Skip to content

Commit 6a60c7b

Browse files
committed
hmac: fix wrong usage of EVP_DigestSignFinal()
According to the manpage, the "siglen" parameter must be initialized beforehand.
1 parent 91d04f9 commit 6a60c7b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/openssl/ossl_hmac.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ static VALUE
175175
ossl_hmac_digest(VALUE self)
176176
{
177177
EVP_MD_CTX *ctx;
178-
size_t buf_len;
178+
size_t buf_len = EVP_MAX_MD_SIZE;
179179
VALUE ret;
180180

181181
GetHMAC(self, ctx);
@@ -200,7 +200,7 @@ ossl_hmac_hexdigest(VALUE self)
200200
{
201201
EVP_MD_CTX *ctx;
202202
unsigned char buf[EVP_MAX_MD_SIZE];
203-
size_t buf_len;
203+
size_t buf_len = EVP_MAX_MD_SIZE;
204204
VALUE ret;
205205

206206
GetHMAC(self, ctx);

0 commit comments

Comments
 (0)