summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa/rsa_eay.c
diff options
context:
space:
mode:
authorbeck <>2017-01-21 09:38:59 +0000
committerbeck <>2017-01-21 09:38:59 +0000
commitba7dab5b77b1e4dd797dbe7a4c31b5f4cbea0cd7 (patch)
treea68beae7892dad13fd8d76ba1fc45e6570e3360b /src/lib/libcrypto/rsa/rsa_eay.c
parent0c45e4e4d42eacefe309063241d5a7f6de6674e7 (diff)
downloadopenbsd-ba7dab5b77b1e4dd797dbe7a4c31b5f4cbea0cd7.tar.gz
openbsd-ba7dab5b77b1e4dd797dbe7a4c31b5f4cbea0cd7.tar.bz2
openbsd-ba7dab5b77b1e4dd797dbe7a4c31b5f4cbea0cd7.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 'src/lib/libcrypto/rsa/rsa_eay.c')
-rw-r--r--src/lib/libcrypto/rsa/rsa_eay.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c
index af76541c28..640ed9a0d6 100644
--- a/src/lib/libcrypto/rsa/rsa_eay.c
+++ b/src/lib/libcrypto/rsa/rsa_eay.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_eay.c,v 1.43 2016/09/09 11:39:11 tb Exp $ */ 1/* $OpenBSD: rsa_eay.c,v 1.44 2017/01/21 09:38:59 beck Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -118,6 +118,8 @@
118#include <openssl/err.h> 118#include <openssl/err.h>
119#include <openssl/rsa.h> 119#include <openssl/rsa.h>
120 120
121#include "bn_lcl.h"
122
121static int RSA_eay_public_encrypt(int flen, const unsigned char *from, 123static int RSA_eay_public_encrypt(int flen, const unsigned char *from,
122 unsigned char *to, RSA *rsa, int padding); 124 unsigned char *to, RSA *rsa, int padding);
123static int RSA_eay_private_encrypt(int flen, const unsigned char *from, 125static int RSA_eay_private_encrypt(int flen, const unsigned char *from,
@@ -137,7 +139,7 @@ static RSA_METHOD rsa_pkcs1_eay_meth = {
137 .rsa_priv_enc = RSA_eay_private_encrypt, /* signing */ 139 .rsa_priv_enc = RSA_eay_private_encrypt, /* signing */
138 .rsa_priv_dec = RSA_eay_private_decrypt, 140 .rsa_priv_dec = RSA_eay_private_decrypt,
139 .rsa_mod_exp = RSA_eay_mod_exp, 141 .rsa_mod_exp = RSA_eay_mod_exp,
140 .bn_mod_exp = BN_mod_exp_mont, /* XXX probably we should not use Montgomery if e == 3 */ 142 .bn_mod_exp = BN_mod_exp_mont_ct, /* XXX probably we should not use Montgomery if e == 3 */
141 .init = RSA_eay_init, 143 .init = RSA_eay_init,
142 .finish = RSA_eay_finish, 144 .finish = RSA_eay_finish,
143}; 145};