summaryrefslogtreecommitdiff
path: root/lib/libcrypto/gost
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2017-01-21 10:38:30 +0000
committerBob Beck <beck@cvs.openbsd.org>2017-01-21 10:38:30 +0000
commitff6c5b2d728313569b09c4ec269eb7f0fb2023e3 (patch)
treec4e87e40c7c000af9141ad1143b2dca18ec24c63 /lib/libcrypto/gost
parent485104e2d443c36382923c3c23cc2f275e7ed81c (diff)
Split out BN_div and BN_mod into ct and nonct versions for Internal use.
ok jsing@
Diffstat (limited to 'lib/libcrypto/gost')
-rw-r--r--lib/libcrypto/gost/gostr341001.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libcrypto/gost/gostr341001.c b/lib/libcrypto/gost/gostr341001.c
index c6221e4a012..5fb494009c5 100644
--- a/lib/libcrypto/gost/gostr341001.c
+++ b/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 <dbaryshkov@gmail.com>
* Copyright (c) 2005-2006 Cryptocom LTD
@@ -57,6 +57,8 @@
#include <openssl/bn.h>
#include <openssl/err.h>
#include <openssl/gost.h>
+
+#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);