Skip to content

Commit

Permalink
Merge pull request #39 from microsoft/dev/qmuntal/v0.1-hmaleak
Browse files Browse the repository at this point in the history
[v0.1] free HMAC context when it is garbage collected
  • Loading branch information
qmuntal committed Sep 23, 2022
2 parents c59160c + 957c882 commit 26ba140
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions openssl/hmac.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func NewHMAC(h func() hash.Hash, key []byte) hash.Hash {
key: hkey,
ctx: hmacCtxNew(),
}
runtime.SetFinalizer(hmac, (*opensslHMAC).finalize)
hmac.Reset()
return hmac
}
Expand Down

0 comments on commit 26ba140

Please sign in to comment.