From 5c040a06b5a2b74ac23e9c155ec6578a13fc1022 Mon Sep 17 00:00:00 2001 From: tb Date: Sun, 16 Jul 2023 07:34:07 +0000 Subject: [PATCH] ecdhtest: Drop unnecessary constant and unneeded includes --- regress/lib/libcrypto/ecdh/ecdhtest.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/regress/lib/libcrypto/ecdh/ecdhtest.c b/regress/lib/libcrypto/ecdh/ecdhtest.c index bf9e9c007c2..7d7bbf5465c 100644 --- a/regress/lib/libcrypto/ecdh/ecdhtest.c +++ b/regress/lib/libcrypto/ecdh/ecdhtest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecdhtest.c,v 1.19 2023/07/16 00:16:42 tb Exp $ */ +/* $OpenBSD: ecdhtest.c,v 1.20 2023/07/16 07:34:07 tb Exp $ */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * @@ -72,8 +72,6 @@ #include #include -#include -#include #include #include #include @@ -94,18 +92,16 @@ hexdump(const unsigned char *buf, size_t len) fprintf(stdout, "\n"); } -static const int KDF1_SHA1_len = 20; static void * KDF1_SHA1(const void *in, size_t inlen, void *out, size_t *outlen) { -#ifndef OPENSSL_NO_SHA +#ifdef OPENSSL_NO_SHA + return NULL; +#else if (*outlen < SHA_DIGEST_LENGTH) return NULL; - else - *outlen = SHA_DIGEST_LENGTH; + *outlen = SHA_DIGEST_LENGTH; return SHA1(in, inlen, out); -#else - return NULL; #endif } @@ -115,7 +111,7 @@ ecdh_keygen_test(int nid) EC_KEY *keya = NULL, *keyb = NULL; const EC_POINT *puba, *pubb; unsigned char *abuf = NULL, *bbuf = NULL; - int len = KDF1_SHA1_len; + int len = SHA_DIGEST_LENGTH; int failed = 1; if ((keya = EC_KEY_new_by_curve_name(nid)) == NULL) -- 2.20.1