summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2023-08-20 22:20:12 +0000
committertb <>2023-08-20 22:20:12 +0000
commit720c5a593841a16f4700d1d3d03e6221f49cda32 (patch)
tree6b7ef267f9fba319fbcf0912a916e2b8b372cea5
parenta423f849cdbd330b704f84d929dceca2b4889824 (diff)
downloadopenbsd-720c5a593841a16f4700d1d3d03e6221f49cda32.tar.gz
openbsd-720c5a593841a16f4700d1d3d03e6221f49cda32.tar.bz2
openbsd-720c5a593841a16f4700d1d3d03e6221f49cda32.zip
Use a separate flags variable for the error flags in DH_check()
-rw-r--r--src/regress/lib/libcrypto/dh/dhtest.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/regress/lib/libcrypto/dh/dhtest.c b/src/regress/lib/libcrypto/dh/dhtest.c
index 00eb23079f..41bc0b2e2d 100644
--- a/src/regress/lib/libcrypto/dh/dhtest.c
+++ b/src/regress/lib/libcrypto/dh/dhtest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dhtest.c,v 1.12 2023/08/12 06:30:43 tb Exp $ */ 1/* $OpenBSD: dhtest.c,v 1.13 2023/08/20 22:20:12 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 *
@@ -98,7 +98,8 @@ main(int argc, char *argv[])
98 BN_GENCB *_cb; 98 BN_GENCB *_cb;
99 DH *dh = NULL; 99 DH *dh = NULL;
100 unsigned char *buf = NULL; 100 unsigned char *buf = NULL;
101 int i, buf_len, secret_len; 101 int flags, buf_len, secret_len;
102 int i;
102 int ret = 1; 103 int ret = 1;
103 104
104 if ((_cb = BN_GENCB_new()) == NULL) 105 if ((_cb = BN_GENCB_new()) == NULL)
@@ -118,15 +119,15 @@ main(int argc, char *argv[])
118 if (!DH_generate_parameters_ex(dh, 64, DH_GENERATOR_5, _cb)) 119 if (!DH_generate_parameters_ex(dh, 64, DH_GENERATOR_5, _cb))
119 goto err; 120 goto err;
120 121
121 if (!DH_check(dh, &i)) 122 if (!DH_check(dh, &flags))
122 goto err; 123 goto err;
123 if (i & DH_CHECK_P_NOT_PRIME) 124 if (flags & DH_CHECK_P_NOT_PRIME)
124 printf("p value is not prime\n"); 125 printf("p value is not prime\n");
125 if (i & DH_CHECK_P_NOT_SAFE_PRIME) 126 if (flags & DH_CHECK_P_NOT_SAFE_PRIME)
126 printf("p value is not a safe prime\n"); 127 printf("p value is not a safe prime\n");
127 if (i & DH_UNABLE_TO_CHECK_GENERATOR) 128 if (flags & DH_UNABLE_TO_CHECK_GENERATOR)
128 printf("unable to check the generator value\n"); 129 printf("unable to check the generator value\n");
129 if (i & DH_NOT_SUITABLE_GENERATOR) 130 if (flags & DH_NOT_SUITABLE_GENERATOR)
130 printf("the g value is not a generator\n"); 131 printf("the g value is not a generator\n");
131 132
132 printf("\np = "); 133 printf("\np = ");