diff options
author | Matt Caswell <matt@openssl.org> | 2018-07-30 16:40:18 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2018-07-31 09:08:38 +0100 |
commit | 9cc570d4c419e2ca97e2173dc14c484195502dd4 (patch) | |
tree | c5ca35dd93fa1305ce979ff094e1755fb5b03c13 /crypto/sm2 | |
parent | de34e45a64f0865264b826255adbe7aee7470780 (diff) |
Use the new non-curve type specific EC functions internally
Fixes #6646
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6815)
Diffstat (limited to 'crypto/sm2')
-rw-r--r-- | crypto/sm2/sm2_crypt.c | 12 | ||||
-rw-r--r-- | crypto/sm2/sm2_sign.c | 4 | ||||
-rw-r--r-- | crypto/sm2/sm2_za.c | 10 |
3 files changed, 13 insertions, 13 deletions
diff --git a/crypto/sm2/sm2_crypt.c b/crypto/sm2/sm2_crypt.c index d6f9c81d8c..9e7887320c 100644 --- a/crypto/sm2/sm2_crypt.c +++ b/crypto/sm2/sm2_crypt.c @@ -48,7 +48,7 @@ static size_t ec_field_size(const EC_GROUP *group) if (p == NULL || a == NULL || b == NULL) goto done; - if (!EC_GROUP_get_curve_GFp(group, p, a, b, NULL)) + if (!EC_GROUP_get_curve(group, p, a, b, NULL)) goto done; field_size = (BN_num_bits(p) + 7) / 8; @@ -176,9 +176,9 @@ int sm2_encrypt(const EC_KEY *key, } if (!EC_POINT_mul(group, kG, k, NULL, NULL, ctx) - || !EC_POINT_get_affine_coordinates_GFp(group, kG, x1, y1, ctx) + || !EC_POINT_get_affine_coordinates(group, kG, x1, y1, ctx) || !EC_POINT_mul(group, kP, NULL, P, k, ctx) - || !EC_POINT_get_affine_coordinates_GFp(group, kP, x2, y2, ctx)) { + || !EC_POINT_get_affine_coordinates(group, kP, x2, y2, ctx)) { SM2err(SM2_F_SM2_ENCRYPT, ERR_R_EC_LIB); goto done; } @@ -326,11 +326,11 @@ int sm2_decrypt(const EC_KEY *key, goto done; } - if (!EC_POINT_set_affine_coordinates_GFp(group, C1, sm2_ctext->C1x, - sm2_ctext->C1y, ctx) + if (!EC_POINT_set_affine_coordinates(group, C1, sm2_ctext->C1x, + sm2_ctext->C1y, ctx) || !EC_POINT_mul(group, C1, NULL, C1, EC_KEY_get0_private_key(key), ctx) - || !EC_POINT_get_affine_coordinates_GFp(group, C1, x2, y2, ctx)) { + || !EC_POINT_get_affine_coordinates(group, C1, x2, y2, ctx)) { SM2err(SM2_F_SM2_DECRYPT, ERR_R_EC_LIB); goto done; } diff --git a/crypto/sm2/sm2_sign.c b/crypto/sm2/sm2_sign.c index 1244c05ea8..f1185c1337 100644 --- a/crypto/sm2/sm2_sign.c +++ b/crypto/sm2/sm2_sign.c @@ -115,7 +115,7 @@ static ECDSA_SIG *sm2_sig_gen(const EC_KEY *key, const BIGNUM *e) } if (!EC_POINT_mul(group, kG, k, NULL, NULL, ctx) - || !EC_POINT_get_affine_coordinates_GFp(group, kG, x1, NULL, + || !EC_POINT_get_affine_coordinates(group, kG, x1, NULL, ctx) || !BN_mod_add(r, e, x1, order, ctx)) { SM2err(SM2_F_SM2_SIG_GEN, ERR_R_INTERNAL_ERROR); @@ -224,7 +224,7 @@ static int sm2_sig_verify(const EC_KEY *key, const ECDSA_SIG *sig, } if (!EC_POINT_mul(group, pt, s, EC_KEY_get0_public_key(key), t, ctx) - || !EC_POINT_get_affine_coordinates_GFp(group, pt, x1, NULL, ctx)) { + || !EC_POINT_get_affine_coordinates(group, pt, x1, NULL, ctx)) { SM2err(SM2_F_SM2_SIG_VERIFY, ERR_R_EC_LIB); goto done; } diff --git a/crypto/sm2/sm2_za.c b/crypto/sm2/sm2_za.c index 8f45082db4..320bee1e18 100644 --- a/crypto/sm2/sm2_za.c +++ b/crypto/sm2/sm2_za.c @@ -87,7 +87,7 @@ int sm2_compute_userid_digest(uint8_t *out, goto done; } - if (!EC_GROUP_get_curve_GFp(group, p, a, b, ctx)) { + if (!EC_GROUP_get_curve(group, p, a, b, ctx)) { SM2err(SM2_F_SM2_COMPUTE_USERID_DIGEST, ERR_R_EC_LIB); goto done; } @@ -103,16 +103,16 @@ int sm2_compute_userid_digest(uint8_t *out, || !EVP_DigestUpdate(hash, buf, p_bytes) || BN_bn2binpad(b, buf, p_bytes) < 0 || !EVP_DigestUpdate(hash, buf, p_bytes) - || !EC_POINT_get_affine_coordinates_GFp(group, + || !EC_POINT_get_affine_coordinates(group, EC_GROUP_get0_generator(group), xG, yG, ctx) || BN_bn2binpad(xG, buf, p_bytes) < 0 || !EVP_DigestUpdate(hash, buf, p_bytes) || BN_bn2binpad(yG, buf, p_bytes) < 0 || !EVP_DigestUpdate(hash, buf, p_bytes) - || !EC_POINT_get_affine_coordinates_GFp(group, - EC_KEY_get0_public_key(key), - xA, yA, ctx) + || !EC_POINT_get_affine_coordinates(group, + EC_KEY_get0_public_key(key), + xA, yA, ctx) || BN_bn2binpad(xA, buf, p_bytes) < 0 || !EVP_DigestUpdate(hash, buf, p_bytes) || BN_bn2binpad(yA, buf, p_bytes) < 0 |