diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2021-04-22 13:57:47 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2021-10-24 17:24:50 +0900 |
commit | 0a253027e6be47c0b7fd8b664f1048f24d7ca657 (patch) | |
tree | f7e5ea48a182d650b3535a8fca35aafdc76b3abd /ext/openssl/ossl_hmac.c | |
parent | 90d51ef51091384cde33614d3665232be16682a0 (diff) | |
download | ruby-openssl-0a253027e6be47c0b7fd8b664f1048f24d7ca657.tar.gz |
digest: use EVP_MD_CTX_get0_md() instead of EVP_MD_CTX_md() if exists
The function was renamed in OpenSSL 3.0 due to the change of the
lifetime of EVP_MD objects. They are no longer necessarily statically
allocated and can be reference-counted -- when an EVP_MD_CTX is free'd,
the associated EVP_MD can also become inaccessible.
Currently Ruby/OpenSSL only handles builtin algorithms, so no special
handling is needed except for adapting to the rename.
Diffstat (limited to 'ext/openssl/ossl_hmac.c')
-rw-r--r-- | ext/openssl/ossl_hmac.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/openssl/ossl_hmac.c b/ext/openssl/ossl_hmac.c index a21db6c4..2642728b 100644 --- a/ext/openssl/ossl_hmac.c +++ b/ext/openssl/ossl_hmac.c @@ -239,7 +239,7 @@ ossl_hmac_reset(VALUE self) GetHMAC(self, ctx); pkey = EVP_PKEY_CTX_get0_pkey(EVP_MD_CTX_pkey_ctx(ctx)); - if (EVP_DigestSignInit(ctx, NULL, EVP_MD_CTX_md(ctx), NULL, pkey) != 1) + if (EVP_DigestSignInit(ctx, NULL, EVP_MD_CTX_get0_md(ctx), NULL, pkey) != 1) ossl_raise(eHMACError, "EVP_DigestSignInit"); return self; |