From 6aaa306cdf878250d7b6eaf30978de313653886b Mon Sep 17 00:00:00 2001 From: Yashpal Dutta Date: Thu, 17 Apr 2014 06:57:59 +0545 Subject: [PATCH 13/26] Removed local copy of curve_t type Upstream-status: Pending Signed-off-by: Yashpal Dutta Tested-by: Cristian Stoica --- crypto/engine/eng_cryptodev.c | 34 ++++++++++++++-------------------- crypto/engine/eng_cryptodev_ec.h | 7 ------- 2 files changed, 14 insertions(+), 27 deletions(-) diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c index ed5f20f..5d883fa 100644 --- a/crypto/engine/eng_cryptodev.c +++ b/crypto/engine/eng_cryptodev.c @@ -2398,12 +2398,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, const BIGNUM *in_r, EC_KEY *eckey) @@ -2420,7 +2414,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); @@ -2553,7 +2547,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 */ @@ -2647,7 +2641,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); @@ -2792,7 +2786,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 */ @@ -2893,7 +2887,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; @@ -3029,7 +3023,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 */ @@ -3105,7 +3099,7 @@ static int cryptodev_ecdsa_verify_async(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 = malloc(sizeof(struct crypt_kop)); if (!kop) @@ -3247,7 +3241,7 @@ static int cryptodev_ecdsa_verify_async(const unsigned char *dgst, int dgst_len, /* 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 */ @@ -3552,7 +3546,7 @@ int cryptodev_ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh, 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; @@ -3678,9 +3672,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; @@ -3729,7 +3723,7 @@ int cryptodev_ecdh_compute_key_async(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh, void *(*KDF)(const void *in, size_t inlen, void *out, 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; @@ -3857,9 +3851,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 77aee71..a4b8da5 100644 --- a/crypto/engine/eng_cryptodev_ec.h +++ b/crypto/engine/eng_cryptodev_ec.h @@ -286,11 +286,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.3.5