From 469c2c4a455007ca3465b64e88a1dcfc864e3f0e Mon Sep 17 00:00:00 2001 From: Nicola Tuveri Date: Thu, 21 Jun 2018 19:15:50 +0300 Subject: [PATCH] Use ec_group_do_inverse_ord() in SM2 Reviewed-by: Andy Polyakov Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/6521) --- crypto/sm2/sm2_sign.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crypto/sm2/sm2_sign.c b/crypto/sm2/sm2_sign.c index 9d1905439a..14576ca840 100644 --- a/crypto/sm2/sm2_sign.c +++ b/crypto/sm2/sm2_sign.c @@ -11,6 +11,7 @@ #include "internal/sm2.h" #include "internal/sm2err.h" +#include "internal/ec_int.h" /* ec_group_do_inverse_ord() */ #include #include #include @@ -133,7 +134,7 @@ static ECDSA_SIG *sm2_sig_gen(const EC_KEY *key, const BIGNUM *e) continue; if (!BN_add(s, dA, BN_value_one()) - || !BN_mod_inverse(s, s, order, ctx) + || !ec_group_do_inverse_ord(group, s, s, ctx) || !BN_mod_mul(tmp, dA, r, order, ctx) || !BN_sub(tmp, k, tmp) || !BN_mod_mul(s, s, tmp, order, ctx)) { -- 2.34.1