diff options
author | beck <> | 2017-01-21 09:38:59 +0000 |
---|---|---|
committer | beck <> | 2017-01-21 09:38:59 +0000 |
commit | ba7dab5b77b1e4dd797dbe7a4c31b5f4cbea0cd7 (patch) | |
tree | a68beae7892dad13fd8d76ba1fc45e6570e3360b /src/lib/libcrypto/dh | |
parent | 0c45e4e4d42eacefe309063241d5a7f6de6674e7 (diff) | |
download | openbsd-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/dh')
-rw-r--r-- | src/lib/libcrypto/dh/dh_key.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/libcrypto/dh/dh_key.c b/src/lib/libcrypto/dh/dh_key.c index 6eb1365bf6..5b365cdd06 100644 --- a/src/lib/libcrypto/dh/dh_key.c +++ b/src/lib/libcrypto/dh/dh_key.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dh_key.c,v 1.25 2016/07/07 11:53:12 bcook Exp $ */ | 1 | /* $OpenBSD: dh_key.c,v 1.26 2017/01/21 09:38:58 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 | * |
@@ -62,6 +62,8 @@ | |||
62 | #include <openssl/dh.h> | 62 | #include <openssl/dh.h> |
63 | #include <openssl/err.h> | 63 | #include <openssl/err.h> |
64 | 64 | ||
65 | #include "bn_lcl.h" | ||
66 | |||
65 | static int generate_key(DH *dh); | 67 | static int generate_key(DH *dh); |
66 | static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); | 68 | static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); |
67 | static int dh_bn_mod_exp(const DH *dh, BIGNUM *r, const BIGNUM *a, | 69 | static int dh_bn_mod_exp(const DH *dh, BIGNUM *r, const BIGNUM *a, |
@@ -233,7 +235,7 @@ static int | |||
233 | dh_bn_mod_exp(const DH *dh, BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | 235 | dh_bn_mod_exp(const DH *dh, BIGNUM *r, const BIGNUM *a, const BIGNUM *p, |
234 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) | 236 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) |
235 | { | 237 | { |
236 | return BN_mod_exp_mont(r, a, p, m, ctx, m_ctx); | 238 | return BN_mod_exp_mont_ct(r, a, p, m, ctx, m_ctx); |
237 | } | 239 | } |
238 | 240 | ||
239 | static int | 241 | static int |