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/pem | |
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/pem')
-rw-r--r-- | src/lib/libcrypto/pem/pvkfmt.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/libcrypto/pem/pvkfmt.c b/src/lib/libcrypto/pem/pvkfmt.c index 7a9045396c..0a33a24b9f 100644 --- a/src/lib/libcrypto/pem/pvkfmt.c +++ b/src/lib/libcrypto/pem/pvkfmt.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pvkfmt.c,v 1.16 2016/03/02 14:28:14 beck Exp $ */ | 1 | /* $OpenBSD: pvkfmt.c,v 1.17 2017/01/21 09:38:59 beck Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2005. | 3 | * project 2005. |
4 | */ | 4 | */ |
@@ -73,6 +73,8 @@ | |||
73 | #include <openssl/dsa.h> | 73 | #include <openssl/dsa.h> |
74 | #include <openssl/rsa.h> | 74 | #include <openssl/rsa.h> |
75 | 75 | ||
76 | #include "bn_lcl.h" | ||
77 | |||
76 | /* Utility function: read a DWORD (4 byte unsigned integer) in little endian | 78 | /* Utility function: read a DWORD (4 byte unsigned integer) in little endian |
77 | * format | 79 | * format |
78 | */ | 80 | */ |
@@ -340,7 +342,7 @@ b2i_dss(const unsigned char **in, unsigned int length, unsigned int bitlen, | |||
340 | goto memerr; | 342 | goto memerr; |
341 | if (!(ctx = BN_CTX_new())) | 343 | if (!(ctx = BN_CTX_new())) |
342 | goto memerr; | 344 | goto memerr; |
343 | if (!BN_mod_exp(dsa->pub_key, dsa->g, | 345 | if (!BN_mod_exp_ct(dsa->pub_key, dsa->g, |
344 | dsa->priv_key, dsa->p, ctx)) | 346 | dsa->priv_key, dsa->p, ctx)) |
345 | goto memerr; | 347 | goto memerr; |
346 | BN_CTX_free(ctx); | 348 | BN_CTX_free(ctx); |