aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2021-12-11 16:27:42 +0900
committerKazuki Yamaguchi <k@rhe.jp>2021-12-20 23:42:02 +0900
commitc1a7c6df18f6d6eb0c701443b1231ea2c0baf6ea (patch)
treec84c9d64994b61c285148932ee1560913f3d3810
parentcfcdd2b4bd6c2420ecc93a8f77e553b53595b7ef (diff)
downloadruby-c1a7c6df18f6d6eb0c701443b1231ea2c0baf6ea.tar.gz
[ruby/openssl] hmac: fix wrong usage of EVP_DigestSignFinal()
According to the manpage, the "siglen" parameter must be initialized beforehand. https://github.com/ruby/openssl/commit/6a60c7b2e7
-rw-r--r--ext/openssl/ossl_hmac.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/openssl/ossl_hmac.c b/ext/openssl/ossl_hmac.c
index f89ff2f9a1..bfe3a74b12 100644
--- a/ext/openssl/ossl_hmac.c
+++ b/ext/openssl/ossl_hmac.c
@@ -175,7 +175,7 @@ static VALUE
ossl_hmac_digest(VALUE self)
{
EVP_MD_CTX *ctx;
- size_t buf_len;
+ size_t buf_len = EVP_MAX_MD_SIZE;
VALUE ret;
GetHMAC(self, ctx);
@@ -200,7 +200,7 @@ ossl_hmac_hexdigest(VALUE self)
{
EVP_MD_CTX *ctx;
unsigned char buf[EVP_MAX_MD_SIZE];
- size_t buf_len;
+ size_t buf_len = EVP_MAX_MD_SIZE;
VALUE ret;
GetHMAC(self, ctx);