Skip to content

Commit

Permalink
libarchive: New workaround to build with OpenSSL 3
Browse files Browse the repository at this point in the history
This casts the second parameter to OSSL_PARAM_construct_utf8_string() as
a char * for a string litteral, as documented in EVP_MAC(3).
  • Loading branch information
khorben committed May 30, 2023
1 parent 9af5e8e commit cd93b73
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion contrib/libarchive/libarchive/archive_hmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ __hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len)
if (*ctx == NULL)
return -1;
EVP_MAC_free(mac);
params[0] = OSSL_PARAM_construct_utf8_string("digest", "SHA1", 0);
params[0] = OSSL_PARAM_construct_utf8_string("digest", (char *)"SHA1", 0);
params[1] = OSSL_PARAM_construct_end();
EVP_MAC_init(*ctx, key, key_len, params);
#else
Expand Down
5 changes: 1 addition & 4 deletions lib/libarchive/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/config_freebsd.h\"
CFLAGS+= -DWITH_OPENSSL
CFLAGS+= -DOPENSSL_API_COMPAT=0x10100000L
LIBADD+= crypto
#XXX for OpenSSL 3 with GCC12
.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 120100
CFLAGS.archive_hmac.c+= -Wno-error=discarded-qualifiers
.endif
CFLAGS.archive_hmac.c+= -Wno-error=cast-qual
.else
LIBADD+= md
.endif
Expand Down

0 comments on commit cd93b73

Please sign in to comment.