Skip to content

Commit

Permalink
fix TestMarshalHash
Browse files Browse the repository at this point in the history
  • Loading branch information
qmuntal committed Oct 31, 2024
1 parent 657ae35 commit cd4238a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 28 deletions.
23 changes: 19 additions & 4 deletions patches/0002-Add-crypto-backend-foundation.patch
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ Subject: [PATCH] Add crypto backend foundation
src/crypto/tls/prf_test.go | 12 +-
src/crypto/x509/boring_test.go | 5 +
src/go/build/deps_test.go | 4 +
src/hash/marshal_test.go | 3 +
src/net/smtp/smtp_test.go | 72 ++++---
src/runtime/runtime_boring.go | 5 +
52 files changed, 858 insertions(+), 106 deletions(-)
53 files changed, 861 insertions(+), 106 deletions(-)
create mode 100644 src/crypto/ed25519/boring.go
create mode 100644 src/crypto/ed25519/notboring.go
create mode 100644 src/crypto/internal/backend/backend_test.go
Expand Down Expand Up @@ -912,7 +913,7 @@ index c984c3f4968598..229dd457f8d53c 100644
d.Reset()
d.Write(data)
diff --git a/src/crypto/md5/md5_test.go b/src/crypto/md5/md5_test.go
index 6a8258a67e860c..63dfe196da7a58 100644
index 6a8258a67e860c..61ea6b5153f617 100644
--- a/src/crypto/md5/md5_test.go
+++ b/src/crypto/md5/md5_test.go
@@ -6,6 +6,7 @@ package md5
Expand Down Expand Up @@ -1347,7 +1348,7 @@ index d87c689c9001ad..7584c380af0cec 100644
}
h := New224()
diff --git a/src/crypto/sha256/sha256_test.go b/src/crypto/sha256/sha256_test.go
index ffd16386515830..09f7046548bf8f 100644
index ffd16386515830..58632c01dc6a7f 100644
--- a/src/crypto/sha256/sha256_test.go
+++ b/src/crypto/sha256/sha256_test.go
@@ -8,7 +8,7 @@ package sha256
Expand Down Expand Up @@ -1412,7 +1413,7 @@ index 0a12fde7bc060b..ca752598e4343a 100644
"hash"
)
diff --git a/src/crypto/sha512/sha512_test.go b/src/crypto/sha512/sha512_test.go
index fdad37b1863ae8..78fa1f60a542b5 100644
index fdad37b1863ae8..cf6e4c395cd4fb 100644
--- a/src/crypto/sha512/sha512_test.go
+++ b/src/crypto/sha512/sha512_test.go
@@ -8,7 +8,7 @@ package sha512
Expand Down Expand Up @@ -1908,6 +1909,20 @@ index c6a2518f62ff3a..578b4d6f68504c 100644
< crypto/rand
< crypto/internal/mlkem768
< crypto/ed25519
diff --git a/src/hash/marshal_test.go b/src/hash/marshal_test.go
index 3091f7a67acede..b066f8281c5265 100644
--- a/src/hash/marshal_test.go
+++ b/src/hash/marshal_test.go
@@ -65,6 +65,9 @@ func TestMarshalHash(t *testing.T) {
}

h := tt.new()
+ if _, ok := h.(encoding.BinaryMarshaler); !ok {
+ t.Skip("BinaryMarshaler not implemented")
+ }
h.Write(buf[:256])
sum := h.Sum(nil)

diff --git a/src/net/smtp/smtp_test.go b/src/net/smtp/smtp_test.go
index 389eda9ad54b99..110d60beb0e70c 100644
--- a/src/net/smtp/smtp_test.go
Expand Down
25 changes: 1 addition & 24 deletions patches/0005-Add-CNG-crypto-backend.patch
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ Subject: [PATCH] Add CNG crypto backend
src/go/build/deps_test.go | 5 +
src/go/build/vendor_test.go | 1 +
src/hash/example_test.go | 2 +
src/hash/marshal_test.go | 4 +
.../goexperiment/exp_cngcrypto_off.go | 9 +
src/internal/goexperiment/exp_cngcrypto_on.go | 9 +
src/internal/goexperiment/flags.go | 1 +
37 files changed, 394 insertions(+), 26 deletions(-)
36 files changed, 390 insertions(+), 26 deletions(-)
create mode 100644 src/crypto/ecdsa/badlinkname.go
create mode 100644 src/crypto/internal/backend/bbig/big_cng.go
create mode 100644 src/crypto/internal/backend/cng_windows.go
Expand Down Expand Up @@ -824,28 +823,6 @@ index f07b9aaa2c4898..2ff6c4827391c0 100644
package hash_test

import (
diff --git a/src/hash/marshal_test.go b/src/hash/marshal_test.go
index 3091f7a67acede..824be4a90fd4db 100644
--- a/src/hash/marshal_test.go
+++ b/src/hash/marshal_test.go
@@ -21,6 +21,7 @@ import (
"hash/crc32"
"hash/crc64"
"hash/fnv"
+ "internal/goexperiment"
"testing"
)

@@ -76,6 +77,9 @@ func TestMarshalHash(t *testing.T) {
}
h2m, ok := h2.(encoding.BinaryMarshaler)
if !ok {
+ if goexperiment.CNGCrypto {
+ t.Skip("CNGCrypto does not hash marshaling")
+ }
t.Fatalf("Hash does not implement MarshalBinary")
}
enc, err := h2m.MarshalBinary()
diff --git a/src/internal/goexperiment/exp_cngcrypto_off.go b/src/internal/goexperiment/exp_cngcrypto_off.go
new file mode 100644
index 00000000000000..831460053281e2
Expand Down

0 comments on commit cd4238a

Please sign in to comment.