diff options
| author | tb <> | 2022-02-07 19:44:23 +0000 |
|---|---|---|
| committer | tb <> | 2022-02-07 19:44:23 +0000 |
| commit | ba7fe30fcf200c09c61915f9a3cd9eb665e5e277 (patch) | |
| tree | 37d1b170e3a841492ba556e9f6b259df32a16d1a /src | |
| parent | cbae1c6b17b1dd98f4e23b27675d1f263d248353 (diff) | |
| download | openbsd-ba7fe30fcf200c09c61915f9a3cd9eb665e5e277.tar.gz openbsd-ba7fe30fcf200c09c61915f9a3cd9eb665e5e277.tar.bz2 openbsd-ba7fe30fcf200c09c61915f9a3cd9eb665e5e277.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')
| -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; |
