Skip to content

Commit a197832

Browse files
committed
fix TestHashNotMarshalable
1 parent b6ab98c commit a197832

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

hash.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,10 @@ func SHA3_512(p []byte) (sum [64]byte) {
112112
}
113113

114114
var isMarshallableCache sync.Map
115-
var testNotMarshalable bool // Used in tests.
116115

117116
// isHashMarshallable returns true if the memory layout of cb
118117
// is known by this library and can therefore be marshalled.
119118
func isHashMarshallable(ch crypto.Hash) bool {
120-
if testNotMarshalable {
121-
return false
122-
}
123119
if vMajor == 1 {
124120
return true
125121
}
@@ -235,12 +231,14 @@ func (h *evpHash) sum(out []byte) {
235231
runtime.KeepAlive(h)
236232
}
237233

234+
var testNotMarshalable bool // Used in tests.
235+
238236
// hashState returns a pointer to the internal hash structure.
239237
//
240238
// The EVP_MD_CTX memory layout has changed in OpenSSL 3
241239
// and the property holding the internal structure is no longer md_data but algctx.
242240
func (h *evpHash) hashState() unsafe.Pointer {
243-
if !h.marshallable {
241+
if !h.marshallable || testNotMarshalable {
244242
return nil
245243
}
246244
switch vMajor {

0 commit comments

Comments
 (0)