Update pre9

This commit is contained in:
2018-08-01 15:34:01 +09:00
parent 46f6b5e2fe
commit 0961fd12de
113 changed files with 2568 additions and 901 deletions
+7 -7
View File
@@ -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;
}