Your branch is up to date with 'origin/master'. Already up to date. Only in .: .git Only in .: .github Only in .: .gitignore Only in .: LICENSE Only in .: PATENTS Only in .: README.md Only in .: THEDIFF.diff Only in .: UPSTREAM diff -ur ./upstreamrepo/src/crypto/aes/aes_gcm.go ./aes/aes_gcm.go --- ./upstreamrepo/src/crypto/aes/aes_gcm.go 2023-05-29 11:12:39 +++ ./aes/aes_gcm.go 2023-05-29 10:51:30 @@ -8,9 +8,10 @@ import ( "crypto/cipher" - "crypto/internal/alias" - "crypto/subtle" "errors" + + "github.com/ooni/oocrypto/internal/alias" + "github.com/ooni/oocrypto/subtle" ) // The following functions are defined in gcm_*.s. Only in ./upstreamrepo/src/crypto/aes: asm_ppc64x.s Only in ./upstreamrepo/src/crypto/aes: asm_s390x.s Only in ./upstreamrepo/src/crypto/aes: cbc_ppc64x.go Only in ./upstreamrepo/src/crypto/aes: cbc_s390x.go diff -ur ./upstreamrepo/src/crypto/aes/cipher.go ./aes/cipher.go --- ./upstreamrepo/src/crypto/aes/cipher.go 2023-05-29 11:12:39 +++ ./aes/cipher.go 2023-05-29 10:52:32 @@ -6,9 +6,9 @@ import ( "crypto/cipher" - "crypto/internal/alias" - "crypto/internal/boring" "strconv" + + "github.com/ooni/oocrypto/internal/alias" ) // The AES block size in bytes. @@ -37,9 +37,6 @@ return nil, KeySizeError(k) case 16, 24, 32: break - } - if boring.Enabled { - return boring.NewAESCipher(key) } return newCipher(key) } diff -ur ./upstreamrepo/src/crypto/aes/cipher_asm.go ./aes/cipher_asm.go --- ./upstreamrepo/src/crypto/aes/cipher_asm.go 2023-05-29 11:12:39 +++ ./aes/cipher_asm.go 2023-05-29 11:17:20 @@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build amd64 || arm64 || ppc64 || ppc64le +//go:build amd64 || arm64 package aes import ( "crypto/cipher" - "crypto/internal/alias" - "crypto/internal/boring" - "internal/cpu" - "internal/goarch" + + "github.com/ooni/oocrypto/internal/alias" + "github.com/ooni/oocrypto/internal/cpuoverlay" + "golang.org/x/sys/cpu" ) // defined in asm_*.s @@ -37,8 +37,8 @@ aesCipherAsm } -var supportsAES = cpu.X86.HasAES || cpu.ARM64.HasAES || goarch.IsPpc64 == 1 || goarch.IsPpc64le == 1 -var supportsGFMUL = cpu.X86.HasPCLMULQDQ || cpu.ARM64.HasPMULL +var supportsAES = cpu.X86.HasAES || cpuoverlay.Arm64HasAES() +var supportsGFMUL = cpu.X86.HasPCLMULQDQ || cpuoverlay.Arm64HasPMULL() func newCipher(key []byte) (cipher.Block, error) { if !supportsAES { @@ -68,7 +68,6 @@ func (c *aesCipherAsm) BlockSize() int { return BlockSize } func (c *aesCipherAsm) Encrypt(dst, src []byte) { - boring.Unreachable() if len(src) < BlockSize { panic("crypto/aes: input not full block") } @@ -82,7 +81,6 @@ } func (c *aesCipherAsm) Decrypt(dst, src []byte) { - boring.Unreachable() if len(src) < BlockSize { panic("crypto/aes: input not full block") } diff -ur ./upstreamrepo/src/crypto/aes/cipher_generic.go ./aes/cipher_generic.go --- ./upstreamrepo/src/crypto/aes/cipher_generic.go 2023-05-29 11:12:39 +++ ./aes/cipher_generic.go 2023-05-29 10:29:06 @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !amd64 && !s390x && !ppc64 && !ppc64le && !arm64 +//go:build !amd64 && !arm64 package aes Only in ./upstreamrepo/src/crypto/aes: cipher_s390x.go Only in ./upstreamrepo/src/crypto/aes: ctr_s390x.go Only in ./upstreamrepo/src/crypto/aes: gcm_ppc64x.go Only in ./upstreamrepo/src/crypto/aes: gcm_ppc64x.s Only in ./upstreamrepo/src/crypto/aes: gcm_s390x.go Only in ./upstreamrepo/src/crypto: boring Only in ./upstreamrepo/src/crypto: cipher Only in ./upstreamrepo/src/crypto: crypto.go Only in ./upstreamrepo/src/crypto: des Only in ./upstreamrepo/src/crypto: dsa Only in ./upstreamrepo/src/crypto: ecdh Only in ./upstreamrepo/src/crypto: ecdsa Only in ./upstreamrepo/src/crypto: ed25519 Only in ./upstreamrepo/src/crypto: elliptic Only in .: go.mod Only in .: go.sum Only in ./upstreamrepo/src/crypto: hmac Only in ./upstreamrepo/src/crypto/internal: bigmod Only in ./upstreamrepo/src/crypto/internal/boring: Dockerfile Only in ./upstreamrepo/src/crypto/internal/boring: LICENSE Only in ./upstreamrepo/src/crypto/internal/boring: README.md Only in ./upstreamrepo/src/crypto/internal/boring: aes.go Only in ./upstreamrepo/src/crypto/internal/boring: bbig Only in ./upstreamrepo/src/crypto/internal/boring: bcache Only in ./upstreamrepo/src/crypto/internal/boring: boring.go Only in ./upstreamrepo/src/crypto/internal/boring: boring_test.go Only in ./upstreamrepo/src/crypto/internal/boring: build-boring.sh Only in ./upstreamrepo/src/crypto/internal/boring: build-goboring.sh Only in ./upstreamrepo/src/crypto/internal/boring: build.sh Only in ./upstreamrepo/src/crypto/internal/boring: div_test.c diff -ur ./upstreamrepo/src/crypto/internal/boring/doc.go ./internal/boring/doc.go --- ./upstreamrepo/src/crypto/internal/boring/doc.go 2023-05-29 11:12:39 +++ ./internal/boring/doc.go 2023-05-29 10:29:06 @@ -12,8 +12,3 @@ // // BoringCrypto is only available on linux/amd64 systems. const Enabled = available - -// A BigInt is the raw words from a BigInt. -// This definition allows us to avoid importing math/big. -// Conversion between BigInt and *big.Int is in crypto/internal/boring/bbig. -type BigInt []uint Only in ./upstreamrepo/src/crypto/internal/boring: ecdh.go Only in ./upstreamrepo/src/crypto/internal/boring: ecdsa.go Only in ./upstreamrepo/src/crypto/internal/boring: fipstls Only in ./upstreamrepo/src/crypto/internal/boring: goboringcrypto.h Only in ./upstreamrepo/src/crypto/internal/boring: hmac.go diff -ur ./upstreamrepo/src/crypto/internal/boring/notboring.go ./internal/boring/notboring.go --- ./upstreamrepo/src/crypto/internal/boring/notboring.go 2023-05-29 11:12:39 +++ ./internal/boring/notboring.go 2023-05-29 11:20:47 @@ -6,117 +6,10 @@ package boring -import ( - "crypto" - "crypto/cipher" - "crypto/internal/boring/sig" - "hash" -) - const available = false // Unreachable marks code that should be unreachable // when BoringCrypto is in use. It is a no-op without BoringCrypto. func Unreachable() { - // Code that's unreachable when using BoringCrypto - // is exactly the code we want to detect for reporting - // standard Go crypto. - sig.StandardCrypto() + // nothing } - -// UnreachableExceptTests marks code that should be unreachable -// when BoringCrypto is in use. It is a no-op without BoringCrypto. -func UnreachableExceptTests() {} - -type randReader int - -func (randReader) Read(b []byte) (int, error) { panic("boringcrypto: not available") } - -const RandReader = randReader(0) - -func NewSHA1() hash.Hash { panic("boringcrypto: not available") } -func NewSHA224() hash.Hash { panic("boringcrypto: not available") } -func NewSHA256() hash.Hash { panic("boringcrypto: not available") } -func NewSHA384() hash.Hash { panic("boringcrypto: not available") } -func NewSHA512() hash.Hash { panic("boringcrypto: not available") } - -func SHA1([]byte) [20]byte { panic("boringcrypto: not available") } -func SHA224([]byte) [28]byte { panic("boringcrypto: not available") } -func SHA256([]byte) [32]byte { panic("boringcrypto: not available") } -func SHA384([]byte) [48]byte { panic("boringcrypto: not available") } -func SHA512([]byte) [64]byte { panic("boringcrypto: not available") } - -func NewHMAC(h func() hash.Hash, key []byte) hash.Hash { panic("boringcrypto: not available") } - -func NewAESCipher(key []byte) (cipher.Block, error) { panic("boringcrypto: not available") } -func NewGCMTLS(cipher.Block) (cipher.AEAD, error) { panic("boringcrypto: not available") } - -type PublicKeyECDSA struct{ _ int } -type PrivateKeyECDSA struct{ _ int } - -func GenerateKeyECDSA(curve string) (X, Y, D BigInt, err error) { - panic("boringcrypto: not available") -} -func NewPrivateKeyECDSA(curve string, X, Y, D BigInt) (*PrivateKeyECDSA, error) { - panic("boringcrypto: not available") -} -func NewPublicKeyECDSA(curve string, X, Y BigInt) (*PublicKeyECDSA, error) { - panic("boringcrypto: not available") -} -func SignMarshalECDSA(priv *PrivateKeyECDSA, hash []byte) ([]byte, error) { - panic("boringcrypto: not available") -} -func VerifyECDSA(pub *PublicKeyECDSA, hash []byte, sig []byte) bool { - panic("boringcrypto: not available") -} - -type PublicKeyRSA struct{ _ int } -type PrivateKeyRSA struct{ _ int } - -func DecryptRSAOAEP(h, mgfHash hash.Hash, priv *PrivateKeyRSA, ciphertext, label []byte) ([]byte, error) { - panic("boringcrypto: not available") -} -func DecryptRSAPKCS1(priv *PrivateKeyRSA, ciphertext []byte) ([]byte, error) { - panic("boringcrypto: not available") -} -func DecryptRSANoPadding(priv *PrivateKeyRSA, ciphertext []byte) ([]byte, error) { - panic("boringcrypto: not available") -} -func EncryptRSAOAEP(h, mgfHash hash.Hash, pub *PublicKeyRSA, msg, label []byte) ([]byte, error) { - panic("boringcrypto: not available") -} -func EncryptRSAPKCS1(pub *PublicKeyRSA, msg []byte) ([]byte, error) { - panic("boringcrypto: not available") -} -func EncryptRSANoPadding(pub *PublicKeyRSA, msg []byte) ([]byte, error) { - panic("boringcrypto: not available") -} -func GenerateKeyRSA(bits int) (N, E, D, P, Q, Dp, Dq, Qinv BigInt, err error) { - panic("boringcrypto: not available") -} -func NewPrivateKeyRSA(N, E, D, P, Q, Dp, Dq, Qinv BigInt) (*PrivateKeyRSA, error) { - panic("boringcrypto: not available") -} -func NewPublicKeyRSA(N, E BigInt) (*PublicKeyRSA, error) { panic("boringcrypto: not available") } -func SignRSAPKCS1v15(priv *PrivateKeyRSA, h crypto.Hash, hashed []byte) ([]byte, error) { - panic("boringcrypto: not available") -} -func SignRSAPSS(priv *PrivateKeyRSA, h crypto.Hash, hashed []byte, saltLen int) ([]byte, error) { - panic("boringcrypto: not available") -} -func VerifyRSAPKCS1v15(pub *PublicKeyRSA, h crypto.Hash, hashed, sig []byte) error { - panic("boringcrypto: not available") -} -func VerifyRSAPSS(pub *PublicKeyRSA, h crypto.Hash, hashed, sig []byte, saltLen int) error { - panic("boringcrypto: not available") -} - -type PublicKeyECDH struct{} -type PrivateKeyECDH struct{} - -func ECDH(*PrivateKeyECDH, *PublicKeyECDH) ([]byte, error) { panic("boringcrypto: not available") } -func GenerateKeyECDH(string) (*PrivateKeyECDH, []byte, error) { panic("boringcrypto: not available") } -func NewPrivateKeyECDH(string, []byte) (*PrivateKeyECDH, error) { panic("boringcrypto: not available") } -func NewPublicKeyECDH(string, []byte) (*PublicKeyECDH, error) { panic("boringcrypto: not available") } -func (*PublicKeyECDH) Bytes() []byte { panic("boringcrypto: not available") } -func (*PrivateKeyECDH) PublicKey() (*PublicKeyECDH, error) { panic("boringcrypto: not available") } Only in ./upstreamrepo/src/crypto/internal/boring: rand.go Only in ./upstreamrepo/src/crypto/internal/boring: rsa.go Only in ./upstreamrepo/src/crypto/internal/boring: sha.go Only in ./upstreamrepo/src/crypto/internal/boring: sig Only in ./upstreamrepo/src/crypto/internal/boring: syso Only in ./internal: cpuoverlay Only in ./upstreamrepo/src/crypto/internal: edwards25519 Only in ./upstreamrepo/src/crypto/internal: nistec Only in ./upstreamrepo/src/crypto/internal: randutil Only in ./upstreamrepo/src/crypto: issue21104_test.go Only in ./upstreamrepo/src/crypto: md5 Only in ./upstreamrepo/src/crypto: rand Only in ./upstreamrepo/src/crypto: rc4 Only in ./upstreamrepo/src/crypto: rsa Only in ./upstreamrepo/src/crypto: sha1 Only in ./upstreamrepo/src/crypto: sha256 Only in ./upstreamrepo/src/crypto: sha512 Only in ./upstreamrepo/src/crypto/subtle: xor_ppc64x.go Only in ./upstreamrepo/src/crypto/subtle: xor_ppc64x.s diff -ur ./upstreamrepo/src/crypto/subtle/xor_test.go ./subtle/xor_test.go --- ./upstreamrepo/src/crypto/subtle/xor_test.go 2023-05-29 11:12:40 +++ ./subtle/xor_test.go 2023-05-29 11:03:35 @@ -7,10 +7,11 @@ import ( "bytes" "crypto/rand" - . "crypto/subtle" "fmt" "io" "testing" + + . "github.com/ooni/oocrypto/subtle" ) func TestXORBytes(t *testing.T) { @@ -61,14 +62,6 @@ mustPanic(t, "subtle.XORBytes: dst too short", func() { XORBytes(make([]byte, 1), make([]byte, 2), make([]byte, 3)) }) -} - -func min(a, b []byte) int { - n := len(a) - if len(b) < n { - n = len(b) - } - return n } func BenchmarkXORBytes(b *testing.B) { Only in ./upstreamrepo/src/crypto/tls: boring.go Only in ./upstreamrepo/src/crypto/tls: boring_test.go diff -ur ./upstreamrepo/src/crypto/tls/cipher_suites.go ./tls/cipher_suites.go --- ./upstreamrepo/src/crypto/tls/cipher_suites.go 2023-05-29 11:20:54 +++ ./tls/cipher_suites.go 2023-05-29 11:06:17 @@ -6,20 +6,21 @@ import ( "crypto" - "crypto/aes" "crypto/cipher" "crypto/des" "crypto/hmac" - "crypto/internal/boring" "crypto/rc4" "crypto/sha1" "crypto/sha256" "fmt" "hash" - "internal/cpu" "runtime" + "github.com/ooni/oocrypto/aes" + "github.com/ooni/oocrypto/internal/boring" + "github.com/ooni/oocrypto/internal/cpuoverlay" "golang.org/x/crypto/chacha20poly1305" + "golang.org/x/sys/cpu" ) // CipherSuite is a TLS cipher suite. Note that most functions in this package @@ -356,7 +357,7 @@ var ( hasGCMAsmAMD64 = cpu.X86.HasAES && cpu.X86.HasPCLMULQDQ - hasGCMAsmARM64 = cpu.ARM64.HasAES && cpu.ARM64.HasPMULL + hasGCMAsmARM64 = cpuoverlay.Arm64HasAES() && cpuoverlay.Arm64HasPMULL() // Keep in sync with crypto/aes/cipher_s390x.go. hasGCMAsmS390X = cpu.S390X.HasAES && cpu.S390X.HasAESCBC && cpu.S390X.HasAESCTR && (cpu.S390X.HasGHASH || cpu.S390X.HasAESGCM) @@ -517,12 +518,7 @@ panic(err) } var aead cipher.AEAD - if boring.Enabled { - aead, err = boring.NewGCMTLS(aes) - } else { - boring.Unreachable() - aead, err = cipher.NewGCM(aes) - } + aead, err = cipher.NewGCM(aes) if err != nil { panic(err) } diff -ur ./upstreamrepo/src/crypto/tls/conn.go ./tls/conn.go --- ./upstreamrepo/src/crypto/tls/conn.go 2023-05-29 11:20:54 +++ ./tls/conn.go 2023-05-29 10:29:06 @@ -10,7 +10,6 @@ "bytes" "context" "crypto/cipher" - "crypto/subtle" "crypto/x509" "errors" "fmt" @@ -20,6 +19,8 @@ "sync" "sync/atomic" "time" + + "github.com/ooni/oocrypto/subtle" ) // A Conn represents a secured connection. Only in ./upstreamrepo/src/crypto/tls: example_test.go Only in ./upstreamrepo/src/crypto/tls: fipsonly diff -ur ./upstreamrepo/src/crypto/tls/handshake_client.go ./tls/handshake_client.go --- ./upstreamrepo/src/crypto/tls/handshake_client.go 2023-05-29 11:20:54 +++ ./tls/handshake_client.go 2023-05-29 10:29:06 @@ -12,7 +12,6 @@ "crypto/ecdsa" "crypto/ed25519" "crypto/rsa" - "crypto/subtle" "crypto/x509" "errors" "fmt" @@ -21,6 +20,8 @@ "net" "strings" "time" + + "github.com/ooni/oocrypto/subtle" ) type clientHandshakeState struct { diff -ur ./upstreamrepo/src/crypto/tls/handshake_server.go ./tls/handshake_server.go --- ./upstreamrepo/src/crypto/tls/handshake_server.go 2023-05-29 11:20:54 +++ ./tls/handshake_server.go 2023-05-29 10:29:06 @@ -10,13 +10,14 @@ "crypto/ecdsa" "crypto/ed25519" "crypto/rsa" - "crypto/subtle" "crypto/x509" "errors" "fmt" "hash" "io" "time" + + "github.com/ooni/oocrypto/subtle" ) // serverHandshakeState contains details of a server handshake in progress. Only in ./upstreamrepo/src/crypto/tls: link_test.go Only in ./tls: stdlibwrapper.go Only in ./tls: stdlibwrapper_test.go diff -ur ./upstreamrepo/src/crypto/tls/ticket.go ./tls/ticket.go --- ./upstreamrepo/src/crypto/tls/ticket.go 2023-05-29 11:20:54 +++ ./tls/ticket.go 2023-05-29 10:29:06 @@ -6,14 +6,14 @@ import ( "bytes" - "crypto/aes" "crypto/cipher" "crypto/hmac" "crypto/sha256" - "crypto/subtle" "errors" "io" + "github.com/ooni/oocrypto/aes" + "github.com/ooni/oocrypto/subtle" "golang.org/x/crypto/cryptobyte" ) diff -ur ./upstreamrepo/src/crypto/tls/tls_test.go ./tls/tls_test.go --- ./upstreamrepo/src/crypto/tls/tls_test.go 2023-05-29 11:20:54 +++ ./tls/tls_test.go 2023-05-29 10:29:06 @@ -12,7 +12,6 @@ "encoding/json" "errors" "fmt" - "internal/testenv" "io" "math" "net" @@ -473,8 +472,6 @@ } func TestVerifyHostname(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - c, err := Dial("tcp", "www.google.com:https", nil) if err != nil { t.Fatal(err) Only in .: tools Only in .: upstreamrepo Only in ./upstreamrepo/src/crypto: x509