summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2023-08-12 06:30:43 +0000
committertb <>2023-08-12 06:30:43 +0000
commitee8f35a481544e1c6c9d242ebca90dff32e0a3c2 (patch)
treea3d51c7f60cc2041098f91db7b498d75196d7d45 /src
parent725eaa09b2466cc790c34568af765f98f47f5804 (diff)
downloadopenbsd-ee8f35a481544e1c6c9d242ebca90dff32e0a3c2.tar.gz
openbsd-ee8f35a481544e1c6c9d242ebca90dff32e0a3c2.tar.bz2
openbsd-ee8f35a481544e1c6c9d242ebca90dff32e0a3c2.zip
Now that the DH is sensibly called dh instead of a, we can also rename
abuf, alen and aout to names that make sense, such as buf, buf_len and secret_len.
Diffstat (limited to 'src')
-rw-r--r--src/regress/lib/libcrypto/dh/dhtest.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/regress/lib/libcrypto/dh/dhtest.c b/src/regress/lib/libcrypto/dh/dhtest.c
index 7bd278b1b6..00eb23079f 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.11 2023/08/12 06:28:04 tb Exp $ */ 1/* $OpenBSD: dhtest.c,v 1.12 2023/08/12 06:30:43 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 *
@@ -97,8 +97,8 @@ main(int argc, char *argv[])
97{ 97{
98 BN_GENCB *_cb; 98 BN_GENCB *_cb;
99 DH *dh = NULL; 99 DH *dh = NULL;
100 unsigned char *abuf = NULL; 100 unsigned char *buf = NULL;
101 int i, alen, aout; 101 int i, buf_len, secret_len;
102 int ret = 1; 102 int ret = 1;
103 103
104 if ((_cb = BN_GENCB_new()) == NULL) 104 if ((_cb = BN_GENCB_new()) == NULL)
@@ -147,18 +147,18 @@ main(int argc, char *argv[])
147 goto err; 147 goto err;
148 printf("\n"); 148 printf("\n");
149 149
150 alen = DH_size(dh); 150 buf_len = DH_size(dh);
151 if ((abuf = malloc(alen)) == NULL) 151 if ((buf = malloc(buf_len)) == NULL)
152 err(1, "malloc"); 152 err(1, "malloc");
153 aout = DH_compute_key(abuf, DH_get0_pub_key(dh), dh); 153 secret_len = DH_compute_key(buf, DH_get0_pub_key(dh), dh);
154 154
155 printf("key1 = "); 155 printf("key1 = ");
156 for (i = 0; i < aout; i++) { 156 for (i = 0; i < secret_len; i++) {
157 printf("%02X", abuf[i]); 157 printf("%02X", buf[i]);
158 } 158 }
159 printf("\n"); 159 printf("\n");
160 160
161 if (aout < 4) { 161 if (secret_len < 4) {
162 fprintf(stderr, "Error in DH routines\n"); 162 fprintf(stderr, "Error in DH routines\n");
163 goto err; 163 goto err;
164 } 164 }
@@ -167,7 +167,7 @@ main(int argc, char *argv[])
167err: 167err:
168 ERR_print_errors_fp(stderr); 168 ERR_print_errors_fp(stderr);
169 169
170 free(abuf); 170 free(buf);
171 DH_free(dh); 171 DH_free(dh);
172 BN_GENCB_free(_cb); 172 BN_GENCB_free(_cb);
173 173