Skip to content

Commit

Permalink
fix TestHashNotMarshalable
Browse files Browse the repository at this point in the history
  • Loading branch information
qmuntal committed Nov 4, 2024
1 parent 8d7d390 commit 2281bf3
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 2281bf3

Please sign in to comment.