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/dsa/dsa_gen.c | |
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/dsa/dsa_gen.c')
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_gen.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_gen.c b/src/lib/libcrypto/dsa/dsa_gen.c index 7ddb7fec5e..d627e5ae9c 100644 --- a/src/lib/libcrypto/dsa/dsa_gen.c +++ b/src/lib/libcrypto/dsa/dsa_gen.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dsa_gen.c,v 1.22 2015/07/15 18:34:37 miod Exp $ */ | 1 | /* $OpenBSD: dsa_gen.c,v 1.23 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 | * |
@@ -68,6 +68,7 @@ | |||
68 | #include <openssl/evp.h> | 68 | #include <openssl/evp.h> |
69 | #include <openssl/sha.h> | 69 | #include <openssl/sha.h> |
70 | 70 | ||
71 | #include "bn_lcl.h" | ||
71 | #include "dsa_locl.h" | 72 | #include "dsa_locl.h" |
72 | 73 | ||
73 | int | 74 | int |
@@ -315,7 +316,7 @@ end: | |||
315 | 316 | ||
316 | for (;;) { | 317 | for (;;) { |
317 | /* g=test^r0%p */ | 318 | /* g=test^r0%p */ |
318 | if (!BN_mod_exp_mont(g, test, r0, p, ctx, mont)) | 319 | if (!BN_mod_exp_mont_ct(g, test, r0, p, ctx, mont)) |
319 | goto err; | 320 | goto err; |
320 | if (!BN_is_one(g)) | 321 | if (!BN_is_one(g)) |
321 | break; | 322 | break; |