Update pre9
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -95,7 +95,7 @@ int sm2_ciphertext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len,
|
||||
if (field_size == 0 || md_size < 0)
|
||||
return 0;
|
||||
|
||||
*ct_size = 10 + 2 * field_size + (size_t)md_size + msg_len;
|
||||
*ct_size = 12 + 2 * field_size + (size_t)md_size + msg_len;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -111,11 +111,11 @@ static ECDSA_SIG *sm2_sig_gen(const EC_KEY *key, const BIGNUM *e)
|
||||
for (;;) {
|
||||
if (!BN_priv_rand_range(k, order)) {
|
||||
SM2err(SM2_F_SM2_SIG_GEN, ERR_R_INTERNAL_ERROR);
|
||||
goto done;
|
||||
goto done;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
+5
-5
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user