summaryrefslogtreecommitdiffstats
path: root/lib/libcrypto/rsa
diff options
context:
space:
mode:
authorbeck <beck@openbsd.org>2017-01-21 09:38:58 +0000
committerbeck <beck@openbsd.org>2017-01-21 09:38:58 +0000
commit3a88f7af64c9d83ff2897421820b88bbc08b8c3c (patch)
tree925330f9f107fcf6d76822e3c46c312356985e6e /lib/libcrypto/rsa
parentwhitespace (diff)
downloadwireguard-openbsd-3a88f7af64c9d83ff2897421820b88bbc08b8c3c.tar.xz
wireguard-openbsd-3a88f7af64c9d83ff2897421820b88bbc08b8c3c.zip
Make explicit _ct and _nonct versions of bn_mod_exp funcitons that
matter for constant time, and make the public interface only used external to the library. This moves us to a model where the important things are constant time versions unless you ask for them not to be, rather than the opposite. I'll continue with this method by method. Add regress tests for same. ok jsing@
Diffstat (limited to 'lib/libcrypto/rsa')
-rw-r--r--lib/libcrypto/rsa/rsa_eay.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libcrypto/rsa/rsa_eay.c b/lib/libcrypto/rsa/rsa_eay.c
index af76541c28f..640ed9a0d6a 100644
--- a/lib/libcrypto/rsa/rsa_eay.c
+++ b/lib/libcrypto/rsa/rsa_eay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_eay.c,v 1.43 2016/09/09 11:39:11 tb Exp $ */
+/* $OpenBSD: rsa_eay.c,v 1.44 2017/01/21 09:38:59 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -118,6 +118,8 @@
#include <openssl/err.h>
#include <openssl/rsa.h>
+#include "bn_lcl.h"
+
static int RSA_eay_public_encrypt(int flen, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
static int RSA_eay_private_encrypt(int flen, const unsigned char *from,
@@ -137,7 +139,7 @@ static RSA_METHOD rsa_pkcs1_eay_meth = {
.rsa_priv_enc = RSA_eay_private_encrypt, /* signing */
.rsa_priv_dec = RSA_eay_private_decrypt,
.rsa_mod_exp = RSA_eay_mod_exp,
- .bn_mod_exp = BN_mod_exp_mont, /* XXX probably we should not use Montgomery if e == 3 */
+ .bn_mod_exp = BN_mod_exp_mont_ct, /* XXX probably we should not use Montgomery if e == 3 */
.init = RSA_eay_init,
.finish = RSA_eay_finish,
};