From 8892a6badbf622c84b918ef879a712ad5552f9f8 Mon Sep 17 00:00:00 2001 From: "David M. Syzdek" Date: Wed, 11 Jan 2023 16:24:54 -0900 Subject: autotools: adding checks for EVP_sha3_256() and EVP_sha3_512() --- configure.ac | 2 ++ lib/libotputil/lmisc.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/configure.ac b/configure.ac index 7201868..c06dda1 100644 --- a/configure.ac +++ b/configure.ac @@ -170,6 +170,8 @@ AC_SEARCH_LIBS([EVP_sha256], [crypto], [], [AC_MSG_ERROR([OpenSSL is require AC_SEARCH_LIBS([EVP_sha512], [crypto], [], [AC_MSG_ERROR([OpenSSL is required])], []) AC_SEARCH_LIBS([HMAC], [crypto], [], [AC_MSG_ERROR([OpenSSL is required])], []) AC_CHECK_FUNCS([EVP_MD_get0_name], [], []) +AC_CHECK_FUNCS([EVP_sha3_256], [], []) +AC_CHECK_FUNCS([EVP_sha3_512], [], []) # GNU Libtool Support LT_INIT(dlopen disable-fast-install) diff --git a/lib/libotputil/lmisc.c b/lib/libotputil/lmisc.c index 6d31ea5..4b62d1e 100644 --- a/lib/libotputil/lmisc.c +++ b/lib/libotputil/lmisc.c @@ -64,8 +64,12 @@ static const otputil_map_t otputil_md_list[] = { .map_name = "sha1", .map_id = OTPUTIL_MD_SHA1 }, { .map_name = "sha256", .map_id = OTPUTIL_MD_SHA256 }, { .map_name = "sha512", .map_id = OTPUTIL_MD_SHA512 }, +#ifdef HAVE_EVP_SHA3_256 { .map_name = "sha3-256", .map_id = OTPUTIL_MD_SHA3_256 }, +#endif +#ifdef HAVE_EVP_SHA3_512 { .map_name = "sha3-512", .map_id = OTPUTIL_MD_SHA3_512 }, +#endif { .map_name = NULL, .map_id = 0 }, }; @@ -107,8 +111,12 @@ otputil_evp_md( case OTPUTIL_MD_SHA1: return(EVP_sha1()); case OTPUTIL_MD_SHA256: return(EVP_sha256()); case OTPUTIL_MD_SHA512: return(EVP_sha512()); +#ifdef HAVE_EVP_SHA3_256 case OTPUTIL_MD_SHA3_256: return(EVP_sha3_256()); +#endif +#ifdef HAVE_EVP_SHA3_512 case OTPUTIL_MD_SHA3_512: return(EVP_sha3_512()); +#endif default: break; }; return(NULL); -- cgit v1.2.3