Skip to content

Commit

Permalink
Merge pull request #38 from microsoft/dev/qmuntal/hmacleak
Browse files Browse the repository at this point in the history
Free HMAC context when garbage collected
  • Loading branch information
qmuntal authored Sep 23, 2022
2 parents 8cf6916 + 0660974 commit 0e9fe57
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 0e9fe57

Please sign in to comment.