From 1a7d37d609b5ce61d0c1454292dd4500859ed65c Mon Sep 17 00:00:00 2001 From: Yashpal Dutta Date: Thu, 17 Apr 2014 06:57:59 +0545 Subject: [PATCH 10/48] Removed local copy of curve_t type Upstream-status: Pending Signed-off-by: Yashpal Dutta Tested-by: Cristian Stoica --- crypto/engine/eng_cryptodev.c | 33 ++++++++++++++------------------- crypto/engine/eng_cryptodev_ec.h | 7 ------- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c index 3686c23..afcf72b 100644 --- a/crypto/engine/eng_cryptodev.c +++ b/crypto/engine/eng_cryptodev.c @@ -2517,11 +2517,6 @@ static ECDSA_METHOD cryptodev_ecdsa = { NULL /* app_data */ }; -typedef enum ec_curve_s { - EC_PRIME, - EC_BINARY -} ec_curve_t; - /* ENGINE handler for ECDSA Sign */ static ECDSA_SIG *cryptodev_ecdsa_do_sign(const unsigned char *dgst, int dgst_len, const BIGNUM *in_kinv, @@ -2540,7 +2535,7 @@ static ECDSA_SIG *cryptodev_ecdsa_do_sign(const unsigned char *dgst, const BIGNUM *order = NULL, *priv_key = NULL; const EC_GROUP *group = NULL; struct crypt_kop kop; - ec_curve_t ec_crv = EC_PRIME; + enum ec_curve_t ec_crv = EC_PRIME; memset(&kop, 0, sizeof(kop)); ecdsa = ecdsa_check(eckey); @@ -2678,7 +2673,7 @@ static ECDSA_SIG *cryptodev_ecdsa_do_sign(const unsigned char *dgst, else goto err; } - kop.curve_type = ECC_BINARY; + kop.curve_type = EC_BINARY; } /* Calculation of Generator point */ @@ -2773,7 +2768,7 @@ static int cryptodev_ecdsa_verify(const unsigned char *dgst, int dgst_len, const EC_POINT *pub_key = NULL; const BIGNUM *order = NULL; const EC_GROUP *group = NULL; - ec_curve_t ec_crv = EC_PRIME; + enum ec_curve_t ec_crv = EC_PRIME; struct crypt_kop kop; memset(&kop, 0, sizeof kop); @@ -2924,7 +2919,7 @@ static int cryptodev_ecdsa_verify(const unsigned char *dgst, int dgst_len, else goto err; } - kop.curve_type = ECC_BINARY; + kop.curve_type = EC_BINARY; } /* Calculation of Generator point */ @@ -3029,7 +3024,7 @@ static int cryptodev_ecdsa_do_sign_async(const unsigned char *dgst, const BIGNUM *order = NULL, *priv_key = NULL; const EC_GROUP *group = NULL; struct crypt_kop *kop = malloc(sizeof(struct crypt_kop)); - ec_curve_t ec_crv = EC_PRIME; + enum ec_curve_t ec_crv = EC_PRIME; if (!(sig->r = BN_new()) || !kop) goto err; @@ -3170,7 +3165,7 @@ static int cryptodev_ecdsa_do_sign_async(const unsigned char *dgst, else goto err; } - kop->curve_type = ECC_BINARY; + kop->curve_type = EC_BINARY; } /* Calculation of Generator point */ @@ -3250,7 +3245,7 @@ static int cryptodev_ecdsa_verify_async(const unsigned char *dgst, const EC_POINT *pub_key = NULL; const BIGNUM *order = NULL; const EC_GROUP *group = NULL; - ec_curve_t ec_crv = EC_PRIME; + enum ec_curve_t ec_crv = EC_PRIME; struct crypt_kop *kop = malloc(sizeof(struct crypt_kop)); if (!kop) @@ -3397,7 +3392,7 @@ static int cryptodev_ecdsa_verify_async(const unsigned char *dgst, if (ec_crv == EC_BINARY) { /* copy b' i.e c(b), instead of only b */ eng_ec_get_cparam(EC_GROUP_get_curve_name(group), ab + q_len, q_len); - kop->curve_type = ECC_BINARY; + kop->curve_type = EC_BINARY; } /* Calculation of Generator point */ @@ -3703,7 +3698,7 @@ int cryptodev_ecdh_compute_key(void *out, size_t outlen, void *(*KDF) (const void *in, size_t inlen, void *out, size_t *outlen)) { - ec_curve_t ec_crv = EC_PRIME; + enum ec_curve_t ec_crv = EC_PRIME; unsigned char *q = NULL, *w_xy = NULL, *ab = NULL, *s = NULL, *r = NULL; BIGNUM *w_x = NULL, *w_y = NULL; int q_len = 0, ab_len = 0, pub_key_len = 0, r_len = 0, priv_key_len = 0; @@ -3833,9 +3828,9 @@ int cryptodev_ecdh_compute_key(void *out, size_t outlen, else goto err; } - kop.curve_type = ECC_BINARY; + kop.curve_type = EC_BINARY; } else - kop.curve_type = ECC_PRIME; + kop.curve_type = EC_PRIME; priv_key_len = r_len; @@ -3887,7 +3882,7 @@ int cryptodev_ecdh_compute_key_async(void *out, size_t outlen, size_t *outlen), struct pkc_cookie_s *cookie) { - ec_curve_t ec_crv = EC_PRIME; + enum ec_curve_t ec_crv = EC_PRIME; unsigned char *q = NULL, *w_xy = NULL, *ab = NULL, *s = NULL, *r = NULL; BIGNUM *w_x = NULL, *w_y = NULL; int q_len = 0, ab_len = 0, pub_key_len = 0, r_len = 0, priv_key_len = 0; @@ -4018,9 +4013,9 @@ int cryptodev_ecdh_compute_key_async(void *out, size_t outlen, else goto err; } - kop->curve_type = ECC_BINARY; + kop->curve_type = EC_BINARY; } else - kop->curve_type = ECC_PRIME; + kop->curve_type = EC_PRIME; priv_key_len = r_len; diff --git a/crypto/engine/eng_cryptodev_ec.h b/crypto/engine/eng_cryptodev_ec.h index af54c51..41a8702 100644 --- a/crypto/engine/eng_cryptodev_ec.h +++ b/crypto/engine/eng_cryptodev_ec.h @@ -287,11 +287,4 @@ static inline unsigned char *eng_copy_curve_points(BIGNUM * x, BIGNUM * y, return xy; } - -enum curve_t { - DISCRETE_LOG, - ECC_PRIME, - ECC_BINARY, - MAX_ECC_TYPE -}; #endif -- 2.7.3