"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
-portable: use existing HAVE_SHA2{,56}_H defines
To:
gameoftrees@openbsd.org
Date:
Wed, 1 Mar 2023 21:08:22 +0100

Download raw body.

Thread
I noticed that HAVE_SHA2 is referenced in include/got_compat2.h,
but it isn't defined anywhere.

We could add an AC_DEFINE() like the one for HAVE_SHA256, but I
suggest to instead make use of the existing HAVE_SHA2_H, HAVE_SHA256_H
defines already generated by AC_CHECK_HEADERS().

diff refs/heads/ta/configh refs/heads/local
commit - 8bc24a1fa66de6085e2b2ffacc279194ea2938c6
commit + a0e8fda65bd1d0501cd7ad53bbce40bf9b1bd2a6
blob - 66a5f987364d3134eda0122154ca04ee9767dcc8
blob + 74bf0048c37b744fb7da933a0adcd8fd7b57117c
--- configure.ac
+++ configure.ac
@@ -86,10 +86,6 @@ if test "x$ac_cv_header_sha256_h" = xyes; then
 	wchar.h \
 ])
 
-if test "x$ac_cv_header_sha256_h" = xyes; then
-	AC_DEFINE([HAVE_SHA256], [1], [SHA256 support])
-fi
-
 AM_CONDITIONAL([HAVE_SHA2], [test "x$ac_cv_header_sha2_h" = xyes])
 
 # Check for SHA1_DIGEST_LENGTH
blob - bc3e4d11b4449a9a0131a9afe11b774e2fe08f7c
blob + 3a48362f5947d6409c72223dc55f1516fe5e89dd
--- include/got_compat2.h
+++ include/got_compat2.h
@@ -221,12 +221,12 @@ typedef struct _SHA2_CTX {
 #ifdef HAVE_SHA1_AS_SHA1
 #      include <sha1.h>
 #endif
-#ifdef HAVE_SHA2
+#ifdef HAVE_SHA2_H
 #    include <sha2.h>
 #else
 #    include "sha2.h"
 #endif
-#ifdef HAVE_SHA256
+#ifdef HAVE_SHA256_H
 #    include <sha256.h>
 #endif
 #endif
-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de