From 7a6848210c3b2f42aed4de60646e0e63c0e35fcb Mon Sep 17 00:00:00 2001 From: Yashpal Dutta Date: Thu, 17 Apr 2014 06:57:59 +0545 Subject: [PATCH][fsl 12/15] 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 5d54f7e..33447c8 100644 --- a/crypto/engine/eng_cryptodev.c +++ b/crypto/engine/eng_cryptodev.c @@ -2404,12 +2404,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) @@ -2426,7 +2420,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); @@ -2559,7 +2553,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 */ @@ -2653,7 +2647,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); @@ -2798,7 +2792,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 */ @@ -2899,7 +2893,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; @@ -3035,7 +3029,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 */ @@ -3111,7 +3105,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) @@ -3253,7 +3247,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 */ @@ -3558,7 +3552,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; @@ -3684,9 +3678,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; @@ -3735,7 +3729,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; @@ -3863,9 +3857,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 -- 1.7.9.7