diff options
| author | beck <> | 2017-01-21 10:38:29 +0000 |
|---|---|---|
| committer | beck <> | 2017-01-21 10:38:29 +0000 |
| commit | 55a172a1ed5b0cd8f7de3628fcc2e56df6716d59 (patch) | |
| tree | ec1232403b181357067d4ac6dc7124fb566c88d8 /src/lib/libcrypto/dsa | |
| parent | a0a595cda97de2b217b0582cfa601ee4c746bfce (diff) | |
| download | openbsd-55a172a1ed5b0cd8f7de3628fcc2e56df6716d59.tar.gz openbsd-55a172a1ed5b0cd8f7de3628fcc2e56df6716d59.tar.bz2 openbsd-55a172a1ed5b0cd8f7de3628fcc2e56df6716d59.zip | |
Split out BN_div and BN_mod into ct and nonct versions for Internal use.
ok jsing@
Diffstat (limited to 'src/lib/libcrypto/dsa')
| -rw-r--r-- | src/lib/libcrypto/dsa/dsa_ameth.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/dsa/dsa_gen.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/dsa/dsa_ossl.c | 8 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_ameth.c b/src/lib/libcrypto/dsa/dsa_ameth.c index 92ad02e187..b589d39892 100644 --- a/src/lib/libcrypto/dsa/dsa_ameth.c +++ b/src/lib/libcrypto/dsa/dsa_ameth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dsa_ameth.c,v 1.21 2017/01/21 09:38:59 beck Exp $ */ | 1 | /* $OpenBSD: dsa_ameth.c,v 1.22 2017/01/21 10:38:29 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 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -501,7 +501,7 @@ old_dsa_priv_decode(EVP_PKEY *pkey, const unsigned char **pder, int derlen) | |||
| 501 | if (BN_sub(p1, dsa->p, BN_value_one()) == 0) | 501 | if (BN_sub(p1, dsa->p, BN_value_one()) == 0) |
| 502 | goto err; | 502 | goto err; |
| 503 | /* j = (p - 1) / q */ | 503 | /* j = (p - 1) / q */ |
| 504 | if (BN_div(j, NULL, p1, dsa->q, ctx) == 0) | 504 | if (BN_div_ct(j, NULL, p1, dsa->q, ctx) == 0) |
| 505 | goto err; | 505 | goto err; |
| 506 | /* q * j should == p - 1 */ | 506 | /* q * j should == p - 1 */ |
| 507 | if (BN_mul(newp1, dsa->q, j, ctx) == 0) | 507 | if (BN_mul(newp1, dsa->q, j, ctx) == 0) |
diff --git a/src/lib/libcrypto/dsa/dsa_gen.c b/src/lib/libcrypto/dsa/dsa_gen.c index d627e5ae9c..b6bbb8ab08 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.23 2017/01/21 09:38:59 beck Exp $ */ | 1 | /* $OpenBSD: dsa_gen.c,v 1.24 2017/01/21 10:38:29 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 | * |
| @@ -271,7 +271,7 @@ dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits, const EVP_MD *evpmd, | |||
| 271 | /* step 9 */ | 271 | /* step 9 */ |
| 272 | if (!BN_lshift1(r0, q)) | 272 | if (!BN_lshift1(r0, q)) |
| 273 | goto err; | 273 | goto err; |
| 274 | if (!BN_mod(c, X, r0, ctx)) | 274 | if (!BN_mod_ct(c, X, r0, ctx)) |
| 275 | goto err; | 275 | goto err; |
| 276 | if (!BN_sub(r0, c, BN_value_one())) | 276 | if (!BN_sub(r0, c, BN_value_one())) |
| 277 | goto err; | 277 | goto err; |
| @@ -306,7 +306,7 @@ end: | |||
| 306 | /* Set r0=(p-1)/q */ | 306 | /* Set r0=(p-1)/q */ |
| 307 | if (!BN_sub(test, p, BN_value_one())) | 307 | if (!BN_sub(test, p, BN_value_one())) |
| 308 | goto err; | 308 | goto err; |
| 309 | if (!BN_div(r0, NULL, test, q, ctx)) | 309 | if (!BN_div_ct(r0, NULL, test, q, ctx)) |
| 310 | goto err; | 310 | goto err; |
| 311 | 311 | ||
| 312 | if (!BN_set_word(test, h)) | 312 | if (!BN_set_word(test, h)) |
diff --git a/src/lib/libcrypto/dsa/dsa_ossl.c b/src/lib/libcrypto/dsa/dsa_ossl.c index 3f01a83a44..4177557d0e 100644 --- a/src/lib/libcrypto/dsa/dsa_ossl.c +++ b/src/lib/libcrypto/dsa/dsa_ossl.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dsa_ossl.c,v 1.27 2017/01/21 09:38:59 beck Exp $ */ | 1 | /* $OpenBSD: dsa_ossl.c,v 1.28 2017/01/21 10:38:29 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 | * |
| @@ -244,7 +244,7 @@ dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | |||
| 244 | goto err; | 244 | goto err; |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | if (!BN_mod(r,r,dsa->q,ctx)) | 247 | if (!BN_mod_ct(r,r,dsa->q,ctx)) |
| 248 | goto err; | 248 | goto err; |
| 249 | 249 | ||
| 250 | /* Compute part of 's = inv(k) (m + xr) mod q' */ | 250 | /* Compute part of 's = inv(k) (m + xr) mod q' */ |
| @@ -351,10 +351,10 @@ dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, DSA *dsa) | |||
| 351 | mont)) | 351 | mont)) |
| 352 | goto err; | 352 | goto err; |
| 353 | } | 353 | } |
| 354 | 354 | ||
| 355 | /* BN_copy(&u1,&t1); */ | 355 | /* BN_copy(&u1,&t1); */ |
| 356 | /* let u1 = u1 mod q */ | 356 | /* let u1 = u1 mod q */ |
| 357 | if (!BN_mod(&u1, &t1, dsa->q, ctx)) | 357 | if (!BN_mod_ct(&u1, &t1, dsa->q, ctx)) |
| 358 | goto err; | 358 | goto err; |
| 359 | 359 | ||
| 360 | /* V is now in u1. If the signature is correct, it will be | 360 | /* V is now in u1. If the signature is correct, it will be |
