summaryrefslogtreecommitdiff
path: root/src/regress/lib
diff options
context:
space:
mode:
authortb <>2023-07-16 07:34:07 +0000
committertb <>2023-07-16 07:34:07 +0000
commit58606619bb16e50d60bacec3daa020c9138a07df (patch)
tree32b616cb0baa29d2956b29df8e133fc3cbcd775c /src/regress/lib
parent719f0117cb0150d298f8e762230fe437cdc92f14 (diff)
downloadopenbsd-58606619bb16e50d60bacec3daa020c9138a07df.tar.gz
openbsd-58606619bb16e50d60bacec3daa020c9138a07df.tar.bz2
openbsd-58606619bb16e50d60bacec3daa020c9138a07df.zip
ecdhtest: Drop unnecessary constant and unneeded includes
Diffstat (limited to 'src/regress/lib')
-rw-r--r--src/regress/lib/libcrypto/ecdh/ecdhtest.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/regress/lib/libcrypto/ecdh/ecdhtest.c b/src/regress/lib/libcrypto/ecdh/ecdhtest.c
index bf9e9c007c..7d7bbf5465 100644
--- a/src/regress/lib/libcrypto/ecdh/ecdhtest.c
+++ b/src/regress/lib/libcrypto/ecdh/ecdhtest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecdhtest.c,v 1.19 2023/07/16 00:16:42 tb Exp $ */ 1/* $OpenBSD: ecdhtest.c,v 1.20 2023/07/16 07:34:07 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. 3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
4 * 4 *
@@ -72,8 +72,6 @@
72#include <stdlib.h> 72#include <stdlib.h>
73#include <string.h> 73#include <string.h>
74 74
75#include <openssl/crypto.h>
76#include <openssl/bio.h>
77#include <openssl/bn.h> 75#include <openssl/bn.h>
78#include <openssl/objects.h> 76#include <openssl/objects.h>
79#include <openssl/sha.h> 77#include <openssl/sha.h>
@@ -94,18 +92,16 @@ hexdump(const unsigned char *buf, size_t len)
94 fprintf(stdout, "\n"); 92 fprintf(stdout, "\n");
95} 93}
96 94
97static const int KDF1_SHA1_len = 20;
98static void * 95static void *
99KDF1_SHA1(const void *in, size_t inlen, void *out, size_t *outlen) 96KDF1_SHA1(const void *in, size_t inlen, void *out, size_t *outlen)
100{ 97{
101#ifndef OPENSSL_NO_SHA 98#ifdef OPENSSL_NO_SHA
99 return NULL;
100#else
102 if (*outlen < SHA_DIGEST_LENGTH) 101 if (*outlen < SHA_DIGEST_LENGTH)
103 return NULL; 102 return NULL;
104 else 103 *outlen = SHA_DIGEST_LENGTH;
105 *outlen = SHA_DIGEST_LENGTH;
106 return SHA1(in, inlen, out); 104 return SHA1(in, inlen, out);
107#else
108 return NULL;
109#endif 105#endif
110} 106}
111 107
@@ -115,7 +111,7 @@ ecdh_keygen_test(int nid)
115 EC_KEY *keya = NULL, *keyb = NULL; 111 EC_KEY *keya = NULL, *keyb = NULL;
116 const EC_POINT *puba, *pubb; 112 const EC_POINT *puba, *pubb;
117 unsigned char *abuf = NULL, *bbuf = NULL; 113 unsigned char *abuf = NULL, *bbuf = NULL;
118 int len = KDF1_SHA1_len; 114 int len = SHA_DIGEST_LENGTH;
119 int failed = 1; 115 int failed = 1;
120 116
121 if ((keya = EC_KEY_new_by_curve_name(nid)) == NULL) 117 if ((keya = EC_KEY_new_by_curve_name(nid)) == NULL)