Improve OpenSSL 3.0 support.
This commit is contained in:
parent
8b5a55c798
commit
3ead565d67
@ -888,15 +888,11 @@ static void hmac_impl(const char *digest, Slice key, Slice message, MutableSlice
|
|||||||
EVP_MAC_CTX *ctx = EVP_MAC_CTX_new(hmac);
|
EVP_MAC_CTX *ctx = EVP_MAC_CTX_new(hmac);
|
||||||
LOG_IF(FATAL, ctx == nullptr);
|
LOG_IF(FATAL, ctx == nullptr);
|
||||||
|
|
||||||
OSSL_PARAM params[3];
|
OSSL_PARAM params[2];
|
||||||
params[0] = OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST, const_cast<char *>(digest), 0);
|
params[0] = OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST, const_cast<char *>(digest), 0);
|
||||||
params[1] =
|
params[1] = OSSL_PARAM_construct_end();
|
||||||
OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY, const_cast<unsigned char *>(key.ubegin()), key.size());
|
|
||||||
params[2] = OSSL_PARAM_construct_end();
|
|
||||||
|
|
||||||
int res = EVP_MAC_CTX_set_params(ctx, params);
|
int res = EVP_MAC_init(ctx, const_cast<unsigned char *>(key.ubegin()), key.size(), params);
|
||||||
LOG_IF(FATAL, res != 1);
|
|
||||||
res = EVP_MAC_init(ctx);
|
|
||||||
LOG_IF(FATAL, res != 1);
|
LOG_IF(FATAL, res != 1);
|
||||||
res = EVP_MAC_update(ctx, message.ubegin(), message.size());
|
res = EVP_MAC_update(ctx, message.ubegin(), message.size());
|
||||||
LOG_IF(FATAL, res != 1);
|
LOG_IF(FATAL, res != 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user