diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2021-12-11 16:27:42 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2021-12-20 19:07:03 +0900 |
commit | 6a60c7b2e7b6afe8b8c98d864ef2740094d86e1d (patch) | |
tree | 353c691e6c3a66675ad86acc4637104d387a2e58 | |
parent | 91d04f991f8b9910efea7bbe5aecb0fea2bbd5fa (diff) | |
download | ruby-openssl-6a60c7b2e7b6afe8b8c98d864ef2740094d86e1d.tar.gz |
hmac: fix wrong usage of EVP_DigestSignFinal()
According to the manpage, the "siglen" parameter must be initialized
beforehand.
-rw-r--r-- | ext/openssl/ossl_hmac.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/openssl/ossl_hmac.c b/ext/openssl/ossl_hmac.c index f89ff2f9..bfe3a74b 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); |