summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dh/dh_check.c
diff options
context:
space:
mode:
authortb <>2024-11-29 15:59:57 +0000
committertb <>2024-11-29 15:59:57 +0000
commit0c4bef0c67554c96db6dc257452593c5a9b573ec (patch)
tree22254e07ec11cf2eb4ce6ceccc43ec3534201a43 /src/lib/libcrypto/dh/dh_check.c
parent7bf674fac288e15425988251ece54449f398a71c (diff)
downloadopenbsd-0c4bef0c67554c96db6dc257452593c5a9b573ec.tar.gz
openbsd-0c4bef0c67554c96db6dc257452593c5a9b573ec.tar.bz2
openbsd-0c4bef0c67554c96db6dc257452593c5a9b573ec.zip
Remove X9.42 DH rudiments
In the unlikely event that we should ever decide to implement this after a quarter century of not needing it, we can readily put this back. Until then this is dead weight. prompted by a question by djm ok jsing
Diffstat (limited to 'src/lib/libcrypto/dh/dh_check.c')
-rw-r--r--src/lib/libcrypto/dh/dh_check.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/lib/libcrypto/dh/dh_check.c b/src/lib/libcrypto/dh/dh_check.c
index 57330b2068..a880f9fca1 100644
--- a/src/lib/libcrypto/dh/dh_check.c
+++ b/src/lib/libcrypto/dh/dh_check.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh_check.c,v 1.29 2024/08/30 17:44:56 tb Exp $ */ 1/* $OpenBSD: dh_check.c,v 1.30 2024/11/29 15:59:57 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 *
@@ -127,10 +127,8 @@ DH_check(const DH *dh, int *flags)
127 BN_CTX_start(ctx); 127 BN_CTX_start(ctx);
128 128
129 if (dh->q != NULL) { 129 if (dh->q != NULL) {
130 BIGNUM *quotient, *residue; 130 BIGNUM *residue;
131 131
132 if ((quotient = BN_CTX_get(ctx)) == NULL)
133 goto err;
134 if ((residue = BN_CTX_get(ctx)) == NULL) 132 if ((residue = BN_CTX_get(ctx)) == NULL)
135 goto err; 133 goto err;
136 if ((*flags & DH_NOT_SUITABLE_GENERATOR) == 0) { 134 if ((*flags & DH_NOT_SUITABLE_GENERATOR) == 0) {
@@ -147,12 +145,10 @@ DH_check(const DH *dh, int *flags)
147 if (is_prime == 0) 145 if (is_prime == 0)
148 *flags |= DH_CHECK_Q_NOT_PRIME; 146 *flags |= DH_CHECK_Q_NOT_PRIME;
149 /* Check p == 1 mod q, i.e., q divides p - 1 */ 147 /* Check p == 1 mod q, i.e., q divides p - 1 */
150 if (!BN_div_ct(quotient, residue, dh->p, dh->q, ctx)) 148 if (!BN_div_ct(NULL, residue, dh->p, dh->q, ctx))
151 goto err; 149 goto err;
152 if (!BN_is_one(residue)) 150 if (!BN_is_one(residue))
153 *flags |= DH_CHECK_INVALID_Q_VALUE; 151 *flags |= DH_CHECK_INVALID_Q_VALUE;
154 if (dh->j != NULL && BN_cmp(dh->j, quotient) != 0)
155 *flags |= DH_CHECK_INVALID_J_VALUE;
156 } 152 }
157 153
158 is_prime = BN_is_prime_ex(dh->p, DH_NUMBER_ITERATIONS_FOR_PRIME, 154 is_prime = BN_is_prime_ex(dh->p, DH_NUMBER_ITERATIONS_FOR_PRIME,