diff options
author | tb <> | 2025-01-22 12:53:16 +0000 |
---|---|---|
committer | tb <> | 2025-01-22 12:53:16 +0000 |
commit | 9265252033e95a736d43b21bf2437b3629938ed4 (patch) | |
tree | 2b47411c7eb51d58cdc8980be3dbed8393083da5 /src/lib/libcrypto/bn/bn_recp.c | |
parent | 24c9cd684d5ef027d5484a39a092c8018d6936a5 (diff) | |
download | openbsd-9265252033e95a736d43b21bf2437b3629938ed4.tar.gz openbsd-9265252033e95a736d43b21bf2437b3629938ed4.tar.bz2 openbsd-9265252033e95a736d43b21bf2437b3629938ed4.zip |
bn_recp: Avoid complication for negative moduli
Instead of doing a weird dance, set the sign on N in BN_RECP_CTX_create().
Since we're not exposing a general purpose calculator API, we can simplify.
ok jsing
Diffstat (limited to 'src/lib/libcrypto/bn/bn_recp.c')
-rw-r--r-- | src/lib/libcrypto/bn/bn_recp.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bn/bn_recp.c b/src/lib/libcrypto/bn/bn_recp.c index 6277b06dab..8f917e95db 100644 --- a/src/lib/libcrypto/bn/bn_recp.c +++ b/src/lib/libcrypto/bn/bn_recp.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bn_recp.c,v 1.29 2025/01/22 10:12:01 tb Exp $ */ | 1 | /* $OpenBSD: bn_recp.c,v 1.30 2025/01/22 12:53:16 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 | * |
@@ -79,6 +79,7 @@ BN_RECP_CTX_create(const BIGNUM *N) | |||
79 | 79 | ||
80 | if ((recp->N = BN_dup(N)) == NULL) | 80 | if ((recp->N = BN_dup(N)) == NULL) |
81 | goto err; | 81 | goto err; |
82 | BN_set_negative(recp->N, 0); | ||
82 | recp->num_bits = BN_num_bits(recp->N); | 83 | recp->num_bits = BN_num_bits(recp->N); |
83 | 84 | ||
84 | if ((recp->Nr = BN_new()) == NULL) | 85 | if ((recp->Nr = BN_new()) == NULL) |