diff options
-rw-r--r-- | ecp/src/ecp/cr.h | 4 | ||||
-rw-r--r-- | ecp/src/ecp/crypto/crypto.c | 23 | ||||
-rw-r--r-- | ecp/src/ecp/crypto/crypto.h | 8 |
3 files changed, 0 insertions, 35 deletions
diff --git a/ecp/src/ecp/cr.h b/ecp/src/ecp/cr.h index c5046ed..f5a617d 100644 --- a/ecp/src/ecp/cr.h +++ b/ecp/src/ecp/cr.h @@ -15,8 +15,4 @@ int ecp_ecdsa_mkpair(ecp_ecdsa_public_t *pub, ecp_ecdsa_private_t *priv); int ecp_ecdsa_sign(ecp_ecdsa_signature_t *sig, unsigned char *m, size_t ml, ecp_ecdsa_private_t *k); int ecp_ecdsa_verify(unsigned char *m, size_t ml, ecp_ecdsa_signature_t *sig, ecp_ecdsa_public_t *p); -int ecp_bc_key_gen(ecp_bc_ctx_t *key); -void ecp_bc_encrypt_block(unsigned char *in, unsigned char *out, ecp_bc_ctx_t *key); -void ecp_bc_decrypt_block(unsigned char *in, unsigned char *out, ecp_bc_ctx_t *key); - void ecp_hmac(unsigned char *hd, ecp_hmac_key_t *k, unsigned char *m, size_t ml); diff --git a/ecp/src/ecp/crypto/crypto.c b/ecp/src/ecp/crypto/crypto.c index 8a78702..2909f47 100644 --- a/ecp/src/ecp/crypto/crypto.c +++ b/ecp/src/ecp/crypto/crypto.c @@ -104,29 +104,6 @@ int ecp_ecdsa_verify(unsigned char *m, size_t ml, ecp_ecdsa_signature_t *sig, ec return ECP_ERR_VERIFY; } -int ecp_bc_key_gen(ecp_bc_ctx_t *key) { - unsigned char _key[ECP_SIZE_BC_KEY]; - int rv; - - arc4random_buf(_key, sizeof(_key)); - - rv = AES_set_encrypt_key(_key, ECP_SIZE_BC_KEY * 8, &key->ctx_enc); - if (rv < 0) return ECP_ERR; - - rv = AES_set_decrypt_key(_key, ECP_SIZE_BC_KEY * 8, &key->ctx_dec); - if (rv < 0) return ECP_ERR; - - return ECP_OK; -} - -void ecp_bc_encrypt_block(unsigned char *in, unsigned char *out, ecp_bc_ctx_t *key) { - AES_encrypt(in, out, &key->ctx_enc); -} - -void ecp_bc_decrypt_block(unsigned char *in, unsigned char *out, ecp_bc_ctx_t *key) { - AES_decrypt(in, out, &key->ctx_dec); -} - void ecp_hmac(unsigned char *hd, ecp_hmac_key_t *k, unsigned char *m, size_t ml) { unsigned char b[SHA_CBLOCK]; unsigned char d[SHA_DIGEST_LENGTH]; diff --git a/ecp/src/ecp/crypto/crypto.h b/ecp/src/ecp/crypto/crypto.h index f2986d0..1320fb8 100644 --- a/ecp/src/ecp/crypto/crypto.h +++ b/ecp/src/ecp/crypto/crypto.h @@ -1,4 +1,3 @@ -#include <openssl/aes.h> #include <openssl/sha.h> #define CURVE25519_SIZE_KEY 32 @@ -19,9 +18,6 @@ #define ECP_SIZE_HMAC_KEY 32 #define ECP_SIZE_HMAC_DIGEST SHA_DIGEST_LENGTH -#define ECP_SIZE_BC_KEY 16 -#define ECP_SIZE_BC_BLOCK 16 - typedef uint8_t ecp_ecdh_public_t[ECP_SIZE_ECDH_PUB]; typedef uint8_t ecp_ecdh_private_t[ECP_SIZE_ECDH_SEC]; typedef uint8_t ecp_aead_key_t[ECP_SIZE_AEAD_KEY]; @@ -30,10 +26,6 @@ typedef uint8_t ecp_ecdsa_public_t[ECP_SIZE_ECDSA_PUB]; typedef uint8_t ecp_ecdsa_private_t[ECP_SIZE_ECDSA_SEC]; typedef uint8_t ecp_ecdsa_signature_t[ECP_SIZE_ECDSA_SIG]; typedef uint8_t ecp_hmac_key_t[ECP_SIZE_HMAC_KEY]; -typedef struct { - AES_KEY ctx_enc; - AES_KEY ctx_dec; -} ecp_bc_ctx_t; int aead_chacha20_poly1305_seal(unsigned char key[32], unsigned char tag_len, |