summaryrefslogtreecommitdiffstats
path: root/crypto/sm2
diff options
context:
space:
mode:
authorNicola Tuveri <nic.tuv@gmail.com>2018-06-21 19:15:50 +0300
committerAndy Polyakov <appro@openssl.org>2018-06-25 16:40:51 +0200
commit469c2c4a455007ca3465b64e88a1dcfc864e3f0e (patch)
treefed29232757919070c84913229f4b0a7e452bbfd /crypto/sm2
parent5a2124620cb2893b2d5c40be75579cd9c35c839c (diff)
Use ec_group_do_inverse_ord() in SM2
Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6521)
Diffstat (limited to 'crypto/sm2')
-rw-r--r--crypto/sm2/sm2_sign.c3
1 files changed, 2 insertions, 1 deletions
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 <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/err.h>
@@ -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)) {