1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[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
This commit is contained in:
Kazuki Yamaguchi 2021-12-11 16:27:42 +09:00
parent cfcdd2b4bd
commit c1a7c6df18

View file

@ -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);