Skip to content

Commit f9bcf55

Browse files
author
tb
committed
Check for zero modulus in BN_MONT_CTX_set().
From OpenSSL 6a009812, prompted by a report by Guido Vranken ok beck jsing
1 parent dd9667a commit f9bcf55

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/lib/libcrypto/bn/bn_mont.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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 $ */
22
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
33
* All rights reserved.
44
*
@@ -369,6 +369,9 @@ BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
369369
int ret = 0;
370370
BIGNUM *Ri, *R;
371371

372+
if (BN_is_zero(mod))
373+
return 0;
374+
372375
BN_CTX_start(ctx);
373376
if ((Ri = BN_CTX_get(ctx)) == NULL)
374377
goto err;

0 commit comments

Comments
 (0)