diff options
author | tb <> | 2022-02-07 19:44:23 +0000 |
---|---|---|
committer | tb <> | 2022-02-07 19:44:23 +0000 |
commit | 4f6fe11c9458f94a9e6844c0eefb70e0242edd96 (patch) | |
tree | 37d1b170e3a841492ba556e9f6b259df32a16d1a /src/lib | |
parent | 0ba161420113135230ceb9d4dd293ec8d325cf59 (diff) | |
download | openbsd-4f6fe11c9458f94a9e6844c0eefb70e0242edd96.tar.gz openbsd-4f6fe11c9458f94a9e6844c0eefb70e0242edd96.tar.bz2 openbsd-4f6fe11c9458f94a9e6844c0eefb70e0242edd96.zip |
Check for zero modulus in BN_MONT_CTX_set().
From OpenSSL 6a009812, prompted by a report by Guido Vranken
ok beck jsing
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/bn/bn_mont.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bn/bn_mont.c b/src/lib/libcrypto/bn/bn_mont.c index 45e312a3a6..e01af702e7 100644 --- a/src/lib/libcrypto/bn/bn_mont.c +++ b/src/lib/libcrypto/bn/bn_mont.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bn_mont.c,v 1.27 2021/12/04 16:05:46 tb Exp $ */ | 1 | /* $OpenBSD: bn_mont.c,v 1.28 2022/02/07 19:44:23 tb 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 | * |
@@ -369,6 +369,9 @@ BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) | |||
369 | int ret = 0; | 369 | int ret = 0; |
370 | BIGNUM *Ri, *R; | 370 | BIGNUM *Ri, *R; |
371 | 371 | ||
372 | if (BN_is_zero(mod)) | ||
373 | return 0; | ||
374 | |||
372 | BN_CTX_start(ctx); | 375 | BN_CTX_start(ctx); |
373 | if ((Ri = BN_CTX_get(ctx)) == NULL) | 376 | if ((Ri = BN_CTX_get(ctx)) == NULL) |
374 | goto err; | 377 | goto err; |