summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorjsing <>2022-11-23 03:10:10 +0000
committerjsing <>2022-11-23 03:10:10 +0000
commit18fd3b0a66fb6b89d05631662dad5467cb0ee3bb (patch)
treeebbcc77732029817b196e897af247c3a859a9ce9 /src/lib
parentbc4574576aa870ae46b89eb9506a76cdccea8db2 (diff)
downloadopenbsd-18fd3b0a66fb6b89d05631662dad5467cb0ee3bb.tar.gz
openbsd-18fd3b0a66fb6b89d05631662dad5467cb0ee3bb.tar.bz2
openbsd-18fd3b0a66fb6b89d05631662dad5467cb0ee3bb.zip
Use bn_wexpand() rather than bn_expand() with sizeof(BN_ULONG).
This also fixes a bug in BN_MONT_CTX_set(), where the sizeof(BN_ULONG) in the call to bn_expand() was not multiplied by eight (to get bits). ok tb@
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/bn/bn_lib.c4
-rw-r--r--src/lib/libcrypto/bn/bn_mont.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c
index 15bbdf1273..1c079b004a 100644
--- a/src/lib/libcrypto/bn/bn_lib.c
+++ b/src/lib/libcrypto/bn/bn_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_lib.c,v 1.59 2022/11/23 03:04:52 jsing Exp $ */ 1/* $OpenBSD: bn_lib.c,v 1.60 2022/11/23 03:10:10 jsing 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 *
@@ -518,7 +518,7 @@ int
518BN_set_word(BIGNUM *a, BN_ULONG w) 518BN_set_word(BIGNUM *a, BN_ULONG w)
519{ 519{
520 bn_check_top(a); 520 bn_check_top(a);
521 if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 521 if (bn_wexpand(a, 1) == NULL)
522 return (0); 522 return (0);
523 a->neg = 0; 523 a->neg = 0;
524 a->d[0] = w; 524 a->d[0] = w;
diff --git a/src/lib/libcrypto/bn/bn_mont.c b/src/lib/libcrypto/bn/bn_mont.c
index e01af702e7..4555f6146b 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.28 2022/02/07 19:44:23 tb Exp $ */ 1/* $OpenBSD: bn_mont.c,v 1.29 2022/11/23 03:10:10 jsing 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 *
@@ -419,7 +419,7 @@ BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
419 } 419 }
420 else /* if N mod word size == 1 */ 420 else /* if N mod word size == 1 */
421 { 421 {
422 if (bn_expand(Ri, (int)sizeof(BN_ULONG) * 2) == NULL) 422 if (bn_wexpand(Ri, 2) == NULL)
423 goto err; 423 goto err;
424 /* Ri-- (mod double word size) */ 424 /* Ri-- (mod double word size) */
425 Ri->neg = 0; 425 Ri->neg = 0;