mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-02 23:55:27 +00:00
Refactor the OpenSSL HMAC usage to use newer APIs
OpenSSL 3 deprecates the HMAC* family and associated APIs. Rewrite portions of OpenSSL library usage code to use a newer set of HMAC APIs.
This commit is contained in:
@@ -58,45 +58,6 @@ EVP_MD_CTX_reset(EVP_MD_CTX *ctx) {
|
||||
}
|
||||
#endif /* if !HAVE_EVP_MD_CTX_RESET */
|
||||
|
||||
#if !HAVE_HMAC_CTX_NEW
|
||||
HMAC_CTX *
|
||||
HMAC_CTX_new(void) {
|
||||
HMAC_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
|
||||
if (ctx != NULL) {
|
||||
if (!HMAC_CTX_reset(ctx)) {
|
||||
HMAC_CTX_free(ctx);
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
return (ctx);
|
||||
}
|
||||
#endif /* if !HAVE_HMAC_CTX_NEW */
|
||||
|
||||
#if !HAVE_HMAC_CTX_FREE
|
||||
void
|
||||
HMAC_CTX_free(HMAC_CTX *ctx) {
|
||||
if (ctx != NULL) {
|
||||
HMAC_CTX_cleanup(ctx);
|
||||
OPENSSL_free(ctx);
|
||||
}
|
||||
}
|
||||
#endif /* if !HAVE_HMAC_CTX_FREE */
|
||||
|
||||
#if !HAVE_HMAC_CTX_RESET
|
||||
int
|
||||
HMAC_CTX_reset(HMAC_CTX *ctx) {
|
||||
HMAC_CTX_cleanup(ctx);
|
||||
return (1);
|
||||
}
|
||||
#endif /* if !HAVE_HMAC_CTX_RESET */
|
||||
|
||||
#if !HAVE_HMAC_CTX_GET_MD
|
||||
const EVP_MD *
|
||||
HMAC_CTX_get_md(const HMAC_CTX *ctx) {
|
||||
return (ctx->md);
|
||||
}
|
||||
#endif /* if !HAVE_HMAC_CTX_GET_MD */
|
||||
|
||||
#if !HAVE_SSL_READ_EX
|
||||
int
|
||||
SSL_read_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes) {
|
||||
|
Reference in New Issue
Block a user