summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa/rsa_crpt.c
diff options
context:
space:
mode:
authorbcook <>2016-06-30 02:02:06 +0000
committerbcook <>2016-06-30 02:02:06 +0000
commitf38e0f193e7bb5faea955cd4afea248b830afa18 (patch)
tree0ceecace65c38593a01c1d41cce469bd98529f43 /src/lib/libcrypto/rsa/rsa_crpt.c
parentaa239d08d6dc87fdd121f62e3130aa5d5357cfff (diff)
downloadopenbsd-f38e0f193e7bb5faea955cd4afea248b830afa18.tar.gz
openbsd-f38e0f193e7bb5faea955cd4afea248b830afa18.tar.bz2
openbsd-f38e0f193e7bb5faea955cd4afea248b830afa18.zip
Remove flags for disabling constant-time operations.
This removes support for DSA_FLAG_NO_EXP_CONSTTIME, DH_FLAG_NO_EXP_CONSTTIME, and RSA_FLAG_NO_CONSTTIME flags, making all of these operations unconditionally constant-time. Based on the original patch by César Pereid. ok beck@
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_crpt.c')
-rw-r--r--src/lib/libcrypto/rsa/rsa_crpt.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_crpt.c b/src/lib/libcrypto/rsa/rsa_crpt.c
index 809dd14c92..b50e4a4a6f 100644
--- a/src/lib/libcrypto/rsa/rsa_crpt.c
+++ b/src/lib/libcrypto/rsa/rsa_crpt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_crpt.c,v 1.14 2015/02/11 03:19:37 doug Exp $ */ 1/* $OpenBSD: rsa_crpt.c,v 1.15 2016/06/30 02:02:06 bcook 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 *
@@ -169,8 +169,8 @@ err:
169BN_BLINDING * 169BN_BLINDING *
170RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx) 170RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx)
171{ 171{
172 BIGNUM local_n; 172 BIGNUM *e;
173 BIGNUM *e, *n; 173 BIGNUM n;
174 BN_CTX *ctx; 174 BN_CTX *ctx;
175 BN_BLINDING *ret = NULL; 175 BN_BLINDING *ret = NULL;
176 176
@@ -192,15 +192,11 @@ RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx)
192 } else 192 } else
193 e = rsa->e; 193 e = rsa->e;
194 194
195 if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) { 195 BN_with_flags(&n, rsa->n, BN_FLG_CONSTTIME);
196 /* Set BN_FLG_CONSTTIME flag */
197 n = &local_n;
198 BN_with_flags(n, rsa->n, BN_FLG_CONSTTIME);
199 } else
200 n = rsa->n;
201 196
202 ret = BN_BLINDING_create_param(NULL, e, n, ctx, rsa->meth->bn_mod_exp, 197 ret = BN_BLINDING_create_param(NULL, e, &n, ctx, rsa->meth->bn_mod_exp,
203 rsa->_method_mod_n); 198 rsa->_method_mod_n);
199
204 if (ret == NULL) { 200 if (ret == NULL) {
205 RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_BN_LIB); 201 RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_BN_LIB);
206 goto err; 202 goto err;