From bce45cc241b51da39ead8b476c811b47d76ccc46 Mon Sep 17 00:00:00 2001 From: beck <> Date: Sat, 21 Jan 2017 10:38:29 +0000 Subject: Split out BN_div and BN_mod into ct and nonct versions for Internal use. ok jsing@ --- src/lib/libcrypto/gost/gostr341001.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/lib/libcrypto/gost') diff --git a/src/lib/libcrypto/gost/gostr341001.c b/src/lib/libcrypto/gost/gostr341001.c index c6221e4a01..5fb494009c 100644 --- a/src/lib/libcrypto/gost/gostr341001.c +++ b/src/lib/libcrypto/gost/gostr341001.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gostr341001.c,v 1.4 2015/02/14 06:40:04 jsing Exp $ */ +/* $OpenBSD: gostr341001.c,v 1.5 2017/01/21 10:38:29 beck Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD @@ -57,6 +57,8 @@ #include #include #include + +#include "bn_lcl.h" #include "gost_locl.h" /* Convert little-endian byte array into bignum */ @@ -175,7 +177,7 @@ gost2001_do_sign(BIGNUM *md, GOST_KEY *eckey) priv_key = GOST_KEY_get0_private_key(eckey); if ((e = BN_CTX_get(ctx)) == NULL) goto err; - if (BN_mod(e, md, order, ctx) == 0) + if (BN_mod_ct(e, md, order, ctx) == 0) goto err; if (BN_is_zero(e)) BN_one(e); @@ -288,7 +290,7 @@ gost2001_do_verify(BIGNUM *md, ECDSA_SIG *sig, GOST_KEY *ec) goto err; } - if (BN_mod(e, md, order, ctx) == 0) + if (BN_mod_ct(e, md, order, ctx) == 0) goto err; if (BN_is_zero(e)) BN_one(e); @@ -310,7 +312,7 @@ gost2001_do_verify(BIGNUM *md, ECDSA_SIG *sig, GOST_KEY *ec) GOSTerr(GOST_F_GOST2001_DO_VERIFY, ERR_R_EC_LIB); goto err; } - if (BN_mod(R, X, order, ctx) == 0) + if (BN_mod_ct(R, X, order, ctx) == 0) goto err; if (BN_cmp(R, sig->r) != 0) { GOSTerr(GOST_F_GOST2001_DO_VERIFY, GOST_R_SIGNATURE_MISMATCH); -- cgit v1.2.3-55-g6feb