Skip to content

Commit

Permalink
Merge pull request #54 from microsoft/hmacleak
Browse files Browse the repository at this point in the history
hmac: fix memory leak in NewHMAC
  • Loading branch information
qmuntal committed Jun 19, 2023
2 parents e311e15 + 47fb879 commit f18e1f2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions openssl/hmac.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ func (h *hmac3) Reset() {
}

func (h *hmac3) finalize() {
C.go_openssl_EVP_MAC_free(h.md)
if h.ctx == nil {
return
}
Expand Down
1 change: 1 addition & 0 deletions openssl/openssl_funcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ DEFINEFUNC(int, EVP_PKEY_derive_init, (GO_EVP_PKEY_CTX_PTR ctx), (ctx)) \
DEFINEFUNC(int, EVP_PKEY_derive_set_peer, (GO_EVP_PKEY_CTX_PTR ctx, GO_EVP_PKEY_PTR peer), (ctx, peer)) \
DEFINEFUNC(int, EVP_PKEY_derive, (GO_EVP_PKEY_CTX_PTR ctx, unsigned char *key, size_t *keylen), (ctx, key, keylen)) \
DEFINEFUNC_3_0(GO_EVP_MAC_PTR, EVP_MAC_fetch, (GO_OSSL_LIB_CTX_PTR ctx, const char *algorithm, const char *properties), (ctx, algorithm, properties)) \
DEFINEFUNC_3_0(void, EVP_MAC_free, (GO_EVP_MAC_PTR mac), (mac)) \
DEFINEFUNC_3_0(GO_EVP_MAC_CTX_PTR, EVP_MAC_CTX_new, (GO_EVP_MAC_PTR arg0), (arg0)) \
DEFINEFUNC_3_0(void, EVP_MAC_CTX_free, (GO_EVP_MAC_CTX_PTR arg0), (arg0)) \
DEFINEFUNC_3_0(GO_EVP_MAC_CTX_PTR, EVP_MAC_CTX_dup, (const GO_EVP_MAC_CTX_PTR arg0), (arg0)) \
Expand Down

0 comments on commit f18e1f2

Please sign in to comment.