From 2281bf3f523547bae171449036e3e6174527b5ae Mon Sep 17 00:00:00 2001 From: qmuntal Date: Mon, 4 Nov 2024 15:45:54 +0100 Subject: [PATCH] fix TestHashNotMarshalable --- hash.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hash.go b/hash.go index df1cfaf..e0ea56d 100644 --- a/hash.go +++ b/hash.go @@ -112,14 +112,10 @@ func SHA3_512(p []byte) (sum [64]byte) { } var isMarshallableCache sync.Map -var testNotMarshalable bool // Used in tests. // isHashMarshallable returns true if the memory layout of cb // is known by this library and can therefore be marshalled. func isHashMarshallable(ch crypto.Hash) bool { - if testNotMarshalable { - return false - } if vMajor == 1 { return true } @@ -235,12 +231,14 @@ func (h *evpHash) sum(out []byte) { runtime.KeepAlive(h) } +var testNotMarshalable bool // Used in tests. + // hashState returns a pointer to the internal hash structure. // // The EVP_MD_CTX memory layout has changed in OpenSSL 3 // and the property holding the internal structure is no longer md_data but algctx. func (h *evpHash) hashState() unsafe.Pointer { - if !h.marshallable { + if !h.marshallable || testNotMarshalable { return nil } switch vMajor {