diff --git a/go/src/crypto/aes/aes.go b/go/src/crypto/aes/aes.go new file mode 100644 index 0000000000000000000000000000000000000000..22ea8819ed239affd8d0e1d1bc8d186d2be46fa4 --- /dev/null +++ b/go/src/crypto/aes/aes.go @@ -0,0 +1,48 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package aes implements AES encryption (formerly Rijndael), as defined in +// U.S. Federal Information Processing Standards Publication 197. +// +// The AES operations in this package are not implemented using constant-time algorithms. +// An exception is when running on systems with enabled hardware support for AES +// that makes these operations constant-time. Examples include amd64 systems using AES-NI +// extensions and s390x systems using Message-Security-Assist extensions. +// On such systems, when the result of NewCipher is passed to cipher.NewGCM, +// the GHASH operation used by GCM is also constant-time. +package aes + +import ( + "crypto/cipher" + "crypto/internal/boring" + "crypto/internal/fips140/aes" + "strconv" +) + +// The AES block size in bytes. +const BlockSize = 16 + +type KeySizeError int + +func (k KeySizeError) Error() string { + return "crypto/aes: invalid key size " + strconv.Itoa(int(k)) +} + +// NewCipher creates and returns a new [cipher.Block]. +// The key argument must be the AES key, +// either 16, 24, or 32 bytes to select +// AES-128, AES-192, or AES-256. +func NewCipher(key []byte) (cipher.Block, error) { + k := len(key) + switch k { + default: + return nil, KeySizeError(k) + case 16, 24, 32: + break + } + if boring.Enabled { + return boring.NewAESCipher(key) + } + return aes.New(key) +} diff --git a/go/src/crypto/aes/aes_test.go b/go/src/crypto/aes/aes_test.go new file mode 100644 index 0000000000000000000000000000000000000000..cfe75f4057a96bf49f7748d556b99c6bdad116c6 --- /dev/null +++ b/go/src/crypto/aes/aes_test.go @@ -0,0 +1,175 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package aes + +import ( + "crypto/internal/boring" + "crypto/internal/cryptotest" + "fmt" + "testing" +) + +// Test vectors are from FIPS 197: +// https://csrc.nist.gov/publications/fips/fips197/fips-197.pdf + +// Appendix B, C of FIPS 197: Cipher examples, Example vectors. +type CryptTest struct { + key []byte + in []byte + out []byte +} + +var encryptTests = []CryptTest{ + { + // Appendix B. + []byte{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}, + []byte{0x32, 0x43, 0xf6, 0xa8, 0x88, 0x5a, 0x30, 0x8d, 0x31, 0x31, 0x98, 0xa2, 0xe0, 0x37, 0x07, 0x34}, + []byte{0x39, 0x25, 0x84, 0x1d, 0x02, 0xdc, 0x09, 0xfb, 0xdc, 0x11, 0x85, 0x97, 0x19, 0x6a, 0x0b, 0x32}, + }, + { + // Appendix C.1. AES-128 + []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + []byte{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, + []byte{0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30, 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a}, + }, + { + // Appendix C.2. AES-192 + []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + }, + []byte{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, + []byte{0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0, 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91}, + }, + { + // Appendix C.3. AES-256 + []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + }, + []byte{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, + []byte{0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf, 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89}, + }, +} + +// Test Cipher Encrypt method against FIPS 197 examples. +func TestCipherEncrypt(t *testing.T) { + cryptotest.TestAllImplementations(t, "aes", testCipherEncrypt) +} + +func testCipherEncrypt(t *testing.T) { + for i, tt := range encryptTests { + c, err := NewCipher(tt.key) + if err != nil { + t.Errorf("NewCipher(%d bytes) = %s", len(tt.key), err) + continue + } + out := make([]byte, len(tt.in)) + c.Encrypt(out, tt.in) + for j, v := range out { + if v != tt.out[j] { + t.Errorf("Cipher.Encrypt %d: out[%d] = %#x, want %#x", i, j, v, tt.out[j]) + break + } + } + } +} + +// Test Cipher Decrypt against FIPS 197 examples. +func TestCipherDecrypt(t *testing.T) { + cryptotest.TestAllImplementations(t, "aes", testCipherDecrypt) +} + +func testCipherDecrypt(t *testing.T) { + for i, tt := range encryptTests { + c, err := NewCipher(tt.key) + if err != nil { + t.Errorf("NewCipher(%d bytes) = %s", len(tt.key), err) + continue + } + plain := make([]byte, len(tt.in)) + c.Decrypt(plain, tt.out) + for j, v := range plain { + if v != tt.in[j] { + t.Errorf("decryptBlock %d: plain[%d] = %#x, want %#x", i, j, v, tt.in[j]) + break + } + } + } +} + +// Test AES against the general cipher.Block interface tester +func TestAESBlock(t *testing.T) { + cryptotest.TestAllImplementations(t, "aes", testAESBlock) +} + +func testAESBlock(t *testing.T) { + for _, keylen := range []int{128, 192, 256} { + t.Run(fmt.Sprintf("AES-%d", keylen), func(t *testing.T) { + cryptotest.TestBlock(t, keylen/8, NewCipher) + }) + } +} + +func TestExtraMethods(t *testing.T) { + if boring.Enabled { + t.Skip("Go+BoringCrypto still uses the interface upgrades in crypto/cipher") + } + cryptotest.TestAllImplementations(t, "aes", func(t *testing.T) { + b, _ := NewCipher(make([]byte, 16)) + cryptotest.NoExtraMethods(t, &b) + }) +} + +func BenchmarkEncrypt(b *testing.B) { + b.Run("AES-128", func(b *testing.B) { benchmarkEncrypt(b, encryptTests[1]) }) + b.Run("AES-192", func(b *testing.B) { benchmarkEncrypt(b, encryptTests[2]) }) + b.Run("AES-256", func(b *testing.B) { benchmarkEncrypt(b, encryptTests[3]) }) +} + +func benchmarkEncrypt(b *testing.B, tt CryptTest) { + c, err := NewCipher(tt.key) + if err != nil { + b.Fatal("NewCipher:", err) + } + out := make([]byte, len(tt.in)) + b.SetBytes(int64(len(out))) + b.ResetTimer() + for i := 0; i < b.N; i++ { + c.Encrypt(out, tt.in) + } +} + +func BenchmarkDecrypt(b *testing.B) { + b.Run("AES-128", func(b *testing.B) { benchmarkDecrypt(b, encryptTests[1]) }) + b.Run("AES-192", func(b *testing.B) { benchmarkDecrypt(b, encryptTests[2]) }) + b.Run("AES-256", func(b *testing.B) { benchmarkDecrypt(b, encryptTests[3]) }) +} + +func benchmarkDecrypt(b *testing.B, tt CryptTest) { + c, err := NewCipher(tt.key) + if err != nil { + b.Fatal("NewCipher:", err) + } + out := make([]byte, len(tt.out)) + b.SetBytes(int64(len(out))) + b.ResetTimer() + for i := 0; i < b.N; i++ { + c.Decrypt(out, tt.out) + } +} + +func BenchmarkCreateCipher(b *testing.B) { + b.Run("AES-128", func(b *testing.B) { benchmarkCreateCipher(b, encryptTests[1]) }) + b.Run("AES-192", func(b *testing.B) { benchmarkCreateCipher(b, encryptTests[2]) }) + b.Run("AES-256", func(b *testing.B) { benchmarkCreateCipher(b, encryptTests[3]) }) +} + +func benchmarkCreateCipher(b *testing.B, tt CryptTest) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + if _, err := NewCipher(tt.key); err != nil { + b.Fatal(err) + } + } +} diff --git a/go/src/crypto/boring/boring.go b/go/src/crypto/boring/boring.go new file mode 100644 index 0000000000000000000000000000000000000000..097c37e343fdb833dc2c1bb2c5c777d3dbe100ff --- /dev/null +++ b/go/src/crypto/boring/boring.go @@ -0,0 +1,21 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build boringcrypto + +// Package boring exposes functions that are only available when building with +// Go+BoringCrypto. This package is available on all targets as long as the +// Go+BoringCrypto toolchain is used. Use the Enabled function to determine +// whether the BoringCrypto core is actually in use. +// +// Any time the Go+BoringCrypto toolchain is used, the "boringcrypto" build tag +// is satisfied, so that applications can tag files that use this package. +package boring + +import "crypto/internal/boring" + +// Enabled reports whether BoringCrypto handles supported crypto operations. +func Enabled() bool { + return boring.Enabled +} diff --git a/go/src/crypto/boring/boring_test.go b/go/src/crypto/boring/boring_test.go new file mode 100644 index 0000000000000000000000000000000000000000..33e5f1b37e041e9c08f3a476554ce00d7be0e937 --- /dev/null +++ b/go/src/crypto/boring/boring_test.go @@ -0,0 +1,22 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build boringcrypto + +package boring_test + +import ( + "crypto/boring" + "runtime" + "testing" +) + +func TestEnabled(t *testing.T) { + supportedPlatform := runtime.GOOS == "linux" && (runtime.GOARCH == "amd64" || runtime.GOARCH == "arm64") + if supportedPlatform && !boring.Enabled() { + t.Error("Enabled returned false on a supported platform") + } else if !supportedPlatform && boring.Enabled() { + t.Error("Enabled returned true on an unsupported platform") + } +} diff --git a/go/src/crypto/boring/notboring_test.go b/go/src/crypto/boring/notboring_test.go new file mode 100644 index 0000000000000000000000000000000000000000..070162846499ab035345c6f5e2acf5d1fc2894f4 --- /dev/null +++ b/go/src/crypto/boring/notboring_test.go @@ -0,0 +1,13 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build (goexperiment.boringcrypto && !boringcrypto) || (!goexperiment.boringcrypto && boringcrypto) + +package boring_test + +import "testing" + +func TestNotBoring(t *testing.T) { + t.Error("goexperiment.boringcrypto and boringcrypto should be equivalent build tags") +} diff --git a/go/src/crypto/cipher/benchmark_test.go b/go/src/crypto/cipher/benchmark_test.go new file mode 100644 index 0000000000000000000000000000000000000000..1a5b1b1ddd552d51410b79b8d0a1476122580d8f --- /dev/null +++ b/go/src/crypto/cipher/benchmark_test.go @@ -0,0 +1,130 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cipher_test + +import ( + "crypto/aes" + "crypto/cipher" + "strconv" + "testing" +) + +func benchmarkAESGCMSeal(b *testing.B, buf []byte, keySize int) { + b.ReportAllocs() + b.SetBytes(int64(len(buf))) + + var key = make([]byte, keySize) + var nonce [12]byte + var ad [13]byte + aes, _ := aes.NewCipher(key[:]) + aesgcm, _ := cipher.NewGCM(aes) + var out []byte + + b.ResetTimer() + for i := 0; i < b.N; i++ { + out = aesgcm.Seal(out[:0], nonce[:], buf, ad[:]) + } +} + +func benchmarkAESGCMOpen(b *testing.B, buf []byte, keySize int) { + b.ReportAllocs() + b.SetBytes(int64(len(buf))) + + var key = make([]byte, keySize) + var nonce [12]byte + var ad [13]byte + aes, _ := aes.NewCipher(key[:]) + aesgcm, _ := cipher.NewGCM(aes) + var out []byte + + ct := aesgcm.Seal(nil, nonce[:], buf[:], ad[:]) + + b.ResetTimer() + for i := 0; i < b.N; i++ { + out, _ = aesgcm.Open(out[:0], nonce[:], ct, ad[:]) + } +} + +func BenchmarkAESGCM(b *testing.B) { + for _, length := range []int{64, 1350, 8 * 1024} { + b.Run("Open-128-"+strconv.Itoa(length), func(b *testing.B) { + benchmarkAESGCMOpen(b, make([]byte, length), 128/8) + }) + b.Run("Seal-128-"+strconv.Itoa(length), func(b *testing.B) { + benchmarkAESGCMSeal(b, make([]byte, length), 128/8) + }) + + b.Run("Open-256-"+strconv.Itoa(length), func(b *testing.B) { + benchmarkAESGCMOpen(b, make([]byte, length), 256/8) + }) + b.Run("Seal-256-"+strconv.Itoa(length), func(b *testing.B) { + benchmarkAESGCMSeal(b, make([]byte, length), 256/8) + }) + } +} + +func benchmarkAESStream(b *testing.B, mode func(cipher.Block, []byte) cipher.Stream, buf []byte, keySize int) { + b.SetBytes(int64(len(buf))) + + key := make([]byte, keySize) + var iv [16]byte + aes, _ := aes.NewCipher(key) + stream := mode(aes, iv[:]) + + b.ResetTimer() + for i := 0; i < b.N; i++ { + stream.XORKeyStream(buf, buf) + } +} + +// If we test exactly 1K blocks, we would generate exact multiples of +// the cipher's block size, and the cipher stream fragments would +// always be wordsize aligned, whereas non-aligned is a more typical +// use-case. +const almost1K = 1024 - 5 +const almost8K = 8*1024 - 5 + +func BenchmarkAESCTR(b *testing.B) { + for _, keyBits := range []int{128, 192, 256} { + keySize := keyBits / 8 + b.Run(strconv.Itoa(keyBits), func(b *testing.B) { + b.Run("50", func(b *testing.B) { + benchmarkAESStream(b, cipher.NewCTR, make([]byte, 50), keySize) + }) + b.Run("1K", func(b *testing.B) { + benchmarkAESStream(b, cipher.NewCTR, make([]byte, almost1K), keySize) + }) + b.Run("8K", func(b *testing.B) { + benchmarkAESStream(b, cipher.NewCTR, make([]byte, almost8K), keySize) + }) + }) + } +} + +func BenchmarkAESCBCEncrypt1K(b *testing.B) { + buf := make([]byte, 1024) + b.SetBytes(int64(len(buf))) + + var key [16]byte + var iv [16]byte + aes, _ := aes.NewCipher(key[:]) + cbc := cipher.NewCBCEncrypter(aes, iv[:]) + for i := 0; i < b.N; i++ { + cbc.CryptBlocks(buf, buf) + } +} + +func BenchmarkAESCBCDecrypt1K(b *testing.B) { + buf := make([]byte, 1024) + b.SetBytes(int64(len(buf))) + + var key [16]byte + var iv [16]byte + aes, _ := aes.NewCipher(key[:]) + cbc := cipher.NewCBCDecrypter(aes, iv[:]) + for i := 0; i < b.N; i++ { + cbc.CryptBlocks(buf, buf) + } +} diff --git a/go/src/crypto/cipher/cbc.go b/go/src/crypto/cipher/cbc.go new file mode 100644 index 0000000000000000000000000000000000000000..87bafee08ade4f7eb55ee5eaab21366ef6c8df5e --- /dev/null +++ b/go/src/crypto/cipher/cbc.go @@ -0,0 +1,207 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Cipher block chaining (CBC) mode. + +// CBC provides confidentiality by xoring (chaining) each plaintext block +// with the previous ciphertext block before applying the block cipher. + +// See NIST SP 800-38A, pp 10-11 + +package cipher + +import ( + "bytes" + "crypto/internal/fips140/aes" + "crypto/internal/fips140/alias" + "crypto/internal/fips140only" + "crypto/subtle" +) + +type cbc struct { + b Block + blockSize int + iv []byte + tmp []byte +} + +func newCBC(b Block, iv []byte) *cbc { + return &cbc{ + b: b, + blockSize: b.BlockSize(), + iv: bytes.Clone(iv), + tmp: make([]byte, b.BlockSize()), + } +} + +type cbcEncrypter cbc + +// cbcEncAble is an interface implemented by ciphers that have a specific +// optimized implementation of CBC encryption. crypto/aes doesn't use this +// anymore, and we'd like to eventually remove it. +type cbcEncAble interface { + NewCBCEncrypter(iv []byte) BlockMode +} + +// NewCBCEncrypter returns a BlockMode which encrypts in cipher block chaining +// mode, using the given Block. The length of iv must be the same as the +// Block's block size. +func NewCBCEncrypter(b Block, iv []byte) BlockMode { + if len(iv) != b.BlockSize() { + panic("cipher.NewCBCEncrypter: IV length must equal block size") + } + if b, ok := b.(*aes.Block); ok { + return aes.NewCBCEncrypter(b, [16]byte(iv)) + } + if fips140only.Enforced() { + panic("crypto/cipher: use of CBC with non-AES ciphers is not allowed in FIPS 140-only mode") + } + if cbc, ok := b.(cbcEncAble); ok { + return cbc.NewCBCEncrypter(iv) + } + return (*cbcEncrypter)(newCBC(b, iv)) +} + +// newCBCGenericEncrypter returns a BlockMode which encrypts in cipher block chaining +// mode, using the given Block. The length of iv must be the same as the +// Block's block size. This always returns the generic non-asm encrypter for use +// in fuzz testing. +func newCBCGenericEncrypter(b Block, iv []byte) BlockMode { + if len(iv) != b.BlockSize() { + panic("cipher.NewCBCEncrypter: IV length must equal block size") + } + return (*cbcEncrypter)(newCBC(b, iv)) +} + +func (x *cbcEncrypter) BlockSize() int { return x.blockSize } + +func (x *cbcEncrypter) CryptBlocks(dst, src []byte) { + if len(src)%x.blockSize != 0 { + panic("crypto/cipher: input not full blocks") + } + if len(dst) < len(src) { + panic("crypto/cipher: output smaller than input") + } + if alias.InexactOverlap(dst[:len(src)], src) { + panic("crypto/cipher: invalid buffer overlap") + } + if _, ok := x.b.(*aes.Block); ok { + panic("crypto/cipher: internal error: generic CBC used with AES") + } + + iv := x.iv + + for len(src) > 0 { + // Write the xor to dst, then encrypt in place. + subtle.XORBytes(dst[:x.blockSize], src[:x.blockSize], iv) + x.b.Encrypt(dst[:x.blockSize], dst[:x.blockSize]) + + // Move to the next block with this block as the next iv. + iv = dst[:x.blockSize] + src = src[x.blockSize:] + dst = dst[x.blockSize:] + } + + // Save the iv for the next CryptBlocks call. + copy(x.iv, iv) +} + +func (x *cbcEncrypter) SetIV(iv []byte) { + if len(iv) != len(x.iv) { + panic("cipher: incorrect length IV") + } + copy(x.iv, iv) +} + +type cbcDecrypter cbc + +// cbcDecAble is an interface implemented by ciphers that have a specific +// optimized implementation of CBC decryption. crypto/aes doesn't use this +// anymore, and we'd like to eventually remove it. +type cbcDecAble interface { + NewCBCDecrypter(iv []byte) BlockMode +} + +// NewCBCDecrypter returns a BlockMode which decrypts in cipher block chaining +// mode, using the given Block. The length of iv must be the same as the +// Block's block size and must match the iv used to encrypt the data. +func NewCBCDecrypter(b Block, iv []byte) BlockMode { + if len(iv) != b.BlockSize() { + panic("cipher.NewCBCDecrypter: IV length must equal block size") + } + if b, ok := b.(*aes.Block); ok { + return aes.NewCBCDecrypter(b, [16]byte(iv)) + } + if fips140only.Enforced() { + panic("crypto/cipher: use of CBC with non-AES ciphers is not allowed in FIPS 140-only mode") + } + if cbc, ok := b.(cbcDecAble); ok { + return cbc.NewCBCDecrypter(iv) + } + return (*cbcDecrypter)(newCBC(b, iv)) +} + +// newCBCGenericDecrypter returns a BlockMode which encrypts in cipher block chaining +// mode, using the given Block. The length of iv must be the same as the +// Block's block size. This always returns the generic non-asm decrypter for use in +// fuzz testing. +func newCBCGenericDecrypter(b Block, iv []byte) BlockMode { + if len(iv) != b.BlockSize() { + panic("cipher.NewCBCDecrypter: IV length must equal block size") + } + return (*cbcDecrypter)(newCBC(b, iv)) +} + +func (x *cbcDecrypter) BlockSize() int { return x.blockSize } + +func (x *cbcDecrypter) CryptBlocks(dst, src []byte) { + if len(src)%x.blockSize != 0 { + panic("crypto/cipher: input not full blocks") + } + if len(dst) < len(src) { + panic("crypto/cipher: output smaller than input") + } + if alias.InexactOverlap(dst[:len(src)], src) { + panic("crypto/cipher: invalid buffer overlap") + } + if _, ok := x.b.(*aes.Block); ok { + panic("crypto/cipher: internal error: generic CBC used with AES") + } + if len(src) == 0 { + return + } + + // For each block, we need to xor the decrypted data with the previous block's ciphertext (the iv). + // To avoid making a copy each time, we loop over the blocks BACKWARDS. + end := len(src) + start := end - x.blockSize + prev := start - x.blockSize + + // Copy the last block of ciphertext in preparation as the new iv. + copy(x.tmp, src[start:end]) + + // Loop over all but the first block. + for start > 0 { + x.b.Decrypt(dst[start:end], src[start:end]) + subtle.XORBytes(dst[start:end], dst[start:end], src[prev:start]) + + end = start + start = prev + prev -= x.blockSize + } + + // The first block is special because it uses the saved iv. + x.b.Decrypt(dst[start:end], src[start:end]) + subtle.XORBytes(dst[start:end], dst[start:end], x.iv) + + // Set the new iv to the first block we copied earlier. + x.iv, x.tmp = x.tmp, x.iv +} + +func (x *cbcDecrypter) SetIV(iv []byte) { + if len(iv) != len(x.iv) { + panic("cipher: incorrect length IV") + } + copy(x.iv, iv) +} diff --git a/go/src/crypto/cipher/cbc_aes_test.go b/go/src/crypto/cipher/cbc_aes_test.go new file mode 100644 index 0000000000000000000000000000000000000000..20355e9ec2eb8f1e85b1d563369db63749cd170a --- /dev/null +++ b/go/src/crypto/cipher/cbc_aes_test.go @@ -0,0 +1,113 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// CBC AES test vectors. + +// See U.S. National Institute of Standards and Technology (NIST) +// Special Publication 800-38A, ``Recommendation for Block Cipher +// Modes of Operation,'' 2001 Edition, pp. 24-29. + +package cipher_test + +import ( + "bytes" + "crypto/aes" + "crypto/cipher" + "crypto/internal/cryptotest" + "testing" +) + +var cbcAESTests = []struct { + name string + key []byte + iv []byte + in []byte + out []byte +}{ + // NIST SP 800-38A pp 27-29 + { + "CBC-AES128", + commonKey128, + commonIV, + commonInput, + []byte{ + 0x76, 0x49, 0xab, 0xac, 0x81, 0x19, 0xb2, 0x46, 0xce, 0xe9, 0x8e, 0x9b, 0x12, 0xe9, 0x19, 0x7d, + 0x50, 0x86, 0xcb, 0x9b, 0x50, 0x72, 0x19, 0xee, 0x95, 0xdb, 0x11, 0x3a, 0x91, 0x76, 0x78, 0xb2, + 0x73, 0xbe, 0xd6, 0xb8, 0xe3, 0xc1, 0x74, 0x3b, 0x71, 0x16, 0xe6, 0x9e, 0x22, 0x22, 0x95, 0x16, + 0x3f, 0xf1, 0xca, 0xa1, 0x68, 0x1f, 0xac, 0x09, 0x12, 0x0e, 0xca, 0x30, 0x75, 0x86, 0xe1, 0xa7, + }, + }, + { + "CBC-AES192", + commonKey192, + commonIV, + commonInput, + []byte{ + 0x4f, 0x02, 0x1d, 0xb2, 0x43, 0xbc, 0x63, 0x3d, 0x71, 0x78, 0x18, 0x3a, 0x9f, 0xa0, 0x71, 0xe8, + 0xb4, 0xd9, 0xad, 0xa9, 0xad, 0x7d, 0xed, 0xf4, 0xe5, 0xe7, 0x38, 0x76, 0x3f, 0x69, 0x14, 0x5a, + 0x57, 0x1b, 0x24, 0x20, 0x12, 0xfb, 0x7a, 0xe0, 0x7f, 0xa9, 0xba, 0xac, 0x3d, 0xf1, 0x02, 0xe0, + 0x08, 0xb0, 0xe2, 0x79, 0x88, 0x59, 0x88, 0x81, 0xd9, 0x20, 0xa9, 0xe6, 0x4f, 0x56, 0x15, 0xcd, + }, + }, + { + "CBC-AES256", + commonKey256, + commonIV, + commonInput, + []byte{ + 0xf5, 0x8c, 0x4c, 0x04, 0xd6, 0xe5, 0xf1, 0xba, 0x77, 0x9e, 0xab, 0xfb, 0x5f, 0x7b, 0xfb, 0xd6, + 0x9c, 0xfc, 0x4e, 0x96, 0x7e, 0xdb, 0x80, 0x8d, 0x67, 0x9f, 0x77, 0x7b, 0xc6, 0x70, 0x2c, 0x7d, + 0x39, 0xf2, 0x33, 0x69, 0xa9, 0xd9, 0xba, 0xcf, 0xa5, 0x30, 0xe2, 0x63, 0x04, 0x23, 0x14, 0x61, + 0xb2, 0xeb, 0x05, 0xe2, 0xc3, 0x9b, 0xe9, 0xfc, 0xda, 0x6c, 0x19, 0x07, 0x8c, 0x6a, 0x9d, 0x1b, + }, + }, +} + +func TestCBCEncrypterAES(t *testing.T) { + cryptotest.TestAllImplementations(t, "aes", testCBCEncrypterAES) +} + +func testCBCEncrypterAES(t *testing.T) { + for _, test := range cbcAESTests { + c, err := aes.NewCipher(test.key) + if err != nil { + t.Errorf("%s: NewCipher(%d bytes) = %s", test.name, len(test.key), err) + continue + } + + encrypter := cipher.NewCBCEncrypter(c, test.iv) + + data := make([]byte, len(test.in)) + copy(data, test.in) + + encrypter.CryptBlocks(data, data) + if !bytes.Equal(test.out, data) { + t.Errorf("%s: CBCEncrypter\nhave %x\nwant %x", test.name, data, test.out) + } + } +} + +func TestCBCDecrypterAES(t *testing.T) { + cryptotest.TestAllImplementations(t, "aes", testCBCDecrypterAES) +} + +func testCBCDecrypterAES(t *testing.T) { + for _, test := range cbcAESTests { + c, err := aes.NewCipher(test.key) + if err != nil { + t.Errorf("%s: NewCipher(%d bytes) = %s", test.name, len(test.key), err) + continue + } + + decrypter := cipher.NewCBCDecrypter(c, test.iv) + + data := make([]byte, len(test.out)) + copy(data, test.out) + + decrypter.CryptBlocks(data, data) + if !bytes.Equal(test.in, data) { + t.Errorf("%s: CBCDecrypter\nhave %x\nwant %x", test.name, data, test.in) + } + } +} diff --git a/go/src/crypto/cipher/cbc_test.go b/go/src/crypto/cipher/cbc_test.go new file mode 100644 index 0000000000000000000000000000000000000000..05accd592db052e359497f846f31f47e43153de2 --- /dev/null +++ b/go/src/crypto/cipher/cbc_test.go @@ -0,0 +1,68 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cipher_test + +import ( + "crypto/aes" + "crypto/cipher" + "crypto/des" + "crypto/internal/cryptotest" + "fmt" + "io" + "math/rand" + "testing" + "time" +) + +// Test CBC Blockmode against the general cipher.BlockMode interface tester +func TestCBCBlockMode(t *testing.T) { + cryptotest.TestAllImplementations(t, "aes", func(t *testing.T) { + for _, keylen := range []int{128, 192, 256} { + t.Run(fmt.Sprintf("AES-%d", keylen), func(t *testing.T) { + rng := newRandReader(t) + + key := make([]byte, keylen/8) + rng.Read(key) + + block, err := aes.NewCipher(key) + if err != nil { + panic(err) + } + + cryptotest.TestBlockMode(t, block, cipher.NewCBCEncrypter, cipher.NewCBCDecrypter) + }) + } + }) + + t.Run("DES", func(t *testing.T) { + rng := newRandReader(t) + + key := make([]byte, 8) + rng.Read(key) + + block, err := des.NewCipher(key) + if err != nil { + panic(err) + } + + cryptotest.TestBlockMode(t, block, cipher.NewCBCEncrypter, cipher.NewCBCDecrypter) + }) +} + +func TestCBCExtraMethods(t *testing.T) { + block, _ := aes.NewCipher(make([]byte, 16)) + iv := make([]byte, block.BlockSize()) + s := cipher.NewCBCEncrypter(block, iv) + cryptotest.NoExtraMethods(t, &s, "SetIV") + + s = cipher.NewCBCDecrypter(block, iv) + cryptotest.NoExtraMethods(t, &s, "SetIV") +} + +func newRandReader(t *testing.T) io.Reader { + seed := time.Now().UnixNano() + t.Logf("Deterministic RNG seed: 0x%x", seed) + return rand.New(rand.NewSource(seed)) +} diff --git a/go/src/crypto/cipher/cfb.go b/go/src/crypto/cipher/cfb.go new file mode 100644 index 0000000000000000000000000000000000000000..8ede955b9171a22cff17da52a832f48b03dc2a12 --- /dev/null +++ b/go/src/crypto/cipher/cfb.go @@ -0,0 +1,102 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// CFB (Cipher Feedback) Mode. + +package cipher + +import ( + "crypto/internal/fips140/alias" + "crypto/internal/fips140only" + "crypto/subtle" +) + +type cfb struct { + b Block + next []byte + out []byte + outUsed int + + decrypt bool +} + +func (x *cfb) XORKeyStream(dst, src []byte) { + if len(dst) < len(src) { + panic("crypto/cipher: output smaller than input") + } + if alias.InexactOverlap(dst[:len(src)], src) { + panic("crypto/cipher: invalid buffer overlap") + } + for len(src) > 0 { + if x.outUsed == len(x.out) { + x.b.Encrypt(x.out, x.next) + x.outUsed = 0 + } + + if x.decrypt { + // We can precompute a larger segment of the + // keystream on decryption. This will allow + // larger batches for xor, and we should be + // able to match CTR/OFB performance. + copy(x.next[x.outUsed:], src) + } + n := subtle.XORBytes(dst, src, x.out[x.outUsed:]) + if !x.decrypt { + copy(x.next[x.outUsed:], dst) + } + dst = dst[n:] + src = src[n:] + x.outUsed += n + } +} + +// NewCFBEncrypter returns a [Stream] which encrypts with cipher feedback mode, +// using the given [Block]. The iv must be the same length as the [Block]'s block +// size. +// +// Deprecated: CFB mode is not authenticated, which generally enables active +// attacks to manipulate and recover the plaintext. It is recommended that +// applications use [AEAD] modes instead. The standard library implementation of +// CFB is also unoptimized and not validated as part of the FIPS 140-3 module. +// If an unauthenticated [Stream] mode is required, use [NewCTR] instead. +func NewCFBEncrypter(block Block, iv []byte) Stream { + if fips140only.Enforced() { + panic("crypto/cipher: use of CFB is not allowed in FIPS 140-only mode") + } + return newCFB(block, iv, false) +} + +// NewCFBDecrypter returns a [Stream] which decrypts with cipher feedback mode, +// using the given [Block]. The iv must be the same length as the [Block]'s block +// size. +// +// Deprecated: CFB mode is not authenticated, which generally enables active +// attacks to manipulate and recover the plaintext. It is recommended that +// applications use [AEAD] modes instead. The standard library implementation of +// CFB is also unoptimized and not validated as part of the FIPS 140-3 module. +// If an unauthenticated [Stream] mode is required, use [NewCTR] instead. +func NewCFBDecrypter(block Block, iv []byte) Stream { + if fips140only.Enforced() { + panic("crypto/cipher: use of CFB is not allowed in FIPS 140-only mode") + } + return newCFB(block, iv, true) +} + +func newCFB(block Block, iv []byte, decrypt bool) Stream { + blockSize := block.BlockSize() + if len(iv) != blockSize { + // Stack trace will indicate whether it was de- or en-cryption. + panic("cipher.newCFB: IV length must equal block size") + } + x := &cfb{ + b: block, + out: make([]byte, blockSize), + next: make([]byte, blockSize), + outUsed: blockSize, + decrypt: decrypt, + } + copy(x.next, iv) + + return x +} diff --git a/go/src/crypto/cipher/cfb_test.go b/go/src/crypto/cipher/cfb_test.go new file mode 100644 index 0000000000000000000000000000000000000000..67033d9a3bba1a50f2afaf7a393d000a74e0e94b --- /dev/null +++ b/go/src/crypto/cipher/cfb_test.go @@ -0,0 +1,160 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cipher_test + +import ( + "bytes" + "crypto/aes" + "crypto/cipher" + "crypto/des" + "crypto/internal/cryptotest" + "crypto/rand" + "encoding/hex" + "fmt" + "testing" +) + +// cfbTests contains the test vectors from +// https://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf, section +// F.3.13. +var cfbTests = []struct { + key, iv, plaintext, ciphertext string +}{ + { + "2b7e151628aed2a6abf7158809cf4f3c", + "000102030405060708090a0b0c0d0e0f", + "6bc1bee22e409f96e93d7e117393172a", + "3b3fd92eb72dad20333449f8e83cfb4a", + }, + { + "2b7e151628aed2a6abf7158809cf4f3c", + "3B3FD92EB72DAD20333449F8E83CFB4A", + "ae2d8a571e03ac9c9eb76fac45af8e51", + "c8a64537a0b3a93fcde3cdad9f1ce58b", + }, + { + "2b7e151628aed2a6abf7158809cf4f3c", + "C8A64537A0B3A93FCDE3CDAD9F1CE58B", + "30c81c46a35ce411e5fbc1191a0a52ef", + "26751f67a3cbb140b1808cf187a4f4df", + }, + { + "2b7e151628aed2a6abf7158809cf4f3c", + "26751F67A3CBB140B1808CF187A4F4DF", + "f69f2445df4f9b17ad2b417be66c3710", + "c04b05357c5d1c0eeac4c66f9ff7f2e6", + }, +} + +func TestCFBVectors(t *testing.T) { + for i, test := range cfbTests { + key, err := hex.DecodeString(test.key) + if err != nil { + t.Fatal(err) + } + iv, err := hex.DecodeString(test.iv) + if err != nil { + t.Fatal(err) + } + plaintext, err := hex.DecodeString(test.plaintext) + if err != nil { + t.Fatal(err) + } + expected, err := hex.DecodeString(test.ciphertext) + if err != nil { + t.Fatal(err) + } + + block, err := aes.NewCipher(key) + if err != nil { + t.Fatal(err) + } + + ciphertext := make([]byte, len(plaintext)) + cfb := cipher.NewCFBEncrypter(block, iv) + cfb.XORKeyStream(ciphertext, plaintext) + + if !bytes.Equal(ciphertext, expected) { + t.Errorf("#%d: wrong output: got %x, expected %x", i, ciphertext, expected) + } + + cfbdec := cipher.NewCFBDecrypter(block, iv) + plaintextCopy := make([]byte, len(ciphertext)) + cfbdec.XORKeyStream(plaintextCopy, ciphertext) + + if !bytes.Equal(plaintextCopy, plaintext) { + t.Errorf("#%d: wrong plaintext: got %x, expected %x", i, plaintextCopy, plaintext) + } + } +} + +func TestCFBInverse(t *testing.T) { + block, err := aes.NewCipher(commonKey128) + if err != nil { + t.Error(err) + return + } + + plaintext := []byte("this is the plaintext. this is the plaintext.") + iv := make([]byte, block.BlockSize()) + rand.Reader.Read(iv) + cfb := cipher.NewCFBEncrypter(block, iv) + ciphertext := make([]byte, len(plaintext)) + copy(ciphertext, plaintext) + cfb.XORKeyStream(ciphertext, ciphertext) + + cfbdec := cipher.NewCFBDecrypter(block, iv) + plaintextCopy := make([]byte, len(plaintext)) + copy(plaintextCopy, ciphertext) + cfbdec.XORKeyStream(plaintextCopy, plaintextCopy) + + if !bytes.Equal(plaintextCopy, plaintext) { + t.Errorf("got: %x, want: %x", plaintextCopy, plaintext) + } +} + +func TestCFBStream(t *testing.T) { + + for _, keylen := range []int{128, 192, 256} { + + t.Run(fmt.Sprintf("AES-%d", keylen), func(t *testing.T) { + rng := newRandReader(t) + + key := make([]byte, keylen/8) + rng.Read(key) + + block, err := aes.NewCipher(key) + if err != nil { + panic(err) + } + + t.Run("Encrypter", func(t *testing.T) { + cryptotest.TestStreamFromBlock(t, block, cipher.NewCFBEncrypter) + }) + t.Run("Decrypter", func(t *testing.T) { + cryptotest.TestStreamFromBlock(t, block, cipher.NewCFBDecrypter) + }) + }) + } + + t.Run("DES", func(t *testing.T) { + rng := newRandReader(t) + + key := make([]byte, 8) + rng.Read(key) + + block, err := des.NewCipher(key) + if err != nil { + panic(err) + } + + t.Run("Encrypter", func(t *testing.T) { + cryptotest.TestStreamFromBlock(t, block, cipher.NewCFBEncrypter) + }) + t.Run("Decrypter", func(t *testing.T) { + cryptotest.TestStreamFromBlock(t, block, cipher.NewCFBDecrypter) + }) + }) +} diff --git a/go/src/crypto/cipher/cipher.go b/go/src/crypto/cipher/cipher.go new file mode 100644 index 0000000000000000000000000000000000000000..4d631991ee11041cc70339bdc7b0e8af9b02bad3 --- /dev/null +++ b/go/src/crypto/cipher/cipher.go @@ -0,0 +1,98 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package cipher implements standard block cipher modes that can be wrapped +// around low-level block cipher implementations. +// See https://csrc.nist.gov/groups/ST/toolkit/BCM/current_modes.html +// and NIST Special Publication 800-38A. +package cipher + +// A Block represents an implementation of block cipher +// using a given key. It provides the capability to encrypt +// or decrypt individual blocks. The mode implementations +// extend that capability to streams of blocks. +type Block interface { + // BlockSize returns the cipher's block size. + BlockSize() int + + // Encrypt encrypts the first block in src into dst. + // Dst and src must overlap entirely or not at all. + Encrypt(dst, src []byte) + + // Decrypt decrypts the first block in src into dst. + // Dst and src must overlap entirely or not at all. + Decrypt(dst, src []byte) +} + +// A Stream represents a stream cipher. +type Stream interface { + // XORKeyStream XORs each byte in the given slice with a byte from the + // cipher's key stream. Dst and src must overlap entirely or not at all. + // + // If len(dst) < len(src), XORKeyStream should panic. It is acceptable + // to pass a dst bigger than src, and in that case, XORKeyStream will + // only update dst[:len(src)] and will not touch the rest of dst. + // + // Multiple calls to XORKeyStream behave as if the concatenation of + // the src buffers was passed in a single run. That is, Stream + // maintains state and does not reset at each XORKeyStream call. + XORKeyStream(dst, src []byte) +} + +// A BlockMode represents a block cipher running in a block-based mode (CBC, +// ECB etc). +type BlockMode interface { + // BlockSize returns the mode's block size. + BlockSize() int + + // CryptBlocks encrypts or decrypts a number of blocks. The length of + // src must be a multiple of the block size. Dst and src must overlap + // entirely or not at all. + // + // If len(dst) < len(src), CryptBlocks should panic. It is acceptable + // to pass a dst bigger than src, and in that case, CryptBlocks will + // only update dst[:len(src)] and will not touch the rest of dst. + // + // Multiple calls to CryptBlocks behave as if the concatenation of + // the src buffers was passed in a single run. That is, BlockMode + // maintains state and does not reset at each CryptBlocks call. + CryptBlocks(dst, src []byte) +} + +// AEAD is a cipher mode providing authenticated encryption with associated +// data. For a description of the methodology, see +// https://en.wikipedia.org/wiki/Authenticated_encryption. +type AEAD interface { + // NonceSize returns the size of the nonce that must be passed to Seal + // and Open. + NonceSize() int + + // Overhead returns the maximum difference between the lengths of a + // plaintext and its ciphertext. + Overhead() int + + // Seal encrypts and authenticates plaintext, authenticates the + // additional data and appends the result to dst, returning the updated + // slice. The nonce must be NonceSize() bytes long and unique for all + // time, for a given key. + // + // To reuse plaintext's storage for the encrypted output, use plaintext[:0] + // as dst. Otherwise, the remaining capacity of dst must not overlap plaintext. + // dst and additionalData may not overlap. + Seal(dst, nonce, plaintext, additionalData []byte) []byte + + // Open decrypts and authenticates ciphertext, authenticates the + // additional data and, if successful, appends the resulting plaintext + // to dst, returning the updated slice. The nonce must be NonceSize() + // bytes long and both it and the additional data must match the + // value passed to Seal. + // + // To reuse ciphertext's storage for the decrypted output, use ciphertext[:0] + // as dst. Otherwise, the remaining capacity of dst must not overlap ciphertext. + // dst and additionalData may not overlap. + // + // Even if the function fails, the contents of dst, up to its capacity, + // may be overwritten. + Open(dst, nonce, ciphertext, additionalData []byte) ([]byte, error) +} diff --git a/go/src/crypto/cipher/common_test.go b/go/src/crypto/cipher/common_test.go new file mode 100644 index 0000000000000000000000000000000000000000..c75c919d1758078aa280e712b205dd66b40db614 --- /dev/null +++ b/go/src/crypto/cipher/common_test.go @@ -0,0 +1,28 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cipher_test + +// Common values for tests. + +var commonInput = []byte{ + 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, + 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51, + 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef, + 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10, +} + +var commonKey128 = []byte{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c} + +var commonKey192 = []byte{ + 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52, 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5, + 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b, +} + +var commonKey256 = []byte{ + 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe, 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81, + 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7, 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4, +} + +var commonIV = []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f} diff --git a/go/src/crypto/cipher/ctr.go b/go/src/crypto/cipher/ctr.go new file mode 100644 index 0000000000000000000000000000000000000000..8e63ed7e668a4cbf19482ae21c774a18e58dfa84 --- /dev/null +++ b/go/src/crypto/cipher/ctr.go @@ -0,0 +1,115 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Counter (CTR) mode. + +// CTR converts a block cipher into a stream cipher by +// repeatedly encrypting an incrementing counter and +// xoring the resulting stream of data with the input. + +// See NIST SP 800-38A, pp 13-15 + +package cipher + +import ( + "bytes" + "crypto/internal/fips140/aes" + "crypto/internal/fips140/alias" + "crypto/internal/fips140only" + "crypto/subtle" +) + +type ctr struct { + b Block + ctr []byte + out []byte + outUsed int +} + +const streamBufferSize = 512 + +// ctrAble is an interface implemented by ciphers that have a specific optimized +// implementation of CTR. crypto/aes doesn't use this anymore, and we'd like to +// eventually remove it. +type ctrAble interface { + NewCTR(iv []byte) Stream +} + +// NewCTR returns a [Stream] which encrypts/decrypts using the given [Block] in +// counter mode. The length of iv must be the same as the [Block]'s block size. +func NewCTR(block Block, iv []byte) Stream { + if block, ok := block.(*aes.Block); ok { + return aesCtrWrapper{aes.NewCTR(block, iv)} + } + if fips140only.Enforced() { + panic("crypto/cipher: use of CTR with non-AES ciphers is not allowed in FIPS 140-only mode") + } + if ctr, ok := block.(ctrAble); ok { + return ctr.NewCTR(iv) + } + if len(iv) != block.BlockSize() { + panic("cipher.NewCTR: IV length must equal block size") + } + bufSize := streamBufferSize + if bufSize < block.BlockSize() { + bufSize = block.BlockSize() + } + return &ctr{ + b: block, + ctr: bytes.Clone(iv), + out: make([]byte, 0, bufSize), + outUsed: 0, + } +} + +// aesCtrWrapper hides extra methods from aes.CTR. +type aesCtrWrapper struct { + c *aes.CTR +} + +func (x aesCtrWrapper) XORKeyStream(dst, src []byte) { + x.c.XORKeyStream(dst, src) +} + +func (x *ctr) refill() { + remain := len(x.out) - x.outUsed + copy(x.out, x.out[x.outUsed:]) + x.out = x.out[:cap(x.out)] + bs := x.b.BlockSize() + for remain <= len(x.out)-bs { + x.b.Encrypt(x.out[remain:], x.ctr) + remain += bs + + // Increment counter + for i := len(x.ctr) - 1; i >= 0; i-- { + x.ctr[i]++ + if x.ctr[i] != 0 { + break + } + } + } + x.out = x.out[:remain] + x.outUsed = 0 +} + +func (x *ctr) XORKeyStream(dst, src []byte) { + if len(dst) < len(src) { + panic("crypto/cipher: output smaller than input") + } + if alias.InexactOverlap(dst[:len(src)], src) { + panic("crypto/cipher: invalid buffer overlap") + } + if _, ok := x.b.(*aes.Block); ok { + panic("crypto/cipher: internal error: generic CTR used with AES") + } + for len(src) > 0 { + if x.outUsed >= len(x.out)-x.b.BlockSize() { + x.refill() + } + n := subtle.XORBytes(dst, src, x.out[x.outUsed:]) + dst = dst[n:] + src = src[n:] + x.outUsed += n + } +} diff --git a/go/src/crypto/cipher/ctr_aes_test.go b/go/src/crypto/cipher/ctr_aes_test.go new file mode 100644 index 0000000000000000000000000000000000000000..1d8ae78674ebe2294aab961b8e0ccdd33bf073f6 --- /dev/null +++ b/go/src/crypto/cipher/ctr_aes_test.go @@ -0,0 +1,363 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// CTR AES test vectors. + +// See U.S. National Institute of Standards and Technology (NIST) +// Special Publication 800-38A, ``Recommendation for Block Cipher +// Modes of Operation,'' 2001 Edition, pp. 55-58. + +package cipher_test + +import ( + "bytes" + "crypto/aes" + "crypto/cipher" + "crypto/internal/boring" + "crypto/internal/cryptotest" + fipsaes "crypto/internal/fips140/aes" + "encoding/binary" + "encoding/hex" + "fmt" + "math/rand" + "sort" + "strings" + "testing" +) + +var commonCounter = []byte{0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff} + +var ctrAESTests = []struct { + name string + key []byte + iv []byte + in []byte + out []byte +}{ + // NIST SP 800-38A pp 55-58 + { + "CTR-AES128", + commonKey128, + commonCounter, + commonInput, + []byte{ + 0x87, 0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26, 0x1b, 0xef, 0x68, 0x64, 0x99, 0x0d, 0xb6, 0xce, + 0x98, 0x06, 0xf6, 0x6b, 0x79, 0x70, 0xfd, 0xff, 0x86, 0x17, 0x18, 0x7b, 0xb9, 0xff, 0xfd, 0xff, + 0x5a, 0xe4, 0xdf, 0x3e, 0xdb, 0xd5, 0xd3, 0x5e, 0x5b, 0x4f, 0x09, 0x02, 0x0d, 0xb0, 0x3e, 0xab, + 0x1e, 0x03, 0x1d, 0xda, 0x2f, 0xbe, 0x03, 0xd1, 0x79, 0x21, 0x70, 0xa0, 0xf3, 0x00, 0x9c, 0xee, + }, + }, + { + "CTR-AES192", + commonKey192, + commonCounter, + commonInput, + []byte{ + 0x1a, 0xbc, 0x93, 0x24, 0x17, 0x52, 0x1c, 0xa2, 0x4f, 0x2b, 0x04, 0x59, 0xfe, 0x7e, 0x6e, 0x0b, + 0x09, 0x03, 0x39, 0xec, 0x0a, 0xa6, 0xfa, 0xef, 0xd5, 0xcc, 0xc2, 0xc6, 0xf4, 0xce, 0x8e, 0x94, + 0x1e, 0x36, 0xb2, 0x6b, 0xd1, 0xeb, 0xc6, 0x70, 0xd1, 0xbd, 0x1d, 0x66, 0x56, 0x20, 0xab, 0xf7, + 0x4f, 0x78, 0xa7, 0xf6, 0xd2, 0x98, 0x09, 0x58, 0x5a, 0x97, 0xda, 0xec, 0x58, 0xc6, 0xb0, 0x50, + }, + }, + { + "CTR-AES256", + commonKey256, + commonCounter, + commonInput, + []byte{ + 0x60, 0x1e, 0xc3, 0x13, 0x77, 0x57, 0x89, 0xa5, 0xb7, 0xa7, 0xf5, 0x04, 0xbb, 0xf3, 0xd2, 0x28, + 0xf4, 0x43, 0xe3, 0xca, 0x4d, 0x62, 0xb5, 0x9a, 0xca, 0x84, 0xe9, 0x90, 0xca, 0xca, 0xf5, 0xc5, + 0x2b, 0x09, 0x30, 0xda, 0xa2, 0x3d, 0xe9, 0x4c, 0xe8, 0x70, 0x17, 0xba, 0x2d, 0x84, 0x98, 0x8d, + 0xdf, 0xc9, 0xc5, 0x8d, 0xb6, 0x7a, 0xad, 0xa6, 0x13, 0xc2, 0xdd, 0x08, 0x45, 0x79, 0x41, 0xa6, + }, + }, +} + +func TestCTR_AES(t *testing.T) { + cryptotest.TestAllImplementations(t, "aes", testCTR_AES) +} + +func testCTR_AES(t *testing.T) { + for _, tt := range ctrAESTests { + test := tt.name + + c, err := aes.NewCipher(tt.key) + if err != nil { + t.Errorf("%s: NewCipher(%d bytes) = %s", test, len(tt.key), err) + continue + } + + for j := 0; j <= 5; j += 5 { + in := tt.in[0 : len(tt.in)-j] + ctr := cipher.NewCTR(c, tt.iv) + encrypted := make([]byte, len(in)) + ctr.XORKeyStream(encrypted, in) + if out := tt.out[:len(in)]; !bytes.Equal(out, encrypted) { + t.Errorf("%s/%d: CTR\ninpt %x\nhave %x\nwant %x", test, len(in), in, encrypted, out) + } + } + + for j := 0; j <= 7; j += 7 { + in := tt.out[0 : len(tt.out)-j] + ctr := cipher.NewCTR(c, tt.iv) + plain := make([]byte, len(in)) + ctr.XORKeyStream(plain, in) + if out := tt.in[:len(in)]; !bytes.Equal(out, plain) { + t.Errorf("%s/%d: CTRReader\nhave %x\nwant %x", test, len(out), plain, out) + } + } + + if t.Failed() { + break + } + } +} + +func makeTestingCiphers(aesBlock cipher.Block, iv []byte) (genericCtr, multiblockCtr cipher.Stream) { + return cipher.NewCTR(wrap(aesBlock), iv), cipher.NewCTR(aesBlock, iv) +} + +// TestCTR_AES_blocks8FastPathMatchesGeneric ensures the overlow aware branch +// produces identical keystreams to the generic counter walker across +// representative IVs, including near-overflow cases. +func TestCTR_AES_blocks8FastPathMatchesGeneric(t *testing.T) { + key := make([]byte, aes.BlockSize) + block, err := aes.NewCipher(key) + if err != nil { + t.Fatal(err) + } + if _, ok := block.(*fipsaes.Block); !ok { + t.Skip("requires crypto/internal/fips140/aes") + } + + keystream := make([]byte, 8*aes.BlockSize) + + testCases := []struct { + name string + hi uint64 + lo uint64 + }{ + {"Zero", 0, 0}, + {"NearOverflowMinus7", 1, ^uint64(0) - 7}, + {"NearOverflowMinus6", 2, ^uint64(0) - 6}, + {"Overflow", 0, ^uint64(0)}, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + var iv [aes.BlockSize]byte + binary.BigEndian.PutUint64(iv[0:8], tc.hi) + binary.BigEndian.PutUint64(iv[8:], tc.lo) + + generic, multiblock := makeTestingCiphers(block, iv[:]) + + genericOut := make([]byte, len(keystream)) + multiblockOut := make([]byte, len(keystream)) + + generic.XORKeyStream(genericOut, keystream) + multiblock.XORKeyStream(multiblockOut, keystream) + + if !bytes.Equal(multiblockOut, genericOut) { + t.Fatalf("mismatch for iv %#x:%#x\n"+ + "asm keystream: %x\n"+ + "gen keystream: %x\n"+ + "asm counters: %x\n"+ + "gen counters: %x", + tc.hi, tc.lo, multiblockOut, genericOut, + extractCounters(block, multiblockOut), + extractCounters(block, genericOut)) + } + }) + } +} + +func randBytes(t *testing.T, r *rand.Rand, count int) []byte { + t.Helper() + buf := make([]byte, count) + n, err := r.Read(buf) + if err != nil { + t.Fatal(err) + } + if n != count { + t.Fatal("short read from Rand") + } + return buf +} + +const aesBlockSize = 16 + +type ctrAble interface { + NewCTR(iv []byte) cipher.Stream +} + +// Verify that multiblock AES CTR (src/crypto/aes/ctr_*.s) +// produces the same results as generic single-block implementation. +// This test runs checks on random IV. +func TestCTR_AES_multiblock_random_IV(t *testing.T) { + r := rand.New(rand.NewSource(54321)) + iv := randBytes(t, r, aesBlockSize) + const Size = 100 + + for _, keySize := range []int{16, 24, 32} { + t.Run(fmt.Sprintf("keySize=%d", keySize), func(t *testing.T) { + key := randBytes(t, r, keySize) + aesBlock, err := aes.NewCipher(key) + if err != nil { + t.Fatal(err) + } + genericCtr, _ := makeTestingCiphers(aesBlock, iv) + + plaintext := randBytes(t, r, Size) + + // Generate reference ciphertext. + genericCiphertext := make([]byte, len(plaintext)) + genericCtr.XORKeyStream(genericCiphertext, plaintext) + + // Split the text in 3 parts in all possible ways and encrypt them + // individually using multiblock implementation to catch edge cases. + + for part1 := 0; part1 <= Size; part1++ { + t.Run(fmt.Sprintf("part1=%d", part1), func(t *testing.T) { + for part2 := 0; part2 <= Size-part1; part2++ { + t.Run(fmt.Sprintf("part2=%d", part2), func(t *testing.T) { + _, multiblockCtr := makeTestingCiphers(aesBlock, iv) + multiblockCiphertext := make([]byte, len(plaintext)) + multiblockCtr.XORKeyStream(multiblockCiphertext[:part1], plaintext[:part1]) + multiblockCtr.XORKeyStream(multiblockCiphertext[part1:part1+part2], plaintext[part1:part1+part2]) + multiblockCtr.XORKeyStream(multiblockCiphertext[part1+part2:], plaintext[part1+part2:]) + if !bytes.Equal(genericCiphertext, multiblockCiphertext) { + t.Fatal("multiblock CTR's output does not match generic CTR's output") + } + }) + } + }) + } + }) + } +} + +func parseHex(str string) []byte { + b, err := hex.DecodeString(strings.ReplaceAll(str, " ", "")) + if err != nil { + panic(err) + } + return b +} + +// Verify that multiblock AES CTR (src/crypto/aes/ctr_*.s) +// produces the same results as generic single-block implementation. +// This test runs checks on edge cases (IV overflows). +func TestCTR_AES_multiblock_overflow_IV(t *testing.T) { + r := rand.New(rand.NewSource(987654)) + + const Size = 4096 + plaintext := randBytes(t, r, Size) + + ivs := [][]byte{ + parseHex("00 00 00 00 00 00 00 00 FF FF FF FF FF FF FF FF"), + parseHex("FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF"), + parseHex("FF FF FF FF FF FF FF FF 00 00 00 00 00 00 00 00"), + parseHex("FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF fe"), + parseHex("00 00 00 00 00 00 00 00 FF FF FF FF FF FF FF fe"), + parseHex("FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 00"), + parseHex("00 00 00 00 00 00 00 01 FF FF FF FF FF FF FF 00"), + parseHex("00 00 00 00 00 00 00 01 FF FF FF FF FF FF FF FF"), + parseHex("00 00 00 00 00 00 00 01 FF FF FF FF FF FF FF fe"), + parseHex("00 00 00 00 00 00 00 01 FF FF FF FF FF FF FF 00"), + } + + for _, keySize := range []int{16, 24, 32} { + t.Run(fmt.Sprintf("keySize=%d", keySize), func(t *testing.T) { + for _, iv := range ivs { + key := randBytes(t, r, keySize) + aesBlock, err := aes.NewCipher(key) + if err != nil { + t.Fatal(err) + } + + t.Run(fmt.Sprintf("iv=%s", hex.EncodeToString(iv)), func(t *testing.T) { + for _, offset := range []int{0, 1, 16, 1024} { + t.Run(fmt.Sprintf("offset=%d", offset), func(t *testing.T) { + genericCtr, multiblockCtr := makeTestingCiphers(aesBlock, iv) + + // Generate reference ciphertext. + genericCiphertext := make([]byte, Size) + genericCtr.XORKeyStream(genericCiphertext, plaintext) + + multiblockCiphertext := make([]byte, Size) + multiblockCtr.XORKeyStream(multiblockCiphertext, plaintext[:offset]) + multiblockCtr.XORKeyStream(multiblockCiphertext[offset:], plaintext[offset:]) + if !bytes.Equal(genericCiphertext, multiblockCiphertext) { + t.Fatal("multiblock CTR's output does not match generic CTR's output") + } + }) + } + }) + } + }) + } +} + +// Check that method XORKeyStreamAt works correctly. +func TestCTR_AES_multiblock_XORKeyStreamAt(t *testing.T) { + if boring.Enabled { + t.Skip("XORKeyStreamAt is not available in boring mode") + } + + r := rand.New(rand.NewSource(12345)) + const Size = 32 * 1024 * 1024 + plaintext := randBytes(t, r, Size) + + for _, keySize := range []int{16, 24, 32} { + t.Run(fmt.Sprintf("keySize=%d", keySize), func(t *testing.T) { + key := randBytes(t, r, keySize) + iv := randBytes(t, r, aesBlockSize) + + aesBlock, err := aes.NewCipher(key) + if err != nil { + t.Fatal(err) + } + genericCtr, _ := makeTestingCiphers(aesBlock, iv) + ctrAt := fipsaes.NewCTR(aesBlock.(*fipsaes.Block), iv) + + // Generate reference ciphertext. + genericCiphertext := make([]byte, Size) + genericCtr.XORKeyStream(genericCiphertext, plaintext) + + multiblockCiphertext := make([]byte, Size) + // Split the range to random slices. + const N = 1000 + boundaries := make([]int, 0, N+2) + for i := 0; i < N; i++ { + boundaries = append(boundaries, r.Intn(Size)) + } + boundaries = append(boundaries, 0) + boundaries = append(boundaries, Size) + sort.Ints(boundaries) + + for _, i := range r.Perm(N + 1) { + begin := boundaries[i] + end := boundaries[i+1] + ctrAt.XORKeyStreamAt( + multiblockCiphertext[begin:end], + plaintext[begin:end], + uint64(begin), + ) + } + + if !bytes.Equal(genericCiphertext, multiblockCiphertext) { + t.Fatal("multiblock CTR's output does not match generic CTR's output") + } + }) + } +} + +func extractCounters(block cipher.Block, keystream []byte) []byte { + blockSize := block.BlockSize() + res := make([]byte, len(keystream)) + for i := 0; i < len(keystream); i += blockSize { + block.Decrypt(res[i:i+blockSize], keystream[i:i+blockSize]) + } + return res +} diff --git a/go/src/crypto/cipher/ctr_test.go b/go/src/crypto/cipher/ctr_test.go new file mode 100644 index 0000000000000000000000000000000000000000..cd2438984e003d86dba2fce87bb4d8517e3e46f7 --- /dev/null +++ b/go/src/crypto/cipher/ctr_test.go @@ -0,0 +1,100 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cipher_test + +import ( + "bytes" + "crypto/aes" + "crypto/cipher" + "crypto/des" + "crypto/internal/cryptotest" + "fmt" + "testing" +) + +type noopBlock int + +func (b noopBlock) BlockSize() int { return int(b) } +func (noopBlock) Encrypt(dst, src []byte) { copy(dst, src) } +func (noopBlock) Decrypt(dst, src []byte) { panic("unreachable") } + +func inc(b []byte) { + for i := len(b) - 1; i >= 0; i++ { + b[i]++ + if b[i] != 0 { + break + } + } +} + +func xor(a, b []byte) { + for i := range a { + a[i] ^= b[i] + } +} + +func TestCTR(t *testing.T) { + for size := 64; size <= 1024; size *= 2 { + iv := make([]byte, size) + ctr := cipher.NewCTR(noopBlock(size), iv) + src := make([]byte, 1024) + for i := range src { + src[i] = 0xff + } + want := make([]byte, 1024) + copy(want, src) + counter := make([]byte, size) + for i := 1; i < len(want)/size; i++ { + inc(counter) + xor(want[i*size:(i+1)*size], counter) + } + dst := make([]byte, 1024) + ctr.XORKeyStream(dst, src) + if !bytes.Equal(dst, want) { + t.Errorf("for size %d\nhave %x\nwant %x", size, dst, want) + } + } +} + +func TestCTRStream(t *testing.T) { + cryptotest.TestAllImplementations(t, "aes", func(t *testing.T) { + for _, keylen := range []int{128, 192, 256} { + t.Run(fmt.Sprintf("AES-%d", keylen), func(t *testing.T) { + rng := newRandReader(t) + + key := make([]byte, keylen/8) + rng.Read(key) + + block, err := aes.NewCipher(key) + if err != nil { + panic(err) + } + + cryptotest.TestStreamFromBlock(t, block, cipher.NewCTR) + }) + } + }) + + t.Run("DES", func(t *testing.T) { + rng := newRandReader(t) + + key := make([]byte, 8) + rng.Read(key) + + block, err := des.NewCipher(key) + if err != nil { + panic(err) + } + + cryptotest.TestStreamFromBlock(t, block, cipher.NewCTR) + }) +} + +func TestCTRExtraMethods(t *testing.T) { + block, _ := aes.NewCipher(make([]byte, 16)) + iv := make([]byte, block.BlockSize()) + s := cipher.NewCTR(block, iv) + cryptotest.NoExtraMethods(t, &s) +} diff --git a/go/src/crypto/cipher/example_test.go b/go/src/crypto/cipher/example_test.go new file mode 100644 index 0000000000000000000000000000000000000000..86dbda9ec02452367f7e0595df79278c4ae3b86b --- /dev/null +++ b/go/src/crypto/cipher/example_test.go @@ -0,0 +1,363 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cipher_test + +import ( + "bytes" + "crypto/aes" + "crypto/cipher" + "crypto/rand" + "encoding/hex" + "fmt" + "io" + "os" +) + +func ExampleNewGCM_encrypt() { + // Load your secret key from a safe place and reuse it across multiple + // Seal/Open calls. (Obviously don't use this example key for anything + // real.) If you want to convert a passphrase to a key, use a suitable + // package like bcrypt or scrypt. + // When decoded the key should be 16 bytes (AES-128) or 32 (AES-256). + key, _ := hex.DecodeString("6368616e676520746869732070617373776f726420746f206120736563726574") + plaintext := []byte("exampleplaintext") + + block, err := aes.NewCipher(key) + if err != nil { + panic(err.Error()) + } + + aesgcm, err := cipher.NewGCM(block) + if err != nil { + panic(err.Error()) + } + + // Never use more than 2^32 random nonces with a given key because of the risk of a repeat. + nonce := make([]byte, aesgcm.NonceSize()) + if _, err := io.ReadFull(rand.Reader, nonce); err != nil { + panic(err.Error()) + } + + ciphertext := aesgcm.Seal(nil, nonce, plaintext, nil) + fmt.Printf("%x\n", ciphertext) +} + +func ExampleNewGCM_decrypt() { + // Load your secret key from a safe place and reuse it across multiple + // Seal/Open calls. (Obviously don't use this example key for anything + // real.) If you want to convert a passphrase to a key, use a suitable + // package like bcrypt or scrypt. + // When decoded the key should be 16 bytes (AES-128) or 32 (AES-256). + key, _ := hex.DecodeString("6368616e676520746869732070617373776f726420746f206120736563726574") + ciphertext, _ := hex.DecodeString("c3aaa29f002ca75870806e44086700f62ce4d43e902b3888e23ceff797a7a471") + nonce, _ := hex.DecodeString("64a9433eae7ccceee2fc0eda") + + block, err := aes.NewCipher(key) + if err != nil { + panic(err.Error()) + } + + aesgcm, err := cipher.NewGCM(block) + if err != nil { + panic(err.Error()) + } + + plaintext, err := aesgcm.Open(nil, nonce, ciphertext, nil) + if err != nil { + panic(err.Error()) + } + + fmt.Printf("%s\n", plaintext) + // Output: exampleplaintext +} + +func ExampleNewCBCDecrypter() { + // Load your secret key from a safe place and reuse it across multiple + // NewCipher calls. (Obviously don't use this example key for anything + // real.) If you want to convert a passphrase to a key, use a suitable + // package like bcrypt or scrypt. + key, _ := hex.DecodeString("6368616e676520746869732070617373") + ciphertext, _ := hex.DecodeString("73c86d43a9d700a253a96c85b0f6b03ac9792e0e757f869cca306bd3cba1c62b") + + block, err := aes.NewCipher(key) + if err != nil { + panic(err) + } + + // The IV needs to be unique, but not secure. Therefore it's common to + // include it at the beginning of the ciphertext. + if len(ciphertext) < aes.BlockSize { + panic("ciphertext too short") + } + iv := ciphertext[:aes.BlockSize] + ciphertext = ciphertext[aes.BlockSize:] + + // CBC mode always works in whole blocks. + if len(ciphertext)%aes.BlockSize != 0 { + panic("ciphertext is not a multiple of the block size") + } + + mode := cipher.NewCBCDecrypter(block, iv) + + // CryptBlocks can work in-place if the two arguments are the same. + mode.CryptBlocks(ciphertext, ciphertext) + + // If the original plaintext lengths are not a multiple of the block + // size, padding would have to be added when encrypting, which would be + // removed at this point. For an example, see + // https://tools.ietf.org/html/rfc5246#section-6.2.3.2. However, it's + // critical to note that ciphertexts must be authenticated (i.e. by + // using crypto/hmac) before being decrypted in order to avoid creating + // a padding oracle. + + fmt.Printf("%s\n", ciphertext) + // Output: exampleplaintext +} + +func ExampleNewCBCEncrypter() { + // Load your secret key from a safe place and reuse it across multiple + // NewCipher calls. (Obviously don't use this example key for anything + // real.) If you want to convert a passphrase to a key, use a suitable + // package like bcrypt or scrypt. + key, _ := hex.DecodeString("6368616e676520746869732070617373") + plaintext := []byte("exampleplaintext") + + // CBC mode works on blocks so plaintexts may need to be padded to the + // next whole block. For an example of such padding, see + // https://tools.ietf.org/html/rfc5246#section-6.2.3.2. Here we'll + // assume that the plaintext is already of the correct length. + if len(plaintext)%aes.BlockSize != 0 { + panic("plaintext is not a multiple of the block size") + } + + block, err := aes.NewCipher(key) + if err != nil { + panic(err) + } + + // The IV needs to be unique, but not secure. Therefore it's common to + // include it at the beginning of the ciphertext. + ciphertext := make([]byte, aes.BlockSize+len(plaintext)) + iv := ciphertext[:aes.BlockSize] + if _, err := io.ReadFull(rand.Reader, iv); err != nil { + panic(err) + } + + mode := cipher.NewCBCEncrypter(block, iv) + mode.CryptBlocks(ciphertext[aes.BlockSize:], plaintext) + + // It's important to remember that ciphertexts must be authenticated + // (i.e. by using crypto/hmac) as well as being encrypted in order to + // be secure. + + fmt.Printf("%x\n", ciphertext) +} + +func ExampleNewCFBDecrypter() { + // Load your secret key from a safe place and reuse it across multiple + // NewCipher calls. (Obviously don't use this example key for anything + // real.) If you want to convert a passphrase to a key, use a suitable + // package like bcrypt or scrypt. + key, _ := hex.DecodeString("6368616e676520746869732070617373") + ciphertext, _ := hex.DecodeString("7dd015f06bec7f1b8f6559dad89f4131da62261786845100056b353194ad") + + block, err := aes.NewCipher(key) + if err != nil { + panic(err) + } + + // The IV needs to be unique, but not secure. Therefore it's common to + // include it at the beginning of the ciphertext. + if len(ciphertext) < aes.BlockSize { + panic("ciphertext too short") + } + iv := ciphertext[:aes.BlockSize] + ciphertext = ciphertext[aes.BlockSize:] + + stream := cipher.NewCFBDecrypter(block, iv) + + // XORKeyStream can work in-place if the two arguments are the same. + stream.XORKeyStream(ciphertext, ciphertext) + fmt.Printf("%s", ciphertext) + // Output: some plaintext +} + +func ExampleNewCFBEncrypter() { + // Load your secret key from a safe place and reuse it across multiple + // NewCipher calls. (Obviously don't use this example key for anything + // real.) If you want to convert a passphrase to a key, use a suitable + // package like bcrypt or scrypt. + key, _ := hex.DecodeString("6368616e676520746869732070617373") + plaintext := []byte("some plaintext") + + block, err := aes.NewCipher(key) + if err != nil { + panic(err) + } + + // The IV needs to be unique, but not secure. Therefore it's common to + // include it at the beginning of the ciphertext. + ciphertext := make([]byte, aes.BlockSize+len(plaintext)) + iv := ciphertext[:aes.BlockSize] + if _, err := io.ReadFull(rand.Reader, iv); err != nil { + panic(err) + } + + stream := cipher.NewCFBEncrypter(block, iv) + stream.XORKeyStream(ciphertext[aes.BlockSize:], plaintext) + + // It's important to remember that ciphertexts must be authenticated + // (i.e. by using crypto/hmac) as well as being encrypted in order to + // be secure. + fmt.Printf("%x\n", ciphertext) +} + +func ExampleNewCTR() { + // Load your secret key from a safe place and reuse it across multiple + // NewCipher calls. (Obviously don't use this example key for anything + // real.) If you want to convert a passphrase to a key, use a suitable + // package like bcrypt or scrypt. + key, _ := hex.DecodeString("6368616e676520746869732070617373") + plaintext := []byte("some plaintext") + + block, err := aes.NewCipher(key) + if err != nil { + panic(err) + } + + // The IV needs to be unique, but not secure. Therefore it's common to + // include it at the beginning of the ciphertext. + ciphertext := make([]byte, aes.BlockSize+len(plaintext)) + iv := ciphertext[:aes.BlockSize] + if _, err := io.ReadFull(rand.Reader, iv); err != nil { + panic(err) + } + + stream := cipher.NewCTR(block, iv) + stream.XORKeyStream(ciphertext[aes.BlockSize:], plaintext) + + // It's important to remember that ciphertexts must be authenticated + // (i.e. by using crypto/hmac) as well as being encrypted in order to + // be secure. + + // CTR mode is the same for both encryption and decryption, so we can + // also decrypt that ciphertext with NewCTR. + + plaintext2 := make([]byte, len(plaintext)) + stream = cipher.NewCTR(block, iv) + stream.XORKeyStream(plaintext2, ciphertext[aes.BlockSize:]) + + fmt.Printf("%s\n", plaintext2) + // Output: some plaintext +} + +func ExampleNewOFB() { + // Load your secret key from a safe place and reuse it across multiple + // NewCipher calls. (Obviously don't use this example key for anything + // real.) If you want to convert a passphrase to a key, use a suitable + // package like bcrypt or scrypt. + key, _ := hex.DecodeString("6368616e676520746869732070617373") + plaintext := []byte("some plaintext") + + block, err := aes.NewCipher(key) + if err != nil { + panic(err) + } + + // The IV needs to be unique, but not secure. Therefore it's common to + // include it at the beginning of the ciphertext. + ciphertext := make([]byte, aes.BlockSize+len(plaintext)) + iv := ciphertext[:aes.BlockSize] + if _, err := io.ReadFull(rand.Reader, iv); err != nil { + panic(err) + } + + stream := cipher.NewOFB(block, iv) + stream.XORKeyStream(ciphertext[aes.BlockSize:], plaintext) + + // It's important to remember that ciphertexts must be authenticated + // (i.e. by using crypto/hmac) as well as being encrypted in order to + // be secure. + + // OFB mode is the same for both encryption and decryption, so we can + // also decrypt that ciphertext with NewOFB. + + plaintext2 := make([]byte, len(plaintext)) + stream = cipher.NewOFB(block, iv) + stream.XORKeyStream(plaintext2, ciphertext[aes.BlockSize:]) + + fmt.Printf("%s\n", plaintext2) + // Output: some plaintext +} + +func ExampleStreamReader() { + // Load your secret key from a safe place and reuse it across multiple + // NewCipher calls. (Obviously don't use this example key for anything + // real.) If you want to convert a passphrase to a key, use a suitable + // package like bcrypt or scrypt. + key, _ := hex.DecodeString("6368616e676520746869732070617373") + + encrypted, _ := hex.DecodeString("cf0495cc6f75dafc23948538e79904a9") + bReader := bytes.NewReader(encrypted) + + block, err := aes.NewCipher(key) + if err != nil { + panic(err) + } + + // If the key is unique for each ciphertext, then it's ok to use a zero + // IV. + var iv [aes.BlockSize]byte + stream := cipher.NewOFB(block, iv[:]) + + reader := &cipher.StreamReader{S: stream, R: bReader} + // Copy the input to the output stream, decrypting as we go. + if _, err := io.Copy(os.Stdout, reader); err != nil { + panic(err) + } + + // Note that this example is simplistic in that it omits any + // authentication of the encrypted data. If you were actually to use + // StreamReader in this manner, an attacker could flip arbitrary bits in + // the output. + + // Output: some secret text +} + +func ExampleStreamWriter() { + // Load your secret key from a safe place and reuse it across multiple + // NewCipher calls. (Obviously don't use this example key for anything + // real.) If you want to convert a passphrase to a key, use a suitable + // package like bcrypt or scrypt. + key, _ := hex.DecodeString("6368616e676520746869732070617373") + + bReader := bytes.NewReader([]byte("some secret text")) + + block, err := aes.NewCipher(key) + if err != nil { + panic(err) + } + + // If the key is unique for each ciphertext, then it's ok to use a zero + // IV. + var iv [aes.BlockSize]byte + stream := cipher.NewOFB(block, iv[:]) + + var out bytes.Buffer + + writer := &cipher.StreamWriter{S: stream, W: &out} + // Copy the input to the output buffer, encrypting as we go. + if _, err := io.Copy(writer, bReader); err != nil { + panic(err) + } + + // Note that this example is simplistic in that it omits any + // authentication of the encrypted data. If you were actually to use + // StreamReader in this manner, an attacker could flip arbitrary bits in + // the decrypted result. + + fmt.Printf("%x\n", out.Bytes()) + // Output: cf0495cc6f75dafc23948538e79904a9 +} diff --git a/go/src/crypto/cipher/fuzz_test.go b/go/src/crypto/cipher/fuzz_test.go new file mode 100644 index 0000000000000000000000000000000000000000..ed5d80e5ee8696bbc65031f488d0629a97573b1b --- /dev/null +++ b/go/src/crypto/cipher/fuzz_test.go @@ -0,0 +1,103 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build ppc64le + +package cipher_test + +import ( + "bytes" + "crypto/aes" + "crypto/cipher" + "crypto/rand" + "testing" + "time" +) + +var cbcAESFuzzTests = []struct { + name string + key []byte +}{ + { + "CBC-AES128", + commonKey128, + }, + { + "CBC-AES192", + commonKey192, + }, + { + "CBC-AES256", + commonKey256, + }, +} + +var timeout *time.Timer + +const datalen = 1024 + +func TestFuzz(t *testing.T) { + + for _, ft := range cbcAESFuzzTests { + c, _ := aes.NewCipher(ft.key) + + cbcAsm := cipher.NewCBCEncrypter(c, commonIV) + cbcGeneric := cipher.NewCBCEncrypter(wrap(c), commonIV) + + if testing.Short() { + timeout = time.NewTimer(10 * time.Millisecond) + } else { + timeout = time.NewTimer(2 * time.Second) + } + + indata := make([]byte, datalen) + outgeneric := make([]byte, datalen) + outdata := make([]byte, datalen) + + fuzzencrypt: + for { + select { + case <-timeout.C: + break fuzzencrypt + default: + } + + rand.Read(indata[:]) + + cbcGeneric.CryptBlocks(indata, outgeneric) + cbcAsm.CryptBlocks(indata, outdata) + + if !bytes.Equal(outdata, outgeneric) { + t.Fatalf("AES-CBC encryption does not match reference result: %x and %x, please report this error to security@golang.org", outdata, outgeneric) + } + } + + cbcAsm = cipher.NewCBCDecrypter(c, commonIV) + cbcGeneric = cipher.NewCBCDecrypter(wrap(c), commonIV) + + if testing.Short() { + timeout = time.NewTimer(10 * time.Millisecond) + } else { + timeout = time.NewTimer(2 * time.Second) + } + + fuzzdecrypt: + for { + select { + case <-timeout.C: + break fuzzdecrypt + default: + } + + rand.Read(indata[:]) + + cbcGeneric.CryptBlocks(indata, outgeneric) + cbcAsm.CryptBlocks(indata, outdata) + + if !bytes.Equal(outdata, outgeneric) { + t.Fatalf("AES-CBC decryption does not match reference result: %x and %x, please report this error to security@golang.org", outdata, outgeneric) + } + } + } +} diff --git a/go/src/crypto/cipher/gcm.go b/go/src/crypto/cipher/gcm.go new file mode 100644 index 0000000000000000000000000000000000000000..88892e155551b3ed73bf1913275d2fc7b98e2dd7 --- /dev/null +++ b/go/src/crypto/cipher/gcm.go @@ -0,0 +1,377 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cipher + +import ( + "crypto/internal/fips140/aes" + "crypto/internal/fips140/aes/gcm" + "crypto/internal/fips140/alias" + "crypto/internal/fips140only" + "crypto/subtle" + "errors" + "internal/byteorder" +) + +const ( + gcmBlockSize = 16 + gcmStandardNonceSize = 12 + gcmTagSize = 16 + gcmMinimumTagSize = 12 // NIST SP 800-38D recommends tags with 12 or more bytes. +) + +// NewGCM returns the given 128-bit, block cipher wrapped in Galois Counter Mode +// with the standard nonce length. +// +// In general, the GHASH operation performed by this implementation of GCM is not constant-time. +// An exception is when the underlying [Block] was created by aes.NewCipher +// on systems with hardware support for AES. See the [crypto/aes] package documentation for details. +func NewGCM(cipher Block) (AEAD, error) { + if fips140only.Enforced() { + return nil, errors.New("crypto/cipher: use of GCM with arbitrary IVs is not allowed in FIPS 140-only mode, use NewGCMWithRandomNonce") + } + return newGCM(cipher, gcmStandardNonceSize, gcmTagSize) +} + +// NewGCMWithNonceSize returns the given 128-bit, block cipher wrapped in Galois +// Counter Mode, which accepts nonces of the given length. The length must not +// be zero. +// +// Only use this function if you require compatibility with an existing +// cryptosystem that uses non-standard nonce lengths. All other users should use +// [NewGCM], which is faster and more resistant to misuse. +func NewGCMWithNonceSize(cipher Block, size int) (AEAD, error) { + if fips140only.Enforced() { + return nil, errors.New("crypto/cipher: use of GCM with arbitrary IVs is not allowed in FIPS 140-only mode, use NewGCMWithRandomNonce") + } + return newGCM(cipher, size, gcmTagSize) +} + +// NewGCMWithTagSize returns the given 128-bit, block cipher wrapped in Galois +// Counter Mode, which generates tags with the given length. +// +// Tag sizes between 12 and 16 bytes are allowed. +// +// Only use this function if you require compatibility with an existing +// cryptosystem that uses non-standard tag lengths. All other users should use +// [NewGCM], which is more resistant to misuse. +func NewGCMWithTagSize(cipher Block, tagSize int) (AEAD, error) { + if fips140only.Enforced() { + return nil, errors.New("crypto/cipher: use of GCM with arbitrary IVs is not allowed in FIPS 140-only mode, use NewGCMWithRandomNonce") + } + return newGCM(cipher, gcmStandardNonceSize, tagSize) +} + +func newGCM(cipher Block, nonceSize, tagSize int) (AEAD, error) { + c, ok := cipher.(*aes.Block) + if !ok { + if fips140only.Enforced() { + return nil, errors.New("crypto/cipher: use of GCM with non-AES ciphers is not allowed in FIPS 140-only mode") + } + return newGCMFallback(cipher, nonceSize, tagSize) + } + // We don't return gcm.New directly, because it would always return a non-nil + // AEAD interface value with type *gcm.GCM even if the *gcm.GCM is nil. + g, err := gcm.New(c, nonceSize, tagSize) + if err != nil { + return nil, err + } + return g, nil +} + +// NewGCMWithRandomNonce returns the given cipher wrapped in Galois Counter +// Mode, with randomly-generated nonces. The cipher must have been created by +// [crypto/aes.NewCipher]. +// +// It generates a random 96-bit nonce, which is prepended to the ciphertext by Seal, +// and is extracted from the ciphertext by Open. The NonceSize of the AEAD is zero, +// while the Overhead is 28 bytes (the combination of nonce size and tag size). +// +// A given key MUST NOT be used to encrypt more than 2^32 messages, to limit the +// risk of a random nonce collision to negligible levels. +func NewGCMWithRandomNonce(cipher Block) (AEAD, error) { + c, ok := cipher.(*aes.Block) + if !ok { + return nil, errors.New("cipher: NewGCMWithRandomNonce requires aes.Block") + } + g, err := gcm.New(c, gcmStandardNonceSize, gcmTagSize) + if err != nil { + return nil, err + } + return gcmWithRandomNonce{g}, nil +} + +type gcmWithRandomNonce struct { + *gcm.GCM +} + +func (g gcmWithRandomNonce) NonceSize() int { + return 0 +} + +func (g gcmWithRandomNonce) Overhead() int { + return gcmStandardNonceSize + gcmTagSize +} + +func (g gcmWithRandomNonce) Seal(dst, nonce, plaintext, additionalData []byte) []byte { + if len(nonce) != 0 { + panic("crypto/cipher: non-empty nonce passed to GCMWithRandomNonce") + } + + ret, out := sliceForAppend(dst, gcmStandardNonceSize+len(plaintext)+gcmTagSize) + if alias.InexactOverlap(out, plaintext) { + panic("crypto/cipher: invalid buffer overlap of output and input") + } + if alias.AnyOverlap(out, additionalData) { + panic("crypto/cipher: invalid buffer overlap of output and additional data") + } + nonce = out[:gcmStandardNonceSize] + ciphertext := out[gcmStandardNonceSize:] + + // The AEAD interface allows using plaintext[:0] or ciphertext[:0] as dst. + // + // This is kind of a problem when trying to prepend or trim a nonce, because the + // actual AES-GCTR blocks end up overlapping but not exactly. + // + // In Open, we write the output *before* the input, so unless we do something + // weird like working through a chunk of block backwards, it works out. + // + // In Seal, we could work through the input backwards or intentionally load + // ahead before writing. + // + // However, the crypto/internal/fips140/aes/gcm APIs also check for exact overlap, + // so for now we just do a memmove if we detect overlap. + // + // ┌───────────────────────────┬ ─ ─ + // │PPPPPPPPPPPPPPPPPPPPPPPPPPP│ │ + // └▽─────────────────────────▲┴ ─ ─ + // ╲ Seal ╲ + // ╲ Open ╲ + // ┌───▼─────────────────────────△──┐ + // │NN|CCCCCCCCCCCCCCCCCCCCCCCCCCC|T│ + // └────────────────────────────────┘ + // + if alias.AnyOverlap(out, plaintext) { + copy(ciphertext, plaintext) + plaintext = ciphertext[:len(plaintext)] + } + + gcm.SealWithRandomNonce(g.GCM, nonce, ciphertext, plaintext, additionalData) + return ret +} + +func (g gcmWithRandomNonce) Open(dst, nonce, ciphertext, additionalData []byte) ([]byte, error) { + if len(nonce) != 0 { + panic("crypto/cipher: non-empty nonce passed to GCMWithRandomNonce") + } + if len(ciphertext) < gcmStandardNonceSize+gcmTagSize { + return nil, errOpen + } + + ret, out := sliceForAppend(dst, len(ciphertext)-gcmStandardNonceSize-gcmTagSize) + if alias.InexactOverlap(out, ciphertext) { + panic("crypto/cipher: invalid buffer overlap of output and input") + } + if alias.AnyOverlap(out, additionalData) { + panic("crypto/cipher: invalid buffer overlap of output and additional data") + } + // See the discussion in Seal. Note that if there is any overlap at this + // point, it's because out = ciphertext, so out must have enough capacity + // even if we sliced the tag off. Also note how [AEAD] specifies that "the + // contents of dst, up to its capacity, may be overwritten". + if alias.AnyOverlap(out, ciphertext) { + nonce = make([]byte, gcmStandardNonceSize) + copy(nonce, ciphertext) + copy(out[:len(ciphertext)], ciphertext[gcmStandardNonceSize:]) + ciphertext = out[:len(ciphertext)-gcmStandardNonceSize] + } else { + nonce = ciphertext[:gcmStandardNonceSize] + ciphertext = ciphertext[gcmStandardNonceSize:] + } + + _, err := g.GCM.Open(out[:0], nonce, ciphertext, additionalData) + if err != nil { + return nil, err + } + return ret, nil +} + +// gcmAble is an interface implemented by ciphers that have a specific optimized +// implementation of GCM. crypto/aes doesn't use this anymore, and we'd like to +// eventually remove it. +type gcmAble interface { + NewGCM(nonceSize, tagSize int) (AEAD, error) +} + +func newGCMFallback(cipher Block, nonceSize, tagSize int) (AEAD, error) { + if tagSize < gcmMinimumTagSize || tagSize > gcmBlockSize { + return nil, errors.New("cipher: incorrect tag size given to GCM") + } + if nonceSize <= 0 { + return nil, errors.New("cipher: the nonce can't have zero length") + } + if cipher, ok := cipher.(gcmAble); ok { + return cipher.NewGCM(nonceSize, tagSize) + } + if cipher.BlockSize() != gcmBlockSize { + return nil, errors.New("cipher: NewGCM requires 128-bit block cipher") + } + return &gcmFallback{cipher: cipher, nonceSize: nonceSize, tagSize: tagSize}, nil +} + +// gcmFallback is only used for non-AES ciphers, which regrettably we +// theoretically support. It's a copy of the generic implementation from +// crypto/internal/fips140/aes/gcm/gcm_generic.go, refer to that file for more details. +type gcmFallback struct { + cipher Block + nonceSize int + tagSize int +} + +func (g *gcmFallback) NonceSize() int { + return g.nonceSize +} + +func (g *gcmFallback) Overhead() int { + return g.tagSize +} + +func (g *gcmFallback) Seal(dst, nonce, plaintext, additionalData []byte) []byte { + if len(nonce) != g.nonceSize { + panic("crypto/cipher: incorrect nonce length given to GCM") + } + if g.nonceSize == 0 { + panic("crypto/cipher: incorrect GCM nonce size") + } + if uint64(len(plaintext)) > uint64((1<<32)-2)*gcmBlockSize { + panic("crypto/cipher: message too large for GCM") + } + + ret, out := sliceForAppend(dst, len(plaintext)+g.tagSize) + if alias.InexactOverlap(out, plaintext) { + panic("crypto/cipher: invalid buffer overlap of output and input") + } + if alias.AnyOverlap(out, additionalData) { + panic("crypto/cipher: invalid buffer overlap of output and additional data") + } + + var H, counter, tagMask [gcmBlockSize]byte + g.cipher.Encrypt(H[:], H[:]) + deriveCounter(&H, &counter, nonce) + gcmCounterCryptGeneric(g.cipher, tagMask[:], tagMask[:], &counter) + + gcmCounterCryptGeneric(g.cipher, out, plaintext, &counter) + + var tag [gcmTagSize]byte + gcmAuth(tag[:], &H, &tagMask, out[:len(plaintext)], additionalData) + copy(out[len(plaintext):], tag[:]) + + return ret +} + +var errOpen = errors.New("cipher: message authentication failed") + +func (g *gcmFallback) Open(dst, nonce, ciphertext, additionalData []byte) ([]byte, error) { + if len(nonce) != g.nonceSize { + panic("crypto/cipher: incorrect nonce length given to GCM") + } + if g.tagSize < gcmMinimumTagSize { + panic("crypto/cipher: incorrect GCM tag size") + } + + if len(ciphertext) < g.tagSize { + return nil, errOpen + } + if uint64(len(ciphertext)) > uint64((1<<32)-2)*gcmBlockSize+uint64(g.tagSize) { + return nil, errOpen + } + + ret, out := sliceForAppend(dst, len(ciphertext)-g.tagSize) + if alias.InexactOverlap(out, ciphertext) { + panic("crypto/cipher: invalid buffer overlap of output and input") + } + if alias.AnyOverlap(out, additionalData) { + panic("crypto/cipher: invalid buffer overlap of output and additional data") + } + + var H, counter, tagMask [gcmBlockSize]byte + g.cipher.Encrypt(H[:], H[:]) + deriveCounter(&H, &counter, nonce) + gcmCounterCryptGeneric(g.cipher, tagMask[:], tagMask[:], &counter) + + tag := ciphertext[len(ciphertext)-g.tagSize:] + ciphertext = ciphertext[:len(ciphertext)-g.tagSize] + + var expectedTag [gcmTagSize]byte + gcmAuth(expectedTag[:], &H, &tagMask, ciphertext, additionalData) + if subtle.ConstantTimeCompare(expectedTag[:g.tagSize], tag) != 1 { + // We sometimes decrypt and authenticate concurrently, so we overwrite + // dst in the event of a tag mismatch. To be consistent across platforms + // and to avoid releasing unauthenticated plaintext, we clear the buffer + // in the event of an error. + clear(out) + return nil, errOpen + } + + gcmCounterCryptGeneric(g.cipher, out, ciphertext, &counter) + + return ret, nil +} + +func deriveCounter(H, counter *[gcmBlockSize]byte, nonce []byte) { + if len(nonce) == gcmStandardNonceSize { + copy(counter[:], nonce) + counter[gcmBlockSize-1] = 1 + } else { + lenBlock := make([]byte, 16) + byteorder.BEPutUint64(lenBlock[8:], uint64(len(nonce))*8) + J := gcm.GHASH(H, nonce, lenBlock) + copy(counter[:], J) + } +} + +func gcmCounterCryptGeneric(b Block, out, src []byte, counter *[gcmBlockSize]byte) { + var mask [gcmBlockSize]byte + for len(src) >= gcmBlockSize { + b.Encrypt(mask[:], counter[:]) + gcmInc32(counter) + + subtle.XORBytes(out, src, mask[:]) + out = out[gcmBlockSize:] + src = src[gcmBlockSize:] + } + if len(src) > 0 { + b.Encrypt(mask[:], counter[:]) + gcmInc32(counter) + subtle.XORBytes(out, src, mask[:]) + } +} + +func gcmInc32(counterBlock *[gcmBlockSize]byte) { + ctr := counterBlock[len(counterBlock)-4:] + byteorder.BEPutUint32(ctr, byteorder.BEUint32(ctr)+1) +} + +func gcmAuth(out []byte, H, tagMask *[gcmBlockSize]byte, ciphertext, additionalData []byte) { + lenBlock := make([]byte, 16) + byteorder.BEPutUint64(lenBlock[:8], uint64(len(additionalData))*8) + byteorder.BEPutUint64(lenBlock[8:], uint64(len(ciphertext))*8) + S := gcm.GHASH(H, additionalData, ciphertext, lenBlock) + subtle.XORBytes(out, S, tagMask[:]) +} + +// sliceForAppend takes a slice and a requested number of bytes. It returns a +// slice with the contents of the given slice followed by that many bytes and a +// second slice that aliases into it and contains only the extra bytes. If the +// original slice has sufficient capacity then no allocation is performed. +func sliceForAppend(in []byte, n int) (head, tail []byte) { + if total := len(in) + n; cap(in) >= total { + head = in[:total] + } else { + head = make([]byte, total) + copy(head, in) + } + tail = head[len(in):] + return +} diff --git a/go/src/crypto/cipher/gcm_fips140v1.26_test.go b/go/src/crypto/cipher/gcm_fips140v1.26_test.go new file mode 100644 index 0000000000000000000000000000000000000000..9f17a497cabea3412acbf8a82707f83cbccbe778 --- /dev/null +++ b/go/src/crypto/cipher/gcm_fips140v1.26_test.go @@ -0,0 +1,105 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !fips140v1.0 + +package cipher_test + +import ( + "crypto/cipher" + "crypto/internal/cryptotest" + "crypto/internal/fips140" + fipsaes "crypto/internal/fips140/aes" + "crypto/internal/fips140/aes/gcm" + "encoding/binary" + "internal/testenv" + "math" + "testing" +) + +func TestGCMNoncesFIPSV126(t *testing.T) { + cryptotest.MustSupportFIPS140(t) + if !fips140.Enabled { + cmd := testenv.Command(t, testenv.Executable(t), "-test.run=^TestGCMNoncesFIPSV126$", "-test.v") + cmd.Env = append(cmd.Environ(), "GODEBUG=fips140=on") + out, err := cmd.CombinedOutput() + t.Logf("running with GODEBUG=fips140=on:\n%s", out) + if err != nil { + t.Errorf("fips140=on subprocess failed: %v", err) + } + return + } + + tryNonce := func(aead cipher.AEAD, nonce []byte) bool { + fips140.ResetServiceIndicator() + aead.Seal(nil, nonce, []byte("x"), nil) + return fips140.ServiceIndicator() + } + expectOK := func(t *testing.T, aead cipher.AEAD, nonce []byte) { + t.Helper() + if !tryNonce(aead, nonce) { + t.Errorf("expected service indicator true for %x", nonce) + } + } + expectPanic := func(t *testing.T, aead cipher.AEAD, nonce []byte) { + t.Helper() + defer func() { + t.Helper() + if recover() == nil { + t.Errorf("expected panic for %x", nonce) + } + }() + tryNonce(aead, nonce) + } + + t.Run("NewGCMWithXORCounterNonce", func(t *testing.T) { + newGCM := func() *gcm.GCMWithXORCounterNonce { + key := make([]byte, 16) + block, _ := fipsaes.New(key) + aead, _ := gcm.NewGCMWithXORCounterNonce(block) + return aead + } + nonce := func(mask []byte, counter uint64) []byte { + nonce := make([]byte, 12) + copy(nonce, mask) + n := binary.BigEndian.AppendUint64(nil, counter) + for i, b := range n { + nonce[4+i] ^= b + } + return nonce + } + + for _, mask := range [][]byte{ + decodeHex(t, "ffffffffffffffffffffffff"), + decodeHex(t, "aabbccddeeff001122334455"), + decodeHex(t, "000000000000000000000000"), + } { + g := newGCM() + // Mask is derived from first invocation with zero nonce. + expectOK(t, g, nonce(mask, 0)) + expectOK(t, g, nonce(mask, 1)) + expectOK(t, g, nonce(mask, 100)) + expectPanic(t, g, nonce(mask, 100)) + expectPanic(t, g, nonce(mask, 99)) + expectOK(t, g, nonce(mask, math.MaxUint64-2)) + expectOK(t, g, nonce(mask, math.MaxUint64-1)) + expectPanic(t, g, nonce(mask, math.MaxUint64)) + expectPanic(t, g, nonce(mask, 0)) + + g = newGCM() + g.SetNoncePrefixAndMask(mask) + expectOK(t, g, nonce(mask, 0xFFFFFFFF)) + expectOK(t, g, nonce(mask, math.MaxUint64-2)) + expectOK(t, g, nonce(mask, math.MaxUint64-1)) + expectPanic(t, g, nonce(mask, math.MaxUint64)) + expectPanic(t, g, nonce(mask, 0)) + + g = newGCM() + g.SetNoncePrefixAndMask(mask) + expectOK(t, g, nonce(mask, math.MaxUint64-1)) + expectPanic(t, g, nonce(mask, math.MaxUint64)) + expectPanic(t, g, nonce(mask, 0)) + } + }) +} diff --git a/go/src/crypto/cipher/gcm_test.go b/go/src/crypto/cipher/gcm_test.go new file mode 100644 index 0000000000000000000000000000000000000000..8daa0ded22e1769ae50b84b108c5610bd01da70d --- /dev/null +++ b/go/src/crypto/cipher/gcm_test.go @@ -0,0 +1,909 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cipher_test + +import ( + "bytes" + "crypto/aes" + "crypto/cipher" + "crypto/internal/boring" + "crypto/internal/cryptotest" + "crypto/internal/fips140" + fipsaes "crypto/internal/fips140/aes" + "crypto/internal/fips140/aes/gcm" + "crypto/rand" + "encoding/hex" + "errors" + "fmt" + "internal/testenv" + "io" + "reflect" + "testing" +) + +var _ cipher.Block = (*wrapper)(nil) + +type wrapper struct { + block cipher.Block +} + +func (w *wrapper) BlockSize() int { return w.block.BlockSize() } +func (w *wrapper) Encrypt(dst, src []byte) { w.block.Encrypt(dst, src) } +func (w *wrapper) Decrypt(dst, src []byte) { w.block.Decrypt(dst, src) } + +// wrap wraps the Block so that it does not type-asserts to *aes.Block. +func wrap(b cipher.Block) cipher.Block { + return &wrapper{b} +} + +func testAllImplementations(t *testing.T, f func(*testing.T, func([]byte) cipher.Block)) { + cryptotest.TestAllImplementations(t, "gcm", func(t *testing.T) { + f(t, func(b []byte) cipher.Block { + c, err := aes.NewCipher(b) + if err != nil { + t.Fatal(err) + } + return c + }) + }) + t.Run("Fallback", func(t *testing.T) { + f(t, func(b []byte) cipher.Block { + c, err := aes.NewCipher(b) + if err != nil { + t.Fatal(err) + } + return wrap(c) + }) + }) +} + +var aesGCMTests = []struct { + key, nonce, plaintext, ad, result string +}{ + { // key=16, plaintext=null + "11754cd72aec309bf52f7687212e8957", + "3c819d9a9bed087615030b65", + "", + "", + "250327c674aaf477aef2675748cf6971", + }, + { // key=24, plaintext=null + "e2e001a36c60d2bf40d69ff5b2b1161ea218db263be16a4e", + "3c819d9a9bed087615030b65", + "", + "", + "c7b8da1fe2e3dccc4071ba92a0a57ba8", + }, + { // key=32, plaintext=null + "5394e890d37ba55ec9d5f327f15680f6a63ef5279c79331643ad0af6d2623525", + "3c819d9a9bed087615030b65", + "", + "", + "d9b260d4bc4630733ffb642f5ce45726", + }, + { + "ca47248ac0b6f8372a97ac43508308ed", + "ffd2b598feabc9019262d2be", + "", + "", + "60d20404af527d248d893ae495707d1a", + }, + { + "fbe3467cc254f81be8e78d765a2e6333", + "c6697351ff4aec29cdbaabf2", + "", + "67", + "3659cdc25288bf499ac736c03bfc1159", + }, + { + "8a7f9d80d08ad0bd5a20fb689c88f9fc", + "88b7b27d800937fda4f47301", + "", + "50edd0503e0d7b8c91608eb5a1", + "ed6f65322a4740011f91d2aae22dd44e", + }, + { + "051758e95ed4abb2cdc69bb454110e82", + "c99a66320db73158a35a255d", + "", + "67c6697351ff4aec29cdbaabf2fbe3467cc254f81be8e78d765a2e63339f", + "6ce77f1a5616c505b6aec09420234036", + }, + { + "77be63708971c4e240d1cb79e8d77feb", + "e0e00f19fed7ba0136a797f3", + "", + "7a43ec1d9c0a5a78a0b16533a6213cab", + "209fcc8d3675ed938e9c7166709dd946", + }, + { + "7680c5d3ca6154758e510f4d25b98820", + "f8f105f9c3df4965780321f8", + "", + "c94c410194c765e3dcc7964379758ed3", + "94dca8edfcf90bb74b153c8d48a17930", + }, + + { // key=16, plaintext=16 + "7fddb57453c241d03efbed3ac44e371c", + "ee283a3fc75575e33efd4887", + "d5de42b461646c255c87bd2962d3b9a2", + "", + "2ccda4a5415cb91e135c2a0f78c9b2fdb36d1df9b9d5e596f83e8b7f52971cb3", + }, + { + "ab72c77b97cb5fe9a382d9fe81ffdbed", + "54cc7dc2c37ec006bcc6d1da", + "007c5e5b3e59df24a7c355584fc1518d", + "", + "0e1bde206a07a9c2c1b65300f8c649972b4401346697138c7a4891ee59867d0c", + }, + { // key=24, plaintext=16 + "feffe9928665731c6d6a8f9467308308feffe9928665731c", + "54cc7dc2c37ec006bcc6d1da", + "007c5e5b3e59df24a7c355584fc1518d", + "", + "7bd53594c28b6c6596feb240199cad4c9badb907fd65bde541b8df3bd444d3a8", + }, + { // key=32, plaintext=16 + "feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308", + "54cc7dc2c37ec006bcc6d1da", + "007c5e5b3e59df24a7c355584fc1518d", + "", + "d50b9e252b70945d4240d351677eb10f937cdaef6f2822b6a3191654ba41b197", + }, + { // key=16, plaintext=23 + "ab72c77b97cb5fe9a382d9fe81ffdbed", + "54cc7dc2c37ec006bcc6d1da", + "007c5e5b3e59df24a7c355584fc1518dabcdefab", + "", + "0e1bde206a07a9c2c1b65300f8c64997b73381a6ff6bc24c5146fbd73361f4fe", + }, + { // key=24, plaintext=23 + "feffe9928665731c6d6a8f9467308308feffe9928665731c", + "54cc7dc2c37ec006bcc6d1da", + "007c5e5b3e59df24a7c355584fc1518dabcdefab", + "", + "7bd53594c28b6c6596feb240199cad4c23b86a96d423cffa929e68541dc16b28", + }, + { // key=32, plaintext=23 + "feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308", + "54cc7dc2c37ec006bcc6d1da", + "007c5e5b3e59df24a7c355584fc1518dabcdefab", + "", + "d50b9e252b70945d4240d351677eb10f27fd385388ad3b72b96a2d5dea1240ae", + }, + + { // key=16, plaintext=51 + "fe47fcce5fc32665d2ae399e4eec72ba", + "5adb9609dbaeb58cbd6e7275", + "7c0e88c88899a779228465074797cd4c2e1498d259b54390b85e3eef1c02df60e743f1b840382c4bccaf3bafb4ca8429bea063", + "88319d6e1d3ffa5f987199166c8a9b56c2aeba5a", + "98f4826f05a265e6dd2be82db241c0fbbbf9ffb1c173aa83964b7cf5393043736365253ddbc5db8778371495da76d269e5db3e291ef1982e4defedaa2249f898556b47", + }, + { + "ec0c2ba17aa95cd6afffe949da9cc3a8", + "296bce5b50b7d66096d627ef", + "b85b3753535b825cbe5f632c0b843c741351f18aa484281aebec2f45bb9eea2d79d987b764b9611f6c0f8641843d5d58f3a242", + "f8d00f05d22bf68599bcdeb131292ad6e2df5d14", + "a7443d31c26bdf2a1c945e29ee4bd344a99cfaf3aa71f8b3f191f83c2adfc7a07162995506fde6309ffc19e716eddf1a828c5a890147971946b627c40016da1ecf3e77", + }, + { + "2c1f21cf0f6fb3661943155c3e3d8492", + "23cb5ff362e22426984d1907", + "42f758836986954db44bf37c6ef5e4ac0adaf38f27252a1b82d02ea949c8a1a2dbc0d68b5615ba7c1220ff6510e259f06655d8", + "5d3624879d35e46849953e45a32a624d6a6c536ed9857c613b572b0333e701557a713e3f010ecdf9a6bd6c9e3e44b065208645aff4aabee611b391528514170084ccf587177f4488f33cfb5e979e42b6e1cfc0a60238982a7aec", + "81824f0e0d523db30d3da369fdc0d60894c7a0a20646dd015073ad2732bd989b14a222b6ad57af43e1895df9dca2a5344a62cc57a3ee28136e94c74838997ae9823f3a", + }, + { + "d9f7d2411091f947b4d6f1e2d1f0fb2e", + "e1934f5db57cc983e6b180e7", + "73ed042327f70fe9c572a61545eda8b2a0c6e1d6c291ef19248e973aee6c312012f490c2c6f6166f4a59431e182663fcaea05a", + "0a8a18a7150e940c3d87b38e73baee9a5c049ee21795663e264b694a949822b639092d0e67015e86363583fcf0ca645af9f43375f05fdb4ce84f411dcbca73c2220dea03a20115d2e51398344b16bee1ed7c499b353d6c597af8", + "aaadbd5c92e9151ce3db7210b8714126b73e43436d242677afa50384f2149b831f1d573c7891c2a91fbc48db29967ec9542b2321b51ca862cb637cdd03b99a0f93b134", + }, + { //key=24 plaintext=51 + "feffe9928665731c6d6a8f9467308308feffe9928665731c", + "e1934f5db57cc983e6b180e7", + "73ed042327f70fe9c572a61545eda8b2a0c6e1d6c291ef19248e973aee6c312012f490c2c6f6166f4a59431e182663fcaea05a", + "0a8a18a7150e940c3d87b38e73baee9a5c049ee21795663e264b694a949822b639092d0e67015e86363583fcf0ca645af9f43375f05fdb4ce84f411dcbca73c2220dea03a20115d2e51398344b16bee1ed7c499b353d6c597af8", + "0736378955001d50773305975b3a534a4cd3614dd7300916301ae508cb7b45aa16e79435ca16b5557bcad5991bc52b971806863b15dc0b055748919b8ee91bc8477f68", + }, + { //key-32 plaintext=51 + "feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308", + "e1934f5db57cc983e6b180e7", + "73ed042327f70fe9c572a61545eda8b2a0c6e1d6c291ef19248e973aee6c312012f490c2c6f6166f4a59431e182663fcaea05a", + "0a8a18a7150e940c3d87b38e73baee9a5c049ee21795663e264b694a949822b639092d0e67015e86363583fcf0ca645af9f43375f05fdb4ce84f411dcbca73c2220dea03a20115d2e51398344b16bee1ed7c499b353d6c597af8", + "fc1ae2b5dcd2c4176c3f538b4c3cc21197f79e608cc3730167936382e4b1e5a7b75ae1678bcebd876705477eb0e0fdbbcda92fb9a0dc58c8d8f84fb590e0422e6077ef", + }, + { //key=16 plaintext=138 + "d9f7d2411091f947b4d6f1e2d1f0fb2e", + "e1934f5db57cc983e6b180e7", + "67c6697351ff4aec29cdbaabf2fbe3467cc254f81be8e78d765a2e63339fc99a66320db73158a35a255d051758e95ed4abb2cdc69bb454110e827441213ddc8770e93ea141e1fc673e017e97eadc6b968f385c2aecb03bfb32af3c54ec18db5c021afe43fbfaaa3afb29d1e6053c7c9475d8be6189f95cbba8990f95b1ebf1b3aabbccddee", + "0a8a18a7150e940c3d87b38e73baee9a5c049ee21795663e264b694a949822b639092d0e67015e86363583fcf0ca645af9f43375f05fdb4ce84f411dcbca73c2220dea03a20115d2e51398344b16bee1ed7c499b353d6c597af8", + "be86d00ce4e150190f646eae0f670ad26b3af66db45d2ee3fd71badd2fe763396bdbca498f3f779c70b80ed2695943e15139b406e5147b3855a1441dfb7bd64954b581e3db0ddf26b1c759e2276a4c18a8e4ad4b890f473e61c78e60074bd0633961e87e66d0a1be77c51ab6b9bb3318ccdd43794ffc18a03a83c1d368eeea590a13407c7ef48efc66e26047f3ab9deed0412ce89e", + }, + { //key=24 plaintext=138 + "feffe9928665731c6d6a8f9467308308feffe9928665731c", + "e1934f5db57cc983e6b180e7", + "67c6697351ff4aec29cdbaabf2fbe3467cc254f81be8e78d765a2e63339fc99a66320db73158a35a255d051758e95ed4abb2cdc69bb454110e827441213ddc8770e93ea141e1fc673e017e97eadc6b968f385c2aecb03bfb32af3c54ec18db5c021afe43fbfaaa3afb29d1e6053c7c9475d8be6189f95cbba8990f95b1ebf1b3aabbccddee", + "0a8a18a7150e940c3d87b38e73baee9a5c049ee21795663e264b694a949822b639092d0e67015e86363583fcf0ca645af9f43375f05fdb4ce84f411dcbca73c2220dea03a20115d2e51398344b16bee1ed7c499b353d6c597af8", + "131d5ad9230858559b8c1929ec2c18be90d7d4630e49018262ce5c511688bd10622109403db8006014ce93905b0a16bf1d1411acc9e14edf09518bd5967ff4bc202805d4c2810810a093e996a0f56c9a3e3e593c783f68528c1a282ff6f4925902bb2b3d4cdd04b873663bf5fd9dd53b5df462e0424d038f249b10a99c0523200f8c92c3e8a178a25ee8e23b71308c88ec2cfe047e", + }, + { //key-32 plaintext=138 + "feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308", + "e1934f5db57cc983e6b180e7", + "67c6697351ff4aec29cdbaabf2fbe3467cc254f81be8e78d765a2e63339fc99a66320db73158a35a255d051758e95ed4abb2cdc69bb454110e827441213ddc8770e93ea141e1fc673e017e97eadc6b968f385c2aecb03bfb32af3c54ec18db5c021afe43fbfaaa3afb29d1e6053c7c9475d8be6189f95cbba8990f95b1ebf1b3aabbccddee", + "0a8a18a7150e940c3d87b38e73baee9a5c049ee21795663e264b694a949822b639092d0e67015e86363583fcf0ca645af9f43375f05fdb4ce84f411dcbca73c2220dea03a20115d2e51398344b16bee1ed7c499b353d6c597af8", + "e8318fe5aada811280804f35fb2a89e54bf32b4e55ba7b953547dadb39421d1dc39c7c127c6008b208010177f02fc093c8bbb8b3834d0e060d96dda96ba386c7c01224a4cac1edebffda4f9a64692bfbffb9f7c2999069fab84205224978a10d815d5ab8fa31e4e11630ba01c3b6cb99bef5772357ce86b83b4fb45ea7146402d560b6ad07de635b9366865e788a6bcdb132dcd079", + }, + { // key=16, plaintext=13 + "fe9bb47deb3a61e423c2231841cfd1fb", + "4d328eb776f500a2f7fb47aa", + "f1cc3818e421876bb6b8bbd6c9", + "", + "b88c5c1977b35b517b0aeae96743fd4727fe5cdb4b5b42818dea7ef8c9", + }, + { // key=16, plaintext=13 + "6703df3701a7f54911ca72e24dca046a", + "12823ab601c350ea4bc2488c", + "793cd125b0b84a043e3ac67717", + "", + "b2051c80014f42f08735a7b0cd38e6bcd29962e5f2c13626b85a877101", + }, + { // key=24, plaintext=13 + "feffe9928665731c6d6a8f9467308308feffe9928665731c", + "12823ab601c350ea4bc2488c", + "793cd125b0b84a043e3ac67717", + "", + "e888c2f438caedd4189d26c59f53439b8a7caec29e98c33ebf7e5712d6", + }, + { // key=32, plaintext=13 + "feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308", + "12823ab601c350ea4bc2488c", + "793cd125b0b84a043e3ac67717", + "", + "e796c39074c7783a38193e3f8d46b355adacca7198d16d879fbfeac6e3", + }, + + // These cases test non-standard nonce sizes. + { // key=16, plaintext=0 + "1672c3537afa82004c6b8a46f6f0d026", + "05", + "", + "", + "8e2ad721f9455f74d8b53d3141f27e8e", + }, + { //key=16, plaintext=32 + "9a4fea86a621a91ab371e492457796c0", + "75", + "ca6131faf0ff210e4e693d6c31c109fc5b6f54224eb120f37de31dc59ec669b6", + "4f6e2585c161f05a9ae1f2f894e9f0ab52b45d0f", + "5698c0a384241d30004290aac56bb3ece6fe8eacc5c4be98954deb9c3ff6aebf5d50e1af100509e1fba2a5e8a0af9670", + }, + { //key=24, plaintext=32 + "feffe9928665731c6d6a8f9467308308feffe9928665731c", + "75", + "ca6131faf0ff210e4e693d6c31c109fc5b6f54224eb120f37de31dc59ec669b6", + "4f6e2585c161f05a9ae1f2f894e9f0ab52b45d0f", + "2709b357ec8334a074dbd5c4c352b216cfd1c8bd66343c5d43bfc6bd3b2b6cd0e3a82315d56ea5e4961c9ef3bc7e4042", + }, + { //key=32, plaintext=32 + "feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308", + "75", + "ca6131faf0ff210e4e693d6c31c109fc5b6f54224eb120f37de31dc59ec669b6", + "4f6e2585c161f05a9ae1f2f894e9f0ab52b45d0f", + "d73bebe722c5e312fe910ba71d5a6a063a4297203f819103dfa885a8076d095545a999affde3dbac2b5be6be39195ed0", + }, + { // key=16, plaintext=0 + "d0f1f4defa1e8c08b4b26d576392027c", + "42b4f01eb9f5a1ea5b1eb73b0fb0baed54f387ecaa0393c7d7dffc6af50146ecc021abf7eb9038d4303d91f8d741a11743166c0860208bcc02c6258fd9511a2fa626f96d60b72fcff773af4e88e7a923506e4916ecbd814651e9f445adef4ad6a6b6c7290cc13b956130eef5b837c939fcac0cbbcc9656cd75b13823ee5acdac", + "", + "", + "7ab49b57ddf5f62c427950111c5c4f0d", + }, + { //key=16, plaintext=13 + "4a0c00a3d284dea9d4bf8b8dde86685e", + "f8cbe82588e784bcacbe092cd9089b51e01527297f635bf294b3aa787d91057ef23869789698ac960707857f163ecb242135a228ad93964f5dc4a4d7f88fd7b3b07dd0a5b37f9768fb05a523639f108c34c661498a56879e501a2321c8a4a94d7e1b89db255ac1f685e185263368e99735ebe62a7f2931b47282be8eb165e4d7", + "6d4bf87640a6a48a50d28797b7", + "8d8c7ffc55086d539b5a8f0d1232654c", + "0d803ec309482f35b8e6226f2b56303239298e06b281c2d51aaba3c125", + }, + { //key=16, plaintext=128 + "0e18a844ac5bf38e4cd72d9b0942e506", + "0870d4b28a2954489a0abcd5", + "67c6697351ff4aec29cdbaabf2fbe3467cc254f81be8e78d765a2e63339fc99a66320db73158a35a255d051758e95ed4abb2cdc69bb454110e827441213ddc8770e93ea141e1fc673e017e97eadc6b968f385c2aecb03bfb32af3c54ec18db5c021afe43fbfaaa3afb29d1e6053c7c9475d8be6189f95cbba8990f95b1ebf1b3", + "05eff700e9a13ae5ca0bcbd0484764bd1f231ea81c7b64c514735ac55e4b79633b706424119e09dcaad4acf21b10af3b33cde3504847155cbb6f2219ba9b7df50be11a1c7f23f829f8a41b13b5ca4ee8983238e0794d3d34bc5f4e77facb6c05ac86212baa1a55a2be70b5733b045cd33694b3afe2f0e49e4f321549fd824ea9", + "cace28f4976afd72e3c5128167eb788fbf6634dda0a2f53148d00f6fa557f5e9e8f736c12e450894af56cb67f7d99e1027258c8571bd91ee3b7360e0d508aa1f382411a16115f9c05251cc326d4016f62e0eb8151c048465b0c6c8ff12558d43310e18b2cb1889eec91557ce21ba05955cf4c1d4847aadfb1b0a83f3a3b82b7efa62a5f03c5d6eda381a85dd78dbc55c", + }, + { //key=24, plaintext=128 + "feffe9928665731c6d6a8f9467308308feffe9928665731c", + "0870d4b28a2954489a0abcd5", + "67c6697351ff4aec29cdbaabf2fbe3467cc254f81be8e78d765a2e63339fc99a66320db73158a35a255d051758e95ed4abb2cdc69bb454110e827441213ddc8770e93ea141e1fc673e017e97eadc6b968f385c2aecb03bfb32af3c54ec18db5c021afe43fbfaaa3afb29d1e6053c7c9475d8be6189f95cbba8990f95b1ebf1b3", + "05eff700e9a13ae5ca0bcbd0484764bd1f231ea81c7b64c514735ac55e4b79633b706424119e09dcaad4acf21b10af3b33cde3504847155cbb6f2219ba9b7df50be11a1c7f23f829f8a41b13b5ca4ee8983238e0794d3d34bc5f4e77facb6c05ac86212baa1a55a2be70b5733b045cd33694b3afe2f0e49e4f321549fd824ea9", + "303157d398376a8d51e39eabdd397f45b65f81f09acbe51c726ae85867e1675cad178580bb31c7f37c1af3644bd36ac436e9459139a4903d95944f306e415da709134dccde9d2b2d7d196b6740c196d9d10caa45296cf577a6e15d7ddf3576c20c503617d6a9e6b6d2be09ae28410a1210700a463a5b3b8d391abe9dac217e76a6f78306b5ebe759a5986b7d6682db0b", + }, + { //key=32, plaintext=128 + "feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308", + "0870d4b28a2954489a0abcd5", + "67c6697351ff4aec29cdbaabf2fbe3467cc254f81be8e78d765a2e63339fc99a66320db73158a35a255d051758e95ed4abb2cdc69bb454110e827441213ddc8770e93ea141e1fc673e017e97eadc6b968f385c2aecb03bfb32af3c54ec18db5c021afe43fbfaaa3afb29d1e6053c7c9475d8be6189f95cbba8990f95b1ebf1b3", + "05eff700e9a13ae5ca0bcbd0484764bd1f231ea81c7b64c514735ac55e4b79633b706424119e09dcaad4acf21b10af3b33cde3504847155cbb6f2219ba9b7df50be11a1c7f23f829f8a41b13b5ca4ee8983238e0794d3d34bc5f4e77facb6c05ac86212baa1a55a2be70b5733b045cd33694b3afe2f0e49e4f321549fd824ea9", + "e4f13934744125b9c35935ed4c5ac7d0c16434d52eadef1da91c6abb62bc757f01e3e42f628f030d750826adceb961f0675b81de48376b181d8781c6a0ccd0f34872ef6901b97ff7c2e152426b3257fb91f6a43f47befaaf7a2136fd0c97de8c48517ce047a5641141092c717b151b44f0794a164b5861f0a77271d1bdbc332e9e43d3b9828ccfdbd4ae338da5baf7a9", + }, + + { //key=16, plaintext=512 + "1f6c3a3bc0542aabba4ef8f6c7169e73", + "f3584606472b260e0dd2ebb2", + "67c6697351ff4aec29cdbaabf2fbe3467cc254f81be8e78d765a2e63339fc99a66320db73158a35a255d051758e95ed4abb2cdc69bb454110e827441213ddc8770e93ea141e1fc673e017e97eadc6b968f385c2aecb03bfb32af3c54ec18db5c021afe43fbfaaa3afb29d1e6053c7c9475d8be6189f95cbba8990f95b1ebf1b305eff700e9a13ae5ca0bcbd0484764bd1f231ea81c7b64c514735ac55e4b79633b706424119e09dcaad4acf21b10af3b33cde3504847155cbb6f2219ba9b7df50be11a1c7f23f829f8a41b13b5ca4ee8983238e0794d3d34bc5f4e77facb6c05ac86212baa1a55a2be70b5733b045cd33694b3afe2f0e49e4f321549fd824ea90870d4b28a2954489a0abcd50e18a844ac5bf38e4cd72d9b0942e506c433afcda3847f2dadd47647de321cec4ac430f62023856cfbb20704f4ec0bb920ba86c33e05f1ecd96733b79950a3e314d3d934f75ea0f210a8f6059401beb4bc4478fa4969e623d01ada696a7e4c7e5125b34884533a94fb319990325744ee9bbce9e525cf08f5e9e25e5360aad2b2d085fa54d835e8d466826498d9a8877565705a8a3f62802944de7ca5894e5759d351adac869580ec17e485f18c0c66f17cc07cbb22fce466da610b63af62bc83b4692f3affaf271693ac071fb86d11342d8def4f89d4b66335c1c7e4248367d8ed9612ec453902d8e50af89d7709d1a596c1f41f", + "95aa82ca6c49ae90cd1668baac7aa6f2b4a8ca99b2c2372acb08cf61c9c3805e6e0328da4cd76a19edd2d3994c798b0022569ad418d1fee4d9cd45a391c601ffc92ad91501432fee150287617c13629e69fc7281cd7165a63eab49cf714bce3a75a74f76ea7e64ff81eb61fdfec39b67bf0de98c7e4e32bdf97c8c6ac75ba43c02f4b2ed7216ecf3014df000108b67cf99505b179f8ed4980a6103d1bca70dbe9bbfab0ed59801d6e5f2d6f67d3ec5168e212e2daf02c6b963c98a1f7097de0c56891a2b211b01070dd8fd8b16c2a1a4e3cfd292d2984b3561d555d16c33ddc2bcf7edde13efe520c7e2abdda44d81881c531aeeeb66244c3b791ea8acfb6a68", + "55864065117e07650ca650a0f0d9ef4b02aee7c58928462fddb49045bf85355b4653fa26158210a7f3ef5b3ca48612e8b7adf5c025c1b821960af770d935df1c9a1dd25077d6b1c7f937b2e20ce981b07980880214698f3fad72fa370b3b7da257ce1d0cf352bc5304fada3e0f8927bd4e5c1abbffa563bdedcb567daa64faaed748cb361732200ba3506836a3c1c82aafa14c76dc07f6c4277ff2c61325f91fdbd6c1883e745fcaadd5a6d692eeaa5ad56eead6a9d74a595d22757ed89532a4b8831e2b9e2315baea70a9b95d228f09d491a5ed5ab7076766703457e3159bbb9b17b329525669863153079448c68cd2f200c0be9d43061a60639cb59d50993d276c05caaa565db8ce633b2673e4012bebbca02b1a64d779d04066f3e949ece173825885ec816468c819a8129007cc05d8785c48077d09eb1abcba14508dde85a6f16a744bc95faef24888d53a8020515ab20307efaecbdf143a26563c67989bceedc2d6d2bb9699bb6c615d93767e4158c1124e3b6c723aaa47796e59a60d3696cd85adfae9a62f2c02c22009f80ed494bdc587f31dd892c253b5c6d6b7db078fa72d23474ee54f8144d6561182d71c862941dbc0b2cb37a4d4b23cbad5637e6be901cc73f16d5aec39c60dddee631511e57b47520b61ae1892d2d1bd2b486e30faec892f171b6de98d96108016fac805604761f8e74742b3bb7dc8a290a46bf697c3e4446e6e65832cbae7cf1aaad1", + }, + { //key=24, plaintext=512 + "feffe9928665731c6d6a8f9467308308feffe9928665731c", + "f3584606472b260e0dd2ebb2", + "67c6697351ff4aec29cdbaabf2fbe3467cc254f81be8e78d765a2e63339fc99a66320db73158a35a255d051758e95ed4abb2cdc69bb454110e827441213ddc8770e93ea141e1fc673e017e97eadc6b968f385c2aecb03bfb32af3c54ec18db5c021afe43fbfaaa3afb29d1e6053c7c9475d8be6189f95cbba8990f95b1ebf1b305eff700e9a13ae5ca0bcbd0484764bd1f231ea81c7b64c514735ac55e4b79633b706424119e09dcaad4acf21b10af3b33cde3504847155cbb6f2219ba9b7df50be11a1c7f23f829f8a41b13b5ca4ee8983238e0794d3d34bc5f4e77facb6c05ac86212baa1a55a2be70b5733b045cd33694b3afe2f0e49e4f321549fd824ea90870d4b28a2954489a0abcd50e18a844ac5bf38e4cd72d9b0942e506c433afcda3847f2dadd47647de321cec4ac430f62023856cfbb20704f4ec0bb920ba86c33e05f1ecd96733b79950a3e314d3d934f75ea0f210a8f6059401beb4bc4478fa4969e623d01ada696a7e4c7e5125b34884533a94fb319990325744ee9bbce9e525cf08f5e9e25e5360aad2b2d085fa54d835e8d466826498d9a8877565705a8a3f62802944de7ca5894e5759d351adac869580ec17e485f18c0c66f17cc07cbb22fce466da610b63af62bc83b4692f3affaf271693ac071fb86d11342d8def4f89d4b66335c1c7e4248367d8ed9612ec453902d8e50af89d7709d1a596c1f41f", + "95aa82ca6c49ae90cd1668baac7aa6f2b4a8ca99b2c2372acb08cf61c9c3805e6e0328da4cd76a19edd2d3994c798b0022569ad418d1fee4d9cd45a391c601ffc92ad91501432fee150287617c13629e69fc7281cd7165a63eab49cf714bce3a75a74f76ea7e64ff81eb61fdfec39b67bf0de98c7e4e32bdf97c8c6ac75ba43c02f4b2ed7216ecf3014df000108b67cf99505b179f8ed4980a6103d1bca70dbe9bbfab0ed59801d6e5f2d6f67d3ec5168e212e2daf02c6b963c98a1f7097de0c56891a2b211b01070dd8fd8b16c2a1a4e3cfd292d2984b3561d555d16c33ddc2bcf7edde13efe520c7e2abdda44d81881c531aeeeb66244c3b791ea8acfb6a68", + "9daa466c7174dfde72b435fb6041ed7ff8ab8b1b96edb90437c3cc2e7e8a7c2c3629bae3bcaede99ee926ef4c55571e504e1c516975f6c719611c4da74acc23bbc79b3a67491f84d573e0293aa0cf5d775dde93fc466d5babd3e93a6506c0261021ac184f571ab190df83c32b41a67eaaa8dde27c02b08f15cabc75e46d1f9634f32f9233b2cb975386ff3a5e16b6ea2e2e4215cb33beb4de39a861d7f4a02165cd763f8252b2d60ac45d65a70735a8806a8fec3ca9d37c2cdcb21d2bd5c08d350e4bbdfb11dca344b9bee17e71ee0df3449fd9f9581c6b5483843b457534afb4240585f38ac22aa59a68a167fed6f1be0a5b072b2461f16c976b9aa0f5f2f5988818b01faa025ac7788212d92d222f7c14fe6e8f644c8cd117bb8def5a0217dad4f05cbb334ff9ccf819a4a085ed7c19928ddc40edc931b47339f456ccd423b5c0c1cdc96278006b29de945cdceb0737771e14562fff2aba40606f6046da5031647308682060412812317962bb68be3b42876f0905d52da51ec6345677fe86613828f488cc5685a4b973e48babd109a56d1a1effb286133dc2a94b4ada5707d3a7825941fea1a7502693afc7fe5d810bb0050d98aa6b80801e13b563954a35c31f57d5ba1ddb1a2be26426e2fe7bcd13ba183d80ac1c556b7ec2069b01de1450431a1c2e27848e1f5f4af013bce9080aebd2bb0f1de9f7bb460771c266d48ff4cf84a66f82630657db861c032971079", + }, + { //key=32, plaintext=512 + "feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308", + "f3584606472b260e0dd2ebb2", + "67c6697351ff4aec29cdbaabf2fbe3467cc254f81be8e78d765a2e63339fc99a66320db73158a35a255d051758e95ed4abb2cdc69bb454110e827441213ddc8770e93ea141e1fc673e017e97eadc6b968f385c2aecb03bfb32af3c54ec18db5c021afe43fbfaaa3afb29d1e6053c7c9475d8be6189f95cbba8990f95b1ebf1b305eff700e9a13ae5ca0bcbd0484764bd1f231ea81c7b64c514735ac55e4b79633b706424119e09dcaad4acf21b10af3b33cde3504847155cbb6f2219ba9b7df50be11a1c7f23f829f8a41b13b5ca4ee8983238e0794d3d34bc5f4e77facb6c05ac86212baa1a55a2be70b5733b045cd33694b3afe2f0e49e4f321549fd824ea90870d4b28a2954489a0abcd50e18a844ac5bf38e4cd72d9b0942e506c433afcda3847f2dadd47647de321cec4ac430f62023856cfbb20704f4ec0bb920ba86c33e05f1ecd96733b79950a3e314d3d934f75ea0f210a8f6059401beb4bc4478fa4969e623d01ada696a7e4c7e5125b34884533a94fb319990325744ee9bbce9e525cf08f5e9e25e5360aad2b2d085fa54d835e8d466826498d9a8877565705a8a3f62802944de7ca5894e5759d351adac869580ec17e485f18c0c66f17cc07cbb22fce466da610b63af62bc83b4692f3affaf271693ac071fb86d11342d8def4f89d4b66335c1c7e4248367d8ed9612ec453902d8e50af89d7709d1a596c1f41f", + "95aa82ca6c49ae90cd1668baac7aa6f2b4a8ca99b2c2372acb08cf61c9c3805e6e0328da4cd76a19edd2d3994c798b0022569ad418d1fee4d9cd45a391c601ffc92ad91501432fee150287617c13629e69fc7281cd7165a63eab49cf714bce3a75a74f76ea7e64ff81eb61fdfec39b67bf0de98c7e4e32bdf97c8c6ac75ba43c02f4b2ed7216ecf3014df000108b67cf99505b179f8ed4980a6103d1bca70dbe9bbfab0ed59801d6e5f2d6f67d3ec5168e212e2daf02c6b963c98a1f7097de0c56891a2b211b01070dd8fd8b16c2a1a4e3cfd292d2984b3561d555d16c33ddc2bcf7edde13efe520c7e2abdda44d81881c531aeeeb66244c3b791ea8acfb6a68", + "793d34afb982ab70b0e204e1e7243314a19e987d9ab7662f58c3dc6064c9be35667ad53b115c610cfc229f4e5b3e8aae7aac97ce66d1d20b92da3860701b5006dd1385e173e3af7a5a9bb7da85c0434cd55a40fb9c482a0b36f0782846a7f16d05b40a08f0ad9a633f9a1e99e69e6b8039a0f2a91be40f193f4ce3bed1886dab1b0a6112f91503684c1e5afb938b9497166a7147badd1cc19c73e8b9f22e0dcbd18996868d7ad47755e677ee6e6ec87094cab7ee35feb96017c474261ba7391b18a72451e6daa7f38e162358c5d84788c974e614acc362b887c56b756df5aeacdda09b11d35a1f97daaceb5ca1b40a78b6058f7e1d26ad945be6ef74a8e72729f9ab2e3e7dda88d8f803e26e84a34ac07a7cecf5b6be23a4aa1ac6897f23169d894d53369b27673cf2438af9c6b53a2fa412c74dc075c617029e571f4c2951b1cdd63d33765af9d9d20e12430a83784c2bca8603f11521fa97f2e45398b4a385176701c6f416720ca0816bf51a3e0b4c7a28a89f0616a296423760f0f2f471e1def8a2f43956f79790a6b64dfdbb8159236ebd7fe1049e8e005e231e5f1936bfdccbda8cf0cb5116af758dfd6732dfa77ac3e6faf0996c13473292da363f01ddcb6a524dbf1d5d608f57c146173a9b169f979e101fe581f749764fd87119ae301958c8e9a9bfd16249e564ffbb304bc2ca4c34713a20fb858b47c83ce768e04f149884504c0515345631401f829e3259", + }, + + { //key=16, plaintext=293 + "0795d80bc7f40f4d41c280271a2e4f7f", + "ff824c906594aff365d3cb1f", + "1ad4e74d127f935beee57cff920665babe7ce56227377afe570ba786193ded3412d4812453157f42fafc418c02a746c1232c234a639d49baa8f041c12e2ef540027764568ce49886e0d913e28059a3a485c6eee96337a30b28e4cd5612c2961539fa6bc5de034cbedc5fa15db844013e0bef276e27ca7a4faf47a5c1093bd643354108144454d221b3737e6cb87faac36ed131959babe44af2890cfcc4e23ffa24470e689ce0894f5407bb0c8665cff536008ad2ac6f1c9ef8289abd0bd9b72f21c597bda5210cf928c805af2dd4a464d52e36819d521f967bba5386930ab5b4cf4c71746d7e6e964673457348e9d71d170d9eb560bd4bdb779e610ba816bf776231ebd0af5966f5cdab6815944032ab4dd060ad8dab880549e910f1ffcf6862005432afad", + "98a47a430d8fd74dc1829a91e3481f8ed024d8ba34c9b903321b04864db333e558ae28653dffb2", + "3b8f91443480e647473a0a0b03d571c622b7e70e4309a02c9bb7980053010d865e6aec161354dc9f481b2cd5213e09432b57ec4e58fbd0a8549dd15c8c4e74a6529f75fad0ce5a9e20e2beeb2f91eb638bf88999968de438d2f1cedbfb0a1c81f9e8e7362c738e0fddd963692a4f4df9276b7f040979ce874cf6fa3de26da0713784bdb25e4efcb840554ef5b38b5fe8380549a496bd8e423a7456df6f4ae78a07ebe2276a8e22fc2243ec4f78abe0c99c733fd67c8c492699fa5ee2289cdd0a8d469bf883520ee74efb854bfadc7366a49ee65ca4e894e3335e2b672618d362eee12a577dd8dc2ba55c49c1fc3ad68180e9b112d0234d4aa28f5661f1e036450ca6f18be0166676bd80f8a4890c6ddea306fabb7ff3cb2860aa32a827e3a312912a2dfa70f6bc1c07de238448f2d751bd0cf15bf7", + }, + { //key=24, plaintext=293 + "e2e001a36c60d2bf40d69ff5b2b1161ea218db263be16a4e", + "84230643130d05425826641e", + "adb034f3f4a7ca45e2993812d113a9821d50df151af978bccc6d3bc113e15bc0918fb385377dca1916022ce816d56a332649484043c0fc0f2d37d040182b00a9bbb42ef231f80b48fb3730110d9a4433e38c73264c703579a705b9c031b969ec6d98de9f90e9e78b21179c2eb1e061946cd4bbb844f031ecf6eaac27a4151311adf1b03eda97c9fbae66295f468af4b35faf6ba39f9d8f95873bbc2b51cf3dfec0ed3c9b850696336cc093b24a8765a936d14dd56edc6bf518272169f75e67b74ba452d0aae90416a997c8f31e2e9d54ffea296dc69462debc8347b3e1af6a2d53bdfdfda601134f98db42b609df0a08c9347590c8d86e845bb6373d65a26ab85f67b50569c85401a396b8ad76c2b53ff62bcfbf033e435ef47b9b591d05117c6dc681d68e", + "d5d7316b8fdee152942148bff007c22e4b2022c6bc7be3c18c5f2e52e004e0b5dc12206bf002bd", + "f2c39423ee630dfe961da81909159dba018ce09b1073a12a477108316af5b7a31f86be6a0548b572d604bd115ea737dde899e0bd7f7ac9b23e38910dc457551ecc15c814a9f46d8432a1a36097dc1afe2712d1ba0838fa88cb55d9f65a2e9bece0dbf8999562503989041a2c87d7eb80ef649769d2f4978ce5cf9664f2bd0849646aa81cb976e45e1ade2f17a8126219e917aadbb4bae5e2c4b3f57bbc7f13fcc807df7842d9727a1b389e0b749e5191482adacabd812627c6eae2c7a30caf0844ad2a22e08f39edddf0ae10413e47db433dfe3febbb5a5cec9ade21fbba1e548247579395880b747669a8eb7e2ec0c1bff7fed2defdb92b07a14edf07b1bde29c31ab052ff1214e6b5ebbefcb8f21b5d6f8f6e07ee57ad6e14d4e142cb3f51bb465ab3a28a2a12f01b7514ad0463f2bde0d71d221", + }, + { //key=32, plaintext=293 + "5394e890d37ba55ec9d5f327f15680f6a63ef5279c79331643ad0af6d2623525", + "815e840b7aca7af3b324583f", + "8e63067cd15359f796b43c68f093f55fdf3589fc5f2fdfad5f9d156668a617f7091d73da71cdd207810e6f71a165d0809a597df9885ca6e8f9bb4e616166586b83cc45f49917fc1a256b8bc7d05c476ab5c4633e20092619c4747b26dad3915e9fd65238ee4e5213badeda8a3a22f5efe6582d0762532026c89b4ca26fdd000eb45347a2a199b55b7790e6b1b2dba19833ce9f9522c0bcea5b088ccae68dd99ae0203c81b9f1dd3181c3e2339e83ccd1526b67742b235e872bea5111772aab574ae7d904d9b6355a79178e179b5ae8edc54f61f172bf789ea9c9af21f45b783e4251421b077776808f04972a5e801723cf781442378ce0e0568f014aea7a882dcbcb48d342be53d1c2ebfb206b12443a8a587cc1e55ca23beca385d61d0d03e9d84cbc1b0a", + "0feccdfae8ed65fa31a0858a1c466f79e8aa658c2f3ba93c3f92158b4e30955e1c62580450beff", + "b69a7e17bb5af688883274550a4ded0d1aff49a0b18343f4b382f745c163f7f714c9206a32a1ff012427e19431951edd0a755e5f491b0eedfd7df68bbc6085dd2888607a2f998c3e881eb1694109250db28291e71f4ad344a125624fb92e16ea9815047cd1111cabfdc9cb8c3b4b0f40aa91d31774009781231400789ed545404af6c3f76d07ddc984a7bd8f52728159782832e298cc4d529be96d17be898efd83e44dc7b0e2efc645849fd2bba61fef0ae7be0dcab233cc4e2b7ba4e887de9c64b97f2a1818aa54371a8d629dae37975f7784e5e3cc77055ed6e975b1e5f55e6bbacdc9f295ce4ada2c16113cd5b323cf78b7dde39f4a87aa8c141a31174e3584ccbd380cf5ec6d1dba539928b084fa9683e9c0953acf47cc3ac384a2c38914f1da01fb2cfd78905c2b58d36b2574b9df15535d82", + }, + // These cases test non-standard tag sizes. + { + "89c54b0d3bc3c397d5039058c220685f", + "bc7f45c00868758d62d4bb4d", + "582670b0baf5540a3775b6615605bd05", + "48d16cda0337105a50e2ed76fd18e114", + "fc2d4c4eee2209ddbba6663c02765e6955e783b00156f5da0446e2970b877f", + }, + { + "bad6049678bf75c9087b3e3ae7e72c13", + "a0a017b83a67d8f1b883e561", + "a1be93012f05a1958440f74a5311f4a1", + "f7c27b51d5367161dc2ff1e9e3edc6f2", + "36f032f7e3dc3275ca22aedcdc68436b99a2227f8bb69d45ea5d8842cd08", + }, + { + "66a3c722ccf9709525650973ecc100a9", + "1621d42d3a6d42a2d2bf9494", + "61fa9dbbed2190fbc2ffabf5d2ea4ff8", + "d7a9b6523b8827068a6354a6d166c6b9", + "fef3b20f40e08a49637cc82f4c89b8603fd5c0132acfab97b5fff651c4", + }, + { + "562ae8aadb8d23e0f271a99a7d1bd4d1", + "f7a5e2399413b89b6ad31aff", + "bbdc3504d803682aa08a773cde5f231a", + "2b9680b886b3efb7c6354b38c63b5373", + "e2b7e5ed5ff27fc8664148f5a628a46dcbf2015184fffb82f2651c36", + }, + { + "11754cd72aec309bf52f7687212e8957", + "", + "", + "", + "250327c674aaf477aef2675748cf6971", + }, +} + +func TestAESGCM(t *testing.T) { + testAllImplementations(t, testAESGCM) +} + +func testAESGCM(t *testing.T, newCipher func(key []byte) cipher.Block) { + for i, test := range aesGCMTests { + key, _ := hex.DecodeString(test.key) + aes := newCipher(key) + + nonce, _ := hex.DecodeString(test.nonce) + plaintext, _ := hex.DecodeString(test.plaintext) + ad, _ := hex.DecodeString(test.ad) + tagSize := (len(test.result) - len(test.plaintext)) / 2 + + var err error + var aesgcm cipher.AEAD + switch { + // Handle non-standard tag sizes + case tagSize != 16: + aesgcm, err = cipher.NewGCMWithTagSize(aes, tagSize) + if err != nil { + t.Fatal(err) + } + + // Handle 0 nonce size (expect error and continue) + case len(nonce) == 0: + aesgcm, err = cipher.NewGCMWithNonceSize(aes, 0) + if err == nil { + t.Fatal("expected error for zero nonce size") + } + continue + + // Handle non-standard nonce sizes + case len(nonce) != 12: + aesgcm, err = cipher.NewGCMWithNonceSize(aes, len(nonce)) + if err != nil { + t.Fatal(err) + } + + default: + aesgcm, err = cipher.NewGCM(aes) + if err != nil { + t.Fatal(err) + } + } + + ct := aesgcm.Seal(nil, nonce, plaintext, ad) + if ctHex := hex.EncodeToString(ct); ctHex != test.result { + t.Errorf("#%d: got %s, want %s", i, ctHex, test.result) + continue + } + + plaintext2, err := aesgcm.Open(nil, nonce, ct, ad) + if err != nil { + t.Errorf("#%d: Open failed", i) + continue + } + + if !bytes.Equal(plaintext, plaintext2) { + t.Errorf("#%d: plaintext's don't match: got %x vs %x", i, plaintext2, plaintext) + continue + } + + if len(ad) > 0 { + ad[0] ^= 0x80 + if _, err := aesgcm.Open(nil, nonce, ct, ad); err == nil { + t.Errorf("#%d: Open was successful after altering additional data", i) + } + ad[0] ^= 0x80 + } + + nonce[0] ^= 0x80 + if _, err := aesgcm.Open(nil, nonce, ct, ad); err == nil { + t.Errorf("#%d: Open was successful after altering nonce", i) + } + nonce[0] ^= 0x80 + + ct[0] ^= 0x80 + if _, err := aesgcm.Open(nil, nonce, ct, ad); err == nil { + t.Errorf("#%d: Open was successful after altering ciphertext", i) + } + ct[0] ^= 0x80 + } +} + +func TestGCMInvalidTagSize(t *testing.T) { + testAllImplementations(t, testGCMInvalidTagSize) +} + +func testGCMInvalidTagSize(t *testing.T, newCipher func(key []byte) cipher.Block) { + key, _ := hex.DecodeString("ab72c77b97cb5fe9a382d9fe81ffdbed") + aes := newCipher(key) + + for _, tagSize := range []int{0, 1, aes.BlockSize() + 1} { + aesgcm, err := cipher.NewGCMWithTagSize(aes, tagSize) + if aesgcm != nil || err == nil { + t.Fatalf("NewGCMWithTagSize was successful with an invalid %d-byte tag size", tagSize) + } + } +} + +func TestTagFailureOverwrite(t *testing.T) { + testAllImplementations(t, testTagFailureOverwrite) +} + +func testTagFailureOverwrite(t *testing.T, newCipher func(key []byte) cipher.Block) { + // The AESNI GCM code decrypts and authenticates concurrently and so + // overwrites the output buffer before checking the authentication tag. + // In order to be consistent across platforms, all implementations + // should do this and this test checks that. + + key, _ := hex.DecodeString("ab72c77b97cb5fe9a382d9fe81ffdbed") + nonce, _ := hex.DecodeString("54cc7dc2c37ec006bcc6d1db") + ciphertext, _ := hex.DecodeString("0e1bde206a07a9c2c1b65300f8c649972b4401346697138c7a4891ee59867d0c") + + aes := newCipher(key) + aesgcm, _ := cipher.NewGCM(aes) + + dst := make([]byte, len(ciphertext)-16) + for i := range dst { + dst[i] = 42 + } + + result, err := aesgcm.Open(dst[:0], nonce, ciphertext, nil) + if err == nil { + t.Fatal("Bad Open still resulted in nil error.") + } + + if result != nil { + t.Fatal("Failed Open returned non-nil result.") + } + + for i := range dst { + if dst[i] != 0 { + t.Fatal("Failed Open didn't zero dst buffer") + } + } +} + +func TestGCMCounterWrap(t *testing.T) { + testAllImplementations(t, testGCMCounterWrap) +} + +func testGCMCounterWrap(t *testing.T, newCipher func(key []byte) cipher.Block) { + // Test that the last 32-bits of the counter wrap correctly. + tests := []struct { + nonce, tag string + }{ + {"0fa72e25", "37e1948cdfff09fbde0c40ad99fee4a7"}, // counter: 7eb59e4d961dad0dfdd75aaffffffff0 + {"afe05cc1", "438f3aa9fee5e54903b1927bca26bbdf"}, // counter: 75d492a7e6e6bfc979ad3a8ffffffff4 + {"9ffecbef", "7b88ca424df9703e9e8611071ec7e16e"}, // counter: c8bb108b0ecdc71747b9d57ffffffff5 + {"ffc3e5b3", "38d49c86e0abe853ac250e66da54c01a"}, // counter: 706414d2de9b36ab3b900a9ffffffff6 + {"cfdd729d", "e08402eaac36a1a402e09b1bd56500e8"}, // counter: cd0b96fe36b04e750584e56ffffffff7 + {"010ae3d486", "5405bb490b1f95d01e2ba735687154bc"}, // counter: e36c18e69406c49722808104fffffff8 + {"01b1107a9d", "939a585f342e01e17844627492d44dbf"}, // counter: e6d56eaf9127912b6d62c6dcffffffff + } + key := newCipher(make([]byte, 16)) + plaintext := make([]byte, 16*17+1) + for i, test := range tests { + nonce, _ := hex.DecodeString(test.nonce) + want, _ := hex.DecodeString(test.tag) + aead, err := cipher.NewGCMWithNonceSize(key, len(nonce)) + if err != nil { + t.Fatal(err) + } + got := aead.Seal(nil, nonce, plaintext, nil) + if !bytes.Equal(got[len(plaintext):], want) { + t.Errorf("test[%v]: got: %x, want: %x", i, got[len(plaintext):], want) + } + _, err = aead.Open(nil, nonce, got, nil) + if err != nil { + t.Errorf("test[%v]: authentication failed", i) + } + } +} + +func TestGCMAsm(t *testing.T) { + // Create a new pair of AEADs, one using the assembly implementation + // and one using the generic Go implementation. + newAESGCM := func(key []byte) (asm, generic cipher.AEAD, err error) { + block, err := aes.NewCipher(key[:]) + if err != nil { + return nil, nil, err + } + asm, err = cipher.NewGCM(block) + if err != nil { + return nil, nil, err + } + generic, err = cipher.NewGCM(wrap(block)) + if err != nil { + return nil, nil, err + } + return asm, generic, nil + } + + // check for assembly implementation + var key [16]byte + asm, generic, err := newAESGCM(key[:]) + if err != nil { + t.Fatal(err) + } + if reflect.TypeOf(asm) == reflect.TypeOf(generic) { + t.Skipf("no assembly implementation of GCM") + } + + // generate permutations + type pair struct{ align, length int } + lengths := []int{0, 156, 8192, 8193, 8208} + keySizes := []int{16, 24, 32} + alignments := []int{0, 1, 2, 3} + if testing.Short() { + keySizes = []int{16} + alignments = []int{1} + } + perms := make([]pair, 0) + for _, l := range lengths { + for _, a := range alignments { + if a != 0 && l == 0 { + continue + } + perms = append(perms, pair{align: a, length: l}) + } + } + + // run test for all permutations + test := func(ks int, pt, ad []byte) error { + key := make([]byte, ks) + if _, err := io.ReadFull(rand.Reader, key); err != nil { + return err + } + asm, generic, err := newAESGCM(key) + if err != nil { + return err + } + if _, err := io.ReadFull(rand.Reader, pt); err != nil { + return err + } + if _, err := io.ReadFull(rand.Reader, ad); err != nil { + return err + } + nonce := make([]byte, 12) + if _, err := io.ReadFull(rand.Reader, nonce); err != nil { + return err + } + want := generic.Seal(nil, nonce, pt, ad) + got := asm.Seal(nil, nonce, pt, ad) + if !bytes.Equal(want, got) { + return errors.New("incorrect Seal output") + } + got, err = asm.Open(nil, nonce, want, ad) + if err != nil { + return errors.New("authentication failed") + } + if !bytes.Equal(pt, got) { + return errors.New("incorrect Open output") + } + return nil + } + for _, a := range perms { + ad := make([]byte, a.align+a.length) + ad = ad[a.align:] + for _, p := range perms { + pt := make([]byte, p.align+p.length) + pt = pt[p.align:] + for _, ks := range keySizes { + if err := test(ks, pt, ad); err != nil { + t.Error(err) + t.Errorf(" key size: %v", ks) + t.Errorf(" plaintext alignment: %v", p.align) + t.Errorf(" plaintext length: %v", p.length) + t.Errorf(" additionalData alignment: %v", a.align) + t.Fatalf(" additionalData length: %v", a.length) + } + } + } + } +} + +// Test GCM against the general cipher.AEAD interface tester. +func TestGCMAEAD(t *testing.T) { + testAllImplementations(t, testGCMAEAD) +} + +func testGCMAEAD(t *testing.T, newCipher func(key []byte) cipher.Block) { + minTagSize := 12 + + for _, keySize := range []int{128, 192, 256} { + // Use AES as underlying block cipher at different key sizes for GCM. + t.Run(fmt.Sprintf("AES-%d", keySize), func(t *testing.T) { + rng := newRandReader(t) + + key := make([]byte, keySize/8) + rng.Read(key) + + block := newCipher(key) + + // Test GCM with the current AES block with the standard nonce and tag + // sizes. + cryptotest.TestAEAD(t, func() (cipher.AEAD, error) { return cipher.NewGCM(block) }) + + // Test non-standard tag sizes. + t.Run("MinTagSize", func(t *testing.T) { + cryptotest.TestAEAD(t, func() (cipher.AEAD, error) { return cipher.NewGCMWithTagSize(block, minTagSize) }) + }) + + // Test non-standard nonce sizes. + for _, nonceSize := range []int{1, 16, 100} { + t.Run(fmt.Sprintf("NonceSize-%d", nonceSize), func(t *testing.T) { + cryptotest.TestAEAD(t, func() (cipher.AEAD, error) { return cipher.NewGCMWithNonceSize(block, nonceSize) }) + }) + } + + // Test NewGCMWithRandomNonce. + t.Run("GCMWithRandomNonce", func(t *testing.T) { + if _, ok := block.(*wrapper); ok || boring.Enabled { + t.Skip("NewGCMWithRandomNonce requires an AES block cipher") + } + cryptotest.TestAEAD(t, func() (cipher.AEAD, error) { return cipher.NewGCMWithRandomNonce(block) }) + }) + }) + } +} + +func TestGCMExtraMethods(t *testing.T) { + testAllImplementations(t, func(t *testing.T, newCipher func([]byte) cipher.Block) { + t.Run("NewGCM", func(t *testing.T) { + a, _ := cipher.NewGCM(newCipher(make([]byte, 16))) + cryptotest.NoExtraMethods(t, &a) + }) + t.Run("NewGCMWithTagSize", func(t *testing.T) { + a, _ := cipher.NewGCMWithTagSize(newCipher(make([]byte, 16)), 12) + cryptotest.NoExtraMethods(t, &a) + }) + t.Run("NewGCMWithNonceSize", func(t *testing.T) { + a, _ := cipher.NewGCMWithNonceSize(newCipher(make([]byte, 16)), 12) + cryptotest.NoExtraMethods(t, &a) + }) + t.Run("NewGCMWithRandomNonce", func(t *testing.T) { + block := newCipher(make([]byte, 16)) + if _, ok := block.(*wrapper); ok || boring.Enabled { + t.Skip("NewGCMWithRandomNonce requires an AES block cipher") + } + a, _ := cipher.NewGCMWithRandomNonce(block) + cryptotest.NoExtraMethods(t, &a) + }) + }) +} + +func TestGCMNoncesFIPSV1(t *testing.T) { + cryptotest.MustSupportFIPS140(t) + if !fips140.Enabled { + cmd := testenv.Command(t, testenv.Executable(t), "-test.run=^TestGCMNoncesFIPSV1$", "-test.v") + cmd.Env = append(cmd.Environ(), "GODEBUG=fips140=on") + out, err := cmd.CombinedOutput() + t.Logf("running with GODEBUG=fips140=on:\n%s", out) + if err != nil { + t.Errorf("fips140=on subprocess failed: %v", err) + } + return + } + + tryNonce := func(aead cipher.AEAD, nonce []byte) bool { + fips140.ResetServiceIndicator() + aead.Seal(nil, nonce, []byte("x"), nil) + return fips140.ServiceIndicator() + } + expectOK := func(t *testing.T, aead cipher.AEAD, nonce []byte) { + t.Helper() + if !tryNonce(aead, nonce) { + t.Errorf("expected service indicator true for %x", nonce) + } + } + expectPanic := func(t *testing.T, aead cipher.AEAD, nonce []byte) { + t.Helper() + defer func() { + t.Helper() + if recover() == nil { + t.Errorf("expected panic for %x", nonce) + } + }() + tryNonce(aead, nonce) + } + + t.Run("NewGCMWithCounterNonce", func(t *testing.T) { + newGCM := func() cipher.AEAD { + key := make([]byte, 16) + block, _ := fipsaes.New(key) + aead, _ := gcm.NewGCMWithCounterNonce(block) + return aead + } + + g := newGCM() + expectOK(t, g, []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}) + expectOK(t, g, []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}) + expectOK(t, g, []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100}) + expectOK(t, g, []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}) + expectOK(t, g, []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}) + expectOK(t, g, []byte{0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}) + expectOK(t, g, []byte{0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}) + expectOK(t, g, []byte{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}) + expectOK(t, g, []byte{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}) + expectOK(t, g, []byte{0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0}) + // Changed name. + expectPanic(t, g, []byte{0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}) + + g = newGCM() + expectOK(t, g, []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}) + // Went down. + expectPanic(t, g, []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}) + + g = newGCM() + expectOK(t, g, []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}) + expectOK(t, g, []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13}) + // Did not increment. + expectPanic(t, g, []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13}) + + g = newGCM() + expectOK(t, g, []byte{1, 2, 3, 4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00}) + expectOK(t, g, []byte{1, 2, 3, 4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}) + // Wrap is ok as long as we don't run out of values. + expectOK(t, g, []byte{1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0}) + expectOK(t, g, []byte{1, 2, 3, 4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe}) + // Run out of counters. + expectPanic(t, g, []byte{1, 2, 3, 4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff}) + + g = newGCM() + expectOK(t, g, []byte{1, 2, 3, 4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}) + // Wrap with overflow. + expectPanic(t, g, []byte{1, 2, 3, 5, 0, 0, 0, 0, 0, 0, 0, 0}) + }) + + t.Run("NewGCMForSSH", func(t *testing.T) { + newGCM := func() cipher.AEAD { + key := make([]byte, 16) + block, _ := fipsaes.New(key) + aead, _ := gcm.NewGCMForSSH(block) + return aead + } + // incIV from x/crypto/ssh/cipher.go. + incIV := func(iv []byte) { + for i := 4 + 7; i >= 4; i-- { + iv[i]++ + if iv[i] != 0 { + break + } + } + } + + aead := newGCM() + iv := decodeHex(t, "11223344"+"0000000000000000") + expectOK(t, aead, iv) + incIV(iv) + expectOK(t, aead, iv) + iv = decodeHex(t, "11223344"+"fffffffffffffffe") + expectOK(t, aead, iv) + incIV(iv) + expectPanic(t, aead, iv) + + // Wrapping is ok as long as we don't run out of values. + aead = newGCM() + iv = decodeHex(t, "11223344"+"fffffffffffffffe") + expectOK(t, aead, iv) + incIV(iv) + expectOK(t, aead, iv) + incIV(iv) + expectOK(t, aead, iv) + incIV(iv) + expectOK(t, aead, iv) + + aead = newGCM() + iv = decodeHex(t, "11223344"+"aaaaaaaaaaaaaaaa") + expectOK(t, aead, iv) + iv = decodeHex(t, "11223344"+"ffffffffffffffff") + expectOK(t, aead, iv) + incIV(iv) + expectOK(t, aead, iv) + iv = decodeHex(t, "11223344"+"aaaaaaaaaaaaaaa8") + expectOK(t, aead, iv) + incIV(iv) + expectPanic(t, aead, iv) + iv = decodeHex(t, "11223344"+"bbbbbbbbbbbbbbbb") + expectPanic(t, aead, iv) + }) +} + +func decodeHex(t *testing.T, s string) []byte { + t.Helper() + b, err := hex.DecodeString(s) + if err != nil { + t.Fatal(err) + } + return b +} diff --git a/go/src/crypto/cipher/io.go b/go/src/crypto/cipher/io.go new file mode 100644 index 0000000000000000000000000000000000000000..b70285b4060a70e82cce493e77798cef25b69265 --- /dev/null +++ b/go/src/crypto/cipher/io.go @@ -0,0 +1,53 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cipher + +import "io" + +// The Stream* objects are so simple that all their members are public. Users +// can create them themselves. + +// StreamReader wraps a [Stream] into an [io.Reader]. It calls XORKeyStream +// to process each slice of data which passes through. +type StreamReader struct { + S Stream + R io.Reader +} + +func (r StreamReader) Read(dst []byte) (n int, err error) { + n, err = r.R.Read(dst) + r.S.XORKeyStream(dst[:n], dst[:n]) + return +} + +// StreamWriter wraps a [Stream] into an io.Writer. It calls XORKeyStream +// to process each slice of data which passes through. If any [StreamWriter.Write] +// call returns short then the StreamWriter is out of sync and must be discarded. +// A StreamWriter has no internal buffering; [StreamWriter.Close] does not need +// to be called to flush write data. +type StreamWriter struct { + S Stream + W io.Writer + Err error // unused +} + +func (w StreamWriter) Write(src []byte) (n int, err error) { + c := make([]byte, len(src)) + w.S.XORKeyStream(c, src) + n, err = w.W.Write(c) + if n != len(src) && err == nil { // should never happen + err = io.ErrShortWrite + } + return +} + +// Close closes the underlying Writer and returns its Close return value, if the Writer +// is also an io.Closer. Otherwise it returns nil. +func (w StreamWriter) Close() error { + if c, ok := w.W.(io.Closer); ok { + return c.Close() + } + return nil +} diff --git a/go/src/crypto/cipher/modes_test.go b/go/src/crypto/cipher/modes_test.go new file mode 100644 index 0000000000000000000000000000000000000000..3f431b9b1341f441c1c1376c2cc6b9ab9e10f292 --- /dev/null +++ b/go/src/crypto/cipher/modes_test.go @@ -0,0 +1,126 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cipher_test + +import ( + . "crypto/cipher" + "reflect" + "testing" +) + +// Historically, crypto/aes's Block would implement some undocumented +// methods for crypto/cipher to use from NewCTR, NewCBCEncrypter, etc. +// This is no longer the case, but for now test that the mechanism is +// still working until we explicitly decide to remove it. + +type block struct { + Block +} + +func (block) BlockSize() int { + return 16 +} + +type specialCTR struct { + Stream +} + +func (block) NewCTR(iv []byte) Stream { + return specialCTR{} +} + +func TestCTRAble(t *testing.T) { + b := block{} + s := NewCTR(b, make([]byte, 16)) + if _, ok := s.(specialCTR); !ok { + t.Errorf("NewCTR did not return specialCTR") + } +} + +type specialCBC struct { + BlockMode +} + +func (block) NewCBCEncrypter(iv []byte) BlockMode { + return specialCBC{} +} + +func (block) NewCBCDecrypter(iv []byte) BlockMode { + return specialCBC{} +} + +func TestCBCAble(t *testing.T) { + b := block{} + s := NewCBCEncrypter(b, make([]byte, 16)) + if _, ok := s.(specialCBC); !ok { + t.Errorf("NewCBCEncrypter did not return specialCBC") + } + s = NewCBCDecrypter(b, make([]byte, 16)) + if _, ok := s.(specialCBC); !ok { + t.Errorf("NewCBCDecrypter did not return specialCBC") + } +} + +type specialGCM struct { + AEAD +} + +func (block) NewGCM(nonceSize, tagSize int) (AEAD, error) { + return specialGCM{}, nil +} + +func TestGCM(t *testing.T) { + b := block{} + s, err := NewGCM(b) + if err != nil { + t.Errorf("NewGCM failed: %v", err) + } + if _, ok := s.(specialGCM); !ok { + t.Errorf("NewGCM did not return specialGCM") + } +} + +// TestNoExtraMethods makes sure we don't accidentally expose methods on the +// underlying implementations of modes. +func TestNoExtraMethods(t *testing.T) { + testAllImplementations(t, testNoExtraMethods) +} + +func testNoExtraMethods(t *testing.T, newBlock func([]byte) Block) { + b := newBlock(make([]byte, 16)) + + ctr := NewCTR(b, make([]byte, 16)) + ctrExpected := []string{"XORKeyStream"} + if got := exportedMethods(ctr); !reflect.DeepEqual(got, ctrExpected) { + t.Errorf("CTR: got %v, want %v", got, ctrExpected) + } + + cbc := NewCBCEncrypter(b, make([]byte, 16)) + cbcExpected := []string{"BlockSize", "CryptBlocks", "SetIV"} + if got := exportedMethods(cbc); !reflect.DeepEqual(got, cbcExpected) { + t.Errorf("CBC: got %v, want %v", got, cbcExpected) + } + cbc = NewCBCDecrypter(b, make([]byte, 16)) + if got := exportedMethods(cbc); !reflect.DeepEqual(got, cbcExpected) { + t.Errorf("CBC: got %v, want %v", got, cbcExpected) + } + + gcm, _ := NewGCM(b) + gcmExpected := []string{"NonceSize", "Open", "Overhead", "Seal"} + if got := exportedMethods(gcm); !reflect.DeepEqual(got, gcmExpected) { + t.Errorf("GCM: got %v, want %v", got, gcmExpected) + } +} + +func exportedMethods(x any) []string { + var methods []string + v := reflect.ValueOf(x) + for i := 0; i < v.NumMethod(); i++ { + if v.Type().Method(i).IsExported() { + methods = append(methods, v.Type().Method(i).Name) + } + } + return methods +} diff --git a/go/src/crypto/cipher/ofb.go b/go/src/crypto/cipher/ofb.go new file mode 100644 index 0000000000000000000000000000000000000000..ee5dfaf5c0dd62c068afaedb365c791a4dbdacf7 --- /dev/null +++ b/go/src/crypto/cipher/ofb.go @@ -0,0 +1,88 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// OFB (Output Feedback) Mode. + +package cipher + +import ( + "crypto/internal/fips140/alias" + "crypto/internal/fips140only" + "crypto/subtle" +) + +type ofb struct { + b Block + cipher []byte + out []byte + outUsed int +} + +// NewOFB returns a [Stream] that encrypts or decrypts using the block cipher b +// in output feedback mode. The initialization vector iv's length must be equal +// to b's block size. +// +// Deprecated: OFB mode is not authenticated, which generally enables active +// attacks to manipulate and recover the plaintext. It is recommended that +// applications use [AEAD] modes instead. The standard library implementation of +// OFB is also unoptimized and not validated as part of the FIPS 140-3 module. +// If an unauthenticated [Stream] mode is required, use [NewCTR] instead. +func NewOFB(b Block, iv []byte) Stream { + if fips140only.Enforced() { + panic("crypto/cipher: use of OFB is not allowed in FIPS 140-only mode") + } + + blockSize := b.BlockSize() + if len(iv) != blockSize { + panic("cipher.NewOFB: IV length must equal block size") + } + bufSize := streamBufferSize + if bufSize < blockSize { + bufSize = blockSize + } + x := &ofb{ + b: b, + cipher: make([]byte, blockSize), + out: make([]byte, 0, bufSize), + outUsed: 0, + } + + copy(x.cipher, iv) + return x +} + +func (x *ofb) refill() { + bs := x.b.BlockSize() + remain := len(x.out) - x.outUsed + if remain > x.outUsed { + return + } + copy(x.out, x.out[x.outUsed:]) + x.out = x.out[:cap(x.out)] + for remain < len(x.out)-bs { + x.b.Encrypt(x.cipher, x.cipher) + copy(x.out[remain:], x.cipher) + remain += bs + } + x.out = x.out[:remain] + x.outUsed = 0 +} + +func (x *ofb) XORKeyStream(dst, src []byte) { + if len(dst) < len(src) { + panic("crypto/cipher: output smaller than input") + } + if alias.InexactOverlap(dst[:len(src)], src) { + panic("crypto/cipher: invalid buffer overlap") + } + for len(src) > 0 { + if x.outUsed >= len(x.out)-x.b.BlockSize() { + x.refill() + } + n := subtle.XORBytes(dst, src, x.out[x.outUsed:]) + dst = dst[n:] + src = src[n:] + x.outUsed += n + } +} diff --git a/go/src/crypto/cipher/ofb_test.go b/go/src/crypto/cipher/ofb_test.go new file mode 100644 index 0000000000000000000000000000000000000000..036b76c45c620ac12707e0450ccd621af409d77e --- /dev/null +++ b/go/src/crypto/cipher/ofb_test.go @@ -0,0 +1,139 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// OFB AES test vectors. + +// See U.S. National Institute of Standards and Technology (NIST) +// Special Publication 800-38A, ``Recommendation for Block Cipher +// Modes of Operation,'' 2001 Edition, pp. 52-55. + +package cipher_test + +import ( + "bytes" + "crypto/aes" + "crypto/cipher" + "crypto/des" + "crypto/internal/cryptotest" + "fmt" + "testing" +) + +type ofbTest struct { + name string + key []byte + iv []byte + in []byte + out []byte +} + +var ofbTests = []ofbTest{ + // NIST SP 800-38A pp 52-55 + { + "OFB-AES128", + commonKey128, + commonIV, + commonInput, + []byte{ + 0x3b, 0x3f, 0xd9, 0x2e, 0xb7, 0x2d, 0xad, 0x20, 0x33, 0x34, 0x49, 0xf8, 0xe8, 0x3c, 0xfb, 0x4a, + 0x77, 0x89, 0x50, 0x8d, 0x16, 0x91, 0x8f, 0x03, 0xf5, 0x3c, 0x52, 0xda, 0xc5, 0x4e, 0xd8, 0x25, + 0x97, 0x40, 0x05, 0x1e, 0x9c, 0x5f, 0xec, 0xf6, 0x43, 0x44, 0xf7, 0xa8, 0x22, 0x60, 0xed, 0xcc, + 0x30, 0x4c, 0x65, 0x28, 0xf6, 0x59, 0xc7, 0x78, 0x66, 0xa5, 0x10, 0xd9, 0xc1, 0xd6, 0xae, 0x5e, + }, + }, + { + "OFB-AES192", + commonKey192, + commonIV, + commonInput, + []byte{ + 0xcd, 0xc8, 0x0d, 0x6f, 0xdd, 0xf1, 0x8c, 0xab, 0x34, 0xc2, 0x59, 0x09, 0xc9, 0x9a, 0x41, 0x74, + 0xfc, 0xc2, 0x8b, 0x8d, 0x4c, 0x63, 0x83, 0x7c, 0x09, 0xe8, 0x17, 0x00, 0xc1, 0x10, 0x04, 0x01, + 0x8d, 0x9a, 0x9a, 0xea, 0xc0, 0xf6, 0x59, 0x6f, 0x55, 0x9c, 0x6d, 0x4d, 0xaf, 0x59, 0xa5, 0xf2, + 0x6d, 0x9f, 0x20, 0x08, 0x57, 0xca, 0x6c, 0x3e, 0x9c, 0xac, 0x52, 0x4b, 0xd9, 0xac, 0xc9, 0x2a, + }, + }, + { + "OFB-AES256", + commonKey256, + commonIV, + commonInput, + []byte{ + 0xdc, 0x7e, 0x84, 0xbf, 0xda, 0x79, 0x16, 0x4b, 0x7e, 0xcd, 0x84, 0x86, 0x98, 0x5d, 0x38, 0x60, + 0x4f, 0xeb, 0xdc, 0x67, 0x40, 0xd2, 0x0b, 0x3a, 0xc8, 0x8f, 0x6a, 0xd8, 0x2a, 0x4f, 0xb0, 0x8d, + 0x71, 0xab, 0x47, 0xa0, 0x86, 0xe8, 0x6e, 0xed, 0xf3, 0x9d, 0x1c, 0x5b, 0xba, 0x97, 0xc4, 0x08, + 0x01, 0x26, 0x14, 0x1d, 0x67, 0xf3, 0x7b, 0xe8, 0x53, 0x8f, 0x5a, 0x8b, 0xe7, 0x40, 0xe4, 0x84, + }, + }, +} + +func TestOFB(t *testing.T) { + for _, tt := range ofbTests { + test := tt.name + + c, err := aes.NewCipher(tt.key) + if err != nil { + t.Errorf("%s: NewCipher(%d bytes) = %s", test, len(tt.key), err) + continue + } + + for j := 0; j <= 5; j += 5 { + plaintext := tt.in[0 : len(tt.in)-j] + ofb := cipher.NewOFB(c, tt.iv) + ciphertext := make([]byte, len(plaintext)) + ofb.XORKeyStream(ciphertext, plaintext) + if !bytes.Equal(ciphertext, tt.out[:len(plaintext)]) { + t.Errorf("%s/%d: encrypting\ninput % x\nhave % x\nwant % x", test, len(plaintext), plaintext, ciphertext, tt.out) + } + } + + for j := 0; j <= 5; j += 5 { + ciphertext := tt.out[0 : len(tt.in)-j] + ofb := cipher.NewOFB(c, tt.iv) + plaintext := make([]byte, len(ciphertext)) + ofb.XORKeyStream(plaintext, ciphertext) + if !bytes.Equal(plaintext, tt.in[:len(ciphertext)]) { + t.Errorf("%s/%d: decrypting\nhave % x\nwant % x", test, len(ciphertext), plaintext, tt.in) + } + } + + if t.Failed() { + break + } + } +} + +func TestOFBStream(t *testing.T) { + + for _, keylen := range []int{128, 192, 256} { + + t.Run(fmt.Sprintf("AES-%d", keylen), func(t *testing.T) { + rng := newRandReader(t) + + key := make([]byte, keylen/8) + rng.Read(key) + + block, err := aes.NewCipher(key) + if err != nil { + panic(err) + } + + cryptotest.TestStreamFromBlock(t, block, cipher.NewOFB) + }) + } + + t.Run("DES", func(t *testing.T) { + rng := newRandReader(t) + + key := make([]byte, 8) + rng.Read(key) + + block, err := des.NewCipher(key) + if err != nil { + panic(err) + } + + cryptotest.TestStreamFromBlock(t, block, cipher.NewOFB) + }) +} diff --git a/go/src/crypto/des/block.go b/go/src/crypto/des/block.go new file mode 100644 index 0000000000000000000000000000000000000000..1a29eff73bbe7825fd888f8574a24df65aaa1748 --- /dev/null +++ b/go/src/crypto/des/block.go @@ -0,0 +1,249 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package des + +import ( + "internal/byteorder" + "sync" +) + +func cryptBlock(subkeys []uint64, dst, src []byte, decrypt bool) { + b := byteorder.BEUint64(src) + b = permuteInitialBlock(b) + left, right := uint32(b>>32), uint32(b) + + left = (left << 1) | (left >> 31) + right = (right << 1) | (right >> 31) + + if decrypt { + for i := 0; i < 8; i++ { + left, right = feistel(left, right, subkeys[15-2*i], subkeys[15-(2*i+1)]) + } + } else { + for i := 0; i < 8; i++ { + left, right = feistel(left, right, subkeys[2*i], subkeys[2*i+1]) + } + } + + left = (left << 31) | (left >> 1) + right = (right << 31) | (right >> 1) + + // switch left & right and perform final permutation + preOutput := (uint64(right) << 32) | uint64(left) + byteorder.BEPutUint64(dst, permuteFinalBlock(preOutput)) +} + +// DES Feistel function. feistelBox must be initialized via +// feistelBoxOnce.Do(initFeistelBox) first. +func feistel(l, r uint32, k0, k1 uint64) (lout, rout uint32) { + var t uint32 + + t = r ^ uint32(k0>>32) + l ^= feistelBox[7][t&0x3f] ^ + feistelBox[5][(t>>8)&0x3f] ^ + feistelBox[3][(t>>16)&0x3f] ^ + feistelBox[1][(t>>24)&0x3f] + + t = ((r << 28) | (r >> 4)) ^ uint32(k0) + l ^= feistelBox[6][(t)&0x3f] ^ + feistelBox[4][(t>>8)&0x3f] ^ + feistelBox[2][(t>>16)&0x3f] ^ + feistelBox[0][(t>>24)&0x3f] + + t = l ^ uint32(k1>>32) + r ^= feistelBox[7][t&0x3f] ^ + feistelBox[5][(t>>8)&0x3f] ^ + feistelBox[3][(t>>16)&0x3f] ^ + feistelBox[1][(t>>24)&0x3f] + + t = ((l << 28) | (l >> 4)) ^ uint32(k1) + r ^= feistelBox[6][(t)&0x3f] ^ + feistelBox[4][(t>>8)&0x3f] ^ + feistelBox[2][(t>>16)&0x3f] ^ + feistelBox[0][(t>>24)&0x3f] + + return l, r +} + +// feistelBox[s][16*i+j] contains the output of permutationFunction +// for sBoxes[s][i][j] << 4*(7-s) +var feistelBox [8][64]uint32 + +var feistelBoxOnce sync.Once + +// general purpose function to perform DES block permutations. +func permuteBlock(src uint64, permutation []uint8) (block uint64) { + for position, n := range permutation { + bit := (src >> n) & 1 + block |= bit << uint((len(permutation)-1)-position) + } + return +} + +func initFeistelBox() { + for s := range sBoxes { + for i := 0; i < 4; i++ { + for j := 0; j < 16; j++ { + f := uint64(sBoxes[s][i][j]) << (4 * (7 - uint(s))) + f = permuteBlock(f, permutationFunction[:]) + + // Row is determined by the 1st and 6th bit. + // Column is the middle four bits. + row := uint8(((i & 2) << 4) | i&1) + col := uint8(j << 1) + t := row | col + + // The rotation was performed in the feistel rounds, being factored out and now mixed into the feistelBox. + f = (f << 1) | (f >> 31) + + feistelBox[s][t] = uint32(f) + } + } + } +} + +// permuteInitialBlock is equivalent to the permutation defined +// by initialPermutation. +func permuteInitialBlock(block uint64) uint64 { + // block = b7 b6 b5 b4 b3 b2 b1 b0 (8 bytes) + b1 := block >> 48 + b2 := block << 48 + block ^= b1 ^ b2 ^ b1<<48 ^ b2>>48 + + // block = b1 b0 b5 b4 b3 b2 b7 b6 + b1 = block >> 32 & 0xff00ff + b2 = (block & 0xff00ff00) + block ^= b1<<32 ^ b2 ^ b1<<8 ^ b2<<24 // exchange b0 b4 with b3 b7 + + // block is now b1 b3 b5 b7 b0 b2 b4 b6, the permutation: + // ... 8 + // ... 24 + // ... 40 + // ... 56 + // 7 6 5 4 3 2 1 0 + // 23 22 21 20 19 18 17 16 + // ... 32 + // ... 48 + + // exchange 4,5,6,7 with 32,33,34,35 etc. + b1 = block & 0x0f0f00000f0f0000 + b2 = block & 0x0000f0f00000f0f0 + block ^= b1 ^ b2 ^ b1>>12 ^ b2<<12 + + // block is the permutation: + // + // [+8] [+40] + // + // 7 6 5 4 + // 23 22 21 20 + // 3 2 1 0 + // 19 18 17 16 [+32] + + // exchange 0,1,4,5 with 18,19,22,23 + b1 = block & 0x3300330033003300 + b2 = block & 0x00cc00cc00cc00cc + block ^= b1 ^ b2 ^ b1>>6 ^ b2<<6 + + // block is the permutation: + // 15 14 + // 13 12 + // 11 10 + // 9 8 + // 7 6 + // 5 4 + // 3 2 + // 1 0 [+16] [+32] [+64] + + // exchange 0,2,4,6 with 9,11,13,15: + b1 = block & 0xaaaaaaaa55555555 + block ^= b1 ^ b1>>33 ^ b1<<33 + + // block is the permutation: + // 6 14 22 30 38 46 54 62 + // 4 12 20 28 36 44 52 60 + // 2 10 18 26 34 42 50 58 + // 0 8 16 24 32 40 48 56 + // 7 15 23 31 39 47 55 63 + // 5 13 21 29 37 45 53 61 + // 3 11 19 27 35 43 51 59 + // 1 9 17 25 33 41 49 57 + return block +} + +// permuteFinalBlock is equivalent to the permutation defined +// by finalPermutation. +func permuteFinalBlock(block uint64) uint64 { + // Perform the same bit exchanges as permuteInitialBlock + // but in reverse order. + b1 := block & 0xaaaaaaaa55555555 + block ^= b1 ^ b1>>33 ^ b1<<33 + + b1 = block & 0x3300330033003300 + b2 := block & 0x00cc00cc00cc00cc + block ^= b1 ^ b2 ^ b1>>6 ^ b2<<6 + + b1 = block & 0x0f0f00000f0f0000 + b2 = block & 0x0000f0f00000f0f0 + block ^= b1 ^ b2 ^ b1>>12 ^ b2<<12 + + b1 = block >> 32 & 0xff00ff + b2 = (block & 0xff00ff00) + block ^= b1<<32 ^ b2 ^ b1<<8 ^ b2<<24 + + b1 = block >> 48 + b2 = block << 48 + block ^= b1 ^ b2 ^ b1<<48 ^ b2>>48 + return block +} + +// creates 16 28-bit blocks rotated according +// to the rotation schedule. +func ksRotate(in uint32) (out []uint32) { + out = make([]uint32, 16) + last := in + for i := 0; i < 16; i++ { + // 28-bit circular left shift + left := (last << (4 + ksRotations[i])) >> 4 + right := (last << 4) >> (32 - ksRotations[i]) + out[i] = left | right + last = out[i] + } + return +} + +// creates 16 56-bit subkeys from the original key. +func (c *desCipher) generateSubkeys(keyBytes []byte) { + feistelBoxOnce.Do(initFeistelBox) + + // apply PC1 permutation to key + key := byteorder.BEUint64(keyBytes) + permutedKey := permuteBlock(key, permutedChoice1[:]) + + // rotate halves of permuted key according to the rotation schedule + leftRotations := ksRotate(uint32(permutedKey >> 28)) + rightRotations := ksRotate(uint32(permutedKey<<4) >> 4) + + // generate subkeys + for i := 0; i < 16; i++ { + // combine halves to form 56-bit input to PC2 + pc2Input := uint64(leftRotations[i])<<28 | uint64(rightRotations[i]) + // apply PC2 permutation to 7 byte input + c.subkeys[i] = unpack(permuteBlock(pc2Input, permutedChoice2[:])) + } +} + +// Expand 48-bit input to 64-bit, with each 6-bit block padded by extra two bits at the top. +// By doing so, we can have the input blocks (four bits each), and the key blocks (six bits each) well-aligned without +// extra shifts/rotations for alignments. +func unpack(x uint64) uint64 { + return ((x>>(6*1))&0xff)<<(8*0) | + ((x>>(6*3))&0xff)<<(8*1) | + ((x>>(6*5))&0xff)<<(8*2) | + ((x>>(6*7))&0xff)<<(8*3) | + ((x>>(6*0))&0xff)<<(8*4) | + ((x>>(6*2))&0xff)<<(8*5) | + ((x>>(6*4))&0xff)<<(8*6) | + ((x>>(6*6))&0xff)<<(8*7) +} diff --git a/go/src/crypto/des/cipher.go b/go/src/crypto/des/cipher.go new file mode 100644 index 0000000000000000000000000000000000000000..81ba766b2527d21c645517b9e541901acfe6bade --- /dev/null +++ b/go/src/crypto/des/cipher.go @@ -0,0 +1,165 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package des + +import ( + "crypto/cipher" + "crypto/internal/fips140/alias" + "crypto/internal/fips140only" + "errors" + "internal/byteorder" + "strconv" +) + +// The DES block size in bytes. +const BlockSize = 8 + +type KeySizeError int + +func (k KeySizeError) Error() string { + return "crypto/des: invalid key size " + strconv.Itoa(int(k)) +} + +// desCipher is an instance of DES encryption. +type desCipher struct { + subkeys [16]uint64 +} + +// NewCipher creates and returns a new [cipher.Block]. +func NewCipher(key []byte) (cipher.Block, error) { + if fips140only.Enforced() { + return nil, errors.New("crypto/des: use of DES is not allowed in FIPS 140-only mode") + } + + if len(key) != 8 { + return nil, KeySizeError(len(key)) + } + + c := new(desCipher) + c.generateSubkeys(key) + return c, nil +} + +func (c *desCipher) BlockSize() int { return BlockSize } + +func (c *desCipher) Encrypt(dst, src []byte) { + if len(src) < BlockSize { + panic("crypto/des: input not full block") + } + if len(dst) < BlockSize { + panic("crypto/des: output not full block") + } + if alias.InexactOverlap(dst[:BlockSize], src[:BlockSize]) { + panic("crypto/des: invalid buffer overlap") + } + cryptBlock(c.subkeys[:], dst, src, false) +} + +func (c *desCipher) Decrypt(dst, src []byte) { + if len(src) < BlockSize { + panic("crypto/des: input not full block") + } + if len(dst) < BlockSize { + panic("crypto/des: output not full block") + } + if alias.InexactOverlap(dst[:BlockSize], src[:BlockSize]) { + panic("crypto/des: invalid buffer overlap") + } + cryptBlock(c.subkeys[:], dst, src, true) +} + +// A tripleDESCipher is an instance of TripleDES encryption. +type tripleDESCipher struct { + cipher1, cipher2, cipher3 desCipher +} + +// NewTripleDESCipher creates and returns a new [cipher.Block]. +func NewTripleDESCipher(key []byte) (cipher.Block, error) { + if fips140only.Enforced() { + return nil, errors.New("crypto/des: use of TripleDES is not allowed in FIPS 140-only mode") + } + + if len(key) != 24 { + return nil, KeySizeError(len(key)) + } + + c := new(tripleDESCipher) + c.cipher1.generateSubkeys(key[:8]) + c.cipher2.generateSubkeys(key[8:16]) + c.cipher3.generateSubkeys(key[16:]) + return c, nil +} + +func (c *tripleDESCipher) BlockSize() int { return BlockSize } + +func (c *tripleDESCipher) Encrypt(dst, src []byte) { + if len(src) < BlockSize { + panic("crypto/des: input not full block") + } + if len(dst) < BlockSize { + panic("crypto/des: output not full block") + } + if alias.InexactOverlap(dst[:BlockSize], src[:BlockSize]) { + panic("crypto/des: invalid buffer overlap") + } + + b := byteorder.BEUint64(src) + b = permuteInitialBlock(b) + left, right := uint32(b>>32), uint32(b) + + left = (left << 1) | (left >> 31) + right = (right << 1) | (right >> 31) + + for i := 0; i < 8; i++ { + left, right = feistel(left, right, c.cipher1.subkeys[2*i], c.cipher1.subkeys[2*i+1]) + } + for i := 0; i < 8; i++ { + right, left = feistel(right, left, c.cipher2.subkeys[15-2*i], c.cipher2.subkeys[15-(2*i+1)]) + } + for i := 0; i < 8; i++ { + left, right = feistel(left, right, c.cipher3.subkeys[2*i], c.cipher3.subkeys[2*i+1]) + } + + left = (left << 31) | (left >> 1) + right = (right << 31) | (right >> 1) + + preOutput := (uint64(right) << 32) | uint64(left) + byteorder.BEPutUint64(dst, permuteFinalBlock(preOutput)) +} + +func (c *tripleDESCipher) Decrypt(dst, src []byte) { + if len(src) < BlockSize { + panic("crypto/des: input not full block") + } + if len(dst) < BlockSize { + panic("crypto/des: output not full block") + } + if alias.InexactOverlap(dst[:BlockSize], src[:BlockSize]) { + panic("crypto/des: invalid buffer overlap") + } + + b := byteorder.BEUint64(src) + b = permuteInitialBlock(b) + left, right := uint32(b>>32), uint32(b) + + left = (left << 1) | (left >> 31) + right = (right << 1) | (right >> 31) + + for i := 0; i < 8; i++ { + left, right = feistel(left, right, c.cipher3.subkeys[15-2*i], c.cipher3.subkeys[15-(2*i+1)]) + } + for i := 0; i < 8; i++ { + right, left = feistel(right, left, c.cipher2.subkeys[2*i], c.cipher2.subkeys[2*i+1]) + } + for i := 0; i < 8; i++ { + left, right = feistel(left, right, c.cipher1.subkeys[15-2*i], c.cipher1.subkeys[15-(2*i+1)]) + } + + left = (left << 31) | (left >> 1) + right = (right << 31) | (right >> 1) + + preOutput := (uint64(right) << 32) | uint64(left) + byteorder.BEPutUint64(dst, permuteFinalBlock(preOutput)) +} diff --git a/go/src/crypto/des/const.go b/go/src/crypto/des/const.go new file mode 100644 index 0000000000000000000000000000000000000000..a20879d57412da256a0bc737a484ba7488ee498a --- /dev/null +++ b/go/src/crypto/des/const.go @@ -0,0 +1,142 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package des implements the Data Encryption Standard (DES) and the +// Triple Data Encryption Algorithm (TDEA) as defined +// in U.S. Federal Information Processing Standards Publication 46-3. +// +// DES is cryptographically broken and should not be used for secure +// applications. +package des + +// Used to perform an initial permutation of a 64-bit input block. +var initialPermutation = [64]byte{ + 6, 14, 22, 30, 38, 46, 54, 62, + 4, 12, 20, 28, 36, 44, 52, 60, + 2, 10, 18, 26, 34, 42, 50, 58, + 0, 8, 16, 24, 32, 40, 48, 56, + 7, 15, 23, 31, 39, 47, 55, 63, + 5, 13, 21, 29, 37, 45, 53, 61, + 3, 11, 19, 27, 35, 43, 51, 59, + 1, 9, 17, 25, 33, 41, 49, 57, +} + +// Used to perform a final permutation of a 4-bit preoutput block. This is the +// inverse of initialPermutation +var finalPermutation = [64]byte{ + 24, 56, 16, 48, 8, 40, 0, 32, + 25, 57, 17, 49, 9, 41, 1, 33, + 26, 58, 18, 50, 10, 42, 2, 34, + 27, 59, 19, 51, 11, 43, 3, 35, + 28, 60, 20, 52, 12, 44, 4, 36, + 29, 61, 21, 53, 13, 45, 5, 37, + 30, 62, 22, 54, 14, 46, 6, 38, + 31, 63, 23, 55, 15, 47, 7, 39, +} + +// Used to expand an input block of 32 bits, producing an output block of 48 +// bits. +var expansionFunction = [48]byte{ + 0, 31, 30, 29, 28, 27, 28, 27, + 26, 25, 24, 23, 24, 23, 22, 21, + 20, 19, 20, 19, 18, 17, 16, 15, + 16, 15, 14, 13, 12, 11, 12, 11, + 10, 9, 8, 7, 8, 7, 6, 5, + 4, 3, 4, 3, 2, 1, 0, 31, +} + +// Yields a 32-bit output from a 32-bit input +var permutationFunction = [32]byte{ + 16, 25, 12, 11, 3, 20, 4, 15, + 31, 17, 9, 6, 27, 14, 1, 22, + 30, 24, 8, 18, 0, 5, 29, 23, + 13, 19, 2, 26, 10, 21, 28, 7, +} + +// Used in the key schedule to select 56 bits +// from a 64-bit input. +var permutedChoice1 = [56]byte{ + 7, 15, 23, 31, 39, 47, 55, 63, + 6, 14, 22, 30, 38, 46, 54, 62, + 5, 13, 21, 29, 37, 45, 53, 61, + 4, 12, 20, 28, 1, 9, 17, 25, + 33, 41, 49, 57, 2, 10, 18, 26, + 34, 42, 50, 58, 3, 11, 19, 27, + 35, 43, 51, 59, 36, 44, 52, 60, +} + +// Used in the key schedule to produce each subkey by selecting 48 bits from +// the 56-bit input +var permutedChoice2 = [48]byte{ + 42, 39, 45, 32, 55, 51, 53, 28, + 41, 50, 35, 46, 33, 37, 44, 52, + 30, 48, 40, 49, 29, 36, 43, 54, + 15, 4, 25, 19, 9, 1, 26, 16, + 5, 11, 23, 8, 12, 7, 17, 0, + 22, 3, 10, 14, 6, 20, 27, 24, +} + +// 8 S-boxes composed of 4 rows and 16 columns +// Used in the DES cipher function +var sBoxes = [8][4][16]uint8{ + // S-box 1 + { + {14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7}, + {0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8}, + {4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0}, + {15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13}, + }, + // S-box 2 + { + {15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10}, + {3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5}, + {0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15}, + {13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9}, + }, + // S-box 3 + { + {10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8}, + {13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1}, + {13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7}, + {1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12}, + }, + // S-box 4 + { + {7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15}, + {13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9}, + {10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4}, + {3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14}, + }, + // S-box 5 + { + {2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9}, + {14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6}, + {4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14}, + {11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3}, + }, + // S-box 6 + { + {12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11}, + {10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8}, + {9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6}, + {4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13}, + }, + // S-box 7 + { + {4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1}, + {13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6}, + {1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2}, + {6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12}, + }, + // S-box 8 + { + {13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7}, + {1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2}, + {7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8}, + {2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11}, + }, +} + +// Size of left rotation per round in each half of the key schedule +var ksRotations = [16]uint8{1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1} diff --git a/go/src/crypto/des/des_test.go b/go/src/crypto/des/des_test.go new file mode 100644 index 0000000000000000000000000000000000000000..e72b4b15c71b17ea77b2d9211ce4b0826f681a9d --- /dev/null +++ b/go/src/crypto/des/des_test.go @@ -0,0 +1,1575 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package des_test + +import ( + "bytes" + "crypto/cipher" + "crypto/des" + "crypto/internal/cryptotest" + "testing" +) + +type CryptTest struct { + key []byte + in []byte + out []byte +} + +// some custom tests for DES +var encryptDESTests = []CryptTest{ + { + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0x8c, 0xa6, 0x4d, 0xe9, 0xc1, 0xb1, 0x23, 0xa7}}, + { + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + []byte{0x35, 0x55, 0x50, 0xb2, 0x15, 0x0e, 0x24, 0x51}}, + { + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, + []byte{0x61, 0x7b, 0x3a, 0x0c, 0xe8, 0xf0, 0x71, 0x00}}, + { + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, + []byte{0x92, 0x31, 0xf2, 0x36, 0xff, 0x9a, 0xa9, 0x5c}}, + { + []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0xca, 0xaa, 0xaf, 0x4d, 0xea, 0xf1, 0xdb, 0xae}}, + { + []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + []byte{0x73, 0x59, 0xb2, 0x16, 0x3e, 0x4e, 0xdc, 0x58}}, + { + []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, + []byte{0x6d, 0xce, 0x0d, 0xc9, 0x00, 0x65, 0x56, 0xa3}}, + { + []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + []byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, + []byte{0x9e, 0x84, 0xc5, 0xf3, 0x17, 0x0f, 0x8e, 0xff}}, + { + []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0xd5, 0xd4, 0x4f, 0xf7, 0x20, 0x68, 0x3d, 0x0d}}, + { + []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, + []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + []byte{0x59, 0x73, 0x23, 0x56, 0xf3, 0x6f, 0xde, 0x06}}, + { + []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, + []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, + []byte{0x56, 0xcc, 0x09, 0xe7, 0xcf, 0xdc, 0x4c, 0xef}}, + { + []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, + []byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, + []byte{0x12, 0xc6, 0x26, 0xaf, 0x05, 0x8b, 0x43, 0x3b}}, + { + []byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0xa6, 0x8c, 0xdc, 0xa9, 0x0c, 0x90, 0x21, 0xf9}}, + { + []byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, + []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + []byte{0x2a, 0x2b, 0xb0, 0x08, 0xdf, 0x97, 0xc2, 0xf2}}, + { + []byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, + []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, + []byte{0xed, 0x39, 0xd9, 0x50, 0xfa, 0x74, 0xbc, 0xc4}}, + { + []byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, + []byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, + []byte{0xa9, 0x33, 0xf6, 0x18, 0x30, 0x23, 0xb3, 0x10}}, + { + []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, + []byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}, + []byte{0x17, 0x66, 0x8d, 0xfc, 0x72, 0x92, 0x53, 0x2d}}, + { + []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, + []byte{0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, + []byte{0xb4, 0xfd, 0x23, 0x16, 0x47, 0xa5, 0xbe, 0xc0}}, + { + []byte{0x0e, 0x32, 0x92, 0x32, 0xea, 0x6d, 0x0d, 0x73}, + []byte{0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87}, + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, + { + []byte{0x73, 0x65, 0x63, 0x52, 0x33, 0x74, 0x24, 0x3b}, // "secR3t$;" + []byte{0x61, 0x20, 0x74, 0x65, 0x73, 0x74, 0x31, 0x32}, // "a test12" + []byte{0x37, 0x0d, 0xee, 0x2c, 0x1f, 0xb4, 0xf7, 0xa5}}, + { + []byte{0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68}, // "abcdefgh" + []byte{0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68}, // "abcdefgh" + []byte{0x2a, 0x8d, 0x69, 0xde, 0x9d, 0x5f, 0xdf, 0xf9}}, + { + []byte{0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68}, // "abcdefgh" + []byte{0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38}, // "12345678" + []byte{0x21, 0xc6, 0x0d, 0xa5, 0x34, 0x24, 0x8b, 0xce}}, + { + []byte{0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38}, // "12345678" + []byte{0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68}, // "abcdefgh" + []byte{0x94, 0xd4, 0x43, 0x6b, 0xc3, 0xb5, 0xb6, 0x93}}, + { + []byte{0x1f, 0x79, 0x90, 0x5f, 0x88, 0x01, 0xc8, 0x88}, // random + []byte{0xc7, 0x46, 0x18, 0x73, 0xaf, 0x48, 0x5f, 0xb3}, // random + []byte{0xb0, 0x93, 0x50, 0x88, 0xf9, 0x92, 0x44, 0x6a}}, + { + []byte{0xe6, 0xf4, 0xf2, 0xdb, 0x31, 0x42, 0x53, 0x01}, // random + []byte{0xff, 0x3d, 0x25, 0x50, 0x12, 0xe3, 0x4a, 0xc5}, // random + []byte{0x86, 0x08, 0xd3, 0xd1, 0x6c, 0x2f, 0xd2, 0x55}}, + { + []byte{0x69, 0xc1, 0x9d, 0xc1, 0x15, 0xc5, 0xfb, 0x2b}, // random + []byte{0x1a, 0x22, 0x5c, 0xaf, 0x1f, 0x1d, 0xa3, 0xf9}, // random + []byte{0x64, 0xba, 0x31, 0x67, 0x56, 0x91, 0x1e, 0xa7}}, + { + []byte{0x6e, 0x5e, 0xe2, 0x47, 0xc4, 0xbf, 0xf6, 0x51}, // random + []byte{0x11, 0xc9, 0x57, 0xff, 0x66, 0x89, 0x0e, 0xf0}, // random + []byte{0x94, 0xc5, 0x35, 0xb2, 0xc5, 0x8b, 0x39, 0x72}}, +} + +var weakKeyTests = []CryptTest{ + { + []byte{0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, + []byte{0x55, 0x74, 0xc0, 0xbd, 0x7c, 0xdf, 0xf7, 0x39}, // random + nil}, + { + []byte{0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe}, + []byte{0xe8, 0xe1, 0xa7, 0xc1, 0xde, 0x11, 0x89, 0xaa}, // random + nil}, + { + []byte{0xe0, 0xe0, 0xe0, 0xe0, 0xf1, 0xf1, 0xf1, 0xf1}, + []byte{0x50, 0x6a, 0x4b, 0x94, 0x3b, 0xed, 0x7d, 0xdc}, // random + nil}, + { + []byte{0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e}, + []byte{0x88, 0x81, 0x56, 0x38, 0xec, 0x3b, 0x1c, 0x97}, // random + nil}, + { + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0x17, 0xa0, 0x83, 0x62, 0x32, 0xfe, 0x9a, 0x0b}, // random + nil}, + { + []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + []byte{0xca, 0x8f, 0xca, 0x1f, 0x50, 0xc5, 0x7b, 0x49}, // random + nil}, + { + []byte{0xe1, 0xe1, 0xe1, 0xe1, 0xf0, 0xf0, 0xf0, 0xf0}, + []byte{0xb1, 0xea, 0xad, 0x7d, 0xe7, 0xc3, 0x7a, 0x43}, // random + nil}, + { + []byte{0x1e, 0x1e, 0x1e, 0x1e, 0x0f, 0x0f, 0x0f, 0x0f}, + []byte{0xae, 0x74, 0x7d, 0x6f, 0xef, 0x16, 0xbb, 0x81}, // random + nil}, +} + +var semiWeakKeyTests = []CryptTest{ + // key and out contain the semi-weak key pair + { + []byte{0x01, 0x1f, 0x01, 0x1f, 0x01, 0x0e, 0x01, 0x0e}, + []byte{0x12, 0xfa, 0x31, 0x16, 0xf9, 0xc5, 0x0a, 0xe4}, // random + []byte{0x1f, 0x01, 0x1f, 0x01, 0x0e, 0x01, 0x0e, 0x01}}, + { + []byte{0x01, 0xe0, 0x01, 0xe0, 0x01, 0xf1, 0x01, 0xf1}, + []byte{0xb0, 0x4c, 0x7a, 0xee, 0xd2, 0xe5, 0x4d, 0xb7}, // random + []byte{0xe0, 0x01, 0xe0, 0x01, 0xf1, 0x01, 0xf1, 0x01}}, + { + []byte{0x01, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0xfe}, + []byte{0xa4, 0x81, 0xcd, 0xb1, 0x64, 0x6f, 0xd3, 0xbc}, // random + []byte{0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01}}, + { + []byte{0x1f, 0xe0, 0x1f, 0xe0, 0x0e, 0xf1, 0x0e, 0xf1}, + []byte{0xee, 0x27, 0xdd, 0x88, 0x4c, 0x22, 0xcd, 0xce}, // random + []byte{0xe0, 0x1f, 0xe0, 0x1f, 0xf1, 0x0e, 0xf1, 0x0e}}, + { + []byte{0x1f, 0xfe, 0x1f, 0xfe, 0x0e, 0xfe, 0x0e, 0xfe}, + []byte{0x19, 0x3d, 0xcf, 0x97, 0x70, 0xfb, 0xab, 0xe1}, // random + []byte{0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x0e, 0xfe, 0x0e}}, + { + []byte{0xe0, 0xfe, 0xe0, 0xfe, 0xf1, 0xfe, 0xf1, 0xfe}, + []byte{0x7c, 0x82, 0x69, 0xe4, 0x1e, 0x86, 0x99, 0xd7}, // random + []byte{0xfe, 0xe0, 0xfe, 0xe0, 0xfe, 0xf1, 0xfe, 0xf1}}, +} + +// some custom tests for TripleDES +var encryptTripleDESTests = []CryptTest{ + { + []byte{ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0x92, 0x95, 0xb5, 0x9b, 0xb3, 0x84, 0x73, 0x6e}}, + { + []byte{ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + []byte{0xc1, 0x97, 0xf5, 0x58, 0x74, 0x8a, 0x20, 0xe7}}, + { + []byte{ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0x3e, 0x68, 0x0a, 0xa7, 0x8b, 0x75, 0xdf, 0x18}}, + { + []byte{ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + []byte{0x6d, 0x6a, 0x4a, 0x64, 0x4c, 0x7b, 0x8c, 0x91}}, + { + []byte{ // "abcdefgh12345678ABCDEFGH" + 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, + 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, + 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48}, + []byte{0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30}, // "00000000" + []byte{0xe4, 0x61, 0xb7, 0x59, 0x68, 0x8b, 0xff, 0x66}}, + { + []byte{ // "abcdefgh12345678ABCDEFGH" + 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, + 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, + 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48}, + []byte{0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38}, // "12345678" + []byte{0xdb, 0xd0, 0x92, 0xde, 0xf8, 0x34, 0xff, 0x58}}, + { + []byte{ // "abcdefgh12345678ABCDEFGH" + 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, + 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, + 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48}, + []byte{0xf0, 0xc5, 0x82, 0x22, 0xd3, 0xe6, 0x12, 0xd2}, // random + []byte{0xba, 0xe4, 0x41, 0xb1, 0x3c, 0x37, 0x4d, 0xf4}}, + { + []byte{ // random + 0xd3, 0x7d, 0x45, 0xee, 0x22, 0xe9, 0xcf, 0x52, + 0xf4, 0x65, 0xa2, 0x4f, 0x70, 0xd1, 0x81, 0x8a, + 0x3d, 0xbe, 0x2f, 0x39, 0xc7, 0x71, 0xd2, 0xe9}, + []byte{0x49, 0x53, 0xc3, 0xe9, 0x78, 0xdf, 0x9f, 0xaf}, // random + []byte{0x53, 0x40, 0x51, 0x24, 0xd8, 0x3c, 0xf9, 0x88}}, + { + []byte{ // random + 0xcb, 0x10, 0x7d, 0xda, 0x7e, 0x96, 0x57, 0x0a, + 0xe8, 0xeb, 0xe8, 0x07, 0x8e, 0x87, 0xd3, 0x57, + 0xb2, 0x61, 0x12, 0xb8, 0x2a, 0x90, 0xb7, 0x2f}, + []byte{0xa3, 0xc2, 0x60, 0xb1, 0x0b, 0xb7, 0x28, 0x6e}, // random + []byte{0x56, 0x73, 0x7d, 0xfb, 0xb5, 0xa1, 0xc3, 0xde}}, +} + +// NIST Special Publication 800-20, Appendix A +// Key for use with Table A.1 tests +var tableA1Key = []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +} + +// Table A.1 Resulting Ciphertext from the Variable Plaintext Known Answer Test +var tableA1Tests = []CryptTest{ + {nil, // 0 + []byte{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0x95, 0xf8, 0xa5, 0xe5, 0xdd, 0x31, 0xd9, 0x00}}, + {nil, // 1 + []byte{0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0xdd, 0x7f, 0x12, 0x1c, 0xa5, 0x01, 0x56, 0x19}}, + {nil, // 2 + []byte{0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0x2e, 0x86, 0x53, 0x10, 0x4f, 0x38, 0x34, 0xea}}, + {nil, // 3 + []byte{0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0x4b, 0xd3, 0x88, 0xff, 0x6c, 0xd8, 0x1d, 0x4f}}, + {nil, // 4 + []byte{0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0x20, 0xb9, 0xe7, 0x67, 0xb2, 0xfb, 0x14, 0x56}}, + {nil, // 5 + []byte{0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0x55, 0x57, 0x93, 0x80, 0xd7, 0x71, 0x38, 0xef}}, + {nil, // 6 + []byte{0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0x6c, 0xc5, 0xde, 0xfa, 0xaf, 0x04, 0x51, 0x2f}}, + {nil, // 7 + []byte{0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0x0d, 0x9f, 0x27, 0x9b, 0xa5, 0xd8, 0x72, 0x60}}, + {nil, // 8 + []byte{0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0xd9, 0x03, 0x1b, 0x02, 0x71, 0xbd, 0x5a, 0x0a}}, + {nil, // 9 + []byte{0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0x42, 0x42, 0x50, 0xb3, 0x7c, 0x3d, 0xd9, 0x51}}, + {nil, // 10 + []byte{0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0xb8, 0x06, 0x1b, 0x7e, 0xcd, 0x9a, 0x21, 0xe5}}, + {nil, // 11 + []byte{0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0xf1, 0x5d, 0x0f, 0x28, 0x6b, 0x65, 0xbd, 0x28}}, + {nil, // 12 + []byte{0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0xad, 0xd0, 0xcc, 0x8d, 0x6e, 0x5d, 0xeb, 0xa1}}, + {nil, // 13 + []byte{0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0xe6, 0xd5, 0xf8, 0x27, 0x52, 0xad, 0x63, 0xd1}}, + {nil, // 14 + []byte{0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0xec, 0xbf, 0xe3, 0xbd, 0x3f, 0x59, 0x1a, 0x5e}}, + {nil, // 15 + []byte{0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0xf3, 0x56, 0x83, 0x43, 0x79, 0xd1, 0x65, 0xcd}}, + {nil, // 16 + []byte{0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0x2b, 0x9f, 0x98, 0x2f, 0x20, 0x03, 0x7f, 0xa9}}, + {nil, // 17 + []byte{0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0x88, 0x9d, 0xe0, 0x68, 0xa1, 0x6f, 0x0b, 0xe6}}, + {nil, // 18 + []byte{0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0xe1, 0x9e, 0x27, 0x5d, 0x84, 0x6a, 0x12, 0x98}}, + {nil, // 19 + []byte{0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0x32, 0x9a, 0x8e, 0xd5, 0x23, 0xd7, 0x1a, 0xec}}, + {nil, // 20 + []byte{0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0xe7, 0xfc, 0xe2, 0x25, 0x57, 0xd2, 0x3c, 0x97}}, + {nil, // 21 + []byte{0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0x12, 0xa9, 0xf5, 0x81, 0x7f, 0xf2, 0xd6, 0x5d}}, + {nil, // 22 + []byte{0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0xa4, 0x84, 0xc3, 0xad, 0x38, 0xdc, 0x9c, 0x19}}, + {nil, // 23 + []byte{0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0xfb, 0xe0, 0x0a, 0x8a, 0x1e, 0xf8, 0xad, 0x72}}, + {nil, // 24 + []byte{0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00}, + []byte{0x75, 0x0d, 0x07, 0x94, 0x07, 0x52, 0x13, 0x63}}, + {nil, // 25 + []byte{0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00}, + []byte{0x64, 0xfe, 0xed, 0x9c, 0x72, 0x4c, 0x2f, 0xaf}}, + {nil, // 26 + []byte{0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00}, + []byte{0xf0, 0x2b, 0x26, 0x3b, 0x32, 0x8e, 0x2b, 0x60}}, + {nil, // 27 + []byte{0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00}, + []byte{0x9d, 0x64, 0x55, 0x5a, 0x9a, 0x10, 0xb8, 0x52}}, + {nil, // 28 + []byte{0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}, + []byte{0xd1, 0x06, 0xff, 0x0b, 0xed, 0x52, 0x55, 0xd7}}, + {nil, // 29 + []byte{0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00}, + []byte{0xe1, 0x65, 0x2c, 0x6b, 0x13, 0x8c, 0x64, 0xa5}}, + {nil, // 30 + []byte{0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00}, + []byte{0xe4, 0x28, 0x58, 0x11, 0x86, 0xec, 0x8f, 0x46}}, + {nil, // 31 + []byte{0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00}, + []byte{0xae, 0xb5, 0xf5, 0xed, 0xe2, 0x2d, 0x1a, 0x36}}, + {nil, // 32 + []byte{0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00}, + []byte{0xe9, 0x43, 0xd7, 0x56, 0x8a, 0xec, 0x0c, 0x5c}}, + {nil, // 33 + []byte{0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00}, + []byte{0xdf, 0x98, 0xc8, 0x27, 0x6f, 0x54, 0xb0, 0x4b}}, + {nil, // 34 + []byte{0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00}, + []byte{0xb1, 0x60, 0xe4, 0x68, 0x0f, 0x6c, 0x69, 0x6f}}, + {nil, // 35 + []byte{0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}, + []byte{0xfa, 0x07, 0x52, 0xb0, 0x7d, 0x9c, 0x4a, 0xb8}}, + {nil, // 36 + []byte{0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00}, + []byte{0xca, 0x3a, 0x2b, 0x03, 0x6d, 0xbc, 0x85, 0x02}}, + {nil, // 37 + []byte{0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00}, + []byte{0x5e, 0x09, 0x05, 0x51, 0x7b, 0xb5, 0x9b, 0xcf}}, + {nil, // 38 + []byte{0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00}, + []byte{0x81, 0x4e, 0xeb, 0x3b, 0x91, 0xd9, 0x07, 0x26}}, + {nil, // 39 + []byte{0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00}, + []byte{0x4d, 0x49, 0xdb, 0x15, 0x32, 0x91, 0x9c, 0x9f}}, + {nil, // 40 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00}, + []byte{0x25, 0xeb, 0x5f, 0xc3, 0xf8, 0xcf, 0x06, 0x21}}, + {nil, // 41 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00}, + []byte{0xab, 0x6a, 0x20, 0xc0, 0x62, 0x0d, 0x1c, 0x6f}}, + {nil, // 42 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00}, + []byte{0x79, 0xe9, 0x0d, 0xbc, 0x98, 0xf9, 0x2c, 0xca}}, + {nil, // 43 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00}, + []byte{0x86, 0x6e, 0xce, 0xdd, 0x80, 0x72, 0xbb, 0x0e}}, + {nil, // 44 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00}, + []byte{0x8b, 0x54, 0x53, 0x6f, 0x2f, 0x3e, 0x64, 0xa8}}, + {nil, // 45 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00}, + []byte{0xea, 0x51, 0xd3, 0x97, 0x55, 0x95, 0xb8, 0x6b}}, + {nil, // 46 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00}, + []byte{0xca, 0xff, 0xc6, 0xac, 0x45, 0x42, 0xde, 0x31}}, + {nil, // 47 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00}, + []byte{0x8d, 0xd4, 0x5a, 0x2d, 0xdf, 0x90, 0x79, 0x6c}}, + {nil, // 48 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00}, + []byte{0x10, 0x29, 0xd5, 0x5e, 0x88, 0x0e, 0xc2, 0xd0}}, + {nil, // 49 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00}, + []byte{0x5d, 0x86, 0xcb, 0x23, 0x63, 0x9d, 0xbe, 0xa9}}, + {nil, // 50 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00}, + []byte{0x1d, 0x1c, 0xa8, 0x53, 0xae, 0x7c, 0x0c, 0x5f}}, + {nil, // 51 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00}, + []byte{0xce, 0x33, 0x23, 0x29, 0x24, 0x8f, 0x32, 0x28}}, + {nil, // 52 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00}, + []byte{0x84, 0x05, 0xd1, 0xab, 0xe2, 0x4f, 0xb9, 0x42}}, + {nil, // 53 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00}, + []byte{0xe6, 0x43, 0xd7, 0x80, 0x90, 0xca, 0x42, 0x07}}, + {nil, // 54 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00}, + []byte{0x48, 0x22, 0x1b, 0x99, 0x37, 0x74, 0x8a, 0x23}}, + {nil, // 55 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00}, + []byte{0xdd, 0x7c, 0x0b, 0xbd, 0x61, 0xfa, 0xfd, 0x54}}, + {nil, // 56 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80}, + []byte{0x2f, 0xbc, 0x29, 0x1a, 0x57, 0x0d, 0xb5, 0xc4}}, + {nil, // 57 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40}, + []byte{0xe0, 0x7c, 0x30, 0xd7, 0xe4, 0xe2, 0x6e, 0x12}}, + {nil, // 58 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}, + []byte{0x09, 0x53, 0xe2, 0x25, 0x8e, 0x8e, 0x90, 0xa1}}, + {nil, // 59 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, + []byte{0x5b, 0x71, 0x1b, 0xc4, 0xce, 0xeb, 0xf2, 0xee}}, + {nil, // 60 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08}, + []byte{0xcc, 0x08, 0x3f, 0x1e, 0x6d, 0x9e, 0x85, 0xf6}}, + {nil, // 61 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04}, + []byte{0xd2, 0xfd, 0x88, 0x67, 0xd5, 0x0d, 0x2d, 0xfe}}, + {nil, // 62 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}, + []byte{0x06, 0xe7, 0xea, 0x22, 0xce, 0x92, 0x70, 0x8f}}, + {nil, // 63 + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, + []byte{0x16, 0x6b, 0x40, 0xb4, 0x4a, 0xba, 0x4b, 0xd6}}, +} + +// Plaintext for use with Table A.2 tests +var tableA2Plaintext = []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +// Table A.2 Resulting Ciphertext from the Variable Key Known Answer Test +var tableA2Tests = []CryptTest{ + { // 0 + []byte{ + 0x80, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x80, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x80, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0x95, 0xa8, 0xd7, 0x28, 0x13, 0xda, 0xa9, 0x4d}}, + { // 1 + []byte{ + 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0x0e, 0xec, 0x14, 0x87, 0xdd, 0x8c, 0x26, 0xd5}}, + { // 2 + []byte{ + 0x20, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x20, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x20, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0x7a, 0xd1, 0x6f, 0xfb, 0x79, 0xc4, 0x59, 0x26}}, + { // 3 + []byte{ + 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0xd3, 0x74, 0x62, 0x94, 0xca, 0x6a, 0x6c, 0xf3}}, + { // 4 + []byte{ + 0x08, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x08, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x08, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0x80, 0x9f, 0x5f, 0x87, 0x3c, 0x1f, 0xd7, 0x61}}, + { // 5 + []byte{ + 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0xc0, 0x2f, 0xaf, 0xfe, 0xc9, 0x89, 0xd1, 0xfc}}, + { // 6 + []byte{ + 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0x46, 0x15, 0xaa, 0x1d, 0x33, 0xe7, 0x2f, 0x10}}, + { // 7 + []byte{ + 0x01, 0x80, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x80, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x80, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0x20, 0x55, 0x12, 0x33, 0x50, 0xc0, 0x08, 0x58}}, + { // 8 + []byte{ + 0x01, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0xdf, 0x3b, 0x99, 0xd6, 0x57, 0x73, 0x97, 0xc8}}, + { // 9 + []byte{ + 0x01, 0x20, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x20, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x20, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0x31, 0xfe, 0x17, 0x36, 0x9b, 0x52, 0x88, 0xc9}}, + { // 10 + []byte{ + 0x01, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0xdf, 0xdd, 0x3c, 0xc6, 0x4d, 0xae, 0x16, 0x42}}, + { // 11 + []byte{ + 0x01, 0x08, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x08, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x08, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0x17, 0x8c, 0x83, 0xce, 0x2b, 0x39, 0x9d, 0x94}}, + { // 12 + []byte{ + 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0x50, 0xf6, 0x36, 0x32, 0x4a, 0x9b, 0x7f, 0x80}}, + { // 13 + []byte{ + 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0xa8, 0x46, 0x8e, 0xe3, 0xbc, 0x18, 0xf0, 0x6d}}, + { // 14 + []byte{ + 0x01, 0x01, 0x80, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x80, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x80, 0x01, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0xa2, 0xdc, 0x9e, 0x92, 0xfd, 0x3c, 0xde, 0x92}}, + { // 15 + []byte{ + 0x01, 0x01, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0xca, 0xc0, 0x9f, 0x79, 0x7d, 0x03, 0x12, 0x87}}, + { // 16 + []byte{ + 0x01, 0x01, 0x20, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x20, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x20, 0x01, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0x90, 0xba, 0x68, 0x0b, 0x22, 0xae, 0xb5, 0x25}}, + { // 17 + []byte{ + 0x01, 0x01, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0xce, 0x7a, 0x24, 0xf3, 0x50, 0xe2, 0x80, 0xb6}}, + { // 18 + []byte{ + 0x01, 0x01, 0x08, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x08, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x08, 0x01, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0x88, 0x2b, 0xff, 0x0a, 0xa0, 0x1a, 0x0b, 0x87}}, + { // 19 + []byte{ + 0x01, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0x25, 0x61, 0x02, 0x88, 0x92, 0x45, 0x11, 0xc2}}, + { // 20 + []byte{ + 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0xc7, 0x15, 0x16, 0xc2, 0x9c, 0x75, 0xd1, 0x70}}, + { // 21 + []byte{ + 0x01, 0x01, 0x01, 0x80, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x80, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x80, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0x51, 0x99, 0xc2, 0x9a, 0x52, 0xc9, 0xf0, 0x59}}, + { // 22 + []byte{ + 0x01, 0x01, 0x01, 0x40, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x40, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x40, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0xc2, 0x2f, 0x0a, 0x29, 0x4a, 0x71, 0xf2, 0x9f}}, + { // 23 + []byte{ + 0x01, 0x01, 0x01, 0x20, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x20, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x20, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0xee, 0x37, 0x14, 0x83, 0x71, 0x4c, 0x02, 0xea}}, + { // 24 + []byte{ + 0x01, 0x01, 0x01, 0x10, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x10, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x10, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0xa8, 0x1f, 0xbd, 0x44, 0x8f, 0x9e, 0x52, 0x2f}}, + { // 25 + []byte{ + 0x01, 0x01, 0x01, 0x08, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x08, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x08, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0x4f, 0x64, 0x4c, 0x92, 0xe1, 0x92, 0xdf, 0xed}}, + { // 26 + []byte{ + 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0x1a, 0xfa, 0x9a, 0x66, 0xa6, 0xdf, 0x92, 0xae}}, + { // 27 + []byte{ + 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01}, + nil, + []byte{0xb3, 0xc1, 0xcc, 0x71, 0x5c, 0xb8, 0x79, 0xd8}}, + { // 28 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x80, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x80, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x80, 0x01, 0x01, 0x01}, + nil, + []byte{0x19, 0xd0, 0x32, 0xe6, 0x4a, 0xb0, 0xbd, 0x8b}}, + { // 29 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x40, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x40, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x40, 0x01, 0x01, 0x01}, + nil, + []byte{0x3c, 0xfa, 0xa7, 0xa7, 0xdc, 0x87, 0x20, 0xdc}}, + { // 30 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x20, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x20, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x20, 0x01, 0x01, 0x01}, + nil, + []byte{0xb7, 0x26, 0x5f, 0x7f, 0x44, 0x7a, 0xc6, 0xf3}}, + { // 31 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x10, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x10, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x10, 0x01, 0x01, 0x01}, + nil, + []byte{0x9d, 0xb7, 0x3b, 0x3c, 0x0d, 0x16, 0x3f, 0x54}}, + { // 32 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x08, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x08, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x08, 0x01, 0x01, 0x01}, + nil, + []byte{0x81, 0x81, 0xb6, 0x5b, 0xab, 0xf4, 0xa9, 0x75}}, + { // 33 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x01}, + nil, + []byte{0x93, 0xc9, 0xb6, 0x40, 0x42, 0xea, 0xa2, 0x40}}, + { // 34 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01}, + nil, + []byte{0x55, 0x70, 0x53, 0x08, 0x29, 0x70, 0x55, 0x92}}, + { // 35 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x80, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x80, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x80, 0x01, 0x01}, + nil, + []byte{0x86, 0x38, 0x80, 0x9e, 0x87, 0x87, 0x87, 0xa0}}, + { // 36 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x40, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x40, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x40, 0x01, 0x01}, + nil, + []byte{0x41, 0xb9, 0xa7, 0x9a, 0xf7, 0x9a, 0xc2, 0x08}}, + { // 37 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x20, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x20, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x20, 0x01, 0x01}, + nil, + []byte{0x7a, 0x9b, 0xe4, 0x2f, 0x20, 0x09, 0xa8, 0x92}}, + { // 38 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x10, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x10, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x10, 0x01, 0x01}, + nil, + []byte{0x29, 0x03, 0x8d, 0x56, 0xba, 0x6d, 0x27, 0x45}}, + { // 39 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x08, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x08, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x08, 0x01, 0x01}, + nil, + []byte{0x54, 0x95, 0xc6, 0xab, 0xf1, 0xe5, 0xdf, 0x51}}, + { // 40 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01}, + nil, + []byte{0xae, 0x13, 0xdb, 0xd5, 0x61, 0x48, 0x89, 0x33}}, + { // 41 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01}, + nil, + []byte{0x02, 0x4d, 0x1f, 0xfa, 0x89, 0x04, 0xe3, 0x89}}, + { // 42 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x80, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x80, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x80, 0x01}, + nil, + []byte{0xd1, 0x39, 0x97, 0x12, 0xf9, 0x9b, 0xf0, 0x2e}}, + { // 43 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x40, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x40, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x40, 0x01}, + nil, + []byte{0x14, 0xc1, 0xd7, 0xc1, 0xcf, 0xfe, 0xc7, 0x9e}}, + { // 44 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x20, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x20, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x20, 0x01}, + nil, + []byte{0x1d, 0xe5, 0x27, 0x9d, 0xae, 0x3b, 0xed, 0x6f}}, + { // 45 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x10, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x10, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x10, 0x01}, + nil, + []byte{0xe9, 0x41, 0xa3, 0x3f, 0x85, 0x50, 0x13, 0x03}}, + { // 46 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x08, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x08, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x08, 0x01}, + nil, + []byte{0xda, 0x99, 0xdb, 0xbc, 0x9a, 0x03, 0xf3, 0x79}}, + { // 47 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x01}, + nil, + []byte{0xb7, 0xfc, 0x92, 0xf9, 0x1d, 0x8e, 0x92, 0xe9}}, + { // 48 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01}, + nil, + []byte{0xae, 0x8e, 0x5c, 0xaa, 0x3c, 0xa0, 0x4e, 0x85}}, + { // 49 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x80, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x80, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x80}, + nil, + []byte{0x9c, 0xc6, 0x2d, 0xf4, 0x3b, 0x6e, 0xed, 0x74}}, + { // 50 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x40, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x40, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x40}, + nil, + []byte{0xd8, 0x63, 0xdb, 0xb5, 0xc5, 0x9a, 0x91, 0xa0}}, + { // 50 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x20, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x20, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x20}, + nil, + []byte{0xa1, 0xab, 0x21, 0x90, 0x54, 0x5b, 0x91, 0xd7}}, + { // 52 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x10, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x10, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x10}, + nil, + []byte{0x08, 0x75, 0x04, 0x1e, 0x64, 0xc5, 0x70, 0xf7}}, + { // 53 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x08, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x08, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x08}, + nil, + []byte{0x5a, 0x59, 0x45, 0x28, 0xbe, 0xbe, 0xf1, 0xcc}}, + { // 54 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04}, + nil, + []byte{0xfc, 0xdb, 0x32, 0x91, 0xde, 0x21, 0xf0, 0xc0}}, + { // 55 + []byte{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02}, + nil, + []byte{0x86, 0x9e, 0xfd, 0x7f, 0x9f, 0x26, 0x5a, 0x09}}, +} + +// Plaintext for use with Table A.3 tests +var tableA3Plaintext = []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +// Table A.3 Values To Be Used for the Permutation Operation Known Answer Test +var tableA3Tests = []CryptTest{ + { // 0 + []byte{ + 0x10, 0x46, 0x91, 0x34, 0x89, 0x98, 0x01, 0x31, + 0x10, 0x46, 0x91, 0x34, 0x89, 0x98, 0x01, 0x31, + 0x10, 0x46, 0x91, 0x34, 0x89, 0x98, 0x01, 0x31, + }, + nil, + []byte{0x88, 0xd5, 0x5e, 0x54, 0xf5, 0x4c, 0x97, 0xb4}}, + { // 1 + []byte{ + 0x10, 0x07, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20, + 0x10, 0x07, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20, + 0x10, 0x07, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20, + }, + nil, + []byte{0x0c, 0x0c, 0xc0, 0x0c, 0x83, 0xea, 0x48, 0xfd}}, + { // 2 + []byte{ + 0x10, 0x07, 0x10, 0x34, 0xc8, 0x98, 0x01, 0x20, + 0x10, 0x07, 0x10, 0x34, 0xc8, 0x98, 0x01, 0x20, + 0x10, 0x07, 0x10, 0x34, 0xc8, 0x98, 0x01, 0x20, + }, + nil, + []byte{0x83, 0xbc, 0x8e, 0xf3, 0xa6, 0x57, 0x01, 0x83}}, + { // 3 + []byte{ + 0x10, 0x46, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20, + 0x10, 0x46, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20, + 0x10, 0x46, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20, + }, + nil, + []byte{0xdf, 0x72, 0x5d, 0xca, 0xd9, 0x4e, 0xa2, 0xe9}}, + { // 4 + []byte{ + 0x10, 0x86, 0x91, 0x15, 0x19, 0x19, 0x01, 0x01, + 0x10, 0x86, 0x91, 0x15, 0x19, 0x19, 0x01, 0x01, + 0x10, 0x86, 0x91, 0x15, 0x19, 0x19, 0x01, 0x01, + }, + nil, + []byte{0xe6, 0x52, 0xb5, 0x3b, 0x55, 0x0b, 0xe8, 0xb0}}, + { // 5 + []byte{ + 0x10, 0x86, 0x91, 0x15, 0x19, 0x58, 0x01, 0x01, + 0x10, 0x86, 0x91, 0x15, 0x19, 0x58, 0x01, 0x01, + 0x10, 0x86, 0x91, 0x15, 0x19, 0x58, 0x01, 0x01, + }, + nil, + []byte{0xaf, 0x52, 0x71, 0x20, 0xc4, 0x85, 0xcb, 0xb0}}, + { // 6 + []byte{ + 0x51, 0x07, 0xb0, 0x15, 0x19, 0x58, 0x01, 0x01, + 0x51, 0x07, 0xb0, 0x15, 0x19, 0x58, 0x01, 0x01, + 0x51, 0x07, 0xb0, 0x15, 0x19, 0x58, 0x01, 0x01, + }, + nil, + []byte{0x0f, 0x04, 0xce, 0x39, 0x3d, 0xb9, 0x26, 0xd5}}, + { // 7 + []byte{ + 0x10, 0x07, 0xb0, 0x15, 0x19, 0x19, 0x01, 0x01, + 0x10, 0x07, 0xb0, 0x15, 0x19, 0x19, 0x01, 0x01, + 0x10, 0x07, 0xb0, 0x15, 0x19, 0x19, 0x01, 0x01, + }, + nil, + []byte{0xc9, 0xf0, 0x0f, 0xfc, 0x74, 0x07, 0x90, 0x67}}, + { // 8 + []byte{ + 0x31, 0x07, 0x91, 0x54, 0x98, 0x08, 0x01, 0x01, + 0x31, 0x07, 0x91, 0x54, 0x98, 0x08, 0x01, 0x01, + 0x31, 0x07, 0x91, 0x54, 0x98, 0x08, 0x01, 0x01, + }, + nil, + []byte{0x7c, 0xfd, 0x82, 0xa5, 0x93, 0x25, 0x2b, 0x4e}}, + { // 9 + []byte{ + 0x31, 0x07, 0x91, 0x94, 0x98, 0x08, 0x01, 0x01, + 0x31, 0x07, 0x91, 0x94, 0x98, 0x08, 0x01, 0x01, + 0x31, 0x07, 0x91, 0x94, 0x98, 0x08, 0x01, 0x01, + }, + nil, + []byte{0xcb, 0x49, 0xa2, 0xf9, 0xe9, 0x13, 0x63, 0xe3}}, + { // 10 + []byte{ + 0x10, 0x07, 0x91, 0x15, 0xb9, 0x08, 0x01, 0x40, + 0x10, 0x07, 0x91, 0x15, 0xb9, 0x08, 0x01, 0x40, + 0x10, 0x07, 0x91, 0x15, 0xb9, 0x08, 0x01, 0x40, + }, + nil, + []byte{0x00, 0xb5, 0x88, 0xbe, 0x70, 0xd2, 0x3f, 0x56}}, + { // 11 + []byte{ + 0x31, 0x07, 0x91, 0x15, 0x98, 0x08, 0x01, 0x40, + 0x31, 0x07, 0x91, 0x15, 0x98, 0x08, 0x01, 0x40, + 0x31, 0x07, 0x91, 0x15, 0x98, 0x08, 0x01, 0x40, + }, + nil, + []byte{0x40, 0x6a, 0x9a, 0x6a, 0xb4, 0x33, 0x99, 0xae}}, + { // 12 + []byte{ + 0x10, 0x07, 0xd0, 0x15, 0x89, 0x98, 0x01, 0x01, + 0x10, 0x07, 0xd0, 0x15, 0x89, 0x98, 0x01, 0x01, + 0x10, 0x07, 0xd0, 0x15, 0x89, 0x98, 0x01, 0x01, + }, + nil, + []byte{0x6c, 0xb7, 0x73, 0x61, 0x1d, 0xca, 0x9a, 0xda}}, + { // 13 + []byte{ + 0x91, 0x07, 0x91, 0x15, 0x89, 0x98, 0x01, 0x01, + 0x91, 0x07, 0x91, 0x15, 0x89, 0x98, 0x01, 0x01, + 0x91, 0x07, 0x91, 0x15, 0x89, 0x98, 0x01, 0x01, + }, + nil, + []byte{0x67, 0xfd, 0x21, 0xc1, 0x7d, 0xbb, 0x5d, 0x70}}, + { // 14 + []byte{ + 0x91, 0x07, 0xd0, 0x15, 0x89, 0x19, 0x01, 0x01, + 0x91, 0x07, 0xd0, 0x15, 0x89, 0x19, 0x01, 0x01, + 0x91, 0x07, 0xd0, 0x15, 0x89, 0x19, 0x01, 0x01, + }, + nil, + []byte{0x95, 0x92, 0xcb, 0x41, 0x10, 0x43, 0x07, 0x87}}, + { // 15 + []byte{ + 0x10, 0x07, 0xd0, 0x15, 0x98, 0x98, 0x01, 0x20, + 0x10, 0x07, 0xd0, 0x15, 0x98, 0x98, 0x01, 0x20, + 0x10, 0x07, 0xd0, 0x15, 0x98, 0x98, 0x01, 0x20, + }, + nil, + []byte{0xa6, 0xb7, 0xff, 0x68, 0xa3, 0x18, 0xdd, 0xd3}}, + { // 16 + []byte{ + 0x10, 0x07, 0x94, 0x04, 0x98, 0x19, 0x01, 0x01, + 0x10, 0x07, 0x94, 0x04, 0x98, 0x19, 0x01, 0x01, + 0x10, 0x07, 0x94, 0x04, 0x98, 0x19, 0x01, 0x01, + }, + nil, + []byte{0x4d, 0x10, 0x21, 0x96, 0xc9, 0x14, 0xca, 0x16}}, + { // 17 + []byte{ + 0x01, 0x07, 0x91, 0x04, 0x91, 0x19, 0x04, 0x01, + 0x01, 0x07, 0x91, 0x04, 0x91, 0x19, 0x04, 0x01, + 0x01, 0x07, 0x91, 0x04, 0x91, 0x19, 0x04, 0x01, + }, + nil, + []byte{0x2d, 0xfa, 0x9f, 0x45, 0x73, 0x59, 0x49, 0x65}}, + { // 18 + []byte{ + 0x01, 0x07, 0x91, 0x04, 0x91, 0x19, 0x01, 0x01, + 0x01, 0x07, 0x91, 0x04, 0x91, 0x19, 0x01, 0x01, + 0x01, 0x07, 0x91, 0x04, 0x91, 0x19, 0x01, 0x01, + }, + nil, + []byte{0xb4, 0x66, 0x04, 0x81, 0x6c, 0x0e, 0x07, 0x74}}, + { // 19 + []byte{ + 0x01, 0x07, 0x94, 0x04, 0x91, 0x19, 0x04, 0x01, + 0x01, 0x07, 0x94, 0x04, 0x91, 0x19, 0x04, 0x01, + 0x01, 0x07, 0x94, 0x04, 0x91, 0x19, 0x04, 0x01, + }, + nil, + []byte{0x6e, 0x7e, 0x62, 0x21, 0xa4, 0xf3, 0x4e, 0x87}}, + { // 20 + []byte{ + 0x19, 0x07, 0x92, 0x10, 0x98, 0x1a, 0x01, 0x01, + 0x19, 0x07, 0x92, 0x10, 0x98, 0x1a, 0x01, 0x01, + 0x19, 0x07, 0x92, 0x10, 0x98, 0x1a, 0x01, 0x01, + }, + nil, + []byte{0xaa, 0x85, 0xe7, 0x46, 0x43, 0x23, 0x31, 0x99}}, + { // 21 + []byte{ + 0x10, 0x07, 0x91, 0x19, 0x98, 0x19, 0x08, 0x01, + 0x10, 0x07, 0x91, 0x19, 0x98, 0x19, 0x08, 0x01, + 0x10, 0x07, 0x91, 0x19, 0x98, 0x19, 0x08, 0x01, + }, + nil, + []byte{0x2e, 0x5a, 0x19, 0xdb, 0x4d, 0x19, 0x62, 0xd6}}, + { // 22 + []byte{ + 0x10, 0x07, 0x91, 0x19, 0x98, 0x1a, 0x08, 0x01, + 0x10, 0x07, 0x91, 0x19, 0x98, 0x1a, 0x08, 0x01, + 0x10, 0x07, 0x91, 0x19, 0x98, 0x1a, 0x08, 0x01, + }, + nil, + []byte{0x23, 0xa8, 0x66, 0xa8, 0x09, 0xd3, 0x08, 0x94}}, + { // 23 + []byte{ + 0x10, 0x07, 0x92, 0x10, 0x98, 0x19, 0x01, 0x01, + 0x10, 0x07, 0x92, 0x10, 0x98, 0x19, 0x01, 0x01, + 0x10, 0x07, 0x92, 0x10, 0x98, 0x19, 0x01, 0x01, + }, + nil, + []byte{0xd8, 0x12, 0xd9, 0x61, 0xf0, 0x17, 0xd3, 0x20}}, + { // 24 + []byte{ + 0x10, 0x07, 0x91, 0x15, 0x98, 0x19, 0x01, 0x0b, + 0x10, 0x07, 0x91, 0x15, 0x98, 0x19, 0x01, 0x0b, + 0x10, 0x07, 0x91, 0x15, 0x98, 0x19, 0x01, 0x0b, + }, + nil, + []byte{0x05, 0x56, 0x05, 0x81, 0x6e, 0x58, 0x60, 0x8f}}, + { // 25 + []byte{ + 0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x01, + 0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x01, + 0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x01, + }, + nil, + []byte{0xab, 0xd8, 0x8e, 0x8b, 0x1b, 0x77, 0x16, 0xf1}}, + { // 26 + []byte{ + 0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x02, + 0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x02, + 0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x02, + }, + nil, + []byte{0x53, 0x7a, 0xc9, 0x5b, 0xe6, 0x9d, 0xa1, 0xe1}}, + { // 27 + []byte{ + 0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x08, + 0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x08, + 0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x08, + }, + nil, + []byte{0xae, 0xd0, 0xf6, 0xae, 0x3c, 0x25, 0xcd, 0xd8}}, + { // 28 + []byte{ + 0x10, 0x02, 0x91, 0x15, 0x98, 0x10, 0x01, 0x04, + 0x10, 0x02, 0x91, 0x15, 0x98, 0x10, 0x01, 0x04, + 0x10, 0x02, 0x91, 0x15, 0x98, 0x10, 0x01, 0x04, + }, + nil, + []byte{0xb3, 0xe3, 0x5a, 0x5e, 0xe5, 0x3e, 0x7b, 0x8d}}, + { // 29 + []byte{ + 0x10, 0x02, 0x91, 0x15, 0x98, 0x19, 0x01, 0x04, + 0x10, 0x02, 0x91, 0x15, 0x98, 0x19, 0x01, 0x04, + 0x10, 0x02, 0x91, 0x15, 0x98, 0x19, 0x01, 0x04, + }, + nil, + []byte{0x61, 0xc7, 0x9c, 0x71, 0x92, 0x1a, 0x2e, 0xf8}}, + { // 30 + []byte{ + 0x10, 0x02, 0x91, 0x15, 0x98, 0x10, 0x02, 0x01, + 0x10, 0x02, 0x91, 0x15, 0x98, 0x10, 0x02, 0x01, + 0x10, 0x02, 0x91, 0x15, 0x98, 0x10, 0x02, 0x01, + }, + nil, + []byte{0xe2, 0xf5, 0x72, 0x8f, 0x09, 0x95, 0x01, 0x3c}}, + { // 31 + []byte{ + 0x10, 0x02, 0x91, 0x16, 0x98, 0x10, 0x01, 0x01, + 0x10, 0x02, 0x91, 0x16, 0x98, 0x10, 0x01, 0x01, + 0x10, 0x02, 0x91, 0x16, 0x98, 0x10, 0x01, 0x01, + }, + nil, + []byte{0x1a, 0xea, 0xc3, 0x9a, 0x61, 0xf0, 0xa4, 0x64}}, +} + +// Table A.4 Values To Be Used for the Substitution Table Known Answer Test +var tableA4Tests = []CryptTest{ + { // 0 + []byte{ + 0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57, + 0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57, + 0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57}, + []byte{0x01, 0xa1, 0xd6, 0xd0, 0x39, 0x77, 0x67, 0x42}, + []byte{0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b}}, + { // 1 + []byte{ + 0x01, 0x31, 0xd9, 0x61, 0x9d, 0xc1, 0x37, 0x6e, + 0x01, 0x31, 0xd9, 0x61, 0x9d, 0xc1, 0x37, 0x6e, + 0x01, 0x31, 0xd9, 0x61, 0x9d, 0xc1, 0x37, 0x6e}, + []byte{0x5c, 0xd5, 0x4c, 0xa8, 0x3d, 0xef, 0x57, 0xda}, + []byte{0x7a, 0x38, 0x9d, 0x10, 0x35, 0x4b, 0xd2, 0x71}}, + { // 2 + []byte{ + 0x07, 0xa1, 0x13, 0x3e, 0x4a, 0x0b, 0x26, 0x86, + 0x07, 0xa1, 0x13, 0x3e, 0x4a, 0x0b, 0x26, 0x86, + 0x07, 0xa1, 0x13, 0x3e, 0x4a, 0x0b, 0x26, 0x86}, + []byte{0x02, 0x48, 0xd4, 0x38, 0x06, 0xf6, 0x71, 0x72}, + []byte{0x86, 0x8e, 0xbb, 0x51, 0xca, 0xb4, 0x59, 0x9a}}, + { // 3 + []byte{ + 0x38, 0x49, 0x67, 0x4c, 0x26, 0x02, 0x31, 0x9e, + 0x38, 0x49, 0x67, 0x4c, 0x26, 0x02, 0x31, 0x9e, + 0x38, 0x49, 0x67, 0x4c, 0x26, 0x02, 0x31, 0x9e}, + []byte{0x51, 0x45, 0x4b, 0x58, 0x2d, 0xdf, 0x44, 0x0a}, + []byte{0x71, 0x78, 0x87, 0x6e, 0x01, 0xf1, 0x9b, 0x2a}}, + { // 4 + []byte{ + 0x04, 0xb9, 0x15, 0xba, 0x43, 0xfe, 0xb5, 0xb6, + 0x04, 0xb9, 0x15, 0xba, 0x43, 0xfe, 0xb5, 0xb6, + 0x04, 0xb9, 0x15, 0xba, 0x43, 0xfe, 0xb5, 0xb6}, + []byte{0x42, 0xfd, 0x44, 0x30, 0x59, 0x57, 0x7f, 0xa2}, + []byte{0xaf, 0x37, 0xfb, 0x42, 0x1f, 0x8c, 0x40, 0x95}}, + { // 5 + []byte{ + 0x01, 0x13, 0xb9, 0x70, 0xfd, 0x34, 0xf2, 0xce, + 0x01, 0x13, 0xb9, 0x70, 0xfd, 0x34, 0xf2, 0xce, + 0x01, 0x13, 0xb9, 0x70, 0xfd, 0x34, 0xf2, 0xce}, + []byte{0x05, 0x9b, 0x5e, 0x08, 0x51, 0xcf, 0x14, 0x3a}, + []byte{0x86, 0xa5, 0x60, 0xf1, 0x0e, 0xc6, 0xd8, 0x5b}}, + { // 6 + []byte{ + 0x01, 0x70, 0xf1, 0x75, 0x46, 0x8f, 0xb5, 0xe6, + 0x01, 0x70, 0xf1, 0x75, 0x46, 0x8f, 0xb5, 0xe6, + 0x01, 0x70, 0xf1, 0x75, 0x46, 0x8f, 0xb5, 0xe6}, + []byte{0x07, 0x56, 0xd8, 0xe0, 0x77, 0x47, 0x61, 0xd2}, + []byte{0x0c, 0xd3, 0xda, 0x02, 0x00, 0x21, 0xdc, 0x09}}, + { // 7 + []byte{ + 0x43, 0x29, 0x7f, 0xad, 0x38, 0xe3, 0x73, 0xfe, + 0x43, 0x29, 0x7f, 0xad, 0x38, 0xe3, 0x73, 0xfe, + 0x43, 0x29, 0x7f, 0xad, 0x38, 0xe3, 0x73, 0xfe}, + []byte{0x76, 0x25, 0x14, 0xb8, 0x29, 0xbf, 0x48, 0x6a}, + []byte{0xea, 0x67, 0x6b, 0x2c, 0xb7, 0xdb, 0x2b, 0x7a}}, + { // 8 + []byte{ + 0x07, 0xa7, 0x13, 0x70, 0x45, 0xda, 0x2a, 0x16, + 0x07, 0xa7, 0x13, 0x70, 0x45, 0xda, 0x2a, 0x16, + 0x07, 0xa7, 0x13, 0x70, 0x45, 0xda, 0x2a, 0x16}, + []byte{0x3b, 0xdd, 0x11, 0x90, 0x49, 0x37, 0x28, 0x02}, + []byte{0xdf, 0xd6, 0x4a, 0x81, 0x5c, 0xaf, 0x1a, 0x0f}}, + { // 9 + []byte{ + 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f, + 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f, + 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f}, + []byte{0x26, 0x95, 0x5f, 0x68, 0x35, 0xaf, 0x60, 0x9a}, + []byte{0x5c, 0x51, 0x3c, 0x9c, 0x48, 0x86, 0xc0, 0x88}}, + { // 10 + []byte{ + 0x37, 0xd0, 0x6b, 0xb5, 0x16, 0xcb, 0x75, 0x46, + 0x37, 0xd0, 0x6b, 0xb5, 0x16, 0xcb, 0x75, 0x46, + 0x37, 0xd0, 0x6b, 0xb5, 0x16, 0xcb, 0x75, 0x46}, + []byte{0x16, 0x4d, 0x5e, 0x40, 0x4f, 0x27, 0x52, 0x32}, + []byte{0x0a, 0x2a, 0xee, 0xae, 0x3f, 0xf4, 0xab, 0x77}}, + { // 11 + []byte{ + 0x1f, 0x08, 0x26, 0x0d, 0x1a, 0xc2, 0x46, 0x5e, + 0x1f, 0x08, 0x26, 0x0d, 0x1a, 0xc2, 0x46, 0x5e, + 0x1f, 0x08, 0x26, 0x0d, 0x1a, 0xc2, 0x46, 0x5e}, + []byte{0x6b, 0x05, 0x6e, 0x18, 0x75, 0x9f, 0x5c, 0xca}, + []byte{0xef, 0x1b, 0xf0, 0x3e, 0x5d, 0xfa, 0x57, 0x5a}}, + { // 12 + []byte{ + 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76, + 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76, + 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76}, + []byte{0x00, 0x4b, 0xd6, 0xef, 0x09, 0x17, 0x60, 0x62}, + []byte{0x88, 0xbf, 0x0d, 0xb6, 0xd7, 0x0d, 0xee, 0x56}}, + { // 13 + []byte{ + 0x02, 0x58, 0x16, 0x16, 0x46, 0x29, 0xb0, 0x07, + 0x02, 0x58, 0x16, 0x16, 0x46, 0x29, 0xb0, 0x07, + 0x02, 0x58, 0x16, 0x16, 0x46, 0x29, 0xb0, 0x07}, + []byte{0x48, 0x0d, 0x39, 0x00, 0x6e, 0xe7, 0x62, 0xf2}, + []byte{0xa1, 0xf9, 0x91, 0x55, 0x41, 0x02, 0x0b, 0x56}}, + { // 14 + []byte{ + 0x49, 0x79, 0x3e, 0xbc, 0x79, 0xb3, 0x25, 0x8f, + 0x49, 0x79, 0x3e, 0xbc, 0x79, 0xb3, 0x25, 0x8f, + 0x49, 0x79, 0x3e, 0xbc, 0x79, 0xb3, 0x25, 0x8f}, + []byte{0x43, 0x75, 0x40, 0xc8, 0x69, 0x8f, 0x3c, 0xfa}, + []byte{0x6f, 0xbf, 0x1c, 0xaf, 0xcf, 0xfd, 0x05, 0x56}}, + { // 15 + []byte{ + 0x4f, 0xb0, 0x5e, 0x15, 0x15, 0xab, 0x73, 0xa7, + 0x4f, 0xb0, 0x5e, 0x15, 0x15, 0xab, 0x73, 0xa7, + 0x4f, 0xb0, 0x5e, 0x15, 0x15, 0xab, 0x73, 0xa7}, + []byte{0x07, 0x2d, 0x43, 0xa0, 0x77, 0x07, 0x52, 0x92}, + []byte{0x2f, 0x22, 0xe4, 0x9b, 0xab, 0x7c, 0xa1, 0xac}}, + { // 16 + []byte{ + 0x49, 0xe9, 0x5d, 0x6d, 0x4c, 0xa2, 0x29, 0xbf, + 0x49, 0xe9, 0x5d, 0x6d, 0x4c, 0xa2, 0x29, 0xbf, + 0x49, 0xe9, 0x5d, 0x6d, 0x4c, 0xa2, 0x29, 0xbf}, + []byte{0x02, 0xfe, 0x55, 0x77, 0x81, 0x17, 0xf1, 0x2a}, + []byte{0x5a, 0x6b, 0x61, 0x2c, 0xc2, 0x6c, 0xce, 0x4a}}, + { // 17 + []byte{ + 0x01, 0x83, 0x10, 0xdc, 0x40, 0x9b, 0x26, 0xd6, + 0x01, 0x83, 0x10, 0xdc, 0x40, 0x9b, 0x26, 0xd6, + 0x01, 0x83, 0x10, 0xdc, 0x40, 0x9b, 0x26, 0xd6}, + []byte{0x1d, 0x9d, 0x5c, 0x50, 0x18, 0xf7, 0x28, 0xc2}, + []byte{0x5f, 0x4c, 0x03, 0x8e, 0xd1, 0x2b, 0x2e, 0x41}}, + { // 18 + []byte{ + 0x1c, 0x58, 0x7f, 0x1c, 0x13, 0x92, 0x4f, 0xef, + 0x1c, 0x58, 0x7f, 0x1c, 0x13, 0x92, 0x4f, 0xef, + 0x1c, 0x58, 0x7f, 0x1c, 0x13, 0x92, 0x4f, 0xef}, + []byte{0x30, 0x55, 0x32, 0x28, 0x6d, 0x6f, 0x29, 0x5a}, + []byte{0x63, 0xfa, 0xc0, 0xd0, 0x34, 0xd9, 0xf7, 0x93}}, +} + +func newCipher(key []byte) cipher.Block { + c, err := des.NewCipher(key) + if err != nil { + panic("NewCipher failed: " + err.Error()) + } + return c +} + +// Use the known weak keys to test DES implementation +func TestWeakKeys(t *testing.T) { + for i, tt := range weakKeyTests { + var encrypt = func(in []byte) (out []byte) { + c := newCipher(tt.key) + out = make([]byte, len(in)) + c.Encrypt(out, in) + return + } + + // Encrypting twice with a DES weak + // key should reproduce the original input + result := encrypt(tt.in) + result = encrypt(result) + + if !bytes.Equal(result, tt.in) { + t.Errorf("#%d: result: %x want: %x", i, result, tt.in) + } + } +} + +// Use the known semi-weak key pairs to test DES implementation +func TestSemiWeakKeyPairs(t *testing.T) { + for i, tt := range semiWeakKeyTests { + var encrypt = func(key, in []byte) (out []byte) { + c := newCipher(key) + out = make([]byte, len(in)) + c.Encrypt(out, in) + return + } + + // Encrypting with one member of the semi-weak pair + // and then encrypting the result with the other member + // should reproduce the original input. + result := encrypt(tt.key, tt.in) + result = encrypt(tt.out, result) + + if !bytes.Equal(result, tt.in) { + t.Errorf("#%d: result: %x want: %x", i, result, tt.in) + } + } +} + +func TestDESEncryptBlock(t *testing.T) { + for i, tt := range encryptDESTests { + c := newCipher(tt.key) + out := make([]byte, len(tt.in)) + c.Encrypt(out, tt.in) + + if !bytes.Equal(out, tt.out) { + t.Errorf("#%d: result: %x want: %x", i, out, tt.out) + } + } +} + +func TestDESDecryptBlock(t *testing.T) { + for i, tt := range encryptDESTests { + c := newCipher(tt.key) + plain := make([]byte, len(tt.in)) + c.Decrypt(plain, tt.out) + + if !bytes.Equal(plain, tt.in) { + t.Errorf("#%d: result: %x want: %x", i, plain, tt.in) + } + } +} + +func TestEncryptTripleDES(t *testing.T) { + for i, tt := range encryptTripleDESTests { + c, _ := des.NewTripleDESCipher(tt.key) + out := make([]byte, len(tt.in)) + c.Encrypt(out, tt.in) + + if !bytes.Equal(out, tt.out) { + t.Errorf("#%d: result: %x want: %x", i, out, tt.out) + } + } +} + +func TestDecryptTripleDES(t *testing.T) { + for i, tt := range encryptTripleDESTests { + c, _ := des.NewTripleDESCipher(tt.key) + + plain := make([]byte, len(tt.in)) + c.Decrypt(plain, tt.out) + + if !bytes.Equal(plain, tt.in) { + t.Errorf("#%d: result: %x want: %x", i, plain, tt.in) + } + } +} + +// Defined in Pub 800-20 +func TestVariablePlaintextKnownAnswer(t *testing.T) { + for i, tt := range tableA1Tests { + c, _ := des.NewTripleDESCipher(tableA1Key) + + out := make([]byte, len(tt.in)) + c.Encrypt(out, tt.in) + + if !bytes.Equal(out, tt.out) { + t.Errorf("#%d: result: %x want: %x", i, out, tt.out) + } + } +} + +// Defined in Pub 800-20 +func TestVariableCiphertextKnownAnswer(t *testing.T) { + for i, tt := range tableA1Tests { + c, _ := des.NewTripleDESCipher(tableA1Key) + + plain := make([]byte, len(tt.out)) + c.Decrypt(plain, tt.out) + + if !bytes.Equal(plain, tt.in) { + t.Errorf("#%d: result: %x want: %x", i, plain, tt.in) + } + } +} + +// Defined in Pub 800-20 +// Encrypting the Table A.1 ciphertext with the +// 0x01... key produces the original plaintext +func TestInversePermutationKnownAnswer(t *testing.T) { + for i, tt := range tableA1Tests { + c, _ := des.NewTripleDESCipher(tableA1Key) + + plain := make([]byte, len(tt.in)) + c.Encrypt(plain, tt.out) + + if !bytes.Equal(plain, tt.in) { + t.Errorf("#%d: result: %x want: %x", i, plain, tt.in) + } + } +} + +// Defined in Pub 800-20 +// Decrypting the Table A.1 plaintext with the +// 0x01... key produces the corresponding ciphertext +func TestInitialPermutationKnownAnswer(t *testing.T) { + for i, tt := range tableA1Tests { + c, _ := des.NewTripleDESCipher(tableA1Key) + + out := make([]byte, len(tt.in)) + c.Decrypt(out, tt.in) + + if !bytes.Equal(out, tt.out) { + t.Errorf("#%d: result: %x want: %x", i, out, tt.out) + } + } +} + +// Defined in Pub 800-20 +func TestVariableKeyKnownAnswerEncrypt(t *testing.T) { + for i, tt := range tableA2Tests { + c, _ := des.NewTripleDESCipher(tt.key) + + out := make([]byte, len(tableA2Plaintext)) + c.Encrypt(out, tableA2Plaintext) + + if !bytes.Equal(out, tt.out) { + t.Errorf("#%d: result: %x want: %x", i, out, tt.out) + } + } +} + +// Defined in Pub 800-20 +func TestVariableKeyKnownAnswerDecrypt(t *testing.T) { + for i, tt := range tableA2Tests { + c, _ := des.NewTripleDESCipher(tt.key) + + out := make([]byte, len(tt.out)) + c.Decrypt(out, tt.out) + + if !bytes.Equal(out, tableA2Plaintext) { + t.Errorf("#%d: result: %x want: %x", i, out, tableA2Plaintext) + } + } +} + +// Defined in Pub 800-20 +func TestPermutationOperationKnownAnswerEncrypt(t *testing.T) { + for i, tt := range tableA3Tests { + c, _ := des.NewTripleDESCipher(tt.key) + + out := make([]byte, len(tableA3Plaintext)) + c.Encrypt(out, tableA3Plaintext) + + if !bytes.Equal(out, tt.out) { + t.Errorf("#%d: result: %x want: %x", i, out, tt.out) + } + } +} + +// Defined in Pub 800-20 +func TestPermutationOperationKnownAnswerDecrypt(t *testing.T) { + for i, tt := range tableA3Tests { + c, _ := des.NewTripleDESCipher(tt.key) + + out := make([]byte, len(tt.out)) + c.Decrypt(out, tt.out) + + if !bytes.Equal(out, tableA3Plaintext) { + t.Errorf("#%d: result: %x want: %x", i, out, tableA3Plaintext) + } + } +} + +// Defined in Pub 800-20 +func TestSubstitutionTableKnownAnswerEncrypt(t *testing.T) { + for i, tt := range tableA4Tests { + c, _ := des.NewTripleDESCipher(tt.key) + + out := make([]byte, len(tt.in)) + c.Encrypt(out, tt.in) + + if !bytes.Equal(out, tt.out) { + t.Errorf("#%d: result: %x want: %x", i, out, tt.out) + } + } +} + +// Defined in Pub 800-20 +func TestSubstitutionTableKnownAnswerDecrypt(t *testing.T) { + for i, tt := range tableA4Tests { + c, _ := des.NewTripleDESCipher(tt.key) + + out := make([]byte, len(tt.out)) + c.Decrypt(out, tt.out) + + if !bytes.Equal(out, tt.in) { + t.Errorf("#%d: result: %x want: %x", i, out, tt.in) + } + } +} + +// Test DES against the general cipher.Block interface tester +func TestDESBlock(t *testing.T) { + t.Run("DES", func(t *testing.T) { + cryptotest.TestBlock(t, 8, des.NewCipher) + }) + + t.Run("TripleDES", func(t *testing.T) { + cryptotest.TestBlock(t, 24, des.NewTripleDESCipher) + }) +} + +func BenchmarkEncrypt(b *testing.B) { + tt := encryptDESTests[0] + c, err := des.NewCipher(tt.key) + if err != nil { + b.Fatal("NewCipher:", err) + } + out := make([]byte, len(tt.in)) + b.SetBytes(int64(len(out))) + b.ResetTimer() + for i := 0; i < b.N; i++ { + c.Encrypt(out, tt.in) + } +} + +func BenchmarkDecrypt(b *testing.B) { + tt := encryptDESTests[0] + c, err := des.NewCipher(tt.key) + if err != nil { + b.Fatal("NewCipher:", err) + } + out := make([]byte, len(tt.out)) + b.SetBytes(int64(len(out))) + b.ResetTimer() + for i := 0; i < b.N; i++ { + c.Decrypt(out, tt.out) + } +} + +func BenchmarkTDESEncrypt(b *testing.B) { + tt := encryptTripleDESTests[0] + c, err := des.NewTripleDESCipher(tt.key) + if err != nil { + b.Fatal("NewCipher:", err) + } + out := make([]byte, len(tt.in)) + b.SetBytes(int64(len(out))) + b.ResetTimer() + for i := 0; i < b.N; i++ { + c.Encrypt(out, tt.in) + } +} + +func BenchmarkTDESDecrypt(b *testing.B) { + tt := encryptTripleDESTests[0] + c, err := des.NewTripleDESCipher(tt.key) + if err != nil { + b.Fatal("NewCipher:", err) + } + out := make([]byte, len(tt.out)) + b.SetBytes(int64(len(out))) + b.ResetTimer() + for i := 0; i < b.N; i++ { + c.Decrypt(out, tt.out) + } +} diff --git a/go/src/crypto/des/example_test.go b/go/src/crypto/des/example_test.go new file mode 100644 index 0000000000000000000000000000000000000000..336b5937569cde27b645bfc8b76b28575f208b85 --- /dev/null +++ b/go/src/crypto/des/example_test.go @@ -0,0 +1,25 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package des_test + +import "crypto/des" + +func ExampleNewTripleDESCipher() { + // NewTripleDESCipher can also be used when EDE2 is required by + // duplicating the first 8 bytes of the 16-byte key. + ede2Key := []byte("example key 1234") + + var tripleDESKey []byte + tripleDESKey = append(tripleDESKey, ede2Key[:16]...) + tripleDESKey = append(tripleDESKey, ede2Key[:8]...) + + _, err := des.NewTripleDESCipher(tripleDESKey) + if err != nil { + panic(err) + } + + // See crypto/cipher for how to use a cipher.Block for encryption and + // decryption. +} diff --git a/go/src/crypto/des/internal_test.go b/go/src/crypto/des/internal_test.go new file mode 100644 index 0000000000000000000000000000000000000000..f309b013a242bbed944848cf738ff9efc6895884 --- /dev/null +++ b/go/src/crypto/des/internal_test.go @@ -0,0 +1,29 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package des + +import "testing" + +func TestInitialPermute(t *testing.T) { + for i := uint(0); i < 64; i++ { + bit := uint64(1) << i + got := permuteInitialBlock(bit) + want := uint64(1) << finalPermutation[63-i] + if got != want { + t.Errorf("permute(%x) = %x, want %x", bit, got, want) + } + } +} + +func TestFinalPermute(t *testing.T) { + for i := uint(0); i < 64; i++ { + bit := uint64(1) << i + got := permuteFinalBlock(bit) + want := uint64(1) << initialPermutation[63-i] + if got != want { + t.Errorf("permute(%x) = %x, want %x", bit, got, want) + } + } +} diff --git a/go/src/crypto/dsa/dsa.go b/go/src/crypto/dsa/dsa.go new file mode 100644 index 0000000000000000000000000000000000000000..6724f861b7f2f027a2a0481e6627cf3f269cb434 --- /dev/null +++ b/go/src/crypto/dsa/dsa.go @@ -0,0 +1,330 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package dsa implements the Digital Signature Algorithm, as defined in FIPS 186-3. +// +// The DSA operations in this package are not implemented using constant-time algorithms. +// +// Deprecated: DSA is a legacy algorithm, and modern alternatives such as +// Ed25519 (implemented by package crypto/ed25519) should be used instead. Keys +// with 1024-bit moduli (L1024N160 parameters) are cryptographically weak, while +// bigger keys are not widely supported. Note that FIPS 186-5 no longer approves +// DSA for signature generation. +package dsa + +import ( + "errors" + "io" + "math/big" + + "crypto/internal/fips140only" + "crypto/internal/rand" +) + +// Parameters represents the domain parameters for a key. These parameters can +// be shared across many keys. The bit length of Q must be a multiple of 8. +type Parameters struct { + P, Q, G *big.Int +} + +// PublicKey represents a DSA public key. +type PublicKey struct { + Parameters + Y *big.Int +} + +// PrivateKey represents a DSA private key. +type PrivateKey struct { + PublicKey + X *big.Int +} + +// ErrInvalidPublicKey results when a public key is not usable by this code. +// FIPS is quite strict about the format of DSA keys, but other code may be +// less so. Thus, when using keys which may have been generated by other code, +// this error must be handled. +var ErrInvalidPublicKey = errors.New("crypto/dsa: invalid public key") + +// ParameterSizes is an enumeration of the acceptable bit lengths of the primes +// in a set of DSA parameters. See FIPS 186-3, section 4.2. +type ParameterSizes int + +const ( + L1024N160 ParameterSizes = iota + L2048N224 + L2048N256 + L3072N256 +) + +// numMRTests is the number of Miller-Rabin primality tests that we perform. We +// pick the largest recommended number from table C.1 of FIPS 186-3. +const numMRTests = 64 + +// GenerateParameters puts a random, valid set of DSA parameters into params. +// This function can take many seconds, even on fast machines. +func GenerateParameters(params *Parameters, rand io.Reader, sizes ParameterSizes) error { + if fips140only.Enforced() { + return errors.New("crypto/dsa: use of DSA is not allowed in FIPS 140-only mode") + } + + // This function doesn't follow FIPS 186-3 exactly in that it doesn't + // use a verification seed to generate the primes. The verification + // seed doesn't appear to be exported or used by other code and + // omitting it makes the code cleaner. + + var L, N int + switch sizes { + case L1024N160: + L = 1024 + N = 160 + case L2048N224: + L = 2048 + N = 224 + case L2048N256: + L = 2048 + N = 256 + case L3072N256: + L = 3072 + N = 256 + default: + return errors.New("crypto/dsa: invalid ParameterSizes") + } + + qBytes := make([]byte, N/8) + pBytes := make([]byte, L/8) + + q := new(big.Int) + p := new(big.Int) + rem := new(big.Int) + one := new(big.Int) + one.SetInt64(1) + +GeneratePrimes: + for { + if _, err := io.ReadFull(rand, qBytes); err != nil { + return err + } + + qBytes[len(qBytes)-1] |= 1 + qBytes[0] |= 0x80 + q.SetBytes(qBytes) + + if !q.ProbablyPrime(numMRTests) { + continue + } + + for i := 0; i < 4*L; i++ { + if _, err := io.ReadFull(rand, pBytes); err != nil { + return err + } + + pBytes[len(pBytes)-1] |= 1 + pBytes[0] |= 0x80 + + p.SetBytes(pBytes) + rem.Mod(p, q) + rem.Sub(rem, one) + p.Sub(p, rem) + if p.BitLen() < L { + continue + } + + if !p.ProbablyPrime(numMRTests) { + continue + } + + params.P = p + params.Q = q + break GeneratePrimes + } + } + + h := new(big.Int) + h.SetInt64(2) + g := new(big.Int) + + pm1 := new(big.Int).Sub(p, one) + e := new(big.Int).Div(pm1, q) + + for { + g.Exp(h, e, p) + if g.Cmp(one) == 0 { + h.Add(h, one) + continue + } + + params.G = g + return nil + } +} + +// GenerateKey generates a public&private key pair. The Parameters of the +// [PrivateKey] must already be valid (see [GenerateParameters]). +func GenerateKey(priv *PrivateKey, rand io.Reader) error { + if fips140only.Enforced() { + return errors.New("crypto/dsa: use of DSA is not allowed in FIPS 140-only mode") + } + + if priv.P == nil || priv.Q == nil || priv.G == nil { + return errors.New("crypto/dsa: parameters not set up before generating key") + } + + x := new(big.Int) + xBytes := make([]byte, priv.Q.BitLen()/8) + + for { + _, err := io.ReadFull(rand, xBytes) + if err != nil { + return err + } + x.SetBytes(xBytes) + if x.Sign() != 0 && x.Cmp(priv.Q) < 0 { + break + } + } + + priv.X = x + priv.Y = new(big.Int) + priv.Y.Exp(priv.G, x, priv.P) + return nil +} + +// fermatInverse calculates the inverse of k in GF(P) using Fermat's method. +// This has better constant-time properties than Euclid's method (implemented +// in math/big.Int.ModInverse) although math/big itself isn't strictly +// constant-time so it's not perfect. +func fermatInverse(k, P *big.Int) *big.Int { + two := big.NewInt(2) + pMinus2 := new(big.Int).Sub(P, two) + return new(big.Int).Exp(k, pMinus2, P) +} + +// Sign signs an arbitrary length hash (which should be the result of hashing a +// larger message) using the private key, priv. It returns the signature as a +// pair of integers. The security of the private key depends on the entropy of +// rand. +// +// Note that FIPS 186-3 section 4.6 specifies that the hash should be truncated +// to the byte-length of the subgroup. This function does not perform that +// truncation itself. +// +// Since Go 1.26, a secure source of random bytes is always used, and the Reader is +// ignored unless GODEBUG=cryptocustomrand=1 is set. This setting will be removed +// in a future Go release. Instead, use [testing/cryptotest.SetGlobalRandom]. +// +// Be aware that calling Sign with an attacker-controlled [PrivateKey] may +// require an arbitrary amount of CPU. +func Sign(random io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err error) { + if fips140only.Enforced() { + return nil, nil, errors.New("crypto/dsa: use of DSA is not allowed in FIPS 140-only mode") + } + + random = rand.CustomReader(random) + + // FIPS 186-3, section 4.6 + + n := priv.Q.BitLen() + if priv.Q.Sign() <= 0 || priv.P.Sign() <= 0 || priv.G.Sign() <= 0 || priv.X.Sign() <= 0 || n%8 != 0 { + err = ErrInvalidPublicKey + return + } + n >>= 3 + + var attempts int + for attempts = 10; attempts > 0; attempts-- { + k := new(big.Int) + buf := make([]byte, n) + for { + _, err = io.ReadFull(random, buf) + if err != nil { + return + } + k.SetBytes(buf) + // priv.Q must be >= 128 because the test above + // requires it to be > 0 and that + // ceil(log_2(Q)) mod 8 = 0 + // Thus this loop will quickly terminate. + if k.Sign() > 0 && k.Cmp(priv.Q) < 0 { + break + } + } + + kInv := fermatInverse(k, priv.Q) + + r = new(big.Int).Exp(priv.G, k, priv.P) + r.Mod(r, priv.Q) + + if r.Sign() == 0 { + continue + } + + z := k.SetBytes(hash) + + s = new(big.Int).Mul(priv.X, r) + s.Add(s, z) + s.Mod(s, priv.Q) + s.Mul(s, kInv) + s.Mod(s, priv.Q) + + if s.Sign() != 0 { + break + } + } + + // Only degenerate private keys will require more than a handful of + // attempts. + if attempts == 0 { + return nil, nil, ErrInvalidPublicKey + } + + return +} + +// Verify verifies the signature in r, s of hash using the public key, pub. It +// reports whether the signature is valid. +// +// Note that FIPS 186-3 section 4.6 specifies that the hash should be truncated +// to the byte-length of the subgroup. This function does not perform that +// truncation itself. +func Verify(pub *PublicKey, hash []byte, r, s *big.Int) bool { + if fips140only.Enforced() { + panic("crypto/dsa: use of DSA is not allowed in FIPS 140-only mode") + } + + // FIPS 186-3, section 4.7 + + if pub.P.Sign() == 0 { + return false + } + + if r.Sign() < 1 || r.Cmp(pub.Q) >= 0 { + return false + } + if s.Sign() < 1 || s.Cmp(pub.Q) >= 0 { + return false + } + + w := new(big.Int).ModInverse(s, pub.Q) + if w == nil { + return false + } + + n := pub.Q.BitLen() + if n%8 != 0 { + return false + } + z := new(big.Int).SetBytes(hash) + + u1 := new(big.Int).Mul(z, w) + u1.Mod(u1, pub.Q) + u2 := w.Mul(r, w) + u2.Mod(u2, pub.Q) + v := u1.Exp(pub.G, u1, pub.P) + u2.Exp(pub.Y, u2, pub.P) + v.Mul(v, u2) + v.Mod(v, pub.P) + v.Mod(v, pub.Q) + + return v.Cmp(r) == 0 +} diff --git a/go/src/crypto/dsa/dsa_test.go b/go/src/crypto/dsa/dsa_test.go new file mode 100644 index 0000000000000000000000000000000000000000..ad85eac0a7f0b1182bc5c0077c091523464e34fa --- /dev/null +++ b/go/src/crypto/dsa/dsa_test.go @@ -0,0 +1,144 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package dsa + +import ( + "crypto/rand" + "math/big" + "testing" +) + +func testSignAndVerify(t *testing.T, i int, priv *PrivateKey) { + hashed := []byte("testing") + r, s, err := Sign(rand.Reader, priv, hashed) + if err != nil { + t.Errorf("%d: error signing: %s", i, err) + return + } + + if !Verify(&priv.PublicKey, hashed, r, s) { + t.Errorf("%d: Verify failed", i) + } +} + +func testParameterGeneration(t *testing.T, sizes ParameterSizes, L, N int) { + t.Helper() + var priv PrivateKey + params := &priv.Parameters + + err := GenerateParameters(params, rand.Reader, sizes) + if err != nil { + t.Errorf("%d: %s", int(sizes), err) + return + } + + if params.P.BitLen() != L { + t.Errorf("%d: params.BitLen got:%d want:%d", int(sizes), params.P.BitLen(), L) + } + + if params.Q.BitLen() != N { + t.Errorf("%d: q.BitLen got:%d want:%d", int(sizes), params.Q.BitLen(), L) + } + + one := new(big.Int) + one.SetInt64(1) + pm1 := new(big.Int).Sub(params.P, one) + quo, rem := new(big.Int).DivMod(pm1, params.Q, new(big.Int)) + if rem.Sign() != 0 { + t.Errorf("%d: p-1 mod q != 0", int(sizes)) + } + x := new(big.Int).Exp(params.G, quo, params.P) + if x.Cmp(one) == 0 { + t.Errorf("%d: invalid generator", int(sizes)) + } + + err = GenerateKey(&priv, rand.Reader) + if err != nil { + t.Errorf("error generating key: %s", err) + return + } + + testSignAndVerify(t, int(sizes), &priv) +} + +func TestParameterGeneration(t *testing.T) { + if testing.Short() { + t.Skip("skipping parameter generation test in short mode") + } + + testParameterGeneration(t, L1024N160, 1024, 160) + testParameterGeneration(t, L2048N224, 2048, 224) + testParameterGeneration(t, L2048N256, 2048, 256) + testParameterGeneration(t, L3072N256, 3072, 256) +} + +func fromHex(s string) *big.Int { + result, ok := new(big.Int).SetString(s, 16) + if !ok { + panic(s) + } + return result +} + +func TestSignAndVerify(t *testing.T) { + priv := PrivateKey{ + PublicKey: PublicKey{ + Parameters: Parameters{ + P: fromHex("A9B5B793FB4785793D246BAE77E8FF63CA52F442DA763C440259919FE1BC1D6065A9350637A04F75A2F039401D49F08E066C4D275A5A65DA5684BC563C14289D7AB8A67163BFBF79D85972619AD2CFF55AB0EE77A9002B0EF96293BDD0F42685EBB2C66C327079F6C98000FBCB79AACDE1BC6F9D5C7B1A97E3D9D54ED7951FEF"), + Q: fromHex("E1D3391245933D68A0714ED34BBCB7A1F422B9C1"), + G: fromHex("634364FC25248933D01D1993ECABD0657CC0CB2CEED7ED2E3E8AECDFCDC4A25C3B15E9E3B163ACA2984B5539181F3EFF1A5E8903D71D5B95DA4F27202B77D2C44B430BB53741A8D59A8F86887525C9F2A6A5980A195EAA7F2FF910064301DEF89D3AA213E1FAC7768D89365318E370AF54A112EFBA9246D9158386BA1B4EEFDA"), + }, + Y: fromHex("32969E5780CFE1C849A1C276D7AEB4F38A23B591739AA2FE197349AEEBD31366AEE5EB7E6C6DDB7C57D02432B30DB5AA66D9884299FAA72568944E4EEDC92EA3FBC6F39F53412FBCC563208F7C15B737AC8910DBC2D9C9B8C001E72FDC40EB694AB1F06A5A2DBD18D9E36C66F31F566742F11EC0A52E9F7B89355C02FB5D32D2"), + }, + X: fromHex("5078D4D29795CBE76D3AACFE48C9AF0BCDBEE91A"), + } + + testSignAndVerify(t, 0, &priv) +} + +func TestSignAndVerifyWithBadPublicKey(t *testing.T) { + pub := PublicKey{ + Parameters: Parameters{ + P: fromHex("A9B5B793FB4785793D246BAE77E8FF63CA52F442DA763C440259919FE1BC1D6065A9350637A04F75A2F039401D49F08E066C4D275A5A65DA5684BC563C14289D7AB8A67163BFBF79D85972619AD2CFF55AB0EE77A9002B0EF96293BDD0F42685EBB2C66C327079F6C98000FBCB79AACDE1BC6F9D5C7B1A97E3D9D54ED7951FEF"), + Q: fromHex("FA"), + G: fromHex("634364FC25248933D01D1993ECABD0657CC0CB2CEED7ED2E3E8AECDFCDC4A25C3B15E9E3B163ACA2984B5539181F3EFF1A5E8903D71D5B95DA4F27202B77D2C44B430BB53741A8D59A8F86887525C9F2A6A5980A195EAA7F2FF910064301DEF89D3AA213E1FAC7768D89365318E370AF54A112EFBA9246D9158386BA1B4EEFDA"), + }, + Y: fromHex("32969E5780CFE1C849A1C276D7AEB4F38A23B591739AA2FE197349AEEBD31366AEE5EB7E6C6DDB7C57D02432B30DB5AA66D9884299FAA72568944E4EEDC92EA3FBC6F39F53412FBCC563208F7C15B737AC8910DBC2D9C9B8C001E72FDC40EB694AB1F06A5A2DBD18D9E36C66F31F566742F11EC0A52E9F7B89355C02FB5D32D2"), + } + + if Verify(&pub, []byte("testing"), fromHex("2"), fromHex("4")) { + t.Errorf("Verify unexpected success with non-existent mod inverse of Q") + } +} + +func TestSigningWithDegenerateKeys(t *testing.T) { + // Signing with degenerate private keys should not cause an infinite + // loop. + badKeys := []struct { + p, q, g, y, x string + }{ + {"00", "01", "00", "00", "00"}, + {"01", "ff", "00", "00", "00"}, + } + + for i, test := range badKeys { + priv := PrivateKey{ + PublicKey: PublicKey{ + Parameters: Parameters{ + P: fromHex(test.p), + Q: fromHex(test.q), + G: fromHex(test.g), + }, + Y: fromHex(test.y), + }, + X: fromHex(test.x), + } + + hashed := []byte("testing") + if _, _, err := Sign(rand.Reader, &priv, hashed); err == nil { + t.Errorf("#%d: unexpected success", i) + } + } +} diff --git a/go/src/crypto/ecdh/ecdh.go b/go/src/crypto/ecdh/ecdh.go new file mode 100644 index 0000000000000000000000000000000000000000..3f85a2833697a9fb0b5b9d2de21a5240cd3e8452 --- /dev/null +++ b/go/src/crypto/ecdh/ecdh.go @@ -0,0 +1,174 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package ecdh implements Elliptic Curve Diffie-Hellman over +// NIST curves and Curve25519. +package ecdh + +import ( + "crypto" + "crypto/internal/boring" + "crypto/internal/fips140/ecdh" + "crypto/subtle" + "errors" + "io" +) + +type Curve interface { + // GenerateKey generates a random PrivateKey. + // + // Since Go 1.26, a secure source of random bytes is always used, and rand + // is ignored unless GODEBUG=cryptocustomrand=1 is set. This setting will be + // removed in a future Go release. Instead, use [testing/cryptotest.SetGlobalRandom]. + GenerateKey(rand io.Reader) (*PrivateKey, error) + + // NewPrivateKey checks that key is valid and returns a PrivateKey. + // + // For NIST curves, this follows SEC 1, Version 2.0, Section 2.3.6, which + // amounts to decoding the bytes as a fixed length big endian integer and + // checking that the result is lower than the order of the curve. The zero + // private key is also rejected, as the encoding of the corresponding public + // key would be irregular. + // + // For X25519, this only checks the scalar length. + NewPrivateKey(key []byte) (*PrivateKey, error) + + // NewPublicKey checks that key is valid and returns a PublicKey. + // + // For NIST curves, this decodes an uncompressed point according to SEC 1, + // Version 2.0, Section 2.3.4. Compressed encodings and the point at + // infinity are rejected. + // + // For X25519, this only checks the u-coordinate length. Adversarially + // selected public keys can cause ECDH to return an error. + NewPublicKey(key []byte) (*PublicKey, error) + + // ecdh performs an ECDH exchange and returns the shared secret. It's exposed + // as the PrivateKey.ECDH method. + // + // The private method also allow us to expand the ECDH interface with more + // methods in the future without breaking backwards compatibility. + ecdh(local *PrivateKey, remote *PublicKey) ([]byte, error) +} + +// PublicKey is an ECDH public key, usually a peer's ECDH share sent over the wire. +// +// These keys can be parsed with [crypto/x509.ParsePKIXPublicKey] and encoded +// with [crypto/x509.MarshalPKIXPublicKey]. For NIST curves, they then need to +// be converted with [crypto/ecdsa.PublicKey.ECDH] after parsing. +type PublicKey struct { + curve Curve + publicKey []byte + boring *boring.PublicKeyECDH + fips *ecdh.PublicKey +} + +// Bytes returns a copy of the encoding of the public key. +func (k *PublicKey) Bytes() []byte { + // Copy the public key to a fixed size buffer that can get allocated on the + // caller's stack after inlining. + var buf [133]byte + return append(buf[:0], k.publicKey...) +} + +// Equal returns whether x represents the same public key as k. +// +// Note that there can be equivalent public keys with different encodings which +// would return false from this check but behave the same way as inputs to ECDH. +// +// This check is performed in constant time as long as the key types and their +// curve match. +func (k *PublicKey) Equal(x crypto.PublicKey) bool { + xx, ok := x.(*PublicKey) + if !ok { + return false + } + return k.curve == xx.curve && + subtle.ConstantTimeCompare(k.publicKey, xx.publicKey) == 1 +} + +func (k *PublicKey) Curve() Curve { + return k.curve +} + +// KeyExchanger is an interface for an opaque private key that can be used for +// key exchange operations. For example, an ECDH key kept in a hardware module. +// +// It is implemented by [PrivateKey]. +type KeyExchanger interface { + PublicKey() *PublicKey + Curve() Curve + ECDH(*PublicKey) ([]byte, error) +} + +var _ KeyExchanger = (*PrivateKey)(nil) + +// PrivateKey is an ECDH private key, usually kept secret. +// +// These keys can be parsed with [crypto/x509.ParsePKCS8PrivateKey] and encoded +// with [crypto/x509.MarshalPKCS8PrivateKey]. For NIST curves, they then need to +// be converted with [crypto/ecdsa.PrivateKey.ECDH] after parsing. +type PrivateKey struct { + curve Curve + privateKey []byte + publicKey *PublicKey + boring *boring.PrivateKeyECDH + fips *ecdh.PrivateKey +} + +// ECDH performs an ECDH exchange and returns the shared secret. The [PrivateKey] +// and [PublicKey] must use the same curve. +// +// For NIST curves, this performs ECDH as specified in SEC 1, Version 2.0, +// Section 3.3.1, and returns the x-coordinate encoded according to SEC 1, +// Version 2.0, Section 2.3.5. The result is never the point at infinity. +// This is also known as the Shared Secret Computation of the Ephemeral Unified +// Model scheme specified in NIST SP 800-56A Rev. 3, Section 6.1.2.2. +// +// For [X25519], this performs ECDH as specified in RFC 7748, Section 6.1. If +// the result is the all-zero value, ECDH returns an error. +func (k *PrivateKey) ECDH(remote *PublicKey) ([]byte, error) { + if k.curve != remote.curve { + return nil, errors.New("crypto/ecdh: private key and public key curves do not match") + } + return k.curve.ecdh(k, remote) +} + +// Bytes returns a copy of the encoding of the private key. +func (k *PrivateKey) Bytes() []byte { + // Copy the private key to a fixed size buffer that can get allocated on the + // caller's stack after inlining. + var buf [66]byte + return append(buf[:0], k.privateKey...) +} + +// Equal returns whether x represents the same private key as k. +// +// Note that there can be equivalent private keys with different encodings which +// would return false from this check but behave the same way as inputs to [ECDH]. +// +// This check is performed in constant time as long as the key types and their +// curve match. +func (k *PrivateKey) Equal(x crypto.PrivateKey) bool { + xx, ok := x.(*PrivateKey) + if !ok { + return false + } + return k.curve == xx.curve && + subtle.ConstantTimeCompare(k.privateKey, xx.privateKey) == 1 +} + +func (k *PrivateKey) Curve() Curve { + return k.curve +} + +func (k *PrivateKey) PublicKey() *PublicKey { + return k.publicKey +} + +// Public implements the implicit interface of all standard library private +// keys. See the docs of [crypto.PrivateKey]. +func (k *PrivateKey) Public() crypto.PublicKey { + return k.PublicKey() +} diff --git a/go/src/crypto/ecdh/ecdh_test.go b/go/src/crypto/ecdh/ecdh_test.go new file mode 100644 index 0000000000000000000000000000000000000000..cfa919ade97ad06be3096fdbe7fb7fb549a6d0a2 --- /dev/null +++ b/go/src/crypto/ecdh/ecdh_test.go @@ -0,0 +1,527 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package ecdh_test + +import ( + "bytes" + "crypto" + "crypto/cipher" + "crypto/ecdh" + "crypto/rand" + "crypto/sha256" + "encoding/hex" + "fmt" + "internal/testenv" + "io" + "os" + "path/filepath" + "regexp" + "strings" + "testing" + + "golang.org/x/crypto/chacha20" +) + +// Check that PublicKey and PrivateKey implement the interfaces documented in +// crypto.PublicKey and crypto.PrivateKey. +var _ interface { + Equal(x crypto.PublicKey) bool +} = &ecdh.PublicKey{} +var _ interface { + Public() crypto.PublicKey + Equal(x crypto.PrivateKey) bool +} = &ecdh.PrivateKey{} + +func TestECDH(t *testing.T) { + testAllCurves(t, func(t *testing.T, curve ecdh.Curve) { + aliceKey, err := curve.GenerateKey(rand.Reader) + if err != nil { + t.Fatal(err) + } + bobKey, err := curve.GenerateKey(rand.Reader) + if err != nil { + t.Fatal(err) + } + + alicePubKey, err := curve.NewPublicKey(aliceKey.PublicKey().Bytes()) + if err != nil { + t.Error(err) + } + if !bytes.Equal(aliceKey.PublicKey().Bytes(), alicePubKey.Bytes()) { + t.Error("encoded and decoded public keys are different") + } + if !aliceKey.PublicKey().Equal(alicePubKey) { + t.Error("encoded and decoded public keys are different") + } + + alicePrivKey, err := curve.NewPrivateKey(aliceKey.Bytes()) + if err != nil { + t.Error(err) + } + if !bytes.Equal(aliceKey.Bytes(), alicePrivKey.Bytes()) { + t.Error("encoded and decoded private keys are different") + } + if !aliceKey.Equal(alicePrivKey) { + t.Error("encoded and decoded private keys are different") + } + + bobSecret, err := bobKey.ECDH(aliceKey.PublicKey()) + if err != nil { + t.Fatal(err) + } + aliceSecret, err := aliceKey.ECDH(bobKey.PublicKey()) + if err != nil { + t.Fatal(err) + } + + if !bytes.Equal(bobSecret, aliceSecret) { + t.Error("two ECDH computations came out different") + } + }) +} + +type countingReader struct { + r io.Reader + n int +} + +func (r *countingReader) Read(p []byte) (int, error) { + n, err := r.r.Read(p) + r.n += n + return n, err +} + +func TestGenerateKey(t *testing.T) { + testAllCurves(t, func(t *testing.T, curve ecdh.Curve) { + r := &countingReader{r: rand.Reader} + k, err := curve.GenerateKey(r) + if err != nil { + t.Fatal(err) + } + + // GenerateKey does rejection sampling. If the masking works correctly, + // the probability of a rejection is 1-ord(G)/2^ceil(log2(ord(G))), + // which for all curves is small enough (at most 2^-32, for P-256) that + // a bit flip is more likely to make this test fail than bad luck. + // Account for the extra MaybeReadByte byte, too. + if got, expected := r.n, len(k.Bytes())+1; got > expected { + t.Errorf("expected GenerateKey to consume at most %v bytes, got %v", expected, got) + } + }) +} + +var vectors = map[ecdh.Curve]struct { + PrivateKey, PublicKey string + PeerPublicKey string + SharedSecret string +}{ + // NIST vectors from CAVS 14.1, ECC CDH Primitive (SP800-56A). + ecdh.P256(): { + PrivateKey: "7d7dc5f71eb29ddaf80d6214632eeae03d9058af1fb6d22ed80badb62bc1a534", + PublicKey: "04ead218590119e8876b29146ff89ca61770c4edbbf97d38ce385ed281d8a6b230" + + "28af61281fd35e2fa7002523acc85a429cb06ee6648325389f59edfce1405141", + PeerPublicKey: "04700c48f77f56584c5cc632ca65640db91b6bacce3a4df6b42ce7cc838833d287" + + "db71e509e3fd9b060ddb20ba5c51dcc5948d46fbf640dfe0441782cab85fa4ac", + SharedSecret: "46fc62106420ff012e54a434fbdd2d25ccc5852060561e68040dd7778997bd7b", + }, + ecdh.P384(): { + PrivateKey: "3cc3122a68f0d95027ad38c067916ba0eb8c38894d22e1b15618b6818a661774ad463b205da88cf699ab4d43c9cf98a1", + PublicKey: "049803807f2f6d2fd966cdd0290bd410c0190352fbec7ff6247de1302df86f25d34fe4a97bef60cff548355c015dbb3e5f" + + "ba26ca69ec2f5b5d9dad20cc9da711383a9dbe34ea3fa5a2af75b46502629ad54dd8b7d73a8abb06a3a3be47d650cc99", + PeerPublicKey: "04a7c76b970c3b5fe8b05d2838ae04ab47697b9eaf52e764592efda27fe7513272734466b400091adbf2d68c58e0c50066" + + "ac68f19f2e1cb879aed43a9969b91a0839c4c38a49749b661efedf243451915ed0905a32b060992b468c64766fc8437a", + SharedSecret: "5f9d29dc5e31a163060356213669c8ce132e22f57c9a04f40ba7fcead493b457e5621e766c40a2e3d4d6a04b25e533f1", + }, + // For some reason all field elements in the test vector (both scalars and + // base field elements), but not the shared secret output, have two extra + // leading zero bytes (which in big-endian are irrelevant). Removed here. + ecdh.P521(): { + PrivateKey: "017eecc07ab4b329068fba65e56a1f8890aa935e57134ae0ffcce802735151f4eac6564f6ee9974c5e6887a1fefee5743ae2241bfeb95d5ce31ddcb6f9edb4d6fc47", + PublicKey: "0400602f9d0cf9e526b29e22381c203c48a886c2b0673033366314f1ffbcba240ba42f4ef38a76174635f91e6b4ed34275eb01c8467d05ca80315bf1a7bbd945f550a5" + + "01b7c85f26f5d4b2d7355cf6b02117659943762b6d1db5ab4f1dbc44ce7b2946eb6c7de342962893fd387d1b73d7a8672d1f236961170b7eb3579953ee5cdc88cd2d", + PeerPublicKey: "0400685a48e86c79f0f0875f7bc18d25eb5fc8c0b07e5da4f4370f3a9490340854334b1e1b87fa395464c60626124a4e70d0f785601d37c09870ebf176666877a2046d" + + "01ba52c56fc8776d9e8f5db4f0cc27636d0b741bbe05400697942e80b739884a83bde99e0f6716939e632bc8986fa18dccd443a348b6c3e522497955a4f3c302f676", + SharedSecret: "005fc70477c3e63bc3954bd0df3ea0d1f41ee21746ed95fc5e1fdf90930d5e136672d72cc770742d1711c3c3a4c334a0ad9759436a4d3c5bf6e74b9578fac148c831", + }, + // X25519 test vector from RFC 7748, Section 6.1. + ecdh.X25519(): { + PrivateKey: "77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a", + PublicKey: "8520f0098930a754748b7ddcb43ef75a0dbf3a0d26381af4eba4a98eaa9b4e6a", + PeerPublicKey: "de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f", + SharedSecret: "4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742", + }, +} + +func TestVectors(t *testing.T) { + testAllCurves(t, func(t *testing.T, curve ecdh.Curve) { + v := vectors[curve] + key, err := curve.NewPrivateKey(hexDecode(t, v.PrivateKey)) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(key.PublicKey().Bytes(), hexDecode(t, v.PublicKey)) { + t.Error("public key derived from the private key does not match") + } + peer, err := curve.NewPublicKey(hexDecode(t, v.PeerPublicKey)) + if err != nil { + t.Fatal(err) + } + secret, err := key.ECDH(peer) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(secret, hexDecode(t, v.SharedSecret)) { + t.Errorf("shared secret does not match: %x %x %s %x", secret, sha256.Sum256(secret), v.SharedSecret, + sha256.Sum256(hexDecode(t, v.SharedSecret))) + } + }) +} + +func hexDecode(t *testing.T, s string) []byte { + b, err := hex.DecodeString(s) + if err != nil { + t.Fatal("invalid hex string:", s) + } + return b +} + +func TestString(t *testing.T) { + testAllCurves(t, func(t *testing.T, curve ecdh.Curve) { + s := fmt.Sprintf("%s", curve) + if s[:1] != "P" && s[:1] != "X" { + t.Errorf("unexpected Curve string encoding: %q", s) + } + }) +} + +func TestX25519Failure(t *testing.T) { + identity := hexDecode(t, "0000000000000000000000000000000000000000000000000000000000000000") + lowOrderPoint := hexDecode(t, "e0eb7a7c3b41b8ae1656e3faf19fc46ada098deb9c32b1fd866205165f49b800") + randomScalar := make([]byte, 32) + rand.Read(randomScalar) + + t.Run("identity point", func(t *testing.T) { testX25519Failure(t, randomScalar, identity) }) + t.Run("low order point", func(t *testing.T) { testX25519Failure(t, randomScalar, lowOrderPoint) }) +} + +func testX25519Failure(t *testing.T, private, public []byte) { + priv, err := ecdh.X25519().NewPrivateKey(private) + if err != nil { + t.Fatal(err) + } + pub, err := ecdh.X25519().NewPublicKey(public) + if err != nil { + t.Fatal(err) + } + secret, err := priv.ECDH(pub) + if err == nil { + t.Error("expected ECDH error") + } + if secret != nil { + t.Errorf("unexpected ECDH output: %x", secret) + } +} + +var invalidPrivateKeys = map[ecdh.Curve][]string{ + ecdh.P256(): { + // Bad lengths. + "", + "01", + "01010101010101010101010101010101010101010101010101010101010101", + "000101010101010101010101010101010101010101010101010101010101010101", + strings.Repeat("01", 200), + // Zero. + "0000000000000000000000000000000000000000000000000000000000000000", + // Order of the curve and above. + "ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551", + "ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632552", + "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + }, + ecdh.P384(): { + // Bad lengths. + "", + "01", + "0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101", + "00010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101", + strings.Repeat("01", 200), + // Zero. + "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + // Order of the curve and above. + "ffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973", + "ffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52974", + "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + }, + ecdh.P521(): { + // Bad lengths. + "", + "01", + "0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101", + "00010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101", + strings.Repeat("01", 200), + // Zero. + "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + // Order of the curve and above. + "01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409", + "01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e9138640a", + "11fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409", + "03fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff4a30d0f077e5f2cd6ff980291ee134ba0776b937113388f5d76df6e3d2270c812", + }, + ecdh.X25519(): { + // X25519 only rejects bad lengths. + "", + "01", + "01010101010101010101010101010101010101010101010101010101010101", + "000101010101010101010101010101010101010101010101010101010101010101", + strings.Repeat("01", 200), + }, +} + +func TestNewPrivateKey(t *testing.T) { + testAllCurves(t, func(t *testing.T, curve ecdh.Curve) { + for _, input := range invalidPrivateKeys[curve] { + k, err := curve.NewPrivateKey(hexDecode(t, input)) + if err == nil { + t.Errorf("unexpectedly accepted %q", input) + } else if k != nil { + t.Error("PrivateKey was not nil on error") + } else if strings.Contains(err.Error(), "boringcrypto") { + t.Errorf("boringcrypto error leaked out: %v", err) + } + } + }) +} + +var invalidPublicKeys = map[ecdh.Curve][]string{ + ecdh.P256(): { + // Bad lengths. + "", + "04", + strings.Repeat("04", 200), + // Infinity. + "00", + // Compressed encodings. + "036b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296", + "02e2534a3532d08fbba02dde659ee62bd0031fe2db785596ef509302446b030852", + // Points not on the curve. + "046b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c2964fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f6", + "0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + // Non-canonical encoding. + "04ffffffff00000001000000000000000000000001000000000000000000000004ba6dbc4555a7e7fa016ec431667e8521ee35afc49b265c3accbea3f7cdb70433", + }, + ecdh.P384(): { + // Bad lengths. + "", + "04", + strings.Repeat("04", 200), + // Infinity. + "00", + // Compressed encodings. + "03aa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7", + "0208d999057ba3d2d969260045c55b97f089025959a6f434d651d207d19fb96e9e4fe0e86ebe0e64f85b96a9c75295df61", + // Points not on the curve. + "04aa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab73617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e60", + "04000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + // Non-canonical encoding. + "04fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff000000000000000100000001732152442fb6ee5c3e6ce1d920c059bc623563814d79042b903ce60f1d4487fccd450a86da03f3e6ed525d02017bfdb3", + }, + ecdh.P521(): { + // Bad lengths. + "", + "04", + strings.Repeat("04", 200), + // Infinity. + "00", + // Compressed encodings. + "030035b5df64ae2ac204c354b483487c9070cdc61c891c5ff39afc06c5d55541d3ceac8659e24afe3d0750e8b88e9f078af066a1d5025b08e5a5e2fbc87412871902f3", + "0200c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66", + // Points not on the curve. + "0400c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16651", + "04000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + // Non-canonical encoding. + "0402000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100d9254fdf800496acb33790b103c5ee9fac12832fe546c632225b0f7fce3da4574b1a879b623d722fa8fc34d5fc2a8731aad691a9a8bb8b554c95a051d6aa505acf", + }, + ecdh.X25519(): {}, +} + +func TestNewPublicKey(t *testing.T) { + testAllCurves(t, func(t *testing.T, curve ecdh.Curve) { + for _, input := range invalidPublicKeys[curve] { + k, err := curve.NewPublicKey(hexDecode(t, input)) + if err == nil { + t.Errorf("unexpectedly accepted %q", input) + } else if k != nil { + t.Error("PublicKey was not nil on error") + } else if strings.Contains(err.Error(), "boringcrypto") { + t.Errorf("boringcrypto error leaked out: %v", err) + } + } + }) +} + +func testAllCurves(t *testing.T, f func(t *testing.T, curve ecdh.Curve)) { + t.Run("P256", func(t *testing.T) { f(t, ecdh.P256()) }) + t.Run("P384", func(t *testing.T) { f(t, ecdh.P384()) }) + t.Run("P521", func(t *testing.T) { f(t, ecdh.P521()) }) + t.Run("X25519", func(t *testing.T) { f(t, ecdh.X25519()) }) +} + +func BenchmarkECDH(b *testing.B) { + benchmarkAllCurves(b, func(b *testing.B, curve ecdh.Curve) { + c, err := chacha20.NewUnauthenticatedCipher(make([]byte, 32), make([]byte, 12)) + if err != nil { + b.Fatal(err) + } + rand := cipher.StreamReader{ + S: c, R: zeroReader, + } + + peerKey, err := curve.GenerateKey(rand) + if err != nil { + b.Fatal(err) + } + peerShare := peerKey.PublicKey().Bytes() + b.ResetTimer() + b.ReportAllocs() + + var allocationsSink byte + + for i := 0; i < b.N; i++ { + key, err := curve.GenerateKey(rand) + if err != nil { + b.Fatal(err) + } + share := key.PublicKey().Bytes() + peerPubKey, err := curve.NewPublicKey(peerShare) + if err != nil { + b.Fatal(err) + } + secret, err := key.ECDH(peerPubKey) + if err != nil { + b.Fatal(err) + } + allocationsSink ^= secret[0] ^ share[0] + } + }) +} + +func benchmarkAllCurves(b *testing.B, f func(b *testing.B, curve ecdh.Curve)) { + b.Run("P256", func(b *testing.B) { f(b, ecdh.P256()) }) + b.Run("P384", func(b *testing.B) { f(b, ecdh.P384()) }) + b.Run("P521", func(b *testing.B) { f(b, ecdh.P521()) }) + b.Run("X25519", func(b *testing.B) { f(b, ecdh.X25519()) }) +} + +type zr struct{} + +// Read replaces the contents of dst with zeros. It is safe for concurrent use. +func (zr) Read(dst []byte) (n int, err error) { + clear(dst) + return len(dst), nil +} + +var zeroReader = zr{} + +const linkerTestProgram = ` +package main +import "crypto/ecdh" +import "crypto/rand" +func main() { + // Use P-256, since that's what the always-enabled CAST uses. + curve := ecdh.P256() + key, err := curve.GenerateKey(rand.Reader) + if err != nil { panic(err) } + _, err = curve.NewPublicKey(key.PublicKey().Bytes()) + if err != nil { panic(err) } + _, err = curve.NewPrivateKey(key.Bytes()) + if err != nil { panic(err) } + _, err = key.ECDH(key.PublicKey()) + if err != nil { panic(err) } + println("OK") +} +` + +// TestLinker ensures that using one curve does not bring all other +// implementations into the binary. This also guarantees that govulncheck can +// avoid warning about a curve-specific vulnerability if that curve is not used. +func TestLinker(t *testing.T) { + if testing.Short() { + t.Skip("test requires running 'go build'") + } + + dir := t.TempDir() + hello := filepath.Join(dir, "hello.go") + err := os.WriteFile(hello, []byte(linkerTestProgram), 0664) + if err != nil { + t.Fatal(err) + } + + run := func(args ...string) string { + cmd := testenv.Command(t, args[0], args[1:]...) + cmd.Dir = dir + out, err := testenv.CleanCmdEnv(cmd).CombinedOutput() + if err != nil { + t.Fatalf("%v: %v\n%s", args, err, string(out)) + } + return string(out) + } + + run(testenv.GoToolPath(t), "build", "-o", "hello.exe", "hello.go") + if out := run("./hello.exe"); out != "OK\n" { + t.Error("unexpected output:", out) + } + + // List all text symbols under crypto/... and make sure there are some for + // P256, but none for the other curves. + var consistent bool + nm := run(testenv.GoToolPath(t), "tool", "nm", "hello.exe") + for _, match := range regexp.MustCompile(`(?m)T (crypto/.*)$`).FindAllStringSubmatch(nm, -1) { + symbol := strings.ToLower(match[1]) + if strings.Contains(symbol, "p256") { + consistent = true + } + if strings.Contains(symbol, "p224") || strings.Contains(symbol, "p384") || strings.Contains(symbol, "p521") { + t.Errorf("unexpected symbol in program using only ecdh.P256: %s", match[1]) + } + } + if !consistent { + t.Error("no P256 symbols found in program using ecdh.P256, test is broken") + } +} + +func TestMismatchedCurves(t *testing.T) { + curves := []struct { + name string + curve ecdh.Curve + }{ + {"P256", ecdh.P256()}, + {"P384", ecdh.P384()}, + {"P521", ecdh.P521()}, + {"X25519", ecdh.X25519()}, + } + + for _, privCurve := range curves { + priv, err := privCurve.curve.GenerateKey(rand.Reader) + if err != nil { + t.Fatalf("failed to generate test key: %s", err) + } + + for _, pubCurve := range curves { + if privCurve == pubCurve { + continue + } + t.Run(fmt.Sprintf("%s/%s", privCurve.name, pubCurve.name), func(t *testing.T) { + pub, err := pubCurve.curve.GenerateKey(rand.Reader) + if err != nil { + t.Fatalf("failed to generate test key: %s", err) + } + expected := "crypto/ecdh: private key and public key curves do not match" + _, err = priv.ECDH(pub.PublicKey()) + if err.Error() != expected { + t.Fatalf("unexpected error: want %q, got %q", expected, err) + } + }) + } + } +} diff --git a/go/src/crypto/ecdh/nist.go b/go/src/crypto/ecdh/nist.go new file mode 100644 index 0000000000000000000000000000000000000000..13865ea70129895ce10a56f303ac465be0944de9 --- /dev/null +++ b/go/src/crypto/ecdh/nist.go @@ -0,0 +1,227 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package ecdh + +import ( + "bytes" + "crypto/internal/boring" + "crypto/internal/fips140/ecdh" + "crypto/internal/fips140only" + "crypto/internal/rand" + "errors" + "io" +) + +type nistCurve struct { + name string + generate func(io.Reader) (*ecdh.PrivateKey, error) + newPrivateKey func([]byte) (*ecdh.PrivateKey, error) + newPublicKey func(publicKey []byte) (*ecdh.PublicKey, error) + sharedSecret func(*ecdh.PrivateKey, *ecdh.PublicKey) (sharedSecret []byte, err error) +} + +func (c *nistCurve) String() string { + return c.name +} + +func (c *nistCurve) GenerateKey(r io.Reader) (*PrivateKey, error) { + if boring.Enabled && rand.IsDefaultReader(r) { + key, bytes, err := boring.GenerateKeyECDH(c.name) + if err != nil { + return nil, err + } + pub, err := key.PublicKey() + if err != nil { + return nil, err + } + k := &PrivateKey{ + curve: c, + privateKey: bytes, + publicKey: &PublicKey{curve: c, publicKey: pub.Bytes(), boring: pub}, + boring: key, + } + return k, nil + } + + r = rand.CustomReader(r) + + if fips140only.Enforced() && !fips140only.ApprovedRandomReader(r) { + return nil, errors.New("crypto/ecdh: only crypto/rand.Reader is allowed in FIPS 140-only mode") + } + + privateKey, err := c.generate(r) + if err != nil { + return nil, err + } + + k := &PrivateKey{ + curve: c, + privateKey: privateKey.Bytes(), + fips: privateKey, + publicKey: &PublicKey{ + curve: c, + publicKey: privateKey.PublicKey().Bytes(), + fips: privateKey.PublicKey(), + }, + } + if boring.Enabled { + bk, err := boring.NewPrivateKeyECDH(c.name, k.privateKey) + if err != nil { + return nil, err + } + pub, err := bk.PublicKey() + if err != nil { + return nil, err + } + k.boring = bk + k.publicKey.boring = pub + } + return k, nil +} + +func (c *nistCurve) NewPrivateKey(key []byte) (*PrivateKey, error) { + if boring.Enabled { + bk, err := boring.NewPrivateKeyECDH(c.name, key) + if err != nil { + return nil, errors.New("crypto/ecdh: invalid private key") + } + pub, err := bk.PublicKey() + if err != nil { + return nil, errors.New("crypto/ecdh: invalid private key") + } + k := &PrivateKey{ + curve: c, + privateKey: bytes.Clone(key), + publicKey: &PublicKey{curve: c, publicKey: pub.Bytes(), boring: pub}, + boring: bk, + } + return k, nil + } + + fk, err := c.newPrivateKey(key) + if err != nil { + return nil, err + } + k := &PrivateKey{ + curve: c, + privateKey: bytes.Clone(key), + fips: fk, + publicKey: &PublicKey{ + curve: c, + publicKey: fk.PublicKey().Bytes(), + fips: fk.PublicKey(), + }, + } + return k, nil +} + +func (c *nistCurve) NewPublicKey(key []byte) (*PublicKey, error) { + // Reject the point at infinity and compressed encodings. + // Note that boring.NewPublicKeyECDH would accept them. + if len(key) == 0 || key[0] != 4 { + return nil, errors.New("crypto/ecdh: invalid public key") + } + k := &PublicKey{ + curve: c, + publicKey: bytes.Clone(key), + } + if boring.Enabled { + bk, err := boring.NewPublicKeyECDH(c.name, k.publicKey) + if err != nil { + return nil, errors.New("crypto/ecdh: invalid public key") + } + k.boring = bk + } else { + fk, err := c.newPublicKey(key) + if err != nil { + return nil, err + } + k.fips = fk + } + return k, nil +} + +func (c *nistCurve) ecdh(local *PrivateKey, remote *PublicKey) ([]byte, error) { + // Note that this function can't return an error, as NewPublicKey rejects + // invalid points and the point at infinity, and NewPrivateKey rejects + // invalid scalars and the zero value. BytesX returns an error for the point + // at infinity, but in a prime order group such as the NIST curves that can + // only be the result of a scalar multiplication if one of the inputs is the + // zero scalar or the point at infinity. + + if boring.Enabled { + return boring.ECDH(local.boring, remote.boring) + } + return c.sharedSecret(local.fips, remote.fips) +} + +// P256 returns a [Curve] which implements NIST P-256 (FIPS 186-3, section D.2.3), +// also known as secp256r1 or prime256v1. +// +// Multiple invocations of this function will return the same value, which can +// be used for equality checks and switch statements. +func P256() Curve { return p256 } + +var p256 = &nistCurve{ + name: "P-256", + generate: func(r io.Reader) (*ecdh.PrivateKey, error) { + return ecdh.GenerateKey(ecdh.P256(), r) + }, + newPrivateKey: func(b []byte) (*ecdh.PrivateKey, error) { + return ecdh.NewPrivateKey(ecdh.P256(), b) + }, + newPublicKey: func(publicKey []byte) (*ecdh.PublicKey, error) { + return ecdh.NewPublicKey(ecdh.P256(), publicKey) + }, + sharedSecret: func(priv *ecdh.PrivateKey, pub *ecdh.PublicKey) (sharedSecret []byte, err error) { + return ecdh.ECDH(ecdh.P256(), priv, pub) + }, +} + +// P384 returns a [Curve] which implements NIST P-384 (FIPS 186-3, section D.2.4), +// also known as secp384r1. +// +// Multiple invocations of this function will return the same value, which can +// be used for equality checks and switch statements. +func P384() Curve { return p384 } + +var p384 = &nistCurve{ + name: "P-384", + generate: func(r io.Reader) (*ecdh.PrivateKey, error) { + return ecdh.GenerateKey(ecdh.P384(), r) + }, + newPrivateKey: func(b []byte) (*ecdh.PrivateKey, error) { + return ecdh.NewPrivateKey(ecdh.P384(), b) + }, + newPublicKey: func(publicKey []byte) (*ecdh.PublicKey, error) { + return ecdh.NewPublicKey(ecdh.P384(), publicKey) + }, + sharedSecret: func(priv *ecdh.PrivateKey, pub *ecdh.PublicKey) (sharedSecret []byte, err error) { + return ecdh.ECDH(ecdh.P384(), priv, pub) + }, +} + +// P521 returns a [Curve] which implements NIST P-521 (FIPS 186-3, section D.2.5), +// also known as secp521r1. +// +// Multiple invocations of this function will return the same value, which can +// be used for equality checks and switch statements. +func P521() Curve { return p521 } + +var p521 = &nistCurve{ + name: "P-521", + generate: func(r io.Reader) (*ecdh.PrivateKey, error) { + return ecdh.GenerateKey(ecdh.P521(), r) + }, + newPrivateKey: func(b []byte) (*ecdh.PrivateKey, error) { + return ecdh.NewPrivateKey(ecdh.P521(), b) + }, + newPublicKey: func(publicKey []byte) (*ecdh.PublicKey, error) { + return ecdh.NewPublicKey(ecdh.P521(), publicKey) + }, + sharedSecret: func(priv *ecdh.PrivateKey, pub *ecdh.PublicKey) (sharedSecret []byte, err error) { + return ecdh.ECDH(ecdh.P521(), priv, pub) + }, +} diff --git a/go/src/crypto/ecdh/x25519.go b/go/src/crypto/ecdh/x25519.go new file mode 100644 index 0000000000000000000000000000000000000000..21a921aa12d44db2ea66ee1e431e0f20453f364c --- /dev/null +++ b/go/src/crypto/ecdh/x25519.go @@ -0,0 +1,150 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package ecdh + +import ( + "bytes" + "crypto/internal/fips140/edwards25519/field" + "crypto/internal/fips140only" + "crypto/internal/rand" + "errors" + "io" +) + +var ( + x25519PublicKeySize = 32 + x25519PrivateKeySize = 32 + x25519SharedSecretSize = 32 +) + +// X25519 returns a [Curve] which implements the X25519 function over Curve25519 +// (RFC 7748, Section 5). +// +// Multiple invocations of this function will return the same value, so it can +// be used for equality checks and switch statements. +func X25519() Curve { return x25519 } + +var x25519 = &x25519Curve{} + +type x25519Curve struct{} + +func (c *x25519Curve) String() string { + return "X25519" +} + +func (c *x25519Curve) GenerateKey(r io.Reader) (*PrivateKey, error) { + if fips140only.Enforced() { + return nil, errors.New("crypto/ecdh: use of X25519 is not allowed in FIPS 140-only mode") + } + r = rand.CustomReader(r) + key := make([]byte, x25519PrivateKeySize) + if _, err := io.ReadFull(r, key); err != nil { + return nil, err + } + return c.NewPrivateKey(key) +} + +func (c *x25519Curve) NewPrivateKey(key []byte) (*PrivateKey, error) { + if fips140only.Enforced() { + return nil, errors.New("crypto/ecdh: use of X25519 is not allowed in FIPS 140-only mode") + } + if len(key) != x25519PrivateKeySize { + return nil, errors.New("crypto/ecdh: invalid private key size") + } + publicKey := make([]byte, x25519PublicKeySize) + x25519Basepoint := [32]byte{9} + x25519ScalarMult(publicKey, key, x25519Basepoint[:]) + // We don't check for the all-zero public key here because the scalar is + // never zero because of clamping, and the basepoint is not the identity in + // the prime-order subgroup(s). + return &PrivateKey{ + curve: c, + privateKey: bytes.Clone(key), + publicKey: &PublicKey{curve: c, publicKey: publicKey}, + }, nil +} + +func (c *x25519Curve) NewPublicKey(key []byte) (*PublicKey, error) { + if fips140only.Enforced() { + return nil, errors.New("crypto/ecdh: use of X25519 is not allowed in FIPS 140-only mode") + } + if len(key) != x25519PublicKeySize { + return nil, errors.New("crypto/ecdh: invalid public key") + } + return &PublicKey{ + curve: c, + publicKey: bytes.Clone(key), + }, nil +} + +func (c *x25519Curve) ecdh(local *PrivateKey, remote *PublicKey) ([]byte, error) { + out := make([]byte, x25519SharedSecretSize) + x25519ScalarMult(out, local.privateKey, remote.publicKey) + if isZero(out) { + return nil, errors.New("crypto/ecdh: bad X25519 remote ECDH input: low order point") + } + return out, nil +} + +func x25519ScalarMult(dst, scalar, point []byte) { + var e [32]byte + + copy(e[:], scalar[:]) + e[0] &= 248 + e[31] &= 127 + e[31] |= 64 + + var x1, x2, z2, x3, z3, tmp0, tmp1 field.Element + x1.SetBytes(point[:]) + x2.One() + x3.Set(&x1) + z3.One() + + swap := 0 + for pos := 254; pos >= 0; pos-- { + b := e[pos/8] >> uint(pos&7) + b &= 1 + swap ^= int(b) + x2.Swap(&x3, swap) + z2.Swap(&z3, swap) + swap = int(b) + + tmp0.Subtract(&x3, &z3) + tmp1.Subtract(&x2, &z2) + x2.Add(&x2, &z2) + z2.Add(&x3, &z3) + z3.Multiply(&tmp0, &x2) + z2.Multiply(&z2, &tmp1) + tmp0.Square(&tmp1) + tmp1.Square(&x2) + x3.Add(&z3, &z2) + z2.Subtract(&z3, &z2) + x2.Multiply(&tmp1, &tmp0) + tmp1.Subtract(&tmp1, &tmp0) + z2.Square(&z2) + + z3.Mult32(&tmp1, 121666) + x3.Square(&x3) + tmp0.Add(&tmp0, &z3) + z3.Multiply(&x1, &z2) + z2.Multiply(&tmp1, &tmp0) + } + + x2.Swap(&x3, swap) + z2.Swap(&z3, swap) + + z2.Invert(&z2) + x2.Multiply(&x2, &z2) + copy(dst[:], x2.Bytes()) +} + +// isZero reports whether x is all zeroes in constant time. +func isZero(x []byte) bool { + var acc byte + for _, b := range x { + acc |= b + } + return acc == 0 +} diff --git a/go/src/crypto/ecdsa/boring.go b/go/src/crypto/ecdsa/boring.go new file mode 100644 index 0000000000000000000000000000000000000000..275c60b4de49eb31091cd652829d3ddf56b602fa --- /dev/null +++ b/go/src/crypto/ecdsa/boring.go @@ -0,0 +1,106 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build boringcrypto + +package ecdsa + +import ( + "crypto/internal/boring" + "crypto/internal/boring/bbig" + "crypto/internal/boring/bcache" + "math/big" +) + +// Cached conversions from Go PublicKey/PrivateKey to BoringCrypto. +// +// The first operation on a PublicKey or PrivateKey makes a parallel +// BoringCrypto key and saves it in pubCache or privCache. +// +// We could just assume that once used in a Sign or Verify operation, +// a particular key is never again modified, but that has not been a +// stated assumption before. Just in case there is any existing code that +// does modify the key between operations, we save the original values +// alongside the cached BoringCrypto key and check that the real key +// still matches before using the cached key. The theory is that the real +// operations are significantly more expensive than the comparison. + +var pubCache bcache.Cache[PublicKey, boringPub] +var privCache bcache.Cache[PrivateKey, boringPriv] + +func init() { + pubCache.Register() + privCache.Register() +} + +type boringPub struct { + key *boring.PublicKeyECDSA + orig PublicKey +} + +func boringPublicKey(pub *PublicKey) (*boring.PublicKeyECDSA, error) { + b := pubCache.Get(pub) + if b != nil && publicKeyEqual(&b.orig, pub) { + return b.key, nil + } + + b = new(boringPub) + b.orig = copyPublicKey(pub) + key, err := boring.NewPublicKeyECDSA(b.orig.Curve.Params().Name, bbig.Enc(b.orig.X), bbig.Enc(b.orig.Y)) + if err != nil { + return nil, err + } + b.key = key + pubCache.Put(pub, b) + return key, nil +} + +type boringPriv struct { + key *boring.PrivateKeyECDSA + orig PrivateKey +} + +func boringPrivateKey(priv *PrivateKey) (*boring.PrivateKeyECDSA, error) { + b := privCache.Get(priv) + if b != nil && privateKeyEqual(&b.orig, priv) { + return b.key, nil + } + + b = new(boringPriv) + b.orig = copyPrivateKey(priv) + key, err := boring.NewPrivateKeyECDSA(b.orig.Curve.Params().Name, bbig.Enc(b.orig.X), bbig.Enc(b.orig.Y), bbig.Enc(b.orig.D)) + if err != nil { + return nil, err + } + b.key = key + privCache.Put(priv, b) + return key, nil +} + +func publicKeyEqual(k1, k2 *PublicKey) bool { + return k1.X != nil && + k1.Curve.Params() == k2.Curve.Params() && + k1.X.Cmp(k2.X) == 0 && + k1.Y.Cmp(k2.Y) == 0 +} + +func privateKeyEqual(k1, k2 *PrivateKey) bool { + return publicKeyEqual(&k1.PublicKey, &k2.PublicKey) && + k1.D.Cmp(k2.D) == 0 +} + +func copyPublicKey(k *PublicKey) PublicKey { + return PublicKey{ + Curve: k.Curve, + X: new(big.Int).Set(k.X), + Y: new(big.Int).Set(k.Y), + } +} + +func copyPrivateKey(k *PrivateKey) PrivateKey { + return PrivateKey{ + PublicKey: copyPublicKey(&k.PublicKey), + D: new(big.Int).Set(k.D), + } +} diff --git a/go/src/crypto/ecdsa/ecdsa.go b/go/src/crypto/ecdsa/ecdsa.go new file mode 100644 index 0000000000000000000000000000000000000000..b336f32eb69ef57cd5797535c01b93357dfff6f9 --- /dev/null +++ b/go/src/crypto/ecdsa/ecdsa.go @@ -0,0 +1,632 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package ecdsa implements the Elliptic Curve Digital Signature Algorithm, as +// defined in [FIPS 186-5]. +// +// Signatures generated by this package are not deterministic, but entropy is +// mixed with the private key and the message, achieving the same level of +// security in case of randomness source failure. +// +// Operations involving private keys are implemented using constant-time +// algorithms, as long as an [elliptic.Curve] returned by [elliptic.P224], +// [elliptic.P256], [elliptic.P384], or [elliptic.P521] is used. +// +// [FIPS 186-5]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf +package ecdsa + +import ( + "crypto" + "crypto/ecdh" + "crypto/elliptic" + "crypto/internal/boring" + "crypto/internal/boring/bbig" + "crypto/internal/fips140/ecdsa" + "crypto/internal/fips140/nistec" + "crypto/internal/fips140cache" + "crypto/internal/fips140hash" + "crypto/internal/fips140only" + "crypto/internal/rand" + "crypto/sha512" + "crypto/subtle" + "errors" + "io" + "math/big" + + "golang.org/x/crypto/cryptobyte" + "golang.org/x/crypto/cryptobyte/asn1" +) + +// PublicKey represents an ECDSA public key. +type PublicKey struct { + elliptic.Curve + + // X, Y are the coordinates of the public key point. + // + // Deprecated: modifying the raw coordinates can produce invalid keys, and may + // invalidate internal optimizations; moreover, [big.Int] methods are not + // suitable for operating on cryptographic values. To encode and decode + // PublicKey values, use [PublicKey.Bytes] and [ParseUncompressedPublicKey] + // or [crypto/x509.MarshalPKIXPublicKey] and [crypto/x509.ParsePKIXPublicKey]. + // For ECDH, use [crypto/ecdh]. For lower-level elliptic curve operations, + // use a third-party module like filippo.io/nistec. + X, Y *big.Int +} + +// Any methods implemented on PublicKey might need to also be implemented on +// PrivateKey, as the latter embeds the former and will expose its methods. + +// ECDH returns k as a [ecdh.PublicKey]. It returns an error if the key is +// invalid according to the definition of [ecdh.Curve.NewPublicKey], or if the +// Curve is not supported by crypto/ecdh. +func (pub *PublicKey) ECDH() (*ecdh.PublicKey, error) { + c := curveToECDH(pub.Curve) + if c == nil { + return nil, errors.New("ecdsa: unsupported curve by crypto/ecdh") + } + k, err := pub.Bytes() + if err != nil { + return nil, err + } + return c.NewPublicKey(k) +} + +// Equal reports whether pub and x have the same value. +// +// Two keys are only considered to have the same value if they have the same Curve value. +// Note that for example [elliptic.P256] and elliptic.P256().Params() are different +// values, as the latter is a generic not constant time implementation. +func (pub *PublicKey) Equal(x crypto.PublicKey) bool { + xx, ok := x.(*PublicKey) + if !ok { + return false + } + return bigIntEqual(pub.X, xx.X) && bigIntEqual(pub.Y, xx.Y) && + // Standard library Curve implementations are singletons, so this check + // will work for those. Other Curves might be equivalent even if not + // singletons, but there is no definitive way to check for that, and + // better to err on the side of safety. + pub.Curve == xx.Curve +} + +// ParseUncompressedPublicKey parses a public key encoded as an uncompressed +// point according to SEC 1, Version 2.0, Section 2.3.3 (also known as the X9.62 +// uncompressed format). It returns an error if the point is not in uncompressed +// form, is not on the curve, or is the point at infinity. +// +// curve must be one of [elliptic.P224], [elliptic.P256], [elliptic.P384], or +// [elliptic.P521], or ParseUncompressedPublicKey returns an error. +// +// ParseUncompressedPublicKey accepts the same format as +// [ecdh.Curve.NewPublicKey] does for NIST curves, but returns a [PublicKey] +// instead of an [ecdh.PublicKey]. +// +// Note that public keys are more commonly encoded in DER (or PEM) format, which +// can be parsed with [crypto/x509.ParsePKIXPublicKey] (and [encoding/pem]). +func ParseUncompressedPublicKey(curve elliptic.Curve, data []byte) (*PublicKey, error) { + if len(data) < 1 || data[0] != 4 { + return nil, errors.New("ecdsa: invalid uncompressed public key") + } + switch curve { + case elliptic.P224(): + return parseUncompressedPublicKey(ecdsa.P224(), curve, data) + case elliptic.P256(): + return parseUncompressedPublicKey(ecdsa.P256(), curve, data) + case elliptic.P384(): + return parseUncompressedPublicKey(ecdsa.P384(), curve, data) + case elliptic.P521(): + return parseUncompressedPublicKey(ecdsa.P521(), curve, data) + default: + return nil, errors.New("ecdsa: curve not supported by ParseUncompressedPublicKey") + } +} + +func parseUncompressedPublicKey[P ecdsa.Point[P]](c *ecdsa.Curve[P], curve elliptic.Curve, data []byte) (*PublicKey, error) { + k, err := ecdsa.NewPublicKey(c, data) + if err != nil { + return nil, err + } + return publicKeyFromFIPS(curve, k) +} + +// Bytes encodes the public key as an uncompressed point according to SEC 1, +// Version 2.0, Section 2.3.3 (also known as the X9.62 uncompressed format). +// It returns an error if the public key is invalid. +// +// PublicKey.Curve must be one of [elliptic.P224], [elliptic.P256], +// [elliptic.P384], or [elliptic.P521], or Bytes returns an error. +// +// Bytes returns the same format as [ecdh.PublicKey.Bytes] does for NIST curves. +// +// Note that public keys are more commonly encoded in DER (or PEM) format, which +// can be generated with [crypto/x509.MarshalPKIXPublicKey] (and [encoding/pem]). +func (pub *PublicKey) Bytes() ([]byte, error) { + switch pub.Curve { + case elliptic.P224(): + return publicKeyBytes(ecdsa.P224(), pub) + case elliptic.P256(): + return publicKeyBytes(ecdsa.P256(), pub) + case elliptic.P384(): + return publicKeyBytes(ecdsa.P384(), pub) + case elliptic.P521(): + return publicKeyBytes(ecdsa.P521(), pub) + default: + return nil, errors.New("ecdsa: curve not supported by PublicKey.Bytes") + } +} + +func publicKeyBytes[P ecdsa.Point[P]](c *ecdsa.Curve[P], pub *PublicKey) ([]byte, error) { + k, err := publicKeyToFIPS(c, pub) + if err != nil { + return nil, err + } + return k.Bytes(), nil +} + +// PrivateKey represents an ECDSA private key. +type PrivateKey struct { + PublicKey + + // D is the private scalar value. + // + // Deprecated: modifying the raw value can produce invalid keys, and may + // invalidate internal optimizations; moreover, [big.Int] methods are not + // suitable for operating on cryptographic values. To encode and decode + // PrivateKey values, use [PrivateKey.Bytes] and [ParseRawPrivateKey] or + // [crypto/x509.MarshalPKCS8PrivateKey] and [crypto/x509.ParsePKCS8PrivateKey]. + // For ECDH, use [crypto/ecdh]. + D *big.Int +} + +// ECDH returns k as a [ecdh.PrivateKey]. It returns an error if the key is +// invalid according to the definition of [ecdh.Curve.NewPrivateKey], or if the +// Curve is not supported by [crypto/ecdh]. +func (priv *PrivateKey) ECDH() (*ecdh.PrivateKey, error) { + c := curveToECDH(priv.Curve) + if c == nil { + return nil, errors.New("ecdsa: unsupported curve by crypto/ecdh") + } + k, err := priv.Bytes() + if err != nil { + return nil, err + } + return c.NewPrivateKey(k) +} + +func curveToECDH(c elliptic.Curve) ecdh.Curve { + switch c { + case elliptic.P256(): + return ecdh.P256() + case elliptic.P384(): + return ecdh.P384() + case elliptic.P521(): + return ecdh.P521() + default: + return nil + } +} + +// Public returns the public key corresponding to priv. +func (priv *PrivateKey) Public() crypto.PublicKey { + return &priv.PublicKey +} + +// Equal reports whether priv and x have the same value. +// +// See [PublicKey.Equal] for details on how Curve is compared. +func (priv *PrivateKey) Equal(x crypto.PrivateKey) bool { + xx, ok := x.(*PrivateKey) + if !ok { + return false + } + return priv.PublicKey.Equal(&xx.PublicKey) && bigIntEqual(priv.D, xx.D) +} + +// bigIntEqual reports whether a and b are equal leaking only their bit length +// through timing side-channels. +func bigIntEqual(a, b *big.Int) bool { + return subtle.ConstantTimeCompare(a.Bytes(), b.Bytes()) == 1 +} + +// ParseRawPrivateKey parses a private key encoded as a fixed-length big-endian +// integer, according to SEC 1, Version 2.0, Section 2.3.6 (sometimes referred +// to as the raw format). It returns an error if the value is not reduced modulo +// the curve's order, or if it's zero. +// +// curve must be one of [elliptic.P224], [elliptic.P256], [elliptic.P384], or +// [elliptic.P521], or ParseRawPrivateKey returns an error. +// +// ParseRawPrivateKey accepts the same format as [ecdh.Curve.NewPrivateKey] does +// for NIST curves, but returns a [PrivateKey] instead of an [ecdh.PrivateKey]. +// +// Note that private keys are more commonly encoded in ASN.1 or PKCS#8 format, +// which can be parsed with [crypto/x509.ParseECPrivateKey] or +// [crypto/x509.ParsePKCS8PrivateKey] (and [encoding/pem]). +func ParseRawPrivateKey(curve elliptic.Curve, data []byte) (*PrivateKey, error) { + switch curve { + case elliptic.P224(): + return parseRawPrivateKey(ecdsa.P224(), nistec.NewP224Point, curve, data) + case elliptic.P256(): + return parseRawPrivateKey(ecdsa.P256(), nistec.NewP256Point, curve, data) + case elliptic.P384(): + return parseRawPrivateKey(ecdsa.P384(), nistec.NewP384Point, curve, data) + case elliptic.P521(): + return parseRawPrivateKey(ecdsa.P521(), nistec.NewP521Point, curve, data) + default: + return nil, errors.New("ecdsa: curve not supported by ParseRawPrivateKey") + } +} + +func parseRawPrivateKey[P ecdsa.Point[P]](c *ecdsa.Curve[P], newPoint func() P, curve elliptic.Curve, data []byte) (*PrivateKey, error) { + q, err := newPoint().ScalarBaseMult(data) + if err != nil { + return nil, err + } + k, err := ecdsa.NewPrivateKey(c, data, q.Bytes()) + if err != nil { + return nil, err + } + return privateKeyFromFIPS(curve, k) +} + +// Bytes encodes the private key as a fixed-length big-endian integer according +// to SEC 1, Version 2.0, Section 2.3.6 (sometimes referred to as the raw +// format). It returns an error if the private key is invalid. +// +// PrivateKey.Curve must be one of [elliptic.P224], [elliptic.P256], +// [elliptic.P384], or [elliptic.P521], or Bytes returns an error. +// +// Bytes returns the same format as [ecdh.PrivateKey.Bytes] does for NIST curves. +// +// Note that private keys are more commonly encoded in ASN.1 or PKCS#8 format, +// which can be generated with [crypto/x509.MarshalECPrivateKey] or +// [crypto/x509.MarshalPKCS8PrivateKey] (and [encoding/pem]). +func (priv *PrivateKey) Bytes() ([]byte, error) { + switch priv.Curve { + case elliptic.P224(): + return privateKeyBytes(ecdsa.P224(), priv) + case elliptic.P256(): + return privateKeyBytes(ecdsa.P256(), priv) + case elliptic.P384(): + return privateKeyBytes(ecdsa.P384(), priv) + case elliptic.P521(): + return privateKeyBytes(ecdsa.P521(), priv) + default: + return nil, errors.New("ecdsa: curve not supported by PrivateKey.Bytes") + } +} + +func privateKeyBytes[P ecdsa.Point[P]](c *ecdsa.Curve[P], priv *PrivateKey) ([]byte, error) { + k, err := privateKeyToFIPS(c, priv) + if err != nil { + return nil, err + } + return k.Bytes(), nil +} + +// Sign signs a hash (which should be the result of hashing a larger message +// with opts.HashFunc()) using the private key, priv. If the hash is longer than +// the bit-length of the private key's curve order, the hash will be truncated +// to that length. It returns the ASN.1 encoded signature, like [SignASN1]. +// +// If random is not nil, the signature is randomized. Most applications should use +// [crypto/rand.Reader] as random, but unless GODEBUG=cryptocustomrand=1 is set, a +// secure source of random bytes is always used, and the actual Reader is ignored. +// The GODEBUG setting will be removed in a future Go release. Instead, use +// [testing/cryptotest.SetGlobalRandom]. +// +// If random is nil, Sign will produce a deterministic signature according to RFC +// 6979. When producing a deterministic signature, opts.HashFunc() must be the +// function used to produce digest and priv.Curve must be one of +// [elliptic.P224], [elliptic.P256], [elliptic.P384], or [elliptic.P521]. +func (priv *PrivateKey) Sign(random io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error) { + if random == nil { + return signRFC6979(priv, digest, opts) + } + random = rand.CustomReader(random) + return SignASN1(random, priv, digest) +} + +// GenerateKey generates a new ECDSA private key for the specified curve. +// +// Since Go 1.26, a secure source of random bytes is always used, and the Reader is +// ignored unless GODEBUG=cryptocustomrand=1 is set. This setting will be removed +// in a future Go release. Instead, use [testing/cryptotest.SetGlobalRandom]. +func GenerateKey(c elliptic.Curve, r io.Reader) (*PrivateKey, error) { + if boring.Enabled && rand.IsDefaultReader(r) { + x, y, d, err := boring.GenerateKeyECDSA(c.Params().Name) + if err != nil { + return nil, err + } + return &PrivateKey{PublicKey: PublicKey{Curve: c, X: bbig.Dec(x), Y: bbig.Dec(y)}, D: bbig.Dec(d)}, nil + } + boring.UnreachableExceptTests() + + r = rand.CustomReader(r) + + switch c.Params() { + case elliptic.P224().Params(): + return generateFIPS(c, ecdsa.P224(), r) + case elliptic.P256().Params(): + return generateFIPS(c, ecdsa.P256(), r) + case elliptic.P384().Params(): + return generateFIPS(c, ecdsa.P384(), r) + case elliptic.P521().Params(): + return generateFIPS(c, ecdsa.P521(), r) + default: + return generateLegacy(c, r) + } +} + +func generateFIPS[P ecdsa.Point[P]](curve elliptic.Curve, c *ecdsa.Curve[P], rand io.Reader) (*PrivateKey, error) { + if fips140only.Enforced() && !fips140only.ApprovedRandomReader(rand) { + return nil, errors.New("crypto/ecdsa: only crypto/rand.Reader is allowed in FIPS 140-only mode") + } + privateKey, err := ecdsa.GenerateKey(c, rand) + if err != nil { + return nil, err + } + return privateKeyFromFIPS(curve, privateKey) +} + +// SignASN1 signs a hash (which should be the result of hashing a larger message) +// using the private key, priv. If the hash is longer than the bit-length of the +// private key's curve order, the hash will be truncated to that length. It +// returns the ASN.1 encoded signature. +// +// The signature is randomized. Since Go 1.26, a secure source of random bytes +// is always used, and the Reader is ignored unless GODEBUG=cryptocustomrand=1 +// is set. This setting will be removed in a future Go release. Instead, use +// [testing/cryptotest.SetGlobalRandom]. +func SignASN1(r io.Reader, priv *PrivateKey, hash []byte) ([]byte, error) { + if boring.Enabled && rand.IsDefaultReader(r) { + b, err := boringPrivateKey(priv) + if err != nil { + return nil, err + } + return boring.SignMarshalECDSA(b, hash) + } + boring.UnreachableExceptTests() + + r = rand.CustomReader(r) + + switch priv.Curve.Params() { + case elliptic.P224().Params(): + return signFIPS(ecdsa.P224(), priv, r, hash) + case elliptic.P256().Params(): + return signFIPS(ecdsa.P256(), priv, r, hash) + case elliptic.P384().Params(): + return signFIPS(ecdsa.P384(), priv, r, hash) + case elliptic.P521().Params(): + return signFIPS(ecdsa.P521(), priv, r, hash) + default: + return signLegacy(priv, r, hash) + } +} + +func signFIPS[P ecdsa.Point[P]](c *ecdsa.Curve[P], priv *PrivateKey, rand io.Reader, hash []byte) ([]byte, error) { + if fips140only.Enforced() && !fips140only.ApprovedRandomReader(rand) { + return nil, errors.New("crypto/ecdsa: only crypto/rand.Reader is allowed in FIPS 140-only mode") + } + k, err := privateKeyToFIPS(c, priv) + if err != nil { + return nil, err + } + // Always using SHA-512 instead of the hash that computed hash is + // technically a violation of draft-irtf-cfrg-det-sigs-with-noise-04 but in + // our API we don't get to know what it was, and this has no security impact. + sig, err := ecdsa.Sign(c, sha512.New, k, rand, hash) + if err != nil { + return nil, err + } + return encodeSignature(sig.R, sig.S) +} + +func signRFC6979(priv *PrivateKey, hash []byte, opts crypto.SignerOpts) ([]byte, error) { + if opts == nil { + return nil, errors.New("ecdsa: Sign called with nil opts") + } + h := opts.HashFunc() + if h.Size() != len(hash) { + return nil, errors.New("ecdsa: hash length does not match hash function") + } + switch priv.Curve.Params() { + case elliptic.P224().Params(): + return signFIPSDeterministic(ecdsa.P224(), h, priv, hash) + case elliptic.P256().Params(): + return signFIPSDeterministic(ecdsa.P256(), h, priv, hash) + case elliptic.P384().Params(): + return signFIPSDeterministic(ecdsa.P384(), h, priv, hash) + case elliptic.P521().Params(): + return signFIPSDeterministic(ecdsa.P521(), h, priv, hash) + default: + return nil, errors.New("ecdsa: curve not supported by deterministic signatures") + } +} + +func signFIPSDeterministic[P ecdsa.Point[P]](c *ecdsa.Curve[P], hashFunc crypto.Hash, priv *PrivateKey, hash []byte) ([]byte, error) { + k, err := privateKeyToFIPS(c, priv) + if err != nil { + return nil, err + } + h := fips140hash.UnwrapNew(hashFunc.New) + if fips140only.Enforced() && !fips140only.ApprovedHash(h()) { + return nil, errors.New("crypto/ecdsa: use of hash functions other than SHA-2 or SHA-3 is not allowed in FIPS 140-only mode") + } + sig, err := ecdsa.SignDeterministic(c, h, k, hash) + if err != nil { + return nil, err + } + return encodeSignature(sig.R, sig.S) +} + +func encodeSignature(r, s []byte) ([]byte, error) { + var b cryptobyte.Builder + b.AddASN1(asn1.SEQUENCE, func(b *cryptobyte.Builder) { + addASN1IntBytes(b, r) + addASN1IntBytes(b, s) + }) + return b.Bytes() +} + +// addASN1IntBytes encodes in ASN.1 a positive integer represented as +// a big-endian byte slice with zero or more leading zeroes. +func addASN1IntBytes(b *cryptobyte.Builder, bytes []byte) { + for len(bytes) > 0 && bytes[0] == 0 { + bytes = bytes[1:] + } + if len(bytes) == 0 { + b.SetError(errors.New("invalid integer")) + return + } + b.AddASN1(asn1.INTEGER, func(c *cryptobyte.Builder) { + if bytes[0]&0x80 != 0 { + c.AddUint8(0) + } + c.AddBytes(bytes) + }) +} + +// VerifyASN1 verifies the ASN.1 encoded signature, sig, of hash using the +// public key, pub. Its return value records whether the signature is valid. +// +// The inputs are not considered confidential, and may leak through timing side +// channels, or if an attacker has control of part of the inputs. +func VerifyASN1(pub *PublicKey, hash, sig []byte) bool { + if boring.Enabled { + key, err := boringPublicKey(pub) + if err != nil { + return false + } + return boring.VerifyECDSA(key, hash, sig) + } + boring.UnreachableExceptTests() + + switch pub.Curve.Params() { + case elliptic.P224().Params(): + return verifyFIPS(ecdsa.P224(), pub, hash, sig) + case elliptic.P256().Params(): + return verifyFIPS(ecdsa.P256(), pub, hash, sig) + case elliptic.P384().Params(): + return verifyFIPS(ecdsa.P384(), pub, hash, sig) + case elliptic.P521().Params(): + return verifyFIPS(ecdsa.P521(), pub, hash, sig) + default: + return verifyLegacy(pub, hash, sig) + } +} + +func verifyFIPS[P ecdsa.Point[P]](c *ecdsa.Curve[P], pub *PublicKey, hash, sig []byte) bool { + r, s, err := parseSignature(sig) + if err != nil { + return false + } + k, err := publicKeyToFIPS(c, pub) + if err != nil { + return false + } + if err := ecdsa.Verify(c, k, hash, &ecdsa.Signature{R: r, S: s}); err != nil { + return false + } + return true +} + +func parseSignature(sig []byte) (r, s []byte, err error) { + var inner cryptobyte.String + input := cryptobyte.String(sig) + if !input.ReadASN1(&inner, asn1.SEQUENCE) || + !input.Empty() || + !inner.ReadASN1Integer(&r) || + !inner.ReadASN1Integer(&s) || + !inner.Empty() { + return nil, nil, errors.New("invalid ASN.1") + } + return r, s, nil +} + +func publicKeyFromFIPS(curve elliptic.Curve, pub *ecdsa.PublicKey) (*PublicKey, error) { + x, y, err := pointToAffine(curve, pub.Bytes()) + if err != nil { + return nil, err + } + return &PublicKey{Curve: curve, X: x, Y: y}, nil +} + +func privateKeyFromFIPS(curve elliptic.Curve, priv *ecdsa.PrivateKey) (*PrivateKey, error) { + pub, err := publicKeyFromFIPS(curve, priv.PublicKey()) + if err != nil { + return nil, err + } + return &PrivateKey{PublicKey: *pub, D: new(big.Int).SetBytes(priv.Bytes())}, nil +} + +func publicKeyToFIPS[P ecdsa.Point[P]](c *ecdsa.Curve[P], pub *PublicKey) (*ecdsa.PublicKey, error) { + Q, err := pointFromAffine(pub.Curve, pub.X, pub.Y) + if err != nil { + return nil, err + } + return ecdsa.NewPublicKey(c, Q) +} + +var privateKeyCache fips140cache.Cache[PrivateKey, ecdsa.PrivateKey] + +func privateKeyToFIPS[P ecdsa.Point[P]](c *ecdsa.Curve[P], priv *PrivateKey) (*ecdsa.PrivateKey, error) { + Q, err := pointFromAffine(priv.Curve, priv.X, priv.Y) + if err != nil { + return nil, err + } + + // Reject values that would not get correctly encoded. + if priv.D.BitLen() > priv.Curve.Params().N.BitLen() { + return nil, errors.New("ecdsa: private key scalar too large") + } + if priv.D.Sign() <= 0 { + return nil, errors.New("ecdsa: private key scalar is zero or negative") + } + + size := (priv.Curve.Params().N.BitLen() + 7) / 8 + const maxScalarSize = 66 // enough for a P-521 private key + if size > maxScalarSize { + return nil, errors.New("ecdsa: internal error: curve size too large") + } + D := priv.D.FillBytes(make([]byte, size, maxScalarSize)) + + return privateKeyCache.Get(priv, func() (*ecdsa.PrivateKey, error) { + return ecdsa.NewPrivateKey(c, D, Q) + }, func(k *ecdsa.PrivateKey) bool { + return subtle.ConstantTimeCompare(k.PublicKey().Bytes(), Q) == 1 && + subtle.ConstantTimeCompare(k.Bytes(), D) == 1 + }) +} + +// pointFromAffine is used to convert the PublicKey to a nistec SetBytes input. +func pointFromAffine(curve elliptic.Curve, x, y *big.Int) ([]byte, error) { + bitSize := curve.Params().BitSize + // Reject values that would not get correctly encoded. + if x.Sign() < 0 || y.Sign() < 0 { + return nil, errors.New("negative coordinate") + } + if x.BitLen() > bitSize || y.BitLen() > bitSize { + return nil, errors.New("overflowing coordinate") + } + // Encode the coordinates and let [ecdsa.NewPublicKey] reject invalid points. + byteLen := (bitSize + 7) / 8 + buf := make([]byte, 1+2*byteLen) + buf[0] = 4 // uncompressed point + x.FillBytes(buf[1 : 1+byteLen]) + y.FillBytes(buf[1+byteLen : 1+2*byteLen]) + return buf, nil +} + +// pointToAffine is used to convert a nistec Bytes encoding to a PublicKey. +func pointToAffine(curve elliptic.Curve, p []byte) (x, y *big.Int, err error) { + if len(p) == 1 && p[0] == 0 { + // This is the encoding of the point at infinity. + return nil, nil, errors.New("ecdsa: public key point is the infinity") + } + byteLen := (curve.Params().BitSize + 7) / 8 + x = new(big.Int).SetBytes(p[1 : 1+byteLen]) + y = new(big.Int).SetBytes(p[1+byteLen:]) + return x, y, nil +} diff --git a/go/src/crypto/ecdsa/ecdsa_legacy.go b/go/src/crypto/ecdsa/ecdsa_legacy.go new file mode 100644 index 0000000000000000000000000000000000000000..2fb1b21a6059867e0e275ea80953e17a16712f90 --- /dev/null +++ b/go/src/crypto/ecdsa/ecdsa_legacy.go @@ -0,0 +1,220 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package ecdsa + +import ( + "crypto/elliptic" + "crypto/internal/fips140only" + "errors" + "io" + "math/big" + "math/rand/v2" + + "golang.org/x/crypto/cryptobyte" + "golang.org/x/crypto/cryptobyte/asn1" +) + +// This file contains a math/big implementation of ECDSA that is only used for +// deprecated custom curves. + +func generateLegacy(c elliptic.Curve, rand io.Reader) (*PrivateKey, error) { + if fips140only.Enforced() { + return nil, errors.New("crypto/ecdsa: use of custom curves is not allowed in FIPS 140-only mode") + } + + k, err := randFieldElement(c, rand) + if err != nil { + return nil, err + } + + priv := new(PrivateKey) + priv.PublicKey.Curve = c + priv.D = k + priv.PublicKey.X, priv.PublicKey.Y = c.ScalarBaseMult(k.Bytes()) + return priv, nil +} + +// hashToInt converts a hash value to an integer. Per FIPS 186-4, Section 6.4, +// we use the left-most bits of the hash to match the bit-length of the order of +// the curve. This also performs Step 5 of SEC 1, Version 2.0, Section 4.1.3. +func hashToInt(hash []byte, c elliptic.Curve) *big.Int { + orderBits := c.Params().N.BitLen() + orderBytes := (orderBits + 7) / 8 + if len(hash) > orderBytes { + hash = hash[:orderBytes] + } + + ret := new(big.Int).SetBytes(hash) + excess := len(hash)*8 - orderBits + if excess > 0 { + ret.Rsh(ret, uint(excess)) + } + return ret +} + +var errZeroParam = errors.New("zero parameter") + +// Sign signs a hash (which should be the result of hashing a larger message) +// using the private key, priv. If the hash is longer than the bit-length of the +// private key's curve order, the hash will be truncated to that length. It +// returns the signature as a pair of integers. Most applications should use +// [SignASN1] instead of dealing directly with r, s. +// +// The signature is randomized. Since Go 1.26, a secure source of random bytes +// is always used, and the Reader is ignored unless GODEBUG=cryptocustomrand=1 +// is set. This setting will be removed in a future Go release. Instead, use +// [testing/cryptotest.SetGlobalRandom]. +func Sign(rand io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err error) { + sig, err := SignASN1(rand, priv, hash) + if err != nil { + return nil, nil, err + } + + r, s = new(big.Int), new(big.Int) + var inner cryptobyte.String + input := cryptobyte.String(sig) + if !input.ReadASN1(&inner, asn1.SEQUENCE) || + !input.Empty() || + !inner.ReadASN1Integer(r) || + !inner.ReadASN1Integer(s) || + !inner.Empty() { + return nil, nil, errors.New("invalid ASN.1 from SignASN1") + } + return r, s, nil +} + +func signLegacy(priv *PrivateKey, csprng io.Reader, hash []byte) (sig []byte, err error) { + if fips140only.Enforced() { + return nil, errors.New("crypto/ecdsa: use of custom curves is not allowed in FIPS 140-only mode") + } + + c := priv.Curve + + // A cheap version of hedged signatures, for the deprecated path. + var seed [32]byte + if _, err := io.ReadFull(csprng, seed[:]); err != nil { + return nil, err + } + for i, b := range priv.D.Bytes() { + seed[i%32] ^= b + } + for i, b := range hash { + seed[i%32] ^= b + } + csprng = rand.NewChaCha8(seed) + + // SEC 1, Version 2.0, Section 4.1.3 + N := c.Params().N + if N.Sign() == 0 { + return nil, errZeroParam + } + var k, kInv, r, s *big.Int + for { + for { + k, err = randFieldElement(c, csprng) + if err != nil { + return nil, err + } + + kInv = new(big.Int).ModInverse(k, N) + + r, _ = c.ScalarBaseMult(k.Bytes()) + r.Mod(r, N) + if r.Sign() != 0 { + break + } + } + + e := hashToInt(hash, c) + s = new(big.Int).Mul(priv.D, r) + s.Add(s, e) + s.Mul(s, kInv) + s.Mod(s, N) // N != 0 + if s.Sign() != 0 { + break + } + } + + return encodeSignature(r.Bytes(), s.Bytes()) +} + +// Verify verifies the signature in r, s of hash using the public key, pub. Its +// return value records whether the signature is valid. Most applications should +// use VerifyASN1 instead of dealing directly with r, s. +// +// The inputs are not considered confidential, and may leak through timing side +// channels, or if an attacker has control of part of the inputs. +func Verify(pub *PublicKey, hash []byte, r, s *big.Int) bool { + if r.Sign() <= 0 || s.Sign() <= 0 { + return false + } + sig, err := encodeSignature(r.Bytes(), s.Bytes()) + if err != nil { + return false + } + return VerifyASN1(pub, hash, sig) +} + +func verifyLegacy(pub *PublicKey, hash []byte, sig []byte) bool { + if fips140only.Enforced() { + panic("crypto/ecdsa: use of custom curves is not allowed in FIPS 140-only mode") + } + + rBytes, sBytes, err := parseSignature(sig) + if err != nil { + return false + } + r, s := new(big.Int).SetBytes(rBytes), new(big.Int).SetBytes(sBytes) + + c := pub.Curve + N := c.Params().N + + if r.Sign() <= 0 || s.Sign() <= 0 { + return false + } + if r.Cmp(N) >= 0 || s.Cmp(N) >= 0 { + return false + } + + // SEC 1, Version 2.0, Section 4.1.4 + e := hashToInt(hash, c) + w := new(big.Int).ModInverse(s, N) + + u1 := e.Mul(e, w) + u1.Mod(u1, N) + u2 := w.Mul(r, w) + u2.Mod(u2, N) + + x1, y1 := c.ScalarBaseMult(u1.Bytes()) + x2, y2 := c.ScalarMult(pub.X, pub.Y, u2.Bytes()) + x, y := c.Add(x1, y1, x2, y2) + + if x.Sign() == 0 && y.Sign() == 0 { + return false + } + x.Mod(x, N) + return x.Cmp(r) == 0 +} + +var one = new(big.Int).SetInt64(1) + +// randFieldElement returns a random element of the order of the given +// curve using the procedure given in FIPS 186-4, Appendix B.5.2. +func randFieldElement(c elliptic.Curve, rand io.Reader) (k *big.Int, err error) { + for { + N := c.Params().N + b := make([]byte, (N.BitLen()+7)/8) + if _, err = io.ReadFull(rand, b); err != nil { + return + } + if excess := len(b)*8 - N.BitLen(); excess > 0 { + b[0] >>= excess + } + k = new(big.Int).SetBytes(b) + if k.Sign() != 0 && k.Cmp(N) < 0 { + return + } + } +} diff --git a/go/src/crypto/ecdsa/ecdsa_test.go b/go/src/crypto/ecdsa/ecdsa_test.go new file mode 100644 index 0000000000000000000000000000000000000000..9594dbd1cb6c84e4b50b675d9fc4f7b7d9422c4d --- /dev/null +++ b/go/src/crypto/ecdsa/ecdsa_test.go @@ -0,0 +1,778 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package ecdsa + +import ( + "bufio" + "bytes" + "compress/bzip2" + "crypto" + "crypto/elliptic" + "crypto/internal/cryptotest" + "crypto/rand" + "crypto/sha1" + "crypto/sha256" + "crypto/sha512" + "encoding/hex" + "hash" + "io" + "math/big" + "os" + "strings" + "testing" +) + +func testAllCurves(t *testing.T, f func(*testing.T, elliptic.Curve)) { + tests := []struct { + name string + curve elliptic.Curve + }{ + {"P256", elliptic.P256()}, + {"P224", elliptic.P224()}, + {"P384", elliptic.P384()}, + {"P521", elliptic.P521()}, + {"P256/Generic", genericParamsForCurve(elliptic.P256())}, + } + if testing.Short() { + tests = tests[:1] + } + for _, test := range tests { + curve := test.curve + cryptotest.TestAllImplementations(t, "ecdsa", func(t *testing.T) { + t.Run(test.name, func(t *testing.T) { + t.Parallel() + f(t, curve) + }) + }) + } +} + +// genericParamsForCurve returns the dereferenced CurveParams for +// the specified curve. This is used to avoid the logic for +// upgrading a curve to its specific implementation, forcing +// usage of the generic implementation. +func genericParamsForCurve(c elliptic.Curve) *elliptic.CurveParams { + d := *(c.Params()) + return &d +} + +func TestKeyGeneration(t *testing.T) { + testAllCurves(t, testKeyGeneration) +} + +func testKeyGeneration(t *testing.T, c elliptic.Curve) { + priv, err := GenerateKey(c, rand.Reader) + if err != nil { + t.Fatal(err) + } + if !c.IsOnCurve(priv.PublicKey.X, priv.PublicKey.Y) { + t.Errorf("public key invalid: %s", err) + } +} + +func TestSignAndVerify(t *testing.T) { + testAllCurves(t, testSignAndVerify) +} + +func testSignAndVerify(t *testing.T, c elliptic.Curve) { + priv, _ := GenerateKey(c, rand.Reader) + + hashed := []byte("testing") + r, s, err := Sign(rand.Reader, priv, hashed) + if err != nil { + t.Errorf("error signing: %s", err) + return + } + + if !Verify(&priv.PublicKey, hashed, r, s) { + t.Errorf("Verify failed") + } + + hashed[0] ^= 0xff + if Verify(&priv.PublicKey, hashed, r, s) { + t.Errorf("Verify always works!") + } +} + +func TestSignAndVerifyASN1(t *testing.T) { + testAllCurves(t, testSignAndVerifyASN1) +} + +func testSignAndVerifyASN1(t *testing.T, c elliptic.Curve) { + priv, _ := GenerateKey(c, rand.Reader) + + hashed := []byte("testing") + sig, err := SignASN1(rand.Reader, priv, hashed) + if err != nil { + t.Errorf("error signing: %s", err) + return + } + + if !VerifyASN1(&priv.PublicKey, hashed, sig) { + t.Errorf("VerifyASN1 failed") + } + + hashed[0] ^= 0xff + if VerifyASN1(&priv.PublicKey, hashed, sig) { + t.Errorf("VerifyASN1 always works!") + } +} + +func TestNonceSafety(t *testing.T) { + testAllCurves(t, testNonceSafety) +} + +func testNonceSafety(t *testing.T, c elliptic.Curve) { + priv, _ := GenerateKey(c, rand.Reader) + + hashed := []byte("testing") + r0, s0, err := Sign(zeroReader, priv, hashed) + if err != nil { + t.Errorf("error signing: %s", err) + return + } + + hashed = []byte("testing...") + r1, s1, err := Sign(zeroReader, priv, hashed) + if err != nil { + t.Errorf("error signing: %s", err) + return + } + + if s0.Cmp(s1) == 0 { + // This should never happen. + t.Errorf("the signatures on two different messages were the same") + } + + if r0.Cmp(r1) == 0 { + t.Errorf("the nonce used for two different messages was the same") + } +} + +type readerFunc func([]byte) (int, error) + +func (f readerFunc) Read(b []byte) (int, error) { return f(b) } + +var zeroReader = readerFunc(func(b []byte) (int, error) { + clear(b) + return len(b), nil +}) + +func TestINDCCA(t *testing.T) { + testAllCurves(t, testINDCCA) +} + +func testINDCCA(t *testing.T, c elliptic.Curve) { + priv, _ := GenerateKey(c, rand.Reader) + + hashed := []byte("testing") + r0, s0, err := Sign(rand.Reader, priv, hashed) + if err != nil { + t.Errorf("error signing: %s", err) + return + } + + r1, s1, err := Sign(rand.Reader, priv, hashed) + if err != nil { + t.Errorf("error signing: %s", err) + return + } + + if s0.Cmp(s1) == 0 { + t.Errorf("two signatures of the same message produced the same result") + } + + if r0.Cmp(r1) == 0 { + t.Errorf("two signatures of the same message produced the same nonce") + } +} + +func fromHex(s string) *big.Int { + r, ok := new(big.Int).SetString(s, 16) + if !ok { + panic("bad hex") + } + return r +} + +func TestVectors(t *testing.T) { + cryptotest.TestAllImplementations(t, "ecdsa", testVectors) +} + +func testVectors(t *testing.T) { + // This test runs the full set of NIST test vectors from + // https://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3ecdsatestvectors.zip + // + // The SigVer.rsp file has been edited to remove test vectors for + // unsupported algorithms and has been compressed. + + if testing.Short() { + return + } + + f, err := os.Open("testdata/SigVer.rsp.bz2") + if err != nil { + t.Fatal(err) + } + + buf := bufio.NewReader(bzip2.NewReader(f)) + + lineNo := 1 + var h hash.Hash + var msg []byte + var hashed []byte + var r, s *big.Int + pub := new(PublicKey) + + for { + line, err := buf.ReadString('\n') + if len(line) == 0 { + if err == io.EOF { + break + } + t.Fatalf("error reading from input: %s", err) + } + lineNo++ + // Need to remove \r\n from the end of the line. + if !strings.HasSuffix(line, "\r\n") { + t.Fatalf("bad line ending (expected \\r\\n) on line %d", lineNo) + } + line = line[:len(line)-2] + + if len(line) == 0 || line[0] == '#' { + continue + } + + if line[0] == '[' { + line = line[1 : len(line)-1] + curve, hash, _ := strings.Cut(line, ",") + + switch curve { + case "P-224": + pub.Curve = elliptic.P224() + case "P-256": + pub.Curve = elliptic.P256() + case "P-384": + pub.Curve = elliptic.P384() + case "P-521": + pub.Curve = elliptic.P521() + default: + pub.Curve = nil + } + + switch hash { + case "SHA-1": + h = sha1.New() + case "SHA-224": + h = sha256.New224() + case "SHA-256": + h = sha256.New() + case "SHA-384": + h = sha512.New384() + case "SHA-512": + h = sha512.New() + default: + h = nil + } + + continue + } + + if h == nil || pub.Curve == nil { + continue + } + + switch { + case strings.HasPrefix(line, "Msg = "): + if msg, err = hex.DecodeString(line[6:]); err != nil { + t.Fatalf("failed to decode message on line %d: %s", lineNo, err) + } + case strings.HasPrefix(line, "Qx = "): + pub.X = fromHex(line[5:]) + case strings.HasPrefix(line, "Qy = "): + pub.Y = fromHex(line[5:]) + case strings.HasPrefix(line, "R = "): + r = fromHex(line[4:]) + case strings.HasPrefix(line, "S = "): + s = fromHex(line[4:]) + case strings.HasPrefix(line, "Result = "): + expected := line[9] == 'P' + h.Reset() + h.Write(msg) + hashed := h.Sum(hashed[:0]) + if Verify(pub, hashed, r, s) != expected { + t.Fatalf("incorrect result on line %d", lineNo) + } + default: + t.Fatalf("unknown variable on line %d: %s", lineNo, line) + } + } +} + +func TestNegativeInputs(t *testing.T) { + testAllCurves(t, testNegativeInputs) +} + +func testNegativeInputs(t *testing.T, curve elliptic.Curve) { + key, err := GenerateKey(curve, rand.Reader) + if err != nil { + t.Errorf("failed to generate key") + } + + var hash [32]byte + r := new(big.Int).SetInt64(1) + r.Lsh(r, 550 /* larger than any supported curve */) + r.Neg(r) + + if Verify(&key.PublicKey, hash[:], r, r) { + t.Errorf("bogus signature accepted") + } +} + +func TestZeroHashSignature(t *testing.T) { + testAllCurves(t, testZeroHashSignature) +} + +func testZeroHashSignature(t *testing.T, curve elliptic.Curve) { + zeroHash := make([]byte, 64) + + privKey, err := GenerateKey(curve, rand.Reader) + if err != nil { + panic(err) + } + + // Sign a hash consisting of all zeros. + r, s, err := Sign(rand.Reader, privKey, zeroHash) + if err != nil { + panic(err) + } + + // Confirm that it can be verified. + if !Verify(&privKey.PublicKey, zeroHash, r, s) { + t.Errorf("zero hash signature verify failed for %T", curve) + } +} + +func TestZeroSignature(t *testing.T) { + testAllCurves(t, testZeroSignature) +} + +func testZeroSignature(t *testing.T, curve elliptic.Curve) { + privKey, err := GenerateKey(curve, rand.Reader) + if err != nil { + panic(err) + } + + if Verify(&privKey.PublicKey, make([]byte, 64), big.NewInt(0), big.NewInt(0)) { + t.Errorf("Verify with r,s=0 succeeded: %T", curve) + } +} + +func TestNegativeSignature(t *testing.T) { + testAllCurves(t, testNegativeSignature) +} + +func testNegativeSignature(t *testing.T, curve elliptic.Curve) { + zeroHash := make([]byte, 64) + + privKey, err := GenerateKey(curve, rand.Reader) + if err != nil { + panic(err) + } + r, s, err := Sign(rand.Reader, privKey, zeroHash) + if err != nil { + panic(err) + } + + r = r.Neg(r) + if Verify(&privKey.PublicKey, zeroHash, r, s) { + t.Errorf("Verify with r=-r succeeded: %T", curve) + } +} + +func TestRPlusNSignature(t *testing.T) { + testAllCurves(t, testRPlusNSignature) +} + +func testRPlusNSignature(t *testing.T, curve elliptic.Curve) { + zeroHash := make([]byte, 64) + + privKey, err := GenerateKey(curve, rand.Reader) + if err != nil { + panic(err) + } + r, s, err := Sign(rand.Reader, privKey, zeroHash) + if err != nil { + panic(err) + } + + r = r.Add(r, curve.Params().N) + if Verify(&privKey.PublicKey, zeroHash, r, s) { + t.Errorf("Verify with r=r+n succeeded: %T", curve) + } +} + +func TestRMinusNSignature(t *testing.T) { + testAllCurves(t, testRMinusNSignature) +} + +func testRMinusNSignature(t *testing.T, curve elliptic.Curve) { + zeroHash := make([]byte, 64) + + privKey, err := GenerateKey(curve, rand.Reader) + if err != nil { + panic(err) + } + r, s, err := Sign(rand.Reader, privKey, zeroHash) + if err != nil { + panic(err) + } + + r = r.Sub(r, curve.Params().N) + if Verify(&privKey.PublicKey, zeroHash, r, s) { + t.Errorf("Verify with r=r-n succeeded: %T", curve) + } +} + +func TestRFC6979(t *testing.T) { + t.Run("P-224", func(t *testing.T) { + testRFC6979(t, elliptic.P224(), + "F220266E1105BFE3083E03EC7A3A654651F45E37167E88600BF257C1", + "00CF08DA5AD719E42707FA431292DEA11244D64FC51610D94B130D6C", + "EEAB6F3DEBE455E3DBF85416F7030CBD94F34F2D6F232C69F3C1385A", + "sample", + "61AA3DA010E8E8406C656BC477A7A7189895E7E840CDFE8FF42307BA", + "BC814050DAB5D23770879494F9E0A680DC1AF7161991BDE692B10101") + testRFC6979(t, elliptic.P224(), + "F220266E1105BFE3083E03EC7A3A654651F45E37167E88600BF257C1", + "00CF08DA5AD719E42707FA431292DEA11244D64FC51610D94B130D6C", + "EEAB6F3DEBE455E3DBF85416F7030CBD94F34F2D6F232C69F3C1385A", + "test", + "AD04DDE87B84747A243A631EA47A1BA6D1FAA059149AD2440DE6FBA6", + "178D49B1AE90E3D8B629BE3DB5683915F4E8C99FDF6E666CF37ADCFD") + }) + t.Run("P-256", func(t *testing.T) { + // This vector was bruteforced to find a message that causes the + // generation of k to loop. It was checked against + // github.com/codahale/rfc6979 (https://go.dev/play/p/FK5-fmKf7eK), + // OpenSSL 3.2.0 (https://github.com/openssl/openssl/pull/23130), + // and python-ecdsa: + // + // ecdsa.keys.SigningKey.from_secret_exponent( + // 0xC9AFA9D845BA75166B5C215767B1D6934E50C3DB36E89B127B8A622B120F6721, + // ecdsa.curves.curve_by_name("NIST256p"), hashlib.sha256).sign_deterministic( + // b"wv[vnX", hashlib.sha256, lambda r, s, order: print(hex(r), hex(s))) + // + testRFC6979(t, elliptic.P256(), + "C9AFA9D845BA75166B5C215767B1D6934E50C3DB36E89B127B8A622B120F6721", + "60FED4BA255A9D31C961EB74C6356D68C049B8923B61FA6CE669622E60F29FB6", + "7903FE1008B8BC99A41AE9E95628BC64F2F1B20C2D7E9F5177A3C294D4462299", + "wv[vnX", + "EFD9073B652E76DA1B5A019C0E4A2E3FA529B035A6ABB91EF67F0ED7A1F21234", + "3DB4706C9D9F4A4FE13BB5E08EF0FAB53A57DBAB2061C83A35FA411C68D2BA33") + + // The remaining vectors are from RFC 6979. + testRFC6979(t, elliptic.P256(), + "C9AFA9D845BA75166B5C215767B1D6934E50C3DB36E89B127B8A622B120F6721", + "60FED4BA255A9D31C961EB74C6356D68C049B8923B61FA6CE669622E60F29FB6", + "7903FE1008B8BC99A41AE9E95628BC64F2F1B20C2D7E9F5177A3C294D4462299", + "sample", + "EFD48B2AACB6A8FD1140DD9CD45E81D69D2C877B56AAF991C34D0EA84EAF3716", + "F7CB1C942D657C41D436C7A1B6E29F65F3E900DBB9AFF4064DC4AB2F843ACDA8") + testRFC6979(t, elliptic.P256(), + "C9AFA9D845BA75166B5C215767B1D6934E50C3DB36E89B127B8A622B120F6721", + "60FED4BA255A9D31C961EB74C6356D68C049B8923B61FA6CE669622E60F29FB6", + "7903FE1008B8BC99A41AE9E95628BC64F2F1B20C2D7E9F5177A3C294D4462299", + "test", + "F1ABB023518351CD71D881567B1EA663ED3EFCF6C5132B354F28D3B0B7D38367", + "019F4113742A2B14BD25926B49C649155F267E60D3814B4C0CC84250E46F0083") + }) + t.Run("P-384", func(t *testing.T) { + testRFC6979(t, elliptic.P384(), + "6B9D3DAD2E1B8C1C05B19875B6659F4DE23C3B667BF297BA9AA47740787137D896D5724E4C70A825F872C9EA60D2EDF5", + "EC3A4E415B4E19A4568618029F427FA5DA9A8BC4AE92E02E06AAE5286B300C64DEF8F0EA9055866064A254515480BC13", + "8015D9B72D7D57244EA8EF9AC0C621896708A59367F9DFB9F54CA84B3F1C9DB1288B231C3AE0D4FE7344FD2533264720", + "sample", + "21B13D1E013C7FA1392D03C5F99AF8B30C570C6F98D4EA8E354B63A21D3DAA33BDE1E888E63355D92FA2B3C36D8FB2CD", + "F3AA443FB107745BF4BD77CB3891674632068A10CA67E3D45DB2266FA7D1FEEBEFDC63ECCD1AC42EC0CB8668A4FA0AB0") + testRFC6979(t, elliptic.P384(), + "6B9D3DAD2E1B8C1C05B19875B6659F4DE23C3B667BF297BA9AA47740787137D896D5724E4C70A825F872C9EA60D2EDF5", + "EC3A4E415B4E19A4568618029F427FA5DA9A8BC4AE92E02E06AAE5286B300C64DEF8F0EA9055866064A254515480BC13", + "8015D9B72D7D57244EA8EF9AC0C621896708A59367F9DFB9F54CA84B3F1C9DB1288B231C3AE0D4FE7344FD2533264720", + "test", + "6D6DEFAC9AB64DABAFE36C6BF510352A4CC27001263638E5B16D9BB51D451559F918EEDAF2293BE5B475CC8F0188636B", + "2D46F3BECBCC523D5F1A1256BF0C9B024D879BA9E838144C8BA6BAEB4B53B47D51AB373F9845C0514EEFB14024787265") + }) + t.Run("P-521", func(t *testing.T) { + testRFC6979(t, elliptic.P521(), + "0FAD06DAA62BA3B25D2FB40133DA757205DE67F5BB0018FEE8C86E1B68C7E75CAA896EB32F1F47C70855836A6D16FCC1466F6D8FBEC67DB89EC0C08B0E996B83538", + "1894550D0785932E00EAA23B694F213F8C3121F86DC97A04E5A7167DB4E5BCD371123D46E45DB6B5D5370A7F20FB633155D38FFA16D2BD761DCAC474B9A2F5023A4", + "0493101C962CD4D2FDDF782285E64584139C2F91B47F87FF82354D6630F746A28A0DB25741B5B34A828008B22ACC23F924FAAFBD4D33F81EA66956DFEAA2BFDFCF5", + "sample", + "1511BB4D675114FE266FC4372B87682BAECC01D3CC62CF2303C92B3526012659D16876E25C7C1E57648F23B73564D67F61C6F14D527D54972810421E7D87589E1A7", + "04A171143A83163D6DF460AAF61522695F207A58B95C0644D87E52AA1A347916E4F7A72930B1BC06DBE22CE3F58264AFD23704CBB63B29B931F7DE6C9D949A7ECFC") + testRFC6979(t, elliptic.P521(), + "0FAD06DAA62BA3B25D2FB40133DA757205DE67F5BB0018FEE8C86E1B68C7E75CAA896EB32F1F47C70855836A6D16FCC1466F6D8FBEC67DB89EC0C08B0E996B83538", + "1894550D0785932E00EAA23B694F213F8C3121F86DC97A04E5A7167DB4E5BCD371123D46E45DB6B5D5370A7F20FB633155D38FFA16D2BD761DCAC474B9A2F5023A4", + "0493101C962CD4D2FDDF782285E64584139C2F91B47F87FF82354D6630F746A28A0DB25741B5B34A828008B22ACC23F924FAAFBD4D33F81EA66956DFEAA2BFDFCF5", + "test", + "00E871C4A14F993C6C7369501900C4BC1E9C7B0B4BA44E04868B30B41D8071042EB28C4C250411D0CE08CD197E4188EA4876F279F90B3D8D74A3C76E6F1E4656AA8", + "0CD52DBAA33B063C3A6CD8058A1FB0A46A4754B034FCC644766CA14DA8CA5CA9FDE00E88C1AD60CCBA759025299079D7A427EC3CC5B619BFBC828E7769BCD694E86") + }) +} + +func testRFC6979(t *testing.T, curve elliptic.Curve, D, X, Y, msg, r, s string) { + priv := &PrivateKey{ + D: fromHex(D), + PublicKey: PublicKey{ + Curve: curve, + X: fromHex(X), + Y: fromHex(Y), + }, + } + h := sha256.Sum256([]byte(msg)) + sig, err := priv.Sign(nil, h[:], crypto.SHA256) + if err != nil { + t.Fatal(err) + } + expected, err := encodeSignature(fromHex(r).Bytes(), fromHex(s).Bytes()) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(sig, expected) { + t.Errorf("signature mismatch:\n got: %x\nwant: %x", sig, expected) + } +} + +func TestParseAndBytesRoundTrip(t *testing.T) { + testAllCurves(t, testParseAndBytesRoundTrip) +} + +func testParseAndBytesRoundTrip(t *testing.T, curve elliptic.Curve) { + if strings.HasSuffix(t.Name(), "/Generic") { + t.Skip("these methods don't support generic curves") + } + priv, _ := GenerateKey(curve, rand.Reader) + + b, err := priv.PublicKey.Bytes() + if err != nil { + t.Fatalf("failed to serialize private key's public key: %v", err) + } + if b[0] != 4 { + t.Fatalf("public key bytes doesn't start with 0x04 (uncompressed format)") + } + p, err := ParseUncompressedPublicKey(curve, b) + if err != nil { + t.Fatalf("failed to parse private key's public key: %v", err) + } + if !priv.PublicKey.Equal(p) { + t.Errorf("parsed private key's public key doesn't match original") + } + + bk, err := priv.Bytes() + if err != nil { + t.Fatalf("failed to serialize private key: %v", err) + } + k, err := ParseRawPrivateKey(curve, bk) + if err != nil { + t.Fatalf("failed to parse private key: %v", err) + } + if !priv.Equal(k) { + t.Errorf("parsed private key doesn't match original") + } + + if curve != elliptic.P224() { + privECDH, err := priv.ECDH() + if err != nil { + t.Fatalf("failed to convert private key to ECDH: %v", err) + } + + pp, err := privECDH.Curve().NewPublicKey(b) + if err != nil { + t.Fatalf("failed to parse with ECDH: %v", err) + } + if !privECDH.PublicKey().Equal(pp) { + t.Errorf("parsed ECDH public key doesn't match original") + } + if !bytes.Equal(b, pp.Bytes()) { + t.Errorf("encoded ECDH public key doesn't match Bytes") + } + + kk, err := privECDH.Curve().NewPrivateKey(bk) + if err != nil { + t.Fatalf("failed to parse with ECDH: %v", err) + } + if !privECDH.Equal(kk) { + t.Errorf("parsed ECDH private key doesn't match original") + } + if !bytes.Equal(bk, kk.Bytes()) { + t.Errorf("encoded ECDH private key doesn't match Bytes") + } + } +} + +func TestInvalidPublicKeys(t *testing.T) { + testAllCurves(t, testInvalidPublicKeys) +} + +func testInvalidPublicKeys(t *testing.T, curve elliptic.Curve) { + t.Run("Infinity", func(t *testing.T) { + k := &PublicKey{Curve: curve, X: big.NewInt(0), Y: big.NewInt(0)} + if _, err := k.Bytes(); err == nil { + t.Errorf("PublicKey.Bytes accepted infinity") + } + + b := []byte{0} + if _, err := ParseUncompressedPublicKey(curve, b); err == nil { + t.Errorf("ParseUncompressedPublicKey accepted infinity") + } + b = make([]byte, 1+2*(curve.Params().BitSize+7)/8) + b[0] = 4 + if _, err := ParseUncompressedPublicKey(curve, b); err == nil { + t.Errorf("ParseUncompressedPublicKey accepted infinity") + } + }) + t.Run("NotOnCurve", func(t *testing.T) { + k, _ := GenerateKey(curve, rand.Reader) + k.X = k.X.Add(k.X, big.NewInt(1)) + if _, err := k.Bytes(); err == nil { + t.Errorf("PublicKey.Bytes accepted not on curve") + } + + b := make([]byte, 1+2*(curve.Params().BitSize+7)/8) + b[0] = 4 + k.X.FillBytes(b[1 : 1+len(b)/2]) + k.Y.FillBytes(b[1+len(b)/2:]) + if _, err := ParseUncompressedPublicKey(curve, b); err == nil { + t.Errorf("ParseUncompressedPublicKey accepted not on curve") + } + }) + t.Run("Compressed", func(t *testing.T) { + k, _ := GenerateKey(curve, rand.Reader) + b := elliptic.MarshalCompressed(curve, k.X, k.Y) + if _, err := ParseUncompressedPublicKey(curve, b); err == nil { + t.Errorf("ParseUncompressedPublicKey accepted compressed key") + } + }) +} + +func TestInvalidPrivateKeys(t *testing.T) { + testAllCurves(t, testInvalidPrivateKeys) +} + +func testInvalidPrivateKeys(t *testing.T, curve elliptic.Curve) { + t.Run("Zero", func(t *testing.T) { + k := &PrivateKey{PublicKey{curve, big.NewInt(0), big.NewInt(0)}, big.NewInt(0)} + if _, err := k.Bytes(); err == nil { + t.Errorf("PrivateKey.Bytes accepted zero key") + } + + b := make([]byte, (curve.Params().BitSize+7)/8) + if _, err := ParseRawPrivateKey(curve, b); err == nil { + t.Errorf("ParseRawPrivateKey accepted zero key") + } + }) + t.Run("Overflow", func(t *testing.T) { + d := new(big.Int).Add(curve.Params().N, big.NewInt(5)) + x, y := curve.ScalarBaseMult(d.Bytes()) + k := &PrivateKey{PublicKey{curve, x, y}, d} + if _, err := k.Bytes(); err == nil { + t.Errorf("PrivateKey.Bytes accepted overflow key") + } + + b := make([]byte, (curve.Params().BitSize+7)/8) + k.D.FillBytes(b) + if _, err := ParseRawPrivateKey(curve, b); err == nil { + t.Errorf("ParseRawPrivateKey accepted overflow key") + } + }) + t.Run("Length", func(t *testing.T) { + b := []byte{1, 2, 3} + if _, err := ParseRawPrivateKey(curve, b); err == nil { + t.Errorf("ParseRawPrivateKey accepted short key") + } + + b = make([]byte, (curve.Params().BitSize+7)/8) + b = append(b, []byte{1, 2, 3}...) + if _, err := ParseRawPrivateKey(curve, b); err == nil { + t.Errorf("ParseRawPrivateKey accepted long key") + } + }) +} + +func benchmarkAllCurves(b *testing.B, f func(*testing.B, elliptic.Curve)) { + tests := []struct { + name string + curve elliptic.Curve + }{ + {"P256", elliptic.P256()}, + {"P384", elliptic.P384()}, + {"P521", elliptic.P521()}, + } + for _, test := range tests { + curve := test.curve + b.Run(test.name, func(b *testing.B) { + f(b, curve) + }) + } +} + +func BenchmarkSign(b *testing.B) { + benchmarkAllCurves(b, func(b *testing.B, curve elliptic.Curve) { + r := bufio.NewReaderSize(rand.Reader, 1<<15) + priv, err := GenerateKey(curve, r) + if err != nil { + b.Fatal(err) + } + hashed := []byte("testing") + + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + sig, err := SignASN1(r, priv, hashed) + if err != nil { + b.Fatal(err) + } + // Prevent the compiler from optimizing out the operation. + hashed[0] = sig[0] + } + }) +} + +func BenchmarkVerify(b *testing.B) { + benchmarkAllCurves(b, func(b *testing.B, curve elliptic.Curve) { + r := bufio.NewReaderSize(rand.Reader, 1<<15) + priv, err := GenerateKey(curve, r) + if err != nil { + b.Fatal(err) + } + hashed := []byte("testing") + sig, err := SignASN1(r, priv, hashed) + if err != nil { + b.Fatal(err) + } + + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + if !VerifyASN1(&priv.PublicKey, hashed, sig) { + b.Fatal("verify failed") + } + } + }) +} + +func BenchmarkGenerateKey(b *testing.B) { + benchmarkAllCurves(b, func(b *testing.B, curve elliptic.Curve) { + r := bufio.NewReaderSize(rand.Reader, 1<<15) + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + if _, err := GenerateKey(curve, r); err != nil { + b.Fatal(err) + } + } + }) +} diff --git a/go/src/crypto/ecdsa/equal_test.go b/go/src/crypto/ecdsa/equal_test.go new file mode 100644 index 0000000000000000000000000000000000000000..53ac8504c2f692b887da053acfe890e3c33b12b1 --- /dev/null +++ b/go/src/crypto/ecdsa/equal_test.go @@ -0,0 +1,75 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package ecdsa_test + +import ( + "crypto" + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "crypto/x509" + "testing" +) + +func testEqual(t *testing.T, c elliptic.Curve) { + private, _ := ecdsa.GenerateKey(c, rand.Reader) + public := &private.PublicKey + + if !public.Equal(public) { + t.Errorf("public key is not equal to itself: %v", public) + } + if !public.Equal(crypto.Signer(private).Public().(*ecdsa.PublicKey)) { + t.Errorf("private.Public() is not Equal to public: %q", public) + } + if !private.Equal(private) { + t.Errorf("private key is not equal to itself: %v", private) + } + + enc, err := x509.MarshalPKCS8PrivateKey(private) + if err != nil { + t.Fatal(err) + } + decoded, err := x509.ParsePKCS8PrivateKey(enc) + if err != nil { + t.Fatal(err) + } + if !public.Equal(decoded.(crypto.Signer).Public()) { + t.Errorf("public key is not equal to itself after decoding: %v", public) + } + if !private.Equal(decoded) { + t.Errorf("private key is not equal to itself after decoding: %v", private) + } + + other, _ := ecdsa.GenerateKey(c, rand.Reader) + if public.Equal(other.Public()) { + t.Errorf("different public keys are Equal") + } + if private.Equal(other) { + t.Errorf("different private keys are Equal") + } + + // Ensure that keys with the same coordinates but on different curves + // aren't considered Equal. + differentCurve := &ecdsa.PublicKey{} + *differentCurve = *public // make a copy of the public key + if differentCurve.Curve == elliptic.P256() { + differentCurve.Curve = elliptic.P224() + } else { + differentCurve.Curve = elliptic.P256() + } + if public.Equal(differentCurve) { + t.Errorf("public keys with different curves are Equal") + } +} + +func TestEqual(t *testing.T) { + t.Run("P224", func(t *testing.T) { testEqual(t, elliptic.P224()) }) + if testing.Short() { + return + } + t.Run("P256", func(t *testing.T) { testEqual(t, elliptic.P256()) }) + t.Run("P384", func(t *testing.T) { testEqual(t, elliptic.P384()) }) + t.Run("P521", func(t *testing.T) { testEqual(t, elliptic.P521()) }) +} diff --git a/go/src/crypto/ecdsa/example_test.go b/go/src/crypto/ecdsa/example_test.go new file mode 100644 index 0000000000000000000000000000000000000000..652c1658f66327d2d5cd2bd5691ee9be44ee2e2c --- /dev/null +++ b/go/src/crypto/ecdsa/example_test.go @@ -0,0 +1,32 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package ecdsa_test + +import ( + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "crypto/sha256" + "fmt" +) + +func Example() { + privateKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + panic(err) + } + + msg := "hello, world" + hash := sha256.Sum256([]byte(msg)) + + sig, err := ecdsa.SignASN1(rand.Reader, privateKey, hash[:]) + if err != nil { + panic(err) + } + fmt.Printf("signature: %x\n", sig) + + valid := ecdsa.VerifyASN1(&privateKey.PublicKey, hash[:], sig) + fmt.Println("signature verified:", valid) +} diff --git a/go/src/crypto/ecdsa/notboring.go b/go/src/crypto/ecdsa/notboring.go new file mode 100644 index 0000000000000000000000000000000000000000..039bd82ed21f9f35122127de7a2b3a846914cbd7 --- /dev/null +++ b/go/src/crypto/ecdsa/notboring.go @@ -0,0 +1,16 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !boringcrypto + +package ecdsa + +import "crypto/internal/boring" + +func boringPublicKey(*PublicKey) (*boring.PublicKeyECDSA, error) { + panic("boringcrypto: not available") +} +func boringPrivateKey(*PrivateKey) (*boring.PrivateKeyECDSA, error) { + panic("boringcrypto: not available") +} diff --git a/go/src/crypto/ed25519/ed25519.go b/go/src/crypto/ed25519/ed25519.go new file mode 100644 index 0000000000000000000000000000000000000000..a0263638ef19fe744b6e4694d63a0a23517a23ab --- /dev/null +++ b/go/src/crypto/ed25519/ed25519.go @@ -0,0 +1,257 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package ed25519 implements the Ed25519 signature algorithm. See +// https://ed25519.cr.yp.to/. +// +// These functions are also compatible with the “Ed25519” function defined in +// RFC 8032. However, unlike RFC 8032's formulation, this package's private key +// representation includes a public key suffix to make multiple signing +// operations with the same key more efficient. This package refers to the RFC +// 8032 private key as the “seed”. +// +// Operations involving private keys are implemented using constant-time +// algorithms. +package ed25519 + +import ( + "crypto" + "crypto/internal/fips140/ed25519" + "crypto/internal/fips140cache" + "crypto/internal/fips140only" + "crypto/internal/rand" + cryptorand "crypto/rand" + "crypto/subtle" + "errors" + "internal/godebug" + "io" + "strconv" +) + +const ( + // PublicKeySize is the size, in bytes, of public keys as used in this package. + PublicKeySize = 32 + // PrivateKeySize is the size, in bytes, of private keys as used in this package. + PrivateKeySize = 64 + // SignatureSize is the size, in bytes, of signatures generated and verified by this package. + SignatureSize = 64 + // SeedSize is the size, in bytes, of private key seeds. These are the private key representations used by RFC 8032. + SeedSize = 32 +) + +// PublicKey is the type of Ed25519 public keys. +type PublicKey []byte + +// Any methods implemented on PublicKey might need to also be implemented on +// PrivateKey, as the latter embeds the former and will expose its methods. + +// Equal reports whether pub and x have the same value. +func (pub PublicKey) Equal(x crypto.PublicKey) bool { + xx, ok := x.(PublicKey) + if !ok { + return false + } + return subtle.ConstantTimeCompare(pub, xx) == 1 +} + +// PrivateKey is the type of Ed25519 private keys. It implements [crypto.Signer]. +type PrivateKey []byte + +// Public returns the [PublicKey] corresponding to priv. +func (priv PrivateKey) Public() crypto.PublicKey { + publicKey := make([]byte, PublicKeySize) + copy(publicKey, priv[32:]) + return PublicKey(publicKey) +} + +// Equal reports whether priv and x have the same value. +func (priv PrivateKey) Equal(x crypto.PrivateKey) bool { + xx, ok := x.(PrivateKey) + if !ok { + return false + } + return subtle.ConstantTimeCompare(priv, xx) == 1 +} + +// Seed returns the private key seed corresponding to priv. It is provided for +// interoperability with RFC 8032. RFC 8032's private keys correspond to seeds +// in this package. +func (priv PrivateKey) Seed() []byte { + return append(make([]byte, 0, SeedSize), priv[:SeedSize]...) +} + +// privateKeyCache uses a pointer to the first byte of underlying storage as a +// key, because [PrivateKey] is a slice header passed around by value. +var privateKeyCache fips140cache.Cache[byte, ed25519.PrivateKey] + +// Sign signs the given message with priv. rand is ignored and can be nil. +// +// If opts.HashFunc() is [crypto.SHA512], the pre-hashed variant Ed25519ph is used +// and message is expected to be a SHA-512 hash, otherwise opts.HashFunc() must +// be [crypto.Hash](0) and the message must not be hashed, as Ed25519 performs two +// passes over messages to be signed. +// +// A value of type [Options] can be used as opts, or crypto.Hash(0) or +// crypto.SHA512 directly to select plain Ed25519 or Ed25519ph, respectively. +func (priv PrivateKey) Sign(rand io.Reader, message []byte, opts crypto.SignerOpts) (signature []byte, err error) { + k, err := privateKeyCache.Get(&priv[0], func() (*ed25519.PrivateKey, error) { + return ed25519.NewPrivateKey(priv) + }, func(k *ed25519.PrivateKey) bool { + return subtle.ConstantTimeCompare(priv, k.Bytes()) == 1 + }) + if err != nil { + return nil, err + } + hash := opts.HashFunc() + context := "" + if opts, ok := opts.(*Options); ok { + context = opts.Context + } + switch { + case hash == crypto.SHA512: // Ed25519ph + return ed25519.SignPH(k, message, context) + case hash == crypto.Hash(0) && context != "": // Ed25519ctx + if fips140only.Enforced() { + return nil, errors.New("crypto/ed25519: use of Ed25519ctx is not allowed in FIPS 140-only mode") + } + return ed25519.SignCtx(k, message, context) + case hash == crypto.Hash(0): // Ed25519 + return ed25519.Sign(k, message), nil + default: + return nil, errors.New("ed25519: expected opts.HashFunc() zero (unhashed message, for standard Ed25519) or SHA-512 (for Ed25519ph)") + } +} + +// Options can be used with [PrivateKey.Sign] or [VerifyWithOptions] +// to select Ed25519 variants. +type Options struct { + // Hash can be zero for regular Ed25519, or crypto.SHA512 for Ed25519ph. + Hash crypto.Hash + + // Context, if not empty, selects Ed25519ctx or provides the context string + // for Ed25519ph. It can be at most 255 bytes in length. + Context string +} + +// HashFunc returns o.Hash. +func (o *Options) HashFunc() crypto.Hash { return o.Hash } + +var cryptocustomrand = godebug.New("cryptocustomrand") + +// GenerateKey generates a public/private key pair using entropy from random. +// +// If random is nil, a secure random source is used. (Before Go 1.26, a custom +// [crypto/rand.Reader] was used if set by the application. That behavior can be +// restored with GODEBUG=cryptocustomrand=1. This setting will be removed in a +// future Go release. Instead, use [testing/cryptotest.SetGlobalRandom].) +// +// The output of this function is deterministic, and equivalent to reading +// [SeedSize] bytes from random, and passing them to [NewKeyFromSeed]. +func GenerateKey(random io.Reader) (PublicKey, PrivateKey, error) { + if random == nil { + if cryptocustomrand.Value() == "1" { + random = cryptorand.Reader + if !rand.IsDefaultReader(random) { + cryptocustomrand.IncNonDefault() + } + } else { + random = rand.Reader + } + } + + seed := make([]byte, SeedSize) + if _, err := io.ReadFull(random, seed); err != nil { + return nil, nil, err + } + + privateKey := NewKeyFromSeed(seed) + publicKey := privateKey.Public().(PublicKey) + return publicKey, privateKey, nil +} + +// NewKeyFromSeed calculates a private key from a seed. It will panic if +// len(seed) is not [SeedSize]. This function is provided for interoperability +// with RFC 8032. RFC 8032's private keys correspond to seeds in this +// package. +func NewKeyFromSeed(seed []byte) PrivateKey { + // Outline the function body so that the returned key can be stack-allocated. + privateKey := make([]byte, PrivateKeySize) + newKeyFromSeed(privateKey, seed) + return privateKey +} + +func newKeyFromSeed(privateKey, seed []byte) { + k, err := ed25519.NewPrivateKeyFromSeed(seed) + if err != nil { + // NewPrivateKeyFromSeed only returns an error if the seed length is incorrect. + panic("ed25519: bad seed length: " + strconv.Itoa(len(seed))) + } + copy(privateKey, k.Bytes()) +} + +// Sign signs the message with privateKey and returns a signature. It will +// panic if len(privateKey) is not [PrivateKeySize]. +func Sign(privateKey PrivateKey, message []byte) []byte { + // Outline the function body so that the returned signature can be + // stack-allocated. + signature := make([]byte, SignatureSize) + sign(signature, privateKey, message) + return signature +} + +func sign(signature []byte, privateKey PrivateKey, message []byte) { + k, err := privateKeyCache.Get(&privateKey[0], func() (*ed25519.PrivateKey, error) { + return ed25519.NewPrivateKey(privateKey) + }, func(k *ed25519.PrivateKey) bool { + return subtle.ConstantTimeCompare(privateKey, k.Bytes()) == 1 + }) + if err != nil { + panic("ed25519: bad private key: " + err.Error()) + } + sig := ed25519.Sign(k, message) + copy(signature, sig) +} + +// Verify reports whether sig is a valid signature of message by publicKey. It +// will panic if len(publicKey) is not [PublicKeySize]. +// +// The inputs are not considered confidential, and may leak through timing side +// channels, or if an attacker has control of part of the inputs. +func Verify(publicKey PublicKey, message, sig []byte) bool { + return VerifyWithOptions(publicKey, message, sig, &Options{Hash: crypto.Hash(0)}) == nil +} + +// VerifyWithOptions reports whether sig is a valid signature of message by +// publicKey. A valid signature is indicated by returning a nil error. It will +// panic if len(publicKey) is not [PublicKeySize]. +// +// If opts.Hash is [crypto.SHA512], the pre-hashed variant Ed25519ph is used and +// message is expected to be a SHA-512 hash, otherwise opts.Hash must be +// [crypto.Hash](0) and the message must not be hashed, as Ed25519 performs two +// passes over messages to be signed. +// +// The inputs are not considered confidential, and may leak through timing side +// channels, or if an attacker has control of part of the inputs. +func VerifyWithOptions(publicKey PublicKey, message, sig []byte, opts *Options) error { + if l := len(publicKey); l != PublicKeySize { + panic("ed25519: bad public key length: " + strconv.Itoa(l)) + } + k, err := ed25519.NewPublicKey(publicKey) + if err != nil { + return err + } + switch { + case opts.Hash == crypto.SHA512: // Ed25519ph + return ed25519.VerifyPH(k, message, sig, opts.Context) + case opts.Hash == crypto.Hash(0) && opts.Context != "": // Ed25519ctx + if fips140only.Enforced() { + return errors.New("crypto/ed25519: use of Ed25519ctx is not allowed in FIPS 140-only mode") + } + return ed25519.VerifyCtx(k, message, sig, opts.Context) + case opts.Hash == crypto.Hash(0): // Ed25519 + return ed25519.Verify(k, message, sig) + default: + return errors.New("ed25519: expected opts.Hash zero (unhashed message, for standard Ed25519) or SHA-512 (for Ed25519ph)") + } +} diff --git a/go/src/crypto/ed25519/ed25519_test.go b/go/src/crypto/ed25519/ed25519_test.go new file mode 100644 index 0000000000000000000000000000000000000000..c8a23e3246a949bfd2faf55c9808b8f7d7c11fe5 --- /dev/null +++ b/go/src/crypto/ed25519/ed25519_test.go @@ -0,0 +1,427 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package ed25519 + +import ( + "bufio" + "bytes" + "compress/gzip" + "crypto" + "crypto/internal/cryptotest" + "crypto/rand" + "crypto/sha512" + "encoding/hex" + "log" + "os" + "strings" + "testing" +) + +func Example_ed25519ctx() { + pub, priv, err := GenerateKey(nil) + if err != nil { + log.Fatal(err) + } + + msg := []byte("The quick brown fox jumps over the lazy dog") + + sig, err := priv.Sign(nil, msg, &Options{ + Context: "Example_ed25519ctx", + }) + if err != nil { + log.Fatal(err) + } + + if err := VerifyWithOptions(pub, msg, sig, &Options{ + Context: "Example_ed25519ctx", + }); err != nil { + log.Fatal("invalid signature") + } +} + +func TestGenerateKey(t *testing.T) { + // nil is like using crypto/rand.Reader. + public, private, err := GenerateKey(nil) + if err != nil { + t.Fatal(err) + } + + if len(public) != PublicKeySize { + t.Errorf("public key has the wrong size: %d", len(public)) + } + if len(private) != PrivateKeySize { + t.Errorf("private key has the wrong size: %d", len(private)) + } + if !bytes.Equal(private.Public().(PublicKey), public) { + t.Errorf("public key doesn't match private key") + } + fromSeed := NewKeyFromSeed(private.Seed()) + if !bytes.Equal(private, fromSeed) { + t.Errorf("recreating key pair from seed gave different private key") + } + + _, k2, err := GenerateKey(nil) + if err != nil { + t.Fatal(err) + } + if bytes.Equal(private, k2) { + t.Errorf("GenerateKey returned the same private key twice") + } + + _, k3, err := GenerateKey(rand.Reader) + if err != nil { + t.Fatal(err) + } + if bytes.Equal(private, k3) { + t.Errorf("GenerateKey returned the same private key twice") + } + + // GenerateKey is documented to be the same as NewKeyFromSeed. + seed := make([]byte, SeedSize) + rand.Read(seed) + _, k4, err := GenerateKey(bytes.NewReader(seed)) + if err != nil { + t.Fatal(err) + } + k4n := NewKeyFromSeed(seed) + if !bytes.Equal(k4, k4n) { + t.Errorf("GenerateKey with seed gave different private key") + } +} + +type zeroReader struct{} + +func (zeroReader) Read(buf []byte) (int, error) { + clear(buf) + return len(buf), nil +} + +func TestSignVerify(t *testing.T) { + var zero zeroReader + public, private, _ := GenerateKey(zero) + + message := []byte("test message") + sig := Sign(private, message) + if !Verify(public, message, sig) { + t.Errorf("valid signature rejected") + } + + wrongMessage := []byte("wrong message") + if Verify(public, wrongMessage, sig) { + t.Errorf("signature of different message accepted") + } +} + +func TestSignVerifyHashed(t *testing.T) { + // From RFC 8032, Section 7.3 + key, _ := hex.DecodeString("833fe62409237b9d62ec77587520911e9a759cec1d19755b7da901b96dca3d42ec172b93ad5e563bf4932c70e1245034c35467ef2efd4d64ebf819683467e2bf") + expectedSig, _ := hex.DecodeString("98a70222f0b8121aa9d30f813d683f809e462b469c7ff87639499bb94e6dae4131f85042463c2a355a2003d062adf5aaa10b8c61e636062aaad11c2a26083406") + message, _ := hex.DecodeString("616263") + + private := PrivateKey(key) + public := private.Public().(PublicKey) + hash := sha512.Sum512(message) + sig, err := private.Sign(nil, hash[:], crypto.SHA512) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(sig, expectedSig) { + t.Error("signature doesn't match test vector") + } + sig, err = private.Sign(nil, hash[:], &Options{Hash: crypto.SHA512}) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(sig, expectedSig) { + t.Error("signature doesn't match test vector") + } + if err := VerifyWithOptions(public, hash[:], sig, &Options{Hash: crypto.SHA512}); err != nil { + t.Errorf("valid signature rejected: %v", err) + } + + if err := VerifyWithOptions(public, hash[:], sig, &Options{Hash: crypto.SHA256}); err == nil { + t.Errorf("expected error for wrong hash") + } + + wrongHash := sha512.Sum512([]byte("wrong message")) + if VerifyWithOptions(public, wrongHash[:], sig, &Options{Hash: crypto.SHA512}) == nil { + t.Errorf("signature of different message accepted") + } + + sig[0] ^= 0xff + if VerifyWithOptions(public, hash[:], sig, &Options{Hash: crypto.SHA512}) == nil { + t.Errorf("invalid signature accepted") + } + sig[0] ^= 0xff + sig[SignatureSize-1] ^= 0xff + if VerifyWithOptions(public, hash[:], sig, &Options{Hash: crypto.SHA512}) == nil { + t.Errorf("invalid signature accepted") + } + + // The RFC provides no test vectors for Ed25519ph with context, so just sign + // and verify something. + sig, err = private.Sign(nil, hash[:], &Options{Hash: crypto.SHA512, Context: "123"}) + if err != nil { + t.Fatal(err) + } + if err := VerifyWithOptions(public, hash[:], sig, &Options{Hash: crypto.SHA512, Context: "123"}); err != nil { + t.Errorf("valid signature rejected: %v", err) + } + if err := VerifyWithOptions(public, hash[:], sig, &Options{Hash: crypto.SHA512, Context: "321"}); err == nil { + t.Errorf("expected error for wrong context") + } + if err := VerifyWithOptions(public, hash[:], sig, &Options{Hash: crypto.SHA256, Context: "123"}); err == nil { + t.Errorf("expected error for wrong hash") + } +} + +func TestSignVerifyContext(t *testing.T) { + // From RFC 8032, Section 7.2 + key, _ := hex.DecodeString("0305334e381af78f141cb666f6199f57bc3495335a256a95bd2a55bf546663f6dfc9425e4f968f7f0c29f0259cf5f9aed6851c2bb4ad8bfb860cfee0ab248292") + expectedSig, _ := hex.DecodeString("55a4cc2f70a54e04288c5f4cd1e45a7bb520b36292911876cada7323198dd87a8b36950b95130022907a7fb7c4e9b2d5f6cca685a587b4b21f4b888e4e7edb0d") + message, _ := hex.DecodeString("f726936d19c800494e3fdaff20b276a8") + context := "foo" + + private := PrivateKey(key) + public := private.Public().(PublicKey) + sig, err := private.Sign(nil, message, &Options{Context: context}) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(sig, expectedSig) { + t.Error("signature doesn't match test vector") + } + if err := VerifyWithOptions(public, message, sig, &Options{Context: context}); err != nil { + t.Errorf("valid signature rejected: %v", err) + } + + if VerifyWithOptions(public, []byte("bar"), sig, &Options{Context: context}) == nil { + t.Errorf("signature of different message accepted") + } + if VerifyWithOptions(public, message, sig, &Options{Context: "bar"}) == nil { + t.Errorf("signature with different context accepted") + } + + sig[0] ^= 0xff + if VerifyWithOptions(public, message, sig, &Options{Context: context}) == nil { + t.Errorf("invalid signature accepted") + } + sig[0] ^= 0xff + sig[SignatureSize-1] ^= 0xff + if VerifyWithOptions(public, message, sig, &Options{Context: context}) == nil { + t.Errorf("invalid signature accepted") + } +} + +func TestCryptoSigner(t *testing.T) { + var zero zeroReader + public, private, _ := GenerateKey(zero) + + signer := crypto.Signer(private) + + publicInterface := signer.Public() + public2, ok := publicInterface.(PublicKey) + if !ok { + t.Fatalf("expected PublicKey from Public() but got %T", publicInterface) + } + + if !bytes.Equal(public, public2) { + t.Errorf("public keys do not match: original:%x vs Public():%x", public, public2) + } + + message := []byte("message") + var noHash crypto.Hash + signature, err := signer.Sign(zero, message, noHash) + if err != nil { + t.Fatalf("error from Sign(): %s", err) + } + + signature2, err := signer.Sign(zero, message, &Options{Hash: noHash}) + if err != nil { + t.Fatalf("error from Sign(): %s", err) + } + if !bytes.Equal(signature, signature2) { + t.Errorf("signatures keys do not match") + } + + if !Verify(public, message, signature) { + t.Errorf("Verify failed on signature from Sign()") + } +} + +func TestEqual(t *testing.T) { + public, private, _ := GenerateKey(rand.Reader) + + if !public.Equal(public) { + t.Errorf("public key is not equal to itself: %q", public) + } + if !public.Equal(crypto.Signer(private).Public()) { + t.Errorf("private.Public() is not Equal to public: %q", public) + } + if !private.Equal(private) { + t.Errorf("private key is not equal to itself: %q", private) + } + + otherPub, otherPriv, _ := GenerateKey(rand.Reader) + if public.Equal(otherPub) { + t.Errorf("different public keys are Equal") + } + if private.Equal(otherPriv) { + t.Errorf("different private keys are Equal") + } +} + +func TestGolden(t *testing.T) { + // sign.input.gz is a selection of test cases from + // https://ed25519.cr.yp.to/python/sign.input + testDataZ, err := os.Open("testdata/sign.input.gz") + if err != nil { + t.Fatal(err) + } + defer testDataZ.Close() + testData, err := gzip.NewReader(testDataZ) + if err != nil { + t.Fatal(err) + } + defer testData.Close() + + scanner := bufio.NewScanner(testData) + lineNo := 0 + + for scanner.Scan() { + lineNo++ + + line := scanner.Text() + parts := strings.Split(line, ":") + if len(parts) != 5 { + t.Fatalf("bad number of parts on line %d", lineNo) + } + + privBytes, _ := hex.DecodeString(parts[0]) + pubKey, _ := hex.DecodeString(parts[1]) + msg, _ := hex.DecodeString(parts[2]) + sig, _ := hex.DecodeString(parts[3]) + // The signatures in the test vectors also include the message + // at the end, but we just want R and S. + sig = sig[:SignatureSize] + + if l := len(pubKey); l != PublicKeySize { + t.Fatalf("bad public key length on line %d: got %d bytes", lineNo, l) + } + + var priv [PrivateKeySize]byte + copy(priv[:], privBytes) + copy(priv[32:], pubKey) + + sig2 := Sign(priv[:], msg) + if !bytes.Equal(sig, sig2[:]) { + t.Errorf("different signature result on line %d: %x vs %x", lineNo, sig, sig2) + } + + if !Verify(pubKey, msg, sig2) { + t.Errorf("signature failed to verify on line %d", lineNo) + } + + priv2 := NewKeyFromSeed(priv[:32]) + if !bytes.Equal(priv[:], priv2) { + t.Errorf("recreating key pair gave different private key on line %d: %x vs %x", lineNo, priv[:], priv2) + } + + if pubKey2 := priv2.Public().(PublicKey); !bytes.Equal(pubKey, pubKey2) { + t.Errorf("recreating key pair gave different public key on line %d: %x vs %x", lineNo, pubKey, pubKey2) + } + + if seed := priv2.Seed(); !bytes.Equal(priv[:32], seed) { + t.Errorf("recreating key pair gave different seed on line %d: %x vs %x", lineNo, priv[:32], seed) + } + } + + if err := scanner.Err(); err != nil { + t.Fatalf("error reading test data: %s", err) + } +} + +func TestMalleability(t *testing.T) { + // https://tools.ietf.org/html/rfc8032#section-5.1.7 adds an additional test + // that s be in [0, order). This prevents someone from adding a multiple of + // order to s and obtaining a second valid signature for the same message. + msg := []byte{0x54, 0x65, 0x73, 0x74} + sig := []byte{ + 0x7c, 0x38, 0xe0, 0x26, 0xf2, 0x9e, 0x14, 0xaa, 0xbd, 0x05, 0x9a, + 0x0f, 0x2d, 0xb8, 0xb0, 0xcd, 0x78, 0x30, 0x40, 0x60, 0x9a, 0x8b, + 0xe6, 0x84, 0xdb, 0x12, 0xf8, 0x2a, 0x27, 0x77, 0x4a, 0xb0, 0x67, + 0x65, 0x4b, 0xce, 0x38, 0x32, 0xc2, 0xd7, 0x6f, 0x8f, 0x6f, 0x5d, + 0xaf, 0xc0, 0x8d, 0x93, 0x39, 0xd4, 0xee, 0xf6, 0x76, 0x57, 0x33, + 0x36, 0xa5, 0xc5, 0x1e, 0xb6, 0xf9, 0x46, 0xb3, 0x1d, + } + publicKey := []byte{ + 0x7d, 0x4d, 0x0e, 0x7f, 0x61, 0x53, 0xa6, 0x9b, 0x62, 0x42, 0xb5, + 0x22, 0xab, 0xbe, 0xe6, 0x85, 0xfd, 0xa4, 0x42, 0x0f, 0x88, 0x34, + 0xb1, 0x08, 0xc3, 0xbd, 0xae, 0x36, 0x9e, 0xf5, 0x49, 0xfa, + } + + if Verify(publicKey, msg, sig) { + t.Fatal("non-canonical signature accepted") + } +} + +func TestAllocations(t *testing.T) { + cryptotest.SkipTestAllocations(t) + seed := make([]byte, SeedSize) + priv := NewKeyFromSeed(seed) + if allocs := testing.AllocsPerRun(100, func() { + message := []byte("Hello, world!") + pub := priv.Public().(PublicKey) + signature := Sign(priv, message) + if !Verify(pub, message, signature) { + t.Fatal("signature didn't verify") + } + }); allocs > 0 { + t.Errorf("expected zero allocations, got %0.1f", allocs) + } +} + +func BenchmarkKeyGeneration(b *testing.B) { + var zero zeroReader + for i := 0; i < b.N; i++ { + if _, _, err := GenerateKey(zero); err != nil { + b.Fatal(err) + } + } +} + +func BenchmarkNewKeyFromSeed(b *testing.B) { + seed := make([]byte, SeedSize) + for i := 0; i < b.N; i++ { + _ = NewKeyFromSeed(seed) + } +} + +func BenchmarkSigning(b *testing.B) { + var zero zeroReader + _, priv, err := GenerateKey(zero) + if err != nil { + b.Fatal(err) + } + message := []byte("Hello, world!") + b.ResetTimer() + for i := 0; i < b.N; i++ { + Sign(priv, message) + } +} + +func BenchmarkVerification(b *testing.B) { + var zero zeroReader + pub, priv, err := GenerateKey(zero) + if err != nil { + b.Fatal(err) + } + message := []byte("Hello, world!") + signature := Sign(priv, message) + b.ResetTimer() + for i := 0; i < b.N; i++ { + Verify(pub, message, signature) + } +} diff --git a/go/src/crypto/ed25519/ed25519vectors_test.go b/go/src/crypto/ed25519/ed25519vectors_test.go new file mode 100644 index 0000000000000000000000000000000000000000..304257a993c100bd18c215c95783433ca7e5301d --- /dev/null +++ b/go/src/crypto/ed25519/ed25519vectors_test.go @@ -0,0 +1,94 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package ed25519_test + +import ( + "crypto/ed25519" + "crypto/internal/cryptotest" + "encoding/hex" + "encoding/json" + "os" + "path/filepath" + "testing" +) + +// TestEd25519Vectors runs a very large set of test vectors that exercise all +// combinations of low-order points, low-order components, and non-canonical +// encodings. These vectors lock in unspecified and spec-divergent behaviors in +// edge cases that are not security relevant in most contexts, but that can +// cause issues in consensus applications if changed. +// +// Our behavior matches the "classic" unwritten verification rules of the +// "ref10" reference implementation. +// +// Note that although we test for these edge cases, they are not covered by the +// Go 1 Compatibility Promise. Applications that need stable verification rules +// should use github.com/hdevalence/ed25519consensus. +// +// See https://hdevalence.ca/blog/2020-10-04-its-25519am for more details. +func TestEd25519Vectors(t *testing.T) { + jsonVectors := downloadEd25519Vectors(t) + var vectors []struct { + A, R, S, M string + Flags []string + } + if err := json.Unmarshal(jsonVectors, &vectors); err != nil { + t.Fatal(err) + } + for i, v := range vectors { + expectedToVerify := true + for _, f := range v.Flags { + switch f { + // We use the simplified verification formula that doesn't multiply + // by the cofactor, so any low order residue will cause the + // signature not to verify. + // + // This is allowed, but not required, by RFC 8032. + case "LowOrderResidue": + expectedToVerify = false + // Our point decoding allows non-canonical encodings (in violation + // of RFC 8032) but R is not decoded: instead, R is recomputed and + // compared bytewise against the canonical encoding. + case "NonCanonicalR": + expectedToVerify = false + } + } + + publicKey := decodeHex(t, v.A) + signature := append(decodeHex(t, v.R), decodeHex(t, v.S)...) + message := []byte(v.M) + + didVerify := ed25519.Verify(publicKey, message, signature) + if didVerify && !expectedToVerify { + t.Errorf("#%d: vector with flags %s unexpectedly verified", i, v.Flags) + } + if !didVerify && expectedToVerify { + t.Errorf("#%d: vector with flags %s unexpectedly rejected", i, v.Flags) + } + } +} + +func downloadEd25519Vectors(t *testing.T) []byte { + // Download the JSON test file from the GOPROXY with `go mod download`, + // pinning the version so test and module caching works as expected. + path := "filippo.io/mostly-harmless/ed25519vectors" + version := "v0.0.0-20210322192420-30a2d7243a94" + dir := cryptotest.FetchModule(t, path, version) + + jsonVectors, err := os.ReadFile(filepath.Join(dir, "ed25519vectors.json")) + if err != nil { + t.Fatalf("failed to read ed25519vectors.json: %v", err) + } + return jsonVectors +} + +func decodeHex(t *testing.T, s string) []byte { + t.Helper() + b, err := hex.DecodeString(s) + if err != nil { + t.Errorf("invalid hex: %v", err) + } + return b +} diff --git a/go/src/crypto/elliptic/elliptic.go b/go/src/crypto/elliptic/elliptic.go new file mode 100644 index 0000000000000000000000000000000000000000..290a8e53908da3ee94cf5abea166796936e7f775 --- /dev/null +++ b/go/src/crypto/elliptic/elliptic.go @@ -0,0 +1,280 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package elliptic implements the standard NIST P-224, P-256, P-384, and P-521 +// elliptic curves over prime fields. +// +// Direct use of this package is deprecated, beyond the [P224], [P256], [P384], +// and [P521] values necessary to use [crypto/ecdsa]. Most other uses +// should migrate to the more efficient and safer [crypto/ecdh], or to +// third-party modules for lower-level functionality. +package elliptic + +import ( + "io" + "math/big" + "sync" +) + +// A Curve represents a short-form Weierstrass curve with a=-3. +// +// The behavior of Add, Double, and ScalarMult when the input is not a point on +// the curve is undefined. +// +// Note that the conventional point at infinity (0, 0) is not considered on the +// curve, although it can be returned by Add, Double, ScalarMult, or +// ScalarBaseMult (but not the [Unmarshal] or [UnmarshalCompressed] functions). +// +// Using Curve implementations besides those returned by [P224], [P256], [P384], +// and [P521] is deprecated. +type Curve interface { + // Params returns the parameters for the curve. + Params() *CurveParams + + // IsOnCurve reports whether the given (x,y) lies on the curve. + // + // Deprecated: this is a low-level unsafe API. For ECDH, use the crypto/ecdh + // package. The NewPublicKey methods of NIST curves in crypto/ecdh accept + // the same encoding as the Unmarshal function, and perform on-curve checks. + IsOnCurve(x, y *big.Int) bool + + // Add returns the sum of (x1,y1) and (x2,y2). + // + // Deprecated: this is a low-level unsafe API. + Add(x1, y1, x2, y2 *big.Int) (x, y *big.Int) + + // Double returns 2*(x,y). + // + // Deprecated: this is a low-level unsafe API. + Double(x1, y1 *big.Int) (x, y *big.Int) + + // ScalarMult returns k*(x,y) where k is an integer in big-endian form. + // + // Deprecated: this is a low-level unsafe API. For ECDH, use the crypto/ecdh + // package. Most uses of ScalarMult can be replaced by a call to the ECDH + // methods of NIST curves in crypto/ecdh. + ScalarMult(x1, y1 *big.Int, k []byte) (x, y *big.Int) + + // ScalarBaseMult returns k*G, where G is the base point of the group + // and k is an integer in big-endian form. + // + // Deprecated: this is a low-level unsafe API. For ECDH, use the crypto/ecdh + // package. Most uses of ScalarBaseMult can be replaced by a call to the + // PrivateKey.PublicKey method in crypto/ecdh. + ScalarBaseMult(k []byte) (x, y *big.Int) +} + +var mask = []byte{0xff, 0x1, 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f} + +// GenerateKey returns a public/private key pair. The private key is +// generated using the given reader, which must return random data. +// +// Deprecated: for ECDH, use the GenerateKey methods of the [crypto/ecdh] package; +// for ECDSA, use the GenerateKey function of the crypto/ecdsa package. +func GenerateKey(curve Curve, rand io.Reader) (priv []byte, x, y *big.Int, err error) { + N := curve.Params().N + bitSize := N.BitLen() + byteLen := (bitSize + 7) / 8 + priv = make([]byte, byteLen) + + for x == nil { + _, err = io.ReadFull(rand, priv) + if err != nil { + return + } + // We have to mask off any excess bits in the case that the size of the + // underlying field is not a whole number of bytes. + priv[0] &= mask[bitSize%8] + // This is because, in tests, rand will return all zeros and we don't + // want to get the point at infinity and loop forever. + priv[1] ^= 0x42 + + // If the scalar is out of range, sample another random number. + if new(big.Int).SetBytes(priv).Cmp(N) >= 0 { + continue + } + + x, y = curve.ScalarBaseMult(priv) + } + return +} + +// Marshal converts a point on the curve into the uncompressed form specified in +// SEC 1, Version 2.0, Section 2.3.3. If the point is not on the curve (or is +// the conventional point at infinity), the behavior is undefined. +// +// Deprecated: for ECDH, use the crypto/ecdh package. This function returns an +// encoding equivalent to that of PublicKey.Bytes in crypto/ecdh. +func Marshal(curve Curve, x, y *big.Int) []byte { + panicIfNotOnCurve(curve, x, y) + + byteLen := (curve.Params().BitSize + 7) / 8 + + ret := make([]byte, 1+2*byteLen) + ret[0] = 4 // uncompressed point + + x.FillBytes(ret[1 : 1+byteLen]) + y.FillBytes(ret[1+byteLen : 1+2*byteLen]) + + return ret +} + +// MarshalCompressed converts a point on the curve into the compressed form +// specified in SEC 1, Version 2.0, Section 2.3.3. If the point is not on the +// curve (or is the conventional point at infinity), the behavior is undefined. +func MarshalCompressed(curve Curve, x, y *big.Int) []byte { + panicIfNotOnCurve(curve, x, y) + byteLen := (curve.Params().BitSize + 7) / 8 + compressed := make([]byte, 1+byteLen) + compressed[0] = byte(y.Bit(0)) | 2 + x.FillBytes(compressed[1:]) + return compressed +} + +// unmarshaler is implemented by curves with their own constant-time Unmarshal. +// +// There isn't an equivalent interface for Marshal/MarshalCompressed because +// that doesn't involve any mathematical operations, only FillBytes and Bit. +type unmarshaler interface { + Unmarshal([]byte) (x, y *big.Int) + UnmarshalCompressed([]byte) (x, y *big.Int) +} + +// Assert that the known curves implement unmarshaler. +var _ = []unmarshaler{p224, p256, p384, p521} + +// Unmarshal converts a point, serialized by [Marshal], into an x, y pair. It is +// an error if the point is not in uncompressed form, is not on the curve, or is +// the point at infinity. On error, x = nil. +// +// Deprecated: for ECDH, use the crypto/ecdh package. This function accepts an +// encoding equivalent to that of the NewPublicKey methods in crypto/ecdh. +func Unmarshal(curve Curve, data []byte) (x, y *big.Int) { + if c, ok := curve.(unmarshaler); ok { + return c.Unmarshal(data) + } + + byteLen := (curve.Params().BitSize + 7) / 8 + if len(data) != 1+2*byteLen { + return nil, nil + } + if data[0] != 4 { // uncompressed form + return nil, nil + } + p := curve.Params().P + x = new(big.Int).SetBytes(data[1 : 1+byteLen]) + y = new(big.Int).SetBytes(data[1+byteLen:]) + if x.Cmp(p) >= 0 || y.Cmp(p) >= 0 { + return nil, nil + } + if !curve.IsOnCurve(x, y) { + return nil, nil + } + return +} + +// UnmarshalCompressed converts a point, serialized by [MarshalCompressed], into +// an x, y pair. It is an error if the point is not in compressed form, is not +// on the curve, or is the point at infinity. On error, x = nil. +func UnmarshalCompressed(curve Curve, data []byte) (x, y *big.Int) { + if c, ok := curve.(unmarshaler); ok { + return c.UnmarshalCompressed(data) + } + + byteLen := (curve.Params().BitSize + 7) / 8 + if len(data) != 1+byteLen { + return nil, nil + } + if data[0] != 2 && data[0] != 3 { // compressed form + return nil, nil + } + p := curve.Params().P + x = new(big.Int).SetBytes(data[1:]) + if x.Cmp(p) >= 0 { + return nil, nil + } + // y² = x³ - 3x + b + y = curve.Params().polynomial(x) + y = y.ModSqrt(y, p) + if y == nil { + return nil, nil + } + if byte(y.Bit(0)) != data[0]&1 { + y.Neg(y).Mod(y, p) + } + if !curve.IsOnCurve(x, y) { + return nil, nil + } + return +} + +func panicIfNotOnCurve(curve Curve, x, y *big.Int) { + // (0, 0) is the point at infinity by convention. It's ok to operate on it, + // although IsOnCurve is documented to return false for it. See Issue 37294. + if x.Sign() == 0 && y.Sign() == 0 { + return + } + + if !curve.IsOnCurve(x, y) { + panic("crypto/elliptic: attempted operation on invalid point") + } +} + +var initonce sync.Once + +func initAll() { + initP224() + initP256() + initP384() + initP521() +} + +// P224 returns a [Curve] which implements NIST P-224 (FIPS 186-3, section D.2.2), +// also known as secp224r1. The CurveParams.Name of this [Curve] is "P-224". +// +// Multiple invocations of this function will return the same value, so it can +// be used for equality checks and switch statements. +// +// The cryptographic operations are implemented using constant-time algorithms. +func P224() Curve { + initonce.Do(initAll) + return p224 +} + +// P256 returns a [Curve] which implements NIST P-256 (FIPS 186-3, section D.2.3), +// also known as secp256r1 or prime256v1. The CurveParams.Name of this [Curve] is +// "P-256". +// +// Multiple invocations of this function will return the same value, so it can +// be used for equality checks and switch statements. +// +// The cryptographic operations are implemented using constant-time algorithms. +func P256() Curve { + initonce.Do(initAll) + return p256 +} + +// P384 returns a [Curve] which implements NIST P-384 (FIPS 186-3, section D.2.4), +// also known as secp384r1. The CurveParams.Name of this [Curve] is "P-384". +// +// Multiple invocations of this function will return the same value, so it can +// be used for equality checks and switch statements. +// +// The cryptographic operations are implemented using constant-time algorithms. +func P384() Curve { + initonce.Do(initAll) + return p384 +} + +// P521 returns a [Curve] which implements NIST P-521 (FIPS 186-3, section D.2.5), +// also known as secp521r1. The CurveParams.Name of this [Curve] is "P-521". +// +// Multiple invocations of this function will return the same value, so it can +// be used for equality checks and switch statements. +// +// The cryptographic operations are implemented using constant-time algorithms. +func P521() Curve { + initonce.Do(initAll) + return p521 +} diff --git a/go/src/crypto/elliptic/elliptic_test.go b/go/src/crypto/elliptic/elliptic_test.go new file mode 100644 index 0000000000000000000000000000000000000000..aedbefc4cadcb4ba3717d190e737f820ced13c2b --- /dev/null +++ b/go/src/crypto/elliptic/elliptic_test.go @@ -0,0 +1,413 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package elliptic + +import ( + "bytes" + "crypto/rand" + "encoding/hex" + "math/big" + "testing" +) + +// genericParamsForCurve returns the dereferenced CurveParams for +// the specified curve. This is used to avoid the logic for +// upgrading a curve to its specific implementation, forcing +// usage of the generic implementation. +func genericParamsForCurve(c Curve) *CurveParams { + d := *(c.Params()) + return &d +} + +func testAllCurves(t *testing.T, f func(*testing.T, Curve)) { + tests := []struct { + name string + curve Curve + }{ + {"P256", P256()}, + {"P256/Params", genericParamsForCurve(P256())}, + {"P224", P224()}, + {"P224/Params", genericParamsForCurve(P224())}, + {"P384", P384()}, + {"P384/Params", genericParamsForCurve(P384())}, + {"P521", P521()}, + {"P521/Params", genericParamsForCurve(P521())}, + } + if testing.Short() { + tests = tests[:1] + } + for _, test := range tests { + curve := test.curve + t.Run(test.name, func(t *testing.T) { + t.Parallel() + f(t, curve) + }) + } +} + +func TestOnCurve(t *testing.T) { + t.Parallel() + testAllCurves(t, func(t *testing.T, curve Curve) { + if !curve.IsOnCurve(curve.Params().Gx, curve.Params().Gy) { + t.Error("basepoint is not on the curve") + } + }) +} + +func TestOffCurve(t *testing.T) { + t.Parallel() + testAllCurves(t, func(t *testing.T, curve Curve) { + x, y := new(big.Int).SetInt64(1), new(big.Int).SetInt64(1) + if curve.IsOnCurve(x, y) { + t.Errorf("point off curve is claimed to be on the curve") + } + + byteLen := (curve.Params().BitSize + 7) / 8 + b := make([]byte, 1+2*byteLen) + b[0] = 4 // uncompressed point + x.FillBytes(b[1 : 1+byteLen]) + y.FillBytes(b[1+byteLen : 1+2*byteLen]) + + x1, y1 := Unmarshal(curve, b) + if x1 != nil || y1 != nil { + t.Errorf("unmarshaling a point not on the curve succeeded") + } + }) +} + +func TestInfinity(t *testing.T) { + t.Parallel() + testAllCurves(t, testInfinity) +} + +func isInfinity(x, y *big.Int) bool { + return x.Sign() == 0 && y.Sign() == 0 +} + +func testInfinity(t *testing.T, curve Curve) { + x0, y0 := new(big.Int), new(big.Int) + xG, yG := curve.Params().Gx, curve.Params().Gy + + if !isInfinity(curve.ScalarMult(xG, yG, curve.Params().N.Bytes())) { + t.Errorf("x^q != ∞") + } + if !isInfinity(curve.ScalarMult(xG, yG, []byte{0})) { + t.Errorf("x^0 != ∞") + } + + if !isInfinity(curve.ScalarMult(x0, y0, []byte{1, 2, 3})) { + t.Errorf("∞^k != ∞") + } + if !isInfinity(curve.ScalarMult(x0, y0, []byte{0})) { + t.Errorf("∞^0 != ∞") + } + + if !isInfinity(curve.ScalarBaseMult(curve.Params().N.Bytes())) { + t.Errorf("b^q != ∞") + } + if !isInfinity(curve.ScalarBaseMult([]byte{0})) { + t.Errorf("b^0 != ∞") + } + + if !isInfinity(curve.Double(x0, y0)) { + t.Errorf("2∞ != ∞") + } + // There is no other point of order two on the NIST curves (as they have + // cofactor one), so Double can't otherwise return the point at infinity. + + nMinusOne := new(big.Int).Sub(curve.Params().N, big.NewInt(1)) + x, y := curve.ScalarMult(xG, yG, nMinusOne.Bytes()) + x, y = curve.Add(x, y, xG, yG) + if !isInfinity(x, y) { + t.Errorf("x^(q-1) + x != ∞") + } + x, y = curve.Add(xG, yG, x0, y0) + if x.Cmp(xG) != 0 || y.Cmp(yG) != 0 { + t.Errorf("x+∞ != x") + } + x, y = curve.Add(x0, y0, xG, yG) + if x.Cmp(xG) != 0 || y.Cmp(yG) != 0 { + t.Errorf("∞+x != x") + } + + if curve.IsOnCurve(x0, y0) { + t.Errorf("IsOnCurve(∞) == true") + } + + if xx, yy := Unmarshal(curve, Marshal(curve, x0, y0)); xx != nil || yy != nil { + t.Errorf("Unmarshal(Marshal(∞)) did not return an error") + } + // We don't test UnmarshalCompressed(MarshalCompressed(∞)) because there are + // two valid points with x = 0. + if xx, yy := Unmarshal(curve, []byte{0x00}); xx != nil || yy != nil { + t.Errorf("Unmarshal(∞) did not return an error") + } + byteLen := (curve.Params().BitSize + 7) / 8 + buf := make([]byte, byteLen*2+1) + buf[0] = 4 // Uncompressed format. + if xx, yy := Unmarshal(curve, buf); xx != nil || yy != nil { + t.Errorf("Unmarshal((0,0)) did not return an error") + } +} + +func TestMarshal(t *testing.T) { + t.Parallel() + testAllCurves(t, func(t *testing.T, curve Curve) { + _, x, y, err := GenerateKey(curve, rand.Reader) + if err != nil { + t.Fatal(err) + } + serialized := Marshal(curve, x, y) + xx, yy := Unmarshal(curve, serialized) + if xx == nil { + t.Fatal("failed to unmarshal") + } + if xx.Cmp(x) != 0 || yy.Cmp(y) != 0 { + t.Fatal("unmarshal returned different values") + } + }) +} + +func TestUnmarshalToLargeCoordinates(t *testing.T) { + t.Parallel() + // See https://golang.org/issues/20482. + testAllCurves(t, testUnmarshalToLargeCoordinates) +} + +func testUnmarshalToLargeCoordinates(t *testing.T, curve Curve) { + p := curve.Params().P + byteLen := (p.BitLen() + 7) / 8 + + // Set x to be greater than curve's parameter P – specifically, to P+5. + // Set y to mod_sqrt(x^3 - 3x + B)) so that (x mod P = 5 , y) is on the + // curve. + x := new(big.Int).Add(p, big.NewInt(5)) + y := curve.Params().polynomial(x) + y.ModSqrt(y, p) + + invalid := make([]byte, byteLen*2+1) + invalid[0] = 4 // uncompressed encoding + x.FillBytes(invalid[1 : 1+byteLen]) + y.FillBytes(invalid[1+byteLen:]) + + if X, Y := Unmarshal(curve, invalid); X != nil || Y != nil { + t.Errorf("Unmarshal accepts invalid X coordinate") + } + + if curve == p256 { + // This is a point on the curve with a small y value, small enough that + // we can add p and still be within 32 bytes. + x, _ = new(big.Int).SetString("31931927535157963707678568152204072984517581467226068221761862915403492091210", 10) + y, _ = new(big.Int).SetString("5208467867388784005506817585327037698770365050895731383201516607147", 10) + y.Add(y, p) + + if p.Cmp(y) > 0 || y.BitLen() != 256 { + t.Fatal("y not within expected range") + } + + // marshal + x.FillBytes(invalid[1 : 1+byteLen]) + y.FillBytes(invalid[1+byteLen:]) + + if X, Y := Unmarshal(curve, invalid); X != nil || Y != nil { + t.Errorf("Unmarshal accepts invalid Y coordinate") + } + } +} + +// TestInvalidCoordinates tests big.Int values that are not valid field elements +// (negative or bigger than P). They are expected to return false from +// IsOnCurve, all other behavior is undefined. +func TestInvalidCoordinates(t *testing.T) { + t.Parallel() + testAllCurves(t, testInvalidCoordinates) +} + +func testInvalidCoordinates(t *testing.T, curve Curve) { + checkIsOnCurveFalse := func(name string, x, y *big.Int) { + if curve.IsOnCurve(x, y) { + t.Errorf("IsOnCurve(%s) unexpectedly returned true", name) + } + } + + p := curve.Params().P + _, x, y, _ := GenerateKey(curve, rand.Reader) + xx, yy := new(big.Int), new(big.Int) + + // Check if the sign is getting dropped. + xx.Neg(x) + checkIsOnCurveFalse("-x, y", xx, y) + yy.Neg(y) + checkIsOnCurveFalse("x, -y", x, yy) + + // Check if negative values are reduced modulo P. + xx.Sub(x, p) + checkIsOnCurveFalse("x-P, y", xx, y) + yy.Sub(y, p) + checkIsOnCurveFalse("x, y-P", x, yy) + + // Check if positive values are reduced modulo P. + xx.Add(x, p) + checkIsOnCurveFalse("x+P, y", xx, y) + yy.Add(y, p) + checkIsOnCurveFalse("x, y+P", x, yy) + + // Check if the overflow is dropped. + xx.Add(x, new(big.Int).Lsh(big.NewInt(1), 535)) + checkIsOnCurveFalse("x+2⁵³⁵, y", xx, y) + yy.Add(y, new(big.Int).Lsh(big.NewInt(1), 535)) + checkIsOnCurveFalse("x, y+2⁵³⁵", x, yy) + + // Check if P is treated like zero (if possible). + // y^2 = x^3 - 3x + B + // y = mod_sqrt(x^3 - 3x + B) + // y = mod_sqrt(B) if x = 0 + // If there is no modsqrt, there is no point with x = 0, can't test x = P. + if yy := new(big.Int).ModSqrt(curve.Params().B, p); yy != nil { + if !curve.IsOnCurve(big.NewInt(0), yy) { + t.Fatal("(0, mod_sqrt(B)) is not on the curve?") + } + checkIsOnCurveFalse("P, y", p, yy) + } +} + +func TestMarshalCompressed(t *testing.T) { + t.Parallel() + t.Run("P-256/03", func(t *testing.T) { + data, _ := hex.DecodeString("031e3987d9f9ea9d7dd7155a56a86b2009e1e0ab332f962d10d8beb6406ab1ad79") + x, _ := new(big.Int).SetString("13671033352574878777044637384712060483119675368076128232297328793087057702265", 10) + y, _ := new(big.Int).SetString("66200849279091436748794323380043701364391950689352563629885086590854940586447", 10) + testMarshalCompressed(t, P256(), x, y, data) + }) + t.Run("P-256/02", func(t *testing.T) { + data, _ := hex.DecodeString("021e3987d9f9ea9d7dd7155a56a86b2009e1e0ab332f962d10d8beb6406ab1ad79") + x, _ := new(big.Int).SetString("13671033352574878777044637384712060483119675368076128232297328793087057702265", 10) + y, _ := new(big.Int).SetString("49591239931264812013903123569363872165694192725937750565648544718012157267504", 10) + testMarshalCompressed(t, P256(), x, y, data) + }) + + t.Run("Invalid", func(t *testing.T) { + data, _ := hex.DecodeString("02fd4bf61763b46581fd9174d623516cf3c81edd40e29ffa2777fb6cb0ae3ce535") + X, Y := UnmarshalCompressed(P256(), data) + if X != nil || Y != nil { + t.Error("expected an error for invalid encoding") + } + }) + + if testing.Short() { + t.Skip("skipping other curves on short test") + } + + testAllCurves(t, func(t *testing.T, curve Curve) { + _, x, y, err := GenerateKey(curve, rand.Reader) + if err != nil { + t.Fatal(err) + } + testMarshalCompressed(t, curve, x, y, nil) + }) + +} + +func testMarshalCompressed(t *testing.T, curve Curve, x, y *big.Int, want []byte) { + if !curve.IsOnCurve(x, y) { + t.Fatal("invalid test point") + } + got := MarshalCompressed(curve, x, y) + if want != nil && !bytes.Equal(got, want) { + t.Errorf("got unexpected MarshalCompressed result: got %x, want %x", got, want) + } + + X, Y := UnmarshalCompressed(curve, got) + if X == nil || Y == nil { + t.Fatalf("UnmarshalCompressed failed unexpectedly") + } + + if !curve.IsOnCurve(X, Y) { + t.Error("UnmarshalCompressed returned a point not on the curve") + } + if X.Cmp(x) != 0 || Y.Cmp(y) != 0 { + t.Errorf("point did not round-trip correctly: got (%v, %v), want (%v, %v)", X, Y, x, y) + } +} + +func TestLargeIsOnCurve(t *testing.T) { + t.Parallel() + testAllCurves(t, func(t *testing.T, curve Curve) { + large := big.NewInt(1) + large.Lsh(large, 1000) + if curve.IsOnCurve(large, large) { + t.Errorf("(2^1000, 2^1000) is reported on the curve") + } + }) +} + +func benchmarkAllCurves(b *testing.B, f func(*testing.B, Curve)) { + tests := []struct { + name string + curve Curve + }{ + {"P256", P256()}, + {"P224", P224()}, + {"P384", P384()}, + {"P521", P521()}, + } + for _, test := range tests { + curve := test.curve + b.Run(test.name, func(b *testing.B) { + f(b, curve) + }) + } +} + +func BenchmarkScalarBaseMult(b *testing.B) { + benchmarkAllCurves(b, func(b *testing.B, curve Curve) { + priv, _, _, _ := GenerateKey(curve, rand.Reader) + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + x, _ := curve.ScalarBaseMult(priv) + // Prevent the compiler from optimizing out the operation. + priv[0] ^= byte(x.Bits()[0]) + } + }) +} + +func BenchmarkScalarMult(b *testing.B) { + benchmarkAllCurves(b, func(b *testing.B, curve Curve) { + _, x, y, _ := GenerateKey(curve, rand.Reader) + priv, _, _, _ := GenerateKey(curve, rand.Reader) + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + x, y = curve.ScalarMult(x, y, priv) + } + }) +} + +func BenchmarkMarshalUnmarshal(b *testing.B) { + benchmarkAllCurves(b, func(b *testing.B, curve Curve) { + _, x, y, _ := GenerateKey(curve, rand.Reader) + b.Run("Uncompressed", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + buf := Marshal(curve, x, y) + xx, yy := Unmarshal(curve, buf) + if xx.Cmp(x) != 0 || yy.Cmp(y) != 0 { + b.Error("Unmarshal output different from Marshal input") + } + } + }) + b.Run("Compressed", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + buf := MarshalCompressed(curve, x, y) + xx, yy := UnmarshalCompressed(curve, buf) + if xx.Cmp(x) != 0 || yy.Cmp(y) != 0 { + b.Error("Unmarshal output different from Marshal input") + } + } + }) + }) +} diff --git a/go/src/crypto/elliptic/nistec.go b/go/src/crypto/elliptic/nistec.go new file mode 100644 index 0000000000000000000000000000000000000000..690c0c2c9e47f7806bc7623a02c314fee654daed --- /dev/null +++ b/go/src/crypto/elliptic/nistec.go @@ -0,0 +1,270 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package elliptic + +import ( + "crypto/internal/fips140/nistec" + "errors" + "math/big" +) + +var p224 = &nistCurve[*nistec.P224Point]{ + newPoint: nistec.NewP224Point, +} + +func initP224() { + p224.params = &CurveParams{ + Name: "P-224", + BitSize: 224, + // SP 800-186, Section 3.2.1.2 + P: bigFromDecimal("26959946667150639794667015087019630673557916260026308143510066298881"), + N: bigFromDecimal("26959946667150639794667015087019625940457807714424391721682722368061"), + B: bigFromHex("b4050a850c04b3abf54132565044b0b7d7bfd8ba270b39432355ffb4"), + Gx: bigFromHex("b70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21"), + Gy: bigFromHex("bd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34"), + } +} + +var p256 = &nistCurve[*nistec.P256Point]{ + newPoint: nistec.NewP256Point, +} + +func initP256() { + p256.params = &CurveParams{ + Name: "P-256", + BitSize: 256, + // SP 800-186, Section 3.2.1.3 + P: bigFromDecimal("115792089210356248762697446949407573530086143415290314195533631308867097853951"), + N: bigFromDecimal("115792089210356248762697446949407573529996955224135760342422259061068512044369"), + B: bigFromHex("5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"), + Gx: bigFromHex("6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"), + Gy: bigFromHex("4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"), + } +} + +var p384 = &nistCurve[*nistec.P384Point]{ + newPoint: nistec.NewP384Point, +} + +func initP384() { + p384.params = &CurveParams{ + Name: "P-384", + BitSize: 384, + // SP 800-186, Section 3.2.1.4 + P: bigFromDecimal("394020061963944792122790401001436138050797392704654" + + "46667948293404245721771496870329047266088258938001861606973112319"), + N: bigFromDecimal("394020061963944792122790401001436138050797392704654" + + "46667946905279627659399113263569398956308152294913554433653942643"), + B: bigFromHex("b3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088" + + "f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"), + Gx: bigFromHex("aa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741" + + "e082542a385502f25dbf55296c3a545e3872760ab7"), + Gy: bigFromHex("3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da31" + + "13b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f"), + } +} + +var p521 = &nistCurve[*nistec.P521Point]{ + newPoint: nistec.NewP521Point, +} + +func initP521() { + p521.params = &CurveParams{ + Name: "P-521", + BitSize: 521, + // SP 800-186, Section 3.2.1.5 + P: bigFromDecimal("68647976601306097149819007990813932172694353001433" + + "0540939446345918554318339765605212255964066145455497729631139148" + + "0858037121987999716643812574028291115057151"), + N: bigFromDecimal("68647976601306097149819007990813932172694353001433" + + "0540939446345918554318339765539424505774633321719753296399637136" + + "3321113864768612440380340372808892707005449"), + B: bigFromHex("0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8" + + "b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef" + + "451fd46b503f00"), + Gx: bigFromHex("00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f8" + + "28af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf9" + + "7e7e31c2e5bd66"), + Gy: bigFromHex("011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817" + + "afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088" + + "be94769fd16650"), + } +} + +// nistCurve is a Curve implementation based on a nistec Point. +// +// It's a wrapper that exposes the big.Int-based Curve interface and encodes the +// legacy idiosyncrasies it requires, such as invalid and infinity point +// handling. +// +// To interact with the nistec package, points are encoded into and decoded from +// properly formatted byte slices. All big.Int use is limited to this package. +// Encoding and decoding is 1/1000th of the runtime of a scalar multiplication, +// so the overhead is acceptable. +type nistCurve[Point nistPoint[Point]] struct { + newPoint func() Point + params *CurveParams +} + +// nistPoint is a generic constraint for the nistec Point types. +type nistPoint[T any] interface { + Bytes() []byte + SetBytes([]byte) (T, error) + Add(T, T) T + Double(T) T + ScalarMult(T, []byte) (T, error) + ScalarBaseMult([]byte) (T, error) +} + +func (curve *nistCurve[Point]) Params() *CurveParams { + return curve.params +} + +func (curve *nistCurve[Point]) IsOnCurve(x, y *big.Int) bool { + // IsOnCurve is documented to reject (0, 0), the conventional point at + // infinity, which however is accepted by pointFromAffine. + if x.Sign() == 0 && y.Sign() == 0 { + return false + } + _, err := curve.pointFromAffine(x, y) + return err == nil +} + +func (curve *nistCurve[Point]) pointFromAffine(x, y *big.Int) (p Point, err error) { + // (0, 0) is by convention the point at infinity, which can't be represented + // in affine coordinates. See Issue 37294. + if x.Sign() == 0 && y.Sign() == 0 { + return curve.newPoint(), nil + } + // Reject values that would not get correctly encoded. + if x.Sign() < 0 || y.Sign() < 0 { + return p, errors.New("negative coordinate") + } + if x.BitLen() > curve.params.BitSize || y.BitLen() > curve.params.BitSize { + return p, errors.New("overflowing coordinate") + } + // Encode the coordinates and let SetBytes reject invalid points. + byteLen := (curve.params.BitSize + 7) / 8 + buf := make([]byte, 1+2*byteLen) + buf[0] = 4 // uncompressed point + x.FillBytes(buf[1 : 1+byteLen]) + y.FillBytes(buf[1+byteLen : 1+2*byteLen]) + return curve.newPoint().SetBytes(buf) +} + +func (curve *nistCurve[Point]) pointToAffine(p Point) (x, y *big.Int) { + out := p.Bytes() + if len(out) == 1 && out[0] == 0 { + // This is the encoding of the point at infinity, which the affine + // coordinates API represents as (0, 0) by convention. + return new(big.Int), new(big.Int) + } + byteLen := (curve.params.BitSize + 7) / 8 + x = new(big.Int).SetBytes(out[1 : 1+byteLen]) + y = new(big.Int).SetBytes(out[1+byteLen:]) + return x, y +} + +func (curve *nistCurve[Point]) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int) { + p1, err := curve.pointFromAffine(x1, y1) + if err != nil { + panic("crypto/elliptic: Add was called on an invalid point") + } + p2, err := curve.pointFromAffine(x2, y2) + if err != nil { + panic("crypto/elliptic: Add was called on an invalid point") + } + return curve.pointToAffine(p1.Add(p1, p2)) +} + +func (curve *nistCurve[Point]) Double(x1, y1 *big.Int) (*big.Int, *big.Int) { + p, err := curve.pointFromAffine(x1, y1) + if err != nil { + panic("crypto/elliptic: Double was called on an invalid point") + } + return curve.pointToAffine(p.Double(p)) +} + +// normalizeScalar brings the scalar within the byte size of the order of the +// curve, as expected by the nistec scalar multiplication functions. +func (curve *nistCurve[Point]) normalizeScalar(scalar []byte) []byte { + byteSize := (curve.params.N.BitLen() + 7) / 8 + if len(scalar) == byteSize { + return scalar + } + s := new(big.Int).SetBytes(scalar) + if len(scalar) > byteSize { + s.Mod(s, curve.params.N) + } + out := make([]byte, byteSize) + return s.FillBytes(out) +} + +func (curve *nistCurve[Point]) ScalarMult(Bx, By *big.Int, scalar []byte) (*big.Int, *big.Int) { + p, err := curve.pointFromAffine(Bx, By) + if err != nil { + panic("crypto/elliptic: ScalarMult was called on an invalid point") + } + scalar = curve.normalizeScalar(scalar) + p, err = p.ScalarMult(p, scalar) + if err != nil { + panic("crypto/elliptic: nistec rejected normalized scalar") + } + return curve.pointToAffine(p) +} + +func (curve *nistCurve[Point]) ScalarBaseMult(scalar []byte) (*big.Int, *big.Int) { + scalar = curve.normalizeScalar(scalar) + p, err := curve.newPoint().ScalarBaseMult(scalar) + if err != nil { + panic("crypto/elliptic: nistec rejected normalized scalar") + } + return curve.pointToAffine(p) +} + +func (curve *nistCurve[Point]) Unmarshal(data []byte) (x, y *big.Int) { + if len(data) == 0 || data[0] != 4 { + return nil, nil + } + // Use SetBytes to check that data encodes a valid point. + _, err := curve.newPoint().SetBytes(data) + if err != nil { + return nil, nil + } + // We don't use pointToAffine because it involves an expensive field + // inversion to convert from Jacobian to affine coordinates, which we + // already have. + byteLen := (curve.params.BitSize + 7) / 8 + x = new(big.Int).SetBytes(data[1 : 1+byteLen]) + y = new(big.Int).SetBytes(data[1+byteLen:]) + return x, y +} + +func (curve *nistCurve[Point]) UnmarshalCompressed(data []byte) (x, y *big.Int) { + if len(data) == 0 || (data[0] != 2 && data[0] != 3) { + return nil, nil + } + p, err := curve.newPoint().SetBytes(data) + if err != nil { + return nil, nil + } + return curve.pointToAffine(p) +} + +func bigFromDecimal(s string) *big.Int { + b, ok := new(big.Int).SetString(s, 10) + if !ok { + panic("crypto/elliptic: internal error: invalid encoding") + } + return b +} + +func bigFromHex(s string) *big.Int { + b, ok := new(big.Int).SetString(s, 16) + if !ok { + panic("crypto/elliptic: internal error: invalid encoding") + } + return b +} diff --git a/go/src/crypto/elliptic/p224_test.go b/go/src/crypto/elliptic/p224_test.go new file mode 100644 index 0000000000000000000000000000000000000000..7971f631bf2a31b433d8c1bb0056c7cc59db9d02 --- /dev/null +++ b/go/src/crypto/elliptic/p224_test.go @@ -0,0 +1,325 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package elliptic + +import ( + "encoding/hex" + "fmt" + "math/big" + "testing" +) + +type baseMultTest struct { + k string + x, y string +} + +var p224BaseMultTests = []baseMultTest{ + { + "1", + "b70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21", + "bd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34", + }, + { + "2", + "706a46dc76dcb76798e60e6d89474788d16dc18032d268fd1a704fa6", + "1c2b76a7bc25e7702a704fa986892849fca629487acf3709d2e4e8bb", + }, + { + "3", + "df1b1d66a551d0d31eff822558b9d2cc75c2180279fe0d08fd896d04", + "a3f7f03cadd0be444c0aa56830130ddf77d317344e1af3591981a925", + }, + { + "4", + "ae99feebb5d26945b54892092a8aee02912930fa41cd114e40447301", + "482580a0ec5bc47e88bc8c378632cd196cb3fa058a7114eb03054c9", + }, + { + "5", + "31c49ae75bce7807cdff22055d94ee9021fedbb5ab51c57526f011aa", + "27e8bff1745635ec5ba0c9f1c2ede15414c6507d29ffe37e790a079b", + }, + { + "6", + "1f2483f82572251fca975fea40db821df8ad82a3c002ee6c57112408", + "89faf0ccb750d99b553c574fad7ecfb0438586eb3952af5b4b153c7e", + }, + { + "7", + "db2f6be630e246a5cf7d99b85194b123d487e2d466b94b24a03c3e28", + "f3a30085497f2f611ee2517b163ef8c53b715d18bb4e4808d02b963", + }, + { + "8", + "858e6f9cc6c12c31f5df124aa77767b05c8bc021bd683d2b55571550", + "46dcd3ea5c43898c5c5fc4fdac7db39c2f02ebee4e3541d1e78047a", + }, + { + "9", + "2fdcccfee720a77ef6cb3bfbb447f9383117e3daa4a07e36ed15f78d", + "371732e4f41bf4f7883035e6a79fcedc0e196eb07b48171697517463", + }, + { + "10", + "aea9e17a306517eb89152aa7096d2c381ec813c51aa880e7bee2c0fd", + "39bb30eab337e0a521b6cba1abe4b2b3a3e524c14a3fe3eb116b655f", + }, + { + "11", + "ef53b6294aca431f0f3c22dc82eb9050324f1d88d377e716448e507c", + "20b510004092e96636cfb7e32efded8265c266dfb754fa6d6491a6da", + }, + { + "12", + "6e31ee1dc137f81b056752e4deab1443a481033e9b4c93a3044f4f7a", + "207dddf0385bfdeab6e9acda8da06b3bbef224a93ab1e9e036109d13", + }, + { + "13", + "34e8e17a430e43289793c383fac9774247b40e9ebd3366981fcfaeca", + "252819f71c7fb7fbcb159be337d37d3336d7feb963724fdfb0ecb767", + }, + { + "14", + "a53640c83dc208603ded83e4ecf758f24c357d7cf48088b2ce01e9fa", + "d5814cd724199c4a5b974a43685fbf5b8bac69459c9469bc8f23ccaf", + }, + { + "15", + "baa4d8635511a7d288aebeedd12ce529ff102c91f97f867e21916bf9", + "979a5f4759f80f4fb4ec2e34f5566d595680a11735e7b61046127989", + }, + { + "16", + "b6ec4fe1777382404ef679997ba8d1cc5cd8e85349259f590c4c66d", + "3399d464345906b11b00e363ef429221f2ec720d2f665d7dead5b482", + }, + { + "17", + "b8357c3a6ceef288310e17b8bfeff9200846ca8c1942497c484403bc", + "ff149efa6606a6bd20ef7d1b06bd92f6904639dce5174db6cc554a26", + }, + { + "18", + "c9ff61b040874c0568479216824a15eab1a838a797d189746226e4cc", + "ea98d60e5ffc9b8fcf999fab1df7e7ef7084f20ddb61bb045a6ce002", + }, + { + "19", + "a1e81c04f30ce201c7c9ace785ed44cc33b455a022f2acdbc6cae83c", + "dcf1f6c3db09c70acc25391d492fe25b4a180babd6cea356c04719cd", + }, + { + "20", + "fcc7f2b45df1cd5a3c0c0731ca47a8af75cfb0347e8354eefe782455", + "d5d7110274cba7cdee90e1a8b0d394c376a5573db6be0bf2747f530", + }, + { + "112233445566778899", + "61f077c6f62ed802dad7c2f38f5c67f2cc453601e61bd076bb46179e", + "2272f9e9f5933e70388ee652513443b5e289dd135dcc0d0299b225e4", + }, + { + "112233445566778899112233445566778899", + "29895f0af496bfc62b6ef8d8a65c88c613949b03668aab4f0429e35", + "3ea6e53f9a841f2019ec24bde1a75677aa9b5902e61081c01064de93", + }, + { + "6950511619965839450988900688150712778015737983940691968051900319680", + "ab689930bcae4a4aa5f5cb085e823e8ae30fd365eb1da4aba9cf0379", + "3345a121bbd233548af0d210654eb40bab788a03666419be6fbd34e7", + }, + { + "13479972933410060327035789020509431695094902435494295338570602119423", + "bdb6a8817c1f89da1c2f3dd8e97feb4494f2ed302a4ce2bc7f5f4025", + "4c7020d57c00411889462d77a5438bb4e97d177700bf7243a07f1680", + }, + { + "13479971751745682581351455311314208093898607229429740618390390702079", + "d58b61aa41c32dd5eba462647dba75c5d67c83606c0af2bd928446a9", + "d24ba6a837be0460dd107ae77725696d211446c5609b4595976b16bd", + }, + { + "13479972931865328106486971546324465392952975980343228160962702868479", + "dc9fa77978a005510980e929a1485f63716df695d7a0c18bb518df03", + "ede2b016f2ddffc2a8c015b134928275ce09e5661b7ab14ce0d1d403", + }, + { + "11795773708834916026404142434151065506931607341523388140225443265536", + "499d8b2829cfb879c901f7d85d357045edab55028824d0f05ba279ba", + "bf929537b06e4015919639d94f57838fa33fc3d952598dcdbb44d638", + }, + { + "784254593043826236572847595991346435467177662189391577090", + "8246c999137186632c5f9eddf3b1b0e1764c5e8bd0e0d8a554b9cb77", + "e80ed8660bc1cb17ac7d845be40a7a022d3306f116ae9f81fea65947", + }, + { + "13479767645505654746623887797783387853576174193480695826442858012671", + "6670c20afcceaea672c97f75e2e9dd5c8460e54bb38538ebb4bd30eb", + "f280d8008d07a4caf54271f993527d46ff3ff46fd1190a3f1faa4f74", + }, + { + "205688069665150753842126177372015544874550518966168735589597183", + "eca934247425cfd949b795cb5ce1eff401550386e28d1a4c5a8eb", + "d4c01040dba19628931bc8855370317c722cbd9ca6156985f1c2e9ce", + }, + { + "13479966930919337728895168462090683249159702977113823384618282123295", + "ef353bf5c73cd551b96d596fbc9a67f16d61dd9fe56af19de1fba9cd", + "21771b9cdce3e8430c09b3838be70b48c21e15bc09ee1f2d7945b91f", + }, + { + "50210731791415612487756441341851895584393717453129007497216", + "4036052a3091eb481046ad3289c95d3ac905ca0023de2c03ecd451cf", + "d768165a38a2b96f812586a9d59d4136035d9c853a5bf2e1c86a4993", + }, + { + "26959946667150639794667015087019625940457807714424391721682722368041", + "fcc7f2b45df1cd5a3c0c0731ca47a8af75cfb0347e8354eefe782455", + "f2a28eefd8b345832116f1e574f2c6b2c895aa8c24941f40d8b80ad1", + }, + { + "26959946667150639794667015087019625940457807714424391721682722368042", + "a1e81c04f30ce201c7c9ace785ed44cc33b455a022f2acdbc6cae83c", + "230e093c24f638f533dac6e2b6d01da3b5e7f45429315ca93fb8e634", + }, + { + "26959946667150639794667015087019625940457807714424391721682722368043", + "c9ff61b040874c0568479216824a15eab1a838a797d189746226e4cc", + "156729f1a003647030666054e208180f8f7b0df2249e44fba5931fff", + }, + { + "26959946667150639794667015087019625940457807714424391721682722368044", + "b8357c3a6ceef288310e17b8bfeff9200846ca8c1942497c484403bc", + "eb610599f95942df1082e4f9426d086fb9c6231ae8b24933aab5db", + }, + { + "26959946667150639794667015087019625940457807714424391721682722368045", + "b6ec4fe1777382404ef679997ba8d1cc5cd8e85349259f590c4c66d", + "cc662b9bcba6f94ee4ff1c9c10bd6ddd0d138df2d099a282152a4b7f", + }, + { + "26959946667150639794667015087019625940457807714424391721682722368046", + "baa4d8635511a7d288aebeedd12ce529ff102c91f97f867e21916bf9", + "6865a0b8a607f0b04b13d1cb0aa992a5a97f5ee8ca1849efb9ed8678", + }, + { + "26959946667150639794667015087019625940457807714424391721682722368047", + "a53640c83dc208603ded83e4ecf758f24c357d7cf48088b2ce01e9fa", + "2a7eb328dbe663b5a468b5bc97a040a3745396ba636b964370dc3352", + }, + { + "26959946667150639794667015087019625940457807714424391721682722368048", + "34e8e17a430e43289793c383fac9774247b40e9ebd3366981fcfaeca", + "dad7e608e380480434ea641cc82c82cbc92801469c8db0204f13489a", + }, + { + "26959946667150639794667015087019625940457807714424391721682722368049", + "6e31ee1dc137f81b056752e4deab1443a481033e9b4c93a3044f4f7a", + "df82220fc7a4021549165325725f94c3410ddb56c54e161fc9ef62ee", + }, + { + "26959946667150639794667015087019625940457807714424391721682722368050", + "ef53b6294aca431f0f3c22dc82eb9050324f1d88d377e716448e507c", + "df4aefffbf6d1699c930481cd102127c9a3d992048ab05929b6e5927", + }, + { + "26959946667150639794667015087019625940457807714424391721682722368051", + "aea9e17a306517eb89152aa7096d2c381ec813c51aa880e7bee2c0fd", + "c644cf154cc81f5ade49345e541b4d4b5c1adb3eb5c01c14ee949aa2", + }, + { + "26959946667150639794667015087019625940457807714424391721682722368052", + "2fdcccfee720a77ef6cb3bfbb447f9383117e3daa4a07e36ed15f78d", + "c8e8cd1b0be40b0877cfca1958603122f1e6914f84b7e8e968ae8b9e", + }, + { + "26959946667150639794667015087019625940457807714424391721682722368053", + "858e6f9cc6c12c31f5df124aa77767b05c8bc021bd683d2b55571550", + "fb9232c15a3bc7673a3a03b0253824c53d0fd1411b1cabe2e187fb87", + }, + { + "26959946667150639794667015087019625940457807714424391721682722368054", + "db2f6be630e246a5cf7d99b85194b123d487e2d466b94b24a03c3e28", + "f0c5cff7ab680d09ee11dae84e9c1072ac48ea2e744b1b7f72fd469e", + }, + { + "26959946667150639794667015087019625940457807714424391721682722368055", + "1f2483f82572251fca975fea40db821df8ad82a3c002ee6c57112408", + "76050f3348af2664aac3a8b05281304ebc7a7914c6ad50a4b4eac383", + }, + { + "26959946667150639794667015087019625940457807714424391721682722368056", + "31c49ae75bce7807cdff22055d94ee9021fedbb5ab51c57526f011aa", + "d817400e8ba9ca13a45f360e3d121eaaeb39af82d6001c8186f5f866", + }, + { + "26959946667150639794667015087019625940457807714424391721682722368057", + "ae99feebb5d26945b54892092a8aee02912930fa41cd114e40447301", + "fb7da7f5f13a43b81774373c879cd32d6934c05fa758eeb14fcfab38", + }, + { + "26959946667150639794667015087019625940457807714424391721682722368058", + "df1b1d66a551d0d31eff822558b9d2cc75c2180279fe0d08fd896d04", + "5c080fc3522f41bbb3f55a97cfecf21f882ce8cbb1e50ca6e67e56dc", + }, + { + "26959946667150639794667015087019625940457807714424391721682722368059", + "706a46dc76dcb76798e60e6d89474788d16dc18032d268fd1a704fa6", + "e3d4895843da188fd58fb0567976d7b50359d6b78530c8f62d1b1746", + }, + { + "26959946667150639794667015087019625940457807714424391721682722368060", + "b70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21", + "42c89c774a08dc04b3dd201932bc8a5ea5f8b89bbb2a7e667aff81cd", + }, +} + +func TestP224BaseMult(t *testing.T) { + p224 := P224() + for i, e := range p224BaseMultTests { + k, ok := new(big.Int).SetString(e.k, 10) + if !ok { + t.Errorf("%d: bad value for k: %s", i, e.k) + } + x, y := p224.ScalarBaseMult(k.Bytes()) + if fmt.Sprintf("%x", x) != e.x || fmt.Sprintf("%x", y) != e.y { + t.Errorf("%d: bad output for k=%s: got (%x, %x), want (%s, %s)", i, e.k, x, y, e.x, e.y) + } + if testing.Short() && i > 5 { + break + } + } +} + +func TestP224GenericBaseMult(t *testing.T) { + // We use the P224 CurveParams directly in order to test the generic implementation. + p224 := genericParamsForCurve(P224()) + for i, e := range p224BaseMultTests { + k, ok := new(big.Int).SetString(e.k, 10) + if !ok { + t.Errorf("%d: bad value for k: %s", i, e.k) + } + x, y := p224.ScalarBaseMult(k.Bytes()) + if fmt.Sprintf("%x", x) != e.x || fmt.Sprintf("%x", y) != e.y { + t.Errorf("%d: bad output for k=%s: got (%x, %x), want (%s, %s)", i, e.k, x, y, e.x, e.y) + } + if testing.Short() && i > 5 { + break + } + } +} + +func TestP224Overflow(t *testing.T) { + // This tests for a specific bug in the P224 implementation. + p224 := P224() + pointData, _ := hex.DecodeString("049B535B45FB0A2072398A6831834624C7E32CCFD5A4B933BCEAF77F1DD945E08BBE5178F5EDF5E733388F196D2A631D2E075BB16CBFEEA15B") + x, y := Unmarshal(p224, pointData) + if !p224.IsOnCurve(x, y) { + t.Error("P224 failed to validate a correct point") + } +} diff --git a/go/src/crypto/elliptic/p256_test.go b/go/src/crypto/elliptic/p256_test.go new file mode 100644 index 0000000000000000000000000000000000000000..a2c2b44104564c0f6b6fcd07c82654dbe7b3bd18 --- /dev/null +++ b/go/src/crypto/elliptic/p256_test.go @@ -0,0 +1,89 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package elliptic + +import ( + "math/big" + "testing" +) + +type scalarMultTest struct { + k string + xIn, yIn string + xOut, yOut string +} + +var p256MultTests = []scalarMultTest{ + { + "2a265f8bcbdcaf94d58519141e578124cb40d64a501fba9c11847b28965bc737", + "023819813ac969847059028ea88a1f30dfbcde03fc791d3a252c6b41211882ea", + "f93e4ae433cc12cf2a43fc0ef26400c0e125508224cdb649380f25479148a4ad", + "4d4de80f1534850d261075997e3049321a0864082d24a917863366c0724f5ae3", + "a22d2b7f7818a3563e0f7a76c9bf0921ac55e06e2e4d11795b233824b1db8cc0", + }, + { + "313f72ff9fe811bf573176231b286a3bdb6f1b14e05c40146590727a71c3bccd", + "cc11887b2d66cbae8f4d306627192522932146b42f01d3c6f92bd5c8ba739b06", + "a2f08a029cd06b46183085bae9248b0ed15b70280c7ef13a457f5af382426031", + "831c3f6b5f762d2f461901577af41354ac5f228c2591f84f8a6e51e2e3f17991", + "93f90934cd0ef2c698cc471c60a93524e87ab31ca2412252337f364513e43684", + }, +} + +func TestP256BaseMult(t *testing.T) { + p256 := P256() + p256Generic := genericParamsForCurve(p256) + + scalars := make([]*big.Int, 0, len(p224BaseMultTests)+1) + for _, e := range p224BaseMultTests { + k, _ := new(big.Int).SetString(e.k, 10) + scalars = append(scalars, k) + } + k := new(big.Int).SetInt64(1) + k.Lsh(k, 500) + scalars = append(scalars, k) + + for i, k := range scalars { + x, y := p256.ScalarBaseMult(k.Bytes()) + x2, y2 := p256Generic.ScalarBaseMult(k.Bytes()) + if x.Cmp(x2) != 0 || y.Cmp(y2) != 0 { + t.Errorf("#%d: got (%x, %x), want (%x, %x)", i, x, y, x2, y2) + } + + if testing.Short() && i > 5 { + break + } + } +} + +func TestP256Mult(t *testing.T) { + p256 := P256() + for i, e := range p256MultTests { + x, _ := new(big.Int).SetString(e.xIn, 16) + y, _ := new(big.Int).SetString(e.yIn, 16) + k, _ := new(big.Int).SetString(e.k, 16) + expectedX, _ := new(big.Int).SetString(e.xOut, 16) + expectedY, _ := new(big.Int).SetString(e.yOut, 16) + + xx, yy := p256.ScalarMult(x, y, k.Bytes()) + if xx.Cmp(expectedX) != 0 || yy.Cmp(expectedY) != 0 { + t.Errorf("#%d: got (%x, %x), want (%x, %x)", i, xx, yy, expectedX, expectedY) + } + } +} + +func TestIssue52075(t *testing.T) { + Gx, Gy := P256().Params().Gx, P256().Params().Gy + scalar := make([]byte, 33) + scalar[32] = 1 + x, y := P256().ScalarBaseMult(scalar) + if x.Cmp(Gx) != 0 || y.Cmp(Gy) != 0 { + t.Errorf("unexpected output (%v,%v)", x, y) + } + x, y = P256().ScalarMult(Gx, Gy, scalar) + if x.Cmp(Gx) != 0 || y.Cmp(Gy) != 0 { + t.Errorf("unexpected output (%v,%v)", x, y) + } +} diff --git a/go/src/crypto/elliptic/params.go b/go/src/crypto/elliptic/params.go new file mode 100644 index 0000000000000000000000000000000000000000..8cf9a6dc400bad972720026b3ef2325b19a08686 --- /dev/null +++ b/go/src/crypto/elliptic/params.go @@ -0,0 +1,334 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package elliptic + +import "math/big" + +// CurveParams contains the parameters of an elliptic curve and also provides +// a generic, non-constant time implementation of [Curve]. +// +// The generic Curve implementation is deprecated, and using custom curves +// (those not returned by [P224], [P256], [P384], and [P521]) is not guaranteed +// to provide any security property. +type CurveParams struct { + P *big.Int // the order of the underlying field + N *big.Int // the order of the base point + B *big.Int // the constant of the curve equation + Gx, Gy *big.Int // (x,y) of the base point + BitSize int // the size of the underlying field + Name string // the canonical name of the curve +} + +func (curve *CurveParams) Params() *CurveParams { + return curve +} + +// CurveParams operates, internally, on Jacobian coordinates. For a given +// (x, y) position on the curve, the Jacobian coordinates are (x1, y1, z1) +// where x = x1/z1² and y = y1/z1³. The greatest speedups come when the whole +// calculation can be performed within the transform (as in ScalarMult and +// ScalarBaseMult). But even for Add and Double, it's faster to apply and +// reverse the transform than to operate in affine coordinates. + +// polynomial returns x³ - 3x + b. +func (curve *CurveParams) polynomial(x *big.Int) *big.Int { + x3 := new(big.Int).Mul(x, x) + x3.Mul(x3, x) + + threeX := new(big.Int).Lsh(x, 1) + threeX.Add(threeX, x) + + x3.Sub(x3, threeX) + x3.Add(x3, curve.B) + x3.Mod(x3, curve.P) + + return x3 +} + +// IsOnCurve implements [Curve.IsOnCurve]. +// +// Deprecated: the [CurveParams] methods are deprecated and are not guaranteed to +// provide any security property. For ECDH, use the [crypto/ecdh] package. +// For ECDSA, use the [crypto/ecdsa] package with a [Curve] value returned directly +// from [P224], [P256], [P384], or [P521]. +func (curve *CurveParams) IsOnCurve(x, y *big.Int) bool { + // If there is a dedicated constant-time implementation for this curve operation, + // use that instead of the generic one. + if specific, ok := matchesSpecificCurve(curve); ok { + return specific.IsOnCurve(x, y) + } + + if x.Sign() < 0 || x.Cmp(curve.P) >= 0 || + y.Sign() < 0 || y.Cmp(curve.P) >= 0 { + return false + } + + // y² = x³ - 3x + b + y2 := new(big.Int).Mul(y, y) + y2.Mod(y2, curve.P) + + return curve.polynomial(x).Cmp(y2) == 0 +} + +// zForAffine returns a Jacobian Z value for the affine point (x, y). If x and +// y are zero, it assumes that they represent the point at infinity because (0, +// 0) is not on the any of the curves handled here. +func zForAffine(x, y *big.Int) *big.Int { + z := new(big.Int) + if x.Sign() != 0 || y.Sign() != 0 { + z.SetInt64(1) + } + return z +} + +// affineFromJacobian reverses the Jacobian transform. See the comment at the +// top of the file. If the point is ∞ it returns 0, 0. +func (curve *CurveParams) affineFromJacobian(x, y, z *big.Int) (xOut, yOut *big.Int) { + if z.Sign() == 0 { + return new(big.Int), new(big.Int) + } + + zinv := new(big.Int).ModInverse(z, curve.P) + zinvsq := new(big.Int).Mul(zinv, zinv) + + xOut = new(big.Int).Mul(x, zinvsq) + xOut.Mod(xOut, curve.P) + zinvsq.Mul(zinvsq, zinv) + yOut = new(big.Int).Mul(y, zinvsq) + yOut.Mod(yOut, curve.P) + return +} + +// Add implements [Curve.Add]. +// +// Deprecated: the [CurveParams] methods are deprecated and are not guaranteed to +// provide any security property. For ECDH, use the [crypto/ecdh] package. +// For ECDSA, use the [crypto/ecdsa] package with a [Curve] value returned directly +// from [P224], [P256], [P384], or [P521]. +func (curve *CurveParams) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int) { + // If there is a dedicated constant-time implementation for this curve operation, + // use that instead of the generic one. + if specific, ok := matchesSpecificCurve(curve); ok { + return specific.Add(x1, y1, x2, y2) + } + panicIfNotOnCurve(curve, x1, y1) + panicIfNotOnCurve(curve, x2, y2) + + z1 := zForAffine(x1, y1) + z2 := zForAffine(x2, y2) + return curve.affineFromJacobian(curve.addJacobian(x1, y1, z1, x2, y2, z2)) +} + +// addJacobian takes two points in Jacobian coordinates, (x1, y1, z1) and +// (x2, y2, z2) and returns their sum, also in Jacobian form. +func (curve *CurveParams) addJacobian(x1, y1, z1, x2, y2, z2 *big.Int) (*big.Int, *big.Int, *big.Int) { + // See https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-add-2007-bl + x3, y3, z3 := new(big.Int), new(big.Int), new(big.Int) + if z1.Sign() == 0 { + x3.Set(x2) + y3.Set(y2) + z3.Set(z2) + return x3, y3, z3 + } + if z2.Sign() == 0 { + x3.Set(x1) + y3.Set(y1) + z3.Set(z1) + return x3, y3, z3 + } + + z1z1 := new(big.Int).Mul(z1, z1) + z1z1.Mod(z1z1, curve.P) + z2z2 := new(big.Int).Mul(z2, z2) + z2z2.Mod(z2z2, curve.P) + + u1 := new(big.Int).Mul(x1, z2z2) + u1.Mod(u1, curve.P) + u2 := new(big.Int).Mul(x2, z1z1) + u2.Mod(u2, curve.P) + h := new(big.Int).Sub(u2, u1) + xEqual := h.Sign() == 0 + if h.Sign() == -1 { + h.Add(h, curve.P) + } + i := new(big.Int).Lsh(h, 1) + i.Mul(i, i) + j := new(big.Int).Mul(h, i) + + s1 := new(big.Int).Mul(y1, z2) + s1.Mul(s1, z2z2) + s1.Mod(s1, curve.P) + s2 := new(big.Int).Mul(y2, z1) + s2.Mul(s2, z1z1) + s2.Mod(s2, curve.P) + r := new(big.Int).Sub(s2, s1) + if r.Sign() == -1 { + r.Add(r, curve.P) + } + yEqual := r.Sign() == 0 + if xEqual && yEqual { + return curve.doubleJacobian(x1, y1, z1) + } + r.Lsh(r, 1) + v := new(big.Int).Mul(u1, i) + + x3.Set(r) + x3.Mul(x3, x3) + x3.Sub(x3, j) + x3.Sub(x3, v) + x3.Sub(x3, v) + x3.Mod(x3, curve.P) + + y3.Set(r) + v.Sub(v, x3) + y3.Mul(y3, v) + s1.Mul(s1, j) + s1.Lsh(s1, 1) + y3.Sub(y3, s1) + y3.Mod(y3, curve.P) + + z3.Add(z1, z2) + z3.Mul(z3, z3) + z3.Sub(z3, z1z1) + z3.Sub(z3, z2z2) + z3.Mul(z3, h) + z3.Mod(z3, curve.P) + + return x3, y3, z3 +} + +// Double implements [Curve.Double]. +// +// Deprecated: the [CurveParams] methods are deprecated and are not guaranteed to +// provide any security property. For ECDH, use the [crypto/ecdh] package. +// For ECDSA, use the [crypto/ecdsa] package with a [Curve] value returned directly +// from [P224], [P256], [P384], or [P521]. +func (curve *CurveParams) Double(x1, y1 *big.Int) (*big.Int, *big.Int) { + // If there is a dedicated constant-time implementation for this curve operation, + // use that instead of the generic one. + if specific, ok := matchesSpecificCurve(curve); ok { + return specific.Double(x1, y1) + } + panicIfNotOnCurve(curve, x1, y1) + + z1 := zForAffine(x1, y1) + return curve.affineFromJacobian(curve.doubleJacobian(x1, y1, z1)) +} + +// doubleJacobian takes a point in Jacobian coordinates, (x, y, z), and +// returns its double, also in Jacobian form. +func (curve *CurveParams) doubleJacobian(x, y, z *big.Int) (*big.Int, *big.Int, *big.Int) { + // See https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b + delta := new(big.Int).Mul(z, z) + delta.Mod(delta, curve.P) + gamma := new(big.Int).Mul(y, y) + gamma.Mod(gamma, curve.P) + alpha := new(big.Int).Sub(x, delta) + if alpha.Sign() == -1 { + alpha.Add(alpha, curve.P) + } + alpha2 := new(big.Int).Add(x, delta) + alpha.Mul(alpha, alpha2) + alpha2.Set(alpha) + alpha.Lsh(alpha, 1) + alpha.Add(alpha, alpha2) + + beta := alpha2.Mul(x, gamma) + + x3 := new(big.Int).Mul(alpha, alpha) + beta8 := new(big.Int).Lsh(beta, 3) + beta8.Mod(beta8, curve.P) + x3.Sub(x3, beta8) + if x3.Sign() == -1 { + x3.Add(x3, curve.P) + } + x3.Mod(x3, curve.P) + + z3 := new(big.Int).Add(y, z) + z3.Mul(z3, z3) + z3.Sub(z3, gamma) + if z3.Sign() == -1 { + z3.Add(z3, curve.P) + } + z3.Sub(z3, delta) + if z3.Sign() == -1 { + z3.Add(z3, curve.P) + } + z3.Mod(z3, curve.P) + + beta.Lsh(beta, 2) + beta.Sub(beta, x3) + if beta.Sign() == -1 { + beta.Add(beta, curve.P) + } + y3 := alpha.Mul(alpha, beta) + + gamma.Mul(gamma, gamma) + gamma.Lsh(gamma, 3) + gamma.Mod(gamma, curve.P) + + y3.Sub(y3, gamma) + if y3.Sign() == -1 { + y3.Add(y3, curve.P) + } + y3.Mod(y3, curve.P) + + return x3, y3, z3 +} + +// ScalarMult implements [Curve.ScalarMult]. +// +// Deprecated: the [CurveParams] methods are deprecated and are not guaranteed to +// provide any security property. For ECDH, use the [crypto/ecdh] package. +// For ECDSA, use the [crypto/ecdsa] package with a [Curve] value returned directly +// from [P224], [P256], [P384], or [P521]. +func (curve *CurveParams) ScalarMult(Bx, By *big.Int, k []byte) (*big.Int, *big.Int) { + // If there is a dedicated constant-time implementation for this curve operation, + // use that instead of the generic one. + if specific, ok := matchesSpecificCurve(curve); ok { + return specific.ScalarMult(Bx, By, k) + } + panicIfNotOnCurve(curve, Bx, By) + + Bz := new(big.Int).SetInt64(1) + x, y, z := new(big.Int), new(big.Int), new(big.Int) + + for _, b := range k { + for range 8 { + x, y, z = curve.doubleJacobian(x, y, z) + if b&0x80 == 0x80 { + x, y, z = curve.addJacobian(Bx, By, Bz, x, y, z) + } + b <<= 1 + } + } + + return curve.affineFromJacobian(x, y, z) +} + +// ScalarBaseMult implements [Curve.ScalarBaseMult]. +// +// Deprecated: the [CurveParams] methods are deprecated and are not guaranteed to +// provide any security property. For ECDH, use the [crypto/ecdh] package. +// For ECDSA, use the [crypto/ecdsa] package with a [Curve] value returned directly +// from [P224], [P256], [P384], or [P521]. +func (curve *CurveParams) ScalarBaseMult(k []byte) (*big.Int, *big.Int) { + // If there is a dedicated constant-time implementation for this curve operation, + // use that instead of the generic one. + if specific, ok := matchesSpecificCurve(curve); ok { + return specific.ScalarBaseMult(k) + } + + return curve.ScalarMult(curve.Gx, curve.Gy, k) +} + +func matchesSpecificCurve(params *CurveParams) (Curve, bool) { + for _, c := range []Curve{p224, p256, p384, p521} { + if params == c.Params() { + return c, true + } + } + return nil, false +} diff --git a/go/src/crypto/fips140/enforcement.go b/go/src/crypto/fips140/enforcement.go new file mode 100644 index 0000000000000000000000000000000000000000..5dae32a3a79e9a5e603d38ea3a4ea35523ae21ed --- /dev/null +++ b/go/src/crypto/fips140/enforcement.go @@ -0,0 +1,47 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package fips140 + +import ( + "internal/godebug" + _ "unsafe" // for linkname +) + +// WithoutEnforcement disables strict FIPS 140-3 enforcement while executing f. +// Calling WithoutEnforcement without strict enforcement enabled +// (GODEBUG=fips140=only is not set or already inside of a call to +// WithoutEnforcement) is a no-op. +// +// WithoutEnforcement is inherited by any goroutines spawned while executing f. +// +// As this disables enforcement, it should be applied carefully to tightly +// scoped functions. +func WithoutEnforcement(f func()) { + if !Enabled() || !Enforced() { + f() + return + } + setBypass() + defer unsetBypass() + f() +} + +var enabled = godebug.New("fips140").Value() == "only" + +// Enforced indicates if strict FIPS 140-3 enforcement is enabled. Strict +// enforcement is enabled when a program is run with GODEBUG=fips140=only and +// enforcement has not been disabled by a call to [WithoutEnforcement]. +func Enforced() bool { + return enabled && !isBypassed() +} + +//go:linkname setBypass +func setBypass() + +//go:linkname isBypassed +func isBypassed() bool + +//go:linkname unsetBypass +func unsetBypass() diff --git a/go/src/crypto/fips140/enforcement_test.go b/go/src/crypto/fips140/enforcement_test.go new file mode 100644 index 0000000000000000000000000000000000000000..c2f66d544bfbd063b28e2d68825ea4d2eaa44553 --- /dev/null +++ b/go/src/crypto/fips140/enforcement_test.go @@ -0,0 +1,81 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package fips140_test + +import ( + "crypto/des" + "crypto/fips140" + "crypto/internal/cryptotest" + "internal/testenv" + "testing" +) + +func expectAllowed(t *testing.T, why string, expected bool) { + t.Helper() + result := isAllowed() + if result != expected { + t.Fatalf("%v: expected: %v, got: %v", why, expected, result) + } +} + +func isAllowed() bool { + _, err := des.NewCipher(make([]byte, 8)) + return err == nil +} + +func TestWithoutEnforcement(t *testing.T) { + cryptotest.MustSupportFIPS140(t) + if !fips140.Enforced() { + cmd := testenv.Command(t, testenv.Executable(t), "-test.run=^TestWithoutEnforcement$", "-test.v") + cmd.Env = append(cmd.Environ(), "GODEBUG=fips140=only") + out, err := cmd.CombinedOutput() + t.Logf("running with GODEBUG=fips140=only:\n%s", out) + if err != nil { + t.Errorf("fips140=only subprocess failed: %v", err) + } + return + } + + t.Run("Disabled", func(t *testing.T) { + expectAllowed(t, "before enforcement disabled", false) + fips140.WithoutEnforcement(func() { + expectAllowed(t, "inside WithoutEnforcement", true) + }) + // make sure that bypass doesn't live on after returning + expectAllowed(t, "after WithoutEnforcement", false) + }) + + t.Run("Nested", func(t *testing.T) { + expectAllowed(t, "before enforcement bypass", false) + fips140.WithoutEnforcement(func() { + fips140.WithoutEnforcement(func() { + expectAllowed(t, "inside nested WithoutEnforcement", true) + }) + expectAllowed(t, "inside nested WithoutEnforcement", true) + }) + expectAllowed(t, "after enforcement bypass", false) + }) + + t.Run("GoroutineInherit", func(t *testing.T) { + ch := make(chan bool, 2) + expectAllowed(t, "before enforcement bypass", false) + fips140.WithoutEnforcement(func() { + go func() { + ch <- isAllowed() + }() + }) + allowed := <-ch + if !allowed { + t.Fatal("goroutine didn't inherit enforcement bypass") + } + go func() { + ch <- isAllowed() + }() + allowed = <-ch + if allowed { + t.Fatal("goroutine inherited bypass after WithoutEnforcement return") + } + }) +} diff --git a/go/src/crypto/fips140/fips140.go b/go/src/crypto/fips140/fips140.go new file mode 100644 index 0000000000000000000000000000000000000000..d3f63d3bf18fcbe8f8bb4e6441aba250c0682e2c --- /dev/null +++ b/go/src/crypto/fips140/fips140.go @@ -0,0 +1,46 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package fips140 provides information about the FIPS 140-3 Go Cryptographic +// Module and FIPS 140-3 mode. +// +// For more details, see the [FIPS 140-3 documentation]. +// +// [FIPS 140-3 documentation]: https://go.dev/doc/security/fips140 +package fips140 + +import ( + "crypto/internal/fips140" + "crypto/internal/fips140/check" +) + +// Enabled reports whether the cryptography libraries are operating in FIPS +// 140-3 mode. +// +// It can be controlled at runtime using the GODEBUG setting "fips140". If set +// to "on", FIPS 140-3 mode is enabled. If set to "only", non-approved +// cryptography functions will additionally return errors or panic. +// +// This can't be changed after the program has started. +func Enabled() bool { + if fips140.Enabled && !check.Verified { + panic("crypto/fips140: FIPS 140-3 mode enabled, but integrity check didn't pass") + } + return fips140.Enabled +} + +// Version returns the FIPS 140-3 Go Cryptographic Module version (such as +// "v1.0.0"), as referenced in the Security Policy for the module, if building +// against a frozen module with GOFIPS140. Otherwise, it returns "latest". If an +// alias is in use (such as "inprogress") the actual resolved version is +// returned. +// +// The returned version may not uniquely identify the frozen module which was +// used to build the program, if there are multiple copies of the frozen module +// at the same version. The uniquely identifying version suffix can be found by +// checking the value of the GOFIPS140 setting in +// runtime/debug.BuildInfo.Settings. +func Version() string { + return fips140.Version() +} diff --git a/go/src/crypto/fips140/fips140_test.go b/go/src/crypto/fips140/fips140_test.go new file mode 100644 index 0000000000000000000000000000000000000000..c038add94762d7691e886e0c8bc283108eb9314b --- /dev/null +++ b/go/src/crypto/fips140/fips140_test.go @@ -0,0 +1,51 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package fips140 + +import ( + "internal/godebug" + "os" + "testing" +) + +func TestImmutableGODEBUG(t *testing.T) { + defer func(v string) { os.Setenv("GODEBUG", v) }(os.Getenv("GODEBUG")) + + fips140Enabled := Enabled() + fips140Setting := godebug.New("fips140") + fips140SettingValue := fips140Setting.Value() + + os.Setenv("GODEBUG", "fips140=off") + if Enabled() != fips140Enabled { + t.Errorf("Enabled() changed after setting GODEBUG=fips140=off") + } + if fips140Setting.Value() != fips140SettingValue { + t.Errorf("fips140Setting.Value() changed after setting GODEBUG=fips140=off") + } + + os.Setenv("GODEBUG", "fips140=on") + if Enabled() != fips140Enabled { + t.Errorf("Enabled() changed after setting GODEBUG=fips140=on") + } + if fips140Setting.Value() != fips140SettingValue { + t.Errorf("fips140Setting.Value() changed after setting GODEBUG=fips140=on") + } + + os.Setenv("GODEBUG", "fips140=") + if Enabled() != fips140Enabled { + t.Errorf("Enabled() changed after setting GODEBUG=fips140=") + } + if fips140Setting.Value() != fips140SettingValue { + t.Errorf("fips140Setting.Value() changed after setting GODEBUG=fips140=") + } + + os.Setenv("GODEBUG", "") + if Enabled() != fips140Enabled { + t.Errorf("Enabled() changed after setting GODEBUG=") + } + if fips140Setting.Value() != fips140SettingValue { + t.Errorf("fips140Setting.Value() changed after setting GODEBUG=") + } +} diff --git a/go/src/crypto/hkdf/example_test.go b/go/src/crypto/hkdf/example_test.go new file mode 100644 index 0000000000000000000000000000000000000000..789f7ae58c9d6f8154ebc858b07369e8f0c7c6fb --- /dev/null +++ b/go/src/crypto/hkdf/example_test.go @@ -0,0 +1,53 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package hkdf_test + +import ( + "bytes" + "crypto/hkdf" + "crypto/rand" + "crypto/sha256" + "fmt" +) + +// Usage example that expands one master secret into three other +// cryptographically secure keys. +func Example_usage() { + // Underlying hash function for HMAC. + hash := sha256.New + keyLen := hash().Size() + + // Cryptographically secure master secret. + secret := []byte{0x00, 0x01, 0x02, 0x03} // i.e. NOT this. + + // Non-secret salt, optional (can be nil). + // Recommended: hash-length random value. + salt := make([]byte, hash().Size()) + if _, err := rand.Read(salt); err != nil { + panic(err) + } + + // Non-secret context info, optional (can be nil). + info := "hkdf example" + + // Generate three 128-bit derived keys. + var keys [][]byte + for i := 0; i < 3; i++ { + key, err := hkdf.Key(hash, secret, salt, info, keyLen) + if err != nil { + panic(err) + } + keys = append(keys, key) + } + + for i := range keys { + fmt.Printf("Key #%d: %v\n", i+1, !bytes.Equal(keys[i], make([]byte, 16))) + } + + // Output: + // Key #1: true + // Key #2: true + // Key #3: true +} diff --git a/go/src/crypto/hkdf/hkdf.go b/go/src/crypto/hkdf/hkdf.go new file mode 100644 index 0000000000000000000000000000000000000000..88439922a5032e3ca25ee4dc352732b4a243c66a --- /dev/null +++ b/go/src/crypto/hkdf/hkdf.go @@ -0,0 +1,84 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package hkdf implements the HMAC-based Extract-and-Expand Key Derivation +// Function (HKDF) as defined in RFC 5869. +// +// HKDF is a cryptographic key derivation function (KDF) with the goal of +// expanding limited input keying material into one or more cryptographically +// strong secret keys. +package hkdf + +import ( + "crypto/internal/fips140/hkdf" + "crypto/internal/fips140hash" + "crypto/internal/fips140only" + "errors" + "hash" +) + +// Extract generates a pseudorandom key for use with [Expand] from an input +// secret and an optional independent salt. +// +// Only use this function if you need to reuse the extracted key with multiple +// Expand invocations and different context values. Most common scenarios, +// including the generation of multiple keys, should use [Key] instead. +func Extract[H hash.Hash](h func() H, secret, salt []byte) ([]byte, error) { + fh := fips140hash.UnwrapNew(h) + if err := checkFIPS140Only(fh, secret); err != nil { + return nil, err + } + return hkdf.Extract(fh, secret, salt), nil +} + +// Expand derives a key from the given hash, key, and optional context info, +// returning a []byte of length keyLength that can be used as cryptographic key. +// The extraction step is skipped. +// +// The key should have been generated by [Extract], or be a uniformly +// random or pseudorandom cryptographically strong key. See RFC 5869, Section +// 3.3. Most common scenarios will want to use [Key] instead. +func Expand[H hash.Hash](h func() H, pseudorandomKey []byte, info string, keyLength int) ([]byte, error) { + fh := fips140hash.UnwrapNew(h) + if err := checkFIPS140Only(fh, pseudorandomKey); err != nil { + return nil, err + } + + limit := fh().Size() * 255 + if keyLength > limit { + return nil, errors.New("hkdf: requested key length too large") + } + + return hkdf.Expand(fh, pseudorandomKey, info, keyLength), nil +} + +// Key derives a key from the given hash, secret, salt and context info, +// returning a []byte of length keyLength that can be used as cryptographic key. +// Salt and info can be nil. +func Key[Hash hash.Hash](h func() Hash, secret, salt []byte, info string, keyLength int) ([]byte, error) { + fh := fips140hash.UnwrapNew(h) + if err := checkFIPS140Only(fh, secret); err != nil { + return nil, err + } + + limit := fh().Size() * 255 + if keyLength > limit { + return nil, errors.New("hkdf: requested key length too large") + } + + return hkdf.Key(fh, secret, salt, info, keyLength), nil +} + +func checkFIPS140Only[Hash hash.Hash](h func() Hash, key []byte) error { + if !fips140only.Enforced() { + return nil + } + if len(key) < 112/8 { + return errors.New("crypto/hkdf: use of keys shorter than 112 bits is not allowed in FIPS 140-only mode") + } + if !fips140only.ApprovedHash(h()) { + return errors.New("crypto/hkdf: use of hash functions other than SHA-2 or SHA-3 is not allowed in FIPS 140-only mode") + } + return nil +} diff --git a/go/src/crypto/hkdf/hkdf_test.go b/go/src/crypto/hkdf/hkdf_test.go new file mode 100644 index 0000000000000000000000000000000000000000..57d90f88e93e758d15444f41ae78c578fbffacb8 --- /dev/null +++ b/go/src/crypto/hkdf/hkdf_test.go @@ -0,0 +1,413 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package hkdf + +import ( + "bytes" + "crypto/internal/boring" + "crypto/internal/fips140" + "crypto/md5" + "crypto/sha1" + "crypto/sha256" + "crypto/sha512" + "hash" + "testing" +) + +type hkdfTest struct { + hash func() hash.Hash + master []byte + salt []byte + prk []byte + info []byte + out []byte +} + +var hkdfTests = []hkdfTest{ + // Tests from RFC 5869 + { + sha256.New, + []byte{ + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + }, + []byte{ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, + }, + []byte{ + 0x07, 0x77, 0x09, 0x36, 0x2c, 0x2e, 0x32, 0xdf, + 0x0d, 0xdc, 0x3f, 0x0d, 0xc4, 0x7b, 0xba, 0x63, + 0x90, 0xb6, 0xc7, 0x3b, 0xb5, 0x0f, 0x9c, 0x31, + 0x22, 0xec, 0x84, 0x4a, 0xd7, 0xc2, 0xb3, 0xe5, + }, + []byte{ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, + }, + []byte{ + 0x3c, 0xb2, 0x5f, 0x25, 0xfa, 0xac, 0xd5, 0x7a, + 0x90, 0x43, 0x4f, 0x64, 0xd0, 0x36, 0x2f, 0x2a, + 0x2d, 0x2d, 0x0a, 0x90, 0xcf, 0x1a, 0x5a, 0x4c, + 0x5d, 0xb0, 0x2d, 0x56, 0xec, 0xc4, 0xc5, 0xbf, + 0x34, 0x00, 0x72, 0x08, 0xd5, 0xb8, 0x87, 0x18, + 0x58, 0x65, + }, + }, + { + sha256.New, + []byte{ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + }, + []byte{ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + }, + []byte{ + 0x06, 0xa6, 0xb8, 0x8c, 0x58, 0x53, 0x36, 0x1a, + 0x06, 0x10, 0x4c, 0x9c, 0xeb, 0x35, 0xb4, 0x5c, + 0xef, 0x76, 0x00, 0x14, 0x90, 0x46, 0x71, 0x01, + 0x4a, 0x19, 0x3f, 0x40, 0xc1, 0x5f, 0xc2, 0x44, + }, + []byte{ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, + }, + []byte{ + 0xb1, 0x1e, 0x39, 0x8d, 0xc8, 0x03, 0x27, 0xa1, + 0xc8, 0xe7, 0xf7, 0x8c, 0x59, 0x6a, 0x49, 0x34, + 0x4f, 0x01, 0x2e, 0xda, 0x2d, 0x4e, 0xfa, 0xd8, + 0xa0, 0x50, 0xcc, 0x4c, 0x19, 0xaf, 0xa9, 0x7c, + 0x59, 0x04, 0x5a, 0x99, 0xca, 0xc7, 0x82, 0x72, + 0x71, 0xcb, 0x41, 0xc6, 0x5e, 0x59, 0x0e, 0x09, + 0xda, 0x32, 0x75, 0x60, 0x0c, 0x2f, 0x09, 0xb8, + 0x36, 0x77, 0x93, 0xa9, 0xac, 0xa3, 0xdb, 0x71, + 0xcc, 0x30, 0xc5, 0x81, 0x79, 0xec, 0x3e, 0x87, + 0xc1, 0x4c, 0x01, 0xd5, 0xc1, 0xf3, 0x43, 0x4f, + 0x1d, 0x87, + }, + }, + { + sha256.New, + []byte{ + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + }, + []byte{}, + []byte{ + 0x19, 0xef, 0x24, 0xa3, 0x2c, 0x71, 0x7b, 0x16, + 0x7f, 0x33, 0xa9, 0x1d, 0x6f, 0x64, 0x8b, 0xdf, + 0x96, 0x59, 0x67, 0x76, 0xaf, 0xdb, 0x63, 0x77, + 0xac, 0x43, 0x4c, 0x1c, 0x29, 0x3c, 0xcb, 0x04, + }, + []byte{}, + []byte{ + 0x8d, 0xa4, 0xe7, 0x75, 0xa5, 0x63, 0xc1, 0x8f, + 0x71, 0x5f, 0x80, 0x2a, 0x06, 0x3c, 0x5a, 0x31, + 0xb8, 0xa1, 0x1f, 0x5c, 0x5e, 0xe1, 0x87, 0x9e, + 0xc3, 0x45, 0x4e, 0x5f, 0x3c, 0x73, 0x8d, 0x2d, + 0x9d, 0x20, 0x13, 0x95, 0xfa, 0xa4, 0xb6, 0x1a, + 0x96, 0xc8, + }, + }, + { + sha256.New, + []byte{ + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + }, + nil, + []byte{ + 0x19, 0xef, 0x24, 0xa3, 0x2c, 0x71, 0x7b, 0x16, + 0x7f, 0x33, 0xa9, 0x1d, 0x6f, 0x64, 0x8b, 0xdf, + 0x96, 0x59, 0x67, 0x76, 0xaf, 0xdb, 0x63, 0x77, + 0xac, 0x43, 0x4c, 0x1c, 0x29, 0x3c, 0xcb, 0x04, + }, + nil, + []byte{ + 0x8d, 0xa4, 0xe7, 0x75, 0xa5, 0x63, 0xc1, 0x8f, + 0x71, 0x5f, 0x80, 0x2a, 0x06, 0x3c, 0x5a, 0x31, + 0xb8, 0xa1, 0x1f, 0x5c, 0x5e, 0xe1, 0x87, 0x9e, + 0xc3, 0x45, 0x4e, 0x5f, 0x3c, 0x73, 0x8d, 0x2d, + 0x9d, 0x20, 0x13, 0x95, 0xfa, 0xa4, 0xb6, 0x1a, + 0x96, 0xc8, + }, + }, + { + sha1.New, + []byte{ + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, + }, + []byte{ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, + }, + []byte{ + 0x9b, 0x6c, 0x18, 0xc4, 0x32, 0xa7, 0xbf, 0x8f, + 0x0e, 0x71, 0xc8, 0xeb, 0x88, 0xf4, 0xb3, 0x0b, + 0xaa, 0x2b, 0xa2, 0x43, + }, + []byte{ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, + }, + []byte{ + 0x08, 0x5a, 0x01, 0xea, 0x1b, 0x10, 0xf3, 0x69, + 0x33, 0x06, 0x8b, 0x56, 0xef, 0xa5, 0xad, 0x81, + 0xa4, 0xf1, 0x4b, 0x82, 0x2f, 0x5b, 0x09, 0x15, + 0x68, 0xa9, 0xcd, 0xd4, 0xf1, 0x55, 0xfd, 0xa2, + 0xc2, 0x2e, 0x42, 0x24, 0x78, 0xd3, 0x05, 0xf3, + 0xf8, 0x96, + }, + }, + { + sha1.New, + []byte{ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + }, + []byte{ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x7b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c, 0xae, 0x89, 0x9d, 0x92, 0x19, + 0x1f, 0xe4, 0x30, 0x56, 0x73, 0xba, 0x2f, 0xfe, + 0x8f, 0xa3, 0xf1, 0xa4, 0xe5, 0xad, 0x79, 0xf3, + 0xf3, 0x34, 0xb3, 0xb2, 0x02, 0xb2, 0x17, 0x3c, + 0x48, 0x6e, 0xa3, 0x7c, 0xe3, 0xd3, 0x97, 0xed, + 0x03, 0x4c, 0x7f, 0x9d, 0xfe, 0xb1, 0x5c, 0x5e, + 0x92, 0x73, 0x36, 0xd0, 0x44, 0x1f, 0x4c, 0x43, + 0x00, 0xe2, 0xcf, 0xf0, 0xd0, 0x90, 0x0b, 0x52, + 0xd3, 0xb4, + }, + }, + { + sha1.New, + []byte{ + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + }, + []byte{}, + []byte{ + 0xda, 0x8c, 0x8a, 0x73, 0xc7, 0xfa, 0x77, 0x28, + 0x8e, 0xc6, 0xf5, 0xe7, 0xc2, 0x97, 0x78, 0x6a, + 0xa0, 0xd3, 0x2d, 0x01, + }, + []byte{}, + []byte{ + 0x0a, 0xc1, 0xaf, 0x70, 0x02, 0xb3, 0xd7, 0x61, + 0xd1, 0xe5, 0x52, 0x98, 0xda, 0x9d, 0x05, 0x06, + 0xb9, 0xae, 0x52, 0x05, 0x72, 0x20, 0xa3, 0x06, + 0xe0, 0x7b, 0x6b, 0x87, 0xe8, 0xdf, 0x21, 0xd0, + 0xea, 0x00, 0x03, 0x3d, 0xe0, 0x39, 0x84, 0xd3, + 0x49, 0x18, + }, + }, + { + sha1.New, + []byte{ + 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, + 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, + 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, + }, + nil, + []byte{ + 0x2a, 0xdc, 0xca, 0xda, 0x18, 0x77, 0x9e, 0x7c, + 0x20, 0x77, 0xad, 0x2e, 0xb1, 0x9d, 0x3f, 0x3e, + 0x73, 0x13, 0x85, 0xdd, + }, + nil, + []byte{ + 0x2c, 0x91, 0x11, 0x72, 0x04, 0xd7, 0x45, 0xf3, + 0x50, 0x0d, 0x63, 0x6a, 0x62, 0xf6, 0x4f, 0x0a, + 0xb3, 0xba, 0xe5, 0x48, 0xaa, 0x53, 0xd4, 0x23, + 0xb0, 0xd1, 0xf2, 0x7e, 0xbb, 0xa6, 0xf5, 0xe5, + 0x67, 0x3a, 0x08, 0x1d, 0x70, 0xcc, 0xe7, 0xac, + 0xfc, 0x48, + }, + }, +} + +func TestHKDF(t *testing.T) { + for i, tt := range hkdfTests { + prk, err := Extract(tt.hash, tt.master, tt.salt) + if err != nil { + t.Errorf("test %d: PRK extraction failed: %v", i, err) + } + if !bytes.Equal(prk, tt.prk) { + t.Errorf("test %d: incorrect PRK: have %v, need %v.", i, prk, tt.prk) + } + + key, err := Key(tt.hash, tt.master, tt.salt, string(tt.info), len(tt.out)) + if err != nil { + t.Errorf("test %d: key derivation failed: %v", i, err) + } + + if !bytes.Equal(key, tt.out) { + t.Errorf("test %d: incorrect output: have %v, need %v.", i, key, tt.out) + } + + expanded, err := Expand(tt.hash, prk, string(tt.info), len(tt.out)) + if err != nil { + t.Errorf("test %d: key expansion failed: %v", i, err) + } + + if !bytes.Equal(expanded, tt.out) { + t.Errorf("test %d: incorrect output from Expand: have %v, need %v.", i, expanded, tt.out) + } + } +} + +func TestHKDFLimit(t *testing.T) { + hash := sha1.New + master := []byte{0x00, 0x01, 0x02, 0x03} + info := "" + limit := hash().Size() * 255 + + // The maximum output bytes should be extractable + out, err := Key(hash, master, nil, info, limit) + if err != nil || len(out) != limit { + t.Errorf("key derivation failed: %v", err) + } + + // Reading one more should return an error + _, err = Key(hash, master, nil, info, limit+1) + if err == nil { + t.Error("expected key derivation to fail, but it succeeded") + } +} + +func Benchmark16ByteMD5Single(b *testing.B) { + benchmarkHKDF(md5.New, 16, b) +} + +func Benchmark20ByteSHA1Single(b *testing.B) { + benchmarkHKDF(sha1.New, 20, b) +} + +func Benchmark32ByteSHA256Single(b *testing.B) { + benchmarkHKDF(sha256.New, 32, b) +} + +func Benchmark64ByteSHA512Single(b *testing.B) { + benchmarkHKDF(sha512.New, 64, b) +} + +func benchmarkHKDF(hasher func() hash.Hash, block int, b *testing.B) { + master := []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07} + salt := []byte{0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17} + info := string([]byte{0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27}) + + b.SetBytes(int64(block)) + b.ResetTimer() + + for i := 0; i < b.N; i++ { + _, err := Key(hasher, master, salt, info, hasher().Size()) + if err != nil { + b.Errorf("failed to derive key: %v", err) + } + } +} + +func TestFIPSServiceIndicator(t *testing.T) { + if boring.Enabled { + t.Skip("in BoringCrypto mode HMAC is not from the Go FIPS module") + } + + fips140.ResetServiceIndicator() + _, err := Key(sha256.New, []byte("YELLOW SUBMARINE"), nil, "", 32) + if err != nil { + panic(err) + } + if !fips140.ServiceIndicator() { + t.Error("FIPS service indicator should be set") + } + + // Key too short. + fips140.ResetServiceIndicator() + _, err = Key(sha256.New, []byte("key"), nil, "", 32) + if err != nil { + panic(err) + } + if fips140.ServiceIndicator() { + t.Error("FIPS service indicator should not be set") + } + + // Salt and info are short, which is ok, but translates to a short HMAC key. + fips140.ResetServiceIndicator() + _, err = Key(sha256.New, []byte("YELLOW SUBMARINE"), []byte("salt"), "info", 32) + if err != nil { + panic(err) + } + if !fips140.ServiceIndicator() { + t.Error("FIPS service indicator should be set") + } +} diff --git a/go/src/crypto/hmac/hmac.go b/go/src/crypto/hmac/hmac.go new file mode 100644 index 0000000000000000000000000000000000000000..e7976e25193dfe3d57718966984fa62de9293153 --- /dev/null +++ b/go/src/crypto/hmac/hmac.go @@ -0,0 +1,65 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/* +Package hmac implements the Keyed-Hash Message Authentication Code (HMAC) as +defined in U.S. Federal Information Processing Standards Publication 198. +An HMAC is a cryptographic hash that uses a key to sign a message. +The receiver verifies the hash by recomputing it using the same key. + +Receivers should be careful to use Equal to compare MACs in order to avoid +timing side-channels: + + // ValidMAC reports whether messageMAC is a valid HMAC tag for message. + func ValidMAC(message, messageMAC, key []byte) bool { + mac := hmac.New(sha256.New, key) + mac.Write(message) + expectedMAC := mac.Sum(nil) + return hmac.Equal(messageMAC, expectedMAC) + } +*/ +package hmac + +import ( + "crypto/internal/boring" + "crypto/internal/fips140/hmac" + "crypto/internal/fips140hash" + "crypto/internal/fips140only" + "crypto/subtle" + "hash" +) + +// New returns a new HMAC hash using the given [hash.Hash] type and key. +// New functions like [crypto/sha256.New] can be used as h. +// h must return a new Hash every time it is called. +// Note that unlike other hash implementations in the standard library, +// the returned Hash does not implement [encoding.BinaryMarshaler] +// or [encoding.BinaryUnmarshaler]. +func New(h func() hash.Hash, key []byte) hash.Hash { + if boring.Enabled { + hm := boring.NewHMAC(h, key) + if hm != nil { + return hm + } + // BoringCrypto did not recognize h, so fall through to standard Go code. + } + h = fips140hash.UnwrapNew(h) + if fips140only.Enforced() { + if len(key) < 112/8 { + panic("crypto/hmac: use of keys shorter than 112 bits is not allowed in FIPS 140-only mode") + } + if !fips140only.ApprovedHash(h()) { + panic("crypto/hmac: use of hash functions other than SHA-2 or SHA-3 is not allowed in FIPS 140-only mode") + } + } + return hmac.New(h, key) +} + +// Equal compares two MACs for equality without leaking timing information. +func Equal(mac1, mac2 []byte) bool { + // We don't have to be constant time if the lengths of the MACs are + // different as that suggests that a completely different hash function + // was used. + return subtle.ConstantTimeCompare(mac1, mac2) == 1 +} diff --git a/go/src/crypto/hmac/hmac_test.go b/go/src/crypto/hmac/hmac_test.go new file mode 100644 index 0000000000000000000000000000000000000000..4046a9555a8e35fc9e7f16561d86a8d5430a2547 --- /dev/null +++ b/go/src/crypto/hmac/hmac_test.go @@ -0,0 +1,695 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package hmac + +import ( + "crypto/internal/boring" + "crypto/internal/cryptotest" + "crypto/md5" + "crypto/sha1" + "crypto/sha256" + "crypto/sha512" + "errors" + "fmt" + "hash" + "testing" +) + +type hmacTest struct { + hash func() hash.Hash + key []byte + in []byte + out string + size int + blocksize int +} + +var hmacTests = []hmacTest{ + // Tests from US FIPS 198 + // https://csrc.nist.gov/publications/fips/fips198/fips-198a.pdf + { + sha1.New, + []byte{ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + }, + []byte("Sample #1"), + "4f4ca3d5d68ba7cc0a1208c9c61e9c5da0403c0a", + sha1.Size, + sha1.BlockSize, + }, + { + sha1.New, + []byte{ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, + }, + []byte("Sample #2"), + "0922d3405faa3d194f82a45830737d5cc6c75d24", + sha1.Size, + sha1.BlockSize, + }, + { + sha1.New, + []byte{ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + 0xb0, 0xb1, 0xb2, 0xb3, + }, + []byte("Sample #3"), + "bcf41eab8bb2d802f3d05caf7cb092ecf8d1a3aa", + sha1.Size, + sha1.BlockSize, + }, + + // Test from Plan 9. + { + md5.New, + []byte("Jefe"), + []byte("what do ya want for nothing?"), + "750c783e6ab0b503eaa86e310a5db738", + md5.Size, + md5.BlockSize, + }, + + // Tests from RFC 4231 + { + sha256.New, + []byte{ + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b, + }, + []byte("Hi There"), + "b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7", + sha256.Size, + sha256.BlockSize, + }, + { + sha256.New, + []byte("Jefe"), + []byte("what do ya want for nothing?"), + "5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843", + sha256.Size, + sha256.BlockSize, + }, + { + sha256.New, + []byte{ + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, + }, + []byte{ + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, + }, + "773ea91e36800e46854db8ebd09181a72959098b3ef8c122d9635514ced565fe", + sha256.Size, + sha256.BlockSize, + }, + { + sha256.New, + []byte{ + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, + 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, + 0x19, + }, + []byte{ + 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, + 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, + 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, + 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, + 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, + 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, + 0xcd, 0xcd, + }, + "82558a389a443c0ea4cc819899f2083a85f0faa3e578f8077a2e3ff46729665b", + sha256.Size, + sha256.BlockSize, + }, + { + sha256.New, + []byte{ + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, + }, + []byte("Test Using Larger Than Block-Size Key - Hash Key First"), + "60e431591ee0b67f0d8a26aacbf5b77f8e0bc6213728c5140546040f0ee37f54", + sha256.Size, + sha256.BlockSize, + }, + { + sha256.New, + []byte{ + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, + }, + []byte("This is a test using a larger than block-size key " + + "and a larger than block-size data. The key needs to " + + "be hashed before being used by the HMAC algorithm."), + "9b09ffa71b942fcb27635fbcd5b0e944bfdc63644f0713938a7f51535c3a35e2", + sha256.Size, + sha256.BlockSize, + }, + + // Tests from https://csrc.nist.gov/groups/ST/toolkit/examples.html + // (truncated tag tests are left out) + { + sha1.New, + []byte{ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + }, + []byte("Sample message for keylen=blocklen"), + "5fd596ee78d5553c8ff4e72d266dfd192366da29", + sha1.Size, + sha1.BlockSize, + }, + { + sha1.New, + []byte{ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, + }, + []byte("Sample message for keylen 0xFFFF { + return nil, errors.New("invalid length") + } + return s.export(exporterContext, uint16(length)) +} + +// Open decrypts the provided ciphertext, optionally binding to the additional +// public data aad, or returns an error if decryption fails. +// +// Open uses incrementing counters for each successful call, and must be called +// in the same order as Seal on the sending side. +func (r *Recipient) Open(aad, ciphertext []byte) ([]byte, error) { + if r.aead == nil { + return nil, errors.New("export-only instantiation") + } + plaintext, err := r.aead.Open(nil, r.nextNonce(), ciphertext, aad) + if err != nil { + return nil, err + } + r.seqNum++ + return plaintext, nil +} + +// Open instantiates a single-use HPKE receiving HPKE context like [NewRecipient], +// and then decrypts the provided ciphertext like [Recipient.Open] (with no aad). +// ciphertext must be the concatenation of the encapsulated key and the actual ciphertext. +func Open(k PrivateKey, kdf KDF, aead AEAD, info, ciphertext []byte) ([]byte, error) { + encSize := k.KEM().encSize() + if len(ciphertext) < encSize { + return nil, errors.New("ciphertext too short") + } + enc, ciphertext := ciphertext[:encSize], ciphertext[encSize:] + r, err := NewRecipient(enc, k, kdf, aead, info) + if err != nil { + return nil, err + } + return r.Open(nil, ciphertext) +} + +// Export produces a secret value derived from the shared key between sender and +// recipient. length must be at most 65,535. +func (r *Recipient) Export(exporterContext string, length int) ([]byte, error) { + if length < 0 || length > 0xFFFF { + return nil, errors.New("invalid length") + } + return r.export(exporterContext, uint16(length)) +} + +func (ctx *context) nextNonce() []byte { + nonce := make([]byte, ctx.aead.NonceSize()) + byteorder.BEPutUint64(nonce[len(nonce)-8:], ctx.seqNum) + for i := range ctx.baseNonce { + nonce[i] ^= ctx.baseNonce[i] + } + return nonce +} + +func suiteID(kemID, kdfID, aeadID uint16) []byte { + suiteID := make([]byte, 0, 4+2+2+2) + suiteID = append(suiteID, []byte("HPKE")...) + suiteID = byteorder.BEAppendUint16(suiteID, kemID) + suiteID = byteorder.BEAppendUint16(suiteID, kdfID) + suiteID = byteorder.BEAppendUint16(suiteID, aeadID) + return suiteID +} diff --git a/go/src/crypto/hpke/hpke_test.go b/go/src/crypto/hpke/hpke_test.go new file mode 100644 index 0000000000000000000000000000000000000000..ceb33263a6671718fba70172bec104f693b752ee --- /dev/null +++ b/go/src/crypto/hpke/hpke_test.go @@ -0,0 +1,687 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package hpke + +import ( + "bytes" + "crypto/ecdh" + "crypto/mlkem" + "crypto/mlkem/mlkemtest" + "crypto/sha3" + "encoding/hex" + "encoding/json" + "fmt" + "io" + "os" + "testing" +) + +func Example() { + // In this example, we use MLKEM768-X25519 as the KEM, HKDF-SHA256 as the + // KDF, and AES-256-GCM as the AEAD to encrypt a single message from a + // sender to a recipient using the one-shot API. + + kem, kdf, aead := MLKEM768X25519(), HKDFSHA256(), AES256GCM() + + // Recipient side + var ( + recipientPrivateKey PrivateKey + publicKeyBytes []byte + ) + { + k, err := kem.GenerateKey() + if err != nil { + panic(err) + } + recipientPrivateKey = k + publicKeyBytes = k.PublicKey().Bytes() + } + + // Sender side + var ciphertext []byte + { + publicKey, err := kem.NewPublicKey(publicKeyBytes) + if err != nil { + panic(err) + } + + message := []byte("|-()-|") + ct, err := Seal(publicKey, kdf, aead, []byte("example"), message) + if err != nil { + panic(err) + } + + ciphertext = ct + } + + // Recipient side + { + plaintext, err := Open(recipientPrivateKey, kdf, aead, []byte("example"), ciphertext) + if err != nil { + panic(err) + } + fmt.Printf("Decrypted message: %s\n", plaintext) + } + + // Output: + // Decrypted message: |-()-| +} + +func TestRoundTrip(t *testing.T) { + kems := []KEM{ + DHKEM(ecdh.P256()), + DHKEM(ecdh.P384()), + DHKEM(ecdh.P521()), + DHKEM(ecdh.X25519()), + MLKEM768(), + MLKEM1024(), + MLKEM768P256(), + MLKEM1024P384(), + MLKEM768X25519(), + } + kdfs := []KDF{ + HKDFSHA256(), + HKDFSHA384(), + HKDFSHA512(), + SHAKE128(), + SHAKE256(), + } + aeads := []AEAD{ + AES128GCM(), + AES256GCM(), + ChaCha20Poly1305(), + } + + for _, kem := range kems { + t.Run(fmt.Sprintf("KEM_%04x", kem.ID()), func(t *testing.T) { + k, err := kem.GenerateKey() + if err != nil { + t.Fatal(err) + } + kb, err := k.Bytes() + if err != nil { + t.Fatal(err) + } + kk, err := kem.NewPrivateKey(kb) + if err != nil { + t.Fatal(err) + } + if got, err := kk.Bytes(); err != nil { + t.Fatal(err) + } else if !bytes.Equal(got, kb) { + t.Errorf("re-serialized key mismatch: got %x, want %x", got, kb) + } + pk, err := kem.NewPublicKey(k.PublicKey().Bytes()) + if err != nil { + t.Fatal(err) + } + if got := pk.Bytes(); !bytes.Equal(got, k.PublicKey().Bytes()) { + t.Errorf("re-serialized public key mismatch: got %x, want %x", got, k.PublicKey().Bytes()) + } + + for _, kdf := range kdfs { + t.Run(fmt.Sprintf("KDF_%04x", kdf.ID()), func(t *testing.T) { + for _, aead := range aeads { + t.Run(fmt.Sprintf("AEAD_%04x", aead.ID()), func(t *testing.T) { + c, err := Seal(pk, kdf, aead, []byte("info"), []byte("plaintext")) + if err != nil { + t.Fatal(err) + } + p, err := Open(kk, kdf, aead, []byte("info"), c) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(p, []byte("plaintext")) { + t.Errorf("unexpected plaintext: got %x, want %x", p, []byte("plaintext")) + } + + p, err = Open(kk, kdf, aead, []byte("wrong"), c) + if err == nil { + t.Errorf("expected error when opening with wrong info, got plaintext %x", p) + } + c[len(c)-1] ^= 0xFF + p, err = Open(kk, kdf, aead, []byte("info"), c) + if err == nil { + t.Errorf("expected error when opening with corrupted ciphertext, got plaintext %x", p) + } + + c, err = Seal(k.PublicKey(), kdf, aead, nil, nil) + if err != nil { + t.Fatal(err) + } + p, err = Open(k, kdf, aead, nil, c) + if err != nil { + t.Fatal(err) + } + if len(p) != 0 { + t.Errorf("unexpected plaintext: got %x, want empty", p) + } + + // Test that Seal and Open don't modify the excess capacity of input + // slices. This is a regression test for a bug where decap would + // append to the enc slice, corrupting the ciphertext if they shared + // a backing array. + padSlice := func(b []byte) []byte { + s := make([]byte, len(b), len(b)+2000) + copy(s, b) + for i := len(b); i < cap(s); i++ { + s[:cap(s)][i] = 0xAA + } + return s[:len(b)] + } + checkSlice := func(name string, s []byte) { + for i := len(s); i < cap(s); i++ { + if s[:cap(s)][i] != 0xAA { + t.Errorf("%s: modified byte at index %d beyond slice length", name, i) + return + } + } + } + + infoS := padSlice([]byte("info")) + plaintextS := padSlice([]byte("plaintext")) + c, err = Seal(pk, kdf, aead, infoS, plaintextS) + if err != nil { + t.Fatal(err) + } + checkSlice("Seal info", infoS) + checkSlice("Seal plaintext", plaintextS) + + infoO := padSlice([]byte("info")) + ciphertextO := padSlice(c) + p, err = Open(kk, kdf, aead, infoO, ciphertextO) + if err != nil { + t.Fatalf("Open with large capacity slices failed: %v", err) + } + if !bytes.Equal(p, []byte("plaintext")) { + t.Errorf("unexpected plaintext: got %x, want %x", p, []byte("plaintext")) + } + checkSlice("Open info", infoO) + checkSlice("Open ciphertext", ciphertextO) + + // Also test the Sender.Seal and Recipient.Open methods. + infoSender := padSlice([]byte("info")) + enc, sender, err := NewSender(pk, kdf, aead, infoSender) + if err != nil { + t.Fatal(err) + } + checkSlice("NewSender info", infoSender) + + aadSeal := padSlice([]byte("aad")) + plaintextSeal := padSlice([]byte("plaintext")) + ct, err := sender.Seal(aadSeal, plaintextSeal) + if err != nil { + t.Fatal(err) + } + checkSlice("Sender.Seal aad", aadSeal) + checkSlice("Sender.Seal plaintext", plaintextSeal) + + infoRecipient := padSlice([]byte("info")) + encPadded := padSlice(enc) + recipient, err := NewRecipient(encPadded, kk, kdf, aead, infoRecipient) + if err != nil { + t.Fatal(err) + } + checkSlice("NewRecipient info", infoRecipient) + checkSlice("NewRecipient enc", encPadded) + + aadOpen := padSlice([]byte("aad")) + ctPadded := padSlice(ct) + p, err = recipient.Open(aadOpen, ctPadded) + if err != nil { + t.Fatalf("Recipient.Open failed: %v", err) + } + if !bytes.Equal(p, []byte("plaintext")) { + t.Errorf("unexpected plaintext: got %x, want %x", p, []byte("plaintext")) + } + checkSlice("Recipient.Open aad", aadOpen) + checkSlice("Recipient.Open ciphertext", ctPadded) + }) + } + }) + } + }) + } +} + +func mustDecodeHex(t *testing.T, in string) []byte { + t.Helper() + b, err := hex.DecodeString(in) + if err != nil { + t.Fatal(err) + } + return b +} + +func TestVectors(t *testing.T) { + t.Run("rfc9180", func(t *testing.T) { + testVectors(t, "rfc9180") + }) + t.Run("hpke-pq", func(t *testing.T) { + testVectors(t, "hpke-pq") + }) +} + +func testVectors(t *testing.T, name string) { + vectorsJSON, err := os.ReadFile("testdata/" + name + ".json") + if err != nil { + t.Fatal(err) + } + var vectors []struct { + Mode uint16 `json:"mode"` + KEM uint16 `json:"kem_id"` + KDF uint16 `json:"kdf_id"` + AEAD uint16 `json:"aead_id"` + Info string `json:"info"` + IkmE string `json:"ikmE"` + IkmR string `json:"ikmR"` + SkRm string `json:"skRm"` + PkRm string `json:"pkRm"` + Enc string `json:"enc"` + Encryptions []struct { + Aad string `json:"aad"` + Ct string `json:"ct"` + Nonce string `json:"nonce"` + Pt string `json:"pt"` + } `json:"encryptions"` + Exports []struct { + Context string `json:"exporter_context"` + L int `json:"L"` + Value string `json:"exported_value"` + } `json:"exports"` + + // Instead of checking in a very large rfc9180.json, we computed + // alternative accumulated values. + AccEncryptions string `json:"encryptions_accumulated"` + AccExports string `json:"exports_accumulated"` + } + if err := json.Unmarshal(vectorsJSON, &vectors); err != nil { + t.Fatal(err) + } + + for _, vector := range vectors { + name := fmt.Sprintf("mode %04x kem %04x kdf %04x aead %04x", + vector.Mode, vector.KEM, vector.KDF, vector.AEAD) + t.Run(name, func(t *testing.T) { + if vector.Mode != 0 { + t.Skip("only mode 0 (base) is supported") + } + if vector.KEM == 0x0021 { + t.Skip("KEM 0x0021 (DHKEM(X448)) not supported") + } + if vector.KEM == 0x0040 { + t.Skip("KEM 0x0040 (ML-KEM-512) not supported") + } + if vector.KDF == 0x0012 || vector.KDF == 0x0013 { + t.Skipf("TurboSHAKE KDF not supported") + } + + kdf, err := NewKDF(vector.KDF) + if err != nil { + t.Fatal(err) + } + if kdf.ID() != vector.KDF { + t.Errorf("unexpected KDF ID: got %04x, want %04x", kdf.ID(), vector.KDF) + } + + aead, err := NewAEAD(vector.AEAD) + if err != nil { + t.Fatal(err) + } + if aead.ID() != vector.AEAD { + t.Errorf("unexpected AEAD ID: got %04x, want %04x", aead.ID(), vector.AEAD) + } + + kem, err := NewKEM(vector.KEM) + if err != nil { + t.Fatal(err) + } + if kem.ID() != vector.KEM { + t.Errorf("unexpected KEM ID: got %04x, want %04x", kem.ID(), vector.KEM) + } + + pubKeyBytes := mustDecodeHex(t, vector.PkRm) + kemSender, err := kem.NewPublicKey(pubKeyBytes) + if err != nil { + t.Fatal(err) + } + if kemSender.KEM() != kem { + t.Errorf("unexpected KEM from sender: got %04x, want %04x", kemSender.KEM().ID(), kem.ID()) + } + if !bytes.Equal(kemSender.Bytes(), pubKeyBytes) { + t.Errorf("unexpected KEM bytes: got %x, want %x", kemSender.Bytes(), pubKeyBytes) + } + + ikmE := mustDecodeHex(t, vector.IkmE) + setupDerandomizedEncap(t, ikmE, kemSender) + + info := mustDecodeHex(t, vector.Info) + encap, sender, err := NewSender(kemSender, kdf, aead, info) + if err != nil { + t.Fatal(err) + } + if len(encap) != kem.encSize() { + t.Errorf("unexpected encapsulated key size: got %d, want %d", len(encap), kem.encSize()) + } + + expectedEncap := mustDecodeHex(t, vector.Enc) + if !bytes.Equal(encap, expectedEncap) { + t.Errorf("unexpected encapsulated key, got: %x, want %x", encap, expectedEncap) + } + + privKeyBytes := mustDecodeHex(t, vector.SkRm) + kemRecipient, err := kem.NewPrivateKey(privKeyBytes) + if err != nil { + t.Fatal(err) + } + if kemRecipient.KEM() != kem { + t.Errorf("unexpected KEM from recipient: got %04x, want %04x", kemRecipient.KEM().ID(), kem.ID()) + } + kemRecipientBytes, err := kemRecipient.Bytes() + if err != nil { + t.Fatal(err) + } + // X25519 serialized keys must be clamped, so the bytes might not match. + if !bytes.Equal(kemRecipientBytes, privKeyBytes) && vector.KEM != DHKEM(ecdh.X25519()).ID() { + t.Errorf("unexpected KEM bytes: got %x, want %x", kemRecipientBytes, privKeyBytes) + } + if vector.KEM == DHKEM(ecdh.X25519()).ID() { + kem2, err := kem.NewPrivateKey(kemRecipientBytes) + if err != nil { + t.Fatal(err) + } + kemRecipientBytes2, err := kem2.Bytes() + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(kemRecipientBytes2, kemRecipientBytes) { + t.Errorf("X25519 re-serialized key differs: got %x, want %x", kemRecipientBytes2, kemRecipientBytes) + } + if !bytes.Equal(kem2.PublicKey().Bytes(), pubKeyBytes) { + t.Errorf("X25519 re-derived public key differs: got %x, want %x", kem2.PublicKey().Bytes(), pubKeyBytes) + } + } + if !bytes.Equal(kemRecipient.PublicKey().Bytes(), pubKeyBytes) { + t.Errorf("unexpected KEM sender bytes: got %x, want %x", kemRecipient.PublicKey().Bytes(), pubKeyBytes) + } + + ikm := mustDecodeHex(t, vector.IkmR) + derivRecipient, err := kem.DeriveKeyPair(ikm) + if err != nil { + t.Fatal(err) + } + derivRecipientBytes, err := derivRecipient.Bytes() + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(derivRecipientBytes, privKeyBytes) && vector.KEM != DHKEM(ecdh.X25519()).ID() { + t.Errorf("unexpected KEM bytes from seed: got %x, want %x", derivRecipientBytes, privKeyBytes) + } + if !bytes.Equal(derivRecipient.PublicKey().Bytes(), pubKeyBytes) { + t.Errorf("unexpected KEM sender bytes from seed: got %x, want %x", derivRecipient.PublicKey().Bytes(), pubKeyBytes) + } + + recipient, err := NewRecipient(encap, kemRecipient, kdf, aead, info) + if err != nil { + t.Fatal(err) + } + + if aead != ExportOnly() && len(vector.AccEncryptions) != 0 { + source, sink := sha3.NewSHAKE128(), sha3.NewSHAKE128() + for range 1000 { + aad, plaintext := drawRandomInput(t, source), drawRandomInput(t, source) + ciphertext, err := sender.Seal(aad, plaintext) + if err != nil { + t.Fatal(err) + } + sink.Write(ciphertext) + got, err := recipient.Open(aad, ciphertext) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(got, plaintext) { + t.Errorf("unexpected plaintext: got %x want %x", got, plaintext) + } + } + encryptions := make([]byte, 16) + sink.Read(encryptions) + expectedEncryptions := mustDecodeHex(t, vector.AccEncryptions) + if !bytes.Equal(encryptions, expectedEncryptions) { + t.Errorf("unexpected accumulated encryptions, got: %x, want %x", encryptions, expectedEncryptions) + } + } else if aead != ExportOnly() { + for _, enc := range vector.Encryptions { + aad := mustDecodeHex(t, enc.Aad) + plaintext := mustDecodeHex(t, enc.Pt) + expectedCiphertext := mustDecodeHex(t, enc.Ct) + + ciphertext, err := sender.Seal(aad, plaintext) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(ciphertext, expectedCiphertext) { + t.Errorf("unexpected ciphertext, got: %x, want %x", ciphertext, expectedCiphertext) + } + + got, err := recipient.Open(aad, ciphertext) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(got, plaintext) { + t.Errorf("unexpected plaintext: got %x want %x", got, plaintext) + } + } + } else { + if _, err := sender.Seal(nil, nil); err == nil { + t.Error("expected error from Seal with export-only AEAD") + } + if _, err := recipient.Open(nil, nil); err == nil { + t.Error("expected error from Open with export-only AEAD") + } + } + + if len(vector.AccExports) != 0 { + source, sink := sha3.NewSHAKE128(), sha3.NewSHAKE128() + for l := range 1000 { + context := string(drawRandomInput(t, source)) + value, err := sender.Export(context, l) + if err != nil { + t.Fatal(err) + } + sink.Write(value) + got, err := recipient.Export(context, l) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(got, value) { + t.Errorf("recipient: unexpected exported secret: got %x want %x", got, value) + } + } + exports := make([]byte, 16) + sink.Read(exports) + expectedExports := mustDecodeHex(t, vector.AccExports) + if !bytes.Equal(exports, expectedExports) { + t.Errorf("unexpected accumulated exports, got: %x, want %x", exports, expectedExports) + } + } else { + for _, exp := range vector.Exports { + context := string(mustDecodeHex(t, exp.Context)) + expectedValue := mustDecodeHex(t, exp.Value) + + value, err := sender.Export(context, exp.L) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(value, expectedValue) { + t.Errorf("unexpected exported value, got: %x, want %x", value, expectedValue) + } + + got, err := recipient.Export(context, exp.L) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(got, value) { + t.Errorf("recipient: unexpected exported secret: got %x want %x", got, value) + } + } + } + }) + } +} + +func drawRandomInput(t *testing.T, r io.Reader) []byte { + t.Helper() + l := make([]byte, 1) + if _, err := r.Read(l); err != nil { + t.Fatal(err) + } + n := int(l[0]) + b := make([]byte, n) + if _, err := r.Read(b); err != nil { + t.Fatal(err) + } + return b +} + +func setupDerandomizedEncap(t *testing.T, randBytes []byte, pk PublicKey) { + t.Cleanup(func() { + testingOnlyGenerateKey = nil + testingOnlyEncapsulate = nil + }) + switch pk.KEM() { + case DHKEM(ecdh.P256()), DHKEM(ecdh.P384()), DHKEM(ecdh.P521()), DHKEM(ecdh.X25519()): + r, err := pk.KEM().DeriveKeyPair(randBytes) + if err != nil { + t.Fatal(err) + } + testingOnlyGenerateKey = func() *ecdh.PrivateKey { + return r.(*dhKEMPrivateKey).priv.(*ecdh.PrivateKey) + } + case mlkem768: + pq := pk.(*mlkemPublicKey).pq.(*mlkem.EncapsulationKey768) + testingOnlyEncapsulate = func() ([]byte, []byte) { + ss, ct, err := mlkemtest.Encapsulate768(pq, randBytes) + if err != nil { + t.Fatal(err) + } + return ss, ct + } + case mlkem1024: + pq := pk.(*mlkemPublicKey).pq.(*mlkem.EncapsulationKey1024) + testingOnlyEncapsulate = func() ([]byte, []byte) { + ss, ct, err := mlkemtest.Encapsulate1024(pq, randBytes) + if err != nil { + t.Fatal(err) + } + return ss, ct + } + case mlkem768X25519: + pqRand, tRand := randBytes[:32], randBytes[32:] + pq := pk.(*hybridPublicKey).pq.(*mlkem.EncapsulationKey768) + k, err := ecdh.X25519().NewPrivateKey(tRand) + if err != nil { + t.Fatal(err) + } + testingOnlyGenerateKey = func() *ecdh.PrivateKey { + return k + } + testingOnlyEncapsulate = func() ([]byte, []byte) { + ss, ct, err := mlkemtest.Encapsulate768(pq, pqRand) + if err != nil { + t.Fatal(err) + } + return ss, ct + } + case mlkem768P256: + // The rest of randBytes are the following candidates for rejection + // sampling, but they are never reached. + pqRand, tRand := randBytes[:32], randBytes[32:64] + pq := pk.(*hybridPublicKey).pq.(*mlkem.EncapsulationKey768) + k, err := ecdh.P256().NewPrivateKey(tRand) + if err != nil { + t.Fatal(err) + } + testingOnlyGenerateKey = func() *ecdh.PrivateKey { + return k + } + testingOnlyEncapsulate = func() ([]byte, []byte) { + ss, ct, err := mlkemtest.Encapsulate768(pq, pqRand) + if err != nil { + t.Fatal(err) + } + return ss, ct + } + case mlkem1024P384: + pqRand, tRand := randBytes[:32], randBytes[32:] + pq := pk.(*hybridPublicKey).pq.(*mlkem.EncapsulationKey1024) + k, err := ecdh.P384().NewPrivateKey(tRand) + if err != nil { + t.Fatal(err) + } + testingOnlyGenerateKey = func() *ecdh.PrivateKey { + return k + } + testingOnlyEncapsulate = func() ([]byte, []byte) { + ss, ct, err := mlkemtest.Encapsulate1024(pq, pqRand) + if err != nil { + t.Fatal(err) + } + return ss, ct + } + default: + t.Fatalf("unsupported KEM %04x", pk.KEM().ID()) + } +} + +func TestSingletons(t *testing.T) { + if HKDFSHA256() != HKDFSHA256() { + t.Error("HKDFSHA256() != HKDFSHA256()") + } + if HKDFSHA384() != HKDFSHA384() { + t.Error("HKDFSHA384() != HKDFSHA384()") + } + if HKDFSHA512() != HKDFSHA512() { + t.Error("HKDFSHA512() != HKDFSHA512()") + } + if AES128GCM() != AES128GCM() { + t.Error("AES128GCM() != AES128GCM()") + } + if AES256GCM() != AES256GCM() { + t.Error("AES256GCM() != AES256GCM()") + } + if ChaCha20Poly1305() != ChaCha20Poly1305() { + t.Error("ChaCha20Poly1305() != ChaCha20Poly1305()") + } + if ExportOnly() != ExportOnly() { + t.Error("ExportOnly() != ExportOnly()") + } + if DHKEM(ecdh.P256()) != DHKEM(ecdh.P256()) { + t.Error("DHKEM(P-256) != DHKEM(P-256)") + } + if DHKEM(ecdh.P384()) != DHKEM(ecdh.P384()) { + t.Error("DHKEM(P-384) != DHKEM(P-384)") + } + if DHKEM(ecdh.P521()) != DHKEM(ecdh.P521()) { + t.Error("DHKEM(P-521) != DHKEM(P-521)") + } + if DHKEM(ecdh.X25519()) != DHKEM(ecdh.X25519()) { + t.Error("DHKEM(X25519) != DHKEM(X25519)") + } + if MLKEM768() != MLKEM768() { + t.Error("MLKEM768() != MLKEM768()") + } + if MLKEM1024() != MLKEM1024() { + t.Error("MLKEM1024() != MLKEM1024()") + } + if MLKEM768X25519() != MLKEM768X25519() { + t.Error("MLKEM768X25519() != MLKEM768X25519()") + } + if MLKEM768P256() != MLKEM768P256() { + t.Error("MLKEM768P256() != MLKEM768P256()") + } + if MLKEM1024P384() != MLKEM1024P384() { + t.Error("MLKEM1024P384() != MLKEM1024P384()") + } +} diff --git a/go/src/crypto/hpke/kdf.go b/go/src/crypto/hpke/kdf.go new file mode 100644 index 0000000000000000000000000000000000000000..23217a718dc8ae7fe87f1a708136de7292b2724d --- /dev/null +++ b/go/src/crypto/hpke/kdf.go @@ -0,0 +1,155 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package hpke + +import ( + "crypto/hkdf" + "crypto/sha256" + "crypto/sha3" + "crypto/sha512" + "errors" + "fmt" + "hash" + "internal/byteorder" +) + +// The KDF is one of the three components of an HPKE ciphersuite, implementing +// key derivation. +type KDF interface { + ID() uint16 + oneStage() bool + size() int // Nh + labeledDerive(suiteID, inputKey []byte, label string, context []byte, length uint16) ([]byte, error) + labeledExtract(suiteID, salt []byte, label string, inputKey []byte) ([]byte, error) + labeledExpand(suiteID, randomKey []byte, label string, info []byte, length uint16) ([]byte, error) +} + +// NewKDF returns the KDF implementation for the given KDF ID. +// +// Applications are encouraged to use specific implementations like [HKDFSHA256] +// instead, unless runtime agility is required. +func NewKDF(id uint16) (KDF, error) { + switch id { + case 0x0001: // HKDF-SHA256 + return HKDFSHA256(), nil + case 0x0002: // HKDF-SHA384 + return HKDFSHA384(), nil + case 0x0003: // HKDF-SHA512 + return HKDFSHA512(), nil + case 0x0010: // SHAKE128 + return SHAKE128(), nil + case 0x0011: // SHAKE256 + return SHAKE256(), nil + default: + return nil, fmt.Errorf("unsupported KDF %04x", id) + } +} + +// HKDFSHA256 returns an HKDF-SHA256 KDF implementation. +func HKDFSHA256() KDF { return hkdfSHA256 } + +// HKDFSHA384 returns an HKDF-SHA384 KDF implementation. +func HKDFSHA384() KDF { return hkdfSHA384 } + +// HKDFSHA512 returns an HKDF-SHA512 KDF implementation. +func HKDFSHA512() KDF { return hkdfSHA512 } + +type hkdfKDF struct { + hash func() hash.Hash + id uint16 + nH int +} + +var hkdfSHA256 = &hkdfKDF{hash: sha256.New, id: 0x0001, nH: sha256.Size} +var hkdfSHA384 = &hkdfKDF{hash: sha512.New384, id: 0x0002, nH: sha512.Size384} +var hkdfSHA512 = &hkdfKDF{hash: sha512.New, id: 0x0003, nH: sha512.Size} + +func (kdf *hkdfKDF) ID() uint16 { + return kdf.id +} + +func (kdf *hkdfKDF) size() int { + return kdf.nH +} + +func (kdf *hkdfKDF) oneStage() bool { + return false +} + +func (kdf *hkdfKDF) labeledDerive(_, _ []byte, _ string, _ []byte, _ uint16) ([]byte, error) { + return nil, errors.New("hpke: internal error: labeledDerive called on two-stage KDF") +} + +func (kdf *hkdfKDF) labeledExtract(suiteID []byte, salt []byte, label string, inputKey []byte) ([]byte, error) { + labeledIKM := make([]byte, 0, 7+len(suiteID)+len(label)+len(inputKey)) + labeledIKM = append(labeledIKM, []byte("HPKE-v1")...) + labeledIKM = append(labeledIKM, suiteID...) + labeledIKM = append(labeledIKM, label...) + labeledIKM = append(labeledIKM, inputKey...) + return hkdf.Extract(kdf.hash, labeledIKM, salt) +} + +func (kdf *hkdfKDF) labeledExpand(suiteID []byte, randomKey []byte, label string, info []byte, length uint16) ([]byte, error) { + labeledInfo := make([]byte, 0, 2+7+len(suiteID)+len(label)+len(info)) + labeledInfo = byteorder.BEAppendUint16(labeledInfo, length) + labeledInfo = append(labeledInfo, []byte("HPKE-v1")...) + labeledInfo = append(labeledInfo, suiteID...) + labeledInfo = append(labeledInfo, label...) + labeledInfo = append(labeledInfo, info...) + return hkdf.Expand(kdf.hash, randomKey, string(labeledInfo), int(length)) +} + +// SHAKE128 returns a SHAKE128 KDF implementation. +func SHAKE128() KDF { + return shake128KDF +} + +// SHAKE256 returns a SHAKE256 KDF implementation. +func SHAKE256() KDF { + return shake256KDF +} + +type shakeKDF struct { + hash func() *sha3.SHAKE + id uint16 + nH int +} + +var shake128KDF = &shakeKDF{hash: sha3.NewSHAKE128, id: 0x0010, nH: 32} +var shake256KDF = &shakeKDF{hash: sha3.NewSHAKE256, id: 0x0011, nH: 64} + +func (kdf *shakeKDF) ID() uint16 { + return kdf.id +} + +func (kdf *shakeKDF) size() int { + return kdf.nH +} + +func (kdf *shakeKDF) oneStage() bool { + return true +} + +func (kdf *shakeKDF) labeledDerive(suiteID, inputKey []byte, label string, context []byte, length uint16) ([]byte, error) { + H := kdf.hash() + H.Write(inputKey) + H.Write([]byte("HPKE-v1")) + H.Write(suiteID) + H.Write([]byte{byte(len(label) >> 8), byte(len(label))}) + H.Write([]byte(label)) + H.Write([]byte{byte(length >> 8), byte(length)}) + H.Write(context) + out := make([]byte, length) + H.Read(out) + return out, nil +} + +func (kdf *shakeKDF) labeledExtract(_, _ []byte, _ string, _ []byte) ([]byte, error) { + return nil, errors.New("hpke: internal error: labeledExtract called on one-stage KDF") +} + +func (kdf *shakeKDF) labeledExpand(_, _ []byte, _ string, _ []byte, _ uint16) ([]byte, error) { + return nil, errors.New("hpke: internal error: labeledExpand called on one-stage KDF") +} diff --git a/go/src/crypto/hpke/kem.go b/go/src/crypto/hpke/kem.go new file mode 100644 index 0000000000000000000000000000000000000000..132e0a754c63f37e23c2874a2b3ba947df988254 --- /dev/null +++ b/go/src/crypto/hpke/kem.go @@ -0,0 +1,383 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package hpke + +import ( + "crypto/ecdh" + "crypto/internal/rand" + "errors" + "internal/byteorder" + "slices" +) + +// A KEM is a Key Encapsulation Mechanism, one of the three components of an +// HPKE ciphersuite. +type KEM interface { + // ID returns the HPKE KEM identifier. + ID() uint16 + + // GenerateKey generates a new key pair. + GenerateKey() (PrivateKey, error) + + // NewPublicKey deserializes a public key from bytes. + // + // It implements DeserializePublicKey, as defined in RFC 9180. + NewPublicKey([]byte) (PublicKey, error) + + // NewPrivateKey deserializes a private key from bytes. + // + // It implements DeserializePrivateKey, as defined in RFC 9180. + NewPrivateKey([]byte) (PrivateKey, error) + + // DeriveKeyPair derives a key pair from the given input keying material. + // + // It implements DeriveKeyPair, as defined in RFC 9180. + DeriveKeyPair(ikm []byte) (PrivateKey, error) + + encSize() int +} + +// NewKEM returns the KEM implementation for the given KEM ID. +// +// Applications are encouraged to use specific implementations like [DHKEM] or +// [MLKEM768X25519] instead, unless runtime agility is required. +func NewKEM(id uint16) (KEM, error) { + switch id { + case 0x0010: // DHKEM(P-256, HKDF-SHA256) + return DHKEM(ecdh.P256()), nil + case 0x0011: // DHKEM(P-384, HKDF-SHA384) + return DHKEM(ecdh.P384()), nil + case 0x0012: // DHKEM(P-521, HKDF-SHA512) + return DHKEM(ecdh.P521()), nil + case 0x0020: // DHKEM(X25519, HKDF-SHA256) + return DHKEM(ecdh.X25519()), nil + case 0x0041: // ML-KEM-768 + return MLKEM768(), nil + case 0x0042: // ML-KEM-1024 + return MLKEM1024(), nil + case 0x647a: // MLKEM768-X25519 + return MLKEM768X25519(), nil + case 0x0050: // MLKEM768-P256 + return MLKEM768P256(), nil + case 0x0051: // MLKEM1024-P384 + return MLKEM1024P384(), nil + default: + return nil, errors.New("unsupported KEM") + } +} + +// A PublicKey is an instantiation of a KEM (one of the three components of an +// HPKE ciphersuite) with an encapsulation key (i.e. the public key). +// +// A PublicKey is usually obtained from a method of the corresponding [KEM] or +// [PrivateKey], such as [KEM.NewPublicKey] or [PrivateKey.PublicKey]. +type PublicKey interface { + // KEM returns the instantiated KEM. + KEM() KEM + + // Bytes returns the public key as the output of SerializePublicKey. + Bytes() []byte + + encap() (sharedSecret, enc []byte, err error) +} + +// A PrivateKey is an instantiation of a KEM (one of the three components of +// an HPKE ciphersuite) with a decapsulation key (i.e. the secret key). +// +// A PrivateKey is usually obtained from a method of the corresponding [KEM], +// such as [KEM.GenerateKey] or [KEM.NewPrivateKey]. +type PrivateKey interface { + // KEM returns the instantiated KEM. + KEM() KEM + + // Bytes returns the private key as the output of SerializePrivateKey, as + // defined in RFC 9180. + // + // Note that for X25519 this might not match the input to NewPrivateKey. + // This is a requirement of RFC 9180, Section 7.1.2. + Bytes() ([]byte, error) + + // PublicKey returns the corresponding PublicKey. + PublicKey() PublicKey + + decap(enc []byte) (sharedSecret []byte, err error) +} + +type dhKEM struct { + kdf KDF + id uint16 + curve ecdh.Curve + Nsecret uint16 + Nsk uint16 + Nenc int +} + +func (kem *dhKEM) extractAndExpand(dhKey, kemContext []byte) ([]byte, error) { + suiteID := byteorder.BEAppendUint16([]byte("KEM"), kem.id) + eaePRK, err := kem.kdf.labeledExtract(suiteID, nil, "eae_prk", dhKey) + if err != nil { + return nil, err + } + return kem.kdf.labeledExpand(suiteID, eaePRK, "shared_secret", kemContext, kem.Nsecret) +} + +func (kem *dhKEM) ID() uint16 { + return kem.id +} + +func (kem *dhKEM) encSize() int { + return kem.Nenc +} + +var dhKEMP256 = &dhKEM{HKDFSHA256(), 0x0010, ecdh.P256(), 32, 32, 65} +var dhKEMP384 = &dhKEM{HKDFSHA384(), 0x0011, ecdh.P384(), 48, 48, 97} +var dhKEMP521 = &dhKEM{HKDFSHA512(), 0x0012, ecdh.P521(), 64, 66, 133} +var dhKEMX25519 = &dhKEM{HKDFSHA256(), 0x0020, ecdh.X25519(), 32, 32, 32} + +// DHKEM returns a KEM implementing one of +// +// - DHKEM(P-256, HKDF-SHA256) +// - DHKEM(P-384, HKDF-SHA384) +// - DHKEM(P-521, HKDF-SHA512) +// - DHKEM(X25519, HKDF-SHA256) +// +// depending on curve. +func DHKEM(curve ecdh.Curve) KEM { + switch curve { + case ecdh.P256(): + return dhKEMP256 + case ecdh.P384(): + return dhKEMP384 + case ecdh.P521(): + return dhKEMP521 + case ecdh.X25519(): + return dhKEMX25519 + default: + // The set of ecdh.Curve implementations is closed, because the + // interface has unexported methods. Therefore, this default case is + // only hit if a new curve is added that DHKEM doesn't support. + return unsupportedCurveKEM{} + } +} + +type unsupportedCurveKEM struct{} + +func (unsupportedCurveKEM) ID() uint16 { + return 0 +} +func (unsupportedCurveKEM) GenerateKey() (PrivateKey, error) { + return nil, errors.New("unsupported curve") +} +func (unsupportedCurveKEM) NewPublicKey([]byte) (PublicKey, error) { + return nil, errors.New("unsupported curve") +} +func (unsupportedCurveKEM) NewPrivateKey([]byte) (PrivateKey, error) { + return nil, errors.New("unsupported curve") +} +func (unsupportedCurveKEM) DeriveKeyPair([]byte) (PrivateKey, error) { + return nil, errors.New("unsupported curve") +} +func (unsupportedCurveKEM) encSize() int { + return 0 +} + +type dhKEMPublicKey struct { + kem *dhKEM + pub *ecdh.PublicKey +} + +// NewDHKEMPublicKey returns a PublicKey implementing +// +// - DHKEM(P-256, HKDF-SHA256) +// - DHKEM(P-384, HKDF-SHA384) +// - DHKEM(P-521, HKDF-SHA512) +// - DHKEM(X25519, HKDF-SHA256) +// +// depending on the underlying curve of pub ([ecdh.X25519], [ecdh.P256], +// [ecdh.P384], or [ecdh.P521]). +// +// This function is meant for applications that already have an instantiated +// crypto/ecdh public key. Otherwise, applications should use the +// [KEM.NewPublicKey] method of [DHKEM]. +func NewDHKEMPublicKey(pub *ecdh.PublicKey) (PublicKey, error) { + kem, ok := DHKEM(pub.Curve()).(*dhKEM) + if !ok { + return nil, errors.New("unsupported curve") + } + return &dhKEMPublicKey{ + kem: kem, + pub: pub, + }, nil +} + +func (kem *dhKEM) NewPublicKey(data []byte) (PublicKey, error) { + pub, err := kem.curve.NewPublicKey(data) + if err != nil { + return nil, err + } + return NewDHKEMPublicKey(pub) +} + +func (pk *dhKEMPublicKey) KEM() KEM { + return pk.kem +} + +func (pk *dhKEMPublicKey) Bytes() []byte { + return pk.pub.Bytes() +} + +// testingOnlyGenerateKey is only used during testing, to provide +// a fixed test key to use when checking the RFC 9180 vectors. +var testingOnlyGenerateKey func() *ecdh.PrivateKey + +func (pk *dhKEMPublicKey) encap() (sharedSecret []byte, encapPub []byte, err error) { + privEph, err := pk.pub.Curve().GenerateKey(rand.Reader) + if err != nil { + return nil, nil, err + } + if testingOnlyGenerateKey != nil { + privEph = testingOnlyGenerateKey() + } + dhVal, err := privEph.ECDH(pk.pub) + if err != nil { + return nil, nil, err + } + encPubEph := privEph.PublicKey().Bytes() + + encPubRecip := pk.pub.Bytes() + kemContext := append(encPubEph, encPubRecip...) + sharedSecret, err = pk.kem.extractAndExpand(dhVal, kemContext) + if err != nil { + return nil, nil, err + } + return sharedSecret, encPubEph, nil +} + +type dhKEMPrivateKey struct { + kem *dhKEM + priv ecdh.KeyExchanger +} + +// NewDHKEMPrivateKey returns a PrivateKey implementing +// +// - DHKEM(P-256, HKDF-SHA256) +// - DHKEM(P-384, HKDF-SHA384) +// - DHKEM(P-521, HKDF-SHA512) +// - DHKEM(X25519, HKDF-SHA256) +// +// depending on the underlying curve of priv ([ecdh.X25519], [ecdh.P256], +// [ecdh.P384], or [ecdh.P521]). +// +// This function is meant for applications that already have an instantiated +// crypto/ecdh private key, or another implementation of a [ecdh.KeyExchanger] +// (e.g. a hardware key). Otherwise, applications should use the +// [KEM.NewPrivateKey] method of [DHKEM]. +func NewDHKEMPrivateKey(priv ecdh.KeyExchanger) (PrivateKey, error) { + kem, ok := DHKEM(priv.Curve()).(*dhKEM) + if !ok { + return nil, errors.New("unsupported curve") + } + return &dhKEMPrivateKey{ + kem: kem, + priv: priv, + }, nil +} + +func (kem *dhKEM) GenerateKey() (PrivateKey, error) { + priv, err := kem.curve.GenerateKey(rand.Reader) + if err != nil { + return nil, err + } + return NewDHKEMPrivateKey(priv) +} + +func (kem *dhKEM) NewPrivateKey(ikm []byte) (PrivateKey, error) { + priv, err := kem.curve.NewPrivateKey(ikm) + if err != nil { + return nil, err + } + return NewDHKEMPrivateKey(priv) +} + +func (kem *dhKEM) DeriveKeyPair(ikm []byte) (PrivateKey, error) { + // DeriveKeyPair from RFC 9180 Section 7.1.3. + suiteID := byteorder.BEAppendUint16([]byte("KEM"), kem.id) + prk, err := kem.kdf.labeledExtract(suiteID, nil, "dkp_prk", ikm) + if err != nil { + return nil, err + } + if kem == dhKEMX25519 { + s, err := kem.kdf.labeledExpand(suiteID, prk, "sk", nil, kem.Nsk) + if err != nil { + return nil, err + } + return kem.NewPrivateKey(s) + } + var counter uint8 + for counter < 4 { + s, err := kem.kdf.labeledExpand(suiteID, prk, "candidate", []byte{counter}, kem.Nsk) + if err != nil { + return nil, err + } + if kem == dhKEMP521 { + s[0] &= 0x01 + } + r, err := kem.NewPrivateKey(s) + if err != nil { + counter++ + continue + } + return r, nil + } + panic("chance of four rejections is < 2^-128") +} + +func (k *dhKEMPrivateKey) KEM() KEM { + return k.kem +} + +func (k *dhKEMPrivateKey) Bytes() ([]byte, error) { + // Bizarrely, RFC 9180, Section 7.1.2 says SerializePrivateKey MUST clamp + // the output, which I thought we all agreed to instead do as part of the DH + // function, letting private keys be random bytes. + // + // At the same time, it says DeserializePrivateKey MUST also clamp, implying + // that the input doesn't have to be clamped, so Bytes by spec doesn't + // necessarily match the NewPrivateKey input. + // + // I'm sure this will not lead to any unexpected behavior or interop issue. + priv, ok := k.priv.(*ecdh.PrivateKey) + if !ok { + return nil, errors.New("ecdh: private key does not support Bytes") + } + if k.kem == dhKEMX25519 { + b := priv.Bytes() + b[0] &= 248 + b[31] &= 127 + b[31] |= 64 + return b, nil + } + return priv.Bytes(), nil +} + +func (k *dhKEMPrivateKey) PublicKey() PublicKey { + return &dhKEMPublicKey{ + kem: k.kem, + pub: k.priv.PublicKey(), + } +} + +func (k *dhKEMPrivateKey) decap(encPubEph []byte) ([]byte, error) { + pubEph, err := k.priv.Curve().NewPublicKey(encPubEph) + if err != nil { + return nil, err + } + dhVal, err := k.priv.ECDH(pubEph) + if err != nil { + return nil, err + } + kemContext := append(slices.Clip(encPubEph), k.priv.PublicKey().Bytes()...) + return k.kem.extractAndExpand(dhVal, kemContext) +} diff --git a/go/src/crypto/hpke/pq.go b/go/src/crypto/hpke/pq.go new file mode 100644 index 0000000000000000000000000000000000000000..e8dc80fd23a61a268dde3fd8f3bb4a74cbc62e6d --- /dev/null +++ b/go/src/crypto/hpke/pq.go @@ -0,0 +1,540 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package hpke + +import ( + "bytes" + "crypto" + "crypto/ecdh" + "crypto/fips140" + "crypto/internal/fips140/drbg" + "crypto/internal/rand" + "crypto/mlkem" + "crypto/sha3" + "errors" + "internal/byteorder" +) + +var mlkem768X25519 = &hybridKEM{ + id: 0x647a, + label: /**/ `\./` + + /* */ `/^\`, + curve: ecdh.X25519(), + + curveSeedSize: 32, + curvePointSize: 32, + pqEncapsKeySize: mlkem.EncapsulationKeySize768, + pqCiphertextSize: mlkem.CiphertextSize768, + + pqNewPublicKey: func(data []byte) (crypto.Encapsulator, error) { + return mlkem.NewEncapsulationKey768(data) + }, + pqNewPrivateKey: func(data []byte) (crypto.Decapsulator, error) { + return mlkem.NewDecapsulationKey768(data) + }, +} + +// MLKEM768X25519 returns a KEM implementing MLKEM768-X25519 (a.k.a. X-Wing) +// from draft-ietf-hpke-pq. +func MLKEM768X25519() KEM { + return mlkem768X25519 +} + +var mlkem768P256 = &hybridKEM{ + id: 0x0050, + label: "MLKEM768-P256", + curve: ecdh.P256(), + + curveSeedSize: 32, + curvePointSize: 65, + pqEncapsKeySize: mlkem.EncapsulationKeySize768, + pqCiphertextSize: mlkem.CiphertextSize768, + + pqNewPublicKey: func(data []byte) (crypto.Encapsulator, error) { + return mlkem.NewEncapsulationKey768(data) + }, + pqNewPrivateKey: func(data []byte) (crypto.Decapsulator, error) { + return mlkem.NewDecapsulationKey768(data) + }, +} + +// MLKEM768P256 returns a KEM implementing MLKEM768-P256 from draft-ietf-hpke-pq. +func MLKEM768P256() KEM { + return mlkem768P256 +} + +var mlkem1024P384 = &hybridKEM{ + id: 0x0051, + label: "MLKEM1024-P384", + curve: ecdh.P384(), + + curveSeedSize: 48, + curvePointSize: 97, + pqEncapsKeySize: mlkem.EncapsulationKeySize1024, + pqCiphertextSize: mlkem.CiphertextSize1024, + + pqNewPublicKey: func(data []byte) (crypto.Encapsulator, error) { + return mlkem.NewEncapsulationKey1024(data) + }, + pqNewPrivateKey: func(data []byte) (crypto.Decapsulator, error) { + return mlkem.NewDecapsulationKey1024(data) + }, +} + +// MLKEM1024P384 returns a KEM implementing MLKEM1024-P384 from draft-ietf-hpke-pq. +func MLKEM1024P384() KEM { + return mlkem1024P384 +} + +type hybridKEM struct { + id uint16 + label string + curve ecdh.Curve + + curveSeedSize int + curvePointSize int + pqEncapsKeySize int + pqCiphertextSize int + + pqNewPublicKey func(data []byte) (crypto.Encapsulator, error) + pqNewPrivateKey func(data []byte) (crypto.Decapsulator, error) +} + +func (kem *hybridKEM) ID() uint16 { + return kem.id +} + +func (kem *hybridKEM) encSize() int { + return kem.pqCiphertextSize + kem.curvePointSize +} + +func (kem *hybridKEM) sharedSecret(ssPQ, ssT, ctT, ekT []byte) []byte { + h := sha3.New256() + h.Write(ssPQ) + h.Write(ssT) + h.Write(ctT) + h.Write(ekT) + h.Write([]byte(kem.label)) + return h.Sum(nil) +} + +type hybridPublicKey struct { + kem *hybridKEM + t *ecdh.PublicKey + pq crypto.Encapsulator +} + +// NewHybridPublicKey returns a PublicKey implementing one of +// +// - MLKEM768-X25519 (a.k.a. X-Wing) +// - MLKEM768-P256 +// - MLKEM1024-P384 +// +// from draft-ietf-hpke-pq, depending on the underlying curve of t +// ([ecdh.X25519], [ecdh.P256], or [ecdh.P384]) and the type of pq (either +// *[mlkem.EncapsulationKey768] or *[mlkem.EncapsulationKey1024]). +// +// This function is meant for applications that already have instantiated +// crypto/ecdh and crypto/mlkem public keys. Otherwise, applications should use +// the [KEM.NewPublicKey] method of e.g. [MLKEM768X25519]. +func NewHybridPublicKey(pq crypto.Encapsulator, t *ecdh.PublicKey) (PublicKey, error) { + switch t.Curve() { + case ecdh.X25519(): + if _, ok := pq.(*mlkem.EncapsulationKey768); !ok { + return nil, errors.New("invalid PQ KEM for X25519 hybrid") + } + return &hybridPublicKey{mlkem768X25519, t, pq}, nil + case ecdh.P256(): + if _, ok := pq.(*mlkem.EncapsulationKey768); !ok { + return nil, errors.New("invalid PQ KEM for P-256 hybrid") + } + return &hybridPublicKey{mlkem768P256, t, pq}, nil + case ecdh.P384(): + if _, ok := pq.(*mlkem.EncapsulationKey1024); !ok { + return nil, errors.New("invalid PQ KEM for P-384 hybrid") + } + return &hybridPublicKey{mlkem1024P384, t, pq}, nil + default: + return nil, errors.New("unsupported curve") + } +} + +func (kem *hybridKEM) NewPublicKey(data []byte) (PublicKey, error) { + if len(data) != kem.pqEncapsKeySize+kem.curvePointSize { + return nil, errors.New("invalid public key size") + } + pq, err := kem.pqNewPublicKey(data[:kem.pqEncapsKeySize]) + if err != nil { + return nil, err + } + var k *ecdh.PublicKey + fips140.WithoutEnforcement(func() { // Hybrid of ML-KEM, which is Approved. + k, err = kem.curve.NewPublicKey(data[kem.pqEncapsKeySize:]) + }) + if err != nil { + return nil, err + } + return NewHybridPublicKey(pq, k) +} + +func (pk *hybridPublicKey) KEM() KEM { + return pk.kem +} + +func (pk *hybridPublicKey) Bytes() []byte { + return append(pk.pq.Bytes(), pk.t.Bytes()...) +} + +var testingOnlyEncapsulate func() (ss, ct []byte) + +func (pk *hybridPublicKey) encap() (sharedSecret []byte, encapPub []byte, err error) { + var skE *ecdh.PrivateKey + fips140.WithoutEnforcement(func() { // Hybrid of ML-KEM, which is Approved. + skE, err = pk.t.Curve().GenerateKey(rand.Reader) + }) + if err != nil { + return nil, nil, err + } + if testingOnlyGenerateKey != nil { + skE = testingOnlyGenerateKey() + } + var ssT []byte + fips140.WithoutEnforcement(func() { + ssT, err = skE.ECDH(pk.t) + }) + if err != nil { + return nil, nil, err + } + ctT := skE.PublicKey().Bytes() + + ssPQ, ctPQ := pk.pq.Encapsulate() + if testingOnlyEncapsulate != nil { + ssPQ, ctPQ = testingOnlyEncapsulate() + } + + ss := pk.kem.sharedSecret(ssPQ, ssT, ctT, pk.t.Bytes()) + ct := append(ctPQ, ctT...) + return ss, ct, nil +} + +type hybridPrivateKey struct { + kem *hybridKEM + seed []byte // can be nil + t ecdh.KeyExchanger + pq crypto.Decapsulator +} + +// NewHybridPrivateKey returns a PrivateKey implementing +// +// - MLKEM768-X25519 (a.k.a. X-Wing) +// - MLKEM768-P256 +// - MLKEM1024-P384 +// +// from draft-ietf-hpke-pq, depending on the underlying curve of t +// ([ecdh.X25519], [ecdh.P256], or [ecdh.P384]) and the type of pq.Encapsulator() +// (either *[mlkem.EncapsulationKey768] or *[mlkem.EncapsulationKey1024]). +// +// This function is meant for applications that already have instantiated +// crypto/ecdh and crypto/mlkem private keys, or another implementation of a +// [ecdh.KeyExchanger] and [crypto.Decapsulator] (e.g. a hardware key). +// Otherwise, applications should use the [KEM.NewPrivateKey] method of e.g. +// [MLKEM768X25519]. +func NewHybridPrivateKey(pq crypto.Decapsulator, t ecdh.KeyExchanger) (PrivateKey, error) { + return newHybridPrivateKey(pq, t, nil) +} + +func (kem *hybridKEM) GenerateKey() (PrivateKey, error) { + seed := make([]byte, 32) + drbg.Read(seed) + return kem.NewPrivateKey(seed) +} + +func (kem *hybridKEM) NewPrivateKey(priv []byte) (PrivateKey, error) { + if len(priv) != 32 { + return nil, errors.New("hpke: invalid hybrid KEM secret length") + } + + s := sha3.NewSHAKE256() + s.Write(priv) + + seedPQ := make([]byte, mlkem.SeedSize) + s.Read(seedPQ) + pq, err := kem.pqNewPrivateKey(seedPQ) + if err != nil { + return nil, err + } + + seedT := make([]byte, kem.curveSeedSize) + for { + s.Read(seedT) + var k ecdh.KeyExchanger + fips140.WithoutEnforcement(func() { // Hybrid of ML-KEM, which is Approved. + k, err = kem.curve.NewPrivateKey(seedT) + }) + if err != nil { + continue + } + return newHybridPrivateKey(pq, k, priv) + } +} + +func newHybridPrivateKey(pq crypto.Decapsulator, t ecdh.KeyExchanger, seed []byte) (PrivateKey, error) { + switch t.Curve() { + case ecdh.X25519(): + if _, ok := pq.Encapsulator().(*mlkem.EncapsulationKey768); !ok { + return nil, errors.New("invalid PQ KEM for X25519 hybrid") + } + return &hybridPrivateKey{mlkem768X25519, bytes.Clone(seed), t, pq}, nil + case ecdh.P256(): + if _, ok := pq.Encapsulator().(*mlkem.EncapsulationKey768); !ok { + return nil, errors.New("invalid PQ KEM for P-256 hybrid") + } + return &hybridPrivateKey{mlkem768P256, bytes.Clone(seed), t, pq}, nil + case ecdh.P384(): + if _, ok := pq.Encapsulator().(*mlkem.EncapsulationKey1024); !ok { + return nil, errors.New("invalid PQ KEM for P-384 hybrid") + } + return &hybridPrivateKey{mlkem1024P384, bytes.Clone(seed), t, pq}, nil + default: + return nil, errors.New("unsupported curve") + } +} + +func (kem *hybridKEM) DeriveKeyPair(ikm []byte) (PrivateKey, error) { + suiteID := byteorder.BEAppendUint16([]byte("KEM"), kem.id) + dk, err := SHAKE256().labeledDerive(suiteID, ikm, "DeriveKeyPair", nil, 32) + if err != nil { + return nil, err + } + return kem.NewPrivateKey(dk) +} + +func (k *hybridPrivateKey) KEM() KEM { + return k.kem +} + +func (k *hybridPrivateKey) Bytes() ([]byte, error) { + if k.seed == nil { + return nil, errors.New("private key seed not available") + } + return k.seed, nil +} + +func (k *hybridPrivateKey) PublicKey() PublicKey { + return &hybridPublicKey{ + kem: k.kem, + t: k.t.PublicKey(), + pq: k.pq.Encapsulator(), + } +} + +func (k *hybridPrivateKey) decap(enc []byte) ([]byte, error) { + if len(enc) != k.kem.pqCiphertextSize+k.kem.curvePointSize { + return nil, errors.New("invalid encapsulated key size") + } + ctPQ, ctT := enc[:k.kem.pqCiphertextSize], enc[k.kem.pqCiphertextSize:] + ssPQ, err := k.pq.Decapsulate(ctPQ) + if err != nil { + return nil, err + } + var pub *ecdh.PublicKey + fips140.WithoutEnforcement(func() { // Hybrid of ML-KEM, which is Approved. + pub, err = k.t.Curve().NewPublicKey(ctT) + }) + if err != nil { + return nil, err + } + var ssT []byte + fips140.WithoutEnforcement(func() { + ssT, err = k.t.ECDH(pub) + }) + if err != nil { + return nil, err + } + ss := k.kem.sharedSecret(ssPQ, ssT, ctT, k.t.PublicKey().Bytes()) + return ss, nil +} + +var mlkem768 = &mlkemKEM{ + id: 0x0041, + ciphertextSize: mlkem.CiphertextSize768, + newPublicKey: func(data []byte) (crypto.Encapsulator, error) { + return mlkem.NewEncapsulationKey768(data) + }, + newPrivateKey: func(data []byte) (crypto.Decapsulator, error) { + return mlkem.NewDecapsulationKey768(data) + }, + generateKey: func() (crypto.Decapsulator, error) { + return mlkem.GenerateKey768() + }, +} + +// MLKEM768 returns a KEM implementing ML-KEM-768 from draft-ietf-hpke-pq. +func MLKEM768() KEM { + return mlkem768 +} + +var mlkem1024 = &mlkemKEM{ + id: 0x0042, + ciphertextSize: mlkem.CiphertextSize1024, + newPublicKey: func(data []byte) (crypto.Encapsulator, error) { + return mlkem.NewEncapsulationKey1024(data) + }, + newPrivateKey: func(data []byte) (crypto.Decapsulator, error) { + return mlkem.NewDecapsulationKey1024(data) + }, + generateKey: func() (crypto.Decapsulator, error) { + return mlkem.GenerateKey1024() + }, +} + +// MLKEM1024 returns a KEM implementing ML-KEM-1024 from draft-ietf-hpke-pq. +func MLKEM1024() KEM { + return mlkem1024 +} + +type mlkemKEM struct { + id uint16 + ciphertextSize int + newPublicKey func(data []byte) (crypto.Encapsulator, error) + newPrivateKey func(data []byte) (crypto.Decapsulator, error) + generateKey func() (crypto.Decapsulator, error) +} + +func (kem *mlkemKEM) ID() uint16 { + return kem.id +} + +func (kem *mlkemKEM) encSize() int { + return kem.ciphertextSize +} + +type mlkemPublicKey struct { + kem *mlkemKEM + pq crypto.Encapsulator +} + +// NewMLKEMPublicKey returns a KEMPublicKey implementing +// +// - ML-KEM-768 +// - ML-KEM-1024 +// +// from draft-ietf-hpke-pq, depending on the type of pub +// (*[mlkem.EncapsulationKey768] or *[mlkem.EncapsulationKey1024]). +// +// This function is meant for applications that already have an instantiated +// crypto/mlkem public key. Otherwise, applications should use the +// [KEM.NewPublicKey] method of e.g. [MLKEM768]. +func NewMLKEMPublicKey(pub crypto.Encapsulator) (PublicKey, error) { + switch pub.(type) { + case *mlkem.EncapsulationKey768: + return &mlkemPublicKey{mlkem768, pub}, nil + case *mlkem.EncapsulationKey1024: + return &mlkemPublicKey{mlkem1024, pub}, nil + default: + return nil, errors.New("unsupported public key type") + } +} + +func (kem *mlkemKEM) NewPublicKey(data []byte) (PublicKey, error) { + pq, err := kem.newPublicKey(data) + if err != nil { + return nil, err + } + return NewMLKEMPublicKey(pq) +} + +func (pk *mlkemPublicKey) KEM() KEM { + return pk.kem +} + +func (pk *mlkemPublicKey) Bytes() []byte { + return pk.pq.Bytes() +} + +func (pk *mlkemPublicKey) encap() (sharedSecret []byte, encapPub []byte, err error) { + ss, ct := pk.pq.Encapsulate() + if testingOnlyEncapsulate != nil { + ss, ct = testingOnlyEncapsulate() + } + return ss, ct, nil +} + +type mlkemPrivateKey struct { + kem *mlkemKEM + pq crypto.Decapsulator +} + +// NewMLKEMPrivateKey returns a KEMPrivateKey implementing +// +// - ML-KEM-768 +// - ML-KEM-1024 +// +// from draft-ietf-hpke-pq, depending on the type of priv.Encapsulator() +// (either *[mlkem.EncapsulationKey768] or *[mlkem.EncapsulationKey1024]). +// +// This function is meant for applications that already have an instantiated +// crypto/mlkem private key. Otherwise, applications should use the +// [KEM.NewPrivateKey] method of e.g. [MLKEM768]. +func NewMLKEMPrivateKey(priv crypto.Decapsulator) (PrivateKey, error) { + switch priv.Encapsulator().(type) { + case *mlkem.EncapsulationKey768: + return &mlkemPrivateKey{mlkem768, priv}, nil + case *mlkem.EncapsulationKey1024: + return &mlkemPrivateKey{mlkem1024, priv}, nil + default: + return nil, errors.New("unsupported public key type") + } +} + +func (kem *mlkemKEM) GenerateKey() (PrivateKey, error) { + pq, err := kem.generateKey() + if err != nil { + return nil, err + } + return NewMLKEMPrivateKey(pq) +} + +func (kem *mlkemKEM) NewPrivateKey(priv []byte) (PrivateKey, error) { + pq, err := kem.newPrivateKey(priv) + if err != nil { + return nil, err + } + return NewMLKEMPrivateKey(pq) +} + +func (kem *mlkemKEM) DeriveKeyPair(ikm []byte) (PrivateKey, error) { + suiteID := byteorder.BEAppendUint16([]byte("KEM"), kem.id) + dk, err := SHAKE256().labeledDerive(suiteID, ikm, "DeriveKeyPair", nil, 64) + if err != nil { + return nil, err + } + return kem.NewPrivateKey(dk) +} + +func (k *mlkemPrivateKey) KEM() KEM { + return k.kem +} + +func (k *mlkemPrivateKey) Bytes() ([]byte, error) { + pq, ok := k.pq.(interface { + Bytes() []byte + }) + if !ok { + return nil, errors.New("private key seed not available") + } + return pq.Bytes(), nil +} + +func (k *mlkemPrivateKey) PublicKey() PublicKey { + return &mlkemPublicKey{ + kem: k.kem, + pq: k.pq.Encapsulator(), + } +} + +func (k *mlkemPrivateKey) decap(enc []byte) ([]byte, error) { + return k.pq.Decapsulate(enc) +} diff --git a/go/src/crypto/md5/example_test.go b/go/src/crypto/md5/example_test.go new file mode 100644 index 0000000000000000000000000000000000000000..af8c1bfd65a8059dffd0549d9eaccefac5641771 --- /dev/null +++ b/go/src/crypto/md5/example_test.go @@ -0,0 +1,42 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package md5_test + +import ( + "crypto/md5" + "fmt" + "io" + "log" + "os" +) + +func ExampleNew() { + h := md5.New() + io.WriteString(h, "The fog is getting thicker!") + io.WriteString(h, "And Leon's getting laaarger!") + fmt.Printf("%x", h.Sum(nil)) + // Output: e2c569be17396eca2a2e3c11578123ed +} + +func ExampleSum() { + data := []byte("These pretzels are making me thirsty.") + fmt.Printf("%x", md5.Sum(data)) + // Output: b0804ec967f48520697662a204f5fe72 +} + +func ExampleNew_file() { + f, err := os.Open("file.txt") + if err != nil { + log.Fatal(err) + } + defer f.Close() + + h := md5.New() + if _, err := io.Copy(h, f); err != nil { + log.Fatal(err) + } + + fmt.Printf("%x", h.Sum(nil)) +} diff --git a/go/src/crypto/md5/gen.go b/go/src/crypto/md5/gen.go new file mode 100644 index 0000000000000000000000000000000000000000..cad9e9140557fb238fd82a7574292eaf956deb02 --- /dev/null +++ b/go/src/crypto/md5/gen.go @@ -0,0 +1,259 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build ignore + +// This program generates md5block.go +// Invoke as +// +// go run gen.go -output md5block.go + +package main + +import ( + "bytes" + "flag" + "go/format" + "log" + "os" + "strings" + "text/template" +) + +var filename = flag.String("output", "md5block.go", "output file name") + +func main() { + flag.Parse() + + var buf bytes.Buffer + + t := template.Must(template.New("main").Funcs(funcs).Parse(program)) + if err := t.Execute(&buf, data); err != nil { + log.Fatal(err) + } + + data, err := format.Source(buf.Bytes()) + if err != nil { + log.Fatal(err) + } + err = os.WriteFile(*filename, data, 0644) + if err != nil { + log.Fatal(err) + } +} + +type Data struct { + a, b, c, d string + Shift1 []int + Shift2 []int + Shift3 []int + Shift4 []int + Table1 []uint32 + Table2 []uint32 + Table3 []uint32 + Table4 []uint32 +} + +var funcs = template.FuncMap{ + "dup": dup, + "relabel": relabel, + "rotate": rotate, + "idx": idx, + "seq": seq, +} + +func dup(count int, x []int) []int { + var out []int + for i := 0; i < count; i++ { + out = append(out, x...) + } + return out +} + +func relabel(s string) string { + return strings.NewReplacer("arg0", data.a, "arg1", data.b, "arg2", data.c, "arg3", data.d).Replace(s) +} + +func rotate() string { + data.a, data.b, data.c, data.d = data.d, data.a, data.b, data.c + return "" // no output +} + +func idx(round, index int) int { + v := 0 + switch round { + case 1: + v = index + case 2: + v = (1 + 5*index) & 15 + case 3: + v = (5 + 3*index) & 15 + case 4: + v = (7 * index) & 15 + } + return v +} + +func seq(i int) []int { + s := make([]int, i) + for i := range s { + s[i] = i + } + return s +} + +var data = Data{ + a: "a", + b: "b", + c: "c", + d: "d", + Shift1: []int{7, 12, 17, 22}, + Shift2: []int{5, 9, 14, 20}, + Shift3: []int{4, 11, 16, 23}, + Shift4: []int{6, 10, 15, 21}, + + // table[i] = int((1<<32) * abs(sin(i+1 radians))). + Table1: []uint32{ + // round 1 + 0xd76aa478, + 0xe8c7b756, + 0x242070db, + 0xc1bdceee, + 0xf57c0faf, + 0x4787c62a, + 0xa8304613, + 0xfd469501, + 0x698098d8, + 0x8b44f7af, + 0xffff5bb1, + 0x895cd7be, + 0x6b901122, + 0xfd987193, + 0xa679438e, + 0x49b40821, + }, + Table2: []uint32{ + // round 2 + 0xf61e2562, + 0xc040b340, + 0x265e5a51, + 0xe9b6c7aa, + 0xd62f105d, + 0x2441453, + 0xd8a1e681, + 0xe7d3fbc8, + 0x21e1cde6, + 0xc33707d6, + 0xf4d50d87, + 0x455a14ed, + 0xa9e3e905, + 0xfcefa3f8, + 0x676f02d9, + 0x8d2a4c8a, + }, + Table3: []uint32{ + // round 3 + 0xfffa3942, + 0x8771f681, + 0x6d9d6122, + 0xfde5380c, + 0xa4beea44, + 0x4bdecfa9, + 0xf6bb4b60, + 0xbebfbc70, + 0x289b7ec6, + 0xeaa127fa, + 0xd4ef3085, + 0x4881d05, + 0xd9d4d039, + 0xe6db99e5, + 0x1fa27cf8, + 0xc4ac5665, + }, + Table4: []uint32{ + // round 4 + 0xf4292244, + 0x432aff97, + 0xab9423a7, + 0xfc93a039, + 0x655b59c3, + 0x8f0ccc92, + 0xffeff47d, + 0x85845dd1, + 0x6fa87e4f, + 0xfe2ce6e0, + 0xa3014314, + 0x4e0811a1, + 0xf7537e82, + 0xbd3af235, + 0x2ad7d2bb, + 0xeb86d391, + }, +} + +var program = `// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code generated by go run gen.go -output md5block.go; DO NOT EDIT. + +package md5 + +import ( + "internal/byteorder" + "math/bits" +) + +func blockGeneric(dig *digest, p []byte) { + // load state + a, b, c, d := dig.s[0], dig.s[1], dig.s[2], dig.s[3] + + for i := 0; i <= len(p)-BlockSize; i += BlockSize { + // eliminate bounds checks on p + q := p[i:] + q = q[:BlockSize:BlockSize] + + // save current state + aa, bb, cc, dd := a, b, c, d + + // load input block + {{range $i := seq 16 -}} + {{printf "x%x := byteorder.LEUint32(q[4*%#x:])" $i $i}} + {{end}} + + // round 1 + {{range $i, $s := dup 4 .Shift1 -}} + {{printf "arg0 = arg1 + bits.RotateLeft32((((arg2^arg3)&arg1)^arg3)+arg0+x%x+%#08x, %d)" (idx 1 $i) (index $.Table1 $i) $s | relabel}} + {{rotate -}} + {{end}} + + // round 2 + {{range $i, $s := dup 4 .Shift2 -}} + {{printf "arg0 = arg1 + bits.RotateLeft32((((arg1^arg2)&arg3)^arg2)+arg0+x%x+%#08x, %d)" (idx 2 $i) (index $.Table2 $i) $s | relabel}} + {{rotate -}} + {{end}} + + // round 3 + {{range $i, $s := dup 4 .Shift3 -}} + {{printf "arg0 = arg1 + bits.RotateLeft32((arg1^arg2^arg3)+arg0+x%x+%#08x, %d)" (idx 3 $i) (index $.Table3 $i) $s | relabel}} + {{rotate -}} + {{end}} + + // round 4 + {{range $i, $s := dup 4 .Shift4 -}} + {{printf "arg0 = arg1 + bits.RotateLeft32((arg2^(arg1|^arg3))+arg0+x%x+%#08x, %d)" (idx 4 $i) (index $.Table4 $i) $s | relabel}} + {{rotate -}} + {{end}} + + // add saved state + a += aa + b += bb + c += cc + d += dd + } + + // save state + dig.s[0], dig.s[1], dig.s[2], dig.s[3] = a, b, c, d +} +` diff --git a/go/src/crypto/md5/md5.go b/go/src/crypto/md5/md5.go new file mode 100644 index 0000000000000000000000000000000000000000..f1287887ff5e250bd9980f146d436e1384e181a4 --- /dev/null +++ b/go/src/crypto/md5/md5.go @@ -0,0 +1,210 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:generate go run gen.go -output md5block.go + +// Package md5 implements the MD5 hash algorithm as defined in RFC 1321. +// +// MD5 is cryptographically broken and should not be used for secure +// applications. +package md5 + +import ( + "crypto" + "crypto/internal/fips140only" + "errors" + "hash" + "internal/byteorder" +) + +func init() { + crypto.RegisterHash(crypto.MD5, New) +} + +// The size of an MD5 checksum in bytes. +const Size = 16 + +// The blocksize of MD5 in bytes. +const BlockSize = 64 + +// The maximum number of bytes that can be passed to block(). The limit exists +// because implementations that rely on assembly routines are not preemptible. +const maxAsmIters = 1024 +const maxAsmSize = BlockSize * maxAsmIters // 64KiB + +const ( + init0 = 0x67452301 + init1 = 0xEFCDAB89 + init2 = 0x98BADCFE + init3 = 0x10325476 +) + +// digest represents the partial evaluation of a checksum. +type digest struct { + s [4]uint32 + x [BlockSize]byte + nx int + len uint64 +} + +func (d *digest) Reset() { + d.s[0] = init0 + d.s[1] = init1 + d.s[2] = init2 + d.s[3] = init3 + d.nx = 0 + d.len = 0 +} + +const ( + magic = "md5\x01" + marshaledSize = len(magic) + 4*4 + BlockSize + 8 +) + +func (d *digest) MarshalBinary() ([]byte, error) { + return d.AppendBinary(make([]byte, 0, marshaledSize)) +} + +func (d *digest) AppendBinary(b []byte) ([]byte, error) { + b = append(b, magic...) + b = byteorder.BEAppendUint32(b, d.s[0]) + b = byteorder.BEAppendUint32(b, d.s[1]) + b = byteorder.BEAppendUint32(b, d.s[2]) + b = byteorder.BEAppendUint32(b, d.s[3]) + b = append(b, d.x[:d.nx]...) + b = append(b, make([]byte, len(d.x)-d.nx)...) + b = byteorder.BEAppendUint64(b, d.len) + return b, nil +} + +func (d *digest) UnmarshalBinary(b []byte) error { + if len(b) < len(magic) || string(b[:len(magic)]) != magic { + return errors.New("crypto/md5: invalid hash state identifier") + } + if len(b) != marshaledSize { + return errors.New("crypto/md5: invalid hash state size") + } + b = b[len(magic):] + b, d.s[0] = consumeUint32(b) + b, d.s[1] = consumeUint32(b) + b, d.s[2] = consumeUint32(b) + b, d.s[3] = consumeUint32(b) + b = b[copy(d.x[:], b):] + b, d.len = consumeUint64(b) + d.nx = int(d.len % BlockSize) + return nil +} + +func consumeUint64(b []byte) ([]byte, uint64) { + return b[8:], byteorder.BEUint64(b[0:8]) +} + +func consumeUint32(b []byte) ([]byte, uint32) { + return b[4:], byteorder.BEUint32(b[0:4]) +} + +func (d *digest) Clone() (hash.Cloner, error) { + r := *d + return &r, nil +} + +// New returns a new [hash.Hash] computing the MD5 checksum. The Hash +// also implements [encoding.BinaryMarshaler], [encoding.BinaryAppender] and +// [encoding.BinaryUnmarshaler] to marshal and unmarshal the internal +// state of the hash. +func New() hash.Hash { + d := new(digest) + d.Reset() + return d +} + +func (d *digest) Size() int { return Size } + +func (d *digest) BlockSize() int { return BlockSize } + +func (d *digest) Write(p []byte) (nn int, err error) { + if fips140only.Enforced() { + return 0, errors.New("crypto/md5: use of MD5 is not allowed in FIPS 140-only mode") + } + // Note that we currently call block or blockGeneric + // directly (guarded using haveAsm) because this allows + // escape analysis to see that p and d don't escape. + nn = len(p) + d.len += uint64(nn) + if d.nx > 0 { + n := copy(d.x[d.nx:], p) + d.nx += n + if d.nx == BlockSize { + if haveAsm { + block(d, d.x[:]) + } else { + blockGeneric(d, d.x[:]) + } + d.nx = 0 + } + p = p[n:] + } + if len(p) >= BlockSize { + n := len(p) &^ (BlockSize - 1) + if haveAsm { + for n > maxAsmSize { + block(d, p[:maxAsmSize]) + p = p[maxAsmSize:] + n -= maxAsmSize + } + block(d, p[:n]) + } else { + blockGeneric(d, p[:n]) + } + p = p[n:] + } + if len(p) > 0 { + d.nx = copy(d.x[:], p) + } + return +} + +func (d *digest) Sum(in []byte) []byte { + // Make a copy of d so that caller can keep writing and summing. + d0 := *d + hash := d0.checkSum() + return append(in, hash[:]...) +} + +func (d *digest) checkSum() [Size]byte { + if fips140only.Enforced() { + panic("crypto/md5: use of MD5 is not allowed in FIPS 140-only mode") + } + + // Append 0x80 to the end of the message and then append zeros + // until the length is a multiple of 56 bytes. Finally append + // 8 bytes representing the message length in bits. + // + // 1 byte end marker :: 0-63 padding bytes :: 8 byte length + tmp := [1 + 63 + 8]byte{0x80} + pad := (55 - d.len) % 64 // calculate number of padding bytes + byteorder.LEPutUint64(tmp[1+pad:], d.len<<3) // append length in bits + d.Write(tmp[:1+pad+8]) + + // The previous write ensures that a whole number of + // blocks (i.e. a multiple of 64 bytes) have been hashed. + if d.nx != 0 { + panic("d.nx != 0") + } + + var digest [Size]byte + byteorder.LEPutUint32(digest[0:], d.s[0]) + byteorder.LEPutUint32(digest[4:], d.s[1]) + byteorder.LEPutUint32(digest[8:], d.s[2]) + byteorder.LEPutUint32(digest[12:], d.s[3]) + return digest +} + +// Sum returns the MD5 checksum of the data. +func Sum(data []byte) [Size]byte { + var d digest + d.Reset() + d.Write(data) + return d.checkSum() +} diff --git a/go/src/crypto/md5/md5_test.go b/go/src/crypto/md5/md5_test.go new file mode 100644 index 0000000000000000000000000000000000000000..403ff2881f4b685b966f7660dc5ccfc9fb4580e4 --- /dev/null +++ b/go/src/crypto/md5/md5_test.go @@ -0,0 +1,350 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package md5 + +import ( + "bytes" + "crypto/internal/cryptotest" + "crypto/rand" + "encoding" + "fmt" + "hash" + "io" + "testing" + "unsafe" +) + +type md5Test struct { + out string + in string + halfState string // marshaled hash state after first half of in written, used by TestGoldenMarshal +} + +var golden = []md5Test{ + {"d41d8cd98f00b204e9800998ecf8427e", "", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102Tv\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"}, + {"0cc175b9c0f1b6a831c399e269772661", "a", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102Tv\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"}, + {"187ef4436122d1cc2f40dc2b92f0eba0", "ab", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102Tva\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01"}, + {"900150983cd24fb0d6963f7d28e17f72", "abc", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102Tva\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01"}, + {"e2fc714c4727ee9395f324cd2e7f331f", "abcd", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102Tvab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02"}, + {"ab56b4d92b40713acc5af89985d4b786", "abcde", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102Tvab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02"}, + {"e80b5017098950fc58aad83c8c14978e", "abcdef", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102Tvabc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03"}, + {"7ac66c0f148de9519b8bd264312c4d64", "abcdefg", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102Tvabc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03"}, + {"e8dc4081b13434b45189a720b77b6818", "abcdefgh", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102Tvabcd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04"}, + {"8aa99b1f439ff71293e95357bac6fd94", "abcdefghi", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102Tvabcd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04"}, + {"a925576942e94b2ef57a066101b48876", "abcdefghij", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102Tvabcde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05"}, + {"d747fc1719c7eacb84058196cfe56d57", "Discard medicine more than two years old.", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102TvDiscard medicine mor\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x14"}, + {"bff2dcb37ef3a44ba43ab144768ca837", "He who has a shady past knows that nice guys finish last.", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102TvHe who has a shady past know\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c"}, + {"0441015ecb54a7342d017ed1bcfdbea5", "I wouldn't marry him with a ten foot pole.", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102TvI wouldn't marry him \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15"}, + {"9e3cac8e9e9757a60c3ea391130d3689", "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102TvFree! Free!/A trip/to Mars/f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c"}, + {"a0f04459b031f916a59a35cc482dc039", "The days of the digital watch are numbered. -Tom Stoppard", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102TvThe days of the digital watch\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1d"}, + {"e7a48e0fe884faf31475d2a04b1362cc", "Nepal premier won't resign.", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102TvNepal premier\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\r"}, + {"637d2fe925c07c113800509964fb0e06", "For every action there is an equal and opposite government program.", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102TvFor every action there is an equa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00!"}, + {"834a8d18d5c6562119cf4c7f5086cb71", "His money is twice tainted: 'taint yours and 'taint mine.", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102TvHis money is twice tainted: \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c"}, + {"de3a4d2fd6c73ec2db2abad23b444281", "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102TvThere is no reason for any individual to hav\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00,"}, + {"acf203f997e2cf74ea3aff86985aefaf", "It's a tiny change to the code and not completely disgusting. - Bob Manchek", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102TvIt's a tiny change to the code and no\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00%"}, + {"e1c1384cb4d2221dfdd7c795a4222c9a", "size: a.out: bad magic", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102Tvsize: a.out\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\f"}, + {"c90f3ddecc54f34228c063d7525bf644", "The major problem is with sendmail. -Mark Horton", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102TvThe major problem is wit\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18"}, + {"cdf7ab6c1fd49bd9933c43f3ea5af185", "Give me a rock, paper and scissors and I will move the world. CCFestoon", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102TvGive me a rock, paper and scissors a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00$"}, + {"83bc85234942fc883c063cbd7f0ad5d0", "If the enemy is within range, then so are you.", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102TvIf the enemy is within \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17"}, + {"277cbe255686b48dd7e8f389394d9299", "It's well we cannot hear the screams/That we create in others' dreams.", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102TvIt's well we cannot hear the scream\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00#"}, + {"fd3fb0a7ffb8af16603f3d3af98f8e1f", "You remind me of a TV show, but that's all right: I watch it anyway.", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102TvYou remind me of a TV show, but th\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\""}, + {"469b13a78ebf297ecda64d4723655154", "C is as portable as Stonehedge!!", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102TvC is as portable\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10"}, + {"63eb3a2f466410104731c4b037600110", "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102TvEven if I could be Shakespeare, I think I sh\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00,"}, + {"72c2ed7592debca1c90fc0100f931a2f", "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction. Lewis-Randall Rule", "md5\x01\xa7\xc9\x18\x9b\xc3E\x18\xf2\x82\xfd\xf3$\x9d_\v\nem\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00B"}, + {"132f7619d33b523b1d9e5bd8e0928355", "How can you write a big system without C++? -Paul Glick", "md5\x01gE#\x01\xefͫ\x89\x98\xba\xdc\xfe\x102TvHow can you write a big syst\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c"}, +} + +func TestGolden(t *testing.T) { + for i := 0; i < len(golden); i++ { + g := golden[i] + s := fmt.Sprintf("%x", Sum([]byte(g.in))) + if s != g.out { + t.Fatalf("Sum function: md5(%s) = %s want %s", g.in, s, g.out) + } + c := New() + buf := make([]byte, len(g.in)+4) + for j := 0; j < 3+4; j++ { + if j < 2 { + io.WriteString(c, g.in) + } else if j == 2 { + io.WriteString(c, g.in[:len(g.in)/2]) + c.Sum(nil) + io.WriteString(c, g.in[len(g.in)/2:]) + } else if j > 2 { + // test unaligned write + buf = buf[1:] + copy(buf, g.in) + c.Write(buf[:len(g.in)]) + } + s := fmt.Sprintf("%x", c.Sum(nil)) + if s != g.out { + t.Fatalf("md5[%d](%s) = %s want %s", j, g.in, s, g.out) + } + c.Reset() + } + } +} + +func TestGoldenMarshal(t *testing.T) { + for _, g := range golden { + h := New() + h2 := New() + + io.WriteString(h, g.in[:len(g.in)/2]) + + state, err := h.(encoding.BinaryMarshaler).MarshalBinary() + if err != nil { + t.Errorf("could not marshal: %v", err) + continue + } + + stateAppend, err := h.(encoding.BinaryAppender).AppendBinary(make([]byte, 4, 32)) + if err != nil { + t.Errorf("could not marshal: %v", err) + continue + } + stateAppend = stateAppend[4:] + + if string(state) != g.halfState { + t.Errorf("md5(%q) state = %q, want %q", g.in, state, g.halfState) + continue + } + + if string(stateAppend) != g.halfState { + t.Errorf("md5(%q) stateAppend = %q, want %q", g.in, stateAppend, g.halfState) + continue + } + + if err := h2.(encoding.BinaryUnmarshaler).UnmarshalBinary(state); err != nil { + t.Errorf("could not unmarshal: %v", err) + continue + } + + io.WriteString(h, g.in[len(g.in)/2:]) + io.WriteString(h2, g.in[len(g.in)/2:]) + + if actual, actual2 := h.Sum(nil), h2.Sum(nil); !bytes.Equal(actual, actual2) { + t.Errorf("md5(%q) = 0x%x != marshaled 0x%x", g.in, actual, actual2) + } + } +} + +func TestLarge(t *testing.T) { + const N = 10000 + const offsets = 4 + ok := "2bb571599a4180e1d542f76904adc3df" // md5sum of "0123456789" * 1000 + block := make([]byte, N+offsets) + c := New() + for offset := 0; offset < offsets; offset++ { + for i := 0; i < N; i++ { + block[offset+i] = '0' + byte(i%10) + } + for blockSize := 10; blockSize <= N; blockSize *= 10 { + blocks := N / blockSize + b := block[offset : offset+blockSize] + c.Reset() + for i := 0; i < blocks; i++ { + c.Write(b) + } + s := fmt.Sprintf("%x", c.Sum(nil)) + if s != ok { + t.Fatalf("md5 TestLarge offset=%d, blockSize=%d = %s want %s", offset, blockSize, s, ok) + } + } + } +} + +func TestExtraLarge(t *testing.T) { + const N = 100000 + const offsets = 4 + ok := "13572e9e296cff52b79c52148313c3a5" // md5sum of "0123456789" * 10000 + block := make([]byte, N+offsets) + c := New() + for offset := 0; offset < offsets; offset++ { + for i := 0; i < N; i++ { + block[offset+i] = '0' + byte(i%10) + } + for blockSize := 10; blockSize <= N; blockSize *= 10 { + blocks := N / blockSize + b := block[offset : offset+blockSize] + c.Reset() + for i := 0; i < blocks; i++ { + c.Write(b) + } + s := fmt.Sprintf("%x", c.Sum(nil)) + if s != ok { + t.Fatalf("md5 TestExtraLarge offset=%d, blockSize=%d = %s want %s", offset, blockSize, s, ok) + } + } + } +} + +// Tests that blockGeneric (pure Go) and block (in assembly for amd64, 386, arm) match. +func TestBlockGeneric(t *testing.T) { + gen, asm := New().(*digest), New().(*digest) + buf := make([]byte, BlockSize*20) // arbitrary factor + rand.Read(buf) + blockGeneric(gen, buf) + block(asm, buf) + if *gen != *asm { + t.Error("block and blockGeneric resulted in different states") + } +} + +// Tests for unmarshaling hashes that have hashed a large amount of data +// The initial hash generation is omitted from the test, because it takes a long time. +// The test contains some already-generated states, and their expected sums +// Tests a problem that is outlined in GitHub issue #29541 +// The problem is triggered when an amount of data has been hashed for which +// the data length has a 1 in the 32nd bit. When casted to int, this changes +// the sign of the value, and causes the modulus operation to return a +// different result. +type unmarshalTest struct { + state string + sum string +} + +var largeUnmarshalTests = []unmarshalTest{ + // Data length: 7_102_415_735 + { + state: "md5\x01\xa5\xf7\xf0=\xd6S\x85\xd9M\n}\xc3\u0601\x89\xe7@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuv\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xa7VCw", + sum: "cddefcf74ffec709a0b45a6a987564d5", + }, + // Data length: 6_565_544_823 + { + state: "md5\x01{\xda\x1a\xc7\xc9'?\x83EX\xe0\x88q\xfeG\x18@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuv\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x87VCw", + sum: "fd9f41874ab240698e7bc9c3ae70c8e4", + }, +} + +func safeSum(h hash.Hash) (sum []byte, err error) { + defer func() { + if r := recover(); r != nil { + err = fmt.Errorf("sum panic: %v", r) + } + }() + + return h.Sum(nil), nil +} + +func TestLargeHashes(t *testing.T) { + for i, test := range largeUnmarshalTests { + + h := New() + if err := h.(encoding.BinaryUnmarshaler).UnmarshalBinary([]byte(test.state)); err != nil { + t.Errorf("test %d could not unmarshal: %v", i, err) + continue + } + + sum, err := safeSum(h) + if err != nil { + t.Errorf("test %d could not sum: %v", i, err) + continue + } + + if fmt.Sprintf("%x", sum) != test.sum { + t.Errorf("test %d sum mismatch: expect %s got %x", i, test.sum, sum) + } + } +} + +func TestAllocations(t *testing.T) { + cryptotest.SkipTestAllocations(t) + in := []byte("hello, world!") + out := make([]byte, 0, Size) + h := New() + n := int(testing.AllocsPerRun(10, func() { + h.Reset() + h.Write(in) + out = h.Sum(out[:0]) + })) + if n > 0 { + t.Errorf("allocs = %d, want 0", n) + } +} + +func TestMD5Hash(t *testing.T) { + cryptotest.TestHash(t, New) +} + +func TestExtraMethods(t *testing.T) { + h := maybeCloner(New()) + cryptotest.NoExtraMethods(t, &h, "MarshalBinary", "UnmarshalBinary", "AppendBinary") +} + +func maybeCloner(h hash.Hash) any { + if c, ok := h.(hash.Cloner); ok { + return &c + } + return &h +} + +var bench = New() +var buf = make([]byte, 1024*1024*8+1) +var sum = make([]byte, bench.Size()) + +func benchmarkSize(b *testing.B, size int, unaligned bool) { + b.SetBytes(int64(size)) + buf := buf + if unaligned { + if uintptr(unsafe.Pointer(&buf[0]))&(unsafe.Alignof(uint32(0))-1) == 0 { + buf = buf[1:] + } + } + b.ResetTimer() + for i := 0; i < b.N; i++ { + bench.Reset() + bench.Write(buf[:size]) + bench.Sum(sum[:0]) + } +} + +func BenchmarkHash8Bytes(b *testing.B) { + benchmarkSize(b, 8, false) +} + +func BenchmarkHash64(b *testing.B) { + benchmarkSize(b, 64, false) +} + +func BenchmarkHash128(b *testing.B) { + benchmarkSize(b, 128, false) +} + +func BenchmarkHash256(b *testing.B) { + benchmarkSize(b, 256, false) +} + +func BenchmarkHash512(b *testing.B) { + benchmarkSize(b, 512, false) +} + +func BenchmarkHash1K(b *testing.B) { + benchmarkSize(b, 1024, false) +} + +func BenchmarkHash8K(b *testing.B) { + benchmarkSize(b, 8192, false) +} + +func BenchmarkHash1M(b *testing.B) { + benchmarkSize(b, 1024*1024, false) +} + +func BenchmarkHash8M(b *testing.B) { + benchmarkSize(b, 8*1024*1024, false) +} + +func BenchmarkHash8BytesUnaligned(b *testing.B) { + benchmarkSize(b, 8, true) +} + +func BenchmarkHash1KUnaligned(b *testing.B) { + benchmarkSize(b, 1024, true) +} + +func BenchmarkHash8KUnaligned(b *testing.B) { + benchmarkSize(b, 8192, true) +} diff --git a/go/src/crypto/md5/md5block.go b/go/src/crypto/md5/md5block.go new file mode 100644 index 0000000000000000000000000000000000000000..16e833cc5056aca63ec6eae689adb70aa6e76c59 --- /dev/null +++ b/go/src/crypto/md5/md5block.go @@ -0,0 +1,125 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code generated by go run gen.go -output md5block.go; DO NOT EDIT. + +package md5 + +import ( + "internal/byteorder" + "math/bits" +) + +func blockGeneric(dig *digest, p []byte) { + // load state + a, b, c, d := dig.s[0], dig.s[1], dig.s[2], dig.s[3] + + for i := 0; i <= len(p)-BlockSize; i += BlockSize { + // eliminate bounds checks on p + q := p[i:] + q = q[:BlockSize:BlockSize] + + // save current state + aa, bb, cc, dd := a, b, c, d + + // load input block + x0 := byteorder.LEUint32(q[4*0x0:]) + x1 := byteorder.LEUint32(q[4*0x1:]) + x2 := byteorder.LEUint32(q[4*0x2:]) + x3 := byteorder.LEUint32(q[4*0x3:]) + x4 := byteorder.LEUint32(q[4*0x4:]) + x5 := byteorder.LEUint32(q[4*0x5:]) + x6 := byteorder.LEUint32(q[4*0x6:]) + x7 := byteorder.LEUint32(q[4*0x7:]) + x8 := byteorder.LEUint32(q[4*0x8:]) + x9 := byteorder.LEUint32(q[4*0x9:]) + xa := byteorder.LEUint32(q[4*0xa:]) + xb := byteorder.LEUint32(q[4*0xb:]) + xc := byteorder.LEUint32(q[4*0xc:]) + xd := byteorder.LEUint32(q[4*0xd:]) + xe := byteorder.LEUint32(q[4*0xe:]) + xf := byteorder.LEUint32(q[4*0xf:]) + + // round 1 + a = b + bits.RotateLeft32((((c^d)&b)^d)+a+x0+0xd76aa478, 7) + d = a + bits.RotateLeft32((((b^c)&a)^c)+d+x1+0xe8c7b756, 12) + c = d + bits.RotateLeft32((((a^b)&d)^b)+c+x2+0x242070db, 17) + b = c + bits.RotateLeft32((((d^a)&c)^a)+b+x3+0xc1bdceee, 22) + a = b + bits.RotateLeft32((((c^d)&b)^d)+a+x4+0xf57c0faf, 7) + d = a + bits.RotateLeft32((((b^c)&a)^c)+d+x5+0x4787c62a, 12) + c = d + bits.RotateLeft32((((a^b)&d)^b)+c+x6+0xa8304613, 17) + b = c + bits.RotateLeft32((((d^a)&c)^a)+b+x7+0xfd469501, 22) + a = b + bits.RotateLeft32((((c^d)&b)^d)+a+x8+0x698098d8, 7) + d = a + bits.RotateLeft32((((b^c)&a)^c)+d+x9+0x8b44f7af, 12) + c = d + bits.RotateLeft32((((a^b)&d)^b)+c+xa+0xffff5bb1, 17) + b = c + bits.RotateLeft32((((d^a)&c)^a)+b+xb+0x895cd7be, 22) + a = b + bits.RotateLeft32((((c^d)&b)^d)+a+xc+0x6b901122, 7) + d = a + bits.RotateLeft32((((b^c)&a)^c)+d+xd+0xfd987193, 12) + c = d + bits.RotateLeft32((((a^b)&d)^b)+c+xe+0xa679438e, 17) + b = c + bits.RotateLeft32((((d^a)&c)^a)+b+xf+0x49b40821, 22) + + // round 2 + a = b + bits.RotateLeft32((((b^c)&d)^c)+a+x1+0xf61e2562, 5) + d = a + bits.RotateLeft32((((a^b)&c)^b)+d+x6+0xc040b340, 9) + c = d + bits.RotateLeft32((((d^a)&b)^a)+c+xb+0x265e5a51, 14) + b = c + bits.RotateLeft32((((c^d)&a)^d)+b+x0+0xe9b6c7aa, 20) + a = b + bits.RotateLeft32((((b^c)&d)^c)+a+x5+0xd62f105d, 5) + d = a + bits.RotateLeft32((((a^b)&c)^b)+d+xa+0x02441453, 9) + c = d + bits.RotateLeft32((((d^a)&b)^a)+c+xf+0xd8a1e681, 14) + b = c + bits.RotateLeft32((((c^d)&a)^d)+b+x4+0xe7d3fbc8, 20) + a = b + bits.RotateLeft32((((b^c)&d)^c)+a+x9+0x21e1cde6, 5) + d = a + bits.RotateLeft32((((a^b)&c)^b)+d+xe+0xc33707d6, 9) + c = d + bits.RotateLeft32((((d^a)&b)^a)+c+x3+0xf4d50d87, 14) + b = c + bits.RotateLeft32((((c^d)&a)^d)+b+x8+0x455a14ed, 20) + a = b + bits.RotateLeft32((((b^c)&d)^c)+a+xd+0xa9e3e905, 5) + d = a + bits.RotateLeft32((((a^b)&c)^b)+d+x2+0xfcefa3f8, 9) + c = d + bits.RotateLeft32((((d^a)&b)^a)+c+x7+0x676f02d9, 14) + b = c + bits.RotateLeft32((((c^d)&a)^d)+b+xc+0x8d2a4c8a, 20) + + // round 3 + a = b + bits.RotateLeft32((b^c^d)+a+x5+0xfffa3942, 4) + d = a + bits.RotateLeft32((a^b^c)+d+x8+0x8771f681, 11) + c = d + bits.RotateLeft32((d^a^b)+c+xb+0x6d9d6122, 16) + b = c + bits.RotateLeft32((c^d^a)+b+xe+0xfde5380c, 23) + a = b + bits.RotateLeft32((b^c^d)+a+x1+0xa4beea44, 4) + d = a + bits.RotateLeft32((a^b^c)+d+x4+0x4bdecfa9, 11) + c = d + bits.RotateLeft32((d^a^b)+c+x7+0xf6bb4b60, 16) + b = c + bits.RotateLeft32((c^d^a)+b+xa+0xbebfbc70, 23) + a = b + bits.RotateLeft32((b^c^d)+a+xd+0x289b7ec6, 4) + d = a + bits.RotateLeft32((a^b^c)+d+x0+0xeaa127fa, 11) + c = d + bits.RotateLeft32((d^a^b)+c+x3+0xd4ef3085, 16) + b = c + bits.RotateLeft32((c^d^a)+b+x6+0x04881d05, 23) + a = b + bits.RotateLeft32((b^c^d)+a+x9+0xd9d4d039, 4) + d = a + bits.RotateLeft32((a^b^c)+d+xc+0xe6db99e5, 11) + c = d + bits.RotateLeft32((d^a^b)+c+xf+0x1fa27cf8, 16) + b = c + bits.RotateLeft32((c^d^a)+b+x2+0xc4ac5665, 23) + + // round 4 + a = b + bits.RotateLeft32((c^(b|^d))+a+x0+0xf4292244, 6) + d = a + bits.RotateLeft32((b^(a|^c))+d+x7+0x432aff97, 10) + c = d + bits.RotateLeft32((a^(d|^b))+c+xe+0xab9423a7, 15) + b = c + bits.RotateLeft32((d^(c|^a))+b+x5+0xfc93a039, 21) + a = b + bits.RotateLeft32((c^(b|^d))+a+xc+0x655b59c3, 6) + d = a + bits.RotateLeft32((b^(a|^c))+d+x3+0x8f0ccc92, 10) + c = d + bits.RotateLeft32((a^(d|^b))+c+xa+0xffeff47d, 15) + b = c + bits.RotateLeft32((d^(c|^a))+b+x1+0x85845dd1, 21) + a = b + bits.RotateLeft32((c^(b|^d))+a+x8+0x6fa87e4f, 6) + d = a + bits.RotateLeft32((b^(a|^c))+d+xf+0xfe2ce6e0, 10) + c = d + bits.RotateLeft32((a^(d|^b))+c+x6+0xa3014314, 15) + b = c + bits.RotateLeft32((d^(c|^a))+b+xd+0x4e0811a1, 21) + a = b + bits.RotateLeft32((c^(b|^d))+a+x4+0xf7537e82, 6) + d = a + bits.RotateLeft32((b^(a|^c))+d+xb+0xbd3af235, 10) + c = d + bits.RotateLeft32((a^(d|^b))+c+x2+0x2ad7d2bb, 15) + b = c + bits.RotateLeft32((d^(c|^a))+b+x9+0xeb86d391, 21) + + // add saved state + a += aa + b += bb + c += cc + d += dd + } + + // save state + dig.s[0], dig.s[1], dig.s[2], dig.s[3] = a, b, c, d +} diff --git a/go/src/crypto/md5/md5block_386.s b/go/src/crypto/md5/md5block_386.s new file mode 100644 index 0000000000000000000000000000000000000000..b6c6509d3b529c6a11f0820193518bcd4919d4ad --- /dev/null +++ b/go/src/crypto/md5/md5block_386.s @@ -0,0 +1,184 @@ +// Original source: +// http://www.zorinaq.com/papers/md5-amd64.html +// http://www.zorinaq.com/papers/md5-amd64.tar.bz2 +// +// Translated from Perl generating GNU assembly into +// #defines generating 8a assembly, and adjusted for 386, +// by the Go Authors. + +//go:build !purego + +#include "textflag.h" + +// MD5 optimized for AMD64. +// +// Author: Marc Bevand +// Licence: I hereby disclaim the copyright on this code and place it +// in the public domain. + +#define ROUND1(a, b, c, d, index, const, shift) \ + XORL c, BP; \ + LEAL const(a)(DI*1), a; \ + ANDL b, BP; \ + XORL d, BP; \ + MOVL (index*4)(SI), DI; \ + ADDL BP, a; \ + ROLL $shift, a; \ + MOVL c, BP; \ + ADDL b, a + +#define ROUND2(a, b, c, d, index, const, shift) \ + LEAL const(a)(DI*1),a; \ + MOVL d, DI; \ + ANDL b, DI; \ + MOVL d, BP; \ + NOTL BP; \ + ANDL c, BP; \ + ORL DI, BP; \ + MOVL (index*4)(SI),DI; \ + ADDL BP, a; \ + ROLL $shift, a; \ + ADDL b, a + +#define ROUND3(a, b, c, d, index, const, shift) \ + LEAL const(a)(DI*1),a; \ + MOVL (index*4)(SI),DI; \ + XORL d, BP; \ + XORL b, BP; \ + ADDL BP, a; \ + ROLL $shift, a; \ + MOVL b, BP; \ + ADDL b, a + +#define ROUND4(a, b, c, d, index, const, shift) \ + LEAL const(a)(DI*1),a; \ + ORL b, BP; \ + XORL c, BP; \ + ADDL BP, a; \ + MOVL (index*4)(SI),DI; \ + MOVL $0xffffffff, BP; \ + ROLL $shift, a; \ + XORL c, BP; \ + ADDL b, a + +TEXT ·block(SB),NOSPLIT,$24-16 + MOVL dig+0(FP), BP + MOVL p+4(FP), SI + MOVL p_len+8(FP), DX + SHRL $6, DX + SHLL $6, DX + + LEAL (SI)(DX*1), DI + MOVL (0*4)(BP), AX + MOVL (1*4)(BP), BX + MOVL (2*4)(BP), CX + MOVL (3*4)(BP), DX + + CMPL SI, DI + JEQ end + + MOVL DI, 16(SP) + +loop: + MOVL AX, 0(SP) + MOVL BX, 4(SP) + MOVL CX, 8(SP) + MOVL DX, 12(SP) + + MOVL (0*4)(SI), DI + MOVL DX, BP + + ROUND1(AX,BX,CX,DX, 1,0xd76aa478, 7); + ROUND1(DX,AX,BX,CX, 2,0xe8c7b756,12); + ROUND1(CX,DX,AX,BX, 3,0x242070db,17); + ROUND1(BX,CX,DX,AX, 4,0xc1bdceee,22); + ROUND1(AX,BX,CX,DX, 5,0xf57c0faf, 7); + ROUND1(DX,AX,BX,CX, 6,0x4787c62a,12); + ROUND1(CX,DX,AX,BX, 7,0xa8304613,17); + ROUND1(BX,CX,DX,AX, 8,0xfd469501,22); + ROUND1(AX,BX,CX,DX, 9,0x698098d8, 7); + ROUND1(DX,AX,BX,CX,10,0x8b44f7af,12); + ROUND1(CX,DX,AX,BX,11,0xffff5bb1,17); + ROUND1(BX,CX,DX,AX,12,0x895cd7be,22); + ROUND1(AX,BX,CX,DX,13,0x6b901122, 7); + ROUND1(DX,AX,BX,CX,14,0xfd987193,12); + ROUND1(CX,DX,AX,BX,15,0xa679438e,17); + ROUND1(BX,CX,DX,AX, 0,0x49b40821,22); + + MOVL (1*4)(SI), DI + MOVL DX, BP + + ROUND2(AX,BX,CX,DX, 6,0xf61e2562, 5); + ROUND2(DX,AX,BX,CX,11,0xc040b340, 9); + ROUND2(CX,DX,AX,BX, 0,0x265e5a51,14); + ROUND2(BX,CX,DX,AX, 5,0xe9b6c7aa,20); + ROUND2(AX,BX,CX,DX,10,0xd62f105d, 5); + ROUND2(DX,AX,BX,CX,15, 0x2441453, 9); + ROUND2(CX,DX,AX,BX, 4,0xd8a1e681,14); + ROUND2(BX,CX,DX,AX, 9,0xe7d3fbc8,20); + ROUND2(AX,BX,CX,DX,14,0x21e1cde6, 5); + ROUND2(DX,AX,BX,CX, 3,0xc33707d6, 9); + ROUND2(CX,DX,AX,BX, 8,0xf4d50d87,14); + ROUND2(BX,CX,DX,AX,13,0x455a14ed,20); + ROUND2(AX,BX,CX,DX, 2,0xa9e3e905, 5); + ROUND2(DX,AX,BX,CX, 7,0xfcefa3f8, 9); + ROUND2(CX,DX,AX,BX,12,0x676f02d9,14); + ROUND2(BX,CX,DX,AX, 0,0x8d2a4c8a,20); + + MOVL (5*4)(SI), DI + MOVL CX, BP + + ROUND3(AX,BX,CX,DX, 8,0xfffa3942, 4); + ROUND3(DX,AX,BX,CX,11,0x8771f681,11); + ROUND3(CX,DX,AX,BX,14,0x6d9d6122,16); + ROUND3(BX,CX,DX,AX, 1,0xfde5380c,23); + ROUND3(AX,BX,CX,DX, 4,0xa4beea44, 4); + ROUND3(DX,AX,BX,CX, 7,0x4bdecfa9,11); + ROUND3(CX,DX,AX,BX,10,0xf6bb4b60,16); + ROUND3(BX,CX,DX,AX,13,0xbebfbc70,23); + ROUND3(AX,BX,CX,DX, 0,0x289b7ec6, 4); + ROUND3(DX,AX,BX,CX, 3,0xeaa127fa,11); + ROUND3(CX,DX,AX,BX, 6,0xd4ef3085,16); + ROUND3(BX,CX,DX,AX, 9, 0x4881d05,23); + ROUND3(AX,BX,CX,DX,12,0xd9d4d039, 4); + ROUND3(DX,AX,BX,CX,15,0xe6db99e5,11); + ROUND3(CX,DX,AX,BX, 2,0x1fa27cf8,16); + ROUND3(BX,CX,DX,AX, 0,0xc4ac5665,23); + + MOVL (0*4)(SI), DI + MOVL $0xffffffff, BP + XORL DX, BP + + ROUND4(AX,BX,CX,DX, 7,0xf4292244, 6); + ROUND4(DX,AX,BX,CX,14,0x432aff97,10); + ROUND4(CX,DX,AX,BX, 5,0xab9423a7,15); + ROUND4(BX,CX,DX,AX,12,0xfc93a039,21); + ROUND4(AX,BX,CX,DX, 3,0x655b59c3, 6); + ROUND4(DX,AX,BX,CX,10,0x8f0ccc92,10); + ROUND4(CX,DX,AX,BX, 1,0xffeff47d,15); + ROUND4(BX,CX,DX,AX, 8,0x85845dd1,21); + ROUND4(AX,BX,CX,DX,15,0x6fa87e4f, 6); + ROUND4(DX,AX,BX,CX, 6,0xfe2ce6e0,10); + ROUND4(CX,DX,AX,BX,13,0xa3014314,15); + ROUND4(BX,CX,DX,AX, 4,0x4e0811a1,21); + ROUND4(AX,BX,CX,DX,11,0xf7537e82, 6); + ROUND4(DX,AX,BX,CX, 2,0xbd3af235,10); + ROUND4(CX,DX,AX,BX, 9,0x2ad7d2bb,15); + ROUND4(BX,CX,DX,AX, 0,0xeb86d391,21); + + ADDL 0(SP), AX + ADDL 4(SP), BX + ADDL 8(SP), CX + ADDL 12(SP), DX + + ADDL $64, SI + CMPL SI, 16(SP) + JB loop + +end: + MOVL dig+0(FP), BP + MOVL AX, (0*4)(BP) + MOVL BX, (1*4)(BP) + MOVL CX, (2*4)(BP) + MOVL DX, (3*4)(BP) + RET diff --git a/go/src/crypto/md5/md5block_amd64.s b/go/src/crypto/md5/md5block_amd64.s new file mode 100644 index 0000000000000000000000000000000000000000..979eb22dbf74ebcb72c5e4a78b48af35003e3136 --- /dev/null +++ b/go/src/crypto/md5/md5block_amd64.s @@ -0,0 +1,689 @@ +// Code generated by command: go run md5block_amd64_asm.go -out ../md5block_amd64.s -pkg md5. DO NOT EDIT. + +//go:build !purego + +#include "textflag.h" + +// func block(dig *digest, p []byte) +TEXT ·block(SB), NOSPLIT, $8-32 + MOVQ dig+0(FP), BP + MOVQ p_base+8(FP), SI + MOVQ p_len+16(FP), DX + SHRQ $0x06, DX + SHLQ $0x06, DX + LEAQ (SI)(DX*1), DI + MOVL (BP), AX + MOVL 4(BP), BX + MOVL 8(BP), CX + MOVL 12(BP), DX + MOVL $0xffffffff, R11 + CMPQ SI, DI + JEQ end + +loop: + MOVL AX, R12 + MOVL BX, R13 + MOVL CX, R14 + MOVL DX, R15 + MOVL (SI), R8 + MOVL DX, R9 + XORL CX, R9 + ADDL $0xd76aa478, AX + ADDL R8, AX + ANDL BX, R9 + XORL DX, R9 + MOVL 4(SI), R8 + ADDL R9, AX + ROLL $0x07, AX + MOVL CX, R9 + ADDL BX, AX + XORL BX, R9 + ADDL $0xe8c7b756, DX + ADDL R8, DX + ANDL AX, R9 + XORL CX, R9 + MOVL 8(SI), R8 + ADDL R9, DX + ROLL $0x0c, DX + MOVL BX, R9 + ADDL AX, DX + XORL AX, R9 + ADDL $0x242070db, CX + ADDL R8, CX + ANDL DX, R9 + XORL BX, R9 + MOVL 12(SI), R8 + ADDL R9, CX + ROLL $0x11, CX + MOVL AX, R9 + ADDL DX, CX + XORL DX, R9 + ADDL $0xc1bdceee, BX + ADDL R8, BX + ANDL CX, R9 + XORL AX, R9 + MOVL 16(SI), R8 + ADDL R9, BX + ROLL $0x16, BX + MOVL DX, R9 + ADDL CX, BX + XORL CX, R9 + ADDL $0xf57c0faf, AX + ADDL R8, AX + ANDL BX, R9 + XORL DX, R9 + MOVL 20(SI), R8 + ADDL R9, AX + ROLL $0x07, AX + MOVL CX, R9 + ADDL BX, AX + XORL BX, R9 + ADDL $0x4787c62a, DX + ADDL R8, DX + ANDL AX, R9 + XORL CX, R9 + MOVL 24(SI), R8 + ADDL R9, DX + ROLL $0x0c, DX + MOVL BX, R9 + ADDL AX, DX + XORL AX, R9 + ADDL $0xa8304613, CX + ADDL R8, CX + ANDL DX, R9 + XORL BX, R9 + MOVL 28(SI), R8 + ADDL R9, CX + ROLL $0x11, CX + MOVL AX, R9 + ADDL DX, CX + XORL DX, R9 + ADDL $0xfd469501, BX + ADDL R8, BX + ANDL CX, R9 + XORL AX, R9 + MOVL 32(SI), R8 + ADDL R9, BX + ROLL $0x16, BX + MOVL DX, R9 + ADDL CX, BX + XORL CX, R9 + ADDL $0x698098d8, AX + ADDL R8, AX + ANDL BX, R9 + XORL DX, R9 + MOVL 36(SI), R8 + ADDL R9, AX + ROLL $0x07, AX + MOVL CX, R9 + ADDL BX, AX + XORL BX, R9 + ADDL $0x8b44f7af, DX + ADDL R8, DX + ANDL AX, R9 + XORL CX, R9 + MOVL 40(SI), R8 + ADDL R9, DX + ROLL $0x0c, DX + MOVL BX, R9 + ADDL AX, DX + XORL AX, R9 + ADDL $0xffff5bb1, CX + ADDL R8, CX + ANDL DX, R9 + XORL BX, R9 + MOVL 44(SI), R8 + ADDL R9, CX + ROLL $0x11, CX + MOVL AX, R9 + ADDL DX, CX + XORL DX, R9 + ADDL $0x895cd7be, BX + ADDL R8, BX + ANDL CX, R9 + XORL AX, R9 + MOVL 48(SI), R8 + ADDL R9, BX + ROLL $0x16, BX + MOVL DX, R9 + ADDL CX, BX + XORL CX, R9 + ADDL $0x6b901122, AX + ADDL R8, AX + ANDL BX, R9 + XORL DX, R9 + MOVL 52(SI), R8 + ADDL R9, AX + ROLL $0x07, AX + MOVL CX, R9 + ADDL BX, AX + XORL BX, R9 + ADDL $0xfd987193, DX + ADDL R8, DX + ANDL AX, R9 + XORL CX, R9 + MOVL 56(SI), R8 + ADDL R9, DX + ROLL $0x0c, DX + MOVL BX, R9 + ADDL AX, DX + XORL AX, R9 + ADDL $0xa679438e, CX + ADDL R8, CX + ANDL DX, R9 + XORL BX, R9 + MOVL 60(SI), R8 + ADDL R9, CX + ROLL $0x11, CX + MOVL AX, R9 + ADDL DX, CX + XORL DX, R9 + ADDL $0x49b40821, BX + ADDL R8, BX + ANDL CX, R9 + XORL AX, R9 + MOVL 4(SI), R8 + ADDL R9, BX + ROLL $0x16, BX + MOVL DX, R9 + ADDL CX, BX + MOVL DX, R9 + MOVL DX, R10 + XORL R11, R9 + ADDL $0xf61e2562, AX + ADDL R8, AX + ANDL BX, R10 + ANDL CX, R9 + MOVL 24(SI), R8 + ADDL R9, AX + ADDL R10, AX + MOVL CX, R9 + MOVL CX, R10 + ROLL $0x05, AX + ADDL BX, AX + XORL R11, R9 + ADDL $0xc040b340, DX + ADDL R8, DX + ANDL AX, R10 + ANDL BX, R9 + MOVL 44(SI), R8 + ADDL R9, DX + ADDL R10, DX + MOVL BX, R9 + MOVL BX, R10 + ROLL $0x09, DX + ADDL AX, DX + XORL R11, R9 + ADDL $0x265e5a51, CX + ADDL R8, CX + ANDL DX, R10 + ANDL AX, R9 + MOVL (SI), R8 + ADDL R9, CX + ADDL R10, CX + MOVL AX, R9 + MOVL AX, R10 + ROLL $0x0e, CX + ADDL DX, CX + XORL R11, R9 + ADDL $0xe9b6c7aa, BX + ADDL R8, BX + ANDL CX, R10 + ANDL DX, R9 + MOVL 20(SI), R8 + ADDL R9, BX + ADDL R10, BX + MOVL DX, R9 + MOVL DX, R10 + ROLL $0x14, BX + ADDL CX, BX + XORL R11, R9 + ADDL $0xd62f105d, AX + ADDL R8, AX + ANDL BX, R10 + ANDL CX, R9 + MOVL 40(SI), R8 + ADDL R9, AX + ADDL R10, AX + MOVL CX, R9 + MOVL CX, R10 + ROLL $0x05, AX + ADDL BX, AX + XORL R11, R9 + ADDL $0x02441453, DX + ADDL R8, DX + ANDL AX, R10 + ANDL BX, R9 + MOVL 60(SI), R8 + ADDL R9, DX + ADDL R10, DX + MOVL BX, R9 + MOVL BX, R10 + ROLL $0x09, DX + ADDL AX, DX + XORL R11, R9 + ADDL $0xd8a1e681, CX + ADDL R8, CX + ANDL DX, R10 + ANDL AX, R9 + MOVL 16(SI), R8 + ADDL R9, CX + ADDL R10, CX + MOVL AX, R9 + MOVL AX, R10 + ROLL $0x0e, CX + ADDL DX, CX + XORL R11, R9 + ADDL $0xe7d3fbc8, BX + ADDL R8, BX + ANDL CX, R10 + ANDL DX, R9 + MOVL 36(SI), R8 + ADDL R9, BX + ADDL R10, BX + MOVL DX, R9 + MOVL DX, R10 + ROLL $0x14, BX + ADDL CX, BX + XORL R11, R9 + ADDL $0x21e1cde6, AX + ADDL R8, AX + ANDL BX, R10 + ANDL CX, R9 + MOVL 56(SI), R8 + ADDL R9, AX + ADDL R10, AX + MOVL CX, R9 + MOVL CX, R10 + ROLL $0x05, AX + ADDL BX, AX + XORL R11, R9 + ADDL $0xc33707d6, DX + ADDL R8, DX + ANDL AX, R10 + ANDL BX, R9 + MOVL 12(SI), R8 + ADDL R9, DX + ADDL R10, DX + MOVL BX, R9 + MOVL BX, R10 + ROLL $0x09, DX + ADDL AX, DX + XORL R11, R9 + ADDL $0xf4d50d87, CX + ADDL R8, CX + ANDL DX, R10 + ANDL AX, R9 + MOVL 32(SI), R8 + ADDL R9, CX + ADDL R10, CX + MOVL AX, R9 + MOVL AX, R10 + ROLL $0x0e, CX + ADDL DX, CX + XORL R11, R9 + ADDL $0x455a14ed, BX + ADDL R8, BX + ANDL CX, R10 + ANDL DX, R9 + MOVL 52(SI), R8 + ADDL R9, BX + ADDL R10, BX + MOVL DX, R9 + MOVL DX, R10 + ROLL $0x14, BX + ADDL CX, BX + XORL R11, R9 + ADDL $0xa9e3e905, AX + ADDL R8, AX + ANDL BX, R10 + ANDL CX, R9 + MOVL 8(SI), R8 + ADDL R9, AX + ADDL R10, AX + MOVL CX, R9 + MOVL CX, R10 + ROLL $0x05, AX + ADDL BX, AX + XORL R11, R9 + ADDL $0xfcefa3f8, DX + ADDL R8, DX + ANDL AX, R10 + ANDL BX, R9 + MOVL 28(SI), R8 + ADDL R9, DX + ADDL R10, DX + MOVL BX, R9 + MOVL BX, R10 + ROLL $0x09, DX + ADDL AX, DX + XORL R11, R9 + ADDL $0x676f02d9, CX + ADDL R8, CX + ANDL DX, R10 + ANDL AX, R9 + MOVL 48(SI), R8 + ADDL R9, CX + ADDL R10, CX + MOVL AX, R9 + MOVL AX, R10 + ROLL $0x0e, CX + ADDL DX, CX + XORL R11, R9 + ADDL $0x8d2a4c8a, BX + ADDL R8, BX + ANDL CX, R10 + ANDL DX, R9 + MOVL 20(SI), R8 + ADDL R9, BX + ADDL R10, BX + MOVL DX, R9 + MOVL DX, R10 + ROLL $0x14, BX + ADDL CX, BX + MOVL CX, R9 + MOVL DX, R9 + XORL CX, R9 + XORL BX, R9 + ADDL $0xfffa3942, AX + ADDL R8, AX + MOVL 32(SI), R8 + ADDL R9, AX + ROLL $0x04, AX + ADDL BX, AX + XORL DX, R9 + XORL AX, R9 + ADDL $0x8771f681, DX + ADDL R8, DX + MOVL 44(SI), R8 + ADDL R9, DX + ROLL $0x0b, DX + ADDL AX, DX + XORL CX, R9 + XORL DX, R9 + ADDL $0x6d9d6122, CX + ADDL R8, CX + MOVL 56(SI), R8 + ADDL R9, CX + ROLL $0x10, CX + ADDL DX, CX + XORL BX, R9 + XORL CX, R9 + ADDL $0xfde5380c, BX + ADDL R8, BX + MOVL 4(SI), R8 + ADDL R9, BX + ROLL $0x17, BX + ADDL CX, BX + XORL AX, R9 + XORL BX, R9 + ADDL $0xa4beea44, AX + ADDL R8, AX + MOVL 16(SI), R8 + ADDL R9, AX + ROLL $0x04, AX + ADDL BX, AX + XORL DX, R9 + XORL AX, R9 + ADDL $0x4bdecfa9, DX + ADDL R8, DX + MOVL 28(SI), R8 + ADDL R9, DX + ROLL $0x0b, DX + ADDL AX, DX + XORL CX, R9 + XORL DX, R9 + ADDL $0xf6bb4b60, CX + ADDL R8, CX + MOVL 40(SI), R8 + ADDL R9, CX + ROLL $0x10, CX + ADDL DX, CX + XORL BX, R9 + XORL CX, R9 + ADDL $0xbebfbc70, BX + ADDL R8, BX + MOVL 52(SI), R8 + ADDL R9, BX + ROLL $0x17, BX + ADDL CX, BX + XORL AX, R9 + XORL BX, R9 + ADDL $0x289b7ec6, AX + ADDL R8, AX + MOVL (SI), R8 + ADDL R9, AX + ROLL $0x04, AX + ADDL BX, AX + XORL DX, R9 + XORL AX, R9 + ADDL $0xeaa127fa, DX + ADDL R8, DX + MOVL 12(SI), R8 + ADDL R9, DX + ROLL $0x0b, DX + ADDL AX, DX + XORL CX, R9 + XORL DX, R9 + ADDL $0xd4ef3085, CX + ADDL R8, CX + MOVL 24(SI), R8 + ADDL R9, CX + ROLL $0x10, CX + ADDL DX, CX + XORL BX, R9 + XORL CX, R9 + ADDL $0x04881d05, BX + ADDL R8, BX + MOVL 36(SI), R8 + ADDL R9, BX + ROLL $0x17, BX + ADDL CX, BX + XORL AX, R9 + XORL BX, R9 + ADDL $0xd9d4d039, AX + ADDL R8, AX + MOVL 48(SI), R8 + ADDL R9, AX + ROLL $0x04, AX + ADDL BX, AX + XORL DX, R9 + XORL AX, R9 + ADDL $0xe6db99e5, DX + ADDL R8, DX + MOVL 60(SI), R8 + ADDL R9, DX + ROLL $0x0b, DX + ADDL AX, DX + XORL CX, R9 + XORL DX, R9 + ADDL $0x1fa27cf8, CX + ADDL R8, CX + MOVL 8(SI), R8 + ADDL R9, CX + ROLL $0x10, CX + ADDL DX, CX + XORL BX, R9 + XORL CX, R9 + ADDL $0xc4ac5665, BX + ADDL R8, BX + MOVL (SI), R8 + ADDL R9, BX + ROLL $0x17, BX + ADDL CX, BX + MOVL R11, R9 + XORL DX, R9 + ADDL $0xf4292244, AX + ADDL R8, AX + ORL BX, R9 + XORL CX, R9 + ADDL R9, AX + MOVL 28(SI), R8 + MOVL $0xffffffff, R9 + ROLL $0x06, AX + XORL CX, R9 + ADDL BX, AX + ADDL $0x432aff97, DX + ADDL R8, DX + ORL AX, R9 + XORL BX, R9 + ADDL R9, DX + MOVL 56(SI), R8 + MOVL $0xffffffff, R9 + ROLL $0x0a, DX + XORL BX, R9 + ADDL AX, DX + ADDL $0xab9423a7, CX + ADDL R8, CX + ORL DX, R9 + XORL AX, R9 + ADDL R9, CX + MOVL 20(SI), R8 + MOVL $0xffffffff, R9 + ROLL $0x0f, CX + XORL AX, R9 + ADDL DX, CX + ADDL $0xfc93a039, BX + ADDL R8, BX + ORL CX, R9 + XORL DX, R9 + ADDL R9, BX + MOVL 48(SI), R8 + MOVL $0xffffffff, R9 + ROLL $0x15, BX + XORL DX, R9 + ADDL CX, BX + ADDL $0x655b59c3, AX + ADDL R8, AX + ORL BX, R9 + XORL CX, R9 + ADDL R9, AX + MOVL 12(SI), R8 + MOVL $0xffffffff, R9 + ROLL $0x06, AX + XORL CX, R9 + ADDL BX, AX + ADDL $0x8f0ccc92, DX + ADDL R8, DX + ORL AX, R9 + XORL BX, R9 + ADDL R9, DX + MOVL 40(SI), R8 + MOVL $0xffffffff, R9 + ROLL $0x0a, DX + XORL BX, R9 + ADDL AX, DX + ADDL $0xffeff47d, CX + ADDL R8, CX + ORL DX, R9 + XORL AX, R9 + ADDL R9, CX + MOVL 4(SI), R8 + MOVL $0xffffffff, R9 + ROLL $0x0f, CX + XORL AX, R9 + ADDL DX, CX + ADDL $0x85845dd1, BX + ADDL R8, BX + ORL CX, R9 + XORL DX, R9 + ADDL R9, BX + MOVL 32(SI), R8 + MOVL $0xffffffff, R9 + ROLL $0x15, BX + XORL DX, R9 + ADDL CX, BX + ADDL $0x6fa87e4f, AX + ADDL R8, AX + ORL BX, R9 + XORL CX, R9 + ADDL R9, AX + MOVL 60(SI), R8 + MOVL $0xffffffff, R9 + ROLL $0x06, AX + XORL CX, R9 + ADDL BX, AX + ADDL $0xfe2ce6e0, DX + ADDL R8, DX + ORL AX, R9 + XORL BX, R9 + ADDL R9, DX + MOVL 24(SI), R8 + MOVL $0xffffffff, R9 + ROLL $0x0a, DX + XORL BX, R9 + ADDL AX, DX + ADDL $0xa3014314, CX + ADDL R8, CX + ORL DX, R9 + XORL AX, R9 + ADDL R9, CX + MOVL 52(SI), R8 + MOVL $0xffffffff, R9 + ROLL $0x0f, CX + XORL AX, R9 + ADDL DX, CX + ADDL $0x4e0811a1, BX + ADDL R8, BX + ORL CX, R9 + XORL DX, R9 + ADDL R9, BX + MOVL 16(SI), R8 + MOVL $0xffffffff, R9 + ROLL $0x15, BX + XORL DX, R9 + ADDL CX, BX + ADDL $0xf7537e82, AX + ADDL R8, AX + ORL BX, R9 + XORL CX, R9 + ADDL R9, AX + MOVL 44(SI), R8 + MOVL $0xffffffff, R9 + ROLL $0x06, AX + XORL CX, R9 + ADDL BX, AX + ADDL $0xbd3af235, DX + ADDL R8, DX + ORL AX, R9 + XORL BX, R9 + ADDL R9, DX + MOVL 8(SI), R8 + MOVL $0xffffffff, R9 + ROLL $0x0a, DX + XORL BX, R9 + ADDL AX, DX + ADDL $0x2ad7d2bb, CX + ADDL R8, CX + ORL DX, R9 + XORL AX, R9 + ADDL R9, CX + MOVL 36(SI), R8 + MOVL $0xffffffff, R9 + ROLL $0x0f, CX + XORL AX, R9 + ADDL DX, CX + ADDL $0xeb86d391, BX + ADDL R8, BX + ORL CX, R9 + XORL DX, R9 + ADDL R9, BX + MOVL (SI), R8 + MOVL $0xffffffff, R9 + ROLL $0x15, BX + XORL DX, R9 + ADDL CX, BX + ADDL R12, AX + ADDL R13, BX + ADDL R14, CX + ADDL R15, DX + ADDQ $0x40, SI + CMPQ SI, DI + JB loop + +end: + MOVL AX, (BP) + MOVL BX, 4(BP) + MOVL CX, 8(BP) + MOVL DX, 12(BP) + RET diff --git a/go/src/crypto/md5/md5block_arm.s b/go/src/crypto/md5/md5block_arm.s new file mode 100644 index 0000000000000000000000000000000000000000..13fdc5c3beb515717ef97d6a5ed28f5a516a05cc --- /dev/null +++ b/go/src/crypto/md5/md5block_arm.s @@ -0,0 +1,301 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// +// ARM version of md5block.go + +//go:build !purego + +#include "textflag.h" + +// Register definitions +#define Rtable R0 // Pointer to MD5 constants table +#define Rdata R1 // Pointer to data to hash +#define Ra R2 // MD5 accumulator +#define Rb R3 // MD5 accumulator +#define Rc R4 // MD5 accumulator +#define Rd R5 // MD5 accumulator +#define Rc0 R6 // MD5 constant +#define Rc1 R7 // MD5 constant +#define Rc2 R8 // MD5 constant +// r9, r10 are forbidden +// r11 is OK provided you check the assembler that no synthetic instructions use it +#define Rc3 R11 // MD5 constant +#define Rt0 R12 // temporary +#define Rt1 R14 // temporary + +// func block(dig *digest, p []byte) +// 0(FP) is *digest +// 4(FP) is p.array (struct Slice) +// 8(FP) is p.len +//12(FP) is p.cap +// +// Stack frame +#define p_end end-4(SP) // pointer to the end of data +#define p_data data-8(SP) // current data pointer +#define buf buffer-(8+4*16)(SP) //16 words temporary buffer + // 3 words at 4..12(R13) for called routine parameters + +TEXT ·block(SB), NOSPLIT, $84-16 + MOVW p+4(FP), Rdata // pointer to the data + MOVW p_len+8(FP), Rt0 // number of bytes + ADD Rdata, Rt0 + MOVW Rt0, p_end // pointer to end of data + +loop: + MOVW Rdata, p_data // Save Rdata + AND.S $3, Rdata, Rt0 // TST $3, Rdata not working see issue 5921 + BEQ aligned // aligned detected - skip copy + + // Copy the unaligned source data into the aligned temporary buffer + // memmove(to=4(R13), from=8(R13), n=12(R13)) - Corrupts all registers + MOVW $buf, Rtable // to + MOVW $64, Rc0 // n + MOVM.IB [Rtable,Rdata,Rc0], (R13) + BL runtime·memmove(SB) + + // Point to the local aligned copy of the data + MOVW $buf, Rdata + +aligned: + // Point to the table of constants + // A PC relative add would be cheaper than this + MOVW $·table(SB), Rtable + + // Load up initial MD5 accumulator + MOVW dig+0(FP), Rc0 + MOVM.IA (Rc0), [Ra,Rb,Rc,Rd] + +// a += (((c^d)&b)^d) + X[index] + const +// a = a<>(32-shift) + b +#define ROUND1(Ra, Rb, Rc, Rd, index, shift, Rconst) \ + EOR Rc, Rd, Rt0 ; \ + AND Rb, Rt0 ; \ + EOR Rd, Rt0 ; \ + MOVW (index<<2)(Rdata), Rt1 ; \ + ADD Rt1, Rt0 ; \ + ADD Rconst, Rt0 ; \ + ADD Rt0, Ra ; \ + ADD Ra@>(32-shift), Rb, Ra ; + + MOVM.IA.W (Rtable), [Rc0,Rc1,Rc2,Rc3] + ROUND1(Ra, Rb, Rc, Rd, 0, 7, Rc0) + ROUND1(Rd, Ra, Rb, Rc, 1, 12, Rc1) + ROUND1(Rc, Rd, Ra, Rb, 2, 17, Rc2) + ROUND1(Rb, Rc, Rd, Ra, 3, 22, Rc3) + + MOVM.IA.W (Rtable), [Rc0,Rc1,Rc2,Rc3] + ROUND1(Ra, Rb, Rc, Rd, 4, 7, Rc0) + ROUND1(Rd, Ra, Rb, Rc, 5, 12, Rc1) + ROUND1(Rc, Rd, Ra, Rb, 6, 17, Rc2) + ROUND1(Rb, Rc, Rd, Ra, 7, 22, Rc3) + + MOVM.IA.W (Rtable), [Rc0,Rc1,Rc2,Rc3] + ROUND1(Ra, Rb, Rc, Rd, 8, 7, Rc0) + ROUND1(Rd, Ra, Rb, Rc, 9, 12, Rc1) + ROUND1(Rc, Rd, Ra, Rb, 10, 17, Rc2) + ROUND1(Rb, Rc, Rd, Ra, 11, 22, Rc3) + + MOVM.IA.W (Rtable), [Rc0,Rc1,Rc2,Rc3] + ROUND1(Ra, Rb, Rc, Rd, 12, 7, Rc0) + ROUND1(Rd, Ra, Rb, Rc, 13, 12, Rc1) + ROUND1(Rc, Rd, Ra, Rb, 14, 17, Rc2) + ROUND1(Rb, Rc, Rd, Ra, 15, 22, Rc3) + +// a += (((b^c)&d)^c) + X[index] + const +// a = a<>(32-shift) + b +#define ROUND2(Ra, Rb, Rc, Rd, index, shift, Rconst) \ + EOR Rb, Rc, Rt0 ; \ + AND Rd, Rt0 ; \ + EOR Rc, Rt0 ; \ + MOVW (index<<2)(Rdata), Rt1 ; \ + ADD Rt1, Rt0 ; \ + ADD Rconst, Rt0 ; \ + ADD Rt0, Ra ; \ + ADD Ra@>(32-shift), Rb, Ra ; + + MOVM.IA.W (Rtable), [Rc0,Rc1,Rc2,Rc3] + ROUND2(Ra, Rb, Rc, Rd, 1, 5, Rc0) + ROUND2(Rd, Ra, Rb, Rc, 6, 9, Rc1) + ROUND2(Rc, Rd, Ra, Rb, 11, 14, Rc2) + ROUND2(Rb, Rc, Rd, Ra, 0, 20, Rc3) + + MOVM.IA.W (Rtable), [Rc0,Rc1,Rc2,Rc3] + ROUND2(Ra, Rb, Rc, Rd, 5, 5, Rc0) + ROUND2(Rd, Ra, Rb, Rc, 10, 9, Rc1) + ROUND2(Rc, Rd, Ra, Rb, 15, 14, Rc2) + ROUND2(Rb, Rc, Rd, Ra, 4, 20, Rc3) + + MOVM.IA.W (Rtable), [Rc0,Rc1,Rc2,Rc3] + ROUND2(Ra, Rb, Rc, Rd, 9, 5, Rc0) + ROUND2(Rd, Ra, Rb, Rc, 14, 9, Rc1) + ROUND2(Rc, Rd, Ra, Rb, 3, 14, Rc2) + ROUND2(Rb, Rc, Rd, Ra, 8, 20, Rc3) + + MOVM.IA.W (Rtable), [Rc0,Rc1,Rc2,Rc3] + ROUND2(Ra, Rb, Rc, Rd, 13, 5, Rc0) + ROUND2(Rd, Ra, Rb, Rc, 2, 9, Rc1) + ROUND2(Rc, Rd, Ra, Rb, 7, 14, Rc2) + ROUND2(Rb, Rc, Rd, Ra, 12, 20, Rc3) + +// a += (b^c^d) + X[index] + const +// a = a<>(32-shift) + b +#define ROUND3(Ra, Rb, Rc, Rd, index, shift, Rconst) \ + EOR Rb, Rc, Rt0 ; \ + EOR Rd, Rt0 ; \ + MOVW (index<<2)(Rdata), Rt1 ; \ + ADD Rt1, Rt0 ; \ + ADD Rconst, Rt0 ; \ + ADD Rt0, Ra ; \ + ADD Ra@>(32-shift), Rb, Ra ; + + MOVM.IA.W (Rtable), [Rc0,Rc1,Rc2,Rc3] + ROUND3(Ra, Rb, Rc, Rd, 5, 4, Rc0) + ROUND3(Rd, Ra, Rb, Rc, 8, 11, Rc1) + ROUND3(Rc, Rd, Ra, Rb, 11, 16, Rc2) + ROUND3(Rb, Rc, Rd, Ra, 14, 23, Rc3) + + MOVM.IA.W (Rtable), [Rc0,Rc1,Rc2,Rc3] + ROUND3(Ra, Rb, Rc, Rd, 1, 4, Rc0) + ROUND3(Rd, Ra, Rb, Rc, 4, 11, Rc1) + ROUND3(Rc, Rd, Ra, Rb, 7, 16, Rc2) + ROUND3(Rb, Rc, Rd, Ra, 10, 23, Rc3) + + MOVM.IA.W (Rtable), [Rc0,Rc1,Rc2,Rc3] + ROUND3(Ra, Rb, Rc, Rd, 13, 4, Rc0) + ROUND3(Rd, Ra, Rb, Rc, 0, 11, Rc1) + ROUND3(Rc, Rd, Ra, Rb, 3, 16, Rc2) + ROUND3(Rb, Rc, Rd, Ra, 6, 23, Rc3) + + MOVM.IA.W (Rtable), [Rc0,Rc1,Rc2,Rc3] + ROUND3(Ra, Rb, Rc, Rd, 9, 4, Rc0) + ROUND3(Rd, Ra, Rb, Rc, 12, 11, Rc1) + ROUND3(Rc, Rd, Ra, Rb, 15, 16, Rc2) + ROUND3(Rb, Rc, Rd, Ra, 2, 23, Rc3) + +// a += (c^(b|^d)) + X[index] + const +// a = a<>(32-shift) + b +#define ROUND4(Ra, Rb, Rc, Rd, index, shift, Rconst) \ + MVN Rd, Rt0 ; \ + ORR Rb, Rt0 ; \ + EOR Rc, Rt0 ; \ + MOVW (index<<2)(Rdata), Rt1 ; \ + ADD Rt1, Rt0 ; \ + ADD Rconst, Rt0 ; \ + ADD Rt0, Ra ; \ + ADD Ra@>(32-shift), Rb, Ra ; + + MOVM.IA.W (Rtable), [Rc0,Rc1,Rc2,Rc3] + ROUND4(Ra, Rb, Rc, Rd, 0, 6, Rc0) + ROUND4(Rd, Ra, Rb, Rc, 7, 10, Rc1) + ROUND4(Rc, Rd, Ra, Rb, 14, 15, Rc2) + ROUND4(Rb, Rc, Rd, Ra, 5, 21, Rc3) + + MOVM.IA.W (Rtable), [Rc0,Rc1,Rc2,Rc3] + ROUND4(Ra, Rb, Rc, Rd, 12, 6, Rc0) + ROUND4(Rd, Ra, Rb, Rc, 3, 10, Rc1) + ROUND4(Rc, Rd, Ra, Rb, 10, 15, Rc2) + ROUND4(Rb, Rc, Rd, Ra, 1, 21, Rc3) + + MOVM.IA.W (Rtable), [Rc0,Rc1,Rc2,Rc3] + ROUND4(Ra, Rb, Rc, Rd, 8, 6, Rc0) + ROUND4(Rd, Ra, Rb, Rc, 15, 10, Rc1) + ROUND4(Rc, Rd, Ra, Rb, 6, 15, Rc2) + ROUND4(Rb, Rc, Rd, Ra, 13, 21, Rc3) + + MOVM.IA.W (Rtable), [Rc0,Rc1,Rc2,Rc3] + ROUND4(Ra, Rb, Rc, Rd, 4, 6, Rc0) + ROUND4(Rd, Ra, Rb, Rc, 11, 10, Rc1) + ROUND4(Rc, Rd, Ra, Rb, 2, 15, Rc2) + ROUND4(Rb, Rc, Rd, Ra, 9, 21, Rc3) + + MOVW dig+0(FP), Rt0 + MOVM.IA (Rt0), [Rc0,Rc1,Rc2,Rc3] + + ADD Rc0, Ra + ADD Rc1, Rb + ADD Rc2, Rc + ADD Rc3, Rd + + MOVM.IA [Ra,Rb,Rc,Rd], (Rt0) + + MOVW p_data, Rdata + MOVW p_end, Rt0 + ADD $64, Rdata + CMP Rt0, Rdata + BLO loop + + RET + +// MD5 constants table + + // Round 1 + DATA ·table+0x00(SB)/4, $0xd76aa478 + DATA ·table+0x04(SB)/4, $0xe8c7b756 + DATA ·table+0x08(SB)/4, $0x242070db + DATA ·table+0x0c(SB)/4, $0xc1bdceee + DATA ·table+0x10(SB)/4, $0xf57c0faf + DATA ·table+0x14(SB)/4, $0x4787c62a + DATA ·table+0x18(SB)/4, $0xa8304613 + DATA ·table+0x1c(SB)/4, $0xfd469501 + DATA ·table+0x20(SB)/4, $0x698098d8 + DATA ·table+0x24(SB)/4, $0x8b44f7af + DATA ·table+0x28(SB)/4, $0xffff5bb1 + DATA ·table+0x2c(SB)/4, $0x895cd7be + DATA ·table+0x30(SB)/4, $0x6b901122 + DATA ·table+0x34(SB)/4, $0xfd987193 + DATA ·table+0x38(SB)/4, $0xa679438e + DATA ·table+0x3c(SB)/4, $0x49b40821 + // Round 2 + DATA ·table+0x40(SB)/4, $0xf61e2562 + DATA ·table+0x44(SB)/4, $0xc040b340 + DATA ·table+0x48(SB)/4, $0x265e5a51 + DATA ·table+0x4c(SB)/4, $0xe9b6c7aa + DATA ·table+0x50(SB)/4, $0xd62f105d + DATA ·table+0x54(SB)/4, $0x02441453 + DATA ·table+0x58(SB)/4, $0xd8a1e681 + DATA ·table+0x5c(SB)/4, $0xe7d3fbc8 + DATA ·table+0x60(SB)/4, $0x21e1cde6 + DATA ·table+0x64(SB)/4, $0xc33707d6 + DATA ·table+0x68(SB)/4, $0xf4d50d87 + DATA ·table+0x6c(SB)/4, $0x455a14ed + DATA ·table+0x70(SB)/4, $0xa9e3e905 + DATA ·table+0x74(SB)/4, $0xfcefa3f8 + DATA ·table+0x78(SB)/4, $0x676f02d9 + DATA ·table+0x7c(SB)/4, $0x8d2a4c8a + // Round 3 + DATA ·table+0x80(SB)/4, $0xfffa3942 + DATA ·table+0x84(SB)/4, $0x8771f681 + DATA ·table+0x88(SB)/4, $0x6d9d6122 + DATA ·table+0x8c(SB)/4, $0xfde5380c + DATA ·table+0x90(SB)/4, $0xa4beea44 + DATA ·table+0x94(SB)/4, $0x4bdecfa9 + DATA ·table+0x98(SB)/4, $0xf6bb4b60 + DATA ·table+0x9c(SB)/4, $0xbebfbc70 + DATA ·table+0xa0(SB)/4, $0x289b7ec6 + DATA ·table+0xa4(SB)/4, $0xeaa127fa + DATA ·table+0xa8(SB)/4, $0xd4ef3085 + DATA ·table+0xac(SB)/4, $0x04881d05 + DATA ·table+0xb0(SB)/4, $0xd9d4d039 + DATA ·table+0xb4(SB)/4, $0xe6db99e5 + DATA ·table+0xb8(SB)/4, $0x1fa27cf8 + DATA ·table+0xbc(SB)/4, $0xc4ac5665 + // Round 4 + DATA ·table+0xc0(SB)/4, $0xf4292244 + DATA ·table+0xc4(SB)/4, $0x432aff97 + DATA ·table+0xc8(SB)/4, $0xab9423a7 + DATA ·table+0xcc(SB)/4, $0xfc93a039 + DATA ·table+0xd0(SB)/4, $0x655b59c3 + DATA ·table+0xd4(SB)/4, $0x8f0ccc92 + DATA ·table+0xd8(SB)/4, $0xffeff47d + DATA ·table+0xdc(SB)/4, $0x85845dd1 + DATA ·table+0xe0(SB)/4, $0x6fa87e4f + DATA ·table+0xe4(SB)/4, $0xfe2ce6e0 + DATA ·table+0xe8(SB)/4, $0xa3014314 + DATA ·table+0xec(SB)/4, $0x4e0811a1 + DATA ·table+0xf0(SB)/4, $0xf7537e82 + DATA ·table+0xf4(SB)/4, $0xbd3af235 + DATA ·table+0xf8(SB)/4, $0x2ad7d2bb + DATA ·table+0xfc(SB)/4, $0xeb86d391 + // Global definition + GLOBL ·table(SB),8,$256 diff --git a/go/src/crypto/md5/md5block_arm64.s b/go/src/crypto/md5/md5block_arm64.s new file mode 100644 index 0000000000000000000000000000000000000000..5942218f76fb928798df5c43f7a4ec2b1c45e016 --- /dev/null +++ b/go/src/crypto/md5/md5block_arm64.s @@ -0,0 +1,169 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// +// ARM64 version of md5block.go +// derived from crypto/md5/md5block_amd64.s + +//go:build !purego + +#include "textflag.h" + +TEXT ·block(SB),NOSPLIT,$0-32 + MOVD dig+0(FP), R0 + MOVD p+8(FP), R1 + MOVD p_len+16(FP), R2 + AND $~63, R2 + CBZ R2, zero + + ADD R1, R2, R21 + LDPW (0*8)(R0), (R4, R5) + LDPW (1*8)(R0), (R6, R7) + +loop: + MOVW R4, R12 + MOVW R5, R13 + MOVW R6, R14 + MOVW R7, R15 + + MOVW (0*4)(R1), R8 + MOVW R7, R9 + +#define ROUND1(a, b, c, d, index, const, shift) \ + ADDW $const, a; \ + ADDW R8, a; \ + MOVW (index*4)(R1), R8; \ + EORW c, R9; \ + ANDW b, R9; \ + EORW d, R9; \ + ADDW R9, a; \ + RORW $(32-shift), a; \ + MOVW c, R9; \ + ADDW b, a + + ROUND1(R4,R5,R6,R7, 1,0xd76aa478, 7); + ROUND1(R7,R4,R5,R6, 2,0xe8c7b756,12); + ROUND1(R6,R7,R4,R5, 3,0x242070db,17); + ROUND1(R5,R6,R7,R4, 4,0xc1bdceee,22); + ROUND1(R4,R5,R6,R7, 5,0xf57c0faf, 7); + ROUND1(R7,R4,R5,R6, 6,0x4787c62a,12); + ROUND1(R6,R7,R4,R5, 7,0xa8304613,17); + ROUND1(R5,R6,R7,R4, 8,0xfd469501,22); + ROUND1(R4,R5,R6,R7, 9,0x698098d8, 7); + ROUND1(R7,R4,R5,R6,10,0x8b44f7af,12); + ROUND1(R6,R7,R4,R5,11,0xffff5bb1,17); + ROUND1(R5,R6,R7,R4,12,0x895cd7be,22); + ROUND1(R4,R5,R6,R7,13,0x6b901122, 7); + ROUND1(R7,R4,R5,R6,14,0xfd987193,12); + ROUND1(R6,R7,R4,R5,15,0xa679438e,17); + ROUND1(R5,R6,R7,R4, 0,0x49b40821,22); + + MOVW (1*4)(R1), R8 + MOVW R7, R9 + MOVW R7, R10 + +#define ROUND2(a, b, c, d, index, const, shift) \ + ADDW $const, a; \ + ADDW R8, a; \ + MOVW (index*4)(R1), R8; \ + ANDW b, R10; \ + BICW R9, c, R9; \ + ORRW R9, R10; \ + MOVW c, R9; \ + ADDW R10, a; \ + MOVW c, R10; \ + RORW $(32-shift), a; \ + ADDW b, a + + ROUND2(R4,R5,R6,R7, 6,0xf61e2562, 5); + ROUND2(R7,R4,R5,R6,11,0xc040b340, 9); + ROUND2(R6,R7,R4,R5, 0,0x265e5a51,14); + ROUND2(R5,R6,R7,R4, 5,0xe9b6c7aa,20); + ROUND2(R4,R5,R6,R7,10,0xd62f105d, 5); + ROUND2(R7,R4,R5,R6,15, 0x2441453, 9); + ROUND2(R6,R7,R4,R5, 4,0xd8a1e681,14); + ROUND2(R5,R6,R7,R4, 9,0xe7d3fbc8,20); + ROUND2(R4,R5,R6,R7,14,0x21e1cde6, 5); + ROUND2(R7,R4,R5,R6, 3,0xc33707d6, 9); + ROUND2(R6,R7,R4,R5, 8,0xf4d50d87,14); + ROUND2(R5,R6,R7,R4,13,0x455a14ed,20); + ROUND2(R4,R5,R6,R7, 2,0xa9e3e905, 5); + ROUND2(R7,R4,R5,R6, 7,0xfcefa3f8, 9); + ROUND2(R6,R7,R4,R5,12,0x676f02d9,14); + ROUND2(R5,R6,R7,R4, 0,0x8d2a4c8a,20); + + MOVW (5*4)(R1), R8 + MOVW R6, R9 + +#define ROUND3(a, b, c, d, index, const, shift) \ + ADDW $const, a; \ + ADDW R8, a; \ + MOVW (index*4)(R1), R8; \ + EORW d, R9; \ + EORW b, R9; \ + ADDW R9, a; \ + RORW $(32-shift), a; \ + MOVW b, R9; \ + ADDW b, a + + ROUND3(R4,R5,R6,R7, 8,0xfffa3942, 4); + ROUND3(R7,R4,R5,R6,11,0x8771f681,11); + ROUND3(R6,R7,R4,R5,14,0x6d9d6122,16); + ROUND3(R5,R6,R7,R4, 1,0xfde5380c,23); + ROUND3(R4,R5,R6,R7, 4,0xa4beea44, 4); + ROUND3(R7,R4,R5,R6, 7,0x4bdecfa9,11); + ROUND3(R6,R7,R4,R5,10,0xf6bb4b60,16); + ROUND3(R5,R6,R7,R4,13,0xbebfbc70,23); + ROUND3(R4,R5,R6,R7, 0,0x289b7ec6, 4); + ROUND3(R7,R4,R5,R6, 3,0xeaa127fa,11); + ROUND3(R6,R7,R4,R5, 6,0xd4ef3085,16); + ROUND3(R5,R6,R7,R4, 9, 0x4881d05,23); + ROUND3(R4,R5,R6,R7,12,0xd9d4d039, 4); + ROUND3(R7,R4,R5,R6,15,0xe6db99e5,11); + ROUND3(R6,R7,R4,R5, 2,0x1fa27cf8,16); + ROUND3(R5,R6,R7,R4, 0,0xc4ac5665,23); + + MOVW (0*4)(R1), R8 + MVNW R7, R9 + +#define ROUND4(a, b, c, d, index, const, shift) \ + ADDW $const, a; \ + ADDW R8, a; \ + MOVW (index*4)(R1), R8; \ + ORRW b, R9; \ + EORW c, R9; \ + ADDW R9, a; \ + RORW $(32-shift), a; \ + MVNW c, R9; \ + ADDW b, a + + ROUND4(R4,R5,R6,R7, 7,0xf4292244, 6); + ROUND4(R7,R4,R5,R6,14,0x432aff97,10); + ROUND4(R6,R7,R4,R5, 5,0xab9423a7,15); + ROUND4(R5,R6,R7,R4,12,0xfc93a039,21); + ROUND4(R4,R5,R6,R7, 3,0x655b59c3, 6); + ROUND4(R7,R4,R5,R6,10,0x8f0ccc92,10); + ROUND4(R6,R7,R4,R5, 1,0xffeff47d,15); + ROUND4(R5,R6,R7,R4, 8,0x85845dd1,21); + ROUND4(R4,R5,R6,R7,15,0x6fa87e4f, 6); + ROUND4(R7,R4,R5,R6, 6,0xfe2ce6e0,10); + ROUND4(R6,R7,R4,R5,13,0xa3014314,15); + ROUND4(R5,R6,R7,R4, 4,0x4e0811a1,21); + ROUND4(R4,R5,R6,R7,11,0xf7537e82, 6); + ROUND4(R7,R4,R5,R6, 2,0xbd3af235,10); + ROUND4(R6,R7,R4,R5, 9,0x2ad7d2bb,15); + ROUND4(R5,R6,R7,R4, 0,0xeb86d391,21); + + ADDW R12, R4 + ADDW R13, R5 + ADDW R14, R6 + ADDW R15, R7 + + ADD $64, R1 + CMP R1, R21 + BNE loop + + STPW (R4, R5), (0*8)(R0) + STPW (R6, R7), (1*8)(R0) +zero: + RET diff --git a/go/src/crypto/md5/md5block_decl.go b/go/src/crypto/md5/md5block_decl.go new file mode 100644 index 0000000000000000000000000000000000000000..0af9c69a5ce34370a81867a438057941d6d99a61 --- /dev/null +++ b/go/src/crypto/md5/md5block_decl.go @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build (386 || amd64 || arm || arm64 || loong64 || ppc64 || ppc64le || riscv64 || s390x) && !purego + +package md5 + +const haveAsm = true + +//go:noescape +func block(dig *digest, p []byte) diff --git a/go/src/crypto/md5/md5block_generic.go b/go/src/crypto/md5/md5block_generic.go new file mode 100644 index 0000000000000000000000000000000000000000..22d0831300d02e8c5f1ab3c1f48bc58b0083207d --- /dev/null +++ b/go/src/crypto/md5/md5block_generic.go @@ -0,0 +1,13 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build (!386 && !amd64 && !arm && !arm64 && !loong64 && !ppc64 && !ppc64le && !riscv64 && !s390x) || purego + +package md5 + +const haveAsm = false + +func block(dig *digest, p []byte) { + blockGeneric(dig, p) +} diff --git a/go/src/crypto/md5/md5block_loong64.s b/go/src/crypto/md5/md5block_loong64.s new file mode 100644 index 0000000000000000000000000000000000000000..c16aa23cfe65ec4509ddc50050062c98a8142a34 --- /dev/null +++ b/go/src/crypto/md5/md5block_loong64.s @@ -0,0 +1,180 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// +// Loong64 version of md5block.go +// derived from crypto/md5/md5block_amd64.s + +//go:build !purego + +#define REGTMP R30 +#define REGTMP1 R12 +#define REGTMP2 R18 + +#include "textflag.h" + +// func block(dig *digest, p []byte) +TEXT ·block(SB),NOSPLIT,$0-32 + MOVV dig+0(FP), R4 + MOVV p+8(FP), R5 + MOVV p_len+16(FP), R6 + AND $~63, R6 + BEQ R6, zero + + // p_len >= 64 + ADDV R5, R6, R24 + MOVW (0*4)(R4), R7 + MOVW (1*4)(R4), R8 + MOVW (2*4)(R4), R9 + MOVW (3*4)(R4), R10 + +loop: + MOVW R7, R14 + MOVW R8, R15 + MOVW R9, R16 + MOVW R10, R17 + + MOVW (0*4)(R5), R11 + MOVW R10, REGTMP1 + +// F = ((c ^ d) & b) ^ d +#define ROUND1(a, b, c, d, index, const, shift) \ + ADDV $const, a; \ + ADD R11, a; \ + MOVW (index*4)(R5), R11; \ + XOR c, REGTMP1; \ + AND b, REGTMP1; \ + XOR d, REGTMP1; \ + ADD REGTMP1, a; \ + ROTR $(32-shift), a; \ + MOVW c, REGTMP1; \ + ADD b, a + + ROUND1(R7, R8, R9, R10, 1, 0xd76aa478, 7); + ROUND1(R10, R7, R8, R9, 2, 0xe8c7b756, 12); + ROUND1(R9, R10, R7, R8, 3, 0x242070db, 17); + ROUND1(R8, R9, R10, R7, 4, 0xc1bdceee, 22); + ROUND1(R7, R8, R9, R10, 5, 0xf57c0faf, 7); + ROUND1(R10, R7, R8, R9, 6, 0x4787c62a, 12); + ROUND1(R9, R10, R7, R8, 7, 0xa8304613, 17); + ROUND1(R8, R9, R10, R7, 8, 0xfd469501, 22); + ROUND1(R7, R8, R9, R10, 9, 0x698098d8, 7); + ROUND1(R10, R7, R8, R9, 10, 0x8b44f7af, 12); + ROUND1(R9, R10, R7, R8, 11, 0xffff5bb1, 17); + ROUND1(R8, R9, R10, R7, 12, 0x895cd7be, 22); + ROUND1(R7, R8, R9, R10, 13, 0x6b901122, 7); + ROUND1(R10, R7, R8, R9, 14, 0xfd987193, 12); + ROUND1(R9, R10, R7, R8, 15, 0xa679438e, 17); + ROUND1(R8, R9, R10, R7, 1, 0x49b40821, 22); + + MOVW (1*4)(R5), R11 + +// F = ((b ^ c) & d) ^ c +#define ROUND2(a, b, c, d, index, const, shift) \ + ADDV $const, a; \ + ADD R11, a; \ + MOVW (index*4)(R5), R11; \ + XOR b, c, REGTMP; \ + AND REGTMP, d, REGTMP; \ + XOR REGTMP, c, REGTMP; \ + ADD REGTMP, a; \ + ROTR $(32-shift), a; \ + ADD b, a + + ROUND2(R7, R8, R9, R10, 6, 0xf61e2562, 5); + ROUND2(R10, R7, R8, R9, 11, 0xc040b340, 9); + ROUND2(R9, R10, R7, R8, 0, 0x265e5a51, 14); + ROUND2(R8, R9, R10, R7, 5, 0xe9b6c7aa, 20); + ROUND2(R7, R8, R9, R10, 10, 0xd62f105d, 5); + ROUND2(R10, R7, R8, R9, 15, 0x2441453, 9); + ROUND2(R9, R10, R7, R8, 4, 0xd8a1e681, 14); + ROUND2(R8, R9, R10, R7, 9, 0xe7d3fbc8, 20); + ROUND2(R7, R8, R9, R10, 14, 0x21e1cde6, 5); + ROUND2(R10, R7, R8, R9, 3, 0xc33707d6, 9); + ROUND2(R9, R10, R7, R8, 8, 0xf4d50d87, 14); + ROUND2(R8, R9, R10, R7, 13, 0x455a14ed, 20); + ROUND2(R7, R8, R9, R10, 2, 0xa9e3e905, 5); + ROUND2(R10, R7, R8, R9, 7, 0xfcefa3f8, 9); + ROUND2(R9, R10, R7, R8, 12, 0x676f02d9, 14); + ROUND2(R8, R9, R10, R7, 5, 0x8d2a4c8a, 20); + + MOVW (5*4)(R5), R11 + MOVW R9, REGTMP1 + +// F = b ^ c ^ d +#define ROUND3(a, b, c, d, index, const, shift) \ + ADDV $const, a; \ + ADD R11, a; \ + MOVW (index*4)(R5), R11; \ + XOR d, REGTMP1; \ + XOR b, REGTMP1; \ + ADD REGTMP1, a; \ + ROTR $(32-shift), a; \ + MOVW b, REGTMP1; \ + ADD b, a + + ROUND3(R7, R8, R9, R10, 8, 0xfffa3942, 4); + ROUND3(R10, R7, R8, R9, 11, 0x8771f681, 11); + ROUND3(R9, R10, R7, R8, 14, 0x6d9d6122, 16); + ROUND3(R8, R9, R10, R7, 1, 0xfde5380c, 23); + ROUND3(R7, R8, R9, R10, 4, 0xa4beea44, 4); + ROUND3(R10, R7, R8, R9, 7, 0x4bdecfa9, 11); + ROUND3(R9, R10, R7, R8, 10, 0xf6bb4b60, 16); + ROUND3(R8, R9, R10, R7, 13, 0xbebfbc70, 23); + ROUND3(R7, R8, R9, R10, 0, 0x289b7ec6, 4); + ROUND3(R10, R7, R8, R9, 3, 0xeaa127fa, 11); + ROUND3(R9, R10, R7, R8, 6, 0xd4ef3085, 16); + ROUND3(R8, R9, R10, R7, 9, 0x4881d05, 23); + ROUND3(R7, R8, R9, R10, 12, 0xd9d4d039, 4); + ROUND3(R10, R7, R8, R9, 15, 0xe6db99e5, 11); + ROUND3(R9, R10, R7, R8, 2, 0x1fa27cf8, 16); + ROUND3(R8, R9, R10, R7, 0, 0xc4ac5665, 23); + + MOVW (0*4)(R5), R11 + MOVV $0xffffffff, REGTMP2 + XOR R10, REGTMP2, REGTMP1 // REGTMP1 = ~d + +// F = c ^ (b | (~d)) +#define ROUND4(a, b, c, d, index, const, shift) \ + ADDV $const, a; \ + ADD R11, a; \ + MOVW (index*4)(R5), R11; \ + OR b, REGTMP1; \ + XOR c, REGTMP1; \ + ADD REGTMP1, a; \ + ROTR $(32-shift), a; \ + MOVV $0xffffffff, REGTMP2; \ + XOR c, REGTMP2, REGTMP1; \ + ADD b, a + + ROUND4(R7, R8, R9, R10, 7, 0xf4292244, 6); + ROUND4(R10, R7, R8, R9, 14, 0x432aff97, 10); + ROUND4(R9, R10, R7, R8, 5, 0xab9423a7, 15); + ROUND4(R8, R9, R10, R7, 12, 0xfc93a039, 21); + ROUND4(R7, R8, R9, R10, 3, 0x655b59c3, 6); + ROUND4(R10, R7, R8, R9, 10, 0x8f0ccc92, 10); + ROUND4(R9, R10, R7, R8, 1, 0xffeff47d, 15); + ROUND4(R8, R9, R10, R7, 8, 0x85845dd1, 21); + ROUND4(R7, R8, R9, R10, 15, 0x6fa87e4f, 6); + ROUND4(R10, R7, R8, R9, 6, 0xfe2ce6e0, 10); + ROUND4(R9, R10, R7, R8, 13, 0xa3014314, 15); + ROUND4(R8, R9, R10, R7, 4, 0x4e0811a1, 21); + ROUND4(R7, R8, R9, R10, 11, 0xf7537e82, 6); + ROUND4(R10, R7, R8, R9, 2, 0xbd3af235, 10); + ROUND4(R9, R10, R7, R8, 9, 0x2ad7d2bb, 15); + ROUND4(R8, R9, R10, R7, 0, 0xeb86d391, 21); + + ADD R14, R7 + ADD R15, R8 + ADD R16, R9 + ADD R17, R10 + + ADDV $64, R5 + BNE R5, R24, loop + + MOVW R7, (0*4)(R4) + MOVW R8, (1*4)(R4) + MOVW R9, (2*4)(R4) + MOVW R10, (3*4)(R4) +zero: + RET diff --git a/go/src/crypto/md5/md5block_ppc64x.s b/go/src/crypto/md5/md5block_ppc64x.s new file mode 100644 index 0000000000000000000000000000000000000000..49a369548ee7eee41dfed95f840070bd56db837c --- /dev/null +++ b/go/src/crypto/md5/md5block_ppc64x.s @@ -0,0 +1,212 @@ +// Original source: +// http://www.zorinaq.com/papers/md5-amd64.html +// http://www.zorinaq.com/papers/md5-amd64.tar.bz2 +// +// MD5 optimized for ppc64le using Go's assembler for +// ppc64le, based on md5block_amd64.s implementation by +// the Go authors. +// +// Author: Marc Bevand +// Licence: I hereby disclaim the copyright on this code and place it +// in the public domain. + +//go:build (ppc64 || ppc64le) && !purego + +#include "textflag.h" + +// ENDIAN_MOVE generates the appropriate +// 4 byte load for big or little endian. +// The 4 bytes at ptr+off is loaded into dst. +// The idx reg is only needed for big endian +// and is clobbered when used. +#ifdef GOARCH_ppc64le +#define ENDIAN_MOVE(off, ptr, dst, idx) \ + MOVWZ off(ptr),dst +#else +#define ENDIAN_MOVE(off, ptr, dst, idx) \ + MOVD $off,idx; \ + MOVWBR (idx)(ptr), dst +#endif + +#define M00 R18 +#define M01 R19 +#define M02 R20 +#define M03 R24 +#define M04 R25 +#define M05 R26 +#define M06 R27 +#define M07 R28 +#define M08 R29 +#define M09 R21 +#define M10 R11 +#define M11 R8 +#define M12 R7 +#define M13 R12 +#define M14 R23 +#define M15 R10 + +#define ROUND1(a, b, c, d, index, const, shift) \ + ADD $const, index, R9; \ + ADD R9, a; \ + AND b, c, R9; \ + ANDN b, d, R31; \ + OR R9, R31, R9; \ + ADD R9, a; \ + ROTLW $shift, a; \ + ADD b, a; + +#define ROUND2(a, b, c, d, index, const, shift) \ + ADD $const, index, R9; \ + ADD R9, a; \ + AND b, d, R31; \ + ANDN d, c, R9; \ + OR R9, R31; \ + ADD R31, a; \ + ROTLW $shift, a; \ + ADD b, a; + +#define ROUND3(a, b, c, d, index, const, shift) \ + ADD $const, index, R9; \ + ADD R9, a; \ + XOR d, c, R31; \ + XOR b, R31; \ + ADD R31, a; \ + ROTLW $shift, a; \ + ADD b, a; + +#define ROUND4(a, b, c, d, index, const, shift) \ + ADD $const, index, R9; \ + ADD R9, a; \ + ORN d, b, R31; \ + XOR c, R31; \ + ADD R31, a; \ + ROTLW $shift, a; \ + ADD b, a; + + +TEXT ·block(SB),NOSPLIT,$0-32 + MOVD dig+0(FP), R10 + MOVD p+8(FP), R6 + MOVD p_len+16(FP), R5 + + // We assume p_len >= 64 + SRD $6, R5 + MOVD R5, CTR + + MOVWZ 0(R10), R22 + MOVWZ 4(R10), R3 + MOVWZ 8(R10), R4 + MOVWZ 12(R10), R5 + +loop: + MOVD R22, R14 + MOVD R3, R15 + MOVD R4, R16 + MOVD R5, R17 + + ENDIAN_MOVE( 0,R6,M00,M15) + ENDIAN_MOVE( 4,R6,M01,M15) + ENDIAN_MOVE( 8,R6,M02,M15) + ENDIAN_MOVE(12,R6,M03,M15) + + ROUND1(R22,R3,R4,R5,M00,0xd76aa478, 7); + ROUND1(R5,R22,R3,R4,M01,0xe8c7b756,12); + ROUND1(R4,R5,R22,R3,M02,0x242070db,17); + ROUND1(R3,R4,R5,R22,M03,0xc1bdceee,22); + + ENDIAN_MOVE(16,R6,M04,M15) + ENDIAN_MOVE(20,R6,M05,M15) + ENDIAN_MOVE(24,R6,M06,M15) + ENDIAN_MOVE(28,R6,M07,M15) + + ROUND1(R22,R3,R4,R5,M04,0xf57c0faf, 7); + ROUND1(R5,R22,R3,R4,M05,0x4787c62a,12); + ROUND1(R4,R5,R22,R3,M06,0xa8304613,17); + ROUND1(R3,R4,R5,R22,M07,0xfd469501,22); + + ENDIAN_MOVE(32,R6,M08,M15) + ENDIAN_MOVE(36,R6,M09,M15) + ENDIAN_MOVE(40,R6,M10,M15) + ENDIAN_MOVE(44,R6,M11,M15) + + ROUND1(R22,R3,R4,R5,M08,0x698098d8, 7); + ROUND1(R5,R22,R3,R4,M09,0x8b44f7af,12); + ROUND1(R4,R5,R22,R3,M10,0xffff5bb1,17); + ROUND1(R3,R4,R5,R22,M11,0x895cd7be,22); + + ENDIAN_MOVE(48,R6,M12,M15) + ENDIAN_MOVE(52,R6,M13,M15) + ENDIAN_MOVE(56,R6,M14,M15) + ENDIAN_MOVE(60,R6,M15,M15) + + ROUND1(R22,R3,R4,R5,M12,0x6b901122, 7); + ROUND1(R5,R22,R3,R4,M13,0xfd987193,12); + ROUND1(R4,R5,R22,R3,M14,0xa679438e,17); + ROUND1(R3,R4,R5,R22,M15,0x49b40821,22); + + ROUND2(R22,R3,R4,R5,M01,0xf61e2562, 5); + ROUND2(R5,R22,R3,R4,M06,0xc040b340, 9); + ROUND2(R4,R5,R22,R3,M11,0x265e5a51,14); + ROUND2(R3,R4,R5,R22,M00,0xe9b6c7aa,20); + ROUND2(R22,R3,R4,R5,M05,0xd62f105d, 5); + ROUND2(R5,R22,R3,R4,M10, 0x2441453, 9); + ROUND2(R4,R5,R22,R3,M15,0xd8a1e681,14); + ROUND2(R3,R4,R5,R22,M04,0xe7d3fbc8,20); + ROUND2(R22,R3,R4,R5,M09,0x21e1cde6, 5); + ROUND2(R5,R22,R3,R4,M14,0xc33707d6, 9); + ROUND2(R4,R5,R22,R3,M03,0xf4d50d87,14); + ROUND2(R3,R4,R5,R22,M08,0x455a14ed,20); + ROUND2(R22,R3,R4,R5,M13,0xa9e3e905, 5); + ROUND2(R5,R22,R3,R4,M02,0xfcefa3f8, 9); + ROUND2(R4,R5,R22,R3,M07,0x676f02d9,14); + ROUND2(R3,R4,R5,R22,M12,0x8d2a4c8a,20); + + ROUND3(R22,R3,R4,R5,M05,0xfffa3942, 4); + ROUND3(R5,R22,R3,R4,M08,0x8771f681,11); + ROUND3(R4,R5,R22,R3,M11,0x6d9d6122,16); + ROUND3(R3,R4,R5,R22,M14,0xfde5380c,23); + ROUND3(R22,R3,R4,R5,M01,0xa4beea44, 4); + ROUND3(R5,R22,R3,R4,M04,0x4bdecfa9,11); + ROUND3(R4,R5,R22,R3,M07,0xf6bb4b60,16); + ROUND3(R3,R4,R5,R22,M10,0xbebfbc70,23); + ROUND3(R22,R3,R4,R5,M13,0x289b7ec6, 4); + ROUND3(R5,R22,R3,R4,M00,0xeaa127fa,11); + ROUND3(R4,R5,R22,R3,M03,0xd4ef3085,16); + ROUND3(R3,R4,R5,R22,M06, 0x4881d05,23); + ROUND3(R22,R3,R4,R5,M09,0xd9d4d039, 4); + ROUND3(R5,R22,R3,R4,M12,0xe6db99e5,11); + ROUND3(R4,R5,R22,R3,M15,0x1fa27cf8,16); + ROUND3(R3,R4,R5,R22,M02,0xc4ac5665,23); + + ROUND4(R22,R3,R4,R5,M00,0xf4292244, 6); + ROUND4(R5,R22,R3,R4,M07,0x432aff97,10); + ROUND4(R4,R5,R22,R3,M14,0xab9423a7,15); + ROUND4(R3,R4,R5,R22,M05,0xfc93a039,21); + ROUND4(R22,R3,R4,R5,M12,0x655b59c3, 6); + ROUND4(R5,R22,R3,R4,M03,0x8f0ccc92,10); + ROUND4(R4,R5,R22,R3,M10,0xffeff47d,15); + ROUND4(R3,R4,R5,R22,M01,0x85845dd1,21); + ROUND4(R22,R3,R4,R5,M08,0x6fa87e4f, 6); + ROUND4(R5,R22,R3,R4,M15,0xfe2ce6e0,10); + ROUND4(R4,R5,R22,R3,M06,0xa3014314,15); + ROUND4(R3,R4,R5,R22,M13,0x4e0811a1,21); + ROUND4(R22,R3,R4,R5,M04,0xf7537e82, 6); + ROUND4(R5,R22,R3,R4,M11,0xbd3af235,10); + ROUND4(R4,R5,R22,R3,M02,0x2ad7d2bb,15); + ROUND4(R3,R4,R5,R22,M09,0xeb86d391,21); + + ADD R14, R22 + ADD R15, R3 + ADD R16, R4 + ADD R17, R5 + ADD $64, R6 + BDNZ loop + +end: + MOVD dig+0(FP), R10 + MOVWZ R22, 0(R10) + MOVWZ R3, 4(R10) + MOVWZ R4, 8(R10) + MOVWZ R5, 12(R10) + + RET diff --git a/go/src/crypto/md5/md5block_riscv64.s b/go/src/crypto/md5/md5block_riscv64.s new file mode 100644 index 0000000000000000000000000000000000000000..017c70b9369516a0fe5a0e57c8453516fe2d2d11 --- /dev/null +++ b/go/src/crypto/md5/md5block_riscv64.s @@ -0,0 +1,279 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// +// RISCV64 version of md5block.go +// derived from crypto/md5/md5block_arm64.s and crypto/md5/md5block.go + +//go:build !purego + +#include "textflag.h" + +#define LOAD32U(base, offset, tmp, dest) \ + MOVBU (offset+0*1)(base), dest; \ + MOVBU (offset+1*1)(base), tmp; \ + SLL $8, tmp; \ + OR tmp, dest; \ + MOVBU (offset+2*1)(base), tmp; \ + SLL $16, tmp; \ + OR tmp, dest; \ + MOVBU (offset+3*1)(base), tmp; \ + SLL $24, tmp; \ + OR tmp, dest + +#define LOAD64U(base, offset, tmp1, tmp2, dst) \ + LOAD32U(base, offset, tmp1, dst); \ + LOAD32U(base, offset+4, tmp1, tmp2); \ + SLL $32, tmp2; \ + OR tmp2, dst + +#define ROUND1EVN(a, b, c, d, x, const, shift) \ + MOV $const, X23; \ + ADDW x, a; \ + ADDW X23, a; \ + XOR c, d, X23; \ + AND b, X23; \ + XOR d, X23; \ + ADDW X23, a; \ + RORIW $(32-shift), a; \ + ADDW b, a + +#define ROUND1ODD(a, b, c, d, x, const, shift) \ + MOV $const, X23; \ + ADDW X23, a; \ + SRL $32, x, X23; \ + ADDW X23, a; \ + XOR c, d, X23; \ + AND b, X23; \ + XOR d, X23; \ + ADDW X23, a; \ + RORIW $(32-shift), a; \ + ADDW b, a + +#define ROUND2EVN(a, b, c, d, x, const, shift) \ + MOV $const, X23; \ + ADDW x, a; \ + ADDW X23, a; \ + XOR b, c, X23; \ + AND d, X23; \ + XOR c, X23; \ + ADDW X23, a; \ + RORIW $(32-shift), a; \ + ADDW b, a + +#define ROUND2ODD(a, b, c, d, x, const, shift) \ + MOV $const, X23; \ + ADDW X23, a; \ + SRL $32, x, X23; \ + ADDW X23, a; \ + XOR b, c, X23; \ + AND d, X23; \ + XOR c, X23; \ + ADDW X23, a; \ + RORIW $(32-shift), a; \ + ADDW b, a + +#define ROUND3EVN(a, b, c, d, x, const, shift) \ + MOV $const, X23; \ + ADDW x, a; \ + ADDW X23, a; \ + XOR c, d, X23; \ + XOR b, X23; \ + ADDW X23, a; \ + RORIW $(32-shift), a; \ + ADDW b, a + +#define ROUND3ODD(a, b, c, d, x, const, shift) \ + MOV $const, X23; \ + ADDW X23, a; \ + SRL $32, x, X23; \ + ADDW X23, a; \ + XOR c, d, X23; \ + XOR b, X23; \ + ADDW X23, a; \ + RORIW $(32-shift), a; \ + ADDW b, a + +#define ROUND4EVN(a, b, c, d, x, const, shift) \ + MOV $const, X23; \ + ADDW x, a; \ + ADDW X23, a; \ + ORN d, b, X23; \ + XOR c, X23; \ + ADDW X23, a; \ + RORIW $(32-shift), a; \ + ADDW b, a + +#define ROUND4ODD(a, b, c, d, x, const, shift) \ + MOV $const, X23; \ + ADDW X23, a; \ + SRL $32, x, X23; \ + ADDW X23, a; \ + ORN d, b, X23; \ + XOR c, X23; \ + ADDW X23, a; \ + RORIW $(32-shift), a; \ + ADDW b, a + +// Register use for the block function +// +// X5 - X12 : contain the 16 32 bit data items in the block we're +// processing. Odd numbered values, e.g., x1, x3 are stored in +// the upper 32 bits of the register. +// X13 - X16 : a, b, c, d +// X17 - X20 : used to store the old values of a, b, c, d, i.e., aa, bb, cc, +// dd. X17 and X18 are also used as temporary registers when +// loading unaligned data. +// X22 : pointer to dig.s +// X23 : temporary register +// X28 : pointer to the first byte beyond the end of p +// X29 : pointer to current 64 byte block of data, initially set to +// &p[0] +// X30 : temporary register + +TEXT ·block(SB),NOSPLIT,$0-32 + MOV p+8(FP), X29 + MOV p_len+16(FP), X30 + SRL $6, X30 + SLL $6, X30 + BEQZ X30, zero + + ADD X29, X30, X28 + + MOV dig+0(FP), X22 + MOVWU (0*4)(X22), X13 // a = s[0] + MOVWU (1*4)(X22), X14 // b = s[1] + MOVWU (2*4)(X22), X15 // c = s[2] + MOVWU (3*4)(X22), X16 // d = s[3] + +loop: + + // Load the 64 bytes of data in x0-15 into 8 64 bit registers, X5-X12. + // Different paths are taken to load the values depending on whether the + // buffer is 8 byte aligned or not. We load all the values up front + // here at the start of the loop to avoid multiple alignment checks and + // to reduce code size. It takes 10 instructions to load an unaligned + // 32 bit value and this value will be used 4 times in the main body + // of the loop below. + + AND $7, X29, X30 + BEQZ X30, aligned + + LOAD64U(X29,0, X17, X18, X5) + LOAD64U(X29,8, X17, X18, X6) + LOAD64U(X29,16, X17, X18, X7) + LOAD64U(X29,24, X17, X18, X8) + LOAD64U(X29,32, X17, X18, X9) + LOAD64U(X29,40, X17, X18, X10) + LOAD64U(X29,48, X17, X18, X11) + LOAD64U(X29,56, X17, X18, X12) + JMP block_loaded + +aligned: + MOV (0*8)(X29), X5 + MOV (1*8)(X29), X6 + MOV (2*8)(X29), X7 + MOV (3*8)(X29), X8 + MOV (4*8)(X29), X9 + MOV (5*8)(X29), X10 + MOV (6*8)(X29), X11 + MOV (7*8)(X29), X12 + +block_loaded: + MOV X13, X17 + MOV X14, X18 + MOV X15, X19 + MOV X16, X20 + + // Some of the hex constants below are too large to fit into a + // signed 32 bit value. The assembler will handle these + // constants in a special way to ensure that they are + // zero extended. Our algorithm is only interested in the + // bottom 32 bits and doesn't care whether constants are + // sign or zero extended when moved into 64 bit registers. + // So we use signed constants instead of hex when bit 31 is + // set so all constants can be loaded by lui+addi. + + ROUND1EVN(X13,X14,X15,X16,X5, -680876936, 7); // 0xd76aa478 + ROUND1ODD(X16,X13,X14,X15,X5, -389564586,12); // 0xe8c7b756 + ROUND1EVN(X15,X16,X13,X14,X6, 0x242070db,17); // 0x242070db + ROUND1ODD(X14,X15,X16,X13,X6, -1044525330,22); // 0xc1bdceee + ROUND1EVN(X13,X14,X15,X16,X7, -176418897, 7); // 0xf57c0faf + ROUND1ODD(X16,X13,X14,X15,X7, 0x4787c62a,12); // 0x4787c62a + ROUND1EVN(X15,X16,X13,X14,X8, -1473231341,17); // 0xa8304613 + ROUND1ODD(X14,X15,X16,X13,X8, -45705983,22); // 0xfd469501 + ROUND1EVN(X13,X14,X15,X16,X9, 0x698098d8, 7); // 0x698098d8 + ROUND1ODD(X16,X13,X14,X15,X9, -1958414417,12); // 0x8b44f7af + ROUND1EVN(X15,X16,X13,X14,X10, -42063,17); // 0xffff5bb1 + ROUND1ODD(X14,X15,X16,X13,X10,-1990404162,22); // 0x895cd7be + ROUND1EVN(X13,X14,X15,X16,X11, 0x6b901122, 7); // 0x6b901122 + ROUND1ODD(X16,X13,X14,X15,X11, -40341101,12); // 0xfd987193 + ROUND1EVN(X15,X16,X13,X14,X12,-1502002290,17); // 0xa679438e + ROUND1ODD(X14,X15,X16,X13,X12, 0x49b40821,22); // 0x49b40821 + + ROUND2ODD(X13,X14,X15,X16,X5, -165796510, 5); // f61e2562 + ROUND2EVN(X16,X13,X14,X15,X8, -1069501632, 9); // c040b340 + ROUND2ODD(X15,X16,X13,X14,X10, 0x265e5a51,14); // 265e5a51 + ROUND2EVN(X14,X15,X16,X13,X5, -373897302,20); // e9b6c7aa + ROUND2ODD(X13,X14,X15,X16,X7, -701558691, 5); // d62f105d + ROUND2EVN(X16,X13,X14,X15,X10, 0x2441453, 9); // 2441453 + ROUND2ODD(X15,X16,X13,X14,X12, -660478335,14); // d8a1e681 + ROUND2EVN(X14,X15,X16,X13,X7, -405537848,20); // e7d3fbc8 + ROUND2ODD(X13,X14,X15,X16,X9, 0x21e1cde6, 5); // 21e1cde6 + ROUND2EVN(X16,X13,X14,X15,X12,-1019803690, 9); // c33707d6 + ROUND2ODD(X15,X16,X13,X14,X6, -187363961,14); // f4d50d87 + ROUND2EVN(X14,X15,X16,X13,X9, 0x455a14ed,20); // 455a14ed + ROUND2ODD(X13,X14,X15,X16,X11,-1444681467, 5); // a9e3e905 + ROUND2EVN(X16,X13,X14,X15,X6, -51403784, 9); // fcefa3f8 + ROUND2ODD(X15,X16,X13,X14,X8, 0x676f02d9,14); // 676f02d9 + ROUND2EVN(X14,X15,X16,X13,X11,-1926607734,20); // 8d2a4c8a + + ROUND3ODD(X13,X14,X15,X16,X7, -378558, 4); // fffa3942 + ROUND3EVN(X16,X13,X14,X15,X9, -2022574463,11); // 8771f681 + ROUND3ODD(X15,X16,X13,X14,X10, 0x6d9d6122,16); // 6d9d6122 + ROUND3EVN(X14,X15,X16,X13,X12, -35309556,23); // fde5380c + ROUND3ODD(X13,X14,X15,X16,X5, -1530992060, 4); // a4beea44 + ROUND3EVN(X16,X13,X14,X15,X7, 0x4bdecfa9,11); // 4bdecfa9 + ROUND3ODD(X15,X16,X13,X14,X8, -155497632,16); // f6bb4b60 + ROUND3EVN(X14,X15,X16,X13,X10,-1094730640,23); // bebfbc70 + ROUND3ODD(X13,X14,X15,X16,X11, 0x289b7ec6, 4); // 289b7ec6 + ROUND3EVN(X16,X13,X14,X15,X5, -358537222,11); // eaa127fa + ROUND3ODD(X15,X16,X13,X14,X6, -722521979,16); // d4ef3085 + ROUND3EVN(X14,X15,X16,X13,X8, 0x4881d05,23); // 4881d05 + ROUND3ODD(X13,X14,X15,X16,X9, -640364487, 4); // d9d4d039 + ROUND3EVN(X16,X13,X14,X15,X11, -421815835,11); // e6db99e5 + ROUND3ODD(X15,X16,X13,X14,X12, 0x1fa27cf8,16); // 1fa27cf8 + ROUND3EVN(X14,X15,X16,X13,X6, -995338651,23); // c4ac5665 + + ROUND4EVN(X13,X14,X15,X16,X5, -198630844, 6); // f4292244 + ROUND4ODD(X16,X13,X14,X15,X8, 0x432aff97,10); // 432aff97 + ROUND4EVN(X15,X16,X13,X14,X12,-1416354905,15); // ab9423a7 + ROUND4ODD(X14,X15,X16,X13,X7, -57434055,21); // fc93a039 + ROUND4EVN(X13,X14,X15,X16,X11, 0x655b59c3, 6); // 655b59c3 + ROUND4ODD(X16,X13,X14,X15,X6, -1894986606,10); // 8f0ccc92 + ROUND4EVN(X15,X16,X13,X14,X10 ,-1051523,15); // ffeff47d + ROUND4ODD(X14,X15,X16,X13,X5, -2054922799,21); // 85845dd1 + ROUND4EVN(X13,X14,X15,X16,X9, 0x6fa87e4f, 6); // 6fa87e4f + ROUND4ODD(X16,X13,X14,X15,X12, -30611744,10); // fe2ce6e0 + ROUND4EVN(X15,X16,X13,X14,X8, -1560198380,15); // a3014314 + ROUND4ODD(X14,X15,X16,X13,X11, 0x4e0811a1,21); // 4e0811a1 + ROUND4EVN(X13,X14,X15,X16,X7, -145523070, 6); // f7537e82 + ROUND4ODD(X16,X13,X14,X15,X10,-1120210379,10); // bd3af235 + ROUND4EVN(X15,X16,X13,X14,X6, 0x2ad7d2bb,15); // 2ad7d2bb + ROUND4ODD(X14,X15,X16,X13,X9, -343485551,21); // eb86d391 + + ADDW X17, X13 + ADDW X18, X14 + ADDW X19, X15 + ADDW X20, X16 + + ADD $64, X29 + BNE X28, X29, loop + + MOVW X13, (0*4)(X22) + MOVW X14, (1*4)(X22) + MOVW X15, (2*4)(X22) + MOVW X16, (3*4)(X22) + +zero: + RET diff --git a/go/src/crypto/md5/md5block_s390x.s b/go/src/crypto/md5/md5block_s390x.s new file mode 100644 index 0000000000000000000000000000000000000000..2d18d28f2514d5996e869ad98dd332ef3cbd89d0 --- /dev/null +++ b/go/src/crypto/md5/md5block_s390x.s @@ -0,0 +1,177 @@ +// Original source: +// http://www.zorinaq.com/papers/md5-amd64.html +// http://www.zorinaq.com/papers/md5-amd64.tar.bz2 +// +// MD5 adapted for s390x using Go's assembler for +// s390x, based on md5block_amd64.s implementation by +// the Go authors. +// +// Author: Marc Bevand +// Licence: I hereby disclaim the copyright on this code and place it +// in the public domain. + +//go:build !purego + +#include "textflag.h" + +// func block(dig *digest, p []byte) +TEXT ·block(SB),NOSPLIT,$16-32 + MOVD dig+0(FP), R1 + MOVD p+8(FP), R6 + MOVD p_len+16(FP), R5 + AND $-64, R5 + LAY (R6)(R5*1), R7 + + LMY 0(R1), R2, R5 + CMPBEQ R6, R7, end + +loop: + STMY R2, R5, tmp-16(SP) + + MOVWBR 0(R6), R8 + MOVWZ R5, R9 + +#define ROUND1(a, b, c, d, index, const, shift) \ + XOR c, R9; \ + ADD $const, a; \ + ADD R8, a; \ + MOVWBR (index*4)(R6), R8; \ + AND b, R9; \ + XOR d, R9; \ + ADD R9, a; \ + RLL $shift, a; \ + MOVWZ c, R9; \ + ADD b, a + + ROUND1(R2,R3,R4,R5, 1,0xd76aa478, 7); + ROUND1(R5,R2,R3,R4, 2,0xe8c7b756,12); + ROUND1(R4,R5,R2,R3, 3,0x242070db,17); + ROUND1(R3,R4,R5,R2, 4,0xc1bdceee,22); + ROUND1(R2,R3,R4,R5, 5,0xf57c0faf, 7); + ROUND1(R5,R2,R3,R4, 6,0x4787c62a,12); + ROUND1(R4,R5,R2,R3, 7,0xa8304613,17); + ROUND1(R3,R4,R5,R2, 8,0xfd469501,22); + ROUND1(R2,R3,R4,R5, 9,0x698098d8, 7); + ROUND1(R5,R2,R3,R4,10,0x8b44f7af,12); + ROUND1(R4,R5,R2,R3,11,0xffff5bb1,17); + ROUND1(R3,R4,R5,R2,12,0x895cd7be,22); + ROUND1(R2,R3,R4,R5,13,0x6b901122, 7); + ROUND1(R5,R2,R3,R4,14,0xfd987193,12); + ROUND1(R4,R5,R2,R3,15,0xa679438e,17); + ROUND1(R3,R4,R5,R2, 0,0x49b40821,22); + + MOVWBR (1*4)(R6), R8 + MOVWZ R5, R9 + MOVWZ R5, R1 + +#define ROUND2(a, b, c, d, index, const, shift) \ + XOR $0xffffffff, R9; \ // NOTW R9 + ADD $const, a; \ + ADD R8, a; \ + MOVWBR (index*4)(R6), R8; \ + AND b, R1; \ + AND c, R9; \ + OR R9, R1; \ + MOVWZ c, R9; \ + ADD R1, a; \ + MOVWZ c, R1; \ + RLL $shift, a; \ + ADD b, a + + ROUND2(R2,R3,R4,R5, 6,0xf61e2562, 5); + ROUND2(R5,R2,R3,R4,11,0xc040b340, 9); + ROUND2(R4,R5,R2,R3, 0,0x265e5a51,14); + ROUND2(R3,R4,R5,R2, 5,0xe9b6c7aa,20); + ROUND2(R2,R3,R4,R5,10,0xd62f105d, 5); + ROUND2(R5,R2,R3,R4,15, 0x2441453, 9); + ROUND2(R4,R5,R2,R3, 4,0xd8a1e681,14); + ROUND2(R3,R4,R5,R2, 9,0xe7d3fbc8,20); + ROUND2(R2,R3,R4,R5,14,0x21e1cde6, 5); + ROUND2(R5,R2,R3,R4, 3,0xc33707d6, 9); + ROUND2(R4,R5,R2,R3, 8,0xf4d50d87,14); + ROUND2(R3,R4,R5,R2,13,0x455a14ed,20); + ROUND2(R2,R3,R4,R5, 2,0xa9e3e905, 5); + ROUND2(R5,R2,R3,R4, 7,0xfcefa3f8, 9); + ROUND2(R4,R5,R2,R3,12,0x676f02d9,14); + ROUND2(R3,R4,R5,R2, 0,0x8d2a4c8a,20); + + MOVWBR (5*4)(R6), R8 + MOVWZ R4, R9 + +#define ROUND3(a, b, c, d, index, const, shift) \ + ADD $const, a; \ + ADD R8, a; \ + MOVWBR (index*4)(R6), R8; \ + XOR d, R9; \ + XOR b, R9; \ + ADD R9, a; \ + RLL $shift, a; \ + MOVWZ b, R9; \ + ADD b, a + + ROUND3(R2,R3,R4,R5, 8,0xfffa3942, 4); + ROUND3(R5,R2,R3,R4,11,0x8771f681,11); + ROUND3(R4,R5,R2,R3,14,0x6d9d6122,16); + ROUND3(R3,R4,R5,R2, 1,0xfde5380c,23); + ROUND3(R2,R3,R4,R5, 4,0xa4beea44, 4); + ROUND3(R5,R2,R3,R4, 7,0x4bdecfa9,11); + ROUND3(R4,R5,R2,R3,10,0xf6bb4b60,16); + ROUND3(R3,R4,R5,R2,13,0xbebfbc70,23); + ROUND3(R2,R3,R4,R5, 0,0x289b7ec6, 4); + ROUND3(R5,R2,R3,R4, 3,0xeaa127fa,11); + ROUND3(R4,R5,R2,R3, 6,0xd4ef3085,16); + ROUND3(R3,R4,R5,R2, 9, 0x4881d05,23); + ROUND3(R2,R3,R4,R5,12,0xd9d4d039, 4); + ROUND3(R5,R2,R3,R4,15,0xe6db99e5,11); + ROUND3(R4,R5,R2,R3, 2,0x1fa27cf8,16); + ROUND3(R3,R4,R5,R2, 0,0xc4ac5665,23); + + MOVWBR (0*4)(R6), R8 + MOVWZ $0xffffffff, R9 + XOR R5, R9 + +#define ROUND4(a, b, c, d, index, const, shift) \ + ADD $const, a; \ + ADD R8, a; \ + MOVWBR (index*4)(R6), R8; \ + OR b, R9; \ + XOR c, R9; \ + ADD R9, a; \ + MOVWZ $0xffffffff, R9; \ + RLL $shift, a; \ + XOR c, R9; \ + ADD b, a + + ROUND4(R2,R3,R4,R5, 7,0xf4292244, 6); + ROUND4(R5,R2,R3,R4,14,0x432aff97,10); + ROUND4(R4,R5,R2,R3, 5,0xab9423a7,15); + ROUND4(R3,R4,R5,R2,12,0xfc93a039,21); + ROUND4(R2,R3,R4,R5, 3,0x655b59c3, 6); + ROUND4(R5,R2,R3,R4,10,0x8f0ccc92,10); + ROUND4(R4,R5,R2,R3, 1,0xffeff47d,15); + ROUND4(R3,R4,R5,R2, 8,0x85845dd1,21); + ROUND4(R2,R3,R4,R5,15,0x6fa87e4f, 6); + ROUND4(R5,R2,R3,R4, 6,0xfe2ce6e0,10); + ROUND4(R4,R5,R2,R3,13,0xa3014314,15); + ROUND4(R3,R4,R5,R2, 4,0x4e0811a1,21); + ROUND4(R2,R3,R4,R5,11,0xf7537e82, 6); + ROUND4(R5,R2,R3,R4, 2,0xbd3af235,10); + ROUND4(R4,R5,R2,R3, 9,0x2ad7d2bb,15); + ROUND4(R3,R4,R5,R2, 0,0xeb86d391,21); + + MOVWZ tmp-16(SP), R1 + ADD R1, R2 + MOVWZ tmp-12(SP), R1 + ADD R1, R3 + MOVWZ tmp-8(SP), R1 + ADD R1, R4 + MOVWZ tmp-4(SP), R1 + ADD R1, R5 + + LA 64(R6), R6 + CMPBLT R6, R7, loop + +end: + MOVD dig+0(FP), R1 + STMY R2, R5, 0(R1) + RET diff --git a/go/src/crypto/mlkem/example_test.go b/go/src/crypto/mlkem/example_test.go new file mode 100644 index 0000000000000000000000000000000000000000..28bf3f29e711edd6264bcc60b659352f82efe25b --- /dev/null +++ b/go/src/crypto/mlkem/example_test.go @@ -0,0 +1,47 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package mlkem_test + +import ( + "crypto/mlkem" + "log" +) + +func Example() { + // Alice generates a new key pair and sends the encapsulation key to Bob. + dk, err := mlkem.GenerateKey768() + if err != nil { + log.Fatal(err) + } + encapsulationKey := dk.EncapsulationKey().Bytes() + + // Bob uses the encapsulation key to encapsulate a shared secret, and sends + // back the ciphertext to Alice. + ciphertext := Bob(encapsulationKey) + + // Alice decapsulates the shared secret from the ciphertext. + sharedSecret, err := dk.Decapsulate(ciphertext) + if err != nil { + log.Fatal(err) + } + + // Alice and Bob now share a secret. + _ = sharedSecret +} + +func Bob(encapsulationKey []byte) (ciphertext []byte) { + // Bob encapsulates a shared secret using the encapsulation key. + ek, err := mlkem.NewEncapsulationKey768(encapsulationKey) + if err != nil { + log.Fatal(err) + } + sharedSecret, ciphertext := ek.Encapsulate() + + // Alice and Bob now share a secret. + _ = sharedSecret + + // Bob sends the ciphertext to Alice. + return ciphertext +} diff --git a/go/src/crypto/mlkem/mlkem.go b/go/src/crypto/mlkem/mlkem.go new file mode 100644 index 0000000000000000000000000000000000000000..b652e3bae9dd717afdcfe5894148d6e9c79a3f6c --- /dev/null +++ b/go/src/crypto/mlkem/mlkem.go @@ -0,0 +1,221 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package mlkem implements the quantum-resistant key encapsulation method +// ML-KEM (formerly known as Kyber), as specified in [NIST FIPS 203]. +// +// Most applications should use the ML-KEM-768 parameter set, as implemented by +// [DecapsulationKey768] and [EncapsulationKey768]. +// +// [NIST FIPS 203]: https://doi.org/10.6028/NIST.FIPS.203 +package mlkem + +import ( + "crypto" + "crypto/internal/fips140/mlkem" +) + +const ( + // SharedKeySize is the size of a shared key produced by ML-KEM. + SharedKeySize = 32 + + // SeedSize is the size of a seed used to generate a decapsulation key. + SeedSize = 64 + + // CiphertextSize768 is the size of a ciphertext produced by ML-KEM-768. + CiphertextSize768 = 1088 + + // EncapsulationKeySize768 is the size of an ML-KEM-768 encapsulation key. + EncapsulationKeySize768 = 1184 + + // CiphertextSize1024 is the size of a ciphertext produced by ML-KEM-1024. + CiphertextSize1024 = 1568 + + // EncapsulationKeySize1024 is the size of an ML-KEM-1024 encapsulation key. + EncapsulationKeySize1024 = 1568 +) + +// DecapsulationKey768 is the secret key used to decapsulate a shared key +// from a ciphertext. It includes various precomputed values. +type DecapsulationKey768 struct { + key *mlkem.DecapsulationKey768 +} + +// GenerateKey768 generates a new decapsulation key, drawing random bytes from +// a secure source. The decapsulation key must be kept secret. +func GenerateKey768() (*DecapsulationKey768, error) { + key, err := mlkem.GenerateKey768() + if err != nil { + return nil, err + } + + return &DecapsulationKey768{key}, nil +} + +// NewDecapsulationKey768 expands a decapsulation key from a 64-byte seed in the +// "d || z" form. The seed must be uniformly random. +func NewDecapsulationKey768(seed []byte) (*DecapsulationKey768, error) { + key, err := mlkem.NewDecapsulationKey768(seed) + if err != nil { + return nil, err + } + + return &DecapsulationKey768{key}, nil +} + +// Bytes returns the decapsulation key as a 64-byte seed in the "d || z" form. +// +// The decapsulation key must be kept secret. +func (dk *DecapsulationKey768) Bytes() []byte { + return dk.key.Bytes() +} + +// Decapsulate generates a shared key from a ciphertext and a decapsulation +// key. If the ciphertext is not valid, Decapsulate returns an error. +// +// The shared key must be kept secret. +func (dk *DecapsulationKey768) Decapsulate(ciphertext []byte) (sharedKey []byte, err error) { + return dk.key.Decapsulate(ciphertext) +} + +// EncapsulationKey returns the public encapsulation key necessary to produce +// ciphertexts. +func (dk *DecapsulationKey768) EncapsulationKey() *EncapsulationKey768 { + return &EncapsulationKey768{dk.key.EncapsulationKey()} +} + +// Encapsulator returns the encapsulation key, like +// [DecapsulationKey768.EncapsulationKey]. +// +// It implements [crypto.Decapsulator]. +func (dk *DecapsulationKey768) Encapsulator() crypto.Encapsulator { + return dk.EncapsulationKey() +} + +var _ crypto.Decapsulator = (*DecapsulationKey768)(nil) + +// An EncapsulationKey768 is the public key used to produce ciphertexts to be +// decapsulated by the corresponding DecapsulationKey768. +type EncapsulationKey768 struct { + key *mlkem.EncapsulationKey768 +} + +// NewEncapsulationKey768 parses an encapsulation key from its encoded form. If +// the encapsulation key is not valid, NewEncapsulationKey768 returns an error. +func NewEncapsulationKey768(encapsulationKey []byte) (*EncapsulationKey768, error) { + key, err := mlkem.NewEncapsulationKey768(encapsulationKey) + if err != nil { + return nil, err + } + + return &EncapsulationKey768{key}, nil +} + +// Bytes returns the encapsulation key as a byte slice. +func (ek *EncapsulationKey768) Bytes() []byte { + return ek.key.Bytes() +} + +// Encapsulate generates a shared key and an associated ciphertext from an +// encapsulation key, drawing random bytes from a secure source. +// +// The shared key must be kept secret. +// +// For testing, derandomized encapsulation is provided by the +// [crypto/mlkem/mlkemtest] package. +func (ek *EncapsulationKey768) Encapsulate() (sharedKey, ciphertext []byte) { + return ek.key.Encapsulate() +} + +// DecapsulationKey1024 is the secret key used to decapsulate a shared key +// from a ciphertext. It includes various precomputed values. +type DecapsulationKey1024 struct { + key *mlkem.DecapsulationKey1024 +} + +// GenerateKey1024 generates a new decapsulation key, drawing random bytes from +// a secure source. The decapsulation key must be kept secret. +func GenerateKey1024() (*DecapsulationKey1024, error) { + key, err := mlkem.GenerateKey1024() + if err != nil { + return nil, err + } + + return &DecapsulationKey1024{key}, nil +} + +// NewDecapsulationKey1024 expands a decapsulation key from a 64-byte seed in the +// "d || z" form. The seed must be uniformly random. +func NewDecapsulationKey1024(seed []byte) (*DecapsulationKey1024, error) { + key, err := mlkem.NewDecapsulationKey1024(seed) + if err != nil { + return nil, err + } + + return &DecapsulationKey1024{key}, nil +} + +// Bytes returns the decapsulation key as a 64-byte seed in the "d || z" form. +// +// The decapsulation key must be kept secret. +func (dk *DecapsulationKey1024) Bytes() []byte { + return dk.key.Bytes() +} + +// Decapsulate generates a shared key from a ciphertext and a decapsulation +// key. If the ciphertext is not valid, Decapsulate returns an error. +// +// The shared key must be kept secret. +func (dk *DecapsulationKey1024) Decapsulate(ciphertext []byte) (sharedKey []byte, err error) { + return dk.key.Decapsulate(ciphertext) +} + +// EncapsulationKey returns the public encapsulation key necessary to produce +// ciphertexts. +func (dk *DecapsulationKey1024) EncapsulationKey() *EncapsulationKey1024 { + return &EncapsulationKey1024{dk.key.EncapsulationKey()} +} + +// Encapsulator returns the encapsulation key, like +// [DecapsulationKey1024.EncapsulationKey]. +// +// It implements [crypto.Decapsulator]. +func (dk *DecapsulationKey1024) Encapsulator() crypto.Encapsulator { + return dk.EncapsulationKey() +} + +var _ crypto.Decapsulator = (*DecapsulationKey1024)(nil) + +// An EncapsulationKey1024 is the public key used to produce ciphertexts to be +// decapsulated by the corresponding DecapsulationKey1024. +type EncapsulationKey1024 struct { + key *mlkem.EncapsulationKey1024 +} + +// NewEncapsulationKey1024 parses an encapsulation key from its encoded form. If +// the encapsulation key is not valid, NewEncapsulationKey1024 returns an error. +func NewEncapsulationKey1024(encapsulationKey []byte) (*EncapsulationKey1024, error) { + key, err := mlkem.NewEncapsulationKey1024(encapsulationKey) + if err != nil { + return nil, err + } + + return &EncapsulationKey1024{key}, nil +} + +// Bytes returns the encapsulation key as a byte slice. +func (ek *EncapsulationKey1024) Bytes() []byte { + return ek.key.Bytes() +} + +// Encapsulate generates a shared key and an associated ciphertext from an +// encapsulation key, drawing random bytes from a secure source. +// +// The shared key must be kept secret. +// +// For testing, derandomized encapsulation is provided by the +// [crypto/mlkem/mlkemtest] package. +func (ek *EncapsulationKey1024) Encapsulate() (sharedKey, ciphertext []byte) { + return ek.key.Encapsulate() +} diff --git a/go/src/crypto/mlkem/mlkem_test.go b/go/src/crypto/mlkem/mlkem_test.go new file mode 100644 index 0000000000000000000000000000000000000000..922147ab15dec2d0502f38db4cd865e621e18d4e --- /dev/null +++ b/go/src/crypto/mlkem/mlkem_test.go @@ -0,0 +1,336 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package mlkem_test + +import ( + "bytes" + "crypto/internal/fips140/mlkem" + "crypto/internal/fips140/sha3" + . "crypto/mlkem" + "crypto/mlkem/mlkemtest" + "crypto/rand" + "encoding/hex" + "flag" + "testing" +) + +type encapsulationKey interface { + Bytes() []byte + Encapsulate() ([]byte, []byte) +} + +type decapsulationKey[E encapsulationKey] interface { + Bytes() []byte + Decapsulate([]byte) ([]byte, error) + EncapsulationKey() E +} + +func TestRoundTrip(t *testing.T) { + t.Run("768", func(t *testing.T) { + testRoundTrip(t, GenerateKey768, NewEncapsulationKey768, NewDecapsulationKey768) + }) + t.Run("1024", func(t *testing.T) { + testRoundTrip(t, GenerateKey1024, NewEncapsulationKey1024, NewDecapsulationKey1024) + }) +} + +func testRoundTrip[E encapsulationKey, D decapsulationKey[E]]( + t *testing.T, generateKey func() (D, error), + newEncapsulationKey func([]byte) (E, error), + newDecapsulationKey func([]byte) (D, error)) { + dk, err := generateKey() + if err != nil { + t.Fatal(err) + } + ek := dk.EncapsulationKey() + Ke, c := ek.Encapsulate() + Kd, err := dk.Decapsulate(c) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(Ke, Kd) { + t.Fail() + } + + ek1, err := newEncapsulationKey(ek.Bytes()) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(ek.Bytes(), ek1.Bytes()) { + t.Fail() + } + dk1, err := newDecapsulationKey(dk.Bytes()) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(dk.Bytes(), dk1.Bytes()) { + t.Fail() + } + Ke1, c1 := ek1.Encapsulate() + Kd1, err := dk1.Decapsulate(c1) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(Ke1, Kd1) { + t.Fail() + } + + dk2, err := generateKey() + if err != nil { + t.Fatal(err) + } + if bytes.Equal(dk.EncapsulationKey().Bytes(), dk2.EncapsulationKey().Bytes()) { + t.Fail() + } + if bytes.Equal(dk.Bytes(), dk2.Bytes()) { + t.Fail() + } + + Ke2, c2 := dk.EncapsulationKey().Encapsulate() + if bytes.Equal(c, c2) { + t.Fail() + } + if bytes.Equal(Ke, Ke2) { + t.Fail() + } +} + +func TestBadLengths(t *testing.T) { + t.Run("768", func(t *testing.T) { + testBadLengths(t, GenerateKey768, NewEncapsulationKey768, NewDecapsulationKey768) + }) + t.Run("1024", func(t *testing.T) { + testBadLengths(t, GenerateKey1024, NewEncapsulationKey1024, NewDecapsulationKey1024) + }) +} + +func testBadLengths[E encapsulationKey, D decapsulationKey[E]]( + t *testing.T, generateKey func() (D, error), + newEncapsulationKey func([]byte) (E, error), + newDecapsulationKey func([]byte) (D, error)) { + dk, err := generateKey() + dkBytes := dk.Bytes() + if err != nil { + t.Fatal(err) + } + ek := dk.EncapsulationKey() + ekBytes := dk.EncapsulationKey().Bytes() + _, c := ek.Encapsulate() + + for i := 0; i < len(dkBytes)-1; i++ { + if _, err := newDecapsulationKey(dkBytes[:i]); err == nil { + t.Errorf("expected error for dk length %d", i) + } + } + dkLong := dkBytes + for i := 0; i < 100; i++ { + dkLong = append(dkLong, 0) + if _, err := newDecapsulationKey(dkLong); err == nil { + t.Errorf("expected error for dk length %d", len(dkLong)) + } + } + + for i := 0; i < len(ekBytes)-1; i++ { + if _, err := newEncapsulationKey(ekBytes[:i]); err == nil { + t.Errorf("expected error for ek length %d", i) + } + } + ekLong := ekBytes + for i := 0; i < 100; i++ { + ekLong = append(ekLong, 0) + if _, err := newEncapsulationKey(ekLong); err == nil { + t.Errorf("expected error for ek length %d", len(ekLong)) + } + } + + for i := 0; i < len(c)-1; i++ { + if _, err := dk.Decapsulate(c[:i]); err == nil { + t.Errorf("expected error for c length %d", i) + } + } + cLong := c + for i := 0; i < 100; i++ { + cLong = append(cLong, 0) + if _, err := dk.Decapsulate(cLong); err == nil { + t.Errorf("expected error for c length %d", len(cLong)) + } + } +} + +var millionFlag = flag.Bool("million", false, "run the million vector test") + +// TestAccumulated accumulates 10k (or 100, or 1M) random vectors and checks the +// hash of the result, to avoid checking in 150MB of test vectors. +func TestAccumulated(t *testing.T) { + n := 10000 + expected := "8a518cc63da366322a8e7a818c7a0d63483cb3528d34a4cf42f35d5ad73f22fc" + if testing.Short() { + n = 100 + expected = "1114b1b6699ed191734fa339376afa7e285c9e6acf6ff0177d346696ce564415" + } + if *millionFlag { + n = 1000000 + expected = "424bf8f0e8ae99b78d788a6e2e8e9cdaf9773fc0c08a6f433507cb559edfd0f0" + } + + s := sha3.NewShake128() + o := sha3.NewShake128() + seed := make([]byte, SeedSize) + msg := make([]byte, 32) + ct1 := make([]byte, CiphertextSize768) + + for i := 0; i < n; i++ { + s.Read(seed) + dk, err := NewDecapsulationKey768(seed) + if err != nil { + t.Fatal(err) + } + ek := dk.EncapsulationKey() + o.Write(ek.Bytes()) + + s.Read(msg) + k, ct, err := mlkemtest.Encapsulate768(ek, msg) + if err != nil { + t.Fatal(err) + } + o.Write(ct) + o.Write(k) + + kk, err := dk.Decapsulate(ct) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(kk, k) { + t.Errorf("k: got %x, expected %x", kk, k) + } + + s.Read(ct1) + k1, err := dk.Decapsulate(ct1) + if err != nil { + t.Fatal(err) + } + o.Write(k1) + } + + got := hex.EncodeToString(o.Sum(nil)) + if got != expected { + t.Errorf("got %s, expected %s", got, expected) + } +} + +var sink byte + +func BenchmarkKeyGen(b *testing.B) { + var d, z [32]byte + rand.Read(d[:]) + rand.Read(z[:]) + b.ResetTimer() + for i := 0; i < b.N; i++ { + dk := mlkem.GenerateKeyInternal768(&d, &z) + sink ^= dk.EncapsulationKey().Bytes()[0] + } +} + +func BenchmarkEncaps(b *testing.B) { + seed := make([]byte, SeedSize) + rand.Read(seed) + dk, err := NewDecapsulationKey768(seed) + if err != nil { + b.Fatal(err) + } + ekBytes := dk.EncapsulationKey().Bytes() + b.ResetTimer() + for i := 0; i < b.N; i++ { + ek, err := NewEncapsulationKey768(ekBytes) + if err != nil { + b.Fatal(err) + } + K, c := ek.Encapsulate() + sink ^= c[0] ^ K[0] + } +} + +func BenchmarkDecaps(b *testing.B) { + dk, err := GenerateKey768() + if err != nil { + b.Fatal(err) + } + ek := dk.EncapsulationKey() + _, c := ek.Encapsulate() + b.ResetTimer() + for i := 0; i < b.N; i++ { + K, _ := dk.Decapsulate(c) + sink ^= K[0] + } +} + +func BenchmarkRoundTrip(b *testing.B) { + dk, err := GenerateKey768() + if err != nil { + b.Fatal(err) + } + ek := dk.EncapsulationKey() + ekBytes := ek.Bytes() + _, c := ek.Encapsulate() + if err != nil { + b.Fatal(err) + } + b.Run("Alice", func(b *testing.B) { + for i := 0; i < b.N; i++ { + dkS, err := GenerateKey768() + if err != nil { + b.Fatal(err) + } + ekS := dkS.EncapsulationKey().Bytes() + sink ^= ekS[0] + + Ks, err := dk.Decapsulate(c) + if err != nil { + b.Fatal(err) + } + sink ^= Ks[0] + } + }) + b.Run("Bob", func(b *testing.B) { + for i := 0; i < b.N; i++ { + ek, err := NewEncapsulationKey768(ekBytes) + if err != nil { + b.Fatal(err) + } + Ks, cS := ek.Encapsulate() + if err != nil { + b.Fatal(err) + } + sink ^= cS[0] ^ Ks[0] + } + }) +} + +// Test that the constants from the public API match the corresponding values from the internal API. +func TestConstantSizes(t *testing.T) { + if SharedKeySize != mlkem.SharedKeySize { + t.Errorf("SharedKeySize mismatch: got %d, want %d", SharedKeySize, mlkem.SharedKeySize) + } + + if SeedSize != mlkem.SeedSize { + t.Errorf("SeedSize mismatch: got %d, want %d", SeedSize, mlkem.SeedSize) + } + + if CiphertextSize768 != mlkem.CiphertextSize768 { + t.Errorf("CiphertextSize768 mismatch: got %d, want %d", CiphertextSize768, mlkem.CiphertextSize768) + } + + if EncapsulationKeySize768 != mlkem.EncapsulationKeySize768 { + t.Errorf("EncapsulationKeySize768 mismatch: got %d, want %d", EncapsulationKeySize768, mlkem.EncapsulationKeySize768) + } + + if CiphertextSize1024 != mlkem.CiphertextSize1024 { + t.Errorf("CiphertextSize1024 mismatch: got %d, want %d", CiphertextSize1024, mlkem.CiphertextSize1024) + } + + if EncapsulationKeySize1024 != mlkem.EncapsulationKeySize1024 { + t.Errorf("EncapsulationKeySize1024 mismatch: got %d, want %d", EncapsulationKeySize1024, mlkem.EncapsulationKeySize1024) + } +} diff --git a/go/src/crypto/pbkdf2/pbkdf2.go b/go/src/crypto/pbkdf2/pbkdf2.go new file mode 100644 index 0000000000000000000000000000000000000000..0bc14be888d9d6335f8230087473c938b3593817 --- /dev/null +++ b/go/src/crypto/pbkdf2/pbkdf2.go @@ -0,0 +1,54 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package pbkdf2 implements the key derivation function PBKDF2 as defined in +// RFC 8018 (PKCS #5 v2.1). +// +// A key derivation function is useful when encrypting data based on a password +// or any other not-fully-random data. It uses a pseudorandom function to derive +// a secure encryption key based on the password. +package pbkdf2 + +import ( + "crypto/internal/fips140/pbkdf2" + "crypto/internal/fips140hash" + "crypto/internal/fips140only" + "errors" + "hash" +) + +// Key derives a key from the password, salt and iteration count, returning a +// []byte of length keyLength that can be used as cryptographic key. The key is +// derived based on the method described as PBKDF2 with the HMAC variant using +// the supplied hash function. +// +// For example, to use a HMAC-SHA-1 based PBKDF2 key derivation function, you +// can get a derived key for e.g. AES-256 (which needs a 32-byte key) by +// doing: +// +// dk, err := pbkdf2.Key(sha1.New, "some password", salt, 4096, 32) +// +// Remember to get a good random salt. At least 8 bytes is recommended by the +// RFC. +// +// Using a higher iteration count will increase the cost of an exhaustive +// search but will also make derivation proportionally slower. +// +// keyLength must be a positive integer between 1 and (2^32 - 1) * h.Size(). +// Setting keyLength to a value outside of this range will result in an error. +func Key[Hash hash.Hash](h func() Hash, password string, salt []byte, iter, keyLength int) ([]byte, error) { + fh := fips140hash.UnwrapNew(h) + if fips140only.Enforced() { + if keyLength < 112/8 { + return nil, errors.New("crypto/pbkdf2: use of keys shorter than 112 bits is not allowed in FIPS 140-only mode") + } + if len(salt) < 128/8 { + return nil, errors.New("crypto/pbkdf2: use of salts shorter than 128 bits is not allowed in FIPS 140-only mode") + } + if !fips140only.ApprovedHash(fh()) { + return nil, errors.New("crypto/pbkdf2: use of hash functions other than SHA-2 or SHA-3 is not allowed in FIPS 140-only mode") + } + } + return pbkdf2.Key(fh, password, salt, iter, keyLength) +} diff --git a/go/src/crypto/pbkdf2/pbkdf2_test.go b/go/src/crypto/pbkdf2/pbkdf2_test.go new file mode 100644 index 0000000000000000000000000000000000000000..eb0ed14e243c6ba22e4de47cadc139f0c0ced177 --- /dev/null +++ b/go/src/crypto/pbkdf2/pbkdf2_test.go @@ -0,0 +1,253 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package pbkdf2_test + +import ( + "bytes" + "crypto/internal/boring" + "crypto/internal/fips140" + "crypto/pbkdf2" + "crypto/sha1" + "crypto/sha256" + "hash" + "testing" +) + +type testVector struct { + password string + salt string + iter int + output []byte +} + +// Test vectors from RFC 6070, http://tools.ietf.org/html/rfc6070 +var sha1TestVectors = []testVector{ + { + "password", + "salt", + 1, + []byte{ + 0x0c, 0x60, 0xc8, 0x0f, 0x96, 0x1f, 0x0e, 0x71, + 0xf3, 0xa9, 0xb5, 0x24, 0xaf, 0x60, 0x12, 0x06, + 0x2f, 0xe0, 0x37, 0xa6, + }, + }, + { + "password", + "salt", + 2, + []byte{ + 0xea, 0x6c, 0x01, 0x4d, 0xc7, 0x2d, 0x6f, 0x8c, + 0xcd, 0x1e, 0xd9, 0x2a, 0xce, 0x1d, 0x41, 0xf0, + 0xd8, 0xde, 0x89, 0x57, + }, + }, + { + "password", + "salt", + 4096, + []byte{ + 0x4b, 0x00, 0x79, 0x01, 0xb7, 0x65, 0x48, 0x9a, + 0xbe, 0xad, 0x49, 0xd9, 0x26, 0xf7, 0x21, 0xd0, + 0x65, 0xa4, 0x29, 0xc1, + }, + }, + // // This one takes too long + // { + // "password", + // "salt", + // 16777216, + // []byte{ + // 0xee, 0xfe, 0x3d, 0x61, 0xcd, 0x4d, 0xa4, 0xe4, + // 0xe9, 0x94, 0x5b, 0x3d, 0x6b, 0xa2, 0x15, 0x8c, + // 0x26, 0x34, 0xe9, 0x84, + // }, + // }, + { + "passwordPASSWORDpassword", + "saltSALTsaltSALTsaltSALTsaltSALTsalt", + 4096, + []byte{ + 0x3d, 0x2e, 0xec, 0x4f, 0xe4, 0x1c, 0x84, 0x9b, + 0x80, 0xc8, 0xd8, 0x36, 0x62, 0xc0, 0xe4, 0x4a, + 0x8b, 0x29, 0x1a, 0x96, 0x4c, 0xf2, 0xf0, 0x70, + 0x38, + }, + }, + { + "pass\000word", + "sa\000lt", + 4096, + []byte{ + 0x56, 0xfa, 0x6a, 0xa7, 0x55, 0x48, 0x09, 0x9d, + 0xcc, 0x37, 0xd7, 0xf0, 0x34, 0x25, 0xe0, 0xc3, + }, + }, +} + +// Test vectors from +// http://stackoverflow.com/questions/5130513/pbkdf2-hmac-sha2-test-vectors +var sha256TestVectors = []testVector{ + { + "password", + "salt", + 1, + []byte{ + 0x12, 0x0f, 0xb6, 0xcf, 0xfc, 0xf8, 0xb3, 0x2c, + 0x43, 0xe7, 0x22, 0x52, 0x56, 0xc4, 0xf8, 0x37, + 0xa8, 0x65, 0x48, 0xc9, + }, + }, + { + "password", + "salt", + 2, + []byte{ + 0xae, 0x4d, 0x0c, 0x95, 0xaf, 0x6b, 0x46, 0xd3, + 0x2d, 0x0a, 0xdf, 0xf9, 0x28, 0xf0, 0x6d, 0xd0, + 0x2a, 0x30, 0x3f, 0x8e, + }, + }, + { + "password", + "salt", + 4096, + []byte{ + 0xc5, 0xe4, 0x78, 0xd5, 0x92, 0x88, 0xc8, 0x41, + 0xaa, 0x53, 0x0d, 0xb6, 0x84, 0x5c, 0x4c, 0x8d, + 0x96, 0x28, 0x93, 0xa0, + }, + }, + { + "passwordPASSWORDpassword", + "saltSALTsaltSALTsaltSALTsaltSALTsalt", + 4096, + []byte{ + 0x34, 0x8c, 0x89, 0xdb, 0xcb, 0xd3, 0x2b, 0x2f, + 0x32, 0xd8, 0x14, 0xb8, 0x11, 0x6e, 0x84, 0xcf, + 0x2b, 0x17, 0x34, 0x7e, 0xbc, 0x18, 0x00, 0x18, + 0x1c, + }, + }, + { + "pass\000word", + "sa\000lt", + 4096, + []byte{ + 0x89, 0xb6, 0x9d, 0x05, 0x16, 0xf8, 0x29, 0x89, + 0x3c, 0x69, 0x62, 0x26, 0x65, 0x0a, 0x86, 0x87, + }, + }, +} + +func testHash(t *testing.T, h func() hash.Hash, hashName string, vectors []testVector) { + for i, v := range vectors { + o, err := pbkdf2.Key(h, v.password, []byte(v.salt), v.iter, len(v.output)) + if err != nil { + t.Error(err) + } + if !bytes.Equal(o, v.output) { + t.Errorf("%s %d: expected %x, got %x", hashName, i, v.output, o) + } + } +} + +func TestWithHMACSHA1(t *testing.T) { + testHash(t, sha1.New, "SHA1", sha1TestVectors) +} + +func TestWithHMACSHA256(t *testing.T) { + testHash(t, sha256.New, "SHA256", sha256TestVectors) +} + +var sink uint8 + +func benchmark(b *testing.B, h func() hash.Hash) { + var err error + password := make([]byte, h().Size()) + salt := make([]byte, 8) + for i := 0; i < b.N; i++ { + password, err = pbkdf2.Key(h, string(password), salt, 4096, len(password)) + if err != nil { + b.Error(err) + } + } + sink += password[0] +} + +func BenchmarkHMACSHA1(b *testing.B) { + benchmark(b, sha1.New) +} + +func BenchmarkHMACSHA256(b *testing.B) { + benchmark(b, sha256.New) +} + +func TestPBKDF2ServiceIndicator(t *testing.T) { + if boring.Enabled { + t.Skip("in BoringCrypto mode PBKDF2 is not from the Go FIPS module") + } + + goodSalt := []byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10} + + fips140.ResetServiceIndicator() + _, err := pbkdf2.Key(sha256.New, "password", goodSalt, 1, 32) + if err != nil { + t.Error(err) + } + if !fips140.ServiceIndicator() { + t.Error("FIPS service indicator should be set") + } + + // Salt too short + fips140.ResetServiceIndicator() + _, err = pbkdf2.Key(sha256.New, "password", goodSalt[:8], 1, 32) + if err != nil { + t.Error(err) + } + if fips140.ServiceIndicator() { + t.Error("FIPS service indicator should not be set") + } + + // Key length too short + fips140.ResetServiceIndicator() + _, err = pbkdf2.Key(sha256.New, "password", goodSalt, 1, 10) + if err != nil { + t.Error(err) + } + if fips140.ServiceIndicator() { + t.Error("FIPS service indicator should not be set") + } +} + +func TestMaxKeyLength(t *testing.T) { + // This error cannot be triggered on platforms where int is 31 bits (i.e. + // 32-bit platforms), since the max value for keyLength is 1<<31-1 and + // 1<<31-1 * hLen will always be less than 1<<32-1 * hLen. + keySize := int64(1<<63 - 1) + if int64(int(keySize)) != keySize { + t.Skip("cannot be replicated on platforms where int is 31 bits") + } + _, err := pbkdf2.Key(sha256.New, "password", []byte("salt"), 1, int(keySize)) + if err == nil { + t.Fatal("expected pbkdf2.Key to fail with extremely large keyLength") + } + keySize = int64(1<<32-1) * (sha256.Size + 1) + _, err = pbkdf2.Key(sha256.New, "password", []byte("salt"), 1, int(keySize)) + if err == nil { + t.Fatal("expected pbkdf2.Key to fail with extremely large keyLength") + } +} + +func TestZeroKeyLength(t *testing.T) { + _, err := pbkdf2.Key(sha256.New, "password", []byte("salt"), 1, 0) + if err == nil { + t.Fatal("expected pbkdf2.Key to fail with zero keyLength") + } + _, err = pbkdf2.Key(sha256.New, "password", []byte("salt"), 1, -1) + if err == nil { + t.Fatal("expected pbkdf2.Key to fail with negative keyLength") + } +} diff --git a/go/src/crypto/rand/example_test.go b/go/src/crypto/rand/example_test.go new file mode 100644 index 0000000000000000000000000000000000000000..cc074cceec518ce3e39f209e484d4f2613f3fde8 --- /dev/null +++ b/go/src/crypto/rand/example_test.go @@ -0,0 +1,41 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package rand_test + +import ( + "crypto/rand" + "fmt" + "math/big" +) + +// ExampleInt prints a single cryptographically secure pseudorandom number between 0 and 99 inclusive. +func ExampleInt() { + // Int cannot return an error when using rand.Reader. + a, _ := rand.Int(rand.Reader, big.NewInt(100)) + fmt.Println(a.Int64()) +} + +// ExamplePrime prints a cryptographically secure pseudorandom 64 bit prime number. +func ExamplePrime() { + // Prime cannot return an error when using rand.Reader and bits >= 2. + a, _ := rand.Prime(rand.Reader, 64) + fmt.Println(a.Int64()) +} + +// ExampleRead prints a cryptographically secure pseudorandom 32 byte key. +func ExampleRead() { + // Note that no error handling is necessary, as Read always succeeds. + key := make([]byte, 32) + rand.Read(key) + // The key can contain any byte value, print the key in hex. + fmt.Printf("% x\n", key) +} + +// ExampleText prints a random key encoded in base32. +func ExampleText() { + key := rand.Text() + // The key is base32 and safe to display. + fmt.Println(key) +} diff --git a/go/src/crypto/rand/rand.go b/go/src/crypto/rand/rand.go new file mode 100644 index 0000000000000000000000000000000000000000..018fe013cef6005780026fb9cb6bc4fbde3d3cc5 --- /dev/null +++ b/go/src/crypto/rand/rand.go @@ -0,0 +1,68 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package rand implements a cryptographically secure +// random number generator. +package rand + +import ( + "crypto/internal/boring" + "crypto/internal/fips140/drbg" + "crypto/internal/rand" + "io" + _ "unsafe" + + // Ensure the go:linkname from testing/cryptotest to + // crypto/internal/rand.SetTestingReader works. + _ "crypto/internal/rand" +) + +// Reader is a global, shared instance of a cryptographically +// secure random number generator. It is safe for concurrent use. +// +// - On Linux, FreeBSD, Dragonfly, and Solaris, Reader uses getrandom(2). +// - On legacy Linux (< 3.17), Reader opens /dev/urandom on first use. +// - On macOS, iOS, and OpenBSD Reader, uses arc4random_buf(3). +// - On NetBSD, Reader uses the kern.arandom sysctl. +// - On Windows, Reader uses the ProcessPrng API. +// - On js/wasm, Reader uses the Web Crypto API. +// - On wasip1/wasm, Reader uses random_get. +// +// In FIPS 140-3 mode, the output passes through an SP 800-90A Rev. 1 +// Deterministric Random Bit Generator (DRBG). +var Reader io.Reader = rand.Reader + +// fatal is [runtime.fatal], pushed via linkname. +// +//go:linkname fatal +func fatal(string) + +// Read fills b with cryptographically secure random bytes. It never returns an +// error, and always fills b entirely. +// +// Read calls [io.ReadFull] on [Reader] and crashes the program irrecoverably if +// an error is returned. The default Reader uses operating system APIs that are +// documented to never return an error on all but legacy Linux systems. +func Read(b []byte) (n int, err error) { + // We don't want b to escape to the heap, but escape analysis can't see + // through a potentially overridden Reader, so we special-case the default + // case which we can keep non-escaping, and in the general case we read into + // a heap buffer and copy from it. + if rand.IsDefaultReader(Reader) { + if boring.Enabled { + _, err = io.ReadFull(boring.RandReader, b) + } else { + drbg.Read(b) + } + } else { + bb := make([]byte, len(b)) + _, err = io.ReadFull(Reader, bb) + copy(b, bb) + } + if err != nil { + fatal("crypto/rand: failed to read random data (see https://go.dev/issue/66821): " + err.Error()) + panic("unreachable") // To be sure. + } + return len(b), nil +} diff --git a/go/src/crypto/rand/rand_test.go b/go/src/crypto/rand/rand_test.go new file mode 100644 index 0000000000000000000000000000000000000000..3bb3d5f1acda25ccf123ffa0990782cc8f6e513d --- /dev/null +++ b/go/src/crypto/rand/rand_test.go @@ -0,0 +1,215 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package rand + +import ( + "bytes" + "compress/flate" + "crypto/internal/cryptotest" + "errors" + "internal/testenv" + "io" + "os" + "sync" + "testing" +) + +// These tests are mostly duplicates of the tests in crypto/internal/sysrand, +// and testing both the Reader and Read is pretty redundant when one calls the +// other, but better safe than sorry. + +func testReadAndReader(t *testing.T, f func(*testing.T, func([]byte) (int, error))) { + t.Run("Read", func(t *testing.T) { + f(t, Read) + }) + t.Run("Reader.Read", func(t *testing.T) { + f(t, Reader.Read) + }) +} + +func TestRead(t *testing.T) { + testReadAndReader(t, testRead) +} + +func testRead(t *testing.T, Read func([]byte) (int, error)) { + var n int = 4e6 + if testing.Short() { + n = 1e5 + } + b := make([]byte, n) + n, err := Read(b) + if n != len(b) || err != nil { + t.Fatalf("Read(buf) = %d, %s", n, err) + } + + var z bytes.Buffer + f, _ := flate.NewWriter(&z, 5) + f.Write(b) + f.Close() + if z.Len() < len(b)*99/100 { + t.Fatalf("Compressed %d -> %d", len(b), z.Len()) + } +} + +func TestReadByteValues(t *testing.T) { + testReadAndReader(t, testReadByteValues) +} + +func testReadByteValues(t *testing.T, Read func([]byte) (int, error)) { + b := make([]byte, 1) + v := make(map[byte]bool) + for { + n, err := Read(b) + if n != 1 || err != nil { + t.Fatalf("Read(b) = %d, %v", n, err) + } + v[b[0]] = true + if len(v) == 256 { + break + } + } +} + +func TestLargeRead(t *testing.T) { + testReadAndReader(t, testLargeRead) +} + +func testLargeRead(t *testing.T, Read func([]byte) (int, error)) { + // 40MiB, more than the documented maximum of 32Mi-1 on Linux 32-bit. + b := make([]byte, 40<<20) + if n, err := Read(b); err != nil { + t.Fatal(err) + } else if n != len(b) { + t.Fatalf("Read(b) = %d, want %d", n, len(b)) + } +} + +func TestReadEmpty(t *testing.T) { + testReadAndReader(t, testReadEmpty) +} + +func testReadEmpty(t *testing.T, Read func([]byte) (int, error)) { + n, err := Read(make([]byte, 0)) + if n != 0 || err != nil { + t.Fatalf("Read(make([]byte, 0)) = %d, %v", n, err) + } + n, err = Read(nil) + if n != 0 || err != nil { + t.Fatalf("Read(nil) = %d, %v", n, err) + } +} + +type readerFunc func([]byte) (int, error) + +func (f readerFunc) Read(b []byte) (int, error) { + return f(b) +} + +func TestReadUsesReader(t *testing.T) { + var called bool + defer func(r io.Reader) { Reader = r }(Reader) + Reader = readerFunc(func(b []byte) (int, error) { + called = true + return len(b), nil + }) + n, err := Read(make([]byte, 32)) + if n != 32 || err != nil { + t.Fatalf("Read(make([]byte, 32)) = %d, %v", n, err) + } + if !called { + t.Error("Read did not use Reader") + } +} + +func TestConcurrentRead(t *testing.T) { + testReadAndReader(t, testConcurrentRead) +} + +func testConcurrentRead(t *testing.T, Read func([]byte) (int, error)) { + if testing.Short() { + t.Skip("skipping in short mode") + } + const N = 100 + const M = 1000 + var wg sync.WaitGroup + wg.Add(N) + for i := 0; i < N; i++ { + go func() { + defer wg.Done() + for i := 0; i < M; i++ { + b := make([]byte, 32) + n, err := Read(b) + if n != 32 || err != nil { + t.Errorf("Read = %d, %v", n, err) + } + } + }() + } + wg.Wait() +} + +var sink byte + +func TestAllocations(t *testing.T) { + cryptotest.SkipTestAllocations(t) + n := int(testing.AllocsPerRun(10, func() { + buf := make([]byte, 32) + Read(buf) + sink ^= buf[0] + })) + if n > 0 { + t.Errorf("allocs = %d, want 0", n) + } +} + +func TestReadError(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode") + } + + // We run this test in a subprocess because it's expected to crash. + if os.Getenv("GO_TEST_READ_ERROR") == "1" { + defer func(r io.Reader) { Reader = r }(Reader) + Reader = readerFunc(func([]byte) (int, error) { + return 0, errors.New("error") + }) + Read(make([]byte, 32)) + t.Error("Read did not crash") + return + } + + cmd := testenv.Command(t, testenv.Executable(t), "-test.run=^TestReadError$", "-test.v") + cmd.Env = append(os.Environ(), "GO_TEST_READ_ERROR=1") + out, err := cmd.CombinedOutput() + if err == nil { + t.Error("subprocess succeeded unexpectedly") + } + exp := "fatal error: crypto/rand: failed to read random data" + if !bytes.Contains(out, []byte(exp)) { + t.Errorf("subprocess output does not contain %q: %s", exp, out) + } +} + +func BenchmarkRead(b *testing.B) { + b.Run("4", func(b *testing.B) { + benchmarkRead(b, 4) + }) + b.Run("32", func(b *testing.B) { + benchmarkRead(b, 32) + }) + b.Run("4K", func(b *testing.B) { + benchmarkRead(b, 4<<10) + }) +} + +func benchmarkRead(b *testing.B, size int) { + b.SetBytes(int64(size)) + buf := make([]byte, size) + for i := 0; i < b.N; i++ { + if _, err := Read(buf); err != nil { + b.Fatal(err) + } + } +} diff --git a/go/src/crypto/rand/text.go b/go/src/crypto/rand/text.go new file mode 100644 index 0000000000000000000000000000000000000000..176326dd96af8d0c813a638955396e314d8fb493 --- /dev/null +++ b/go/src/crypto/rand/text.go @@ -0,0 +1,22 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package rand + +const base32alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567" + +// Text returns a cryptographically random string using the standard RFC 4648 base32 alphabet +// for use when a secret string, token, password, or other text is needed. +// The result contains at least 128 bits of randomness, enough to prevent brute force +// guessing attacks and to make the likelihood of collisions vanishingly small. +// A future version may return longer texts as needed to maintain those properties. +func Text() string { + // ⌈log₃₂ 2¹²⁸⌉ = 26 chars + src := make([]byte, 26) + Read(src) + for i := range src { + src[i] = base32alphabet[src[i]%32] + } + return string(src) +} diff --git a/go/src/crypto/rand/text_test.go b/go/src/crypto/rand/text_test.go new file mode 100644 index 0000000000000000000000000000000000000000..062f6a9870c67c1a4fbbc96cc1804496eb652c76 --- /dev/null +++ b/go/src/crypto/rand/text_test.go @@ -0,0 +1,71 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package rand_test + +import ( + "crypto/rand" + "fmt" + "testing" +) + +func TestText(t *testing.T) { + set := make(map[string]struct{}) // hold every string produced + var indexSet [26]map[rune]int // hold every char produced at every position + for i := range indexSet { + indexSet[i] = make(map[rune]int) + } + + // not getting a char in a position: (31/32)¹⁰⁰⁰ = 1.6e-14 + // test completion within 1000 rounds: (1-(31/32)¹⁰⁰⁰)²⁶ = 0.9999999999996 + // empirically, this should complete within 400 rounds = 0.999921 + rounds := 1000 + var done bool + for range rounds { + s := rand.Text() + if len(s) != 26 { + t.Errorf("len(Text()) = %d, want = 26", len(s)) + } + for i, r := range s { + if ('A' > r || r > 'Z') && ('2' > r || r > '7') { + t.Errorf("Text()[%d] = %v, outside of base32 alphabet", i, r) + } + } + if _, ok := set[s]; ok { + t.Errorf("Text() = %s, duplicate of previously produced string", s) + } + set[s] = struct{}{} + + done = true + for i, r := range s { + indexSet[i][r]++ + if len(indexSet[i]) != 32 { + done = false + } + } + if done { + break + } + } + if !done { + t.Errorf("failed to produce every char at every index after %d rounds", rounds) + indexSetTable(t, indexSet) + } +} + +func indexSetTable(t *testing.T, indexSet [26]map[rune]int) { + alphabet := "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567" + line := " " + for _, r := range alphabet { + line += fmt.Sprintf(" %3s", string(r)) + } + t.Log(line) + for i, set := range indexSet { + line = fmt.Sprintf("%2d:", i) + for _, r := range alphabet { + line += fmt.Sprintf(" %3d", set[r]) + } + t.Log(line) + } +} diff --git a/go/src/crypto/rand/util.go b/go/src/crypto/rand/util.go new file mode 100644 index 0000000000000000000000000000000000000000..7cb9b47b4a658115500daee6658a0646c1b6ba74 --- /dev/null +++ b/go/src/crypto/rand/util.go @@ -0,0 +1,108 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package rand + +import ( + "crypto/internal/fips140only" + "crypto/internal/rand" + "errors" + "io" + "math/big" +) + +// Prime returns a number of the given bit length that is prime with high probability. +// Prime will return error for any error returned by rand.Read or if bits < 2. +// +// Since Go 1.26, a secure source of random bytes is always used, and the Reader is +// ignored unless GODEBUG=cryptocustomrand=1 is set. This setting will be removed +// in a future Go release. Instead, use [testing/cryptotest.SetGlobalRandom]. +func Prime(r io.Reader, bits int) (*big.Int, error) { + if fips140only.Enforced() { + return nil, errors.New("crypto/rand: use of Prime is not allowed in FIPS 140-only mode") + } + if bits < 2 { + return nil, errors.New("crypto/rand: prime size must be at least 2-bit") + } + + r = rand.CustomReader(r) + + b := uint(bits % 8) + if b == 0 { + b = 8 + } + + bytes := make([]byte, (bits+7)/8) + p := new(big.Int) + + for { + if _, err := io.ReadFull(r, bytes); err != nil { + return nil, err + } + + // Clear bits in the first byte to make sure the candidate has a size <= bits. + bytes[0] &= uint8(int(1<= 2 { + bytes[0] |= 3 << (b - 2) + } else { + // Here b==1, because b cannot be zero. + bytes[0] |= 1 + if len(bytes) > 1 { + bytes[1] |= 0x80 + } + } + // Make the value odd since an even number this large certainly isn't prime. + bytes[len(bytes)-1] |= 1 + + p.SetBytes(bytes) + if p.ProbablyPrime(20) { + return p, nil + } + } +} + +// Int returns a uniform random value in [0, max). It panics if max <= 0, and +// returns an error if rand.Read returns one. +func Int(rand io.Reader, max *big.Int) (n *big.Int, err error) { + if max.Sign() <= 0 { + panic("crypto/rand: argument to Int is <= 0") + } + n = new(big.Int) + n.Sub(max, n.SetUint64(1)) + // bitLen is the maximum bit length needed to encode a value < max. + bitLen := n.BitLen() + if bitLen == 0 { + // the only valid result is 0 + return + } + // k is the maximum byte length needed to encode a value < max. + k := (bitLen + 7) / 8 + // b is the number of bits in the most significant byte of max-1. + b := uint(bitLen % 8) + if b == 0 { + b = 8 + } + + bytes := make([]byte, k) + + for { + _, err = io.ReadFull(rand, bytes) + if err != nil { + return nil, err + } + + // Clear bits in the first byte to increase the probability + // that the candidate is < max. + bytes[0] &= uint8(int(1< 256 { + return nil, KeySizeError(k) + } + var c Cipher + for i := 0; i < 256; i++ { + c.s[i] = uint32(i) + } + var j uint8 = 0 + for i := 0; i < 256; i++ { + j += uint8(c.s[i]) + key[i%k] + c.s[i], c.s[j] = c.s[j], c.s[i] + } + return &c, nil +} + +// Reset zeros the key data and makes the [Cipher] unusable. +// +// Deprecated: Reset can't guarantee that the key will be entirely removed from +// the process's memory. +func (c *Cipher) Reset() { + clear(c.s[:]) + c.i, c.j = 0, 0 +} + +// XORKeyStream sets dst to the result of XORing src with the key stream. +// Dst and src must overlap entirely or not at all. +func (c *Cipher) XORKeyStream(dst, src []byte) { + if len(src) == 0 { + return + } + if alias.InexactOverlap(dst[:len(src)], src) { + panic("crypto/rc4: invalid buffer overlap") + } + i, j := c.i, c.j + _ = dst[len(src)-1] + dst = dst[:len(src)] // eliminate bounds check from loop + for k, v := range src { + i += 1 + x := c.s[i] + j += uint8(x) + y := c.s[j] + c.s[i], c.s[j] = y, x + dst[k] = v ^ uint8(c.s[uint8(x+y)]) + } + c.i, c.j = i, j +} diff --git a/go/src/crypto/rc4/rc4_test.go b/go/src/crypto/rc4/rc4_test.go new file mode 100644 index 0000000000000000000000000000000000000000..f092f4f26591e6cf887a7d3dbd4d8432a48713d9 --- /dev/null +++ b/go/src/crypto/rc4/rc4_test.go @@ -0,0 +1,171 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package rc4 + +import ( + "bytes" + "crypto/cipher" + "crypto/internal/cryptotest" + "fmt" + "testing" +) + +type rc4Test struct { + key, keystream []byte +} + +var golden = []rc4Test{ + // Test vectors from the original cypherpunk posting of ARC4: + // https://groups.google.com/group/sci.crypt/msg/10a300c9d21afca0?pli=1 + { + []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, + []byte{0x74, 0x94, 0xc2, 0xe7, 0x10, 0x4b, 0x08, 0x79}, + }, + { + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a}, + }, + { + []byte{0xef, 0x01, 0x23, 0x45}, + []byte{0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf, 0xbd, 0x61}, + }, + + // Test vectors from the Wikipedia page: https://en.wikipedia.org/wiki/RC4 + { + []byte{0x4b, 0x65, 0x79}, + []byte{0xeb, 0x9f, 0x77, 0x81, 0xb7, 0x34, 0xca, 0x72, 0xa7, 0x19}, + }, + { + []byte{0x57, 0x69, 0x6b, 0x69}, + []byte{0x60, 0x44, 0xdb, 0x6d, 0x41, 0xb7}, + }, + { + []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + []byte{ + 0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a, + 0x8a, 0x06, 0x1e, 0x67, 0x57, 0x6e, 0x92, 0x6d, + 0xc7, 0x1a, 0x7f, 0xa3, 0xf0, 0xcc, 0xeb, 0x97, + 0x45, 0x2b, 0x4d, 0x32, 0x27, 0x96, 0x5f, 0x9e, + 0xa8, 0xcc, 0x75, 0x07, 0x6d, 0x9f, 0xb9, 0xc5, + 0x41, 0x7a, 0xa5, 0xcb, 0x30, 0xfc, 0x22, 0x19, + 0x8b, 0x34, 0x98, 0x2d, 0xbb, 0x62, 0x9e, 0xc0, + 0x4b, 0x4f, 0x8b, 0x05, 0xa0, 0x71, 0x08, 0x50, + 0x92, 0xa0, 0xc3, 0x58, 0x4a, 0x48, 0xe4, 0xa3, + 0x0a, 0x39, 0x7b, 0x8a, 0xcd, 0x1d, 0x00, 0x9e, + 0xc8, 0x7d, 0x68, 0x11, 0xf2, 0x2c, 0xf4, 0x9c, + 0xa3, 0xe5, 0x93, 0x54, 0xb9, 0x45, 0x15, 0x35, + 0xa2, 0x18, 0x7a, 0x86, 0x42, 0x6c, 0xca, 0x7d, + 0x5e, 0x82, 0x3e, 0xba, 0x00, 0x44, 0x12, 0x67, + 0x12, 0x57, 0xb8, 0xd8, 0x60, 0xae, 0x4c, 0xbd, + 0x4c, 0x49, 0x06, 0xbb, 0xc5, 0x35, 0xef, 0xe1, + 0x58, 0x7f, 0x08, 0xdb, 0x33, 0x95, 0x5c, 0xdb, + 0xcb, 0xad, 0x9b, 0x10, 0xf5, 0x3f, 0xc4, 0xe5, + 0x2c, 0x59, 0x15, 0x65, 0x51, 0x84, 0x87, 0xfe, + 0x08, 0x4d, 0x0e, 0x3f, 0x03, 0xde, 0xbc, 0xc9, + 0xda, 0x1c, 0xe9, 0x0d, 0x08, 0x5c, 0x2d, 0x8a, + 0x19, 0xd8, 0x37, 0x30, 0x86, 0x16, 0x36, 0x92, + 0x14, 0x2b, 0xd8, 0xfc, 0x5d, 0x7a, 0x73, 0x49, + 0x6a, 0x8e, 0x59, 0xee, 0x7e, 0xcf, 0x6b, 0x94, + 0x06, 0x63, 0xf4, 0xa6, 0xbe, 0xe6, 0x5b, 0xd2, + 0xc8, 0x5c, 0x46, 0x98, 0x6c, 0x1b, 0xef, 0x34, + 0x90, 0xd3, 0x7b, 0x38, 0xda, 0x85, 0xd3, 0x2e, + 0x97, 0x39, 0xcb, 0x23, 0x4a, 0x2b, 0xe7, 0x40, + }, + }, +} + +func testEncrypt(t *testing.T, desc string, c *Cipher, src, expect []byte) { + dst := make([]byte, len(src)) + c.XORKeyStream(dst, src) + for i, v := range dst { + if v != expect[i] { + t.Fatalf("%s: mismatch at byte %d:\nhave %x\nwant %x", desc, i, dst, expect) + } + } +} + +func TestGolden(t *testing.T) { + for gi, g := range golden { + data := make([]byte, len(g.keystream)) + for i := range data { + data[i] = byte(i) + } + + expect := make([]byte, len(g.keystream)) + for i := range expect { + expect[i] = byte(i) ^ g.keystream[i] + } + + for size := 1; size <= len(g.keystream); size++ { + c, err := NewCipher(g.key) + if err != nil { + t.Fatalf("#%d: NewCipher: %v", gi, err) + } + + off := 0 + for off < len(g.keystream) { + n := len(g.keystream) - off + if n > size { + n = size + } + desc := fmt.Sprintf("#%d@[%d:%d]", gi, off, off+n) + testEncrypt(t, desc, c, data[off:off+n], expect[off:off+n]) + off += n + } + } + } +} + +func TestBlock(t *testing.T) { + c1a, _ := NewCipher(golden[0].key) + c1b, _ := NewCipher(golden[1].key) + data1 := make([]byte, 1<<20) + for i := range data1 { + c1a.XORKeyStream(data1[i:i+1], data1[i:i+1]) + c1b.XORKeyStream(data1[i:i+1], data1[i:i+1]) + } + + c2a, _ := NewCipher(golden[0].key) + c2b, _ := NewCipher(golden[1].key) + data2 := make([]byte, 1<<20) + c2a.XORKeyStream(data2, data2) + c2b.XORKeyStream(data2, data2) + + if !bytes.Equal(data1, data2) { + t.Fatalf("bad block") + } +} + +func TestRC4Stream(t *testing.T) { + cryptotest.TestStream(t, func() cipher.Stream { + c, _ := NewCipher(golden[0].key) + return c + }) +} + +func benchmark(b *testing.B, size int64) { + buf := make([]byte, size) + c, err := NewCipher(golden[0].key) + if err != nil { + panic(err) + } + b.SetBytes(size) + + for i := 0; i < b.N; i++ { + c.XORKeyStream(buf, buf) + } +} + +func BenchmarkRC4_128(b *testing.B) { + benchmark(b, 128) +} + +func BenchmarkRC4_1K(b *testing.B) { + benchmark(b, 1024) +} + +func BenchmarkRC4_8K(b *testing.B) { + benchmark(b, 8096) +} diff --git a/go/src/crypto/rsa/boring.go b/go/src/crypto/rsa/boring.go new file mode 100644 index 0000000000000000000000000000000000000000..b9f9d3154f2589e04fcf6592511e1d55f371051e --- /dev/null +++ b/go/src/crypto/rsa/boring.go @@ -0,0 +1,130 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build boringcrypto + +package rsa + +import ( + "crypto/internal/boring" + "crypto/internal/boring/bbig" + "crypto/internal/boring/bcache" + "math/big" +) + +// Cached conversions from Go PublicKey/PrivateKey to BoringCrypto. +// +// The first operation on a PublicKey or PrivateKey makes a parallel +// BoringCrypto key and saves it in pubCache or privCache. +// +// We could just assume that once used in a sign/verify/encrypt/decrypt operation, +// a particular key is never again modified, but that has not been a +// stated assumption before. Just in case there is any existing code that +// does modify the key between operations, we save the original values +// alongside the cached BoringCrypto key and check that the real key +// still matches before using the cached key. The theory is that the real +// operations are significantly more expensive than the comparison. + +type boringPub struct { + key *boring.PublicKeyRSA + orig PublicKey +} + +var pubCache bcache.Cache[PublicKey, boringPub] +var privCache bcache.Cache[PrivateKey, boringPriv] + +func init() { + pubCache.Register() + privCache.Register() +} + +func boringPublicKey(pub *PublicKey) (*boring.PublicKeyRSA, error) { + b := pubCache.Get(pub) + if b != nil && publicKeyEqual(&b.orig, pub) { + return b.key, nil + } + + b = new(boringPub) + b.orig = copyPublicKey(pub) + key, err := boring.NewPublicKeyRSA(bbig.Enc(b.orig.N), bbig.Enc(big.NewInt(int64(b.orig.E)))) + if err != nil { + return nil, err + } + b.key = key + pubCache.Put(pub, b) + return key, nil +} + +type boringPriv struct { + key *boring.PrivateKeyRSA + orig PrivateKey +} + +func boringPrivateKey(priv *PrivateKey) (*boring.PrivateKeyRSA, error) { + b := privCache.Get(priv) + if b != nil && privateKeyEqual(&b.orig, priv) { + return b.key, nil + } + + b = new(boringPriv) + b.orig = copyPrivateKey(priv) + + var N, E, D, P, Q, Dp, Dq, Qinv *big.Int + N = b.orig.N + E = big.NewInt(int64(b.orig.E)) + D = b.orig.D + if len(b.orig.Primes) == 2 { + P = b.orig.Primes[0] + Q = b.orig.Primes[1] + Dp = b.orig.Precomputed.Dp + Dq = b.orig.Precomputed.Dq + Qinv = b.orig.Precomputed.Qinv + } + key, err := boring.NewPrivateKeyRSA(bbig.Enc(N), bbig.Enc(E), bbig.Enc(D), bbig.Enc(P), bbig.Enc(Q), bbig.Enc(Dp), bbig.Enc(Dq), bbig.Enc(Qinv)) + if err != nil { + return nil, err + } + b.key = key + privCache.Put(priv, b) + return key, nil +} + +func publicKeyEqual(k1, k2 *PublicKey) bool { + return k1.N != nil && + k1.N.Cmp(k2.N) == 0 && + k1.E == k2.E +} + +func copyPublicKey(k *PublicKey) PublicKey { + return PublicKey{ + N: new(big.Int).Set(k.N), + E: k.E, + } +} + +func privateKeyEqual(k1, k2 *PrivateKey) bool { + return publicKeyEqual(&k1.PublicKey, &k2.PublicKey) && + k1.D.Cmp(k2.D) == 0 +} + +func copyPrivateKey(k *PrivateKey) PrivateKey { + dst := PrivateKey{ + PublicKey: copyPublicKey(&k.PublicKey), + D: new(big.Int).Set(k.D), + } + dst.Primes = make([]*big.Int, len(k.Primes)) + for i, p := range k.Primes { + dst.Primes[i] = new(big.Int).Set(p) + } + if x := k.Precomputed.Dp; x != nil { + dst.Precomputed.Dp = new(big.Int).Set(x) + } + if x := k.Precomputed.Dq; x != nil { + dst.Precomputed.Dq = new(big.Int).Set(x) + } + if x := k.Precomputed.Qinv; x != nil { + dst.Precomputed.Qinv = new(big.Int).Set(x) + } + return dst +} diff --git a/go/src/crypto/rsa/boring_test.go b/go/src/crypto/rsa/boring_test.go new file mode 100644 index 0000000000000000000000000000000000000000..838fcc1244bdbe71909ce28881f7eb6ff63dd1fc --- /dev/null +++ b/go/src/crypto/rsa/boring_test.go @@ -0,0 +1,150 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build boringcrypto + +// Note: Can run these tests against the non-BoringCrypto +// version of the code by using "CGO_ENABLED=0 go test". + +package rsa + +import ( + "crypto" + "crypto/rand" + "encoding/asn1" + "encoding/hex" + "math/big" + "runtime" + "runtime/debug" + "sync" + "testing" +) + +func TestBoringASN1Marshal(t *testing.T) { + t.Setenv("GODEBUG", "rsa1024min=0") + + k, err := GenerateKey(rand.Reader, 128) + if err != nil { + t.Fatal(err) + } + _, err = asn1.Marshal(k.PublicKey) + if err != nil { + t.Fatal(err) + } +} + +func TestBoringVerify(t *testing.T) { + // Check that signatures that lack leading zeroes don't verify. + key := &PublicKey{ + N: bigFromHex("c4fdf7b40a5477f206e6ee278eaef888ca73bf9128a9eef9f2f1ddb8b7b71a4c07cfa241f028a04edb405e4d916c61d6beabc333813dc7b484d2b3c52ee233c6a79b1eea4e9cc51596ba9cd5ac5aeb9df62d86ea051055b79d03f8a4fa9f38386f5bd17529138f3325d46801514ea9047977e0829ed728e68636802796801be1"), + E: 65537, + } + + hash := fromHex("019c5571724fb5d0e47a4260c940e9803ba05a44") + paddedHash := fromHex("3021300906052b0e03021a05000414019c5571724fb5d0e47a4260c940e9803ba05a44") + + // signature is one byte shorter than key.N. + sig := fromHex("5edfbeb6a73e7225ad3cc52724e2872e04260d7daf0d693c170d8c4b243b8767bc7785763533febc62ec2600c30603c433c095453ede59ff2fcabeb84ce32e0ed9d5cf15ffcbc816202b64370d4d77c1e9077d74e94a16fb4fa2e5bec23a56d7a73cf275f91691ae1801a976fcde09e981a2f6327ac27ea1fecf3185df0d56") + + err := VerifyPKCS1v15(key, 0, paddedHash, sig) + if err == nil { + t.Errorf("raw: expected verification error") + } + + err = VerifyPKCS1v15(key, crypto.SHA1, hash, sig) + if err == nil { + t.Errorf("sha1: expected verification error") + } +} + +func BenchmarkBoringVerify(b *testing.B) { + // Check that signatures that lack leading zeroes don't verify. + key := &PublicKey{ + N: bigFromHex("c4fdf7b40a5477f206e6ee278eaef888ca73bf9128a9eef9f2f1ddb8b7b71a4c07cfa241f028a04edb405e4d916c61d6beabc333813dc7b484d2b3c52ee233c6a79b1eea4e9cc51596ba9cd5ac5aeb9df62d86ea051055b79d03f8a4fa9f38386f5bd17529138f3325d46801514ea9047977e0829ed728e68636802796801be1"), + E: 65537, + } + + hash := fromHex("019c5571724fb5d0e47a4260c940e9803ba05a44") + + // signature is one byte shorter than key.N. + sig := fromHex("5edfbeb6a73e7225ad3cc52724e2872e04260d7daf0d693c170d8c4b243b8767bc7785763533febc62ec2600c30603c433c095453ede59ff2fcabeb84ce32e0ed9d5cf15ffcbc816202b64370d4d77c1e9077d74e94a16fb4fa2e5bec23a56d7a73cf275f91691ae1801a976fcde09e981a2f6327ac27ea1fecf3185df0d56") + + b.ReportAllocs() + + for i := 0; i < b.N; i++ { + err := VerifyPKCS1v15(key, crypto.SHA1, hash, sig) + if err == nil { + b.Fatalf("sha1: expected verification error") + } + } +} + +func TestBoringGenerateKey(t *testing.T) { + k, err := GenerateKey(rand.Reader, 2048) // 2048 is smallest size BoringCrypto might kick in for + if err != nil { + t.Fatal(err) + } + + // Non-Boring GenerateKey always sets CRTValues to a non-nil (possibly empty) slice. + if k.Precomputed.CRTValues == nil { + t.Fatalf("GenerateKey: Precomputed.CRTValues = nil") + } +} + +func TestBoringFinalizers(t *testing.T) { + if runtime.GOOS == "nacl" || runtime.GOOS == "js" { + // Times out on nacl and js/wasm (without BoringCrypto) + // but not clear why - probably consuming rand.Reader too quickly + // and being throttled. Also doesn't really matter. + t.Skipf("skipping on %s/%s", runtime.GOOS, runtime.GOARCH) + } + + k, err := GenerateKey(rand.Reader, 2048) + if err != nil { + t.Fatal(err) + } + + // Run test with GOGC=10, to make bug more likely. + // Without the KeepAlives, the loop usually dies after + // about 30 iterations. + defer debug.SetGCPercent(debug.SetGCPercent(10)) + for n := 0; n < 200; n++ { + // Clear the underlying BoringCrypto object cache. + privCache.Clear() + + // Race to create the underlying BoringCrypto object. + // The ones that lose the race are prime candidates for + // being GC'ed too early if the finalizers are not being + // used correctly. + var wg sync.WaitGroup + for i := 0; i < 10; i++ { + wg.Add(1) + go func() { + defer wg.Done() + sum := make([]byte, 32) + _, err := SignPKCS1v15(rand.Reader, k, crypto.SHA256, sum) + if err != nil { + panic(err) // usually caused by memory corruption, so hard stop + } + }() + } + wg.Wait() + } +} + +func bigFromHex(hex string) *big.Int { + n, ok := new(big.Int).SetString(hex, 16) + if !ok { + panic("bad hex: " + hex) + } + return n +} + +func fromHex(hexStr string) []byte { + s, err := hex.DecodeString(hexStr) + if err != nil { + panic(err) + } + return s +} diff --git a/go/src/crypto/rsa/equal_test.go b/go/src/crypto/rsa/equal_test.go new file mode 100644 index 0000000000000000000000000000000000000000..39a9cdc86cfaf5cdeda4fef1b8e6974875ea49fa --- /dev/null +++ b/go/src/crypto/rsa/equal_test.go @@ -0,0 +1,58 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package rsa_test + +import ( + "crypto" + "crypto/rsa" + "crypto/x509" + "testing" +) + +func TestEqual(t *testing.T) { + t.Setenv("GODEBUG", "rsa1024min=0") + + private := test512Key + public := &private.PublicKey + + if !public.Equal(public) { + t.Errorf("public key is not equal to itself: %v", public) + } + if !public.Equal(crypto.Signer(private).Public().(*rsa.PublicKey)) { + t.Errorf("private.Public() is not Equal to public: %v", public) + } + if !private.Equal(private) { + t.Errorf("private key is not equal to itself: %v", private) + } + + enc, err := x509.MarshalPKCS8PrivateKey(private) + if err != nil { + t.Fatal(err) + } + decoded, err := x509.ParsePKCS8PrivateKey(enc) + if err != nil { + t.Fatal(err) + } + if !public.Equal(decoded.(crypto.Signer).Public()) { + t.Errorf("public key is not equal to itself after decoding: %v", public) + } + if !private.Equal(decoded) { + t.Errorf("private key is not equal to itself after decoding: %v", private) + } + + other := test512KeyTwo + if public.Equal(other.Public()) { + t.Errorf("different public keys are Equal") + } + if private.Equal(other) { + t.Errorf("different private keys are Equal") + } + + noPrecomp := *private + noPrecomp.Precomputed = rsa.PrecomputedValues{} + if !private.Equal(&noPrecomp) { + t.Errorf("private key with no precomputation is not equal to itself: %v", private) + } +} diff --git a/go/src/crypto/rsa/example_test.go b/go/src/crypto/rsa/example_test.go new file mode 100644 index 0000000000000000000000000000000000000000..4a5c1c60fc8dad8dac83816407800c62a988c9af --- /dev/null +++ b/go/src/crypto/rsa/example_test.go @@ -0,0 +1,215 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package rsa_test + +import ( + "crypto" + "crypto/aes" + "crypto/cipher" + "crypto/rand" + "crypto/rsa" + "crypto/sha256" + "crypto/x509" + "encoding/hex" + "encoding/pem" + "fmt" + "os" + "strings" +) + +func ExampleGenerateKey() { + privateKey, err := rsa.GenerateKey(rand.Reader, 2048) + if err != nil { + fmt.Fprintf(os.Stderr, "Error generating RSA key: %s", err) + return + } + + der, err := x509.MarshalPKCS8PrivateKey(privateKey) + if err != nil { + fmt.Fprintf(os.Stderr, "Error marshalling RSA private key: %s", err) + return + } + + fmt.Printf("%s", pem.EncodeToMemory(&pem.Block{ + Type: "PRIVATE KEY", + Bytes: der, + })) +} + +func ExampleGenerateKey_testKey() { + // This is an insecure, test-only key from RFC 9500, Section 2.1. + // It can be used in tests to avoid slow key generation. + block, _ := pem.Decode([]byte(strings.ReplaceAll( + `-----BEGIN RSA TESTING KEY----- +MIIEowIBAAKCAQEAsPnoGUOnrpiSqt4XynxA+HRP7S+BSObI6qJ7fQAVSPtRkqso +tWxQYLEYzNEx5ZSHTGypibVsJylvCfuToDTfMul8b/CZjP2Ob0LdpYrNH6l5hvFE +89FU1nZQF15oVLOpUgA7wGiHuEVawrGfey92UE68mOyUVXGweJIVDdxqdMoPvNNU +l86BU02vlBiESxOuox+dWmuVV7vfYZ79Toh/LUK43YvJh+rhv4nKuF7iHjVjBd9s +B6iDjj70HFldzOQ9r8SRI+9NirupPTkF5AKNe6kUhKJ1luB7S27ZkvB3tSTT3P59 +3VVJvnzOjaA1z6Cz+4+eRvcysqhrRgFlwI9TEwIDAQABAoIBAEEYiyDP29vCzx/+ +dS3LqnI5BjUuJhXUnc6AWX/PCgVAO+8A+gZRgvct7PtZb0sM6P9ZcLrweomlGezI +FrL0/6xQaa8bBr/ve/a8155OgcjFo6fZEw3Dz7ra5fbSiPmu4/b/kvrg+Br1l77J +aun6uUAs1f5B9wW+vbR7tzbT/mxaUeDiBzKpe15GwcvbJtdIVMa2YErtRjc1/5B2 +BGVXyvlJv0SIlcIEMsHgnAFOp1ZgQ08aDzvilLq8XVMOahAhP1O2A3X8hKdXPyrx +IVWE9bS9ptTo+eF6eNl+d7htpKGEZHUxinoQpWEBTv+iOoHsVunkEJ3vjLP3lyI/ +fY0NQ1ECgYEA3RBXAjgvIys2gfU3keImF8e/TprLge1I2vbWmV2j6rZCg5r/AS0u +pii5CvJ5/T5vfJPNgPBy8B/yRDs+6PJO1GmnlhOkG9JAIPkv0RBZvR0PMBtbp6nT +Y3yo1lwamBVBfY6rc0sLTzosZh2aGoLzrHNMQFMGaauORzBFpY5lU50CgYEAzPHl +u5DI6Xgep1vr8QvCUuEesCOgJg8Yh1UqVoY/SmQh6MYAv1I9bLGwrb3WW/7kqIoD +fj0aQV5buVZI2loMomtU9KY5SFIsPV+JuUpy7/+VE01ZQM5FdY8wiYCQiVZYju9X +Wz5LxMNoz+gT7pwlLCsC4N+R8aoBk404aF1gum8CgYAJ7VTq7Zj4TFV7Soa/T1eE +k9y8a+kdoYk3BASpCHJ29M5R2KEA7YV9wrBklHTz8VzSTFTbKHEQ5W5csAhoL5Fo +qoHzFFi3Qx7MHESQb9qHyolHEMNx6QdsHUn7rlEnaTTyrXh3ifQtD6C0yTmFXUIS +CW9wKApOrnyKJ9nI0HcuZQKBgQCMtoV6e9VGX4AEfpuHvAAnMYQFgeBiYTkBKltQ +XwozhH63uMMomUmtSG87Sz1TmrXadjAhy8gsG6I0pWaN7QgBuFnzQ/HOkwTm+qKw +AsrZt4zeXNwsH7QXHEJCFnCmqw9QzEoZTrNtHJHpNboBuVnYcoueZEJrP8OnUG3r +UjmopwKBgAqB2KYYMUqAOvYcBnEfLDmyZv9BTVNHbR2lKkMYqv5LlvDaBxVfilE0 +2riO4p6BaAdvzXjKeRrGNEKoHNBpOSfYCOM16NjL8hIZB1CaV3WbT5oY+jp7Mzd5 +7d56RZOE+ERK2uz/7JX9VSsM/LbH9pJibd4e8mikDS9ntciqOH/3 +-----END RSA TESTING KEY-----`, "TESTING KEY", "PRIVATE KEY"))) + testRSA2048, _ := x509.ParsePKCS1PrivateKey(block.Bytes) + + fmt.Println("Private key bit size:", testRSA2048.N.BitLen()) +} + +// RSA is able to encrypt only a very limited amount of data. In order +// to encrypt reasonable amounts of data a hybrid scheme is commonly +// used: RSA is used to encrypt a key for a symmetric primitive like +// AES-GCM. +// +// Before encrypting, data is “padded” by embedding it in a known +// structure. This is done for a number of reasons, but the most +// obvious is to ensure that the value is large enough that the +// exponentiation is larger than the modulus. (Otherwise it could be +// decrypted with a square-root.) +// +// In these designs, when using PKCS #1 v1.5, it's vitally important to +// avoid disclosing whether the received RSA message was well-formed +// (that is, whether the result of decrypting is a correctly padded +// message) because this leaks secret information. +// DecryptPKCS1v15SessionKey is designed for this situation and copies +// the decrypted, symmetric key (if well-formed) in constant-time over +// a buffer that contains a random key. Thus, if the RSA result isn't +// well-formed, the implementation uses a random key in constant time. +func ExampleDecryptPKCS1v15SessionKey() { + // The hybrid scheme should use at least a 16-byte symmetric key. Here + // we read the random key that will be used if the RSA decryption isn't + // well-formed. + key := make([]byte, 32) + if _, err := rand.Read(key); err != nil { + panic("RNG failure") + } + + rsaCiphertext, _ := hex.DecodeString("aabbccddeeff") + + if err := rsa.DecryptPKCS1v15SessionKey(nil, rsaPrivateKey, rsaCiphertext, key); err != nil { + // Any errors that result will be “public” – meaning that they + // can be determined without any secret information. (For + // instance, if the length of key is impossible given the RSA + // public key.) + fmt.Fprintf(os.Stderr, "Error from RSA decryption: %s\n", err) + return + } + + // Given the resulting key, a symmetric scheme can be used to decrypt a + // larger ciphertext. + block, err := aes.NewCipher(key) + if err != nil { + panic("aes.NewCipher failed: " + err.Error()) + } + + // Since the key is random, using a fixed nonce is acceptable as the + // (key, nonce) pair will still be unique, as required. + var zeroNonce [12]byte + aead, err := cipher.NewGCM(block) + if err != nil { + panic("cipher.NewGCM failed: " + err.Error()) + } + ciphertext, _ := hex.DecodeString("00112233445566") + plaintext, err := aead.Open(nil, zeroNonce[:], ciphertext, nil) + if err != nil { + // The RSA ciphertext was badly formed; the decryption will + // fail here because the AES-GCM key will be incorrect. + fmt.Fprintf(os.Stderr, "Error decrypting: %s\n", err) + return + } + + fmt.Printf("Plaintext: %s\n", plaintext) +} + +func ExampleSignPKCS1v15() { + message := []byte("message to be signed") + + // Only small messages can be signed directly; thus the hash of a + // message, rather than the message itself, is signed. This requires + // that the hash function be collision resistant. SHA-256 is the + // least-strong hash function that should be used for this at the time + // of writing (2016). + hashed := sha256.Sum256(message) + + signature, err := rsa.SignPKCS1v15(nil, rsaPrivateKey, crypto.SHA256, hashed[:]) + if err != nil { + fmt.Fprintf(os.Stderr, "Error from signing: %s\n", err) + return + } + + fmt.Printf("Signature: %x\n", signature) +} + +func ExampleVerifyPKCS1v15() { + message := []byte("message to be signed") + signature, _ := hex.DecodeString("ad2766728615cc7a746cc553916380ca7bfa4f8983b990913bc69eb0556539a350ff0f8fe65ddfd3ebe91fe1c299c2fac135bc8c61e26be44ee259f2f80c1530") + + // Only small messages can be signed directly; thus the hash of a + // message, rather than the message itself, is signed. This requires + // that the hash function be collision resistant. SHA-256 is the + // least-strong hash function that should be used for this at the time + // of writing (2016). + hashed := sha256.Sum256(message) + + err := rsa.VerifyPKCS1v15(&rsaPrivateKey.PublicKey, crypto.SHA256, hashed[:], signature) + if err != nil { + fmt.Fprintf(os.Stderr, "Error from verification: %s\n", err) + return + } + + // signature is a valid signature of message from the public key. +} + +func ExampleEncryptOAEP() { + secretMessage := []byte("send reinforcements, we're going to advance") + label := []byte("orders") + + // crypto/rand.Reader is a good source of entropy for randomizing the + // encryption function. + rng := rand.Reader + + ciphertext, err := rsa.EncryptOAEP(sha256.New(), rng, &test2048Key.PublicKey, secretMessage, label) + if err != nil { + fmt.Fprintf(os.Stderr, "Error from encryption: %s\n", err) + return + } + + // Since encryption is a randomized function, ciphertext will be + // different each time. + fmt.Printf("Ciphertext: %x\n", ciphertext) +} + +func ExampleDecryptOAEP() { + ciphertext, _ := hex.DecodeString("4d1ee10e8f286390258c51a5e80802844c3e6358ad6690b7285218a7c7ed7fc3a4c7b950fbd04d4b0239cc060dcc7065ca6f84c1756deb71ca5685cadbb82be025e16449b905c568a19c088a1abfad54bf7ecc67a7df39943ec511091a34c0f2348d04e058fcff4d55644de3cd1d580791d4524b92f3e91695582e6e340a1c50b6c6d78e80b4e42c5b4d45e479b492de42bbd39cc642ebb80226bb5200020d501b24a37bcc2ec7f34e596b4fd6b063de4858dbf5a4e3dd18e262eda0ec2d19dbd8e890d672b63d368768360b20c0b6b8592a438fa275e5fa7f60bef0dd39673fd3989cc54d2cb80c08fcd19dacbc265ee1c6014616b0e04ea0328c2a04e73460") + label := []byte("orders") + + plaintext, err := rsa.DecryptOAEP(sha256.New(), nil, test2048Key, ciphertext, label) + if err != nil { + fmt.Fprintf(os.Stderr, "Error from decryption: %s\n", err) + return + } + + fmt.Printf("Plaintext: %s\n", plaintext) + + // Remember that encryption only provides confidentiality. The + // ciphertext should be signed before authenticity is assumed and, even + // then, consider that messages might be reordered. +} diff --git a/go/src/crypto/rsa/fips.go b/go/src/crypto/rsa/fips.go new file mode 100644 index 0000000000000000000000000000000000000000..fb2395886b053bfaa0ff9eda3f9eea36b0781500 --- /dev/null +++ b/go/src/crypto/rsa/fips.go @@ -0,0 +1,454 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package rsa + +import ( + "crypto" + "crypto/internal/boring" + "crypto/internal/fips140/rsa" + "crypto/internal/fips140hash" + "crypto/internal/fips140only" + "crypto/internal/rand" + "errors" + "hash" + "io" +) + +const ( + // PSSSaltLengthAuto causes the salt in a PSS signature to be as large + // as possible when signing, and to be auto-detected when verifying. + // + // When signing in FIPS 140-3 mode, the salt length is capped at the length + // of the hash function used in the signature. + PSSSaltLengthAuto = 0 + // PSSSaltLengthEqualsHash causes the salt length to equal the length + // of the hash used in the signature. + PSSSaltLengthEqualsHash = -1 +) + +// PSSOptions contains options for creating and verifying PSS signatures. +type PSSOptions struct { + // SaltLength controls the length of the salt used in the PSS signature. It + // can either be a positive number of bytes, or one of the special + // PSSSaltLength constants. + SaltLength int + + // Hash is the hash function used to generate the message digest. If not + // zero, it overrides the hash function passed to SignPSS. It's required + // when using PrivateKey.Sign. + Hash crypto.Hash +} + +// HashFunc returns opts.Hash so that [PSSOptions] implements [crypto.SignerOpts]. +func (opts *PSSOptions) HashFunc() crypto.Hash { + return opts.Hash +} + +func (opts *PSSOptions) saltLength() int { + if opts == nil { + return PSSSaltLengthAuto + } + return opts.SaltLength +} + +// SignPSS calculates the signature of digest using PSS. +// +// digest must be the result of hashing the input message using the given hash +// function. The opts argument may be nil, in which case sensible defaults are +// used. If opts.Hash is set, it overrides hash. +// +// The signature is randomized depending on the message, key, and salt size, +// using bytes from random. Most applications should use [crypto/rand.Reader] as +// random. +func SignPSS(random io.Reader, priv *PrivateKey, hash crypto.Hash, digest []byte, opts *PSSOptions) ([]byte, error) { + if err := checkPublicKeySize(&priv.PublicKey); err != nil { + return nil, err + } + + if opts != nil && opts.Hash != 0 { + hash = opts.Hash + } + + if boring.Enabled && rand.IsDefaultReader(random) { + bkey, err := boringPrivateKey(priv) + if err != nil { + return nil, err + } + return boring.SignRSAPSS(bkey, hash, digest, opts.saltLength()) + } + boring.UnreachableExceptTests() + + h := fips140hash.Unwrap(hash.New()) + + if err := checkFIPS140OnlyPrivateKey(priv); err != nil { + return nil, err + } + if fips140only.Enforced() && !fips140only.ApprovedHash(h) { + return nil, errors.New("crypto/rsa: use of hash functions other than SHA-2 or SHA-3 is not allowed in FIPS 140-only mode") + } + if fips140only.Enforced() && !fips140only.ApprovedRandomReader(random) { + return nil, errors.New("crypto/rsa: only crypto/rand.Reader is allowed in FIPS 140-only mode") + } + + k, err := fipsPrivateKey(priv) + if err != nil { + return nil, err + } + + saltLength := opts.saltLength() + if fips140only.Enforced() && saltLength > h.Size() { + return nil, errors.New("crypto/rsa: use of PSS salt longer than the hash is not allowed in FIPS 140-only mode") + } + switch saltLength { + case PSSSaltLengthAuto: + saltLength, err = rsa.PSSMaxSaltLength(k.PublicKey(), h) + if err != nil { + return nil, fipsError(err) + } + case PSSSaltLengthEqualsHash: + saltLength = h.Size() + default: + // If we get here saltLength is either > 0 or < -1, in the + // latter case we fail out. + if saltLength <= 0 { + return nil, errors.New("crypto/rsa: invalid PSS salt length") + } + } + + return fipsError2(rsa.SignPSS(random, k, h, digest, saltLength)) +} + +// VerifyPSS verifies a PSS signature. +// +// A valid signature is indicated by returning a nil error. digest must be the +// result of hashing the input message using the given hash function. The opts +// argument may be nil, in which case sensible defaults are used. opts.Hash is +// ignored. +// +// The inputs are not considered confidential, and may leak through timing side +// channels, or if an attacker has control of part of the inputs. +func VerifyPSS(pub *PublicKey, hash crypto.Hash, digest []byte, sig []byte, opts *PSSOptions) error { + if err := checkPublicKeySize(pub); err != nil { + return err + } + + if boring.Enabled { + bkey, err := boringPublicKey(pub) + if err != nil { + return err + } + if err := boring.VerifyRSAPSS(bkey, hash, digest, sig, opts.saltLength()); err != nil { + return ErrVerification + } + return nil + } + + h := fips140hash.Unwrap(hash.New()) + + if err := checkFIPS140OnlyPublicKey(pub); err != nil { + return err + } + if fips140only.Enforced() && !fips140only.ApprovedHash(h) { + return errors.New("crypto/rsa: use of hash functions other than SHA-2 or SHA-3 is not allowed in FIPS 140-only mode") + } + + k, err := fipsPublicKey(pub) + if err != nil { + return err + } + + saltLength := opts.saltLength() + if fips140only.Enforced() && saltLength > h.Size() { + return errors.New("crypto/rsa: use of PSS salt longer than the hash is not allowed in FIPS 140-only mode") + } + switch saltLength { + case PSSSaltLengthAuto: + return fipsError(rsa.VerifyPSS(k, h, digest, sig)) + case PSSSaltLengthEqualsHash: + return fipsError(rsa.VerifyPSSWithSaltLength(k, h, digest, sig, h.Size())) + default: + return fipsError(rsa.VerifyPSSWithSaltLength(k, h, digest, sig, saltLength)) + } +} + +// EncryptOAEP encrypts the given message with RSA-OAEP. +// +// OAEP is parameterised by a hash function that is used as a random oracle. +// Encryption and decryption of a given message must use the same hash function +// and sha256.New() is a reasonable choice. +// +// The random parameter is used as a source of entropy to ensure that +// encrypting the same message twice doesn't result in the same ciphertext. +// Most applications should use [crypto/rand.Reader] as random. +// +// The label parameter may contain arbitrary data that will not be encrypted, +// but which gives important context to the message. For example, if a given +// public key is used to encrypt two types of messages then distinct label +// values could be used to ensure that a ciphertext for one purpose cannot be +// used for another by an attacker. If not required it can be empty. +// +// The message must be no longer than the length of the public modulus minus +// twice the hash length, minus a further 2. +func EncryptOAEP(hash hash.Hash, random io.Reader, pub *PublicKey, msg []byte, label []byte) ([]byte, error) { + return encryptOAEP(hash, hash, random, pub, msg, label) +} + +// EncryptOAEPWithOptions encrypts the given message with RSA-OAEP using the +// provided options. +// +// This function should only be used over [EncryptOAEP] when there is a need to +// specify the OAEP and MGF1 hashes separately. +// +// See [EncryptOAEP] for additional details. +func EncryptOAEPWithOptions(random io.Reader, pub *PublicKey, msg []byte, opts *OAEPOptions) ([]byte, error) { + if opts.MGFHash == 0 { + return encryptOAEP(opts.Hash.New(), opts.Hash.New(), random, pub, msg, opts.Label) + } + return encryptOAEP(opts.Hash.New(), opts.MGFHash.New(), random, pub, msg, opts.Label) +} + +func encryptOAEP(hash hash.Hash, mgfHash hash.Hash, random io.Reader, pub *PublicKey, msg []byte, label []byte) ([]byte, error) { + if err := checkPublicKeySize(pub); err != nil { + return nil, err + } + + defer hash.Reset() + defer mgfHash.Reset() + + if boring.Enabled && rand.IsDefaultReader(random) { + k := pub.Size() + if len(msg) > k-2*hash.Size()-2 { + return nil, ErrMessageTooLong + } + bkey, err := boringPublicKey(pub) + if err != nil { + return nil, err + } + return boring.EncryptRSAOAEP(hash, mgfHash, bkey, msg, label) + } + boring.UnreachableExceptTests() + + hash = fips140hash.Unwrap(hash) + + if err := checkFIPS140OnlyPublicKey(pub); err != nil { + return nil, err + } + if fips140only.Enforced() && !fips140only.ApprovedHash(hash) { + return nil, errors.New("crypto/rsa: use of hash functions other than SHA-2 or SHA-3 is not allowed in FIPS 140-only mode") + } + if fips140only.Enforced() && !fips140only.ApprovedRandomReader(random) { + return nil, errors.New("crypto/rsa: only crypto/rand.Reader is allowed in FIPS 140-only mode") + } + + k, err := fipsPublicKey(pub) + if err != nil { + return nil, err + } + return fipsError2(rsa.EncryptOAEP(hash, mgfHash, random, k, msg, label)) +} + +// DecryptOAEP decrypts ciphertext using RSA-OAEP. +// +// OAEP is parameterised by a hash function that is used as a random oracle. +// Encryption and decryption of a given message must use the same hash function +// and sha256.New() is a reasonable choice. +// +// The random parameter is legacy and ignored, and it can be nil. +// +// The label parameter must match the value given when encrypting. See +// [EncryptOAEP] for details. +func DecryptOAEP(hash hash.Hash, random io.Reader, priv *PrivateKey, ciphertext []byte, label []byte) ([]byte, error) { + defer hash.Reset() + return decryptOAEP(hash, hash, priv, ciphertext, label) +} + +func decryptOAEP(hash, mgfHash hash.Hash, priv *PrivateKey, ciphertext []byte, label []byte) ([]byte, error) { + if err := checkPublicKeySize(&priv.PublicKey); err != nil { + return nil, err + } + + if boring.Enabled { + k := priv.Size() + if len(ciphertext) > k || + k < hash.Size()*2+2 { + return nil, ErrDecryption + } + bkey, err := boringPrivateKey(priv) + if err != nil { + return nil, err + } + out, err := boring.DecryptRSAOAEP(hash, mgfHash, bkey, ciphertext, label) + if err != nil { + return nil, ErrDecryption + } + return out, nil + } + + hash = fips140hash.Unwrap(hash) + mgfHash = fips140hash.Unwrap(mgfHash) + + if err := checkFIPS140OnlyPrivateKey(priv); err != nil { + return nil, err + } + if fips140only.Enforced() { + if !fips140only.ApprovedHash(hash) || !fips140only.ApprovedHash(mgfHash) { + return nil, errors.New("crypto/rsa: use of hash functions other than SHA-2 or SHA-3 is not allowed in FIPS 140-only mode") + } + } + + k, err := fipsPrivateKey(priv) + if err != nil { + return nil, err + } + + return fipsError2(rsa.DecryptOAEP(hash, mgfHash, k, ciphertext, label)) +} + +// SignPKCS1v15 calculates the signature of hashed using +// RSASSA-PKCS1-V1_5-SIGN from RSA PKCS #1 v1.5. Note that hashed must +// be the result of hashing the input message using the given hash +// function. If hash is zero, hashed is signed directly. This isn't +// advisable except for interoperability. +// +// The random parameter is legacy and ignored, and it can be nil. +// +// This function is deterministic. Thus, if the set of possible +// messages is small, an attacker may be able to build a map from +// messages to signatures and identify the signed messages. As ever, +// signatures provide authenticity, not confidentiality. +func SignPKCS1v15(random io.Reader, priv *PrivateKey, hash crypto.Hash, hashed []byte) ([]byte, error) { + var hashName string + if hash != crypto.Hash(0) { + if len(hashed) != hash.Size() { + return nil, errors.New("crypto/rsa: input must be hashed message") + } + hashName = hash.String() + } + + if err := checkPublicKeySize(&priv.PublicKey); err != nil { + return nil, err + } + + if boring.Enabled { + bkey, err := boringPrivateKey(priv) + if err != nil { + return nil, err + } + return boring.SignRSAPKCS1v15(bkey, hash, hashed) + } + + if err := checkFIPS140OnlyPrivateKey(priv); err != nil { + return nil, err + } + if fips140only.Enforced() && !fips140only.ApprovedHash(fips140hash.Unwrap(hash.New())) { + return nil, errors.New("crypto/rsa: use of hash functions other than SHA-2 or SHA-3 is not allowed in FIPS 140-only mode") + } + + k, err := fipsPrivateKey(priv) + if err != nil { + return nil, err + } + return fipsError2(rsa.SignPKCS1v15(k, hashName, hashed)) +} + +// VerifyPKCS1v15 verifies an RSA PKCS #1 v1.5 signature. +// hashed is the result of hashing the input message using the given hash +// function and sig is the signature. A valid signature is indicated by +// returning a nil error. If hash is zero then hashed is used directly. This +// isn't advisable except for interoperability. +// +// The inputs are not considered confidential, and may leak through timing side +// channels, or if an attacker has control of part of the inputs. +func VerifyPKCS1v15(pub *PublicKey, hash crypto.Hash, hashed []byte, sig []byte) error { + var hashName string + if hash != crypto.Hash(0) { + if len(hashed) != hash.Size() { + return errors.New("crypto/rsa: input must be hashed message") + } + hashName = hash.String() + } + + if err := checkPublicKeySize(pub); err != nil { + return err + } + + if boring.Enabled { + bkey, err := boringPublicKey(pub) + if err != nil { + return err + } + if err := boring.VerifyRSAPKCS1v15(bkey, hash, hashed, sig); err != nil { + return ErrVerification + } + return nil + } + + if err := checkFIPS140OnlyPublicKey(pub); err != nil { + return err + } + if fips140only.Enforced() && !fips140only.ApprovedHash(fips140hash.Unwrap(hash.New())) { + return errors.New("crypto/rsa: use of hash functions other than SHA-2 or SHA-3 is not allowed in FIPS 140-only mode") + } + + k, err := fipsPublicKey(pub) + if err != nil { + return err + } + return fipsError(rsa.VerifyPKCS1v15(k, hashName, hashed, sig)) +} + +func fipsError(err error) error { + switch err { + case rsa.ErrDecryption: + return ErrDecryption + case rsa.ErrVerification: + return ErrVerification + case rsa.ErrMessageTooLong: + return ErrMessageTooLong + } + return err +} + +func fipsError2[T any](x T, err error) (T, error) { + return x, fipsError(err) +} + +func checkFIPS140OnlyPublicKey(pub *PublicKey) error { + if !fips140only.Enforced() { + return nil + } + if pub.N == nil { + return errors.New("crypto/rsa: public key missing N") + } + if pub.N.BitLen() < 2048 { + return errors.New("crypto/rsa: use of keys smaller than 2048 bits is not allowed in FIPS 140-only mode") + } + if pub.N.BitLen()%2 == 1 { + return errors.New("crypto/rsa: use of keys with odd size is not allowed in FIPS 140-only mode") + } + if pub.E <= 1<<16 { + return errors.New("crypto/rsa: use of public exponent <= 2¹⁶ is not allowed in FIPS 140-only mode") + } + if pub.E&1 == 0 { + return errors.New("crypto/rsa: use of even public exponent is not allowed in FIPS 140-only mode") + } + return nil +} + +func checkFIPS140OnlyPrivateKey(priv *PrivateKey) error { + if !fips140only.Enforced() { + return nil + } + if err := checkFIPS140OnlyPublicKey(&priv.PublicKey); err != nil { + return err + } + if len(priv.Primes) != 2 { + return errors.New("crypto/rsa: use of multi-prime keys is not allowed in FIPS 140-only mode") + } + if priv.Primes[0] == nil || priv.Primes[1] == nil || priv.Primes[0].BitLen() != priv.Primes[1].BitLen() { + return errors.New("crypto/rsa: use of primes of different sizes is not allowed in FIPS 140-only mode") + } + return nil +} diff --git a/go/src/crypto/rsa/notboring.go b/go/src/crypto/rsa/notboring.go new file mode 100644 index 0000000000000000000000000000000000000000..2abc0436405f8ac02533b9ea5f46cadb776f6df4 --- /dev/null +++ b/go/src/crypto/rsa/notboring.go @@ -0,0 +1,16 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !boringcrypto + +package rsa + +import "crypto/internal/boring" + +func boringPublicKey(*PublicKey) (*boring.PublicKeyRSA, error) { + panic("boringcrypto: not available") +} +func boringPrivateKey(*PrivateKey) (*boring.PrivateKeyRSA, error) { + panic("boringcrypto: not available") +} diff --git a/go/src/crypto/rsa/pkcs1v15.go b/go/src/crypto/rsa/pkcs1v15.go new file mode 100644 index 0000000000000000000000000000000000000000..5269d7b971bda7db86d236c3c8c9435d91995a75 --- /dev/null +++ b/go/src/crypto/rsa/pkcs1v15.go @@ -0,0 +1,289 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package rsa + +import ( + "crypto/internal/boring" + "crypto/internal/fips140/rsa" + "crypto/internal/fips140only" + "crypto/internal/rand" + "crypto/subtle" + "errors" + "io" +) + +// This file implements encryption and decryption using PKCS #1 v1.5 padding. + +// PKCS1v15DecryptOptions is for passing options to PKCS #1 v1.5 decryption using +// the [crypto.Decrypter] interface. +// +// Deprecated: PKCS #1 v1.5 encryption is dangerous and should not be used. +// See [draft-irtf-cfrg-rsa-guidance-05] for more information. Use +// [EncryptOAEP] and [DecryptOAEP] instead. +// +// [draft-irtf-cfrg-rsa-guidance-05]: https://www.ietf.org/archive/id/draft-irtf-cfrg-rsa-guidance-05.html#name-rationale +type PKCS1v15DecryptOptions struct { + // SessionKeyLen is the length of the session key that is being + // decrypted. If not zero, then a padding error during decryption will + // cause a random plaintext of this length to be returned rather than + // an error. These alternatives happen in constant time. + SessionKeyLen int +} + +// EncryptPKCS1v15 encrypts the given message with RSA and the padding +// scheme from PKCS #1 v1.5. The message must be no longer than the +// length of the public modulus minus 11 bytes. +// +// The random parameter is used as a source of entropy to ensure that encrypting +// the same message twice doesn't result in the same ciphertext. Since Go 1.26, +// a secure source of random bytes is always used, and the Reader is ignored +// unless GODEBUG=cryptocustomrand=1 is set. This setting will be removed in a +// future Go release. Instead, use [testing/cryptotest.SetGlobalRandom]. +// +// Deprecated: PKCS #1 v1.5 encryption is dangerous and should not be used. +// See [draft-irtf-cfrg-rsa-guidance-05] for more information. Use +// [EncryptOAEP] and [DecryptOAEP] instead. +// +// [draft-irtf-cfrg-rsa-guidance-05]: https://www.ietf.org/archive/id/draft-irtf-cfrg-rsa-guidance-05.html#name-rationale +func EncryptPKCS1v15(random io.Reader, pub *PublicKey, msg []byte) ([]byte, error) { + if fips140only.Enforced() { + return nil, errors.New("crypto/rsa: use of PKCS#1 v1.5 encryption is not allowed in FIPS 140-only mode") + } + + if err := checkPublicKeySize(pub); err != nil { + return nil, err + } + + k := pub.Size() + if len(msg) > k-11 { + return nil, ErrMessageTooLong + } + + if boring.Enabled && rand.IsDefaultReader(random) { + bkey, err := boringPublicKey(pub) + if err != nil { + return nil, err + } + return boring.EncryptRSAPKCS1(bkey, msg) + } + boring.UnreachableExceptTests() + + random = rand.CustomReader(random) + + // EM = 0x00 || 0x02 || PS || 0x00 || M + em := make([]byte, k) + em[1] = 2 + ps, mm := em[2:len(em)-len(msg)-1], em[len(em)-len(msg):] + err := nonZeroRandomBytes(ps, random) + if err != nil { + return nil, err + } + em[len(em)-len(msg)-1] = 0 + copy(mm, msg) + + if boring.Enabled { + var bkey *boring.PublicKeyRSA + bkey, err = boringPublicKey(pub) + if err != nil { + return nil, err + } + return boring.EncryptRSANoPadding(bkey, em) + } + + fk, err := fipsPublicKey(pub) + if err != nil { + return nil, err + } + return rsa.Encrypt(fk, em) +} + +// DecryptPKCS1v15 decrypts a plaintext using RSA and the padding scheme from +// PKCS #1 v1.5. The random parameter is legacy and ignored, and it can be nil. +// +// Deprecated: PKCS #1 v1.5 encryption is dangerous and should not be used. +// Whether this function returns an error or not discloses secret information. +// If an attacker can cause this function to run repeatedly and learn whether +// each instance returned an error then they can decrypt and forge signatures as +// if they had the private key. See [draft-irtf-cfrg-rsa-guidance-05] for more +// information. Use [EncryptOAEP] and [DecryptOAEP] instead. +// +// [draft-irtf-cfrg-rsa-guidance-05]: https://www.ietf.org/archive/id/draft-irtf-cfrg-rsa-guidance-05.html#name-rationale +func DecryptPKCS1v15(random io.Reader, priv *PrivateKey, ciphertext []byte) ([]byte, error) { + if err := checkPublicKeySize(&priv.PublicKey); err != nil { + return nil, err + } + + if boring.Enabled { + bkey, err := boringPrivateKey(priv) + if err != nil { + return nil, err + } + out, err := boring.DecryptRSAPKCS1(bkey, ciphertext) + if err != nil { + return nil, ErrDecryption + } + return out, nil + } + + valid, out, index, err := decryptPKCS1v15(priv, ciphertext) + if err != nil { + return nil, err + } + if valid == 0 { + return nil, ErrDecryption + } + return out[index:], nil +} + +// DecryptPKCS1v15SessionKey decrypts a session key using RSA and the padding +// scheme from PKCS #1 v1.5. The random parameter is legacy and ignored, and it +// can be nil. +// +// DecryptPKCS1v15SessionKey returns an error if the ciphertext is the wrong +// length or if the ciphertext is greater than the public modulus. Otherwise, no +// error is returned. If the padding is valid, the resulting plaintext message +// is copied into key. Otherwise, key is unchanged. These alternatives occur in +// constant time. It is intended that the user of this function generate a +// random session key beforehand and continue the protocol with the resulting +// value. +// +// Note that if the session key is too small then it may be possible for an +// attacker to brute-force it. If they can do that then they can learn whether a +// random value was used (because it'll be different for the same ciphertext) +// and thus whether the padding was correct. This also defeats the point of this +// function. Using at least a 16-byte key will protect against this attack. +// +// This method implements protections against Bleichenbacher chosen ciphertext +// attacks [0] described in RFC 3218 Section 2.3.2 [1]. While these protections +// make a Bleichenbacher attack significantly more difficult, the protections +// are only effective if the rest of the protocol which uses +// DecryptPKCS1v15SessionKey is designed with these considerations in mind. In +// particular, if any subsequent operations which use the decrypted session key +// leak any information about the key (e.g. whether it is a static or random +// key) then the mitigations are defeated. This method must be used extremely +// carefully, and typically should only be used when absolutely necessary for +// compatibility with an existing protocol (such as TLS) that is designed with +// these properties in mind. +// +// - [0] “Chosen Ciphertext Attacks Against Protocols Based on the RSA Encryption +// Standard PKCS #1”, Daniel Bleichenbacher, Advances in Cryptology (Crypto '98) +// - [1] RFC 3218, Preventing the Million Message Attack on CMS, +// https://www.rfc-editor.org/rfc/rfc3218.html +// +// Deprecated: PKCS #1 v1.5 encryption is dangerous and should not be used. The +// protections implemented by this function are limited and fragile, as +// explained above. See [draft-irtf-cfrg-rsa-guidance-05] for more information. +// Use [EncryptOAEP] and [DecryptOAEP] instead. +// +// [draft-irtf-cfrg-rsa-guidance-05]: https://www.ietf.org/archive/id/draft-irtf-cfrg-rsa-guidance-05.html#name-rationale +func DecryptPKCS1v15SessionKey(random io.Reader, priv *PrivateKey, ciphertext []byte, key []byte) error { + if err := checkPublicKeySize(&priv.PublicKey); err != nil { + return err + } + + k := priv.Size() + if k-(len(key)+3+8) < 0 { + return ErrDecryption + } + + valid, em, index, err := decryptPKCS1v15(priv, ciphertext) + if err != nil { + return err + } + + if len(em) != k { + // This should be impossible because decryptPKCS1v15 always + // returns the full slice. + return ErrDecryption + } + + valid &= subtle.ConstantTimeEq(int32(len(em)-index), int32(len(key))) + subtle.ConstantTimeCopy(valid, key, em[len(em)-len(key):]) + return nil +} + +// decryptPKCS1v15 decrypts ciphertext using priv. It returns one or zero in +// valid that indicates whether the plaintext was correctly structured. +// In either case, the plaintext is returned in em so that it may be read +// independently of whether it was valid in order to maintain constant memory +// access patterns. If the plaintext was valid then index contains the index of +// the original message in em, to allow constant time padding removal. +func decryptPKCS1v15(priv *PrivateKey, ciphertext []byte) (valid int, em []byte, index int, err error) { + if fips140only.Enforced() { + return 0, nil, 0, errors.New("crypto/rsa: use of PKCS#1 v1.5 encryption is not allowed in FIPS 140-only mode") + } + + k := priv.Size() + if k < 11 { + err = ErrDecryption + return 0, nil, 0, err + } + + if boring.Enabled { + var bkey *boring.PrivateKeyRSA + bkey, err = boringPrivateKey(priv) + if err != nil { + return 0, nil, 0, err + } + em, err = boring.DecryptRSANoPadding(bkey, ciphertext) + if err != nil { + return 0, nil, 0, ErrDecryption + } + } else { + fk, err := fipsPrivateKey(priv) + if err != nil { + return 0, nil, 0, err + } + em, err = rsa.DecryptWithoutCheck(fk, ciphertext) + if err != nil { + return 0, nil, 0, ErrDecryption + } + } + + firstByteIsZero := subtle.ConstantTimeByteEq(em[0], 0) + secondByteIsTwo := subtle.ConstantTimeByteEq(em[1], 2) + + // The remainder of the plaintext must be a string of non-zero random + // octets, followed by a 0, followed by the message. + // lookingForIndex: 1 iff we are still looking for the zero. + // index: the offset of the first zero byte. + lookingForIndex := 1 + + for i := 2; i < len(em); i++ { + equals0 := subtle.ConstantTimeByteEq(em[i], 0) + index = subtle.ConstantTimeSelect(lookingForIndex&equals0, i, index) + lookingForIndex = subtle.ConstantTimeSelect(equals0, 0, lookingForIndex) + } + + // The PS padding must be at least 8 bytes long, and it starts two + // bytes into em. + validPS := subtle.ConstantTimeLessOrEq(2+8, index) + + valid = firstByteIsZero & secondByteIsTwo & (^lookingForIndex & 1) & validPS + index = subtle.ConstantTimeSelect(valid, index+1, 0) + return valid, em, index, nil +} + +// nonZeroRandomBytes fills the given slice with non-zero random octets. +func nonZeroRandomBytes(s []byte, random io.Reader) (err error) { + _, err = io.ReadFull(random, s) + if err != nil { + return + } + + for i := 0; i < len(s); i++ { + for s[i] == 0 { + _, err = io.ReadFull(random, s[i:i+1]) + if err != nil { + return + } + // In tests, the PRNG may return all zeros so we do + // this to break the loop. + s[i] ^= 0x42 + } + } + + return +} diff --git a/go/src/crypto/rsa/pkcs1v15_test.go b/go/src/crypto/rsa/pkcs1v15_test.go new file mode 100644 index 0000000000000000000000000000000000000000..c65552cd93526afde7c601262648546ec38ee2ad --- /dev/null +++ b/go/src/crypto/rsa/pkcs1v15_test.go @@ -0,0 +1,314 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package rsa_test + +import ( + "bytes" + "crypto" + "crypto/rand" + . "crypto/rsa" + "crypto/sha1" + "crypto/sha256" + "crypto/x509" + "encoding/base64" + "encoding/hex" + "encoding/pem" + "io" + "testing" + "testing/quick" +) + +func decodeBase64(in string) []byte { + out := make([]byte, base64.StdEncoding.DecodedLen(len(in))) + n, err := base64.StdEncoding.Decode(out, []byte(in)) + if err != nil { + return nil + } + return out[0:n] +} + +type DecryptPKCS1v15Test struct { + in, out string +} + +// These test vectors were generated with `openssl rsautl -pkcs -encrypt` +var decryptPKCS1v15Tests = []DecryptPKCS1v15Test{ + { + "gIcUIoVkD6ATMBk/u/nlCZCCWRKdkfjCgFdo35VpRXLduiKXhNz1XupLLzTXAybEq15juc+EgY5o0DHv/nt3yg==", + "x", + }, + { + "Y7TOCSqofGhkRb+jaVRLzK8xw2cSo1IVES19utzv6hwvx+M8kFsoWQm5DzBeJCZTCVDPkTpavUuEbgp8hnUGDw==", + "testing.", + }, + { + "arReP9DJtEVyV2Dg3dDp4c/PSk1O6lxkoJ8HcFupoRorBZG+7+1fDAwT1olNddFnQMjmkb8vxwmNMoTAT/BFjQ==", + "testing.\n", + }, + { + "WtaBXIoGC54+vH0NH0CHHE+dRDOsMc/6BrfFu2lEqcKL9+uDuWaf+Xj9mrbQCjjZcpQuX733zyok/jsnqe/Ftw==", + "01234567890123456789012345678901234567890123456789012", + }, +} + +func TestDecryptPKCS1v15(t *testing.T) { + t.Setenv("GODEBUG", "rsa1024min=0") + + decryptionFuncs := []func([]byte) ([]byte, error){ + func(ciphertext []byte) (plaintext []byte, err error) { + return DecryptPKCS1v15(nil, test512Key, ciphertext) + }, + func(ciphertext []byte) (plaintext []byte, err error) { + return test512Key.Decrypt(nil, ciphertext, nil) + }, + } + + for _, decryptFunc := range decryptionFuncs { + for i, test := range decryptPKCS1v15Tests { + out, err := decryptFunc(decodeBase64(test.in)) + if err != nil { + t.Errorf("#%d error decrypting: %v", i, err) + } + want := []byte(test.out) + if !bytes.Equal(out, want) { + t.Errorf("#%d got:%#v want:%#v", i, out, want) + } + } + } +} + +func TestEncryptPKCS1v15(t *testing.T) { + random := rand.Reader + k := (rsaPrivateKey.N.BitLen() + 7) / 8 + + tryEncryptDecrypt := func(in []byte, blind bool) bool { + if len(in) > k-11 { + in = in[0 : k-11] + } + + ciphertext, err := EncryptPKCS1v15(random, &rsaPrivateKey.PublicKey, in) + if err != nil { + t.Errorf("error encrypting: %s", err) + return false + } + + var rand io.Reader + if !blind { + rand = nil + } else { + rand = random + } + plaintext, err := DecryptPKCS1v15(rand, rsaPrivateKey, ciphertext) + if err != nil { + t.Errorf("error decrypting: %s", err) + return false + } + + if !bytes.Equal(plaintext, in) { + t.Errorf("output mismatch: %#v %#v", plaintext, in) + return false + } + return true + } + + config := new(quick.Config) + if testing.Short() { + config.MaxCount = 10 + } + quick.Check(tryEncryptDecrypt, config) +} + +// These test vectors were generated with `openssl rsautl -pkcs -encrypt` +var decryptPKCS1v15SessionKeyTests = []DecryptPKCS1v15Test{ + { + "e6ukkae6Gykq0fKzYwULpZehX+UPXYzMoB5mHQUDEiclRbOTqas4Y0E6nwns1BBpdvEJcilhl5zsox/6DtGsYg==", + "1234", + }, + { + "Dtis4uk/q/LQGGqGk97P59K03hkCIVFMEFZRgVWOAAhxgYpCRG0MX2adptt92l67IqMki6iVQyyt0TtX3IdtEw==", + "FAIL", + }, + { + "LIyFyCYCptPxrvTxpol8F3M7ZivlMsf53zs0vHRAv+rDIh2YsHS69ePMoPMe3TkOMZ3NupiL3takPxIs1sK+dw==", + "abcd", + }, + { + "bafnobel46bKy76JzqU/RIVOH0uAYvzUtauKmIidKgM0sMlvobYVAVQPeUQ/oTGjbIZ1v/6Gyi5AO4DtHruGdw==", + "FAIL", + }, +} + +func TestEncryptPKCS1v15SessionKey(t *testing.T) { + t.Setenv("GODEBUG", "rsa1024min=0") + for i, test := range decryptPKCS1v15SessionKeyTests { + key := []byte("FAIL") + err := DecryptPKCS1v15SessionKey(nil, test512Key, decodeBase64(test.in), key) + if err != nil { + t.Errorf("#%d error decrypting", i) + } + want := []byte(test.out) + if !bytes.Equal(key, want) { + t.Errorf("#%d got:%#v want:%#v", i, key, want) + } + } +} + +func TestEncryptPKCS1v15DecrypterSessionKey(t *testing.T) { + t.Setenv("GODEBUG", "rsa1024min=0") + for i, test := range decryptPKCS1v15SessionKeyTests { + plaintext, err := test512Key.Decrypt(rand.Reader, decodeBase64(test.in), &PKCS1v15DecryptOptions{SessionKeyLen: 4}) + if err != nil { + t.Fatalf("#%d: error decrypting: %s", i, err) + } + if len(plaintext) != 4 { + t.Fatalf("#%d: incorrect length plaintext: got %d, want 4", i, len(plaintext)) + } + + if test.out != "FAIL" && !bytes.Equal(plaintext, []byte(test.out)) { + t.Errorf("#%d: incorrect plaintext: got %x, want %x", i, plaintext, test.out) + } + } +} + +func TestNonZeroRandomBytes(t *testing.T) { + random := rand.Reader + + b := make([]byte, 512) + err := NonZeroRandomBytes(b, random) + if err != nil { + t.Errorf("returned error: %s", err) + } + for _, b := range b { + if b == 0 { + t.Errorf("Zero octet found") + return + } + } +} + +type signPKCS1v15Test struct { + in, out string +} + +// These vectors have been tested with +// +// `openssl rsautl -verify -inkey pk -in signature | hexdump -C` +var signPKCS1v15Tests = []signPKCS1v15Test{ + {"Test.\n", "a4f3fa6ea93bcdd0c57be020c1193ecbfd6f200a3d95c409769b029578fa0e336ad9a347600e40d3ae823b8c7e6bad88cc07c1d54c3a1523cbbb6d58efc362ae"}, +} + +func TestSignPKCS1v15(t *testing.T) { + t.Setenv("GODEBUG", "rsa1024min=0") + for i, test := range signPKCS1v15Tests { + h := sha1.New() + h.Write([]byte(test.in)) + digest := h.Sum(nil) + + s, err := SignPKCS1v15(nil, test512Key, crypto.SHA1, digest) + if err != nil { + t.Errorf("#%d %s", i, err) + } + + expected, _ := hex.DecodeString(test.out) + if !bytes.Equal(s, expected) { + t.Errorf("#%d got: %x want: %x", i, s, expected) + } + } +} + +func TestVerifyPKCS1v15(t *testing.T) { + t.Setenv("GODEBUG", "rsa1024min=0") + for i, test := range signPKCS1v15Tests { + h := sha1.New() + h.Write([]byte(test.in)) + digest := h.Sum(nil) + + sig, _ := hex.DecodeString(test.out) + + err := VerifyPKCS1v15(&test512Key.PublicKey, crypto.SHA1, digest, sig) + if err != nil { + t.Errorf("#%d %s", i, err) + } + } +} + +func TestOverlongMessagePKCS1v15(t *testing.T) { + t.Setenv("GODEBUG", "rsa1024min=0") + ciphertext := decodeBase64("fjOVdirUzFoLlukv80dBllMLjXythIf22feqPrNo0YoIjzyzyoMFiLjAc/Y4krkeZ11XFThIrEvw\nkRiZcCq5ng==") + _, err := DecryptPKCS1v15(nil, test512Key, ciphertext) + if err == nil { + t.Error("RSA decrypted a message that was too long.") + } +} + +func TestUnpaddedSignature(t *testing.T) { + t.Setenv("GODEBUG", "rsa1024min=0") + + msg := []byte("Thu Dec 19 18:06:16 EST 2013\n") + // This base64 value was generated with: + // % echo Thu Dec 19 18:06:16 EST 2013 > /tmp/msg + // % openssl rsautl -sign -inkey key -out /tmp/sig -in /tmp/msg + // + // Where "key" contains the RSA private key given at the bottom of this + // file. + expectedSig := decodeBase64("pX4DR8azytjdQ1rtUiC040FjkepuQut5q2ZFX1pTjBrOVKNjgsCDyiJDGZTCNoh9qpXYbhl7iEym30BWWwuiZg==") + + sig, err := SignPKCS1v15(nil, test512Key, crypto.Hash(0), msg) + if err != nil { + t.Fatalf("SignPKCS1v15 failed: %s", err) + } + if !bytes.Equal(sig, expectedSig) { + t.Fatalf("signature is not expected value: got %x, want %x", sig, expectedSig) + } + if err := VerifyPKCS1v15(&test512Key.PublicKey, crypto.Hash(0), msg, sig); err != nil { + t.Fatalf("signature failed to verify: %s", err) + } +} + +func TestShortSessionKey(t *testing.T) { + // This tests that attempting to decrypt a session key where the + // ciphertext is too small doesn't run outside the array bounds. + ciphertext, err := EncryptPKCS1v15(rand.Reader, &rsaPrivateKey.PublicKey, []byte{1}) + if err != nil { + t.Fatalf("Failed to encrypt short message: %s", err) + } + + var key [32]byte + if err := DecryptPKCS1v15SessionKey(nil, rsaPrivateKey, ciphertext, key[:]); err != nil { + t.Fatalf("Failed to decrypt short message: %s", err) + } + + for _, v := range key { + if v != 0 { + t.Fatal("key was modified when ciphertext was invalid") + } + } +} + +func parsePublicKey(s string) *PublicKey { + p, _ := pem.Decode([]byte(s)) + k, err := x509.ParsePKCS1PublicKey(p.Bytes) + if err != nil { + panic(err) + } + return k +} + +func TestShortPKCS1v15Signature(t *testing.T) { + pub := parsePublicKey(`-----BEGIN RSA PUBLIC KEY----- +MEgCQQCd9BVzo775lkohasxjnefF1nCMcNoibqIWEVDe/K7M2GSoO4zlSQB+gkix +O3AnTcdHB51iaZpWfxPSnew8yfulAgMBAAE= +-----END RSA PUBLIC KEY-----`) + sig, err := hex.DecodeString("193a310d0dcf64094c6e3a00c8219b80ded70535473acff72c08e1222974bb24a93a535b1dc4c59fc0e65775df7ba2007dd20e9193f4c4025a18a7070aee93") + if err != nil { + t.Fatalf("failed to decode signature: %s", err) + } + + h := sha256.Sum256([]byte("hello")) + err = VerifyPKCS1v15(pub, crypto.SHA256, h[:], sig) + if err == nil { + t.Fatal("VerifyPKCS1v15 accepted a truncated signature") + } +} diff --git a/go/src/crypto/rsa/pss_test.go b/go/src/crypto/rsa/pss_test.go new file mode 100644 index 0000000000000000000000000000000000000000..e03f4ab06603c6c1b2b39d4fc9316531aa3f9a62 --- /dev/null +++ b/go/src/crypto/rsa/pss_test.go @@ -0,0 +1,278 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package rsa_test + +import ( + "bufio" + "compress/bzip2" + "crypto" + "crypto/internal/fips140" + "crypto/rand" + . "crypto/rsa" + "crypto/sha256" + "crypto/sha512" + "encoding/hex" + "math/big" + "os" + "strconv" + "strings" + "testing" +) + +// TestPSSGolden tests all the test vectors in pss-vect.txt from +// ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip +func TestPSSGolden(t *testing.T) { + inFile, err := os.Open("testdata/pss-vect.txt.bz2") + if err != nil { + t.Fatalf("Failed to open input file: %s", err) + } + defer inFile.Close() + + // The pss-vect.txt file contains RSA keys and then a series of + // signatures. A goroutine is used to preprocess the input by merging + // lines, removing spaces in hex values and identifying the start of + // new keys and signature blocks. + const newKeyMarker = "START NEW KEY" + const newSignatureMarker = "START NEW SIGNATURE" + + values := make(chan string) + + go func() { + defer close(values) + scanner := bufio.NewScanner(bzip2.NewReader(inFile)) + var partialValue string + lastWasValue := true + + for scanner.Scan() { + line := scanner.Text() + switch { + case len(line) == 0: + if len(partialValue) > 0 { + values <- strings.ReplaceAll(partialValue, " ", "") + partialValue = "" + lastWasValue = true + } + continue + case strings.HasPrefix(line, "# ======") && lastWasValue: + values <- newKeyMarker + lastWasValue = false + case strings.HasPrefix(line, "# ------") && lastWasValue: + values <- newSignatureMarker + lastWasValue = false + case strings.HasPrefix(line, "#"): + continue + default: + partialValue += line + } + } + if err := scanner.Err(); err != nil { + panic(err) + } + }() + + var key *PublicKey + var hashed []byte + hash := crypto.SHA1 + h := hash.New() + opts := &PSSOptions{ + SaltLength: PSSSaltLengthEqualsHash, + } + + for marker := range values { + switch marker { + case newKeyMarker: + key = new(PublicKey) + nHex, ok := <-values + if !ok { + continue + } + key.N = bigFromHex(nHex) + key.E = intFromHex(<-values) + // We don't care for d, p, q, dP, dQ or qInv. + for i := 0; i < 6; i++ { + <-values + } + case newSignatureMarker: + msg := fromHex(<-values) + <-values // skip salt + sig := fromHex(<-values) + + h.Reset() + h.Write(msg) + hashed = h.Sum(hashed[:0]) + + if err := VerifyPSS(key, hash, hashed, sig, opts); err != nil { + t.Error(err) + } + default: + t.Fatalf("unknown marker: %s", marker) + } + } +} + +// TestPSSOpenSSL ensures that we can verify a PSS signature from OpenSSL with +// the default options. OpenSSL sets the salt length to be maximal. +func TestPSSOpenSSL(t *testing.T) { + t.Setenv("GODEBUG", "rsa1024min=0") + + hash := crypto.SHA256 + h := hash.New() + h.Write([]byte("testing")) + hashed := h.Sum(nil) + + // Generated with `echo -n testing | openssl dgst -sign key.pem -sigopt rsa_padding_mode:pss -sha256 > sig` + sig := []byte{ + 0x95, 0x59, 0x6f, 0xd3, 0x10, 0xa2, 0xe7, 0xa2, 0x92, 0x9d, + 0x4a, 0x07, 0x2e, 0x2b, 0x27, 0xcc, 0x06, 0xc2, 0x87, 0x2c, + 0x52, 0xf0, 0x4a, 0xcc, 0x05, 0x94, 0xf2, 0xc3, 0x2e, 0x20, + 0xd7, 0x3e, 0x66, 0x62, 0xb5, 0x95, 0x2b, 0xa3, 0x93, 0x9a, + 0x66, 0x64, 0x25, 0xe0, 0x74, 0x66, 0x8c, 0x3e, 0x92, 0xeb, + 0xc6, 0xe6, 0xc0, 0x44, 0xf3, 0xb4, 0xb4, 0x2e, 0x8c, 0x66, + 0x0a, 0x37, 0x9c, 0x69, + } + + if err := VerifyPSS(&test512Key.PublicKey, hash, hashed, sig, nil); err != nil { + t.Error(err) + } +} + +func TestPSSNilOpts(t *testing.T) { + hash := crypto.SHA256 + h := hash.New() + h.Write([]byte("testing")) + hashed := h.Sum(nil) + + SignPSS(rand.Reader, rsaPrivateKey, hash, hashed, nil) +} + +func TestPSSSigning(t *testing.T) { + var saltLengthCombinations = []struct { + signSaltLength, verifySaltLength int + good, fipsGood bool + }{ + {PSSSaltLengthAuto, PSSSaltLengthAuto, true, true}, + {PSSSaltLengthEqualsHash, PSSSaltLengthAuto, true, true}, + {PSSSaltLengthEqualsHash, PSSSaltLengthEqualsHash, true, true}, + {PSSSaltLengthEqualsHash, 8, false, false}, + {8, 8, true, true}, + {8, PSSSaltLengthAuto, true, true}, + {42, PSSSaltLengthAuto, true, true}, + // In FIPS mode, PSSSaltLengthAuto is capped at PSSSaltLengthEqualsHash. + {PSSSaltLengthAuto, PSSSaltLengthEqualsHash, false, true}, + {PSSSaltLengthAuto, 106, true, false}, + {PSSSaltLengthAuto, 20, false, true}, + {PSSSaltLengthAuto, -2, false, false}, + } + + hash := crypto.SHA1 + h := hash.New() + h.Write([]byte("testing")) + hashed := h.Sum(nil) + var opts PSSOptions + + for i, test := range saltLengthCombinations { + opts.SaltLength = test.signSaltLength + sig, err := SignPSS(rand.Reader, rsaPrivateKey, hash, hashed, &opts) + if err != nil { + t.Errorf("#%d: error while signing: %s", i, err) + continue + } + + opts.SaltLength = test.verifySaltLength + err = VerifyPSS(&rsaPrivateKey.PublicKey, hash, hashed, sig, &opts) + good := test.good + if fips140.Enabled { + good = test.fipsGood + } + if (err == nil) != good { + t.Errorf("#%d: bad result, wanted: %t, got: %s", i, test.good, err) + } + } +} + +func TestPSS513(t *testing.T) { + // See Issue 42741, and separately, RFC 8017: "Note that the octet length of + // EM will be one less than k if modBits - 1 is divisible by 8 and equal to + // k otherwise, where k is the length in octets of the RSA modulus n." + t.Setenv("GODEBUG", "rsa1024min=0") + key, err := GenerateKey(rand.Reader, 513) + if err != nil { + t.Fatal(err) + } + digest := sha256.Sum256([]byte("message")) + signature, err := key.Sign(rand.Reader, digest[:], &PSSOptions{ + SaltLength: PSSSaltLengthAuto, + Hash: crypto.SHA256, + }) + if err != nil { + t.Fatal(err) + } + err = VerifyPSS(&key.PublicKey, crypto.SHA256, digest[:], signature, nil) + if err != nil { + t.Error(err) + } +} + +func bigFromHex(hex string) *big.Int { + n, ok := new(big.Int).SetString(hex, 16) + if !ok { + panic("bad hex: " + hex) + } + return n +} + +func intFromHex(hex string) int { + i, err := strconv.ParseInt(hex, 16, 32) + if err != nil { + panic(err) + } + return int(i) +} + +func fromHex(hexStr string) []byte { + s, err := hex.DecodeString(hexStr) + if err != nil { + panic(err) + } + return s +} + +func TestInvalidPSSSaltLength(t *testing.T) { + t.Setenv("GODEBUG", "rsa1024min=0") + key, err := GenerateKey(rand.Reader, 245) + if err != nil { + t.Fatal(err) + } + + digest := sha256.Sum256([]byte("message")) + if _, err := SignPSS(rand.Reader, key, crypto.SHA256, digest[:], &PSSOptions{ + SaltLength: -2, + Hash: crypto.SHA256, + }); err.Error() != "crypto/rsa: invalid PSS salt length" { + t.Fatalf("SignPSS unexpected error: got %v, want %v", err, "crypto/rsa: invalid PSS salt length") + } + + // We don't check the specific error here, because crypto/rsa and crypto/internal/boring + // return different errors, so we just check that _an error_ was returned. + if err := VerifyPSS(&key.PublicKey, crypto.SHA256, []byte{1, 2, 3}, make([]byte, 31), &PSSOptions{ + SaltLength: -2, + }); err == nil { + t.Fatal("VerifyPSS unexpected success") + } +} + +func TestHashOverride(t *testing.T) { + digest := sha512.Sum512([]byte("message")) + // opts.Hash overrides the passed hash argument. + sig, err := SignPSS(rand.Reader, test2048Key, crypto.SHA256, digest[:], &PSSOptions{Hash: crypto.SHA512}) + if err != nil { + t.Fatalf("SignPSS unexpected error: got %v, want nil", err) + } + + // VerifyPSS has the inverse behavior, opts.Hash is always ignored, check this is true. + if err := VerifyPSS(&test2048Key.PublicKey, crypto.SHA512, digest[:], sig, &PSSOptions{Hash: crypto.SHA256}); err != nil { + t.Fatalf("VerifyPSS unexpected error: got %v, want nil", err) + } +} diff --git a/go/src/crypto/rsa/rsa.go b/go/src/crypto/rsa/rsa.go new file mode 100644 index 0000000000000000000000000000000000000000..b94b129867727bf802fb456b781dfcc6fbbddd2b --- /dev/null +++ b/go/src/crypto/rsa/rsa.go @@ -0,0 +1,682 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package rsa implements RSA encryption as specified in PKCS #1 and RFC 8017. +// +// RSA is a single, fundamental operation that is used in this package to +// implement either public-key encryption or public-key signatures. +// +// The original specification for encryption and signatures with RSA is PKCS #1 +// and the terms "RSA encryption" and "RSA signatures" by default refer to +// PKCS #1 version 1.5. However, that specification has flaws and new designs +// should use version 2, usually called by just OAEP and PSS, where +// possible. +// +// Two sets of interfaces are included in this package. When a more abstract +// interface isn't necessary, there are functions for encrypting/decrypting +// with v1.5/OAEP and signing/verifying with v1.5/PSS. If one needs to abstract +// over the public key primitive, the PrivateKey type implements the +// Decrypter and Signer interfaces from the crypto package. +// +// Operations involving private keys are implemented using constant-time +// algorithms, except for [GenerateKey] and for some operations involving +// deprecated multi-prime keys. +// +// # Minimum key size +// +// [GenerateKey] returns an error if a key of less than 1024 bits is requested, +// and all Sign, Verify, Encrypt, and Decrypt methods return an error if used +// with a key smaller than 1024 bits. Such keys are insecure and should not be +// used. +// +// The rsa1024min=0 GODEBUG setting suppresses this error, but we recommend +// doing so only in tests, if necessary. Tests can set this option using +// [testing.T.Setenv] or by including "//go:debug rsa1024min=0" in a *_test.go +// source file. +// +// Alternatively, see the [GenerateKey (TestKey)] example for a pregenerated +// test-only 2048-bit key. +// +// [GenerateKey (TestKey)]: https://pkg.go.dev/crypto/rsa#example-GenerateKey-TestKey +package rsa + +import ( + "crypto" + "crypto/internal/boring" + "crypto/internal/boring/bbig" + "crypto/internal/fips140/bigmod" + "crypto/internal/fips140/rsa" + "crypto/internal/fips140only" + "crypto/internal/rand" + cryptorand "crypto/rand" + "crypto/subtle" + "errors" + "fmt" + "internal/godebug" + "io" + "math" + "math/big" +) + +var bigOne = big.NewInt(1) + +// A PublicKey represents the public part of an RSA key. +// +// The values of N and E are not considered confidential, and may leak through +// side channels, or could be mathematically derived from other public values. +type PublicKey struct { + N *big.Int // modulus + E int // public exponent +} + +// Any methods implemented on PublicKey might need to also be implemented on +// PrivateKey, as the latter embeds the former and will expose its methods. + +// Size returns the modulus size in bytes. Raw signatures and ciphertexts +// for or by this public key will have the same size. +func (pub *PublicKey) Size() int { + return (pub.N.BitLen() + 7) / 8 +} + +// Equal reports whether pub and x have the same value. +func (pub *PublicKey) Equal(x crypto.PublicKey) bool { + xx, ok := x.(*PublicKey) + if !ok { + return false + } + return bigIntEqual(pub.N, xx.N) && pub.E == xx.E +} + +// OAEPOptions allows passing options to OAEP encryption and decryption +// through the [PrivateKey.Decrypt] and [EncryptOAEPWithOptions] functions. +type OAEPOptions struct { + // Hash is the hash function that will be used when generating the mask. + Hash crypto.Hash + + // MGFHash is the hash function used for MGF1. + // If zero, Hash is used instead. + MGFHash crypto.Hash + + // Label is an arbitrary byte string that must be equal to the value + // used when encrypting. + Label []byte +} + +// A PrivateKey represents an RSA key. +// +// Its fields must not be modified after calling [PrivateKey.Precompute], and +// should not be used directly as big.Int values for cryptographic purposes. +type PrivateKey struct { + PublicKey // public part. + D *big.Int // private exponent + Primes []*big.Int // prime factors of N, has >= 2 elements. + + // Precomputed contains precomputed values that speed up RSA operations, + // if available. It must be generated by calling PrivateKey.Precompute and + // must not be modified afterwards. + Precomputed PrecomputedValues +} + +// Public returns the public key corresponding to priv. +func (priv *PrivateKey) Public() crypto.PublicKey { + return &priv.PublicKey +} + +// Equal reports whether priv and x have equivalent values. It ignores +// Precomputed values. +func (priv *PrivateKey) Equal(x crypto.PrivateKey) bool { + xx, ok := x.(*PrivateKey) + if !ok { + return false + } + if !priv.PublicKey.Equal(&xx.PublicKey) || !bigIntEqual(priv.D, xx.D) { + return false + } + if len(priv.Primes) != len(xx.Primes) { + return false + } + for i := range priv.Primes { + if !bigIntEqual(priv.Primes[i], xx.Primes[i]) { + return false + } + } + return true +} + +// bigIntEqual reports whether a and b are equal leaking only their bit length +// through timing side-channels. +func bigIntEqual(a, b *big.Int) bool { + return subtle.ConstantTimeCompare(a.Bytes(), b.Bytes()) == 1 +} + +// Sign signs digest with priv, reading randomness from rand. If opts is a +// *[PSSOptions] then the PSS algorithm will be used, otherwise PKCS #1 v1.5 will +// be used. digest must be the result of hashing the input message using +// opts.HashFunc(). +// +// This method implements [crypto.Signer], which is an interface to support keys +// where the private part is kept in, for example, a hardware module. Common +// uses should use the Sign* functions in this package directly. +func (priv *PrivateKey) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error) { + if pssOpts, ok := opts.(*PSSOptions); ok { + return SignPSS(rand, priv, pssOpts.Hash, digest, pssOpts) + } + + return SignPKCS1v15(rand, priv, opts.HashFunc(), digest) +} + +// Decrypt decrypts ciphertext with priv. If opts is nil or of type +// *[PKCS1v15DecryptOptions] then PKCS #1 v1.5 decryption is performed. Otherwise +// opts must have type *[OAEPOptions] and OAEP decryption is done. +func (priv *PrivateKey) Decrypt(rand io.Reader, ciphertext []byte, opts crypto.DecrypterOpts) (plaintext []byte, err error) { + if opts == nil { + return DecryptPKCS1v15(rand, priv, ciphertext) + } + + switch opts := opts.(type) { + case *OAEPOptions: + if opts.MGFHash == 0 { + return decryptOAEP(opts.Hash.New(), opts.Hash.New(), priv, ciphertext, opts.Label) + } else { + return decryptOAEP(opts.Hash.New(), opts.MGFHash.New(), priv, ciphertext, opts.Label) + } + + case *PKCS1v15DecryptOptions: + if l := opts.SessionKeyLen; l > 0 { + plaintext = make([]byte, l) + if _, err := io.ReadFull(rand, plaintext); err != nil { + return nil, err + } + if err := DecryptPKCS1v15SessionKey(rand, priv, ciphertext, plaintext); err != nil { + return nil, err + } + return plaintext, nil + } else { + return DecryptPKCS1v15(rand, priv, ciphertext) + } + + default: + return nil, errors.New("crypto/rsa: invalid options for Decrypt") + } +} + +type PrecomputedValues struct { + Dp, Dq *big.Int // D mod (P-1) (or mod Q-1) + Qinv *big.Int // Q^-1 mod P + + // CRTValues is used for the 3rd and subsequent primes. Due to a + // historical accident, the CRT for the first two primes is handled + // differently in PKCS #1 and interoperability is sufficiently + // important that we mirror this. + // + // Deprecated: These values are still filled in by Precompute for + // backwards compatibility but are not used. Multi-prime RSA is very rare, + // and is implemented by this package without CRT optimizations to limit + // complexity. + CRTValues []CRTValue + + fips *rsa.PrivateKey +} + +// CRTValue contains the precomputed Chinese remainder theorem values. +type CRTValue struct { + Exp *big.Int // D mod (prime-1). + Coeff *big.Int // R·Coeff ≡ 1 mod Prime. + R *big.Int // product of primes prior to this (inc p and q). +} + +// Validate performs basic sanity checks on the key. +// It returns nil if the key is valid, or else an error describing a problem. +// +// It runs faster on valid keys if run after [PrivateKey.Precompute]. +func (priv *PrivateKey) Validate() error { + // We can operate on keys based on d alone, but they can't be encoded with + // [crypto/x509.MarshalPKCS1PrivateKey], which unfortunately doesn't return + // an error, so we need to reject them here. + if len(priv.Primes) < 2 { + return errors.New("crypto/rsa: missing primes") + } + // If Precomputed.fips is set and consistent, then the key has been + // validated by [rsa.NewPrivateKey] or [rsa.NewPrivateKeyWithoutCRT]. + if priv.precomputedIsConsistent() { + return nil + } + if priv.Precomputed.fips != nil { + return errors.New("crypto/rsa: precomputed values are inconsistent with the key") + } + _, err := priv.precompute() + return err +} + +func (priv *PrivateKey) precomputedIsConsistent() bool { + if priv.Precomputed.fips == nil { + return false + } + N, e, d, P, Q, dP, dQ, qInv := priv.Precomputed.fips.Export() + if !bigIntEqualToBytes(priv.N, N) || priv.E != e || !bigIntEqualToBytes(priv.D, d) { + return false + } + if len(priv.Primes) != 2 { + return P == nil && Q == nil && dP == nil && dQ == nil && qInv == nil + } + return bigIntEqualToBytes(priv.Primes[0], P) && + bigIntEqualToBytes(priv.Primes[1], Q) && + bigIntEqualToBytes(priv.Precomputed.Dp, dP) && + bigIntEqualToBytes(priv.Precomputed.Dq, dQ) && + bigIntEqualToBytes(priv.Precomputed.Qinv, qInv) +} + +// bigIntEqual reports whether a and b are equal, ignoring leading zero bytes in +// b, and leaking only their bit length through timing side-channels. +func bigIntEqualToBytes(a *big.Int, b []byte) bool { + if a == nil || a.BitLen() > len(b)*8 { + return false + } + buf := a.FillBytes(make([]byte, len(b))) + return subtle.ConstantTimeCompare(buf, b) == 1 +} + +// rsa1024min is a GODEBUG that re-enables weak RSA keys if set to "0". +// See https://go.dev/issue/68762. +var rsa1024min = godebug.New("rsa1024min") + +func checkKeySize(size int) error { + if size >= 1024 { + return nil + } + if rsa1024min.Value() == "0" { + rsa1024min.IncNonDefault() + return nil + } + return fmt.Errorf("crypto/rsa: %d-bit keys are insecure (see https://go.dev/pkg/crypto/rsa#hdr-Minimum_key_size)", size) +} + +func checkPublicKeySize(k *PublicKey) error { + if k.N == nil { + return errors.New("crypto/rsa: missing public modulus") + } + return checkKeySize(k.N.BitLen()) +} + +// GenerateKey generates a random RSA private key of the given bit size. +// +// If bits is less than 1024, [GenerateKey] returns an error. See the "[Minimum +// key size]" section for further details. +// +// Since Go 1.26, a secure source of random bytes is always used, and the Reader is +// ignored unless GODEBUG=cryptocustomrand=1 is set. This setting will be removed +// in a future Go release. Instead, use [testing/cryptotest.SetGlobalRandom]. +// +// [Minimum key size]: https://pkg.go.dev/crypto/rsa#hdr-Minimum_key_size +func GenerateKey(random io.Reader, bits int) (*PrivateKey, error) { + if err := checkKeySize(bits); err != nil { + return nil, err + } + + if boring.Enabled && rand.IsDefaultReader(random) && + (bits == 2048 || bits == 3072 || bits == 4096) { + bN, bE, bD, bP, bQ, bDp, bDq, bQinv, err := boring.GenerateKeyRSA(bits) + if err != nil { + return nil, err + } + N := bbig.Dec(bN) + E := bbig.Dec(bE) + D := bbig.Dec(bD) + P := bbig.Dec(bP) + Q := bbig.Dec(bQ) + Dp := bbig.Dec(bDp) + Dq := bbig.Dec(bDq) + Qinv := bbig.Dec(bQinv) + e64 := E.Int64() + if !E.IsInt64() || int64(int(e64)) != e64 { + return nil, errors.New("crypto/rsa: generated key exponent too large") + } + + key := &PrivateKey{ + PublicKey: PublicKey{ + N: N, + E: int(e64), + }, + D: D, + Primes: []*big.Int{P, Q}, + Precomputed: PrecomputedValues{ + Dp: Dp, + Dq: Dq, + Qinv: Qinv, + CRTValues: make([]CRTValue, 0), // non-nil, to match Precompute + }, + } + return key, nil + } + + random = rand.CustomReader(random) + + if fips140only.Enforced() && bits < 2048 { + return nil, errors.New("crypto/rsa: use of keys smaller than 2048 bits is not allowed in FIPS 140-only mode") + } + if fips140only.Enforced() && bits%2 == 1 { + return nil, errors.New("crypto/rsa: use of keys with odd size is not allowed in FIPS 140-only mode") + } + if fips140only.Enforced() && !fips140only.ApprovedRandomReader(random) { + return nil, errors.New("crypto/rsa: only crypto/rand.Reader is allowed in FIPS 140-only mode") + } + + k, err := rsa.GenerateKey(random, bits) + if bits < 256 && err != nil { + // Toy-sized keys have a non-negligible chance of hitting two hard + // failure cases: p == q and d <= 2^(nlen / 2). + // + // Since these are impossible to hit for real keys, we don't want to + // make the production code path more complex and harder to think about + // to handle them. + // + // Instead, just rerun the whole process a total of 8 times, which + // brings the chance of failure for 32-bit keys down to the same as for + // 256-bit keys. + for i := 1; i < 8 && err != nil; i++ { + k, err = rsa.GenerateKey(random, bits) + } + } + if err != nil { + return nil, err + } + N, e, d, p, q, dP, dQ, qInv := k.Export() + key := &PrivateKey{ + PublicKey: PublicKey{ + N: new(big.Int).SetBytes(N), + E: e, + }, + D: new(big.Int).SetBytes(d), + Primes: []*big.Int{ + new(big.Int).SetBytes(p), + new(big.Int).SetBytes(q), + }, + Precomputed: PrecomputedValues{ + fips: k, + Dp: new(big.Int).SetBytes(dP), + Dq: new(big.Int).SetBytes(dQ), + Qinv: new(big.Int).SetBytes(qInv), + CRTValues: make([]CRTValue, 0), // non-nil, to match Precompute + }, + } + return key, nil +} + +// GenerateMultiPrimeKey generates a multi-prime RSA keypair of the given bit +// size and the given random source. +// +// Table 1 in "[On the Security of Multi-prime RSA]" suggests maximum numbers of +// primes for a given bit size. +// +// Although the public keys are compatible (actually, indistinguishable) from +// the 2-prime case, the private keys are not. Thus it may not be possible to +// export multi-prime private keys in certain formats or to subsequently import +// them into other code. +// +// This package does not implement CRT optimizations for multi-prime RSA, so the +// keys with more than two primes will have worse performance. +// +// Since Go 1.26, a secure source of random bytes is always used, and the Reader is +// ignored unless GODEBUG=cryptocustomrand=1 is set. This setting will be removed +// in a future Go release. Instead, use [testing/cryptotest.SetGlobalRandom]. +// +// Deprecated: The use of this function with a number of primes different from +// two is not recommended for the above security, compatibility, and performance +// reasons. Use [GenerateKey] instead. +// +// [On the Security of Multi-prime RSA]: http://www.cacr.math.uwaterloo.ca/techreports/2006/cacr2006-16.pdf +func GenerateMultiPrimeKey(random io.Reader, nprimes int, bits int) (*PrivateKey, error) { + if nprimes == 2 { + return GenerateKey(random, bits) + } + if fips140only.Enforced() { + return nil, errors.New("crypto/rsa: multi-prime RSA is not allowed in FIPS 140-only mode") + } + + random = rand.CustomReader(random) + + priv := new(PrivateKey) + priv.E = 65537 + + if nprimes < 2 { + return nil, errors.New("crypto/rsa: GenerateMultiPrimeKey: nprimes must be >= 2") + } + + if bits < 64 { + primeLimit := float64(uint64(1) << uint(bits/nprimes)) + // pi approximates the number of primes less than primeLimit + pi := primeLimit / (math.Log(primeLimit) - 1) + // Generated primes start with 11 (in binary) so we can only + // use a quarter of them. + pi /= 4 + // Use a factor of two to ensure that key generation terminates + // in a reasonable amount of time. + pi /= 2 + if pi <= float64(nprimes) { + return nil, errors.New("crypto/rsa: too few primes of given length to generate an RSA key") + } + } + + primes := make([]*big.Int, nprimes) + +NextSetOfPrimes: + for { + todo := bits + // crypto/rand should set the top two bits in each prime. + // Thus each prime has the form + // p_i = 2^bitlen(p_i) × 0.11... (in base 2). + // And the product is: + // P = 2^todo × α + // where α is the product of nprimes numbers of the form 0.11... + // + // If α < 1/2 (which can happen for nprimes > 2), we need to + // shift todo to compensate for lost bits: the mean value of 0.11... + // is 7/8, so todo + shift - nprimes * log2(7/8) ~= bits - 1/2 + // will give good results. + if nprimes >= 7 { + todo += (nprimes - 2) / 5 + } + for i := 0; i < nprimes; i++ { + var err error + primes[i], err = cryptorand.Prime(random, todo/(nprimes-i)) + if err != nil { + return nil, err + } + todo -= primes[i].BitLen() + } + + // Make sure that primes is pairwise unequal. + for i, prime := range primes { + for j := 0; j < i; j++ { + if prime.Cmp(primes[j]) == 0 { + continue NextSetOfPrimes + } + } + } + + n := new(big.Int).Set(bigOne) + totient := new(big.Int).Set(bigOne) + pminus1 := new(big.Int) + for _, prime := range primes { + n.Mul(n, prime) + pminus1.Sub(prime, bigOne) + totient.Mul(totient, pminus1) + } + if n.BitLen() != bits { + // This should never happen for nprimes == 2 because + // crypto/rand should set the top two bits in each prime. + // For nprimes > 2 we hope it does not happen often. + continue NextSetOfPrimes + } + + priv.D = new(big.Int) + e := big.NewInt(int64(priv.E)) + ok := priv.D.ModInverse(e, totient) + + if ok != nil { + priv.Primes = primes + priv.N = n + break + } + } + + priv.Precompute() + if err := priv.Validate(); err != nil { + return nil, err + } + + return priv, nil +} + +// ErrMessageTooLong is returned when attempting to encrypt or sign a message +// which is too large for the size of the key. When using [SignPSS], this can also +// be returned if the size of the salt is too large. +var ErrMessageTooLong = errors.New("crypto/rsa: message too long for RSA key size") + +// ErrDecryption represents a failure to decrypt a message. +// It is deliberately vague to avoid adaptive attacks. +var ErrDecryption = errors.New("crypto/rsa: decryption error") + +// ErrVerification represents a failure to verify a signature. +// It is deliberately vague to avoid adaptive attacks. +var ErrVerification = errors.New("crypto/rsa: verification error") + +// Precompute performs some calculations that speed up private key operations +// in the future. It is safe to run on non-validated private keys. +func (priv *PrivateKey) Precompute() { + if priv.precomputedIsConsistent() { + return + } + + precomputed, err := priv.precompute() + if err != nil { + // We don't have a way to report errors, so just leave Precomputed.fips + // nil. Validate will re-run precompute and report its error. + priv.Precomputed.fips = nil + return + } + priv.Precomputed = precomputed +} + +func (priv *PrivateKey) precompute() (PrecomputedValues, error) { + var precomputed PrecomputedValues + + if priv.N == nil { + return precomputed, errors.New("crypto/rsa: missing public modulus") + } + if priv.D == nil { + return precomputed, errors.New("crypto/rsa: missing private exponent") + } + if len(priv.Primes) != 2 { + return priv.precomputeLegacy() + } + if priv.Primes[0] == nil { + return precomputed, errors.New("crypto/rsa: prime P is nil") + } + if priv.Primes[1] == nil { + return precomputed, errors.New("crypto/rsa: prime Q is nil") + } + + // If the CRT values are already set, use them. + if priv.Precomputed.Dp != nil && priv.Precomputed.Dq != nil && priv.Precomputed.Qinv != nil { + k, err := rsa.NewPrivateKeyWithPrecomputation(priv.N.Bytes(), priv.E, priv.D.Bytes(), + priv.Primes[0].Bytes(), priv.Primes[1].Bytes(), + priv.Precomputed.Dp.Bytes(), priv.Precomputed.Dq.Bytes(), priv.Precomputed.Qinv.Bytes()) + if err != nil { + return precomputed, err + } + precomputed = priv.Precomputed + precomputed.fips = k + precomputed.CRTValues = make([]CRTValue, 0) + return precomputed, nil + } + + k, err := rsa.NewPrivateKey(priv.N.Bytes(), priv.E, priv.D.Bytes(), + priv.Primes[0].Bytes(), priv.Primes[1].Bytes()) + if err != nil { + return precomputed, err + } + + precomputed.fips = k + _, _, _, _, _, dP, dQ, qInv := k.Export() + precomputed.Dp = new(big.Int).SetBytes(dP) + precomputed.Dq = new(big.Int).SetBytes(dQ) + precomputed.Qinv = new(big.Int).SetBytes(qInv) + precomputed.CRTValues = make([]CRTValue, 0) + return precomputed, nil +} + +func (priv *PrivateKey) precomputeLegacy() (PrecomputedValues, error) { + var precomputed PrecomputedValues + + k, err := rsa.NewPrivateKeyWithoutCRT(priv.N.Bytes(), priv.E, priv.D.Bytes()) + if err != nil { + return precomputed, err + } + precomputed.fips = k + + if len(priv.Primes) < 2 { + return precomputed, nil + } + + // Ensure the Mod and ModInverse calls below don't panic. + for _, prime := range priv.Primes { + if prime == nil { + return precomputed, errors.New("crypto/rsa: prime factor is nil") + } + if prime.Cmp(bigOne) <= 0 { + return precomputed, errors.New("crypto/rsa: prime factor is <= 1") + } + } + + precomputed.Dp = new(big.Int).Sub(priv.Primes[0], bigOne) + precomputed.Dp.Mod(priv.D, precomputed.Dp) + + precomputed.Dq = new(big.Int).Sub(priv.Primes[1], bigOne) + precomputed.Dq.Mod(priv.D, precomputed.Dq) + + precomputed.Qinv = new(big.Int).ModInverse(priv.Primes[1], priv.Primes[0]) + if precomputed.Qinv == nil { + return precomputed, errors.New("crypto/rsa: prime factors are not relatively prime") + } + + r := new(big.Int).Mul(priv.Primes[0], priv.Primes[1]) + precomputed.CRTValues = make([]CRTValue, len(priv.Primes)-2) + for i := 2; i < len(priv.Primes); i++ { + prime := priv.Primes[i] + values := &precomputed.CRTValues[i-2] + + values.Exp = new(big.Int).Sub(prime, bigOne) + values.Exp.Mod(priv.D, values.Exp) + + values.R = new(big.Int).Set(r) + values.Coeff = new(big.Int).ModInverse(r, prime) + if values.Coeff == nil { + return precomputed, errors.New("crypto/rsa: prime factors are not relatively prime") + } + + r.Mul(r, prime) + } + + return precomputed, nil +} + +func fipsPublicKey(pub *PublicKey) (*rsa.PublicKey, error) { + N, err := bigmod.NewModulus(pub.N.Bytes()) + if err != nil { + return nil, err + } + return &rsa.PublicKey{N: N, E: pub.E}, nil +} + +func fipsPrivateKey(priv *PrivateKey) (*rsa.PrivateKey, error) { + if priv.Precomputed.fips != nil { + return priv.Precomputed.fips, nil + } + precomputed, err := priv.precompute() + if err != nil { + return nil, err + } + return precomputed.fips, nil +} diff --git a/go/src/crypto/rsa/rsa_export_test.go b/go/src/crypto/rsa/rsa_export_test.go new file mode 100644 index 0000000000000000000000000000000000000000..6b6afa822f6343ff6bd7128e9b4d9d2ed359eeef --- /dev/null +++ b/go/src/crypto/rsa/rsa_export_test.go @@ -0,0 +1,7 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package rsa + +var NonZeroRandomBytes = nonZeroRandomBytes diff --git a/go/src/crypto/rsa/rsa_test.go b/go/src/crypto/rsa/rsa_test.go new file mode 100644 index 0000000000000000000000000000000000000000..124fba1e8a4faa1c1e6a4b703ac96fa70a896c0b --- /dev/null +++ b/go/src/crypto/rsa/rsa_test.go @@ -0,0 +1,1374 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package rsa_test + +import ( + "bufio" + "bytes" + "crypto" + "crypto/internal/boring" + "crypto/internal/cryptotest" + "crypto/internal/fips140" + "crypto/rand" + . "crypto/rsa" + "crypto/sha1" + "crypto/sha256" + "crypto/sha512" + "crypto/x509" + "encoding/hex" + "encoding/pem" + "flag" + "fmt" + "io" + "math/big" + "os" + "slices" + "strings" + "testing" +) + +func TestKeyGeneration(t *testing.T) { + sizes := []int{128, 512, 1024, 2048, 3072, 4096} + if testing.Short() { + sizes = sizes[:2] + } + for _, size := range sizes { + t.Run(fmt.Sprintf("%d", size), func(t *testing.T) { + if size < 1024 { + _, err := GenerateKey(rand.Reader, size) + if err == nil { + t.Errorf("GenerateKey(%d) succeeded without GODEBUG", size) + } + t.Setenv("GODEBUG", "rsa1024min=0") + } + priv, err := GenerateKey(rand.Reader, size) + if err != nil { + t.Errorf("GenerateKey(%d): %v", size, err) + } + if bits := priv.N.BitLen(); bits != size { + t.Errorf("key too short (%d vs %d)", bits, size) + } + testKeyBasics(t, priv) + }) + } +} + +func Test3PrimeKeyGeneration(t *testing.T) { + size := 1024 + if testing.Short() { + t.Setenv("GODEBUG", "rsa1024min=0") + size = 256 + } + + priv, err := GenerateMultiPrimeKey(rand.Reader, 3, size) + if err != nil { + t.Errorf("failed to generate key") + } + testKeyBasics(t, priv) +} + +func Test4PrimeKeyGeneration(t *testing.T) { + size := 1024 + if testing.Short() { + t.Setenv("GODEBUG", "rsa1024min=0") + size = 256 + } + + priv, err := GenerateMultiPrimeKey(rand.Reader, 4, size) + if err != nil { + t.Errorf("failed to generate key") + } + testKeyBasics(t, priv) +} + +func TestNPrimeKeyGeneration(t *testing.T) { + t.Setenv("GODEBUG", "rsa1024min=0") + primeSize := 64 + maxN := 24 + if testing.Short() { + primeSize = 16 + maxN = 16 + } + // Test that generation of N-prime keys works for N > 4. + for n := 5; n < maxN; n++ { + priv, err := GenerateMultiPrimeKey(rand.Reader, n, 64+n*primeSize) + if err == nil { + testKeyBasics(t, priv) + } else { + t.Errorf("failed to generate %d-prime key", n) + } + } +} + +func TestImpossibleKeyGeneration(t *testing.T) { + // This test ensures that trying to generate or validate toy RSA keys + // doesn't enter an infinite loop or panic. + t.Setenv("GODEBUG", "rsa1024min=0") + for i := 0; i < 32; i++ { + GenerateKey(rand.Reader, i) + GenerateMultiPrimeKey(rand.Reader, 3, i) + GenerateMultiPrimeKey(rand.Reader, 4, i) + GenerateMultiPrimeKey(rand.Reader, 5, i) + } +} + +func TestTinyKeyGeneration(t *testing.T) { + // Toy-sized keys can randomly hit hard failures in GenerateKey. + if testing.Short() { + t.Skip("skipping in short mode") + } + t.Setenv("GODEBUG", "rsa1024min=0") + for range 10000 { + k, err := GenerateKey(rand.Reader, 32) + if err != nil { + t.Fatalf("GenerateKey(32): %v", err) + } + if err := k.Validate(); err != nil { + t.Fatalf("Validate(32): %v", err) + } + } +} + +func TestGnuTLSKey(t *testing.T) { + t.Setenv("GODEBUG", "rsa1024min=0") + // This is a key generated by `certtool --generate-privkey --bits 128`. + // It's such that de ≢ 1 mod φ(n), but is congruent mod the order of + // the group. + priv := parseKey(testingKey(`-----BEGIN RSA TESTING KEY----- +MGECAQACEQDar8EuoZuSosYtE9SeXSyPAgMBAAECEBf7XDET8e6jjTcfO7y/sykC +CQDozXjCjkBzLQIJAPB6MqNbZaQrAghbZTdQoko5LQIIUp9ZiKDdYjMCCCCpqzmX +d8Y7 +-----END RSA TESTING KEY-----`)) + testKeyBasics(t, priv) +} + +func testKeyBasics(t *testing.T, priv *PrivateKey) { + defer func() { + if t.Failed() { + t.Logf("failed key: %#v", priv) + } + }() + + if err := priv.Validate(); err != nil { + t.Errorf("Validate() failed: %s", err) + } + if priv.D.Cmp(priv.N) > 0 { + t.Errorf("private exponent too large") + } + + msg := []byte("hi!") + enc, err := EncryptPKCS1v15(rand.Reader, &priv.PublicKey, msg) + if err != nil { + t.Errorf("EncryptPKCS1v15: %v", err) + return + } + + dec, err := DecryptPKCS1v15(nil, priv, enc) + if err != nil { + t.Errorf("DecryptPKCS1v15: %v", err) + return + } + if !bytes.Equal(dec, msg) { + t.Errorf("got:%x want:%x (%+v)", dec, msg, priv) + } +} + +func TestAllocations(t *testing.T) { + cryptotest.SkipTestAllocations(t) + + m := []byte("Hello Gophers") + c, err := EncryptPKCS1v15(rand.Reader, &test2048Key.PublicKey, m) + if err != nil { + t.Fatal(err) + } + + if allocs := testing.AllocsPerRun(100, func() { + p, err := DecryptPKCS1v15(nil, test2048Key, c) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(p, m) { + t.Fatalf("unexpected output: %q", p) + } + }); allocs > 10 { + t.Errorf("expected less than 10 allocations, got %0.1f", allocs) + } +} + +var allFlag = flag.Bool("all", false, "test all key sizes up to 2048") + +func TestEverything(t *testing.T) { + if testing.Short() { + // Skip key generation, but still test real sizes. + for _, key := range []*PrivateKey{test1024Key, test2048Key} { + t.Run(fmt.Sprintf("%d", key.N.BitLen()), func(t *testing.T) { + t.Parallel() + testEverything(t, key) + }) + } + return + } + + t.Setenv("GODEBUG", "rsa1024min=0") + min := 32 + max := 560 // any smaller than this and not all tests will run + if *allFlag { + max = 2048 + } + for size := min; size <= max; size++ { + t.Run(fmt.Sprintf("%d", size), func(t *testing.T) { + t.Parallel() + priv, err := GenerateKey(rand.Reader, size) + if err != nil { + t.Fatalf("GenerateKey(%d): %v", size, err) + } + if bits := priv.N.BitLen(); bits != size { + t.Errorf("key too short (%d vs %d)", bits, size) + } + testEverything(t, priv) + }) + } +} + +func testEverything(t *testing.T, priv *PrivateKey) { + validateErr := priv.Validate() + if validateErr != nil && len(priv.Primes) >= 2 { + t.Errorf("Validate() failed: %s", validateErr) + } + + msg := []byte("test") + enc, err := EncryptPKCS1v15(rand.Reader, &priv.PublicKey, msg) + if err == ErrMessageTooLong { + t.Log("key too small for EncryptPKCS1v15") + } else if err != nil { + t.Errorf("EncryptPKCS1v15: %v", err) + } + if err == nil { + dec, err := DecryptPKCS1v15(nil, priv, enc) + if err != nil { + t.Errorf("DecryptPKCS1v15: %v", err) + } + err = DecryptPKCS1v15SessionKey(nil, priv, enc, make([]byte, 4)) + if err != nil { + t.Errorf("DecryptPKCS1v15SessionKey: %v", err) + } + if !bytes.Equal(dec, msg) { + t.Errorf("got:%x want:%x (%+v)", dec, msg, priv) + } + } + + label := []byte("label") + enc, err = EncryptOAEP(sha256.New(), rand.Reader, &priv.PublicKey, msg, label) + if err == ErrMessageTooLong { + t.Log("key too small for EncryptOAEP") + } else if err != nil { + t.Errorf("EncryptOAEP: %v", err) + } + if err == nil { + dec, err := DecryptOAEP(sha256.New(), nil, priv, enc, label) + if err != nil { + t.Errorf("DecryptOAEP: %v", err) + } + if !bytes.Equal(dec, msg) { + t.Errorf("got:%x want:%x (%+v)", dec, msg, priv) + } + } + + const hashMsg = "crypto/rsa: input must be hashed message" + sig, err := SignPKCS1v15(nil, priv, crypto.SHA256, msg) + if err == nil || err.Error() != hashMsg { + t.Errorf("SignPKCS1v15 with bad hash: err = %q, want %q", err, hashMsg) + } + + hash := sha256.Sum256(msg) + sig, err = SignPKCS1v15(nil, priv, crypto.SHA256, hash[:]) + if err == ErrMessageTooLong { + t.Log("key too small for SignPKCS1v15") + } else if err != nil { + t.Errorf("SignPKCS1v15: %v", err) + } + if err == nil { + err = VerifyPKCS1v15(&priv.PublicKey, crypto.SHA256, hash[:], sig) + if err != nil { + t.Errorf("VerifyPKCS1v15: %v", err) + } + sig[1] ^= 0x80 + err = VerifyPKCS1v15(&priv.PublicKey, crypto.SHA256, hash[:], sig) + if err == nil { + t.Errorf("VerifyPKCS1v15 success for tampered signature") + } + sig[1] ^= 0x80 + hash[1] ^= 0x80 + err = VerifyPKCS1v15(&priv.PublicKey, crypto.SHA256, hash[:], sig) + if err == nil { + t.Errorf("VerifyPKCS1v15 success for tampered message") + } + hash[1] ^= 0x80 + } + + opts := &PSSOptions{SaltLength: PSSSaltLengthAuto} + sig, err = SignPSS(rand.Reader, priv, crypto.SHA256, hash[:], opts) + if err == ErrMessageTooLong { + t.Log("key too small for SignPSS with PSSSaltLengthAuto") + } else if err != nil { + t.Errorf("SignPSS: %v", err) + } + if err == nil { + err = VerifyPSS(&priv.PublicKey, crypto.SHA256, hash[:], sig, opts) + if err != nil { + t.Errorf("VerifyPSS: %v", err) + } + sig[1] ^= 0x80 + err = VerifyPSS(&priv.PublicKey, crypto.SHA256, hash[:], sig, opts) + if err == nil { + t.Errorf("VerifyPSS success for tampered signature") + } + sig[1] ^= 0x80 + hash[1] ^= 0x80 + err = VerifyPSS(&priv.PublicKey, crypto.SHA256, hash[:], sig, opts) + if err == nil { + t.Errorf("VerifyPSS success for tampered message") + } + hash[1] ^= 0x80 + } + + opts.SaltLength = PSSSaltLengthEqualsHash + sig, err = SignPSS(rand.Reader, priv, crypto.SHA256, hash[:], opts) + if err == ErrMessageTooLong { + t.Log("key too small for SignPSS with PSSSaltLengthEqualsHash") + } else if err != nil { + t.Errorf("SignPSS: %v", err) + } + if err == nil { + err = VerifyPSS(&priv.PublicKey, crypto.SHA256, hash[:], sig, opts) + if err != nil { + t.Errorf("VerifyPSS: %v", err) + } + sig[1] ^= 0x80 + err = VerifyPSS(&priv.PublicKey, crypto.SHA256, hash[:], sig, opts) + if err == nil { + t.Errorf("VerifyPSS success for tampered signature") + } + sig[1] ^= 0x80 + hash[1] ^= 0x80 + err = VerifyPSS(&priv.PublicKey, crypto.SHA256, hash[:], sig, opts) + if err == nil { + t.Errorf("VerifyPSS success for tampered message") + } + hash[1] ^= 0x80 + } + + // Check that an input bigger than the modulus is handled correctly, + // whether it is longer than the byte size of the modulus or not. + c := bytes.Repeat([]byte{0xff}, priv.Size()) + err = VerifyPSS(&priv.PublicKey, crypto.SHA256, hash[:], c, opts) + if err == nil { + t.Errorf("VerifyPSS accepted a large signature") + } + _, err = DecryptPKCS1v15(nil, priv, c) + if err == nil { + t.Errorf("DecryptPKCS1v15 accepted a large ciphertext") + } + c = append(c, 0xff) + err = VerifyPSS(&priv.PublicKey, crypto.SHA256, hash[:], c, opts) + if err == nil { + t.Errorf("VerifyPSS accepted a long signature") + } + _, err = DecryptPKCS1v15(nil, priv, c) + if err == nil { + t.Errorf("DecryptPKCS1v15 accepted a long ciphertext") + } + + if validateErr == nil { + der, err := x509.MarshalPKCS8PrivateKey(priv) + if err != nil { + t.Errorf("MarshalPKCS8PrivateKey: %v", err) + } + key, err := x509.ParsePKCS8PrivateKey(der) + if err != nil { + t.Errorf("ParsePKCS8PrivateKey: %v", err) + } + if !key.(*PrivateKey).Equal(priv) { + t.Errorf("private key mismatch") + } + } + + der, err := x509.MarshalPKIXPublicKey(&priv.PublicKey) + if err != nil { + t.Errorf("MarshalPKIXPublicKey: %v", err) + } + pub, err := x509.ParsePKIXPublicKey(der) + if err != nil { + t.Errorf("ParsePKIXPublicKey: %v", err) + } + if !pub.(*PublicKey).Equal(&priv.PublicKey) { + t.Errorf("public key mismatch") + } +} + +func TestKeyTooSmall(t *testing.T) { + checkErr := func(err error) { + t.Helper() + if err == nil { + t.Error("expected error") + } + if !strings.Contains(err.Error(), "insecure") { + t.Errorf("unexpected error: %v", err) + } + } + checkErr2 := func(_ []byte, err error) { + t.Helper() + checkErr(err) + } + + buf := make([]byte, 512/8) + checkErr2(test512Key.Sign(rand.Reader, buf, crypto.SHA512)) + checkErr2(test512Key.Sign(rand.Reader, buf, &PSSOptions{SaltLength: PSSSaltLengthEqualsHash})) + checkErr2(test512Key.Decrypt(rand.Reader, buf, &PKCS1v15DecryptOptions{})) + checkErr2(test512Key.Decrypt(rand.Reader, buf, &OAEPOptions{Hash: crypto.SHA512})) + checkErr(VerifyPKCS1v15(&test512Key.PublicKey, crypto.SHA512, buf, buf)) + checkErr(VerifyPSS(&test512Key.PublicKey, crypto.SHA512, buf, buf, &PSSOptions{SaltLength: PSSSaltLengthEqualsHash})) + checkErr2(SignPKCS1v15(rand.Reader, test512Key, crypto.SHA512, buf)) + checkErr2(SignPSS(rand.Reader, test512Key, crypto.SHA512, buf, &PSSOptions{SaltLength: PSSSaltLengthEqualsHash})) + checkErr2(EncryptPKCS1v15(rand.Reader, &test512Key.PublicKey, buf)) + checkErr2(EncryptOAEP(sha512.New(), rand.Reader, &test512Key.PublicKey, buf, nil)) + checkErr2(DecryptPKCS1v15(nil, test512Key, buf)) + checkErr2(DecryptOAEP(sha512.New(), nil, test512Key, buf, nil)) + checkErr(DecryptPKCS1v15SessionKey(nil, test512Key, buf, buf)) +} + +func testingKey(s string) string { return strings.ReplaceAll(s, "TESTING KEY", "PRIVATE KEY") } + +func parseKey(s string) *PrivateKey { + p, _ := pem.Decode([]byte(s)) + if p.Type == "PRIVATE KEY" { + k, err := x509.ParsePKCS8PrivateKey(p.Bytes) + if err != nil { + panic(err) + } + return k.(*PrivateKey) + } + k, err := x509.ParsePKCS1PrivateKey(p.Bytes) + if err != nil { + panic(err) + } + return k +} + +var rsaPrivateKey = test1024Key + +var test512Key = parseKey(testingKey(`-----BEGIN RSA TESTING KEY----- +MIIBOgIBAAJBALKZD0nEffqM1ACuak0bijtqE2QrI/KLADv7l3kK3ppMyCuLKoF0 +fd7Ai2KW5ToIwzFofvJcS/STa6HA5gQenRUCAwEAAQJBAIq9amn00aS0h/CrjXqu +/ThglAXJmZhOMPVn4eiu7/ROixi9sex436MaVeMqSNf7Ex9a8fRNfWss7Sqd9eWu +RTUCIQDasvGASLqmjeffBNLTXV2A5g4t+kLVCpsEIZAycV5GswIhANEPLmax0ME/ +EO+ZJ79TJKN5yiGBRsv5yvx5UiHxajEXAiAhAol5N4EUyq6I9w1rYdhPMGpLfk7A +IU2snfRJ6Nq2CQIgFrPsWRCkV+gOYcajD17rEqmuLrdIRexpg8N1DOSXoJ8CIGlS +tAboUGBxTDq3ZroNism3DaMIbKPyYrAqhKov1h5V +-----END RSA TESTING KEY-----`)) + +var test512KeyTwo = parseKey(testingKey(`-----BEGIN TESTING KEY----- +MIIBVgIBADANBgkqhkiG9w0BAQEFAASCAUAwggE8AgEAAkEA0wLCoguSfgskR8tY +Fh2AzXQzBpSEmPucxtVe93HzPdQpxvtSTvZe5kIsdvPc7QZ0dCc/qbnUBRbuGIAl +Ir0c9QIDAQABAkAzul+AXhnhcFXKi9ziPwVOWIgRuuLupe//BluriXG53BEBSVrV +Hr7qFqwnSLSLroMzqhZwoqyRgjsLYyGEHDGBAiEA8T0sDPuht3w2Qv61IAvBwjLH +H4HXjRUEWYRn1XjHqAUCIQDf7BYlANRqFfvg1YK3VCM4YyK2mH1UivDi8wdPlJRk +MQIhAMp5i2WCNeNpD6n/WkqBU6kJMXPSaPZy82mm5feYHgt5AiEAkg/QnhB9fjma +1BzRqD4Uv0pDMXIkhooe+Rrn0OwtI3ECIQDP6nxML3JOjbAS7ydFBv176uVsMJib +r4PZozCXKuuGNg== +-----END PRIVATE KEY-----`)) + +var test1024Key = parseKey(testingKey(`-----BEGIN RSA TESTING KEY----- +MIICXQIBAAKBgQCw0YNSqI9T1VFvRsIOejZ9feiKz1SgGfbe9Xq5tEzt2yJCsbyg ++xtcuCswNhdqY5A1ZN7G60HbL4/Hh/TlLhFJ4zNHVylz9mDDx3yp4IIcK2lb566d +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alBSxubne6rFmhvA00y2mG40c6Ezmxn2ZpbX3dMQ6bMcPKp7QnXtLc +mCSL4FGK02ImUNDsd0RVVFw51DRId4rmsuJYMK9NAoGAKlYdc4784ixTD2ZICIOC +ZWPxPAyQUEA7EkuUhAX1bVNG6UJTYA8kmGcUCG4jPTgWzi00IyUUr8jK7efyU/zs +qiJuVs1bia+flYIQpysMl1VzZh8gW1nkB4SVPm5l2wBvVJDIr9Mc6rueC/oVNkh2 +fLVGuFoTVIu2bF0cWAjNNMg= +-----END TESTING KEY-----`) + +var test2048Key = parseKey(test2048KeyPEM) + +var test2048KeyOnlyD = &PrivateKey{ + PublicKey: test2048Key.PublicKey, + D: test2048Key.D, +} + +var test2048KeyWithoutPrecomputed = &PrivateKey{ + PublicKey: test2048Key.PublicKey, + D: test2048Key.D, + Primes: test2048Key.Primes, +} + +// test2048KeyWithPrecomputed is different from test2048Key because it includes +// only the public precomputed values, and not the fips140/rsa.PrivateKey. +var test2048KeyWithPrecomputed = &PrivateKey{ + PublicKey: test2048Key.PublicKey, + D: test2048Key.D, + Primes: test2048Key.Primes, + Precomputed: PrecomputedValues{ + Dp: test2048Key.Precomputed.Dp, + Dq: test2048Key.Precomputed.Dq, + Qinv: test2048Key.Precomputed.Qinv, + }, +} + +var test3072Key = parseKey(testingKey(`-----BEGIN TESTING KEY----- +MIIG/gIBADANBgkqhkiG9w0BAQEFAASCBugwggbkAgEAAoIBgQDJrvevql7G07LM +xQAwAA1Oo8qUAkWfmpgrpxIUZE1QTyMCDaspQJGBBR2+iStrzi2NnWvyBz3jJWFZ +LepnsMUFSXj5Ez6bEt2x9YbLAAVGhI6USrGAKqRdJ77+F7yIVCJWcV4vtTyN86IO +UaHObwCR8GX7MUwJiRxDUZtYxJcwTMHSs4OWxNnqc+A8yRKn85CsCx0X9I1DULq+ +5BL8gF3MUXvb2zYzIOGI1s3lXOo9tHVcRVB1eV7dZHDyYGxZ4Exj9eKhiOL52hE6 +ZPTWCCKbQnyBV3HYe+t8D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yii8OzXEopB+jByFA +lmMqnKt8z5DRD0dmHXzOggnKJGO2j63/XFaVmsaXcM2B8wlRCqwm4mBE/bYCEKJl +xqkDveICzwb1paWSgmFkjc6DN2g1jUd3ptOORuU38onrSphPHFxgyNlNTcOcXvxb +GW4R8iPinvpkY3shluWqRQTvai1+gNQlmKMdqXvreUjKqJFCOhoRUVG/MDv8IdP2 +tXq43+UZswKBwQDSErOzi74r25/bVAdbR9gvjF7O4OGvKZzNpd1HfvbhxXcIjuXr +UEK5+AU777ju+ndATZahiD9R9qP/8pnHFxg6JiocxnMlW8EHVEhv4+SMBjA+Ljlj +W4kfJjc3ka5qTjWuQVIs/8fv+yayC7DeJhhsxACFWY5Xhn0LoZcLt7fYMNIKCauT +R5d4ZbYt4nEXaMkUt0/h2gkCloNhLmjAWatPU/ZYc3FH/f8K11Z+5jPZCihSJw4A +2pEpH2yffNHnHuECgcEAmxIWEHNYuwYT6brEETgfsFjxAZI+tIMZ+HtrYJ8R4DEm +vVXXguMMEPi4ESosmfNiqYyMInVfscgeuNFZ48YCd3Sg++V6so/G5ABFwjTi/9Fj +exbbDLxGXrTD5PokMyu3rSNr6bLQqELIJK8/93bmsJwO4Q07TPaOL73p1U90s/GF +8TjBivrVY2RLsKPv0VPYfmWoDV/wkneYH/+4g5xMGt4/fHZ6bEn8iQ4ncXM0dlW4 +tSTIf6D80RAjNwG4VzitAoHAA8GLh22w+Cx8RPsj6xdrUiVFE+nNMMgeY8Mdjsrq +Fh4jJb+4zwSML9R6iJu/LH5B7Fre2Te8QrYP+k/jIHPYJtGesVt/WlAtpDCNsC3j +8CBzxwL6zkN+46pph35jPKUSaQQ2r8euNMp/sirkYcP8PpbdtifXCjN08QQIKsqj +17IGHe9jZX/EVnSshCkXOBHG31buV10k5GSkeKcoDrkpp25wQ6FjW9L3Q68y6Y8r +8h02sdAMB9Yc2A4EgzOySWoD +-----END TESTING KEY-----`)) + +var test4096Key = parseKey(testingKey(`-----BEGIN TESTING KEY----- +MIIJQQ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CS1v15(b *testing.B) { + b.Run("2048", func(b *testing.B) { benchmarkDecryptPKCS1v15(b, test2048Key) }) + b.Run("3072", func(b *testing.B) { benchmarkDecryptPKCS1v15(b, test3072Key) }) + b.Run("4096", func(b *testing.B) { benchmarkDecryptPKCS1v15(b, test4096Key) }) +} + +func benchmarkDecryptPKCS1v15(b *testing.B, k *PrivateKey) { + r := bufio.NewReaderSize(rand.Reader, 1<<15) + + m := []byte("Hello Gophers") + c, err := EncryptPKCS1v15(r, &k.PublicKey, m) + if err != nil { + b.Fatal(err) + } + + b.ResetTimer() + var sink byte + for i := 0; i < b.N; i++ { + p, err := DecryptPKCS1v15(r, k, c) + if err != nil { + b.Fatal(err) + } + if !bytes.Equal(p, m) { + b.Fatalf("unexpected output: %q", p) + } + sink ^= p[0] + } +} + +func BenchmarkEncryptPKCS1v15(b *testing.B) { + b.Run("2048", func(b *testing.B) { + r := bufio.NewReaderSize(rand.Reader, 1<<15) + m := []byte("Hello Gophers") + + var sink byte + for i := 0; i < b.N; i++ { + c, err := EncryptPKCS1v15(r, &test2048Key.PublicKey, m) + if err != nil { + b.Fatal(err) + } + sink ^= c[0] + } + }) +} + +func BenchmarkDecryptOAEP(b *testing.B) { + b.Run("2048", func(b *testing.B) { + r := bufio.NewReaderSize(rand.Reader, 1<<15) + + m := []byte("Hello Gophers") + c, err := EncryptOAEP(sha256.New(), r, &test2048Key.PublicKey, m, nil) + if err != nil { + b.Fatal(err) + } + + b.ResetTimer() + var sink byte + for i := 0; i < b.N; i++ { + p, err := DecryptOAEP(sha256.New(), r, test2048Key, c, nil) + if err != nil { + b.Fatal(err) + } + if !bytes.Equal(p, m) { + b.Fatalf("unexpected output: %q", p) + } + sink ^= p[0] + } + }) +} + +func BenchmarkEncryptOAEP(b *testing.B) { + b.Run("2048", func(b *testing.B) { + r := bufio.NewReaderSize(rand.Reader, 1<<15) + m := []byte("Hello Gophers") + + var sink byte + for i := 0; i < b.N; i++ { + c, err := EncryptOAEP(sha256.New(), r, &test2048Key.PublicKey, m, nil) + if err != nil { + b.Fatal(err) + } + sink ^= c[0] + } + }) +} + +func BenchmarkSignPKCS1v15(b *testing.B) { + b.Run("2048", func(b *testing.B) { benchmarkSignPKCS1v15(b, test2048Key) }) + b.Run("2048/noprecomp/OnlyD", func(b *testing.B) { + benchmarkSignPKCS1v15(b, test2048KeyOnlyD) + }) + b.Run("2048/noprecomp/Primes", func(b *testing.B) { + benchmarkSignPKCS1v15(b, test2048KeyWithoutPrecomputed) + }) + // This is different from "2048" because it's only the public precomputed + // values, and not the crypto/internal/fips140/rsa.PrivateKey. + b.Run("2048/noprecomp/AllValues", func(b *testing.B) { + benchmarkSignPKCS1v15(b, test2048KeyWithPrecomputed) + }) +} + +func benchmarkSignPKCS1v15(b *testing.B, k *PrivateKey) { + hashed := sha256.Sum256([]byte("testing")) + + var sink byte + b.ResetTimer() + for i := 0; i < b.N; i++ { + s, err := SignPKCS1v15(rand.Reader, k, crypto.SHA256, hashed[:]) + if err != nil { + b.Fatal(err) + } + sink ^= s[0] + } +} + +func BenchmarkVerifyPKCS1v15(b *testing.B) { + b.Run("2048", func(b *testing.B) { + hashed := sha256.Sum256([]byte("testing")) + s, err := SignPKCS1v15(rand.Reader, test2048Key, crypto.SHA256, hashed[:]) + if err != nil { + b.Fatal(err) + } + + b.ResetTimer() + for i := 0; i < b.N; i++ { + err := VerifyPKCS1v15(&test2048Key.PublicKey, crypto.SHA256, hashed[:], s) + if err != nil { + b.Fatal(err) + } + } + }) +} + +func BenchmarkSignPSS(b *testing.B) { + b.Run("2048", func(b *testing.B) { + hashed := sha256.Sum256([]byte("testing")) + + var sink byte + b.ResetTimer() + for i := 0; i < b.N; i++ { + s, err := SignPSS(rand.Reader, test2048Key, crypto.SHA256, hashed[:], nil) + if err != nil { + b.Fatal(err) + } + sink ^= s[0] + } + }) +} + +func BenchmarkVerifyPSS(b *testing.B) { + b.Run("2048", func(b *testing.B) { + hashed := sha256.Sum256([]byte("testing")) + s, err := SignPSS(rand.Reader, test2048Key, crypto.SHA256, hashed[:], nil) + if err != nil { + b.Fatal(err) + } + + b.ResetTimer() + for i := 0; i < b.N; i++ { + err := VerifyPSS(&test2048Key.PublicKey, crypto.SHA256, hashed[:], s, nil) + if err != nil { + b.Fatal(err) + } + } + }) +} + +func BenchmarkParsePKCS8PrivateKey(b *testing.B) { + b.Run("2048", func(b *testing.B) { + p, _ := pem.Decode([]byte(test2048KeyPEM)) + b.ResetTimer() + for i := 0; i < b.N; i++ { + if _, err := x509.ParsePKCS8PrivateKey(p.Bytes); err != nil { + b.Fatal(err) + } + } + }) +} + +func BenchmarkGenerateKey(b *testing.B) { + b.Run("2048", func(b *testing.B) { + primes, err := os.ReadFile("testdata/keygen2048.txt") + if err != nil { + b.Fatal(err) + } + for b.Loop() { + r := &testPrimeReader{primes: string(primes)} + if _, err := GenerateKey(r, 2048); err != nil { + b.Fatal(err) + } + } + }) +} + +// testPrimeReader feeds prime candidates from a text file, +// one per line in hex, to GenerateKey. +type testPrimeReader struct { + primes string +} + +func (r *testPrimeReader) Read(p []byte) (n int, err error) { + // Neutralize randutil.MaybeReadByte. + // + // DO NOT COPY this. We *will* break you. We can do this because we're + // in the standard library, and can update this along with the + // GenerateKey implementation if necessary. + // + // You have been warned. + if len(p) == 1 { + return 1, nil + } + + var line string + for line == "" || line[0] == '#' { + var ok bool + line, r.primes, ok = strings.Cut(r.primes, "\n") + if !ok { + return 0, io.EOF + } + } + b, err := hex.DecodeString(line) + if err != nil { + return 0, err + } + if len(p) != len(b) { + return 0, fmt.Errorf("unexpected read length: %d", len(p)) + } + copy(p, b) + return len(p), nil +} + +type testEncryptOAEPMessage struct { + in []byte + seed []byte + out []byte +} + +type testEncryptOAEPStruct struct { + modulus string + e int + d string + msgs []testEncryptOAEPMessage +} + +func TestEncryptOAEP(t *testing.T) { + sha1 := sha1.New() + n := new(big.Int) + for i, test := range testEncryptOAEPData { + n.SetString(test.modulus, 16) + public := PublicKey{N: n, E: test.e} + + for j, message := range test.msgs { + randomSource := bytes.NewReader(message.seed) + out, err := EncryptOAEP(sha1, randomSource, &public, message.in, nil) + if err != nil { + t.Errorf("#%d,%d error: %s", i, j, err) + } + if !bytes.Equal(out, message.out) { + t.Errorf("#%d,%d bad result: %x (want %x)", i, j, out, message.out) + } + } + } +} + +func TestDecryptOAEP(t *testing.T) { + random := rand.Reader + + sha1 := sha1.New() + n := new(big.Int) + d := new(big.Int) + for i, test := range testEncryptOAEPData { + n.SetString(test.modulus, 16) + d.SetString(test.d, 16) + private := new(PrivateKey) + private.PublicKey = PublicKey{N: n, E: test.e} + private.D = d + + for j, message := range test.msgs { + out, err := DecryptOAEP(sha1, nil, private, message.out, nil) + if err != nil { + t.Errorf("#%d,%d error: %s", i, j, err) + } else if !bytes.Equal(out, message.in) { + t.Errorf("#%d,%d bad result: %#v (want %#v)", i, j, out, message.in) + } + + // Decrypt with blinding. + out, err = DecryptOAEP(sha1, random, private, message.out, nil) + if err != nil { + t.Errorf("#%d,%d (blind) error: %s", i, j, err) + } else if !bytes.Equal(out, message.in) { + t.Errorf("#%d,%d (blind) bad result: %#v (want %#v)", i, j, out, message.in) + } + } + if testing.Short() { + break + } + } +} + +func Test2DecryptOAEP(t *testing.T) { + random := rand.Reader + + msg := []byte{0xed, 0x36, 0x90, 0x8d, 0xbe, 0xfc, 0x35, 0x40, 0x70, 0x4f, 0xf5, 0x9d, 0x6e, 0xc2, 0xeb, 0xf5, 0x27, 0xae, 0x65, 0xb0, 0x59, 0x29, 0x45, 0x25, 0x8c, 0xc1, 0x91, 0x22} + in := []byte{0x72, 0x26, 0x84, 0xc9, 0xcf, 0xd6, 0xa8, 0x96, 0x04, 0x3e, 0x34, 0x07, 0x2c, 0x4f, 0xe6, 0x52, 0xbe, 0x46, 0x3c, 0xcf, 0x79, 0x21, 0x09, 0x64, 0xe7, 0x33, 0x66, 0x9b, 0xf8, 0x14, 0x22, 0x43, 0xfe, 0x8e, 0x52, 0x8b, 0xe0, 0x5f, 0x98, 0xef, 0x54, 0xac, 0x6b, 0xc6, 0x26, 0xac, 0x5b, 0x1b, 0x4b, 0x7d, 0x2e, 0xd7, 0x69, 0x28, 0x5a, 0x2f, 0x4a, 0x95, 0x89, 0x6c, 0xc7, 0x53, 0x95, 0xc7, 0xd2, 0x89, 0x04, 0x6f, 0x94, 0x74, 0x9b, 0x09, 0x0d, 0xf4, 0x61, 0x2e, 0xab, 0x48, 0x57, 0x4a, 0xbf, 0x95, 0xcb, 0xff, 0x15, 0xe2, 0xa0, 0x66, 0x58, 0xf7, 0x46, 0xf8, 0xc7, 0x0b, 0xb5, 0x1e, 0xa7, 0xba, 0x36, 0xce, 0xdd, 0x36, 0x41, 0x98, 0x6e, 0x10, 0xf9, 0x3b, 0x70, 0xbb, 0xa1, 0xda, 0x00, 0x40, 0xd5, 0xa5, 0x3f, 0x87, 0x64, 0x32, 0x7c, 0xbc, 0x50, 0x52, 0x0e, 0x4f, 0x21, 0xbd} + + n := new(big.Int) + d := new(big.Int) + n.SetString(testEncryptOAEPData[0].modulus, 16) + d.SetString(testEncryptOAEPData[0].d, 16) + priv := new(PrivateKey) + priv.PublicKey = PublicKey{N: n, E: testEncryptOAEPData[0].e} + priv.D = d + sha1 := crypto.SHA1 + sha256 := crypto.SHA256 + + out, err := priv.Decrypt(random, in, &OAEPOptions{MGFHash: sha1, Hash: sha256}) + + if err != nil { + t.Errorf("error: %s", err) + } else if !bytes.Equal(out, msg) { + t.Errorf("bad result %#v (want %#v)", out, msg) + } +} + +func TestEncryptDecryptOAEP(t *testing.T) { + sha256 := sha256.New() + n := new(big.Int) + d := new(big.Int) + for i, test := range testEncryptOAEPData { + n.SetString(test.modulus, 16) + d.SetString(test.d, 16) + priv := new(PrivateKey) + priv.PublicKey = PublicKey{N: n, E: test.e} + priv.D = d + + for j, message := range test.msgs { + label := []byte(fmt.Sprintf("hi#%d", j)) + enc, err := EncryptOAEP(sha256, rand.Reader, &priv.PublicKey, message.in, label) + if err != nil { + t.Errorf("#%d,%d: EncryptOAEP: %v", i, j, err) + continue + } + dec, err := DecryptOAEP(sha256, rand.Reader, priv, enc, label) + if err != nil { + t.Errorf("#%d,%d: DecryptOAEP: %v", i, j, err) + continue + } + if !bytes.Equal(dec, message.in) { + t.Errorf("#%d,%d: round trip %q -> %q", i, j, message.in, dec) + } + + // Using different hash for MGF. + enc, err = EncryptOAEPWithOptions(rand.Reader, &priv.PublicKey, message.in, &OAEPOptions{Hash: crypto.SHA256, MGFHash: crypto.SHA1, Label: label}) + if err != nil { + t.Errorf("#%d,%d: EncryptOAEP with different MGFHash: %v", i, j, err) + continue + } + dec, err = priv.Decrypt(rand.Reader, enc, &OAEPOptions{Hash: crypto.SHA256, MGFHash: crypto.SHA1, Label: label}) + if err != nil { + t.Errorf("#%d,%d: DecryptOAEP with different MGFHash: %v", i, j, err) + continue + } + if !bytes.Equal(dec, message.in) { + t.Errorf("#%d,%d: round trip with different MGFHash %q -> %q", i, j, message.in, dec) + } + + // Using a zero MGFHash. + enc, err = EncryptOAEPWithOptions(rand.Reader, &priv.PublicKey, message.in, &OAEPOptions{Hash: crypto.SHA256, Label: label}) + if err != nil { + t.Errorf("#%d,%d: EncryptOAEP with zero MGFHash: %v", i, j, err) + continue + } + dec, err = DecryptOAEP(sha256, rand.Reader, priv, enc, label) + if err != nil { + t.Errorf("#%d,%d: DecryptOAEP with zero MGFHash: %v", i, j, err) + continue + } + if !bytes.Equal(dec, message.in) { + t.Errorf("#%d,%d: round trip with zero MGFHash %q -> %q", i, j, message.in, dec) + } + } + } +} + +// testEncryptOAEPData contains a subset of the vectors from RSA's "Test vectors for RSA-OAEP". +var testEncryptOAEPData = []testEncryptOAEPStruct{ + // Key 1 + {"a8b3b284af8eb50b387034a860f146c4919f318763cd6c5598c8ae4811a1e0abc4c7e0b082d693a5e7fced675cf4668512772c0cbc64a742c6c630f533c8cc72f62ae833c40bf25842e984bb78bdbf97c0107d55bdb662f5c4e0fab9845cb5148ef7392dd3aaff93ae1e6b667bb3d4247616d4f5ba10d4cfd226de88d39f16fb", + 65537, + "53339cfdb79fc8466a655c7316aca85c55fd8f6dd898fdaf119517ef4f52e8fd8e258df93fee180fa0e4ab29693cd83b152a553d4ac4d1812b8b9fa5af0e7f55fe7304df41570926f3311f15c4d65a732c483116ee3d3d2d0af3549ad9bf7cbfb78ad884f84d5beb04724dc7369b31def37d0cf539e9cfcdd3de653729ead5d1", + []testEncryptOAEPMessage{ + // Example 1.1 + { + []byte{0x66, 0x28, 0x19, 0x4e, 0x12, 0x07, 0x3d, 0xb0, + 0x3b, 0xa9, 0x4c, 0xda, 0x9e, 0xf9, 0x53, 0x23, 0x97, + 0xd5, 0x0d, 0xba, 0x79, 0xb9, 0x87, 0x00, 0x4a, 0xfe, + 0xfe, 0x34, + }, + []byte{0x18, 0xb7, 0x76, 0xea, 0x21, 0x06, 0x9d, 0x69, + 0x77, 0x6a, 0x33, 0xe9, 0x6b, 0xad, 0x48, 0xe1, 0xdd, + 0xa0, 0xa5, 0xef, + }, + []byte{0x35, 0x4f, 0xe6, 0x7b, 0x4a, 0x12, 0x6d, 0x5d, + 0x35, 0xfe, 0x36, 0xc7, 0x77, 0x79, 0x1a, 0x3f, 0x7b, + 0xa1, 0x3d, 0xef, 0x48, 0x4e, 0x2d, 0x39, 0x08, 0xaf, + 0xf7, 0x22, 0xfa, 0xd4, 0x68, 0xfb, 0x21, 0x69, 0x6d, + 0xe9, 0x5d, 0x0b, 0xe9, 0x11, 0xc2, 0xd3, 0x17, 0x4f, + 0x8a, 0xfc, 0xc2, 0x01, 0x03, 0x5f, 0x7b, 0x6d, 0x8e, + 0x69, 0x40, 0x2d, 0xe5, 0x45, 0x16, 0x18, 0xc2, 0x1a, + 0x53, 0x5f, 0xa9, 0xd7, 0xbf, 0xc5, 0xb8, 0xdd, 0x9f, + 0xc2, 0x43, 0xf8, 0xcf, 0x92, 0x7d, 0xb3, 0x13, 0x22, + 0xd6, 0xe8, 0x81, 0xea, 0xa9, 0x1a, 0x99, 0x61, 0x70, + 0xe6, 0x57, 0xa0, 0x5a, 0x26, 0x64, 0x26, 0xd9, 0x8c, + 0x88, 0x00, 0x3f, 0x84, 0x77, 0xc1, 0x22, 0x70, 0x94, + 0xa0, 0xd9, 0xfa, 0x1e, 0x8c, 0x40, 0x24, 0x30, 0x9c, + 0xe1, 0xec, 0xcc, 0xb5, 0x21, 0x00, 0x35, 0xd4, 0x7a, + 0xc7, 0x2e, 0x8a, + }, + }, + // Example 1.2 + { + []byte{0x75, 0x0c, 0x40, 0x47, 0xf5, 0x47, 0xe8, 0xe4, + 0x14, 0x11, 0x85, 0x65, 0x23, 0x29, 0x8a, 0xc9, 0xba, + 0xe2, 0x45, 0xef, 0xaf, 0x13, 0x97, 0xfb, 0xe5, 0x6f, + 0x9d, 0xd5, + }, + []byte{0x0c, 0xc7, 0x42, 0xce, 0x4a, 0x9b, 0x7f, 0x32, + 0xf9, 0x51, 0xbc, 0xb2, 0x51, 0xef, 0xd9, 0x25, 0xfe, + 0x4f, 0xe3, 0x5f, + }, + []byte{0x64, 0x0d, 0xb1, 0xac, 0xc5, 0x8e, 0x05, 0x68, + 0xfe, 0x54, 0x07, 0xe5, 0xf9, 0xb7, 0x01, 0xdf, 0xf8, + 0xc3, 0xc9, 0x1e, 0x71, 0x6c, 0x53, 0x6f, 0xc7, 0xfc, + 0xec, 0x6c, 0xb5, 0xb7, 0x1c, 0x11, 0x65, 0x98, 0x8d, + 0x4a, 0x27, 0x9e, 0x15, 0x77, 0xd7, 0x30, 0xfc, 0x7a, + 0x29, 0x93, 0x2e, 0x3f, 0x00, 0xc8, 0x15, 0x15, 0x23, + 0x6d, 0x8d, 0x8e, 0x31, 0x01, 0x7a, 0x7a, 0x09, 0xdf, + 0x43, 0x52, 0xd9, 0x04, 0xcd, 0xeb, 0x79, 0xaa, 0x58, + 0x3a, 0xdc, 0xc3, 0x1e, 0xa6, 0x98, 0xa4, 0xc0, 0x52, + 0x83, 0xda, 0xba, 0x90, 0x89, 0xbe, 0x54, 0x91, 0xf6, + 0x7c, 0x1a, 0x4e, 0xe4, 0x8d, 0xc7, 0x4b, 0xbb, 0xe6, + 0x64, 0x3a, 0xef, 0x84, 0x66, 0x79, 0xb4, 0xcb, 0x39, + 0x5a, 0x35, 0x2d, 0x5e, 0xd1, 0x15, 0x91, 0x2d, 0xf6, + 0x96, 0xff, 0xe0, 0x70, 0x29, 0x32, 0x94, 0x6d, 0x71, + 0x49, 0x2b, 0x44, + }, + }, + // Example 1.3 + { + []byte{0xd9, 0x4a, 0xe0, 0x83, 0x2e, 0x64, 0x45, 0xce, + 0x42, 0x33, 0x1c, 0xb0, 0x6d, 0x53, 0x1a, 0x82, 0xb1, + 0xdb, 0x4b, 0xaa, 0xd3, 0x0f, 0x74, 0x6d, 0xc9, 0x16, + 0xdf, 0x24, 0xd4, 0xe3, 0xc2, 0x45, 0x1f, 0xff, 0x59, + 0xa6, 0x42, 0x3e, 0xb0, 0xe1, 0xd0, 0x2d, 0x4f, 0xe6, + 0x46, 0xcf, 0x69, 0x9d, 0xfd, 0x81, 0x8c, 0x6e, 0x97, + 0xb0, 0x51, + }, + []byte{0x25, 0x14, 0xdf, 0x46, 0x95, 0x75, 0x5a, 0x67, + 0xb2, 0x88, 0xea, 0xf4, 0x90, 0x5c, 0x36, 0xee, 0xc6, + 0x6f, 0xd2, 0xfd, + }, + []byte{0x42, 0x37, 0x36, 0xed, 0x03, 0x5f, 0x60, 0x26, + 0xaf, 0x27, 0x6c, 0x35, 0xc0, 0xb3, 0x74, 0x1b, 0x36, + 0x5e, 0x5f, 0x76, 0xca, 0x09, 0x1b, 0x4e, 0x8c, 0x29, + 0xe2, 0xf0, 0xbe, 0xfe, 0xe6, 0x03, 0x59, 0x5a, 0xa8, + 0x32, 0x2d, 0x60, 0x2d, 0x2e, 0x62, 0x5e, 0x95, 0xeb, + 0x81, 0xb2, 0xf1, 0xc9, 0x72, 0x4e, 0x82, 0x2e, 0xca, + 0x76, 0xdb, 0x86, 0x18, 0xcf, 0x09, 0xc5, 0x34, 0x35, + 0x03, 0xa4, 0x36, 0x08, 0x35, 0xb5, 0x90, 0x3b, 0xc6, + 0x37, 0xe3, 0x87, 0x9f, 0xb0, 0x5e, 0x0e, 0xf3, 0x26, + 0x85, 0xd5, 0xae, 0xc5, 0x06, 0x7c, 0xd7, 0xcc, 0x96, + 0xfe, 0x4b, 0x26, 0x70, 0xb6, 0xea, 0xc3, 0x06, 0x6b, + 0x1f, 0xcf, 0x56, 0x86, 0xb6, 0x85, 0x89, 0xaa, 0xfb, + 0x7d, 0x62, 0x9b, 0x02, 0xd8, 0xf8, 0x62, 0x5c, 0xa3, + 0x83, 0x36, 0x24, 0xd4, 0x80, 0x0f, 0xb0, 0x81, 0xb1, + 0xcf, 0x94, 0xeb, + }, + }, + }, + }, + // Key 10 + {"ae45ed5601cec6b8cc05f803935c674ddbe0d75c4c09fd7951fc6b0caec313a8df39970c518bffba5ed68f3f0d7f22a4029d413f1ae07e4ebe9e4177ce23e7f5404b569e4ee1bdcf3c1fb03ef113802d4f855eb9b5134b5a7c8085adcae6fa2fa1417ec3763be171b0c62b760ede23c12ad92b980884c641f5a8fac26bdad4a03381a22fe1b754885094c82506d4019a535a286afeb271bb9ba592de18dcf600c2aeeae56e02f7cf79fc14cf3bdc7cd84febbbf950ca90304b2219a7aa063aefa2c3c1980e560cd64afe779585b6107657b957857efde6010988ab7de417fc88d8f384c4e6e72c3f943e0c31c0c4a5cc36f879d8a3ac9d7d59860eaada6b83bb", + 65537, + "056b04216fe5f354ac77250a4b6b0c8525a85c59b0bd80c56450a22d5f438e596a333aa875e291dd43f48cb88b9d5fc0d499f9fcd1c397f9afc070cd9e398c8d19e61db7c7410a6b2675dfbf5d345b804d201add502d5ce2dfcb091ce9997bbebe57306f383e4d588103f036f7e85d1934d152a323e4a8db451d6f4a5b1b0f102cc150e02feee2b88dea4ad4c1baccb24d84072d14e1d24a6771f7408ee30564fb86d4393a34bcf0b788501d193303f13a2284b001f0f649eaf79328d4ac5c430ab4414920a9460ed1b7bc40ec653e876d09abc509ae45b525190116a0c26101848298509c1c3bf3a483e7274054e15e97075036e989f60932807b5257751e79", + []testEncryptOAEPMessage{ + // Example 10.1 + { + []byte{0x8b, 0xba, 0x6b, 0xf8, 0x2a, 0x6c, 0x0f, 0x86, + 0xd5, 0xf1, 0x75, 0x6e, 0x97, 0x95, 0x68, 0x70, 0xb0, + 0x89, 0x53, 0xb0, 0x6b, 0x4e, 0xb2, 0x05, 0xbc, 0x16, + 0x94, 0xee, + }, + []byte{0x47, 0xe1, 0xab, 0x71, 0x19, 0xfe, 0xe5, 0x6c, + 0x95, 0xee, 0x5e, 0xaa, 0xd8, 0x6f, 0x40, 0xd0, 0xaa, + 0x63, 0xbd, 0x33, + }, + []byte{0x53, 0xea, 0x5d, 0xc0, 0x8c, 0xd2, 0x60, 0xfb, + 0x3b, 0x85, 0x85, 0x67, 0x28, 0x7f, 0xa9, 0x15, 0x52, + 0xc3, 0x0b, 0x2f, 0xeb, 0xfb, 0xa2, 0x13, 0xf0, 0xae, + 0x87, 0x70, 0x2d, 0x06, 0x8d, 0x19, 0xba, 0xb0, 0x7f, + 0xe5, 0x74, 0x52, 0x3d, 0xfb, 0x42, 0x13, 0x9d, 0x68, + 0xc3, 0xc5, 0xaf, 0xee, 0xe0, 0xbf, 0xe4, 0xcb, 0x79, + 0x69, 0xcb, 0xf3, 0x82, 0xb8, 0x04, 0xd6, 0xe6, 0x13, + 0x96, 0x14, 0x4e, 0x2d, 0x0e, 0x60, 0x74, 0x1f, 0x89, + 0x93, 0xc3, 0x01, 0x4b, 0x58, 0xb9, 0xb1, 0x95, 0x7a, + 0x8b, 0xab, 0xcd, 0x23, 0xaf, 0x85, 0x4f, 0x4c, 0x35, + 0x6f, 0xb1, 0x66, 0x2a, 0xa7, 0x2b, 0xfc, 0xc7, 0xe5, + 0x86, 0x55, 0x9d, 0xc4, 0x28, 0x0d, 0x16, 0x0c, 0x12, + 0x67, 0x85, 0xa7, 0x23, 0xeb, 0xee, 0xbe, 0xff, 0x71, + 0xf1, 0x15, 0x94, 0x44, 0x0a, 0xae, 0xf8, 0x7d, 0x10, + 0x79, 0x3a, 0x87, 0x74, 0xa2, 0x39, 0xd4, 0xa0, 0x4c, + 0x87, 0xfe, 0x14, 0x67, 0xb9, 0xda, 0xf8, 0x52, 0x08, + 0xec, 0x6c, 0x72, 0x55, 0x79, 0x4a, 0x96, 0xcc, 0x29, + 0x14, 0x2f, 0x9a, 0x8b, 0xd4, 0x18, 0xe3, 0xc1, 0xfd, + 0x67, 0x34, 0x4b, 0x0c, 0xd0, 0x82, 0x9d, 0xf3, 0xb2, + 0xbe, 0xc6, 0x02, 0x53, 0x19, 0x62, 0x93, 0xc6, 0xb3, + 0x4d, 0x3f, 0x75, 0xd3, 0x2f, 0x21, 0x3d, 0xd4, 0x5c, + 0x62, 0x73, 0xd5, 0x05, 0xad, 0xf4, 0xcc, 0xed, 0x10, + 0x57, 0xcb, 0x75, 0x8f, 0xc2, 0x6a, 0xee, 0xfa, 0x44, + 0x12, 0x55, 0xed, 0x4e, 0x64, 0xc1, 0x99, 0xee, 0x07, + 0x5e, 0x7f, 0x16, 0x64, 0x61, 0x82, 0xfd, 0xb4, 0x64, + 0x73, 0x9b, 0x68, 0xab, 0x5d, 0xaf, 0xf0, 0xe6, 0x3e, + 0x95, 0x52, 0x01, 0x68, 0x24, 0xf0, 0x54, 0xbf, 0x4d, + 0x3c, 0x8c, 0x90, 0xa9, 0x7b, 0xb6, 0xb6, 0x55, 0x32, + 0x84, 0xeb, 0x42, 0x9f, 0xcc, + }, + }, + }, + }, +} + +func TestPSmallerThanQ(t *testing.T) { + // This key has a 256-bit P and a 257-bit Q. + k := parseKey(testingKey(`-----BEGIN RSA TESTING KEY----- +MIIBOgIBAAJBAKj34GkxFhD90vcNLYLInFEX6Ppy1tPf9Cnzj4p4WGeKLs1Pt8Qu +KUpRKfFLfRYC9AIKjbJTWit+CqvjWYzvQwECAwEAAQJAIJLixBy2qpFoS4DSmoEm +o3qGy0t6z09AIJtH+5OeRV1be+N4cDYJKffGzDa88vQENZiRm0GRq6a+HPGQMd2k +TQIhAKMSvzIBnni7ot/OSie2TmJLY4SwTQAevXysE2RbFDYdAiEBCUEaRQnMnbp7 +9mxDXDf6AU0cN/RPBjb9qSHDcWZHGzUCIG2Es59z8ugGrDY+pxLQnwfotadxd+Uy +v/Ow5T0q5gIJAiEAyS4RaI9YG8EWx/2w0T67ZUVAw8eOMB6BIUg0Xcu+3okCIBOs +/5OiPgoTdSy7bcF9IGpSE8ZgGKzgYQVZeN97YE00 +-----END RSA TESTING KEY-----`)) + t.Setenv("GODEBUG", "rsa1024min=0") + if boring.Enabled { + t.Skip("BoringCrypto mode returns the wrong error from SignPSS") + } + testEverything(t, k) +} + +func TestLargeSizeDifference(t *testing.T) { + // This key has a 768-bit P and a 256-bit Q. + k1 := parseKey(testingKey(`-----BEGIN TESTING KEY----- +MIICmAIBADANBgkqhkiG9w0BAQEFAASCAoIwggJ+AgEAAoGBAOB/V7qbbMLHZSHS +rU3FLNQJe88wQr5asy813wqlWsCeYUn7Imxv23vDXthpkH/54+CplWDvVri24zhU +4tHfONSEBWWKTRfQKCW+vrzf+d02rB95lVBrBDSKAUR6w1Xcx9/6ib+kQRDnMl2l +WZzDgv8jrNPrLGipYBOLcI9/Oh3HAgMBAAECgYBr85AiAX8JIoy0+POxA/GMfIr2 +lERj+IVVXFhGbED5gjUBUn8kz/gOrClZAqgxJKVbdTcxn4KGOM64z427Y24H52zQ +sCq7RFJ9KDd4s1hAPQImBRUYu2blqDoqxNBQBxLHVUN7vwFp2MGsHzTz7mcx7QNG +teRbyLhCanUd3UOb4QJhAP5dyjIK1WzKBZ/jSAmjJL64bks4wEEl5eG6e2cTscCH +RE/OSpHi57dyrxgnBkczt56hOksJFzwmgk4wEM8n/JDOXwIzvAH4w4JWhu169gCW +8LgxCzJ71xv8+wUUouUTLwIhAOHwcdEAKyLo3K7X1nlYcUOX61yQ1GXRgIROGrsh +NNjpAmEAuW1nu4k4QmEXLpJB7nyWic3q4T0SsatN5HrMAL1To/U3sDHDHIxbvNiG +mcXBBuDFp4cC9rY+0OOFtDfH2SveKzW1/uX11T4iT/6Bx9cORCnEe5GNBxVOH6IQ +34hGo1WTAiEAyCYALW1AyUQPerOpQwWeEIrb7Lw/65KTjqDB/VOFRUECYQCPcc07 +D19OB593kGklAtk1XwGt1W8OmfGIKhGMKzlYhb9MezjaX/3zpO19msSUmSNKszMX +RpZX4LYz9Ity0nxQ3qZYN6XYNwvr7dCV0E5eS+mgbGWRrf3utdbUkZUNwYE= +-----END TESTING KEY-----`)) + + // This key has a 256-bit P and a 768-bit Q. + k2 := parseKey(testingKey(`-----BEGIN TESTING KEY----- +MIICVwIBADANBgkqhkiG9w0BAQEFAASCAkEwggI9AgEAAoGBAObSD1Q4cfUURAuY +RCCTDxv3TxK/VPJH/ees4eVkJHBkgErTXJsVb7df3Pyz8J5yVU7Y68osp1uRgJu1 +E/v61L388oUQbpDlhpCzkpx2ZBfwx891JJBNgrRu/ZEDaWfXA4fx3iUDcA83NfY+ +WWBlwwjhZG2jTQAgB0kz6fIhxODRAgMBAAECgYAJcO3i1WC25C5w1Xhy5yT68TuN +IiGWu+JbLa97NySE6tOHRvQk0QSTUGw8thsEoo3BAthlQtKHWLmvwPl1YNtEGE14 +9gMlzoveiB10tMAJqmIaPoUWgQ2Wmzz+akYgr3zEloN+2ptVRYmboOWXGOHK4LJd +n5h7UvQNSqZyUvqogQIhAPOfMCgE3hvt4wA9cNUg3uQgUNnjr0ITiptNmgmoaaFB +AmEA8oxdQm/Uo1B5J2ebPj/e6mCi/wv3Ewq0CNE4Q1SiLmK1EKwyYj1pNBfrT2Vs +O5XsuFPC5V07iSjjfbaE8Q4zuKSmhVFe9aoAn8lwuuVBufGLFW7FD8PnhDZcqWsE +ksuRAiEA7sRa5y32Hbtlmquc9VV0/nJpq1NKRmFunE1PJh4IAMECYH0Q1ZHJWkqv +1xjzeoA5rPcLx2BdyhP+g+C8CRfmzw2+BgFH2V8ArXuYDdTNxmZfI0XUov1j+qv5 +8nvDHn+xxAekltzNnXptI49A7qjgR+jaXM47ZM+BQ6LP6S3OqfgLkQIhAKbHdb9l +cHPGX1uUDRAU1xxtpVQ0OqXyEgqwz6y6hYRw +-----END TESTING KEY-----`)) + + if boring.Enabled { + t.Skip("BoringCrypto mode returns the wrong error from SignPSS") + } + testEverything(t, k1) + testEverything(t, k2) +} + +func TestNotPrecomputed(t *testing.T) { + t.Run("OnlyD", func(t *testing.T) { + testEverything(t, test2048KeyOnlyD) + k := *test2048KeyOnlyD + k.Precompute() + testEverything(t, &k) + }) + t.Run("Primes", func(t *testing.T) { + testEverything(t, test2048KeyWithoutPrecomputed) + k := *test2048KeyWithoutPrecomputed + k.Precompute() + if k.Precomputed.Dp == nil || k.Precomputed.Dq == nil || k.Precomputed.Qinv == nil { + t.Error("Precomputed values should not be nil after Precompute()") + } + testEverything(t, &k) + }) + t.Run("AllValues", func(t *testing.T) { + testEverything(t, test2048KeyWithPrecomputed) + k := *test2048KeyWithoutPrecomputed + k.Precompute() + if k.Precomputed.Dp == nil || k.Precomputed.Dq == nil || k.Precomputed.Qinv == nil { + t.Error("Precomputed values should not be nil after Precompute()") + } + testEverything(t, &k) + }) +} + +func TestModifiedPrivateKey(t *testing.T) { + if test512Key.Validate() != nil { + t.Fatal("test512Key should be valid") + } + + t.Run("PublicKey mismatch", func(t *testing.T) { + testModifiedPrivateKey(t, func(k *PrivateKey) { + k.PublicKey = test512KeyTwo.PublicKey + }) + }) + t.Run("Precomputed mismatch", func(t *testing.T) { + testModifiedPrivateKey(t, func(k *PrivateKey) { + k.Precomputed = test512KeyTwo.Precomputed + }) + }) + + t.Run("D+2", func(t *testing.T) { + if fips140.Version() == "v1.0.0" { + t.Skip("This was fixed after v1.0.0") + } + testModifiedPrivateKey(t, func(k *PrivateKey) { + k.D = new(big.Int).Add(k.D, big.NewInt(2)) + }) + }) + t.Run("D=0", func(t *testing.T) { + testModifiedPrivateKey(t, func(k *PrivateKey) { + k.D = new(big.Int) + }) + }) + t.Run("D is nil", func(t *testing.T) { + testModifiedPrivateKey(t, func(k *PrivateKey) { + k.D = nil + }) + }) + + t.Run("N+2", func(t *testing.T) { + testModifiedPrivateKey(t, func(k *PrivateKey) { + k.N = new(big.Int).Add(k.N, big.NewInt(2)) + }) + }) + t.Run("N=0", func(t *testing.T) { + testModifiedPrivateKey(t, func(k *PrivateKey) { + k.N = new(big.Int) + }) + }) + t.Run("N is nil", func(t *testing.T) { + testModifiedPrivateKey(t, func(k *PrivateKey) { + k.N = nil + }) + }) + + t.Run("P+2", func(t *testing.T) { + testModifiedPrivateKey(t, func(k *PrivateKey) { + k.Primes[0] = new(big.Int).Add(k.Primes[0], big.NewInt(2)) + }) + }) + t.Run("P=0", func(t *testing.T) { + testModifiedPrivateKey(t, func(k *PrivateKey) { + k.Primes[0] = new(big.Int) + }) + }) + t.Run("P is nil", func(t *testing.T) { + testModifiedPrivateKey(t, func(k *PrivateKey) { + k.Primes[0] = nil + }) + }) + + t.Run("Q+2", func(t *testing.T) { + testModifiedPrivateKey(t, func(k *PrivateKey) { + k.Primes[1] = new(big.Int).Add(k.Primes[1], big.NewInt(2)) + }) + }) + t.Run("Q=0", func(t *testing.T) { + testModifiedPrivateKey(t, func(k *PrivateKey) { + k.Primes[1] = new(big.Int) + }) + }) + t.Run("Q is nil", func(t *testing.T) { + testModifiedPrivateKey(t, func(k *PrivateKey) { + k.Primes[1] = nil + }) + }) + + t.Run("E+2", func(t *testing.T) { + testModifiedPrivateKey(t, func(k *PrivateKey) { + k.E += 2 + }) + }) + t.Run("E=0", func(t *testing.T) { + testModifiedPrivateKey(t, func(k *PrivateKey) { + k.E = 0 + }) + }) +} + +func testModifiedPrivateKey(t *testing.T, f func(*PrivateKey)) { + k := new(PrivateKey) + *k = *test512Key + k.Primes = slices.Clone(k.Primes) + f(k) + if err := k.Validate(); err == nil { + t.Error("Validate should have failed") + } + k.Precompute() + if err := k.Validate(); err == nil { + t.Error("Validate should have failed after Precompute()") + } +} diff --git a/go/src/crypto/sha1/example_test.go b/go/src/crypto/sha1/example_test.go new file mode 100644 index 0000000000000000000000000000000000000000..499055cc9627c83f76c5a0d1c994e10cc60f8624 --- /dev/null +++ b/go/src/crypto/sha1/example_test.go @@ -0,0 +1,42 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sha1_test + +import ( + "crypto/sha1" + "fmt" + "io" + "log" + "os" +) + +func ExampleNew() { + h := sha1.New() + io.WriteString(h, "His money is twice tainted:") + io.WriteString(h, " 'taint yours and 'taint mine.") + fmt.Printf("% x", h.Sum(nil)) + // Output: 59 7f 6a 54 00 10 f9 4c 15 d7 18 06 a9 9a 2c 87 10 e7 47 bd +} + +func ExampleSum() { + data := []byte("This page intentionally left blank.") + fmt.Printf("% x", sha1.Sum(data)) + // Output: af 06 49 23 bb f2 30 15 96 aa c4 c2 73 ba 32 17 8e bc 4a 96 +} + +func ExampleNew_file() { + f, err := os.Open("file.txt") + if err != nil { + log.Fatal(err) + } + defer f.Close() + + h := sha1.New() + if _, err := io.Copy(h, f); err != nil { + log.Fatal(err) + } + + fmt.Printf("% x", h.Sum(nil)) +} diff --git a/go/src/crypto/sha1/issue15617_test.go b/go/src/crypto/sha1/issue15617_test.go new file mode 100644 index 0000000000000000000000000000000000000000..402c57482c4ca3e185dc2f42ed7b3bb0db5eff4f --- /dev/null +++ b/go/src/crypto/sha1/issue15617_test.go @@ -0,0 +1,30 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build amd64 && (linux || darwin) + +package sha1_test + +import ( + "crypto/internal/cryptotest" + "crypto/sha1" + "syscall" + "testing" +) + +func TestOutOfBoundsRead(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha1", func(t *testing.T) { + const pageSize = 4 << 10 + data, err := syscall.Mmap(0, 0, 2*pageSize, syscall.PROT_READ|syscall.PROT_WRITE, syscall.MAP_ANON|syscall.MAP_PRIVATE) + if err != nil { + panic(err) + } + if err := syscall.Mprotect(data[pageSize:], syscall.PROT_NONE); err != nil { + panic(err) + } + for i := 0; i < pageSize; i++ { + sha1.Sum(data[pageSize-i : pageSize]) + } + }) +} diff --git a/go/src/crypto/sha1/sha1.go b/go/src/crypto/sha1/sha1.go new file mode 100644 index 0000000000000000000000000000000000000000..46e47df1d32cf233e34f58f788736dbb1469ebd8 --- /dev/null +++ b/go/src/crypto/sha1/sha1.go @@ -0,0 +1,284 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package sha1 implements the SHA-1 hash algorithm as defined in RFC 3174. +// +// SHA-1 is cryptographically broken and should not be used for secure +// applications. +package sha1 + +import ( + "crypto" + "crypto/internal/boring" + "crypto/internal/fips140only" + "errors" + "hash" + "internal/byteorder" +) + +func init() { + crypto.RegisterHash(crypto.SHA1, New) +} + +// The size of a SHA-1 checksum in bytes. +const Size = 20 + +// The blocksize of SHA-1 in bytes. +const BlockSize = 64 + +const ( + chunk = 64 + init0 = 0x67452301 + init1 = 0xEFCDAB89 + init2 = 0x98BADCFE + init3 = 0x10325476 + init4 = 0xC3D2E1F0 +) + +// digest represents the partial evaluation of a checksum. +type digest struct { + h [5]uint32 + x [chunk]byte + nx int + len uint64 +} + +const ( + magic = "sha\x01" + marshaledSize = len(magic) + 5*4 + chunk + 8 +) + +func (d *digest) MarshalBinary() ([]byte, error) { + return d.AppendBinary(make([]byte, 0, marshaledSize)) +} + +func (d *digest) AppendBinary(b []byte) ([]byte, error) { + b = append(b, magic...) + b = byteorder.BEAppendUint32(b, d.h[0]) + b = byteorder.BEAppendUint32(b, d.h[1]) + b = byteorder.BEAppendUint32(b, d.h[2]) + b = byteorder.BEAppendUint32(b, d.h[3]) + b = byteorder.BEAppendUint32(b, d.h[4]) + b = append(b, d.x[:d.nx]...) + b = append(b, make([]byte, len(d.x)-d.nx)...) + b = byteorder.BEAppendUint64(b, d.len) + return b, nil +} + +func (d *digest) UnmarshalBinary(b []byte) error { + if len(b) < len(magic) || string(b[:len(magic)]) != magic { + return errors.New("crypto/sha1: invalid hash state identifier") + } + if len(b) != marshaledSize { + return errors.New("crypto/sha1: invalid hash state size") + } + b = b[len(magic):] + b, d.h[0] = consumeUint32(b) + b, d.h[1] = consumeUint32(b) + b, d.h[2] = consumeUint32(b) + b, d.h[3] = consumeUint32(b) + b, d.h[4] = consumeUint32(b) + b = b[copy(d.x[:], b):] + b, d.len = consumeUint64(b) + d.nx = int(d.len % chunk) + return nil +} + +func consumeUint64(b []byte) ([]byte, uint64) { + return b[8:], byteorder.BEUint64(b) +} + +func consumeUint32(b []byte) ([]byte, uint32) { + return b[4:], byteorder.BEUint32(b) +} + +func (d *digest) Clone() (hash.Cloner, error) { + r := *d + return &r, nil +} + +func (d *digest) Reset() { + d.h[0] = init0 + d.h[1] = init1 + d.h[2] = init2 + d.h[3] = init3 + d.h[4] = init4 + d.nx = 0 + d.len = 0 +} + +// New returns a new [hash.Hash] computing the SHA1 checksum. The Hash +// also implements [encoding.BinaryMarshaler], [encoding.BinaryAppender] and +// [encoding.BinaryUnmarshaler] to marshal and unmarshal the internal +// state of the hash. +func New() hash.Hash { + if boring.Enabled { + return boring.NewSHA1() + } + d := new(digest) + d.Reset() + return d +} + +func (d *digest) Size() int { return Size } + +func (d *digest) BlockSize() int { return BlockSize } + +func (d *digest) Write(p []byte) (nn int, err error) { + if fips140only.Enforced() { + return 0, errors.New("crypto/sha1: use of SHA-1 is not allowed in FIPS 140-only mode") + } + boring.Unreachable() + nn = len(p) + d.len += uint64(nn) + if d.nx > 0 { + n := copy(d.x[d.nx:], p) + d.nx += n + if d.nx == chunk { + block(d, d.x[:]) + d.nx = 0 + } + p = p[n:] + } + if len(p) >= chunk { + n := len(p) &^ (chunk - 1) + block(d, p[:n]) + p = p[n:] + } + if len(p) > 0 { + d.nx = copy(d.x[:], p) + } + return +} + +func (d *digest) Sum(in []byte) []byte { + boring.Unreachable() + // Make a copy of d so that caller can keep writing and summing. + d0 := *d + hash := d0.checkSum() + return append(in, hash[:]...) +} + +func (d *digest) checkSum() [Size]byte { + if fips140only.Enforced() { + panic("crypto/sha1: use of SHA-1 is not allowed in FIPS 140-only mode") + } + + len := d.len + // Padding. Add a 1 bit and 0 bits until 56 bytes mod 64. + var tmp [64 + 8]byte // padding + length buffer + tmp[0] = 0x80 + var t uint64 + if len%64 < 56 { + t = 56 - len%64 + } else { + t = 64 + 56 - len%64 + } + + // Length in bits. + len <<= 3 + padlen := tmp[:t+8] + byteorder.BEPutUint64(padlen[t:], len) + d.Write(padlen) + + if d.nx != 0 { + panic("d.nx != 0") + } + + var digest [Size]byte + + byteorder.BEPutUint32(digest[0:], d.h[0]) + byteorder.BEPutUint32(digest[4:], d.h[1]) + byteorder.BEPutUint32(digest[8:], d.h[2]) + byteorder.BEPutUint32(digest[12:], d.h[3]) + byteorder.BEPutUint32(digest[16:], d.h[4]) + + return digest +} + +// ConstantTimeSum computes the same result of [Sum] but in constant time +func (d *digest) ConstantTimeSum(in []byte) []byte { + d0 := *d + hash := d0.constSum() + return append(in, hash[:]...) +} + +func (d *digest) constSum() [Size]byte { + if fips140only.Enforced() { + panic("crypto/sha1: use of SHA-1 is not allowed in FIPS 140-only mode") + } + + var length [8]byte + l := d.len << 3 + for i := uint(0); i < 8; i++ { + length[i] = byte(l >> (56 - 8*i)) + } + + nx := byte(d.nx) + t := nx - 56 // if nx < 56 then the MSB of t is one + mask1b := byte(int8(t) >> 7) // mask1b is 0xFF iff one block is enough + + separator := byte(0x80) // gets reset to 0x00 once used + for i := byte(0); i < chunk; i++ { + mask := byte(int8(i-nx) >> 7) // 0x00 after the end of data + + // if we reached the end of the data, replace with 0x80 or 0x00 + d.x[i] = (^mask & separator) | (mask & d.x[i]) + + // zero the separator once used + separator &= mask + + if i >= 56 { + // we might have to write the length here if all fit in one block + d.x[i] |= mask1b & length[i-56] + } + } + + // compress, and only keep the digest if all fit in one block + block(d, d.x[:]) + + var digest [Size]byte + for i, s := range d.h { + digest[i*4] = mask1b & byte(s>>24) + digest[i*4+1] = mask1b & byte(s>>16) + digest[i*4+2] = mask1b & byte(s>>8) + digest[i*4+3] = mask1b & byte(s) + } + + for i := byte(0); i < chunk; i++ { + // second block, it's always past the end of data, might start with 0x80 + if i < 56 { + d.x[i] = separator + separator = 0 + } else { + d.x[i] = length[i-56] + } + } + + // compress, and only keep the digest if we actually needed the second block + block(d, d.x[:]) + + for i, s := range d.h { + digest[i*4] |= ^mask1b & byte(s>>24) + digest[i*4+1] |= ^mask1b & byte(s>>16) + digest[i*4+2] |= ^mask1b & byte(s>>8) + digest[i*4+3] |= ^mask1b & byte(s) + } + + return digest +} + +// Sum returns the SHA-1 checksum of the data. +func Sum(data []byte) [Size]byte { + if boring.Enabled { + return boring.SHA1(data) + } + if fips140only.Enforced() { + panic("crypto/sha1: use of SHA-1 is not allowed in FIPS 140-only mode") + } + var d digest + d.Reset() + d.Write(data) + return d.checkSum() +} diff --git a/go/src/crypto/sha1/sha1_test.go b/go/src/crypto/sha1/sha1_test.go new file mode 100644 index 0000000000000000000000000000000000000000..ef6e5ddcbb2d97f4791a1bced926b93d0f04e243 --- /dev/null +++ b/go/src/crypto/sha1/sha1_test.go @@ -0,0 +1,294 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// SHA-1 hash algorithm. See RFC 3174. + +package sha1 + +import ( + "bytes" + "crypto/internal/boring" + "crypto/internal/cryptotest" + "encoding" + "fmt" + "hash" + "io" + "testing" +) + +type sha1Test struct { + out string + in string + halfState string // marshaled hash state after first half of in written, used by TestGoldenMarshal +} + +var golden = []sha1Test{ + {"76245dbf96f661bd221046197ab8b9f063f11bad", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "sha\x01\v\xa0)I\xdeq(8h\x9ev\xe5\x88[\xf8\x81\x17\xba4Daaaaaaaaaaaaaaaaaaaaaa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x96"}, + {"da39a3ee5e6b4b0d3255bfef95601890afd80709", "", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"}, + {"86f7e437faa5a7fce15d1ddcb9eaeaea377667b8", "a", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"}, + {"da23614e02469a0d7c7bd1bdab5c9c474b1904dc", "ab", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01"}, + {"a9993e364706816aba3e25717850c26c9cd0d89d", "abc", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01"}, + {"81fe8bfe87576c3ecb22426f8e57847382917acf", "abcd", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0ab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02"}, + {"03de6c570bfe24bfc328ccd7ca46b76eadaf4334", "abcde", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0ab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02"}, + {"1f8ac10f23c5b5bc1167bda84b833e5c057a77d2", "abcdef", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0abc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03"}, + {"2fb5e13419fc89246865e7a324f476ec624e8740", "abcdefg", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0abc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03"}, + {"425af12a0743502b322e93a015bcf868e324d56a", "abcdefgh", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0abcd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04"}, + {"c63b19f1e4c8b5f76b25c49b8b87f57d8e4872a1", "abcdefghi", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0abcd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04"}, + {"d68c19a0a345b7eab78d5e11e991c026ec60db63", "abcdefghij", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0abcde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05"}, + {"ebf81ddcbe5bf13aaabdc4d65354fdf2044f38a7", "Discard medicine more than two years old.", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0Discard medicine mor\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x14"}, + {"e5dea09392dd886ca63531aaa00571dc07554bb6", "He who has a shady past knows that nice guys finish last.", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0He who has a shady past know\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c"}, + {"45988f7234467b94e3e9494434c96ee3609d8f8f", "I wouldn't marry him with a ten foot pole.", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0I wouldn't marry him \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15"}, + {"55dee037eb7460d5a692d1ce11330b260e40c988", "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0Free! Free!/A trip/to Mars/f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c"}, + {"b7bc5fb91080c7de6b582ea281f8a396d7c0aee8", "The days of the digital watch are numbered. -Tom Stoppard", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0The days of the digital watch\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1d"}, + {"c3aed9358f7c77f523afe86135f06b95b3999797", "Nepal premier won't resign.", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0Nepal premier\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\r"}, + {"6e29d302bf6e3a5e4305ff318d983197d6906bb9", "For every action there is an equal and opposite government program.", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0For every action there is an equa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00!"}, + {"597f6a540010f94c15d71806a99a2c8710e747bd", "His money is twice tainted: 'taint yours and 'taint mine.", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0His money is twice tainted: \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c"}, + {"6859733b2590a8a091cecf50086febc5ceef1e80", "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0There is no reason for any individual to hav\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00,"}, + {"514b2630ec089b8aee18795fc0cf1f4860cdacad", "It's a tiny change to the code and not completely disgusting. - Bob Manchek", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0It's a tiny change to the code and no\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00%"}, + {"c5ca0d4a7b6676fc7aa72caa41cc3d5df567ed69", "size: a.out: bad magic", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0size: a.out\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\f"}, + {"74c51fa9a04eadc8c1bbeaa7fc442f834b90a00a", "The major problem is with sendmail. -Mark Horton", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0The major problem is wit\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18"}, + {"0b4c4ce5f52c3ad2821852a8dc00217fa18b8b66", "Give me a rock, paper and scissors and I will move the world. CCFestoon", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0Give me a rock, paper and scissors a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00$"}, + {"3ae7937dd790315beb0f48330e8642237c61550a", "If the enemy is within range, then so are you.", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0If the enemy is within \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17"}, + {"410a2b296df92b9a47412b13281df8f830a9f44b", "It's well we cannot hear the screams/That we create in others' dreams.", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0It's well we cannot hear the scream\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00#"}, + {"841e7c85ca1adcddbdd0187f1289acb5c642f7f5", "You remind me of a TV show, but that's all right: I watch it anyway.", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0You remind me of a TV show, but th\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\""}, + {"163173b825d03b952601376b25212df66763e1db", "C is as portable as Stonehedge!!", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0C is as portable\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10"}, + {"32b0377f2687eb88e22106f133c586ab314d5279", "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0Even if I could be Shakespeare, I think I sh\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00,"}, + {"0885aaf99b569542fd165fa44e322718f4a984e0", "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction. Lewis-Randall Rule", "sha\x01x}\xf4\r\xeb\xf2\x10\x87\xe8[\xb2JA$D\xb7\u063ax8em\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00B"}, + {"6627d6904d71420b0bf3886ab629623538689f45", "How can you write a big system without C++? -Paul Glick", "sha\x01gE#\x01\xef\u036b\x89\x98\xba\xdc\xfe\x102Tv\xc3\xd2\xe1\xf0How can you write a big syst\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c"}, +} + +func TestGolden(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha1", testGolden) +} +func testGolden(t *testing.T) { + for i := 0; i < len(golden); i++ { + g := golden[i] + s := fmt.Sprintf("%x", Sum([]byte(g.in))) + if s != g.out { + t.Fatalf("Sum function: sha1(%s) = %s want %s", g.in, s, g.out) + } + c := New() + for j := 0; j < 4; j++ { + var sum []byte + switch j { + case 0, 1: + io.WriteString(c, g.in) + sum = c.Sum(nil) + case 2: + io.WriteString(c, g.in[:len(g.in)/2]) + c.Sum(nil) + io.WriteString(c, g.in[len(g.in)/2:]) + sum = c.Sum(nil) + case 3: + if boring.Enabled { + continue + } + io.WriteString(c, g.in[:len(g.in)/2]) + c.(*digest).ConstantTimeSum(nil) + io.WriteString(c, g.in[len(g.in)/2:]) + sum = c.(*digest).ConstantTimeSum(nil) + } + s := fmt.Sprintf("%x", sum) + if s != g.out { + t.Fatalf("sha1[%d](%s) = %s want %s", j, g.in, s, g.out) + } + c.Reset() + } + } +} + +func TestGoldenMarshal(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha1", testGoldenMarshal) +} +func testGoldenMarshal(t *testing.T) { + h := New() + h2 := New() + for _, g := range golden { + h.Reset() + h2.Reset() + + io.WriteString(h, g.in[:len(g.in)/2]) + + state, err := h.(encoding.BinaryMarshaler).MarshalBinary() + if err != nil { + t.Errorf("could not marshal: %v", err) + continue + } + + stateAppend, err := h.(encoding.BinaryAppender).AppendBinary(make([]byte, 4, 32)) + if err != nil { + t.Errorf("could not marshal: %v", err) + continue + } + stateAppend = stateAppend[4:] + + if string(state) != g.halfState { + t.Errorf("sha1(%q) state = %+q, want %+q", g.in, state, g.halfState) + continue + } + + if string(stateAppend) != g.halfState { + t.Errorf("sha1(%q) stateAppend = %+q, want %+q", g.in, stateAppend, g.halfState) + continue + } + + if err := h2.(encoding.BinaryUnmarshaler).UnmarshalBinary(state); err != nil { + t.Errorf("could not unmarshal: %v", err) + continue + } + + io.WriteString(h, g.in[len(g.in)/2:]) + io.WriteString(h2, g.in[len(g.in)/2:]) + + if actual, actual2 := h.Sum(nil), h2.Sum(nil); !bytes.Equal(actual, actual2) { + t.Errorf("sha1(%q) = 0x%x != marshaled 0x%x", g.in, actual, actual2) + } + } +} + +func TestSize(t *testing.T) { + c := New() + if got := c.Size(); got != Size { + t.Errorf("Size = %d; want %d", got, Size) + } +} + +func TestBlockSize(t *testing.T) { + c := New() + if got := c.BlockSize(); got != BlockSize { + t.Errorf("BlockSize = %d; want %d", got, BlockSize) + } +} + +// Tests for unmarshaling hashes that have hashed a large amount of data +// The initial hash generation is omitted from the test, because it takes a long time. +// The test contains some already-generated states, and their expected sums +// Tests a problem that is outlined in GitHub issue #29543 +// The problem is triggered when an amount of data has been hashed for which +// the data length has a 1 in the 32nd bit. When casted to int, this changes +// the sign of the value, and causes the modulus operation to return a +// different result. +type unmarshalTest struct { + state string + sum string +} + +var largeUnmarshalTests = []unmarshalTest{ + // Data length: 7_102_415_735 + { + state: "sha\x01\x13\xbc\xfe\x83\x8c\xbd\xdfP\x1f\xd8ڿ<\x9eji8t\xe1\xa5@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuv\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xa7VCw", + sum: "bc6245c9959cc33e1c2592e5c9ea9b5d0431246c", + }, + // Data length: 6_565_544_823 + { + state: "sha\x01m;\x16\xa6R\xbe@\xa9nĈ\xf9S\x03\x00B\xc2\xdcv\xcf@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuv\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x87VCw", + sum: "8f2d1c0e4271768f35feb918bfe21ea1387a2072", + }, +} + +func safeSum(h hash.Hash) (sum []byte, err error) { + defer func() { + if r := recover(); r != nil { + err = fmt.Errorf("sum panic: %v", r) + } + }() + + return h.Sum(nil), nil +} + +func TestLargeHashes(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha1", testLargeHashes) +} +func testLargeHashes(t *testing.T) { + for i, test := range largeUnmarshalTests { + h := New() + if err := h.(encoding.BinaryUnmarshaler).UnmarshalBinary([]byte(test.state)); err != nil { + t.Errorf("test %d could not unmarshal: %v", i, err) + continue + } + + sum, err := safeSum(h) + if err != nil { + t.Errorf("test %d could not sum: %v", i, err) + continue + } + + if fmt.Sprintf("%x", sum) != test.sum { + t.Errorf("test %d sum mismatch: expect %s got %x", i, test.sum, sum) + } + } +} + +func TestAllocations(t *testing.T) { + cryptotest.SkipTestAllocations(t) + in := []byte("hello, world!") + out := make([]byte, 0, Size) + h := New() + n := int(testing.AllocsPerRun(10, func() { + h.Reset() + h.Write(in) + out = h.Sum(out[:0]) + })) + if n > 0 { + t.Errorf("allocs = %d, want 0", n) + } +} + +func TestSHA1Hash(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha1", func(t *testing.T) { + cryptotest.TestHash(t, New) + }) +} + +func TestExtraMethods(t *testing.T) { + h := maybeCloner(New()) + cryptotest.NoExtraMethods(t, &h, "ConstantTimeSum", + "MarshalBinary", "UnmarshalBinary", "AppendBinary") +} + +func maybeCloner(h hash.Hash) any { + if c, ok := h.(hash.Cloner); ok { + return &c + } + return &h +} + +var bench = New() +var buf = make([]byte, 8192) + +func benchmarkSize(b *testing.B, size int) { + sum := make([]byte, bench.Size()) + b.Run("New", func(b *testing.B) { + b.ReportAllocs() + b.SetBytes(int64(size)) + for i := 0; i < b.N; i++ { + bench.Reset() + bench.Write(buf[:size]) + bench.Sum(sum[:0]) + } + }) + b.Run("Sum", func(b *testing.B) { + b.ReportAllocs() + b.SetBytes(int64(size)) + for i := 0; i < b.N; i++ { + Sum(buf[:size]) + } + }) +} + +func BenchmarkHash8Bytes(b *testing.B) { + benchmarkSize(b, 8) +} + +func BenchmarkHash320Bytes(b *testing.B) { + benchmarkSize(b, 320) +} + +func BenchmarkHash1K(b *testing.B) { + benchmarkSize(b, 1024) +} + +func BenchmarkHash8K(b *testing.B) { + benchmarkSize(b, 8192) +} diff --git a/go/src/crypto/sha1/sha1block.go b/go/src/crypto/sha1/sha1block.go new file mode 100644 index 0000000000000000000000000000000000000000..1c1a7c5f31c16413b949986f2793da1275669b5d --- /dev/null +++ b/go/src/crypto/sha1/sha1block.go @@ -0,0 +1,83 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sha1 + +import ( + "math/bits" +) + +const ( + _K0 = 0x5A827999 + _K1 = 0x6ED9EBA1 + _K2 = 0x8F1BBCDC + _K3 = 0xCA62C1D6 +) + +// blockGeneric is a portable, pure Go version of the SHA-1 block step. +// It's used by sha1block_generic.go and tests. +func blockGeneric(dig *digest, p []byte) { + var w [16]uint32 + + h0, h1, h2, h3, h4 := dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4] + for len(p) >= chunk { + // Can interlace the computation of w with the + // rounds below if needed for speed. + for i := 0; i < 16; i++ { + j := i * 4 + w[i] = uint32(p[j])<<24 | uint32(p[j+1])<<16 | uint32(p[j+2])<<8 | uint32(p[j+3]) + } + + a, b, c, d, e := h0, h1, h2, h3, h4 + + // Each of the four 20-iteration rounds + // differs only in the computation of f and + // the choice of K (_K0, _K1, etc). + i := 0 + for ; i < 16; i++ { + f := b&c | (^b)&d + t := bits.RotateLeft32(a, 5) + f + e + w[i&0xf] + _K0 + a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d + } + for ; i < 20; i++ { + tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] + w[i&0xf] = bits.RotateLeft32(tmp, 1) + + f := b&c | (^b)&d + t := bits.RotateLeft32(a, 5) + f + e + w[i&0xf] + _K0 + a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d + } + for ; i < 40; i++ { + tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] + w[i&0xf] = bits.RotateLeft32(tmp, 1) + f := b ^ c ^ d + t := bits.RotateLeft32(a, 5) + f + e + w[i&0xf] + _K1 + a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d + } + for ; i < 60; i++ { + tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] + w[i&0xf] = bits.RotateLeft32(tmp, 1) + f := ((b | c) & d) | (b & c) + t := bits.RotateLeft32(a, 5) + f + e + w[i&0xf] + _K2 + a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d + } + for ; i < 80; i++ { + tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] + w[i&0xf] = bits.RotateLeft32(tmp, 1) + f := b ^ c ^ d + t := bits.RotateLeft32(a, 5) + f + e + w[i&0xf] + _K3 + a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d + } + + h0 += a + h1 += b + h2 += c + h3 += d + h4 += e + + p = p[chunk:] + } + + dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4] = h0, h1, h2, h3, h4 +} diff --git a/go/src/crypto/sha1/sha1block_386.s b/go/src/crypto/sha1/sha1block_386.s new file mode 100644 index 0000000000000000000000000000000000000000..33d3f1e9973fd39985b21fd4d1326145f5f828e5 --- /dev/null +++ b/go/src/crypto/sha1/sha1block_386.s @@ -0,0 +1,235 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !purego + +#include "textflag.h" + +// SHA-1 block routine. See sha1block.go for Go equivalent. +// +// There are 80 rounds of 4 types: +// - rounds 0-15 are type 1 and load data (ROUND1 macro). +// - rounds 16-19 are type 1 and do not load data (ROUND1x macro). +// - rounds 20-39 are type 2 and do not load data (ROUND2 macro). +// - rounds 40-59 are type 3 and do not load data (ROUND3 macro). +// - rounds 60-79 are type 4 and do not load data (ROUND4 macro). +// +// Each round loads or shuffles the data, then computes a per-round +// function of b, c, d, and then mixes the result into and rotates the +// five registers a, b, c, d, e holding the intermediate results. +// +// The register rotation is implemented by rotating the arguments to +// the round macros instead of by explicit move instructions. + +// Like sha1block_amd64.s, but we keep the data and limit pointers on the stack. +// To free up the word pointer (R10 on amd64, DI here), we add it to e during +// LOAD/SHUFFLE instead of during MIX. +// +// The stack holds the intermediate word array - 16 uint32s - at 0(SP) up to 64(SP). +// The saved a, b, c, d, e (R11 through R15 on amd64) are at 64(SP) up to 84(SP). +// The saved limit pointer (DI on amd64) is at 84(SP). +// The saved data pointer (SI on amd64) is at 88(SP). + +#define LOAD(index, e) \ + MOVL 88(SP), SI; \ + MOVL (index*4)(SI), DI; \ + BSWAPL DI; \ + MOVL DI, (index*4)(SP); \ + ADDL DI, e + +#define SHUFFLE(index, e) \ + MOVL (((index)&0xf)*4)(SP), DI; \ + XORL (((index-3)&0xf)*4)(SP), DI; \ + XORL (((index-8)&0xf)*4)(SP), DI; \ + XORL (((index-14)&0xf)*4)(SP), DI; \ + ROLL $1, DI; \ + MOVL DI, (((index)&0xf)*4)(SP); \ + ADDL DI, e + +#define FUNC1(a, b, c, d, e) \ + MOVL d, DI; \ + XORL c, DI; \ + ANDL b, DI; \ + XORL d, DI + +#define FUNC2(a, b, c, d, e) \ + MOVL b, DI; \ + XORL c, DI; \ + XORL d, DI + +#define FUNC3(a, b, c, d, e) \ + MOVL b, SI; \ + ORL c, SI; \ + ANDL d, SI; \ + MOVL b, DI; \ + ANDL c, DI; \ + ORL SI, DI + +#define FUNC4 FUNC2 + +#define MIX(a, b, c, d, e, const) \ + ROLL $30, b; \ + ADDL DI, e; \ + MOVL a, SI; \ + ROLL $5, SI; \ + LEAL const(e)(SI*1), e + +#define ROUND1(a, b, c, d, e, index) \ + LOAD(index, e); \ + FUNC1(a, b, c, d, e); \ + MIX(a, b, c, d, e, 0x5A827999) + +#define ROUND1x(a, b, c, d, e, index) \ + SHUFFLE(index, e); \ + FUNC1(a, b, c, d, e); \ + MIX(a, b, c, d, e, 0x5A827999) + +#define ROUND2(a, b, c, d, e, index) \ + SHUFFLE(index, e); \ + FUNC2(a, b, c, d, e); \ + MIX(a, b, c, d, e, 0x6ED9EBA1) + +#define ROUND3(a, b, c, d, e, index) \ + SHUFFLE(index, e); \ + FUNC3(a, b, c, d, e); \ + MIX(a, b, c, d, e, 0x8F1BBCDC) + +#define ROUND4(a, b, c, d, e, index) \ + SHUFFLE(index, e); \ + FUNC4(a, b, c, d, e); \ + MIX(a, b, c, d, e, 0xCA62C1D6) + +// func block(dig *digest, p []byte) +TEXT ·block(SB),NOSPLIT,$92-16 + MOVL dig+0(FP), BP + MOVL p+4(FP), SI + MOVL p_len+8(FP), DX + SHRL $6, DX + SHLL $6, DX + + LEAL (SI)(DX*1), DI + MOVL (0*4)(BP), AX + MOVL (1*4)(BP), BX + MOVL (2*4)(BP), CX + MOVL (3*4)(BP), DX + MOVL (4*4)(BP), BP + + CMPL SI, DI + JEQ end + + MOVL DI, 84(SP) + +loop: + MOVL SI, 88(SP) + + MOVL AX, 64(SP) + MOVL BX, 68(SP) + MOVL CX, 72(SP) + MOVL DX, 76(SP) + MOVL BP, 80(SP) + + ROUND1(AX, BX, CX, DX, BP, 0) + ROUND1(BP, AX, BX, CX, DX, 1) + ROUND1(DX, BP, AX, BX, CX, 2) + ROUND1(CX, DX, BP, AX, BX, 3) + ROUND1(BX, CX, DX, BP, AX, 4) + ROUND1(AX, BX, CX, DX, BP, 5) + ROUND1(BP, AX, BX, CX, DX, 6) + ROUND1(DX, BP, AX, BX, CX, 7) + ROUND1(CX, DX, BP, AX, BX, 8) + ROUND1(BX, CX, DX, BP, AX, 9) + ROUND1(AX, BX, CX, DX, BP, 10) + ROUND1(BP, AX, BX, CX, DX, 11) + ROUND1(DX, BP, AX, BX, CX, 12) + ROUND1(CX, DX, BP, AX, BX, 13) + ROUND1(BX, CX, DX, BP, AX, 14) + ROUND1(AX, BX, CX, DX, BP, 15) + + ROUND1x(BP, AX, BX, CX, DX, 16) + ROUND1x(DX, BP, AX, BX, CX, 17) + ROUND1x(CX, DX, BP, AX, BX, 18) + ROUND1x(BX, CX, DX, BP, AX, 19) + + ROUND2(AX, BX, CX, DX, BP, 20) + ROUND2(BP, AX, BX, CX, DX, 21) + ROUND2(DX, BP, AX, BX, CX, 22) + ROUND2(CX, DX, BP, AX, BX, 23) + ROUND2(BX, CX, DX, BP, AX, 24) + ROUND2(AX, BX, CX, DX, BP, 25) + ROUND2(BP, AX, BX, CX, DX, 26) + ROUND2(DX, BP, AX, BX, CX, 27) + ROUND2(CX, DX, BP, AX, BX, 28) + ROUND2(BX, CX, DX, BP, AX, 29) + ROUND2(AX, BX, CX, DX, BP, 30) + ROUND2(BP, AX, BX, CX, DX, 31) + ROUND2(DX, BP, AX, BX, CX, 32) + ROUND2(CX, DX, BP, AX, BX, 33) + ROUND2(BX, CX, DX, BP, AX, 34) + ROUND2(AX, BX, CX, DX, BP, 35) + ROUND2(BP, AX, BX, CX, DX, 36) + ROUND2(DX, BP, AX, BX, CX, 37) + ROUND2(CX, DX, BP, AX, BX, 38) + ROUND2(BX, CX, DX, BP, AX, 39) + + ROUND3(AX, BX, CX, DX, BP, 40) + ROUND3(BP, AX, BX, CX, DX, 41) + ROUND3(DX, BP, AX, BX, CX, 42) + ROUND3(CX, DX, BP, AX, BX, 43) + ROUND3(BX, CX, DX, BP, AX, 44) + ROUND3(AX, BX, CX, DX, BP, 45) + ROUND3(BP, AX, BX, CX, DX, 46) + ROUND3(DX, BP, AX, BX, CX, 47) + ROUND3(CX, DX, BP, AX, BX, 48) + ROUND3(BX, CX, DX, BP, AX, 49) + ROUND3(AX, BX, CX, DX, BP, 50) + ROUND3(BP, AX, BX, CX, DX, 51) + ROUND3(DX, BP, AX, BX, CX, 52) + ROUND3(CX, DX, BP, AX, BX, 53) + ROUND3(BX, CX, DX, BP, AX, 54) + ROUND3(AX, BX, CX, DX, BP, 55) + ROUND3(BP, AX, BX, CX, DX, 56) + ROUND3(DX, BP, AX, BX, CX, 57) + ROUND3(CX, DX, BP, AX, BX, 58) + ROUND3(BX, CX, DX, BP, AX, 59) + + ROUND4(AX, BX, CX, DX, BP, 60) + ROUND4(BP, AX, BX, CX, DX, 61) + ROUND4(DX, BP, AX, BX, CX, 62) + ROUND4(CX, DX, BP, AX, BX, 63) + ROUND4(BX, CX, DX, BP, AX, 64) + ROUND4(AX, BX, CX, DX, BP, 65) + ROUND4(BP, AX, BX, CX, DX, 66) + ROUND4(DX, BP, AX, BX, CX, 67) + ROUND4(CX, DX, BP, AX, BX, 68) + ROUND4(BX, CX, DX, BP, AX, 69) + ROUND4(AX, BX, CX, DX, BP, 70) + ROUND4(BP, AX, BX, CX, DX, 71) + ROUND4(DX, BP, AX, BX, CX, 72) + ROUND4(CX, DX, BP, AX, BX, 73) + ROUND4(BX, CX, DX, BP, AX, 74) + ROUND4(AX, BX, CX, DX, BP, 75) + ROUND4(BP, AX, BX, CX, DX, 76) + ROUND4(DX, BP, AX, BX, CX, 77) + ROUND4(CX, DX, BP, AX, BX, 78) + ROUND4(BX, CX, DX, BP, AX, 79) + + ADDL 64(SP), AX + ADDL 68(SP), BX + ADDL 72(SP), CX + ADDL 76(SP), DX + ADDL 80(SP), BP + + MOVL 88(SP), SI + ADDL $64, SI + CMPL SI, 84(SP) + JB loop + +end: + MOVL dig+0(FP), DI + MOVL AX, (0*4)(DI) + MOVL BX, (1*4)(DI) + MOVL CX, (2*4)(DI) + MOVL DX, (3*4)(DI) + MOVL BP, (4*4)(DI) + RET diff --git a/go/src/crypto/sha1/sha1block_amd64.go b/go/src/crypto/sha1/sha1block_amd64.go new file mode 100644 index 0000000000000000000000000000000000000000..1f78e2d78b4b17cb133d72489a3f6035a15309f2 --- /dev/null +++ b/go/src/crypto/sha1/sha1block_amd64.go @@ -0,0 +1,46 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !purego + +package sha1 + +import ( + "crypto/internal/impl" + "internal/cpu" +) + +//go:noescape +func blockAVX2(dig *digest, p []byte) + +//go:noescape +func blockSHANI(dig *digest, p []byte) + +var useAVX2 = cpu.X86.HasAVX && cpu.X86.HasAVX2 && cpu.X86.HasBMI1 && cpu.X86.HasBMI2 +var useSHANI = cpu.X86.HasAVX && cpu.X86.HasSHA && cpu.X86.HasSSE41 && cpu.X86.HasSSSE3 + +func init() { + impl.Register("sha1", "AVX2", &useAVX2) + impl.Register("sha1", "SHA-NI", &useSHANI) +} + +func block(dig *digest, p []byte) { + if useSHANI { + blockSHANI(dig, p) + } else if useAVX2 && len(p) >= 256 { + // blockAVX2 calculates sha1 for 2 block per iteration and also + // interleaves precalculation for next block. So it may read up-to 192 + // bytes past end of p. We could add checks inside blockAVX2, but this + // would just turn it into a copy of the old pre-AVX2 amd64 SHA1 + // assembly implementation, so just call blockGeneric instead. + safeLen := len(p) - 128 + if safeLen%128 != 0 { + safeLen -= 64 + } + blockAVX2(dig, p[:safeLen]) + blockGeneric(dig, p[safeLen:]) + } else { + blockGeneric(dig, p) + } +} diff --git a/go/src/crypto/sha1/sha1block_amd64.s b/go/src/crypto/sha1/sha1block_amd64.s new file mode 100644 index 0000000000000000000000000000000000000000..4e0c43ee4e18755b655d516eef2427aed8c40827 --- /dev/null +++ b/go/src/crypto/sha1/sha1block_amd64.s @@ -0,0 +1,1988 @@ +// Code generated by command: go run sha1block_amd64_asm.go -out ../sha1block_amd64.s -pkg sha1. DO NOT EDIT. + +//go:build !purego + +#include "textflag.h" + +// func blockAVX2(dig *digest, p []byte) +// Requires: AVX, AVX2, BMI, BMI2, CMOV +TEXT ·blockAVX2(SB), $1408-32 + MOVQ dig+0(FP), DI + MOVQ p_base+8(FP), SI + MOVQ p_len+16(FP), DX + SHRQ $0x06, DX + SHLQ $0x06, DX + LEAQ K_XMM_AR<>+0(SB), R8 + MOVQ DI, R9 + MOVQ SI, R10 + LEAQ 64(SI), R13 + ADDQ SI, DX + ADDQ $0x40, DX + MOVQ DX, R11 + CMPQ R13, R11 + CMOVQCC R8, R13 + VMOVDQU BSWAP_SHUFB_CTL<>+0(SB), Y10 + MOVL (R9), CX + MOVL 4(R9), SI + MOVL 8(R9), DI + MOVL 12(R9), AX + MOVL 16(R9), DX + MOVQ SP, R14 + LEAQ 672(SP), R15 + VMOVDQU (R10), X0 + VINSERTI128 $0x01, (R13), Y0, Y0 + VPSHUFB Y10, Y0, Y15 + VPADDD (R8), Y15, Y0 + VMOVDQU Y0, (R14) + VMOVDQU 16(R10), X0 + VINSERTI128 $0x01, 16(R13), Y0, Y0 + VPSHUFB Y10, Y0, Y14 + VPADDD (R8), Y14, Y0 + VMOVDQU Y0, 32(R14) + VMOVDQU 32(R10), X0 + VINSERTI128 $0x01, 32(R13), Y0, Y0 + VPSHUFB Y10, Y0, Y13 + VPADDD (R8), Y13, Y0 + VMOVDQU Y0, 64(R14) + VMOVDQU 48(R10), X0 + VINSERTI128 $0x01, 48(R13), Y0, Y0 + VPSHUFB Y10, Y0, Y12 + VPADDD (R8), Y12, Y0 + VMOVDQU Y0, 96(R14) + VPALIGNR $0x08, Y15, Y14, Y8 + VPSRLDQ $0x04, Y12, Y0 + VPXOR Y13, Y8, Y8 + VPXOR Y15, Y0, Y0 + VPXOR Y0, Y8, Y8 + VPSLLDQ $0x0c, Y8, Y9 + VPSLLD $0x01, Y8, Y0 + VPSRLD $0x1f, Y8, Y8 + VPOR Y8, Y0, Y0 + VPSLLD $0x02, Y9, Y8 + VPSRLD $0x1e, Y9, Y9 + VPXOR Y8, Y0, Y0 + VPXOR Y9, Y0, Y8 + VPADDD (R8), Y8, Y0 + VMOVDQU Y0, 128(R14) + VPALIGNR $0x08, Y14, Y13, Y7 + VPSRLDQ $0x04, Y8, Y0 + VPXOR Y12, Y7, Y7 + VPXOR Y14, Y0, Y0 + VPXOR Y0, Y7, Y7 + VPSLLDQ $0x0c, Y7, Y9 + VPSLLD $0x01, Y7, Y0 + VPSRLD $0x1f, Y7, Y7 + VPOR Y7, Y0, Y0 + VPSLLD $0x02, Y9, Y7 + VPSRLD $0x1e, Y9, Y9 + VPXOR Y7, Y0, Y0 + VPXOR Y9, Y0, Y7 + VPADDD 32(R8), Y7, Y0 + VMOVDQU Y0, 160(R14) + VPALIGNR $0x08, Y13, Y12, Y5 + VPSRLDQ $0x04, Y7, Y0 + VPXOR Y8, Y5, Y5 + VPXOR Y13, Y0, Y0 + VPXOR Y0, Y5, Y5 + VPSLLDQ $0x0c, Y5, Y9 + VPSLLD $0x01, Y5, Y0 + VPSRLD $0x1f, Y5, Y5 + VPOR Y5, Y0, Y0 + VPSLLD $0x02, Y9, Y5 + VPSRLD $0x1e, Y9, Y9 + VPXOR Y5, Y0, Y0 + VPXOR Y9, Y0, Y5 + VPADDD 32(R8), Y5, Y0 + VMOVDQU Y0, 192(R14) + VPALIGNR $0x08, Y12, Y8, Y3 + VPSRLDQ $0x04, Y5, Y0 + VPXOR Y7, Y3, Y3 + VPXOR Y12, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSLLDQ $0x0c, Y3, Y9 + VPSLLD $0x01, Y3, Y0 + VPSRLD $0x1f, Y3, Y3 + VPOR Y3, Y0, Y0 + VPSLLD $0x02, Y9, Y3 + VPSRLD $0x1e, Y9, Y9 + VPXOR Y3, Y0, Y0 + VPXOR Y9, Y0, Y3 + VPADDD 32(R8), Y3, Y0 + VMOVDQU Y0, 224(R14) + VPALIGNR $0x08, Y5, Y3, Y0 + VPXOR Y14, Y15, Y15 + VPXOR Y8, Y0, Y0 + VPXOR Y0, Y15, Y15 + VPSLLD $0x02, Y15, Y0 + VPSRLD $0x1e, Y15, Y15 + VPOR Y15, Y0, Y15 + VPADDD 32(R8), Y15, Y0 + VMOVDQU Y0, 256(R14) + VPALIGNR $0x08, Y3, Y15, Y0 + VPXOR Y13, Y14, Y14 + VPXOR Y7, Y0, Y0 + VPXOR Y0, Y14, Y14 + VPSLLD $0x02, Y14, Y0 + VPSRLD $0x1e, Y14, Y14 + VPOR Y14, Y0, Y14 + VPADDD 32(R8), Y14, Y0 + VMOVDQU Y0, 288(R14) + VPALIGNR $0x08, Y15, Y14, Y0 + VPXOR Y12, Y13, Y13 + VPXOR Y5, Y0, Y0 + VPXOR Y0, Y13, Y13 + VPSLLD $0x02, Y13, Y0 + VPSRLD $0x1e, Y13, Y13 + VPOR Y13, Y0, Y13 + VPADDD 64(R8), Y13, Y0 + VMOVDQU Y0, 320(R14) + VPALIGNR $0x08, Y14, Y13, Y0 + VPXOR Y8, Y12, Y12 + VPXOR Y3, Y0, Y0 + VPXOR Y0, Y12, Y12 + VPSLLD $0x02, Y12, Y0 + VPSRLD $0x1e, Y12, Y12 + VPOR Y12, Y0, Y12 + VPADDD 64(R8), Y12, Y0 + VMOVDQU Y0, 352(R14) + VPALIGNR $0x08, Y13, Y12, Y0 + VPXOR Y7, Y8, Y8 + VPXOR Y15, Y0, Y0 + VPXOR Y0, Y8, Y8 + VPSLLD $0x02, Y8, Y0 + VPSRLD $0x1e, Y8, Y8 + VPOR Y8, Y0, Y8 + VPADDD 64(R8), Y8, Y0 + VMOVDQU Y0, 384(R14) + VPALIGNR $0x08, Y12, Y8, Y0 + VPXOR Y5, Y7, Y7 + VPXOR Y14, Y0, Y0 + VPXOR Y0, Y7, Y7 + VPSLLD $0x02, Y7, Y0 + VPSRLD $0x1e, Y7, Y7 + VPOR Y7, Y0, Y7 + VPADDD 64(R8), Y7, Y0 + VMOVDQU Y0, 416(R14) + VPALIGNR $0x08, Y8, Y7, Y0 + VPXOR Y3, Y5, Y5 + VPXOR Y13, Y0, Y0 + VPXOR Y0, Y5, Y5 + VPSLLD $0x02, Y5, Y0 + VPSRLD $0x1e, Y5, Y5 + VPOR Y5, Y0, Y5 + VPADDD 64(R8), Y5, Y0 + VMOVDQU Y0, 448(R14) + VPALIGNR $0x08, Y7, Y5, Y0 + VPXOR Y15, Y3, Y3 + VPXOR Y12, Y0, Y0 + VPXOR Y0, Y3, Y3 + VPSLLD $0x02, Y3, Y0 + VPSRLD $0x1e, Y3, Y3 + VPOR Y3, Y0, Y3 + VPADDD 96(R8), Y3, Y0 + VMOVDQU Y0, 480(R14) + VPALIGNR $0x08, Y5, Y3, Y0 + VPXOR Y14, Y15, Y15 + VPXOR Y8, Y0, Y0 + VPXOR Y0, Y15, Y15 + VPSLLD $0x02, Y15, Y0 + VPSRLD $0x1e, Y15, Y15 + VPOR Y15, Y0, Y15 + VPADDD 96(R8), Y15, Y0 + VMOVDQU Y0, 512(R14) + VPALIGNR $0x08, Y3, Y15, Y0 + VPXOR Y13, Y14, Y14 + VPXOR Y7, Y0, Y0 + VPXOR Y0, Y14, Y14 + VPSLLD $0x02, Y14, Y0 + VPSRLD $0x1e, Y14, Y14 + VPOR Y14, Y0, Y14 + VPADDD 96(R8), Y14, Y0 + VMOVDQU Y0, 544(R14) + VPALIGNR $0x08, Y15, Y14, Y0 + VPXOR Y12, Y13, Y13 + VPXOR Y5, Y0, Y0 + VPXOR Y0, Y13, Y13 + VPSLLD $0x02, Y13, Y0 + VPSRLD $0x1e, Y13, Y13 + VPOR Y13, Y0, Y13 + VPADDD 96(R8), Y13, Y0 + VMOVDQU Y0, 576(R14) + VPALIGNR $0x08, Y14, Y13, Y0 + VPXOR Y8, Y12, Y12 + VPXOR Y3, Y0, Y0 + VPXOR Y0, Y12, Y12 + VPSLLD $0x02, Y12, Y0 + VPSRLD $0x1e, Y12, Y12 + VPOR Y12, Y0, Y12 + VPADDD 96(R8), Y12, Y0 + VMOVDQU Y0, 608(R14) + XCHGQ R15, R14 + +loop: + CMPQ R10, R8 + JNE begin + VZEROUPPER + RET + +begin: + MOVL SI, BX + RORXL $0x02, SI, SI + ANDNL AX, BX, BP + ANDL DI, BX + XORL BP, BX + ADDL (R15), DX + ANDNL DI, CX, BP + LEAL (DX)(BX*1), DX + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + VMOVDQU 128(R10), X0 + ANDL SI, CX + XORL BP, CX + LEAL (DX)(R12*1), DX + ADDL 4(R15), AX + ANDNL SI, DX, BP + LEAL (AX)(CX*1), AX + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + VINSERTI128 $0x01, 128(R13), Y0, Y0 + ANDL BX, DX + XORL BP, DX + LEAL (AX)(R12*1), AX + ADDL 8(R15), DI + ANDNL BX, AX, BP + LEAL (DI)(DX*1), DI + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + VPSHUFB Y10, Y0, Y15 + ANDL CX, AX + XORL BP, AX + LEAL (DI)(R12*1), DI + ADDL 12(R15), SI + ANDNL CX, DI, BP + LEAL (SI)(AX*1), SI + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + ANDL DX, DI + XORL BP, DI + LEAL (SI)(R12*1), SI + ADDL 32(R15), BX + ANDNL DX, SI, BP + LEAL (BX)(DI*1), BX + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + VPADDD (R8), Y15, Y0 + ANDL AX, SI + XORL BP, SI + LEAL (BX)(R12*1), BX + ADDL 36(R15), CX + ANDNL AX, BX, BP + LEAL (CX)(SI*1), CX + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + ANDL DI, BX + XORL BP, BX + LEAL (CX)(R12*1), CX + ADDL 40(R15), DX + ANDNL DI, CX, BP + LEAL (DX)(BX*1), DX + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + ANDL SI, CX + XORL BP, CX + LEAL (DX)(R12*1), DX + ADDL 44(R15), AX + ANDNL SI, DX, BP + LEAL (AX)(CX*1), AX + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + VMOVDQU Y0, (R14) + ANDL BX, DX + XORL BP, DX + LEAL (AX)(R12*1), AX + ADDL 64(R15), DI + ANDNL BX, AX, BP + LEAL (DI)(DX*1), DI + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + VMOVDQU 144(R10), X0 + ANDL CX, AX + XORL BP, AX + LEAL (DI)(R12*1), DI + ADDL 68(R15), SI + ANDNL CX, DI, BP + LEAL (SI)(AX*1), SI + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + VINSERTI128 $0x01, 144(R13), Y0, Y0 + ANDL DX, DI + XORL BP, DI + LEAL (SI)(R12*1), SI + ADDL 72(R15), BX + ANDNL DX, SI, BP + LEAL (BX)(DI*1), BX + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + VPSHUFB Y10, Y0, Y14 + ANDL AX, SI + XORL BP, SI + LEAL (BX)(R12*1), BX + ADDL 76(R15), CX + ANDNL AX, BX, BP + LEAL (CX)(SI*1), CX + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + ANDL DI, BX + XORL BP, BX + LEAL (CX)(R12*1), CX + ADDL 96(R15), DX + ANDNL DI, CX, BP + LEAL (DX)(BX*1), DX + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + VPADDD (R8), Y14, Y0 + ANDL SI, CX + XORL BP, CX + LEAL (DX)(R12*1), DX + ADDL 100(R15), AX + ANDNL SI, DX, BP + LEAL (AX)(CX*1), AX + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + ANDL BX, DX + XORL BP, DX + LEAL (AX)(R12*1), AX + ADDL 104(R15), DI + ANDNL BX, AX, BP + LEAL (DI)(DX*1), DI + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + ANDL CX, AX + XORL BP, AX + LEAL (DI)(R12*1), DI + ADDL 108(R15), SI + ANDNL CX, DI, BP + LEAL (SI)(AX*1), SI + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + VMOVDQU Y0, 32(R14) + ANDL DX, DI + XORL BP, DI + LEAL (SI)(R12*1), SI + ADDL 128(R15), BX + ANDNL DX, SI, BP + LEAL (BX)(DI*1), BX + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + VMOVDQU 160(R10), X0 + ANDL AX, SI + XORL BP, SI + LEAL (BX)(R12*1), BX + ADDL 132(R15), CX + ANDNL AX, BX, BP + LEAL (CX)(SI*1), CX + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + VINSERTI128 $0x01, 160(R13), Y0, Y0 + ANDL DI, BX + XORL BP, BX + LEAL (CX)(R12*1), CX + ADDL 136(R15), DX + ANDNL DI, CX, BP + LEAL (DX)(BX*1), DX + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + VPSHUFB Y10, Y0, Y13 + ANDL SI, CX + XORL BP, CX + LEAL (DX)(R12*1), DX + ADDL 140(R15), AX + LEAL (AX)(CX*1), AX + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + XORL BX, DX + ADDL R12, AX + XORL SI, DX + ADDL 160(R15), DI + LEAL (DI)(DX*1), DI + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + VPADDD (R8), Y13, Y0 + XORL CX, AX + ADDL R12, DI + XORL BX, AX + ADDL 164(R15), SI + LEAL (SI)(AX*1), SI + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + XORL DX, DI + ADDL R12, SI + XORL CX, DI + ADDL 168(R15), BX + LEAL (BX)(DI*1), BX + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + XORL AX, SI + ADDL R12, BX + XORL DX, SI + ADDL 172(R15), CX + LEAL (CX)(SI*1), CX + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + VMOVDQU Y0, 64(R14) + XORL DI, BX + ADDL R12, CX + XORL AX, BX + ADDL 192(R15), DX + LEAL (DX)(BX*1), DX + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + VMOVDQU 176(R10), X0 + XORL SI, CX + ADDL R12, DX + XORL DI, CX + ADDL 196(R15), AX + LEAL (AX)(CX*1), AX + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + VINSERTI128 $0x01, 176(R13), Y0, Y0 + XORL BX, DX + ADDL R12, AX + XORL SI, DX + ADDL 200(R15), DI + LEAL (DI)(DX*1), DI + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + VPSHUFB Y10, Y0, Y12 + XORL CX, AX + ADDL R12, DI + XORL BX, AX + ADDL 204(R15), SI + LEAL (SI)(AX*1), SI + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + XORL DX, DI + ADDL R12, SI + XORL CX, DI + ADDL 224(R15), BX + LEAL (BX)(DI*1), BX + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + VPADDD (R8), Y12, Y0 + XORL AX, SI + ADDL R12, BX + XORL DX, SI + ADDL 228(R15), CX + LEAL (CX)(SI*1), CX + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + XORL DI, BX + ADDL R12, CX + XORL AX, BX + ADDL 232(R15), DX + LEAL (DX)(BX*1), DX + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + XORL SI, CX + ADDL R12, DX + XORL DI, CX + ADDL 236(R15), AX + LEAL (AX)(CX*1), AX + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + VMOVDQU Y0, 96(R14) + XORL BX, DX + ADDL R12, AX + XORL SI, DX + ADDL 256(R15), DI + LEAL (DI)(DX*1), DI + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + VPALIGNR $0x08, Y15, Y14, Y8 + VPSRLDQ $0x04, Y12, Y0 + XORL CX, AX + ADDL R12, DI + XORL BX, AX + ADDL 260(R15), SI + LEAL (SI)(AX*1), SI + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + VPXOR Y13, Y8, Y8 + VPXOR Y15, Y0, Y0 + XORL DX, DI + ADDL R12, SI + XORL CX, DI + ADDL 264(R15), BX + LEAL (BX)(DI*1), BX + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + VPXOR Y0, Y8, Y8 + VPSLLDQ $0x0c, Y8, Y9 + XORL AX, SI + ADDL R12, BX + XORL DX, SI + ADDL 268(R15), CX + LEAL (CX)(SI*1), CX + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + VPSLLD $0x01, Y8, Y0 + VPSRLD $0x1f, Y8, Y8 + XORL DI, BX + ADDL R12, CX + XORL AX, BX + ADDL 288(R15), DX + LEAL (DX)(BX*1), DX + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + VPOR Y8, Y0, Y0 + VPSLLD $0x02, Y9, Y8 + XORL SI, CX + ADDL R12, DX + XORL DI, CX + ADDL 292(R15), AX + LEAL (AX)(CX*1), AX + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + VPSRLD $0x1e, Y9, Y9 + VPXOR Y8, Y0, Y0 + XORL BX, DX + ADDL R12, AX + XORL SI, DX + ADDL 296(R15), DI + LEAL (DI)(DX*1), DI + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + XORL CX, AX + ADDL R12, DI + XORL BX, AX + ADDL 300(R15), SI + VPXOR Y9, Y0, Y8 + VPADDD (R8), Y8, Y0 + VMOVDQU Y0, 128(R14) + LEAL (SI)(AX*1), SI + MOVL DX, BP + ORL DI, BP + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + ANDL CX, BP + ANDL DX, DI + ORL BP, DI + ADDL R12, SI + ADDL 320(R15), BX + VPALIGNR $0x08, Y14, Y13, Y7 + VPSRLDQ $0x04, Y8, Y0 + LEAL (BX)(DI*1), BX + MOVL AX, BP + ORL SI, BP + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + ANDL DX, BP + ANDL AX, SI + ORL BP, SI + ADDL R12, BX + ADDL 324(R15), CX + VPXOR Y12, Y7, Y7 + VPXOR Y14, Y0, Y0 + LEAL (CX)(SI*1), CX + MOVL DI, BP + ORL BX, BP + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + ANDL AX, BP + ANDL DI, BX + ORL BP, BX + ADDL R12, CX + ADDL 328(R15), DX + VPXOR Y0, Y7, Y7 + VPSLLDQ $0x0c, Y7, Y9 + LEAL (DX)(BX*1), DX + MOVL SI, BP + ORL CX, BP + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + ANDL DI, BP + ANDL SI, CX + ORL BP, CX + ADDL R12, DX + ADDL 332(R15), AX + VPSLLD $0x01, Y7, Y0 + VPSRLD $0x1f, Y7, Y7 + LEAL (AX)(CX*1), AX + MOVL BX, BP + ORL DX, BP + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + ANDL SI, BP + ANDL BX, DX + ORL BP, DX + ADDL R12, AX + ADDL 352(R15), DI + VPOR Y7, Y0, Y0 + VPSLLD $0x02, Y9, Y7 + LEAL (DI)(DX*1), DI + MOVL CX, BP + ORL AX, BP + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + ANDL BX, BP + ANDL CX, AX + ORL BP, AX + ADDL R12, DI + ADDL 356(R15), SI + VPSRLD $0x1e, Y9, Y9 + VPXOR Y7, Y0, Y0 + LEAL (SI)(AX*1), SI + MOVL DX, BP + ORL DI, BP + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + ANDL CX, BP + ANDL DX, DI + ORL BP, DI + ADDL R12, SI + ADDL 360(R15), BX + LEAL (BX)(DI*1), BX + MOVL AX, BP + ORL SI, BP + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + ANDL DX, BP + ANDL AX, SI + ORL BP, SI + ADDL R12, BX + ADDL 364(R15), CX + VPXOR Y9, Y0, Y7 + VPADDD 32(R8), Y7, Y0 + VMOVDQU Y0, 160(R14) + LEAL (CX)(SI*1), CX + MOVL DI, BP + ORL BX, BP + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + ANDL AX, BP + ANDL DI, BX + ORL BP, BX + ADDL R12, CX + ADDL 384(R15), DX + VPALIGNR $0x08, Y13, Y12, Y5 + VPSRLDQ $0x04, Y7, Y0 + LEAL (DX)(BX*1), DX + MOVL SI, BP + ORL CX, BP + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + ANDL DI, BP + ANDL SI, CX + ORL BP, CX + ADDL R12, DX + ADDL 388(R15), AX + VPXOR Y8, Y5, Y5 + VPXOR Y13, Y0, Y0 + LEAL (AX)(CX*1), AX + MOVL BX, BP + ORL DX, BP + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + ANDL SI, BP + ANDL BX, DX + ORL BP, DX + ADDL R12, AX + ADDL 392(R15), DI + VPXOR Y0, Y5, Y5 + VPSLLDQ $0x0c, Y5, Y9 + LEAL (DI)(DX*1), DI + MOVL CX, BP + ORL AX, BP + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + ANDL BX, BP + ANDL CX, AX + ORL BP, AX + ADDL R12, DI + ADDL 396(R15), SI + VPSLLD $0x01, Y5, Y0 + VPSRLD $0x1f, Y5, Y5 + LEAL (SI)(AX*1), SI + MOVL DX, BP + ORL DI, BP + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + ANDL CX, BP + ANDL DX, DI + ORL BP, DI + ADDL R12, SI + ADDL 416(R15), BX + VPOR Y5, Y0, Y0 + VPSLLD $0x02, Y9, Y5 + LEAL (BX)(DI*1), BX + MOVL AX, BP + ORL SI, BP + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + ANDL DX, BP + ANDL AX, SI + ORL BP, SI + ADDL R12, BX + ADDL 420(R15), CX + VPSRLD $0x1e, Y9, Y9 + VPXOR Y5, Y0, Y0 + LEAL (CX)(SI*1), CX + MOVL DI, BP + ORL BX, BP + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + ANDL AX, BP + ANDL DI, BX + ORL BP, BX + ADDL R12, CX + ADDL 424(R15), DX + LEAL (DX)(BX*1), DX + MOVL SI, BP + ORL CX, BP + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + ANDL DI, BP + ANDL SI, CX + ORL BP, CX + ADDL R12, DX + ADDL 428(R15), AX + VPXOR Y9, Y0, Y5 + VPADDD 32(R8), Y5, Y0 + VMOVDQU Y0, 192(R14) + LEAL (AX)(CX*1), AX + MOVL BX, BP + ORL DX, BP + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + ANDL SI, BP + ANDL BX, DX + ORL BP, DX + ADDL R12, AX + ADDL 448(R15), DI + VPALIGNR $0x08, Y12, Y8, Y3 + VPSRLDQ $0x04, Y5, Y0 + LEAL (DI)(DX*1), DI + MOVL CX, BP + ORL AX, BP + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + ANDL BX, BP + ANDL CX, AX + ORL BP, AX + ADDL R12, DI + ADDL 452(R15), SI + VPXOR Y7, Y3, Y3 + VPXOR Y12, Y0, Y0 + LEAL (SI)(AX*1), SI + MOVL DX, BP + ORL DI, BP + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + ANDL CX, BP + ANDL DX, DI + ORL BP, DI + ADDL R12, SI + ADDL 456(R15), BX + VPXOR Y0, Y3, Y3 + VPSLLDQ $0x0c, Y3, Y9 + LEAL (BX)(DI*1), BX + MOVL AX, BP + ORL SI, BP + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + ANDL DX, BP + ANDL AX, SI + ORL BP, SI + ADDL R12, BX + ADDL 460(R15), CX + LEAL (CX)(SI*1), CX + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + VPSLLD $0x01, Y3, Y0 + VPSRLD $0x1f, Y3, Y3 + XORL DI, BX + ADDL R12, CX + XORL AX, BX + ADDQ $0x80, R10 + CMPQ R10, R11 + CMOVQCC R8, R10 + ADDL 480(R15), DX + LEAL (DX)(BX*1), DX + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + VPOR Y3, Y0, Y0 + VPSLLD $0x02, Y9, Y3 + XORL SI, CX + ADDL R12, DX + XORL DI, CX + ADDL 484(R15), AX + LEAL (AX)(CX*1), AX + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + VPSRLD $0x1e, Y9, Y9 + VPXOR Y3, Y0, Y0 + XORL BX, DX + ADDL R12, AX + XORL SI, DX + ADDL 488(R15), DI + LEAL (DI)(DX*1), DI + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + XORL CX, AX + ADDL R12, DI + XORL BX, AX + ADDL 492(R15), SI + LEAL (SI)(AX*1), SI + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + VPXOR Y9, Y0, Y3 + VPADDD 32(R8), Y3, Y0 + VMOVDQU Y0, 224(R14) + XORL DX, DI + ADDL R12, SI + XORL CX, DI + ADDL 512(R15), BX + LEAL (BX)(DI*1), BX + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + VPALIGNR $0x08, Y5, Y3, Y0 + XORL AX, SI + ADDL R12, BX + XORL DX, SI + ADDL 516(R15), CX + LEAL (CX)(SI*1), CX + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + VPXOR Y14, Y15, Y15 + XORL DI, BX + ADDL R12, CX + XORL AX, BX + ADDL 520(R15), DX + LEAL (DX)(BX*1), DX + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + VPXOR Y8, Y0, Y0 + XORL SI, CX + ADDL R12, DX + XORL DI, CX + ADDL 524(R15), AX + LEAL (AX)(CX*1), AX + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + VPXOR Y0, Y15, Y15 + XORL BX, DX + ADDL R12, AX + XORL SI, DX + ADDL 544(R15), DI + LEAL (DI)(DX*1), DI + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + VPSLLD $0x02, Y15, Y0 + XORL CX, AX + ADDL R12, DI + XORL BX, AX + ADDL 548(R15), SI + LEAL (SI)(AX*1), SI + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + VPSRLD $0x1e, Y15, Y15 + VPOR Y15, Y0, Y15 + XORL DX, DI + ADDL R12, SI + XORL CX, DI + ADDL 552(R15), BX + LEAL (BX)(DI*1), BX + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + XORL AX, SI + ADDL R12, BX + XORL DX, SI + ADDL 556(R15), CX + LEAL (CX)(SI*1), CX + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + VPADDD 32(R8), Y15, Y0 + VMOVDQU Y0, 256(R14) + XORL DI, BX + ADDL R12, CX + XORL AX, BX + ADDL 576(R15), DX + LEAL (DX)(BX*1), DX + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + VPALIGNR $0x08, Y3, Y15, Y0 + XORL SI, CX + ADDL R12, DX + XORL DI, CX + ADDL 580(R15), AX + LEAL (AX)(CX*1), AX + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + VPXOR Y13, Y14, Y14 + XORL BX, DX + ADDL R12, AX + XORL SI, DX + ADDL 584(R15), DI + LEAL (DI)(DX*1), DI + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + VPXOR Y7, Y0, Y0 + XORL CX, AX + ADDL R12, DI + XORL BX, AX + ADDL 588(R15), SI + LEAL (SI)(AX*1), SI + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + VPXOR Y0, Y14, Y14 + XORL DX, DI + ADDL R12, SI + XORL CX, DI + ADDL 608(R15), BX + LEAL (BX)(DI*1), BX + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + VPSLLD $0x02, Y14, Y0 + XORL AX, SI + ADDL R12, BX + XORL DX, SI + ADDL 612(R15), CX + LEAL (CX)(SI*1), CX + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + VPSRLD $0x1e, Y14, Y14 + VPOR Y14, Y0, Y14 + XORL DI, BX + ADDL R12, CX + XORL AX, BX + ADDL 616(R15), DX + LEAL (DX)(BX*1), DX + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + XORL SI, CX + ADDL R12, DX + XORL DI, CX + ADDL 620(R15), AX + LEAL (AX)(CX*1), AX + RORXL $0x1b, DX, R12 + VPADDD 32(R8), Y14, Y0 + VMOVDQU Y0, 288(R14) + ADDL R12, AX + ADDL (R9), AX + MOVL AX, (R9) + ADDL 4(R9), DX + MOVL DX, 4(R9) + ADDL 8(R9), BX + MOVL BX, 8(R9) + ADDL 12(R9), SI + MOVL SI, 12(R9) + ADDL 16(R9), DI + MOVL DI, 16(R9) + CMPQ R10, R8 + JE loop + MOVL DX, CX + MOVL CX, DX + RORXL $0x02, CX, CX + ANDNL SI, DX, BP + ANDL BX, DX + XORL BP, DX + ADDL 16(R15), DI + ANDNL BX, AX, BP + LEAL (DI)(DX*1), DI + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + VPALIGNR $0x08, Y15, Y14, Y0 + ANDL CX, AX + XORL BP, AX + LEAL (DI)(R12*1), DI + ADDL 20(R15), SI + ANDNL CX, DI, BP + LEAL (SI)(AX*1), SI + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + VPXOR Y12, Y13, Y13 + ANDL DX, DI + XORL BP, DI + LEAL (SI)(R12*1), SI + ADDL 24(R15), BX + ANDNL DX, SI, BP + LEAL (BX)(DI*1), BX + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + VPXOR Y5, Y0, Y0 + ANDL AX, SI + XORL BP, SI + LEAL (BX)(R12*1), BX + ADDL 28(R15), CX + ANDNL AX, BX, BP + LEAL (CX)(SI*1), CX + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + VPXOR Y0, Y13, Y13 + ANDL DI, BX + XORL BP, BX + LEAL (CX)(R12*1), CX + ADDL 48(R15), DX + ANDNL DI, CX, BP + LEAL (DX)(BX*1), DX + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + VPSLLD $0x02, Y13, Y0 + ANDL SI, CX + XORL BP, CX + LEAL (DX)(R12*1), DX + ADDL 52(R15), AX + ANDNL SI, DX, BP + LEAL (AX)(CX*1), AX + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + VPSRLD $0x1e, Y13, Y13 + VPOR Y13, Y0, Y13 + ANDL BX, DX + XORL BP, DX + LEAL (AX)(R12*1), AX + ADDL 56(R15), DI + ANDNL BX, AX, BP + LEAL (DI)(DX*1), DI + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + ANDL CX, AX + XORL BP, AX + LEAL (DI)(R12*1), DI + ADDL 60(R15), SI + ANDNL CX, DI, BP + LEAL (SI)(AX*1), SI + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + VPADDD 64(R8), Y13, Y0 + VMOVDQU Y0, 320(R14) + ANDL DX, DI + XORL BP, DI + LEAL (SI)(R12*1), SI + ADDL 80(R15), BX + ANDNL DX, SI, BP + LEAL (BX)(DI*1), BX + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + VPALIGNR $0x08, Y14, Y13, Y0 + ANDL AX, SI + XORL BP, SI + LEAL (BX)(R12*1), BX + ADDL 84(R15), CX + ANDNL AX, BX, BP + LEAL (CX)(SI*1), CX + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + VPXOR Y8, Y12, Y12 + ANDL DI, BX + XORL BP, BX + LEAL (CX)(R12*1), CX + ADDL 88(R15), DX + ANDNL DI, CX, BP + LEAL (DX)(BX*1), DX + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + VPXOR Y3, Y0, Y0 + ANDL SI, CX + XORL BP, CX + LEAL (DX)(R12*1), DX + ADDL 92(R15), AX + ANDNL SI, DX, BP + LEAL (AX)(CX*1), AX + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + VPXOR Y0, Y12, Y12 + ANDL BX, DX + XORL BP, DX + LEAL (AX)(R12*1), AX + ADDL 112(R15), DI + ANDNL BX, AX, BP + LEAL (DI)(DX*1), DI + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + VPSLLD $0x02, Y12, Y0 + ANDL CX, AX + XORL BP, AX + LEAL (DI)(R12*1), DI + ADDL 116(R15), SI + ANDNL CX, DI, BP + LEAL (SI)(AX*1), SI + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + VPSRLD $0x1e, Y12, Y12 + VPOR Y12, Y0, Y12 + ANDL DX, DI + XORL BP, DI + LEAL (SI)(R12*1), SI + ADDL 120(R15), BX + ANDNL DX, SI, BP + LEAL (BX)(DI*1), BX + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + ANDL AX, SI + XORL BP, SI + LEAL (BX)(R12*1), BX + ADDL 124(R15), CX + ANDNL AX, BX, BP + LEAL (CX)(SI*1), CX + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + VPADDD 64(R8), Y12, Y0 + VMOVDQU Y0, 352(R14) + ANDL DI, BX + XORL BP, BX + LEAL (CX)(R12*1), CX + ADDL 144(R15), DX + ANDNL DI, CX, BP + LEAL (DX)(BX*1), DX + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + VPALIGNR $0x08, Y13, Y12, Y0 + ANDL SI, CX + XORL BP, CX + LEAL (DX)(R12*1), DX + ADDL 148(R15), AX + ANDNL SI, DX, BP + LEAL (AX)(CX*1), AX + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + VPXOR Y7, Y8, Y8 + ANDL BX, DX + XORL BP, DX + LEAL (AX)(R12*1), AX + ADDL 152(R15), DI + ANDNL BX, AX, BP + LEAL (DI)(DX*1), DI + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + VPXOR Y15, Y0, Y0 + ANDL CX, AX + XORL BP, AX + LEAL (DI)(R12*1), DI + ADDL 156(R15), SI + LEAL (SI)(AX*1), SI + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + VPXOR Y0, Y8, Y8 + XORL DX, DI + ADDL R12, SI + XORL CX, DI + ADDL 176(R15), BX + LEAL (BX)(DI*1), BX + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + VPSLLD $0x02, Y8, Y0 + XORL AX, SI + ADDL R12, BX + XORL DX, SI + ADDL 180(R15), CX + LEAL (CX)(SI*1), CX + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + VPSRLD $0x1e, Y8, Y8 + VPOR Y8, Y0, Y8 + XORL DI, BX + ADDL R12, CX + XORL AX, BX + ADDL 184(R15), DX + LEAL (DX)(BX*1), DX + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + XORL SI, CX + ADDL R12, DX + XORL DI, CX + ADDL 188(R15), AX + LEAL (AX)(CX*1), AX + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + VPADDD 64(R8), Y8, Y0 + VMOVDQU Y0, 384(R14) + XORL BX, DX + ADDL R12, AX + XORL SI, DX + ADDL 208(R15), DI + LEAL (DI)(DX*1), DI + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + VPALIGNR $0x08, Y12, Y8, Y0 + XORL CX, AX + ADDL R12, DI + XORL BX, AX + ADDL 212(R15), SI + LEAL (SI)(AX*1), SI + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + VPXOR Y5, Y7, Y7 + XORL DX, DI + ADDL R12, SI + XORL CX, DI + ADDL 216(R15), BX + LEAL (BX)(DI*1), BX + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + VPXOR Y14, Y0, Y0 + XORL AX, SI + ADDL R12, BX + XORL DX, SI + ADDL 220(R15), CX + LEAL (CX)(SI*1), CX + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + VPXOR Y0, Y7, Y7 + XORL DI, BX + ADDL R12, CX + XORL AX, BX + ADDL 240(R15), DX + LEAL (DX)(BX*1), DX + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + VPSLLD $0x02, Y7, Y0 + XORL SI, CX + ADDL R12, DX + XORL DI, CX + ADDL 244(R15), AX + LEAL (AX)(CX*1), AX + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + VPSRLD $0x1e, Y7, Y7 + VPOR Y7, Y0, Y7 + XORL BX, DX + ADDL R12, AX + XORL SI, DX + ADDL 248(R15), DI + LEAL (DI)(DX*1), DI + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + XORL CX, AX + ADDL R12, DI + XORL BX, AX + ADDL 252(R15), SI + LEAL (SI)(AX*1), SI + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + VPADDD 64(R8), Y7, Y0 + VMOVDQU Y0, 416(R14) + XORL DX, DI + ADDL R12, SI + XORL CX, DI + ADDL 272(R15), BX + LEAL (BX)(DI*1), BX + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + VPALIGNR $0x08, Y8, Y7, Y0 + XORL AX, SI + ADDL R12, BX + XORL DX, SI + ADDL 276(R15), CX + LEAL (CX)(SI*1), CX + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + VPXOR Y3, Y5, Y5 + XORL DI, BX + ADDL R12, CX + XORL AX, BX + ADDL 280(R15), DX + LEAL (DX)(BX*1), DX + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + VPXOR Y13, Y0, Y0 + XORL SI, CX + ADDL R12, DX + XORL DI, CX + ADDL 284(R15), AX + LEAL (AX)(CX*1), AX + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + VPXOR Y0, Y5, Y5 + XORL BX, DX + ADDL R12, AX + XORL SI, DX + ADDL 304(R15), DI + LEAL (DI)(DX*1), DI + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + VPSLLD $0x02, Y5, Y0 + XORL CX, AX + ADDL R12, DI + XORL BX, AX + ADDL 308(R15), SI + LEAL (SI)(AX*1), SI + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + VPSRLD $0x1e, Y5, Y5 + VPOR Y5, Y0, Y5 + XORL DX, DI + ADDL R12, SI + XORL CX, DI + ADDL 312(R15), BX + LEAL (BX)(DI*1), BX + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + XORL AX, SI + ADDL R12, BX + XORL DX, SI + ADDL 316(R15), CX + VPADDD 64(R8), Y5, Y0 + VMOVDQU Y0, 448(R14) + LEAL (CX)(SI*1), CX + MOVL DI, BP + ORL BX, BP + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + ANDL AX, BP + ANDL DI, BX + ORL BP, BX + ADDL R12, CX + ADDL 336(R15), DX + VPALIGNR $0x08, Y7, Y5, Y0 + LEAL (DX)(BX*1), DX + MOVL SI, BP + ORL CX, BP + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + ANDL DI, BP + ANDL SI, CX + ORL BP, CX + ADDL R12, DX + ADDL 340(R15), AX + VPXOR Y15, Y3, Y3 + LEAL (AX)(CX*1), AX + MOVL BX, BP + ORL DX, BP + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + ANDL SI, BP + ANDL BX, DX + ORL BP, DX + ADDL R12, AX + ADDL 344(R15), DI + VPXOR Y12, Y0, Y0 + LEAL (DI)(DX*1), DI + MOVL CX, BP + ORL AX, BP + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + ANDL BX, BP + ANDL CX, AX + ORL BP, AX + ADDL R12, DI + ADDL 348(R15), SI + VPXOR Y0, Y3, Y3 + LEAL (SI)(AX*1), SI + MOVL DX, BP + ORL DI, BP + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + ANDL CX, BP + ANDL DX, DI + ORL BP, DI + ADDL R12, SI + ADDL 368(R15), BX + VPSLLD $0x02, Y3, Y0 + LEAL (BX)(DI*1), BX + MOVL AX, BP + ORL SI, BP + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + ANDL DX, BP + ANDL AX, SI + ORL BP, SI + ADDL R12, BX + ADDL 372(R15), CX + VPSRLD $0x1e, Y3, Y3 + VPOR Y3, Y0, Y3 + LEAL (CX)(SI*1), CX + MOVL DI, BP + ORL BX, BP + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + ANDL AX, BP + ANDL DI, BX + ORL BP, BX + ADDL R12, CX + ADDL 376(R15), DX + LEAL (DX)(BX*1), DX + MOVL SI, BP + ORL CX, BP + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + ANDL DI, BP + ANDL SI, CX + ORL BP, CX + ADDL R12, DX + ADDL 380(R15), AX + VPADDD 96(R8), Y3, Y0 + VMOVDQU Y0, 480(R14) + LEAL (AX)(CX*1), AX + MOVL BX, BP + ORL DX, BP + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + ANDL SI, BP + ANDL BX, DX + ORL BP, DX + ADDL R12, AX + ADDL 400(R15), DI + VPALIGNR $0x08, Y5, Y3, Y0 + LEAL (DI)(DX*1), DI + MOVL CX, BP + ORL AX, BP + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + ANDL BX, BP + ANDL CX, AX + ORL BP, AX + ADDL R12, DI + ADDL 404(R15), SI + VPXOR Y14, Y15, Y15 + LEAL (SI)(AX*1), SI + MOVL DX, BP + ORL DI, BP + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + ANDL CX, BP + ANDL DX, DI + ORL BP, DI + ADDL R12, SI + ADDL 408(R15), BX + VPXOR Y8, Y0, Y0 + LEAL (BX)(DI*1), BX + MOVL AX, BP + ORL SI, BP + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + ANDL DX, BP + ANDL AX, SI + ORL BP, SI + ADDL R12, BX + ADDL 412(R15), CX + VPXOR Y0, Y15, Y15 + LEAL (CX)(SI*1), CX + MOVL DI, BP + ORL BX, BP + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + ANDL AX, BP + ANDL DI, BX + ORL BP, BX + ADDL R12, CX + ADDL 432(R15), DX + VPSLLD $0x02, Y15, Y0 + LEAL (DX)(BX*1), DX + MOVL SI, BP + ORL CX, BP + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + ANDL DI, BP + ANDL SI, CX + ORL BP, CX + ADDL R12, DX + ADDL 436(R15), AX + VPSRLD $0x1e, Y15, Y15 + VPOR Y15, Y0, Y15 + LEAL (AX)(CX*1), AX + MOVL BX, BP + ORL DX, BP + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + ANDL SI, BP + ANDL BX, DX + ORL BP, DX + ADDL R12, AX + ADDL 440(R15), DI + LEAL (DI)(DX*1), DI + MOVL CX, BP + ORL AX, BP + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + ANDL BX, BP + ANDL CX, AX + ORL BP, AX + ADDL R12, DI + ADDL 444(R15), SI + VPADDD 96(R8), Y15, Y0 + VMOVDQU Y0, 512(R14) + LEAL (SI)(AX*1), SI + MOVL DX, BP + ORL DI, BP + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + ANDL CX, BP + ANDL DX, DI + ORL BP, DI + ADDL R12, SI + ADDL 464(R15), BX + VPALIGNR $0x08, Y3, Y15, Y0 + LEAL (BX)(DI*1), BX + MOVL AX, BP + ORL SI, BP + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + ANDL DX, BP + ANDL AX, SI + ORL BP, SI + ADDL R12, BX + ADDL 468(R15), CX + VPXOR Y13, Y14, Y14 + LEAL (CX)(SI*1), CX + MOVL DI, BP + ORL BX, BP + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + ANDL AX, BP + ANDL DI, BX + ORL BP, BX + ADDL R12, CX + ADDL 472(R15), DX + VPXOR Y7, Y0, Y0 + LEAL (DX)(BX*1), DX + MOVL SI, BP + ORL CX, BP + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + ANDL DI, BP + ANDL SI, CX + ORL BP, CX + ADDL R12, DX + ADDL 476(R15), AX + LEAL (AX)(CX*1), AX + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + VPXOR Y0, Y14, Y14 + XORL BX, DX + ADDL R12, AX + XORL SI, DX + ADDQ $0x80, R13 + CMPQ R13, R11 + CMOVQCC R8, R10 + ADDL 496(R15), DI + LEAL (DI)(DX*1), DI + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + VPSLLD $0x02, Y14, Y0 + XORL CX, AX + ADDL R12, DI + XORL BX, AX + ADDL 500(R15), SI + LEAL (SI)(AX*1), SI + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + VPSRLD $0x1e, Y14, Y14 + VPOR Y14, Y0, Y14 + XORL DX, DI + ADDL R12, SI + XORL CX, DI + ADDL 504(R15), BX + LEAL (BX)(DI*1), BX + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + XORL AX, SI + ADDL R12, BX + XORL DX, SI + ADDL 508(R15), CX + LEAL (CX)(SI*1), CX + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + VPADDD 96(R8), Y14, Y0 + VMOVDQU Y0, 544(R14) + XORL DI, BX + ADDL R12, CX + XORL AX, BX + ADDL 528(R15), DX + LEAL (DX)(BX*1), DX + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + VPALIGNR $0x08, Y15, Y14, Y0 + XORL SI, CX + ADDL R12, DX + XORL DI, CX + ADDL 532(R15), AX + LEAL (AX)(CX*1), AX + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + VPXOR Y12, Y13, Y13 + XORL BX, DX + ADDL R12, AX + XORL SI, DX + ADDL 536(R15), DI + LEAL (DI)(DX*1), DI + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + VPXOR Y5, Y0, Y0 + XORL CX, AX + ADDL R12, DI + XORL BX, AX + ADDL 540(R15), SI + LEAL (SI)(AX*1), SI + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + VPXOR Y0, Y13, Y13 + XORL DX, DI + ADDL R12, SI + XORL CX, DI + ADDL 560(R15), BX + LEAL (BX)(DI*1), BX + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + VPSLLD $0x02, Y13, Y0 + XORL AX, SI + ADDL R12, BX + XORL DX, SI + ADDL 564(R15), CX + LEAL (CX)(SI*1), CX + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + VPSRLD $0x1e, Y13, Y13 + VPOR Y13, Y0, Y13 + XORL DI, BX + ADDL R12, CX + XORL AX, BX + ADDL 568(R15), DX + LEAL (DX)(BX*1), DX + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + XORL SI, CX + ADDL R12, DX + XORL DI, CX + ADDL 572(R15), AX + LEAL (AX)(CX*1), AX + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + VPADDD 96(R8), Y13, Y0 + VMOVDQU Y0, 576(R14) + XORL BX, DX + ADDL R12, AX + XORL SI, DX + ADDL 592(R15), DI + LEAL (DI)(DX*1), DI + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + VPALIGNR $0x08, Y14, Y13, Y0 + XORL CX, AX + ADDL R12, DI + XORL BX, AX + ADDL 596(R15), SI + LEAL (SI)(AX*1), SI + RORXL $0x1b, DI, R12 + RORXL $0x02, DI, AX + VPXOR Y8, Y12, Y12 + XORL DX, DI + ADDL R12, SI + XORL CX, DI + ADDL 600(R15), BX + LEAL (BX)(DI*1), BX + RORXL $0x1b, SI, R12 + RORXL $0x02, SI, DI + VPXOR Y3, Y0, Y0 + XORL AX, SI + ADDL R12, BX + XORL DX, SI + ADDL 604(R15), CX + LEAL (CX)(SI*1), CX + RORXL $0x1b, BX, R12 + RORXL $0x02, BX, SI + VPXOR Y0, Y12, Y12 + XORL DI, BX + ADDL R12, CX + XORL AX, BX + ADDL 624(R15), DX + LEAL (DX)(BX*1), DX + RORXL $0x1b, CX, R12 + RORXL $0x02, CX, BX + VPSLLD $0x02, Y12, Y0 + XORL SI, CX + ADDL R12, DX + XORL DI, CX + ADDL 628(R15), AX + LEAL (AX)(CX*1), AX + RORXL $0x1b, DX, R12 + RORXL $0x02, DX, CX + VPSRLD $0x1e, Y12, Y12 + VPOR Y12, Y0, Y12 + XORL BX, DX + ADDL R12, AX + XORL SI, DX + ADDL 632(R15), DI + LEAL (DI)(DX*1), DI + RORXL $0x1b, AX, R12 + RORXL $0x02, AX, DX + XORL CX, AX + ADDL R12, DI + XORL BX, AX + ADDL 636(R15), SI + LEAL (SI)(AX*1), SI + RORXL $0x1b, DI, R12 + VPADDD 96(R8), Y12, Y0 + VMOVDQU Y0, 608(R14) + ADDL R12, SI + ADDL (R9), SI + MOVL SI, (R9) + ADDL 4(R9), DI + MOVL DI, 4(R9) + ADDL 8(R9), DX + MOVL DX, 8(R9) + ADDL 12(R9), CX + MOVL CX, 12(R9) + ADDL 16(R9), BX + MOVL BX, 16(R9) + MOVL SI, R12 + MOVL DI, SI + MOVL DX, DI + MOVL BX, DX + MOVL CX, AX + MOVL R12, CX + XCHGQ R15, R14 + JMP loop + +DATA K_XMM_AR<>+0(SB)/4, $0x5a827999 +DATA K_XMM_AR<>+4(SB)/4, $0x5a827999 +DATA K_XMM_AR<>+8(SB)/4, $0x5a827999 +DATA K_XMM_AR<>+12(SB)/4, $0x5a827999 +DATA K_XMM_AR<>+16(SB)/4, $0x5a827999 +DATA K_XMM_AR<>+20(SB)/4, $0x5a827999 +DATA K_XMM_AR<>+24(SB)/4, $0x5a827999 +DATA K_XMM_AR<>+28(SB)/4, $0x5a827999 +DATA K_XMM_AR<>+32(SB)/4, $0x6ed9eba1 +DATA K_XMM_AR<>+36(SB)/4, $0x6ed9eba1 +DATA K_XMM_AR<>+40(SB)/4, $0x6ed9eba1 +DATA K_XMM_AR<>+44(SB)/4, $0x6ed9eba1 +DATA K_XMM_AR<>+48(SB)/4, $0x6ed9eba1 +DATA K_XMM_AR<>+52(SB)/4, $0x6ed9eba1 +DATA K_XMM_AR<>+56(SB)/4, $0x6ed9eba1 +DATA K_XMM_AR<>+60(SB)/4, $0x6ed9eba1 +DATA K_XMM_AR<>+64(SB)/4, $0x8f1bbcdc +DATA K_XMM_AR<>+68(SB)/4, $0x8f1bbcdc +DATA K_XMM_AR<>+72(SB)/4, $0x8f1bbcdc +DATA K_XMM_AR<>+76(SB)/4, $0x8f1bbcdc +DATA K_XMM_AR<>+80(SB)/4, $0x8f1bbcdc +DATA K_XMM_AR<>+84(SB)/4, $0x8f1bbcdc +DATA K_XMM_AR<>+88(SB)/4, $0x8f1bbcdc +DATA K_XMM_AR<>+92(SB)/4, $0x8f1bbcdc +DATA K_XMM_AR<>+96(SB)/4, $0xca62c1d6 +DATA K_XMM_AR<>+100(SB)/4, $0xca62c1d6 +DATA K_XMM_AR<>+104(SB)/4, $0xca62c1d6 +DATA K_XMM_AR<>+108(SB)/4, $0xca62c1d6 +DATA K_XMM_AR<>+112(SB)/4, $0xca62c1d6 +DATA K_XMM_AR<>+116(SB)/4, $0xca62c1d6 +DATA K_XMM_AR<>+120(SB)/4, $0xca62c1d6 +DATA K_XMM_AR<>+124(SB)/4, $0xca62c1d6 +GLOBL K_XMM_AR<>(SB), RODATA, $128 + +DATA BSWAP_SHUFB_CTL<>+0(SB)/4, $0x00010203 +DATA BSWAP_SHUFB_CTL<>+4(SB)/4, $0x04050607 +DATA BSWAP_SHUFB_CTL<>+8(SB)/4, $0x08090a0b +DATA BSWAP_SHUFB_CTL<>+12(SB)/4, $0x0c0d0e0f +DATA BSWAP_SHUFB_CTL<>+16(SB)/4, $0x00010203 +DATA BSWAP_SHUFB_CTL<>+20(SB)/4, $0x04050607 +DATA BSWAP_SHUFB_CTL<>+24(SB)/4, $0x08090a0b +DATA BSWAP_SHUFB_CTL<>+28(SB)/4, $0x0c0d0e0f +GLOBL BSWAP_SHUFB_CTL<>(SB), RODATA, $32 + +// func blockSHANI(dig *digest, p []byte) +// Requires: AVX, SHA, SSE2, SSE4.1, SSSE3 +TEXT ·blockSHANI(SB), $48-32 + MOVQ dig+0(FP), DI + MOVQ p_base+8(FP), SI + MOVQ p_len+16(FP), DX + CMPQ DX, $0x00 + JEQ done + ADDQ SI, DX + + // Allocate space on the stack for saving ABCD and E0, and align it to 16 bytes + LEAQ 15(SP), AX + MOVQ $0x000000000000000f, CX + NOTQ CX + ANDQ CX, AX + + // Load initial hash state + PINSRD $0x03, 16(DI), X5 + VMOVDQU (DI), X0 + PAND upper_mask<>+0(SB), X5 + PSHUFD $0x1b, X0, X0 + VMOVDQA shuffle_mask<>+0(SB), X7 + +loop: + // Save ABCD and E working values + VMOVDQA X5, (AX) + VMOVDQA X0, 16(AX) + + // Rounds 0-3 + VMOVDQU (SI), X1 + PSHUFB X7, X1 + PADDD X1, X5 + VMOVDQA X0, X6 + SHA1RNDS4 $0x00, X5, X0 + + // Rounds 4-7 + VMOVDQU 16(SI), X2 + PSHUFB X7, X2 + SHA1NEXTE X2, X6 + VMOVDQA X0, X5 + SHA1RNDS4 $0x00, X6, X0 + SHA1MSG1 X2, X1 + + // Rounds 8-11 + VMOVDQU 32(SI), X3 + PSHUFB X7, X3 + SHA1NEXTE X3, X5 + VMOVDQA X0, X6 + SHA1RNDS4 $0x00, X5, X0 + SHA1MSG1 X3, X2 + PXOR X3, X1 + + // Rounds 12-15 + VMOVDQU 48(SI), X4 + PSHUFB X7, X4 + SHA1NEXTE X4, X6 + VMOVDQA X0, X5 + SHA1MSG2 X4, X1 + SHA1RNDS4 $0x00, X6, X0 + SHA1MSG1 X4, X3 + PXOR X4, X2 + + // Rounds 16-19 + SHA1NEXTE X1, X5 + VMOVDQA X0, X6 + SHA1MSG2 X1, X2 + SHA1RNDS4 $0x00, X5, X0 + SHA1MSG1 X1, X4 + PXOR X1, X3 + + // Rounds 20-23 + SHA1NEXTE X2, X6 + VMOVDQA X0, X5 + SHA1MSG2 X2, X3 + SHA1RNDS4 $0x01, X6, X0 + SHA1MSG1 X2, X1 + PXOR X2, X4 + + // Rounds 24-27 + SHA1NEXTE X3, X5 + VMOVDQA X0, X6 + SHA1MSG2 X3, X4 + SHA1RNDS4 $0x01, X5, X0 + SHA1MSG1 X3, X2 + PXOR X3, X1 + + // Rounds 28-31 + SHA1NEXTE X4, X6 + VMOVDQA X0, X5 + SHA1MSG2 X4, X1 + SHA1RNDS4 $0x01, X6, X0 + SHA1MSG1 X4, X3 + PXOR X4, X2 + + // Rounds 32-35 + SHA1NEXTE X1, X5 + VMOVDQA X0, X6 + SHA1MSG2 X1, X2 + SHA1RNDS4 $0x01, X5, X0 + SHA1MSG1 X1, X4 + PXOR X1, X3 + + // Rounds 36-39 + SHA1NEXTE X2, X6 + VMOVDQA X0, X5 + SHA1MSG2 X2, X3 + SHA1RNDS4 $0x01, X6, X0 + SHA1MSG1 X2, X1 + PXOR X2, X4 + + // Rounds 40-43 + SHA1NEXTE X3, X5 + VMOVDQA X0, X6 + SHA1MSG2 X3, X4 + SHA1RNDS4 $0x02, X5, X0 + SHA1MSG1 X3, X2 + PXOR X3, X1 + + // Rounds 44-47 + SHA1NEXTE X4, X6 + VMOVDQA X0, X5 + SHA1MSG2 X4, X1 + SHA1RNDS4 $0x02, X6, X0 + SHA1MSG1 X4, X3 + PXOR X4, X2 + + // Rounds 48-51 + SHA1NEXTE X1, X5 + VMOVDQA X0, X6 + SHA1MSG2 X1, X2 + SHA1RNDS4 $0x02, X5, X0 + SHA1MSG1 X1, X4 + PXOR X1, X3 + + // Rounds 52-55 + SHA1NEXTE X2, X6 + VMOVDQA X0, X5 + SHA1MSG2 X2, X3 + SHA1RNDS4 $0x02, X6, X0 + SHA1MSG1 X2, X1 + PXOR X2, X4 + + // Rounds 56-59 + SHA1NEXTE X3, X5 + VMOVDQA X0, X6 + SHA1MSG2 X3, X4 + SHA1RNDS4 $0x02, X5, X0 + SHA1MSG1 X3, X2 + PXOR X3, X1 + + // Rounds 60-63 + SHA1NEXTE X4, X6 + VMOVDQA X0, X5 + SHA1MSG2 X4, X1 + SHA1RNDS4 $0x03, X6, X0 + SHA1MSG1 X4, X3 + PXOR X4, X2 + + // Rounds 64-67 + SHA1NEXTE X1, X5 + VMOVDQA X0, X6 + SHA1MSG2 X1, X2 + SHA1RNDS4 $0x03, X5, X0 + SHA1MSG1 X1, X4 + PXOR X1, X3 + + // Rounds 68-71 + SHA1NEXTE X2, X6 + VMOVDQA X0, X5 + SHA1MSG2 X2, X3 + SHA1RNDS4 $0x03, X6, X0 + PXOR X2, X4 + + // Rounds 72-75 + SHA1NEXTE X3, X5 + VMOVDQA X0, X6 + SHA1MSG2 X3, X4 + SHA1RNDS4 $0x03, X5, X0 + + // Rounds 76-79 + SHA1NEXTE X4, X6 + VMOVDQA X0, X5 + SHA1RNDS4 $0x03, X6, X0 + + // Add saved E and ABCD + SHA1NEXTE (AX), X5 + PADDD 16(AX), X0 + + // Check if we are done, if not return to the loop + ADDQ $0x40, SI + CMPQ SI, DX + JNE loop + + // Write the hash state back to digest + PSHUFD $0x1b, X0, X0 + VMOVDQU X0, (DI) + PEXTRD $0x03, X5, 16(DI) + +done: + RET + +DATA upper_mask<>+0(SB)/8, $0x0000000000000000 +DATA upper_mask<>+8(SB)/8, $0xffffffff00000000 +GLOBL upper_mask<>(SB), RODATA, $16 + +DATA shuffle_mask<>+0(SB)/8, $0x08090a0b0c0d0e0f +DATA shuffle_mask<>+8(SB)/8, $0x0001020304050607 +GLOBL shuffle_mask<>(SB), RODATA, $16 diff --git a/go/src/crypto/sha1/sha1block_arm.s b/go/src/crypto/sha1/sha1block_arm.s new file mode 100644 index 0000000000000000000000000000000000000000..209b1d89ae349af8791b4e8c0abbc7e799116fbf --- /dev/null +++ b/go/src/crypto/sha1/sha1block_arm.s @@ -0,0 +1,219 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// +// ARM version of md5block.go + +//go:build !purego + +#include "textflag.h" + +// SHA-1 block routine. See sha1block.go for Go equivalent. +// +// There are 80 rounds of 4 types: +// - rounds 0-15 are type 1 and load data (ROUND1 macro). +// - rounds 16-19 are type 1 and do not load data (ROUND1x macro). +// - rounds 20-39 are type 2 and do not load data (ROUND2 macro). +// - rounds 40-59 are type 3 and do not load data (ROUND3 macro). +// - rounds 60-79 are type 4 and do not load data (ROUND4 macro). +// +// Each round loads or shuffles the data, then computes a per-round +// function of b, c, d, and then mixes the result into and rotates the +// five registers a, b, c, d, e holding the intermediate results. +// +// The register rotation is implemented by rotating the arguments to +// the round macros instead of by explicit move instructions. + +// Register definitions +#define Rdata R0 // Pointer to incoming data +#define Rconst R1 // Current constant for SHA round +#define Ra R2 // SHA-1 accumulator +#define Rb R3 // SHA-1 accumulator +#define Rc R4 // SHA-1 accumulator +#define Rd R5 // SHA-1 accumulator +#define Re R6 // SHA-1 accumulator +#define Rt0 R7 // Temporary +#define Rt1 R8 // Temporary +// r9, r10 are forbidden +// r11 is OK provided you check the assembler that no synthetic instructions use it +#define Rt2 R11 // Temporary +#define Rctr R12 // loop counter +#define Rw R14 // point to w buffer + +// func block(dig *digest, p []byte) +// 0(FP) is *digest +// 4(FP) is p.array (struct Slice) +// 8(FP) is p.len +//12(FP) is p.cap +// +// Stack frame +#define p_end end-4(SP) // pointer to the end of data +#define p_data data-8(SP) // current data pointer (unused?) +#define w_buf buf-(8+4*80)(SP) //80 words temporary buffer w uint32[80] +#define saved abcde-(8+4*80+4*5)(SP) // saved sha1 registers a,b,c,d,e - these must be last (unused?) +// Total size +4 for saved LR is 352 + + // w[i] = p[j]<<24 | p[j+1]<<16 | p[j+2]<<8 | p[j+3] + // e += w[i] +#define LOAD(Re) \ + MOVBU 2(Rdata), Rt0 ; \ + MOVBU 3(Rdata), Rt1 ; \ + MOVBU 1(Rdata), Rt2 ; \ + ORR Rt0<<8, Rt1, Rt0 ; \ + MOVBU.P 4(Rdata), Rt1 ; \ + ORR Rt2<<16, Rt0, Rt0 ; \ + ORR Rt1<<24, Rt0, Rt0 ; \ + MOVW.P Rt0, 4(Rw) ; \ + ADD Rt0, Re, Re + + // tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] + // w[i&0xf] = tmp<<1 | tmp>>(32-1) + // e += w[i&0xf] +#define SHUFFLE(Re) \ + MOVW (-16*4)(Rw), Rt0 ; \ + MOVW (-14*4)(Rw), Rt1 ; \ + MOVW (-8*4)(Rw), Rt2 ; \ + EOR Rt0, Rt1, Rt0 ; \ + MOVW (-3*4)(Rw), Rt1 ; \ + EOR Rt2, Rt0, Rt0 ; \ + EOR Rt0, Rt1, Rt0 ; \ + MOVW Rt0@>(32-1), Rt0 ; \ + MOVW.P Rt0, 4(Rw) ; \ + ADD Rt0, Re, Re + + // t1 = (b & c) | ((~b) & d) +#define FUNC1(Ra, Rb, Rc, Rd, Re) \ + MVN Rb, Rt1 ; \ + AND Rb, Rc, Rt0 ; \ + AND Rd, Rt1, Rt1 ; \ + ORR Rt0, Rt1, Rt1 + + // t1 = b ^ c ^ d +#define FUNC2(Ra, Rb, Rc, Rd, Re) \ + EOR Rb, Rc, Rt1 ; \ + EOR Rd, Rt1, Rt1 + + // t1 = (b & c) | (b & d) | (c & d) = + // t1 = (b & c) | ((b | c) & d) +#define FUNC3(Ra, Rb, Rc, Rd, Re) \ + ORR Rb, Rc, Rt0 ; \ + AND Rb, Rc, Rt1 ; \ + AND Rd, Rt0, Rt0 ; \ + ORR Rt0, Rt1, Rt1 + +#define FUNC4 FUNC2 + + // a5 := a<<5 | a>>(32-5) + // b = b<<30 | b>>(32-30) + // e = a5 + t1 + e + const +#define MIX(Ra, Rb, Rc, Rd, Re) \ + ADD Rt1, Re, Re ; \ + MOVW Rb@>(32-30), Rb ; \ + ADD Ra@>(32-5), Re, Re ; \ + ADD Rconst, Re, Re + +#define ROUND1(Ra, Rb, Rc, Rd, Re) \ + LOAD(Re) ; \ + FUNC1(Ra, Rb, Rc, Rd, Re) ; \ + MIX(Ra, Rb, Rc, Rd, Re) + +#define ROUND1x(Ra, Rb, Rc, Rd, Re) \ + SHUFFLE(Re) ; \ + FUNC1(Ra, Rb, Rc, Rd, Re) ; \ + MIX(Ra, Rb, Rc, Rd, Re) + +#define ROUND2(Ra, Rb, Rc, Rd, Re) \ + SHUFFLE(Re) ; \ + FUNC2(Ra, Rb, Rc, Rd, Re) ; \ + MIX(Ra, Rb, Rc, Rd, Re) + +#define ROUND3(Ra, Rb, Rc, Rd, Re) \ + SHUFFLE(Re) ; \ + FUNC3(Ra, Rb, Rc, Rd, Re) ; \ + MIX(Ra, Rb, Rc, Rd, Re) + +#define ROUND4(Ra, Rb, Rc, Rd, Re) \ + SHUFFLE(Re) ; \ + FUNC4(Ra, Rb, Rc, Rd, Re) ; \ + MIX(Ra, Rb, Rc, Rd, Re) + + +// func block(dig *digest, p []byte) +TEXT ·block(SB), 0, $352-16 + MOVW p+4(FP), Rdata // pointer to the data + MOVW p_len+8(FP), Rt0 // number of bytes + ADD Rdata, Rt0 + MOVW Rt0, p_end // pointer to end of data + + // Load up initial SHA-1 accumulator + MOVW dig+0(FP), Rt0 + MOVM.IA (Rt0), [Ra,Rb,Rc,Rd,Re] + +loop: + // Save registers at SP+4 onwards + MOVM.IB [Ra,Rb,Rc,Rd,Re], (R13) + + MOVW $w_buf, Rw + MOVW $0x5A827999, Rconst + MOVW $3, Rctr +loop1: ROUND1(Ra, Rb, Rc, Rd, Re) + ROUND1(Re, Ra, Rb, Rc, Rd) + ROUND1(Rd, Re, Ra, Rb, Rc) + ROUND1(Rc, Rd, Re, Ra, Rb) + ROUND1(Rb, Rc, Rd, Re, Ra) + SUB.S $1, Rctr + BNE loop1 + + ROUND1(Ra, Rb, Rc, Rd, Re) + ROUND1x(Re, Ra, Rb, Rc, Rd) + ROUND1x(Rd, Re, Ra, Rb, Rc) + ROUND1x(Rc, Rd, Re, Ra, Rb) + ROUND1x(Rb, Rc, Rd, Re, Ra) + + MOVW $0x6ED9EBA1, Rconst + MOVW $4, Rctr +loop2: ROUND2(Ra, Rb, Rc, Rd, Re) + ROUND2(Re, Ra, Rb, Rc, Rd) + ROUND2(Rd, Re, Ra, Rb, Rc) + ROUND2(Rc, Rd, Re, Ra, Rb) + ROUND2(Rb, Rc, Rd, Re, Ra) + SUB.S $1, Rctr + BNE loop2 + + MOVW $0x8F1BBCDC, Rconst + MOVW $4, Rctr +loop3: ROUND3(Ra, Rb, Rc, Rd, Re) + ROUND3(Re, Ra, Rb, Rc, Rd) + ROUND3(Rd, Re, Ra, Rb, Rc) + ROUND3(Rc, Rd, Re, Ra, Rb) + ROUND3(Rb, Rc, Rd, Re, Ra) + SUB.S $1, Rctr + BNE loop3 + + MOVW $0xCA62C1D6, Rconst + MOVW $4, Rctr +loop4: ROUND4(Ra, Rb, Rc, Rd, Re) + ROUND4(Re, Ra, Rb, Rc, Rd) + ROUND4(Rd, Re, Ra, Rb, Rc) + ROUND4(Rc, Rd, Re, Ra, Rb) + ROUND4(Rb, Rc, Rd, Re, Ra) + SUB.S $1, Rctr + BNE loop4 + + // Accumulate - restoring registers from SP+4 + MOVM.IB (R13), [Rt0,Rt1,Rt2,Rctr,Rw] + ADD Rt0, Ra + ADD Rt1, Rb + ADD Rt2, Rc + ADD Rctr, Rd + ADD Rw, Re + + MOVW p_end, Rt0 + CMP Rt0, Rdata + BLO loop + + // Save final SHA-1 accumulator + MOVW dig+0(FP), Rt0 + MOVM.IA [Ra,Rb,Rc,Rd,Re], (Rt0) + + RET diff --git a/go/src/crypto/sha1/sha1block_arm64.go b/go/src/crypto/sha1/sha1block_arm64.go new file mode 100644 index 0000000000000000000000000000000000000000..b972a1e62e8017a90a24a22faeaace597ef54314 --- /dev/null +++ b/go/src/crypto/sha1/sha1block_arm64.go @@ -0,0 +1,37 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !purego + +package sha1 + +import ( + "crypto/internal/impl" + "internal/cpu" +) + +var useSHA1 = cpu.ARM64.HasSHA1 + +func init() { + impl.Register("sha1", "Armv8.0", &useSHA1) +} + +var k = []uint32{ + 0x5A827999, + 0x6ED9EBA1, + 0x8F1BBCDC, + 0xCA62C1D6, +} + +//go:noescape +func sha1block(h []uint32, p []byte, k []uint32) + +func block(dig *digest, p []byte) { + if useSHA1 { + h := dig.h[:] + sha1block(h, p, k) + } else { + blockGeneric(dig, p) + } +} diff --git a/go/src/crypto/sha1/sha1block_arm64.s b/go/src/crypto/sha1/sha1block_arm64.s new file mode 100644 index 0000000000000000000000000000000000000000..d0ff0986b8b5abc97903aa737943b62fb3eb9df6 --- /dev/null +++ b/go/src/crypto/sha1/sha1block_arm64.s @@ -0,0 +1,154 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !purego + +#include "textflag.h" + +#define HASHUPDATECHOOSE \ + SHA1C V16.S4, V1, V2 \ + SHA1H V3, V1 \ + VMOV V2.B16, V3.B16 + +#define HASHUPDATEPARITY \ + SHA1P V16.S4, V1, V2 \ + SHA1H V3, V1 \ + VMOV V2.B16, V3.B16 + +#define HASHUPDATEMAJ \ + SHA1M V16.S4, V1, V2 \ + SHA1H V3, V1 \ + VMOV V2.B16, V3.B16 + +// func sha1block(h []uint32, p []byte, k []uint32) +TEXT ·sha1block(SB),NOSPLIT,$0 + MOVD h_base+0(FP), R0 // hash value first address + MOVD p_base+24(FP), R1 // message first address + MOVD k_base+48(FP), R2 // k constants first address + MOVD p_len+32(FP), R3 // message length + VLD1.P 16(R0), [V0.S4] + FMOVS (R0), F20 + SUB $16, R0, R0 + +blockloop: + + VLD1.P 16(R1), [V4.B16] // load message + VLD1.P 16(R1), [V5.B16] + VLD1.P 16(R1), [V6.B16] + VLD1.P 16(R1), [V7.B16] + VLD1 (R2), [V19.S4] // load constant k0-k79 + VMOV V0.B16, V2.B16 + VMOV V20.S[0], V1 + VMOV V2.B16, V3.B16 + VDUP V19.S[0], V17.S4 + VREV32 V4.B16, V4.B16 // prepare for using message in Byte format + VREV32 V5.B16, V5.B16 + VREV32 V6.B16, V6.B16 + VREV32 V7.B16, V7.B16 + + + VDUP V19.S[1], V18.S4 + VADD V17.S4, V4.S4, V16.S4 + SHA1SU0 V6.S4, V5.S4, V4.S4 + HASHUPDATECHOOSE + SHA1SU1 V7.S4, V4.S4 + + VADD V17.S4, V5.S4, V16.S4 + SHA1SU0 V7.S4, V6.S4, V5.S4 + HASHUPDATECHOOSE + SHA1SU1 V4.S4, V5.S4 + VADD V17.S4, V6.S4, V16.S4 + SHA1SU0 V4.S4, V7.S4, V6.S4 + HASHUPDATECHOOSE + SHA1SU1 V5.S4, V6.S4 + + VADD V17.S4, V7.S4, V16.S4 + SHA1SU0 V5.S4, V4.S4, V7.S4 + HASHUPDATECHOOSE + SHA1SU1 V6.S4, V7.S4 + + VADD V17.S4, V4.S4, V16.S4 + SHA1SU0 V6.S4, V5.S4, V4.S4 + HASHUPDATECHOOSE + SHA1SU1 V7.S4, V4.S4 + + VDUP V19.S[2], V17.S4 + VADD V18.S4, V5.S4, V16.S4 + SHA1SU0 V7.S4, V6.S4, V5.S4 + HASHUPDATEPARITY + SHA1SU1 V4.S4, V5.S4 + + VADD V18.S4, V6.S4, V16.S4 + SHA1SU0 V4.S4, V7.S4, V6.S4 + HASHUPDATEPARITY + SHA1SU1 V5.S4, V6.S4 + + VADD V18.S4, V7.S4, V16.S4 + SHA1SU0 V5.S4, V4.S4, V7.S4 + HASHUPDATEPARITY + SHA1SU1 V6.S4, V7.S4 + + VADD V18.S4, V4.S4, V16.S4 + SHA1SU0 V6.S4, V5.S4, V4.S4 + HASHUPDATEPARITY + SHA1SU1 V7.S4, V4.S4 + + VADD V18.S4, V5.S4, V16.S4 + SHA1SU0 V7.S4, V6.S4, V5.S4 + HASHUPDATEPARITY + SHA1SU1 V4.S4, V5.S4 + + VDUP V19.S[3], V18.S4 + VADD V17.S4, V6.S4, V16.S4 + SHA1SU0 V4.S4, V7.S4, V6.S4 + HASHUPDATEMAJ + SHA1SU1 V5.S4, V6.S4 + + VADD V17.S4, V7.S4, V16.S4 + SHA1SU0 V5.S4, V4.S4, V7.S4 + HASHUPDATEMAJ + SHA1SU1 V6.S4, V7.S4 + + VADD V17.S4, V4.S4, V16.S4 + SHA1SU0 V6.S4, V5.S4, V4.S4 + HASHUPDATEMAJ + SHA1SU1 V7.S4, V4.S4 + + VADD V17.S4, V5.S4, V16.S4 + SHA1SU0 V7.S4, V6.S4, V5.S4 + HASHUPDATEMAJ + SHA1SU1 V4.S4, V5.S4 + + VADD V17.S4, V6.S4, V16.S4 + SHA1SU0 V4.S4, V7.S4, V6.S4 + HASHUPDATEMAJ + SHA1SU1 V5.S4, V6.S4 + + VADD V18.S4, V7.S4, V16.S4 + SHA1SU0 V5.S4, V4.S4, V7.S4 + HASHUPDATEPARITY + SHA1SU1 V6.S4, V7.S4 + + VADD V18.S4, V4.S4, V16.S4 + HASHUPDATEPARITY + + VADD V18.S4, V5.S4, V16.S4 + HASHUPDATEPARITY + + VADD V18.S4, V6.S4, V16.S4 + HASHUPDATEPARITY + + VADD V18.S4, V7.S4, V16.S4 + HASHUPDATEPARITY + + SUB $64, R3, R3 // message length - 64bytes, then compare with 64bytes + VADD V2.S4, V0.S4, V0.S4 + VADD V1.S4, V20.S4, V20.S4 + CBNZ R3, blockloop + +sha1ret: + + VST1.P [V0.S4], 16(R0) // store hash value H(dcba) + FMOVS F20, (R0) // store hash value H(e) + RET diff --git a/go/src/crypto/sha1/sha1block_decl.go b/go/src/crypto/sha1/sha1block_decl.go new file mode 100644 index 0000000000000000000000000000000000000000..887d8cad01f4eea12276e2a4b92227456dc59332 --- /dev/null +++ b/go/src/crypto/sha1/sha1block_decl.go @@ -0,0 +1,10 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build (386 || arm || loong64) && !purego + +package sha1 + +//go:noescape +func block(dig *digest, p []byte) diff --git a/go/src/crypto/sha1/sha1block_generic.go b/go/src/crypto/sha1/sha1block_generic.go new file mode 100644 index 0000000000000000000000000000000000000000..5989a2434760b53fa3e9cc478f5adbc19ef4a5d4 --- /dev/null +++ b/go/src/crypto/sha1/sha1block_generic.go @@ -0,0 +1,11 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build (!386 && !amd64 && !arm && !arm64 && !loong64 && !s390x) || purego + +package sha1 + +func block(dig *digest, p []byte) { + blockGeneric(dig, p) +} diff --git a/go/src/crypto/sha1/sha1block_loong64.s b/go/src/crypto/sha1/sha1block_loong64.s new file mode 100644 index 0000000000000000000000000000000000000000..b76b193ad0e3e5a3c2b00369e16143a01b471060 --- /dev/null +++ b/go/src/crypto/sha1/sha1block_loong64.s @@ -0,0 +1,226 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !purego + +#include "textflag.h" + +// SHA-1 block routine. See sha1block.go for Go equivalent. +// +// There are 80 rounds of 4 types: +// - rounds 0-15 are type 1 and load data (ROUND1 macro). +// - rounds 16-19 are type 1 and do not load data (ROUND1x macro). +// - rounds 20-39 are type 2 and do not load data (ROUND2 macro). +// - rounds 40-59 are type 3 and do not load data (ROUND3 macro). +// - rounds 60-79 are type 4 and do not load data (ROUND4 macro). +// +// Each round loads or shuffles the data, then computes a per-round +// function of b, c, d, and then mixes the result into and rotates the +// five registers a, b, c, d, e holding the intermediate results. +// +// The register rotation is implemented by rotating the arguments to +// the round macros instead of by explicit move instructions. + +#define REGTMP R30 +#define REGTMP1 R17 +#define REGTMP2 R18 +#define REGTMP3 R19 + +#define LOAD1(index) \ + MOVW (index*4)(R5), REGTMP3; \ + REVB2W REGTMP3, REGTMP3; \ + MOVW REGTMP3, (index*4)(R3) + +#define LOAD(index) \ + MOVW (((index)&0xf)*4)(R3), REGTMP3; \ + MOVW (((index-3)&0xf)*4)(R3), REGTMP; \ + MOVW (((index-8)&0xf)*4)(R3), REGTMP1; \ + MOVW (((index-14)&0xf)*4)(R3), REGTMP2; \ + XOR REGTMP, REGTMP3; \ + XOR REGTMP1, REGTMP3; \ + XOR REGTMP2, REGTMP3; \ + ROTR $31, REGTMP3; \ + MOVW REGTMP3, (((index)&0xf)*4)(R3) + +// f = d ^ (b & (c ^ d)) +#define FUNC1(a, b, c, d, e) \ + XOR c, d, REGTMP1; \ + AND b, REGTMP1; \ + XOR d, REGTMP1 + +// f = b ^ c ^ d +#define FUNC2(a, b, c, d, e) \ + XOR b, c, REGTMP1; \ + XOR d, REGTMP1 + +// f = (b & c) | ((b | c) & d) +#define FUNC3(a, b, c, d, e) \ + OR b, c, REGTMP2; \ + AND b, c, REGTMP; \ + AND d, REGTMP2; \ + OR REGTMP, REGTMP2, REGTMP1 + +#define FUNC4 FUNC2 + +#define MIX(a, b, c, d, e, const) \ + ROTR $2, b; \ // b << 30 + ADD REGTMP1, e; \ // e = e + f + ROTR $27, a, REGTMP2; \ // a << 5 + ADD REGTMP3, e; \ // e = e + w[i] + ADDV $const, e; \ // e = e + k + ADD REGTMP2, e // e = e + a<<5 + +#define ROUND1(a, b, c, d, e, index) \ + LOAD1(index); \ + FUNC1(a, b, c, d, e); \ + MIX(a, b, c, d, e, 0x5A827999) + +#define ROUND1x(a, b, c, d, e, index) \ + LOAD(index); \ + FUNC1(a, b, c, d, e); \ + MIX(a, b, c, d, e, 0x5A827999) + +#define ROUND2(a, b, c, d, e, index) \ + LOAD(index); \ + FUNC2(a, b, c, d, e); \ + MIX(a, b, c, d, e, 0x6ED9EBA1) + +#define ROUND3(a, b, c, d, e, index) \ + LOAD(index); \ + FUNC3(a, b, c, d, e); \ + MIX(a, b, c, d, e, 0x8F1BBCDC) + +#define ROUND4(a, b, c, d, e, index) \ + LOAD(index); \ + FUNC4(a, b, c, d, e); \ + MIX(a, b, c, d, e, 0xCA62C1D6) + +// A stack frame size of 64 bytes is required here, because +// the frame size used for data expansion is 64 bytes. +// See the definition of the macro LOAD above, and the definition +// of the local variable w in the general implementation (sha1block.go). +TEXT ·block(SB),NOSPLIT,$64-32 + MOVV dig+0(FP), R4 + MOVV p_base+8(FP), R5 + MOVV p_len+16(FP), R6 + AND $~63, R6 + BEQ R6, zero + + // p_len >= 64 + ADDV R5, R6, R24 + MOVW (0*4)(R4), R7 + MOVW (1*4)(R4), R8 + MOVW (2*4)(R4), R9 + MOVW (3*4)(R4), R10 + MOVW (4*4)(R4), R11 + +loop: + MOVW R7, R12 + MOVW R8, R13 + MOVW R9, R14 + MOVW R10, R15 + MOVW R11, R16 + + ROUND1(R7, R8, R9, R10, R11, 0) + ROUND1(R11, R7, R8, R9, R10, 1) + ROUND1(R10, R11, R7, R8, R9, 2) + ROUND1(R9, R10, R11, R7, R8, 3) + ROUND1(R8, R9, R10, R11, R7, 4) + ROUND1(R7, R8, R9, R10, R11, 5) + ROUND1(R11, R7, R8, R9, R10, 6) + ROUND1(R10, R11, R7, R8, R9, 7) + ROUND1(R9, R10, R11, R7, R8, 8) + ROUND1(R8, R9, R10, R11, R7, 9) + ROUND1(R7, R8, R9, R10, R11, 10) + ROUND1(R11, R7, R8, R9, R10, 11) + ROUND1(R10, R11, R7, R8, R9, 12) + ROUND1(R9, R10, R11, R7, R8, 13) + ROUND1(R8, R9, R10, R11, R7, 14) + ROUND1(R7, R8, R9, R10, R11, 15) + + ROUND1x(R11, R7, R8, R9, R10, 16) + ROUND1x(R10, R11, R7, R8, R9, 17) + ROUND1x(R9, R10, R11, R7, R8, 18) + ROUND1x(R8, R9, R10, R11, R7, 19) + + ROUND2(R7, R8, R9, R10, R11, 20) + ROUND2(R11, R7, R8, R9, R10, 21) + ROUND2(R10, R11, R7, R8, R9, 22) + ROUND2(R9, R10, R11, R7, R8, 23) + ROUND2(R8, R9, R10, R11, R7, 24) + ROUND2(R7, R8, R9, R10, R11, 25) + ROUND2(R11, R7, R8, R9, R10, 26) + ROUND2(R10, R11, R7, R8, R9, 27) + ROUND2(R9, R10, R11, R7, R8, 28) + ROUND2(R8, R9, R10, R11, R7, 29) + ROUND2(R7, R8, R9, R10, R11, 30) + ROUND2(R11, R7, R8, R9, R10, 31) + ROUND2(R10, R11, R7, R8, R9, 32) + ROUND2(R9, R10, R11, R7, R8, 33) + ROUND2(R8, R9, R10, R11, R7, 34) + ROUND2(R7, R8, R9, R10, R11, 35) + ROUND2(R11, R7, R8, R9, R10, 36) + ROUND2(R10, R11, R7, R8, R9, 37) + ROUND2(R9, R10, R11, R7, R8, 38) + ROUND2(R8, R9, R10, R11, R7, 39) + + ROUND3(R7, R8, R9, R10, R11, 40) + ROUND3(R11, R7, R8, R9, R10, 41) + ROUND3(R10, R11, R7, R8, R9, 42) + ROUND3(R9, R10, R11, R7, R8, 43) + ROUND3(R8, R9, R10, R11, R7, 44) + ROUND3(R7, R8, R9, R10, R11, 45) + ROUND3(R11, R7, R8, R9, R10, 46) + ROUND3(R10, R11, R7, R8, R9, 47) + ROUND3(R9, R10, R11, R7, R8, 48) + ROUND3(R8, R9, R10, R11, R7, 49) + ROUND3(R7, R8, R9, R10, R11, 50) + ROUND3(R11, R7, R8, R9, R10, 51) + ROUND3(R10, R11, R7, R8, R9, 52) + ROUND3(R9, R10, R11, R7, R8, 53) + ROUND3(R8, R9, R10, R11, R7, 54) + ROUND3(R7, R8, R9, R10, R11, 55) + ROUND3(R11, R7, R8, R9, R10, 56) + ROUND3(R10, R11, R7, R8, R9, 57) + ROUND3(R9, R10, R11, R7, R8, 58) + ROUND3(R8, R9, R10, R11, R7, 59) + + ROUND4(R7, R8, R9, R10, R11, 60) + ROUND4(R11, R7, R8, R9, R10, 61) + ROUND4(R10, R11, R7, R8, R9, 62) + ROUND4(R9, R10, R11, R7, R8, 63) + ROUND4(R8, R9, R10, R11, R7, 64) + ROUND4(R7, R8, R9, R10, R11, 65) + ROUND4(R11, R7, R8, R9, R10, 66) + ROUND4(R10, R11, R7, R8, R9, 67) + ROUND4(R9, R10, R11, R7, R8, 68) + ROUND4(R8, R9, R10, R11, R7, 69) + ROUND4(R7, R8, R9, R10, R11, 70) + ROUND4(R11, R7, R8, R9, R10, 71) + ROUND4(R10, R11, R7, R8, R9, 72) + ROUND4(R9, R10, R11, R7, R8, 73) + ROUND4(R8, R9, R10, R11, R7, 74) + ROUND4(R7, R8, R9, R10, R11, 75) + ROUND4(R11, R7, R8, R9, R10, 76) + ROUND4(R10, R11, R7, R8, R9, 77) + ROUND4(R9, R10, R11, R7, R8, 78) + ROUND4(R8, R9, R10, R11, R7, 79) + + ADD R12, R7 + ADD R13, R8 + ADD R14, R9 + ADD R15, R10 + ADD R16, R11 + + ADDV $64, R5 + BNE R5, R24, loop + +end: + MOVW R7, (0*4)(R4) + MOVW R8, (1*4)(R4) + MOVW R9, (2*4)(R4) + MOVW R10, (3*4)(R4) + MOVW R11, (4*4)(R4) +zero: + RET diff --git a/go/src/crypto/sha1/sha1block_s390x.go b/go/src/crypto/sha1/sha1block_s390x.go new file mode 100644 index 0000000000000000000000000000000000000000..104220c8bdef5af27299731ab316139df603c465 --- /dev/null +++ b/go/src/crypto/sha1/sha1block_s390x.go @@ -0,0 +1,31 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !purego + +package sha1 + +import ( + "crypto/internal/impl" + "internal/cpu" +) + +var useSHA1 = cpu.S390X.HasSHA1 + +func init() { + // CP Assist for Cryptographic Functions (CPACF) + // https://www.ibm.com/docs/en/zos/3.1.0?topic=icsf-cp-assist-cryptographic-functions-cpacf + impl.Register("sha1", "CPACF", &useSHA1) +} + +//go:noescape +func blockS390X(dig *digest, p []byte) + +func block(dig *digest, p []byte) { + if useSHA1 { + blockS390X(dig, p) + } else { + blockGeneric(dig, p) + } +} diff --git a/go/src/crypto/sha1/sha1block_s390x.s b/go/src/crypto/sha1/sha1block_s390x.s new file mode 100644 index 0000000000000000000000000000000000000000..3ddc9b586a00c61d54551ce42dece25ce60eed9f --- /dev/null +++ b/go/src/crypto/sha1/sha1block_s390x.s @@ -0,0 +1,17 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !purego + +#include "textflag.h" + +// func blockS390X(dig *digest, p []byte) +TEXT ·blockS390X(SB), NOSPLIT|NOFRAME, $0-32 + LMG dig+0(FP), R1, R3 // R2 = &p[0], R3 = len(p) + MOVBZ $1, R0 // SHA-1 function code + +loop: + KIMD R0, R2 // compute intermediate message digest (KIMD) + BVS loop // continue if interrupted + RET diff --git a/go/src/crypto/sha256/example_test.go b/go/src/crypto/sha256/example_test.go new file mode 100644 index 0000000000000000000000000000000000000000..7d73120155cab815bf542fefebb48e57b0300387 --- /dev/null +++ b/go/src/crypto/sha256/example_test.go @@ -0,0 +1,41 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sha256_test + +import ( + "crypto/sha256" + "fmt" + "io" + "log" + "os" +) + +func ExampleSum256() { + sum := sha256.Sum256([]byte("hello world\n")) + fmt.Printf("%x", sum) + // Output: a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447 +} + +func ExampleNew() { + h := sha256.New() + h.Write([]byte("hello world\n")) + fmt.Printf("%x", h.Sum(nil)) + // Output: a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447 +} + +func ExampleNew_file() { + f, err := os.Open("file.txt") + if err != nil { + log.Fatal(err) + } + defer f.Close() + + h := sha256.New() + if _, err := io.Copy(h, f); err != nil { + log.Fatal(err) + } + + fmt.Printf("%x", h.Sum(nil)) +} diff --git a/go/src/crypto/sha256/sha256.go b/go/src/crypto/sha256/sha256.go new file mode 100644 index 0000000000000000000000000000000000000000..069938a22dbc5a12270e281c81bd151ab00f9b5f --- /dev/null +++ b/go/src/crypto/sha256/sha256.go @@ -0,0 +1,74 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package sha256 implements the SHA224 and SHA256 hash algorithms as defined +// in FIPS 180-4. +package sha256 + +import ( + "crypto" + "crypto/internal/boring" + "crypto/internal/fips140/sha256" + "hash" +) + +func init() { + crypto.RegisterHash(crypto.SHA224, New224) + crypto.RegisterHash(crypto.SHA256, New) +} + +// The size of a SHA256 checksum in bytes. +const Size = 32 + +// The size of a SHA224 checksum in bytes. +const Size224 = 28 + +// The blocksize of SHA256 and SHA224 in bytes. +const BlockSize = 64 + +// New returns a new [hash.Hash] computing the SHA256 checksum. The Hash +// also implements [encoding.BinaryMarshaler], [encoding.BinaryAppender] and +// [encoding.BinaryUnmarshaler] to marshal and unmarshal the internal +// state of the hash. +func New() hash.Hash { + if boring.Enabled { + return boring.NewSHA256() + } + return sha256.New() +} + +// New224 returns a new [hash.Hash] computing the SHA224 checksum. The Hash +// also implements [encoding.BinaryMarshaler], [encoding.BinaryAppender] and +// [encoding.BinaryUnmarshaler] to marshal and unmarshal the internal +// state of the hash. +func New224() hash.Hash { + if boring.Enabled { + return boring.NewSHA224() + } + return sha256.New224() +} + +// Sum256 returns the SHA256 checksum of the data. +func Sum256(data []byte) [Size]byte { + if boring.Enabled { + return boring.SHA256(data) + } + h := New() + h.Write(data) + var sum [Size]byte + h.Sum(sum[:0]) + return sum +} + +// Sum224 returns the SHA224 checksum of the data. +func Sum224(data []byte) [Size224]byte { + if boring.Enabled { + return boring.SHA224(data) + } + h := New224() + h.Write(data) + var sum [Size224]byte + h.Sum(sum[:0]) + return sum +} diff --git a/go/src/crypto/sha256/sha256_test.go b/go/src/crypto/sha256/sha256_test.go new file mode 100644 index 0000000000000000000000000000000000000000..a18a536ba2896f8d58d715f0d81473bbd969c1e4 --- /dev/null +++ b/go/src/crypto/sha256/sha256_test.go @@ -0,0 +1,487 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// SHA256 hash algorithm. See FIPS 180-2. + +package sha256 + +import ( + "bytes" + "crypto/internal/cryptotest" + "encoding" + "fmt" + "hash" + "io" + "testing" +) + +type sha256Test struct { + out string + in string + halfState string // marshaled hash state after first half of in written, used by TestGoldenMarshal +} + +var golden = []sha256Test{ + {"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "", "sha\x03j\t\xe6g\xbbg\xae\x85 0 { + t.Errorf("allocs = %v, want 0", n) + } +} + +type cgoData struct { + Data [16]byte + Ptr *cgoData +} + +func TestCgo(t *testing.T) { + // Test that Write does not cause cgo to scan the entire cgoData struct for pointers. + // The scan (if any) should be limited to the [16]byte. + d := new(cgoData) + d.Ptr = d + _ = d.Ptr // for unusedwrite check + h := New() + h.Write(d.Data[:]) + h.Sum(nil) +} + +func TestHash(t *testing.T) { + t.Run("SHA-224", func(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha256", func(t *testing.T) { + cryptotest.TestHash(t, New224) + }) + }) + t.Run("SHA-256", func(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha256", func(t *testing.T) { + cryptotest.TestHash(t, New) + }) + }) +} + +func TestExtraMethods(t *testing.T) { + t.Run("SHA-224", func(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha256", func(t *testing.T) { + h := maybeCloner(New224()) + cryptotest.NoExtraMethods(t, h, "MarshalBinary", "UnmarshalBinary", "AppendBinary") + }) + }) + t.Run("SHA-256", func(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha256", func(t *testing.T) { + h := maybeCloner(New()) + cryptotest.NoExtraMethods(t, h, "MarshalBinary", "UnmarshalBinary", "AppendBinary") + }) + }) +} + +func maybeCloner(h hash.Hash) any { + if c, ok := h.(hash.Cloner); ok { + return &c + } + return &h +} + +var bench = New() + +func benchmarkSize(b *testing.B, size int) { + buf := make([]byte, size) + sum := make([]byte, bench.Size()) + b.Run("New", func(b *testing.B) { + b.ReportAllocs() + b.SetBytes(int64(size)) + for i := 0; i < b.N; i++ { + bench.Reset() + bench.Write(buf) + bench.Sum(sum[:0]) + } + }) + b.Run("Sum224", func(b *testing.B) { + b.ReportAllocs() + b.SetBytes(int64(size)) + for i := 0; i < b.N; i++ { + Sum224(buf) + } + }) + b.Run("Sum256", func(b *testing.B) { + b.ReportAllocs() + b.SetBytes(int64(size)) + for i := 0; i < b.N; i++ { + Sum256(buf) + } + }) +} + +func BenchmarkHash8Bytes(b *testing.B) { + benchmarkSize(b, 8) +} + +func BenchmarkHash1K(b *testing.B) { + benchmarkSize(b, 1024) +} + +func BenchmarkHash8K(b *testing.B) { + benchmarkSize(b, 8192) +} + +func BenchmarkHash256K(b *testing.B) { + benchmarkSize(b, 256*1024) +} + +func BenchmarkHash1M(b *testing.B) { + benchmarkSize(b, 1024*1024) +} + +func TestAllocatonsWithTypeAsserts(t *testing.T) { + cryptotest.SkipTestAllocations(t) + allocs := testing.AllocsPerRun(100, func() { + h := New() + h.Write([]byte{1, 2, 3}) + marshaled, _ := h.(encoding.BinaryMarshaler).MarshalBinary() + marshaled, _ = h.(encoding.BinaryAppender).AppendBinary(marshaled[:0]) + h.(encoding.BinaryUnmarshaler).UnmarshalBinary(marshaled) + }) + if allocs != 0 { + t.Fatalf("allocs = %v; want = 0", allocs) + } +} diff --git a/go/src/crypto/sha3/sha3.go b/go/src/crypto/sha3/sha3.go new file mode 100644 index 0000000000000000000000000000000000000000..48c67e9fe11005957038fdcc8181bb6e0ef94c0b --- /dev/null +++ b/go/src/crypto/sha3/sha3.go @@ -0,0 +1,274 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package sha3 implements the SHA-3 hash algorithms and the SHAKE extendable +// output functions defined in FIPS 202. +package sha3 + +import ( + "crypto" + "crypto/internal/fips140/sha3" + "hash" + _ "unsafe" +) + +func init() { + crypto.RegisterHash(crypto.SHA3_224, func() hash.Hash { return New224() }) + crypto.RegisterHash(crypto.SHA3_256, func() hash.Hash { return New256() }) + crypto.RegisterHash(crypto.SHA3_384, func() hash.Hash { return New384() }) + crypto.RegisterHash(crypto.SHA3_512, func() hash.Hash { return New512() }) +} + +// Sum224 returns the SHA3-224 hash of data. +func Sum224(data []byte) [28]byte { + var out [28]byte + h := sha3.New224() + h.Write(data) + h.Sum(out[:0]) + return out +} + +// Sum256 returns the SHA3-256 hash of data. +func Sum256(data []byte) [32]byte { + var out [32]byte + h := sha3.New256() + h.Write(data) + h.Sum(out[:0]) + return out +} + +// Sum384 returns the SHA3-384 hash of data. +func Sum384(data []byte) [48]byte { + var out [48]byte + h := sha3.New384() + h.Write(data) + h.Sum(out[:0]) + return out +} + +// Sum512 returns the SHA3-512 hash of data. +func Sum512(data []byte) [64]byte { + var out [64]byte + h := sha3.New512() + h.Write(data) + h.Sum(out[:0]) + return out +} + +// SumSHAKE128 applies the SHAKE128 extendable output function to data and +// returns an output of the given length in bytes. +func SumSHAKE128(data []byte, length int) []byte { + // Outline the allocation for up to 256 bits of output to the caller's stack. + out := make([]byte, 32) + return sumSHAKE128(out, data, length) +} + +func sumSHAKE128(out, data []byte, length int) []byte { + if len(out) < length { + out = make([]byte, length) + } else { + out = out[:length] + } + h := sha3.NewShake128() + h.Write(data) + h.Read(out) + return out +} + +// SumSHAKE256 applies the SHAKE256 extendable output function to data and +// returns an output of the given length in bytes. +func SumSHAKE256(data []byte, length int) []byte { + // Outline the allocation for up to 512 bits of output to the caller's stack. + out := make([]byte, 64) + return sumSHAKE256(out, data, length) +} + +func sumSHAKE256(out, data []byte, length int) []byte { + if len(out) < length { + out = make([]byte, length) + } else { + out = out[:length] + } + h := sha3.NewShake256() + h.Write(data) + h.Read(out) + return out +} + +// SHA3 is an instance of a SHA-3 hash. It implements [hash.Hash]. +// The zero value is a usable SHA3-256 hash. +type SHA3 struct { + s sha3.Digest +} + +//go:linkname fips140hash_sha3Unwrap crypto/internal/fips140hash.sha3Unwrap +func fips140hash_sha3Unwrap(sha3 *SHA3) *sha3.Digest { + return &sha3.s +} + +// New224 creates a new SHA3-224 hash. +func New224() *SHA3 { + return &SHA3{*sha3.New224()} +} + +// New256 creates a new SHA3-256 hash. +func New256() *SHA3 { + return &SHA3{*sha3.New256()} +} + +// New384 creates a new SHA3-384 hash. +func New384() *SHA3 { + return &SHA3{*sha3.New384()} +} + +// New512 creates a new SHA3-512 hash. +func New512() *SHA3 { + return &SHA3{*sha3.New512()} +} + +func (s *SHA3) init() { + if s.s.Size() == 0 { + *s = *New256() + } +} + +// Write absorbs more data into the hash's state. +func (s *SHA3) Write(p []byte) (n int, err error) { + s.init() + return s.s.Write(p) +} + +// Sum appends the current hash to b and returns the resulting slice. +func (s *SHA3) Sum(b []byte) []byte { + s.init() + return s.s.Sum(b) +} + +// Reset resets the hash to its initial state. +func (s *SHA3) Reset() { + s.init() + s.s.Reset() +} + +// Size returns the number of bytes Sum will produce. +func (s *SHA3) Size() int { + s.init() + return s.s.Size() +} + +// BlockSize returns the hash's rate. +func (s *SHA3) BlockSize() int { + s.init() + return s.s.BlockSize() +} + +// MarshalBinary implements [encoding.BinaryMarshaler]. +func (s *SHA3) MarshalBinary() ([]byte, error) { + s.init() + return s.s.MarshalBinary() +} + +// AppendBinary implements [encoding.BinaryAppender]. +func (s *SHA3) AppendBinary(p []byte) ([]byte, error) { + s.init() + return s.s.AppendBinary(p) +} + +// UnmarshalBinary implements [encoding.BinaryUnmarshaler]. +func (s *SHA3) UnmarshalBinary(data []byte) error { + s.init() + return s.s.UnmarshalBinary(data) +} + +// Clone implements [hash.Cloner]. +func (d *SHA3) Clone() (hash.Cloner, error) { + r := *d + return &r, nil +} + +// SHAKE is an instance of a SHAKE extendable output function. +// The zero value is a usable SHAKE256 hash. +type SHAKE struct { + s sha3.SHAKE +} + +func (s *SHAKE) init() { + if s.s.Size() == 0 { + *s = *NewSHAKE256() + } +} + +// NewSHAKE128 creates a new SHAKE128 XOF. +func NewSHAKE128() *SHAKE { + return &SHAKE{*sha3.NewShake128()} +} + +// NewSHAKE256 creates a new SHAKE256 XOF. +func NewSHAKE256() *SHAKE { + return &SHAKE{*sha3.NewShake256()} +} + +// NewCSHAKE128 creates a new cSHAKE128 XOF. +// +// N is used to define functions based on cSHAKE, it can be empty when plain +// cSHAKE is desired. S is a customization byte string used for domain +// separation. When N and S are both empty, this is equivalent to NewSHAKE128. +func NewCSHAKE128(N, S []byte) *SHAKE { + return &SHAKE{*sha3.NewCShake128(N, S)} +} + +// NewCSHAKE256 creates a new cSHAKE256 XOF. +// +// N is used to define functions based on cSHAKE, it can be empty when plain +// cSHAKE is desired. S is a customization byte string used for domain +// separation. When N and S are both empty, this is equivalent to NewSHAKE256. +func NewCSHAKE256(N, S []byte) *SHAKE { + return &SHAKE{*sha3.NewCShake256(N, S)} +} + +// Write absorbs more data into the XOF's state. +// +// It panics if any output has already been read. +func (s *SHAKE) Write(p []byte) (n int, err error) { + s.init() + return s.s.Write(p) +} + +// Read squeezes more output from the XOF. +// +// Any call to Write after a call to Read will panic. +func (s *SHAKE) Read(p []byte) (n int, err error) { + s.init() + return s.s.Read(p) +} + +// Reset resets the XOF to its initial state. +func (s *SHAKE) Reset() { + s.init() + s.s.Reset() +} + +// BlockSize returns the rate of the XOF. +func (s *SHAKE) BlockSize() int { + s.init() + return s.s.BlockSize() +} + +// MarshalBinary implements [encoding.BinaryMarshaler]. +func (s *SHAKE) MarshalBinary() ([]byte, error) { + s.init() + return s.s.MarshalBinary() +} + +// AppendBinary implements [encoding.BinaryAppender]. +func (s *SHAKE) AppendBinary(p []byte) ([]byte, error) { + s.init() + return s.s.AppendBinary(p) +} + +// UnmarshalBinary implements [encoding.BinaryUnmarshaler]. +func (s *SHAKE) UnmarshalBinary(data []byte) error { + s.init() + return s.s.UnmarshalBinary(data) +} diff --git a/go/src/crypto/sha3/sha3_test.go b/go/src/crypto/sha3/sha3_test.go new file mode 100644 index 0000000000000000000000000000000000000000..3973e0afd1b935e0ab2f5b631f44a43cb7cd68b9 --- /dev/null +++ b/go/src/crypto/sha3/sha3_test.go @@ -0,0 +1,504 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sha3_test + +import ( + "bytes" + "crypto/internal/cryptotest" + . "crypto/sha3" + "encoding/hex" + "hash" + "io" + "math/rand" + "strings" + "testing" +) + +const testString = "brekeccakkeccak koax koax" + +// testDigests contains functions returning hash.Hash instances +// with output-length equal to the KAT length for SHA-3, Keccak +// and SHAKE instances. +var testDigests = map[string]func() *SHA3{ + "SHA3-224": New224, + "SHA3-256": New256, + "SHA3-384": New384, + "SHA3-512": New512, + "SHA3-Zero": func() *SHA3 { return &SHA3{} }, +} + +// testShakes contains functions that return *sha3.SHAKE instances for +// with output-length equal to the KAT length. +var testShakes = map[string]struct { + constructor func(N []byte, S []byte) *SHAKE + defAlgoName string + defCustomStr string +}{ + // NewCSHAKE without customization produces same result as SHAKE + "SHAKE128": {NewCSHAKE128, "", ""}, + "SHAKE256": {NewCSHAKE256, "", ""}, + "cSHAKE128": {NewCSHAKE128, "CSHAKE128", "CustomString"}, + "cSHAKE256": {NewCSHAKE256, "CSHAKE256", "CustomString"}, + "SHAKE-Zero": {func(N []byte, S []byte) *SHAKE { return &SHAKE{} }, "", ""}, +} + +func TestSHA3Hash(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha3", func(t *testing.T) { + for name, f := range testDigests { + t.Run(name, func(t *testing.T) { + cryptotest.TestHash(t, func() hash.Hash { return f() }) + }) + } + }) +} + +// TestUnalignedWrite tests that writing data in an arbitrary pattern with +// small input buffers. +func TestUnalignedWrite(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha3", testUnalignedWrite) +} + +func testUnalignedWrite(t *testing.T) { + buf := sequentialBytes(0x10000) + for alg, df := range testDigests { + d := df() + d.Reset() + d.Write(buf) + want := d.Sum(nil) + d.Reset() + for i := 0; i < len(buf); { + // Cycle through offsets which make a 137 byte sequence. + // Because 137 is prime this sequence should exercise all corner cases. + offsets := [17]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1} + for _, j := range offsets { + if v := len(buf) - i; v < j { + j = v + } + d.Write(buf[i : i+j]) + i += j + } + } + got := d.Sum(nil) + if !bytes.Equal(got, want) { + t.Errorf("Unaligned writes, alg=%s\ngot %q, want %q", alg, got, want) + } + } + + // Same for SHAKE + for alg, df := range testShakes { + want := make([]byte, 16) + got := make([]byte, 16) + d := df.constructor([]byte(df.defAlgoName), []byte(df.defCustomStr)) + + d.Reset() + d.Write(buf) + d.Read(want) + d.Reset() + for i := 0; i < len(buf); { + // Cycle through offsets which make a 137 byte sequence. + // Because 137 is prime this sequence should exercise all corner cases. + offsets := [17]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1} + for _, j := range offsets { + if v := len(buf) - i; v < j { + j = v + } + d.Write(buf[i : i+j]) + i += j + } + } + d.Read(got) + if !bytes.Equal(got, want) { + t.Errorf("Unaligned writes, alg=%s\ngot %q, want %q", alg, got, want) + } + } +} + +// TestAppend checks that appending works when reallocation is necessary. +func TestAppend(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha3", testAppend) +} + +func testAppend(t *testing.T) { + d := New224() + + for capacity := 2; capacity <= 66; capacity += 64 { + // The first time around the loop, Sum will have to reallocate. + // The second time, it will not. + buf := make([]byte, 2, capacity) + d.Reset() + d.Write([]byte{0xcc}) + buf = d.Sum(buf) + expected := "0000DF70ADC49B2E76EEE3A6931B93FA41841C3AF2CDF5B32A18B5478C39" + if got := strings.ToUpper(hex.EncodeToString(buf)); got != expected { + t.Errorf("got %s, want %s", got, expected) + } + } +} + +// TestAppendNoRealloc tests that appending works when no reallocation is necessary. +func TestAppendNoRealloc(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha3", testAppendNoRealloc) +} + +func testAppendNoRealloc(t *testing.T) { + buf := make([]byte, 1, 200) + d := New224() + d.Write([]byte{0xcc}) + buf = d.Sum(buf) + expected := "00DF70ADC49B2E76EEE3A6931B93FA41841C3AF2CDF5B32A18B5478C39" + if got := strings.ToUpper(hex.EncodeToString(buf)); got != expected { + t.Errorf("got %s, want %s", got, expected) + } +} + +// TestSqueezing checks that squeezing the full output a single time produces +// the same output as repeatedly squeezing the instance. +func TestSqueezing(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha3", testSqueezing) +} + +func testSqueezing(t *testing.T) { + for algo, v := range testShakes { + d0 := v.constructor([]byte(v.defAlgoName), []byte(v.defCustomStr)) + d0.Write([]byte(testString)) + ref := make([]byte, 32) + d0.Read(ref) + + d1 := v.constructor([]byte(v.defAlgoName), []byte(v.defCustomStr)) + d1.Write([]byte(testString)) + var multiple []byte + for range ref { + d1.Read(make([]byte, 0)) + one := make([]byte, 1) + d1.Read(one) + multiple = append(multiple, one...) + } + if !bytes.Equal(ref, multiple) { + t.Errorf("%s: squeezing %d bytes one at a time failed", algo, len(ref)) + } + } +} + +// sequentialBytes produces a buffer of size consecutive bytes 0x00, 0x01, ..., used for testing. +// +// The alignment of each slice is intentionally randomized to detect alignment +// issues in the implementation. See https://golang.org/issue/37644. +// Ideally, the compiler should fuzz the alignment itself. +// (See https://golang.org/issue/35128.) +func sequentialBytes(size int) []byte { + alignmentOffset := rand.Intn(8) + result := make([]byte, size+alignmentOffset)[alignmentOffset:] + for i := range result { + result[i] = byte(i) + } + return result +} + +func TestReset(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha3", testReset) +} + +func testReset(t *testing.T) { + out1 := make([]byte, 32) + out2 := make([]byte, 32) + + for _, v := range testShakes { + // Calculate hash for the first time + c := v.constructor(nil, []byte{0x99, 0x98}) + c.Write(sequentialBytes(0x100)) + c.Read(out1) + + // Calculate hash again + c.Reset() + c.Write(sequentialBytes(0x100)) + c.Read(out2) + + if !bytes.Equal(out1, out2) { + t.Error("\nExpected:\n", out1, "\ngot:\n", out2) + } + } +} + +var sinkSHA3 byte + +func TestAllocations(t *testing.T) { + cryptotest.SkipTestAllocations(t) + t.Run("New", func(t *testing.T) { + if allocs := testing.AllocsPerRun(10, func() { + h := New256() + b := []byte("ABC") + h.Write(b) + out := make([]byte, 0, 32) + out = h.Sum(out) + sinkSHA3 ^= out[0] + }); allocs > 0 { + t.Errorf("expected zero allocations, got %0.1f", allocs) + } + }) + t.Run("NewSHAKE", func(t *testing.T) { + if allocs := testing.AllocsPerRun(10, func() { + h := NewSHAKE128() + b := []byte("ABC") + h.Write(b) + out := make([]byte, 32) + h.Read(out) + sinkSHA3 ^= out[0] + }); allocs > 0 { + t.Errorf("expected zero allocations, got %0.1f", allocs) + } + }) + t.Run("Sum", func(t *testing.T) { + if allocs := testing.AllocsPerRun(10, func() { + b := []byte("ABC") + out := Sum256(b) + sinkSHA3 ^= out[0] + }); allocs > 0 { + t.Errorf("expected zero allocations, got %0.1f", allocs) + } + }) + t.Run("SumSHAKE", func(t *testing.T) { + if allocs := testing.AllocsPerRun(10, func() { + b := []byte("ABC") + out := SumSHAKE128(b, 10) + sinkSHA3 ^= out[0] + }); allocs > 0 { + t.Errorf("expected zero allocations, got %0.1f", allocs) + } + }) +} + +func TestCSHAKEAccumulated(t *testing.T) { + // Generated with pycryptodome@3.20.0 + // + // from Crypto.Hash import cSHAKE128 + // rng = cSHAKE128.new() + // acc = cSHAKE128.new() + // for n in range(200): + // N = rng.read(n) + // for s in range(200): + // S = rng.read(s) + // c = cSHAKE128.cSHAKE_XOF(data=None, custom=S, capacity=256, function=N) + // c.update(rng.read(100)) + // acc.update(c.read(200)) + // c = cSHAKE128.cSHAKE_XOF(data=None, custom=S, capacity=256, function=N) + // c.update(rng.read(168)) + // acc.update(c.read(200)) + // c = cSHAKE128.cSHAKE_XOF(data=None, custom=S, capacity=256, function=N) + // c.update(rng.read(200)) + // acc.update(c.read(200)) + // print(acc.read(32).hex()) + // + // and with @noble/hashes@v1.5.0 + // + // import { bytesToHex } from "@noble/hashes/utils"; + // import { cshake128 } from "@noble/hashes/sha3-addons"; + // const rng = cshake128.create(); + // const acc = cshake128.create(); + // for (let n = 0; n < 200; n++) { + // const N = rng.xof(n); + // for (let s = 0; s < 200; s++) { + // const S = rng.xof(s); + // let c = cshake128.create({ NISTfn: N, personalization: S }); + // c.update(rng.xof(100)); + // acc.update(c.xof(200)); + // c = cshake128.create({ NISTfn: N, personalization: S }); + // c.update(rng.xof(168)); + // acc.update(c.xof(200)); + // c = cshake128.create({ NISTfn: N, personalization: S }); + // c.update(rng.xof(200)); + // acc.update(c.xof(200)); + // } + // } + // console.log(bytesToHex(acc.xof(32))); + // + cryptotest.TestAllImplementations(t, "sha3", func(t *testing.T) { + t.Run("cSHAKE128", func(t *testing.T) { + testCSHAKEAccumulated(t, NewCSHAKE128, (1600-256)/8, + "bb14f8657c6ec5403d0b0e2ef3d3393497e9d3b1a9a9e8e6c81dbaa5fd809252") + }) + t.Run("cSHAKE256", func(t *testing.T) { + testCSHAKEAccumulated(t, NewCSHAKE256, (1600-512)/8, + "0baaf9250c6e25f0c14ea5c7f9bfde54c8a922c8276437db28f3895bdf6eeeef") + }) + }) +} + +func testCSHAKEAccumulated(t *testing.T, newCSHAKE func(N, S []byte) *SHAKE, rate int64, exp string) { + rnd := newCSHAKE(nil, nil) + acc := newCSHAKE(nil, nil) + for n := 0; n < 200; n++ { + N := make([]byte, n) + rnd.Read(N) + for s := 0; s < 200; s++ { + S := make([]byte, s) + rnd.Read(S) + + c := newCSHAKE(N, S) + io.CopyN(c, rnd, 100 /* < rate */) + io.CopyN(acc, c, 200) + + c.Reset() + io.CopyN(c, rnd, rate) + io.CopyN(acc, c, 200) + + c.Reset() + io.CopyN(c, rnd, 200 /* > rate */) + io.CopyN(acc, c, 200) + } + } + out := make([]byte, 32) + acc.Read(out) + if got := hex.EncodeToString(out); got != exp { + t.Errorf("got %s, want %s", got, exp) + } +} + +func TestCSHAKELargeS(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha3", testCSHAKELargeS) +} + +func testCSHAKELargeS(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } + + // See https://go.dev/issue/66232. + const s = (1<<32)/8 + 1000 // s * 8 > 2^32 + S := make([]byte, s) + rnd := NewSHAKE128() + rnd.Read(S) + c := NewCSHAKE128(nil, S) + io.CopyN(c, rnd, 1000) + out := make([]byte, 32) + c.Read(out) + + // Generated with pycryptodome@3.20.0 + // + // from Crypto.Hash import cSHAKE128 + // rng = cSHAKE128.new() + // S = rng.read(536871912) + // c = cSHAKE128.new(custom=S) + // c.update(rng.read(1000)) + // print(c.read(32).hex()) + // + exp := "2cb9f237767e98f2614b8779cf096a52da9b3a849280bbddec820771ae529cf0" + if got := hex.EncodeToString(out); got != exp { + t.Errorf("got %s, want %s", got, exp) + } +} + +func TestMarshalUnmarshal(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha3", func(t *testing.T) { + t.Run("SHA3-224", func(t *testing.T) { testMarshalUnmarshal(t, New224()) }) + t.Run("SHA3-256", func(t *testing.T) { testMarshalUnmarshal(t, New256()) }) + t.Run("SHA3-384", func(t *testing.T) { testMarshalUnmarshal(t, New384()) }) + t.Run("SHA3-512", func(t *testing.T) { testMarshalUnmarshal(t, New512()) }) + t.Run("SHAKE128", func(t *testing.T) { testMarshalUnmarshalSHAKE(t, NewSHAKE128()) }) + t.Run("SHAKE256", func(t *testing.T) { testMarshalUnmarshalSHAKE(t, NewSHAKE256()) }) + t.Run("cSHAKE128", func(t *testing.T) { testMarshalUnmarshalSHAKE(t, NewCSHAKE128([]byte("N"), []byte("S"))) }) + t.Run("cSHAKE256", func(t *testing.T) { testMarshalUnmarshalSHAKE(t, NewCSHAKE256([]byte("N"), []byte("S"))) }) + }) +} + +// TODO(filippo): move this to crypto/internal/cryptotest. +func testMarshalUnmarshal(t *testing.T, h *SHA3) { + buf := make([]byte, 200) + rand.Read(buf) + n := rand.Intn(200) + h.Write(buf) + want := h.Sum(nil) + h.Reset() + h.Write(buf[:n]) + b, err := h.MarshalBinary() + if err != nil { + t.Errorf("MarshalBinary: %v", err) + } + h.Write(bytes.Repeat([]byte{0}, 200)) + if err := h.UnmarshalBinary(b); err != nil { + t.Errorf("UnmarshalBinary: %v", err) + } + h.Write(buf[n:]) + got := h.Sum(nil) + if !bytes.Equal(got, want) { + t.Errorf("got %x, want %x", got, want) + } +} + +// TODO(filippo): move this to crypto/internal/cryptotest. +func testMarshalUnmarshalSHAKE(t *testing.T, h *SHAKE) { + buf := make([]byte, 200) + rand.Read(buf) + n := rand.Intn(200) + h.Write(buf) + want := make([]byte, 32) + h.Read(want) + h.Reset() + h.Write(buf[:n]) + b, err := h.MarshalBinary() + if err != nil { + t.Errorf("MarshalBinary: %v", err) + } + h.Write(bytes.Repeat([]byte{0}, 200)) + if err := h.UnmarshalBinary(b); err != nil { + t.Errorf("UnmarshalBinary: %v", err) + } + h.Write(buf[n:]) + got := make([]byte, 32) + h.Read(got) + if !bytes.Equal(got, want) { + t.Errorf("got %x, want %x", got, want) + } +} + +// benchmarkHash tests the speed to hash num buffers of buflen each. +func benchmarkHash(b *testing.B, h hash.Hash, size, num int) { + b.StopTimer() + h.Reset() + data := sequentialBytes(size) + b.SetBytes(int64(size * num)) + b.StartTimer() + + var state []byte + for i := 0; i < b.N; i++ { + for j := 0; j < num; j++ { + h.Write(data) + } + state = h.Sum(state[:0]) + } + b.StopTimer() + h.Reset() +} + +// benchmarkShake is specialized to the Shake instances, which don't +// require a copy on reading output. +func benchmarkShake(b *testing.B, h *SHAKE, size, num int) { + b.StopTimer() + h.Reset() + data := sequentialBytes(size) + d := make([]byte, 32) + + b.SetBytes(int64(size * num)) + b.StartTimer() + + for i := 0; i < b.N; i++ { + h.Reset() + for j := 0; j < num; j++ { + h.Write(data) + } + h.Read(d) + } +} + +func BenchmarkSha3_512_MTU(b *testing.B) { benchmarkHash(b, New512(), 1350, 1) } +func BenchmarkSha3_384_MTU(b *testing.B) { benchmarkHash(b, New384(), 1350, 1) } +func BenchmarkSha3_256_MTU(b *testing.B) { benchmarkHash(b, New256(), 1350, 1) } +func BenchmarkSha3_224_MTU(b *testing.B) { benchmarkHash(b, New224(), 1350, 1) } + +func BenchmarkShake128_MTU(b *testing.B) { benchmarkShake(b, NewSHAKE128(), 1350, 1) } +func BenchmarkShake256_MTU(b *testing.B) { benchmarkShake(b, NewSHAKE256(), 1350, 1) } +func BenchmarkShake256_16x(b *testing.B) { benchmarkShake(b, NewSHAKE256(), 16, 1024) } +func BenchmarkShake256_1MiB(b *testing.B) { benchmarkShake(b, NewSHAKE256(), 1024, 1024) } + +func BenchmarkSha3_512_1MiB(b *testing.B) { benchmarkHash(b, New512(), 1024, 1024) } diff --git a/go/src/crypto/sha512/sha512.go b/go/src/crypto/sha512/sha512.go new file mode 100644 index 0000000000000000000000000000000000000000..1435eac1f5b5dc0646b6208d0694ec3d68d4ac35 --- /dev/null +++ b/go/src/crypto/sha512/sha512.go @@ -0,0 +1,123 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package sha512 implements the SHA-384, SHA-512, SHA-512/224, and SHA-512/256 +// hash algorithms as defined in FIPS 180-4. +// +// All the hash.Hash implementations returned by this package also +// implement encoding.BinaryMarshaler and encoding.BinaryUnmarshaler to +// marshal and unmarshal the internal state of the hash. +package sha512 + +import ( + "crypto" + "crypto/internal/boring" + "crypto/internal/fips140/sha512" + "hash" +) + +func init() { + crypto.RegisterHash(crypto.SHA384, New384) + crypto.RegisterHash(crypto.SHA512, New) + crypto.RegisterHash(crypto.SHA512_224, New512_224) + crypto.RegisterHash(crypto.SHA512_256, New512_256) +} + +const ( + // Size is the size, in bytes, of a SHA-512 checksum. + Size = 64 + + // Size224 is the size, in bytes, of a SHA-512/224 checksum. + Size224 = 28 + + // Size256 is the size, in bytes, of a SHA-512/256 checksum. + Size256 = 32 + + // Size384 is the size, in bytes, of a SHA-384 checksum. + Size384 = 48 + + // BlockSize is the block size, in bytes, of the SHA-512/224, + // SHA-512/256, SHA-384 and SHA-512 hash functions. + BlockSize = 128 +) + +// New returns a new [hash.Hash] computing the SHA-512 checksum. The Hash +// also implements [encoding.BinaryMarshaler], [encoding.BinaryAppender] and +// [encoding.BinaryUnmarshaler] to marshal and unmarshal the internal +// state of the hash. +func New() hash.Hash { + if boring.Enabled { + return boring.NewSHA512() + } + return sha512.New() +} + +// New512_224 returns a new [hash.Hash] computing the SHA-512/224 checksum. The Hash +// also implements [encoding.BinaryMarshaler], [encoding.BinaryAppender] and +// [encoding.BinaryUnmarshaler] to marshal and unmarshal the internal +// state of the hash. +func New512_224() hash.Hash { + return sha512.New512_224() +} + +// New512_256 returns a new [hash.Hash] computing the SHA-512/256 checksum. The Hash +// also implements [encoding.BinaryMarshaler], [encoding.BinaryAppender] and +// [encoding.BinaryUnmarshaler] to marshal and unmarshal the internal +// state of the hash. +func New512_256() hash.Hash { + return sha512.New512_256() +} + +// New384 returns a new [hash.Hash] computing the SHA-384 checksum. The Hash +// also implements [encoding.BinaryMarshaler], [encoding.BinaryAppender] and +// [encoding.BinaryUnmarshaler] to marshal and unmarshal the internal +// state of the hash. +func New384() hash.Hash { + if boring.Enabled { + return boring.NewSHA384() + } + return sha512.New384() +} + +// Sum512 returns the SHA512 checksum of the data. +func Sum512(data []byte) [Size]byte { + if boring.Enabled { + return boring.SHA512(data) + } + h := New() + h.Write(data) + var sum [Size]byte + h.Sum(sum[:0]) + return sum +} + +// Sum384 returns the SHA384 checksum of the data. +func Sum384(data []byte) [Size384]byte { + if boring.Enabled { + return boring.SHA384(data) + } + h := New384() + h.Write(data) + var sum [Size384]byte + h.Sum(sum[:0]) + return sum +} + +// Sum512_224 returns the Sum512/224 checksum of the data. +func Sum512_224(data []byte) [Size224]byte { + h := New512_224() + h.Write(data) + var sum [Size224]byte + h.Sum(sum[:0]) + return sum +} + +// Sum512_256 returns the Sum512/256 checksum of the data. +func Sum512_256(data []byte) [Size256]byte { + h := New512_256() + h.Write(data) + var sum [Size256]byte + h.Sum(sum[:0]) + return sum +} diff --git a/go/src/crypto/sha512/sha512_test.go b/go/src/crypto/sha512/sha512_test.go new file mode 100644 index 0000000000000000000000000000000000000000..080bf694f03652867c9989b8886f1d38de17620b --- /dev/null +++ b/go/src/crypto/sha512/sha512_test.go @@ -0,0 +1,1040 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// SHA512 hash algorithm. See FIPS 180-4. + +package sha512 + +import ( + "bytes" + "crypto/internal/cryptotest" + "encoding" + "encoding/hex" + "fmt" + "hash" + "io" + "testing" +) + +type sha512Test struct { + out string + in string + halfState string // marshaled hash state after first half of in written, used by TestGoldenMarshal +} + +var golden224 = []sha512Test{ + { + "6ed0dd02806fa89e25de060c19d3ac86cabb87d6a0ddd05c333b84f4", + "", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + }, + { + "d5cdb9ccc769a5121d4175f2bfdd13d6310e0d3d361ea75d82108327", + "a", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + }, + { + "b35878d07bfedf39fc638af08547eb5d1072d8546319f247b442fbf5", + "ab", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", + }, + { + "4634270f707b6a54daae7530460842e20e37ed265ceee9a43e8924aa", + "abc", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", + }, + { + "0c9f157ab030fb06e957c14e3938dc5908962e5dd7b66f04a36fc534", + "abcd", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1ab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", + }, + { + "880e79bb0a1d2c9b7528d851edb6b8342c58c831de98123b432a4515", + "abcde", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1ab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", + }, + { + "236c829cfea4fd6d4de61ad15fcf34dca62342adaf9f2001c16f29b8", + "abcdef", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1abc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03", + }, + { + "4767af672b3ed107f25018dc22d6fa4b07d156e13b720971e2c4f6bf", + "abcdefg", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1abc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03", + }, + { + "792e25e0ae286d123a38950007e037d3122e76c4ee201668c385edab", + "abcdefgh", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1abcd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", + }, + { + "56b275d36127dc070cda4019baf2ce2579a25d8c67fa2bc9be61b539", + "abcdefghi", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1abcd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", + }, + { + "f809423cbb25e81a2a64aecee2cd5fdc7d91d5db583901fbf1db3116", + "abcdefghij", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1abcde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05", + }, + { + "4c46e10b5b72204e509c3c06072cea970bc020cd45a61a0acdfa97ac", + "Discard medicine more than two years old.", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1Discard medicine mor\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x14", + }, + { + "cb0cef13c1848d91a6d02637c7c520de1914ad4a7aea824671cc328e", + "He who has a shady past knows that nice guys finish last.", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1He who has a shady past know\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c", + }, + { + "6c7bd0f3a6544ea698006c2ea583a85f80ea2913590a186db8bb2f1b", + "I wouldn't marry him with a ten foot pole.", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1I wouldn't marry him \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15", + }, + { + "981323be3eca6ccfa598e58dd74ed8cb05d5f7f6653b7604b684f904", + "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1Free! Free!/A trip/to Mars/f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c", + }, + { + "e6fbf82df5138bf361e826903cadf0612cb2986649ba47a57e1bca99", + "The days of the digital watch are numbered. -Tom Stoppard", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1The days of the digital watch\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1d", + }, + { + "6ec2cb2ecafc1a9bddaf4caf57344d853e6ded398927d5694fd7714f", + "Nepal premier won't resign.", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1Nepal premier\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\r", + }, + { + "7f62f36e716e0badaf4a4658da9d09bea26357a1bc6aeb8cf7c3ae35", + "For every action there is an equal and opposite government program.", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1For every action there is an equa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00!", + }, + { + "45adffcb86a05ee4d91263a6115dda011b805d442c60836963cb8378", + "His money is twice tainted: 'taint yours and 'taint mine.", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1His money is twice tainted: \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c", + }, + { + "51cb518f1f68daa901a3075a0a5e1acc755b4e5c82cb47687537f880", + "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1There is no reason for any individual to hav\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00,", + }, + { + "3b59c5e64b0da7bfc18d7017bf458d90f2c83601ff1afc6263ac0993", + "It's a tiny change to the code and not completely disgusting. - Bob Manchek", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1It's a tiny change to the code and no\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00%", + }, + { + "6a9525c0fac0f91b489bc4f0f539b9ec4a156a4e98bc15b655c2c881", + "size: a.out: bad magic", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1size: a.out\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\f", + }, + { + "a1b2b2905b1527d682049c6a76e35c7d8c72551abfe7833ac1be595f", + "The major problem is with sendmail. -Mark Horton", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1The major problem is wit\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18", + }, + { + "76cf045c76a5f2e3d64d56c3cdba6a25479334611bc375460526f8c1", + "Give me a rock, paper and scissors and I will move the world. CCFestoon", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1Give me a rock, paper and scissors a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00$", + }, + { + "4473671daeecfdb6f6c5bc06b26374aa5e497cc37119fe14144c430c", + "If the enemy is within range, then so are you.", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1If the enemy is within \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17", + }, + { + "6accb6394758523fcd453d47d37ebd10868957a0a9e81c796736abf8", + "It's well we cannot hear the screams/That we create in others' dreams.", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1It's well we cannot hear the scream\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00#", + }, + { + "6f173f4b6eac7f2a73eaa0833c4563752df2c869dc00b7d30219e12e", + "You remind me of a TV show, but that's all right: I watch it anyway.", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1You remind me of a TV show, but th\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\"", + }, + { + "db05bf4d0f73325208755f4af96cfac6cb3db5dbfc323d675d68f938", + "C is as portable as Stonehedge!!", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1C is as portable\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10", + }, + { + "05ffa71bb02e855de1aaee1777b3bdbaf7507646f19c4c6aa29933d0", + "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1Even if I could be Shakespeare, I think I sh\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00,", + }, + { + "3ad3c89e15b91e6273534c5d18adadbb528e7b840b288f64e81b8c6d", + "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction. Lewis-Randall Rule", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1The fugacity of a constituent in a mixture of gases at a given tem\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00B", + }, + { + "e3763669d1b760c1be7bfcb6625f92300a8430419d1dbad57ec9f53c", + "How can you write a big system without C++? -Paul Glick", + "sha\x05\x8c=7\xc8\x19TM\xa2s\xe1\x99f\x89\xdc\xd4\xd6\x1d\xfa\xb7\xae2\xff\x9c\x82g\x9d\xd5\x14X/\x9f\xcf\x0fm+i{\xd4M\xa8w\xe3os\x04ĉB?\x9d\x85\xa8j\x1d6\xc8\x11\x12歑֒\xa1How can you write a big syst\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c", + }, +} + +var golden256 = []sha512Test{ + { + "c672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967a", + "", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + }, + { + "455e518824bc0601f9fb858ff5c37d417d67c2f8e0df2babe4808858aea830f8", + "a", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + }, + { + "22d4d37ec6370571af7109fb12eae79673d5f7c83e6e677083faa3cfac3b2c14", + "ab", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", + }, + { + "53048e2681941ef99b2e29b76b4c7dabe4c2d0c634fc6d46e0e2f13107e7af23", + "abc", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", + }, + { + "d2891c7978be0e24948f37caa415b87cb5cbe2b26b7bad9dc6391b8a6f6ddcc9", + "abcd", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2ab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", + }, + { + "de8322b46e78b67d4431997070703e9764e03a1237b896fd8b379ed4576e8363", + "abcde", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2ab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", + }, + { + "e4fdcb11d1ac14e698743acd8805174cea5ddc0d312e3e47f6372032571bad84", + "abcdef", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2abc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03", + }, + { + "a8117f680bdceb5d1443617cbdae9255f6900075422326a972fdd2f65ba9bee3", + "abcdefg", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2abc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03", + }, + { + "a29b9645d2a02a8b582888d044199787220e316bf2e89d1422d3df26bf545bbe", + "abcdefgh", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2abcd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", + }, + { + "b955095330f9c8188d11884ec1679dc44c9c5b25ff9bda700416df9cdd39188f", + "abcdefghi", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2abcd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", + }, + { + "550762913d51eefbcd1a55068fcfc9b154fd11c1078b996df0d926ea59d2a68d", + "abcdefghij", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2abcde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05", + }, + { + "690c8ad3916cefd3ad29226d9875965e3ee9ec0d4482eacc248f2ff4aa0d8e5b", + "Discard medicine more than two years old.", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2Discard medicine mor\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x14", + }, + { + "25938ca49f7ef1178ce81620842b65e576245fcaed86026a36b516b80bb86b3b", + "He who has a shady past knows that nice guys finish last.", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2He who has a shady past know\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c", + }, + { + "698e420c3a7038e53d8e73f4be2b02e03b93464ac1a61ebe69f557079921ef65", + "I wouldn't marry him with a ten foot pole.", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2I wouldn't marry him \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15", + }, + { + "839b414d7e3900ee243aa3d1f9b6955720e64041f5ab9bedd3eb0a08da5a2ca8", + "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2Free! Free!/A trip/to Mars/f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c", + }, + { + "5625ecb9d284e54c00b257b67a8cacb25a78db2845c60ef2d29e43c84f236e8e", + "The days of the digital watch are numbered. -Tom Stoppard", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2The days of the digital watch\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1d", + }, + { + "9b81d06bca2f985e6ad3249096ff3c0f2a9ec5bb16ef530d738d19d81e7806f2", + "Nepal premier won't resign.", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2Nepal premier\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\r", + }, + { + "08241df8d91edfcd68bb1a1dada6e0ae1475a5c6e7b8f12d8e24ca43a38240a9", + "For every action there is an equal and opposite government program.", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2For every action there is an equa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00!", + }, + { + "4ff74d9213a8117745f5d37b5353a774ec81c5dfe65c4c8986a56fc01f2c551e", + "His money is twice tainted: 'taint yours and 'taint mine.", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2His money is twice tainted: \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c", + }, + { + "b5baf747c307f98849ec881cf0d48605ae4edd386372aea9b26e71db517e650b", + "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2There is no reason for any individual to hav\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00,", + }, + { + "7eef0538ebd7ecf18611d23b0e1cd26a74d65b929a2e374197dc66e755ca4944", + "It's a tiny change to the code and not completely disgusting. - Bob Manchek", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2It's a tiny change to the code and no\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00%", + }, + { + "d05600964f83f55323104aadab434f32391c029718a7690d08ddb2d7e8708443", + "size: a.out: bad magic", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2size: a.out\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\f", + }, + { + "53ed5f9b5c0b674ac0f3425d9f9a5d462655b07cc90f5d0f692eec093884a607", + "The major problem is with sendmail. -Mark Horton", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2The major problem is wit\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18", + }, + { + "5a0147685a44eea2435dbd582724efca7637acd9c428e5e1a05115bc3bc2a0e0", + "Give me a rock, paper and scissors and I will move the world. CCFestoon", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2Give me a rock, paper and scissors a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00$", + }, + { + "1152c9b27a99dbf4057d21438f4e63dd0cd0977d5ff12317c64d3b97fcac875a", + "If the enemy is within range, then so are you.", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2If the enemy is within \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17", + }, + { + "105e890f5d5cf1748d9a7b4cdaf58b69855779deebc2097747c2210a17b2cb51", + "It's well we cannot hear the screams/That we create in others' dreams.", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2It's well we cannot hear the scream\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00#", + }, + { + "74644ead770da1434365cd912656fe1aca2056d3039d39f10eb1151bddb32cf3", + "You remind me of a TV show, but that's all right: I watch it anyway.", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2You remind me of a TV show, but th\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\"", + }, + { + "50a234625de5587581883dad9ef399460928032a5ea6bd005d7dc7b68d8cc3d6", + "C is as portable as Stonehedge!!", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2C is as portable\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10", + }, + { + "a7a3846005f8a9935a0a2d43e7fd56d95132a9a3609bf3296ef80b8218acffa0", + "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2Even if I could be Shakespeare, I think I sh\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00,", + }, + { + "688ff03e367680757aa9906cb1e2ad218c51f4526dc0426ea229a5ba9d002c69", + "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction. Lewis-Randall Rule", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2The fugacity of a constituent in a mixture of gases at a given tem\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00B", + }, + { + "3fa46d52094b01021cff5af9a438982b887a5793f624c0a6644149b6b7c3f485", + "How can you write a big system without C++? -Paul Glick", + "sha\x06\"1!\x94\xfc+\xf7,\x9fU_\xa3\xc8Ld\xc2#\x93\xb8koS\xb1Q\x968w\x19Y@꽖(>⨎\xff\xe3\xbe^\x1e%S\x869\x92+\x01\x99\xfc,\x85\xb8\xaa\x0e\xb7-܁\xc5,\xa2How can you write a big syst\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c", + }, +} + +var golden384 = []sha512Test{ + { + "38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b", + "", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + }, + { + "54a59b9f22b0b80880d8427e548b7c23abd873486e1f035dce9cd697e85175033caa88e6d57bc35efae0b5afd3145f31", + "a", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + }, + { + "c7be03ba5bcaa384727076db0018e99248e1a6e8bd1b9ef58a9ec9dd4eeebb3f48b836201221175befa74ddc3d35afdd", + "ab", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", + }, + { + "cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7", + "abc", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", + }, + { + "1165b3406ff0b52a3d24721f785462ca2276c9f454a116c2b2ba20171a7905ea5a026682eb659c4d5f115c363aa3c79b", + "abcd", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4ab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", + }, + { + "4c525cbeac729eaf4b4665815bc5db0c84fe6300068a727cf74e2813521565abc0ec57a37ee4d8be89d097c0d2ad52f0", + "abcde", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4ab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", + }, + { + "c6a4c65b227e7387b9c3e839d44869c4cfca3ef583dea64117859b808c1e3d8ae689e1e314eeef52a6ffe22681aa11f5", + "abcdef", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4abc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03", + }, + { + "9f11fc131123f844c1226f429b6a0a6af0525d9f40f056c7fc16cdf1b06bda08e302554417a59fa7dcf6247421959d22", + "abcdefg", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4abc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03", + }, + { + "9000cd7cada59d1d2eb82912f7f24e5e69cc5517f68283b005fa27c285b61e05edf1ad1a8a9bded6fd29eb87d75ad806", + "abcdefgh", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4abcd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", + }, + { + "ef54915b60cf062b8dd0c29ae3cad69abe6310de63ac081f46ef019c5c90897caefd79b796cfa81139788a260ded52df", + "abcdefghi", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4abcd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", + }, + { + "a12070030a02d86b0ddacd0d3a5b598344513d0a051e7355053e556a0055489c1555399b03342845c4adde2dc44ff66c", + "abcdefghij", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4abcde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05", + }, + { + "86f58ec2d74d1b7f8eb0c2ff0967316699639e8d4eb129de54bdf34c96cdbabe200d052149f2dd787f43571ba74670d4", + "Discard medicine more than two years old.", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4Discard medicine mor\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x14", + }, + { + "ae4a2b639ca9bfa04b1855d5a05fe7f230994f790891c6979103e2605f660c4c1262a48142dcbeb57a1914ba5f7c3fa7", + "He who has a shady past knows that nice guys finish last.", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4He who has a shady past know\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c", + }, + { + "40ae213df6436eca952aa6841886fcdb82908ef1576a99c8f49bb9dd5023169f7c53035abdda0b54c302f4974e2105e7", + "I wouldn't marry him with a ten foot pole.", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4I wouldn't marry him \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15", + }, + { + "e7cf8b873c9bc950f06259aa54309f349cefa72c00d597aebf903e6519a50011dfe355afff064a10701c705693848df9", + "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4Free! Free!/A trip/to Mars/f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c", + }, + { + "c3d4f0f4047181c7d39d34703365f7bf70207183caf2c2f6145f04da895ef69124d9cdeb635da636c3a474e61024e29b", + "The days of the digital watch are numbered. -Tom Stoppard", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4The days of the digital watch\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1d", + }, + { + "a097aab567e167d5cf93676ed73252a69f9687cb3179bb2d27c9878119e94bf7b7c4b58dc90582edfaf66e11388ed714", + "Nepal premier won't resign.", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4Nepal premier\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\r", + }, + { + "5026ca45c41fc64712eb65065da92f6467541c78f8966d3fe2c8e3fb769a3ec14215f819654b47bd64f7f0eac17184f3", + "For every action there is an equal and opposite government program.", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4For every action there is an equa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00!", + }, + { + "ac1cc0f5ac8d5f5514a7b738ac322b7fb52a161b449c3672e9b6a6ad1a5e4b26b001cf3bad24c56598676ca17d4b445a", + "His money is twice tainted: 'taint yours and 'taint mine.", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4His money is twice tainted: \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c", + }, + { + "722d10c5de371ec0c8c4b5247ac8a5f1d240d68c73f8da13d8b25f0166d6f309bf9561979a111a0049405771d201941a", + "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4There is no reason for any individual to hav\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00,", + }, + { + "dc2d3ea18bfa10549c63bf2b75b39b5167a80c12aff0e05443168ea87ff149fb0eda5e0bd234eb5d48c7d02ffc5807f1", + "It's a tiny change to the code and not completely disgusting. - Bob Manchek", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4It's a tiny change to the code and no\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00%", + }, + { + "1d67c969e2a945ae5346d2139760261504d4ba164c522443afe19ef3e29b152a4c52445489cfc9d7215e5a450e8e1e4e", + "size: a.out: bad magic", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4size: a.out\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\f", + }, + { + "5ff8e075e465646e7b73ef36d812c6e9f7d60fa6ea0e533e5569b4f73cde53cdd2cc787f33540af57cca3fe467d32fe0", + "The major problem is with sendmail. -Mark Horton", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4The major problem is wit\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18", + }, + { + "5bd0a997a67c9ae1979a894eb0cde403dde003c9b6f2c03cf21925c42ff4e1176e6df1ca005381612ef18457b9b7ec3b", + "Give me a rock, paper and scissors and I will move the world. CCFestoon", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4Give me a rock, paper and scissors a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00$", + }, + { + "1eee6da33e7e54fc5be52ae23b94b16ba4d2a947ae4505c6a3edfc7401151ea5205ac01b669b56f27d8ef7f175ed7762", + "If the enemy is within range, then so are you.", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4If the enemy is within \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17", + }, + { + "76b06e9dea66bfbb1a96029426dc0dfd7830bd297eb447ff5358d94a87cd00c88b59df2493fef56ecbb5231073892ea9", + "It's well we cannot hear the screams/That we create in others' dreams.", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4It's well we cannot hear the scream\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00#", + }, + { + "12acaf21452cff586143e3f5db0bfdf7802c057e1adf2a619031c4e1b0ccc4208cf6cef8fe722bbaa2fb46a30d9135d8", + "You remind me of a TV show, but that's all right: I watch it anyway.", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4You remind me of a TV show, but th\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\"", + }, + { + "0fc23d7f4183efd186f0bc4fc5db867e026e2146b06cb3d52f4bdbd57d1740122caa853b41868b197b2ac759db39df88", + "C is as portable as Stonehedge!!", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4C is as portable\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10", + }, + { + "bc805578a7f85d34a86a32976e1c34fe65cf815186fbef76f46ef99cda10723f971f3f1464d488243f5e29db7488598d", + "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4Even if I could be Shakespeare, I think I sh\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00,", + }, + { + "b23918399a12ebf4431559eec3813eaf7412e875fd7464f16d581e473330842d2e96c6be49a7ce3f9bb0b8bc0fcbe0fe", + "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction. Lewis-Randall Rule", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4The fugacity of a constituent in a mixture of gases at a given tem\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00B", + }, + { + "1764b700eb1ead52a2fc33cc28975c2180f1b8faa5038d94cffa8d78154aab16e91dd787e7b0303948ebed62561542c8", + "How can you write a big system without C++? -Paul Glick", + "sha\x04˻\x9d]\xc1\x05\x9e\xd8b\x9a)*6|\xd5\a\x91Y\x01Z0p\xdd\x17\x15/\xec\xd8\xf7\x0eY9g3&g\xff\xc0\v1\x8e\xb4J\x87hX\x15\x11\xdb\f.\rd\xf9\x8f\xa7G\xb5H\x1d\xbe\xfaO\xa4How can you write a big syst\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c", + }, +} + +var golden512 = []sha512Test{ + { + "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e", + "", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!y\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + }, + { + "1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75", + "a", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!y\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + }, + { + "2d408a0717ec188158278a796c689044361dc6fdde28d6f04973b80896e1823975cdbf12eb63f9e0591328ee235d80e9b5bf1aa6a44f4617ff3caf6400eb172d", + "ab", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!ya\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", + }, + { + "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f", + "abc", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!ya\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", + }, + { + "d8022f2060ad6efd297ab73dcc5355c9b214054b0d1776a136a669d26a7d3b14f73aa0d0ebff19ee333368f0164b6419a96da49e3e481753e7e96b716bdccb6f", + "abcd", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", + }, + { + "878ae65a92e86cac011a570d4c30a7eaec442b85ce8eca0c2952b5e3cc0628c2e79d889ad4d5c7c626986d452dd86374b6ffaa7cd8b67665bef2289a5c70b0a1", + "abcde", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", + }, + { + "e32ef19623e8ed9d267f657a81944b3d07adbb768518068e88435745564e8d4150a0a703be2a7d88b61e3d390c2bb97e2d4c311fdc69d6b1267f05f59aa920e7", + "abcdef", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yabc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03", + }, + { + "d716a4188569b68ab1b6dfac178e570114cdf0ea3a1cc0e31486c3e41241bc6a76424e8c37ab26f096fc85ef9886c8cb634187f4fddff645fb099f1ff54c6b8c", + "abcdefg", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yabc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03", + }, + { + "a3a8c81bc97c2560010d7389bc88aac974a104e0e2381220c6e084c4dccd1d2d17d4f86db31c2a851dc80e6681d74733c55dcd03dd96f6062cdda12a291ae6ce", + "abcdefgh", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yabcd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", + }, + { + "f22d51d25292ca1d0f68f69aedc7897019308cc9db46efb75a03dd494fc7f126c010e8ade6a00a0c1a5f1b75d81e0ed5a93ce98dc9b833db7839247b1d9c24fe", + "abcdefghi", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yabcd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", + }, + { + "ef6b97321f34b1fea2169a7db9e1960b471aa13302a988087357c520be957ca119c3ba68e6b4982c019ec89de3865ccf6a3cda1fe11e59f98d99f1502c8b9745", + "abcdefghij", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yabcde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05", + }, + { + "2210d99af9c8bdecda1b4beff822136753d8342505ddce37f1314e2cdbb488c6016bdaa9bd2ffa513dd5de2e4b50f031393d8ab61f773b0e0130d7381e0f8a1d", + "Discard medicine more than two years old.", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yDiscard medicine mor\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x14", + }, + { + "a687a8985b4d8d0a24f115fe272255c6afaf3909225838546159c1ed685c211a203796ae8ecc4c81a5b6315919b3a64f10713da07e341fcdbb08541bf03066ce", + "He who has a shady past knows that nice guys finish last.", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yHe who has a shady past know\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c", + }, + { + "8ddb0392e818b7d585ab22769a50df660d9f6d559cca3afc5691b8ca91b8451374e42bcdabd64589ed7c91d85f626596228a5c8572677eb98bc6b624befb7af8", + "I wouldn't marry him with a ten foot pole.", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yI wouldn't marry him \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15", + }, + { + "26ed8f6ca7f8d44b6a8a54ae39640fa8ad5c673f70ee9ce074ba4ef0d483eea00bab2f61d8695d6b34df9c6c48ae36246362200ed820448bdc03a720366a87c6", + "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yFree! Free!/A trip/to Mars/f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c", + }, + { + "e5a14bf044be69615aade89afcf1ab0389d5fc302a884d403579d1386a2400c089b0dbb387ed0f463f9ee342f8244d5a38cfbc0e819da9529fbff78368c9a982", + "The days of the digital watch are numbered. -Tom Stoppard", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yThe days of the digital watch\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1d", + }, + { + "420a1faa48919e14651bed45725abe0f7a58e0f099424c4e5a49194946e38b46c1f8034b18ef169b2e31050d1648e0b982386595f7df47da4b6fd18e55333015", + "Nepal premier won't resign.", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yNepal premier\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\r", + }, + { + "d926a863beadb20134db07683535c72007b0e695045876254f341ddcccde132a908c5af57baa6a6a9c63e6649bba0c213dc05fadcf9abccea09f23dcfb637fbe", + "For every action there is an equal and opposite government program.", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yFor every action there is an equa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00!", + }, + { + "9a98dd9bb67d0da7bf83da5313dff4fd60a4bac0094f1b05633690ffa7f6d61de9a1d4f8617937d560833a9aaa9ccafe3fd24db418d0e728833545cadd3ad92d", + "His money is twice tainted: 'taint yours and 'taint mine.", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yHis money is twice tainted: \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c", + }, + { + "d7fde2d2351efade52f4211d3746a0780a26eec3df9b2ed575368a8a1c09ec452402293a8ea4eceb5a4f60064ea29b13cdd86918cd7a4faf366160b009804107", + "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yThere is no reason for any individual to hav\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00,", + }, + { + "b0f35ffa2697359c33a56f5c0cf715c7aeed96da9905ca2698acadb08fbc9e669bf566b6bd5d61a3e86dc22999bcc9f2224e33d1d4f32a228cf9d0349e2db518", + "It's a tiny change to the code and not completely disgusting. - Bob Manchek", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yIt's a tiny change to the code and no\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00%", + }, + { + "3d2e5f91778c9e66f7e061293aaa8a8fc742dd3b2e4f483772464b1144189b49273e610e5cccd7a81a19ca1fa70f16b10f1a100a4d8c1372336be8484c64b311", + "size: a.out: bad magic", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!ysize: a.out\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\f", + }, + { + "b2f68ff58ac015efb1c94c908b0d8c2bf06f491e4de8e6302c49016f7f8a33eac3e959856c7fddbc464de618701338a4b46f76dbfaf9a1e5262b5f40639771c7", + "The major problem is with sendmail. -Mark Horton", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yThe major problem is wit\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18", + }, + { + "d8c92db5fdf52cf8215e4df3b4909d29203ff4d00e9ad0b64a6a4e04dec5e74f62e7c35c7fb881bd5de95442123df8f57a489b0ae616bd326f84d10021121c57", + "Give me a rock, paper and scissors and I will move the world. CCFestoon", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yGive me a rock, paper and scissors a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00$", + }, + { + "19a9f8dc0a233e464e8566ad3ca9b91e459a7b8c4780985b015776e1bf239a19bc233d0556343e2b0a9bc220900b4ebf4f8bdf89ff8efeaf79602d6849e6f72e", + "If the enemy is within range, then so are you.", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yIf the enemy is within \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17", + }, + { + "00b4c41f307bde87301cdc5b5ab1ae9a592e8ecbb2021dd7bc4b34e2ace60741cc362560bec566ba35178595a91932b8d5357e2c9cec92d393b0fa7831852476", + "It's well we cannot hear the screams/That we create in others' dreams.", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yIt's well we cannot hear the scream\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00#", + }, + { + "91eccc3d5375fd026e4d6787874b1dce201cecd8a27dbded5065728cb2d09c58a3d467bb1faf353bf7ba567e005245d5321b55bc344f7c07b91cb6f26c959be7", + "You remind me of a TV show, but that's all right: I watch it anyway.", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yYou remind me of a TV show, but th\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\"", + }, + { + "fabbbe22180f1f137cfdc9556d2570e775d1ae02a597ded43a72a40f9b485d500043b7be128fb9fcd982b83159a0d99aa855a9e7cc4240c00dc01a9bdf8218d7", + "C is as portable as Stonehedge!!", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yC is as portable\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10", + }, + { + "2ecdec235c1fa4fc2a154d8fba1dddb8a72a1ad73838b51d792331d143f8b96a9f6fcb0f34d7caa351fe6d88771c4f105040e0392f06e0621689d33b2f3ba92e", + "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yEven if I could be Shakespeare, I think I sh\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00,", + }, + { + "7ad681f6f96f82f7abfa7ecc0334e8fa16d3dc1cdc45b60b7af43fe4075d2357c0c1d60e98350f1afb1f2fe7a4d7cd2ad55b88e458e06b73c40b437331f5dab4", + "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction. Lewis-Randall Rule", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yThe fugacity of a constituent in a mixture of gases at a given tem\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00B", + }, + { + "833f9248ab4a3b9e5131f745fda1ffd2dd435b30e965957e78291c7ab73605fd1912b0794e5c233ab0a12d205a39778d19b83515d6a47003f19cdee51d98c7e0", + "How can you write a big system without C++? -Paul Glick", + "sha\aj\t\xe6g\xf3\xbc\xc9\b\xbbg\xae\x85\x84ʧ;l\x1f\x1f\x83٫\xfbA\xbdk[\xe0\xcd\x19\x13~!yHow can you write a big syst\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c", + }, +} + +func testHash(t *testing.T, name, in, outHex string, oneShotResult []byte, digestFunc hash.Hash) { + if calculated := hex.EncodeToString(oneShotResult); calculated != outHex { + t.Errorf("one-shot result for %s(%q) = %q, but expected %q", name, in, calculated, outHex) + return + } + + for pass := 0; pass < 3; pass++ { + if pass < 2 { + io.WriteString(digestFunc, in) + } else { + io.WriteString(digestFunc, in[:len(in)/2]) + digestFunc.Sum(nil) + io.WriteString(digestFunc, in[len(in)/2:]) + } + + if calculated := hex.EncodeToString(digestFunc.Sum(nil)); calculated != outHex { + t.Errorf("%s(%q) = %q (in pass #%d), but expected %q", name, in, calculated, pass, outHex) + } + digestFunc.Reset() + } +} + +func TestGolden(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha512", func(t *testing.T) { + testGolden(t) + }) +} + +func testGolden(t *testing.T) { + tests := []struct { + name string + oneShotHash func(in []byte) []byte + digest hash.Hash + golden []sha512Test + }{ + { + "SHA512/224", + func(in []byte) []byte { a := Sum512_224(in); return a[:] }, + New512_224(), + golden224, + }, + { + "SHA512/256", + func(in []byte) []byte { a := Sum512_256(in); return a[:] }, + New512_256(), + golden256, + }, + { + "SHA384", + func(in []byte) []byte { a := Sum384(in); return a[:] }, + New384(), + golden384, + }, + { + "SHA512", + func(in []byte) []byte { a := Sum512(in); return a[:] }, + New(), + golden512, + }, + } + for _, tt := range tests { + for _, test := range tt.golden { + in := []byte(test.in) + testHash(t, tt.name, test.in, test.out, tt.oneShotHash(in), tt.digest) + } + } +} + +func TestGoldenMarshal(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha512", func(t *testing.T) { + testGoldenMarshal(t) + }) +} + +func testGoldenMarshal(t *testing.T) { + tests := []struct { + name string + newHash func() hash.Hash + golden []sha512Test + }{ + {"512/224", New512_224, golden224}, + {"512/256", New512_256, golden256}, + {"384", New384, golden384}, + {"512", New, golden512}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + for _, test := range tt.golden { + h := tt.newHash() + h2 := tt.newHash() + + io.WriteString(h, test.in[:len(test.in)/2]) + + state, err := h.(encoding.BinaryMarshaler).MarshalBinary() + if err != nil { + t.Errorf("could not marshal: %v", err) + return + } + + stateAppend, err := h.(encoding.BinaryAppender).AppendBinary(make([]byte, 4, 32)) + if err != nil { + t.Errorf("could not marshal: %v", err) + return + } + stateAppend = stateAppend[4:] + + if string(state) != test.halfState { + t.Errorf("New%s(%q) state = %q, want %q", tt.name, test.in, state, test.halfState) + continue + } + + if string(stateAppend) != test.halfState { + t.Errorf("New%s(%q) stateAppend = %q, want %q", tt.name, test.in, stateAppend, test.halfState) + continue + } + + if err := h2.(encoding.BinaryUnmarshaler).UnmarshalBinary(state); err != nil { + t.Errorf("could not unmarshal: %v", err) + return + } + + io.WriteString(h, test.in[len(test.in)/2:]) + io.WriteString(h2, test.in[len(test.in)/2:]) + + if actual, actual2 := h.Sum(nil), h2.Sum(nil); !bytes.Equal(actual, actual2) { + t.Errorf("New%s(%q) = 0x%x != marshaled 0x%x", tt.name, test.in, actual, actual2) + } + } + }) + } +} + +func TestMarshalMismatch(t *testing.T) { + h := []func() hash.Hash{ + New, + New384, + New512_224, + New512_256, + } + + for i, fn1 := range h { + for j, fn2 := range h { + if i == j { + continue + } + + h1 := fn1() + h2 := fn2() + + state, err := h1.(encoding.BinaryMarshaler).MarshalBinary() + if err != nil { + t.Errorf("i=%d: could not marshal: %v", i, err) + continue + } + + if err := h2.(encoding.BinaryUnmarshaler).UnmarshalBinary(state); err == nil { + t.Errorf("i=%d, j=%d: got no error, expected one: %v", i, j, err) + } + } + } +} + +func TestSize(t *testing.T) { + c := New() + if got := c.Size(); got != Size { + t.Errorf("Size = %d; want %d", got, Size) + } + c = New384() + if got := c.Size(); got != Size384 { + t.Errorf("New384.Size = %d; want %d", got, Size384) + } + c = New512_224() + if got := c.Size(); got != Size224 { + t.Errorf("New512224.Size = %d; want %d", got, Size224) + } + c = New512_256() + if got := c.Size(); got != Size256 { + t.Errorf("New512256.Size = %d; want %d", got, Size256) + } +} + +func TestBlockSize(t *testing.T) { + c := New() + if got := c.BlockSize(); got != BlockSize { + t.Errorf("BlockSize = %d; want %d", got, BlockSize) + } +} + +// Tests for unmarshaling hashes that have hashed a large amount of data +// The initial hash generation is omitted from the test, because it takes a long time. +// The test contains some already-generated states, and their expected sums +// Tests a problem that is outlined in GitHub issue #29541 +// The problem is triggered when an amount of data has been hashed for which +// the data length has a 1 in the 32nd bit. When casted to int, this changes +// the sign of the value, and causes the modulus operation to return a +// different result. +type unmarshalTest struct { + state string + sum string +} + +var largeUnmarshalTests = []unmarshalTest{ + // Data length: 6_565_544_823 + { + state: "sha\aηe\x0f\x0f\xe1r]#\aoJ!.{5B\xe4\x140\x91\xdd\x00a\xe1\xb3E&\xb9\xbb\aJ\x9f^\x9f\x03ͺD\x96H\x80\xb0X\x9d\xdeʸ\f\xf7:\xd5\xe6'\xb9\x93f\xddA\xf0~\xe1\x02\x14\x00\x01\x02\x03\x04\x05\x06\a\b\t\n\v\f\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuv\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x87VCw", + sum: "12d612357a1dbc74a28883dff79b83e7d2b881ae40d7a67fd7305490bc8a641cd1ce9ece598192080d6e9ac7e75d5988567a58a9812991299eb99a04ecb69523", + }, + { + state: "sha\a2\xd2\xdc\xf5\xd7\xe2\xf9\x97\xaa\xe7}Fϱ\xbc\x8e\xbf\x12h\x83Z\xa1\xc7\xf5p>bfS T\xea\xee\x1e\xa6Z\x9c\xa4ڶ\u0086\bn\xe47\x8fsGs3\xe0\xda\\\x9dqZ\xa5\xf6\xd0kM\xa1\xf2\x00\x01\x02\x03\x04\x05\x06\a\b\t\n\v\f\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuv\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xa7VCw", + sum: "94a04b9a901254cd94ca0313557e4be3ab1ca86e920c1f3efdc22d361e9ae12be66bc6d6dc5db79a0a4aa6eca6f293c1e9095bbae127ae405f6c325478343299", + }, +} + +func safeSum(h hash.Hash) (sum []byte, err error) { + defer func() { + if r := recover(); r != nil { + err = fmt.Errorf("sum panic: %v", r) + } + }() + + return h.Sum(nil), nil +} + +func TestLargeHashes(t *testing.T) { + for i, test := range largeUnmarshalTests { + + h := New() + if err := h.(encoding.BinaryUnmarshaler).UnmarshalBinary([]byte(test.state)); err != nil { + t.Errorf("test %d could not unmarshal: %v", i, err) + continue + } + + sum, err := safeSum(h) + if err != nil { + t.Errorf("test %d could not sum: %v", i, err) + continue + } + + if fmt.Sprintf("%x", sum) != test.sum { + t.Errorf("test %d sum mismatch: expect %s got %x", i, test.sum, sum) + } + } +} + +func TestAllocations(t *testing.T) { + cryptotest.SkipTestAllocations(t) + if n := testing.AllocsPerRun(10, func() { + in := []byte("hello, world!") + out := make([]byte, 0, Size) + + { + h := New() + h.Reset() + h.Write(in) + out = h.Sum(out[:0]) + } + { + h := New512_224() + h.Reset() + h.Write(in) + out = h.Sum(out[:0]) + } + { + h := New512_256() + h.Reset() + h.Write(in) + out = h.Sum(out[:0]) + } + { + h := New384() + h.Reset() + h.Write(in) + out = h.Sum(out[:0]) + } + + Sum512(in) + Sum384(in) + Sum512_224(in) + Sum512_256(in) + }); n > 0 { + t.Errorf("allocs = %v, want 0", n) + } +} + +func TestHash(t *testing.T) { + t.Run("SHA-384", func(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha512", func(t *testing.T) { + cryptotest.TestHash(t, New384) + }) + }) + t.Run("SHA-512/224", func(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha512", func(t *testing.T) { + cryptotest.TestHash(t, New512_224) + }) + }) + t.Run("SHA-512/256", func(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha512", func(t *testing.T) { + cryptotest.TestHash(t, New512_256) + }) + }) + t.Run("SHA-512", func(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha512", func(t *testing.T) { + cryptotest.TestHash(t, New) + }) + }) +} + +func TestExtraMethods(t *testing.T) { + t.Run("SHA-384", func(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha512", func(t *testing.T) { + h := maybeCloner(New384()) + cryptotest.NoExtraMethods(t, h, "MarshalBinary", "UnmarshalBinary", "AppendBinary") + }) + }) + t.Run("SHA-512/224", func(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha512", func(t *testing.T) { + h := maybeCloner(New512_224()) + cryptotest.NoExtraMethods(t, h, "MarshalBinary", "UnmarshalBinary", "AppendBinary") + }) + }) + t.Run("SHA-512/256", func(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha512", func(t *testing.T) { + h := maybeCloner(New512_256()) + cryptotest.NoExtraMethods(t, h, "MarshalBinary", "UnmarshalBinary", "AppendBinary") + }) + }) + t.Run("SHA-512", func(t *testing.T) { + cryptotest.TestAllImplementations(t, "sha512", func(t *testing.T) { + h := maybeCloner(New()) + cryptotest.NoExtraMethods(t, h, "MarshalBinary", "UnmarshalBinary", "AppendBinary") + }) + }) +} + +func maybeCloner(h hash.Hash) any { + if c, ok := h.(hash.Cloner); ok { + return &c + } + return &h +} + +var bench = New() +var buf = make([]byte, 8192) + +func benchmarkSize(b *testing.B, size int) { + sum := make([]byte, bench.Size()) + b.Run("New", func(b *testing.B) { + b.ReportAllocs() + b.SetBytes(int64(size)) + for i := 0; i < b.N; i++ { + bench.Reset() + bench.Write(buf[:size]) + bench.Sum(sum[:0]) + } + }) + b.Run("Sum384", func(b *testing.B) { + b.ReportAllocs() + b.SetBytes(int64(size)) + for i := 0; i < b.N; i++ { + Sum384(buf[:size]) + } + }) + b.Run("Sum512", func(b *testing.B) { + b.ReportAllocs() + b.SetBytes(int64(size)) + for i := 0; i < b.N; i++ { + Sum512(buf[:size]) + } + }) +} + +func BenchmarkHash8Bytes(b *testing.B) { + benchmarkSize(b, 8) +} + +func BenchmarkHash1K(b *testing.B) { + benchmarkSize(b, 1024) +} + +func BenchmarkHash8K(b *testing.B) { + benchmarkSize(b, 8192) +} diff --git a/go/src/crypto/subtle/constant_time.go b/go/src/crypto/subtle/constant_time.go new file mode 100644 index 0000000000000000000000000000000000000000..14c911101b0fb81e39738999b9157bcfa00aa5e4 --- /dev/null +++ b/go/src/crypto/subtle/constant_time.go @@ -0,0 +1,52 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package subtle implements functions that are often useful in cryptographic +// code but require careful thought to use correctly. +package subtle + +import ( + "crypto/internal/constanttime" + "crypto/internal/fips140/subtle" +) + +// These functions are forwarded to crypto/internal/constanttime for intrinsified +// operations, and to crypto/internal/fips140/subtle for byte slice operations. + +// ConstantTimeCompare returns 1 if the two slices, x and y, have equal contents +// and 0 otherwise. The time taken is a function of the length of the slices and +// is independent of the contents. If the lengths of x and y do not match it +// returns 0 immediately. +func ConstantTimeCompare(x, y []byte) int { + return subtle.ConstantTimeCompare(x, y) +} + +// ConstantTimeSelect returns x if v == 1 and y if v == 0. +// Its behavior is undefined if v takes any other value. +func ConstantTimeSelect(v, x, y int) int { + return constanttime.Select(v, x, y) +} + +// ConstantTimeByteEq returns 1 if x == y and 0 otherwise. +func ConstantTimeByteEq(x, y uint8) int { + return constanttime.ByteEq(x, y) +} + +// ConstantTimeEq returns 1 if x == y and 0 otherwise. +func ConstantTimeEq(x, y int32) int { + return constanttime.Eq(x, y) +} + +// ConstantTimeCopy copies the contents of y into x (a slice of equal length) +// if v == 1. If v == 0, x is left unchanged. Its behavior is undefined if v +// takes any other value. +func ConstantTimeCopy(v int, x, y []byte) { + subtle.ConstantTimeCopy(v, x, y) +} + +// ConstantTimeLessOrEq returns 1 if x <= y and 0 otherwise. +// Its behavior is undefined if x or y are negative or > 2**31 - 1. +func ConstantTimeLessOrEq(x, y int) int { + return constanttime.LessOrEq(x, y) +} diff --git a/go/src/crypto/subtle/constant_time_test.go b/go/src/crypto/subtle/constant_time_test.go new file mode 100644 index 0000000000000000000000000000000000000000..9db1140134fe23d2ed69843bcbdd255f1005c13b --- /dev/null +++ b/go/src/crypto/subtle/constant_time_test.go @@ -0,0 +1,170 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package subtle + +import ( + "testing" + "testing/quick" +) + +type TestConstantTimeCompareStruct struct { + a, b []byte + out int +} + +var testConstantTimeCompareData = []TestConstantTimeCompareStruct{ + {[]byte{}, []byte{}, 1}, + {[]byte{0x11}, []byte{0x11}, 1}, + {[]byte{0x12}, []byte{0x11}, 0}, + {[]byte{0x11}, []byte{0x11, 0x12}, 0}, + {[]byte{0x11, 0x12}, []byte{0x11}, 0}, +} + +func TestConstantTimeCompare(t *testing.T) { + for i, test := range testConstantTimeCompareData { + if r := ConstantTimeCompare(test.a, test.b); r != test.out { + t.Errorf("#%d bad result (got %x, want %x)", i, r, test.out) + } + } +} + +type TestConstantTimeByteEqStruct struct { + a, b uint8 + out int +} + +var testConstandTimeByteEqData = []TestConstantTimeByteEqStruct{ + {0, 0, 1}, + {0, 1, 0}, + {1, 0, 0}, + {0xff, 0xff, 1}, + {0xff, 0xfe, 0}, +} + +func byteEq(a, b uint8) int { + if a == b { + return 1 + } + return 0 +} + +func TestConstantTimeByteEq(t *testing.T) { + for i, test := range testConstandTimeByteEqData { + if r := ConstantTimeByteEq(test.a, test.b); r != test.out { + t.Errorf("#%d bad result (got %x, want %x)", i, r, test.out) + } + } + err := quick.CheckEqual(ConstantTimeByteEq, byteEq, nil) + if err != nil { + t.Error(err) + } +} + +func eq(a, b int32) int { + if a == b { + return 1 + } + return 0 +} + +func TestConstantTimeEq(t *testing.T) { + err := quick.CheckEqual(ConstantTimeEq, eq, nil) + if err != nil { + t.Error(err) + } +} + +func makeCopy(v int, x, y []byte) []byte { + if len(x) > len(y) { + x = x[:len(y)] + } else { + y = y[:len(x)] + } + if v == 1 { + copy(x, y) + } + return x +} + +func constantTimeCopyWrapper(v int, x, y []byte) []byte { + if len(x) > len(y) { + x = x[:len(y)] + } else { + y = y[:len(x)] + } + v &= 1 + ConstantTimeCopy(v, x, y) + return x +} + +func TestConstantTimeCopy(t *testing.T) { + err := quick.CheckEqual(constantTimeCopyWrapper, makeCopy, nil) + if err != nil { + t.Error(err) + } +} + +var lessOrEqTests = []struct { + x, y, result int +}{ + {0, 0, 1}, + {1, 0, 0}, + {0, 1, 1}, + {10, 20, 1}, + {20, 10, 0}, + {10, 10, 1}, +} + +func TestConstantTimeLessOrEq(t *testing.T) { + for i, test := range lessOrEqTests { + result := ConstantTimeLessOrEq(test.x, test.y) + if result != test.result { + t.Errorf("#%d: %d <= %d gave %d, expected %d", i, test.x, test.y, result, test.result) + } + } +} + +var benchmarkGlobal uint8 + +func BenchmarkConstantTimeSelect(b *testing.B) { + x := int(benchmarkGlobal) + var y, z int + + for range b.N { + y, z, x = ConstantTimeSelect(x, y, z), y, z + } + + benchmarkGlobal = uint8(x) +} + +func BenchmarkConstantTimeByteEq(b *testing.B) { + var x, y uint8 + + for i := 0; i < b.N; i++ { + x, y = uint8(ConstantTimeByteEq(x, y)), x + } + + benchmarkGlobal = x +} + +func BenchmarkConstantTimeEq(b *testing.B) { + var x, y int + + for i := 0; i < b.N; i++ { + x, y = ConstantTimeEq(int32(x), int32(y)), x + } + + benchmarkGlobal = uint8(x) +} + +func BenchmarkConstantTimeLessOrEq(b *testing.B) { + var x, y int + + for i := 0; i < b.N; i++ { + x, y = ConstantTimeLessOrEq(x, y), x + } + + benchmarkGlobal = uint8(x) +} diff --git a/go/src/crypto/subtle/dit.go b/go/src/crypto/subtle/dit.go new file mode 100644 index 0000000000000000000000000000000000000000..733261c3b09d2f99c7d85af19ec812d75bd27f5c --- /dev/null +++ b/go/src/crypto/subtle/dit.go @@ -0,0 +1,63 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package subtle + +import ( + "internal/runtime/sys" + _ "unsafe" +) + +// WithDataIndependentTiming enables architecture specific features which ensure +// that the timing of specific instructions is independent of their inputs +// before executing f. On f returning it disables these features. +// +// Any goroutine spawned by f will also have data independent timing enabled for +// its lifetime, as well as any of their descendant goroutines. +// +// Any C code called via cgo from within f, or from a goroutine spawned by f, will +// also have data independent timing enabled for the duration of the call. If the +// C code disables data independent timing, it will be re-enabled on return to Go. +// +// If C code called via cgo, from f or elsewhere, enables or disables data +// independent timing then calling into Go will preserve that state for the +// duration of the call. +// +// WithDataIndependentTiming should only be used when f is written to make use +// of constant-time operations. WithDataIndependentTiming does not make +// variable-time code constant-time. +// +// Calls to WithDataIndependentTiming may be nested. +// +// On Arm64 processors with FEAT_DIT, WithDataIndependentTiming enables +// PSTATE.DIT. See https://developer.arm.com/documentation/ka005181/1-0/?lang=en. +// +// Currently, on all other architectures WithDataIndependentTiming executes f immediately +// with no other side-effects. +// +//go:noinline +func WithDataIndependentTiming(f func()) { + if !sys.DITSupported { + f() + return + } + + alreadyEnabled := setDITEnabled() + + // disableDIT is called in a deferred function so that if f panics we will + // still disable DIT, in case the panic is recovered further up the stack. + defer func() { + if !alreadyEnabled { + setDITDisabled() + } + }() + + f() +} + +//go:linkname setDITEnabled +func setDITEnabled() bool + +//go:linkname setDITDisabled +func setDITDisabled() diff --git a/go/src/crypto/subtle/dit_test.go b/go/src/crypto/subtle/dit_test.go new file mode 100644 index 0000000000000000000000000000000000000000..952a18db1f66cd3b0a4bd53cf49e070dbf1fde57 --- /dev/null +++ b/go/src/crypto/subtle/dit_test.go @@ -0,0 +1,87 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package subtle + +import ( + "internal/cpu" + "internal/runtime/sys" + "testing" +) + +func TestWithDataIndependentTiming(t *testing.T) { + if !cpu.ARM64.HasDIT { + t.Skip("CPU does not support DIT") + } + + ditAlreadyEnabled := sys.DITEnabled() + + WithDataIndependentTiming(func() { + if !sys.DITEnabled() { + t.Fatal("dit not enabled within WithDataIndependentTiming closure") + } + + WithDataIndependentTiming(func() { + if !sys.DITEnabled() { + t.Fatal("dit not enabled within nested WithDataIndependentTiming closure") + } + }) + + if !sys.DITEnabled() { + t.Fatal("dit not enabled after return from nested WithDataIndependentTiming closure") + } + }) + + if !ditAlreadyEnabled && sys.DITEnabled() { + t.Fatal("dit not unset after returning from WithDataIndependentTiming closure") + } +} + +func TestDITPanic(t *testing.T) { + if !cpu.ARM64.HasDIT { + t.Skip("CPU does not support DIT") + } + + ditAlreadyEnabled := sys.DITEnabled() + + defer func() { + e := recover() + if e == nil { + t.Fatal("didn't panic") + } + if !ditAlreadyEnabled && sys.DITEnabled() { + t.Error("DIT still enabled after panic inside of WithDataIndependentTiming closure") + } + }() + + WithDataIndependentTiming(func() { + if !sys.DITEnabled() { + t.Fatal("dit not enabled within WithDataIndependentTiming closure") + } + + panic("bad") + }) +} + +func TestDITGoroutineInheritance(t *testing.T) { + if !cpu.ARM64.HasDIT { + t.Skip("CPU does not support DIT") + } + + ditAlreadyEnabled := sys.DITEnabled() + + WithDataIndependentTiming(func() { + done := make(chan struct{}) + go func() { + if !sys.DITEnabled() { + t.Error("DIT not enabled in new goroutine") + } + close(done) + }() + <-done + if !ditAlreadyEnabled && !sys.DITEnabled() { + t.Fatal("dit unset after returning from goroutine started in WithDataIndependentTiming closure") + } + }) +} diff --git a/go/src/crypto/subtle/xor.go b/go/src/crypto/subtle/xor.go new file mode 100644 index 0000000000000000000000000000000000000000..26c1c779a647bb4017ac8deff2454ccd8be8992f --- /dev/null +++ b/go/src/crypto/subtle/xor.go @@ -0,0 +1,19 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package subtle + +import "crypto/internal/fips140/subtle" + +// XORBytes sets dst[i] = x[i] ^ y[i] for all i < n = min(len(x), len(y)), +// returning n, the number of bytes written to dst. +// +// If dst does not have length at least n, +// XORBytes panics without writing anything to dst. +// +// dst and x or y may overlap exactly or not at all, +// otherwise XORBytes may panic. +func XORBytes(dst, x, y []byte) int { + return subtle.XORBytes(dst, x, y) +} diff --git a/go/src/crypto/subtle/xor_linux_test.go b/go/src/crypto/subtle/xor_linux_test.go new file mode 100644 index 0000000000000000000000000000000000000000..66c96c710ced5fd4188e2b0c5bf5138f44ccc74f --- /dev/null +++ b/go/src/crypto/subtle/xor_linux_test.go @@ -0,0 +1,46 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package subtle_test + +import ( + "crypto/subtle" + "syscall" + "testing" +) + +// dangerousSlice returns a slice which is immediately +// preceded and followed by a faulting page. +// Copied from the bytes package tests. +func dangerousSlice(t *testing.T) []byte { + pagesize := syscall.Getpagesize() + b, err := syscall.Mmap(0, 0, 3*pagesize, syscall.PROT_READ|syscall.PROT_WRITE, syscall.MAP_ANONYMOUS|syscall.MAP_PRIVATE) + if err != nil { + t.Fatalf("mmap failed %s", err) + } + err = syscall.Mprotect(b[:pagesize], syscall.PROT_NONE) + if err != nil { + t.Fatalf("mprotect low failed %s\n", err) + } + err = syscall.Mprotect(b[2*pagesize:], syscall.PROT_NONE) + if err != nil { + t.Fatalf("mprotect high failed %s\n", err) + } + return b[pagesize : 2*pagesize] +} + +func TestXORBytesBoundary(t *testing.T) { + safe := make([]byte, syscall.Getpagesize()*2) + spicy := dangerousSlice(t) + for i := 1; i <= syscall.Getpagesize(); i++ { + start := spicy[:i] + end := spicy[len(spicy)-i:] + subtle.XORBytes(end, safe, safe[:i]) + subtle.XORBytes(start, safe, safe[:i]) + subtle.XORBytes(safe, start, safe) + subtle.XORBytes(safe, end, safe) + subtle.XORBytes(safe, safe, start) + subtle.XORBytes(safe, safe, end) + } +} diff --git a/go/src/crypto/subtle/xor_test.go b/go/src/crypto/subtle/xor_test.go new file mode 100644 index 0000000000000000000000000000000000000000..855e54d82bb26f68159fe0e2be7282da8fa985e1 --- /dev/null +++ b/go/src/crypto/subtle/xor_test.go @@ -0,0 +1,144 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package subtle_test + +import ( + "bytes" + "crypto/rand" + . "crypto/subtle" + "fmt" + "testing" +) + +func TestXORBytes(t *testing.T) { + for n := 1; n <= 1024; n++ { + if n > 16 && testing.Short() { + n += n >> 3 + } + for alignP := 0; alignP < 8; alignP++ { + for alignQ := 0; alignQ < 8; alignQ++ { + for alignD := 0; alignD < 8; alignD++ { + p := make([]byte, alignP+n, alignP+n+100)[alignP:] + q := make([]byte, alignQ+n, alignQ+n+100)[alignQ:] + if n&1 != 0 { + p = p[:n] + } else { + q = q[:n] + } + rand.Read(p) + rand.Read(q) + + d := make([]byte, alignD+n+100) + rand.Read(d) + + want := bytes.Clone(d) + for i := range n { + want[alignD+i] = p[i] ^ q[i] + } + + if nn := XORBytes(d[alignD:], p, q); !bytes.Equal(d, want) { + t.Errorf("n=%d alignP=%d alignQ=%d alignD=%d:\n\tp = %x\n\tq = %x\n\td = %x\n\twant %x\n", n, alignP, alignQ, alignD, p, q, d, want) + } else if nn != n { + t.Errorf("n=%d alignP=%d alignQ=%d alignD=%d: got %d, want %d", n, alignP, alignQ, alignD, nn, n) + } + p1 := bytes.Clone(p) + if nn := XORBytes(p, p, q); !bytes.Equal(p, want[alignD:alignD+n]) { + t.Errorf("n=%d alignP=%d alignQ=%d alignD=%d:\n\tp = %x\n\tq = %x\n\td = %x\n\twant %x\n", n, alignP, alignQ, alignD, p, q, d, want) + } else if nn != n { + t.Errorf("n=%d alignP=%d alignQ=%d alignD=%d: got %d, want %d", n, alignP, alignQ, alignD, nn, n) + } + if nn := XORBytes(q, p1, q); !bytes.Equal(q, want[alignD:alignD+n]) { + t.Errorf("n=%d alignP=%d alignQ=%d alignD=%d:\n\tp = %x\n\tq = %x\n\td = %x\n\twant %x\n", n, alignP, alignQ, alignD, p, q, d, want) + } else if nn != n { + t.Errorf("n=%d alignP=%d alignQ=%d alignD=%d: got %d, want %d", n, alignP, alignQ, alignD, nn, n) + } + + if nn := XORBytes(p, p, p); !bytes.Equal(p, make([]byte, n)) { + t.Errorf("n=%d alignP=%d alignQ=%d alignD=%d: got %x, want %x", n, alignP, alignQ, alignD, p, make([]byte, n)) + } else if nn != n { + t.Errorf("n=%d alignP=%d alignQ=%d alignD=%d: got %d, want %d", n, alignP, alignQ, alignD, nn, n) + } + if nn := XORBytes(p1, q, q); !bytes.Equal(p1, make([]byte, n)) { + t.Errorf("n=%d alignP=%d alignQ=%d alignD=%d: got %x, want %x", n, alignP, alignQ, alignD, p1, make([]byte, n)) + } else if nn != n { + t.Errorf("n=%d alignP=%d alignQ=%d alignD=%d: got %d, want %d", n, alignP, alignQ, alignD, nn, n) + } + } + } + } + } +} + +func TestXorBytesPanic(t *testing.T) { + mustPanic(t, "subtle.XORBytes: dst too short", func() { + XORBytes(nil, make([]byte, 1), make([]byte, 1)) + }) + mustPanic(t, "subtle.XORBytes: dst too short", func() { + XORBytes(make([]byte, 1), make([]byte, 2), make([]byte, 3)) + }) + mustPanic(t, "subtle.XORBytes: invalid overlap", func() { + x := make([]byte, 3) + XORBytes(x, x[1:], make([]byte, 2)) + }) + mustPanic(t, "subtle.XORBytes: invalid overlap", func() { + x := make([]byte, 3) + XORBytes(x, make([]byte, 2), x[1:]) + }) +} + +func BenchmarkXORBytes(b *testing.B) { + dst := make([]byte, 1<<15) + data0 := make([]byte, 1<<15) + data1 := make([]byte, 1<<15) + sizes := []int64{1 << 3, 1 << 7, 1 << 11, 1 << 13, 1 << 15} + for _, size := range sizes { + b.Run(fmt.Sprintf("%dBytes", size), func(b *testing.B) { + s0 := data0[:size] + s1 := data1[:size] + b.SetBytes(int64(size)) + for i := 0; i < b.N; i++ { + XORBytes(dst, s0, s1) + } + }) + } +} + +func BenchmarkXORBytesAlignment(b *testing.B) { + dst := make([]byte, 8+1<<11) + data0 := make([]byte, 8+1<<11) + data1 := make([]byte, 8+1<<11) + sizes := []int64{1 << 3, 1 << 7, 1 << 11} + for _, size := range sizes { + for offset := int64(0); offset < 8; offset++ { + b.Run(fmt.Sprintf("%dBytes%dOffset", size, offset), func(b *testing.B) { + d := dst[offset : offset+size] + s0 := data0[offset : offset+size] + s1 := data1[offset : offset+size] + b.SetBytes(int64(size)) + for i := 0; i < b.N; i++ { + XORBytes(d, s0, s1) + } + }) + } + } +} + +func mustPanic(t *testing.T, expected string, f func()) { + t.Helper() + defer func() { + t.Helper() + switch msg := recover().(type) { + case nil: + t.Errorf("expected panic(%q), but did not panic", expected) + case string: + if msg != expected { + t.Errorf("expected panic(%q), but got panic(%q)", expected, msg) + } + default: + t.Errorf("expected panic(%q), but got panic(%T%v)", expected, msg, msg) + } + }() + f() +} diff --git a/go/src/crypto/tls/alert.go b/go/src/crypto/tls/alert.go new file mode 100644 index 0000000000000000000000000000000000000000..2301c0673d83878ef0b3bf209108a00d35ece28e --- /dev/null +++ b/go/src/crypto/tls/alert.go @@ -0,0 +1,111 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import "strconv" + +// An AlertError is a TLS alert. +// +// When using a QUIC transport, QUICConn methods will return an error +// which wraps AlertError rather than sending a TLS alert. +type AlertError uint8 + +func (e AlertError) Error() string { + return alert(e).String() +} + +type alert uint8 + +const ( + // alert level + alertLevelWarning = 1 + alertLevelError = 2 +) + +const ( + alertCloseNotify alert = 0 + alertUnexpectedMessage alert = 10 + alertBadRecordMAC alert = 20 + alertDecryptionFailed alert = 21 + alertRecordOverflow alert = 22 + alertDecompressionFailure alert = 30 + alertHandshakeFailure alert = 40 + alertBadCertificate alert = 42 + alertUnsupportedCertificate alert = 43 + alertCertificateRevoked alert = 44 + alertCertificateExpired alert = 45 + alertCertificateUnknown alert = 46 + alertIllegalParameter alert = 47 + alertUnknownCA alert = 48 + alertAccessDenied alert = 49 + alertDecodeError alert = 50 + alertDecryptError alert = 51 + alertExportRestriction alert = 60 + alertProtocolVersion alert = 70 + alertInsufficientSecurity alert = 71 + alertInternalError alert = 80 + alertInappropriateFallback alert = 86 + alertUserCanceled alert = 90 + alertNoRenegotiation alert = 100 + alertMissingExtension alert = 109 + alertUnsupportedExtension alert = 110 + alertCertificateUnobtainable alert = 111 + alertUnrecognizedName alert = 112 + alertBadCertificateStatusResponse alert = 113 + alertBadCertificateHashValue alert = 114 + alertUnknownPSKIdentity alert = 115 + alertCertificateRequired alert = 116 + alertNoApplicationProtocol alert = 120 + alertECHRequired alert = 121 +) + +var alertText = map[alert]string{ + alertCloseNotify: "close notify", + alertUnexpectedMessage: "unexpected message", + alertBadRecordMAC: "bad record MAC", + alertDecryptionFailed: "decryption failed", + alertRecordOverflow: "record overflow", + alertDecompressionFailure: "decompression failure", + alertHandshakeFailure: "handshake failure", + alertBadCertificate: "bad certificate", + alertUnsupportedCertificate: "unsupported certificate", + alertCertificateRevoked: "revoked certificate", + alertCertificateExpired: "expired certificate", + alertCertificateUnknown: "unknown certificate", + alertIllegalParameter: "illegal parameter", + alertUnknownCA: "unknown certificate authority", + alertAccessDenied: "access denied", + alertDecodeError: "error decoding message", + alertDecryptError: "error decrypting message", + alertExportRestriction: "export restriction", + alertProtocolVersion: "protocol version not supported", + alertInsufficientSecurity: "insufficient security level", + alertInternalError: "internal error", + alertInappropriateFallback: "inappropriate fallback", + alertUserCanceled: "user canceled", + alertNoRenegotiation: "no renegotiation", + alertMissingExtension: "missing extension", + alertUnsupportedExtension: "unsupported extension", + alertCertificateUnobtainable: "certificate unobtainable", + alertUnrecognizedName: "unrecognized name", + alertBadCertificateStatusResponse: "bad certificate status response", + alertBadCertificateHashValue: "bad certificate hash value", + alertUnknownPSKIdentity: "unknown PSK identity", + alertCertificateRequired: "certificate required", + alertNoApplicationProtocol: "no application protocol", + alertECHRequired: "encrypted client hello required", +} + +func (e alert) String() string { + s, ok := alertText[e] + if ok { + return "tls: " + s + } + return "tls: alert(" + strconv.Itoa(int(e)) + ")" +} + +func (e alert) Error() string { + return e.String() +} diff --git a/go/src/crypto/tls/auth.go b/go/src/crypto/tls/auth.go new file mode 100644 index 0000000000000000000000000000000000000000..1b26dd50ef8c2eb3d5acee78082e5038c1f4dfdc --- /dev/null +++ b/go/src/crypto/tls/auth.go @@ -0,0 +1,309 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "bytes" + "crypto" + "crypto/ecdsa" + "crypto/ed25519" + "crypto/elliptic" + "crypto/rsa" + "errors" + "fmt" + "hash" + "io" + "slices" +) + +// verifyHandshakeSignature verifies a signature against unhashed handshake contents. +func verifyHandshakeSignature(sigType uint8, pubkey crypto.PublicKey, hashFunc crypto.Hash, signed, sig []byte) error { + if hashFunc != directSigning { + h := hashFunc.New() + h.Write(signed) + signed = h.Sum(nil) + } + switch sigType { + case signatureECDSA: + pubKey, ok := pubkey.(*ecdsa.PublicKey) + if !ok { + return fmt.Errorf("expected an ECDSA public key, got %T", pubkey) + } + if !ecdsa.VerifyASN1(pubKey, signed, sig) { + return errors.New("ECDSA verification failure") + } + case signatureEd25519: + pubKey, ok := pubkey.(ed25519.PublicKey) + if !ok { + return fmt.Errorf("expected an Ed25519 public key, got %T", pubkey) + } + if !ed25519.Verify(pubKey, signed, sig) { + return errors.New("Ed25519 verification failure") + } + case signaturePKCS1v15: + pubKey, ok := pubkey.(*rsa.PublicKey) + if !ok { + return fmt.Errorf("expected an RSA public key, got %T", pubkey) + } + if err := rsa.VerifyPKCS1v15(pubKey, hashFunc, signed, sig); err != nil { + return err + } + case signatureRSAPSS: + pubKey, ok := pubkey.(*rsa.PublicKey) + if !ok { + return fmt.Errorf("expected an RSA public key, got %T", pubkey) + } + signOpts := &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash} + if err := rsa.VerifyPSS(pubKey, hashFunc, signed, sig, signOpts); err != nil { + return err + } + default: + return errors.New("internal error: unknown signature type") + } + return nil +} + +// verifyLegacyHandshakeSignature verifies a TLS 1.0 and 1.1 signature against +// pre-hashed handshake contents. +func verifyLegacyHandshakeSignature(sigType uint8, pubkey crypto.PublicKey, hashFunc crypto.Hash, hashed, sig []byte) error { + switch sigType { + case signatureECDSA: + pubKey, ok := pubkey.(*ecdsa.PublicKey) + if !ok { + return fmt.Errorf("expected an ECDSA public key, got %T", pubkey) + } + if !ecdsa.VerifyASN1(pubKey, hashed, sig) { + return errors.New("ECDSA verification failure") + } + case signaturePKCS1v15: + pubKey, ok := pubkey.(*rsa.PublicKey) + if !ok { + return fmt.Errorf("expected an RSA public key, got %T", pubkey) + } + if err := rsa.VerifyPKCS1v15(pubKey, hashFunc, hashed, sig); err != nil { + return err + } + default: + return errors.New("internal error: unknown signature type") + } + return nil +} + +const ( + serverSignatureContext = "TLS 1.3, server CertificateVerify\x00" + clientSignatureContext = "TLS 1.3, client CertificateVerify\x00" +) + +var signaturePadding = []byte{ + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, +} + +// signedMessage returns the (unhashed) message to be signed by certificate keys +// in TLS 1.3. See RFC 8446, Section 4.4.3. +func signedMessage(context string, transcript hash.Hash) []byte { + const maxSize = 64 /* signaturePadding */ + len(serverSignatureContext) + 512/8 /* SHA-512 */ + b := bytes.NewBuffer(make([]byte, 0, maxSize)) + b.Write(signaturePadding) + io.WriteString(b, context) + b.Write(transcript.Sum(nil)) + return b.Bytes() +} + +// typeAndHashFromSignatureScheme returns the corresponding signature type and +// crypto.Hash for a given TLS SignatureScheme. +func typeAndHashFromSignatureScheme(signatureAlgorithm SignatureScheme) (sigType uint8, hash crypto.Hash, err error) { + switch signatureAlgorithm { + case PKCS1WithSHA1, PKCS1WithSHA256, PKCS1WithSHA384, PKCS1WithSHA512: + sigType = signaturePKCS1v15 + case PSSWithSHA256, PSSWithSHA384, PSSWithSHA512: + sigType = signatureRSAPSS + case ECDSAWithSHA1, ECDSAWithP256AndSHA256, ECDSAWithP384AndSHA384, ECDSAWithP521AndSHA512: + sigType = signatureECDSA + case Ed25519: + sigType = signatureEd25519 + default: + return 0, 0, fmt.Errorf("unsupported signature algorithm: %v", signatureAlgorithm) + } + switch signatureAlgorithm { + case PKCS1WithSHA1, ECDSAWithSHA1: + hash = crypto.SHA1 + case PKCS1WithSHA256, PSSWithSHA256, ECDSAWithP256AndSHA256: + hash = crypto.SHA256 + case PKCS1WithSHA384, PSSWithSHA384, ECDSAWithP384AndSHA384: + hash = crypto.SHA384 + case PKCS1WithSHA512, PSSWithSHA512, ECDSAWithP521AndSHA512: + hash = crypto.SHA512 + case Ed25519: + hash = directSigning + default: + return 0, 0, fmt.Errorf("unsupported signature algorithm: %v", signatureAlgorithm) + } + return sigType, hash, nil +} + +// legacyTypeAndHashFromPublicKey returns the fixed signature type and crypto.Hash for +// a given public key used with TLS 1.0 and 1.1, before the introduction of +// signature algorithm negotiation. +func legacyTypeAndHashFromPublicKey(pub crypto.PublicKey) (sigType uint8, hash crypto.Hash, err error) { + switch pub.(type) { + case *rsa.PublicKey: + return signaturePKCS1v15, crypto.MD5SHA1, nil + case *ecdsa.PublicKey: + return signatureECDSA, crypto.SHA1, nil + case ed25519.PublicKey: + // RFC 8422 specifies support for Ed25519 in TLS 1.0 and 1.1, + // but it requires holding on to a handshake transcript to do a + // full signature, and not even OpenSSL bothers with the + // complexity, so we can't even test it properly. + return 0, 0, fmt.Errorf("tls: Ed25519 public keys are not supported before TLS 1.2") + default: + return 0, 0, fmt.Errorf("tls: unsupported public key: %T", pub) + } +} + +var rsaSignatureSchemes = []struct { + scheme SignatureScheme + minModulusBytes int +}{ + // RSA-PSS is used with PSSSaltLengthEqualsHash, and requires + // emLen >= hLen + sLen + 2 + {PSSWithSHA256, crypto.SHA256.Size()*2 + 2}, + {PSSWithSHA384, crypto.SHA384.Size()*2 + 2}, + {PSSWithSHA512, crypto.SHA512.Size()*2 + 2}, + // PKCS #1 v1.5 uses prefixes from hashPrefixes in crypto/rsa, and requires + // emLen >= len(prefix) + hLen + 11 + {PKCS1WithSHA256, 19 + crypto.SHA256.Size() + 11}, + {PKCS1WithSHA384, 19 + crypto.SHA384.Size() + 11}, + {PKCS1WithSHA512, 19 + crypto.SHA512.Size() + 11}, + {PKCS1WithSHA1, 15 + crypto.SHA1.Size() + 11}, +} + +func signatureSchemesForPublicKey(version uint16, pub crypto.PublicKey) []SignatureScheme { + switch pub := pub.(type) { + case *ecdsa.PublicKey: + if version < VersionTLS13 { + // In TLS 1.2 and earlier, ECDSA algorithms are not + // constrained to a single curve. + return []SignatureScheme{ + ECDSAWithP256AndSHA256, + ECDSAWithP384AndSHA384, + ECDSAWithP521AndSHA512, + ECDSAWithSHA1, + } + } + switch pub.Curve { + case elliptic.P256(): + return []SignatureScheme{ECDSAWithP256AndSHA256} + case elliptic.P384(): + return []SignatureScheme{ECDSAWithP384AndSHA384} + case elliptic.P521(): + return []SignatureScheme{ECDSAWithP521AndSHA512} + default: + return nil + } + case *rsa.PublicKey: + size := pub.Size() + sigAlgs := make([]SignatureScheme, 0, len(rsaSignatureSchemes)) + for _, candidate := range rsaSignatureSchemes { + if size >= candidate.minModulusBytes { + sigAlgs = append(sigAlgs, candidate.scheme) + } + } + return sigAlgs + case ed25519.PublicKey: + return []SignatureScheme{Ed25519} + default: + return nil + } +} + +// selectSignatureScheme picks a SignatureScheme from the peer's preference list +// that works with the selected certificate. It's only called for protocol +// versions that support signature algorithms, so TLS 1.2 and 1.3. +func selectSignatureScheme(vers uint16, c *Certificate, peerAlgs []SignatureScheme) (SignatureScheme, error) { + priv, ok := c.PrivateKey.(crypto.Signer) + if !ok { + return 0, unsupportedCertificateError(c) + } + supportedAlgs := signatureSchemesForPublicKey(vers, priv.Public()) + if c.SupportedSignatureAlgorithms != nil { + supportedAlgs = slices.DeleteFunc(supportedAlgs, func(sigAlg SignatureScheme) bool { + return !isSupportedSignatureAlgorithm(sigAlg, c.SupportedSignatureAlgorithms) + }) + } + // Filter out any unsupported signature algorithms, for example due to + // FIPS 140-3 policy, tlssha1=0, or protocol version. + supportedAlgs = slices.DeleteFunc(supportedAlgs, func(sigAlg SignatureScheme) bool { + return isDisabledSignatureAlgorithm(vers, sigAlg, false) + }) + if len(supportedAlgs) == 0 { + return 0, unsupportedCertificateError(c) + } + if len(peerAlgs) == 0 && vers == VersionTLS12 { + // For TLS 1.2, if the client didn't send signature_algorithms then we + // can assume that it supports SHA1. See RFC 5246, Section 7.4.1.4.1. + // RFC 9155 made signature_algorithms mandatory in TLS 1.2, and we gated + // it behind the tlssha1 GODEBUG setting. + if tlssha1.Value() != "1" { + return 0, errors.New("tls: missing signature_algorithms from TLS 1.2 peer") + } + peerAlgs = []SignatureScheme{PKCS1WithSHA1, ECDSAWithSHA1} + } + // Pick signature scheme in the peer's preference order, as our + // preference order is not configurable. + for _, preferredAlg := range peerAlgs { + if isSupportedSignatureAlgorithm(preferredAlg, supportedAlgs) { + return preferredAlg, nil + } + } + return 0, errors.New("tls: peer doesn't support any of the certificate's signature algorithms") +} + +// unsupportedCertificateError returns a helpful error for certificates with +// an unsupported private key. +func unsupportedCertificateError(cert *Certificate) error { + switch cert.PrivateKey.(type) { + case rsa.PrivateKey, ecdsa.PrivateKey: + return fmt.Errorf("tls: unsupported certificate: private key is %T, expected *%T", + cert.PrivateKey, cert.PrivateKey) + case *ed25519.PrivateKey: + return fmt.Errorf("tls: unsupported certificate: private key is *ed25519.PrivateKey, expected ed25519.PrivateKey") + } + + signer, ok := cert.PrivateKey.(crypto.Signer) + if !ok { + return fmt.Errorf("tls: certificate private key (%T) does not implement crypto.Signer", + cert.PrivateKey) + } + + switch pub := signer.Public().(type) { + case *ecdsa.PublicKey: + switch pub.Curve { + case elliptic.P256(): + case elliptic.P384(): + case elliptic.P521(): + default: + return fmt.Errorf("tls: unsupported certificate curve (%s)", pub.Curve.Params().Name) + } + case *rsa.PublicKey: + return fmt.Errorf("tls: certificate RSA key size too small for supported signature algorithms") + case ed25519.PublicKey: + default: + return fmt.Errorf("tls: unsupported certificate key (%T)", pub) + } + + if cert.SupportedSignatureAlgorithms != nil { + return fmt.Errorf("tls: peer doesn't support the certificate custom signature algorithms") + } + + return fmt.Errorf("tls: internal error: unsupported key (%T)", cert.PrivateKey) +} diff --git a/go/src/crypto/tls/auth_test.go b/go/src/crypto/tls/auth_test.go new file mode 100644 index 0000000000000000000000000000000000000000..727bdc4df76393cf40e2e786433c2a52dddbf82e --- /dev/null +++ b/go/src/crypto/tls/auth_test.go @@ -0,0 +1,188 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "crypto" + "crypto/tls/internal/fips140tls" + "os" + "testing" +) + +func TestSignatureSelection(t *testing.T) { + rsaCert := &Certificate{ + Certificate: [][]byte{testRSACertificate}, + PrivateKey: testRSAPrivateKey, + } + pkcs1Cert := &Certificate{ + Certificate: [][]byte{testRSACertificate}, + PrivateKey: testRSAPrivateKey, + SupportedSignatureAlgorithms: []SignatureScheme{PKCS1WithSHA1, PKCS1WithSHA256}, + } + ecdsaCert := &Certificate{ + Certificate: [][]byte{testP256Certificate}, + PrivateKey: testP256PrivateKey, + } + ed25519Cert := &Certificate{ + Certificate: [][]byte{testEd25519Certificate}, + PrivateKey: testEd25519PrivateKey, + } + + tests := []struct { + cert *Certificate + peerSigAlgs []SignatureScheme + tlsVersion uint16 + godebug string + + expectedSigAlg SignatureScheme + expectedSigType uint8 + expectedHash crypto.Hash + }{ + {rsaCert, []SignatureScheme{PKCS1WithSHA1, PKCS1WithSHA256}, VersionTLS12, "", PKCS1WithSHA256, signaturePKCS1v15, crypto.SHA256}, + {rsaCert, []SignatureScheme{PKCS1WithSHA1, PKCS1WithSHA256}, VersionTLS12, "tlssha1=1", PKCS1WithSHA1, signaturePKCS1v15, crypto.SHA1}, + {rsaCert, []SignatureScheme{PKCS1WithSHA512, PKCS1WithSHA1}, VersionTLS12, "", PKCS1WithSHA512, signaturePKCS1v15, crypto.SHA512}, + {rsaCert, []SignatureScheme{PSSWithSHA256, PKCS1WithSHA256}, VersionTLS12, "", PSSWithSHA256, signatureRSAPSS, crypto.SHA256}, + {pkcs1Cert, []SignatureScheme{PSSWithSHA256, PKCS1WithSHA256}, VersionTLS12, "", PKCS1WithSHA256, signaturePKCS1v15, crypto.SHA256}, + {rsaCert, []SignatureScheme{PSSWithSHA384, PKCS1WithSHA1}, VersionTLS13, "", PSSWithSHA384, signatureRSAPSS, crypto.SHA384}, + {rsaCert, []SignatureScheme{PKCS1WithSHA1, PSSWithSHA384}, VersionTLS13, "", PSSWithSHA384, signatureRSAPSS, crypto.SHA384}, + {ecdsaCert, []SignatureScheme{ECDSAWithSHA1, ECDSAWithP256AndSHA256}, VersionTLS12, "", ECDSAWithP256AndSHA256, signatureECDSA, crypto.SHA256}, + {ecdsaCert, []SignatureScheme{ECDSAWithSHA1}, VersionTLS12, "tlssha1=1", ECDSAWithSHA1, signatureECDSA, crypto.SHA1}, + {ecdsaCert, []SignatureScheme{ECDSAWithP256AndSHA256}, VersionTLS12, "", ECDSAWithP256AndSHA256, signatureECDSA, crypto.SHA256}, + {ecdsaCert, []SignatureScheme{ECDSAWithP256AndSHA256}, VersionTLS13, "", ECDSAWithP256AndSHA256, signatureECDSA, crypto.SHA256}, + {ed25519Cert, []SignatureScheme{Ed25519}, VersionTLS12, "", Ed25519, signatureEd25519, directSigning}, + {ed25519Cert, []SignatureScheme{Ed25519}, VersionTLS13, "", Ed25519, signatureEd25519, directSigning}, + + // TLS 1.2 without signature_algorithms extension + {rsaCert, nil, VersionTLS12, "tlssha1=1", PKCS1WithSHA1, signaturePKCS1v15, crypto.SHA1}, + {ecdsaCert, nil, VersionTLS12, "tlssha1=1", ECDSAWithSHA1, signatureECDSA, crypto.SHA1}, + + // TLS 1.2 does not restrict the ECDSA curve (our ecdsaCert is P-256) + {ecdsaCert, []SignatureScheme{ECDSAWithP384AndSHA384}, VersionTLS12, "", ECDSAWithP384AndSHA384, signatureECDSA, crypto.SHA384}, + } + + for testNo, test := range tests { + if fips140tls.Required() && test.expectedHash == crypto.SHA1 { + t.Logf("skipping test[%d] - not compatible with TLS FIPS mode", testNo) + continue + } + savedGODEBUG := os.Getenv("GODEBUG") + os.Setenv("GODEBUG", savedGODEBUG+","+test.godebug) + + sigAlg, err := selectSignatureScheme(test.tlsVersion, test.cert, test.peerSigAlgs) + if err != nil { + t.Errorf("test[%d]: unexpected selectSignatureScheme error: %v", testNo, err) + } + if test.expectedSigAlg != sigAlg { + t.Errorf("test[%d]: expected signature scheme %v, got %v", testNo, test.expectedSigAlg, sigAlg) + } + sigType, hashFunc, err := typeAndHashFromSignatureScheme(sigAlg) + if err != nil { + t.Errorf("test[%d]: unexpected typeAndHashFromSignatureScheme error: %v", testNo, err) + } + if test.expectedSigType != sigType { + t.Errorf("test[%d]: expected signature algorithm %#x, got %#x", testNo, test.expectedSigType, sigType) + } + if test.expectedHash != hashFunc { + t.Errorf("test[%d]: expected hash function %#x, got %#x", testNo, test.expectedHash, hashFunc) + } + + os.Setenv("GODEBUG", savedGODEBUG) + } + + brokenCert := &Certificate{ + Certificate: [][]byte{testRSACertificate}, + PrivateKey: testRSAPrivateKey, + SupportedSignatureAlgorithms: []SignatureScheme{Ed25519}, + } + + badTests := []struct { + cert *Certificate + peerSigAlgs []SignatureScheme + tlsVersion uint16 + }{ + {rsaCert, []SignatureScheme{ECDSAWithP256AndSHA256, ECDSAWithSHA1}, VersionTLS12}, + {ecdsaCert, []SignatureScheme{PKCS1WithSHA256, PKCS1WithSHA1}, VersionTLS12}, + {rsaCert, []SignatureScheme{0}, VersionTLS12}, + {ed25519Cert, []SignatureScheme{ECDSAWithP256AndSHA256, ECDSAWithSHA1}, VersionTLS12}, + {ecdsaCert, []SignatureScheme{Ed25519}, VersionTLS12}, + {brokenCert, []SignatureScheme{Ed25519}, VersionTLS12}, + {brokenCert, []SignatureScheme{PKCS1WithSHA256}, VersionTLS12}, + // RFC 5246, Section 7.4.1.4.1, says to only consider {sha1,ecdsa} as + // default when the extension is missing, and RFC 8422 does not update + // it. Anyway, if a stack supports Ed25519 it better support sigalgs. + {ed25519Cert, nil, VersionTLS12}, + // TLS 1.3 has no default signature_algorithms. + {rsaCert, nil, VersionTLS13}, + {ecdsaCert, nil, VersionTLS13}, + {ed25519Cert, nil, VersionTLS13}, + // Wrong curve, which TLS 1.3 checks + {ecdsaCert, []SignatureScheme{ECDSAWithP384AndSHA384}, VersionTLS13}, + // TLS 1.3 does not support PKCS1v1.5 or SHA-1. + {rsaCert, []SignatureScheme{PKCS1WithSHA256}, VersionTLS13}, + {pkcs1Cert, []SignatureScheme{PSSWithSHA256, PKCS1WithSHA256}, VersionTLS13}, + {ecdsaCert, []SignatureScheme{ECDSAWithSHA1}, VersionTLS13}, + // The key can be too small for the hash. + {rsaCert, []SignatureScheme{PSSWithSHA512}, VersionTLS12}, + // SHA-1 requires tlssha1=1 + {rsaCert, []SignatureScheme{PKCS1WithSHA1}, VersionTLS12}, + {ecdsaCert, []SignatureScheme{ECDSAWithSHA1}, VersionTLS12}, + {rsaCert, nil, VersionTLS12}, + {ecdsaCert, nil, VersionTLS12}, + } + + for testNo, test := range badTests { + sigAlg, err := selectSignatureScheme(test.tlsVersion, test.cert, test.peerSigAlgs) + if err == nil { + t.Errorf("test[%d]: unexpected success, got %v", testNo, sigAlg) + } + } +} + +func TestLegacyTypeAndHash(t *testing.T) { + sigType, hashFunc, err := legacyTypeAndHashFromPublicKey(testRSAPrivateKey.Public()) + if err != nil { + t.Errorf("RSA: unexpected error: %v", err) + } + if expectedSigType := signaturePKCS1v15; expectedSigType != sigType { + t.Errorf("RSA: expected signature type %#x, got %#x", expectedSigType, sigType) + } + if expectedHashFunc := crypto.MD5SHA1; expectedHashFunc != hashFunc { + t.Errorf("RSA: expected hash %#x, got %#x", expectedHashFunc, hashFunc) + } + + sigType, hashFunc, err = legacyTypeAndHashFromPublicKey(testECDSAPrivateKey.Public()) + if err != nil { + t.Errorf("ECDSA: unexpected error: %v", err) + } + if expectedSigType := signatureECDSA; expectedSigType != sigType { + t.Errorf("ECDSA: expected signature type %#x, got %#x", expectedSigType, sigType) + } + if expectedHashFunc := crypto.SHA1; expectedHashFunc != hashFunc { + t.Errorf("ECDSA: expected hash %#x, got %#x", expectedHashFunc, hashFunc) + } + + // Ed25519 is not supported by TLS 1.0 and 1.1. + _, _, err = legacyTypeAndHashFromPublicKey(testEd25519PrivateKey.Public()) + if err == nil { + t.Errorf("Ed25519: unexpected success") + } +} + +// TestSupportedSignatureAlgorithms checks that all supportedSignatureAlgorithms +// have valid type and hash information. +func TestSupportedSignatureAlgorithms(t *testing.T) { + for _, sigAlg := range supportedSignatureAlgorithms(VersionTLS12) { + sigType, hash, err := typeAndHashFromSignatureScheme(sigAlg) + if err != nil { + t.Errorf("%v: unexpected error: %v", sigAlg, err) + } + if sigType == 0 { + t.Errorf("%v: missing signature type", sigAlg) + } + if hash == 0 && sigAlg != Ed25519 { + t.Errorf("%v: missing hash", sigAlg) + } + } +} diff --git a/go/src/crypto/tls/bogo_config.json b/go/src/crypto/tls/bogo_config.json new file mode 100644 index 0000000000000000000000000000000000000000..a4664d6e6f823e2016d7aece2909859d6c6d8e46 --- /dev/null +++ b/go/src/crypto/tls/bogo_config.json @@ -0,0 +1,229 @@ +{ + "DisabledTests": { + "*-Async": "We don't support boringssl concept of async", + + "TLS-ECH-Client-Reject-NoClientCertificate-TLS12": "We won't attempt to negotiate 1.2 if ECH is enabled", + "TLS-ECH-Client-Reject-TLS12": "We won't attempt to negotiate 1.2 if ECH is enabled", + "TLS-ECH-Client-TLS12-RejectRetryConfigs": "We won't attempt to negotiate 1.2 if ECH is enabled", + "TLS-ECH-Client-Rejected-OverrideName-TLS12": "We won't attempt to negotiate 1.2 if ECH is enabled", + "TLS-ECH-Client-Reject-TLS12-NoFalseStart": "We won't attempt to negotiate 1.2 if ECH is enabled", + "TLS-ECH-Client-TLS12SessionTicket": "We won't attempt to negotiate 1.2 if ECH is enabled", + "TLS-ECH-Client-TLS12SessionID": "We won't attempt to negotiate 1.2 if ECH is enabled, and we don't support session ID resumption", + + "TLS-ECH-Client-Reject-ResumeInnerSession-TLS12": "We won't attempt to negotiate 1.2 if ECH is enabled (we could possibly test this if we had the ability to indicate not to send ECH on resumption?)", + + "TLS-ECH-Client-Reject-EarlyDataRejected": "Go does not support early (0-RTT) data", + + "TLS-ECH-Client-NoNPN": "We don't support NPN", + + "TLS-ECH-Client-ChannelID": "We don't support sending channel ID", + "TLS-ECH-Client-Reject-NoChannelID-TLS13": "We don't support sending channel ID", + "TLS-ECH-Client-Reject-NoChannelID-TLS12": "We don't support sending channel ID", + + "TLS-ECH-Client-GREASE-IgnoreHRRExtension": "We don't support ECH GREASE because we don't fallback to plaintext", + "TLS-ECH-Client-NoSupportedConfigs-GREASE": "We don't support ECH GREASE because we don't fallback to plaintext", + "TLS-ECH-Client-GREASEExtensions": "We don't support ECH GREASE because we don't fallback to plaintext", + "TLS-ECH-Client-GREASE-NoOverrideName": "We don't support ECH GREASE because we don't fallback to plaintext", + + "TLS-ECH-Client-UnsolicitedInnerServerNameAck": "We don't allow sending empty SNI without skipping certificate verification, TODO: could add special flag to bogo to indicate 'empty sni'", + + "TLS-ECH-Client-NoSupportedConfigs": "We don't support fallback to cleartext when there are no valid ECH configs", + "TLS-ECH-Client-SkipInvalidPublicName": "We don't support fallback to cleartext when there are no valid ECH configs", + + "TLS-ECH-Server-EarlyData": "Go does not support early (0-RTT) data", + "TLS-ECH-Server-EarlyDataRejected": "Go does not support early (0-RTT) data", + + "MLKEMKeyShareIncludedSecond": "BoGo wants us to order the key shares based on its preference, but we don't support that", + "MLKEMKeyShareIncludedThird": "BoGo wants us to order the key shares based on its preference, but we don't support that", + "PostQuantumNotEnabledByDefaultInClients": "We do enable it by default!", + "*-Kyber-TLS13": "We don't support Kyber, only ML-KEM (BoGo bug ignoring AllCurves?)", + + "*-RSA_PKCS1_SHA256_LEGACY-TLS13": "We don't support the legacy PKCS#1 v1.5 codepoint for TLS 1.3", + "*-Verify-RSA_PKCS1_SHA256_LEGACY-TLS12": "Likewise, we don't know how to handle it in TLS 1.2, so we send the wrong alert", + "*-VerifyDefault-*": "Our signature algorithms are not configurable, so there is no difference between default and supported", + "Ed25519DefaultDisable-*": "We support Ed25519 by default", + "NoCommonSignatureAlgorithms-TLS12-Fallback": "We don't support the legacy RSA exchange (without tlsrsakex=1)", + + "*_SHA1-TLS12": "We don't support SHA-1 in TLS 1.2 (without tlssha1=1)", + "Agree-Digest-SHA1": "We don't support SHA-1 in TLS 1.2 (without tlssha1=1)", + "ServerAuth-SHA1-Fallback*": "We don't support SHA-1 in TLS 1.2 (without tlssha1=1), so we fail if there are no signature_algorithms", + + "Agree-Digest-SHA256": "We select signature algorithms in peer preference order. We should consider changing this.", + + "V2ClientHello-*": "We don't support SSLv2", + "SendV2ClientHello*": "We don't support SSLv2", + "*QUIC*": "No QUIC support", + "Compliance-fips*": "No FIPS", + "*DTLS*": "No DTLS", + "SendEmptyRecords*": "crypto/tls doesn't implement spam protections", + "SendWarningAlerts*": "crypto/tls doesn't implement spam protections", + "SendUserCanceledAlerts-TooMany-TLS13": "crypto/tls doesn't implement spam protections", + "TooManyKeyUpdates": "crypto/tls doesn't implement spam protections (TODO: I think?)", + "KyberNotEnabledByDefaultInClients": "crypto/tls intentionally enables it", + "JustConfiguringKyberWorks": "we always send a X25519 key share with Kyber", + "KyberKeyShareIncludedSecond": "we always send the Kyber key share first", + "KyberKeyShareIncludedThird": "we always send the Kyber key share first", + "GREASE-Server-TLS13": "We don't send GREASE extensions", + "SendBogusAlertType": "sending wrong alert type", + "*Client-P-224*": "no P-224 support", + "*Server-P-224*": "no P-224 support", + "CurveID-Resume*": "unexposed curveID is not stored in the ticket yet", + "BadRSAClientKeyExchange-4": "crypto/tls doesn't check the version number in the premaster secret - see processClientKeyExchange comment", + "BadRSAClientKeyExchange-5": "crypto/tls doesn't check the version number in the premaster secret - see processClientKeyExchange comment", + "SupportTicketsWithSessionID": "We don't support session ID resumption", + "ResumeTLS12SessionID-TLS13": "We don't support session ID resumption", + "TrustAnchors-*": "We don't support draft-beck-tls-trust-anchor-ids", + "PAKE-Extension-*": "We don't support PAKE", + "*TicketFlags": "We don't support draft-ietf-tls-tlsflags", + + "CheckLeafCurve": "TODO: first pass, this should be fixed", + "KeyUpdate-RequestACK": "TODO: first pass, this should be fixed", + "SupportedVersionSelection-TLS12": "TODO: first pass, this should be fixed", + "UnsolicitedServerNameAck-TLS-TLS1": "TODO: first pass, this should be fixed", + "TicketSessionIDLength-33-TLS-TLS1": "TODO: first pass, this should be fixed", + "UnsolicitedServerNameAck-TLS-TLS11": "TODO: first pass, this should be fixed", + "TicketSessionIDLength-33-TLS-TLS11": "TODO: first pass, this should be fixed", + "UnsolicitedServerNameAck-TLS-TLS12": "TODO: first pass, this should be fixed", + "TicketSessionIDLength-33-TLS-TLS12": "TODO: first pass, this should be fixed", + "UnsolicitedServerNameAck-TLS-TLS13": "TODO: first pass, this should be fixed", + "RenegotiationInfo-Forbidden-TLS13": "TODO: first pass, this should be fixed", + "EMS-Forbidden-TLS13": "TODO: first pass, this should be fixed", + "SendUnsolicitedOCSPOnCertificate-TLS13": "TODO: first pass, this should be fixed", + "SendUnsolicitedSCTOnCertificate-TLS13": "TODO: first pass, this should be fixed", + "SendUnknownExtensionOnCertificate-TLS13": "TODO: first pass, this should be fixed", + "Resume-Server-NoTickets-TLS1-TLS1-TLS": "TODO: first pass, this should be fixed", + "Resume-Server-NoTickets-TLS11-TLS11-TLS": "TODO: first pass, this should be fixed", + "Resume-Server-NoTickets-TLS12-TLS12-TLS": "TODO: first pass, this should be fixed", + "Resume-Server-NoPSKBinder": "TODO: first pass, this should be fixed", + "Resume-Server-PSKBinderFirstExtension": "TODO: first pass, this should be fixed", + "Resume-Server-PSKBinderFirstExtension-SecondBinder": "TODO: first pass, this should be fixed", + "Resume-Server-NoPSKBinder-SecondBinder": "TODO: first pass, this should be fixed", + "Resume-Server-OmitPSKsOnSecondClientHello": "TODO: first pass, this should be fixed", + "Renegotiate-Server-Forbidden": "TODO: first pass, this should be fixed", + "Renegotiate-Client-Forbidden-1": "TODO: first pass, this should be fixed", + "UnknownExtension-Client": "TODO: first pass, this should be fixed", + "UnknownUnencryptedExtension-Client-TLS13": "TODO: first pass, this should be fixed", + "UnofferedExtension-Client-TLS13": "TODO: first pass, this should be fixed", + "UnknownExtension-Client-TLS13": "TODO: first pass, this should be fixed", + "SendClientVersion-RSA": "TODO: first pass, this should be fixed", + "NoCommonCurves": "TODO: first pass, this should be fixed", + "PointFormat-EncryptedExtensions-TLS13": "TODO: first pass, this should be fixed", + "TLS13-SendNoKEMModesWithPSK-Server": "TODO: first pass, this should be fixed", + "TLS13-DuplicateTicketEarlyDataSupport": "TODO: first pass, this should be fixed", + "Basic-Client-NoTicket-TLS-Sync": "TODO: first pass, this should be fixed", + "Basic-Server-RSA-TLS-Sync": "TODO: first pass, this should be fixed", + "Basic-Client-NoTicket-TLS-Sync-SplitHandshakeRecords": "TODO: first pass, this should be fixed", + "Basic-Server-RSA-TLS-Sync-SplitHandshakeRecords": "TODO: first pass, this should be fixed", + "Basic-Client-NoTicket-TLS-Sync-PackHandshake": "TODO: first pass, this should be fixed", + "Basic-Server-RSA-TLS-Sync-PackHandshake": "TODO: first pass, this should be fixed", + "PartialSecondClientHelloAfterFirst": "TODO: first pass, this should be fixed", + "PartialServerHelloWithHelloRetryRequest": "TODO: first pass, this should be fixed", + "TrailingDataWithFinished-Server-TLS1": "TODO: first pass, this should be fixed", + "PartialClientKeyExchangeWithClientHello": "TODO: first pass, this should be fixed", + "TrailingDataWithFinished-Resume-Server-TLS1": "TODO: first pass, this should be fixed", + "TrailingDataWithFinished-Resume-Client-TLS11": "TODO: first pass, this should be fixed", + "TrailingDataWithFinished-Client-TLS1": "TODO: first pass, this should be fixed", + "TrailingDataWithFinished-Client-TLS11": "TODO: first pass, this should be fixed", + "TrailingDataWithFinished-Client-TLS12": "TODO: first pass, this should be fixed", + "TrailingDataWithFinished-Client-TLS13": "TODO: first pass, this should be fixed", + "PartialNewSessionTicketWithServerHelloDone": "TODO: first pass, this should be fixed", + "TrailingDataWithFinished-Server-TLS11": "TODO: first pass, this should be fixed", + "TrailingDataWithFinished-Server-TLS12": "TODO: first pass, this should be fixed", + "TrailingDataWithFinished-Resume-Server-TLS11": "TODO: first pass, this should be fixed", + "TrailingDataWithFinished-Resume-Client-TLS12": "TODO: first pass, this should be fixed", + "TrailingDataWithFinished-Resume-Server-TLS12": "TODO: first pass, this should be fixed", + "TrailingDataWithFinished-Resume-Client-TLS13": "TODO: first pass, this should be fixed", + "TrailingDataWithFinished-Resume-Client-TLS1": "TODO: first pass, this should be fixed", + "TrailingMessageData-ClientHello-TLS": "TODO: first pass, this should be fixed", + "TrailingMessageData-ServerHello-TLS": "TODO: first pass, this should be fixed", + "TrailingMessageData-ServerCertificate-TLS": "TODO: first pass, this should be fixed", + "TrailingMessageData-ServerHelloDone-TLS": "TODO: first pass, this should be fixed", + "TrailingMessageData-ServerKeyExchange-TLS": "TODO: first pass, this should be fixed", + "TrailingMessageData-CertificateRequest-TLS": "TODO: first pass, this should be fixed", + "TrailingMessageData-CertificateVerify-TLS": "TODO: first pass, this should be fixed", + "TrailingMessageData-ServerFinished-TLS": "TODO: first pass, this should be fixed", + "TrailingMessageData-ClientKeyExchange-TLS": "TODO: first pass, this should be fixed", + "TrailingMessageData-TLS13-ClientHello-TLS": "TODO: first pass, this should be fixed", + "TrailingMessageData-ClientFinished-TLS": "TODO: first pass, this should be fixed", + "TrailingMessageData-NewSessionTicket-TLS": "TODO: first pass, this should be fixed", + "TrailingMessageData-ClientCertificate-TLS": "TODO: first pass, this should be fixed", + "TrailingMessageData-TLS13-CertificateRequest-TLS": "TODO: first pass, this should be fixed", + "TrailingMessageData-TLS13-ServerCertificateVerify-TLS": "TODO: first pass, this should be fixed", + "TrailingMessageData-TLS13-EncryptedExtensions-TLS": "TODO: first pass, this should be fixed", + "TrailingMessageData-TLS13-ClientCertificate-TLS": "TODO: first pass, this should be fixed", + "TrailingMessageData-TLS13-ClientCertificateVerify-TLS": "TODO: first pass, this should be fixed", + "TrailingMessageData-TLS13-ServerCertificate-TLS": "TODO: first pass, this should be fixed", + "SkipEarlyData-TLS13": "TODO: first pass, this should be fixed", + "DuplicateKeyShares-TLS13": "TODO: first pass, this should be fixed", + "Server-TooLongSessionID-TLS13": "TODO: first pass, this should be fixed", + "Client-TooLongSessionID": "TODO: first pass, this should be fixed", + "Client-ShortSessionID": "TODO: first pass, this should be fixed", + "TLS12NoSessionID-TLS13": "TODO: first pass, this should be fixed", + "Server-TooLongSessionID-TLS12": "TODO: first pass, this should be fixed", + "EmptyEncryptedExtensions-TLS13": "TODO: first pass, this should be fixed", + "SkipEarlyData-SecondClientHelloEarlyData-TLS13": "TODO: first pass, this should be fixed", + "EncryptedExtensionsWithKeyShare-TLS13": "TODO: first pass, this should be fixed", + "HelloRetryRequest-DuplicateCurve-TLS13": "TODO: first pass, this should be fixed", + "HelloRetryRequest-DuplicateCookie-TLS13": "TODO: first pass, this should be fixed", + "HelloRetryRequest-Unknown-TLS13": "TODO: first pass, this should be fixed", + "SendPostHandshakeChangeCipherSpec-TLS13": "TODO: first pass, this should be fixed", + "ECDSAKeyUsage-Server-TLS12": "TODO: first pass, this should be fixed", + "ECDSAKeyUsage-Server-TLS13": "TODO: first pass, this should be fixed", + "RSAKeyUsage-Client-WantEncipherment-GotEnciphermentTLS1": "TODO: first pass, this should be fixed", + "RSAKeyUsage-Server-WantSignature-GotEncipherment-TLS1": "TODO: first pass, this should be fixed", + "RSAKeyUsage-Client-WantSignature-GotSignature-TLS1": "TODO: first pass, this should be fixed", + "RSAKeyUsage-Client-WantEncipherment-GotEnciphermentTLS11": "TODO: first pass, this should be fixed", + "RSAKeyUsage-Client-WantSignature-GotSignature-TLS11": "TODO: first pass, this should be fixed", + "RSAKeyUsage-Client-WantEncipherment-GotEnciphermentTLS12": "TODO: first pass, this should be fixed", + "RSAKeyUsage-Server-WantSignature-GotEncipherment-TLS12": "TODO: first pass, this should be fixed", + "RSAKeyUsage-Server-WantSignature-GotEncipherment-TLS11": "TODO: first pass, this should be fixed", + "RSAKeyUsage-Client-WantSignature-GotSignature-TLS12": "TODO: first pass, this should be fixed", + "RSAKeyUsage-Client-WantSignature-GotSignature-TLS13": "TODO: first pass, this should be fixed", + "RSAKeyUsage-Server-WantSignature-GotEncipherment-TLS13": "TODO: first pass, this should be fixed", + "EmptyExtensions-ClientHello-TLS1": "TODO: first pass, this should be fixed", + "OmitExtensions-ClientHello-TLS1": "TODO: first pass, this should be fixed", + "EmptyExtensions-ClientHello-TLS12": "TODO: first pass, this should be fixed", + "OmitExtensions-ClientHello-TLS12": "TODO: first pass, this should be fixed", + "EmptyExtensions-ClientHello-TLS11": "TODO: first pass, this should be fixed", + "OmitExtensions-ClientHello-TLS11": "TODO: first pass, this should be fixed", + "DuplicateCertCompressionExt-TLS12": "TODO: first pass, this should be fixed", + "DuplicateCertCompressionExt-TLS13": "TODO: first pass, this should be fixed", + "Client-RejectJDK11DowngradeRandom": "TODO: first pass, this should be fixed", + "CheckClientCertificateTypes": "TODO: first pass, this should be fixed", + "CheckECDSACurve-TLS12": "TODO: first pass, this should be fixed", + "ALPNClient-RejectUnknown-TLS-TLS1": "TODO: first pass, this should be fixed", + "ALPNClient-RejectUnknown-TLS-TLS11": "TODO: first pass, this should be fixed", + "ALPNClient-RejectUnknown-TLS-TLS12": "TODO: first pass, this should be fixed", + "ALPNClient-RejectUnknown-TLS-TLS13": "TODO: first pass, this should be fixed", + "ClientHelloPadding": "TODO: first pass, this should be fixed", + "TLS13-ExpectTicketEarlyDataSupport": "TODO: first pass, this should be fixed", + "TLS13-EarlyData-TooMuchData-Client-TLS-Sync": "TODO: first pass, this should be fixed", + "TLS13-EarlyData-TooMuchData-Client-TLS-Sync-SplitHandshakeRecords": "TODO: first pass, this should be fixed", + "TLS13-EarlyData-TooMuchData-Client-TLS-Sync-PackHandshake": "TODO: first pass, this should be fixed", + "WrongMessageType-TLS13-EndOfEarlyData-TLS": "TODO: first pass, this should be fixed", + "TrailingMessageData-TLS13-EndOfEarlyData-TLS": "TODO: first pass, this should be fixed", + "SendHelloRetryRequest-2-TLS13": "TODO: first pass, this should be fixed", + "EarlyData-SkipEndOfEarlyData-TLS13": "TODO: first pass, this should be fixed", + "EarlyData-Server-BadFinished-TLS13": "TODO: first pass, this should be fixed", + "EarlyData-UnexpectedHandshake-Server-TLS13": "TODO: first pass, this should be fixed", + "EarlyData-CipherMismatch-Client-TLS13": "TODO: first pass, this should be fixed", + + "Resume-Server-UnofferedCipher-TLS13": "TODO: first pass, this should be fixed", + "GarbageCertificate-Server-TLS13": "TODO: 2025/06 BoGo update, should be fixed", + "WrongMessageType-TLS13-ClientCertificate-TLS": "TODO: 2025/06 BoGo update, should be fixed", + "KeyUpdate-Requested": "TODO: 2025/06 BoGo update, should be fixed", + "AppDataBeforeTLS13KeyChange-*": "TODO: 2025/06 BoGo update, should be fixed" + }, + "AllCurves": [ + 23, + 24, + 25, + 29, + 4587, + 4588, + 4589 + ], + "ErrorMap": { + ":ECH_REJECTED:": ["tls: server rejected ECH"] + } +} diff --git a/go/src/crypto/tls/bogo_shim_notunix_test.go b/go/src/crypto/tls/bogo_shim_notunix_test.go new file mode 100644 index 0000000000000000000000000000000000000000..2dcb5c09dfdaedde3cab475acb53a38d47d0adb2 --- /dev/null +++ b/go/src/crypto/tls/bogo_shim_notunix_test.go @@ -0,0 +1,11 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !unix || wasm + +package tls + +func pauseProcess() { + panic("-wait-for-debugger not supported on this OS") +} diff --git a/go/src/crypto/tls/bogo_shim_test.go b/go/src/crypto/tls/bogo_shim_test.go new file mode 100644 index 0000000000000000000000000000000000000000..ccac47c271076bc91c8d84ad740f5838e49fea20 --- /dev/null +++ b/go/src/crypto/tls/bogo_shim_test.go @@ -0,0 +1,863 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "bytes" + "crypto/internal/cryptotest" + "crypto/x509" + "encoding/base64" + "encoding/json" + "encoding/pem" + "errors" + "flag" + "fmt" + "html/template" + "internal/byteorder" + "internal/testenv" + "io" + "log" + "net" + "os" + "path/filepath" + "runtime" + "slices" + "strconv" + "strings" + "testing" + "time" + + "golang.org/x/crypto/cryptobyte" +) + +const boringsslModVer = "v0.0.0-20250620172916-f51d8b099832" + +var ( + port = flag.String("port", "", "") + server = flag.Bool("server", false, "") + + isHandshakerSupported = flag.Bool("is-handshaker-supported", false, "") + + keyfile = flag.String("key-file", "", "") + certfile = flag.String("cert-file", "", "") + ocspResponse = flagBase64("ocsp-response", "") + signingPrefs = flagIntSlice("signing-prefs", "") + + trustCert = flag.String("trust-cert", "", "") + + minVersion = flag.Int("min-version", VersionSSL30, "") + maxVersion = flag.Int("max-version", VersionTLS13, "") + expectVersion = flag.Int("expect-version", 0, "") + + noTLS1 = flag.Bool("no-tls1", false, "") + noTLS11 = flag.Bool("no-tls11", false, "") + noTLS12 = flag.Bool("no-tls12", false, "") + noTLS13 = flag.Bool("no-tls13", false, "") + + requireAnyClientCertificate = flag.Bool("require-any-client-certificate", false, "") + + shimWritesFirst = flag.Bool("shim-writes-first", false, "") + + resumeCount = flag.Int("resume-count", 0, "") + + curves = flagIntSlice("curves", "") + expectedCurve = flag.String("expect-curve-id", "", "") + + verifyPrefs = flagIntSlice("verify-prefs", "") + expectedSigAlg = flag.String("expect-peer-signature-algorithm", "", "") + expectedPeerSigAlg = flagIntSlice("expect-peer-verify-pref", "") + + shimID = flag.Uint64("shim-id", 0, "") + _ = flag.Bool("ipv6", false, "") + + echConfigList = flagBase64("ech-config-list", "") + expectECHAccepted = flag.Bool("expect-ech-accept", false, "") + expectHRR = flag.Bool("expect-hrr", false, "") + expectNoHRR = flag.Bool("expect-no-hrr", false, "") + expectedECHRetryConfigs = flag.String("expect-ech-retry-configs", "", "") + expectNoECHRetryConfigs = flag.Bool("expect-no-ech-retry-configs", false, "") + onInitialExpectECHAccepted = flag.Bool("on-initial-expect-ech-accept", false, "") + _ = flag.Bool("expect-no-ech-name-override", false, "") + _ = flag.String("expect-ech-name-override", "", "") + _ = flag.Bool("reverify-on-resume", false, "") + onResumeECHConfigList = flagBase64("on-resume-ech-config-list", "") + _ = flag.Bool("on-resume-expect-reject-early-data", false, "") + onResumeExpectECHAccepted = flag.Bool("on-resume-expect-ech-accept", false, "") + _ = flag.Bool("on-resume-expect-no-ech-name-override", false, "") + expectedServerName = flag.String("expect-server-name", "", "") + echServerConfig = flagStringSlice("ech-server-config", "") + echServerKey = flagStringSlice("ech-server-key", "") + echServerRetryConfig = flagStringSlice("ech-is-retry-config", "") + + expectSessionMiss = flag.Bool("expect-session-miss", false, "") + + _ = flag.Bool("enable-early-data", false, "") + _ = flag.Bool("on-resume-expect-accept-early-data", false, "") + _ = flag.Bool("expect-ticket-supports-early-data", false, "") + _ = flag.Bool("on-resume-shim-writes-first", false, "") + + advertiseALPN = flag.String("advertise-alpn", "", "") + expectALPN = flag.String("expect-alpn", "", "") + rejectALPN = flag.Bool("reject-alpn", false, "") + declineALPN = flag.Bool("decline-alpn", false, "") + expectAdvertisedALPN = flag.String("expect-advertised-alpn", "", "") + selectALPN = flag.String("select-alpn", "", "") + + hostName = flag.String("host-name", "", "") + + verifyPeer = flag.Bool("verify-peer", false, "") + _ = flag.Bool("use-custom-verify-callback", false, "") + + waitForDebugger = flag.Bool("wait-for-debugger", false, "") +) + +type stringSlice []string + +func flagStringSlice(name, usage string) *stringSlice { + f := new(stringSlice) + flag.Var(f, name, usage) + return f +} + +func (saf *stringSlice) String() string { + return strings.Join(*saf, ",") +} + +func (saf *stringSlice) Set(s string) error { + *saf = append(*saf, s) + return nil +} + +type intSlice []int64 + +func flagIntSlice(name, usage string) *intSlice { + f := new(intSlice) + flag.Var(f, name, usage) + return f +} + +func (sf *intSlice) String() string { + return strings.Join(strings.Split(fmt.Sprint(*sf), " "), ",") +} + +func (sf *intSlice) Set(s string) error { + i, err := strconv.ParseInt(s, 10, 64) + if err != nil { + return err + } + *sf = append(*sf, i) + return nil +} + +type base64Flag []byte + +func flagBase64(name, usage string) *base64Flag { + f := new(base64Flag) + flag.Var(f, name, usage) + return f +} + +func (f *base64Flag) String() string { + return base64.StdEncoding.EncodeToString(*f) +} + +func (f *base64Flag) Set(s string) error { + if *f != nil { + return fmt.Errorf("multiple base64 values not supported") + } + b, err := base64.StdEncoding.DecodeString(s) + if err != nil { + return err + } + *f = b + return nil +} + +func bogoShim() { + if *isHandshakerSupported { + fmt.Println("No") + return + } + + fmt.Printf("BoGo shim flags: %q", os.Args[1:]) + + // Test with both the default and insecure cipher suites. + var ciphersuites []uint16 + for _, s := range append(CipherSuites(), InsecureCipherSuites()...) { + ciphersuites = append(ciphersuites, s.ID) + } + + cfg := &Config{ + ServerName: "test", + + MinVersion: uint16(*minVersion), + MaxVersion: uint16(*maxVersion), + + ClientSessionCache: NewLRUClientSessionCache(0), + + CipherSuites: ciphersuites, + + GetConfigForClient: func(chi *ClientHelloInfo) (*Config, error) { + + if *expectAdvertisedALPN != "" { + + s := cryptobyte.String(*expectAdvertisedALPN) + + var expectedALPNs []string + + for !s.Empty() { + var alpn cryptobyte.String + if !s.ReadUint8LengthPrefixed(&alpn) { + return nil, fmt.Errorf("unexpected error while parsing arguments for -expect-advertised-alpn") + } + expectedALPNs = append(expectedALPNs, string(alpn)) + } + + if !slices.Equal(chi.SupportedProtos, expectedALPNs) { + return nil, fmt.Errorf("unexpected ALPN: got %q, want %q", chi.SupportedProtos, expectedALPNs) + } + } + return nil, nil + }, + } + + if *noTLS1 { + cfg.MinVersion = VersionTLS11 + if *noTLS11 { + cfg.MinVersion = VersionTLS12 + if *noTLS12 { + cfg.MinVersion = VersionTLS13 + if *noTLS13 { + log.Fatalf("no supported versions enabled") + } + } + } + } else if *noTLS13 { + cfg.MaxVersion = VersionTLS12 + if *noTLS12 { + cfg.MaxVersion = VersionTLS11 + if *noTLS11 { + cfg.MaxVersion = VersionTLS10 + if *noTLS1 { + log.Fatalf("no supported versions enabled") + } + } + } + } + + if *advertiseALPN != "" { + alpns := *advertiseALPN + for len(alpns) > 0 { + alpnLen := int(alpns[0]) + cfg.NextProtos = append(cfg.NextProtos, alpns[1:1+alpnLen]) + alpns = alpns[alpnLen+1:] + } + } + + if *rejectALPN { + cfg.NextProtos = []string{"unnegotiableprotocol"} + } + + if *declineALPN { + cfg.NextProtos = []string{} + } + if *selectALPN != "" { + cfg.NextProtos = []string{*selectALPN} + } + + if *hostName != "" { + cfg.ServerName = *hostName + } + + if *keyfile != "" || *certfile != "" { + pair, err := LoadX509KeyPair(*certfile, *keyfile) + if err != nil { + log.Fatalf("load key-file err: %s", err) + } + for _, id := range *signingPrefs { + pair.SupportedSignatureAlgorithms = append(pair.SupportedSignatureAlgorithms, SignatureScheme(id)) + } + pair.OCSPStaple = *ocspResponse + // Use Get[Client]Certificate to force the use of the certificate, which + // more closely matches the BoGo expectations (e.g. handshake failure if + // no client certificates are compatible). + cfg.GetCertificate = func(chi *ClientHelloInfo) (*Certificate, error) { + if *expectedPeerSigAlg != nil { + if len(chi.SignatureSchemes) != len(*expectedPeerSigAlg) { + return nil, fmt.Errorf("unexpected signature algorithms: got %s, want %v", chi.SignatureSchemes, *expectedPeerSigAlg) + } + for i := range *expectedPeerSigAlg { + if chi.SignatureSchemes[i] != SignatureScheme((*expectedPeerSigAlg)[i]) { + return nil, fmt.Errorf("unexpected signature algorithms: got %s, want %v", chi.SignatureSchemes, *expectedPeerSigAlg) + } + } + } + return &pair, nil + } + cfg.GetClientCertificate = func(cri *CertificateRequestInfo) (*Certificate, error) { + if *expectedPeerSigAlg != nil { + if len(cri.SignatureSchemes) != len(*expectedPeerSigAlg) { + return nil, fmt.Errorf("unexpected signature algorithms: got %s, want %v", cri.SignatureSchemes, *expectedPeerSigAlg) + } + for i := range *expectedPeerSigAlg { + if cri.SignatureSchemes[i] != SignatureScheme((*expectedPeerSigAlg)[i]) { + return nil, fmt.Errorf("unexpected signature algorithms: got %s, want %v", cri.SignatureSchemes, *expectedPeerSigAlg) + } + } + } + return &pair, nil + } + } + if *trustCert != "" { + pool := x509.NewCertPool() + certFile, err := os.ReadFile(*trustCert) + if err != nil { + log.Fatalf("load trust-cert err: %s", err) + } + block, _ := pem.Decode(certFile) + cert, err := x509.ParseCertificate(block.Bytes) + if err != nil { + log.Fatalf("parse trust-cert err: %s", err) + } + pool.AddCert(cert) + cfg.RootCAs = pool + } + + if *requireAnyClientCertificate { + cfg.ClientAuth = RequireAnyClientCert + } + if *verifyPeer { + cfg.ClientAuth = VerifyClientCertIfGiven + } + + if *echConfigList != nil { + cfg.EncryptedClientHelloConfigList = *echConfigList + cfg.MinVersion = VersionTLS13 + } + + if *curves != nil { + for _, id := range *curves { + cfg.CurvePreferences = append(cfg.CurvePreferences, CurveID(id)) + } + } + + if *verifyPrefs != nil { + for _, id := range *verifyPrefs { + testingOnlySupportedSignatureAlgorithms = append(testingOnlySupportedSignatureAlgorithms, SignatureScheme(id)) + } + } + + if *echServerConfig != nil { + if len(*echServerConfig) != len(*echServerKey) || len(*echServerConfig) != len(*echServerRetryConfig) { + log.Fatal("-ech-server-config, -ech-server-key, and -ech-is-retry-config mismatch") + } + + for i, c := range *echServerConfig { + configBytes, err := base64.StdEncoding.DecodeString(c) + if err != nil { + log.Fatalf("parse ech-server-config err: %s", err) + } + privBytes, err := base64.StdEncoding.DecodeString((*echServerKey)[i]) + if err != nil { + log.Fatalf("parse ech-server-key err: %s", err) + } + + cfg.EncryptedClientHelloKeys = append(cfg.EncryptedClientHelloKeys, EncryptedClientHelloKey{ + Config: configBytes, + PrivateKey: privBytes, + SendAsRetry: (*echServerRetryConfig)[i] == "1", + }) + } + } + + for i := 0; i < *resumeCount+1; i++ { + if i > 0 && *onResumeECHConfigList != nil { + cfg.EncryptedClientHelloConfigList = *onResumeECHConfigList + } + + conn, err := net.Dial("tcp", net.JoinHostPort("localhost", *port)) + if err != nil { + log.Fatalf("dial err: %s", err) + } + defer conn.Close() + + // Write the shim ID we were passed as a little endian uint64 + shimIDBytes := make([]byte, 8) + byteorder.LEPutUint64(shimIDBytes, *shimID) + if _, err := conn.Write(shimIDBytes); err != nil { + log.Fatalf("failed to write shim id: %s", err) + } + + var tlsConn *Conn + if *server { + tlsConn = Server(conn, cfg) + } else { + tlsConn = Client(conn, cfg) + } + + if i == 0 && *shimWritesFirst { + if _, err := tlsConn.Write([]byte("hello")); err != nil { + log.Fatalf("write err: %s", err) + } + } + + // If we were instructed to wait for a debugger, then send SIGSTOP to ourselves. + // When the debugger attaches it will continue the process. + if *waitForDebugger { + pauseProcess() + } + + for { + buf := make([]byte, 500) + var n int + n, err = tlsConn.Read(buf) + if err != nil { + break + } + buf = buf[:n] + for i := range buf { + buf[i] ^= 0xff + } + if _, err = tlsConn.Write(buf); err != nil { + break + } + } + if err != io.EOF { + // Flush the TLS conn and then perform a graceful shutdown of the + // TCP connection to avoid the runner side hitting an unexpected + // write error before it has processed the alert we may have + // generated for the error condition. + orderlyShutdown(tlsConn) + + retryErr, ok := err.(*ECHRejectionError) + if !ok { + log.Fatal(err) + } + if *expectNoECHRetryConfigs && len(retryErr.RetryConfigList) > 0 { + log.Fatalf("expected no ECH retry configs, got some") + } + if *expectedECHRetryConfigs != "" { + expectedRetryConfigs, err := base64.StdEncoding.DecodeString(*expectedECHRetryConfigs) + if err != nil { + log.Fatalf("failed to decode expected retry configs: %s", err) + } + if !bytes.Equal(retryErr.RetryConfigList, expectedRetryConfigs) { + log.Fatalf("unexpected retry list returned: got %x, want %x", retryErr.RetryConfigList, expectedRetryConfigs) + } + } + log.Fatalf("conn error: %s", err) + } + + cs := tlsConn.ConnectionState() + if cs.HandshakeComplete { + if *expectALPN != "" && cs.NegotiatedProtocol != *expectALPN { + log.Fatalf("unexpected protocol negotiated: want %q, got %q", *expectALPN, cs.NegotiatedProtocol) + } + + if *selectALPN != "" && cs.NegotiatedProtocol != *selectALPN { + log.Fatalf("unexpected protocol negotiated: want %q, got %q", *selectALPN, cs.NegotiatedProtocol) + } + + if *expectVersion != 0 && cs.Version != uint16(*expectVersion) { + log.Fatalf("expected ssl version %d, got %d", *expectVersion, cs.Version) + } + if *declineALPN && cs.NegotiatedProtocol != "" { + log.Fatal("unexpected ALPN protocol") + } + if *expectECHAccepted && !cs.ECHAccepted { + log.Fatal("expected ECH to be accepted, but connection state shows it was not") + } else if i == 0 && *onInitialExpectECHAccepted && !cs.ECHAccepted { + log.Fatal("expected ECH to be accepted, but connection state shows it was not") + } else if i > 0 && *onResumeExpectECHAccepted && !cs.ECHAccepted { + log.Fatal("expected ECH to be accepted on resumption, but connection state shows it was not") + } else if i == 0 && !*expectECHAccepted && cs.ECHAccepted { + log.Fatal("did not expect ECH, but it was accepted") + } + + if *expectHRR && !cs.HelloRetryRequest { + log.Fatal("expected HRR but did not do it") + } + + if *expectNoHRR && cs.HelloRetryRequest { + log.Fatal("expected no HRR but did do it") + } + + if *expectSessionMiss && cs.DidResume { + log.Fatal("unexpected session resumption") + } + + if *expectedServerName != "" && cs.ServerName != *expectedServerName { + log.Fatalf("unexpected server name: got %q, want %q", cs.ServerName, *expectedServerName) + } + } + + if *expectedCurve != "" { + expectedCurveID, err := strconv.Atoi(*expectedCurve) + if err != nil { + log.Fatalf("failed to parse -expect-curve-id: %s", err) + } + if cs.CurveID != CurveID(expectedCurveID) { + log.Fatalf("unexpected curve id: want %d, got %d", expectedCurveID, tlsConn.curveID) + } + } + + // TODO: implement testingOnlyPeerSignatureAlgorithm on resumption. + if *expectedSigAlg != "" && !cs.DidResume { + expectedSigAlgID, err := strconv.Atoi(*expectedSigAlg) + if err != nil { + log.Fatalf("failed to parse -expect-peer-signature-algorithm: %s", err) + } + if cs.testingOnlyPeerSignatureAlgorithm != SignatureScheme(expectedSigAlgID) { + log.Fatalf("unexpected peer signature algorithm: want %s, got %s", SignatureScheme(expectedSigAlgID), cs.testingOnlyPeerSignatureAlgorithm) + } + } + } +} + +// If the test case produces an error, we don't want to immediately close the +// TCP connection after generating an alert. The runner side may try to write +// additional data to the connection before it reads the alert. If the conn +// has already been torn down, then these writes will produce an unexpected +// broken pipe err and fail the test. +func orderlyShutdown(tlsConn *Conn) { + // Flush any pending alert data + tlsConn.flush() + + netConn := tlsConn.NetConn() + tcpConn := netConn.(*net.TCPConn) + tcpConn.CloseWrite() + + // Read and discard any data that was sent by the peer. + buf := make([]byte, maxPlaintext) + for { + n, err := tcpConn.Read(buf) + if n == 0 || err != nil { + break + } + } + + tcpConn.CloseRead() +} + +func TestBogoSuite(t *testing.T) { + if testing.Short() { + t.Skip("skipping in short mode") + } + if testenv.Builder() != "" && runtime.GOOS == "windows" { + t.Skip("#66913: windows network connections are flakey on builders") + } + skipFIPS(t) + + // In order to make Go test caching work as expected, we stat the + // bogo_config.json file, so that the Go testing hooks know that it is + // important for this test and will invalidate a cached test result if the + // file changes. + if _, err := os.Stat("bogo_config.json"); err != nil { + t.Fatal(err) + } + + var bogoDir string + if *bogoLocalDir != "" { + ensureLocalBogo(t, *bogoLocalDir) + bogoDir = *bogoLocalDir + } else { + bogoDir = cryptotest.FetchModule(t, "boringssl.googlesource.com/boringssl.git", boringsslModVer) + } + + cwd, err := os.Getwd() + if err != nil { + t.Fatal(err) + } + + resultsFile := filepath.Join(t.TempDir(), "results.json") + + args := []string{ + "test", + ".", + fmt.Sprintf("-shim-config=%s", filepath.Join(cwd, "bogo_config.json")), + fmt.Sprintf("-shim-path=%s", testenv.Executable(t)), + "-shim-extra-flags=-bogo-mode", + "-allow-unimplemented", + "-loose-errors", // TODO(roland): this should be removed eventually + fmt.Sprintf("-json-output=%s", resultsFile), + } + if *bogoFilter != "" { + args = append(args, fmt.Sprintf("-test=%s", *bogoFilter)) + } + + cmd := testenv.Command(t, testenv.GoToolPath(t), args...) + cmd.Dir = filepath.Join(bogoDir, "ssl/test/runner") + out, err := cmd.CombinedOutput() + // NOTE: we don't immediately check the error, because the failure could be either because + // the runner failed for some unexpected reason, or because a test case failed, and we + // cannot easily differentiate these cases. We check if the JSON results file was written, + // which should only happen if the failure was because of a test failure, and use that + // to determine the failure mode. + + resultsJSON, jsonErr := os.ReadFile(resultsFile) + if jsonErr != nil { + if err != nil { + t.Fatalf("bogo failed: %s\n%s", err, out) + } + t.Fatalf("failed to read results JSON file: %s", jsonErr) + } + + var results bogoResults + if err := json.Unmarshal(resultsJSON, &results); err != nil { + t.Fatalf("failed to parse results JSON: %s", err) + } + + if *bogoReport != "" { + if err := generateReport(results, *bogoReport); err != nil { + t.Fatalf("failed to generate report: %v", err) + } + } + + // assertResults contains test results we want to make sure + // are present in the output. They are only checked if -bogo-filter + // was not passed. + assertResults := map[string]string{ + "CurveTest-Client-MLKEM-TLS13": "PASS", + "CurveTest-Server-MLKEM-TLS13": "PASS", + + // Various signature algorithm tests checking that we enforce our + // preferences on the peer. + "ClientAuth-Enforced": "PASS", + "ServerAuth-Enforced": "PASS", + "ClientAuth-Enforced-TLS13": "PASS", + "ServerAuth-Enforced-TLS13": "PASS", + "VerifyPreferences-Advertised": "PASS", + "VerifyPreferences-Enforced": "PASS", + "Client-TLS12-NoSign-RSA_PKCS1_MD5_SHA1": "PASS", + "Server-TLS12-NoSign-RSA_PKCS1_MD5_SHA1": "PASS", + "Client-TLS13-NoSign-RSA_PKCS1_MD5_SHA1": "PASS", + "Server-TLS13-NoSign-RSA_PKCS1_MD5_SHA1": "PASS", + } + + for name, result := range results.Tests { + // This is not really the intended way to do this... but... it works? + t.Run(name, func(t *testing.T) { + if result.Actual == "FAIL" && result.IsUnexpected { + t.Fail() + } + if result.Error != "" { + t.Log(result.Error) + } + if exp, ok := assertResults[name]; ok && exp != result.Actual { + t.Errorf("unexpected result: got %s, want %s", result.Actual, exp) + } + delete(assertResults, name) + if result.Actual == "SKIP" { + t.SkipNow() + } + }) + } + if *bogoFilter == "" { + // Anything still in assertResults did not show up in the results, so we should fail + for name, expectedResult := range assertResults { + t.Run(name, func(t *testing.T) { + t.Fatalf("expected test to run with result %s, but it was not present in the test results", expectedResult) + }) + } + } +} + +// ensureLocalBogo fetches BoringSSL to localBogoDir at the correct revision +// (from boringsslModVer) if localBogoDir doesn't already exist. +// +// If localBogoDir does exist, ensureLocalBogo fails the test if it isn't +// a directory. +func ensureLocalBogo(t *testing.T, localBogoDir string) { + t.Helper() + + if stat, err := os.Stat(localBogoDir); err == nil { + if !stat.IsDir() { + t.Fatalf("local bogo dir (%q) exists but is not a directory", localBogoDir) + } + + t.Logf("using local bogo checkout from %q", localBogoDir) + return + } else if !errors.Is(err, os.ErrNotExist) { + t.Fatalf("failed to stat local bogo dir (%q): %v", localBogoDir, err) + } + + testenv.MustHaveExecPath(t, "git") + + idx := strings.LastIndex(boringsslModVer, "-") + if idx == -1 || idx == len(boringsslModVer)-1 { + t.Fatalf("invalid boringsslModVer format: %q", boringsslModVer) + } + commitSHA := boringsslModVer[idx+1:] + + t.Logf("cloning boringssl@%s to %q", commitSHA, localBogoDir) + cloneCmd := testenv.Command(t, "git", "clone", "--no-checkout", "https://boringssl.googlesource.com/boringssl", localBogoDir) + if err := cloneCmd.Run(); err != nil { + t.Fatalf("git clone failed: %v", err) + } + + checkoutCmd := testenv.Command(t, "git", "checkout", commitSHA) + checkoutCmd.Dir = localBogoDir + if err := checkoutCmd.Run(); err != nil { + t.Fatalf("git checkout failed: %v", err) + } + + t.Logf("using fresh local bogo checkout from %q", localBogoDir) +} + +func generateReport(results bogoResults, outPath string) error { + data := reportData{ + Results: results, + Timestamp: time.Unix(int64(results.SecondsSinceEpoch), 0).Format("2006-01-02 15:04:05"), + Revision: boringsslModVer, + } + + tmpl := template.Must(template.New("report").Parse(reportTemplate)) + file, err := os.Create(outPath) + if err != nil { + return err + } + defer file.Close() + + return tmpl.Execute(file, data) +} + +// bogoResults is a copy of boringssl.googlesource.com/boringssl/testresults.Results +type bogoResults struct { + Version int `json:"version"` + Interrupted bool `json:"interrupted"` + PathDelimiter string `json:"path_delimiter"` + SecondsSinceEpoch float64 `json:"seconds_since_epoch"` + NumFailuresByType map[string]int `json:"num_failures_by_type"` + Tests map[string]struct { + Actual string `json:"actual"` + Expected string `json:"expected"` + IsUnexpected bool `json:"is_unexpected"` + Error string `json:"error,omitempty"` + } `json:"tests"` +} + +type reportData struct { + Results bogoResults + SkipReasons map[string]string + Timestamp string + Revision string +} + +const reportTemplate = ` + + + + BoGo Results Report + + + +

BoGo Results Report

+ +
+ Generated: {{.Timestamp}} | BoGo Revision: {{.Revision}}
+ {{range $status, $count := .Results.NumFailuresByType}} + {{$status}}: {{$count}} | + {{end}} +
+ +
+ + +
+ + + + + + + + + + + + + {{range $name, $test := .Results.Tests}} + + + + + + + + {{end}} + +
Test NameStatusActualExpectedError
{{$name}}{{$test.Actual}}{{$test.Actual}}{{$test.Expected}}{{$test.Error}}
+ + + + +` diff --git a/go/src/crypto/tls/bogo_shim_unix_test.go b/go/src/crypto/tls/bogo_shim_unix_test.go new file mode 100644 index 0000000000000000000000000000000000000000..3b5f5f92c228a7a6a6cf1b3987f4da8d05304a86 --- /dev/null +++ b/go/src/crypto/tls/bogo_shim_unix_test.go @@ -0,0 +1,18 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build unix && !wasm + +package tls + +import ( + "os" + "syscall" +) + +func pauseProcess() { + pid := os.Getpid() + process, _ := os.FindProcess(pid) + process.Signal(syscall.SIGSTOP) +} diff --git a/go/src/crypto/tls/cache.go b/go/src/crypto/tls/cache.go new file mode 100644 index 0000000000000000000000000000000000000000..a2c255af88af2d82b467fadba645974732cd6798 --- /dev/null +++ b/go/src/crypto/tls/cache.go @@ -0,0 +1,44 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "crypto/x509" + "runtime" + "sync" + "weak" +) + +// weakCertCache provides a cache of *x509.Certificates, allowing multiple +// connections to reuse parsed certificates, instead of re-parsing the +// certificate for every connection, which is an expensive operation. +type weakCertCache struct{ sync.Map } + +func (wcc *weakCertCache) newCert(der []byte) (*x509.Certificate, error) { + if entry, ok := wcc.Load(string(der)); ok { + if v := entry.(weak.Pointer[x509.Certificate]).Value(); v != nil { + return v, nil + } + } + + cert, err := x509.ParseCertificate(der) + if err != nil { + return nil, err + } + + wp := weak.Make(cert) + if entry, loaded := wcc.LoadOrStore(string(der), wp); !loaded { + runtime.AddCleanup(cert, func(_ any) { wcc.CompareAndDelete(string(der), entry) }, any(string(der))) + } else if v := entry.(weak.Pointer[x509.Certificate]).Value(); v != nil { + return v, nil + } else { + if wcc.CompareAndSwap(string(der), entry, wp) { + runtime.AddCleanup(cert, func(_ any) { wcc.CompareAndDelete(string(der), wp) }, any(string(der))) + } + } + return cert, nil +} + +var globalCertCache = new(weakCertCache) diff --git a/go/src/crypto/tls/cache_test.go b/go/src/crypto/tls/cache_test.go new file mode 100644 index 0000000000000000000000000000000000000000..75a0508ec0defa3f40939353d8d6795f3ac7ba0b --- /dev/null +++ b/go/src/crypto/tls/cache_test.go @@ -0,0 +1,78 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +package tls + +import ( + "encoding/pem" + "runtime" + "testing" + "time" +) + +func TestWeakCertCache(t *testing.T) { + wcc := weakCertCache{} + p, _ := pem.Decode([]byte(rsaCertPEM)) + if p == nil { + t.Fatal("Failed to decode certificate") + } + + certA, err := wcc.newCert(p.Bytes) + if err != nil { + t.Fatalf("newCert failed: %s", err) + } + certB, err := wcc.newCert(p.Bytes) + if err != nil { + t.Fatalf("newCert failed: %s", err) + } + if certA != certB { + t.Fatal("newCert returned a unique reference for a duplicate certificate") + } + + if _, ok := wcc.Load(string(p.Bytes)); !ok { + t.Fatal("cache does not contain expected entry") + } + + timeoutRefCheck := func(t *testing.T, key string, present bool) { + t.Helper() + timeout := time.After(4 * time.Second) + for { + select { + case <-timeout: + t.Fatal("timed out waiting for expected ref count") + default: + _, ok := wcc.Load(key) + if ok == present { + return + } + } + // Explicitly yield to the scheduler. + // + // On single-threaded platforms like js/wasm a busy-loop might + // never call into the scheduler for the full timeout, meaning + // that if we arrive here and the cleanup hasn't already run, + // we'll simply loop until the timeout. Busy-loops put us at the + // mercy of the Go scheduler, making this test fragile on some + // platforms. + runtime.Gosched() + } + } + + // Keep certA alive until at least now, so that we can + // purposefully nil it and force the finalizer to be + // called. + runtime.KeepAlive(certA) + certA = nil + runtime.GC() + + timeoutRefCheck(t, string(p.Bytes), true) + + // Keep certB alive until at least now, so that we can + // purposefully nil it and force the finalizer to be + // called. + runtime.KeepAlive(certB) + certB = nil + runtime.GC() + + timeoutRefCheck(t, string(p.Bytes), false) +} diff --git a/go/src/crypto/tls/cipher_suites.go b/go/src/crypto/tls/cipher_suites.go new file mode 100644 index 0000000000000000000000000000000000000000..6ed63ccc2dc1f5e392103fa32c94fdf6fa1a4ca4 --- /dev/null +++ b/go/src/crypto/tls/cipher_suites.go @@ -0,0 +1,724 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "crypto" + "crypto/aes" + "crypto/cipher" + "crypto/des" + "crypto/hmac" + "crypto/internal/boring" + fipsaes "crypto/internal/fips140/aes" + "crypto/internal/fips140/aes/gcm" + "crypto/rc4" + "crypto/sha1" + "crypto/sha256" + "fmt" + "hash" + "internal/cpu" + "runtime" + _ "unsafe" // for linkname + + "golang.org/x/crypto/chacha20poly1305" +) + +// CipherSuite is a TLS cipher suite. Note that most functions in this package +// accept and expose cipher suite IDs instead of this type. +type CipherSuite struct { + ID uint16 + Name string + + // Supported versions is the list of TLS protocol versions that can + // negotiate this cipher suite. + SupportedVersions []uint16 + + // Insecure is true if the cipher suite has known security issues + // due to its primitives, design, or implementation. + Insecure bool +} + +var ( + supportedUpToTLS12 = []uint16{VersionTLS10, VersionTLS11, VersionTLS12} + supportedOnlyTLS12 = []uint16{VersionTLS12} + supportedOnlyTLS13 = []uint16{VersionTLS13} +) + +// CipherSuites returns a list of cipher suites currently implemented by this +// package, excluding those with security issues, which are returned by +// [InsecureCipherSuites]. +// +// The list is sorted by ID. Note that the default cipher suites selected by +// this package might depend on logic that can't be captured by a static list, +// and might not match those returned by this function. +func CipherSuites() []*CipherSuite { + return []*CipherSuite{ + {TLS_AES_128_GCM_SHA256, "TLS_AES_128_GCM_SHA256", supportedOnlyTLS13, false}, + {TLS_AES_256_GCM_SHA384, "TLS_AES_256_GCM_SHA384", supportedOnlyTLS13, false}, + {TLS_CHACHA20_POLY1305_SHA256, "TLS_CHACHA20_POLY1305_SHA256", supportedOnlyTLS13, false}, + + {TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", supportedUpToTLS12, false}, + {TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", supportedUpToTLS12, false}, + {TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", supportedUpToTLS12, false}, + {TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", supportedUpToTLS12, false}, + {TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", supportedOnlyTLS12, false}, + {TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", supportedOnlyTLS12, false}, + {TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", supportedOnlyTLS12, false}, + {TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", supportedOnlyTLS12, false}, + {TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256", supportedOnlyTLS12, false}, + {TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256", supportedOnlyTLS12, false}, + } +} + +// InsecureCipherSuites returns a list of cipher suites currently implemented by +// this package and which have security issues. +// +// Most applications should not use the cipher suites in this list, and should +// only use those returned by [CipherSuites]. +func InsecureCipherSuites() []*CipherSuite { + // This list includes legacy RSA kex, RC4, CBC_SHA256, and 3DES cipher + // suites. See cipherSuitesPreferenceOrder for details. + return []*CipherSuite{ + {TLS_RSA_WITH_RC4_128_SHA, "TLS_RSA_WITH_RC4_128_SHA", supportedUpToTLS12, true}, + {TLS_RSA_WITH_3DES_EDE_CBC_SHA, "TLS_RSA_WITH_3DES_EDE_CBC_SHA", supportedUpToTLS12, true}, + {TLS_RSA_WITH_AES_128_CBC_SHA, "TLS_RSA_WITH_AES_128_CBC_SHA", supportedUpToTLS12, true}, + {TLS_RSA_WITH_AES_256_CBC_SHA, "TLS_RSA_WITH_AES_256_CBC_SHA", supportedUpToTLS12, true}, + {TLS_RSA_WITH_AES_128_CBC_SHA256, "TLS_RSA_WITH_AES_128_CBC_SHA256", supportedOnlyTLS12, true}, + {TLS_RSA_WITH_AES_128_GCM_SHA256, "TLS_RSA_WITH_AES_128_GCM_SHA256", supportedOnlyTLS12, true}, + {TLS_RSA_WITH_AES_256_GCM_SHA384, "TLS_RSA_WITH_AES_256_GCM_SHA384", supportedOnlyTLS12, true}, + {TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", supportedUpToTLS12, true}, + {TLS_ECDHE_RSA_WITH_RC4_128_SHA, "TLS_ECDHE_RSA_WITH_RC4_128_SHA", supportedUpToTLS12, true}, + {TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", supportedUpToTLS12, true}, + {TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256", supportedOnlyTLS12, true}, + {TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", supportedOnlyTLS12, true}, + } +} + +// CipherSuiteName returns the standard name for the passed cipher suite ID +// (e.g. "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256"), or a fallback representation +// of the ID value if the cipher suite is not implemented by this package. +func CipherSuiteName(id uint16) string { + for _, c := range CipherSuites() { + if c.ID == id { + return c.Name + } + } + for _, c := range InsecureCipherSuites() { + if c.ID == id { + return c.Name + } + } + return fmt.Sprintf("0x%04X", id) +} + +const ( + // suiteECDHE indicates that the cipher suite involves elliptic curve + // Diffie-Hellman. This means that it should only be selected when the + // client indicates that it supports ECC with a curve and point format + // that we're happy with. + suiteECDHE = 1 << iota + // suiteECSign indicates that the cipher suite involves an ECDSA or + // EdDSA signature and therefore may only be selected when the server's + // certificate is ECDSA or EdDSA. If this is not set then the cipher suite + // is RSA based. + suiteECSign + // suiteTLS12 indicates that the cipher suite should only be advertised + // and accepted when using TLS 1.2. + suiteTLS12 + // suiteSHA384 indicates that the cipher suite uses SHA384 as the + // handshake hash. + suiteSHA384 +) + +// A cipherSuite is a TLS 1.0–1.2 cipher suite, and defines the key exchange +// mechanism, as well as the cipher+MAC pair or the AEAD. +type cipherSuite struct { + id uint16 + // the lengths, in bytes, of the key material needed for each component. + keyLen int + macLen int + ivLen int + ka func(version uint16) keyAgreement + // flags is a bitmask of the suite* values, above. + flags int + cipher func(key, iv []byte, isRead bool) any + mac func(key []byte) hash.Hash + aead func(key, fixedNonce []byte) aead +} + +var cipherSuites = []*cipherSuite{ // TODO: replace with a map, since the order doesn't matter. + {TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, 32, 0, 12, ecdheRSAKA, suiteECDHE | suiteTLS12, nil, nil, aeadChaCha20Poly1305}, + {TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, 32, 0, 12, ecdheECDSAKA, suiteECDHE | suiteECSign | suiteTLS12, nil, nil, aeadChaCha20Poly1305}, + {TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, 16, 0, 4, ecdheRSAKA, suiteECDHE | suiteTLS12, nil, nil, aeadAESGCM}, + {TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, 16, 0, 4, ecdheECDSAKA, suiteECDHE | suiteECSign | suiteTLS12, nil, nil, aeadAESGCM}, + {TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, 32, 0, 4, ecdheRSAKA, suiteECDHE | suiteTLS12 | suiteSHA384, nil, nil, aeadAESGCM}, + {TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, 32, 0, 4, ecdheECDSAKA, suiteECDHE | suiteECSign | suiteTLS12 | suiteSHA384, nil, nil, aeadAESGCM}, + {TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, 16, 32, 16, ecdheRSAKA, suiteECDHE | suiteTLS12, cipherAES, macSHA256, nil}, + {TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, 16, 20, 16, ecdheRSAKA, suiteECDHE, cipherAES, macSHA1, nil}, + {TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, 16, 32, 16, ecdheECDSAKA, suiteECDHE | suiteECSign | suiteTLS12, cipherAES, macSHA256, nil}, + {TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, 16, 20, 16, ecdheECDSAKA, suiteECDHE | suiteECSign, cipherAES, macSHA1, nil}, + {TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, 32, 20, 16, ecdheRSAKA, suiteECDHE, cipherAES, macSHA1, nil}, + {TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, 32, 20, 16, ecdheECDSAKA, suiteECDHE | suiteECSign, cipherAES, macSHA1, nil}, + {TLS_RSA_WITH_AES_128_GCM_SHA256, 16, 0, 4, rsaKA, suiteTLS12, nil, nil, aeadAESGCM}, + {TLS_RSA_WITH_AES_256_GCM_SHA384, 32, 0, 4, rsaKA, suiteTLS12 | suiteSHA384, nil, nil, aeadAESGCM}, + {TLS_RSA_WITH_AES_128_CBC_SHA256, 16, 32, 16, rsaKA, suiteTLS12, cipherAES, macSHA256, nil}, + {TLS_RSA_WITH_AES_128_CBC_SHA, 16, 20, 16, rsaKA, 0, cipherAES, macSHA1, nil}, + {TLS_RSA_WITH_AES_256_CBC_SHA, 32, 20, 16, rsaKA, 0, cipherAES, macSHA1, nil}, + {TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, 24, 20, 8, ecdheRSAKA, suiteECDHE, cipher3DES, macSHA1, nil}, + {TLS_RSA_WITH_3DES_EDE_CBC_SHA, 24, 20, 8, rsaKA, 0, cipher3DES, macSHA1, nil}, + {TLS_RSA_WITH_RC4_128_SHA, 16, 20, 0, rsaKA, 0, cipherRC4, macSHA1, nil}, + {TLS_ECDHE_RSA_WITH_RC4_128_SHA, 16, 20, 0, ecdheRSAKA, suiteECDHE, cipherRC4, macSHA1, nil}, + {TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, 16, 20, 0, ecdheECDSAKA, suiteECDHE | suiteECSign, cipherRC4, macSHA1, nil}, +} + +// selectCipherSuite returns the first TLS 1.0–1.2 cipher suite from ids which +// is also in supportedIDs and passes the ok filter. +func selectCipherSuite(ids, supportedIDs []uint16, ok func(*cipherSuite) bool) *cipherSuite { + for _, id := range ids { + candidate := cipherSuiteByID(id) + if candidate == nil || !ok(candidate) { + continue + } + + for _, suppID := range supportedIDs { + if id == suppID { + return candidate + } + } + } + return nil +} + +// A cipherSuiteTLS13 defines only the pair of the AEAD algorithm and hash +// algorithm to be used with HKDF. See RFC 8446, Appendix B.4. +type cipherSuiteTLS13 struct { + id uint16 + keyLen int + aead func(key, fixedNonce []byte) aead + hash crypto.Hash +} + +// cipherSuitesTLS13 should be an internal detail, +// but widely used packages access it using linkname. +// Notable members of the hall of shame include: +// - github.com/quic-go/quic-go +// - github.com/sagernet/quic-go +// +// Do not remove or change the type signature. +// See go.dev/issue/67401. +// +//go:linkname cipherSuitesTLS13 +var cipherSuitesTLS13 = []*cipherSuiteTLS13{ // TODO: replace with a map. + {TLS_AES_128_GCM_SHA256, 16, aeadAESGCMTLS13, crypto.SHA256}, + {TLS_CHACHA20_POLY1305_SHA256, 32, aeadChaCha20Poly1305, crypto.SHA256}, + {TLS_AES_256_GCM_SHA384, 32, aeadAESGCMTLS13, crypto.SHA384}, +} + +// cipherSuitesPreferenceOrder is the order in which we'll select (on the +// server) or advertise (on the client) TLS 1.0–1.2 cipher suites. +// +// Cipher suites are filtered but not reordered based on the application and +// peer's preferences, meaning we'll never select a suite lower in this list if +// any higher one is available. This makes it more defensible to keep weaker +// cipher suites enabled, especially on the server side where we get the last +// word, since there are no known downgrade attacks on cipher suites selection. +// +// The list is sorted by applying the following priority rules, stopping at the +// first (most important) applicable one: +// +// - Anything else comes before RC4 +// +// RC4 has practically exploitable biases. See https://www.rc4nomore.com. +// +// - Anything else comes before CBC_SHA256 +// +// SHA-256 variants of the CBC ciphersuites don't implement any Lucky13 +// countermeasures. See https://www.isg.rhul.ac.uk/tls/Lucky13.html and +// https://www.imperialviolet.org/2013/02/04/luckythirteen.html. +// +// - Anything else comes before 3DES +// +// 3DES has 64-bit blocks, which makes it fundamentally susceptible to +// birthday attacks. See https://sweet32.info. +// +// - ECDHE comes before anything else +// +// Once we got the broken stuff out of the way, the most important +// property a cipher suite can have is forward secrecy. We don't +// implement FFDHE, so that means ECDHE. +// +// - AEADs come before CBC ciphers +// +// Even with Lucky13 countermeasures, MAC-then-Encrypt CBC cipher suites +// are fundamentally fragile, and suffered from an endless sequence of +// padding oracle attacks. See https://eprint.iacr.org/2015/1129, +// https://www.imperialviolet.org/2014/12/08/poodleagain.html, and +// https://blog.cloudflare.com/yet-another-padding-oracle-in-openssl-cbc-ciphersuites/. +// +// - AES comes before ChaCha20 +// +// When AES hardware is available, AES-128-GCM and AES-256-GCM are faster +// than ChaCha20Poly1305. +// +// When AES hardware is not available, AES-128-GCM is one or more of: much +// slower, way more complex, and less safe (because not constant time) +// than ChaCha20Poly1305. +// +// We use this list if we think both peers have AES hardware, and +// cipherSuitesPreferenceOrderNoAES otherwise. +// +// - AES-128 comes before AES-256 +// +// The only potential advantages of AES-256 are better multi-target +// margins, and hypothetical post-quantum properties. Neither apply to +// TLS, and AES-256 is slower due to its four extra rounds (which don't +// contribute to the advantages above). +// +// - ECDSA comes before RSA +// +// The relative order of ECDSA and RSA cipher suites doesn't matter, +// as they depend on the certificate. Pick one to get a stable order. +var cipherSuitesPreferenceOrder = []uint16{ + // AEADs w/ ECDHE + TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, + TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, + + // CBC w/ ECDHE + TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, + TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, + + // AEADs w/o ECDHE + TLS_RSA_WITH_AES_128_GCM_SHA256, + TLS_RSA_WITH_AES_256_GCM_SHA384, + + // CBC w/o ECDHE + TLS_RSA_WITH_AES_128_CBC_SHA, + TLS_RSA_WITH_AES_256_CBC_SHA, + + // 3DES + TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, + TLS_RSA_WITH_3DES_EDE_CBC_SHA, + + // CBC_SHA256 + TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, + TLS_RSA_WITH_AES_128_CBC_SHA256, + + // RC4 + TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, TLS_ECDHE_RSA_WITH_RC4_128_SHA, + TLS_RSA_WITH_RC4_128_SHA, +} + +var cipherSuitesPreferenceOrderNoAES = []uint16{ + // ChaCha20Poly1305 + TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, + + // AES-GCM w/ ECDHE + TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, + + // The rest of cipherSuitesPreferenceOrder. + TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, + TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, + TLS_RSA_WITH_AES_128_GCM_SHA256, + TLS_RSA_WITH_AES_256_GCM_SHA384, + TLS_RSA_WITH_AES_128_CBC_SHA, + TLS_RSA_WITH_AES_256_CBC_SHA, + TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, + TLS_RSA_WITH_3DES_EDE_CBC_SHA, + TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, + TLS_RSA_WITH_AES_128_CBC_SHA256, + TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, TLS_ECDHE_RSA_WITH_RC4_128_SHA, + TLS_RSA_WITH_RC4_128_SHA, +} + +// disabledCipherSuites are not used unless explicitly listed in Config.CipherSuites. +var disabledCipherSuites = map[uint16]bool{ + // CBC_SHA256 + TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256: true, + TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256: true, + TLS_RSA_WITH_AES_128_CBC_SHA256: true, + + // RC4 + TLS_ECDHE_ECDSA_WITH_RC4_128_SHA: true, + TLS_ECDHE_RSA_WITH_RC4_128_SHA: true, + TLS_RSA_WITH_RC4_128_SHA: true, +} + +// rsaKexCiphers contains the ciphers which use RSA based key exchange, +// which we also disable by default unless a GODEBUG is set. +var rsaKexCiphers = map[uint16]bool{ + TLS_RSA_WITH_RC4_128_SHA: true, + TLS_RSA_WITH_3DES_EDE_CBC_SHA: true, + TLS_RSA_WITH_AES_128_CBC_SHA: true, + TLS_RSA_WITH_AES_256_CBC_SHA: true, + TLS_RSA_WITH_AES_128_CBC_SHA256: true, + TLS_RSA_WITH_AES_128_GCM_SHA256: true, + TLS_RSA_WITH_AES_256_GCM_SHA384: true, +} + +// tdesCiphers contains 3DES ciphers, +// which we also disable by default unless a GODEBUG is set. +var tdesCiphers = map[uint16]bool{ + TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA: true, + TLS_RSA_WITH_3DES_EDE_CBC_SHA: true, +} + +var ( + // Keep in sync with crypto/internal/fips140/aes/gcm.supportsAESGCM. + hasGCMAsmAMD64 = cpu.X86.HasAES && cpu.X86.HasPCLMULQDQ && cpu.X86.HasSSE41 && cpu.X86.HasSSSE3 + hasGCMAsmARM64 = cpu.ARM64.HasAES && cpu.ARM64.HasPMULL + hasGCMAsmS390X = cpu.S390X.HasAES && cpu.S390X.HasAESCTR && cpu.S390X.HasGHASH + hasGCMAsmPPC64 = runtime.GOARCH == "ppc64" || runtime.GOARCH == "ppc64le" + + hasAESGCMHardwareSupport = hasGCMAsmAMD64 || hasGCMAsmARM64 || hasGCMAsmS390X || hasGCMAsmPPC64 +) + +var aesgcmCiphers = map[uint16]bool{ + // TLS 1.2 + TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256: true, + TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384: true, + TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: true, + TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384: true, + // TLS 1.3 + TLS_AES_128_GCM_SHA256: true, + TLS_AES_256_GCM_SHA384: true, +} + +// isAESGCMPreferred returns whether we have hardware support for AES-GCM, and the +// first known cipher in the peer's preference list is an AES-GCM cipher, +// implying the peer also has hardware support for it. +func isAESGCMPreferred(ciphers []uint16) bool { + if !hasAESGCMHardwareSupport { + return false + } + for _, cID := range ciphers { + if c := cipherSuiteByID(cID); c != nil { + return aesgcmCiphers[cID] + } + if c := cipherSuiteTLS13ByID(cID); c != nil { + return aesgcmCiphers[cID] + } + } + return false +} + +func cipherRC4(key, iv []byte, isRead bool) any { + cipher, _ := rc4.NewCipher(key) + return cipher +} + +func cipher3DES(key, iv []byte, isRead bool) any { + block, _ := des.NewTripleDESCipher(key) + if isRead { + return cipher.NewCBCDecrypter(block, iv) + } + return cipher.NewCBCEncrypter(block, iv) +} + +func cipherAES(key, iv []byte, isRead bool) any { + block, _ := aes.NewCipher(key) + if isRead { + return cipher.NewCBCDecrypter(block, iv) + } + return cipher.NewCBCEncrypter(block, iv) +} + +// macSHA1 returns a SHA-1 based constant time MAC. +func macSHA1(key []byte) hash.Hash { + h := sha1.New + // The BoringCrypto SHA1 does not have a constant-time + // checksum function, so don't try to use it. + if !boring.Enabled { + h = newConstantTimeHash(h) + } + return hmac.New(h, key) +} + +// macSHA256 returns a SHA-256 based MAC. This is only supported in TLS 1.2 and +// is currently only used in disabled-by-default cipher suites. +func macSHA256(key []byte) hash.Hash { + return hmac.New(sha256.New, key) +} + +type aead interface { + cipher.AEAD + + // explicitNonceLen returns the number of bytes of explicit nonce + // included in each record. This is eight for older AEADs and + // zero for modern ones. + explicitNonceLen() int +} + +const ( + aeadNonceLength = 12 + noncePrefixLength = 4 +) + +// prefixNonceAEAD wraps an AEAD and prefixes a fixed portion of the nonce to +// each call. +type prefixNonceAEAD struct { + // nonce contains the fixed part of the nonce in the first four bytes. + nonce [aeadNonceLength]byte + aead cipher.AEAD +} + +func (f *prefixNonceAEAD) NonceSize() int { return aeadNonceLength - noncePrefixLength } +func (f *prefixNonceAEAD) Overhead() int { return f.aead.Overhead() } +func (f *prefixNonceAEAD) explicitNonceLen() int { return f.NonceSize() } + +func (f *prefixNonceAEAD) Seal(out, nonce, plaintext, additionalData []byte) []byte { + copy(f.nonce[4:], nonce) + return f.aead.Seal(out, f.nonce[:], plaintext, additionalData) +} + +func (f *prefixNonceAEAD) Open(out, nonce, ciphertext, additionalData []byte) ([]byte, error) { + copy(f.nonce[4:], nonce) + return f.aead.Open(out, f.nonce[:], ciphertext, additionalData) +} + +// xorNonceAEAD wraps an AEAD by XORing in a fixed pattern to the nonce +// before each call. +type xorNonceAEAD struct { + nonceMask [aeadNonceLength]byte + aead cipher.AEAD +} + +func (f *xorNonceAEAD) NonceSize() int { return 8 } // 64-bit sequence number +func (f *xorNonceAEAD) Overhead() int { return f.aead.Overhead() } +func (f *xorNonceAEAD) explicitNonceLen() int { return 0 } + +func (f *xorNonceAEAD) Seal(out, nonce, plaintext, additionalData []byte) []byte { + for i, b := range nonce { + f.nonceMask[4+i] ^= b + } + result := f.aead.Seal(out, f.nonceMask[:], plaintext, additionalData) + for i, b := range nonce { + f.nonceMask[4+i] ^= b + } + + return result +} + +func (f *xorNonceAEAD) Open(out, nonce, ciphertext, additionalData []byte) ([]byte, error) { + for i, b := range nonce { + f.nonceMask[4+i] ^= b + } + result, err := f.aead.Open(out, f.nonceMask[:], ciphertext, additionalData) + for i, b := range nonce { + f.nonceMask[4+i] ^= b + } + + return result, err +} + +func aeadAESGCM(key, noncePrefix []byte) aead { + if len(noncePrefix) != noncePrefixLength { + panic("tls: internal error: wrong nonce length") + } + aes, err := aes.NewCipher(key) + if err != nil { + panic(err) + } + var aead cipher.AEAD + if boring.Enabled { + aead, err = boring.NewGCMTLS(aes) + } else { + boring.Unreachable() + aead, err = gcm.NewGCMForTLS12(aes.(*fipsaes.Block)) + } + if err != nil { + panic(err) + } + + ret := &prefixNonceAEAD{aead: aead} + copy(ret.nonce[:], noncePrefix) + return ret +} + +// aeadAESGCMTLS13 should be an internal detail, +// but widely used packages access it using linkname. +// Notable members of the hall of shame include: +// - github.com/xtls/xray-core +// - github.com/v2fly/v2ray-core +// +// Do not remove or change the type signature. +// See go.dev/issue/67401. +// +//go:linkname aeadAESGCMTLS13 +func aeadAESGCMTLS13(key, nonceMask []byte) aead { + if len(nonceMask) != aeadNonceLength { + panic("tls: internal error: wrong nonce length") + } + aes, err := aes.NewCipher(key) + if err != nil { + panic(err) + } + var aead cipher.AEAD + if boring.Enabled { + aead, err = boring.NewGCMTLS13(aes) + } else { + boring.Unreachable() + aead, err = gcm.NewGCMForTLS13(aes.(*fipsaes.Block)) + } + if err != nil { + panic(err) + } + + ret := &xorNonceAEAD{aead: aead} + copy(ret.nonceMask[:], nonceMask) + return ret +} + +func aeadChaCha20Poly1305(key, nonceMask []byte) aead { + if len(nonceMask) != aeadNonceLength { + panic("tls: internal error: wrong nonce length") + } + aead, err := chacha20poly1305.New(key) + if err != nil { + panic(err) + } + + ret := &xorNonceAEAD{aead: aead} + copy(ret.nonceMask[:], nonceMask) + return ret +} + +type constantTimeHash interface { + hash.Hash + ConstantTimeSum(b []byte) []byte +} + +// cthWrapper wraps any hash.Hash that implements ConstantTimeSum, and replaces +// with that all calls to Sum. It's used to obtain a ConstantTimeSum-based HMAC. +type cthWrapper struct { + h constantTimeHash +} + +func (c *cthWrapper) Size() int { return c.h.Size() } +func (c *cthWrapper) BlockSize() int { return c.h.BlockSize() } +func (c *cthWrapper) Reset() { c.h.Reset() } +func (c *cthWrapper) Write(p []byte) (int, error) { return c.h.Write(p) } +func (c *cthWrapper) Sum(b []byte) []byte { return c.h.ConstantTimeSum(b) } + +func newConstantTimeHash(h func() hash.Hash) func() hash.Hash { + boring.Unreachable() + return func() hash.Hash { + return &cthWrapper{h().(constantTimeHash)} + } +} + +// tls10MAC implements the TLS 1.0 MAC function. RFC 2246, Section 6.2.3. +func tls10MAC(h hash.Hash, out, seq, header, data, extra []byte) []byte { + h.Reset() + h.Write(seq) + h.Write(header) + h.Write(data) + res := h.Sum(out) + if extra != nil { + h.Write(extra) + } + return res +} + +func rsaKA(version uint16) keyAgreement { + return rsaKeyAgreement{} +} + +func ecdheECDSAKA(version uint16) keyAgreement { + return &ecdheKeyAgreement{ + isRSA: false, + version: version, + } +} + +func ecdheRSAKA(version uint16) keyAgreement { + return &ecdheKeyAgreement{ + isRSA: true, + version: version, + } +} + +// mutualCipherSuite returns a cipherSuite given a list of supported +// ciphersuites and the id requested by the peer. +func mutualCipherSuite(have []uint16, want uint16) *cipherSuite { + for _, id := range have { + if id == want { + return cipherSuiteByID(id) + } + } + return nil +} + +func cipherSuiteByID(id uint16) *cipherSuite { + for _, cipherSuite := range cipherSuites { + if cipherSuite.id == id { + return cipherSuite + } + } + return nil +} + +func mutualCipherSuiteTLS13(have []uint16, want uint16) *cipherSuiteTLS13 { + for _, id := range have { + if id == want { + return cipherSuiteTLS13ByID(id) + } + } + return nil +} + +func cipherSuiteTLS13ByID(id uint16) *cipherSuiteTLS13 { + for _, cipherSuite := range cipherSuitesTLS13 { + if cipherSuite.id == id { + return cipherSuite + } + } + return nil +} + +// A list of cipher suite IDs that are, or have been, implemented by this +// package. +// +// See https://www.iana.org/assignments/tls-parameters/tls-parameters.xml +const ( + // TLS 1.0 - 1.2 cipher suites. + TLS_RSA_WITH_RC4_128_SHA uint16 = 0x0005 + TLS_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0x000a + TLS_RSA_WITH_AES_128_CBC_SHA uint16 = 0x002f + TLS_RSA_WITH_AES_256_CBC_SHA uint16 = 0x0035 + TLS_RSA_WITH_AES_128_CBC_SHA256 uint16 = 0x003c + TLS_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0x009c + TLS_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0x009d + TLS_ECDHE_ECDSA_WITH_RC4_128_SHA uint16 = 0xc007 + TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA uint16 = 0xc009 + TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA uint16 = 0xc00a + TLS_ECDHE_RSA_WITH_RC4_128_SHA uint16 = 0xc011 + TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0xc012 + TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA uint16 = 0xc013 + TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA uint16 = 0xc014 + TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 uint16 = 0xc023 + TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 uint16 = 0xc027 + TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0xc02f + TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 uint16 = 0xc02b + TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0xc030 + TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 uint16 = 0xc02c + TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xcca8 + TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xcca9 + + // TLS 1.3 cipher suites. + TLS_AES_128_GCM_SHA256 uint16 = 0x1301 + TLS_AES_256_GCM_SHA384 uint16 = 0x1302 + TLS_CHACHA20_POLY1305_SHA256 uint16 = 0x1303 + + // TLS_FALLBACK_SCSV isn't a standard cipher suite but an indicator + // that the client is doing version fallback. See RFC 7507. + TLS_FALLBACK_SCSV uint16 = 0x5600 + + // Legacy names for the corresponding cipher suites with the correct _SHA256 + // suffix, retained for backward compatibility. + TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 = TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 + TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 = TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 +) diff --git a/go/src/crypto/tls/common.go b/go/src/crypto/tls/common.go new file mode 100644 index 0000000000000000000000000000000000000000..f6926f1aa5a4d215767f611aa81baf66395bb617 --- /dev/null +++ b/go/src/crypto/tls/common.go @@ -0,0 +1,1901 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "bytes" + "container/list" + "context" + "crypto" + "crypto/ecdsa" + "crypto/ed25519" + "crypto/elliptic" + "crypto/rand" + "crypto/rsa" + "crypto/sha512" + "crypto/tls/internal/fips140tls" + "crypto/x509" + "errors" + "fmt" + "internal/godebug" + "io" + "net" + "runtime" + "slices" + "strings" + "sync" + "time" + _ "unsafe" // for linkname +) + +const ( + VersionTLS10 = 0x0301 + VersionTLS11 = 0x0302 + VersionTLS12 = 0x0303 + VersionTLS13 = 0x0304 + + // Deprecated: SSLv3 is cryptographically broken, and is no longer + // supported by this package. See golang.org/issue/32716. + VersionSSL30 = 0x0300 +) + +// VersionName returns the name for the provided TLS version number +// (e.g. "TLS 1.3"), or a fallback representation of the value if the +// version is not implemented by this package. +func VersionName(version uint16) string { + switch version { + case VersionSSL30: + return "SSLv3" + case VersionTLS10: + return "TLS 1.0" + case VersionTLS11: + return "TLS 1.1" + case VersionTLS12: + return "TLS 1.2" + case VersionTLS13: + return "TLS 1.3" + default: + return fmt.Sprintf("0x%04X", version) + } +} + +const ( + maxPlaintext = 16384 // maximum plaintext payload length + maxCiphertext = 16384 + 2048 // maximum ciphertext payload length + maxCiphertextTLS13 = 16384 + 256 // maximum ciphertext length in TLS 1.3 + recordHeaderLen = 5 // record header length + maxHandshake = 65536 // maximum handshake we support (protocol max is 16 MB) + maxHandshakeCertificateMsg = 262144 // maximum certificate message size (256 KiB) + maxUselessRecords = 16 // maximum number of consecutive non-advancing records +) + +// TLS record types. +type recordType uint8 + +const ( + recordTypeChangeCipherSpec recordType = 20 + recordTypeAlert recordType = 21 + recordTypeHandshake recordType = 22 + recordTypeApplicationData recordType = 23 +) + +// TLS handshake message types. +const ( + typeHelloRequest uint8 = 0 + typeClientHello uint8 = 1 + typeServerHello uint8 = 2 + typeNewSessionTicket uint8 = 4 + typeEndOfEarlyData uint8 = 5 + typeEncryptedExtensions uint8 = 8 + typeCertificate uint8 = 11 + typeServerKeyExchange uint8 = 12 + typeCertificateRequest uint8 = 13 + typeServerHelloDone uint8 = 14 + typeCertificateVerify uint8 = 15 + typeClientKeyExchange uint8 = 16 + typeFinished uint8 = 20 + typeCertificateStatus uint8 = 22 + typeKeyUpdate uint8 = 24 + typeMessageHash uint8 = 254 // synthetic message +) + +// TLS compression types. +const ( + compressionNone uint8 = 0 +) + +// TLS extension numbers +const ( + extensionServerName uint16 = 0 + extensionStatusRequest uint16 = 5 + extensionSupportedCurves uint16 = 10 // supported_groups in TLS 1.3, see RFC 8446, Section 4.2.7 + extensionSupportedPoints uint16 = 11 + extensionSignatureAlgorithms uint16 = 13 + extensionALPN uint16 = 16 + extensionSCT uint16 = 18 + extensionExtendedMasterSecret uint16 = 23 + extensionSessionTicket uint16 = 35 + extensionPreSharedKey uint16 = 41 + extensionEarlyData uint16 = 42 + extensionSupportedVersions uint16 = 43 + extensionCookie uint16 = 44 + extensionPSKModes uint16 = 45 + extensionCertificateAuthorities uint16 = 47 + extensionSignatureAlgorithmsCert uint16 = 50 + extensionKeyShare uint16 = 51 + extensionQUICTransportParameters uint16 = 57 + extensionRenegotiationInfo uint16 = 0xff01 + extensionECHOuterExtensions uint16 = 0xfd00 + extensionEncryptedClientHello uint16 = 0xfe0d +) + +// TLS signaling cipher suite values +const ( + scsvRenegotiation uint16 = 0x00ff +) + +// CurveID is the type of a TLS identifier for a key exchange mechanism. See +// https://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-8. +// +// In TLS 1.2, this registry used to support only elliptic curves. In TLS 1.3, +// it was extended to other groups and renamed NamedGroup. See RFC 8446, Section +// 4.2.7. It was then also extended to other mechanisms, such as hybrid +// post-quantum KEMs. +type CurveID uint16 + +const ( + CurveP256 CurveID = 23 + CurveP384 CurveID = 24 + CurveP521 CurveID = 25 + X25519 CurveID = 29 + X25519MLKEM768 CurveID = 4588 + SecP256r1MLKEM768 CurveID = 4587 + SecP384r1MLKEM1024 CurveID = 4589 +) + +func isTLS13OnlyKeyExchange(curve CurveID) bool { + switch curve { + case X25519MLKEM768, SecP256r1MLKEM768, SecP384r1MLKEM1024: + return true + default: + return false + } +} + +func isPQKeyExchange(curve CurveID) bool { + switch curve { + case X25519MLKEM768, SecP256r1MLKEM768, SecP384r1MLKEM1024: + return true + default: + return false + } +} + +// TLS 1.3 Key Share. See RFC 8446, Section 4.2.8. +type keyShare struct { + group CurveID + data []byte +} + +// TLS 1.3 PSK Key Exchange Modes. See RFC 8446, Section 4.2.9. +const ( + pskModePlain uint8 = 0 + pskModeDHE uint8 = 1 +) + +// TLS 1.3 PSK Identity. Can be a Session Ticket, or a reference to a saved +// session. See RFC 8446, Section 4.2.11. +type pskIdentity struct { + label []byte + obfuscatedTicketAge uint32 +} + +// TLS Elliptic Curve Point Formats +// https://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-9 +const ( + pointFormatUncompressed uint8 = 0 +) + +// TLS CertificateStatusType (RFC 3546) +const ( + statusTypeOCSP uint8 = 1 +) + +// Certificate types (for certificateRequestMsg) +const ( + certTypeRSASign = 1 + certTypeECDSASign = 64 // ECDSA or EdDSA keys, see RFC 8422, Section 3. +) + +// Signature algorithms (for internal signaling use). Starting at 225 to avoid overlap with +// TLS 1.2 codepoints (RFC 5246, Appendix A.4.1), with which these have nothing to do. +const ( + signaturePKCS1v15 uint8 = iota + 225 + signatureRSAPSS + signatureECDSA + signatureEd25519 +) + +// directSigning is a standard Hash value that signals that no pre-hashing +// should be performed, and that the input should be signed directly. It is the +// hash function associated with the Ed25519 signature scheme. +var directSigning crypto.Hash = 0 + +// helloRetryRequestRandom is set as the Random value of a ServerHello +// to signal that the message is actually a HelloRetryRequest. +var helloRetryRequestRandom = []byte{ // See RFC 8446, Section 4.1.3. + 0xCF, 0x21, 0xAD, 0x74, 0xE5, 0x9A, 0x61, 0x11, + 0xBE, 0x1D, 0x8C, 0x02, 0x1E, 0x65, 0xB8, 0x91, + 0xC2, 0xA2, 0x11, 0x16, 0x7A, 0xBB, 0x8C, 0x5E, + 0x07, 0x9E, 0x09, 0xE2, 0xC8, 0xA8, 0x33, 0x9C, +} + +const ( + // downgradeCanaryTLS12 or downgradeCanaryTLS11 is embedded in the server + // random as a downgrade protection if the server would be capable of + // negotiating a higher version. See RFC 8446, Section 4.1.3. + downgradeCanaryTLS12 = "DOWNGRD\x01" + downgradeCanaryTLS11 = "DOWNGRD\x00" +) + +// testingOnlyForceDowngradeCanary is set in tests to force the server side to +// include downgrade canaries even if it's using its highers supported version. +var testingOnlyForceDowngradeCanary bool + +// ConnectionState records basic TLS details about the connection. +type ConnectionState struct { + // Version is the TLS version used by the connection (e.g. VersionTLS12). + Version uint16 + + // HandshakeComplete is true if the handshake has concluded. + HandshakeComplete bool + + // DidResume is true if this connection was successfully resumed from a + // previous session with a session ticket or similar mechanism. + DidResume bool + + // CipherSuite is the cipher suite negotiated for the connection (e.g. + // TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_AES_128_GCM_SHA256). + CipherSuite uint16 + + // CurveID is the key exchange mechanism used for the connection. The name + // refers to elliptic curves for legacy reasons, see [CurveID]. If a legacy + // RSA key exchange is used, this value is zero. + CurveID CurveID + + // NegotiatedProtocol is the application protocol negotiated with ALPN. + NegotiatedProtocol string + + // NegotiatedProtocolIsMutual used to indicate a mutual NPN negotiation. + // + // Deprecated: this value is always true. + NegotiatedProtocolIsMutual bool + + // ServerName is the value of the Server Name Indication extension sent by + // the client. It's available both on the server and on the client side. + ServerName string + + // PeerCertificates are the parsed certificates sent by the peer, in the + // order in which they were sent. The first element is the leaf certificate + // that the connection is verified against. + // + // On the client side, it can't be empty. On the server side, it can be + // empty if Config.ClientAuth is not RequireAnyClientCert or + // RequireAndVerifyClientCert. + // + // PeerCertificates and its contents should not be modified. + PeerCertificates []*x509.Certificate + + // VerifiedChains is a list of one or more chains where the first element is + // PeerCertificates[0] and the last element is from Config.RootCAs (on the + // client side) or Config.ClientCAs (on the server side). + // + // On the client side, it's set if Config.InsecureSkipVerify is false. On + // the server side, it's set if Config.ClientAuth is VerifyClientCertIfGiven + // (and the peer provided a certificate) or RequireAndVerifyClientCert. + // + // VerifiedChains and its contents should not be modified. + VerifiedChains [][]*x509.Certificate + + // SignedCertificateTimestamps is a list of SCTs provided by the peer + // through the TLS handshake for the leaf certificate, if any. + SignedCertificateTimestamps [][]byte + + // OCSPResponse is a stapled Online Certificate Status Protocol (OCSP) + // response provided by the peer for the leaf certificate, if any. + OCSPResponse []byte + + // TLSUnique contains the "tls-unique" channel binding value (see RFC 5929, + // Section 3). This value will be nil for TLS 1.3 connections and for + // resumed connections that don't support Extended Master Secret (RFC 7627). + TLSUnique []byte + + // ECHAccepted indicates if Encrypted Client Hello was offered by the client + // and accepted by the server. Currently, ECH is supported only on the + // client side. + ECHAccepted bool + + // HelloRetryRequest indicates whether we sent a HelloRetryRequest if we + // are a server, or if we received a HelloRetryRequest if we are a client. + HelloRetryRequest bool + + // ekm is a closure exposed via ExportKeyingMaterial. + ekm func(label string, context []byte, length int) ([]byte, error) + + // testingOnlyPeerSignatureAlgorithm is the signature algorithm used by the + // peer to sign the handshake. It is not set for resumed connections. + testingOnlyPeerSignatureAlgorithm SignatureScheme +} + +// ExportKeyingMaterial returns length bytes of exported key material in a new +// slice as defined in RFC 5705. If context is nil, it is not used as part of +// the seed. If the connection was set to allow renegotiation via +// Config.Renegotiation, or if the connections supports neither TLS 1.3 nor +// Extended Master Secret, this function will return an error. +// +// Exporting key material without Extended Master Secret or TLS 1.3 was disabled +// in Go 1.22 due to security issues (see the Security Considerations sections +// of RFC 5705 and RFC 7627), but can be re-enabled with the GODEBUG setting +// tlsunsafeekm=1. +func (cs *ConnectionState) ExportKeyingMaterial(label string, context []byte, length int) ([]byte, error) { + return cs.ekm(label, context, length) +} + +// ClientAuthType declares the policy the server will follow for +// TLS Client Authentication. +type ClientAuthType int + +const ( + // NoClientCert indicates that no client certificate should be requested + // during the handshake, and if any certificates are sent they will not + // be verified. + NoClientCert ClientAuthType = iota + // RequestClientCert indicates that a client certificate should be requested + // during the handshake, but does not require that the client send any + // certificates. + RequestClientCert + // RequireAnyClientCert indicates that a client certificate should be requested + // during the handshake, and that at least one certificate is required to be + // sent by the client, but that certificate is not required to be valid. + RequireAnyClientCert + // VerifyClientCertIfGiven indicates that a client certificate should be requested + // during the handshake, but does not require that the client sends a + // certificate. If the client does send a certificate it is required to be + // valid. + VerifyClientCertIfGiven + // RequireAndVerifyClientCert indicates that a client certificate should be requested + // during the handshake, and that at least one valid certificate is required + // to be sent by the client. + RequireAndVerifyClientCert +) + +// requiresClientCert reports whether the ClientAuthType requires a client +// certificate to be provided. +func requiresClientCert(c ClientAuthType) bool { + switch c { + case RequireAnyClientCert, RequireAndVerifyClientCert: + return true + default: + return false + } +} + +// ClientSessionCache is a cache of ClientSessionState objects that can be used +// by a client to resume a TLS session with a given server. ClientSessionCache +// implementations should expect to be called concurrently from different +// goroutines. Up to TLS 1.2, only ticket-based resumption is supported, not +// SessionID-based resumption. In TLS 1.3 they were merged into PSK modes, which +// are supported via this interface. +type ClientSessionCache interface { + // Get searches for a ClientSessionState associated with the given key. + // On return, ok is true if one was found. + Get(sessionKey string) (session *ClientSessionState, ok bool) + + // Put adds the ClientSessionState to the cache with the given key. It might + // get called multiple times in a connection if a TLS 1.3 server provides + // more than one session ticket. If called with a nil *ClientSessionState, + // it should remove the cache entry. + Put(sessionKey string, cs *ClientSessionState) +} + +//go:generate stringer -linecomment -type=SignatureScheme,CurveID,ClientAuthType -output=common_string.go + +// SignatureScheme identifies a signature algorithm supported by TLS. See +// RFC 8446, Section 4.2.3. +type SignatureScheme uint16 + +const ( + // RSASSA-PKCS1-v1_5 algorithms. + PKCS1WithSHA256 SignatureScheme = 0x0401 + PKCS1WithSHA384 SignatureScheme = 0x0501 + PKCS1WithSHA512 SignatureScheme = 0x0601 + + // RSASSA-PSS algorithms with public key OID rsaEncryption. + PSSWithSHA256 SignatureScheme = 0x0804 + PSSWithSHA384 SignatureScheme = 0x0805 + PSSWithSHA512 SignatureScheme = 0x0806 + + // ECDSA algorithms. Only constrained to a specific curve in TLS 1.3. + ECDSAWithP256AndSHA256 SignatureScheme = 0x0403 + ECDSAWithP384AndSHA384 SignatureScheme = 0x0503 + ECDSAWithP521AndSHA512 SignatureScheme = 0x0603 + + // EdDSA algorithms. + Ed25519 SignatureScheme = 0x0807 + + // Legacy signature and hash algorithms for TLS 1.2. + PKCS1WithSHA1 SignatureScheme = 0x0201 + ECDSAWithSHA1 SignatureScheme = 0x0203 +) + +// ClientHelloInfo contains information from a ClientHello message in order to +// guide application logic in the GetCertificate and GetConfigForClient callbacks. +type ClientHelloInfo struct { + // CipherSuites lists the CipherSuites supported by the client (e.g. + // TLS_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256). + CipherSuites []uint16 + + // ServerName indicates the name of the server requested by the client + // in order to support virtual hosting. ServerName is only set if the + // client is using SNI (see RFC 4366, Section 3.1). + ServerName string + + // SupportedCurves lists the key exchange mechanisms supported by the + // client. It was renamed to "supported groups" in TLS 1.3, see RFC 8446, + // Section 4.2.7 and [CurveID]. + // + // SupportedCurves may be nil in TLS 1.2 and lower if the Supported Elliptic + // Curves Extension is not being used (see RFC 4492, Section 5.1.1). + SupportedCurves []CurveID + + // SupportedPoints lists the point formats supported by the client. + // SupportedPoints is set only if the Supported Point Formats Extension + // is being used (see RFC 4492, Section 5.1.2). + SupportedPoints []uint8 + + // SignatureSchemes lists the signature and hash schemes that the client + // is willing to verify. SignatureSchemes is set only if the Signature + // Algorithms Extension is being used (see RFC 5246, Section 7.4.1.4.1). + SignatureSchemes []SignatureScheme + + // SupportedProtos lists the application protocols supported by the client. + // SupportedProtos is set only if the Application-Layer Protocol + // Negotiation Extension is being used (see RFC 7301, Section 3.1). + // + // Servers can select a protocol by setting Config.NextProtos in a + // GetConfigForClient return value. + SupportedProtos []string + + // SupportedVersions lists the TLS versions supported by the client. + // For TLS versions less than 1.3, this is extrapolated from the max + // version advertised by the client, so values other than the greatest + // might be rejected if used. + SupportedVersions []uint16 + + // Extensions lists the IDs of the extensions presented by the client + // in the ClientHello. + Extensions []uint16 + + // Conn is the underlying net.Conn for the connection. Do not read + // from, or write to, this connection; that will cause the TLS + // connection to fail. + Conn net.Conn + + // HelloRetryRequest indicates whether the ClientHello was sent in response + // to a HelloRetryRequest message. + HelloRetryRequest bool + + // config is embedded by the GetCertificate or GetConfigForClient caller, + // for use with SupportsCertificate. + config *Config + + // ctx is the context of the handshake that is in progress. + ctx context.Context +} + +// Context returns the context of the handshake that is in progress. +// This context is a child of the context passed to HandshakeContext, +// if any, and is canceled when the handshake concludes. +func (c *ClientHelloInfo) Context() context.Context { + return c.ctx +} + +// CertificateRequestInfo contains information from a server's +// CertificateRequest message, which is used to demand a certificate and proof +// of control from a client. +type CertificateRequestInfo struct { + // AcceptableCAs contains zero or more, DER-encoded, X.501 + // Distinguished Names. These are the names of root or intermediate CAs + // that the server wishes the returned certificate to be signed by. An + // empty slice indicates that the server has no preference. + AcceptableCAs [][]byte + + // SignatureSchemes lists the signature schemes that the server is + // willing to verify. + SignatureSchemes []SignatureScheme + + // Version is the TLS version that was negotiated for this connection. + Version uint16 + + // ctx is the context of the handshake that is in progress. + ctx context.Context +} + +// Context returns the context of the handshake that is in progress. +// This context is a child of the context passed to HandshakeContext, +// if any, and is canceled when the handshake concludes. +func (c *CertificateRequestInfo) Context() context.Context { + return c.ctx +} + +// RenegotiationSupport enumerates the different levels of support for TLS +// renegotiation. TLS renegotiation is the act of performing subsequent +// handshakes on a connection after the first. This significantly complicates +// the state machine and has been the source of numerous, subtle security +// issues. Initiating a renegotiation is not supported, but support for +// accepting renegotiation requests may be enabled. +// +// Even when enabled, the server may not change its identity between handshakes +// (i.e. the leaf certificate must be the same). Additionally, concurrent +// handshake and application data flow is not permitted so renegotiation can +// only be used with protocols that synchronise with the renegotiation, such as +// HTTPS. +// +// Renegotiation is not defined in TLS 1.3. +type RenegotiationSupport int + +const ( + // RenegotiateNever disables renegotiation. + RenegotiateNever RenegotiationSupport = iota + + // RenegotiateOnceAsClient allows a remote server to request + // renegotiation once per connection. + RenegotiateOnceAsClient + + // RenegotiateFreelyAsClient allows a remote server to repeatedly + // request renegotiation. + RenegotiateFreelyAsClient +) + +// A Config structure is used to configure a TLS client or server. +// After one has been passed to a TLS function it must not be +// modified. A Config may be reused; the tls package will also not +// modify it. +type Config struct { + // Rand provides the source of entropy for nonces and RSA blinding. + // If Rand is nil, TLS uses the cryptographic random reader in package + // crypto/rand. + // The Reader must be safe for use by multiple goroutines. + Rand io.Reader + + // Time returns the current time as the number of seconds since the epoch. + // If Time is nil, TLS uses time.Now. + Time func() time.Time + + // Certificates contains one or more certificate chains to present to the + // other side of the connection. The first certificate compatible with the + // peer's requirements is selected automatically. + // + // Server configurations must set one of Certificates, GetCertificate or + // GetConfigForClient. Clients doing client-authentication may set either + // Certificates or GetClientCertificate. + // + // Note: if there are multiple Certificates, and they don't have the + // optional field Leaf set, certificate selection will incur a significant + // per-handshake performance cost. + Certificates []Certificate + + // NameToCertificate maps from a certificate name to an element of + // Certificates. Note that a certificate name can be of the form + // '*.example.com' and so doesn't have to be a domain name as such. + // + // Deprecated: NameToCertificate only allows associating a single + // certificate with a given name. Leave this field nil to let the library + // select the first compatible chain from Certificates. + NameToCertificate map[string]*Certificate + + // GetCertificate returns a Certificate based on the given + // ClientHelloInfo. It will only be called if the client supplies SNI + // information or if Certificates is empty. + // + // If GetCertificate is nil or returns nil, then the certificate is + // retrieved from NameToCertificate. If NameToCertificate is nil, the + // best element of Certificates will be used. + // + // Once a Certificate is returned it should not be modified. + GetCertificate func(*ClientHelloInfo) (*Certificate, error) + + // GetClientCertificate, if not nil, is called when a server requests a + // certificate from a client. If set, the contents of Certificates will + // be ignored. + // + // If GetClientCertificate returns an error, the handshake will be + // aborted and that error will be returned. Otherwise + // GetClientCertificate must return a non-nil Certificate. If + // Certificate.Certificate is empty then no certificate will be sent to + // the server. If this is unacceptable to the server then it may abort + // the handshake. + // + // GetClientCertificate may be called multiple times for the same + // connection if renegotiation occurs or if TLS 1.3 is in use. + // + // Once a Certificate is returned it should not be modified. + GetClientCertificate func(*CertificateRequestInfo) (*Certificate, error) + + // GetConfigForClient, if not nil, is called after a ClientHello is + // received from a client. It may return a non-nil Config in order to + // change the Config that will be used to handle this connection. If + // the returned Config is nil, the original Config will be used. The + // Config returned by this callback may not be subsequently modified. + // + // If GetConfigForClient is nil, the Config passed to Server() will be + // used for all connections. + // + // If SessionTicketKey is explicitly set on the returned Config, or if + // SetSessionTicketKeys is called on the returned Config, those keys will + // be used. Otherwise, the original Config keys will be used (and possibly + // rotated if they are automatically managed). WARNING: this allows session + // resumtion of connections originally established with the parent (or a + // sibling) Config, which may bypass the [Config.VerifyPeerCertificate] + // value of the returned Config. + GetConfigForClient func(*ClientHelloInfo) (*Config, error) + + // VerifyPeerCertificate, if not nil, is called after normal + // certificate verification by either a TLS client or server. It + // receives the raw ASN.1 certificates provided by the peer and also + // any verified chains that normal processing found. If it returns a + // non-nil error, the handshake is aborted and that error results. + // + // If normal verification fails then the handshake will abort before + // considering this callback. If normal verification is disabled (on the + // client when InsecureSkipVerify is set, or on a server when ClientAuth is + // RequestClientCert or RequireAnyClientCert), then this callback will be + // considered but the verifiedChains argument will always be nil. When + // ClientAuth is NoClientCert, this callback is not called on the server. + // rawCerts may be empty on the server if ClientAuth is RequestClientCert or + // VerifyClientCertIfGiven. + // + // This callback is not invoked on resumed connections. WARNING: this + // includes connections resumed across Configs returned by [Config.Clone] or + // [Config.GetConfigForClient] and their parents. If that is not intended, + // use [Config.VerifyConnection] instead, or set [Config.SessionTicketsDisabled]. + // + // verifiedChains and its contents should not be modified. + VerifyPeerCertificate func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error + + // VerifyConnection, if not nil, is called after normal certificate + // verification and after VerifyPeerCertificate by either a TLS client + // or server. If it returns a non-nil error, the handshake is aborted + // and that error results. + // + // If normal verification fails then the handshake will abort before + // considering this callback. This callback will run for all connections, + // including resumptions, regardless of InsecureSkipVerify or ClientAuth + // settings. + VerifyConnection func(ConnectionState) error + + // RootCAs defines the set of root certificate authorities + // that clients use when verifying server certificates. + // If RootCAs is nil, TLS uses the host's root CA set. + RootCAs *x509.CertPool + + // NextProtos is a list of supported application level protocols, in + // order of preference. If both peers support ALPN, the selected + // protocol will be one from this list, and the connection will fail + // if there is no mutually supported protocol. If NextProtos is empty + // or the peer doesn't support ALPN, the connection will succeed and + // ConnectionState.NegotiatedProtocol will be empty. + NextProtos []string + + // ServerName is used to verify the hostname on the returned + // certificates unless InsecureSkipVerify is given. It is also included + // in the client's handshake to support virtual hosting unless it is + // an IP address. + ServerName string + + // ClientAuth determines the server's policy for + // TLS Client Authentication. The default is NoClientCert. + ClientAuth ClientAuthType + + // ClientCAs defines the set of root certificate authorities + // that servers use if required to verify a client certificate + // by the policy in ClientAuth. + ClientCAs *x509.CertPool + + // InsecureSkipVerify controls whether a client verifies the server's + // certificate chain and host name. If InsecureSkipVerify is true, crypto/tls + // accepts any certificate presented by the server and any host name in that + // certificate. In this mode, TLS is susceptible to machine-in-the-middle + // attacks unless custom verification is used. This should be used only for + // testing or in combination with VerifyConnection or VerifyPeerCertificate. + InsecureSkipVerify bool + + // CipherSuites is a list of enabled TLS 1.0–1.2 cipher suites. The order of + // the list is ignored. Note that TLS 1.3 ciphersuites are not configurable. + // + // If CipherSuites is nil, a safe default list is used. The default cipher + // suites might change over time. In Go 1.22 RSA key exchange based cipher + // suites were removed from the default list, but can be re-added with the + // GODEBUG setting tlsrsakex=1. In Go 1.23 3DES cipher suites were removed + // from the default list, but can be re-added with the GODEBUG setting + // tls3des=1. + CipherSuites []uint16 + + // PreferServerCipherSuites is a legacy field and has no effect. + // + // It used to control whether the server would follow the client's or the + // server's preference. Servers now select the best mutually supported + // cipher suite based on logic that takes into account inferred client + // hardware, server hardware, and security. + // + // Deprecated: PreferServerCipherSuites is ignored. + PreferServerCipherSuites bool + + // SessionTicketsDisabled may be set to true to disable session ticket and + // PSK (resumption) support. Note that on clients, session ticket support is + // also disabled if ClientSessionCache is nil. + SessionTicketsDisabled bool + + // SessionTicketKey is used by TLS servers to provide session resumption. + // See RFC 5077 and the PSK mode of RFC 8446. If zero, it will be filled + // with random data before the first server handshake. + // + // Deprecated: if this field is left at zero, session ticket keys will be + // automatically rotated every day and dropped after seven days. For + // customizing the rotation schedule or synchronizing servers that are + // terminating connections for the same host, use SetSessionTicketKeys. + SessionTicketKey [32]byte + + // ClientSessionCache is a cache of ClientSessionState entries for TLS + // session resumption. It is only used by clients. + ClientSessionCache ClientSessionCache + + // UnwrapSession is called on the server to turn a ticket/identity + // previously produced by [WrapSession] into a usable session. + // + // UnwrapSession will usually either decrypt a session state in the ticket + // (for example with [Config.EncryptTicket]), or use the ticket as a handle + // to recover a previously stored state. It must use [ParseSessionState] to + // deserialize the session state. + // + // If UnwrapSession returns an error, the connection is terminated. If it + // returns (nil, nil), the session is ignored. crypto/tls may still choose + // not to resume the returned session. + UnwrapSession func(identity []byte, cs ConnectionState) (*SessionState, error) + + // WrapSession is called on the server to produce a session ticket/identity. + // + // WrapSession must serialize the session state with [SessionState.Bytes]. + // It may then encrypt the serialized state (for example with + // [Config.DecryptTicket]) and use it as the ticket, or store the state and + // return a handle for it. + // + // If WrapSession returns an error, the connection is terminated. + // + // Warning: the return value will be exposed on the wire and to clients in + // plaintext. The application is in charge of encrypting and authenticating + // it (and rotating keys) or returning high-entropy identifiers. Failing to + // do so correctly can compromise current, previous, and future connections + // depending on the protocol version. + WrapSession func(ConnectionState, *SessionState) ([]byte, error) + + // MinVersion contains the minimum TLS version that is acceptable. + // + // By default, TLS 1.2 is currently used as the minimum. TLS 1.0 is the + // minimum supported by this package. + // + // The server-side default can be reverted to TLS 1.0 by including the value + // "tls10server=1" in the GODEBUG environment variable. + MinVersion uint16 + + // MaxVersion contains the maximum TLS version that is acceptable. + // + // By default, the maximum version supported by this package is used, + // which is currently TLS 1.3. + MaxVersion uint16 + + // CurvePreferences contains a set of supported key exchange mechanisms. + // The name refers to elliptic curves for legacy reasons, see [CurveID]. + // The order of the list is ignored, and key exchange mechanisms are chosen + // from this list using an internal preference order. If empty, the default + // will be used. + // + // From Go 1.24, the default includes the [X25519MLKEM768] hybrid + // post-quantum key exchange. To disable it, set CurvePreferences explicitly + // or use the GODEBUG=tlsmlkem=0 environment variable. + // + // From Go 1.26, the default includes the [SecP256r1MLKEM768] and + // [SecP256r1MLKEM768] hybrid post-quantum key exchanges, too. To disable + // them, set CurvePreferences explicitly or use either the + // GODEBUG=tlsmlkem=0 or the GODEBUG=tlssecpmlkem=0 environment variable. + CurvePreferences []CurveID + + // DynamicRecordSizingDisabled disables adaptive sizing of TLS records. + // When true, the largest possible TLS record size is always used. When + // false, the size of TLS records may be adjusted in an attempt to + // improve latency. + DynamicRecordSizingDisabled bool + + // Renegotiation controls what types of renegotiation are supported. + // The default, none, is correct for the vast majority of applications. + Renegotiation RenegotiationSupport + + // KeyLogWriter optionally specifies a destination for TLS master secrets + // in NSS key log format that can be used to allow external programs + // such as Wireshark to decrypt TLS connections. + // See https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/Key_Log_Format. + // Use of KeyLogWriter compromises security and should only be + // used for debugging. + KeyLogWriter io.Writer + + // EncryptedClientHelloConfigList is a serialized ECHConfigList. If + // provided, clients will attempt to connect to servers using Encrypted + // Client Hello (ECH) using one of the provided ECHConfigs. + // + // Servers do not use this field. In order to configure ECH for servers, see + // the EncryptedClientHelloKeys field. + // + // If the list contains no valid ECH configs, the handshake will fail + // and return an error. + // + // If EncryptedClientHelloConfigList is set, MinVersion, if set, must + // be VersionTLS13. + // + // When EncryptedClientHelloConfigList is set, the handshake will only + // succeed if ECH is successfully negotiated. If the server rejects ECH, + // an ECHRejectionError error will be returned, which may contain a new + // ECHConfigList that the server suggests using. + // + // How this field is parsed may change in future Go versions, if the + // encoding described in the final Encrypted Client Hello RFC changes. + EncryptedClientHelloConfigList []byte + + // EncryptedClientHelloRejectionVerify, if not nil, is called when ECH is + // rejected by the remote server, in order to verify the ECH provider + // certificate in the outer ClientHello. If it returns a non-nil error, the + // handshake is aborted and that error results. + // + // On the server side this field is not used. + // + // Unlike VerifyPeerCertificate and VerifyConnection, normal certificate + // verification will not be performed before calling + // EncryptedClientHelloRejectionVerify. + // + // If EncryptedClientHelloRejectionVerify is nil and ECH is rejected, the + // roots in RootCAs will be used to verify the ECH providers public + // certificate. VerifyPeerCertificate and VerifyConnection are not called + // when ECH is rejected, even if set, and InsecureSkipVerify is ignored. + EncryptedClientHelloRejectionVerify func(ConnectionState) error + + // GetEncryptedClientHelloKeys, if not nil, is called when by a server when + // a client attempts ECH. + // + // If GetEncryptedClientHelloKeys is not nil, [EncryptedClientHelloKeys] is + // ignored. + // + // If GetEncryptedClientHelloKeys returns an error, the handshake will be + // aborted and the error will be returned. Otherwise, + // GetEncryptedClientHelloKeys must return a non-nil slice of + // [EncryptedClientHelloKey] that represents the acceptable ECH keys. + // + // For further details, see [EncryptedClientHelloKeys]. + GetEncryptedClientHelloKeys func(*ClientHelloInfo) ([]EncryptedClientHelloKey, error) + + // EncryptedClientHelloKeys are the ECH keys to use when a client + // attempts ECH. + // + // If EncryptedClientHelloKeys is set, MinVersion, if set, must be + // VersionTLS13. + // + // If a client attempts ECH, but it is rejected by the server, the server + // will send a list of configs to retry based on the set of + // EncryptedClientHelloKeys which have the SendAsRetry field set. + // + // If GetEncryptedClientHelloKeys is non-nil, EncryptedClientHelloKeys is + // ignored. + // + // On the client side, this field is ignored. In order to configure ECH for + // clients, see the EncryptedClientHelloConfigList field. + EncryptedClientHelloKeys []EncryptedClientHelloKey + + // mutex protects sessionTicketKeys and autoSessionTicketKeys. + mutex sync.RWMutex + // sessionTicketKeys contains zero or more ticket keys. If set, it means + // the keys were set with SessionTicketKey or SetSessionTicketKeys. The + // first key is used for new tickets and any subsequent keys can be used to + // decrypt old tickets. The slice contents are not protected by the mutex + // and are immutable. + sessionTicketKeys []ticketKey + // autoSessionTicketKeys is like sessionTicketKeys but is owned by the + // auto-rotation logic. See Config.ticketKeys. + autoSessionTicketKeys []ticketKey +} + +// EncryptedClientHelloKey holds a private key that is associated +// with a specific ECH config known to a client. +type EncryptedClientHelloKey struct { + // Config should be a marshalled ECHConfig associated with PrivateKey. This + // must match the config provided to clients byte-for-byte. The config must + // use as KEM one of + // + // - DHKEM(P-256, HKDF-SHA256) (0x0010) + // - DHKEM(P-384, HKDF-SHA384) (0x0011) + // - DHKEM(P-521, HKDF-SHA512) (0x0012) + // - DHKEM(X25519, HKDF-SHA256) (0x0020) + // + // and as KDF one of + // + // - HKDF-SHA256 (0x0001) + // - HKDF-SHA384 (0x0002) + // - HKDF-SHA512 (0x0003) + // + // and as AEAD one of + // + // - AES-128-GCM (0x0001) + // - AES-256-GCM (0x0002) + // - ChaCha20Poly1305 (0x0003) + // + Config []byte + // PrivateKey should be a marshalled private key, in the format expected by + // HPKE's DeserializePrivateKey (see RFC 9180), for the KEM used in Config. + PrivateKey []byte + // SendAsRetry indicates if Config should be sent as part of the list of + // retry configs when ECH is requested by the client but rejected by the + // server. + SendAsRetry bool +} + +const ( + // ticketKeyLifetime is how long a ticket key remains valid and can be used to + // resume a client connection. + ticketKeyLifetime = 7 * 24 * time.Hour // 7 days + + // ticketKeyRotation is how often the server should rotate the session ticket key + // that is used for new tickets. + ticketKeyRotation = 24 * time.Hour +) + +// ticketKey is the internal representation of a session ticket key. +type ticketKey struct { + aesKey [16]byte + hmacKey [16]byte + // created is the time at which this ticket key was created. See Config.ticketKeys. + created time.Time +} + +// ticketKeyFromBytes converts from the external representation of a session +// ticket key to a ticketKey. Externally, session ticket keys are 32 random +// bytes and this function expands that into sufficient name and key material. +func (c *Config) ticketKeyFromBytes(b [32]byte) (key ticketKey) { + hashed := sha512.Sum512(b[:]) + // The first 16 bytes of the hash used to be exposed on the wire as a ticket + // prefix. They MUST NOT be used as a secret. In the future, it would make + // sense to use a proper KDF here, like HKDF with a fixed salt. + const legacyTicketKeyNameLen = 16 + copy(key.aesKey[:], hashed[legacyTicketKeyNameLen:]) + copy(key.hmacKey[:], hashed[legacyTicketKeyNameLen+len(key.aesKey):]) + key.created = c.time() + return key +} + +// maxSessionTicketLifetime is the maximum allowed lifetime of a TLS 1.3 session +// ticket, and the lifetime we set for all tickets we send. +const maxSessionTicketLifetime = 7 * 24 * time.Hour + +// Clone returns a shallow clone of c or nil if c is nil. It is safe to clone a +// [Config] that is being used concurrently by a TLS client or server. +// +// The returned Config can share session ticket keys with the original Config, +// which means connections could be resumed across the two Configs. WARNING: +// [Config.VerifyPeerCertificate] does not get called on resumed connections, +// including connections that were originally established on the parent Config. +// If that is not intended, use [Config.VerifyConnection] instead, or set +// [Config.SessionTicketsDisabled]. +func (c *Config) Clone() *Config { + if c == nil { + return nil + } + c.mutex.RLock() + defer c.mutex.RUnlock() + return &Config{ + Rand: c.Rand, + Time: c.Time, + Certificates: c.Certificates, + NameToCertificate: c.NameToCertificate, + GetCertificate: c.GetCertificate, + GetClientCertificate: c.GetClientCertificate, + GetConfigForClient: c.GetConfigForClient, + GetEncryptedClientHelloKeys: c.GetEncryptedClientHelloKeys, + VerifyPeerCertificate: c.VerifyPeerCertificate, + VerifyConnection: c.VerifyConnection, + RootCAs: c.RootCAs, + NextProtos: c.NextProtos, + ServerName: c.ServerName, + ClientAuth: c.ClientAuth, + ClientCAs: c.ClientCAs, + InsecureSkipVerify: c.InsecureSkipVerify, + CipherSuites: c.CipherSuites, + PreferServerCipherSuites: c.PreferServerCipherSuites, + SessionTicketsDisabled: c.SessionTicketsDisabled, + SessionTicketKey: c.SessionTicketKey, + ClientSessionCache: c.ClientSessionCache, + UnwrapSession: c.UnwrapSession, + WrapSession: c.WrapSession, + MinVersion: c.MinVersion, + MaxVersion: c.MaxVersion, + CurvePreferences: c.CurvePreferences, + DynamicRecordSizingDisabled: c.DynamicRecordSizingDisabled, + Renegotiation: c.Renegotiation, + KeyLogWriter: c.KeyLogWriter, + EncryptedClientHelloConfigList: c.EncryptedClientHelloConfigList, + EncryptedClientHelloRejectionVerify: c.EncryptedClientHelloRejectionVerify, + EncryptedClientHelloKeys: c.EncryptedClientHelloKeys, + sessionTicketKeys: c.sessionTicketKeys, + autoSessionTicketKeys: c.autoSessionTicketKeys, + } +} + +// deprecatedSessionTicketKey is set as the prefix of SessionTicketKey if it was +// randomized for backwards compatibility but is not in use. +var deprecatedSessionTicketKey = []byte("DEPRECATED") + +// initLegacySessionTicketKeyRLocked ensures the legacy SessionTicketKey field is +// randomized if empty, and that sessionTicketKeys is populated from it otherwise. +func (c *Config) initLegacySessionTicketKeyRLocked() { + // Don't write if SessionTicketKey is already defined as our deprecated string, + // or if it is defined by the user but sessionTicketKeys is already set. + if c.SessionTicketKey != [32]byte{} && + (bytes.HasPrefix(c.SessionTicketKey[:], deprecatedSessionTicketKey) || len(c.sessionTicketKeys) > 0) { + return + } + + // We need to write some data, so get an exclusive lock and re-check any conditions. + c.mutex.RUnlock() + defer c.mutex.RLock() + c.mutex.Lock() + defer c.mutex.Unlock() + if c.SessionTicketKey == [32]byte{} { + if _, err := io.ReadFull(c.rand(), c.SessionTicketKey[:]); err != nil { + panic(fmt.Sprintf("tls: unable to generate random session ticket key: %v", err)) + } + // Write the deprecated prefix at the beginning so we know we created + // it. This key with the DEPRECATED prefix isn't used as an actual + // session ticket key, and is only randomized in case the application + // reuses it for some reason. + copy(c.SessionTicketKey[:], deprecatedSessionTicketKey) + } else if !bytes.HasPrefix(c.SessionTicketKey[:], deprecatedSessionTicketKey) && len(c.sessionTicketKeys) == 0 { + c.sessionTicketKeys = []ticketKey{c.ticketKeyFromBytes(c.SessionTicketKey)} + } + +} + +// ticketKeys returns the ticketKeys for this connection. +// If configForClient has explicitly set keys, those will +// be returned. Otherwise, the keys on c will be used and +// may be rotated if auto-managed. +// During rotation, any expired session ticket keys are deleted from +// c.sessionTicketKeys. If the session ticket key that is currently +// encrypting tickets (ie. the first ticketKey in c.sessionTicketKeys) +// is not fresh, then a new session ticket key will be +// created and prepended to c.sessionTicketKeys. +func (c *Config) ticketKeys(configForClient *Config) []ticketKey { + // If the ConfigForClient callback returned a Config with explicitly set + // keys, use those, otherwise just use the original Config. + if configForClient != nil { + configForClient.mutex.RLock() + if configForClient.SessionTicketsDisabled { + configForClient.mutex.RUnlock() + return nil + } + configForClient.initLegacySessionTicketKeyRLocked() + if len(configForClient.sessionTicketKeys) != 0 { + ret := configForClient.sessionTicketKeys + configForClient.mutex.RUnlock() + return ret + } + configForClient.mutex.RUnlock() + } + + c.mutex.RLock() + defer c.mutex.RUnlock() + if c.SessionTicketsDisabled { + return nil + } + c.initLegacySessionTicketKeyRLocked() + if len(c.sessionTicketKeys) != 0 { + return c.sessionTicketKeys + } + // Fast path for the common case where the key is fresh enough. + if len(c.autoSessionTicketKeys) > 0 && c.time().Sub(c.autoSessionTicketKeys[0].created) < ticketKeyRotation { + return c.autoSessionTicketKeys + } + + // autoSessionTicketKeys are managed by auto-rotation. + c.mutex.RUnlock() + defer c.mutex.RLock() + c.mutex.Lock() + defer c.mutex.Unlock() + // Re-check the condition in case it changed since obtaining the new lock. + if len(c.autoSessionTicketKeys) == 0 || c.time().Sub(c.autoSessionTicketKeys[0].created) >= ticketKeyRotation { + var newKey [32]byte + if _, err := io.ReadFull(c.rand(), newKey[:]); err != nil { + panic(fmt.Sprintf("unable to generate random session ticket key: %v", err)) + } + valid := make([]ticketKey, 0, len(c.autoSessionTicketKeys)+1) + valid = append(valid, c.ticketKeyFromBytes(newKey)) + for _, k := range c.autoSessionTicketKeys { + // While rotating the current key, also remove any expired ones. + if c.time().Sub(k.created) < ticketKeyLifetime { + valid = append(valid, k) + } + } + c.autoSessionTicketKeys = valid + } + return c.autoSessionTicketKeys +} + +// SetSessionTicketKeys updates the session ticket keys for a server. +// +// The first key will be used when creating new tickets, while all keys can be +// used for decrypting tickets. It is safe to call this function while the +// server is running in order to rotate the session ticket keys. The function +// will panic if keys is empty. +// +// Calling this function will turn off automatic session ticket key rotation. +// +// If multiple servers are terminating connections for the same host they should +// all have the same session ticket keys. If the session ticket keys leaks, +// previously recorded and future TLS connections using those keys might be +// compromised. +func (c *Config) SetSessionTicketKeys(keys [][32]byte) { + if len(keys) == 0 { + panic("tls: keys must have at least one key") + } + + newKeys := make([]ticketKey, len(keys)) + for i, bytes := range keys { + newKeys[i] = c.ticketKeyFromBytes(bytes) + } + + c.mutex.Lock() + c.sessionTicketKeys = newKeys + c.mutex.Unlock() +} + +func (c *Config) rand() io.Reader { + r := c.Rand + if r == nil { + return rand.Reader + } + return r +} + +func (c *Config) time() time.Time { + t := c.Time + if t == nil { + t = time.Now + } + return t() +} + +func (c *Config) cipherSuites(aesGCMPreferred bool) []uint16 { + var cipherSuites []uint16 + if c.CipherSuites == nil { + cipherSuites = defaultCipherSuites(aesGCMPreferred) + } else { + cipherSuites = supportedCipherSuites(aesGCMPreferred) + cipherSuites = slices.DeleteFunc(cipherSuites, func(id uint16) bool { + return !slices.Contains(c.CipherSuites, id) + }) + } + if fips140tls.Required() { + cipherSuites = slices.DeleteFunc(cipherSuites, func(id uint16) bool { + return !slices.Contains(allowedCipherSuitesFIPS, id) + }) + } + return cipherSuites +} + +// supportedCipherSuites returns the supported TLS 1.0–1.2 cipher suites in an +// undefined order. For preference ordering, use [Config.cipherSuites]. +func (c *Config) supportedCipherSuites() []uint16 { + return c.cipherSuites(false) +} + +var supportedVersions = []uint16{ + VersionTLS13, + VersionTLS12, + VersionTLS11, + VersionTLS10, +} + +// roleClient and roleServer are meant to call supportedVersions and parents +// with more readability at the callsite. +const roleClient = true +const roleServer = false + +var tls10server = godebug.New("tls10server") + +// supportedVersions returns the list of supported TLS versions, sorted from +// highest to lowest (and hence also in preference order). +func (c *Config) supportedVersions(isClient bool) []uint16 { + versions := make([]uint16, 0, len(supportedVersions)) + for _, v := range supportedVersions { + if fips140tls.Required() && !slices.Contains(allowedSupportedVersionsFIPS, v) { + continue + } + if (c == nil || c.MinVersion == 0) && v < VersionTLS12 { + if isClient || tls10server.Value() != "1" { + continue + } + } + if isClient && c.EncryptedClientHelloConfigList != nil && v < VersionTLS13 { + continue + } + if c != nil && c.MinVersion != 0 && v < c.MinVersion { + continue + } + if c != nil && c.MaxVersion != 0 && v > c.MaxVersion { + continue + } + versions = append(versions, v) + } + return versions +} + +func (c *Config) maxSupportedVersion(isClient bool) uint16 { + supportedVersions := c.supportedVersions(isClient) + if len(supportedVersions) == 0 { + return 0 + } + return supportedVersions[0] +} + +// supportedVersionsFromMax returns a list of supported versions derived from a +// legacy maximum version value. Note that only versions supported by this +// library are returned. Any newer peer will use supportedVersions anyway. +func supportedVersionsFromMax(maxVersion uint16) []uint16 { + versions := make([]uint16, 0, len(supportedVersions)) + for _, v := range supportedVersions { + if v > maxVersion { + continue + } + versions = append(versions, v) + } + return versions +} + +func (c *Config) curvePreferences(version uint16) []CurveID { + curvePreferences := defaultCurvePreferences() + if fips140tls.Required() { + curvePreferences = slices.DeleteFunc(curvePreferences, func(x CurveID) bool { + return !slices.Contains(allowedCurvePreferencesFIPS, x) + }) + } + if c != nil && len(c.CurvePreferences) != 0 { + curvePreferences = slices.DeleteFunc(curvePreferences, func(x CurveID) bool { + return !slices.Contains(c.CurvePreferences, x) + }) + } + if version < VersionTLS13 { + curvePreferences = slices.DeleteFunc(curvePreferences, isTLS13OnlyKeyExchange) + } + return curvePreferences +} + +func (c *Config) supportsCurve(version uint16, curve CurveID) bool { + return slices.Contains(c.curvePreferences(version), curve) +} + +// mutualVersion returns the protocol version to use given the advertised +// versions of the peer. The highest supported version is preferred. +func (c *Config) mutualVersion(isClient bool, peerVersions []uint16) (uint16, bool) { + supportedVersions := c.supportedVersions(isClient) + for _, v := range supportedVersions { + if slices.Contains(peerVersions, v) { + return v, true + } + } + return 0, false +} + +// errNoCertificates should be an internal detail, +// but widely used packages access it using linkname. +// Notable members of the hall of shame include: +// - github.com/xtls/xray-core +// +// Do not remove or change the type signature. +// See go.dev/issue/67401. +// +//go:linkname errNoCertificates +var errNoCertificates = errors.New("tls: no certificates configured") + +// getCertificate returns the best certificate for the given ClientHelloInfo, +// defaulting to the first element of c.Certificates. +func (c *Config) getCertificate(clientHello *ClientHelloInfo) (*Certificate, error) { + if c.GetCertificate != nil && + (len(c.Certificates) == 0 || len(clientHello.ServerName) > 0) { + cert, err := c.GetCertificate(clientHello) + if cert != nil || err != nil { + return cert, err + } + } + + if len(c.Certificates) == 0 { + return nil, errNoCertificates + } + + if len(c.Certificates) == 1 { + // There's only one choice, so no point doing any work. + return &c.Certificates[0], nil + } + + if c.NameToCertificate != nil { + name := strings.ToLower(clientHello.ServerName) + if cert, ok := c.NameToCertificate[name]; ok { + return cert, nil + } + if len(name) > 0 { + labels := strings.Split(name, ".") + labels[0] = "*" + wildcardName := strings.Join(labels, ".") + if cert, ok := c.NameToCertificate[wildcardName]; ok { + return cert, nil + } + } + } + + for _, cert := range c.Certificates { + if err := clientHello.SupportsCertificate(&cert); err == nil { + return &cert, nil + } + } + + // If nothing matches, return the first certificate. + return &c.Certificates[0], nil +} + +// SupportsCertificate returns nil if the provided certificate is supported by +// the client that sent the ClientHello. Otherwise, it returns an error +// describing the reason for the incompatibility. +// +// If this [ClientHelloInfo] was passed to a GetConfigForClient or GetCertificate +// callback, this method will take into account the associated [Config]. Note that +// if GetConfigForClient returns a different [Config], the change can't be +// accounted for by this method. +// +// This function will call x509.ParseCertificate unless c.Leaf is set, which can +// incur a significant performance cost. +func (chi *ClientHelloInfo) SupportsCertificate(c *Certificate) error { + // Note we don't currently support certificate_authorities nor + // signature_algorithms_cert, and don't check the algorithms of the + // signatures on the chain (which anyway are a SHOULD, see RFC 8446, + // Section 4.4.2.2). + + config := chi.config + if config == nil { + config = &Config{} + } + vers, ok := config.mutualVersion(roleServer, chi.SupportedVersions) + if !ok { + return errors.New("no mutually supported protocol versions") + } + + // If the client specified the name they are trying to connect to, the + // certificate needs to be valid for it. + if chi.ServerName != "" { + x509Cert, err := c.leaf() + if err != nil { + return fmt.Errorf("failed to parse certificate: %w", err) + } + if err := x509Cert.VerifyHostname(chi.ServerName); err != nil { + return fmt.Errorf("certificate is not valid for requested server name: %w", err) + } + } + + // supportsRSAFallback returns nil if the certificate and connection support + // the static RSA key exchange, and unsupported otherwise. The logic for + // supporting static RSA is completely disjoint from the logic for + // supporting signed key exchanges, so we just check it as a fallback. + supportsRSAFallback := func(unsupported error) error { + // TLS 1.3 dropped support for the static RSA key exchange. + if vers == VersionTLS13 { + return unsupported + } + // The static RSA key exchange works by decrypting a challenge with the + // RSA private key, not by signing, so check the PrivateKey implements + // crypto.Decrypter, like *rsa.PrivateKey does. + if priv, ok := c.PrivateKey.(crypto.Decrypter); ok { + if _, ok := priv.Public().(*rsa.PublicKey); !ok { + return unsupported + } + } else { + return unsupported + } + // Finally, there needs to be a mutual cipher suite that uses the static + // RSA key exchange instead of ECDHE. + rsaCipherSuite := selectCipherSuite(chi.CipherSuites, config.supportedCipherSuites(), func(c *cipherSuite) bool { + if c.flags&suiteECDHE != 0 { + return false + } + if vers < VersionTLS12 && c.flags&suiteTLS12 != 0 { + return false + } + return true + }) + if rsaCipherSuite == nil { + return unsupported + } + return nil + } + + // If the client sent the signature_algorithms extension, ensure it supports + // schemes we can use with this certificate and TLS version. + if len(chi.SignatureSchemes) > 0 { + if _, err := selectSignatureScheme(vers, c, chi.SignatureSchemes); err != nil { + return supportsRSAFallback(err) + } + } + + // In TLS 1.3 we are done because supported_groups is only relevant to the + // ECDHE computation, point format negotiation is removed, cipher suites are + // only relevant to the AEAD choice, and static RSA does not exist. + if vers == VersionTLS13 { + return nil + } + + // The only signed key exchange we support is ECDHE. + ecdheSupported, err := supportsECDHE(config, vers, chi.SupportedCurves, chi.SupportedPoints) + if err != nil { + return err + } + if !ecdheSupported { + return supportsRSAFallback(errors.New("client doesn't support ECDHE, can only use legacy RSA key exchange")) + } + + var ecdsaCipherSuite bool + if priv, ok := c.PrivateKey.(crypto.Signer); ok { + switch pub := priv.Public().(type) { + case *ecdsa.PublicKey: + var curve CurveID + switch pub.Curve { + case elliptic.P256(): + curve = CurveP256 + case elliptic.P384(): + curve = CurveP384 + case elliptic.P521(): + curve = CurveP521 + default: + return supportsRSAFallback(unsupportedCertificateError(c)) + } + var curveOk bool + for _, c := range chi.SupportedCurves { + if c == curve && config.supportsCurve(vers, c) { + curveOk = true + break + } + } + if !curveOk { + return errors.New("client doesn't support certificate curve") + } + ecdsaCipherSuite = true + case ed25519.PublicKey: + if vers < VersionTLS12 || len(chi.SignatureSchemes) == 0 { + return errors.New("connection doesn't support Ed25519") + } + ecdsaCipherSuite = true + case *rsa.PublicKey: + default: + return supportsRSAFallback(unsupportedCertificateError(c)) + } + } else { + return supportsRSAFallback(unsupportedCertificateError(c)) + } + + // Make sure that there is a mutually supported cipher suite that works with + // this certificate. Cipher suite selection will then apply the logic in + // reverse to pick it. See also serverHandshakeState.cipherSuiteOk. + cipherSuite := selectCipherSuite(chi.CipherSuites, config.supportedCipherSuites(), func(c *cipherSuite) bool { + if c.flags&suiteECDHE == 0 { + return false + } + if c.flags&suiteECSign != 0 { + if !ecdsaCipherSuite { + return false + } + } else { + if ecdsaCipherSuite { + return false + } + } + if vers < VersionTLS12 && c.flags&suiteTLS12 != 0 { + return false + } + return true + }) + if cipherSuite == nil { + return supportsRSAFallback(errors.New("client doesn't support any cipher suites compatible with the certificate")) + } + + return nil +} + +// SupportsCertificate returns nil if the provided certificate is supported by +// the server that sent the CertificateRequest. Otherwise, it returns an error +// describing the reason for the incompatibility. +func (cri *CertificateRequestInfo) SupportsCertificate(c *Certificate) error { + if _, err := selectSignatureScheme(cri.Version, c, cri.SignatureSchemes); err != nil { + return err + } + + if len(cri.AcceptableCAs) == 0 { + return nil + } + + for j, cert := range c.Certificate { + x509Cert := c.Leaf + // Parse the certificate if this isn't the leaf node, or if + // chain.Leaf was nil. + if j != 0 || x509Cert == nil { + var err error + if x509Cert, err = x509.ParseCertificate(cert); err != nil { + return fmt.Errorf("failed to parse certificate #%d in the chain: %w", j, err) + } + } + + for _, ca := range cri.AcceptableCAs { + if bytes.Equal(x509Cert.RawIssuer, ca) { + return nil + } + } + } + return errors.New("chain is not signed by an acceptable CA") +} + +// BuildNameToCertificate parses c.Certificates and builds c.NameToCertificate +// from the CommonName and SubjectAlternateName fields of each of the leaf +// certificates. +// +// Deprecated: NameToCertificate only allows associating a single certificate +// with a given name. Leave that field nil to let the library select the first +// compatible chain from Certificates. +func (c *Config) BuildNameToCertificate() { + c.NameToCertificate = make(map[string]*Certificate) + for i := range c.Certificates { + cert := &c.Certificates[i] + x509Cert, err := cert.leaf() + if err != nil { + continue + } + // If SANs are *not* present, some clients will consider the certificate + // valid for the name in the Common Name. + if x509Cert.Subject.CommonName != "" && len(x509Cert.DNSNames) == 0 { + c.NameToCertificate[x509Cert.Subject.CommonName] = cert + } + for _, san := range x509Cert.DNSNames { + c.NameToCertificate[san] = cert + } + } +} + +const ( + keyLogLabelTLS12 = "CLIENT_RANDOM" + keyLogLabelClientHandshake = "CLIENT_HANDSHAKE_TRAFFIC_SECRET" + keyLogLabelServerHandshake = "SERVER_HANDSHAKE_TRAFFIC_SECRET" + keyLogLabelClientTraffic = "CLIENT_TRAFFIC_SECRET_0" + keyLogLabelServerTraffic = "SERVER_TRAFFIC_SECRET_0" +) + +func (c *Config) writeKeyLog(label string, clientRandom, secret []byte) error { + if c.KeyLogWriter == nil { + return nil + } + + logLine := fmt.Appendf(nil, "%s %x %x\n", label, clientRandom, secret) + + writerMutex.Lock() + _, err := c.KeyLogWriter.Write(logLine) + writerMutex.Unlock() + + return err +} + +// writerMutex protects all KeyLogWriters globally. It is rarely enabled, +// and is only for debugging, so a global mutex saves space. +var writerMutex sync.Mutex + +// A Certificate is a chain of one or more certificates, leaf first. +type Certificate struct { + Certificate [][]byte + // PrivateKey contains the private key corresponding to the public key in + // Leaf. This must implement [crypto.Signer] with an RSA, ECDSA or Ed25519 + // PublicKey. + // + // For a server up to TLS 1.2, it can also implement crypto.Decrypter with + // an RSA PublicKey. + // + // If it implements [crypto.MessageSigner], SignMessage will be used instead + // of Sign for TLS 1.2 and later. + PrivateKey crypto.PrivateKey + // SupportedSignatureAlgorithms is an optional list restricting what + // signature algorithms the PrivateKey can be used for. + SupportedSignatureAlgorithms []SignatureScheme + // OCSPStaple contains an optional OCSP response which will be served + // to clients that request it. + OCSPStaple []byte + // SignedCertificateTimestamps contains an optional list of Signed + // Certificate Timestamps which will be served to clients that request it. + SignedCertificateTimestamps [][]byte + // Leaf is the parsed form of the leaf certificate, which may be initialized + // using x509.ParseCertificate to reduce per-handshake processing. If nil, + // the leaf certificate will be parsed as needed. + Leaf *x509.Certificate +} + +// leaf returns the parsed leaf certificate, either from c.Leaf or by parsing +// the corresponding c.Certificate[0]. +func (c *Certificate) leaf() (*x509.Certificate, error) { + if c.Leaf != nil { + return c.Leaf, nil + } + return x509.ParseCertificate(c.Certificate[0]) +} + +type handshakeMessage interface { + marshal() ([]byte, error) + unmarshal([]byte) bool +} + +type handshakeMessageWithOriginalBytes interface { + handshakeMessage + + // originalBytes should return the original bytes that were passed to + // unmarshal to create the message. If the message was not produced by + // unmarshal, it should return nil. + originalBytes() []byte +} + +// lruSessionCache is a ClientSessionCache implementation that uses an LRU +// caching strategy. +type lruSessionCache struct { + sync.Mutex + + m map[string]*list.Element + q *list.List + capacity int +} + +type lruSessionCacheEntry struct { + sessionKey string + state *ClientSessionState +} + +// NewLRUClientSessionCache returns a [ClientSessionCache] with the given +// capacity that uses an LRU strategy. If capacity is < 1, a default capacity +// is used instead. +func NewLRUClientSessionCache(capacity int) ClientSessionCache { + const defaultSessionCacheCapacity = 64 + + if capacity < 1 { + capacity = defaultSessionCacheCapacity + } + return &lruSessionCache{ + m: make(map[string]*list.Element), + q: list.New(), + capacity: capacity, + } +} + +// Put adds the provided (sessionKey, cs) pair to the cache. If cs is nil, the entry +// corresponding to sessionKey is removed from the cache instead. +func (c *lruSessionCache) Put(sessionKey string, cs *ClientSessionState) { + c.Lock() + defer c.Unlock() + + if elem, ok := c.m[sessionKey]; ok { + if cs == nil { + c.q.Remove(elem) + delete(c.m, sessionKey) + } else { + entry := elem.Value.(*lruSessionCacheEntry) + entry.state = cs + c.q.MoveToFront(elem) + } + return + } + + if c.q.Len() < c.capacity { + entry := &lruSessionCacheEntry{sessionKey, cs} + c.m[sessionKey] = c.q.PushFront(entry) + return + } + + elem := c.q.Back() + entry := elem.Value.(*lruSessionCacheEntry) + delete(c.m, entry.sessionKey) + entry.sessionKey = sessionKey + entry.state = cs + c.q.MoveToFront(elem) + c.m[sessionKey] = elem +} + +// Get returns the [ClientSessionState] value associated with a given key. It +// returns (nil, false) if no value is found. +func (c *lruSessionCache) Get(sessionKey string) (*ClientSessionState, bool) { + c.Lock() + defer c.Unlock() + + if elem, ok := c.m[sessionKey]; ok { + c.q.MoveToFront(elem) + return elem.Value.(*lruSessionCacheEntry).state, true + } + return nil, false +} + +var emptyConfig Config + +func defaultConfig() *Config { + return &emptyConfig +} + +func unexpectedMessageError(wanted, got any) error { + return fmt.Errorf("tls: received unexpected handshake message of type %T when waiting for %T", got, wanted) +} + +var testingOnlySupportedSignatureAlgorithms []SignatureScheme + +// supportedSignatureAlgorithms returns the supported signature algorithms for +// the given minimum TLS version, to advertise in ClientHello and +// CertificateRequest messages. +func supportedSignatureAlgorithms(minVers uint16) []SignatureScheme { + sigAlgs := defaultSupportedSignatureAlgorithms() + if testingOnlySupportedSignatureAlgorithms != nil { + sigAlgs = slices.Clone(testingOnlySupportedSignatureAlgorithms) + } + return slices.DeleteFunc(sigAlgs, func(s SignatureScheme) bool { + return isDisabledSignatureAlgorithm(minVers, s, false) + }) +} + +var tlssha1 = godebug.New("tlssha1") + +func isDisabledSignatureAlgorithm(version uint16, s SignatureScheme, isCert bool) bool { + if fips140tls.Required() && !slices.Contains(allowedSignatureAlgorithmsFIPS, s) { + return true + } + + // For the _cert extension we include all algorithms, including SHA-1 and + // PKCS#1 v1.5, because it's more likely that something on our side will be + // willing to accept a *-with-SHA1 certificate (e.g. with a custom + // VerifyConnection or by a direct match with the CertPool), than that the + // peer would have a better certificate but is just choosing not to send it. + // crypto/x509 will refuse to verify important SHA-1 signatures anyway. + if isCert { + return false + } + + // TLS 1.3 removed support for PKCS#1 v1.5 and SHA-1 signatures, + // and Go 1.25 removed support for SHA-1 signatures in TLS 1.2. + if version > VersionTLS12 { + sigType, sigHash, _ := typeAndHashFromSignatureScheme(s) + if sigType == signaturePKCS1v15 || sigHash == crypto.SHA1 { + return true + } + } else if tlssha1.Value() != "1" { + _, sigHash, _ := typeAndHashFromSignatureScheme(s) + if sigHash == crypto.SHA1 { + return true + } + } + + return false +} + +// supportedSignatureAlgorithmsCert returns the supported algorithms for +// signatures in certificates. +func supportedSignatureAlgorithmsCert() []SignatureScheme { + sigAlgs := defaultSupportedSignatureAlgorithms() + return slices.DeleteFunc(sigAlgs, func(s SignatureScheme) bool { + return isDisabledSignatureAlgorithm(0, s, true) + }) +} + +func isSupportedSignatureAlgorithm(sigAlg SignatureScheme, supportedSignatureAlgorithms []SignatureScheme) bool { + return slices.Contains(supportedSignatureAlgorithms, sigAlg) +} + +// CertificateVerificationError is returned when certificate verification fails during the handshake. +type CertificateVerificationError struct { + // UnverifiedCertificates and its contents should not be modified. + UnverifiedCertificates []*x509.Certificate + Err error +} + +func (e *CertificateVerificationError) Error() string { + return fmt.Sprintf("tls: failed to verify certificate: %s", e.Err) +} + +func (e *CertificateVerificationError) Unwrap() error { + return e.Err +} + +// fipsAllowedChains returns chains that are allowed to be used in a TLS connection +// based on the current fips140tls enforcement setting. +// +// If fips140tls is not required, the chains are returned as-is with no processing. +// Otherwise, the returned chains are filtered to only those allowed by FIPS 140-3. +// If this results in no chains it returns an error. +func fipsAllowedChains(chains [][]*x509.Certificate) ([][]*x509.Certificate, error) { + if !fips140tls.Required() { + return chains, nil + } + + permittedChains := make([][]*x509.Certificate, 0, len(chains)) + for _, chain := range chains { + if fipsAllowChain(chain) { + permittedChains = append(permittedChains, chain) + } + } + + if len(permittedChains) == 0 { + return nil, errors.New("tls: no FIPS compatible certificate chains found") + } + + return permittedChains, nil +} + +func fipsAllowChain(chain []*x509.Certificate) bool { + if len(chain) == 0 { + return false + } + + for _, cert := range chain { + if !isCertificateAllowedFIPS(cert) { + return false + } + } + + return true +} + +// anyValidVerifiedChain reports if at least one of the chains in verifiedChains +// is valid, as indicated by none of the certificates being expired and the root +// being in opts.Roots (or in the system root pool if opts.Roots is nil). If +// verifiedChains is empty, it returns false. +func anyValidVerifiedChain(verifiedChains [][]*x509.Certificate, opts x509.VerifyOptions) bool { + for _, chain := range verifiedChains { + if len(chain) == 0 { + continue + } + if slices.ContainsFunc(chain, func(cert *x509.Certificate) bool { + return opts.CurrentTime.Before(cert.NotBefore) || opts.CurrentTime.After(cert.NotAfter) + }) { + continue + } + // Since we already validated the chain, we only care that it is rooted + // in a CA in opts.Roots. On platforms where we control chain validation + // (e.g. not Windows or macOS) this is a simple lookup in the CertPool + // internal hash map, which we can simulate by running Verify on the + // root. On other platforms, we have to do full verification again, + // because EKU handling might differ. We will want to replace this with + // CertPool.Contains if/once that is available. See go.dev/issue/77376. + if runtime.GOOS == "windows" || runtime.GOOS == "darwin" || runtime.GOOS == "ios" { + opts.Intermediates = x509.NewCertPool() + for _, cert := range chain[1:max(1, len(chain)-1)] { + opts.Intermediates.AddCert(cert) + } + leaf := chain[0] + if _, err := leaf.Verify(opts); err == nil { + return true + } + } else { + root := chain[len(chain)-1] + if _, err := root.Verify(opts); err == nil { + return true + } + } + } + return false +} diff --git a/go/src/crypto/tls/common_string.go b/go/src/crypto/tls/common_string.go new file mode 100644 index 0000000000000000000000000000000000000000..1e868e7162d3e89101451c390abcf811ec360b39 --- /dev/null +++ b/go/src/crypto/tls/common_string.go @@ -0,0 +1,124 @@ +// Code generated by "stringer -linecomment -type=SignatureScheme,CurveID,ClientAuthType -output=common_string.go"; DO NOT EDIT. + +package tls + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[PKCS1WithSHA256-1025] + _ = x[PKCS1WithSHA384-1281] + _ = x[PKCS1WithSHA512-1537] + _ = x[PSSWithSHA256-2052] + _ = x[PSSWithSHA384-2053] + _ = x[PSSWithSHA512-2054] + _ = x[ECDSAWithP256AndSHA256-1027] + _ = x[ECDSAWithP384AndSHA384-1283] + _ = x[ECDSAWithP521AndSHA512-1539] + _ = x[Ed25519-2055] + _ = x[PKCS1WithSHA1-513] + _ = x[ECDSAWithSHA1-515] +} + +const ( + _SignatureScheme_name_0 = "PKCS1WithSHA1" + _SignatureScheme_name_1 = "ECDSAWithSHA1" + _SignatureScheme_name_2 = "PKCS1WithSHA256" + _SignatureScheme_name_3 = "ECDSAWithP256AndSHA256" + _SignatureScheme_name_4 = "PKCS1WithSHA384" + _SignatureScheme_name_5 = "ECDSAWithP384AndSHA384" + _SignatureScheme_name_6 = "PKCS1WithSHA512" + _SignatureScheme_name_7 = "ECDSAWithP521AndSHA512" + _SignatureScheme_name_8 = "PSSWithSHA256PSSWithSHA384PSSWithSHA512Ed25519" +) + +var ( + _SignatureScheme_index_8 = [...]uint8{0, 13, 26, 39, 46} +) + +func (i SignatureScheme) String() string { + switch { + case i == 513: + return _SignatureScheme_name_0 + case i == 515: + return _SignatureScheme_name_1 + case i == 1025: + return _SignatureScheme_name_2 + case i == 1027: + return _SignatureScheme_name_3 + case i == 1281: + return _SignatureScheme_name_4 + case i == 1283: + return _SignatureScheme_name_5 + case i == 1537: + return _SignatureScheme_name_6 + case i == 1539: + return _SignatureScheme_name_7 + case 2052 <= i && i <= 2055: + i -= 2052 + return _SignatureScheme_name_8[_SignatureScheme_index_8[i]:_SignatureScheme_index_8[i+1]] + default: + return "SignatureScheme(" + strconv.FormatInt(int64(i), 10) + ")" + } +} +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[CurveP256-23] + _ = x[CurveP384-24] + _ = x[CurveP521-25] + _ = x[X25519-29] + _ = x[X25519MLKEM768-4588] + _ = x[SecP256r1MLKEM768-4587] + _ = x[SecP384r1MLKEM1024-4589] +} + +const ( + _CurveID_name_0 = "CurveP256CurveP384CurveP521" + _CurveID_name_1 = "X25519" + _CurveID_name_2 = "SecP256r1MLKEM768X25519MLKEM768SecP384r1MLKEM1024" +) + +var ( + _CurveID_index_0 = [...]uint8{0, 9, 18, 27} + _CurveID_index_2 = [...]uint8{0, 17, 31, 49} +) + +func (i CurveID) String() string { + switch { + case 23 <= i && i <= 25: + i -= 23 + return _CurveID_name_0[_CurveID_index_0[i]:_CurveID_index_0[i+1]] + case i == 29: + return _CurveID_name_1 + case 4587 <= i && i <= 4589: + i -= 4587 + return _CurveID_name_2[_CurveID_index_2[i]:_CurveID_index_2[i+1]] + default: + return "CurveID(" + strconv.FormatInt(int64(i), 10) + ")" + } +} +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[NoClientCert-0] + _ = x[RequestClientCert-1] + _ = x[RequireAnyClientCert-2] + _ = x[VerifyClientCertIfGiven-3] + _ = x[RequireAndVerifyClientCert-4] +} + +const _ClientAuthType_name = "NoClientCertRequestClientCertRequireAnyClientCertVerifyClientCertIfGivenRequireAndVerifyClientCert" + +var _ClientAuthType_index = [...]uint8{0, 12, 29, 49, 72, 98} + +func (i ClientAuthType) String() string { + if i < 0 || i >= ClientAuthType(len(_ClientAuthType_index)-1) { + return "ClientAuthType(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _ClientAuthType_name[_ClientAuthType_index[i]:_ClientAuthType_index[i+1]] +} diff --git a/go/src/crypto/tls/conn.go b/go/src/crypto/tls/conn.go new file mode 100644 index 0000000000000000000000000000000000000000..cfadec68f195b85c4db574e6238c41a5a17576c3 --- /dev/null +++ b/go/src/crypto/tls/conn.go @@ -0,0 +1,1707 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// TLS low level connection and record layer + +package tls + +import ( + "bytes" + "context" + "crypto/cipher" + "crypto/subtle" + "crypto/x509" + "errors" + "fmt" + "hash" + "internal/godebug" + "io" + "net" + "sync" + "sync/atomic" + "time" +) + +// A Conn represents a secured connection. +// It implements the net.Conn interface. +type Conn struct { + // constant + conn net.Conn + isClient bool + handshakeFn func(context.Context) error // (*Conn).clientHandshake or serverHandshake + quic *quicState // nil for non-QUIC connections + + // isHandshakeComplete is true if the connection is currently transferring + // application data (i.e. is not currently processing a handshake). + // isHandshakeComplete is true implies handshakeErr == nil. + isHandshakeComplete atomic.Bool + // constant after handshake; protected by handshakeMutex + handshakeMutex sync.Mutex + handshakeErr error // error resulting from handshake + vers uint16 // TLS version + haveVers bool // version has been negotiated + config *Config // configuration passed to constructor + // handshakes counts the number of handshakes performed on the + // connection so far. If renegotiation is disabled then this is either + // zero or one. + handshakes int + extMasterSecret bool + didResume bool // whether this connection was a session resumption + didHRR bool // whether a HelloRetryRequest was sent/received + cipherSuite uint16 + curveID CurveID + peerSigAlg SignatureScheme + ocspResponse []byte // stapled OCSP response + scts [][]byte // signed certificate timestamps from server + peerCertificates []*x509.Certificate + // verifiedChains contains the certificate chains that we built, as + // opposed to the ones presented by the server. + verifiedChains [][]*x509.Certificate + // serverName contains the server name indicated by the client, if any. + serverName string + // secureRenegotiation is true if the server echoed the secure + // renegotiation extension. (This is meaningless as a server because + // renegotiation is not supported in that case.) + secureRenegotiation bool + // ekm is a closure for exporting keying material. + ekm func(label string, context []byte, length int) ([]byte, error) + // resumptionSecret is the resumption_master_secret for handling + // or sending NewSessionTicket messages. + resumptionSecret []byte + echAccepted bool + + // ticketKeys is the set of active session ticket keys for this + // connection. The first one is used to encrypt new tickets and + // all are tried to decrypt tickets. + ticketKeys []ticketKey + + // clientFinishedIsFirst is true if the client sent the first Finished + // message during the most recent handshake. This is recorded because + // the first transmitted Finished message is the tls-unique + // channel-binding value. + clientFinishedIsFirst bool + + // closeNotifyErr is any error from sending the alertCloseNotify record. + closeNotifyErr error + // closeNotifySent is true if the Conn attempted to send an + // alertCloseNotify record. + closeNotifySent bool + + // clientFinished and serverFinished contain the Finished message sent + // by the client or server in the most recent handshake. This is + // retained to support the renegotiation extension and tls-unique + // channel-binding. + clientFinished [12]byte + serverFinished [12]byte + + // clientProtocol is the negotiated ALPN protocol. + clientProtocol string + + // input/output + in, out halfConn + rawInput bytes.Buffer // raw input, starting with a record header + input bytes.Reader // application data waiting to be read, from rawInput.Next + hand bytes.Buffer // handshake data waiting to be read + buffering bool // whether records are buffered in sendBuf + sendBuf []byte // a buffer of records waiting to be sent + + // bytesSent counts the bytes of application data sent. + // packetsSent counts packets. + bytesSent int64 + packetsSent int64 + + // retryCount counts the number of consecutive non-advancing records + // received by Conn.readRecord. That is, records that neither advance the + // handshake, nor deliver application data. Protected by in.Mutex. + retryCount int + + // activeCall indicates whether Close has been call in the low bit. + // the rest of the bits are the number of goroutines in Conn.Write. + activeCall atomic.Int32 + + tmp [16]byte +} + +// Access to net.Conn methods. +// Cannot just embed net.Conn because that would +// export the struct field too. + +// LocalAddr returns the local network address. +func (c *Conn) LocalAddr() net.Addr { + return c.conn.LocalAddr() +} + +// RemoteAddr returns the remote network address. +func (c *Conn) RemoteAddr() net.Addr { + return c.conn.RemoteAddr() +} + +// SetDeadline sets the read and write deadlines associated with the connection. +// A zero value for t means [Conn.Read] and [Conn.Write] will not time out. +// After a Write has timed out, the TLS state is corrupt and all future writes will return the same error. +func (c *Conn) SetDeadline(t time.Time) error { + return c.conn.SetDeadline(t) +} + +// SetReadDeadline sets the read deadline on the underlying connection. +// A zero value for t means [Conn.Read] will not time out. +func (c *Conn) SetReadDeadline(t time.Time) error { + return c.conn.SetReadDeadline(t) +} + +// SetWriteDeadline sets the write deadline on the underlying connection. +// A zero value for t means [Conn.Write] will not time out. +// After a [Conn.Write] has timed out, the TLS state is corrupt and all future writes will return the same error. +func (c *Conn) SetWriteDeadline(t time.Time) error { + return c.conn.SetWriteDeadline(t) +} + +// NetConn returns the underlying connection that is wrapped by c. +// Note that writing to or reading from this connection directly will corrupt the +// TLS session. +func (c *Conn) NetConn() net.Conn { + return c.conn +} + +// A halfConn represents one direction of the record layer +// connection, either sending or receiving. +type halfConn struct { + sync.Mutex + + err error // first permanent error + version uint16 // protocol version + cipher any // cipher algorithm + mac hash.Hash + seq [8]byte // 64-bit sequence number + + scratchBuf [13]byte // to avoid allocs; interface method args escape + + nextCipher any // next encryption state + nextMac hash.Hash // next MAC algorithm + + level QUICEncryptionLevel // current QUIC encryption level + trafficSecret []byte // current TLS 1.3 traffic secret +} + +type permanentError struct { + err net.Error +} + +func (e *permanentError) Error() string { return e.err.Error() } +func (e *permanentError) Unwrap() error { return e.err } +func (e *permanentError) Timeout() bool { return e.err.Timeout() } +func (e *permanentError) Temporary() bool { return false } + +func (hc *halfConn) setErrorLocked(err error) error { + if e, ok := err.(net.Error); ok { + hc.err = &permanentError{err: e} + } else { + hc.err = err + } + return hc.err +} + +// prepareCipherSpec sets the encryption and MAC states +// that a subsequent changeCipherSpec will use. +func (hc *halfConn) prepareCipherSpec(version uint16, cipher any, mac hash.Hash) { + hc.version = version + hc.nextCipher = cipher + hc.nextMac = mac +} + +// changeCipherSpec changes the encryption and MAC states +// to the ones previously passed to prepareCipherSpec. +func (hc *halfConn) changeCipherSpec() error { + if hc.nextCipher == nil || hc.version == VersionTLS13 { + return alertInternalError + } + hc.cipher = hc.nextCipher + hc.mac = hc.nextMac + hc.nextCipher = nil + hc.nextMac = nil + clear(hc.seq[:]) + return nil +} + +// setTrafficSecret sets the traffic secret for the given encryption level. setTrafficSecret +// should not be called directly, but rather through the Conn setWriteTrafficSecret and +// setReadTrafficSecret wrapper methods. +func (hc *halfConn) setTrafficSecret(suite *cipherSuiteTLS13, level QUICEncryptionLevel, secret []byte) { + hc.trafficSecret = secret + hc.level = level + key, iv := suite.trafficKey(secret) + hc.cipher = suite.aead(key, iv) + clear(hc.seq[:]) +} + +// incSeq increments the sequence number. +func (hc *halfConn) incSeq() { + for i := 7; i >= 0; i-- { + hc.seq[i]++ + if hc.seq[i] != 0 { + return + } + } + + // Not allowed to let sequence number wrap. + // Instead, must renegotiate before it does. + // Not likely enough to bother. + panic("TLS: sequence number wraparound") +} + +// explicitNonceLen returns the number of bytes of explicit nonce or IV included +// in each record. Explicit nonces are present only in CBC modes after TLS 1.0 +// and in certain AEAD modes in TLS 1.2. +func (hc *halfConn) explicitNonceLen() int { + if hc.cipher == nil { + return 0 + } + + switch c := hc.cipher.(type) { + case cipher.Stream: + return 0 + case aead: + return c.explicitNonceLen() + case cbcMode: + // TLS 1.1 introduced a per-record explicit IV to fix the BEAST attack. + if hc.version >= VersionTLS11 { + return c.BlockSize() + } + return 0 + default: + panic("unknown cipher type") + } +} + +// extractPadding returns, in constant time, the length of the padding to remove +// from the end of payload. It also returns a byte which is equal to 255 if the +// padding was valid and 0 otherwise. See RFC 2246, Section 6.2.3.2. +func extractPadding(payload []byte) (toRemove int, good byte) { + if len(payload) < 1 { + return 0, 0 + } + + paddingLen := payload[len(payload)-1] + t := uint(len(payload)-1) - uint(paddingLen) + // if len(payload) >= (paddingLen - 1) then the MSB of t is zero + good = byte(int32(^t) >> 31) + + // The maximum possible padding length plus the actual length field + toCheck := 256 + // The length of the padded data is public, so we can use an if here + if toCheck > len(payload) { + toCheck = len(payload) + } + + for i := 0; i < toCheck; i++ { + t := uint(paddingLen) - uint(i) + // if i <= paddingLen then the MSB of t is zero + mask := byte(int32(^t) >> 31) + b := payload[len(payload)-1-i] + good &^= mask&paddingLen ^ mask&b + } + + // We AND together the bits of good and replicate the result across + // all the bits. + good &= good << 4 + good &= good << 2 + good &= good << 1 + good = uint8(int8(good) >> 7) + + // Zero the padding length on error. This ensures any unchecked bytes + // are included in the MAC. Otherwise, an attacker that could + // distinguish MAC failures from padding failures could mount an attack + // similar to POODLE in SSL 3.0: given a good ciphertext that uses a + // full block's worth of padding, replace the final block with another + // block. If the MAC check passed but the padding check failed, the + // last byte of that block decrypted to the block size. + // + // See also macAndPaddingGood logic below. + paddingLen &= good + + toRemove = int(paddingLen) + 1 + return +} + +func roundUp(a, b int) int { + return a + (b-a%b)%b +} + +// cbcMode is an interface for block ciphers using cipher block chaining. +type cbcMode interface { + cipher.BlockMode + SetIV([]byte) +} + +// decrypt authenticates and decrypts the record if protection is active at +// this stage. The returned plaintext might overlap with the input. +func (hc *halfConn) decrypt(record []byte) ([]byte, recordType, error) { + var plaintext []byte + typ := recordType(record[0]) + payload := record[recordHeaderLen:] + + // In TLS 1.3, change_cipher_spec messages are to be ignored without being + // decrypted. See RFC 8446, Appendix D.4. + if hc.version == VersionTLS13 && typ == recordTypeChangeCipherSpec { + return payload, typ, nil + } + + paddingGood := byte(255) + paddingLen := 0 + + explicitNonceLen := hc.explicitNonceLen() + + if hc.cipher != nil { + switch c := hc.cipher.(type) { + case cipher.Stream: + c.XORKeyStream(payload, payload) + case aead: + if len(payload) < explicitNonceLen { + return nil, 0, alertBadRecordMAC + } + nonce := payload[:explicitNonceLen] + if len(nonce) == 0 { + nonce = hc.seq[:] + } + payload = payload[explicitNonceLen:] + + var additionalData []byte + if hc.version == VersionTLS13 { + additionalData = record[:recordHeaderLen] + } else { + additionalData = append(hc.scratchBuf[:0], hc.seq[:]...) + additionalData = append(additionalData, record[:3]...) + n := len(payload) - c.Overhead() + additionalData = append(additionalData, byte(n>>8), byte(n)) + } + + var err error + plaintext, err = c.Open(payload[:0], nonce, payload, additionalData) + if err != nil { + return nil, 0, alertBadRecordMAC + } + case cbcMode: + blockSize := c.BlockSize() + minPayload := explicitNonceLen + roundUp(hc.mac.Size()+1, blockSize) + if len(payload)%blockSize != 0 || len(payload) < minPayload { + return nil, 0, alertBadRecordMAC + } + + if explicitNonceLen > 0 { + c.SetIV(payload[:explicitNonceLen]) + payload = payload[explicitNonceLen:] + } + c.CryptBlocks(payload, payload) + + // In a limited attempt to protect against CBC padding oracles like + // Lucky13, the data past paddingLen (which is secret) is passed to + // the MAC function as extra data, to be fed into the HMAC after + // computing the digest. This makes the MAC roughly constant time as + // long as the digest computation is constant time and does not + // affect the subsequent write, modulo cache effects. + paddingLen, paddingGood = extractPadding(payload) + default: + panic("unknown cipher type") + } + + if hc.version == VersionTLS13 { + if typ != recordTypeApplicationData { + return nil, 0, alertUnexpectedMessage + } + if len(plaintext) > maxPlaintext+1 { + return nil, 0, alertRecordOverflow + } + // Remove padding and find the ContentType scanning from the end. + for i := len(plaintext) - 1; i >= 0; i-- { + if plaintext[i] != 0 { + typ = recordType(plaintext[i]) + plaintext = plaintext[:i] + break + } + if i == 0 { + return nil, 0, alertUnexpectedMessage + } + } + } + } else { + plaintext = payload + } + + if hc.mac != nil { + macSize := hc.mac.Size() + if len(payload) < macSize { + return nil, 0, alertBadRecordMAC + } + + n := len(payload) - macSize - paddingLen + n = subtle.ConstantTimeSelect(int(uint32(n)>>31), 0, n) // if n < 0 { n = 0 } + record[3] = byte(n >> 8) + record[4] = byte(n) + remoteMAC := payload[n : n+macSize] + localMAC := tls10MAC(hc.mac, hc.scratchBuf[:0], hc.seq[:], record[:recordHeaderLen], payload[:n], payload[n+macSize:]) + + // This is equivalent to checking the MACs and paddingGood + // separately, but in constant-time to prevent distinguishing + // padding failures from MAC failures. Depending on what value + // of paddingLen was returned on bad padding, distinguishing + // bad MAC from bad padding can lead to an attack. + // + // See also the logic at the end of extractPadding. + macAndPaddingGood := subtle.ConstantTimeCompare(localMAC, remoteMAC) & int(paddingGood) + if macAndPaddingGood != 1 { + return nil, 0, alertBadRecordMAC + } + + plaintext = payload[:n] + } + + hc.incSeq() + return plaintext, typ, nil +} + +// sliceForAppend extends the input slice by n bytes. head is the full extended +// slice, while tail is the appended part. If the original slice has sufficient +// capacity no allocation is performed. +func sliceForAppend(in []byte, n int) (head, tail []byte) { + if total := len(in) + n; cap(in) >= total { + head = in[:total] + } else { + head = make([]byte, total) + copy(head, in) + } + tail = head[len(in):] + return +} + +// encrypt encrypts payload, adding the appropriate nonce and/or MAC, and +// appends it to record, which must already contain the record header. +func (hc *halfConn) encrypt(record, payload []byte, rand io.Reader) ([]byte, error) { + if hc.cipher == nil { + return append(record, payload...), nil + } + + var explicitNonce []byte + if explicitNonceLen := hc.explicitNonceLen(); explicitNonceLen > 0 { + record, explicitNonce = sliceForAppend(record, explicitNonceLen) + if _, isCBC := hc.cipher.(cbcMode); !isCBC && explicitNonceLen < 16 { + // The AES-GCM construction in TLS has an explicit nonce so that the + // nonce can be random. However, the nonce is only 8 bytes which is + // too small for a secure, random nonce. Therefore we use the + // sequence number as the nonce. The 3DES-CBC construction also has + // an 8 bytes nonce but its nonces must be unpredictable (see RFC + // 5246, Appendix F.3), forcing us to use randomness. That's not + // 3DES' biggest problem anyway because the birthday bound on block + // collision is reached first due to its similarly small block size + // (see the Sweet32 attack). + copy(explicitNonce, hc.seq[:]) + } else { + if _, err := io.ReadFull(rand, explicitNonce); err != nil { + return nil, err + } + } + } + + var dst []byte + switch c := hc.cipher.(type) { + case cipher.Stream: + mac := tls10MAC(hc.mac, hc.scratchBuf[:0], hc.seq[:], record[:recordHeaderLen], payload, nil) + record, dst = sliceForAppend(record, len(payload)+len(mac)) + c.XORKeyStream(dst[:len(payload)], payload) + c.XORKeyStream(dst[len(payload):], mac) + case aead: + nonce := explicitNonce + if len(nonce) == 0 { + nonce = hc.seq[:] + } + + if hc.version == VersionTLS13 { + record = append(record, payload...) + + // Encrypt the actual ContentType and replace the plaintext one. + record = append(record, record[0]) + record[0] = byte(recordTypeApplicationData) + + n := len(payload) + 1 + c.Overhead() + record[3] = byte(n >> 8) + record[4] = byte(n) + + record = c.Seal(record[:recordHeaderLen], + nonce, record[recordHeaderLen:], record[:recordHeaderLen]) + } else { + additionalData := append(hc.scratchBuf[:0], hc.seq[:]...) + additionalData = append(additionalData, record[:recordHeaderLen]...) + record = c.Seal(record, nonce, payload, additionalData) + } + case cbcMode: + mac := tls10MAC(hc.mac, hc.scratchBuf[:0], hc.seq[:], record[:recordHeaderLen], payload, nil) + blockSize := c.BlockSize() + plaintextLen := len(payload) + len(mac) + paddingLen := blockSize - plaintextLen%blockSize + record, dst = sliceForAppend(record, plaintextLen+paddingLen) + copy(dst, payload) + copy(dst[len(payload):], mac) + for i := plaintextLen; i < len(dst); i++ { + dst[i] = byte(paddingLen - 1) + } + if len(explicitNonce) > 0 { + c.SetIV(explicitNonce) + } + c.CryptBlocks(dst, dst) + default: + panic("unknown cipher type") + } + + // Update length to include nonce, MAC and any block padding needed. + n := len(record) - recordHeaderLen + record[3] = byte(n >> 8) + record[4] = byte(n) + hc.incSeq() + + return record, nil +} + +// RecordHeaderError is returned when a TLS record header is invalid. +type RecordHeaderError struct { + // Msg contains a human readable string that describes the error. + Msg string + // RecordHeader contains the five bytes of TLS record header that + // triggered the error. + RecordHeader [5]byte + // Conn provides the underlying net.Conn in the case that a client + // sent an initial handshake that didn't look like TLS. + // It is nil if there's already been a handshake or a TLS alert has + // been written to the connection. + Conn net.Conn +} + +func (e RecordHeaderError) Error() string { return "tls: " + e.Msg } + +func (c *Conn) newRecordHeaderError(conn net.Conn, msg string) (err RecordHeaderError) { + err.Msg = msg + err.Conn = conn + copy(err.RecordHeader[:], c.rawInput.Bytes()) + return err +} + +func (c *Conn) readRecord() error { + return c.readRecordOrCCS(false) +} + +func (c *Conn) readChangeCipherSpec() error { + return c.readRecordOrCCS(true) +} + +// readRecordOrCCS reads one or more TLS records from the connection and +// updates the record layer state. Some invariants: +// - c.in must be locked +// - c.input must be empty +// +// During the handshake one and only one of the following will happen: +// - c.hand grows +// - c.in.changeCipherSpec is called +// - an error is returned +// +// After the handshake one and only one of the following will happen: +// - c.hand grows +// - c.input is set +// - an error is returned +func (c *Conn) readRecordOrCCS(expectChangeCipherSpec bool) error { + if c.in.err != nil { + return c.in.err + } + handshakeComplete := c.isHandshakeComplete.Load() + + // This function modifies c.rawInput, which owns the c.input memory. + if c.input.Len() != 0 { + return c.in.setErrorLocked(errors.New("tls: internal error: attempted to read record with pending application data")) + } + c.input.Reset(nil) + + if c.quic != nil { + return c.in.setErrorLocked(errors.New("tls: internal error: attempted to read record with QUIC transport")) + } + + // Read header, payload. + if err := c.readFromUntil(c.conn, recordHeaderLen); err != nil { + // RFC 8446, Section 6.1 suggests that EOF without an alertCloseNotify + // is an error, but popular web sites seem to do this, so we accept it + // if and only if at the record boundary. + if err == io.ErrUnexpectedEOF && c.rawInput.Len() == 0 { + err = io.EOF + } + if e, ok := err.(net.Error); !ok || !e.Temporary() { + c.in.setErrorLocked(err) + } + return err + } + hdr := c.rawInput.Bytes()[:recordHeaderLen] + typ := recordType(hdr[0]) + + // No valid TLS record has a type of 0x80, however SSLv2 handshakes + // start with a uint16 length where the MSB is set and the first record + // is always < 256 bytes long. Therefore typ == 0x80 strongly suggests + // an SSLv2 client. + if !handshakeComplete && typ == 0x80 { + c.sendAlert(alertProtocolVersion) + return c.in.setErrorLocked(c.newRecordHeaderError(nil, "unsupported SSLv2 handshake received")) + } + + vers := uint16(hdr[1])<<8 | uint16(hdr[2]) + expectedVers := c.vers + if expectedVers == VersionTLS13 { + // All TLS 1.3 records are expected to have 0x0303 (1.2) after + // the initial hello (RFC 8446 Section 5.1). + expectedVers = VersionTLS12 + } + n := int(hdr[3])<<8 | int(hdr[4]) + if c.haveVers && vers != expectedVers { + c.sendAlert(alertProtocolVersion) + msg := fmt.Sprintf("received record with version %x when expecting version %x", vers, expectedVers) + return c.in.setErrorLocked(c.newRecordHeaderError(nil, msg)) + } + if !c.haveVers { + // First message, be extra suspicious: this might not be a TLS + // client. Bail out before reading a full 'body', if possible. + // The current max version is 3.3 so if the version is >= 16.0, + // it's probably not real. + if (typ != recordTypeAlert && typ != recordTypeHandshake) || vers >= 0x1000 { + return c.in.setErrorLocked(c.newRecordHeaderError(c.conn, "first record does not look like a TLS handshake")) + } + } + if c.vers == VersionTLS13 && n > maxCiphertextTLS13 || n > maxCiphertext { + c.sendAlert(alertRecordOverflow) + msg := fmt.Sprintf("oversized record received with length %d", n) + return c.in.setErrorLocked(c.newRecordHeaderError(nil, msg)) + } + if err := c.readFromUntil(c.conn, recordHeaderLen+n); err != nil { + if e, ok := err.(net.Error); !ok || !e.Temporary() { + c.in.setErrorLocked(err) + } + return err + } + + // Process message. + record := c.rawInput.Next(recordHeaderLen + n) + data, typ, err := c.in.decrypt(record) + if err != nil { + return c.in.setErrorLocked(c.sendAlert(err.(alert))) + } + if len(data) > maxPlaintext { + return c.in.setErrorLocked(c.sendAlert(alertRecordOverflow)) + } + + // Application Data messages are always protected. + if c.in.cipher == nil && typ == recordTypeApplicationData { + return c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) + } + + if typ != recordTypeAlert && typ != recordTypeChangeCipherSpec && len(data) > 0 { + // This is a state-advancing message: reset the retry count. + c.retryCount = 0 + } + + // Handshake messages MUST NOT be interleaved with other record types in TLS 1.3. + if c.vers == VersionTLS13 && typ != recordTypeHandshake && c.hand.Len() > 0 { + return c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) + } + + switch typ { + default: + return c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) + + case recordTypeAlert: + if c.quic != nil { + return c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) + } + if len(data) != 2 { + return c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) + } + if alert(data[1]) == alertCloseNotify { + return c.in.setErrorLocked(io.EOF) + } + if c.vers == VersionTLS13 { + // TLS 1.3 removed warning-level alerts except for alertUserCanceled + // (RFC 8446, § 6.1). Since at least one major implementation + // (https://bugs.openjdk.org/browse/JDK-8323517) misuses this alert, + // many TLS stacks now ignore it outright when seen in a TLS 1.3 + // handshake (e.g. BoringSSL, NSS, Rustls). + if alert(data[1]) == alertUserCanceled { + // Like TLS 1.2 alertLevelWarning alerts, we drop the record and retry. + return c.retryReadRecord(expectChangeCipherSpec) + } + return c.in.setErrorLocked(&net.OpError{Op: "remote error", Err: alert(data[1])}) + } + switch data[0] { + case alertLevelWarning: + // Drop the record on the floor and retry. + return c.retryReadRecord(expectChangeCipherSpec) + case alertLevelError: + return c.in.setErrorLocked(&net.OpError{Op: "remote error", Err: alert(data[1])}) + default: + return c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) + } + + case recordTypeChangeCipherSpec: + if len(data) != 1 || data[0] != 1 { + return c.in.setErrorLocked(c.sendAlert(alertDecodeError)) + } + // Handshake messages are not allowed to fragment across the CCS. + if c.hand.Len() > 0 { + return c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) + } + // In TLS 1.3, change_cipher_spec records are ignored until the + // Finished. See RFC 8446, Appendix D.4. Note that according to Section + // 5, a server can send a ChangeCipherSpec before its ServerHello, when + // c.vers is still unset. That's not useful though and suspicious if the + // server then selects a lower protocol version, so don't allow that. + if c.vers == VersionTLS13 { + return c.retryReadRecord(expectChangeCipherSpec) + } + if !expectChangeCipherSpec { + return c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) + } + if err := c.in.changeCipherSpec(); err != nil { + return c.in.setErrorLocked(c.sendAlert(err.(alert))) + } + + case recordTypeApplicationData: + if !handshakeComplete || expectChangeCipherSpec { + return c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) + } + // Some OpenSSL servers send empty records in order to randomize the + // CBC IV. Ignore a limited number of empty records. + if len(data) == 0 { + return c.retryReadRecord(expectChangeCipherSpec) + } + // Note that data is owned by c.rawInput, following the Next call above, + // to avoid copying the plaintext. This is safe because c.rawInput is + // not read from or written to until c.input is drained. + c.input.Reset(data) + + case recordTypeHandshake: + if len(data) == 0 || expectChangeCipherSpec { + return c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) + } + c.hand.Write(data) + } + + return nil +} + +// retryReadRecord recurs into readRecordOrCCS to drop a non-advancing record, like +// a warning alert, empty application_data, or a change_cipher_spec in TLS 1.3. +func (c *Conn) retryReadRecord(expectChangeCipherSpec bool) error { + c.retryCount++ + if c.retryCount > maxUselessRecords { + c.sendAlert(alertUnexpectedMessage) + return c.in.setErrorLocked(errors.New("tls: too many ignored records")) + } + return c.readRecordOrCCS(expectChangeCipherSpec) +} + +// atLeastReader reads from R, stopping with EOF once at least N bytes have been +// read. It is different from an io.LimitedReader in that it doesn't cut short +// the last Read call, and in that it considers an early EOF an error. +type atLeastReader struct { + R io.Reader + N int64 +} + +func (r *atLeastReader) Read(p []byte) (int, error) { + if r.N <= 0 { + return 0, io.EOF + } + n, err := r.R.Read(p) + r.N -= int64(n) // won't underflow unless len(p) >= n > 9223372036854775809 + if r.N > 0 && err == io.EOF { + return n, io.ErrUnexpectedEOF + } + if r.N <= 0 && err == nil { + return n, io.EOF + } + return n, err +} + +// readFromUntil reads from r into c.rawInput until c.rawInput contains +// at least n bytes or else returns an error. +func (c *Conn) readFromUntil(r io.Reader, n int) error { + if c.rawInput.Len() >= n { + return nil + } + needs := n - c.rawInput.Len() + // There might be extra input waiting on the wire. Make a best effort + // attempt to fetch it so that it can be used in (*Conn).Read to + // "predict" closeNotify alerts. + c.rawInput.Grow(needs + bytes.MinRead) + _, err := c.rawInput.ReadFrom(&atLeastReader{r, int64(needs)}) + return err +} + +// sendAlertLocked sends a TLS alert message. +func (c *Conn) sendAlertLocked(err alert) error { + if c.quic != nil { + return c.out.setErrorLocked(&net.OpError{Op: "local error", Err: err}) + } + + switch err { + case alertNoRenegotiation, alertCloseNotify: + c.tmp[0] = alertLevelWarning + default: + c.tmp[0] = alertLevelError + } + c.tmp[1] = byte(err) + + _, writeErr := c.writeRecordLocked(recordTypeAlert, c.tmp[0:2]) + if err == alertCloseNotify { + // closeNotify is a special case in that it isn't an error. + return writeErr + } + + return c.out.setErrorLocked(&net.OpError{Op: "local error", Err: err}) +} + +// sendAlert sends a TLS alert message. +func (c *Conn) sendAlert(err alert) error { + c.out.Lock() + defer c.out.Unlock() + return c.sendAlertLocked(err) +} + +const ( + // tcpMSSEstimate is a conservative estimate of the TCP maximum segment + // size (MSS). A constant is used, rather than querying the kernel for + // the actual MSS, to avoid complexity. The value here is the IPv6 + // minimum MTU (1280 bytes) minus the overhead of an IPv6 header (40 + // bytes) and a TCP header with timestamps (32 bytes). + tcpMSSEstimate = 1208 + + // recordSizeBoostThreshold is the number of bytes of application data + // sent after which the TLS record size will be increased to the + // maximum. + recordSizeBoostThreshold = 128 * 1024 +) + +// maxPayloadSizeForWrite returns the maximum TLS payload size to use for the +// next application data record. There is the following trade-off: +// +// - For latency-sensitive applications, such as web browsing, each TLS +// record should fit in one TCP segment. +// - For throughput-sensitive applications, such as large file transfers, +// larger TLS records better amortize framing and encryption overheads. +// +// A simple heuristic that works well in practice is to use small records for +// the first 1MB of data, then use larger records for subsequent data, and +// reset back to smaller records after the connection becomes idle. See "High +// Performance Web Networking", Chapter 4, or: +// https://www.igvita.com/2013/10/24/optimizing-tls-record-size-and-buffering-latency/ +// +// In the interests of simplicity and determinism, this code does not attempt +// to reset the record size once the connection is idle, however. +func (c *Conn) maxPayloadSizeForWrite(typ recordType) int { + if c.config.DynamicRecordSizingDisabled || typ != recordTypeApplicationData { + return maxPlaintext + } + + if c.bytesSent >= recordSizeBoostThreshold { + return maxPlaintext + } + + // Subtract TLS overheads to get the maximum payload size. + payloadBytes := tcpMSSEstimate - recordHeaderLen - c.out.explicitNonceLen() + if c.out.cipher != nil { + switch ciph := c.out.cipher.(type) { + case cipher.Stream: + payloadBytes -= c.out.mac.Size() + case cipher.AEAD: + payloadBytes -= ciph.Overhead() + case cbcMode: + blockSize := ciph.BlockSize() + // The payload must fit in a multiple of blockSize, with + // room for at least one padding byte. + payloadBytes = (payloadBytes & ^(blockSize - 1)) - 1 + // The MAC is appended before padding so affects the + // payload size directly. + payloadBytes -= c.out.mac.Size() + default: + panic("unknown cipher type") + } + } + if c.vers == VersionTLS13 { + payloadBytes-- // encrypted ContentType + } + + // Allow packet growth in arithmetic progression up to max. + pkt := c.packetsSent + c.packetsSent++ + if pkt > 1000 { + return maxPlaintext // avoid overflow in multiply below + } + + n := payloadBytes * int(pkt+1) + if n > maxPlaintext { + n = maxPlaintext + } + return n +} + +func (c *Conn) write(data []byte) (int, error) { + if c.buffering { + c.sendBuf = append(c.sendBuf, data...) + return len(data), nil + } + + n, err := c.conn.Write(data) + c.bytesSent += int64(n) + return n, err +} + +func (c *Conn) flush() (int, error) { + if len(c.sendBuf) == 0 { + return 0, nil + } + + n, err := c.conn.Write(c.sendBuf) + c.bytesSent += int64(n) + c.sendBuf = nil + c.buffering = false + return n, err +} + +// outBufPool pools the record-sized scratch buffers used by writeRecordLocked. +var outBufPool = sync.Pool{ + New: func() any { + return new([]byte) + }, +} + +// writeRecordLocked writes a TLS record with the given type and payload to the +// connection and updates the record layer state. +func (c *Conn) writeRecordLocked(typ recordType, data []byte) (int, error) { + if c.quic != nil { + if typ != recordTypeHandshake { + return 0, errors.New("tls: internal error: sending non-handshake message to QUIC transport") + } + c.quicWriteCryptoData(c.out.level, data) + if !c.buffering { + if _, err := c.flush(); err != nil { + return 0, err + } + } + return len(data), nil + } + + outBufPtr := outBufPool.Get().(*[]byte) + outBuf := *outBufPtr + defer func() { + // You might be tempted to simplify this by just passing &outBuf to Put, + // but that would make the local copy of the outBuf slice header escape + // to the heap, causing an allocation. Instead, we keep around the + // pointer to the slice header returned by Get, which is already on the + // heap, and overwrite and return that. + *outBufPtr = outBuf + outBufPool.Put(outBufPtr) + }() + + var n int + for len(data) > 0 { + m := len(data) + if maxPayload := c.maxPayloadSizeForWrite(typ); m > maxPayload { + m = maxPayload + } + + _, outBuf = sliceForAppend(outBuf[:0], recordHeaderLen) + outBuf[0] = byte(typ) + vers := c.vers + if vers == 0 { + // Some TLS servers fail if the record version is + // greater than TLS 1.0 for the initial ClientHello. + vers = VersionTLS10 + } else if vers == VersionTLS13 { + // TLS 1.3 froze the record layer version to 1.2. + // See RFC 8446, Section 5.1. + vers = VersionTLS12 + } + outBuf[1] = byte(vers >> 8) + outBuf[2] = byte(vers) + outBuf[3] = byte(m >> 8) + outBuf[4] = byte(m) + + var err error + outBuf, err = c.out.encrypt(outBuf, data[:m], c.config.rand()) + if err != nil { + return n, err + } + if _, err := c.write(outBuf); err != nil { + return n, err + } + n += m + data = data[m:] + } + + if typ == recordTypeChangeCipherSpec && c.vers != VersionTLS13 { + if err := c.out.changeCipherSpec(); err != nil { + return n, c.sendAlertLocked(err.(alert)) + } + } + + return n, nil +} + +// writeHandshakeRecord writes a handshake message to the connection and updates +// the record layer state. If transcript is non-nil the marshaled message is +// written to it. +func (c *Conn) writeHandshakeRecord(msg handshakeMessage, transcript transcriptHash) (int, error) { + c.out.Lock() + defer c.out.Unlock() + + data, err := msg.marshal() + if err != nil { + return 0, err + } + if transcript != nil { + transcript.Write(data) + } + + return c.writeRecordLocked(recordTypeHandshake, data) +} + +// writeChangeCipherRecord writes a ChangeCipherSpec message to the connection and +// updates the record layer state. +func (c *Conn) writeChangeCipherRecord() error { + c.out.Lock() + defer c.out.Unlock() + _, err := c.writeRecordLocked(recordTypeChangeCipherSpec, []byte{1}) + return err +} + +// readHandshakeBytes reads handshake data until c.hand contains at least n bytes. +func (c *Conn) readHandshakeBytes(n int) error { + if c.quic != nil { + return c.quicReadHandshakeBytes(n) + } + for c.hand.Len() < n { + if err := c.readRecord(); err != nil { + return err + } + } + return nil +} + +// readHandshake reads the next handshake message from +// the record layer. If transcript is non-nil, the message +// is written to the passed transcriptHash. +func (c *Conn) readHandshake(transcript transcriptHash) (any, error) { + if err := c.readHandshakeBytes(4); err != nil { + return nil, err + } + data := c.hand.Bytes() + + maxHandshakeSize := maxHandshake + // hasVers indicates we're past the first message, forcing someone trying to + // make us just allocate a large buffer to at least do the initial part of + // the handshake first. + if c.haveVers && data[0] == typeCertificate { + // Since certificate messages are likely to be the only messages that + // can be larger than maxHandshake, we use a special limit for just + // those messages. + maxHandshakeSize = maxHandshakeCertificateMsg + } + + n := int(data[1])<<16 | int(data[2])<<8 | int(data[3]) + if n > maxHandshakeSize { + c.sendAlertLocked(alertInternalError) + return nil, c.in.setErrorLocked(fmt.Errorf("tls: handshake message of length %d bytes exceeds maximum of %d bytes", n, maxHandshakeSize)) + } + if err := c.readHandshakeBytes(4 + n); err != nil { + return nil, err + } + data = c.hand.Next(4 + n) + return c.unmarshalHandshakeMessage(data, transcript) +} + +func (c *Conn) unmarshalHandshakeMessage(data []byte, transcript transcriptHash) (handshakeMessage, error) { + var m handshakeMessage + switch data[0] { + case typeHelloRequest: + m = new(helloRequestMsg) + case typeClientHello: + m = new(clientHelloMsg) + case typeServerHello: + m = new(serverHelloMsg) + case typeNewSessionTicket: + if c.vers == VersionTLS13 { + m = new(newSessionTicketMsgTLS13) + } else { + m = new(newSessionTicketMsg) + } + case typeCertificate: + if c.vers == VersionTLS13 { + m = new(certificateMsgTLS13) + } else { + m = new(certificateMsg) + } + case typeCertificateRequest: + if c.vers == VersionTLS13 { + m = new(certificateRequestMsgTLS13) + } else { + m = &certificateRequestMsg{ + hasSignatureAlgorithm: c.vers >= VersionTLS12, + } + } + case typeCertificateStatus: + m = new(certificateStatusMsg) + case typeServerKeyExchange: + m = new(serverKeyExchangeMsg) + case typeServerHelloDone: + m = new(serverHelloDoneMsg) + case typeClientKeyExchange: + m = new(clientKeyExchangeMsg) + case typeCertificateVerify: + m = &certificateVerifyMsg{ + hasSignatureAlgorithm: c.vers >= VersionTLS12, + } + case typeFinished: + m = new(finishedMsg) + case typeEncryptedExtensions: + m = new(encryptedExtensionsMsg) + case typeEndOfEarlyData: + m = new(endOfEarlyDataMsg) + case typeKeyUpdate: + m = new(keyUpdateMsg) + default: + return nil, c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) + } + + // The handshake message unmarshalers + // expect to be able to keep references to data, + // so pass in a fresh copy that won't be overwritten. + data = append([]byte(nil), data...) + + if !m.unmarshal(data) { + return nil, c.in.setErrorLocked(c.sendAlert(alertDecodeError)) + } + + if transcript != nil { + transcript.Write(data) + } + + return m, nil +} + +var ( + errShutdown = errors.New("tls: protocol is shutdown") +) + +// Write writes data to the connection. +// +// As Write calls [Conn.Handshake], in order to prevent indefinite blocking a deadline +// must be set for both [Conn.Read] and Write before Write is called when the handshake +// has not yet completed. See [Conn.SetDeadline], [Conn.SetReadDeadline], and +// [Conn.SetWriteDeadline]. +func (c *Conn) Write(b []byte) (int, error) { + // interlock with Close below + for { + x := c.activeCall.Load() + if x&1 != 0 { + return 0, net.ErrClosed + } + if c.activeCall.CompareAndSwap(x, x+2) { + break + } + } + defer c.activeCall.Add(-2) + + if err := c.Handshake(); err != nil { + return 0, err + } + + c.out.Lock() + defer c.out.Unlock() + + if err := c.out.err; err != nil { + return 0, err + } + + if !c.isHandshakeComplete.Load() { + return 0, alertInternalError + } + + if c.closeNotifySent { + return 0, errShutdown + } + + // TLS 1.0 is susceptible to a chosen-plaintext + // attack when using block mode ciphers due to predictable IVs. + // This can be prevented by splitting each Application Data + // record into two records, effectively randomizing the IV. + // + // https://www.openssl.org/~bodo/tls-cbc.txt + // https://bugzilla.mozilla.org/show_bug.cgi?id=665814 + // https://www.imperialviolet.org/2012/01/15/beastfollowup.html + + var m int + if len(b) > 1 && c.vers == VersionTLS10 { + if _, ok := c.out.cipher.(cipher.BlockMode); ok { + n, err := c.writeRecordLocked(recordTypeApplicationData, b[:1]) + if err != nil { + return n, c.out.setErrorLocked(err) + } + m, b = 1, b[1:] + } + } + + n, err := c.writeRecordLocked(recordTypeApplicationData, b) + return n + m, c.out.setErrorLocked(err) +} + +// handleRenegotiation processes a HelloRequest handshake message. +func (c *Conn) handleRenegotiation() error { + if c.vers == VersionTLS13 { + return errors.New("tls: internal error: unexpected renegotiation") + } + + msg, err := c.readHandshake(nil) + if err != nil { + return err + } + + helloReq, ok := msg.(*helloRequestMsg) + if !ok { + c.sendAlert(alertUnexpectedMessage) + return unexpectedMessageError(helloReq, msg) + } + + if !c.isClient { + return c.sendAlert(alertNoRenegotiation) + } + + switch c.config.Renegotiation { + case RenegotiateNever: + return c.sendAlert(alertNoRenegotiation) + case RenegotiateOnceAsClient: + if c.handshakes > 1 { + return c.sendAlert(alertNoRenegotiation) + } + case RenegotiateFreelyAsClient: + // Ok. + default: + c.sendAlert(alertInternalError) + return errors.New("tls: unknown Renegotiation value") + } + + c.handshakeMutex.Lock() + defer c.handshakeMutex.Unlock() + + c.isHandshakeComplete.Store(false) + if c.handshakeErr = c.clientHandshake(context.Background()); c.handshakeErr == nil { + c.handshakes++ + } + return c.handshakeErr +} + +// handlePostHandshakeMessage processes a handshake message arrived after the +// handshake is complete. Up to TLS 1.2, it indicates the start of a renegotiation. +func (c *Conn) handlePostHandshakeMessage() error { + if c.vers != VersionTLS13 { + return c.handleRenegotiation() + } + + msg, err := c.readHandshake(nil) + if err != nil { + return err + } + c.retryCount++ + if c.retryCount > maxUselessRecords { + c.sendAlert(alertUnexpectedMessage) + return c.in.setErrorLocked(errors.New("tls: too many non-advancing records")) + } + + switch msg := msg.(type) { + case *newSessionTicketMsgTLS13: + return c.handleNewSessionTicket(msg) + case *keyUpdateMsg: + return c.handleKeyUpdate(msg) + } + // The QUIC layer is supposed to treat an unexpected post-handshake CertificateRequest + // as a QUIC-level PROTOCOL_VIOLATION error (RFC 9001, Section 4.4). Returning an + // unexpected_message alert here doesn't provide it with enough information to distinguish + // this condition from other unexpected messages. This is probably fine. + c.sendAlert(alertUnexpectedMessage) + return fmt.Errorf("tls: received unexpected handshake message of type %T", msg) +} + +func (c *Conn) handleKeyUpdate(keyUpdate *keyUpdateMsg) error { + if c.quic != nil { + c.sendAlert(alertUnexpectedMessage) + return c.in.setErrorLocked(errors.New("tls: received unexpected key update message")) + } + + cipherSuite := cipherSuiteTLS13ByID(c.cipherSuite) + if cipherSuite == nil { + return c.in.setErrorLocked(c.sendAlert(alertInternalError)) + } + + if keyUpdate.updateRequested { + c.out.Lock() + defer c.out.Unlock() + + msg := &keyUpdateMsg{} + msgBytes, err := msg.marshal() + if err != nil { + return err + } + _, err = c.writeRecordLocked(recordTypeHandshake, msgBytes) + if err != nil { + // Surface the error at the next write. + c.out.setErrorLocked(err) + return nil + } + + newSecret := cipherSuite.nextTrafficSecret(c.out.trafficSecret) + c.setWriteTrafficSecret(cipherSuite, QUICEncryptionLevelInitial, newSecret) + } + + newSecret := cipherSuite.nextTrafficSecret(c.in.trafficSecret) + if err := c.setReadTrafficSecret(cipherSuite, QUICEncryptionLevelInitial, newSecret, keyUpdate.updateRequested); err != nil { + return err + } + + return nil +} + +// Read reads data from the connection. +// +// As Read calls [Conn.Handshake], in order to prevent indefinite blocking a deadline +// must be set for both Read and [Conn.Write] before Read is called when the handshake +// has not yet completed. See [Conn.SetDeadline], [Conn.SetReadDeadline], and +// [Conn.SetWriteDeadline]. +func (c *Conn) Read(b []byte) (int, error) { + if err := c.Handshake(); err != nil { + return 0, err + } + if len(b) == 0 { + // Put this after Handshake, in case people were calling + // Read(nil) for the side effect of the Handshake. + return 0, nil + } + + c.in.Lock() + defer c.in.Unlock() + + for c.input.Len() == 0 { + if err := c.readRecord(); err != nil { + return 0, err + } + for c.hand.Len() > 0 { + if err := c.handlePostHandshakeMessage(); err != nil { + return 0, err + } + } + } + + n, _ := c.input.Read(b) + + // If a close-notify alert is waiting, read it so that we can return (n, + // EOF) instead of (n, nil), to signal to the HTTP response reading + // goroutine that the connection is now closed. This eliminates a race + // where the HTTP response reading goroutine would otherwise not observe + // the EOF until its next read, by which time a client goroutine might + // have already tried to reuse the HTTP connection for a new request. + // See https://golang.org/cl/76400046 and https://golang.org/issue/3514 + if n != 0 && c.input.Len() == 0 && c.rawInput.Len() > 0 && + recordType(c.rawInput.Bytes()[0]) == recordTypeAlert { + if err := c.readRecord(); err != nil { + return n, err // will be io.EOF on closeNotify + } + } + + return n, nil +} + +// Close closes the connection. +func (c *Conn) Close() error { + // Interlock with Conn.Write above. + var x int32 + for { + x = c.activeCall.Load() + if x&1 != 0 { + return net.ErrClosed + } + if c.activeCall.CompareAndSwap(x, x|1) { + break + } + } + if x != 0 { + // io.Writer and io.Closer should not be used concurrently. + // If Close is called while a Write is currently in-flight, + // interpret that as a sign that this Close is really just + // being used to break the Write and/or clean up resources and + // avoid sending the alertCloseNotify, which may block + // waiting on handshakeMutex or the c.out mutex. + return c.conn.Close() + } + + var alertErr error + if c.isHandshakeComplete.Load() { + if err := c.closeNotify(); err != nil { + alertErr = fmt.Errorf("tls: failed to send closeNotify alert (but connection was closed anyway): %w", err) + } + } + + if err := c.conn.Close(); err != nil { + return err + } + return alertErr +} + +var errEarlyCloseWrite = errors.New("tls: CloseWrite called before handshake complete") + +// CloseWrite shuts down the writing side of the connection. It should only be +// called once the handshake has completed and does not call CloseWrite on the +// underlying connection. Most callers should just use [Conn.Close]. +func (c *Conn) CloseWrite() error { + if !c.isHandshakeComplete.Load() { + return errEarlyCloseWrite + } + + return c.closeNotify() +} + +func (c *Conn) closeNotify() error { + c.out.Lock() + defer c.out.Unlock() + + if !c.closeNotifySent { + // Set a Write Deadline to prevent possibly blocking forever. + c.SetWriteDeadline(time.Now().Add(time.Second * 5)) + c.closeNotifyErr = c.sendAlertLocked(alertCloseNotify) + c.closeNotifySent = true + // Any subsequent writes will fail. + c.SetWriteDeadline(time.Now()) + } + return c.closeNotifyErr +} + +// Handshake runs the client or server handshake +// protocol if it has not yet been run. +// +// Most uses of this package need not call Handshake explicitly: the +// first [Conn.Read] or [Conn.Write] will call it automatically. +// +// For control over canceling or setting a timeout on a handshake, use +// [Conn.HandshakeContext] or the [Dialer]'s DialContext method instead. +// +// In order to avoid denial of service attacks, the maximum RSA key size allowed +// in certificates sent by either the TLS server or client is limited to 8192 +// bits. This limit can be overridden by setting tlsmaxrsasize in the GODEBUG +// environment variable (e.g. GODEBUG=tlsmaxrsasize=4096). +func (c *Conn) Handshake() error { + return c.HandshakeContext(context.Background()) +} + +// HandshakeContext runs the client or server handshake +// protocol if it has not yet been run. +// +// The provided Context must be non-nil. If the context is canceled before +// the handshake is complete, the handshake is interrupted and an error is returned. +// Once the handshake has completed, cancellation of the context will not affect the +// connection. +// +// Most uses of this package need not call HandshakeContext explicitly: the +// first [Conn.Read] or [Conn.Write] will call it automatically. +func (c *Conn) HandshakeContext(ctx context.Context) error { + // Delegate to unexported method for named return + // without confusing documented signature. + return c.handshakeContext(ctx) +} + +func (c *Conn) handshakeContext(ctx context.Context) (ret error) { + // Fast sync/atomic-based exit if there is no handshake in flight and the + // last one succeeded without an error. Avoids the expensive context setup + // and mutex for most Read and Write calls. + if c.isHandshakeComplete.Load() { + return nil + } + + handshakeCtx, cancel := context.WithCancel(ctx) + // Note: defer this before calling context.AfterFunc + // so that we can tell the difference between the input being canceled and + // this cancellation. In the former case, we need to close the connection. + defer cancel() + + if c.quic != nil { + c.quic.ctx = handshakeCtx + c.quic.cancel = cancel + } else if ctx.Done() != nil { + // Close the connection if ctx is canceled before the function returns. + stop := context.AfterFunc(ctx, func() { + _ = c.conn.Close() + }) + defer func() { + if !stop() { + // Return context error to user. + ret = ctx.Err() + } + }() + } + + c.handshakeMutex.Lock() + defer c.handshakeMutex.Unlock() + + if err := c.handshakeErr; err != nil { + return err + } + if c.isHandshakeComplete.Load() { + return nil + } + + c.in.Lock() + defer c.in.Unlock() + + c.handshakeErr = c.handshakeFn(handshakeCtx) + if c.handshakeErr == nil { + c.handshakes++ + } else { + // If an error occurred during the handshake try to flush the + // alert that might be left in the buffer. + c.flush() + } + + if c.handshakeErr == nil && !c.isHandshakeComplete.Load() { + c.handshakeErr = errors.New("tls: internal error: handshake should have had a result") + } + if c.handshakeErr != nil && c.isHandshakeComplete.Load() { + panic("tls: internal error: handshake returned an error but is marked successful") + } + + if c.quic != nil { + if c.handshakeErr == nil { + c.quicHandshakeComplete() + // Provide the 1-RTT read secret now that the handshake is complete. + // The QUIC layer MUST NOT decrypt 1-RTT packets prior to completing + // the handshake (RFC 9001, Section 5.7). + if err := c.quicSetReadSecret(QUICEncryptionLevelApplication, c.cipherSuite, c.in.trafficSecret); err != nil { + return err + } + } else { + c.out.Lock() + a, ok := errors.AsType[alert](c.out.err) + if !ok { + a = alertInternalError + } + c.out.Unlock() + // Return an error which wraps both the handshake error and + // any alert error we may have sent, or alertInternalError + // if we didn't send an alert. + // Truncate the text of the alert to 0 characters. + c.handshakeErr = fmt.Errorf("%w%.0w", c.handshakeErr, AlertError(a)) + } + close(c.quic.blockedc) + close(c.quic.signalc) + } + + return c.handshakeErr +} + +// ConnectionState returns basic TLS details about the connection. +func (c *Conn) ConnectionState() ConnectionState { + c.handshakeMutex.Lock() + defer c.handshakeMutex.Unlock() + return c.connectionStateLocked() +} + +var tlsunsafeekm = godebug.New("tlsunsafeekm") + +func (c *Conn) connectionStateLocked() ConnectionState { + var state ConnectionState + state.HandshakeComplete = c.isHandshakeComplete.Load() + state.Version = c.vers + state.NegotiatedProtocol = c.clientProtocol + state.DidResume = c.didResume + state.HelloRetryRequest = c.didHRR + state.testingOnlyPeerSignatureAlgorithm = c.peerSigAlg + state.CurveID = c.curveID + state.NegotiatedProtocolIsMutual = true + state.ServerName = c.serverName + state.CipherSuite = c.cipherSuite + state.PeerCertificates = c.peerCertificates + state.VerifiedChains = c.verifiedChains + state.SignedCertificateTimestamps = c.scts + state.OCSPResponse = c.ocspResponse + if (!c.didResume || c.extMasterSecret) && c.vers != VersionTLS13 { + if c.clientFinishedIsFirst { + state.TLSUnique = c.clientFinished[:] + } else { + state.TLSUnique = c.serverFinished[:] + } + } + if c.config.Renegotiation != RenegotiateNever { + state.ekm = noEKMBecauseRenegotiation + } else if c.vers != VersionTLS13 && !c.extMasterSecret { + state.ekm = func(label string, context []byte, length int) ([]byte, error) { + if tlsunsafeekm.Value() == "1" { + tlsunsafeekm.IncNonDefault() + return c.ekm(label, context, length) + } + return noEKMBecauseNoEMS(label, context, length) + } + } else { + state.ekm = c.ekm + } + state.ECHAccepted = c.echAccepted + return state +} + +// OCSPResponse returns the stapled OCSP response from the TLS server, if +// any. (Only valid for client connections.) +func (c *Conn) OCSPResponse() []byte { + c.handshakeMutex.Lock() + defer c.handshakeMutex.Unlock() + + return c.ocspResponse +} + +// VerifyHostname checks that the peer certificate chain is valid for +// connecting to host. If so, it returns nil; if not, it returns an error +// describing the problem. +func (c *Conn) VerifyHostname(host string) error { + c.handshakeMutex.Lock() + defer c.handshakeMutex.Unlock() + if !c.isClient { + return errors.New("tls: VerifyHostname called on TLS server connection") + } + if !c.isHandshakeComplete.Load() { + return errors.New("tls: handshake has not yet been performed") + } + if len(c.verifiedChains) == 0 { + return errors.New("tls: handshake did not verify certificate chain") + } + return c.peerCertificates[0].VerifyHostname(host) +} + +// setReadTrafficSecret sets the read traffic secret for the given encryption level. If +// being called at the same time as setWriteTrafficSecret, the caller must ensure the call +// to setWriteTrafficSecret happens first so any alerts are sent at the write level. +func (c *Conn) setReadTrafficSecret(suite *cipherSuiteTLS13, level QUICEncryptionLevel, secret []byte, locked bool) error { + // Ensure that there are no buffered handshake messages before changing the + // read keys, since that can cause messages to be parsed that were encrypted + // using old keys which are no longer appropriate. + if c.hand.Len() != 0 { + if locked { + c.sendAlertLocked(alertUnexpectedMessage) + } else { + c.sendAlert(alertUnexpectedMessage) + } + return errors.New("tls: handshake buffer not empty before setting read traffic secret") + } + c.in.setTrafficSecret(suite, level, secret) + return nil +} + +// setWriteTrafficSecret sets the write traffic secret for the given encryption level. If +// being called at the same time as setReadTrafficSecret, the caller must ensure the call +// to setWriteTrafficSecret happens first so any alerts are sent at the write level. +func (c *Conn) setWriteTrafficSecret(suite *cipherSuiteTLS13, level QUICEncryptionLevel, secret []byte) { + c.out.setTrafficSecret(suite, level, secret) +} diff --git a/go/src/crypto/tls/conn_test.go b/go/src/crypto/tls/conn_test.go new file mode 100644 index 0000000000000000000000000000000000000000..5fd48d6bd5af663a9cce85a9d440d03a06b8a567 --- /dev/null +++ b/go/src/crypto/tls/conn_test.go @@ -0,0 +1,323 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "bytes" + "io" + "net" + "testing" +) + +func TestRoundUp(t *testing.T) { + if roundUp(0, 16) != 0 || + roundUp(1, 16) != 16 || + roundUp(15, 16) != 16 || + roundUp(16, 16) != 16 || + roundUp(17, 16) != 32 { + t.Error("roundUp broken") + } +} + +// will be initialized with {0, 255, 255, ..., 255} +var padding255Bad = [256]byte{} + +// will be initialized with {255, 255, 255, ..., 255} +var padding255Good = [256]byte{255} + +var paddingTests = []struct { + in []byte + good bool + expectedLen int +}{ + {[]byte{1, 2, 3, 4, 0}, true, 4}, + {[]byte{1, 2, 3, 4, 0, 1}, false, 0}, + {[]byte{1, 2, 3, 4, 99, 99}, false, 0}, + {[]byte{1, 2, 3, 4, 1, 1}, true, 4}, + {[]byte{1, 2, 3, 2, 2, 2}, true, 3}, + {[]byte{1, 2, 3, 3, 3, 3}, true, 2}, + {[]byte{1, 2, 3, 4, 3, 3}, false, 0}, + {[]byte{1, 4, 4, 4, 4, 4}, true, 1}, + {[]byte{5, 5, 5, 5, 5, 5}, true, 0}, + {[]byte{6, 6, 6, 6, 6, 6}, false, 0}, + {padding255Bad[:], false, 0}, + {padding255Good[:], true, 0}, +} + +func TestRemovePadding(t *testing.T) { + for i := 1; i < len(padding255Bad); i++ { + padding255Bad[i] = 255 + padding255Good[i] = 255 + } + for i, test := range paddingTests { + paddingLen, good := extractPadding(test.in) + expectedGood := byte(255) + if !test.good { + expectedGood = 0 + } + if good != expectedGood { + t.Errorf("#%d: wrong validity, want:%d got:%d", i, expectedGood, good) + } + if good == 255 && len(test.in)-paddingLen != test.expectedLen { + t.Errorf("#%d: got %d, want %d", i, len(test.in)-paddingLen, test.expectedLen) + } + } +} + +var certExampleCom = `308201713082011ba003020102021005a75ddf21014d5f417083b7a010ba2e300d06092a864886f70d01010b050030123110300e060355040a130741636d6520436f301e170d3136303831373231343135335a170d3137303831373231343135335a30123110300e060355040a130741636d6520436f305c300d06092a864886f70d0101010500034b003048024100b37f0fdd67e715bf532046ac34acbd8fdc4dabe2b598588f3f58b1f12e6219a16cbfe54d2b4b665396013589262360b6721efa27d546854f17cc9aeec6751db10203010001a34d304b300e0603551d0f0101ff0404030205a030130603551d25040c300a06082b06010505070301300c0603551d130101ff0402300030160603551d11040f300d820b6578616d706c652e636f6d300d06092a864886f70d01010b050003410059fc487866d3d855503c8e064ca32aac5e9babcece89ec597f8b2b24c17867f4a5d3b4ece06e795bfc5448ccbd2ffca1b3433171ebf3557a4737b020565350a0` + +var certWildcardExampleCom = `308201743082011ea003020102021100a7aa6297c9416a4633af8bec2958c607300d06092a864886f70d01010b050030123110300e060355040a130741636d6520436f301e170d3136303831373231343231395a170d3137303831373231343231395a30123110300e060355040a130741636d6520436f305c300d06092a864886f70d0101010500034b003048024100b105afc859a711ee864114e7d2d46c2dcbe392d3506249f6c2285b0eb342cc4bf2d803677c61c0abde443f084745c1a6d62080e5664ef2cc8f50ad8a0ab8870b0203010001a34f304d300e0603551d0f0101ff0404030205a030130603551d25040c300a06082b06010505070301300c0603551d130101ff0402300030180603551d110411300f820d2a2e6578616d706c652e636f6d300d06092a864886f70d01010b0500034100af26088584d266e3f6566360cf862c7fecc441484b098b107439543144a2b93f20781988281e108c6d7656934e56950e1e5f2bcf38796b814ccb729445856c34` + +var certFooExampleCom = `308201753082011fa00302010202101bbdb6070b0aeffc49008cde74deef29300d06092a864886f70d01010b050030123110300e060355040a130741636d6520436f301e170d3136303831373231343234345a170d3137303831373231343234345a30123110300e060355040a130741636d6520436f305c300d06092a864886f70d0101010500034b003048024100f00ac69d8ca2829f26216c7b50f1d4bbabad58d447706476cd89a2f3e1859943748aa42c15eedc93ac7c49e40d3b05ed645cb6b81c4efba60d961f44211a54eb0203010001a351304f300e0603551d0f0101ff0404030205a030130603551d25040c300a06082b06010505070301300c0603551d130101ff04023000301a0603551d1104133011820f666f6f2e6578616d706c652e636f6d300d06092a864886f70d01010b0500034100a0957fca6d1e0f1ef4b247348c7a8ca092c29c9c0ecc1898ea6b8065d23af6d922a410dd2335a0ea15edd1394cef9f62c9e876a21e35250a0b4fe1ddceba0f36` + +func TestCertificateSelection(t *testing.T) { + config := Config{ + Certificates: []Certificate{ + { + Certificate: [][]byte{fromHex(certExampleCom)}, + }, + { + Certificate: [][]byte{fromHex(certWildcardExampleCom)}, + }, + { + Certificate: [][]byte{fromHex(certFooExampleCom)}, + }, + }, + } + + config.BuildNameToCertificate() + + pointerToIndex := func(c *Certificate) int { + for i := range config.Certificates { + if c == &config.Certificates[i] { + return i + } + } + return -1 + } + + certificateForName := func(name string) *Certificate { + clientHello := &ClientHelloInfo{ + ServerName: name, + } + if cert, err := config.getCertificate(clientHello); err != nil { + t.Errorf("unable to get certificate for name '%s': %s", name, err) + return nil + } else { + return cert + } + } + + if n := pointerToIndex(certificateForName("example.com")); n != 0 { + t.Errorf("example.com returned certificate %d, not 0", n) + } + if n := pointerToIndex(certificateForName("bar.example.com")); n != 1 { + t.Errorf("bar.example.com returned certificate %d, not 1", n) + } + if n := pointerToIndex(certificateForName("foo.example.com")); n != 2 { + t.Errorf("foo.example.com returned certificate %d, not 2", n) + } + if n := pointerToIndex(certificateForName("foo.bar.example.com")); n != 0 { + t.Errorf("foo.bar.example.com returned certificate %d, not 0", n) + } +} + +// Run with multiple crypto configs to test the logic for computing TLS record overheads. +func runDynamicRecordSizingTest(t *testing.T, config *Config) { + clientConn, serverConn := localPipe(t) + + serverConfig := config.Clone() + serverConfig.DynamicRecordSizingDisabled = false + tlsConn := Server(serverConn, serverConfig) + + handshakeDone := make(chan struct{}) + recordSizesChan := make(chan []int, 1) + defer func() { <-recordSizesChan }() // wait for the goroutine to exit + go func() { + // This goroutine performs a TLS handshake over clientConn and + // then reads TLS records until EOF. It writes a slice that + // contains all the record sizes to recordSizesChan. + defer close(recordSizesChan) + defer clientConn.Close() + + tlsConn := Client(clientConn, config) + if err := tlsConn.Handshake(); err != nil { + t.Errorf("Error from client handshake: %v", err) + return + } + close(handshakeDone) + + var recordHeader [recordHeaderLen]byte + var record []byte + var recordSizes []int + + for { + n, err := io.ReadFull(clientConn, recordHeader[:]) + if err == io.EOF { + break + } + if err != nil || n != len(recordHeader) { + t.Errorf("io.ReadFull = %d, %v", n, err) + return + } + + length := int(recordHeader[3])<<8 | int(recordHeader[4]) + if len(record) < length { + record = make([]byte, length) + } + + n, err = io.ReadFull(clientConn, record[:length]) + if err != nil || n != length { + t.Errorf("io.ReadFull = %d, %v", n, err) + return + } + + recordSizes = append(recordSizes, recordHeaderLen+length) + } + + recordSizesChan <- recordSizes + }() + + if err := tlsConn.Handshake(); err != nil { + t.Fatalf("Error from server handshake: %s", err) + } + <-handshakeDone + + // The server writes these plaintexts in order. + plaintext := bytes.Join([][]byte{ + bytes.Repeat([]byte("x"), recordSizeBoostThreshold), + bytes.Repeat([]byte("y"), maxPlaintext*2), + bytes.Repeat([]byte("z"), maxPlaintext), + }, nil) + + if _, err := tlsConn.Write(plaintext); err != nil { + t.Fatalf("Error from server write: %s", err) + } + if err := tlsConn.Close(); err != nil { + t.Fatalf("Error from server close: %s", err) + } + + recordSizes := <-recordSizesChan + if recordSizes == nil { + t.Fatalf("Client encountered an error") + } + + // Drop the size of the second to last record, which is likely to be + // truncated, and the last record, which is a close_notify alert. + recordSizes = recordSizes[:len(recordSizes)-2] + + // recordSizes should contain a series of records smaller than + // tcpMSSEstimate followed by some larger than maxPlaintext. + seenLargeRecord := false + for i, size := range recordSizes { + if !seenLargeRecord { + if size > (i+1)*tcpMSSEstimate { + t.Fatalf("Record #%d has size %d, which is too large too soon", i, size) + } + if size >= maxPlaintext { + seenLargeRecord = true + } + } else if size <= maxPlaintext { + t.Fatalf("Record #%d has size %d but should be full sized", i, size) + } + } + + if !seenLargeRecord { + t.Fatalf("No large records observed") + } +} + +func TestDynamicRecordSizingWithStreamCipher(t *testing.T) { + skipFIPS(t) // No RC4 in FIPS mode. + + config := testConfig.Clone() + config.MaxVersion = VersionTLS12 + config.CipherSuites = []uint16{TLS_RSA_WITH_RC4_128_SHA} + runDynamicRecordSizingTest(t, config) +} + +func TestDynamicRecordSizingWithCBC(t *testing.T) { + skipFIPS(t) // No CBC cipher suites in defaultCipherSuitesFIPS. + + config := testConfig.Clone() + config.MaxVersion = VersionTLS12 + config.CipherSuites = []uint16{TLS_RSA_WITH_AES_256_CBC_SHA} + runDynamicRecordSizingTest(t, config) +} + +func TestDynamicRecordSizingWithAEAD(t *testing.T) { + config := testConfig.Clone() + config.MaxVersion = VersionTLS12 + config.CipherSuites = []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256} + runDynamicRecordSizingTest(t, config) +} + +func TestDynamicRecordSizingWithTLSv13(t *testing.T) { + config := testConfig.Clone() + runDynamicRecordSizingTest(t, config) +} + +// hairpinConn is a net.Conn that makes a “hairpin” call when closed, back into +// the tls.Conn which is calling it. +type hairpinConn struct { + net.Conn + tlsConn *Conn +} + +func (conn *hairpinConn) Close() error { + conn.tlsConn.ConnectionState() + return nil +} + +func TestHairpinInClose(t *testing.T) { + // This tests that the underlying net.Conn can call back into the + // tls.Conn when being closed without deadlocking. + client, server := localPipe(t) + defer server.Close() + defer client.Close() + + conn := &hairpinConn{client, nil} + tlsConn := Server(conn, &Config{ + GetCertificate: func(*ClientHelloInfo) (*Certificate, error) { + panic("unreachable") + }, + }) + conn.tlsConn = tlsConn + + // This call should not deadlock. + tlsConn.Close() +} + +func TestRecordBadVersionTLS13(t *testing.T) { + client, server := localPipe(t) + defer server.Close() + defer client.Close() + + config := testConfig.Clone() + config.MinVersion, config.MaxVersion = VersionTLS13, VersionTLS13 + + go func() { + tlsConn := Client(client, config) + if err := tlsConn.Handshake(); err != nil { + t.Errorf("Error from client handshake: %v", err) + return + } + tlsConn.vers = 0x1111 + tlsConn.Write([]byte{1}) + }() + + tlsConn := Server(server, config) + if err := tlsConn.Handshake(); err != nil { + t.Errorf("Error from client handshake: %v", err) + return + } + + expectedErr := "tls: received record with version 1111 when expecting version 303" + + _, err := tlsConn.Read(make([]byte, 10)) + if err.Error() != expectedErr { + t.Fatalf("unexpected error: got %q, want %q", err, expectedErr) + } +} diff --git a/go/src/crypto/tls/defaults.go b/go/src/crypto/tls/defaults.go new file mode 100644 index 0000000000000000000000000000000000000000..8de8d7e0934b07ed68c2b513fde7e6f263a6ad13 --- /dev/null +++ b/go/src/crypto/tls/defaults.go @@ -0,0 +1,112 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "internal/godebug" + "slices" + _ "unsafe" // for linkname +) + +// Defaults are collected in this file to allow distributions to more easily patch +// them to apply local policies. + +var tlsmlkem = godebug.New("tlsmlkem") +var tlssecpmlkem = godebug.New("tlssecpmlkem") + +// defaultCurvePreferences is the default set of supported key exchanges, as +// well as the preference order. +func defaultCurvePreferences() []CurveID { + switch { + // tlsmlkem=0 restores the pre-Go 1.24 default. + case tlsmlkem.Value() == "0": + return []CurveID{X25519, CurveP256, CurveP384, CurveP521} + // tlssecpmlkem=0 restores the pre-Go 1.26 default. + case tlssecpmlkem.Value() == "0": + return []CurveID{X25519MLKEM768, X25519, CurveP256, CurveP384, CurveP521} + default: + return []CurveID{ + X25519MLKEM768, SecP256r1MLKEM768, SecP384r1MLKEM1024, + X25519, CurveP256, CurveP384, CurveP521, + } + } +} + +// defaultSupportedSignatureAlgorithms returns the signature and hash algorithms that +// the code advertises and supports in a TLS 1.2+ ClientHello and in a TLS 1.2+ +// CertificateRequest. The two fields are merged to match with TLS 1.3. +// Note that in TLS 1.2, the ECDSA algorithms are not constrained to P-256, etc. +func defaultSupportedSignatureAlgorithms() []SignatureScheme { + return []SignatureScheme{ + PSSWithSHA256, + ECDSAWithP256AndSHA256, + Ed25519, + PSSWithSHA384, + PSSWithSHA512, + PKCS1WithSHA256, + PKCS1WithSHA384, + PKCS1WithSHA512, + ECDSAWithP384AndSHA384, + ECDSAWithP521AndSHA512, + PKCS1WithSHA1, + ECDSAWithSHA1, + } +} + +var tlsrsakex = godebug.New("tlsrsakex") +var tls3des = godebug.New("tls3des") + +func supportedCipherSuites(aesGCMPreferred bool) []uint16 { + if aesGCMPreferred { + return slices.Clone(cipherSuitesPreferenceOrder) + } else { + return slices.Clone(cipherSuitesPreferenceOrderNoAES) + } +} + +func defaultCipherSuites(aesGCMPreferred bool) []uint16 { + cipherSuites := supportedCipherSuites(aesGCMPreferred) + return slices.DeleteFunc(cipherSuites, func(c uint16) bool { + return disabledCipherSuites[c] || + tlsrsakex.Value() != "1" && rsaKexCiphers[c] || + tls3des.Value() != "1" && tdesCiphers[c] + }) +} + +// defaultCipherSuitesTLS13 is also the preference order, since there are no +// disabled by default TLS 1.3 cipher suites. The same AES vs ChaCha20 logic as +// cipherSuitesPreferenceOrder applies. +// +// defaultCipherSuitesTLS13 should be an internal detail, +// but widely used packages access it using linkname. +// Notable members of the hall of shame include: +// - github.com/quic-go/quic-go +// - github.com/sagernet/quic-go +// +// Do not remove or change the type signature. +// See go.dev/issue/67401. +// +//go:linkname defaultCipherSuitesTLS13 +var defaultCipherSuitesTLS13 = []uint16{ + TLS_AES_128_GCM_SHA256, + TLS_AES_256_GCM_SHA384, + TLS_CHACHA20_POLY1305_SHA256, +} + +// defaultCipherSuitesTLS13NoAES should be an internal detail, +// but widely used packages access it using linkname. +// Notable members of the hall of shame include: +// - github.com/quic-go/quic-go +// - github.com/sagernet/quic-go +// +// Do not remove or change the type signature. +// See go.dev/issue/67401. +// +//go:linkname defaultCipherSuitesTLS13NoAES +var defaultCipherSuitesTLS13NoAES = []uint16{ + TLS_CHACHA20_POLY1305_SHA256, + TLS_AES_128_GCM_SHA256, + TLS_AES_256_GCM_SHA384, +} diff --git a/go/src/crypto/tls/defaults_boring.go b/go/src/crypto/tls/defaults_boring.go new file mode 100644 index 0000000000000000000000000000000000000000..e88f05cc505cfb7c59b4a7390c5df94d84130a56 --- /dev/null +++ b/go/src/crypto/tls/defaults_boring.go @@ -0,0 +1,69 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build boringcrypto + +package tls + +import ( + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rsa" + "crypto/x509" +) + +// These Go+BoringCrypto policies mostly match BoringSSL's +// ssl_compliance_policy_fips_202205, which is based on NIST SP 800-52r2. +// https://cs.opensource.google/boringssl/boringssl/+/master:ssl/ssl_lib.cc;l=3289;drc=ea7a88fa +// +// P-521 is allowed per https://go.dev/issue/71757. +// +// They are applied when crypto/tls/fipsonly is imported with GOEXPERIMENT=boringcrypto. + +var ( + allowedSupportedVersionsFIPS = []uint16{ + VersionTLS12, + VersionTLS13, + } + allowedCurvePreferencesFIPS = []CurveID{ + CurveP256, + CurveP384, + CurveP521, + } + allowedSignatureAlgorithmsFIPS = []SignatureScheme{ + PSSWithSHA256, + PSSWithSHA384, + PSSWithSHA512, + PKCS1WithSHA256, + ECDSAWithP256AndSHA256, + PKCS1WithSHA384, + ECDSAWithP384AndSHA384, + PKCS1WithSHA512, + ECDSAWithP521AndSHA512, + } + allowedCipherSuitesFIPS = []uint16{ + TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, + TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, + TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, + } + allowedCipherSuitesTLS13FIPS = []uint16{ + TLS_AES_128_GCM_SHA256, + TLS_AES_256_GCM_SHA384, + } +) + +func isCertificateAllowedFIPS(c *x509.Certificate) bool { + // The key must be RSA 2048, RSA 3072, RSA 4096, + // or ECDSA P-256, P-384, P-521. + switch k := c.PublicKey.(type) { + case *rsa.PublicKey: + size := k.N.BitLen() + return size == 2048 || size == 3072 || size == 4096 + case *ecdsa.PublicKey: + return k.Curve == elliptic.P256() || k.Curve == elliptic.P384() || k.Curve == elliptic.P521() + } + + return false +} diff --git a/go/src/crypto/tls/defaults_fips140.go b/go/src/crypto/tls/defaults_fips140.go new file mode 100644 index 0000000000000000000000000000000000000000..19132607938a26d5ea9d29395d1cb86c714aab6f --- /dev/null +++ b/go/src/crypto/tls/defaults_fips140.go @@ -0,0 +1,78 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !boringcrypto + +package tls + +import ( + "crypto/ecdsa" + "crypto/ed25519" + "crypto/elliptic" + "crypto/rsa" + "crypto/x509" +) + +// These FIPS 140-3 policies allow anything approved by SP 800-140C +// and SP 800-140D, and tested as part of the Go Cryptographic Module. +// +// Notably, not SHA-1, 3DES, RC4, ChaCha20Poly1305, RSA PKCS #1 v1.5 key +// transport, or TLS 1.0—1.1 (because we don't test its KDF). +// +// These are not default lists, but filters to apply to the default or +// configured lists. Missing items are treated as if they were not implemented. +// +// They are applied when the fips140 GODEBUG is "on" or "only". + +var ( + allowedSupportedVersionsFIPS = []uint16{ + VersionTLS12, + VersionTLS13, + } + allowedCurvePreferencesFIPS = []CurveID{ + X25519MLKEM768, + SecP256r1MLKEM768, + SecP384r1MLKEM1024, + CurveP256, + CurveP384, + CurveP521, + } + allowedSignatureAlgorithmsFIPS = []SignatureScheme{ + PSSWithSHA256, + ECDSAWithP256AndSHA256, + Ed25519, + PSSWithSHA384, + PSSWithSHA512, + PKCS1WithSHA256, + PKCS1WithSHA384, + PKCS1WithSHA512, + ECDSAWithP384AndSHA384, + ECDSAWithP521AndSHA512, + } + allowedCipherSuitesFIPS = []uint16{ + TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, + TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, + TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, + TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, + TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, + } + allowedCipherSuitesTLS13FIPS = []uint16{ + TLS_AES_128_GCM_SHA256, + TLS_AES_256_GCM_SHA384, + } +) + +func isCertificateAllowedFIPS(c *x509.Certificate) bool { + switch k := c.PublicKey.(type) { + case *rsa.PublicKey: + return k.N.BitLen() >= 2048 + case *ecdsa.PublicKey: + return k.Curve == elliptic.P256() || k.Curve == elliptic.P384() || k.Curve == elliptic.P521() + case ed25519.PublicKey: + return true + default: + return false + } +} diff --git a/go/src/crypto/tls/ech.go b/go/src/crypto/tls/ech.go new file mode 100644 index 0000000000000000000000000000000000000000..adeff9e0508bd9cda76598c4499d0af9b10c1550 --- /dev/null +++ b/go/src/crypto/tls/ech.go @@ -0,0 +1,650 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "bytes" + "crypto/hpke" + "errors" + "fmt" + "strings" + + "golang.org/x/crypto/cryptobyte" +) + +type echCipher struct { + KDFID uint16 + AEADID uint16 +} + +type echExtension struct { + Type uint16 + Data []byte +} + +type echConfig struct { + raw []byte + + Version uint16 + Length uint16 + + ConfigID uint8 + KemID uint16 + PublicKey []byte + SymmetricCipherSuite []echCipher + + MaxNameLength uint8 + PublicName []byte + Extensions []echExtension +} + +var errMalformedECHConfigList = errors.New("tls: malformed ECHConfigList") + +type echConfigErr struct { + field string +} + +func (e *echConfigErr) Error() string { + if e.field == "" { + return "tls: malformed ECHConfig" + } + return fmt.Sprintf("tls: malformed ECHConfig, invalid %s field", e.field) +} + +func parseECHConfig(enc []byte) (skip bool, ec echConfig, err error) { + s := cryptobyte.String(enc) + ec.raw = []byte(enc) + if !s.ReadUint16(&ec.Version) { + return false, echConfig{}, &echConfigErr{"version"} + } + if !s.ReadUint16(&ec.Length) { + return false, echConfig{}, &echConfigErr{"length"} + } + if len(ec.raw) < int(ec.Length)+4 { + return false, echConfig{}, &echConfigErr{"length"} + } + ec.raw = ec.raw[:ec.Length+4] + if ec.Version != extensionEncryptedClientHello { + s.Skip(int(ec.Length)) + return true, echConfig{}, nil + } + if !s.ReadUint8(&ec.ConfigID) { + return false, echConfig{}, &echConfigErr{"config_id"} + } + if !s.ReadUint16(&ec.KemID) { + return false, echConfig{}, &echConfigErr{"kem_id"} + } + if !readUint16LengthPrefixed(&s, &ec.PublicKey) { + return false, echConfig{}, &echConfigErr{"public_key"} + } + var cipherSuites cryptobyte.String + if !s.ReadUint16LengthPrefixed(&cipherSuites) { + return false, echConfig{}, &echConfigErr{"cipher_suites"} + } + for !cipherSuites.Empty() { + var c echCipher + if !cipherSuites.ReadUint16(&c.KDFID) { + return false, echConfig{}, &echConfigErr{"cipher_suites kdf_id"} + } + if !cipherSuites.ReadUint16(&c.AEADID) { + return false, echConfig{}, &echConfigErr{"cipher_suites aead_id"} + } + ec.SymmetricCipherSuite = append(ec.SymmetricCipherSuite, c) + } + if !s.ReadUint8(&ec.MaxNameLength) { + return false, echConfig{}, &echConfigErr{"maximum_name_length"} + } + var publicName cryptobyte.String + if !s.ReadUint8LengthPrefixed(&publicName) { + return false, echConfig{}, &echConfigErr{"public_name"} + } + ec.PublicName = publicName + var extensions cryptobyte.String + if !s.ReadUint16LengthPrefixed(&extensions) { + return false, echConfig{}, &echConfigErr{"extensions"} + } + for !extensions.Empty() { + var e echExtension + if !extensions.ReadUint16(&e.Type) { + return false, echConfig{}, &echConfigErr{"extensions type"} + } + if !extensions.ReadUint16LengthPrefixed((*cryptobyte.String)(&e.Data)) { + return false, echConfig{}, &echConfigErr{"extensions data"} + } + ec.Extensions = append(ec.Extensions, e) + } + + return false, ec, nil +} + +// parseECHConfigList parses a draft-ietf-tls-esni-18 ECHConfigList, returning a +// slice of parsed ECHConfigs, in the same order they were parsed, or an error +// if the list is malformed. +func parseECHConfigList(data []byte) ([]echConfig, error) { + s := cryptobyte.String(data) + var length uint16 + if !s.ReadUint16(&length) { + return nil, errMalformedECHConfigList + } + if length != uint16(len(data)-2) { + return nil, errMalformedECHConfigList + } + var configs []echConfig + for len(s) > 0 { + if len(s) < 4 { + return nil, errors.New("tls: malformed ECHConfig") + } + configLen := uint16(s[2])<<8 | uint16(s[3]) + skip, ec, err := parseECHConfig(s) + if err != nil { + return nil, err + } + s = s[configLen+4:] + if !skip { + configs = append(configs, ec) + } + } + return configs, nil +} + +func pickECHConfig(list []echConfig) (*echConfig, hpke.PublicKey, hpke.KDF, hpke.AEAD) { + for _, ec := range list { + if !validDNSName(string(ec.PublicName)) { + continue + } + var unsupportedExt bool + for _, ext := range ec.Extensions { + // If high order bit is set to 1 the extension is mandatory. + // Since we don't support any extensions, if we see a mandatory + // bit, we skip the config. + if ext.Type&uint16(1<<15) != 0 { + unsupportedExt = true + } + } + if unsupportedExt { + continue + } + kem, err := hpke.NewKEM(ec.KemID) + if err != nil { + continue + } + pub, err := kem.NewPublicKey(ec.PublicKey) + if err != nil { + // This is an error in the config, but killing the connection feels + // excessive. + continue + } + for _, cs := range ec.SymmetricCipherSuite { + // All of the supported AEADs and KDFs are fine, rather than + // imposing some sort of preference here, we just pick the first + // valid suite. + kdf, err := hpke.NewKDF(cs.KDFID) + if err != nil { + continue + } + aead, err := hpke.NewAEAD(cs.AEADID) + if err != nil { + continue + } + return &ec, pub, kdf, aead + } + } + return nil, nil, nil, nil +} + +func encodeInnerClientHello(inner *clientHelloMsg, maxNameLength int) ([]byte, error) { + h, err := inner.marshalMsg(true) + if err != nil { + return nil, err + } + h = h[4:] // strip four byte prefix + + var paddingLen int + if inner.serverName != "" { + paddingLen = max(0, maxNameLength-len(inner.serverName)) + } else { + paddingLen = maxNameLength + 9 + } + paddingLen = 31 - ((len(h) + paddingLen - 1) % 32) + + return append(h, make([]byte, paddingLen)...), nil +} + +func skipUint8LengthPrefixed(s *cryptobyte.String) bool { + var skip uint8 + if !s.ReadUint8(&skip) { + return false + } + return s.Skip(int(skip)) +} + +func skipUint16LengthPrefixed(s *cryptobyte.String) bool { + var skip uint16 + if !s.ReadUint16(&skip) { + return false + } + return s.Skip(int(skip)) +} + +type rawExtension struct { + extType uint16 + data []byte +} + +func extractRawExtensions(hello *clientHelloMsg) ([]rawExtension, error) { + s := cryptobyte.String(hello.original) + if !s.Skip(4+2+32) || // header, version, random + !skipUint8LengthPrefixed(&s) || // session ID + !skipUint16LengthPrefixed(&s) || // cipher suites + !skipUint8LengthPrefixed(&s) { // compression methods + return nil, errors.New("tls: malformed outer client hello") + } + var rawExtensions []rawExtension + var extensions cryptobyte.String + if !s.ReadUint16LengthPrefixed(&extensions) { + return nil, errors.New("tls: malformed outer client hello") + } + + for !extensions.Empty() { + var extension uint16 + var extData cryptobyte.String + if !extensions.ReadUint16(&extension) || + !extensions.ReadUint16LengthPrefixed(&extData) { + return nil, errors.New("tls: invalid inner client hello") + } + rawExtensions = append(rawExtensions, rawExtension{extension, extData}) + } + return rawExtensions, nil +} + +func decodeInnerClientHello(outer *clientHelloMsg, encoded []byte) (*clientHelloMsg, error) { + // Reconstructing the inner client hello from its encoded form is somewhat + // complicated. It is missing its header (message type and length), session + // ID, and the extensions may be compressed. Since we need to put the + // extensions back in the same order as they were in the raw outer hello, + // and since we don't store the raw extensions, or the order we parsed them + // in, we need to reparse the raw extensions from the outer hello in order + // to properly insert them into the inner hello. This _should_ result in raw + // bytes which match the hello as it was generated by the client. + innerReader := cryptobyte.String(encoded) + var versionAndRandom, sessionID, cipherSuites, compressionMethods []byte + var extensions cryptobyte.String + if !innerReader.ReadBytes(&versionAndRandom, 2+32) || + !readUint8LengthPrefixed(&innerReader, &sessionID) || + len(sessionID) != 0 || + !readUint16LengthPrefixed(&innerReader, &cipherSuites) || + !readUint8LengthPrefixed(&innerReader, &compressionMethods) || + !innerReader.ReadUint16LengthPrefixed(&extensions) { + return nil, errors.New("tls: invalid inner client hello") + } + + // The specification says we must verify that the trailing padding is all + // zeros. This is kind of weird for TLS messages, where we generally just + // throw away any trailing garbage. + for _, p := range innerReader { + if p != 0 { + return nil, errors.New("tls: invalid inner client hello") + } + } + + rawOuterExts, err := extractRawExtensions(outer) + if err != nil { + return nil, err + } + + recon := cryptobyte.NewBuilder(nil) + recon.AddUint8(typeClientHello) + recon.AddUint24LengthPrefixed(func(recon *cryptobyte.Builder) { + recon.AddBytes(versionAndRandom) + recon.AddUint8LengthPrefixed(func(recon *cryptobyte.Builder) { + recon.AddBytes(outer.sessionId) + }) + recon.AddUint16LengthPrefixed(func(recon *cryptobyte.Builder) { + recon.AddBytes(cipherSuites) + }) + recon.AddUint8LengthPrefixed(func(recon *cryptobyte.Builder) { + recon.AddBytes(compressionMethods) + }) + recon.AddUint16LengthPrefixed(func(recon *cryptobyte.Builder) { + for !extensions.Empty() { + var extension uint16 + var extData cryptobyte.String + if !extensions.ReadUint16(&extension) || + !extensions.ReadUint16LengthPrefixed(&extData) { + recon.SetError(errors.New("tls: invalid inner client hello")) + return + } + if extension == extensionECHOuterExtensions { + if !extData.ReadUint8LengthPrefixed(&extData) { + recon.SetError(errors.New("tls: invalid inner client hello")) + return + } + var i int + for !extData.Empty() { + var extType uint16 + if !extData.ReadUint16(&extType) { + recon.SetError(errors.New("tls: invalid inner client hello")) + return + } + if extType == extensionEncryptedClientHello { + recon.SetError(errors.New("tls: invalid outer extensions")) + return + } + for ; i <= len(rawOuterExts); i++ { + if i == len(rawOuterExts) { + recon.SetError(errors.New("tls: invalid outer extensions")) + return + } + if rawOuterExts[i].extType == extType { + break + } + } + recon.AddUint16(rawOuterExts[i].extType) + recon.AddUint16LengthPrefixed(func(recon *cryptobyte.Builder) { + recon.AddBytes(rawOuterExts[i].data) + }) + } + } else { + recon.AddUint16(extension) + recon.AddUint16LengthPrefixed(func(recon *cryptobyte.Builder) { + recon.AddBytes(extData) + }) + } + } + }) + }) + + reconBytes, err := recon.Bytes() + if err != nil { + return nil, err + } + inner := &clientHelloMsg{} + if !inner.unmarshal(reconBytes) { + return nil, errors.New("tls: invalid reconstructed inner client hello") + } + + if !bytes.Equal(inner.encryptedClientHello, []byte{uint8(innerECHExt)}) { + return nil, errInvalidECHExt + } + + hasTLS13 := false + for _, v := range inner.supportedVersions { + // Skip GREASE values (values of the form 0x?A0A). + // GREASE (Generate Random Extensions And Sustain Extensibility) is a mechanism used by + // browsers like Chrome to ensure TLS implementations correctly ignore unknown values. + // GREASE values follow a specific pattern: 0x?A0A, where ? can be any hex digit. + // These values should be ignored when processing supported TLS versions. + if v&0x0F0F == 0x0A0A && v&0xff == v>>8 { + continue + } + + // Ensure at least TLS 1.3 is offered. + if v == VersionTLS13 { + hasTLS13 = true + } else if v < VersionTLS13 { + // Reject if any non-GREASE value is below TLS 1.3, as ECH requires TLS 1.3+. + return nil, errors.New("tls: client sent encrypted_client_hello extension with unsupported versions") + } + } + + if !hasTLS13 { + return nil, errors.New("tls: client sent encrypted_client_hello extension but did not offer TLS 1.3") + } + + return inner, nil +} + +func decryptECHPayload(context *hpke.Recipient, hello, payload []byte) ([]byte, error) { + outerAAD := bytes.Replace(hello[4:], payload, make([]byte, len(payload)), 1) + return context.Open(outerAAD, payload) +} + +func generateOuterECHExt(id uint8, kdfID, aeadID uint16, encodedKey []byte, payload []byte) ([]byte, error) { + var b cryptobyte.Builder + b.AddUint8(0) // outer + b.AddUint16(kdfID) + b.AddUint16(aeadID) + b.AddUint8(id) + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { b.AddBytes(encodedKey) }) + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { b.AddBytes(payload) }) + return b.Bytes() +} + +func computeAndUpdateOuterECHExtension(outer, inner *clientHelloMsg, ech *echClientContext, useKey bool) error { + var encapKey []byte + if useKey { + encapKey = ech.encapsulatedKey + } + encodedInner, err := encodeInnerClientHello(inner, int(ech.config.MaxNameLength)) + if err != nil { + return err + } + // NOTE: the tag lengths for all of the supported AEADs are the same (16 + // bytes), so we have hardcoded it here. If we add support for another AEAD + // with a different tag length, we will need to change this. + encryptedLen := len(encodedInner) + 16 // AEAD tag length + outer.encryptedClientHello, err = generateOuterECHExt(ech.config.ConfigID, ech.kdfID, ech.aeadID, encapKey, make([]byte, encryptedLen)) + if err != nil { + return err + } + serializedOuter, err := outer.marshal() + if err != nil { + return err + } + serializedOuter = serializedOuter[4:] // strip the four byte prefix + encryptedInner, err := ech.hpkeContext.Seal(serializedOuter, encodedInner) + if err != nil { + return err + } + outer.encryptedClientHello, err = generateOuterECHExt(ech.config.ConfigID, ech.kdfID, ech.aeadID, encapKey, encryptedInner) + if err != nil { + return err + } + return nil +} + +// validDNSName is a rather rudimentary check for the validity of a DNS name. +// This is used to check if the public_name in a ECHConfig is valid when we are +// picking a config. This can be somewhat lax because even if we pick a +// valid-looking name, the DNS layer will later reject it anyway. +func validDNSName(name string) bool { + if len(name) > 253 { + return false + } + labels := strings.Split(name, ".") + if len(labels) <= 1 { + return false + } + for _, l := range labels { + labelLen := len(l) + if labelLen == 0 { + return false + } + for i, r := range l { + if r == '-' && (i == 0 || i == labelLen-1) { + return false + } + if (r < '0' || r > '9') && (r < 'a' || r > 'z') && (r < 'A' || r > 'Z') && r != '-' { + return false + } + } + } + return true +} + +// ECHRejectionError is the error type returned when ECH is rejected by a remote +// server. If the server offered a ECHConfigList to use for retries, the +// RetryConfigList field will contain this list. +// +// The client may treat an ECHRejectionError with an empty set of RetryConfigs +// as a secure signal from the server. +type ECHRejectionError struct { + RetryConfigList []byte +} + +func (e *ECHRejectionError) Error() string { + return "tls: server rejected ECH" +} + +var errMalformedECHExt = errors.New("tls: malformed encrypted_client_hello extension") +var errInvalidECHExt = errors.New("tls: client sent invalid encrypted_client_hello extension") + +type echExtType uint8 + +const ( + innerECHExt echExtType = 1 + outerECHExt echExtType = 0 +) + +func parseECHExt(ext []byte) (echType echExtType, cs echCipher, configID uint8, encap []byte, payload []byte, err error) { + data := make([]byte, len(ext)) + copy(data, ext) + s := cryptobyte.String(data) + var echInt uint8 + if !s.ReadUint8(&echInt) { + err = errMalformedECHExt + return + } + echType = echExtType(echInt) + if echType == innerECHExt { + if !s.Empty() { + err = errMalformedECHExt + return + } + return echType, cs, 0, nil, nil, nil + } + if echType != outerECHExt { + err = errInvalidECHExt + return + } + if !s.ReadUint16(&cs.KDFID) { + err = errMalformedECHExt + return + } + if !s.ReadUint16(&cs.AEADID) { + err = errMalformedECHExt + return + } + if !s.ReadUint8(&configID) { + err = errMalformedECHExt + return + } + if !readUint16LengthPrefixed(&s, &encap) { + err = errMalformedECHExt + return + } + if !readUint16LengthPrefixed(&s, &payload) { + err = errMalformedECHExt + return + } + + // NOTE: clone encap and payload so that mutating them does not mutate the + // raw extension bytes. + return echType, cs, configID, bytes.Clone(encap), bytes.Clone(payload), nil +} + +func (c *Conn) processECHClientHello(outer *clientHelloMsg, echKeys []EncryptedClientHelloKey) (*clientHelloMsg, *echServerContext, error) { + echType, echCiphersuite, configID, encap, payload, err := parseECHExt(outer.encryptedClientHello) + if err != nil { + if errors.Is(err, errInvalidECHExt) { + c.sendAlert(alertIllegalParameter) + } else { + c.sendAlert(alertDecodeError) + } + + return nil, nil, errInvalidECHExt + } + + if echType == innerECHExt { + return outer, &echServerContext{inner: true}, nil + } + + if len(echKeys) == 0 { + return outer, nil, nil + } + + for _, echKey := range echKeys { + skip, config, err := parseECHConfig(echKey.Config) + if err != nil || skip { + c.sendAlert(alertInternalError) + return nil, nil, fmt.Errorf("tls: invalid EncryptedClientHelloKey Config: %s", err) + } + if skip { + continue + } + kem, err := hpke.NewKEM(config.KemID) + if err != nil { + c.sendAlert(alertInternalError) + return nil, nil, fmt.Errorf("tls: invalid EncryptedClientHelloKey Config KEM: %s", err) + } + echPriv, err := kem.NewPrivateKey(echKey.PrivateKey) + if err != nil { + c.sendAlert(alertInternalError) + return nil, nil, fmt.Errorf("tls: invalid EncryptedClientHelloKey PrivateKey: %s", err) + } + kdf, err := hpke.NewKDF(echCiphersuite.KDFID) + if err != nil { + c.sendAlert(alertInternalError) + return nil, nil, fmt.Errorf("tls: invalid EncryptedClientHelloKey Config KDF: %s", err) + } + aead, err := hpke.NewAEAD(echCiphersuite.AEADID) + if err != nil { + c.sendAlert(alertInternalError) + return nil, nil, fmt.Errorf("tls: invalid EncryptedClientHelloKey Config AEAD: %s", err) + } + info := append([]byte("tls ech\x00"), echKey.Config...) + hpkeContext, err := hpke.NewRecipient(encap, echPriv, kdf, aead, info) + if err != nil { + // attempt next trial decryption + continue + } + + encodedInner, err := decryptECHPayload(hpkeContext, outer.original, payload) + if err != nil { + // attempt next trial decryption + continue + } + + // NOTE: we do not enforce that the sent server_name matches the ECH + // configs PublicName, since this is not particularly important, and + // the client already had to know what it was in order to properly + // encrypt the payload. This is only a MAY in the spec, so we're not + // doing anything revolutionary. + + echInner, err := decodeInnerClientHello(outer, encodedInner) + if err != nil { + c.sendAlert(alertIllegalParameter) + return nil, nil, errInvalidECHExt + } + + c.echAccepted = true + + return echInner, &echServerContext{ + hpkeContext: hpkeContext, + configID: configID, + ciphersuite: echCiphersuite, + }, nil + } + + return outer, nil, nil +} + +func buildRetryConfigList(keys []EncryptedClientHelloKey) ([]byte, error) { + var atLeastOneRetryConfig bool + var retryBuilder cryptobyte.Builder + retryBuilder.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + for _, c := range keys { + if !c.SendAsRetry { + continue + } + atLeastOneRetryConfig = true + b.AddBytes(c.Config) + } + }) + if !atLeastOneRetryConfig { + return nil, nil + } + return retryBuilder.Bytes() +} diff --git a/go/src/crypto/tls/ech_test.go b/go/src/crypto/tls/ech_test.go new file mode 100644 index 0000000000000000000000000000000000000000..5adbb0293ddb8608becb7f4958ce3915171466c7 --- /dev/null +++ b/go/src/crypto/tls/ech_test.go @@ -0,0 +1,48 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "encoding/hex" + "testing" +) + +func TestDecodeECHConfigLists(t *testing.T) { + for _, tc := range []struct { + list string + numConfigs int + }{ + {"0045fe0d0041590020002092a01233db2218518ccbbbbc24df20686af417b37388de6460e94011974777090004000100010012636c6f7564666c6172652d6563682e636f6d0000", 1}, + {"0105badd00050504030201fe0d0066000010004104e62b69e2bf659f97be2f1e0d948a4cd5976bb7a91e0d46fbdda9a91e9ddcba5a01e7d697a80a18f9c3c4a31e56e27c8348db161a1cf51d7ef1942d4bcf7222c1000c000100010001000200010003400e7075626c69632e6578616d706c650000fe0d003d00002000207d661615730214aeee70533366f36a609ead65c0c208e62322346ab5bcd8de1c000411112222400e7075626c69632e6578616d706c650000fe0d004d000020002085bd6a03277c25427b52e269e0c77a8eb524ba1eb3d2f132662d4b0ac6cb7357000c000100010001000200010003400e7075626c69632e6578616d706c650008aaaa000474657374", 3}, + } { + b, err := hex.DecodeString(tc.list) + if err != nil { + t.Fatal(err) + } + configs, err := parseECHConfigList(b) + if err != nil { + t.Fatal(err) + } + if len(configs) != tc.numConfigs { + t.Fatalf("unexpected number of configs parsed: got %d want %d", len(configs), tc.numConfigs) + } + } + +} + +func TestSkipBadConfigs(t *testing.T) { + b, err := hex.DecodeString("00c8badd00050504030201fe0d0029006666000401020304000c000100010001000200010003400e7075626c69632e6578616d706c650000fe0d003d000020002072e8a23b7aef67832bcc89d652e3870a60f88ca684ec65d6eace6b61f136064c000411112222400e7075626c69632e6578616d706c650000fe0d004d00002000200ce95810a81d8023f41e83679bc92701b2acd46c75869f95c72bc61c6b12297c000c000100010001000200010003400e7075626c69632e6578616d706c650008aaaa000474657374") + if err != nil { + t.Fatal(err) + } + configs, err := parseECHConfigList(b) + if err != nil { + t.Fatal(err) + } + config, _, _, _ := pickECHConfig(configs) + if config != nil { + t.Fatal("pickECHConfig picked an invalid config") + } +} diff --git a/go/src/crypto/tls/example_test.go b/go/src/crypto/tls/example_test.go new file mode 100644 index 0000000000000000000000000000000000000000..95e4953fb2e0c3870da41dde30ce376bf2ec593e --- /dev/null +++ b/go/src/crypto/tls/example_test.go @@ -0,0 +1,229 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls_test + +import ( + "crypto/tls" + "crypto/x509" + "log" + "net/http" + "net/http/httptest" + "os" + "time" +) + +// zeroSource is an io.Reader that returns an unlimited number of zero bytes. +type zeroSource struct{} + +func (zeroSource) Read(b []byte) (n int, err error) { + clear(b) + return len(b), nil +} + +func ExampleDial() { + // Connecting with a custom root-certificate set. + + const rootPEM = ` +-- GlobalSign Root R2, valid until Dec 15, 2021 +-----BEGIN CERTIFIC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KYnX3ZHu01yiPqFbQfXf5WRDLenVOavS +ot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG79G+dwfCMNYxd +AfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7 +TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg== +-----END CERTIFICATE-----` + + // First, create the set of root certificates. For this example we only + // have one. It's also possible to omit this in order to use the + // default root set of the current operating system. + roots := x509.NewCertPool() + ok := roots.AppendCertsFromPEM([]byte(rootPEM)) + if !ok { + panic("failed to parse root certificate") + } + + conn, err := tls.Dial("tcp", "mail.google.com:443", &tls.Config{ + RootCAs: roots, + }) + if err != nil { + panic("failed to connect: " + err.Error()) + } + conn.Close() +} + +func ExampleConfig_keyLogWriter() { + // Debugging TLS applications by decrypting a network traffic capture. + + // WARNING: Use of KeyLogWriter compromises security and should only be + // used for debugging. + + // Dummy test HTTP server for the example with insecure random so output is + // reproducible. + server := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})) + server.TLS = &tls.Config{ + Rand: zeroSource{}, // for example only; don't do this. + } + server.StartTLS() + defer server.Close() + + // Typically the log would go to an open file: + // w, err := os.OpenFile("tls-secrets.txt", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) + w := os.Stdout + + client := &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{ + KeyLogWriter: w, + + Rand: zeroSource{}, // for reproducible output; don't do this. + InsecureSkipVerify: true, // test server certificate is not trusted. + }, + }, + } + resp, err := client.Get(server.URL) + if err != nil { + log.Fatalf("Failed to get URL: %v", err) + } + resp.Body.Close() + + // The resulting file can be used with Wireshark to decrypt the TLS + // connection by setting (Pre)-Master-Secret log filename in SSL Protocol + // preferences. +} + +func ExampleLoadX509KeyPair() { + cert, err := tls.LoadX509KeyPair("testdata/example-cert.pem", "testdata/example-key.pem") + if err != nil { + log.Fatal(err) + } + cfg := &tls.Config{Certificates: []tls.Certificate{cert}} + listener, err := tls.Listen("tcp", ":2000", cfg) + if err != nil { + log.Fatal(err) + } + _ = listener +} + +func ExampleX509KeyPair() { + certPem := []byte(`-----BEGIN CERTIFICATE----- +MIIBhTCCASugAwIBAgIQIRi6zePL6mKjOipn+dNuaTAKBggqhkjOPQQDAjASMRAw +DgYDVQQKEwdBY21lIENvMB4XDTE3MTAyMDE5NDMwNloXDTE4MTAyMDE5NDMwNlow +EjEQMA4GA1UEChMHQWNtZSBDbzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABD0d +7VNhbWvZLWPuj/RtHFjvtJBEwOkhbN/BnnE8rnZR8+sbwnc/KhCk3FhnpHZnQz7B +5aETbbIgmuvewdjvSBSjYzBhMA4GA1UdDwEB/wQEAwICpDATBgNVHSUEDDAKBggr +BgEFBQcDATAPBgNVHRMBAf8EBTADAQH/MCkGA1UdEQQiMCCCDmxvY2FsaG9zdDo1 +NDUzgg4xMjcuMC4wLjE6NTQ1MzAKBggqhkjOPQQDAgNIADBFAiEA2zpJEPQyz6/l +Wf86aX6PepsntZv2GYlA5UpabfT2EZICICpJ5h/iI+i341gBmLiAFQOyTDT+/wQc +6MF9+Yw1Yy0t +-----END CERTIFICATE-----`) + keyPem := []byte(`-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIIrYSSNQFaA2Hwf1duRSxKtLYX5CB04fSeQ6tF1aY/PuoAoGCCqGSM49 +AwEHoUQDQgAEPR3tU2Fta9ktY+6P9G0cWO+0kETA6SFs38GecTyudlHz6xvCdz8q +EKTcWGekdmdDPsHloRNtsiCa697B2O9IFA== +-----END EC PRIVATE KEY-----`) + cert, err := tls.X509KeyPair(certPem, keyPem) + if err != nil { + log.Fatal(err) + } + cfg := &tls.Config{Certificates: []tls.Certificate{cert}} + listener, err := tls.Listen("tcp", ":2000", cfg) + if err != nil { + log.Fatal(err) + } + _ = listener +} + +func ExampleX509KeyPair_httpServer() { + certPem := []byte(`-----BEGIN CERTIFICATE----- +MIIBhTCCASugAwIBAgIQIRi6zePL6mKjOipn+dNuaTAKBggqhkjOPQQDAjASMRAw +DgYDVQQKEwdBY21lIENvMB4XDTE3MTAyMDE5NDMwNloXDTE4MTAyMDE5NDMwNlow +EjEQMA4GA1UEChMHQWNtZSBDbzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABD0d +7VNhbWvZLWPuj/RtHFjvtJBEwOkhbN/BnnE8rnZR8+sbwnc/KhCk3FhnpHZnQz7B +5aETbbIgmuvewdjvSBSjYzBhMA4GA1UdDwEB/wQEAwICpDATBgNVHSUEDDAKBggr +BgEFBQcDATAPBgNVHRMBAf8EBTADAQH/MCkGA1UdEQQiMCCCDmxvY2FsaG9zdDo1 +NDUzgg4xMjcuMC4wLjE6NTQ1MzAKBggqhkjOPQQDAgNIADBFAiEA2zpJEPQyz6/l +Wf86aX6PepsntZv2GYlA5UpabfT2EZICICpJ5h/iI+i341gBmLiAFQOyTDT+/wQc +6MF9+Yw1Yy0t +-----END CERTIFICATE-----`) + keyPem := []byte(`-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIIrYSSNQFaA2Hwf1duRSxKtLYX5CB04fSeQ6tF1aY/PuoAoGCCqGSM49 +AwEHoUQDQgAEPR3tU2Fta9ktY+6P9G0cWO+0kETA6SFs38GecTyudlHz6xvCdz8q +EKTcWGekdmdDPsHloRNtsiCa697B2O9IFA== +-----END EC PRIVATE KEY-----`) + cert, err := tls.X509KeyPair(certPem, keyPem) + if err != nil { + log.Fatal(err) + } + cfg := &tls.Config{Certificates: []tls.Certificate{cert}} + srv := &http.Server{ + TLSConfig: cfg, + ReadTimeout: time.Minute, + WriteTimeout: time.Minute, + } + log.Fatal(srv.ListenAndServeTLS("", "")) +} + +func ExampleConfig_verifyConnection() { + // VerifyConnection can be used to replace and customize connection + // verification. This example shows a VerifyConnection implementation that + // will be approximately equivalent to what crypto/tls does normally to + // verify the peer's certificate. + + // Client side configuration. + _ = &tls.Config{ + // Set InsecureSkipVerify to skip the default validation we are + // replacing. This will not disable VerifyConnection. + InsecureSkipVerify: true, + VerifyConnection: func(cs tls.ConnectionState) error { + opts := x509.VerifyOptions{ + DNSName: cs.ServerName, + Intermediates: x509.NewCertPool(), + } + for _, cert := range cs.PeerCertificates[1:] { + opts.Intermediates.AddCert(cert) + } + _, err := cs.PeerCertificates[0].Verify(opts) + return err + }, + } + + // Server side configuration. + _ = &tls.Config{ + // Require client certificates (or VerifyConnection will run anyway and + // panic accessing cs.PeerCertificates[0]) but don't verify them with the + // default verifier. This will not disable VerifyConnection. + ClientAuth: tls.RequireAnyClientCert, + VerifyConnection: func(cs tls.ConnectionState) error { + opts := x509.VerifyOptions{ + DNSName: cs.ServerName, + Intermediates: x509.NewCertPool(), + KeyUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth}, + } + for _, cert := range cs.PeerCertificates[1:] { + opts.Intermediates.AddCert(cert) + } + _, err := cs.PeerCertificates[0].Verify(opts) + return err + }, + } + + // Note that when certificates are not handled by the default verifier + // ConnectionState.VerifiedChains will be nil. +} diff --git a/go/src/crypto/tls/fips140_test.go b/go/src/crypto/tls/fips140_test.go new file mode 100644 index 0000000000000000000000000000000000000000..540d2e6ee7c9c84a82db1408a0812aa7590d75b6 --- /dev/null +++ b/go/src/crypto/tls/fips140_test.go @@ -0,0 +1,752 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "crypto/ecdsa" + "crypto/elliptic" + "crypto/fips140" + "crypto/internal/boring" + ifips140 "crypto/internal/fips140" + "crypto/rand" + "crypto/rsa" + "crypto/x509" + "crypto/x509/pkix" + "encoding/pem" + "fmt" + "internal/obscuretestdata" + "internal/testenv" + "math/big" + "net" + "os" + "regexp" + "runtime" + "strings" + "testing" + "time" +) + +func allCipherSuitesIncludingTLS13() []uint16 { + s := allCipherSuites() + for _, suite := range cipherSuitesTLS13 { + s = append(s, suite.id) + } + return s +} + +func isTLS13CipherSuite(id uint16) bool { + for _, suite := range cipherSuitesTLS13 { + if id == suite.id { + return true + } + } + return false +} + +func generateKeyShare(group CurveID) keyShare { + ke, err := keyExchangeForCurveID(group) + if err != nil { + panic(err) + } + _, shares, err := ke.keyShares(rand.Reader) + if err != nil { + panic(err) + } + return shares[0] +} + +func rerunWithFIPS140Enforced(t *testing.T) { + t.Helper() + if err := ifips140.Supported(); err != nil { + t.Skipf("test requires FIPS 140 mode: %v", err) + } + nameRegex := "^" + regexp.QuoteMeta(t.Name()) + "$" + cmd := testenv.Command(t, testenv.Executable(t), "-test.run="+nameRegex, "-test.v") + cmd.Env = append(cmd.Environ(), "GODEBUG=fips140=only") + out, err := cmd.CombinedOutput() + t.Logf("running with GODEBUG=fips140=only:\n%s", out) + if err != nil { + t.Errorf("fips140=only subprocess failed: %v", err) + } +} + +var testConfigFIPS140 *Config + +func TestFIPSServerProtocolVersion(t *testing.T) { + test := func(t *testing.T, name string, v uint16, msg string) { + t.Run(name, func(t *testing.T) { + serverConfig := testConfigFIPS140.Clone() + serverConfig.MinVersion = VersionSSL30 + clientConfig := testConfigFIPS140.Clone() + clientConfig.MinVersion = v + clientConfig.MaxVersion = v + _, _, err := testHandshake(t, clientConfig, serverConfig) + if msg == "" { + if err != nil { + t.Fatalf("got error: %v, expected success", err) + } + } else { + if err == nil { + t.Fatalf("got success, expected error") + } + if !strings.Contains(err.Error(), msg) { + t.Fatalf("got error %v, expected %q", err, msg) + } + } + }) + } + + runWithFIPSDisabled(t, func(t *testing.T) { + test(t, "VersionTLS10", VersionTLS10, "") + test(t, "VersionTLS11", VersionTLS11, "") + test(t, "VersionTLS12", VersionTLS12, "") + test(t, "VersionTLS13", VersionTLS13, "") + }) + + runWithFIPSEnabled(t, func(t *testing.T) { + test(t, "VersionTLS10", VersionTLS10, "supported versions") + test(t, "VersionTLS11", VersionTLS11, "supported versions") + test(t, "VersionTLS12", VersionTLS12, "") + test(t, "VersionTLS13", VersionTLS13, "") + }) + + if !fips140.Enforced() { + rerunWithFIPS140Enforced(t) + } +} + +func isFIPSVersion(v uint16) bool { + return v == VersionTLS12 || v == VersionTLS13 +} + +func isFIPSCipherSuite(id uint16) bool { + name := CipherSuiteName(id) + if isTLS13CipherSuite(id) { + switch id { + case TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384: + return true + case TLS_CHACHA20_POLY1305_SHA256: + return false + default: + panic("unknown TLS 1.3 cipher suite: " + name) + } + } + switch id { + case TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, + TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, + TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384: + return true + case TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, + TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256: + // Only for the native module. + return !boring.Enabled + } + switch { + case strings.Contains(name, "CHACHA20"): + return false + case strings.HasSuffix(name, "_SHA"): // SHA-1 + return false + case strings.HasPrefix(name, "TLS_RSA"): // RSA kex + return false + default: + panic("unknown cipher suite: " + name) + } +} + +func isFIPSCurve(id CurveID) bool { + switch id { + case CurveP256, CurveP384, CurveP521: + return true + case X25519MLKEM768, SecP256r1MLKEM768, SecP384r1MLKEM1024: + // Only for the native module. + return !boring.Enabled + case X25519: + return false + default: + panic("unknown curve: " + id.String()) + } +} + +func isECDSA(id uint16) bool { + for _, suite := range cipherSuites { + if suite.id == id { + return suite.flags&suiteECSign == suiteECSign + } + } + return false // TLS 1.3 cipher suites are not tied to the signature algorithm. +} + +func isFIPSSignatureScheme(alg SignatureScheme) bool { + switch alg { + case PKCS1WithSHA256, + ECDSAWithP256AndSHA256, + PKCS1WithSHA384, + ECDSAWithP384AndSHA384, + PKCS1WithSHA512, + ECDSAWithP521AndSHA512, + PSSWithSHA256, + PSSWithSHA384, + PSSWithSHA512: + return true + case Ed25519: + // Only for the native module. + return !boring.Enabled + case PKCS1WithSHA1, ECDSAWithSHA1: + return false + default: + panic("unknown signature scheme: " + alg.String()) + } +} + +func TestFIPSServerCipherSuites(t *testing.T) { + serverConfig := testConfigFIPS140.Clone() + serverConfig.Certificates = make([]Certificate, 1) + + for _, id := range allCipherSuitesIncludingTLS13() { + if isECDSA(id) { + serverConfig.Certificates[0].Certificate = [][]byte{testECDSACertificate} + serverConfig.Certificates[0].PrivateKey = testECDSAPrivateKey + } else { + serverConfig.Certificates[0].Certificate = [][]byte{testRSACertificate} + serverConfig.Certificates[0].PrivateKey = testRSAPrivateKey + } + serverConfig.BuildNameToCertificate() + t.Run(fmt.Sprintf("suite=%s", CipherSuiteName(id)), func(t *testing.T) { + clientHello := &clientHelloMsg{ + vers: VersionTLS12, + random: make([]byte, 32), + cipherSuites: []uint16{id}, + compressionMethods: []uint8{compressionNone}, + supportedCurves: defaultCurvePreferences(), + keyShares: []keyShare{generateKeyShare(CurveP256)}, + supportedPoints: []uint8{pointFormatUncompressed}, + supportedVersions: []uint16{VersionTLS12}, + supportedSignatureAlgorithms: allowedSignatureAlgorithmsFIPS, + } + if isTLS13CipherSuite(id) { + clientHello.supportedVersions = []uint16{VersionTLS13} + } + + runWithFIPSDisabled(t, func(t *testing.T) { + testClientHello(t, serverConfig, clientHello) + }) + + runWithFIPSEnabled(t, func(t *testing.T) { + msg := "" + if !isFIPSCipherSuite(id) { + msg = "no cipher suite supported by both client and server" + } + testClientHelloFailure(t, serverConfig, clientHello, msg) + }) + }) + } + + if !fips140.Enforced() { + rerunWithFIPS140Enforced(t) + } +} + +func TestFIPSServerCurves(t *testing.T) { + serverConfig := testConfigFIPS140.Clone() + serverConfig.CurvePreferences = nil + serverConfig.BuildNameToCertificate() + + for _, curveid := range defaultCurvePreferences() { + t.Run(fmt.Sprintf("curve=%v", curveid), func(t *testing.T) { + clientConfig := testConfigFIPS140.Clone() + clientConfig.CurvePreferences = []CurveID{curveid} + + runWithFIPSDisabled(t, func(t *testing.T) { + if _, _, err := testHandshake(t, clientConfig, serverConfig); err != nil { + t.Fatalf("got error: %v, expected success", err) + } + }) + + // With fipstls forced, bad curves should be rejected. + runWithFIPSEnabled(t, func(t *testing.T) { + _, _, err := testHandshake(t, clientConfig, serverConfig) + if err != nil && isFIPSCurve(curveid) { + t.Fatalf("got error: %v, expected success", err) + } else if err == nil && !isFIPSCurve(curveid) { + t.Fatalf("got success, expected error") + } + }) + }) + } + + if !fips140.Enforced() { + rerunWithFIPS140Enforced(t) + } +} + +func fipsHandshake(t *testing.T, clientConfig, serverConfig *Config) (clientErr, serverErr error) { + c, s := localPipe(t) + client := Client(c, clientConfig) + server := Server(s, serverConfig) + done := make(chan error, 1) + go func() { + done <- client.Handshake() + c.Close() + }() + serverErr = server.Handshake() + s.Close() + clientErr = <-done + return +} + +func TestFIPSServerSignatureAndHash(t *testing.T) { + defer func() { + testingOnlySupportedSignatureAlgorithms = nil + }() + defer func(godebug string) { + os.Setenv("GODEBUG", godebug) + }(os.Getenv("GODEBUG")) + os.Setenv("GODEBUG", "tlssha1=1") + + for _, sigHash := range defaultSupportedSignatureAlgorithms() { + t.Run(fmt.Sprintf("%v", sigHash), func(t *testing.T) { + serverConfig := testConfigFIPS140.Clone() + serverConfig.Certificates = make([]Certificate, 1) + + testingOnlySupportedSignatureAlgorithms = []SignatureScheme{sigHash} + + sigType, _, _ := typeAndHashFromSignatureScheme(sigHash) + switch sigType { + case signaturePKCS1v15, signatureRSAPSS: + serverConfig.CipherSuites = []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256} + serverConfig.Certificates[0].Certificate = [][]byte{testRSAPSS2048Certificate} + serverConfig.Certificates[0].PrivateKey = testRSAPSS2048PrivateKey + case signatureEd25519: + serverConfig.CipherSuites = []uint16{TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256} + serverConfig.Certificates[0].Certificate = [][]byte{testEd25519Certificate} + serverConfig.Certificates[0].PrivateKey = testEd25519PrivateKey + case signatureECDSA: + serverConfig.CipherSuites = []uint16{TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256} + serverConfig.Certificates[0].Certificate = [][]byte{testECDSACertificate} + serverConfig.Certificates[0].PrivateKey = testECDSAPrivateKey + } + serverConfig.BuildNameToCertificate() + // PKCS#1 v1.5 signature algorithms can't be used standalone in TLS + // 1.3, and the ECDSA ones bind to the curve used. + serverConfig.MaxVersion = VersionTLS12 + + runWithFIPSDisabled(t, func(t *testing.T) { + clientErr, serverErr := fipsHandshake(t, testConfigFIPS140, serverConfig) + if clientErr != nil { + t.Fatalf("expected handshake with %v to succeed; client error: %v; server error: %v", sigHash, clientErr, serverErr) + } + }) + + // With fipstls forced, bad curves should be rejected. + runWithFIPSEnabled(t, func(t *testing.T) { + clientErr, _ := fipsHandshake(t, testConfigFIPS140, serverConfig) + if isFIPSSignatureScheme(sigHash) { + if clientErr != nil { + t.Fatalf("expected handshake with %v to succeed; err=%v", sigHash, clientErr) + } + } else { + if clientErr == nil { + t.Fatalf("expected handshake with %v to fail, but it succeeded", sigHash) + } + } + }) + }) + } + + if !fips140.Enforced() { + rerunWithFIPS140Enforced(t) + } +} + +func TestFIPSClientHello(t *testing.T) { + runWithFIPSEnabled(t, testFIPSClientHello) +} + +func testFIPSClientHello(t *testing.T) { + // Test that no matter what we put in the client config, + // the client does not offer non-FIPS configurations. + + c, s := net.Pipe() + defer c.Close() + defer s.Close() + + clientConfig := testConfigFIPS140.Clone() + // All sorts of traps for the client to avoid. + clientConfig.MinVersion = VersionSSL30 + clientConfig.MaxVersion = VersionTLS13 + clientConfig.CipherSuites = allCipherSuites() + clientConfig.CurvePreferences = defaultCurvePreferences() + + go Client(c, clientConfig).Handshake() + srv := Server(s, testConfigFIPS140) + msg, err := srv.readHandshake(nil) + if err != nil { + t.Fatal(err) + } + hello, ok := msg.(*clientHelloMsg) + if !ok { + t.Fatalf("unexpected message type %T", msg) + } + + if !isFIPSVersion(hello.vers) { + t.Errorf("client vers=%#x", hello.vers) + } + for _, v := range hello.supportedVersions { + if !isFIPSVersion(v) { + t.Errorf("client offered disallowed version %#x", v) + } + } + for _, id := range hello.cipherSuites { + if !isFIPSCipherSuite(id) { + t.Errorf("client offered disallowed suite %v", CipherSuiteName(id)) + } + } + for _, id := range hello.supportedCurves { + if !isFIPSCurve(id) { + t.Errorf("client offered disallowed curve %v", id) + } + } + for _, sigHash := range hello.supportedSignatureAlgorithms { + if !isFIPSSignatureScheme(sigHash) { + t.Errorf("client offered disallowed signature-and-hash %v", sigHash) + } + } +} + +func TestFIPSCertAlgs(t *testing.T) { + // arm and wasm time out generating keys. Nothing in this test is + // architecture-specific, so just don't bother on those. + if testenv.CPUIsSlow() { + t.Skipf("skipping on %s/%s because key generation takes too long", runtime.GOOS, runtime.GOARCH) + } + + // Set up some roots, intermediate CAs, and leaf certs with various algorithms. + // X_Y is X signed by Y. + R1 := fipsCert(t, "R1", fipsRSAKey(t, 2048), nil, fipsCertCA|fipsCertFIPSOK) + R2 := fipsCert(t, "R2", fipsRSAKey(t, 1024), nil, fipsCertCA) + R3 := fipsCert(t, "R3", fipsRSAKey(t, 4096), nil, fipsCertCA|fipsCertFIPSOK) + + M1_R1 := fipsCert(t, "M1_R1", fipsECDSAKey(t, elliptic.P256()), R1, fipsCertCA|fipsCertFIPSOK) + M2_R1 := fipsCert(t, "M2_R1", fipsECDSAKey(t, elliptic.P224()), R1, fipsCertCA) + + I_R1 := fipsCert(t, "I_R1", fipsRSAKey(t, 3072), R1, fipsCertCA|fipsCertFIPSOK) + I_R2 := fipsCert(t, "I_R2", I_R1.key, R2, fipsCertCA|fipsCertFIPSOK) + I_M1 := fipsCert(t, "I_M1", I_R1.key, M1_R1, fipsCertCA|fipsCertFIPSOK) + I_M2 := fipsCert(t, "I_M2", I_R1.key, M2_R1, fipsCertCA|fipsCertFIPSOK) + + I_R3 := fipsCert(t, "I_R3", fipsRSAKey(t, 3072), R3, fipsCertCA|fipsCertFIPSOK) + fipsCert(t, "I_R3", I_R3.key, R3, fipsCertCA|fipsCertFIPSOK) + + L1_I := fipsCert(t, "L1_I", fipsECDSAKey(t, elliptic.P384()), I_R1, fipsCertLeaf|fipsCertFIPSOK) + L2_I := fipsCert(t, "L2_I", fipsRSAKey(t, 1024), I_R1, fipsCertLeaf) + + // client verifying server cert + testServerCert := func(t *testing.T, desc string, pool *x509.CertPool, key any, list [][]byte, ok bool) { + clientConfig := testConfigFIPS140.Clone() + clientConfig.RootCAs = pool + clientConfig.InsecureSkipVerify = false + clientConfig.ServerName = "example.com" + + serverConfig := testConfigFIPS140.Clone() + serverConfig.Certificates = []Certificate{{Certificate: list, PrivateKey: key}} + serverConfig.BuildNameToCertificate() + + clientErr, _ := fipsHandshake(t, clientConfig, serverConfig) + + if (clientErr == nil) == ok { + if ok { + t.Logf("%s: accept", desc) + } else { + t.Logf("%s: reject", desc) + } + } else { + if ok { + t.Errorf("%s: BAD reject (%v)", desc, clientErr) + } else { + t.Errorf("%s: BAD accept", desc) + } + } + } + + // server verifying client cert + testClientCert := func(t *testing.T, desc string, pool *x509.CertPool, key any, list [][]byte, ok bool) { + clientConfig := testConfigFIPS140.Clone() + clientConfig.ServerName = "example.com" + clientConfig.Certificates = []Certificate{{Certificate: list, PrivateKey: key}} + + serverConfig := testConfigFIPS140.Clone() + serverConfig.ClientCAs = pool + serverConfig.ClientAuth = RequireAndVerifyClientCert + + _, serverErr := fipsHandshake(t, clientConfig, serverConfig) + + if (serverErr == nil) == ok { + if ok { + t.Logf("%s: accept", desc) + } else { + t.Logf("%s: reject", desc) + } + } else { + if ok { + t.Errorf("%s: BAD reject (%v)", desc, serverErr) + } else { + t.Errorf("%s: BAD accept", desc) + } + } + } + + // Run simple basic test with known answers before proceeding to + // exhaustive test with computed answers. + r1pool := x509.NewCertPool() + r1pool.AddCert(R1.cert) + + runWithFIPSDisabled(t, func(t *testing.T) { + testServerCert(t, "basic", r1pool, L2_I.key, [][]byte{L2_I.der, I_R1.der}, true) + testClientCert(t, "basic (client cert)", r1pool, L2_I.key, [][]byte{L2_I.der, I_R1.der}, true) + }) + + runWithFIPSEnabled(t, func(t *testing.T) { + testServerCert(t, "basic (fips)", r1pool, L2_I.key, [][]byte{L2_I.der, I_R1.der}, false) + testClientCert(t, "basic (fips, client cert)", r1pool, L2_I.key, [][]byte{L2_I.der, I_R1.der}, false) + }) + + if t.Failed() { + t.Fatal("basic test failed, skipping exhaustive test") + } + + if testing.Short() { + t.Logf("basic test passed; skipping exhaustive test in -short mode") + return + } + + for l := 1; l <= 2; l++ { + leaf := L1_I + if l == 2 { + leaf = L2_I + } + for i := 0; i < 64; i++ { + reachable := map[string]bool{leaf.parentOrg: true} + reachableFIPS := map[string]bool{leaf.parentOrg: leaf.fipsOK} + list := [][]byte{leaf.der} + listName := leaf.name + addList := func(cond int, c *fipsCertificate) { + if cond != 0 { + list = append(list, c.der) + listName += "," + c.name + if reachable[c.org] { + reachable[c.parentOrg] = true + } + if reachableFIPS[c.org] && c.fipsOK { + reachableFIPS[c.parentOrg] = true + } + } + } + addList(i&1, I_R1) + addList(i&2, I_R2) + addList(i&4, I_M1) + addList(i&8, I_M2) + addList(i&16, M1_R1) + addList(i&32, M2_R1) + + for r := 1; r <= 3; r++ { + pool := x509.NewCertPool() + rootName := "," + shouldVerify := false + shouldVerifyFIPS := false + addRoot := func(cond int, c *fipsCertificate) { + if cond != 0 { + rootName += "," + c.name + pool.AddCert(c.cert) + if reachable[c.org] { + shouldVerify = true + } + if reachableFIPS[c.org] && c.fipsOK { + shouldVerifyFIPS = true + } + } + } + addRoot(r&1, R1) + addRoot(r&2, R2) + rootName = rootName[1:] // strip leading comma + + runWithFIPSDisabled(t, func(t *testing.T) { + testServerCert(t, listName+"->"+rootName[1:], pool, leaf.key, list, shouldVerify) + testClientCert(t, listName+"->"+rootName[1:]+"(client cert)", pool, leaf.key, list, shouldVerify) + }) + + runWithFIPSEnabled(t, func(t *testing.T) { + testServerCert(t, listName+"->"+rootName[1:]+" (fips)", pool, leaf.key, list, shouldVerifyFIPS) + testClientCert(t, listName+"->"+rootName[1:]+" (fips, client cert)", pool, leaf.key, list, shouldVerifyFIPS) + }) + } + } + } +} + +const ( + fipsCertCA = iota + fipsCertLeaf + fipsCertFIPSOK = 0x80 +) + +func fipsRSAKey(t *testing.T, size int) *rsa.PrivateKey { + k, err := rsa.GenerateKey(rand.Reader, size) + if err != nil { + t.Fatal(err) + } + return k +} + +func fipsECDSAKey(t *testing.T, curve elliptic.Curve) *ecdsa.PrivateKey { + k, err := ecdsa.GenerateKey(curve, rand.Reader) + if err != nil { + t.Fatal(err) + } + return k +} + +type fipsCertificate struct { + name string + org string + parentOrg string + der []byte + cert *x509.Certificate + key any + fipsOK bool +} + +func fipsCert(t *testing.T, name string, key any, parent *fipsCertificate, mode int) *fipsCertificate { + org := name + parentOrg := "" + if i := strings.Index(org, "_"); i >= 0 { + org = org[:i] + parentOrg = name[i+1:] + } + tmpl := &x509.Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{ + Organization: []string{org}, + }, + NotBefore: time.Unix(0, 0), + NotAfter: time.Unix(0, 0), + + KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth}, + BasicConstraintsValid: true, + } + if mode&^fipsCertFIPSOK == fipsCertLeaf { + tmpl.DNSNames = []string{"example.com"} + } else { + tmpl.IsCA = true + tmpl.KeyUsage |= x509.KeyUsageCertSign + } + + var pcert *x509.Certificate + var pkey any + if parent != nil { + pcert = parent.cert + pkey = parent.key + } else { + pcert = tmpl + pkey = key + } + + var pub any + var desc string + switch k := key.(type) { + case *rsa.PrivateKey: + pub = &k.PublicKey + desc = fmt.Sprintf("RSA-%d", k.N.BitLen()) + case *ecdsa.PrivateKey: + pub = &k.PublicKey + desc = "ECDSA-" + k.Curve.Params().Name + default: + t.Fatalf("invalid key %T", key) + } + + der, err := x509.CreateCertificate(rand.Reader, tmpl, pcert, pub, pkey) + if err != nil { + t.Fatal(err) + } + cert, err := x509.ParseCertificate(der) + if err != nil { + t.Fatal(err) + } + + fipsOK := mode&fipsCertFIPSOK != 0 + runWithFIPSEnabled(t, func(t *testing.T) { + if isCertificateAllowedFIPS(cert) != fipsOK { + t.Errorf("fipsAllowCert(cert with %s key) = %v, want %v", desc, !fipsOK, fipsOK) + } + }) + + return &fipsCertificate{name, org, parentOrg, der, cert, key, fipsOK} +} + +// A self-signed test certificate with an RSA key of size 2048, for testing +// RSA-PSS with SHA512. SAN of example.golang. +var ( + testRSAPSS2048Certificate []byte + testRSAPSS2048PrivateKey *rsa.PrivateKey +) + +func init() { + block, _ := pem.Decode(obscuretestdata.Rot13([]byte(` +-----ORTVA PREGVSVPNGR----- +ZVVP/mPPNrrtNjVONtVENYUUK/xu4+4mZH9QnemORpDjQDLWXbMVuipANDRYODNj +RwRDZN4TN1HRPuZUDJAgMFOQomNrSj0kZGNkZQRkAGN0ZQInSj0lZQRlZwxkAGN0 +ZQInZOVkRQNBOtAIONbGO0SwoJHtD28jttRvZN0TPFdTFVo3QDRONDHNN4VOQjNj +ttRXNbVONDPs8sx0A6vrPOK4VBIVsXvgg4xTpBDYrvzPsfwddUplfZVITRgSFZ6R +4Nl141s/7VdqJ0HgVdAo4CKuEBVQ7lQkE284kY6KoPhi/g5uC3HpruLp3uzYvlIq +ZxMDvMJgsHHWs/1dBgZ+buAt59YEJc4q+6vK0yn1WY3RjPVpxxAwW9uDoS7Co2PF ++RF9Lb55XNnc8XBoycpE8ZOFA38odajwsDqPKiBRBwnz2UHkXmRSK5ZN+sN0zr4P +vbPpPEYJXy+TbA9S8sNOsbM+G+2rny4QYhB95eKE8FeBVIOu3KSBe/EIuwgKpAIS +MXpiQg6q68I6wNXNLXz5ayw9TCcq4i+eNtZONNTwHQOBZN4TN1HqQjRO/jDRNjVS +bQNGOtAIUFHRQQNXOtteOtRSODpQNGNZOtAIUEZONs8RNwNNZOxTN1HqRDDFZOPP +QzI4LJ1joTHhM29fLJ5aZN0TPFdTFVo3QDROPjHNN4VONDPBbLfIpSPOuobdr3JU +qP6I7KKKRPzawu01e8u80li0AE379aFQ3pj2Z+UXinKlfJdey5uwTIXj0igjQ81e +I4WmQh7VsVbt5z8+DAP+7YdQMfm88iQXBefblFIBzHPtzPXSKrj+YN+rB/vDRWGe +7rafqqBrKWRc27Rq5iJ+xzJJ3Dztyp2Tjl8jSeZQVdaeaBmON4bPaQRtgKWg0mbt +aEjosRZNJv1nDEl5qG9XN3FC9zb5FrGSFmTTUvR4f4tUHr7wifNSS2dtgQ6+jU6f +m9o6fukaP7t5VyOXuV7FIO/Hdg2lqW+xU1LowZpVd6ANZ5rAZXtMhWe3+mjfFtju +TAnR +-----RAQ PREGVSVPNGR-----`))) + testRSAPSS2048Certificate = block.Bytes + + block, _ = pem.Decode(obscuretestdata.Rot13([]byte(` +-----ORTVA EFN CEVINGR XRL----- +ZVVRcNVONNXPNDRNa/U5AQrbattI+PQyFUlbeorWOaQxP3bcta7V6du3ZeQPSEuY +EHwBuBNZgrAK/+lXaIgSYFXwJ+Q14HGvN+8t8HqiBZF+y2jee/7rLG91UUbJUA4M +v4fyKGWTHVzIeK1SPK/9nweGCdVGLBsF0IdrUshby9WJgFF9kZNvUWWQLlsLHTkr +m29txiuRiJXBrFtTdsPwz5nKRsQNHwq/T6c8V30UDy7muQb2cgu1ZFfkOI+GNCaj +AWahNbdNaNxF1vcsudQsEsUjNK6Tsx/gazcrNl7wirn10sRdmvSDLq1kGd/0ILL7 +I3QIEJFaYj7rariSrbjPtTPchM5L/Ew6KrY/djVQNDNONbVONDPAcZMvsq/it42u +UqPiYhMnLF0E7FhaSycbKRfygTqYSfac0VsbWM/htSDOFNVVsYjZhzH6bKN1m7Hi +98nVLI61QrCeGPQIQSOfUoAzC8WNb8JgohfRojq5mlbO7YLT2+pyxWxyJR73XdHd +ezV+HWrlFpy2Tva7MGkOKm1JCOx9IjpajxrnKctNFVOJ23suRPZ9taLRRjnOrm5G +6Zr8q1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2048PrivateKey, err = x509.ParsePKCS1PrivateKey(block.Bytes) + if err != nil { + panic(err) + } +} diff --git a/go/src/crypto/tls/fipsonly/fipsonly.go b/go/src/crypto/tls/fipsonly/fipsonly.go new file mode 100644 index 0000000000000000000000000000000000000000..e702f44e986746b1bd2d72b419c45d933037345c --- /dev/null +++ b/go/src/crypto/tls/fipsonly/fipsonly.go @@ -0,0 +1,29 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build boringcrypto + +// Package fipsonly restricts all TLS configuration to FIPS-approved settings. +// +// The effect is triggered by importing the package anywhere in a program, as in: +// +// import _ "crypto/tls/fipsonly" +// +// This package only exists when using Go compiled with GOEXPERIMENT=boringcrypto. +package fipsonly + +// This functionality is provided as a side effect of an import to make +// it trivial to add to an existing program. It requires only a single line +// added to an existing source file, or it can be done by adding a whole +// new source file and not modifying any existing source files. + +import ( + "crypto/internal/boring/sig" + "crypto/tls/internal/fips140tls" +) + +func init() { + fips140tls.Force() + sig.FIPSOnly() +} diff --git a/go/src/crypto/tls/fipsonly/fipsonly_test.go b/go/src/crypto/tls/fipsonly/fipsonly_test.go new file mode 100644 index 0000000000000000000000000000000000000000..027bc22c33c921fa6da6335f1d23013912315a85 --- /dev/null +++ b/go/src/crypto/tls/fipsonly/fipsonly_test.go @@ -0,0 +1,18 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build boringcrypto + +package fipsonly + +import ( + "crypto/tls/internal/fips140tls" + "testing" +) + +func Test(t *testing.T) { + if !fips140tls.Required() { + t.Fatal("fips140tls.Required() = false, must be true") + } +} diff --git a/go/src/crypto/tls/generate_cert.go b/go/src/crypto/tls/generate_cert.go new file mode 100644 index 0000000000000000000000000000000000000000..cd4bfc513f0f0b5a6a3774fa0600a19f68762bc3 --- /dev/null +++ b/go/src/crypto/tls/generate_cert.go @@ -0,0 +1,171 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build ignore + +// Generate a self-signed X.509 certificate for a TLS server. Outputs to +// 'cert.pem' and 'key.pem' and will overwrite existing files. + +package main + +import ( + "crypto/ecdsa" + "crypto/ed25519" + "crypto/elliptic" + "crypto/rand" + "crypto/rsa" + "crypto/x509" + "crypto/x509/pkix" + "encoding/pem" + "flag" + "log" + "math/big" + "net" + "os" + "strings" + "time" +) + +var ( + host = flag.String("host", "", "Comma-separated hostnames and IPs to generate a certificate for") + validFrom = flag.String("start-date", "", "Creation date formatted as Jan 1 15:04:05 2011") + validFor = flag.Duration("duration", 365*24*time.Hour, "Duration that certificate is valid for") + isCA = flag.Bool("ca", false, "whether this cert should be its own Certificate Authority") + rsaBits = flag.Int("rsa-bits", 2048, "Size of RSA key to generate. Ignored if --ecdsa-curve is set") + ecdsaCurve = flag.String("ecdsa-curve", "", "ECDSA curve to use to generate a key. Valid values are P224, P256 (recommended), P384, P521") + ed25519Key = flag.Bool("ed25519", false, "Generate an Ed25519 key") +) + +func publicKey(priv any) any { + switch k := priv.(type) { + case *rsa.PrivateKey: + return &k.PublicKey + case *ecdsa.PrivateKey: + return &k.PublicKey + case ed25519.PrivateKey: + return k.Public().(ed25519.PublicKey) + default: + return nil + } +} + +func main() { + flag.Parse() + + if len(*host) == 0 { + log.Fatalf("Missing required --host parameter") + } + + var priv any + var err error + switch *ecdsaCurve { + case "": + if *ed25519Key { + _, priv, err = ed25519.GenerateKey(rand.Reader) + } else { + priv, err = rsa.GenerateKey(rand.Reader, *rsaBits) + } + case "P224": + priv, err = ecdsa.GenerateKey(elliptic.P224(), rand.Reader) + case "P256": + priv, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + case "P384": + priv, err = ecdsa.GenerateKey(elliptic.P384(), rand.Reader) + case "P521": + priv, err = ecdsa.GenerateKey(elliptic.P521(), rand.Reader) + default: + log.Fatalf("Unrecognized elliptic curve: %q", *ecdsaCurve) + } + if err != nil { + log.Fatalf("Failed to generate private key: %v", err) + } + + // ECDSA, ED25519 and RSA subject keys should have the DigitalSignature + // KeyUsage bits set in the x509.Certificate template + keyUsage := x509.KeyUsageDigitalSignature + // Only RSA subject keys should have the KeyEncipherment KeyUsage bits set. In + // the context of TLS this KeyUsage is particular to RSA key exchange and + // authentication. + if _, isRSA := priv.(*rsa.PrivateKey); isRSA { + keyUsage |= x509.KeyUsageKeyEncipherment + } + + var notBefore time.Time + if len(*validFrom) == 0 { + notBefore = time.Now() + } else { + notBefore, err = time.Parse("Jan 2 15:04:05 2006", *validFrom) + if err != nil { + log.Fatalf("Failed to parse creation date: %v", err) + } + } + + notAfter := notBefore.Add(*validFor) + + serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) + serialNumber, err := rand.Int(rand.Reader, serialNumberLimit) + if err != nil { + log.Fatalf("Failed to generate serial number: %v", err) + } + + template := x509.Certificate{ + SerialNumber: serialNumber, + Subject: pkix.Name{ + Organization: []string{"Acme Co"}, + }, + NotBefore: notBefore, + NotAfter: notAfter, + + KeyUsage: keyUsage, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, + BasicConstraintsValid: true, + } + + hosts := strings.Split(*host, ",") + for _, h := range hosts { + if ip := net.ParseIP(h); ip != nil { + template.IPAddresses = append(template.IPAddresses, ip) + } else { + template.DNSNames = append(template.DNSNames, h) + } + } + + if *isCA { + template.IsCA = true + template.KeyUsage |= x509.KeyUsageCertSign + } + + derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, publicKey(priv), priv) + if err != nil { + log.Fatalf("Failed to create certificate: %v", err) + } + + certOut, err := os.Create("cert.pem") + if err != nil { + log.Fatalf("Failed to open cert.pem for writing: %v", err) + } + if err := pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}); err != nil { + log.Fatalf("Failed to write data to cert.pem: %v", err) + } + if err := certOut.Close(); err != nil { + log.Fatalf("Error closing cert.pem: %v", err) + } + log.Print("wrote cert.pem\n") + + keyOut, err := os.OpenFile("key.pem", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) + if err != nil { + log.Fatalf("Failed to open key.pem for writing: %v", err) + } + privBytes, err := x509.MarshalPKCS8PrivateKey(priv) + if err != nil { + log.Fatalf("Unable to marshal private key: %v", err) + } + if err := pem.Encode(keyOut, &pem.Block{Type: "PRIVATE KEY", Bytes: privBytes}); err != nil { + log.Fatalf("Failed to write data to key.pem: %v", err) + } + if err := keyOut.Close(); err != nil { + log.Fatalf("Error closing key.pem: %v", err) + } + log.Print("wrote key.pem\n") +} diff --git a/go/src/crypto/tls/handshake_client.go b/go/src/crypto/tls/handshake_client.go new file mode 100644 index 0000000000000000000000000000000000000000..7d4bd5bcceba4f288599baf6e10874df0357aa17 --- /dev/null +++ b/go/src/crypto/tls/handshake_client.go @@ -0,0 +1,1320 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "bytes" + "context" + "crypto" + "crypto/ecdsa" + "crypto/ed25519" + "crypto/hpke" + "crypto/internal/fips140/tls13" + "crypto/rsa" + "crypto/subtle" + "crypto/tls/internal/fips140tls" + "crypto/x509" + "errors" + "fmt" + "hash" + "internal/godebug" + "io" + "net" + "slices" + "strconv" + "strings" + "time" +) + +type clientHandshakeState struct { + c *Conn + ctx context.Context + serverHello *serverHelloMsg + hello *clientHelloMsg + suite *cipherSuite + finishedHash finishedHash + masterSecret []byte + session *SessionState // the session being resumed + ticket []byte // a fresh ticket received during this handshake +} + +func (c *Conn) makeClientHello() (*clientHelloMsg, *keySharePrivateKeys, *echClientContext, error) { + config := c.config + if len(config.ServerName) == 0 && !config.InsecureSkipVerify { + return nil, nil, nil, errors.New("tls: either ServerName or InsecureSkipVerify must be specified in the tls.Config") + } + + nextProtosLength := 0 + for _, proto := range config.NextProtos { + if l := len(proto); l == 0 || l > 255 { + return nil, nil, nil, errors.New("tls: invalid NextProtos value") + } else { + nextProtosLength += 1 + l + } + } + if nextProtosLength > 0xffff { + return nil, nil, nil, errors.New("tls: NextProtos values too large") + } + + supportedVersions := config.supportedVersions(roleClient) + if len(supportedVersions) == 0 { + return nil, nil, nil, errors.New("tls: no supported versions satisfy MinVersion and MaxVersion") + } + // Since supportedVersions is sorted in descending order, the first element + // is the maximum version and the last element is the minimum version. + maxVersion := supportedVersions[0] + minVersion := supportedVersions[len(supportedVersions)-1] + + hello := &clientHelloMsg{ + vers: maxVersion, + compressionMethods: []uint8{compressionNone}, + random: make([]byte, 32), + extendedMasterSecret: true, + ocspStapling: true, + scts: true, + serverName: hostnameInSNI(config.ServerName), + supportedCurves: config.curvePreferences(maxVersion), + supportedPoints: []uint8{pointFormatUncompressed}, + secureRenegotiationSupported: true, + alpnProtocols: config.NextProtos, + supportedVersions: supportedVersions, + } + + // The version at the beginning of the ClientHello was capped at TLS 1.2 + // for compatibility reasons. The supported_versions extension is used + // to negotiate versions now. See RFC 8446, Section 4.2.1. + if hello.vers > VersionTLS12 { + hello.vers = VersionTLS12 + } + + if c.handshakes > 0 { + hello.secureRenegotiation = c.clientFinished[:] + } + + hello.cipherSuites = config.cipherSuites(hasAESGCMHardwareSupport) + // Don't advertise TLS 1.2-only cipher suites unless we're attempting TLS 1.2. + if maxVersion < VersionTLS12 { + hello.cipherSuites = slices.DeleteFunc(hello.cipherSuites, func(id uint16) bool { + return cipherSuiteByID(id).flags&suiteTLS12 != 0 + }) + } + + _, err := io.ReadFull(config.rand(), hello.random) + if err != nil { + return nil, nil, nil, errors.New("tls: short read from Rand: " + err.Error()) + } + + // A random session ID is used to detect when the server accepted a ticket + // and is resuming a session (see RFC 5077). In TLS 1.3, it's always set as + // a compatibility measure (see RFC 8446, Section 4.1.2). + // + // The session ID is not set for QUIC connections (see RFC 9001, Section 8.4). + if c.quic == nil { + hello.sessionId = make([]byte, 32) + if _, err := io.ReadFull(config.rand(), hello.sessionId); err != nil { + return nil, nil, nil, errors.New("tls: short read from Rand: " + err.Error()) + } + } + + if maxVersion >= VersionTLS12 { + hello.supportedSignatureAlgorithms = supportedSignatureAlgorithms(minVersion) + hello.supportedSignatureAlgorithmsCert = supportedSignatureAlgorithmsCert() + } + + var keyShareKeys *keySharePrivateKeys + if maxVersion >= VersionTLS13 { + // Reset the list of ciphers when the client only supports TLS 1.3. + if minVersion >= VersionTLS13 { + hello.cipherSuites = nil + } + + if fips140tls.Required() { + hello.cipherSuites = append(hello.cipherSuites, allowedCipherSuitesTLS13FIPS...) + } else if hasAESGCMHardwareSupport { + hello.cipherSuites = append(hello.cipherSuites, defaultCipherSuitesTLS13...) + } else { + hello.cipherSuites = append(hello.cipherSuites, defaultCipherSuitesTLS13NoAES...) + } + + if len(hello.supportedCurves) == 0 { + return nil, nil, nil, errors.New("tls: no supported elliptic curves for ECDHE") + } + // Since the order is fixed, the first one is always the one to send a + // key share for. All the PQ hybrids sort first, and produce a fallback + // ECDH share. + curveID := hello.supportedCurves[0] + ke, err := keyExchangeForCurveID(curveID) + if err != nil { + return nil, nil, nil, errors.New("tls: CurvePreferences includes unsupported curve") + } + keyShareKeys, hello.keyShares, err = ke.keyShares(config.rand()) + if err != nil { + return nil, nil, nil, err + } + // Only send the fallback ECDH share if the corresponding CurveID is enabled. + if len(hello.keyShares) == 2 && !slices.Contains(hello.supportedCurves, hello.keyShares[1].group) { + hello.keyShares = hello.keyShares[:1] + } + } + + if c.quic != nil { + p, err := c.quicGetTransportParameters() + if err != nil { + return nil, nil, nil, err + } + if p == nil { + p = []byte{} + } + hello.quicTransportParameters = p + } + + var ech *echClientContext + if c.config.EncryptedClientHelloConfigList != nil { + if c.config.MinVersion != 0 && c.config.MinVersion < VersionTLS13 { + return nil, nil, nil, errors.New("tls: MinVersion must be >= VersionTLS13 if EncryptedClientHelloConfigList is populated") + } + if c.config.MaxVersion != 0 && c.config.MaxVersion <= VersionTLS12 { + return nil, nil, nil, errors.New("tls: MaxVersion must be >= VersionTLS13 if EncryptedClientHelloConfigList is populated") + } + echConfigs, err := parseECHConfigList(c.config.EncryptedClientHelloConfigList) + if err != nil { + return nil, nil, nil, err + } + echConfig, echPK, kdf, aead := pickECHConfig(echConfigs) + if echConfig == nil { + return nil, nil, nil, errors.New("tls: EncryptedClientHelloConfigList contains no valid configs") + } + ech = &echClientContext{config: echConfig, kdfID: kdf.ID(), aeadID: aead.ID()} + hello.encryptedClientHello = []byte{1} // indicate inner hello + // We need to explicitly set these 1.2 fields to nil, as we do not + // marshal them when encoding the inner hello, otherwise transcripts + // will later mismatch. + hello.supportedPoints = nil + hello.ticketSupported = false + hello.secureRenegotiationSupported = false + hello.extendedMasterSecret = false + + info := append([]byte("tls ech\x00"), ech.config.raw...) + ech.encapsulatedKey, ech.hpkeContext, err = hpke.NewSender(echPK, kdf, aead, info) + if err != nil { + return nil, nil, nil, err + } + } + + return hello, keyShareKeys, ech, nil +} + +type echClientContext struct { + config *echConfig + hpkeContext *hpke.Sender + encapsulatedKey []byte + innerHello *clientHelloMsg + innerTranscript hash.Hash + kdfID uint16 + aeadID uint16 + echRejected bool + retryConfigs []byte +} + +func (c *Conn) clientHandshake(ctx context.Context) (err error) { + if c.config == nil { + c.config = defaultConfig() + } + + // This may be a renegotiation handshake, in which case some fields + // need to be reset. + c.didResume = false + c.curveID = 0 + + hello, keyShareKeys, ech, err := c.makeClientHello() + if err != nil { + return err + } + + session, earlySecret, binderKey, err := c.loadSession(hello) + if err != nil { + return err + } + if session != nil { + defer func() { + // If we got a handshake failure when resuming a session, throw away + // the session ticket. See RFC 5077, Section 3.2. + // + // RFC 8446 makes no mention of dropping tickets on failure, but it + // does require servers to abort on invalid binders, so we need to + // delete tickets to recover from a corrupted PSK. + if err != nil { + if cacheKey := c.clientSessionCacheKey(); cacheKey != "" { + c.config.ClientSessionCache.Put(cacheKey, nil) + } + } + }() + } + + if ech != nil { + // Split hello into inner and outer + ech.innerHello = hello.clone() + + // Overwrite the server name in the outer hello with the public facing + // name. + hello.serverName = string(ech.config.PublicName) + // Generate a new random for the outer hello. + hello.random = make([]byte, 32) + _, err = io.ReadFull(c.config.rand(), hello.random) + if err != nil { + return errors.New("tls: short read from Rand: " + err.Error()) + } + + // NOTE: we don't do PSK GREASE, in line with boringssl, it's meant to + // work around _possibly_ broken middleboxes, but there is little-to-no + // evidence that this is actually a problem. + + if err := computeAndUpdateOuterECHExtension(hello, ech.innerHello, ech, true); err != nil { + return err + } + } + + c.serverName = hello.serverName + + if _, err := c.writeHandshakeRecord(hello, nil); err != nil { + return err + } + + if hello.earlyData { + suite := cipherSuiteTLS13ByID(session.cipherSuite) + transcript := suite.hash.New() + transcriptHello := hello + if ech != nil { + transcriptHello = ech.innerHello + } + if err := transcriptMsg(transcriptHello, transcript); err != nil { + return err + } + earlyTrafficSecret := earlySecret.ClientEarlyTrafficSecret(transcript) + c.quicSetWriteSecret(QUICEncryptionLevelEarly, suite.id, earlyTrafficSecret) + } + + // serverHelloMsg is not included in the transcript + msg, err := c.readHandshake(nil) + if err != nil { + return err + } + + serverHello, ok := msg.(*serverHelloMsg) + if !ok { + c.sendAlert(alertUnexpectedMessage) + return unexpectedMessageError(serverHello, msg) + } + + if err := c.pickTLSVersion(serverHello); err != nil { + return err + } + + // If we are negotiating a protocol version that's lower than what we + // support, check for the server downgrade canaries. + // See RFC 8446, Section 4.1.3. + maxVers := c.config.maxSupportedVersion(roleClient) + tls12Downgrade := string(serverHello.random[24:]) == downgradeCanaryTLS12 + tls11Downgrade := string(serverHello.random[24:]) == downgradeCanaryTLS11 + if maxVers == VersionTLS13 && c.vers <= VersionTLS12 && (tls12Downgrade || tls11Downgrade) || + maxVers == VersionTLS12 && c.vers <= VersionTLS11 && tls11Downgrade { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: downgrade attempt detected, possibly due to a MitM attack or a broken middlebox") + } + + if c.vers == VersionTLS13 { + hs := &clientHandshakeStateTLS13{ + c: c, + ctx: ctx, + serverHello: serverHello, + hello: hello, + keyShareKeys: keyShareKeys, + session: session, + earlySecret: earlySecret, + binderKey: binderKey, + echContext: ech, + } + return hs.handshake() + } + + hs := &clientHandshakeState{ + c: c, + ctx: ctx, + serverHello: serverHello, + hello: hello, + session: session, + } + return hs.handshake() +} + +func (c *Conn) loadSession(hello *clientHelloMsg) ( + session *SessionState, earlySecret *tls13.EarlySecret, binderKey []byte, err error) { + if c.config.SessionTicketsDisabled || c.config.ClientSessionCache == nil { + return nil, nil, nil, nil + } + + echInner := bytes.Equal(hello.encryptedClientHello, []byte{1}) + + // ticketSupported is a TLS 1.2 extension (as TLS 1.3 replaced tickets with PSK + // identities) and ECH requires and forces TLS 1.3. + hello.ticketSupported = true && !echInner + + if hello.supportedVersions[0] == VersionTLS13 { + // Require DHE on resumption as it guarantees forward secrecy against + // compromise of the session ticket key. See RFC 8446, Section 4.2.9. + hello.pskModes = []uint8{pskModeDHE} + } + + // Session resumption is not allowed if renegotiating because + // renegotiation is primarily used to allow a client to send a client + // certificate, which would be skipped if session resumption occurred. + if c.handshakes != 0 { + return nil, nil, nil, nil + } + + // Try to resume a previously negotiated TLS session, if available. + cacheKey := c.clientSessionCacheKey() + if cacheKey == "" { + return nil, nil, nil, nil + } + cs, ok := c.config.ClientSessionCache.Get(cacheKey) + if !ok || cs == nil { + return nil, nil, nil, nil + } + session = cs.session + + // Check that version used for the previous session is still valid. + versOk := false + for _, v := range hello.supportedVersions { + if v == session.version { + versOk = true + break + } + } + if !versOk { + return nil, nil, nil, nil + } + + if c.config.time().After(session.peerCertificates[0].NotAfter) { + // Expired certificate, delete the entry. + c.config.ClientSessionCache.Put(cacheKey, nil) + return nil, nil, nil, nil + } + if !c.config.InsecureSkipVerify { + if len(session.verifiedChains) == 0 { + // The original connection had InsecureSkipVerify, while this doesn't. + return nil, nil, nil, nil + } + if err := session.peerCertificates[0].VerifyHostname(c.config.ServerName); err != nil { + // This should be ensured by the cache key, but protect the + // application from a faulty ClientSessionCache implementation. + return nil, nil, nil, nil + } + opts := x509.VerifyOptions{ + CurrentTime: c.config.time(), + Roots: c.config.RootCAs, + KeyUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, + } + if !anyValidVerifiedChain(session.verifiedChains, opts) { + // No valid chains, delete the entry. + c.config.ClientSessionCache.Put(cacheKey, nil) + return nil, nil, nil, nil + } + } + + if session.version != VersionTLS13 { + // In TLS 1.2 the cipher suite must match the resumed session. Ensure we + // are still offering it. + if mutualCipherSuite(hello.cipherSuites, session.cipherSuite) == nil { + return nil, nil, nil, nil + } + + // FIPS 140-3 requires the use of Extended Master Secret. + if !session.extMasterSecret && fips140tls.Required() { + return nil, nil, nil, nil + } + + hello.sessionTicket = session.ticket + return + } + + // Check that the session ticket is not expired. + if c.config.time().After(time.Unix(int64(session.useBy), 0)) { + c.config.ClientSessionCache.Put(cacheKey, nil) + return nil, nil, nil, nil + } + + // In TLS 1.3 the KDF hash must match the resumed session. Ensure we + // offer at least one cipher suite with that hash. + cipherSuite := cipherSuiteTLS13ByID(session.cipherSuite) + if cipherSuite == nil { + return nil, nil, nil, nil + } + cipherSuiteOk := false + for _, offeredID := range hello.cipherSuites { + offeredSuite := cipherSuiteTLS13ByID(offeredID) + if offeredSuite != nil && offeredSuite.hash == cipherSuite.hash { + cipherSuiteOk = true + break + } + } + if !cipherSuiteOk { + return nil, nil, nil, nil + } + + if c.quic != nil { + if c.quic.enableSessionEvents { + c.quicResumeSession(session) + } + + // For 0-RTT, the cipher suite has to match exactly, and we need to be + // offering the same ALPN. + if session.EarlyData && mutualCipherSuiteTLS13(hello.cipherSuites, session.cipherSuite) != nil { + for _, alpn := range hello.alpnProtocols { + if alpn == session.alpnProtocol { + hello.earlyData = true + break + } + } + } + } + + // Set the pre_shared_key extension. See RFC 8446, Section 4.2.11.1. + ticketAge := c.config.time().Sub(time.Unix(int64(session.createdAt), 0)) + identity := pskIdentity{ + label: session.ticket, + obfuscatedTicketAge: uint32(ticketAge/time.Millisecond) + session.ageAdd, + } + hello.pskIdentities = []pskIdentity{identity} + hello.pskBinders = [][]byte{make([]byte, cipherSuite.hash.Size())} + + // Compute the PSK binders. See RFC 8446, Section 4.2.11.2. + earlySecret = tls13.NewEarlySecret(cipherSuite.hash.New, session.secret) + binderKey = earlySecret.ResumptionBinderKey() + transcript := cipherSuite.hash.New() + if err := computeAndUpdatePSK(hello, binderKey, transcript, cipherSuite.finishedHash); err != nil { + return nil, nil, nil, err + } + + return +} + +func (c *Conn) pickTLSVersion(serverHello *serverHelloMsg) error { + peerVersion := serverHello.vers + if serverHello.supportedVersion != 0 { + peerVersion = serverHello.supportedVersion + } + + vers, ok := c.config.mutualVersion(roleClient, []uint16{peerVersion}) + if !ok { + c.sendAlert(alertProtocolVersion) + return fmt.Errorf("tls: server selected unsupported protocol version %x", peerVersion) + } + + c.vers = vers + c.haveVers = true + c.in.version = vers + c.out.version = vers + + return nil +} + +// Does the handshake, either a full one or resumes old session. Requires hs.c, +// hs.hello, hs.serverHello, and, optionally, hs.session to be set. +func (hs *clientHandshakeState) handshake() error { + c := hs.c + + // If we did not load a session (hs.session == nil), but we did set a + // session ID in the transmitted client hello (hs.hello.sessionId != nil), + // it means we tried to negotiate TLS 1.3 and sent a random session ID as a + // compatibility measure (see RFC 8446, Section 4.1.2). + // + // Since we're now handshaking for TLS 1.2, if the server echoed the + // transmitted ID back to us, we know mischief is afoot: the session ID + // was random and can't possibly be recognized by the server. + if hs.session == nil && hs.hello.sessionId != nil && bytes.Equal(hs.hello.sessionId, hs.serverHello.sessionId) { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: server echoed TLS 1.3 compatibility session ID in TLS 1.2") + } + + isResume, err := hs.processServerHello() + if err != nil { + return err + } + + hs.finishedHash = newFinishedHash(c.vers, hs.suite) + + // No signatures of the handshake are needed in a resumption. + // Otherwise, in a full handshake, if we don't have any certificates + // configured then we will never send a CertificateVerify message and + // thus no signatures are needed in that case either. + if isResume || (len(c.config.Certificates) == 0 && c.config.GetClientCertificate == nil) { + hs.finishedHash.discardHandshakeBuffer() + } + + if err := transcriptMsg(hs.hello, &hs.finishedHash); err != nil { + return err + } + if err := transcriptMsg(hs.serverHello, &hs.finishedHash); err != nil { + return err + } + + c.buffering = true + c.didResume = isResume + if isResume { + if err := hs.establishKeys(); err != nil { + return err + } + if err := hs.readSessionTicket(); err != nil { + return err + } + if err := hs.readFinished(c.serverFinished[:]); err != nil { + return err + } + c.clientFinishedIsFirst = false + // Make sure the connection is still being verified whether or not this + // is a resumption. Resumptions currently don't reverify certificates so + // they don't call verifyServerCertificate. See Issue 31641. + if c.config.VerifyConnection != nil { + if err := c.config.VerifyConnection(c.connectionStateLocked()); err != nil { + c.sendAlert(alertBadCertificate) + return err + } + } + if err := hs.sendFinished(c.clientFinished[:]); err != nil { + return err + } + if _, err := c.flush(); err != nil { + return err + } + } else { + if err := hs.doFullHandshake(); err != nil { + return err + } + if err := hs.establishKeys(); err != nil { + return err + } + if err := hs.sendFinished(c.clientFinished[:]); err != nil { + return err + } + if _, err := c.flush(); err != nil { + return err + } + c.clientFinishedIsFirst = true + if err := hs.readSessionTicket(); err != nil { + return err + } + if err := hs.readFinished(c.serverFinished[:]); err != nil { + return err + } + } + if err := hs.saveSessionTicket(); err != nil { + return err + } + + c.ekm = ekmFromMasterSecret(c.vers, hs.suite, hs.masterSecret, hs.hello.random, hs.serverHello.random) + c.isHandshakeComplete.Store(true) + + return nil +} + +func (hs *clientHandshakeState) pickCipherSuite() error { + if hs.suite = mutualCipherSuite(hs.hello.cipherSuites, hs.serverHello.cipherSuite); hs.suite == nil { + hs.c.sendAlert(alertHandshakeFailure) + return errors.New("tls: server chose an unconfigured cipher suite") + } + + if hs.c.config.CipherSuites == nil && !fips140tls.Required() && rsaKexCiphers[hs.suite.id] { + tlsrsakex.Value() // ensure godebug is initialized + tlsrsakex.IncNonDefault() + } + if hs.c.config.CipherSuites == nil && !fips140tls.Required() && tdesCiphers[hs.suite.id] { + tls3des.Value() // ensure godebug is initialized + tls3des.IncNonDefault() + } + + hs.c.cipherSuite = hs.suite.id + return nil +} + +func (hs *clientHandshakeState) doFullHandshake() error { + c := hs.c + + msg, err := c.readHandshake(&hs.finishedHash) + if err != nil { + return err + } + certMsg, ok := msg.(*certificateMsg) + if !ok || len(certMsg.certificates) == 0 { + c.sendAlert(alertUnexpectedMessage) + return unexpectedMessageError(certMsg, msg) + } + + msg, err = c.readHandshake(&hs.finishedHash) + if err != nil { + return err + } + + cs, ok := msg.(*certificateStatusMsg) + if ok { + // RFC4366 on Certificate Status Request: + // The server MAY return a "certificate_status" message. + + if !hs.serverHello.ocspStapling { + // If a server returns a "CertificateStatus" message, then the + // server MUST have included an extension of type "status_request" + // with empty "extension_data" in the extended server hello. + + c.sendAlert(alertUnexpectedMessage) + return errors.New("tls: received unexpected CertificateStatus message") + } + + c.ocspResponse = cs.response + + msg, err = c.readHandshake(&hs.finishedHash) + if err != nil { + return err + } + } + + if c.handshakes == 0 { + // If this is the first handshake on a connection, process and + // (optionally) verify the server's certificates. + if err := c.verifyServerCertificate(certMsg.certificates); err != nil { + return err + } + } else { + // This is a renegotiation handshake. We require that the + // server's identity (i.e. leaf certificate) is unchanged and + // thus any previous trust decision is still valid. + // + // See https://mitls.org/pages/attacks/3SHAKE for the + // motivation behind this requirement. + if !bytes.Equal(c.peerCertificates[0].Raw, certMsg.certificates[0]) { + c.sendAlert(alertBadCertificate) + return errors.New("tls: server's identity changed during renegotiation") + } + } + + keyAgreement := hs.suite.ka(c.vers) + + skx, ok := msg.(*serverKeyExchangeMsg) + if ok { + err = keyAgreement.processServerKeyExchange(c.config, hs.hello, hs.serverHello, c.peerCertificates[0], skx) + if err != nil { + c.sendAlert(alertIllegalParameter) + return err + } + if keyAgreement, ok := keyAgreement.(*ecdheKeyAgreement); ok { + c.curveID = keyAgreement.curveID + c.peerSigAlg = keyAgreement.signatureAlgorithm + } + + msg, err = c.readHandshake(&hs.finishedHash) + if err != nil { + return err + } + } + + var chainToSend *Certificate + var certRequested bool + certReq, ok := msg.(*certificateRequestMsg) + if ok { + certRequested = true + + cri := certificateRequestInfoFromMsg(hs.ctx, c.vers, certReq) + if chainToSend, err = c.getClientCertificate(cri); err != nil { + c.sendAlert(alertInternalError) + return err + } + + msg, err = c.readHandshake(&hs.finishedHash) + if err != nil { + return err + } + } + + shd, ok := msg.(*serverHelloDoneMsg) + if !ok { + c.sendAlert(alertUnexpectedMessage) + return unexpectedMessageError(shd, msg) + } + + // If the server requested a certificate then we have to send a + // Certificate message, even if it's empty because we don't have a + // certificate to send. + if certRequested { + certMsg = new(certificateMsg) + certMsg.certificates = chainToSend.Certificate + if _, err := hs.c.writeHandshakeRecord(certMsg, &hs.finishedHash); err != nil { + return err + } + } + + preMasterSecret, ckx, err := keyAgreement.generateClientKeyExchange(c.config, hs.hello, c.peerCertificates[0]) + if err != nil { + c.sendAlert(alertInternalError) + return err + } + if ckx != nil { + if _, err := hs.c.writeHandshakeRecord(ckx, &hs.finishedHash); err != nil { + return err + } + } + + if hs.serverHello.extendedMasterSecret { + c.extMasterSecret = true + hs.masterSecret = extMasterFromPreMasterSecret(c.vers, hs.suite, preMasterSecret, + hs.finishedHash.Sum()) + } else { + if fips140tls.Required() { + c.sendAlert(alertHandshakeFailure) + return errors.New("tls: FIPS 140-3 requires the use of Extended Master Secret") + } + hs.masterSecret = masterFromPreMasterSecret(c.vers, hs.suite, preMasterSecret, + hs.hello.random, hs.serverHello.random) + } + if err := c.config.writeKeyLog(keyLogLabelTLS12, hs.hello.random, hs.masterSecret); err != nil { + c.sendAlert(alertInternalError) + return errors.New("tls: failed to write to key log: " + err.Error()) + } + + if chainToSend != nil && len(chainToSend.Certificate) > 0 { + certVerify := &certificateVerifyMsg{} + + key, ok := chainToSend.PrivateKey.(crypto.Signer) + if !ok { + c.sendAlert(alertInternalError) + return fmt.Errorf("tls: client certificate private key of type %T does not implement crypto.Signer", chainToSend.PrivateKey) + } + + if c.vers >= VersionTLS12 { + signatureAlgorithm, err := selectSignatureScheme(c.vers, chainToSend, certReq.supportedSignatureAlgorithms) + if err != nil { + c.sendAlert(alertHandshakeFailure) + return err + } + sigType, sigHash, err := typeAndHashFromSignatureScheme(signatureAlgorithm) + if err != nil { + return c.sendAlert(alertInternalError) + } + certVerify.hasSignatureAlgorithm = true + certVerify.signatureAlgorithm = signatureAlgorithm + if sigHash == crypto.SHA1 { + tlssha1.Value() // ensure godebug is initialized + tlssha1.IncNonDefault() + } + if hs.finishedHash.buffer == nil { + c.sendAlert(alertInternalError) + return errors.New("tls: internal error: did not keep handshake transcript for TLS 1.2") + } + signOpts := crypto.SignerOpts(sigHash) + if sigType == signatureRSAPSS { + signOpts = &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash, Hash: sigHash} + } + certVerify.signature, err = crypto.SignMessage(key, c.config.rand(), hs.finishedHash.buffer, signOpts) + if err != nil { + c.sendAlert(alertInternalError) + return err + } + } else { + sigType, sigHash, err := legacyTypeAndHashFromPublicKey(key.Public()) + if err != nil { + c.sendAlert(alertIllegalParameter) + return err + } + signed := hs.finishedHash.hashForClientCertificate(sigType) + certVerify.signature, err = key.Sign(c.config.rand(), signed, sigHash) + if err != nil { + c.sendAlert(alertInternalError) + return err + } + } + + if _, err := hs.c.writeHandshakeRecord(certVerify, &hs.finishedHash); err != nil { + return err + } + } + + hs.finishedHash.discardHandshakeBuffer() + + return nil +} + +func (hs *clientHandshakeState) establishKeys() error { + c := hs.c + + clientMAC, serverMAC, clientKey, serverKey, clientIV, serverIV := + keysFromMasterSecret(c.vers, hs.suite, hs.masterSecret, hs.hello.random, hs.serverHello.random, hs.suite.macLen, hs.suite.keyLen, hs.suite.ivLen) + var clientCipher, serverCipher any + var clientHash, serverHash hash.Hash + if hs.suite.cipher != nil { + clientCipher = hs.suite.cipher(clientKey, clientIV, false /* not for reading */) + clientHash = hs.suite.mac(clientMAC) + serverCipher = hs.suite.cipher(serverKey, serverIV, true /* for reading */) + serverHash = hs.suite.mac(serverMAC) + } else { + clientCipher = hs.suite.aead(clientKey, clientIV) + serverCipher = hs.suite.aead(serverKey, serverIV) + } + + c.in.prepareCipherSpec(c.vers, serverCipher, serverHash) + c.out.prepareCipherSpec(c.vers, clientCipher, clientHash) + return nil +} + +func (hs *clientHandshakeState) serverResumedSession() bool { + // If the server responded with the same sessionId then it means the + // sessionTicket is being used to resume a TLS session. + return hs.session != nil && hs.hello.sessionId != nil && + bytes.Equal(hs.serverHello.sessionId, hs.hello.sessionId) +} + +func (hs *clientHandshakeState) processServerHello() (bool, error) { + c := hs.c + + if err := hs.pickCipherSuite(); err != nil { + return false, err + } + + if hs.serverHello.compressionMethod != compressionNone { + c.sendAlert(alertIllegalParameter) + return false, errors.New("tls: server selected unsupported compression format") + } + + supportsPointFormat := false + offeredNonCompressedFormat := false + for _, format := range hs.serverHello.supportedPoints { + if format == pointFormatUncompressed { + supportsPointFormat = true + } else { + offeredNonCompressedFormat = true + } + } + if !supportsPointFormat && offeredNonCompressedFormat { + return false, errors.New("tls: server offered only incompatible point formats") + } + + if c.handshakes == 0 && hs.serverHello.secureRenegotiationSupported { + c.secureRenegotiation = true + if len(hs.serverHello.secureRenegotiation) != 0 { + c.sendAlert(alertHandshakeFailure) + return false, errors.New("tls: initial handshake had non-empty renegotiation extension") + } + } + + if c.handshakes > 0 && c.secureRenegotiation { + var expectedSecureRenegotiation [24]byte + copy(expectedSecureRenegotiation[:], c.clientFinished[:]) + copy(expectedSecureRenegotiation[12:], c.serverFinished[:]) + if !bytes.Equal(hs.serverHello.secureRenegotiation, expectedSecureRenegotiation[:]) { + c.sendAlert(alertHandshakeFailure) + return false, errors.New("tls: incorrect renegotiation extension contents") + } + } + + if err := checkALPN(hs.hello.alpnProtocols, hs.serverHello.alpnProtocol, false); err != nil { + c.sendAlert(alertUnsupportedExtension) + return false, err + } + c.clientProtocol = hs.serverHello.alpnProtocol + + c.scts = hs.serverHello.scts + + if !hs.serverResumedSession() { + return false, nil + } + + if hs.session.version != c.vers { + c.sendAlert(alertHandshakeFailure) + return false, errors.New("tls: server resumed a session with a different version") + } + + if hs.session.cipherSuite != hs.suite.id { + c.sendAlert(alertHandshakeFailure) + return false, errors.New("tls: server resumed a session with a different cipher suite") + } + + // RFC 7627, Section 5.3 + if hs.session.extMasterSecret != hs.serverHello.extendedMasterSecret { + c.sendAlert(alertHandshakeFailure) + return false, errors.New("tls: server resumed a session with a different EMS extension") + } + + // Restore master secret and certificates from previous state + hs.masterSecret = hs.session.secret + c.extMasterSecret = hs.session.extMasterSecret + c.peerCertificates = hs.session.peerCertificates + c.verifiedChains = hs.session.verifiedChains + c.ocspResponse = hs.session.ocspResponse + // Let the ServerHello SCTs override the session SCTs from the original + // connection, if any are provided. + if len(c.scts) == 0 && len(hs.session.scts) != 0 { + c.scts = hs.session.scts + } + c.curveID = hs.session.curveID + + return true, nil +} + +// checkALPN ensure that the server's choice of ALPN protocol is compatible with +// the protocols that we advertised in the ClientHello. +func checkALPN(clientProtos []string, serverProto string, quic bool) error { + if serverProto == "" { + if quic && len(clientProtos) > 0 { + // RFC 9001, Section 8.1 + return errors.New("tls: server did not select an ALPN protocol") + } + return nil + } + if len(clientProtos) == 0 { + return errors.New("tls: server advertised unrequested ALPN extension") + } + for _, proto := range clientProtos { + if proto == serverProto { + return nil + } + } + return errors.New("tls: server selected unadvertised ALPN protocol") +} + +func (hs *clientHandshakeState) readFinished(out []byte) error { + c := hs.c + + if err := c.readChangeCipherSpec(); err != nil { + return err + } + + // finishedMsg is included in the transcript, but not until after we + // check the client version, since the state before this message was + // sent is used during verification. + msg, err := c.readHandshake(nil) + if err != nil { + return err + } + serverFinished, ok := msg.(*finishedMsg) + if !ok { + c.sendAlert(alertUnexpectedMessage) + return unexpectedMessageError(serverFinished, msg) + } + + verify := hs.finishedHash.serverSum(hs.masterSecret) + if len(verify) != len(serverFinished.verifyData) || + subtle.ConstantTimeCompare(verify, serverFinished.verifyData) != 1 { + c.sendAlert(alertHandshakeFailure) + return errors.New("tls: server's Finished message was incorrect") + } + + if err := transcriptMsg(serverFinished, &hs.finishedHash); err != nil { + return err + } + + copy(out, verify) + return nil +} + +func (hs *clientHandshakeState) readSessionTicket() error { + if !hs.serverHello.ticketSupported { + return nil + } + c := hs.c + + if !hs.hello.ticketSupported { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: server sent unrequested session ticket") + } + + msg, err := c.readHandshake(&hs.finishedHash) + if err != nil { + return err + } + sessionTicketMsg, ok := msg.(*newSessionTicketMsg) + if !ok { + c.sendAlert(alertUnexpectedMessage) + return unexpectedMessageError(sessionTicketMsg, msg) + } + + hs.ticket = sessionTicketMsg.ticket + return nil +} + +func (hs *clientHandshakeState) saveSessionTicket() error { + if hs.ticket == nil { + return nil + } + c := hs.c + + cacheKey := c.clientSessionCacheKey() + if cacheKey == "" { + return nil + } + + session := c.sessionState() + session.secret = hs.masterSecret + session.ticket = hs.ticket + + cs := &ClientSessionState{session: session} + c.config.ClientSessionCache.Put(cacheKey, cs) + return nil +} + +func (hs *clientHandshakeState) sendFinished(out []byte) error { + c := hs.c + + if err := c.writeChangeCipherRecord(); err != nil { + return err + } + + finished := new(finishedMsg) + finished.verifyData = hs.finishedHash.clientSum(hs.masterSecret) + if _, err := hs.c.writeHandshakeRecord(finished, &hs.finishedHash); err != nil { + return err + } + copy(out, finished.verifyData) + return nil +} + +// defaultMaxRSAKeySize is the maximum RSA key size in bits that we are willing +// to verify the signatures of during a TLS handshake. +const defaultMaxRSAKeySize = 8192 + +var tlsmaxrsasize = godebug.New("tlsmaxrsasize") + +func checkKeySize(n int) (max int, ok bool) { + if v := tlsmaxrsasize.Value(); v != "" { + if max, err := strconv.Atoi(v); err == nil { + if (n <= max) != (n <= defaultMaxRSAKeySize) { + tlsmaxrsasize.IncNonDefault() + } + return max, n <= max + } + } + return defaultMaxRSAKeySize, n <= defaultMaxRSAKeySize +} + +// verifyServerCertificate parses and verifies the provided chain, setting +// c.verifiedChains and c.peerCertificates or sending the appropriate alert. +func (c *Conn) verifyServerCertificate(certificates [][]byte) error { + certs := make([]*x509.Certificate, len(certificates)) + for i, asn1Data := range certificates { + cert, err := globalCertCache.newCert(asn1Data) + if err != nil { + c.sendAlert(alertDecodeError) + return errors.New("tls: failed to parse certificate from server: " + err.Error()) + } + if cert.PublicKeyAlgorithm == x509.RSA { + n := cert.PublicKey.(*rsa.PublicKey).N.BitLen() + if max, ok := checkKeySize(n); !ok { + c.sendAlert(alertBadCertificate) + return fmt.Errorf("tls: server sent certificate containing RSA key larger than %d bits", max) + } + } + certs[i] = cert + } + + echRejected := c.config.EncryptedClientHelloConfigList != nil && !c.echAccepted + if echRejected { + if c.config.EncryptedClientHelloRejectionVerify != nil { + if err := c.config.EncryptedClientHelloRejectionVerify(c.connectionStateLocked()); err != nil { + c.sendAlert(alertBadCertificate) + return err + } + } else { + opts := x509.VerifyOptions{ + Roots: c.config.RootCAs, + CurrentTime: c.config.time(), + DNSName: c.serverName, + Intermediates: x509.NewCertPool(), + } + + for _, cert := range certs[1:] { + opts.Intermediates.AddCert(cert) + } + chains, err := certs[0].Verify(opts) + if err != nil { + c.sendAlert(alertBadCertificate) + return &CertificateVerificationError{UnverifiedCertificates: certs, Err: err} + } + + c.verifiedChains, err = fipsAllowedChains(chains) + if err != nil { + c.sendAlert(alertBadCertificate) + return &CertificateVerificationError{UnverifiedCertificates: certs, Err: err} + } + } + } else if !c.config.InsecureSkipVerify { + opts := x509.VerifyOptions{ + Roots: c.config.RootCAs, + CurrentTime: c.config.time(), + DNSName: c.config.ServerName, + Intermediates: x509.NewCertPool(), + } + + for _, cert := range certs[1:] { + opts.Intermediates.AddCert(cert) + } + chains, err := certs[0].Verify(opts) + if err != nil { + c.sendAlert(alertBadCertificate) + return &CertificateVerificationError{UnverifiedCertificates: certs, Err: err} + } + + c.verifiedChains, err = fipsAllowedChains(chains) + if err != nil { + c.sendAlert(alertBadCertificate) + return &CertificateVerificationError{UnverifiedCertificates: certs, Err: err} + } + } + + switch certs[0].PublicKey.(type) { + case *rsa.PublicKey, *ecdsa.PublicKey, ed25519.PublicKey: + break + default: + c.sendAlert(alertUnsupportedCertificate) + return fmt.Errorf("tls: server's certificate contains an unsupported type of public key: %T", certs[0].PublicKey) + } + + c.peerCertificates = certs + + if c.config.VerifyPeerCertificate != nil && !echRejected { + if err := c.config.VerifyPeerCertificate(certificates, c.verifiedChains); err != nil { + c.sendAlert(alertBadCertificate) + return err + } + } + + if c.config.VerifyConnection != nil && !echRejected { + if err := c.config.VerifyConnection(c.connectionStateLocked()); err != nil { + c.sendAlert(alertBadCertificate) + return err + } + } + + return nil +} + +// certificateRequestInfoFromMsg generates a CertificateRequestInfo from a TLS +// <= 1.2 CertificateRequest, making an effort to fill in missing information. +func certificateRequestInfoFromMsg(ctx context.Context, vers uint16, certReq *certificateRequestMsg) *CertificateRequestInfo { + cri := &CertificateRequestInfo{ + AcceptableCAs: certReq.certificateAuthorities, + Version: vers, + ctx: ctx, + } + + var rsaAvail, ecAvail bool + for _, certType := range certReq.certificateTypes { + switch certType { + case certTypeRSASign: + rsaAvail = true + case certTypeECDSASign: + ecAvail = true + } + } + + if !certReq.hasSignatureAlgorithm { + // Prior to TLS 1.2, signature schemes did not exist. In this case we + // make up a list based on the acceptable certificate types, to help + // GetClientCertificate and SupportsCertificate select the right certificate. + // The hash part of the SignatureScheme is a lie here, because + // TLS 1.0 and 1.1 always use MD5+SHA1 for RSA and SHA1 for ECDSA. + switch { + case rsaAvail && ecAvail: + cri.SignatureSchemes = []SignatureScheme{ + ECDSAWithP256AndSHA256, ECDSAWithP384AndSHA384, ECDSAWithP521AndSHA512, + PKCS1WithSHA256, PKCS1WithSHA384, PKCS1WithSHA512, PKCS1WithSHA1, + } + case rsaAvail: + cri.SignatureSchemes = []SignatureScheme{ + PKCS1WithSHA256, PKCS1WithSHA384, PKCS1WithSHA512, PKCS1WithSHA1, + } + case ecAvail: + cri.SignatureSchemes = []SignatureScheme{ + ECDSAWithP256AndSHA256, ECDSAWithP384AndSHA384, ECDSAWithP521AndSHA512, + } + } + return cri + } + + // Filter the signature schemes based on the certificate types. + // See RFC 5246, Section 7.4.4 (where it calls this "somewhat complicated"). + cri.SignatureSchemes = make([]SignatureScheme, 0, len(certReq.supportedSignatureAlgorithms)) + for _, sigScheme := range certReq.supportedSignatureAlgorithms { + sigType, _, err := typeAndHashFromSignatureScheme(sigScheme) + if err != nil { + continue + } + switch sigType { + case signatureECDSA, signatureEd25519: + if ecAvail { + cri.SignatureSchemes = append(cri.SignatureSchemes, sigScheme) + } + case signatureRSAPSS, signaturePKCS1v15: + if rsaAvail { + cri.SignatureSchemes = append(cri.SignatureSchemes, sigScheme) + } + } + } + + return cri +} + +func (c *Conn) getClientCertificate(cri *CertificateRequestInfo) (*Certificate, error) { + if c.config.GetClientCertificate != nil { + return c.config.GetClientCertificate(cri) + } + + for _, chain := range c.config.Certificates { + if err := cri.SupportsCertificate(&chain); err != nil { + continue + } + return &chain, nil + } + + // No acceptable certificate found. Don't send a certificate. + return new(Certificate), nil +} + +// clientSessionCacheKey returns a key used to cache sessionTickets that could +// be used to resume previously negotiated TLS sessions with a server. +func (c *Conn) clientSessionCacheKey() string { + if len(c.config.ServerName) > 0 { + return c.config.ServerName + } + if c.conn != nil { + return c.conn.RemoteAddr().String() + } + return "" +} + +// hostnameInSNI converts name into an appropriate hostname for SNI. +// Literal IP addresses and absolute FQDNs are not permitted as SNI values. +// See RFC 6066, Section 3. +func hostnameInSNI(name string) string { + host := name + if len(host) > 0 && host[0] == '[' && host[len(host)-1] == ']' { + host = host[1 : len(host)-1] + } + if i := strings.LastIndex(host, "%"); i > 0 { + host = host[:i] + } + if net.ParseIP(host) != nil { + return "" + } + for len(name) > 0 && name[len(name)-1] == '.' { + name = name[:len(name)-1] + } + return name +} + +func computeAndUpdatePSK(m *clientHelloMsg, binderKey []byte, transcript hash.Hash, finishedHash func([]byte, hash.Hash) []byte) error { + helloBytes, err := m.marshalWithoutBinders() + if err != nil { + return err + } + transcript.Write(helloBytes) + pskBinders := [][]byte{finishedHash(binderKey, transcript)} + return m.updateBinders(pskBinders) +} diff --git a/go/src/crypto/tls/handshake_client_test.go b/go/src/crypto/tls/handshake_client_test.go new file mode 100644 index 0000000000000000000000000000000000000000..e7de0b59119b8ab011a27aa2fb6aaa85e588f731 --- /dev/null +++ b/go/src/crypto/tls/handshake_client_test.go @@ -0,0 +1,2929 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "bytes" + "context" + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "crypto/rsa" + "crypto/tls/internal/fips140tls" + "crypto/x509" + "crypto/x509/pkix" + "encoding/base64" + "encoding/hex" + "encoding/pem" + "errors" + "fmt" + "internal/byteorder" + "io" + "math/big" + "net" + "os" + "os/exec" + "path/filepath" + "reflect" + "runtime" + "strconv" + "strings" + "testing" + "time" +) + +// Note: see comment in handshake_test.go for details of how the reference +// tests work. + +// opensslInputEvent enumerates possible inputs that can be sent to an `openssl +// s_client` process. +type opensslInputEvent int + +const ( + // opensslRenegotiate causes OpenSSL to request a renegotiation of the + // connection. + opensslRenegotiate opensslInputEvent = iota + + // opensslSendBanner causes OpenSSL to send the contents of + // opensslSentinel on the connection. + opensslSendSentinel + + // opensslKeyUpdate causes OpenSSL to send a key update message to the + // client and request one back. + opensslKeyUpdate +) + +const opensslSentinel = "SENTINEL\n" + +type opensslInput chan opensslInputEvent + +func (i opensslInput) Read(buf []byte) (n int, err error) { + for event := range i { + switch event { + case opensslRenegotiate: + return copy(buf, []byte("R\n")), nil + case opensslKeyUpdate: + return copy(buf, []byte("K\n")), nil + case opensslSendSentinel: + return copy(buf, []byte(opensslSentinel)), nil + default: + panic("unknown event") + } + } + + return 0, io.EOF +} + +// opensslOutputSink is an io.Writer that receives the stdout and stderr from an +// `openssl` process and sends a value to handshakeComplete or readKeyUpdate +// when certain messages are seen. +type opensslOutputSink struct { + handshakeComplete chan struct{} + readKeyUpdate chan struct{} + all []byte + line []byte +} + +func newOpensslOutputSink() *opensslOutputSink { + return &opensslOutputSink{make(chan struct{}), make(chan struct{}), nil, nil} +} + +// opensslEndOfHandshake is a message that the “openssl s_server” tool will +// print when a handshake completes if run with “-state”. +const opensslEndOfHandshake = "SSL_accept:SSLv3/TLS write finished" + +// opensslReadKeyUpdate is a message that the “openssl s_server” tool will +// print when a KeyUpdate message is received if run with “-state”. +const opensslReadKeyUpdate = "SSL_accept:TLSv1.3 read client key update" + +func (o *opensslOutputSink) Write(data []byte) (n int, err error) { + o.line = append(o.line, data...) + o.all = append(o.all, data...) + + for { + line, next, ok := bytes.Cut(o.line, []byte("\n")) + if !ok { + break + } + + if bytes.Equal([]byte(opensslEndOfHandshake), line) { + o.handshakeComplete <- struct{}{} + } + if bytes.Equal([]byte(opensslReadKeyUpdate), line) { + o.readKeyUpdate <- struct{}{} + } + o.line = next + } + + return len(data), nil +} + +func (o *opensslOutputSink) String() string { + return string(o.all) +} + +// clientTest represents a test of the TLS client handshake against a reference +// implementation. +type clientTest struct { + // name is a freeform string identifying the test and the file in which + // the expected results will be stored. + name string + // args, if not empty, contains a series of arguments for the + // command to run for the reference server. + args []string + // config, if not nil, contains a custom Config to use for this test. + config *Config + // cert, if not empty, contains a DER-encoded certificate for the + // reference server. + cert []byte + // key, if not nil, contains either a *rsa.PrivateKey, ed25519.PrivateKey or + // *ecdsa.PrivateKey which is the private key for the reference server. + key any + // extensions, if not nil, contains a list of extension data to be returned + // from the ServerHello. The data should be in standard TLS format with + // a 2-byte uint16 type, 2-byte data length, followed by the extension data. + extensions [][]byte + // validate, if not nil, is a function that will be called with the + // ConnectionState of the resulting connection. It returns a non-nil + // error if the ConnectionState is unacceptable. + validate func(ConnectionState) error + // numRenegotiations is the number of times that the connection will be + // renegotiated. + numRenegotiations int + // renegotiationExpectedToFail, if not zero, is the number of the + // renegotiation attempt that is expected to fail. + renegotiationExpectedToFail int + // checkRenegotiationError, if not nil, is called with any error + // arising from renegotiation. It can map expected errors to nil to + // ignore them. + checkRenegotiationError func(renegotiationNum int, err error) error + // sendKeyUpdate will cause the server to send a KeyUpdate message. + sendKeyUpdate bool +} + +var serverCommand = []string{"openssl", "s_server", "-no_ticket", "-num_tickets", "0"} + +// connFromCommand starts the reference server process, connects to it and +// returns a recordingConn for the connection. The stdin return value is an +// opensslInput for the stdin of the child process. It must be closed before +// Waiting for child. +func (test *clientTest) connFromCommand() (conn *recordingConn, child *exec.Cmd, stdin opensslInput, stdout *opensslOutputSink, err error) { + cert := testRSACertificate + if len(test.cert) > 0 { + cert = test.cert + } + certPath := tempFile(string(cert)) + defer os.Remove(certPath) + + var key any = testRSAPrivateKey + if test.key != nil { + key = test.key + } + derBytes, err := x509.MarshalPKCS8PrivateKey(key) + if err != nil { + panic(err) + } + + var pemOut bytes.Buffer + pem.Encode(&pemOut, &pem.Block{Type: "PRIVATE KEY", Bytes: derBytes}) + + keyPath := tempFile(pemOut.String()) + defer os.Remove(keyPath) + + var command []string + command = append(command, serverCommand...) + command = append(command, test.args...) + command = append(command, "-cert", certPath, "-certform", "DER", "-key", keyPath) + // serverPort contains the port that OpenSSL will listen on. OpenSSL + // can't take "0" as an argument here so we have to pick a number and + // hope that it's not in use on the machine. Since this only occurs + // when -update is given and thus when there's a human watching the + // test, this isn't too bad. + const serverPort = 24323 + command = append(command, "-accept", strconv.Itoa(serverPort)) + + if len(test.extensions) > 0 { + var serverInfo bytes.Buffer + for _, ext := range test.extensions { + pem.Encode(&serverInfo, &pem.Block{ + Type: fmt.Sprintf("SERVERINFO FOR EXTENSION %d", byteorder.BEUint16(ext)), + Bytes: ext, + }) + } + serverInfoPath := tempFile(serverInfo.String()) + defer os.Remove(serverInfoPath) + command = append(command, "-serverinfo", serverInfoPath) + } + + if test.numRenegotiations > 0 || test.sendKeyUpdate { + found := false + for _, flag := range command[1:] { + if flag == "-state" { + found = true + break + } + } + + if !found { + panic("-state flag missing to OpenSSL, you need this if testing renegotiation or KeyUpdate") + } + } + + cmd := exec.Command(command[0], command[1:]...) + stdin = opensslInput(make(chan opensslInputEvent)) + cmd.Stdin = stdin + out := newOpensslOutputSink() + cmd.Stdout = out + cmd.Stderr = out + if err := cmd.Start(); err != nil { + return nil, nil, nil, nil, err + } + + // OpenSSL does print an "ACCEPT" banner, but it does so *before* + // opening the listening socket, so we can't use that to wait until it + // has started listening. Thus we are forced to poll until we get a + // connection. + var tcpConn net.Conn + for i := uint(0); i < 5; i++ { + tcpConn, err = net.DialTCP("tcp", nil, &net.TCPAddr{ + IP: net.IPv4(127, 0, 0, 1), + Port: serverPort, + }) + if err == nil { + break + } + time.Sleep((1 << i) * 5 * time.Millisecond) + } + if err != nil { + close(stdin) + cmd.Process.Kill() + err = fmt.Errorf("error connecting to the OpenSSL server: %v (%v)\n\n%s", err, cmd.Wait(), out) + return nil, nil, nil, nil, err + } + + record := &recordingConn{ + Conn: tcpConn, + } + + return record, cmd, stdin, out, nil +} + +func (test *clientTest) dataPath() string { + return filepath.Join("testdata", "Client-"+test.name) +} + +func (test *clientTest) loadData() (flows [][]byte, err error) { + in, err := os.Open(test.dataPath()) + if err != nil { + return nil, err + } + defer in.Close() + return parseTestData(in) +} + +func (test *clientTest) run(t *testing.T, write bool) { + var clientConn net.Conn + var recordingConn *recordingConn + var childProcess *exec.Cmd + var stdin opensslInput + var stdout *opensslOutputSink + + if write { + var err error + recordingConn, childProcess, stdin, stdout, err = test.connFromCommand() + if err != nil { + t.Fatalf("Failed to start subcommand: %s", err) + } + clientConn = recordingConn + defer func() { + if t.Failed() { + t.Logf("OpenSSL output:\n\n%s", stdout.all) + } + }() + } else { + flows, err := test.loadData() + if err != nil { + t.Fatalf("failed to load data from %s: %v", test.dataPath(), err) + } + clientConn = &replayingConn{t: t, flows: flows, reading: false} + } + + config := test.config + if config == nil { + config = testConfig + } + client := Client(clientConn, config) + defer client.Close() + + if _, err := client.Write([]byte("hello\n")); err != nil { + t.Errorf("Client.Write failed: %s", err) + return + } + + for i := 1; i <= test.numRenegotiations; i++ { + // The initial handshake will generate a + // handshakeComplete signal which needs to be quashed. + if i == 1 && write { + <-stdout.handshakeComplete + } + + // OpenSSL will try to interleave application data and + // a renegotiation if we send both concurrently. + // Therefore: ask OpensSSL to start a renegotiation, run + // a goroutine to call client.Read and thus process the + // renegotiation request, watch for OpenSSL's stdout to + // indicate that the handshake is complete and, + // finally, have OpenSSL write something to cause + // client.Read to complete. + if write { + stdin <- opensslRenegotiate + } + + signalChan := make(chan struct{}) + + go func() { + defer close(signalChan) + + buf := make([]byte, 256) + n, err := client.Read(buf) + + if test.checkRenegotiationError != nil { + newErr := test.checkRenegotiationError(i, err) + if err != nil && newErr == nil { + return + } + err = newErr + } + + if err != nil { + t.Errorf("Client.Read failed after renegotiation #%d: %s", i, err) + return + } + + buf = buf[:n] + if !bytes.Equal([]byte(opensslSentinel), buf) { + t.Errorf("Client.Read returned %q, but wanted %q", string(buf), opensslSentinel) + } + + if expected := i + 1; client.handshakes != expected { + t.Errorf("client should have recorded %d handshakes, but believes that %d have occurred", expected, client.handshakes) + } + }() + + if write && test.renegotiationExpectedToFail != i { + <-stdout.handshakeComplete + stdin <- opensslSendSentinel + } + <-signalChan + } + + if test.sendKeyUpdate { + if write { + <-stdout.handshakeComplete + stdin <- opensslKeyUpdate + } + + doneRead := make(chan struct{}) + + go func() { + defer close(doneRead) + + buf := make([]byte, 256) + n, err := client.Read(buf) + + if err != nil { + t.Errorf("Client.Read failed after KeyUpdate: %s", err) + return + } + + buf = buf[:n] + if !bytes.Equal([]byte(opensslSentinel), buf) { + t.Errorf("Client.Read returned %q, but wanted %q", string(buf), opensslSentinel) + } + }() + + if write { + // There's no real reason to wait for the client KeyUpdate to + // send data with the new server keys, except that s_server + // drops writes if they are sent at the wrong time. + <-stdout.readKeyUpdate + stdin <- opensslSendSentinel + } + <-doneRead + + if _, err := client.Write([]byte("hello again\n")); err != nil { + t.Errorf("Client.Write failed: %s", err) + return + } + } + + if test.validate != nil { + if err := test.validate(client.ConnectionState()); err != nil { + t.Errorf("validate callback returned error: %s", err) + } + } + + // If the server sent us an alert after our last flight, give it a + // chance to arrive. + if write && test.renegotiationExpectedToFail == 0 { + if err := peekError(client); err != nil { + t.Errorf("final Read returned an error: %s", err) + } + } + + if write { + client.Close() + path := test.dataPath() + out, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) + if err != nil { + t.Fatalf("Failed to create output file: %s", err) + } + defer out.Close() + recordingConn.Close() + close(stdin) + childProcess.Process.Kill() + childProcess.Wait() + if len(recordingConn.flows) < 3 { + t.Fatalf("Client connection didn't work") + } + recordingConn.WriteTo(out) + t.Logf("Wrote %s\n", path) + } +} + +// peekError does a read with a short timeout to check if the next read would +// cause an error, for example if there is an alert waiting on the wire. +func peekError(conn net.Conn) error { + conn.SetReadDeadline(time.Now().Add(100 * time.Millisecond)) + if n, err := conn.Read(make([]byte, 1)); n != 0 { + return errors.New("unexpectedly read data") + } else if err != nil { + if netErr, ok := err.(net.Error); !ok || !netErr.Timeout() { + return err + } + } + return nil +} + +func runClientTestForVersion(t *testing.T, template *clientTest, version, option string) { + // Make a deep copy of the template before going parallel. + test := *template + if template.config != nil { + test.config = template.config.Clone() + } + test.name = version + "-" + test.name + test.args = append([]string{option}, test.args...) + + runTestAndUpdateIfNeeded(t, version, test.run, false) +} + +func runClientTestTLS10(t *testing.T, template *clientTest) { + runClientTestForVersion(t, template, "TLSv10", "-tls1") +} + +func runClientTestTLS11(t *testing.T, template *clientTest) { + runClientTestForVersion(t, template, "TLSv11", "-tls1_1") +} + +func runClientTestTLS12(t *testing.T, template *clientTest) { + runClientTestForVersion(t, template, "TLSv12", "-tls1_2") +} + +func runClientTestTLS13(t *testing.T, template *clientTest) { + runClientTestForVersion(t, template, "TLSv13", "-tls1_3") +} + +func TestHandshakeClientRSARC4(t *testing.T) { + test := &clientTest{ + name: "RSA-RC4", + args: []string{"-cipher", "RC4-SHA"}, + } + runClientTestTLS10(t, test) + runClientTestTLS11(t, test) + runClientTestTLS12(t, test) +} + +func TestHandshakeClientRSAAES128GCM(t *testing.T) { + test := &clientTest{ + name: "AES128-GCM-SHA256", + args: []string{"-cipher", "AES128-GCM-SHA256"}, + } + runClientTestTLS12(t, test) +} + +func TestHandshakeClientRSAAES256GCM(t *testing.T) { + test := &clientTest{ + name: "AES256-GCM-SHA384", + args: []string{"-cipher", "AES256-GCM-SHA384"}, + } + runClientTestTLS12(t, test) +} + +func TestHandshakeClientECDHERSAAES(t *testing.T) { + test := &clientTest{ + name: "ECDHE-RSA-AES", + args: []string{"-cipher", "ECDHE-RSA-AES128-SHA"}, + } + runClientTestTLS10(t, test) + runClientTestTLS11(t, test) + runClientTestTLS12(t, test) +} + +func TestHandshakeClientECDHEECDSAAES(t *testing.T) { + test := &clientTest{ + name: "ECDHE-ECDSA-AES", + args: []string{"-cipher", "ECDHE-ECDSA-AES128-SHA"}, + cert: testECDSACertificate, + key: testECDSAPrivateKey, + } + runClientTestTLS10(t, test) + runClientTestTLS11(t, test) + runClientTestTLS12(t, test) +} + +func TestHandshakeClientECDHEECDSAAESGCM(t *testing.T) { + test := &clientTest{ + name: "ECDHE-ECDSA-AES-GCM", + args: []string{"-cipher", "ECDHE-ECDSA-AES128-GCM-SHA256"}, + cert: testECDSACertificate, + key: testECDSAPrivateKey, + } + runClientTestTLS12(t, test) +} + +func TestHandshakeClientAES256GCMSHA384(t *testing.T) { + test := &clientTest{ + name: "ECDHE-ECDSA-AES256-GCM-SHA384", + args: []string{"-cipher", "ECDHE-ECDSA-AES256-GCM-SHA384"}, + cert: testECDSACertificate, + key: testECDSAPrivateKey, + } + runClientTestTLS12(t, test) +} + +func TestHandshakeClientAES128CBCSHA256(t *testing.T) { + test := &clientTest{ + name: "AES128-SHA256", + args: []string{"-cipher", "AES128-SHA256"}, + } + runClientTestTLS12(t, test) +} + +func TestHandshakeClientECDHERSAAES128CBCSHA256(t *testing.T) { + test := &clientTest{ + name: "ECDHE-RSA-AES128-SHA256", + args: []string{"-cipher", "ECDHE-RSA-AES128-SHA256"}, + } + runClientTestTLS12(t, test) +} + +func TestHandshakeClientECDHEECDSAAES128CBCSHA256(t *testing.T) { + test := &clientTest{ + name: "ECDHE-ECDSA-AES128-SHA256", + args: []string{"-cipher", "ECDHE-ECDSA-AES128-SHA256"}, + cert: testECDSACertificate, + key: testECDSAPrivateKey, + } + runClientTestTLS12(t, test) +} + +func TestHandshakeClientX25519(t *testing.T) { + config := testConfig.Clone() + config.CurvePreferences = []CurveID{X25519} + + test := &clientTest{ + name: "X25519-ECDHE", + args: []string{"-cipher", "ECDHE-RSA-AES128-GCM-SHA256", "-curves", "X25519"}, + config: config, + } + + runClientTestTLS12(t, test) + runClientTestTLS13(t, test) +} + +func TestHandshakeClientP256(t *testing.T) { + config := testConfig.Clone() + config.CurvePreferences = []CurveID{CurveP256} + + test := &clientTest{ + name: "P256-ECDHE", + args: []string{"-cipher", "ECDHE-RSA-AES128-GCM-SHA256", "-curves", "P-256"}, + config: config, + } + + runClientTestTLS12(t, test) + runClientTestTLS13(t, test) +} + +func TestHandshakeClientHelloRetryRequest(t *testing.T) { + config := testConfig.Clone() + config.CurvePreferences = []CurveID{X25519, CurveP256} + + test := &clientTest{ + name: "HelloRetryRequest", + args: []string{"-cipher", "ECDHE-RSA-AES128-GCM-SHA256", "-curves", "P-256"}, + config: config, + validate: func(cs ConnectionState) error { + if !cs.HelloRetryRequest { + return errors.New("expected HelloRetryRequest") + } + return nil + }, + } + + runClientTestTLS13(t, test) +} + +func TestHandshakeClientECDHERSAChaCha20(t *testing.T) { + config := testConfig.Clone() + config.CipherSuites = []uint16{TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256} + + test := &clientTest{ + name: "ECDHE-RSA-CHACHA20-POLY1305", + args: []string{"-cipher", "ECDHE-RSA-CHACHA20-POLY1305"}, + config: config, + } + + runClientTestTLS12(t, test) +} + +func TestHandshakeClientECDHEECDSAChaCha20(t *testing.T) { + config := testConfig.Clone() + config.CipherSuites = []uint16{TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256} + + test := &clientTest{ + name: "ECDHE-ECDSA-CHACHA20-POLY1305", + args: []string{"-cipher", "ECDHE-ECDSA-CHACHA20-POLY1305"}, + config: config, + cert: testECDSACertificate, + key: testECDSAPrivateKey, + } + + runClientTestTLS12(t, test) +} + +func TestHandshakeClientAES128SHA256(t *testing.T) { + test := &clientTest{ + name: "AES128-SHA256", + args: []string{"-ciphersuites", "TLS_AES_128_GCM_SHA256"}, + } + runClientTestTLS13(t, test) +} +func TestHandshakeClientAES256SHA384(t *testing.T) { + test := &clientTest{ + name: "AES256-SHA384", + args: []string{"-ciphersuites", "TLS_AES_256_GCM_SHA384"}, + } + runClientTestTLS13(t, test) +} +func TestHandshakeClientCHACHA20SHA256(t *testing.T) { + test := &clientTest{ + name: "CHACHA20-SHA256", + args: []string{"-ciphersuites", "TLS_CHACHA20_POLY1305_SHA256"}, + } + runClientTestTLS13(t, test) +} + +func TestHandshakeClientECDSATLS13(t *testing.T) { + test := &clientTest{ + name: "ECDSA", + cert: testECDSACertificate, + key: testECDSAPrivateKey, + } + runClientTestTLS13(t, test) +} + +func TestHandshakeClientEd25519(t *testing.T) { + test := &clientTest{ + name: "Ed25519", + cert: testEd25519Certificate, + key: testEd25519PrivateKey, + } + runClientTestTLS12(t, test) + runClientTestTLS13(t, test) + + config := testConfig.Clone() + cert, _ := X509KeyPair([]byte(clientEd25519CertificatePEM), []byte(clientEd25519KeyPEM)) + config.Certificates = []Certificate{cert} + + test = &clientTest{ + name: "ClientCert-Ed25519", + args: []string{"-Verify", "1"}, + config: config, + } + + runClientTestTLS12(t, test) + runClientTestTLS13(t, test) +} + +func TestHandshakeClientCertRSA(t *testing.T) { + config := testConfig.Clone() + cert, _ := X509KeyPair([]byte(clientCertificatePEM), []byte(clientKeyPEM)) + config.Certificates = []Certificate{cert} + + test := &clientTest{ + name: "ClientCert-RSA-RSA", + args: []string{"-cipher", "AES128", "-Verify", "1"}, + config: config, + } + + runClientTestTLS10(t, test) + runClientTestTLS12(t, test) + + test = &clientTest{ + name: "ClientCert-RSA-ECDSA", + args: []string{"-cipher", "ECDHE-ECDSA-AES128-SHA", "-Verify", "1"}, + config: config, + cert: testECDSACertificate, + key: testECDSAPrivateKey, + } + + runClientTestTLS10(t, test) + runClientTestTLS12(t, test) + runClientTestTLS13(t, test) + + test = &clientTest{ + name: "ClientCert-RSA-AES256-GCM-SHA384", + args: []string{"-cipher", "ECDHE-RSA-AES256-GCM-SHA384", "-Verify", "1"}, + config: config, + cert: testRSACertificate, + key: testRSAPrivateKey, + } + + runClientTestTLS12(t, test) +} + +func TestHandshakeClientCertECDSA(t *testing.T) { + config := testConfig.Clone() + cert, _ := X509KeyPair([]byte(clientECDSACertificatePEM), []byte(clientECDSAKeyPEM)) + config.Certificates = []Certificate{cert} + + test := &clientTest{ + name: "ClientCert-ECDSA-RSA", + args: []string{"-cipher", "AES128", "-Verify", "1"}, + config: config, + } + + runClientTestTLS10(t, test) + runClientTestTLS12(t, test) + runClientTestTLS13(t, test) + + test = &clientTest{ + name: "ClientCert-ECDSA-ECDSA", + args: []string{"-cipher", "ECDHE-ECDSA-AES128-SHA", "-Verify", "1"}, + config: config, + cert: testECDSACertificate, + key: testECDSAPrivateKey, + } + + runClientTestTLS10(t, test) + runClientTestTLS12(t, test) +} + +// TestHandshakeClientCertRSAPSS tests rsa_pss_rsae_sha256 signatures from both +// client and server certificates. It also serves from both sides a certificate +// signed itself with RSA-PSS, mostly to check that crypto/x509 chain validation +// works. +func TestHandshakeClientCertRSAPSS(t *testing.T) { + cert, err := x509.ParseCertificate(testRSAPSSCertificate) + if err != nil { + panic(err) + } + rootCAs := x509.NewCertPool() + rootCAs.AddCert(cert) + + config := testConfig.Clone() + // Use GetClientCertificate to bypass the client certificate selection logic. + config.GetClientCertificate = func(*CertificateRequestInfo) (*Certificate, error) { + return &Certificate{ + Certificate: [][]byte{testRSAPSSCertificate}, + PrivateKey: testRSAPrivateKey, + }, nil + } + config.RootCAs = rootCAs + + test := &clientTest{ + name: "ClientCert-RSA-RSAPSS", + args: []string{"-cipher", "AES128", "-Verify", "1", "-client_sigalgs", + "rsa_pss_rsae_sha256", "-sigalgs", "rsa_pss_rsae_sha256"}, + config: config, + cert: testRSAPSSCertificate, + key: testRSAPrivateKey, + } + runClientTestTLS12(t, test) + runClientTestTLS13(t, test) +} + +func TestHandshakeClientCertRSAPKCS1v15(t *testing.T) { + config := testConfig.Clone() + cert, _ := X509KeyPair([]byte(clientCertificatePEM), []byte(clientKeyPEM)) + config.Certificates = []Certificate{cert} + + test := &clientTest{ + name: "ClientCert-RSA-RSAPKCS1v15", + args: []string{"-cipher", "AES128", "-Verify", "1", "-client_sigalgs", + "rsa_pkcs1_sha256", "-sigalgs", "rsa_pkcs1_sha256"}, + config: config, + } + + runClientTestTLS12(t, test) +} + +func TestClientKeyUpdate(t *testing.T) { + test := &clientTest{ + name: "KeyUpdate", + args: []string{"-state"}, + sendKeyUpdate: true, + } + runClientTestTLS13(t, test) +} + +func TestResumption(t *testing.T) { + t.Run("TLSv12", func(t *testing.T) { testResumption(t, VersionTLS12) }) + t.Run("TLSv13", func(t *testing.T) { testResumption(t, VersionTLS13) }) +} + +func testResumption(t *testing.T, version uint16) { + if testing.Short() { + t.Skip("skipping in -short mode") + } + + // Note: using RSA 2048 test certificates because they are compatible with FIPS mode. + testCertificates := []Certificate{{Certificate: [][]byte{testRSA2048Certificate}, PrivateKey: testRSA2048PrivateKey}} + serverConfig := &Config{ + MaxVersion: version, + CipherSuites: []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384}, + Certificates: testCertificates, + Time: testTime, + } + + issuer, err := x509.ParseCertificate(testRSA2048CertificateIssuer) + if err != nil { + panic(err) + } + + rootCAs := x509.NewCertPool() + rootCAs.AddCert(issuer) + + clientConfig := &Config{ + MaxVersion: version, + CipherSuites: []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256}, + ClientSessionCache: NewLRUClientSessionCache(32), + RootCAs: rootCAs, + ServerName: "example.golang", + Time: testTime, + } + + testResumeState := func(test string, didResume bool) { + t.Helper() + _, hs, err := testHandshake(t, clientConfig, serverConfig) + if err != nil { + t.Fatalf("%s: handshake failed: %s", test, err) + } + if hs.DidResume != didResume { + t.Fatalf("%s resumed: %v, expected: %v", test, hs.DidResume, didResume) + } + if didResume && (hs.PeerCertificates == nil || hs.VerifiedChains == nil) { + t.Fatalf("expected non-nil certificates after resumption. Got peerCertificates: %#v, verifiedCertificates: %#v", hs.PeerCertificates, hs.VerifiedChains) + } + if got, want := hs.ServerName, clientConfig.ServerName; got != want { + t.Errorf("%s: server name %s, want %s", test, got, want) + } + } + + getTicket := func() []byte { + return clientConfig.ClientSessionCache.(*lruSessionCache).q.Front().Value.(*lruSessionCacheEntry).state.session.ticket + } + deleteTicket := func() { + ticketKey := clientConfig.ClientSessionCache.(*lruSessionCache).q.Front().Value.(*lruSessionCacheEntry).sessionKey + clientConfig.ClientSessionCache.Put(ticketKey, nil) + } + corruptTicket := func() { + clientConfig.ClientSessionCache.(*lruSessionCache).q.Front().Value.(*lruSessionCacheEntry).state.session.secret[0] ^= 0xff + } + randomKey := func() [32]byte { + var k [32]byte + if _, err := io.ReadFull(serverConfig.rand(), k[:]); err != nil { + t.Fatalf("Failed to read new SessionTicketKey: %s", err) + } + return k + } + + testResumeState("Handshake", false) + ticket := getTicket() + testResumeState("Resume", true) + if bytes.Equal(ticket, getTicket()) { + t.Fatal("ticket didn't change after resumption") + } + + // An old session ticket is replaced with a ticket encrypted with a fresh key. + ticket = getTicket() + serverConfig.Time = func() time.Time { return testTime().Add(24*time.Hour + time.Minute) } + testResumeState("ResumeWithOldTicket", true) + if bytes.Equal(ticket, getTicket()) { + t.Fatal("old first ticket matches the fresh one") + } + + // Once the session master secret is expired, a full handshake should occur. + ticket = getTicket() + serverConfig.Time = func() time.Time { return testTime().Add(24*8*time.Hour + time.Minute) } + testResumeState("ResumeWithExpiredTicket", false) + if bytes.Equal(ticket, getTicket()) { + t.Fatal("expired first ticket matches the fresh one") + } + + serverConfig.Time = testTime // reset the time back + key1 := randomKey() + serverConfig.SetSessionTicketKeys([][32]byte{key1}) + + testResumeState("InvalidSessionTicketKey", false) + testResumeState("ResumeAfterInvalidSessionTicketKey", true) + + key2 := randomKey() + serverConfig.SetSessionTicketKeys([][32]byte{key2, key1}) + ticket = getTicket() + testResumeState("KeyChange", true) + if bytes.Equal(ticket, getTicket()) { + t.Fatal("new ticket wasn't included while resuming") + } + testResumeState("KeyChangeFinish", true) + + // Age the session ticket a bit, but not yet expired. + serverConfig.Time = func() time.Time { return testTime().Add(24*time.Hour + time.Minute) } + testResumeState("OldSessionTicket", true) + ticket = getTicket() + // Expire the session ticket, which would force a full handshake. + serverConfig.Time = func() time.Time { return testTime().Add(24*8*time.Hour + 2*time.Minute) } + testResumeState("ExpiredSessionTicket", false) + if bytes.Equal(ticket, getTicket()) { + t.Fatal("new ticket wasn't provided after old ticket expired") + } + + // Age the session ticket a bit at a time, but don't expire it. + d := 0 * time.Hour + serverConfig.Time = func() time.Time { return testTime().Add(d) } + deleteTicket() + testResumeState("GetFreshSessionTicket", false) + for i := 0; i < 13; i++ { + d += 12 * time.Hour + testResumeState("OldSessionTicket", true) + } + // Expire it (now a little more than 7 days) and make sure a full + // handshake occurs for TLS 1.2. Resumption should still occur for + // TLS 1.3 since the client should be using a fresh ticket sent over + // by the server. + d += 12*time.Hour + time.Minute + if version == VersionTLS13 { + testResumeState("ExpiredSessionTicket", true) + } else { + testResumeState("ExpiredSessionTicket", false) + } + if bytes.Equal(ticket, getTicket()) { + t.Fatal("new ticket wasn't provided after old ticket expired") + } + + // Reset serverConfig to ensure that calling SetSessionTicketKeys + // before the serverConfig is used works. + serverConfig = &Config{ + MaxVersion: version, + CipherSuites: []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384}, + Certificates: testCertificates, + Time: testTime, + } + serverConfig.SetSessionTicketKeys([][32]byte{key2}) + + testResumeState("FreshConfig", true) + + // In TLS 1.3, cross-cipher suite resumption is allowed as long as the KDF + // hash matches. Also, Config.CipherSuites does not apply to TLS 1.3. + if version != VersionTLS13 { + clientConfig.CipherSuites = []uint16{TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384} + testResumeState("DifferentCipherSuite", false) + testResumeState("DifferentCipherSuiteRecovers", true) + } + + deleteTicket() + testResumeState("WithoutSessionTicket", false) + + // In TLS 1.3, HelloRetryRequest is sent after incorrect key share. + // See https://www.rfc-editor.org/rfc/rfc8446#page-14. + if version == VersionTLS13 { + deleteTicket() + serverConfig = &Config{ + // Use a different curve than the client to force a HelloRetryRequest. + CurvePreferences: []CurveID{CurveP521, CurveP384, CurveP256}, + MaxVersion: version, + Certificates: testCertificates, + Time: testTime, + } + testResumeState("InitialHandshake", false) + testResumeState("WithHelloRetryRequest", true) + + // Reset serverConfig back. + serverConfig = &Config{ + MaxVersion: version, + CipherSuites: []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384}, + Certificates: testCertificates, + Time: testTime, + } + } + + // Session resumption should work when using client certificates + deleteTicket() + serverConfig.ClientCAs = rootCAs + serverConfig.ClientAuth = RequireAndVerifyClientCert + clientConfig.Certificates = serverConfig.Certificates + testResumeState("InitialHandshake", false) + testResumeState("WithClientCertificates", true) + serverConfig.ClientAuth = NoClientCert + + // Tickets should be removed from the session cache on TLS handshake + // failure, and the client should recover from a corrupted PSK + testResumeState("FetchTicketToCorrupt", false) + corruptTicket() + _, _, err = testHandshake(t, clientConfig, serverConfig) + if err == nil { + t.Fatalf("handshake did not fail with a corrupted client secret") + } + testResumeState("AfterHandshakeFailure", false) + + clientConfig.ClientSessionCache = nil + testResumeState("WithoutSessionCache", false) + + clientConfig.ClientSessionCache = &serializingClientCache{t: t} + testResumeState("BeforeSerializingCache", false) + testResumeState("WithSerializingCache", true) +} + +type serializingClientCache struct { + t *testing.T + + ticket, state []byte +} + +func (c *serializingClientCache) Get(sessionKey string) (session *ClientSessionState, ok bool) { + if c.ticket == nil { + return nil, false + } + state, err := ParseSessionState(c.state) + if err != nil { + c.t.Error(err) + return nil, false + } + cs, err := NewResumptionState(c.ticket, state) + if err != nil { + c.t.Error(err) + return nil, false + } + return cs, true +} + +func (c *serializingClientCache) Put(sessionKey string, cs *ClientSessionState) { + if cs == nil { + c.ticket, c.state = nil, nil + return + } + ticket, state, err := cs.ResumptionState() + if err != nil { + c.t.Error(err) + return + } + stateBytes, err := state.Bytes() + if err != nil { + c.t.Error(err) + return + } + c.ticket, c.state = ticket, stateBytes +} + +func TestLRUClientSessionCache(t *testing.T) { + // Initialize cache of capacity 4. + cache := NewLRUClientSessionCache(4) + cs := make([]ClientSessionState, 6) + keys := []string{"0", "1", "2", "3", "4", "5", "6"} + + // Add 4 entries to the cache and look them up. + for i := 0; i < 4; i++ { + cache.Put(keys[i], &cs[i]) + } + for i := 0; i < 4; i++ { + if s, ok := cache.Get(keys[i]); !ok || s != &cs[i] { + t.Fatalf("session cache failed lookup for added key: %s", keys[i]) + } + } + + // Add 2 more entries to the cache. First 2 should be evicted. + for i := 4; i < 6; i++ { + cache.Put(keys[i], &cs[i]) + } + for i := 0; i < 2; i++ { + if s, ok := cache.Get(keys[i]); ok || s != nil { + t.Fatalf("session cache should have evicted key: %s", keys[i]) + } + } + + // Touch entry 2. LRU should evict 3 next. + cache.Get(keys[2]) + cache.Put(keys[0], &cs[0]) + if s, ok := cache.Get(keys[3]); ok || s != nil { + t.Fatalf("session cache should have evicted key 3") + } + + // Update entry 0 in place. + cache.Put(keys[0], &cs[3]) + if s, ok := cache.Get(keys[0]); !ok || s != &cs[3] { + t.Fatalf("session cache failed update for key 0") + } + + // Calling Put with a nil entry deletes the key. + cache.Put(keys[0], nil) + if _, ok := cache.Get(keys[0]); ok { + t.Fatalf("session cache failed to delete key 0") + } + + // Delete entry 2. LRU should keep 4 and 5 + cache.Put(keys[2], nil) + if _, ok := cache.Get(keys[2]); ok { + t.Fatalf("session cache failed to delete key 4") + } + for i := 4; i < 6; i++ { + if s, ok := cache.Get(keys[i]); !ok || s != &cs[i] { + t.Fatalf("session cache should not have deleted key: %s", keys[i]) + } + } +} + +func TestKeyLogTLS12(t *testing.T) { + var serverBuf, clientBuf bytes.Buffer + + clientConfig := testConfig.Clone() + clientConfig.KeyLogWriter = &clientBuf + clientConfig.MaxVersion = VersionTLS12 + + serverConfig := testConfig.Clone() + serverConfig.KeyLogWriter = &serverBuf + serverConfig.MaxVersion = VersionTLS12 + + c, s := localPipe(t) + done := make(chan bool) + + go func() { + defer close(done) + + if err := Server(s, serverConfig).Handshake(); err != nil { + t.Errorf("server: %s", err) + return + } + s.Close() + }() + + if err := Client(c, clientConfig).Handshake(); err != nil { + t.Fatalf("client: %s", err) + } + + c.Close() + <-done + + checkKeylogLine := func(side, loggedLine string) { + if len(loggedLine) == 0 { + t.Fatalf("%s: no keylog line was produced", side) + } + const expectedLen = 13 /* "CLIENT_RANDOM" */ + + 1 /* space */ + + 32*2 /* hex client nonce */ + + 1 /* space */ + + 48*2 /* hex master secret */ + + 1 /* new line */ + if len(loggedLine) != expectedLen { + t.Fatalf("%s: keylog line has incorrect length (want %d, got %d): %q", side, expectedLen, len(loggedLine), loggedLine) + } + if !strings.HasPrefix(loggedLine, "CLIENT_RANDOM "+strings.Repeat("0", 64)+" ") { + t.Fatalf("%s: keylog line has incorrect structure or nonce: %q", side, loggedLine) + } + } + + checkKeylogLine("client", clientBuf.String()) + checkKeylogLine("server", serverBuf.String()) +} + +func TestKeyLogTLS13(t *testing.T) { + var serverBuf, clientBuf bytes.Buffer + + clientConfig := testConfig.Clone() + clientConfig.KeyLogWriter = &clientBuf + + serverConfig := testConfig.Clone() + serverConfig.KeyLogWriter = &serverBuf + + c, s := localPipe(t) + done := make(chan bool) + + go func() { + defer close(done) + + if err := Server(s, serverConfig).Handshake(); err != nil { + t.Errorf("server: %s", err) + return + } + s.Close() + }() + + if err := Client(c, clientConfig).Handshake(); err != nil { + t.Fatalf("client: %s", err) + } + + c.Close() + <-done + + checkKeylogLines := func(side, loggedLines string) { + loggedLines = strings.TrimSpace(loggedLines) + lines := strings.Split(loggedLines, "\n") + if len(lines) != 4 { + t.Errorf("Expected the %s to log 4 lines, got %d", side, len(lines)) + } + } + + checkKeylogLines("client", clientBuf.String()) + checkKeylogLines("server", serverBuf.String()) +} + +func TestHandshakeClientALPNMatch(t *testing.T) { + config := testConfig.Clone() + config.NextProtos = []string{"proto2", "proto1"} + + test := &clientTest{ + name: "ALPN", + // Note that this needs OpenSSL 1.0.2 because that is the first + // version that supports the -alpn flag. + args: []string{"-alpn", "proto1,proto2"}, + config: config, + validate: func(state ConnectionState) error { + // The server's preferences should override the client. + if state.NegotiatedProtocol != "proto1" { + return fmt.Errorf("Got protocol %q, wanted proto1", state.NegotiatedProtocol) + } + return nil + }, + } + runClientTestTLS12(t, test) + runClientTestTLS13(t, test) +} + +func TestServerSelectingUnconfiguredApplicationProtocol(t *testing.T) { + // This checks that the server can't select an application protocol that the + // client didn't offer. + + c, s := localPipe(t) + errChan := make(chan error, 1) + + go func() { + client := Client(c, &Config{ + ServerName: "foo", + CipherSuites: []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256}, + NextProtos: []string{"http", "something-else"}, + }) + errChan <- client.Handshake() + }() + + var header [5]byte + if _, err := io.ReadFull(s, header[:]); err != nil { + t.Fatal(err) + } + recordLen := int(header[3])<<8 | int(header[4]) + + record := make([]byte, recordLen) + if _, err := io.ReadFull(s, record); err != nil { + t.Fatal(err) + } + + serverHello := &serverHelloMsg{ + vers: VersionTLS12, + random: make([]byte, 32), + cipherSuite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + alpnProtocol: "how-about-this", + } + serverHelloBytes := mustMarshal(t, serverHello) + + s.Write([]byte{ + byte(recordTypeHandshake), + byte(VersionTLS12 >> 8), + byte(VersionTLS12 & 0xff), + byte(len(serverHelloBytes) >> 8), + byte(len(serverHelloBytes)), + }) + s.Write(serverHelloBytes) + s.Close() + + if err := <-errChan; !strings.Contains(err.Error(), "server selected unadvertised ALPN protocol") { + t.Fatalf("Expected error about unconfigured ALPN protocol but got %q", err) + } +} + +// sctsBase64 contains data from `openssl s_client -serverinfo 18 -connect ritter.vg:443` +const sctsBase64 = "ABIBaQFnAHUApLkJkLQYWBSHuxOizGdwCjw1mAT5G9+443fNDsgN3BAAAAFHl5nuFgAABAMARjBEAiAcS4JdlW5nW9sElUv2zvQyPoZ6ejKrGGB03gjaBZFMLwIgc1Qbbn+hsH0RvObzhS+XZhr3iuQQJY8S9G85D9KeGPAAdgBo9pj4H2SCvjqM7rkoHUz8cVFdZ5PURNEKZ6y7T0/7xAAAAUeX4bVwAAAEAwBHMEUCIDIhFDgG2HIuADBkGuLobU5a4dlCHoJLliWJ1SYT05z6AiEAjxIoZFFPRNWMGGIjskOTMwXzQ1Wh2e7NxXE1kd1J0QsAdgDuS723dc5guuFCaR+r4Z5mow9+X7By2IMAxHuJeqj9ywAAAUhcZIqHAAAEAwBHMEUCICmJ1rBT09LpkbzxtUC+Hi7nXLR0J+2PmwLp+sJMuqK+AiEAr0NkUnEVKVhAkccIFpYDqHOlZaBsuEhWWrYpg2RtKp0=" + +func TestHandshakClientSCTs(t *testing.T) { + config := testConfig.Clone() + + scts, err := base64.StdEncoding.DecodeString(sctsBase64) + if err != nil { + t.Fatal(err) + } + + // Note that this needs OpenSSL 1.0.2 because that is the first + // version that supports the -serverinfo flag. + test := &clientTest{ + name: "SCT", + config: config, + extensions: [][]byte{scts}, + validate: func(state ConnectionState) error { + expectedSCTs := [][]byte{ + scts[8:125], + scts[127:245], + scts[247:], + } + if n := len(state.SignedCertificateTimestamps); n != len(expectedSCTs) { + return fmt.Errorf("Got %d scts, wanted %d", n, len(expectedSCTs)) + } + for i, expected := range expectedSCTs { + if sct := state.SignedCertificateTimestamps[i]; !bytes.Equal(sct, expected) { + return fmt.Errorf("SCT #%d contained %x, expected %x", i, sct, expected) + } + } + return nil + }, + } + runClientTestTLS12(t, test) + + // TLS 1.3 moved SCTs to the Certificate extensions and -serverinfo only + // supports ServerHello extensions. +} + +func TestRenegotiationRejected(t *testing.T) { + config := testConfig.Clone() + test := &clientTest{ + name: "RenegotiationRejected", + args: []string{"-state"}, + config: config, + numRenegotiations: 1, + renegotiationExpectedToFail: 1, + checkRenegotiationError: func(renegotiationNum int, err error) error { + if err == nil { + return errors.New("expected error from renegotiation but got nil") + } + if !strings.Contains(err.Error(), "no renegotiation") { + return fmt.Errorf("expected renegotiation to be rejected but got %q", err) + } + return nil + }, + } + runClientTestTLS12(t, test) +} + +func TestRenegotiateOnce(t *testing.T) { + config := testConfig.Clone() + config.Renegotiation = RenegotiateOnceAsClient + + test := &clientTest{ + name: "RenegotiateOnce", + args: []string{"-state"}, + config: config, + numRenegotiations: 1, + } + + runClientTestTLS12(t, test) +} + +func TestRenegotiateTwice(t *testing.T) { + config := testConfig.Clone() + config.Renegotiation = RenegotiateFreelyAsClient + + test := &clientTest{ + name: "RenegotiateTwice", + args: []string{"-state"}, + config: config, + numRenegotiations: 2, + } + + runClientTestTLS12(t, test) +} + +func TestRenegotiateTwiceRejected(t *testing.T) { + config := testConfig.Clone() + config.Renegotiation = RenegotiateOnceAsClient + + test := &clientTest{ + name: "RenegotiateTwiceRejected", + args: []string{"-state"}, + config: config, + numRenegotiations: 2, + renegotiationExpectedToFail: 2, + checkRenegotiationError: func(renegotiationNum int, err error) error { + if renegotiationNum == 1 { + return err + } + + if err == nil { + return errors.New("expected error from renegotiation but got nil") + } + if !strings.Contains(err.Error(), "no renegotiation") { + return fmt.Errorf("expected renegotiation to be rejected but got %q", err) + } + return nil + }, + } + + runClientTestTLS12(t, test) +} + +func TestHandshakeClientExportKeyingMaterial(t *testing.T) { + test := &clientTest{ + name: "ExportKeyingMaterial", + config: testConfig.Clone(), + validate: func(state ConnectionState) error { + if km, err := state.ExportKeyingMaterial("test", nil, 42); err != nil { + return fmt.Errorf("ExportKeyingMaterial failed: %v", err) + } else if len(km) != 42 { + return fmt.Errorf("Got %d bytes from ExportKeyingMaterial, wanted %d", len(km), 42) + } + return nil + }, + } + runClientTestTLS10(t, test) + runClientTestTLS12(t, test) + runClientTestTLS13(t, test) +} + +var hostnameInSNITests = []struct { + in, out string +}{ + // Opaque string + {"", ""}, + {"localhost", "localhost"}, + {"foo, bar, baz and qux", "foo, bar, baz and qux"}, + + // DNS hostname + {"golang.org", "golang.org"}, + {"golang.org.", "golang.org"}, + + // Literal IPv4 address + {"1.2.3.4", ""}, + + // Literal IPv6 address + {"::1", ""}, + {"::1%lo0", ""}, // with zone identifier + {"[::1]", ""}, // as per RFC 5952 we allow the [] style as IPv6 literal + {"[::1%lo0]", ""}, +} + +func TestHostnameInSNI(t *testing.T) { + for _, tt := range hostnameInSNITests { + c, s := localPipe(t) + + go func(host string) { + Client(c, &Config{ServerName: host, InsecureSkipVerify: true}).Handshake() + }(tt.in) + + var header [5]byte + if _, err := io.ReadFull(s, header[:]); err != nil { + t.Fatal(err) + } + recordLen := int(header[3])<<8 | int(header[4]) + + record := make([]byte, recordLen) + if _, err := io.ReadFull(s, record[:]); err != nil { + t.Fatal(err) + } + + c.Close() + s.Close() + + var m clientHelloMsg + if !m.unmarshal(record) { + t.Errorf("unmarshaling ClientHello for %q failed", tt.in) + continue + } + if tt.in != tt.out && m.serverName == tt.in { + t.Errorf("prohibited %q found in ClientHello: %x", tt.in, record) + } + if m.serverName != tt.out { + t.Errorf("expected %q not found in ClientHello: %x", tt.out, record) + } + } +} + +func TestServerSelectingUnconfiguredCipherSuite(t *testing.T) { + // This checks that the server can't select a cipher suite that the + // client didn't offer. See #13174. + + c, s := localPipe(t) + errChan := make(chan error, 1) + + go func() { + client := Client(c, &Config{ + ServerName: "foo", + CipherSuites: []uint16{TLS_RSA_WITH_AES_128_GCM_SHA256}, + }) + errChan <- client.Handshake() + }() + + var header [5]byte + if _, err := io.ReadFull(s, header[:]); err != nil { + t.Fatal(err) + } + recordLen := int(header[3])<<8 | int(header[4]) + + record := make([]byte, recordLen) + if _, err := io.ReadFull(s, record); err != nil { + t.Fatal(err) + } + + // Create a ServerHello that selects a different cipher suite than the + // sole one that the client offered. + serverHello := &serverHelloMsg{ + vers: VersionTLS12, + random: make([]byte, 32), + cipherSuite: TLS_RSA_WITH_AES_256_GCM_SHA384, + } + serverHelloBytes := mustMarshal(t, serverHello) + + s.Write([]byte{ + byte(recordTypeHandshake), + byte(VersionTLS12 >> 8), + byte(VersionTLS12 & 0xff), + byte(len(serverHelloBytes) >> 8), + byte(len(serverHelloBytes)), + }) + s.Write(serverHelloBytes) + s.Close() + + if err := <-errChan; !strings.Contains(err.Error(), "unconfigured cipher") { + t.Fatalf("Expected error about unconfigured cipher suite but got %q", err) + } +} + +func TestVerifyConnection(t *testing.T) { + t.Run("TLSv12", func(t *testing.T) { testVerifyConnection(t, VersionTLS12) }) + t.Run("TLSv13", func(t *testing.T) { testVerifyConnection(t, VersionTLS13) }) +} + +func testVerifyConnection(t *testing.T, version uint16) { + checkFields := func(c ConnectionState, called *int, errorType string) error { + if c.Version != version { + return fmt.Errorf("%s: got Version %v, want %v", errorType, c.Version, version) + } + if c.HandshakeComplete { + return fmt.Errorf("%s: got HandshakeComplete, want false", errorType) + } + if c.ServerName != "example.golang" { + return fmt.Errorf("%s: got ServerName %s, want %s", errorType, c.ServerName, "example.golang") + } + if c.NegotiatedProtocol != "protocol1" { + return fmt.Errorf("%s: got NegotiatedProtocol %s, want %s", errorType, c.NegotiatedProtocol, "protocol1") + } + if c.CipherSuite == 0 { + return fmt.Errorf("%s: got CipherSuite 0, want non-zero", errorType) + } + wantDidResume := false + if *called == 2 { // if this is the second time, then it should be a resumption + wantDidResume = true + } + if c.DidResume != wantDidResume { + return fmt.Errorf("%s: got DidResume %t, want %t", errorType, c.DidResume, wantDidResume) + } + return nil + } + + tests := []struct { + name string + configureServer func(*Config, *int) + configureClient func(*Config, *int) + }{ + { + name: "RequireAndVerifyClientCert", + configureServer: func(config *Config, called *int) { + config.ClientAuth = RequireAndVerifyClientCert + config.VerifyConnection = func(c ConnectionState) error { + *called++ + if l := len(c.PeerCertificates); l != 1 { + return fmt.Errorf("server: got len(PeerCertificates) = %d, wanted 1", l) + } + if len(c.VerifiedChains) == 0 { + return fmt.Errorf("server: got len(VerifiedChains) = 0, wanted non-zero") + } + return checkFields(c, called, "server") + } + }, + configureClient: func(config *Config, called *int) { + config.VerifyConnection = func(c ConnectionState) error { + *called++ + if l := len(c.PeerCertificates); l != 1 { + return fmt.Errorf("client: got len(PeerCertificates) = %d, wanted 1", l) + } + if len(c.VerifiedChains) == 0 { + return fmt.Errorf("client: got len(VerifiedChains) = 0, wanted non-zero") + } + if c.DidResume { + return nil + // The SCTs and OCSP Response are dropped on resumption. + // See http://golang.org/issue/39075. + } + if len(c.OCSPResponse) == 0 { + return fmt.Errorf("client: got len(OCSPResponse) = 0, wanted non-zero") + } + if len(c.SignedCertificateTimestamps) == 0 { + return fmt.Errorf("client: got len(SignedCertificateTimestamps) = 0, wanted non-zero") + } + return checkFields(c, called, "client") + } + }, + }, + { + name: "InsecureSkipVerify", + configureServer: func(config *Config, called *int) { + config.ClientAuth = RequireAnyClientCert + config.InsecureSkipVerify = true + config.VerifyConnection = func(c ConnectionState) error { + *called++ + if l := len(c.PeerCertificates); l != 1 { + return fmt.Errorf("server: got len(PeerCertificates) = %d, wanted 1", l) + } + if c.VerifiedChains != nil { + return fmt.Errorf("server: got Verified Chains %v, want nil", c.VerifiedChains) + } + return checkFields(c, called, "server") + } + }, + configureClient: func(config *Config, called *int) { + config.InsecureSkipVerify = true + config.VerifyConnection = func(c ConnectionState) error { + *called++ + if l := len(c.PeerCertificates); l != 1 { + return fmt.Errorf("client: got len(PeerCertificates) = %d, wanted 1", l) + } + if c.VerifiedChains != nil { + return fmt.Errorf("server: got Verified Chains %v, want nil", c.VerifiedChains) + } + if c.DidResume { + return nil + // The SCTs and OCSP Response are dropped on resumption. + // See http://golang.org/issue/39075. + } + if len(c.OCSPResponse) == 0 { + return fmt.Errorf("client: got len(OCSPResponse) = 0, wanted non-zero") + } + if len(c.SignedCertificateTimestamps) == 0 { + return fmt.Errorf("client: got len(SignedCertificateTimestamps) = 0, wanted non-zero") + } + return checkFields(c, called, "client") + } + }, + }, + { + name: "NoClientCert", + configureServer: func(config *Config, called *int) { + config.ClientAuth = NoClientCert + config.VerifyConnection = func(c ConnectionState) error { + *called++ + return checkFields(c, called, "server") + } + }, + configureClient: func(config *Config, called *int) { + config.VerifyConnection = func(c ConnectionState) error { + *called++ + return checkFields(c, called, "client") + } + }, + }, + { + name: "RequestClientCert", + configureServer: func(config *Config, called *int) { + config.ClientAuth = RequestClientCert + config.VerifyConnection = func(c ConnectionState) error { + *called++ + return checkFields(c, called, "server") + } + }, + configureClient: func(config *Config, called *int) { + config.Certificates = nil // clear the client cert + config.VerifyConnection = func(c ConnectionState) error { + *called++ + if l := len(c.PeerCertificates); l != 1 { + return fmt.Errorf("client: got len(PeerCertificates) = %d, wanted 1", l) + } + if len(c.VerifiedChains) == 0 { + return fmt.Errorf("client: got len(VerifiedChains) = 0, wanted non-zero") + } + if c.DidResume { + return nil + // The SCTs and OCSP Response are dropped on resumption. + // See http://golang.org/issue/39075. + } + if len(c.OCSPResponse) == 0 { + return fmt.Errorf("client: got len(OCSPResponse) = 0, wanted non-zero") + } + if len(c.SignedCertificateTimestamps) == 0 { + return fmt.Errorf("client: got len(SignedCertificateTimestamps) = 0, wanted non-zero") + } + return checkFields(c, called, "client") + } + }, + }, + } + for _, test := range tests { + // Note: using RSA 2048 test certificates because they are compatible with FIPS mode. + testCertificates := []Certificate{{Certificate: [][]byte{testRSA2048Certificate}, PrivateKey: testRSA2048PrivateKey}} + + issuer, err := x509.ParseCertificate(testRSA2048CertificateIssuer) + if err != nil { + panic(err) + } + rootCAs := x509.NewCertPool() + rootCAs.AddCert(issuer) + + var serverCalled, clientCalled int + + serverConfig := &Config{ + MaxVersion: version, + Certificates: testCertificates, + Time: testTime, + ClientCAs: rootCAs, + NextProtos: []string{"protocol1"}, + } + serverConfig.Certificates[0].SignedCertificateTimestamps = [][]byte{[]byte("dummy sct 1"), []byte("dummy sct 2")} + serverConfig.Certificates[0].OCSPStaple = []byte("dummy ocsp") + test.configureServer(serverConfig, &serverCalled) + + clientConfig := &Config{ + MaxVersion: version, + ClientSessionCache: NewLRUClientSessionCache(32), + RootCAs: rootCAs, + ServerName: "example.golang", + Certificates: testCertificates, + Time: testTime, + NextProtos: []string{"protocol1"}, + } + test.configureClient(clientConfig, &clientCalled) + + testHandshakeState := func(name string, didResume bool) { + _, hs, err := testHandshake(t, clientConfig, serverConfig) + if err != nil { + t.Fatalf("%s: handshake failed: %s", name, err) + } + if hs.DidResume != didResume { + t.Errorf("%s: resumed: %v, expected: %v", name, hs.DidResume, didResume) + } + wantCalled := 1 + if didResume { + wantCalled = 2 // resumption would mean this is the second time it was called in this test + } + if clientCalled != wantCalled { + t.Errorf("%s: expected client VerifyConnection called %d times, did %d times", name, wantCalled, clientCalled) + } + if serverCalled != wantCalled { + t.Errorf("%s: expected server VerifyConnection called %d times, did %d times", name, wantCalled, serverCalled) + } + } + testHandshakeState(fmt.Sprintf("%s-FullHandshake", test.name), false) + testHandshakeState(fmt.Sprintf("%s-Resumption", test.name), true) + } +} + +func TestVerifyPeerCertificate(t *testing.T) { + t.Run("TLSv12", func(t *testing.T) { testVerifyPeerCertificate(t, VersionTLS12) }) + t.Run("TLSv13", func(t *testing.T) { testVerifyPeerCertificate(t, VersionTLS13) }) +} + +func testVerifyPeerCertificate(t *testing.T, version uint16) { + // Note: using RSA 2048 test certificates because they are compatible with FIPS mode. + issuer, err := x509.ParseCertificate(testRSA2048CertificateIssuer) + if err != nil { + panic(err) + } + + rootCAs := x509.NewCertPool() + rootCAs.AddCert(issuer) + + sentinelErr := errors.New("TestVerifyPeerCertificate") + + verifyPeerCertificateCallback := func(called *bool, rawCerts [][]byte, validatedChains [][]*x509.Certificate) error { + if l := len(rawCerts); l != 1 { + return fmt.Errorf("got len(rawCerts) = %d, wanted 1", l) + } + if len(validatedChains) == 0 { + return errors.New("got len(validatedChains) = 0, wanted non-zero") + } + *called = true + return nil + } + verifyConnectionCallback := func(called *bool, isClient bool, c ConnectionState) error { + if l := len(c.PeerCertificates); l != 1 { + return fmt.Errorf("got len(PeerCertificates) = %d, wanted 1", l) + } + if len(c.VerifiedChains) == 0 { + return fmt.Errorf("got len(VerifiedChains) = 0, wanted non-zero") + } + if isClient && len(c.OCSPResponse) == 0 { + return fmt.Errorf("got len(OCSPResponse) = 0, wanted non-zero") + } + *called = true + return nil + } + + tests := []struct { + configureServer func(*Config, *bool) + configureClient func(*Config, *bool) + validate func(t *testing.T, testNo int, clientCalled, serverCalled bool, clientErr, serverErr error) + }{ + { + configureServer: func(config *Config, called *bool) { + config.InsecureSkipVerify = false + config.VerifyPeerCertificate = func(rawCerts [][]byte, validatedChains [][]*x509.Certificate) error { + return verifyPeerCertificateCallback(called, rawCerts, validatedChains) + } + }, + configureClient: func(config *Config, called *bool) { + config.InsecureSkipVerify = false + config.VerifyPeerCertificate = func(rawCerts [][]byte, validatedChains [][]*x509.Certificate) error { + return verifyPeerCertificateCallback(called, rawCerts, validatedChains) + } + }, + validate: func(t *testing.T, testNo int, clientCalled, serverCalled bool, clientErr, serverErr error) { + if clientErr != nil { + t.Errorf("test[%d]: client handshake failed: %v", testNo, clientErr) + } + if serverErr != nil { + t.Errorf("test[%d]: server handshake failed: %v", testNo, serverErr) + } + if !clientCalled { + t.Errorf("test[%d]: client did not call callback", testNo) + } + if !serverCalled { + t.Errorf("test[%d]: server did not call callback", testNo) + } + }, + }, + { + configureServer: func(config *Config, called *bool) { + config.InsecureSkipVerify = false + config.VerifyPeerCertificate = func(rawCerts [][]byte, validatedChains [][]*x509.Certificate) error { + return sentinelErr + } + }, + configureClient: func(config *Config, called *bool) { + config.VerifyPeerCertificate = nil + }, + validate: func(t *testing.T, testNo int, clientCalled, serverCalled bool, clientErr, serverErr error) { + if serverErr != sentinelErr { + t.Errorf("#%d: got server error %v, wanted sentinelErr", testNo, serverErr) + } + }, + }, + { + configureServer: func(config *Config, called *bool) { + config.InsecureSkipVerify = false + }, + configureClient: func(config *Config, called *bool) { + config.VerifyPeerCertificate = func(rawCerts [][]byte, validatedChains [][]*x509.Certificate) error { + return sentinelErr + } + }, + validate: func(t *testing.T, testNo int, clientCalled, serverCalled bool, clientErr, serverErr error) { + if clientErr != sentinelErr { + t.Errorf("#%d: got client error %v, wanted sentinelErr", testNo, clientErr) + } + }, + }, + { + configureServer: func(config *Config, called *bool) { + config.InsecureSkipVerify = false + }, + configureClient: func(config *Config, called *bool) { + config.InsecureSkipVerify = true + config.VerifyPeerCertificate = func(rawCerts [][]byte, validatedChains [][]*x509.Certificate) error { + if l := len(rawCerts); l != 1 { + return fmt.Errorf("got len(rawCerts) = %d, wanted 1", l) + } + // With InsecureSkipVerify set, this + // callback should still be called but + // validatedChains must be empty. + if l := len(validatedChains); l != 0 { + return fmt.Errorf("got len(validatedChains) = %d, wanted zero", l) + } + *called = true + return nil + } + }, + validate: func(t *testing.T, testNo int, clientCalled, serverCalled bool, clientErr, serverErr error) { + if clientErr != nil { + t.Errorf("test[%d]: client handshake failed: %v", testNo, clientErr) + } + if serverErr != nil { + t.Errorf("test[%d]: server handshake failed: %v", testNo, serverErr) + } + if !clientCalled { + t.Errorf("test[%d]: client did not call callback", testNo) + } + }, + }, + { + configureServer: func(config *Config, called *bool) { + config.InsecureSkipVerify = false + config.VerifyConnection = func(c ConnectionState) error { + return verifyConnectionCallback(called, false, c) + } + }, + configureClient: func(config *Config, called *bool) { + config.InsecureSkipVerify = false + config.VerifyConnection = func(c ConnectionState) error { + return verifyConnectionCallback(called, true, c) + } + }, + validate: func(t *testing.T, testNo int, clientCalled, serverCalled bool, clientErr, serverErr error) { + if clientErr != nil { + t.Errorf("test[%d]: client handshake failed: %v", testNo, clientErr) + } + if serverErr != nil { + t.Errorf("test[%d]: server handshake failed: %v", testNo, serverErr) + } + if !clientCalled { + t.Errorf("test[%d]: client did not call callback", testNo) + } + if !serverCalled { + t.Errorf("test[%d]: server did not call callback", testNo) + } + }, + }, + { + configureServer: func(config *Config, called *bool) { + config.InsecureSkipVerify = false + config.VerifyConnection = func(c ConnectionState) error { + return sentinelErr + } + }, + configureClient: func(config *Config, called *bool) { + config.InsecureSkipVerify = false + config.VerifyConnection = nil + }, + validate: func(t *testing.T, testNo int, clientCalled, serverCalled bool, clientErr, serverErr error) { + if serverErr != sentinelErr { + t.Errorf("#%d: got server error %v, wanted sentinelErr", testNo, serverErr) + } + }, + }, + { + configureServer: func(config *Config, called *bool) { + config.InsecureSkipVerify = false + config.VerifyConnection = nil + }, + configureClient: func(config *Config, called *bool) { + config.InsecureSkipVerify = false + config.VerifyConnection = func(c ConnectionState) error { + return sentinelErr + } + }, + validate: func(t *testing.T, testNo int, clientCalled, serverCalled bool, clientErr, serverErr error) { + if clientErr != sentinelErr { + t.Errorf("#%d: got client error %v, wanted sentinelErr", testNo, clientErr) + } + }, + }, + { + configureServer: func(config *Config, called *bool) { + config.InsecureSkipVerify = false + config.VerifyPeerCertificate = func(rawCerts [][]byte, validatedChains [][]*x509.Certificate) error { + return verifyPeerCertificateCallback(called, rawCerts, validatedChains) + } + config.VerifyConnection = func(c ConnectionState) error { + return sentinelErr + } + }, + configureClient: func(config *Config, called *bool) { + config.InsecureSkipVerify = false + config.VerifyPeerCertificate = nil + config.VerifyConnection = nil + }, + validate: func(t *testing.T, testNo int, clientCalled, serverCalled bool, clientErr, serverErr error) { + if serverErr != sentinelErr { + t.Errorf("#%d: got server error %v, wanted sentinelErr", testNo, serverErr) + } + if !serverCalled { + t.Errorf("test[%d]: server did not call callback", testNo) + } + }, + }, + { + configureServer: func(config *Config, called *bool) { + config.InsecureSkipVerify = false + config.VerifyPeerCertificate = nil + config.VerifyConnection = nil + }, + configureClient: func(config *Config, called *bool) { + config.InsecureSkipVerify = false + config.VerifyPeerCertificate = func(rawCerts [][]byte, validatedChains [][]*x509.Certificate) error { + return verifyPeerCertificateCallback(called, rawCerts, validatedChains) + } + config.VerifyConnection = func(c ConnectionState) error { + return sentinelErr + } + }, + validate: func(t *testing.T, testNo int, clientCalled, serverCalled bool, clientErr, serverErr error) { + if clientErr != sentinelErr { + t.Errorf("#%d: got client error %v, wanted sentinelErr", testNo, clientErr) + } + if !clientCalled { + t.Errorf("test[%d]: client did not call callback", testNo) + } + }, + }, + } + + for i, test := range tests { + c, s := localPipe(t) + done := make(chan error) + + var clientCalled, serverCalled bool + + go func() { + config := testConfig.Clone() + config.ServerName = "example.golang" + config.ClientAuth = RequireAndVerifyClientCert + config.ClientCAs = rootCAs + config.Time = testTime + config.MaxVersion = version + config.Certificates = make([]Certificate, 1) + config.Certificates[0].Certificate = [][]byte{testRSA2048Certificate} + config.Certificates[0].PrivateKey = testRSA2048PrivateKey + config.Certificates[0].SignedCertificateTimestamps = [][]byte{[]byte("dummy sct 1"), []byte("dummy sct 2")} + config.Certificates[0].OCSPStaple = []byte("dummy ocsp") + test.configureServer(config, &serverCalled) + + err = Server(s, config).Handshake() + s.Close() + done <- err + }() + + config := testConfig.Clone() + config.Certificates = []Certificate{{Certificate: [][]byte{testRSA2048Certificate}, PrivateKey: testRSA2048PrivateKey}} + config.ServerName = "example.golang" + config.RootCAs = rootCAs + config.Time = testTime + config.MaxVersion = version + test.configureClient(config, &clientCalled) + clientErr := Client(c, config).Handshake() + c.Close() + serverErr := <-done + + test.validate(t, i, clientCalled, serverCalled, clientErr, serverErr) + } +} + +// brokenConn wraps a net.Conn and causes all Writes after a certain number to +// fail with brokenConnErr. +type brokenConn struct { + net.Conn + + // breakAfter is the number of successful writes that will be allowed + // before all subsequent writes fail. + breakAfter int + + // numWrites is the number of writes that have been done. + numWrites int +} + +// brokenConnErr is the error that brokenConn returns once exhausted. +var brokenConnErr = errors.New("too many writes to brokenConn") + +func (b *brokenConn) Write(data []byte) (int, error) { + if b.numWrites >= b.breakAfter { + return 0, brokenConnErr + } + + b.numWrites++ + return b.Conn.Write(data) +} + +func TestFailedWrite(t *testing.T) { + // Test that a write error during the handshake is returned. + for _, breakAfter := range []int{0, 1} { + c, s := localPipe(t) + done := make(chan bool) + + go func() { + Server(s, testConfig).Handshake() + s.Close() + done <- true + }() + + brokenC := &brokenConn{Conn: c, breakAfter: breakAfter} + err := Client(brokenC, testConfig).Handshake() + if err != brokenConnErr { + t.Errorf("#%d: expected error from brokenConn but got %q", breakAfter, err) + } + brokenC.Close() + + <-done + } +} + +// writeCountingConn wraps a net.Conn and counts the number of Write calls. +type writeCountingConn struct { + net.Conn + + // numWrites is the number of writes that have been done. + numWrites int +} + +func (wcc *writeCountingConn) Write(data []byte) (int, error) { + wcc.numWrites++ + return wcc.Conn.Write(data) +} + +func TestBuffering(t *testing.T) { + t.Run("TLSv12", func(t *testing.T) { testBuffering(t, VersionTLS12) }) + t.Run("TLSv13", func(t *testing.T) { testBuffering(t, VersionTLS13) }) +} + +func testBuffering(t *testing.T, version uint16) { + c, s := localPipe(t) + done := make(chan bool) + + clientWCC := &writeCountingConn{Conn: c} + serverWCC := &writeCountingConn{Conn: s} + + go func() { + config := testConfig.Clone() + config.MaxVersion = version + Server(serverWCC, config).Handshake() + serverWCC.Close() + done <- true + }() + + err := Client(clientWCC, testConfig).Handshake() + if err != nil { + t.Fatal(err) + } + clientWCC.Close() + <-done + + var expectedClient, expectedServer int + if version == VersionTLS13 { + expectedClient = 2 + expectedServer = 1 + } else { + expectedClient = 2 + expectedServer = 2 + } + + if n := clientWCC.numWrites; n != expectedClient { + t.Errorf("expected client handshake to complete with %d writes, but saw %d", expectedClient, n) + } + + if n := serverWCC.numWrites; n != expectedServer { + t.Errorf("expected server handshake to complete with %d writes, but saw %d", expectedServer, n) + } +} + +func TestAlertFlushing(t *testing.T) { + c, s := localPipe(t) + done := make(chan bool) + + clientWCC := &writeCountingConn{Conn: c} + serverWCC := &writeCountingConn{Conn: s} + + serverConfig := testConfig.Clone() + + // Cause a signature-time error + brokenKey := rsa.PrivateKey{PublicKey: testRSAPrivateKey.PublicKey} + brokenKey.D = big.NewInt(42) + serverConfig.Certificates = []Certificate{{ + Certificate: [][]byte{testRSACertificate}, + PrivateKey: &brokenKey, + }} + + go func() { + Server(serverWCC, serverConfig).Handshake() + serverWCC.Close() + done <- true + }() + + err := Client(clientWCC, testConfig).Handshake() + if err == nil { + t.Fatal("client unexpectedly returned no error") + } + + const expectedError = "remote error: tls: internal error" + if e := err.Error(); !strings.Contains(e, expectedError) { + t.Fatalf("expected to find %q in error but error was %q", expectedError, e) + } + clientWCC.Close() + <-done + + if n := serverWCC.numWrites; n != 1 { + t.Errorf("expected server handshake to complete with one write, but saw %d", n) + } +} + +func TestHandshakeRace(t *testing.T) { + if testing.Short() { + t.Skip("skipping in -short mode") + } + t.Parallel() + // This test races a Read and Write to try and complete a handshake in + // order to provide some evidence that there are no races or deadlocks + // in the handshake locking. + for i := 0; i < 32; i++ { + c, s := localPipe(t) + + go func() { + server := Server(s, testConfig) + if err := server.Handshake(); err != nil { + panic(err) + } + + var request [1]byte + if n, err := server.Read(request[:]); err != nil || n != 1 { + panic(err) + } + + server.Write(request[:]) + server.Close() + }() + + startWrite := make(chan struct{}) + startRead := make(chan struct{}) + readDone := make(chan struct{}, 1) + + client := Client(c, testConfig) + go func() { + <-startWrite + var request [1]byte + client.Write(request[:]) + }() + + go func() { + <-startRead + var reply [1]byte + if _, err := io.ReadFull(client, reply[:]); err != nil { + panic(err) + } + c.Close() + readDone <- struct{}{} + }() + + if i&1 == 1 { + startWrite <- struct{}{} + startRead <- struct{}{} + } else { + startRead <- struct{}{} + startWrite <- struct{}{} + } + <-readDone + } +} + +var getClientCertificateTests = []struct { + setup func(*Config, *Config) + expectedClientError string + verify func(*testing.T, int, *ConnectionState) +}{ + { + func(clientConfig, serverConfig *Config) { + // Returning a Certificate with no certificate data + // should result in an empty message being sent to the + // server. + serverConfig.ClientCAs = nil + clientConfig.GetClientCertificate = func(cri *CertificateRequestInfo) (*Certificate, error) { + if len(cri.SignatureSchemes) == 0 { + panic("empty SignatureSchemes") + } + if len(cri.AcceptableCAs) != 0 { + panic("AcceptableCAs should have been empty") + } + return new(Certificate), nil + } + }, + "", + func(t *testing.T, testNum int, cs *ConnectionState) { + if l := len(cs.PeerCertificates); l != 0 { + t.Errorf("#%d: expected no certificates but got %d", testNum, l) + } + }, + }, + { + func(clientConfig, serverConfig *Config) { + // With TLS 1.1, the SignatureSchemes should be + // synthesised from the supported certificate types. + clientConfig.MaxVersion = VersionTLS11 + clientConfig.GetClientCertificate = func(cri *CertificateRequestInfo) (*Certificate, error) { + if len(cri.SignatureSchemes) == 0 { + panic("empty SignatureSchemes") + } + return new(Certificate), nil + } + }, + "", + func(t *testing.T, testNum int, cs *ConnectionState) { + if l := len(cs.PeerCertificates); l != 0 { + t.Errorf("#%d: expected no certificates but got %d", testNum, l) + } + }, + }, + { + func(clientConfig, serverConfig *Config) { + // Returning an error should abort the handshake with + // that error. + clientConfig.GetClientCertificate = func(cri *CertificateRequestInfo) (*Certificate, error) { + return nil, errors.New("GetClientCertificate") + } + }, + "GetClientCertificate", + func(t *testing.T, testNum int, cs *ConnectionState) { + }, + }, + { + func(clientConfig, serverConfig *Config) { + clientConfig.GetClientCertificate = func(cri *CertificateRequestInfo) (*Certificate, error) { + if len(cri.AcceptableCAs) == 0 { + panic("empty AcceptableCAs") + } + cert := &Certificate{ + Certificate: [][]byte{testRSA2048Certificate}, + PrivateKey: testRSA2048PrivateKey, + } + return cert, nil + } + }, + "", + func(t *testing.T, testNum int, cs *ConnectionState) { + if len(cs.VerifiedChains) == 0 { + t.Errorf("#%d: expected some verified chains, but found none", testNum) + } + }, + }, +} + +func TestGetClientCertificate(t *testing.T) { + t.Run("TLSv12", func(t *testing.T) { testGetClientCertificate(t, VersionTLS12) }) + t.Run("TLSv13", func(t *testing.T) { testGetClientCertificate(t, VersionTLS13) }) +} + +func testGetClientCertificate(t *testing.T, version uint16) { + // Note: using RSA 2048 test certificates because they are compatible with FIPS mode. + issuer, err := x509.ParseCertificate(testRSA2048CertificateIssuer) + if err != nil { + panic(err) + } + + for i, test := range getClientCertificateTests { + serverConfig := testConfig.Clone() + serverConfig.Certificates = []Certificate{{Certificate: [][]byte{testRSA2048Certificate}, PrivateKey: testRSA2048PrivateKey}} + serverConfig.ClientAuth = VerifyClientCertIfGiven + serverConfig.RootCAs = x509.NewCertPool() + serverConfig.RootCAs.AddCert(issuer) + serverConfig.ClientCAs = serverConfig.RootCAs + serverConfig.Time = testTime + serverConfig.MaxVersion = version + + clientConfig := testConfig.Clone() + clientConfig.Certificates = []Certificate{{Certificate: [][]byte{testRSA2048Certificate}, PrivateKey: testRSA2048PrivateKey}} + clientConfig.MaxVersion = version + + test.setup(clientConfig, serverConfig) + + // TLS 1.1 isn't available for FIPS required + if fips140tls.Required() && clientConfig.MaxVersion == VersionTLS11 { + t.Logf("skipping test %d for FIPS mode", i) + continue + } + + type serverResult struct { + cs ConnectionState + err error + } + + c, s := localPipe(t) + done := make(chan serverResult) + + go func() { + defer s.Close() + server := Server(s, serverConfig) + err := server.Handshake() + + var cs ConnectionState + if err == nil { + cs = server.ConnectionState() + } + done <- serverResult{cs, err} + }() + + clientErr := Client(c, clientConfig).Handshake() + c.Close() + + result := <-done + + if clientErr != nil { + if len(test.expectedClientError) == 0 { + t.Errorf("#%d: client error: %v", i, clientErr) + } else if got := clientErr.Error(); got != test.expectedClientError { + t.Errorf("#%d: expected client error %q, but got %q", i, test.expectedClientError, got) + } else { + test.verify(t, i, &result.cs) + } + } else if len(test.expectedClientError) > 0 { + t.Errorf("#%d: expected client error %q, but got no error", i, test.expectedClientError) + } else if err := result.err; err != nil { + t.Errorf("#%d: server error: %v", i, err) + } else { + test.verify(t, i, &result.cs) + } + } +} + +func TestRSAPSSKeyError(t *testing.T) { + // crypto/tls does not support the rsa_pss_pss_* SignatureSchemes. If support for + // public keys with OID RSASSA-PSS is added to crypto/x509, they will be misused with + // the rsa_pss_rsae_* SignatureSchemes. Assert that RSASSA-PSS certificates don't + // parse, or that they don't carry *rsa.PublicKey keys. + b, _ := pem.Decode([]byte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sn8oPgfC57gpO6yiN+UURRTlK3bgYvLh4VWB3XXk9UaQZ7Mq1tpXjoD +HYFybkWzibkZp4WRo+Fa28rirH+/wHt0vfeN7UCceURZEx4JaxIIfe4ku7uDRhJi +RwBA9Xk1KBNF +-----END CERTIFICATE-----`)) + if b == nil { + t.Fatal("Failed to decode certificate") + } + cert, err := x509.ParseCertificate(b.Bytes) + if err != nil { + return + } + if _, ok := cert.PublicKey.(*rsa.PublicKey); ok { + t.Error("A RSASSA-PSS certificate was parsed like a PKCS#1 v1.5 one, and it will be mistakenly used with rsa_pss_rsae_* signature algorithms") + } +} + +func TestCloseClientConnectionOnIdleServer(t *testing.T) { + clientConn, serverConn := localPipe(t) + client := Client(clientConn, testConfig.Clone()) + go func() { + var b [1]byte + serverConn.Read(b[:]) + client.Close() + }() + client.SetWriteDeadline(time.Now().Add(time.Minute)) + err := client.Handshake() + if err != nil { + if err, ok := err.(net.Error); ok && err.Timeout() { + t.Errorf("Expected a closed network connection error but got '%s'", err.Error()) + } + } else { + t.Errorf("Error expected, but no error returned") + } +} + +func testDowngradeCanary(t *testing.T, clientVersion, serverVersion uint16) error { + defer func() { testingOnlyForceDowngradeCanary = false }() + testingOnlyForceDowngradeCanary = true + + clientConfig := testConfig.Clone() + clientConfig.MaxVersion = clientVersion + serverConfig := testConfig.Clone() + serverConfig.MaxVersion = serverVersion + _, _, err := testHandshake(t, clientConfig, serverConfig) + return err +} + +func TestDowngradeCanary(t *testing.T) { + if err := testDowngradeCanary(t, VersionTLS13, VersionTLS12); err == nil { + t.Errorf("downgrade from TLS 1.3 to TLS 1.2 was not detected") + } + if testing.Short() { + t.Skip("skipping the rest of the checks in short mode") + } + if err := testDowngradeCanary(t, VersionTLS13, VersionTLS11); err == nil { + t.Errorf("downgrade from TLS 1.3 to TLS 1.1 was not detected") + } + if err := testDowngradeCanary(t, VersionTLS13, VersionTLS10); err == nil { + t.Errorf("downgrade from TLS 1.3 to TLS 1.0 was not detected") + } + if err := testDowngradeCanary(t, VersionTLS12, VersionTLS11); err == nil { + t.Errorf("downgrade from TLS 1.2 to TLS 1.1 was not detected") + } + if err := testDowngradeCanary(t, VersionTLS12, VersionTLS10); err == nil { + t.Errorf("downgrade from TLS 1.2 to TLS 1.0 was not detected") + } + if err := testDowngradeCanary(t, VersionTLS13, VersionTLS13); err != nil { + t.Errorf("server unexpectedly sent downgrade canary for TLS 1.3") + } + if err := testDowngradeCanary(t, VersionTLS12, VersionTLS12); err != nil { + t.Errorf("client didn't ignore expected TLS 1.2 canary") + } + if !fips140tls.Required() { + if err := testDowngradeCanary(t, VersionTLS11, VersionTLS11); err != nil { + t.Errorf("client unexpectedly reacted to a canary in TLS 1.1") + } + if err := testDowngradeCanary(t, VersionTLS10, VersionTLS10); err != nil { + t.Errorf("client unexpectedly reacted to a canary in TLS 1.0") + } + } else { + t.Logf("skiping TLS 1.1 and TLS 1.0 downgrade canary checks in FIPS mode") + } +} + +func TestResumptionKeepsOCSPAndSCT(t *testing.T) { + t.Run("TLSv12", func(t *testing.T) { testResumptionKeepsOCSPAndSCT(t, VersionTLS12) }) + t.Run("TLSv13", func(t *testing.T) { testResumptionKeepsOCSPAndSCT(t, VersionTLS13) }) +} + +func testResumptionKeepsOCSPAndSCT(t *testing.T, ver uint16) { + // Note: using RSA 2048 test certificates because they are compatible with FIPS mode. + issuer, err := x509.ParseCertificate(testRSA2048CertificateIssuer) + if err != nil { + t.Fatalf("failed to parse test issuer") + } + roots := x509.NewCertPool() + roots.AddCert(issuer) + clientConfig := &Config{ + MaxVersion: ver, + ClientSessionCache: NewLRUClientSessionCache(32), + ServerName: "example.golang", + RootCAs: roots, + Time: testTime, + } + serverConfig := testConfig.Clone() + serverConfig.Certificates = []Certificate{{Certificate: [][]byte{testRSA2048Certificate}, PrivateKey: testRSA2048PrivateKey}} + serverConfig.MaxVersion = ver + serverConfig.Certificates[0].OCSPStaple = []byte{1, 2, 3} + serverConfig.Certificates[0].SignedCertificateTimestamps = [][]byte{{4, 5, 6}} + + _, ccs, err := testHandshake(t, clientConfig, serverConfig) + if err != nil { + t.Fatalf("handshake failed: %s", err) + } + // after a new session we expect to see OCSPResponse and + // SignedCertificateTimestamps populated as usual + if !bytes.Equal(ccs.OCSPResponse, serverConfig.Certificates[0].OCSPStaple) { + t.Errorf("client ConnectionState contained unexpected OCSPResponse: wanted %v, got %v", + serverConfig.Certificates[0].OCSPStaple, ccs.OCSPResponse) + } + if !reflect.DeepEqual(ccs.SignedCertificateTimestamps, serverConfig.Certificates[0].SignedCertificateTimestamps) { + t.Errorf("client ConnectionState contained unexpected SignedCertificateTimestamps: wanted %v, got %v", + serverConfig.Certificates[0].SignedCertificateTimestamps, ccs.SignedCertificateTimestamps) + } + + // if the server doesn't send any SCTs, repopulate the old SCTs + oldSCTs := serverConfig.Certificates[0].SignedCertificateTimestamps + serverConfig.Certificates[0].SignedCertificateTimestamps = nil + _, ccs, err = testHandshake(t, clientConfig, serverConfig) + if err != nil { + t.Fatalf("handshake failed: %s", err) + } + if !ccs.DidResume { + t.Fatalf("expected session to be resumed") + } + // after a resumed session we also expect to see OCSPResponse + // and SignedCertificateTimestamps populated + if !bytes.Equal(ccs.OCSPResponse, serverConfig.Certificates[0].OCSPStaple) { + t.Errorf("client ConnectionState contained unexpected OCSPResponse after resumption: wanted %v, got %v", + serverConfig.Certificates[0].OCSPStaple, ccs.OCSPResponse) + } + if !reflect.DeepEqual(ccs.SignedCertificateTimestamps, oldSCTs) { + t.Errorf("client ConnectionState contained unexpected SignedCertificateTimestamps after resumption: wanted %v, got %v", + oldSCTs, ccs.SignedCertificateTimestamps) + } + + // Only test overriding the SCTs for TLS 1.2, since in 1.3 + // the server won't send the message containing them + if ver == VersionTLS13 { + return + } + + // if the server changes the SCTs it sends, they should override the saved SCTs + serverConfig.Certificates[0].SignedCertificateTimestamps = [][]byte{{7, 8, 9}} + _, ccs, err = testHandshake(t, clientConfig, serverConfig) + if err != nil { + t.Fatalf("handshake failed: %s", err) + } + if !ccs.DidResume { + t.Fatalf("expected session to be resumed") + } + if !reflect.DeepEqual(ccs.SignedCertificateTimestamps, serverConfig.Certificates[0].SignedCertificateTimestamps) { + t.Errorf("client ConnectionState contained unexpected SignedCertificateTimestamps after resumption: wanted %v, got %v", + serverConfig.Certificates[0].SignedCertificateTimestamps, ccs.SignedCertificateTimestamps) + } +} + +// TestClientHandshakeContextCancellation tests that canceling +// the context given to the client side conn.HandshakeContext +// interrupts the in-progress handshake. +func TestClientHandshakeContextCancellation(t *testing.T) { + c, s := localPipe(t) + ctx, cancel := context.WithCancel(context.Background()) + unblockServer := make(chan struct{}) + defer close(unblockServer) + go func() { + cancel() + <-unblockServer + _ = s.Close() + }() + cli := Client(c, testConfig) + // Initiates client side handshake, which will block until the client hello is read + // by the server, unless the cancellation works. + err := cli.HandshakeContext(ctx) + if err == nil { + t.Fatal("Client handshake did not error when the context was canceled") + } + if err != context.Canceled { + t.Errorf("Unexpected client handshake error: %v", err) + } + if runtime.GOOS == "js" || runtime.GOOS == "wasip1" { + t.Skip("conn.Close does not error as expected when called multiple times on GOOS=js or GOOS=wasip1") + } + err = cli.Close() + if err == nil { + t.Error("Client connection was not closed when the context was canceled") + } +} + +// TestTLS13OnlyClientHelloCipherSuite tests that when a client states that +// it only supports TLS 1.3, it correctly advertises only TLS 1.3 ciphers. +func TestTLS13OnlyClientHelloCipherSuite(t *testing.T) { + tls13Tests := []struct { + name string + ciphers []uint16 + }{ + { + name: "nil", + ciphers: nil, + }, + { + name: "empty", + ciphers: []uint16{}, + }, + { + name: "some TLS 1.2 cipher", + ciphers: []uint16{TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256}, + }, + { + name: "some TLS 1.3 cipher", + ciphers: []uint16{TLS_AES_128_GCM_SHA256}, + }, + { + name: "some TLS 1.2 and 1.3 ciphers", + ciphers: []uint16{TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_AES_256_GCM_SHA384}, + }, + } + for _, tt := range tls13Tests { + t.Run(tt.name, func(t *testing.T) { + t.Parallel() + testTLS13OnlyClientHelloCipherSuite(t, tt.ciphers) + }) + } +} + +func testTLS13OnlyClientHelloCipherSuite(t *testing.T, ciphers []uint16) { + serverConfig := &Config{ + Certificates: testConfig.Certificates, + GetConfigForClient: func(chi *ClientHelloInfo) (*Config, error) { + expectedCiphersuites := defaultCipherSuitesTLS13NoAES + if fips140tls.Required() { + expectedCiphersuites = allowedCipherSuitesTLS13FIPS + } + if len(chi.CipherSuites) != len(expectedCiphersuites) { + t.Errorf("only TLS 1.3 suites should be advertised, got=%x", chi.CipherSuites) + } else { + for i := range expectedCiphersuites { + if want, got := expectedCiphersuites[i], chi.CipherSuites[i]; want != got { + t.Errorf("cipher at index %d does not match, want=%x, got=%x", i, want, got) + } + } + } + return nil, nil + }, + } + clientConfig := &Config{ + MinVersion: VersionTLS13, // client only supports TLS 1.3 + CipherSuites: ciphers, + InsecureSkipVerify: true, + } + if _, _, err := testHandshake(t, clientConfig, serverConfig); err != nil { + t.Fatalf("handshake failed: %s", err) + } +} + +// discardConn wraps a net.Conn but discards all writes, but reports that they happened. +type discardConn struct { + net.Conn +} + +func (dc *discardConn) Write(data []byte) (int, error) { + return len(data), nil +} + +// largeRSAKeyCertPEM contains a 8193 bit RSA key +const largeRSAKeyCertPEM = `-----BEGIN CERTIFICATE----- +MIIInjCCBIWgAwIBAgIBAjANBgkqhkiG9w0BAQsFADASMRAwDgYDVQQDEwd0ZXN0 +aW5nMB4XDTIzMDYwNzIxMjMzNloXDTIzMDYwNzIzMjMzNlowEjEQMA4GA1UEAxMH +dGVzdGluZzCCBCIwDQYJKoZIhvcNAQEBBQADggQPADCCBAoCggQBAWdHsf6Rh2Ca +n2SQwn4t4OQrOjbLLdGE1pM6TBKKrHUFy62uEL8atNjlcfXIsa4aEu3xNGiqxqur +ZectlkZbm0FkaaQ1Wr9oikDY3KfjuaXdPdO/XC/h8AKNxlDOylyXwUSK/CuYb+1j +gy8yF5QFvVfwW/xwTlHmhUeSkVSQPosfQ6yXNNs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wBkKRtlNtrCWCJK2hidK/foxwD7kwAPo2I9FjpltxCRywZUs07X +KwXTfBR9v6ij1LV6K58hFS+8ezZyZ05CeVBFkMQdclTOSfuPxlMkQOtjp8QWDj+F +j/MYziT5KBkHvcbrjdRtUJIAi4N7zCsPZtjik918AK1WBNRVqPbrgq/XSEXMfuvs +6JbfK0B76vdBDRtJFC1JsvnIrGbUztxXzyQwFLaR/AjVJqpVlysLWzPKWVX6/+SJ +u1NQOl2E8P6ycyBsuGnO89p0S4F8cMRcI2X1XQsZ7/q0NBrOMaEp5T3SrWo9GiQ3 +o2SBdbs3Y6MBPBtTu977Z/0RO63J3M5i2tjUiDfrFy7+VRLKr7qQ7JibohyB8QaR +9tedgjn2f+of7PnP/PEl1cCphUZeHM7QKUMPT8dbqwmKtlYY43EHXcvNOT5IBk3X +9lwJoZk/B2i+ZMRNSP34ztAwtxmasPt6RAWGQpWCn9qmttAHAnMfDqe7F7jVR6rS +u58= +-----END CERTIFICATE-----` + +func TestHandshakeRSATooBig(t *testing.T) { + testCert, _ := pem.Decode([]byte(largeRSAKeyCertPEM)) + + c := &Conn{conn: &discardConn{}, config: testConfig.Clone()} + + expectedErr := "tls: server sent certificate containing RSA key larger than 8192 bits" + err := c.verifyServerCertificate([][]byte{testCert.Bytes}) + if err == nil || err.Error() != expectedErr { + t.Errorf("Conn.verifyServerCertificate unexpected error: want %q, got %q", expectedErr, err) + } + + expectedErr = "tls: client sent certificate containing RSA key larger than 8192 bits" + err = c.processCertsFromClient(Certificate{Certificate: [][]byte{testCert.Bytes}}) + if err == nil || err.Error() != expectedErr { + t.Errorf("Conn.processCertsFromClient unexpected error: want %q, got %q", expectedErr, err) + } +} + +func TestTLS13ECHRejectionCallbacks(t *testing.T) { + k, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatal(err) + } + tmpl := &x509.Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{CommonName: "test"}, + DNSNames: []string{"example.golang"}, + NotBefore: testConfig.Time().Add(-time.Hour), + NotAfter: testConfig.Time().Add(time.Hour), + } + certDER, err := x509.CreateCertificate(rand.Reader, tmpl, tmpl, k.Public(), k) + if err != nil { + t.Fatal(err) + } + cert, err := x509.ParseCertificate(certDER) + if err != nil { + t.Fatal(err) + } + + clientConfig, serverConfig := testConfig.Clone(), testConfig.Clone() + serverConfig.Certificates = []Certificate{ + { + Certificate: [][]byte{certDER}, + PrivateKey: k, + }, + } + serverConfig.MinVersion = VersionTLS13 + clientConfig.RootCAs = x509.NewCertPool() + clientConfig.RootCAs.AddCert(cert) + clientConfig.MinVersion = VersionTLS13 + clientConfig.EncryptedClientHelloConfigList, _ = hex.DecodeString("0041fe0d003d0100200020204bed0a11fc0dde595a9b78d966b0011128eb83f65d3c91c1cc5ac786cd246f000400010001ff0e6578616d706c652e676f6c616e670000") + clientConfig.ServerName = "example.golang" + + for _, tc := range []struct { + name string + expectedErr string + + verifyConnection func(ConnectionState) error + verifyPeerCertificate func([][]byte, [][]*x509.Certificate) error + encryptedClientHelloRejectionVerify func(ConnectionState) error + }{ + { + name: "no callbacks", + expectedErr: "tls: server rejected ECH", + }, + { + name: "EncryptedClientHelloRejectionVerify, no err", + encryptedClientHelloRejectionVerify: func(ConnectionState) error { + return nil + }, + expectedErr: "tls: server rejected ECH", + }, + { + name: "EncryptedClientHelloRejectionVerify, err", + encryptedClientHelloRejectionVerify: func(ConnectionState) error { + return errors.New("callback err") + }, + // testHandshake returns the server side error, so we just need to + // check alertBadCertificate was sent + expectedErr: "callback err", + }, + { + name: "VerifyConnection, err", + verifyConnection: func(ConnectionState) error { + return errors.New("callback err") + }, + expectedErr: "tls: server rejected ECH", + }, + { + name: "VerifyPeerCertificate, err", + verifyPeerCertificate: func([][]byte, [][]*x509.Certificate) error { + return errors.New("callback err") + }, + expectedErr: "tls: server rejected ECH", + }, + } { + t.Run(tc.name, func(t *testing.T) { + c, s := localPipe(t) + done := make(chan error) + + go func() { + serverErr := Server(s, serverConfig).Handshake() + s.Close() + done <- serverErr + }() + + cConfig := clientConfig.Clone() + cConfig.VerifyConnection = tc.verifyConnection + cConfig.VerifyPeerCertificate = tc.verifyPeerCertificate + cConfig.EncryptedClientHelloRejectionVerify = tc.encryptedClientHelloRejectionVerify + + clientErr := Client(c, cConfig).Handshake() + c.Close() + + if tc.expectedErr == "" && clientErr != nil { + t.Fatalf("unexpected err: %s", clientErr) + } else if clientErr != nil && tc.expectedErr != clientErr.Error() { + t.Fatalf("unexpected err: got %q, want %q", clientErr, tc.expectedErr) + } + }) + } +} + +func TestECHTLS12Server(t *testing.T) { + clientConfig, serverConfig := testConfig.Clone(), testConfig.Clone() + + serverConfig.MaxVersion = VersionTLS12 + clientConfig.MinVersion = 0 + + clientConfig.EncryptedClientHelloConfigList, _ = hex.DecodeString("0041fe0d003d0100200020204bed0a11fc0dde595a9b78d966b0011128eb83f65d3c91c1cc5ac786cd246f000400010001ff0e6578616d706c652e676f6c616e670000") + + expectedErr := "server: tls: client offered only unsupported versions: [304]\nclient: remote error: tls: protocol version not supported" + _, _, err := testHandshake(t, clientConfig, serverConfig) + if err == nil || err.Error() != expectedErr { + t.Fatalf("unexpected handshake error: got %q, want %q", err, expectedErr) + } +} diff --git a/go/src/crypto/tls/handshake_client_tls13.go b/go/src/crypto/tls/handshake_client_tls13.go new file mode 100644 index 0000000000000000000000000000000000000000..65177767a05b1f5d3461aa9236a3a7fb394403d1 --- /dev/null +++ b/go/src/crypto/tls/handshake_client_tls13.go @@ -0,0 +1,887 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "bytes" + "context" + "crypto" + "crypto/hkdf" + "crypto/hmac" + "crypto/internal/fips140/tls13" + "crypto/rsa" + "crypto/subtle" + "errors" + "hash" + "slices" + "time" +) + +type clientHandshakeStateTLS13 struct { + c *Conn + ctx context.Context + serverHello *serverHelloMsg + hello *clientHelloMsg + keyShareKeys *keySharePrivateKeys + + session *SessionState + earlySecret *tls13.EarlySecret + binderKey []byte + + certReq *certificateRequestMsgTLS13 + usingPSK bool + sentDummyCCS bool + suite *cipherSuiteTLS13 + transcript hash.Hash + masterSecret *tls13.MasterSecret + trafficSecret []byte // client_application_traffic_secret_0 + + echContext *echClientContext +} + +// handshake requires hs.c, hs.hello, hs.serverHello, hs.keyShareKeys, and, +// optionally, hs.session, hs.earlySecret and hs.binderKey to be set. +func (hs *clientHandshakeStateTLS13) handshake() error { + c := hs.c + + // The server must not select TLS 1.3 in a renegotiation. See RFC 8446, + // sections 4.1.2 and 4.1.3. + if c.handshakes > 0 { + c.sendAlert(alertProtocolVersion) + return errors.New("tls: server selected TLS 1.3 in a renegotiation") + } + + // Consistency check on the presence of a keyShare and its parameters. + if hs.keyShareKeys == nil || hs.keyShareKeys.ecdhe == nil || len(hs.hello.keyShares) == 0 { + return c.sendAlert(alertInternalError) + } + + if err := hs.checkServerHelloOrHRR(); err != nil { + return err + } + + hs.transcript = hs.suite.hash.New() + + if err := transcriptMsg(hs.hello, hs.transcript); err != nil { + return err + } + + if hs.echContext != nil { + hs.echContext.innerTranscript = hs.suite.hash.New() + if err := transcriptMsg(hs.echContext.innerHello, hs.echContext.innerTranscript); err != nil { + return err + } + } + + if bytes.Equal(hs.serverHello.random, helloRetryRequestRandom) { + if err := hs.sendDummyChangeCipherSpec(); err != nil { + return err + } + if err := hs.processHelloRetryRequest(); err != nil { + return err + } + } + + if hs.echContext != nil { + confTranscript := cloneHash(hs.echContext.innerTranscript, hs.suite.hash) + confTranscript.Write(hs.serverHello.original[:30]) + confTranscript.Write(make([]byte, 8)) + confTranscript.Write(hs.serverHello.original[38:]) + h := hs.suite.hash.New + prk, err := hkdf.Extract(h, hs.echContext.innerHello.random, nil) + if err != nil { + c.sendAlert(alertInternalError) + return err + } + acceptConfirmation := tls13.ExpandLabel(h, prk, "ech accept confirmation", confTranscript.Sum(nil), 8) + if subtle.ConstantTimeCompare(acceptConfirmation, hs.serverHello.random[len(hs.serverHello.random)-8:]) == 1 { + hs.hello = hs.echContext.innerHello + c.serverName = c.config.ServerName + hs.transcript = hs.echContext.innerTranscript + c.echAccepted = true + + if hs.serverHello.encryptedClientHello != nil { + c.sendAlert(alertUnsupportedExtension) + return errors.New("tls: unexpected encrypted client hello extension in server hello despite ECH being accepted") + } + + if hs.hello.serverName == "" && hs.serverHello.serverNameAck { + c.sendAlert(alertUnsupportedExtension) + return errors.New("tls: unexpected server_name extension in server hello") + } + } else { + hs.echContext.echRejected = true + } + } + + if err := transcriptMsg(hs.serverHello, hs.transcript); err != nil { + return err + } + + c.buffering = true + if err := hs.processServerHello(); err != nil { + return err + } + if err := hs.sendDummyChangeCipherSpec(); err != nil { + return err + } + if err := hs.establishHandshakeKeys(); err != nil { + return err + } + if err := hs.readServerParameters(); err != nil { + return err + } + if err := hs.readServerCertificate(); err != nil { + return err + } + if err := hs.readServerFinished(); err != nil { + return err + } + if err := hs.sendClientCertificate(); err != nil { + return err + } + if err := hs.sendClientFinished(); err != nil { + return err + } + if _, err := c.flush(); err != nil { + return err + } + + if hs.echContext != nil && hs.echContext.echRejected { + c.sendAlert(alertECHRequired) + return &ECHRejectionError{hs.echContext.retryConfigs} + } + + c.isHandshakeComplete.Store(true) + + return nil +} + +// checkServerHelloOrHRR does validity checks that apply to both ServerHello and +// HelloRetryRequest messages. It sets hs.suite. +func (hs *clientHandshakeStateTLS13) checkServerHelloOrHRR() error { + c := hs.c + + if hs.serverHello.supportedVersion == 0 { + c.sendAlert(alertMissingExtension) + return errors.New("tls: server selected TLS 1.3 using the legacy version field") + } + + if hs.serverHello.supportedVersion != VersionTLS13 { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: server selected an invalid version after a HelloRetryRequest") + } + + if hs.serverHello.vers != VersionTLS12 { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: server sent an incorrect legacy version") + } + + if hs.serverHello.ocspStapling || + hs.serverHello.ticketSupported || + hs.serverHello.extendedMasterSecret || + hs.serverHello.secureRenegotiationSupported || + len(hs.serverHello.secureRenegotiation) != 0 || + len(hs.serverHello.alpnProtocol) != 0 || + len(hs.serverHello.scts) != 0 { + c.sendAlert(alertUnsupportedExtension) + return errors.New("tls: server sent a ServerHello extension forbidden in TLS 1.3") + } + + if !bytes.Equal(hs.hello.sessionId, hs.serverHello.sessionId) { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: server did not echo the legacy session ID") + } + + if hs.serverHello.compressionMethod != compressionNone { + c.sendAlert(alertDecodeError) + return errors.New("tls: server sent non-zero legacy TLS compression method") + } + + selectedSuite := mutualCipherSuiteTLS13(hs.hello.cipherSuites, hs.serverHello.cipherSuite) + if hs.suite != nil && selectedSuite != hs.suite { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: server changed cipher suite after a HelloRetryRequest") + } + if selectedSuite == nil { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: server chose an unconfigured cipher suite") + } + hs.suite = selectedSuite + c.cipherSuite = hs.suite.id + + return nil +} + +// sendDummyChangeCipherSpec sends a ChangeCipherSpec record for compatibility +// with middleboxes that didn't implement TLS correctly. See RFC 8446, Appendix D.4. +func (hs *clientHandshakeStateTLS13) sendDummyChangeCipherSpec() error { + if hs.c.quic != nil { + return nil + } + if hs.sentDummyCCS { + return nil + } + hs.sentDummyCCS = true + + return hs.c.writeChangeCipherRecord() +} + +// processHelloRetryRequest handles the HRR in hs.serverHello, modifies and +// resends hs.hello, and reads the new ServerHello into hs.serverHello. +func (hs *clientHandshakeStateTLS13) processHelloRetryRequest() error { + c := hs.c + + // The first ClientHello gets double-hashed into the transcript upon a + // HelloRetryRequest. (The idea is that the server might offload transcript + // storage to the client in the cookie.) See RFC 8446, Section 4.4.1. + chHash := hs.transcript.Sum(nil) + hs.transcript.Reset() + hs.transcript.Write([]byte{typeMessageHash, 0, 0, uint8(len(chHash))}) + hs.transcript.Write(chHash) + if err := transcriptMsg(hs.serverHello, hs.transcript); err != nil { + return err + } + + var isInnerHello bool + hello := hs.hello + if hs.echContext != nil { + chHash = hs.echContext.innerTranscript.Sum(nil) + hs.echContext.innerTranscript.Reset() + hs.echContext.innerTranscript.Write([]byte{typeMessageHash, 0, 0, uint8(len(chHash))}) + hs.echContext.innerTranscript.Write(chHash) + + if hs.serverHello.encryptedClientHello != nil { + if len(hs.serverHello.encryptedClientHello) != 8 { + hs.c.sendAlert(alertDecodeError) + return errors.New("tls: malformed encrypted client hello extension") + } + + confTranscript := cloneHash(hs.echContext.innerTranscript, hs.suite.hash) + hrrHello := make([]byte, len(hs.serverHello.original)) + copy(hrrHello, hs.serverHello.original) + hrrHello = bytes.Replace(hrrHello, hs.serverHello.encryptedClientHello, make([]byte, 8), 1) + confTranscript.Write(hrrHello) + h := hs.suite.hash.New + prk, err := hkdf.Extract(h, hs.echContext.innerHello.random, nil) + if err != nil { + c.sendAlert(alertInternalError) + return err + } + acceptConfirmation := tls13.ExpandLabel(h, prk, "hrr ech accept confirmation", confTranscript.Sum(nil), 8) + if subtle.ConstantTimeCompare(acceptConfirmation, hs.serverHello.encryptedClientHello) == 1 { + hello = hs.echContext.innerHello + c.serverName = c.config.ServerName + isInnerHello = true + c.echAccepted = true + } + } + + if err := transcriptMsg(hs.serverHello, hs.echContext.innerTranscript); err != nil { + return err + } + } else if hs.serverHello.encryptedClientHello != nil { + // Unsolicited ECH extension should be rejected + c.sendAlert(alertUnsupportedExtension) + return errors.New("tls: unexpected encrypted client hello extension in serverHello") + } + + // The only HelloRetryRequest extensions we support are key_share and + // cookie, and clients must abort the handshake if the HRR would not result + // in any change in the ClientHello. + if hs.serverHello.selectedGroup == 0 && hs.serverHello.cookie == nil { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: server sent an unnecessary HelloRetryRequest message") + } + + if hs.serverHello.cookie != nil { + hello.cookie = hs.serverHello.cookie + } + + if hs.serverHello.serverShare.group != 0 { + c.sendAlert(alertDecodeError) + return errors.New("tls: received malformed key_share extension") + } + + // If the server sent a key_share extension selecting a group, ensure it's + // a group we advertised but did not send a key share for, and send a key + // share for it this time. + if curveID := hs.serverHello.selectedGroup; curveID != 0 { + if !slices.Contains(hello.supportedCurves, curveID) { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: server selected unsupported group") + } + if slices.ContainsFunc(hs.hello.keyShares, func(ks keyShare) bool { + return ks.group == curveID + }) { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: server sent an unnecessary HelloRetryRequest key_share") + } + ke, err := keyExchangeForCurveID(curveID) + if err != nil { + c.sendAlert(alertInternalError) + return errors.New("tls: CurvePreferences includes unsupported curve") + } + hs.keyShareKeys, hello.keyShares, err = ke.keyShares(c.config.rand()) + if err != nil { + c.sendAlert(alertInternalError) + return err + } + // Do not send the fallback ECDH key share in a HRR response. + hello.keyShares = hello.keyShares[:1] + } + + if len(hello.pskIdentities) > 0 { + pskSuite := cipherSuiteTLS13ByID(hs.session.cipherSuite) + if pskSuite == nil { + return c.sendAlert(alertInternalError) + } + if pskSuite.hash == hs.suite.hash { + // Update binders and obfuscated_ticket_age. + ticketAge := c.config.time().Sub(time.Unix(int64(hs.session.createdAt), 0)) + hello.pskIdentities[0].obfuscatedTicketAge = uint32(ticketAge/time.Millisecond) + hs.session.ageAdd + + transcript := hs.suite.hash.New() + transcript.Write([]byte{typeMessageHash, 0, 0, uint8(len(chHash))}) + transcript.Write(chHash) + if err := transcriptMsg(hs.serverHello, transcript); err != nil { + return err + } + + if err := computeAndUpdatePSK(hello, hs.binderKey, transcript, hs.suite.finishedHash); err != nil { + return err + } + } else { + // Server selected a cipher suite incompatible with the PSK. + hello.pskIdentities = nil + hello.pskBinders = nil + } + } + + if hello.earlyData { + hello.earlyData = false + c.quicRejectedEarlyData() + } + + if isInnerHello { + // Any extensions which have changed in hello, but are mirrored in the + // outer hello and compressed, need to be copied to the outer hello, so + // they can be properly decompressed by the server. For now, the only + // extension which may have changed is keyShares. + hs.hello.keyShares = hello.keyShares + hs.echContext.innerHello = hello + if err := transcriptMsg(hs.echContext.innerHello, hs.echContext.innerTranscript); err != nil { + return err + } + + if err := computeAndUpdateOuterECHExtension(hs.hello, hs.echContext.innerHello, hs.echContext, false); err != nil { + return err + } + } else { + hs.hello = hello + } + + if _, err := hs.c.writeHandshakeRecord(hs.hello, hs.transcript); err != nil { + return err + } + + // serverHelloMsg is not included in the transcript + msg, err := c.readHandshake(nil) + if err != nil { + return err + } + + serverHello, ok := msg.(*serverHelloMsg) + if !ok { + c.sendAlert(alertUnexpectedMessage) + return unexpectedMessageError(serverHello, msg) + } + hs.serverHello = serverHello + + if err := hs.checkServerHelloOrHRR(); err != nil { + return err + } + + c.didHRR = true + return nil +} + +func (hs *clientHandshakeStateTLS13) processServerHello() error { + c := hs.c + + if bytes.Equal(hs.serverHello.random, helloRetryRequestRandom) { + c.sendAlert(alertUnexpectedMessage) + return errors.New("tls: server sent two HelloRetryRequest messages") + } + + if len(hs.serverHello.cookie) != 0 { + c.sendAlert(alertUnsupportedExtension) + return errors.New("tls: server sent a cookie in a normal ServerHello") + } + + if hs.serverHello.selectedGroup != 0 { + c.sendAlert(alertDecodeError) + return errors.New("tls: malformed key_share extension") + } + + if hs.serverHello.serverShare.group == 0 { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: server did not send a key share") + } + if !slices.ContainsFunc(hs.hello.keyShares, func(ks keyShare) bool { + return ks.group == hs.serverHello.serverShare.group + }) { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: server selected unsupported group") + } + + if !hs.serverHello.selectedIdentityPresent { + return nil + } + + if int(hs.serverHello.selectedIdentity) >= len(hs.hello.pskIdentities) { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: server selected an invalid PSK") + } + + if len(hs.hello.pskIdentities) != 1 || hs.session == nil { + return c.sendAlert(alertInternalError) + } + pskSuite := cipherSuiteTLS13ByID(hs.session.cipherSuite) + if pskSuite == nil { + return c.sendAlert(alertInternalError) + } + if pskSuite.hash != hs.suite.hash { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: server selected an invalid PSK and cipher suite pair") + } + + hs.usingPSK = true + c.didResume = true + c.peerCertificates = hs.session.peerCertificates + c.verifiedChains = hs.session.verifiedChains + c.ocspResponse = hs.session.ocspResponse + c.scts = hs.session.scts + return nil +} + +func (hs *clientHandshakeStateTLS13) establishHandshakeKeys() error { + c := hs.c + + ke, err := keyExchangeForCurveID(hs.serverHello.serverShare.group) + if err != nil { + c.sendAlert(alertInternalError) + return err + } + sharedKey, err := ke.clientSharedSecret(hs.keyShareKeys, hs.serverHello.serverShare.data) + if err != nil { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: invalid server key share") + } + c.curveID = hs.serverHello.serverShare.group + + earlySecret := hs.earlySecret + if !hs.usingPSK { + earlySecret = tls13.NewEarlySecret(hs.suite.hash.New, nil) + } + + handshakeSecret := earlySecret.HandshakeSecret(sharedKey) + + clientSecret := handshakeSecret.ClientHandshakeTrafficSecret(hs.transcript) + c.setWriteTrafficSecret(hs.suite, QUICEncryptionLevelHandshake, clientSecret) + serverSecret := handshakeSecret.ServerHandshakeTrafficSecret(hs.transcript) + if err := c.setReadTrafficSecret(hs.suite, QUICEncryptionLevelHandshake, serverSecret, false); err != nil { + return err + } + + if c.quic != nil { + c.quicSetWriteSecret(QUICEncryptionLevelHandshake, hs.suite.id, clientSecret) + if err := c.quicSetReadSecret(QUICEncryptionLevelHandshake, hs.suite.id, serverSecret); err != nil { + return err + } + } + + err = c.config.writeKeyLog(keyLogLabelClientHandshake, hs.hello.random, clientSecret) + if err != nil { + c.sendAlert(alertInternalError) + return err + } + err = c.config.writeKeyLog(keyLogLabelServerHandshake, hs.hello.random, serverSecret) + if err != nil { + c.sendAlert(alertInternalError) + return err + } + + hs.masterSecret = handshakeSecret.MasterSecret() + + return nil +} + +func (hs *clientHandshakeStateTLS13) readServerParameters() error { + c := hs.c + + msg, err := c.readHandshake(hs.transcript) + if err != nil { + return err + } + + encryptedExtensions, ok := msg.(*encryptedExtensionsMsg) + if !ok { + c.sendAlert(alertUnexpectedMessage) + return unexpectedMessageError(encryptedExtensions, msg) + } + + if err := checkALPN(hs.hello.alpnProtocols, encryptedExtensions.alpnProtocol, c.quic != nil); err != nil { + // RFC 8446 specifies that no_application_protocol is sent by servers, but + // does not specify how clients handle the selection of an incompatible protocol. + // RFC 9001 Section 8.1 specifies that QUIC clients send no_application_protocol + // in this case. Always sending no_application_protocol seems reasonable. + c.sendAlert(alertNoApplicationProtocol) + return err + } + c.clientProtocol = encryptedExtensions.alpnProtocol + + if c.quic != nil { + if encryptedExtensions.quicTransportParameters == nil { + // RFC 9001 Section 8.2. + c.sendAlert(alertMissingExtension) + return errors.New("tls: server did not send a quic_transport_parameters extension") + } + c.quicSetTransportParameters(encryptedExtensions.quicTransportParameters) + } else { + if encryptedExtensions.quicTransportParameters != nil { + c.sendAlert(alertUnsupportedExtension) + return errors.New("tls: server sent an unexpected quic_transport_parameters extension") + } + } + + if !hs.hello.earlyData && encryptedExtensions.earlyData { + c.sendAlert(alertUnsupportedExtension) + return errors.New("tls: server sent an unexpected early_data extension") + } + if hs.hello.earlyData && !encryptedExtensions.earlyData { + c.quicRejectedEarlyData() + } + if encryptedExtensions.earlyData { + if hs.session.cipherSuite != c.cipherSuite { + c.sendAlert(alertHandshakeFailure) + return errors.New("tls: server accepted 0-RTT with the wrong cipher suite") + } + if hs.session.alpnProtocol != c.clientProtocol { + c.sendAlert(alertHandshakeFailure) + return errors.New("tls: server accepted 0-RTT with the wrong ALPN") + } + } + if hs.echContext != nil { + if hs.echContext.echRejected { + hs.echContext.retryConfigs = encryptedExtensions.echRetryConfigs + } else if encryptedExtensions.echRetryConfigs != nil { + c.sendAlert(alertUnsupportedExtension) + return errors.New("tls: server sent encrypted client hello retry configs after accepting encrypted client hello") + } + } + + return nil +} + +func (hs *clientHandshakeStateTLS13) readServerCertificate() error { + c := hs.c + + // Either a PSK or a certificate is always used, but not both. + // See RFC 8446, Section 4.1.1. + if hs.usingPSK { + // Make sure the connection is still being verified whether or not this + // is a resumption. Resumptions currently don't reverify certificates so + // they don't call verifyServerCertificate. See Issue 31641. + if c.config.VerifyConnection != nil { + if err := c.config.VerifyConnection(c.connectionStateLocked()); err != nil { + c.sendAlert(alertBadCertificate) + return err + } + } + return nil + } + + msg, err := c.readHandshake(hs.transcript) + if err != nil { + return err + } + + certReq, ok := msg.(*certificateRequestMsgTLS13) + if ok { + hs.certReq = certReq + + msg, err = c.readHandshake(hs.transcript) + if err != nil { + return err + } + } + + certMsg, ok := msg.(*certificateMsgTLS13) + if !ok { + c.sendAlert(alertUnexpectedMessage) + return unexpectedMessageError(certMsg, msg) + } + if len(certMsg.certificate.Certificate) == 0 { + c.sendAlert(alertDecodeError) + return errors.New("tls: received empty certificates message") + } + + c.scts = certMsg.certificate.SignedCertificateTimestamps + c.ocspResponse = certMsg.certificate.OCSPStaple + + if err := c.verifyServerCertificate(certMsg.certificate.Certificate); err != nil { + return err + } + + // certificateVerifyMsg is included in the transcript, but not until + // after we verify the handshake signature, since the state before + // this message was sent is used. + msg, err = c.readHandshake(nil) + if err != nil { + return err + } + + certVerify, ok := msg.(*certificateVerifyMsg) + if !ok { + c.sendAlert(alertUnexpectedMessage) + return unexpectedMessageError(certVerify, msg) + } + + // See RFC 8446, Section 4.4.3. + // We don't use hs.hello.supportedSignatureAlgorithms because it might + // include PKCS#1 v1.5 and SHA-1 if the ClientHello also supported TLS 1.2. + if !isSupportedSignatureAlgorithm(certVerify.signatureAlgorithm, supportedSignatureAlgorithms(c.vers)) || + !isSupportedSignatureAlgorithm(certVerify.signatureAlgorithm, signatureSchemesForPublicKey(c.vers, c.peerCertificates[0].PublicKey)) { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: certificate used with invalid signature algorithm") + } + sigType, sigHash, err := typeAndHashFromSignatureScheme(certVerify.signatureAlgorithm) + if err != nil { + return c.sendAlert(alertInternalError) + } + if sigType == signaturePKCS1v15 || sigHash == crypto.SHA1 { + return c.sendAlert(alertInternalError) + } + signed := signedMessage(serverSignatureContext, hs.transcript) + if err := verifyHandshakeSignature(sigType, c.peerCertificates[0].PublicKey, + sigHash, signed, certVerify.signature); err != nil { + c.sendAlert(alertDecryptError) + return errors.New("tls: invalid signature by the server certificate: " + err.Error()) + } + c.peerSigAlg = certVerify.signatureAlgorithm + + if err := transcriptMsg(certVerify, hs.transcript); err != nil { + return err + } + + return nil +} + +func (hs *clientHandshakeStateTLS13) readServerFinished() error { + c := hs.c + + // finishedMsg is included in the transcript, but not until after we + // check the client version, since the state before this message was + // sent is used during verification. + msg, err := c.readHandshake(nil) + if err != nil { + return err + } + + finished, ok := msg.(*finishedMsg) + if !ok { + c.sendAlert(alertUnexpectedMessage) + return unexpectedMessageError(finished, msg) + } + + expectedMAC := hs.suite.finishedHash(c.in.trafficSecret, hs.transcript) + if !hmac.Equal(expectedMAC, finished.verifyData) { + c.sendAlert(alertDecryptError) + return errors.New("tls: invalid server finished hash") + } + + if err := transcriptMsg(finished, hs.transcript); err != nil { + return err + } + + // Derive secrets that take context through the server Finished. + + hs.trafficSecret = hs.masterSecret.ClientApplicationTrafficSecret(hs.transcript) + serverSecret := hs.masterSecret.ServerApplicationTrafficSecret(hs.transcript) + if err := c.setReadTrafficSecret(hs.suite, QUICEncryptionLevelApplication, serverSecret, false); err != nil { + return err + } + + err = c.config.writeKeyLog(keyLogLabelClientTraffic, hs.hello.random, hs.trafficSecret) + if err != nil { + c.sendAlert(alertInternalError) + return err + } + err = c.config.writeKeyLog(keyLogLabelServerTraffic, hs.hello.random, serverSecret) + if err != nil { + c.sendAlert(alertInternalError) + return err + } + + c.ekm = hs.suite.exportKeyingMaterial(hs.masterSecret, hs.transcript) + + return nil +} + +func (hs *clientHandshakeStateTLS13) sendClientCertificate() error { + c := hs.c + + if hs.certReq == nil { + return nil + } + + if hs.echContext != nil && hs.echContext.echRejected { + if _, err := hs.c.writeHandshakeRecord(&certificateMsgTLS13{}, hs.transcript); err != nil { + return err + } + return nil + } + + cert, err := c.getClientCertificate(&CertificateRequestInfo{ + AcceptableCAs: hs.certReq.certificateAuthorities, + SignatureSchemes: hs.certReq.supportedSignatureAlgorithms, + Version: c.vers, + ctx: hs.ctx, + }) + if err != nil { + return err + } + + certMsg := new(certificateMsgTLS13) + + certMsg.certificate = *cert + certMsg.scts = hs.certReq.scts && len(cert.SignedCertificateTimestamps) > 0 + certMsg.ocspStapling = hs.certReq.ocspStapling && len(cert.OCSPStaple) > 0 + + if _, err := hs.c.writeHandshakeRecord(certMsg, hs.transcript); err != nil { + return err + } + + // If we sent an empty certificate message, skip the CertificateVerify. + if len(cert.Certificate) == 0 { + return nil + } + + certVerifyMsg := new(certificateVerifyMsg) + certVerifyMsg.hasSignatureAlgorithm = true + + certVerifyMsg.signatureAlgorithm, err = selectSignatureScheme(c.vers, cert, hs.certReq.supportedSignatureAlgorithms) + if err != nil { + // getClientCertificate returned a certificate incompatible with the + // CertificateRequestInfo supported signature algorithms. + c.sendAlert(alertHandshakeFailure) + return err + } + + sigType, sigHash, err := typeAndHashFromSignatureScheme(certVerifyMsg.signatureAlgorithm) + if err != nil { + return c.sendAlert(alertInternalError) + } + + signed := signedMessage(clientSignatureContext, hs.transcript) + signOpts := crypto.SignerOpts(sigHash) + if sigType == signatureRSAPSS { + signOpts = &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash, Hash: sigHash} + } + sig, err := crypto.SignMessage(cert.PrivateKey.(crypto.Signer), c.config.rand(), signed, signOpts) + if err != nil { + c.sendAlert(alertInternalError) + return errors.New("tls: failed to sign handshake: " + err.Error()) + } + certVerifyMsg.signature = sig + + if _, err := hs.c.writeHandshakeRecord(certVerifyMsg, hs.transcript); err != nil { + return err + } + + return nil +} + +func (hs *clientHandshakeStateTLS13) sendClientFinished() error { + c := hs.c + + finished := &finishedMsg{ + verifyData: hs.suite.finishedHash(c.out.trafficSecret, hs.transcript), + } + + if _, err := hs.c.writeHandshakeRecord(finished, hs.transcript); err != nil { + return err + } + + c.setWriteTrafficSecret(hs.suite, QUICEncryptionLevelApplication, hs.trafficSecret) + + if !c.config.SessionTicketsDisabled && c.config.ClientSessionCache != nil { + c.resumptionSecret = hs.masterSecret.ResumptionMasterSecret(hs.transcript) + } + + if c.quic != nil { + c.quicSetWriteSecret(QUICEncryptionLevelApplication, hs.suite.id, hs.trafficSecret) + } + + return nil +} + +func (c *Conn) handleNewSessionTicket(msg *newSessionTicketMsgTLS13) error { + if !c.isClient { + c.sendAlert(alertUnexpectedMessage) + return errors.New("tls: received new session ticket from a client") + } + + if c.config.SessionTicketsDisabled || c.config.ClientSessionCache == nil { + return nil + } + + // See RFC 8446, Section 4.6.1. + if msg.lifetime == 0 { + return nil + } + lifetime := time.Duration(msg.lifetime) * time.Second + if lifetime > maxSessionTicketLifetime { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: received a session ticket with invalid lifetime") + } + + if len(msg.label) == 0 { + c.sendAlert(alertDecodeError) + return errors.New("tls: received a session ticket with empty opaque ticket label") + } + + // RFC 9001, Section 4.6.1 + if c.quic != nil && msg.maxEarlyData != 0 && msg.maxEarlyData != 0xffffffff { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: invalid early data for QUIC connection") + } + + cipherSuite := cipherSuiteTLS13ByID(c.cipherSuite) + if cipherSuite == nil || c.resumptionSecret == nil { + return c.sendAlert(alertInternalError) + } + + psk := tls13.ExpandLabel(cipherSuite.hash.New, c.resumptionSecret, "resumption", + msg.nonce, cipherSuite.hash.Size()) + + session := c.sessionState() + session.secret = psk + session.useBy = uint64(c.config.time().Add(lifetime).Unix()) + session.ageAdd = msg.ageAdd + session.EarlyData = c.quic != nil && msg.maxEarlyData == 0xffffffff // RFC 9001, Section 4.6.1 + session.ticket = msg.label + if c.quic != nil && c.quic.enableSessionEvents { + c.quicStoreSession(session) + return nil + } + cs := &ClientSessionState{session: session} + if cacheKey := c.clientSessionCacheKey(); cacheKey != "" { + c.config.ClientSessionCache.Put(cacheKey, cs) + } + + return nil +} diff --git a/go/src/crypto/tls/handshake_messages.go b/go/src/crypto/tls/handshake_messages.go new file mode 100644 index 0000000000000000000000000000000000000000..aa0b7db75dd493eed6b21460999bbd24289dfb00 --- /dev/null +++ b/go/src/crypto/tls/handshake_messages.go @@ -0,0 +1,1963 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "errors" + "fmt" + "slices" + "strings" + + "golang.org/x/crypto/cryptobyte" +) + +// The marshalingFunction type is an adapter to allow the use of ordinary +// functions as cryptobyte.MarshalingValue. +type marshalingFunction func(b *cryptobyte.Builder) error + +func (f marshalingFunction) Marshal(b *cryptobyte.Builder) error { + return f(b) +} + +// addBytesWithLength appends a sequence of bytes to the cryptobyte.Builder. If +// the length of the sequence is not the value specified, it produces an error. +func addBytesWithLength(b *cryptobyte.Builder, v []byte, n int) { + b.AddValue(marshalingFunction(func(b *cryptobyte.Builder) error { + if len(v) != n { + return fmt.Errorf("invalid value length: expected %d, got %d", n, len(v)) + } + b.AddBytes(v) + return nil + })) +} + +// addUint64 appends a big-endian, 64-bit value to the cryptobyte.Builder. +func addUint64(b *cryptobyte.Builder, v uint64) { + b.AddUint32(uint32(v >> 32)) + b.AddUint32(uint32(v)) +} + +// readUint64 decodes a big-endian, 64-bit value into out and advances over it. +// It reports whether the read was successful. +func readUint64(s *cryptobyte.String, out *uint64) bool { + var hi, lo uint32 + if !s.ReadUint32(&hi) || !s.ReadUint32(&lo) { + return false + } + *out = uint64(hi)<<32 | uint64(lo) + return true +} + +// readUint8LengthPrefixed acts like s.ReadUint8LengthPrefixed, but targets a +// []byte instead of a cryptobyte.String. +func readUint8LengthPrefixed(s *cryptobyte.String, out *[]byte) bool { + return s.ReadUint8LengthPrefixed((*cryptobyte.String)(out)) +} + +// readUint16LengthPrefixed acts like s.ReadUint16LengthPrefixed, but targets a +// []byte instead of a cryptobyte.String. +func readUint16LengthPrefixed(s *cryptobyte.String, out *[]byte) bool { + return s.ReadUint16LengthPrefixed((*cryptobyte.String)(out)) +} + +// readUint24LengthPrefixed acts like s.ReadUint24LengthPrefixed, but targets a +// []byte instead of a cryptobyte.String. +func readUint24LengthPrefixed(s *cryptobyte.String, out *[]byte) bool { + return s.ReadUint24LengthPrefixed((*cryptobyte.String)(out)) +} + +type clientHelloMsg struct { + original []byte + vers uint16 + random []byte + sessionId []byte + cipherSuites []uint16 + compressionMethods []uint8 + serverName string + ocspStapling bool + supportedCurves []CurveID + supportedPoints []uint8 + ticketSupported bool + sessionTicket []uint8 + supportedSignatureAlgorithms []SignatureScheme + supportedSignatureAlgorithmsCert []SignatureScheme + secureRenegotiationSupported bool + secureRenegotiation []byte + extendedMasterSecret bool + alpnProtocols []string + scts bool + supportedVersions []uint16 + cookie []byte + keyShares []keyShare + earlyData bool + pskModes []uint8 + pskIdentities []pskIdentity + pskBinders [][]byte + quicTransportParameters []byte + encryptedClientHello []byte + // extensions are only populated on the server-side of a handshake + extensions []uint16 +} + +func (m *clientHelloMsg) marshalMsg(echInner bool) ([]byte, error) { + var exts cryptobyte.Builder + if len(m.serverName) > 0 { + // RFC 6066, Section 3 + exts.AddUint16(extensionServerName) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint8(0) // name_type = host_name + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddBytes([]byte(m.serverName)) + }) + }) + }) + } + if len(m.supportedPoints) > 0 && !echInner { + // RFC 4492, Section 5.1.2 + exts.AddUint16(extensionSupportedPoints) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint8LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddBytes(m.supportedPoints) + }) + }) + } + if m.ticketSupported && !echInner { + // RFC 5077, Section 3.2 + exts.AddUint16(extensionSessionTicket) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddBytes(m.sessionTicket) + }) + } + if m.secureRenegotiationSupported && !echInner { + // RFC 5746, Section 3.2 + exts.AddUint16(extensionRenegotiationInfo) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint8LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddBytes(m.secureRenegotiation) + }) + }) + } + if m.extendedMasterSecret && !echInner { + // RFC 7627 + exts.AddUint16(extensionExtendedMasterSecret) + exts.AddUint16(0) // empty extension_data + } + if m.scts { + // RFC 6962, Section 3.3.1 + exts.AddUint16(extensionSCT) + exts.AddUint16(0) // empty extension_data + } + if m.earlyData { + // RFC 8446, Section 4.2.10 + exts.AddUint16(extensionEarlyData) + exts.AddUint16(0) // empty extension_data + } + if m.quicTransportParameters != nil { // marshal zero-length parameters when present + // RFC 9001, Section 8.2 + exts.AddUint16(extensionQUICTransportParameters) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddBytes(m.quicTransportParameters) + }) + } + if len(m.encryptedClientHello) > 0 { + exts.AddUint16(extensionEncryptedClientHello) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddBytes(m.encryptedClientHello) + }) + } + // Note that any extension that can be compressed during ECH must be + // contiguous. If any additional extensions are to be compressed they must + // be added to the following block, so that they can be properly + // decompressed on the other side. + var echOuterExts []uint16 + if m.ocspStapling { + // RFC 4366, Section 3.6 + if echInner { + echOuterExts = append(echOuterExts, extensionStatusRequest) + } else { + exts.AddUint16(extensionStatusRequest) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint8(1) // status_type = ocsp + exts.AddUint16(0) // empty responder_id_list + exts.AddUint16(0) // empty request_extensions + }) + } + } + if len(m.supportedCurves) > 0 { + // RFC 4492, sections 5.1.1 and RFC 8446, Section 4.2.7 + if echInner { + echOuterExts = append(echOuterExts, extensionSupportedCurves) + } else { + exts.AddUint16(extensionSupportedCurves) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + for _, curve := range m.supportedCurves { + exts.AddUint16(uint16(curve)) + } + }) + }) + } + } + if len(m.supportedSignatureAlgorithms) > 0 { + // RFC 5246, Section 7.4.1.4.1 + if echInner { + echOuterExts = append(echOuterExts, extensionSignatureAlgorithms) + } else { + exts.AddUint16(extensionSignatureAlgorithms) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + for _, sigAlgo := range m.supportedSignatureAlgorithms { + exts.AddUint16(uint16(sigAlgo)) + } + }) + }) + } + } + if len(m.supportedSignatureAlgorithmsCert) > 0 { + // RFC 8446, Section 4.2.3 + if echInner { + echOuterExts = append(echOuterExts, extensionSignatureAlgorithmsCert) + } else { + exts.AddUint16(extensionSignatureAlgorithmsCert) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + for _, sigAlgo := range m.supportedSignatureAlgorithmsCert { + exts.AddUint16(uint16(sigAlgo)) + } + }) + }) + } + } + if len(m.alpnProtocols) > 0 { + // RFC 7301, Section 3.1 + if echInner { + echOuterExts = append(echOuterExts, extensionALPN) + } else { + exts.AddUint16(extensionALPN) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + for _, proto := range m.alpnProtocols { + exts.AddUint8LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddBytes([]byte(proto)) + }) + } + }) + }) + } + } + if len(m.supportedVersions) > 0 { + // RFC 8446, Section 4.2.1 + if echInner { + echOuterExts = append(echOuterExts, extensionSupportedVersions) + } else { + exts.AddUint16(extensionSupportedVersions) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint8LengthPrefixed(func(exts *cryptobyte.Builder) { + for _, vers := range m.supportedVersions { + exts.AddUint16(vers) + } + }) + }) + } + } + if len(m.cookie) > 0 { + // RFC 8446, Section 4.2.2 + if echInner { + echOuterExts = append(echOuterExts, extensionCookie) + } else { + exts.AddUint16(extensionCookie) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddBytes(m.cookie) + }) + }) + } + } + if len(m.keyShares) > 0 { + // RFC 8446, Section 4.2.8 + if echInner { + echOuterExts = append(echOuterExts, extensionKeyShare) + } else { + exts.AddUint16(extensionKeyShare) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + for _, ks := range m.keyShares { + exts.AddUint16(uint16(ks.group)) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddBytes(ks.data) + }) + } + }) + }) + } + } + if len(m.pskModes) > 0 { + // RFC 8446, Section 4.2.9 + if echInner { + echOuterExts = append(echOuterExts, extensionPSKModes) + } else { + exts.AddUint16(extensionPSKModes) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint8LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddBytes(m.pskModes) + }) + }) + } + } + if len(echOuterExts) > 0 && echInner { + exts.AddUint16(extensionECHOuterExtensions) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint8LengthPrefixed(func(exts *cryptobyte.Builder) { + for _, e := range echOuterExts { + exts.AddUint16(e) + } + }) + }) + } + if len(m.pskIdentities) > 0 { // pre_shared_key must be the last extension + // RFC 8446, Section 4.2.11 + exts.AddUint16(extensionPreSharedKey) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + for _, psk := range m.pskIdentities { + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddBytes(psk.label) + }) + exts.AddUint32(psk.obfuscatedTicketAge) + } + }) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + for _, binder := range m.pskBinders { + exts.AddUint8LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddBytes(binder) + }) + } + }) + }) + } + extBytes, err := exts.Bytes() + if err != nil { + return nil, err + } + + var b cryptobyte.Builder + b.AddUint8(typeClientHello) + b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddUint16(m.vers) + addBytesWithLength(b, m.random, 32) + b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { + if !echInner { + b.AddBytes(m.sessionId) + } + }) + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + for _, suite := range m.cipherSuites { + b.AddUint16(suite) + } + }) + b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddBytes(m.compressionMethods) + }) + + if len(extBytes) > 0 { + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddBytes(extBytes) + }) + } + }) + + return b.Bytes() +} + +func (m *clientHelloMsg) marshal() ([]byte, error) { + return m.marshalMsg(false) +} + +// marshalWithoutBinders returns the ClientHello through the +// PreSharedKeyExtension.identities field, according to RFC 8446, Section +// 4.2.11.2. Note that m.pskBinders must be set to slices of the correct length. +func (m *clientHelloMsg) marshalWithoutBinders() ([]byte, error) { + bindersLen := 2 // uint16 length prefix + for _, binder := range m.pskBinders { + bindersLen += 1 // uint8 length prefix + bindersLen += len(binder) + } + + var fullMessage []byte + if m.original != nil { + fullMessage = m.original + } else { + var err error + fullMessage, err = m.marshal() + if err != nil { + return nil, err + } + } + return fullMessage[:len(fullMessage)-bindersLen], nil +} + +// updateBinders updates the m.pskBinders field. The supplied binders must have +// the same length as the current m.pskBinders. +func (m *clientHelloMsg) updateBinders(pskBinders [][]byte) error { + if len(pskBinders) != len(m.pskBinders) { + return errors.New("tls: internal error: pskBinders length mismatch") + } + for i := range m.pskBinders { + if len(pskBinders[i]) != len(m.pskBinders[i]) { + return errors.New("tls: internal error: pskBinders length mismatch") + } + } + m.pskBinders = pskBinders + + return nil +} + +func (m *clientHelloMsg) unmarshal(data []byte) bool { + *m = clientHelloMsg{original: data} + s := cryptobyte.String(data) + + if !s.Skip(4) || // message type and uint24 length field + !s.ReadUint16(&m.vers) || !s.ReadBytes(&m.random, 32) || + !readUint8LengthPrefixed(&s, &m.sessionId) { + return false + } + + var cipherSuites cryptobyte.String + if !s.ReadUint16LengthPrefixed(&cipherSuites) { + return false + } + m.cipherSuites = []uint16{} + m.secureRenegotiationSupported = false + for !cipherSuites.Empty() { + var suite uint16 + if !cipherSuites.ReadUint16(&suite) { + return false + } + if suite == scsvRenegotiation { + m.secureRenegotiationSupported = true + } + m.cipherSuites = append(m.cipherSuites, suite) + } + + if !readUint8LengthPrefixed(&s, &m.compressionMethods) { + return false + } + + if s.Empty() { + // ClientHello is optionally followed by extension data + return true + } + + var extensions cryptobyte.String + if !s.ReadUint16LengthPrefixed(&extensions) || !s.Empty() { + return false + } + + seenExts := make(map[uint16]bool) + for !extensions.Empty() { + var extension uint16 + var extData cryptobyte.String + if !extensions.ReadUint16(&extension) || + !extensions.ReadUint16LengthPrefixed(&extData) { + return false + } + + if seenExts[extension] { + return false + } + seenExts[extension] = true + m.extensions = append(m.extensions, extension) + + switch extension { + case extensionServerName: + // RFC 6066, Section 3 + var nameList cryptobyte.String + if !extData.ReadUint16LengthPrefixed(&nameList) || nameList.Empty() { + return false + } + for !nameList.Empty() { + var nameType uint8 + var serverName cryptobyte.String + if !nameList.ReadUint8(&nameType) || + !nameList.ReadUint16LengthPrefixed(&serverName) || + serverName.Empty() { + return false + } + if nameType != 0 { + continue + } + if len(m.serverName) != 0 { + // Multiple names of the same name_type are prohibited. + return false + } + m.serverName = string(serverName) + // An SNI value may not include a trailing dot. + if strings.HasSuffix(m.serverName, ".") { + return false + } + } + case extensionStatusRequest: + // RFC 4366, Section 3.6 + var statusType uint8 + var ignored cryptobyte.String + if !extData.ReadUint8(&statusType) || + !extData.ReadUint16LengthPrefixed(&ignored) || + !extData.ReadUint16LengthPrefixed(&ignored) { + return false + } + m.ocspStapling = statusType == statusTypeOCSP + case extensionSupportedCurves: + // RFC 4492, sections 5.1.1 and RFC 8446, Section 4.2.7 + var curves cryptobyte.String + if !extData.ReadUint16LengthPrefixed(&curves) || curves.Empty() { + return false + } + for !curves.Empty() { + var curve uint16 + if !curves.ReadUint16(&curve) { + return false + } + m.supportedCurves = append(m.supportedCurves, CurveID(curve)) + } + case extensionSupportedPoints: + // RFC 4492, Section 5.1.2 + if !readUint8LengthPrefixed(&extData, &m.supportedPoints) || + len(m.supportedPoints) == 0 { + return false + } + case extensionSessionTicket: + // RFC 5077, Section 3.2 + m.ticketSupported = true + extData.ReadBytes(&m.sessionTicket, len(extData)) + case extensionSignatureAlgorithms: + // RFC 5246, Section 7.4.1.4.1 + var sigAndAlgs cryptobyte.String + if !extData.ReadUint16LengthPrefixed(&sigAndAlgs) || sigAndAlgs.Empty() { + return false + } + for !sigAndAlgs.Empty() { + var sigAndAlg uint16 + if !sigAndAlgs.ReadUint16(&sigAndAlg) { + return false + } + m.supportedSignatureAlgorithms = append( + m.supportedSignatureAlgorithms, SignatureScheme(sigAndAlg)) + } + case extensionSignatureAlgorithmsCert: + // RFC 8446, Section 4.2.3 + var sigAndAlgs cryptobyte.String + if !extData.ReadUint16LengthPrefixed(&sigAndAlgs) || sigAndAlgs.Empty() { + return false + } + for !sigAndAlgs.Empty() { + var sigAndAlg uint16 + if !sigAndAlgs.ReadUint16(&sigAndAlg) { + return false + } + m.supportedSignatureAlgorithmsCert = append( + m.supportedSignatureAlgorithmsCert, SignatureScheme(sigAndAlg)) + } + case extensionRenegotiationInfo: + // RFC 5746, Section 3.2 + if !readUint8LengthPrefixed(&extData, &m.secureRenegotiation) { + return false + } + m.secureRenegotiationSupported = true + case extensionExtendedMasterSecret: + // RFC 7627 + m.extendedMasterSecret = true + case extensionALPN: + // RFC 7301, Section 3.1 + var protoList cryptobyte.String + if !extData.ReadUint16LengthPrefixed(&protoList) || protoList.Empty() { + return false + } + for !protoList.Empty() { + var proto cryptobyte.String + if !protoList.ReadUint8LengthPrefixed(&proto) || proto.Empty() { + return false + } + m.alpnProtocols = append(m.alpnProtocols, string(proto)) + } + case extensionSCT: + // RFC 6962, Section 3.3.1 + m.scts = true + case extensionSupportedVersions: + // RFC 8446, Section 4.2.1 + var versList cryptobyte.String + if !extData.ReadUint8LengthPrefixed(&versList) || versList.Empty() { + return false + } + for !versList.Empty() { + var vers uint16 + if !versList.ReadUint16(&vers) { + return false + } + m.supportedVersions = append(m.supportedVersions, vers) + } + case extensionCookie: + // RFC 8446, Section 4.2.2 + if !readUint16LengthPrefixed(&extData, &m.cookie) || + len(m.cookie) == 0 { + return false + } + case extensionKeyShare: + // RFC 8446, Section 4.2.8 + var clientShares cryptobyte.String + if !extData.ReadUint16LengthPrefixed(&clientShares) { + return false + } + for !clientShares.Empty() { + var ks keyShare + if !clientShares.ReadUint16((*uint16)(&ks.group)) || + !readUint16LengthPrefixed(&clientShares, &ks.data) || + len(ks.data) == 0 { + return false + } + m.keyShares = append(m.keyShares, ks) + } + case extensionEarlyData: + // RFC 8446, Section 4.2.10 + m.earlyData = true + case extensionPSKModes: + // RFC 8446, Section 4.2.9 + if !readUint8LengthPrefixed(&extData, &m.pskModes) { + return false + } + case extensionQUICTransportParameters: + m.quicTransportParameters = make([]byte, len(extData)) + if !extData.CopyBytes(m.quicTransportParameters) { + return false + } + case extensionPreSharedKey: + // RFC 8446, Section 4.2.11 + if !extensions.Empty() { + return false // pre_shared_key must be the last extension + } + var identities cryptobyte.String + if !extData.ReadUint16LengthPrefixed(&identities) || identities.Empty() { + return false + } + for !identities.Empty() { + var psk pskIdentity + if !readUint16LengthPrefixed(&identities, &psk.label) || + !identities.ReadUint32(&psk.obfuscatedTicketAge) || + len(psk.label) == 0 { + return false + } + m.pskIdentities = append(m.pskIdentities, psk) + } + var binders cryptobyte.String + if !extData.ReadUint16LengthPrefixed(&binders) || binders.Empty() { + return false + } + for !binders.Empty() { + var binder []byte + if !readUint8LengthPrefixed(&binders, &binder) || + len(binder) == 0 { + return false + } + m.pskBinders = append(m.pskBinders, binder) + } + case extensionEncryptedClientHello: + if !extData.ReadBytes(&m.encryptedClientHello, len(extData)) { + return false + } + default: + // Ignore unknown extensions. + continue + } + + if !extData.Empty() { + return false + } + } + + return true +} + +func (m *clientHelloMsg) originalBytes() []byte { + return m.original +} + +func (m *clientHelloMsg) clone() *clientHelloMsg { + return &clientHelloMsg{ + original: slices.Clone(m.original), + vers: m.vers, + random: slices.Clone(m.random), + sessionId: slices.Clone(m.sessionId), + cipherSuites: slices.Clone(m.cipherSuites), + compressionMethods: slices.Clone(m.compressionMethods), + serverName: m.serverName, + ocspStapling: m.ocspStapling, + supportedCurves: slices.Clone(m.supportedCurves), + supportedPoints: slices.Clone(m.supportedPoints), + ticketSupported: m.ticketSupported, + sessionTicket: slices.Clone(m.sessionTicket), + supportedSignatureAlgorithms: slices.Clone(m.supportedSignatureAlgorithms), + supportedSignatureAlgorithmsCert: slices.Clone(m.supportedSignatureAlgorithmsCert), + secureRenegotiationSupported: m.secureRenegotiationSupported, + secureRenegotiation: slices.Clone(m.secureRenegotiation), + extendedMasterSecret: m.extendedMasterSecret, + alpnProtocols: slices.Clone(m.alpnProtocols), + scts: m.scts, + supportedVersions: slices.Clone(m.supportedVersions), + cookie: slices.Clone(m.cookie), + keyShares: slices.Clone(m.keyShares), + earlyData: m.earlyData, + pskModes: slices.Clone(m.pskModes), + pskIdentities: slices.Clone(m.pskIdentities), + pskBinders: slices.Clone(m.pskBinders), + quicTransportParameters: slices.Clone(m.quicTransportParameters), + encryptedClientHello: slices.Clone(m.encryptedClientHello), + } +} + +type serverHelloMsg struct { + original []byte + vers uint16 + random []byte + sessionId []byte + cipherSuite uint16 + compressionMethod uint8 + ocspStapling bool + ticketSupported bool + secureRenegotiationSupported bool + secureRenegotiation []byte + extendedMasterSecret bool + alpnProtocol string + scts [][]byte + supportedVersion uint16 + serverShare keyShare + selectedIdentityPresent bool + selectedIdentity uint16 + supportedPoints []uint8 + encryptedClientHello []byte + serverNameAck bool + + // HelloRetryRequest extensions + cookie []byte + selectedGroup CurveID +} + +func (m *serverHelloMsg) marshal() ([]byte, error) { + var exts cryptobyte.Builder + if m.ocspStapling { + exts.AddUint16(extensionStatusRequest) + exts.AddUint16(0) // empty extension_data + } + if m.ticketSupported { + exts.AddUint16(extensionSessionTicket) + exts.AddUint16(0) // empty extension_data + } + if m.secureRenegotiationSupported { + exts.AddUint16(extensionRenegotiationInfo) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint8LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddBytes(m.secureRenegotiation) + }) + }) + } + if m.extendedMasterSecret { + exts.AddUint16(extensionExtendedMasterSecret) + exts.AddUint16(0) // empty extension_data + } + if len(m.alpnProtocol) > 0 { + exts.AddUint16(extensionALPN) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint8LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddBytes([]byte(m.alpnProtocol)) + }) + }) + }) + } + if len(m.scts) > 0 { + exts.AddUint16(extensionSCT) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + for _, sct := range m.scts { + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddBytes(sct) + }) + } + }) + }) + } + if m.supportedVersion != 0 { + exts.AddUint16(extensionSupportedVersions) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint16(m.supportedVersion) + }) + } + if m.serverShare.group != 0 { + exts.AddUint16(extensionKeyShare) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint16(uint16(m.serverShare.group)) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddBytes(m.serverShare.data) + }) + }) + } + if m.selectedIdentityPresent { + exts.AddUint16(extensionPreSharedKey) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint16(m.selectedIdentity) + }) + } + + if len(m.cookie) > 0 { + exts.AddUint16(extensionCookie) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddBytes(m.cookie) + }) + }) + } + if m.selectedGroup != 0 { + exts.AddUint16(extensionKeyShare) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint16(uint16(m.selectedGroup)) + }) + } + if len(m.supportedPoints) > 0 { + exts.AddUint16(extensionSupportedPoints) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddUint8LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddBytes(m.supportedPoints) + }) + }) + } + if len(m.encryptedClientHello) > 0 { + exts.AddUint16(extensionEncryptedClientHello) + exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) { + exts.AddBytes(m.encryptedClientHello) + }) + } + if m.serverNameAck { + exts.AddUint16(extensionServerName) + exts.AddUint16(0) + } + + extBytes, err := exts.Bytes() + if err != nil { + return nil, err + } + + var b cryptobyte.Builder + b.AddUint8(typeServerHello) + b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddUint16(m.vers) + addBytesWithLength(b, m.random, 32) + b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddBytes(m.sessionId) + }) + b.AddUint16(m.cipherSuite) + b.AddUint8(m.compressionMethod) + + if len(extBytes) > 0 { + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddBytes(extBytes) + }) + } + }) + + return b.Bytes() +} + +func (m *serverHelloMsg) unmarshal(data []byte) bool { + *m = serverHelloMsg{original: data} + s := cryptobyte.String(data) + + if !s.Skip(4) || // message type and uint24 length field + !s.ReadUint16(&m.vers) || !s.ReadBytes(&m.random, 32) || + !readUint8LengthPrefixed(&s, &m.sessionId) || + !s.ReadUint16(&m.cipherSuite) || + !s.ReadUint8(&m.compressionMethod) { + return false + } + + if s.Empty() { + // ServerHello is optionally followed by extension data + return true + } + + var extensions cryptobyte.String + if !s.ReadUint16LengthPrefixed(&extensions) || !s.Empty() { + return false + } + + seenExts := make(map[uint16]bool) + for !extensions.Empty() { + var extension uint16 + var extData cryptobyte.String + if !extensions.ReadUint16(&extension) || + !extensions.ReadUint16LengthPrefixed(&extData) { + return false + } + + if seenExts[extension] { + return false + } + seenExts[extension] = true + + switch extension { + case extensionStatusRequest: + m.ocspStapling = true + case extensionSessionTicket: + m.ticketSupported = true + case extensionRenegotiationInfo: + if !readUint8LengthPrefixed(&extData, &m.secureRenegotiation) { + return false + } + m.secureRenegotiationSupported = true + case extensionExtendedMasterSecret: + m.extendedMasterSecret = true + case extensionALPN: + var protoList cryptobyte.String + if !extData.ReadUint16LengthPrefixed(&protoList) || protoList.Empty() { + return false + } + var proto cryptobyte.String + if !protoList.ReadUint8LengthPrefixed(&proto) || + proto.Empty() || !protoList.Empty() { + return false + } + m.alpnProtocol = string(proto) + case extensionSCT: + var sctList cryptobyte.String + if !extData.ReadUint16LengthPrefixed(&sctList) || sctList.Empty() { + return false + } + for !sctList.Empty() { + var sct []byte + if !readUint16LengthPrefixed(&sctList, &sct) || + len(sct) == 0 { + return false + } + m.scts = append(m.scts, sct) + } + case extensionSupportedVersions: + if !extData.ReadUint16(&m.supportedVersion) { + return false + } + case extensionCookie: + if !readUint16LengthPrefixed(&extData, &m.cookie) || + len(m.cookie) == 0 { + return false + } + case extensionKeyShare: + // This extension has different formats in SH and HRR, accept either + // and let the handshake logic decide. See RFC 8446, Section 4.2.8. + if len(extData) == 2 { + if !extData.ReadUint16((*uint16)(&m.selectedGroup)) { + return false + } + } else { + if !extData.ReadUint16((*uint16)(&m.serverShare.group)) || + !readUint16LengthPrefixed(&extData, &m.serverShare.data) { + return false + } + } + case extensionPreSharedKey: + m.selectedIdentityPresent = true + if !extData.ReadUint16(&m.selectedIdentity) { + return false + } + case extensionSupportedPoints: + // RFC 4492, Section 5.1.2 + if !readUint8LengthPrefixed(&extData, &m.supportedPoints) || + len(m.supportedPoints) == 0 { + return false + } + case extensionEncryptedClientHello: // encrypted_client_hello + m.encryptedClientHello = make([]byte, len(extData)) + if !extData.CopyBytes(m.encryptedClientHello) { + return false + } + case extensionServerName: + if len(extData) != 0 { + return false + } + m.serverNameAck = true + default: + // Ignore unknown extensions. + continue + } + + if !extData.Empty() { + return false + } + } + + return true +} + +func (m *serverHelloMsg) originalBytes() []byte { + return m.original +} + +type encryptedExtensionsMsg struct { + alpnProtocol string + quicTransportParameters []byte + earlyData bool + echRetryConfigs []byte + serverNameAck bool +} + +func (m *encryptedExtensionsMsg) marshal() ([]byte, error) { + var b cryptobyte.Builder + b.AddUint8(typeEncryptedExtensions) + b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + if len(m.alpnProtocol) > 0 { + b.AddUint16(extensionALPN) + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddBytes([]byte(m.alpnProtocol)) + }) + }) + }) + } + if m.quicTransportParameters != nil { // marshal zero-length parameters when present + // draft-ietf-quic-tls-32, Section 8.2 + b.AddUint16(extensionQUICTransportParameters) + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddBytes(m.quicTransportParameters) + }) + } + if m.earlyData { + // RFC 8446, Section 4.2.10 + b.AddUint16(extensionEarlyData) + b.AddUint16(0) // empty extension_data + } + if len(m.echRetryConfigs) > 0 { + b.AddUint16(extensionEncryptedClientHello) + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddBytes(m.echRetryConfigs) + }) + } + if m.serverNameAck { + b.AddUint16(extensionServerName) + b.AddUint16(0) // empty extension_data + } + }) + }) + + return b.Bytes() +} + +func (m *encryptedExtensionsMsg) unmarshal(data []byte) bool { + *m = encryptedExtensionsMsg{} + s := cryptobyte.String(data) + + var extensions cryptobyte.String + if !s.Skip(4) || // message type and uint24 length field + !s.ReadUint16LengthPrefixed(&extensions) || !s.Empty() { + return false + } + + seenExts := make(map[uint16]bool) + for !extensions.Empty() { + var extension uint16 + var extData cryptobyte.String + if !extensions.ReadUint16(&extension) || + !extensions.ReadUint16LengthPrefixed(&extData) { + return false + } + + if seenExts[extension] { + return false + } + seenExts[extension] = true + + switch extension { + case extensionALPN: + var protoList cryptobyte.String + if !extData.ReadUint16LengthPrefixed(&protoList) || protoList.Empty() { + return false + } + var proto cryptobyte.String + if !protoList.ReadUint8LengthPrefixed(&proto) || + proto.Empty() || !protoList.Empty() { + return false + } + m.alpnProtocol = string(proto) + case extensionQUICTransportParameters: + m.quicTransportParameters = make([]byte, len(extData)) + if !extData.CopyBytes(m.quicTransportParameters) { + return false + } + case extensionEarlyData: + // RFC 8446, Section 4.2.10 + m.earlyData = true + case extensionEncryptedClientHello: + m.echRetryConfigs = make([]byte, len(extData)) + if !extData.CopyBytes(m.echRetryConfigs) { + return false + } + case extensionServerName: + if len(extData) != 0 { + return false + } + m.serverNameAck = true + default: + // Ignore unknown extensions. + continue + } + + if !extData.Empty() { + return false + } + } + + return true +} + +type endOfEarlyDataMsg struct{} + +func (m *endOfEarlyDataMsg) marshal() ([]byte, error) { + x := make([]byte, 4) + x[0] = typeEndOfEarlyData + return x, nil +} + +func (m *endOfEarlyDataMsg) unmarshal(data []byte) bool { + return len(data) == 4 +} + +type keyUpdateMsg struct { + updateRequested bool +} + +func (m *keyUpdateMsg) marshal() ([]byte, error) { + var b cryptobyte.Builder + b.AddUint8(typeKeyUpdate) + b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { + if m.updateRequested { + b.AddUint8(1) + } else { + b.AddUint8(0) + } + }) + + return b.Bytes() +} + +func (m *keyUpdateMsg) unmarshal(data []byte) bool { + s := cryptobyte.String(data) + + var updateRequested uint8 + if !s.Skip(4) || // message type and uint24 length field + !s.ReadUint8(&updateRequested) || !s.Empty() { + return false + } + switch updateRequested { + case 0: + m.updateRequested = false + case 1: + m.updateRequested = true + default: + return false + } + return true +} + +type newSessionTicketMsgTLS13 struct { + lifetime uint32 + ageAdd uint32 + nonce []byte + label []byte + maxEarlyData uint32 +} + +func (m *newSessionTicketMsgTLS13) marshal() ([]byte, error) { + var b cryptobyte.Builder + b.AddUint8(typeNewSessionTicket) + b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddUint32(m.lifetime) + b.AddUint32(m.ageAdd) + b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddBytes(m.nonce) + }) + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddBytes(m.label) + }) + + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + if m.maxEarlyData > 0 { + b.AddUint16(extensionEarlyData) + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddUint32(m.maxEarlyData) + }) + } + }) + }) + + return b.Bytes() +} + +func (m *newSessionTicketMsgTLS13) unmarshal(data []byte) bool { + *m = newSessionTicketMsgTLS13{} + s := cryptobyte.String(data) + + var extensions cryptobyte.String + if !s.Skip(4) || // message type and uint24 length field + !s.ReadUint32(&m.lifetime) || + !s.ReadUint32(&m.ageAdd) || + !readUint8LengthPrefixed(&s, &m.nonce) || + !readUint16LengthPrefixed(&s, &m.label) || + !s.ReadUint16LengthPrefixed(&extensions) || + !s.Empty() { + return false + } + + for !extensions.Empty() { + var extension uint16 + var extData cryptobyte.String + if !extensions.ReadUint16(&extension) || + !extensions.ReadUint16LengthPrefixed(&extData) { + return false + } + + switch extension { + case extensionEarlyData: + if !extData.ReadUint32(&m.maxEarlyData) { + return false + } + default: + // Ignore unknown extensions. + continue + } + + if !extData.Empty() { + return false + } + } + + return true +} + +type certificateRequestMsgTLS13 struct { + ocspStapling bool + scts bool + supportedSignatureAlgorithms []SignatureScheme + supportedSignatureAlgorithmsCert []SignatureScheme + certificateAuthorities [][]byte +} + +func (m *certificateRequestMsgTLS13) marshal() ([]byte, error) { + var b cryptobyte.Builder + b.AddUint8(typeCertificateRequest) + b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { + // certificate_request_context (SHALL be zero length unless used for + // post-handshake authentication) + b.AddUint8(0) + + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + if m.ocspStapling { + b.AddUint16(extensionStatusRequest) + b.AddUint16(0) // empty extension_data + } + if m.scts { + // RFC 8446, Section 4.4.2.1 makes no mention of + // signed_certificate_timestamp in CertificateRequest, but + // "Extensions in the Certificate message from the client MUST + // correspond to extensions in the CertificateRequest message + // from the server." and it appears in the table in Section 4.2. + b.AddUint16(extensionSCT) + b.AddUint16(0) // empty extension_data + } + if len(m.supportedSignatureAlgorithms) > 0 { + b.AddUint16(extensionSignatureAlgorithms) + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + for _, sigAlgo := range m.supportedSignatureAlgorithms { + b.AddUint16(uint16(sigAlgo)) + } + }) + }) + } + if len(m.supportedSignatureAlgorithmsCert) > 0 { + b.AddUint16(extensionSignatureAlgorithmsCert) + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + for _, sigAlgo := range m.supportedSignatureAlgorithmsCert { + b.AddUint16(uint16(sigAlgo)) + } + }) + }) + } + if len(m.certificateAuthorities) > 0 { + b.AddUint16(extensionCertificateAuthorities) + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + for _, ca := range m.certificateAuthorities { + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddBytes(ca) + }) + } + }) + }) + } + }) + }) + + return b.Bytes() +} + +func (m *certificateRequestMsgTLS13) unmarshal(data []byte) bool { + *m = certificateRequestMsgTLS13{} + s := cryptobyte.String(data) + + var context, extensions cryptobyte.String + if !s.Skip(4) || // message type and uint24 length field + !s.ReadUint8LengthPrefixed(&context) || !context.Empty() || + !s.ReadUint16LengthPrefixed(&extensions) || + !s.Empty() { + return false + } + + for !extensions.Empty() { + var extension uint16 + var extData cryptobyte.String + if !extensions.ReadUint16(&extension) || + !extensions.ReadUint16LengthPrefixed(&extData) { + return false + } + + switch extension { + case extensionStatusRequest: + m.ocspStapling = true + case extensionSCT: + m.scts = true + case extensionSignatureAlgorithms: + var sigAndAlgs cryptobyte.String + if !extData.ReadUint16LengthPrefixed(&sigAndAlgs) || sigAndAlgs.Empty() { + return false + } + for !sigAndAlgs.Empty() { + var sigAndAlg uint16 + if !sigAndAlgs.ReadUint16(&sigAndAlg) { + return false + } + m.supportedSignatureAlgorithms = append( + m.supportedSignatureAlgorithms, SignatureScheme(sigAndAlg)) + } + case extensionSignatureAlgorithmsCert: + var sigAndAlgs cryptobyte.String + if !extData.ReadUint16LengthPrefixed(&sigAndAlgs) || sigAndAlgs.Empty() { + return false + } + for !sigAndAlgs.Empty() { + var sigAndAlg uint16 + if !sigAndAlgs.ReadUint16(&sigAndAlg) { + return false + } + m.supportedSignatureAlgorithmsCert = append( + m.supportedSignatureAlgorithmsCert, SignatureScheme(sigAndAlg)) + } + case extensionCertificateAuthorities: + var auths cryptobyte.String + if !extData.ReadUint16LengthPrefixed(&auths) || auths.Empty() { + return false + } + for !auths.Empty() { + var ca []byte + if !readUint16LengthPrefixed(&auths, &ca) || len(ca) == 0 { + return false + } + m.certificateAuthorities = append(m.certificateAuthorities, ca) + } + default: + // Ignore unknown extensions. + continue + } + + if !extData.Empty() { + return false + } + } + + return true +} + +type certificateMsg struct { + certificates [][]byte +} + +func (m *certificateMsg) marshal() ([]byte, error) { + var i int + for _, slice := range m.certificates { + i += len(slice) + } + + length := 3 + 3*len(m.certificates) + i + x := make([]byte, 4+length) + x[0] = typeCertificate + x[1] = uint8(length >> 16) + x[2] = uint8(length >> 8) + x[3] = uint8(length) + + certificateOctets := length - 3 + x[4] = uint8(certificateOctets >> 16) + x[5] = uint8(certificateOctets >> 8) + x[6] = uint8(certificateOctets) + + y := x[7:] + for _, slice := range m.certificates { + y[0] = uint8(len(slice) >> 16) + y[1] = uint8(len(slice) >> 8) + y[2] = uint8(len(slice)) + copy(y[3:], slice) + y = y[3+len(slice):] + } + + return x, nil +} + +func (m *certificateMsg) unmarshal(data []byte) bool { + if len(data) < 7 { + return false + } + + certsLen := uint32(data[4])<<16 | uint32(data[5])<<8 | uint32(data[6]) + if uint32(len(data)) != certsLen+7 { + return false + } + + numCerts := 0 + d := data[7:] + for certsLen > 0 { + if len(d) < 4 { + return false + } + certLen := uint32(d[0])<<16 | uint32(d[1])<<8 | uint32(d[2]) + if uint32(len(d)) < 3+certLen { + return false + } + d = d[3+certLen:] + certsLen -= 3 + certLen + numCerts++ + } + + m.certificates = make([][]byte, numCerts) + d = data[7:] + for i := 0; i < numCerts; i++ { + certLen := uint32(d[0])<<16 | uint32(d[1])<<8 | uint32(d[2]) + m.certificates[i] = d[3 : 3+certLen] + d = d[3+certLen:] + } + + return true +} + +type certificateMsgTLS13 struct { + certificate Certificate + ocspStapling bool + scts bool +} + +func (m *certificateMsgTLS13) marshal() ([]byte, error) { + var b cryptobyte.Builder + b.AddUint8(typeCertificate) + b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddUint8(0) // certificate_request_context + + certificate := m.certificate + if !m.ocspStapling { + certificate.OCSPStaple = nil + } + if !m.scts { + certificate.SignedCertificateTimestamps = nil + } + marshalCertificate(b, certificate) + }) + + return b.Bytes() +} + +func marshalCertificate(b *cryptobyte.Builder, certificate Certificate) { + b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { + for i, cert := range certificate.Certificate { + b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddBytes(cert) + }) + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + if i > 0 { + // This library only supports OCSP and SCT for leaf certificates. + return + } + if certificate.OCSPStaple != nil { + b.AddUint16(extensionStatusRequest) + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddUint8(statusTypeOCSP) + b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddBytes(certificate.OCSPStaple) + }) + }) + } + if certificate.SignedCertificateTimestamps != nil { + b.AddUint16(extensionSCT) + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + for _, sct := range certificate.SignedCertificateTimestamps { + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddBytes(sct) + }) + } + }) + }) + } + }) + } + }) +} + +func (m *certificateMsgTLS13) unmarshal(data []byte) bool { + *m = certificateMsgTLS13{} + s := cryptobyte.String(data) + + var context cryptobyte.String + if !s.Skip(4) || // message type and uint24 length field + !s.ReadUint8LengthPrefixed(&context) || !context.Empty() || + !unmarshalCertificate(&s, &m.certificate) || + !s.Empty() { + return false + } + + m.scts = m.certificate.SignedCertificateTimestamps != nil + m.ocspStapling = m.certificate.OCSPStaple != nil + + return true +} + +func unmarshalCertificate(s *cryptobyte.String, certificate *Certificate) bool { + var certList cryptobyte.String + if !s.ReadUint24LengthPrefixed(&certList) { + return false + } + for !certList.Empty() { + var cert []byte + var extensions cryptobyte.String + if !readUint24LengthPrefixed(&certList, &cert) || + !certList.ReadUint16LengthPrefixed(&extensions) { + return false + } + certificate.Certificate = append(certificate.Certificate, cert) + for !extensions.Empty() { + var extension uint16 + var extData cryptobyte.String + if !extensions.ReadUint16(&extension) || + !extensions.ReadUint16LengthPrefixed(&extData) { + return false + } + if len(certificate.Certificate) > 1 { + // This library only supports OCSP and SCT for leaf certificates. + continue + } + + switch extension { + case extensionStatusRequest: + var statusType uint8 + if !extData.ReadUint8(&statusType) || statusType != statusTypeOCSP || + !readUint24LengthPrefixed(&extData, &certificate.OCSPStaple) || + len(certificate.OCSPStaple) == 0 { + return false + } + case extensionSCT: + var sctList cryptobyte.String + if !extData.ReadUint16LengthPrefixed(&sctList) || sctList.Empty() { + return false + } + for !sctList.Empty() { + var sct []byte + if !readUint16LengthPrefixed(&sctList, &sct) || + len(sct) == 0 { + return false + } + certificate.SignedCertificateTimestamps = append( + certificate.SignedCertificateTimestamps, sct) + } + default: + // Ignore unknown extensions. + continue + } + + if !extData.Empty() { + return false + } + } + } + return true +} + +type serverKeyExchangeMsg struct { + key []byte +} + +func (m *serverKeyExchangeMsg) marshal() ([]byte, error) { + length := len(m.key) + x := make([]byte, length+4) + x[0] = typeServerKeyExchange + x[1] = uint8(length >> 16) + x[2] = uint8(length >> 8) + x[3] = uint8(length) + copy(x[4:], m.key) + + return x, nil +} + +func (m *serverKeyExchangeMsg) unmarshal(data []byte) bool { + if len(data) < 4 { + return false + } + m.key = data[4:] + return true +} + +type certificateStatusMsg struct { + response []byte +} + +func (m *certificateStatusMsg) marshal() ([]byte, error) { + var b cryptobyte.Builder + b.AddUint8(typeCertificateStatus) + b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddUint8(statusTypeOCSP) + b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddBytes(m.response) + }) + }) + + return b.Bytes() +} + +func (m *certificateStatusMsg) unmarshal(data []byte) bool { + s := cryptobyte.String(data) + + var statusType uint8 + if !s.Skip(4) || // message type and uint24 length field + !s.ReadUint8(&statusType) || statusType != statusTypeOCSP || + !readUint24LengthPrefixed(&s, &m.response) || + len(m.response) == 0 || !s.Empty() { + return false + } + return true +} + +type serverHelloDoneMsg struct{} + +func (m *serverHelloDoneMsg) marshal() ([]byte, error) { + x := make([]byte, 4) + x[0] = typeServerHelloDone + return x, nil +} + +func (m *serverHelloDoneMsg) unmarshal(data []byte) bool { + return len(data) == 4 +} + +type clientKeyExchangeMsg struct { + ciphertext []byte +} + +func (m *clientKeyExchangeMsg) marshal() ([]byte, error) { + length := len(m.ciphertext) + x := make([]byte, length+4) + x[0] = typeClientKeyExchange + x[1] = uint8(length >> 16) + x[2] = uint8(length >> 8) + x[3] = uint8(length) + copy(x[4:], m.ciphertext) + + return x, nil +} + +func (m *clientKeyExchangeMsg) unmarshal(data []byte) bool { + if len(data) < 4 { + return false + } + l := int(data[1])<<16 | int(data[2])<<8 | int(data[3]) + if l != len(data)-4 { + return false + } + m.ciphertext = data[4:] + return true +} + +type finishedMsg struct { + verifyData []byte +} + +func (m *finishedMsg) marshal() ([]byte, error) { + var b cryptobyte.Builder + b.AddUint8(typeFinished) + b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddBytes(m.verifyData) + }) + + return b.Bytes() +} + +func (m *finishedMsg) unmarshal(data []byte) bool { + s := cryptobyte.String(data) + return s.Skip(1) && + readUint24LengthPrefixed(&s, &m.verifyData) && + s.Empty() +} + +type certificateRequestMsg struct { + // hasSignatureAlgorithm indicates whether this message includes a list of + // supported signature algorithms. This change was introduced with TLS 1.2. + hasSignatureAlgorithm bool + + certificateTypes []byte + supportedSignatureAlgorithms []SignatureScheme + certificateAuthorities [][]byte +} + +func (m *certificateRequestMsg) marshal() ([]byte, error) { + // See RFC 4346, Section 7.4.4. + length := 1 + len(m.certificateTypes) + 2 + casLength := 0 + for _, ca := range m.certificateAuthorities { + casLength += 2 + len(ca) + } + length += casLength + + if m.hasSignatureAlgorithm { + length += 2 + 2*len(m.supportedSignatureAlgorithms) + } + + x := make([]byte, 4+length) + x[0] = typeCertificateRequest + x[1] = uint8(length >> 16) + x[2] = uint8(length >> 8) + x[3] = uint8(length) + + x[4] = uint8(len(m.certificateTypes)) + + copy(x[5:], m.certificateTypes) + y := x[5+len(m.certificateTypes):] + + if m.hasSignatureAlgorithm { + n := len(m.supportedSignatureAlgorithms) * 2 + y[0] = uint8(n >> 8) + y[1] = uint8(n) + y = y[2:] + for _, sigAlgo := range m.supportedSignatureAlgorithms { + y[0] = uint8(sigAlgo >> 8) + y[1] = uint8(sigAlgo) + y = y[2:] + } + } + + y[0] = uint8(casLength >> 8) + y[1] = uint8(casLength) + y = y[2:] + for _, ca := range m.certificateAuthorities { + y[0] = uint8(len(ca) >> 8) + y[1] = uint8(len(ca)) + y = y[2:] + copy(y, ca) + y = y[len(ca):] + } + + return x, nil +} + +func (m *certificateRequestMsg) unmarshal(data []byte) bool { + if len(data) < 5 { + return false + } + + length := uint32(data[1])<<16 | uint32(data[2])<<8 | uint32(data[3]) + if uint32(len(data))-4 != length { + return false + } + + numCertTypes := int(data[4]) + data = data[5:] + if numCertTypes == 0 || len(data) <= numCertTypes { + return false + } + + m.certificateTypes = make([]byte, numCertTypes) + if copy(m.certificateTypes, data) != numCertTypes { + return false + } + + data = data[numCertTypes:] + + if m.hasSignatureAlgorithm { + if len(data) < 2 { + return false + } + sigAndHashLen := uint16(data[0])<<8 | uint16(data[1]) + data = data[2:] + if sigAndHashLen&1 != 0 || sigAndHashLen == 0 { + return false + } + if len(data) < int(sigAndHashLen) { + return false + } + numSigAlgos := sigAndHashLen / 2 + m.supportedSignatureAlgorithms = make([]SignatureScheme, numSigAlgos) + for i := range m.supportedSignatureAlgorithms { + m.supportedSignatureAlgorithms[i] = SignatureScheme(data[0])<<8 | SignatureScheme(data[1]) + data = data[2:] + } + } + + if len(data) < 2 { + return false + } + casLength := uint16(data[0])<<8 | uint16(data[1]) + data = data[2:] + if len(data) < int(casLength) { + return false + } + cas := make([]byte, casLength) + copy(cas, data) + data = data[casLength:] + + m.certificateAuthorities = nil + for len(cas) > 0 { + if len(cas) < 2 { + return false + } + caLen := uint16(cas[0])<<8 | uint16(cas[1]) + cas = cas[2:] + + if len(cas) < int(caLen) { + return false + } + + m.certificateAuthorities = append(m.certificateAuthorities, cas[:caLen]) + cas = cas[caLen:] + } + + return len(data) == 0 +} + +type certificateVerifyMsg struct { + hasSignatureAlgorithm bool // format change introduced in TLS 1.2 + signatureAlgorithm SignatureScheme + signature []byte +} + +func (m *certificateVerifyMsg) marshal() ([]byte, error) { + var b cryptobyte.Builder + b.AddUint8(typeCertificateVerify) + b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { + if m.hasSignatureAlgorithm { + b.AddUint16(uint16(m.signatureAlgorithm)) + } + b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddBytes(m.signature) + }) + }) + + return b.Bytes() +} + +func (m *certificateVerifyMsg) unmarshal(data []byte) bool { + s := cryptobyte.String(data) + + if !s.Skip(4) { // message type and uint24 length field + return false + } + if m.hasSignatureAlgorithm { + if !s.ReadUint16((*uint16)(&m.signatureAlgorithm)) { + return false + } + } + return readUint16LengthPrefixed(&s, &m.signature) && s.Empty() +} + +type newSessionTicketMsg struct { + ticket []byte +} + +func (m *newSessionTicketMsg) marshal() ([]byte, error) { + // See RFC 5077, Section 3.3. + ticketLen := len(m.ticket) + length := 2 + 4 + ticketLen + x := make([]byte, 4+length) + x[0] = typeNewSessionTicket + x[1] = uint8(length >> 16) + x[2] = uint8(length >> 8) + x[3] = uint8(length) + x[8] = uint8(ticketLen >> 8) + x[9] = uint8(ticketLen) + copy(x[10:], m.ticket) + + return x, nil +} + +func (m *newSessionTicketMsg) unmarshal(data []byte) bool { + if len(data) < 10 { + return false + } + + length := uint32(data[1])<<16 | uint32(data[2])<<8 | uint32(data[3]) + if uint32(len(data))-4 != length { + return false + } + + ticketLen := int(data[8])<<8 + int(data[9]) + if len(data)-10 != ticketLen { + return false + } + + m.ticket = data[10:] + + return true +} + +type helloRequestMsg struct { +} + +func (*helloRequestMsg) marshal() ([]byte, error) { + return []byte{typeHelloRequest, 0, 0, 0}, nil +} + +func (*helloRequestMsg) unmarshal(data []byte) bool { + return len(data) == 4 +} + +type transcriptHash interface { + Write([]byte) (int, error) +} + +// transcriptMsg is a helper used to hash messages which are not hashed when +// they are read from, or written to, the wire. This is typically the case for +// messages which are either not sent, or need to be hashed out of order from +// when they are read/written. +// +// For most messages, the message is marshalled using their marshal method, +// since their wire representation is idempotent. For clientHelloMsg and +// serverHelloMsg, we store the original wire representation of the message and +// use that for hashing, since unmarshal/marshal are not idempotent due to +// extension ordering and other malleable fields, which may cause differences +// between what was received and what we marshal. +func transcriptMsg(msg handshakeMessage, h transcriptHash) error { + if msgWithOrig, ok := msg.(handshakeMessageWithOriginalBytes); ok { + if orig := msgWithOrig.originalBytes(); orig != nil { + h.Write(msgWithOrig.originalBytes()) + return nil + } + } + + data, err := msg.marshal() + if err != nil { + return err + } + h.Write(data) + return nil +} diff --git a/go/src/crypto/tls/handshake_messages_test.go b/go/src/crypto/tls/handshake_messages_test.go new file mode 100644 index 0000000000000000000000000000000000000000..fa81a72b0de0181e43a8c1edd1eef453561251ee --- /dev/null +++ b/go/src/crypto/tls/handshake_messages_test.go @@ -0,0 +1,589 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "bytes" + "crypto/x509" + "encoding/hex" + "math" + "math/rand" + "reflect" + "strings" + "testing" + "testing/quick" + "time" +) + +var tests = []handshakeMessage{ + &clientHelloMsg{}, + &serverHelloMsg{}, + &finishedMsg{}, + + &certificateMsg{}, + &certificateRequestMsg{}, + &certificateVerifyMsg{ + hasSignatureAlgorithm: true, + }, + &certificateStatusMsg{}, + &clientKeyExchangeMsg{}, + &newSessionTicketMsg{}, + &encryptedExtensionsMsg{}, + &endOfEarlyDataMsg{}, + &keyUpdateMsg{}, + &newSessionTicketMsgTLS13{}, + &certificateRequestMsgTLS13{}, + &certificateMsgTLS13{}, + &SessionState{}, +} + +func mustMarshal(t *testing.T, msg handshakeMessage) []byte { + t.Helper() + b, err := msg.marshal() + if err != nil { + t.Fatal(err) + } + return b +} + +func TestMarshalUnmarshal(t *testing.T) { + rand := rand.New(rand.NewSource(time.Now().UnixNano())) + + for i, m := range tests { + ty := reflect.ValueOf(m).Type() + t.Run(ty.String(), func(t *testing.T) { + n := 100 + if testing.Short() { + n = 5 + } + for j := 0; j < n; j++ { + v, ok := quick.Value(ty, rand) + if !ok { + t.Errorf("#%d: failed to create value", i) + break + } + + m1 := v.Interface().(handshakeMessage) + marshaled := mustMarshal(t, m1) + if !m.unmarshal(marshaled) { + t.Errorf("#%d failed to unmarshal %#v %x", i, m1, marshaled) + break + } + + if ch, ok := m.(*clientHelloMsg); ok { + // extensions is special cased, as it is only populated by the + // server-side of a handshake and is not expected to roundtrip + // through marshal + unmarshal. m ends up with the list of + // extensions necessary to serialize the other fields of + // clientHelloMsg, so check that it is non-empty, then clear it. + if len(ch.extensions) == 0 { + t.Errorf("expected ch.extensions to be populated on unmarshal") + } + ch.extensions = nil + } + + // clientHelloMsg and serverHelloMsg, when unmarshalled, store + // their original representation, for later use in the handshake + // transcript. In order to prevent DeepEqual from failing since + // we didn't create the original message via unmarshalling, nil + // the field. + switch t := m.(type) { + case *clientHelloMsg: + t.original = nil + case *serverHelloMsg: + t.original = nil + } + + if !reflect.DeepEqual(m1, m) { + t.Errorf("#%d got:%#v want:%#v %x", i, m, m1, marshaled) + break + } + + if i >= 3 { + // The first three message types (ClientHello, + // ServerHello and Finished) are allowed to + // have parsable prefixes because the extension + // data is optional and the length of the + // Finished varies across versions. + for j := 0; j < len(marshaled); j++ { + if m.unmarshal(marshaled[0:j]) { + t.Errorf("#%d unmarshaled a prefix of length %d of %#v", i, j, m1) + break + } + } + } + } + }) + } +} + +func TestFuzz(t *testing.T) { + rand := rand.New(rand.NewSource(0)) + for _, m := range tests { + for j := 0; j < 1000; j++ { + len := rand.Intn(1000) + bytes := randomBytes(len, rand) + // This just looks for crashes due to bounds errors etc. + m.unmarshal(bytes) + } + } +} + +func randomBytes(n int, rand *rand.Rand) []byte { + r := make([]byte, n) + if _, err := rand.Read(r); err != nil { + panic("rand.Read failed: " + err.Error()) + } + return r +} + +func randomString(n int, rand *rand.Rand) string { + b := randomBytes(n, rand) + return string(b) +} + +func (*clientHelloMsg) Generate(rand *rand.Rand, size int) reflect.Value { + m := &clientHelloMsg{} + m.vers = uint16(rand.Intn(65536)) + m.random = randomBytes(32, rand) + m.sessionId = randomBytes(rand.Intn(32), rand) + m.cipherSuites = make([]uint16, rand.Intn(63)+1) + for i := 0; i < len(m.cipherSuites); i++ { + cs := uint16(rand.Int31()) + if cs == scsvRenegotiation { + cs += 1 + } + m.cipherSuites[i] = cs + } + m.compressionMethods = randomBytes(rand.Intn(63)+1, rand) + if rand.Intn(10) > 5 { + m.serverName = randomString(rand.Intn(255), rand) + for strings.HasSuffix(m.serverName, ".") { + m.serverName = m.serverName[:len(m.serverName)-1] + } + } + m.ocspStapling = rand.Intn(10) > 5 + m.supportedPoints = randomBytes(rand.Intn(5)+1, rand) + m.supportedCurves = make([]CurveID, rand.Intn(5)+1) + for i := range m.supportedCurves { + m.supportedCurves[i] = CurveID(rand.Intn(30000) + 1) + } + if rand.Intn(10) > 5 { + m.ticketSupported = true + if rand.Intn(10) > 5 { + m.sessionTicket = randomBytes(rand.Intn(300), rand) + } else { + m.sessionTicket = make([]byte, 0) + } + } + if rand.Intn(10) > 5 { + m.supportedSignatureAlgorithms = supportedSignatureAlgorithms(VersionTLS12) + } + if rand.Intn(10) > 5 { + m.supportedSignatureAlgorithmsCert = supportedSignatureAlgorithms(VersionTLS12) + } + for i := 0; i < rand.Intn(5); i++ { + m.alpnProtocols = append(m.alpnProtocols, randomString(rand.Intn(20)+1, rand)) + } + if rand.Intn(10) > 5 { + m.scts = true + } + if rand.Intn(10) > 5 { + m.secureRenegotiationSupported = true + m.secureRenegotiation = randomBytes(rand.Intn(50)+1, rand) + } + if rand.Intn(10) > 5 { + m.extendedMasterSecret = true + } + for i := 0; i < rand.Intn(5); i++ { + m.supportedVersions = append(m.supportedVersions, uint16(rand.Intn(0xffff)+1)) + } + if rand.Intn(10) > 5 { + m.cookie = randomBytes(rand.Intn(500)+1, rand) + } + for i := 0; i < rand.Intn(5); i++ { + var ks keyShare + ks.group = CurveID(rand.Intn(30000) + 1) + ks.data = randomBytes(rand.Intn(200)+1, rand) + m.keyShares = append(m.keyShares, ks) + } + switch rand.Intn(3) { + case 1: + m.pskModes = []uint8{pskModeDHE} + case 2: + m.pskModes = []uint8{pskModeDHE, pskModePlain} + } + for i := 0; i < rand.Intn(5); i++ { + var psk pskIdentity + psk.obfuscatedTicketAge = uint32(rand.Intn(500000)) + psk.label = randomBytes(rand.Intn(500)+1, rand) + m.pskIdentities = append(m.pskIdentities, psk) + m.pskBinders = append(m.pskBinders, randomBytes(rand.Intn(50)+32, rand)) + } + if rand.Intn(10) > 5 { + m.quicTransportParameters = randomBytes(rand.Intn(500), rand) + } + if rand.Intn(10) > 5 { + m.earlyData = true + } + if rand.Intn(10) > 5 { + m.encryptedClientHello = randomBytes(rand.Intn(50)+1, rand) + } + + return reflect.ValueOf(m) +} + +func (*serverHelloMsg) Generate(rand *rand.Rand, size int) reflect.Value { + m := &serverHelloMsg{} + m.vers = uint16(rand.Intn(65536)) + m.random = randomBytes(32, rand) + m.sessionId = randomBytes(rand.Intn(32), rand) + m.cipherSuite = uint16(rand.Int31()) + m.compressionMethod = uint8(rand.Intn(256)) + m.supportedPoints = randomBytes(rand.Intn(5)+1, rand) + + if rand.Intn(10) > 5 { + m.ocspStapling = true + } + if rand.Intn(10) > 5 { + m.ticketSupported = true + } + if rand.Intn(10) > 5 { + m.alpnProtocol = randomString(rand.Intn(32)+1, rand) + } + + for i := 0; i < rand.Intn(4); i++ { + m.scts = append(m.scts, randomBytes(rand.Intn(500)+1, rand)) + } + + if rand.Intn(10) > 5 { + m.secureRenegotiationSupported = true + m.secureRenegotiation = randomBytes(rand.Intn(50)+1, rand) + } + if rand.Intn(10) > 5 { + m.extendedMasterSecret = true + } + if rand.Intn(10) > 5 { + m.supportedVersion = uint16(rand.Intn(0xffff) + 1) + } + if rand.Intn(10) > 5 { + m.cookie = randomBytes(rand.Intn(500)+1, rand) + } + if rand.Intn(10) > 5 { + for i := 0; i < rand.Intn(5); i++ { + m.serverShare.group = CurveID(rand.Intn(30000) + 1) + m.serverShare.data = randomBytes(rand.Intn(200)+1, rand) + } + } else if rand.Intn(10) > 5 { + m.selectedGroup = CurveID(rand.Intn(30000) + 1) + } + if rand.Intn(10) > 5 { + m.selectedIdentityPresent = true + m.selectedIdentity = uint16(rand.Intn(0xffff)) + } + if rand.Intn(10) > 5 { + m.encryptedClientHello = randomBytes(rand.Intn(50)+1, rand) + } + if rand.Intn(10) > 5 { + m.serverNameAck = rand.Intn(2) == 1 + } + + return reflect.ValueOf(m) +} + +func (*encryptedExtensionsMsg) Generate(rand *rand.Rand, size int) reflect.Value { + m := &encryptedExtensionsMsg{} + + if rand.Intn(10) > 5 { + m.alpnProtocol = randomString(rand.Intn(32)+1, rand) + } + if rand.Intn(10) > 5 { + m.earlyData = true + } + + return reflect.ValueOf(m) +} + +func (*certificateMsg) Generate(rand *rand.Rand, size int) reflect.Value { + m := &certificateMsg{} + numCerts := rand.Intn(20) + m.certificates = make([][]byte, numCerts) + for i := 0; i < numCerts; i++ { + m.certificates[i] = randomBytes(rand.Intn(10)+1, rand) + } + return reflect.ValueOf(m) +} + +func (*certificateRequestMsg) Generate(rand *rand.Rand, size int) reflect.Value { + m := &certificateRequestMsg{} + m.certificateTypes = randomBytes(rand.Intn(5)+1, rand) + for i := 0; i < rand.Intn(100); i++ { + m.certificateAuthorities = append(m.certificateAuthorities, randomBytes(rand.Intn(15)+1, rand)) + } + return reflect.ValueOf(m) +} + +func (*certificateVerifyMsg) Generate(rand *rand.Rand, size int) reflect.Value { + m := &certificateVerifyMsg{} + m.hasSignatureAlgorithm = true + m.signatureAlgorithm = SignatureScheme(rand.Intn(30000)) + m.signature = randomBytes(rand.Intn(15)+1, rand) + return reflect.ValueOf(m) +} + +func (*certificateStatusMsg) Generate(rand *rand.Rand, size int) reflect.Value { + m := &certificateStatusMsg{} + m.response = randomBytes(rand.Intn(10)+1, rand) + return reflect.ValueOf(m) +} + +func (*clientKeyExchangeMsg) Generate(rand *rand.Rand, size int) reflect.Value { + m := &clientKeyExchangeMsg{} + m.ciphertext = randomBytes(rand.Intn(1000)+1, rand) + return reflect.ValueOf(m) +} + +func (*finishedMsg) Generate(rand *rand.Rand, size int) reflect.Value { + m := &finishedMsg{} + m.verifyData = randomBytes(12, rand) + return reflect.ValueOf(m) +} + +func (*newSessionTicketMsg) Generate(rand *rand.Rand, size int) reflect.Value { + m := &newSessionTicketMsg{} + m.ticket = randomBytes(rand.Intn(4), rand) + return reflect.ValueOf(m) +} + +var sessionTestCerts []*x509.Certificate + +func init() { + cert, err := x509.ParseCertificate(testRSACertificate) + if err != nil { + panic(err) + } + sessionTestCerts = append(sessionTestCerts, cert) + cert, err = x509.ParseCertificate(testRSACertificateIssuer) + if err != nil { + panic(err) + } + sessionTestCerts = append(sessionTestCerts, cert) +} + +func (*SessionState) Generate(rand *rand.Rand, size int) reflect.Value { + s := &SessionState{} + isTLS13 := rand.Intn(10) > 5 + if isTLS13 { + s.version = VersionTLS13 + } else { + s.version = uint16(rand.Intn(VersionTLS13)) + } + s.isClient = rand.Intn(10) > 5 + s.cipherSuite = uint16(rand.Intn(math.MaxUint16)) + s.createdAt = uint64(rand.Int63()) + s.secret = randomBytes(rand.Intn(100)+1, rand) + for n, i := rand.Intn(3), 0; i < n; i++ { + s.Extra = append(s.Extra, randomBytes(rand.Intn(100), rand)) + } + if rand.Intn(10) > 5 { + s.EarlyData = true + } + if rand.Intn(10) > 5 { + s.extMasterSecret = true + } + if s.isClient || rand.Intn(10) > 5 { + if rand.Intn(10) > 5 { + s.peerCertificates = sessionTestCerts + } else { + s.peerCertificates = sessionTestCerts[:1] + } + } + if rand.Intn(10) > 5 && s.peerCertificates != nil { + s.ocspResponse = randomBytes(rand.Intn(100)+1, rand) + } + if rand.Intn(10) > 5 && s.peerCertificates != nil { + for i := 0; i < rand.Intn(2)+1; i++ { + s.scts = append(s.scts, randomBytes(rand.Intn(500)+1, rand)) + } + } + if len(s.peerCertificates) > 0 { + for i := 0; i < rand.Intn(3); i++ { + if rand.Intn(10) > 5 { + s.verifiedChains = append(s.verifiedChains, s.peerCertificates) + } else { + s.verifiedChains = append(s.verifiedChains, s.peerCertificates[:1]) + } + } + } + if rand.Intn(10) > 5 && s.EarlyData { + s.alpnProtocol = string(randomBytes(rand.Intn(10), rand)) + } + if isTLS13 { + if s.isClient { + s.useBy = uint64(rand.Int63()) + s.ageAdd = uint32(rand.Int63() & math.MaxUint32) + } + } else { + s.curveID = CurveID(rand.Intn(30000) + 1) + } + return reflect.ValueOf(s) +} + +func (s *SessionState) marshal() ([]byte, error) { return s.Bytes() } +func (s *SessionState) unmarshal(b []byte) bool { + ss, err := ParseSessionState(b) + if err != nil { + return false + } + *s = *ss + return true +} + +func (*endOfEarlyDataMsg) Generate(rand *rand.Rand, size int) reflect.Value { + m := &endOfEarlyDataMsg{} + return reflect.ValueOf(m) +} + +func (*keyUpdateMsg) Generate(rand *rand.Rand, size int) reflect.Value { + m := &keyUpdateMsg{} + m.updateRequested = rand.Intn(10) > 5 + return reflect.ValueOf(m) +} + +func (*newSessionTicketMsgTLS13) Generate(rand *rand.Rand, size int) reflect.Value { + m := &newSessionTicketMsgTLS13{} + m.lifetime = uint32(rand.Intn(500000)) + m.ageAdd = uint32(rand.Intn(500000)) + m.nonce = randomBytes(rand.Intn(100), rand) + m.label = randomBytes(rand.Intn(1000), rand) + if rand.Intn(10) > 5 { + m.maxEarlyData = uint32(rand.Intn(500000)) + } + return reflect.ValueOf(m) +} + +func (*certificateRequestMsgTLS13) Generate(rand *rand.Rand, size int) reflect.Value { + m := &certificateRequestMsgTLS13{} + if rand.Intn(10) > 5 { + m.ocspStapling = true + } + if rand.Intn(10) > 5 { + m.scts = true + } + if rand.Intn(10) > 5 { + m.supportedSignatureAlgorithms = supportedSignatureAlgorithms(VersionTLS12) + } + if rand.Intn(10) > 5 { + m.supportedSignatureAlgorithmsCert = supportedSignatureAlgorithms(VersionTLS12) + } + if rand.Intn(10) > 5 { + m.certificateAuthorities = make([][]byte, 3) + for i := 0; i < 3; i++ { + m.certificateAuthorities[i] = randomBytes(rand.Intn(10)+1, rand) + } + } + return reflect.ValueOf(m) +} + +func (*certificateMsgTLS13) Generate(rand *rand.Rand, size int) reflect.Value { + m := &certificateMsgTLS13{} + for i := 0; i < rand.Intn(2)+1; i++ { + m.certificate.Certificate = append( + m.certificate.Certificate, randomBytes(rand.Intn(500)+1, rand)) + } + if rand.Intn(10) > 5 { + m.ocspStapling = true + m.certificate.OCSPStaple = randomBytes(rand.Intn(100)+1, rand) + } + if rand.Intn(10) > 5 { + m.scts = true + for i := 0; i < rand.Intn(2)+1; i++ { + m.certificate.SignedCertificateTimestamps = append( + m.certificate.SignedCertificateTimestamps, randomBytes(rand.Intn(500)+1, rand)) + } + } + return reflect.ValueOf(m) +} + +func TestRejectEmptySCTList(t *testing.T) { + // RFC 6962, Section 3.3.1 specifies that empty SCT lists are invalid. + + var random [32]byte + sct := []byte{0x42, 0x42, 0x42, 0x42} + serverHello := &serverHelloMsg{ + vers: VersionTLS12, + random: random[:], + scts: [][]byte{sct}, + } + serverHelloBytes := mustMarshal(t, serverHello) + + var serverHelloCopy serverHelloMsg + if !serverHelloCopy.unmarshal(serverHelloBytes) { + t.Fatal("Failed to unmarshal initial message") + } + + // Change serverHelloBytes so that the SCT list is empty + i := bytes.Index(serverHelloBytes, sct) + if i < 0 { + t.Fatal("Cannot find SCT in ServerHello") + } + + var serverHelloEmptySCT []byte + serverHelloEmptySCT = append(serverHelloEmptySCT, serverHelloBytes[:i-6]...) + // Append the extension length and SCT list length for an empty list. + serverHelloEmptySCT = append(serverHelloEmptySCT, []byte{0, 2, 0, 0}...) + serverHelloEmptySCT = append(serverHelloEmptySCT, serverHelloBytes[i+4:]...) + + // Update the handshake message length. + serverHelloEmptySCT[1] = byte((len(serverHelloEmptySCT) - 4) >> 16) + serverHelloEmptySCT[2] = byte((len(serverHelloEmptySCT) - 4) >> 8) + serverHelloEmptySCT[3] = byte(len(serverHelloEmptySCT) - 4) + + // Update the extensions length + serverHelloEmptySCT[42] = byte((len(serverHelloEmptySCT) - 44) >> 8) + serverHelloEmptySCT[43] = byte((len(serverHelloEmptySCT) - 44)) + + if serverHelloCopy.unmarshal(serverHelloEmptySCT) { + t.Fatal("Unmarshaled ServerHello with empty SCT list") + } +} + +func TestRejectEmptySCT(t *testing.T) { + // Not only must the SCT list be non-empty, but the SCT elements must + // not be zero length. + + var random [32]byte + serverHello := &serverHelloMsg{ + vers: VersionTLS12, + random: random[:], + scts: [][]byte{nil}, + } + serverHelloBytes := mustMarshal(t, serverHello) + + var serverHelloCopy serverHelloMsg + if serverHelloCopy.unmarshal(serverHelloBytes) { + t.Fatal("Unmarshaled ServerHello with zero-length SCT") + } +} + +func TestRejectDuplicateExtensions(t *testing.T) { + clientHelloBytes, err := hex.DecodeString("010000440303000000000000000000000000000000000000000000000000000000000000000000000000001c0000000a000800000568656c6c6f0000000a000800000568656c6c6f") + if err != nil { + t.Fatalf("failed to decode test ClientHello: %s", err) + } + var clientHelloCopy clientHelloMsg + if clientHelloCopy.unmarshal(clientHelloBytes) { + t.Error("Unmarshaled ClientHello with duplicate extensions") + } + + serverHelloBytes, err := hex.DecodeString("02000030030300000000000000000000000000000000000000000000000000000000000000000000000000080005000000050000") + if err != nil { + t.Fatalf("failed to decode test ServerHello: %s", err) + } + var serverHelloCopy serverHelloMsg + if serverHelloCopy.unmarshal(serverHelloBytes) { + t.Fatal("Unmarshaled ServerHello with duplicate extensions") + } +} diff --git a/go/src/crypto/tls/handshake_server.go b/go/src/crypto/tls/handshake_server.go new file mode 100644 index 0000000000000000000000000000000000000000..34dfb13b672f79a2966577c5cb8c80877ff00fea --- /dev/null +++ b/go/src/crypto/tls/handshake_server.go @@ -0,0 +1,1041 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "context" + "crypto" + "crypto/ecdsa" + "crypto/ed25519" + "crypto/rsa" + "crypto/subtle" + "crypto/tls/internal/fips140tls" + "crypto/x509" + "errors" + "fmt" + "hash" + "io" + "time" +) + +// serverHandshakeState contains details of a server handshake in progress. +// It's discarded once the handshake has completed. +type serverHandshakeState struct { + c *Conn + ctx context.Context + clientHello *clientHelloMsg + hello *serverHelloMsg + suite *cipherSuite + ecdheOk bool + ecSignOk bool + rsaDecryptOk bool + rsaSignOk bool + sessionState *SessionState + finishedHash finishedHash + masterSecret []byte + cert *Certificate +} + +// serverHandshake performs a TLS handshake as a server. +func (c *Conn) serverHandshake(ctx context.Context) error { + clientHello, ech, err := c.readClientHello(ctx) + if err != nil { + return err + } + + if c.vers == VersionTLS13 { + hs := serverHandshakeStateTLS13{ + c: c, + ctx: ctx, + clientHello: clientHello, + echContext: ech, + } + return hs.handshake() + } + + hs := serverHandshakeState{ + c: c, + ctx: ctx, + clientHello: clientHello, + } + return hs.handshake() +} + +func (hs *serverHandshakeState) handshake() error { + c := hs.c + + if err := hs.processClientHello(); err != nil { + return err + } + + // For an overview of TLS handshaking, see RFC 5246, Section 7.3. + c.buffering = true + if err := hs.checkForResumption(); err != nil { + return err + } + if hs.sessionState != nil { + // The client has included a session ticket and so we do an abbreviated handshake. + if err := hs.doResumeHandshake(); err != nil { + return err + } + if err := hs.establishKeys(); err != nil { + return err + } + if err := hs.sendSessionTicket(); err != nil { + return err + } + if err := hs.sendFinished(c.serverFinished[:]); err != nil { + return err + } + if _, err := c.flush(); err != nil { + return err + } + c.clientFinishedIsFirst = false + if err := hs.readFinished(nil); err != nil { + return err + } + } else { + // The client didn't include a session ticket, or it wasn't + // valid so we do a full handshake. + if err := hs.pickCipherSuite(); err != nil { + return err + } + if err := hs.doFullHandshake(); err != nil { + return err + } + if err := hs.establishKeys(); err != nil { + return err + } + if err := hs.readFinished(c.clientFinished[:]); err != nil { + return err + } + c.clientFinishedIsFirst = true + c.buffering = true + if err := hs.sendSessionTicket(); err != nil { + return err + } + if err := hs.sendFinished(nil); err != nil { + return err + } + if _, err := c.flush(); err != nil { + return err + } + } + + c.ekm = ekmFromMasterSecret(c.vers, hs.suite, hs.masterSecret, hs.clientHello.random, hs.hello.random) + c.isHandshakeComplete.Store(true) + + return nil +} + +// readClientHello reads a ClientHello message and selects the protocol version. +func (c *Conn) readClientHello(ctx context.Context) (*clientHelloMsg, *echServerContext, error) { + // clientHelloMsg is included in the transcript, but we haven't initialized + // it yet. The respective handshake functions will record it themselves. + msg, err := c.readHandshake(nil) + if err != nil { + return nil, nil, err + } + clientHello, ok := msg.(*clientHelloMsg) + if !ok { + c.sendAlert(alertUnexpectedMessage) + return nil, nil, unexpectedMessageError(clientHello, msg) + } + + // ECH processing has to be done before we do any other negotiation based on + // the contents of the client hello, since we may swap it out completely. + var ech *echServerContext + if len(clientHello.encryptedClientHello) != 0 { + echKeys := c.config.EncryptedClientHelloKeys + if c.config.GetEncryptedClientHelloKeys != nil { + echKeys, err = c.config.GetEncryptedClientHelloKeys(clientHelloInfo(ctx, c, clientHello)) + if err != nil { + c.sendAlert(alertInternalError) + return nil, nil, err + } + } + clientHello, ech, err = c.processECHClientHello(clientHello, echKeys) + if err != nil { + return nil, nil, err + } + } + + var configForClient *Config + originalConfig := c.config + if c.config.GetConfigForClient != nil { + chi := clientHelloInfo(ctx, c, clientHello) + if configForClient, err = c.config.GetConfigForClient(chi); err != nil { + c.sendAlert(alertInternalError) + return nil, nil, err + } else if configForClient != nil { + c.config = configForClient + } + } + c.ticketKeys = originalConfig.ticketKeys(configForClient) + + clientVersions := clientHello.supportedVersions + if clientHello.vers >= VersionTLS13 && len(clientVersions) == 0 { + // RFC 8446 4.2.1 indicates when the supported_versions extension is not sent, + // compatible servers MUST negotiate TLS 1.2 or earlier if supported, even + // if the client legacy version is TLS 1.3 or later. + // + // Since we reject empty extensionSupportedVersions in the client hello unmarshal + // finding the supportedVersions empty indicates the extension was not present. + clientVersions = supportedVersionsFromMax(VersionTLS12) + } else if len(clientVersions) == 0 { + clientVersions = supportedVersionsFromMax(clientHello.vers) + } + c.vers, ok = c.config.mutualVersion(roleServer, clientVersions) + if !ok { + c.sendAlert(alertProtocolVersion) + return nil, nil, fmt.Errorf("tls: client offered only unsupported versions: %x", clientVersions) + } + c.haveVers = true + c.in.version = c.vers + c.out.version = c.vers + + // This check reflects some odd specification implied behavior. Client-facing servers + // are supposed to reject hellos with outer ECH and inner ECH that offers 1.2, but + // backend servers are allowed to accept hellos with inner ECH that offer 1.2, since + // they cannot expect client-facing servers to behave properly. Since we act as both + // a client-facing and backend server, we only enforce 1.3 being negotiated if we + // saw a hello with outer ECH first. The spec probably should've made this an error, + // but it didn't, and this matches the boringssl behavior. + if c.vers != VersionTLS13 && (ech != nil && !ech.inner) { + c.sendAlert(alertIllegalParameter) + return nil, nil, errors.New("tls: Encrypted Client Hello cannot be used pre-TLS 1.3") + } + + if c.config.MinVersion == 0 && c.vers < VersionTLS12 { + tls10server.Value() // ensure godebug is initialized + tls10server.IncNonDefault() + } + + return clientHello, ech, nil +} + +func (hs *serverHandshakeState) processClientHello() error { + c := hs.c + + hs.hello = new(serverHelloMsg) + hs.hello.vers = c.vers + + foundCompression := false + // We only support null compression, so check that the client offered it. + for _, compression := range hs.clientHello.compressionMethods { + if compression == compressionNone { + foundCompression = true + break + } + } + + if !foundCompression { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: client does not support uncompressed connections") + } + + hs.hello.random = make([]byte, 32) + serverRandom := hs.hello.random + // Downgrade protection canaries. See RFC 8446, Section 4.1.3. + maxVers := c.config.maxSupportedVersion(roleServer) + if maxVers >= VersionTLS12 && c.vers < maxVers || testingOnlyForceDowngradeCanary { + if c.vers == VersionTLS12 { + copy(serverRandom[24:], downgradeCanaryTLS12) + } else { + copy(serverRandom[24:], downgradeCanaryTLS11) + } + serverRandom = serverRandom[:24] + } + _, err := io.ReadFull(c.config.rand(), serverRandom) + if err != nil { + c.sendAlert(alertInternalError) + return err + } + + if len(hs.clientHello.secureRenegotiation) != 0 { + c.sendAlert(alertHandshakeFailure) + return errors.New("tls: initial handshake had non-empty renegotiation extension") + } + + hs.hello.extendedMasterSecret = hs.clientHello.extendedMasterSecret + hs.hello.secureRenegotiationSupported = hs.clientHello.secureRenegotiationSupported + hs.hello.compressionMethod = compressionNone + if len(hs.clientHello.serverName) > 0 { + c.serverName = hs.clientHello.serverName + } + + selectedProto, err := negotiateALPN(c.config.NextProtos, hs.clientHello.alpnProtocols, false) + if err != nil { + c.sendAlert(alertNoApplicationProtocol) + return err + } + hs.hello.alpnProtocol = selectedProto + c.clientProtocol = selectedProto + + hs.cert, err = c.config.getCertificate(clientHelloInfo(hs.ctx, c, hs.clientHello)) + if err != nil { + if err == errNoCertificates { + c.sendAlert(alertUnrecognizedName) + } else { + c.sendAlert(alertInternalError) + } + return err + } + if hs.clientHello.scts { + hs.hello.scts = hs.cert.SignedCertificateTimestamps + } + + hs.ecdheOk, err = supportsECDHE(c.config, c.vers, hs.clientHello.supportedCurves, hs.clientHello.supportedPoints) + if err != nil { + c.sendAlert(alertMissingExtension) + return err + } + + if hs.ecdheOk && len(hs.clientHello.supportedPoints) > 0 { + // Although omitting the ec_point_formats extension is permitted, some + // old OpenSSL version will refuse to handshake if not present. + // + // Per RFC 4492, section 5.1.2, implementations MUST support the + // uncompressed point format. See golang.org/issue/31943. + hs.hello.supportedPoints = []uint8{pointFormatUncompressed} + } + + if priv, ok := hs.cert.PrivateKey.(crypto.Signer); ok { + switch priv.Public().(type) { + case *ecdsa.PublicKey: + hs.ecSignOk = true + case ed25519.PublicKey: + hs.ecSignOk = true + case *rsa.PublicKey: + hs.rsaSignOk = true + default: + c.sendAlert(alertInternalError) + return fmt.Errorf("tls: unsupported signing key type (%T)", priv.Public()) + } + } + if priv, ok := hs.cert.PrivateKey.(crypto.Decrypter); ok { + switch priv.Public().(type) { + case *rsa.PublicKey: + hs.rsaDecryptOk = true + default: + c.sendAlert(alertInternalError) + return fmt.Errorf("tls: unsupported decryption key type (%T)", priv.Public()) + } + } + + return nil +} + +// negotiateALPN picks a shared ALPN protocol that both sides support in server +// preference order. If ALPN is not configured or the peer doesn't support it, +// it returns "" and no error. +func negotiateALPN(serverProtos, clientProtos []string, quic bool) (string, error) { + if len(serverProtos) == 0 || len(clientProtos) == 0 { + if quic && len(serverProtos) != 0 { + // RFC 9001, Section 8.1 + return "", fmt.Errorf("tls: client did not request an application protocol") + } + return "", nil + } + var http11fallback bool + for _, s := range serverProtos { + for _, c := range clientProtos { + if s == c { + return s, nil + } + if s == "h2" && c == "http/1.1" { + http11fallback = true + } + } + } + // As a special case, let http/1.1 clients connect to h2 servers as if they + // didn't support ALPN. We used not to enforce protocol overlap, so over + // time a number of HTTP servers were configured with only "h2", but + // expected to accept connections from "http/1.1" clients. See Issue 46310. + if http11fallback { + return "", nil + } + return "", fmt.Errorf("tls: client requested unsupported application protocols (%q)", clientProtos) +} + +// supportsECDHE returns whether ECDHE key exchanges can be used with this +// pre-TLS 1.3 client. +func supportsECDHE(c *Config, version uint16, supportedCurves []CurveID, supportedPoints []uint8) (bool, error) { + supportsCurve := false + for _, curve := range supportedCurves { + if c.supportsCurve(version, curve) { + supportsCurve = true + break + } + } + + supportsPointFormat := false + offeredNonCompressedFormat := false + for _, pointFormat := range supportedPoints { + if pointFormat == pointFormatUncompressed { + supportsPointFormat = true + } else { + offeredNonCompressedFormat = true + } + } + // Per RFC 8422, Section 5.1.2, if the Supported Point Formats extension is + // missing, uncompressed points are supported. If supportedPoints is empty, + // the extension must be missing, as an empty extension body is rejected by + // the parser. See https://go.dev/issue/49126. + if len(supportedPoints) == 0 { + supportsPointFormat = true + } else if offeredNonCompressedFormat && !supportsPointFormat { + return false, errors.New("tls: client offered only incompatible point formats") + } + + return supportsCurve && supportsPointFormat, nil +} + +func (hs *serverHandshakeState) pickCipherSuite() error { + c := hs.c + + preferenceList := c.config.cipherSuites(isAESGCMPreferred(hs.clientHello.cipherSuites)) + + hs.suite = selectCipherSuite(preferenceList, hs.clientHello.cipherSuites, hs.cipherSuiteOk) + if hs.suite == nil { + c.sendAlert(alertHandshakeFailure) + return fmt.Errorf("tls: no cipher suite supported by both client and server; client offered: %x", + hs.clientHello.cipherSuites) + } + c.cipherSuite = hs.suite.id + + if c.config.CipherSuites == nil && !fips140tls.Required() && rsaKexCiphers[hs.suite.id] { + tlsrsakex.Value() // ensure godebug is initialized + tlsrsakex.IncNonDefault() + } + if c.config.CipherSuites == nil && !fips140tls.Required() && tdesCiphers[hs.suite.id] { + tls3des.Value() // ensure godebug is initialized + tls3des.IncNonDefault() + } + + for _, id := range hs.clientHello.cipherSuites { + if id == TLS_FALLBACK_SCSV { + // The client is doing a fallback connection. See RFC 7507. + if hs.clientHello.vers < c.config.maxSupportedVersion(roleServer) { + c.sendAlert(alertInappropriateFallback) + return errors.New("tls: client using inappropriate protocol fallback") + } + break + } + } + + return nil +} + +func (hs *serverHandshakeState) cipherSuiteOk(c *cipherSuite) bool { + if c.flags&suiteECDHE != 0 { + if !hs.ecdheOk { + return false + } + if c.flags&suiteECSign != 0 { + if !hs.ecSignOk { + return false + } + } else if !hs.rsaSignOk { + return false + } + } else if !hs.rsaDecryptOk { + return false + } + if hs.c.vers < VersionTLS12 && c.flags&suiteTLS12 != 0 { + return false + } + return true +} + +// checkForResumption reports whether we should perform resumption on this connection. +func (hs *serverHandshakeState) checkForResumption() error { + c := hs.c + + if c.config.SessionTicketsDisabled { + return nil + } + + var sessionState *SessionState + if c.config.UnwrapSession != nil { + ss, err := c.config.UnwrapSession(hs.clientHello.sessionTicket, c.connectionStateLocked()) + if err != nil { + return err + } + if ss == nil { + return nil + } + sessionState = ss + } else { + plaintext := c.config.decryptTicket(hs.clientHello.sessionTicket, c.ticketKeys) + if plaintext == nil { + return nil + } + ss, err := ParseSessionState(plaintext) + if err != nil { + return nil + } + sessionState = ss + } + + // TLS 1.2 tickets don't natively have a lifetime, but we want to avoid + // re-wrapping the same master secret in different tickets over and over for + // too long, weakening forward secrecy. + createdAt := time.Unix(int64(sessionState.createdAt), 0) + if c.config.time().Sub(createdAt) > maxSessionTicketLifetime { + return nil + } + + // Never resume a session for a different TLS version. + if c.vers != sessionState.version { + return nil + } + + cipherSuiteOk := false + // Check that the client is still offering the ciphersuite in the session. + for _, id := range hs.clientHello.cipherSuites { + if id == sessionState.cipherSuite { + cipherSuiteOk = true + break + } + } + if !cipherSuiteOk { + return nil + } + + // Check that we also support the ciphersuite from the session. + suite := selectCipherSuite([]uint16{sessionState.cipherSuite}, + c.config.supportedCipherSuites(), hs.cipherSuiteOk) + if suite == nil { + return nil + } + + sessionHasClientCerts := len(sessionState.peerCertificates) != 0 + needClientCerts := requiresClientCert(c.config.ClientAuth) + if needClientCerts && !sessionHasClientCerts { + return nil + } + if sessionHasClientCerts && c.config.ClientAuth == NoClientCert { + return nil + } + if sessionHasClientCerts && c.config.time().After(sessionState.peerCertificates[0].NotAfter) { + return nil + } + opts := x509.VerifyOptions{ + CurrentTime: c.config.time(), + Roots: c.config.ClientCAs, + KeyUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth}, + } + if sessionHasClientCerts && c.config.ClientAuth >= VerifyClientCertIfGiven && + !anyValidVerifiedChain(sessionState.verifiedChains, opts) { + return nil + } + + // RFC 7627, Section 5.3 + if !sessionState.extMasterSecret && hs.clientHello.extendedMasterSecret { + return nil + } + if sessionState.extMasterSecret && !hs.clientHello.extendedMasterSecret { + // Aborting is somewhat harsh, but it's a MUST and it would indicate a + // weird downgrade in client capabilities. + return errors.New("tls: session supported extended_master_secret but client does not") + } + if !sessionState.extMasterSecret && fips140tls.Required() { + // FIPS 140-3 requires the use of Extended Master Secret. + return nil + } + + c.peerCertificates = sessionState.peerCertificates + c.ocspResponse = sessionState.ocspResponse + c.scts = sessionState.scts + c.verifiedChains = sessionState.verifiedChains + c.extMasterSecret = sessionState.extMasterSecret + hs.sessionState = sessionState + hs.suite = suite + c.curveID = sessionState.curveID + c.didResume = true + return nil +} + +func (hs *serverHandshakeState) doResumeHandshake() error { + c := hs.c + + hs.hello.cipherSuite = hs.suite.id + c.cipherSuite = hs.suite.id + // We echo the client's session ID in the ServerHello to let it know + // that we're doing a resumption. + hs.hello.sessionId = hs.clientHello.sessionId + // We always send a new session ticket, even if it wraps the same master + // secret and it's potentially encrypted with the same key, to help the + // client avoid cross-connection tracking from a network observer. + hs.hello.ticketSupported = true + hs.finishedHash = newFinishedHash(c.vers, hs.suite) + hs.finishedHash.discardHandshakeBuffer() + if err := transcriptMsg(hs.clientHello, &hs.finishedHash); err != nil { + return err + } + if _, err := hs.c.writeHandshakeRecord(hs.hello, &hs.finishedHash); err != nil { + return err + } + + if c.config.VerifyConnection != nil { + if err := c.config.VerifyConnection(c.connectionStateLocked()); err != nil { + c.sendAlert(alertBadCertificate) + return err + } + } + + hs.masterSecret = hs.sessionState.secret + + return nil +} + +func (hs *serverHandshakeState) doFullHandshake() error { + c := hs.c + + if hs.clientHello.ocspStapling && len(hs.cert.OCSPStaple) > 0 { + hs.hello.ocspStapling = true + } + + if hs.clientHello.serverName != "" { + hs.hello.serverNameAck = true + } + + hs.hello.ticketSupported = hs.clientHello.ticketSupported && !c.config.SessionTicketsDisabled + hs.hello.cipherSuite = hs.suite.id + + hs.finishedHash = newFinishedHash(hs.c.vers, hs.suite) + if c.config.ClientAuth == NoClientCert { + // No need to keep a full record of the handshake if client + // certificates won't be used. + hs.finishedHash.discardHandshakeBuffer() + } + if err := transcriptMsg(hs.clientHello, &hs.finishedHash); err != nil { + return err + } + if _, err := hs.c.writeHandshakeRecord(hs.hello, &hs.finishedHash); err != nil { + return err + } + + certMsg := new(certificateMsg) + certMsg.certificates = hs.cert.Certificate + if _, err := hs.c.writeHandshakeRecord(certMsg, &hs.finishedHash); err != nil { + return err + } + + if hs.hello.ocspStapling { + certStatus := new(certificateStatusMsg) + certStatus.response = hs.cert.OCSPStaple + if _, err := hs.c.writeHandshakeRecord(certStatus, &hs.finishedHash); err != nil { + return err + } + } + + keyAgreement := hs.suite.ka(c.vers) + skx, err := keyAgreement.generateServerKeyExchange(c.config, hs.cert, hs.clientHello, hs.hello) + if err != nil { + c.sendAlert(alertHandshakeFailure) + return err + } + if skx != nil { + if keyAgreement, ok := keyAgreement.(*ecdheKeyAgreement); ok { + c.curveID = keyAgreement.curveID + c.peerSigAlg = keyAgreement.signatureAlgorithm + } + if _, err := hs.c.writeHandshakeRecord(skx, &hs.finishedHash); err != nil { + return err + } + } + + var certReq *certificateRequestMsg + if c.config.ClientAuth >= RequestClientCert { + // Request a client certificate + certReq = new(certificateRequestMsg) + certReq.certificateTypes = []byte{ + byte(certTypeRSASign), + byte(certTypeECDSASign), + } + if c.vers >= VersionTLS12 { + certReq.hasSignatureAlgorithm = true + certReq.supportedSignatureAlgorithms = supportedSignatureAlgorithms(c.vers) + } + + // An empty list of certificateAuthorities signals to + // the client that it may send any certificate in response + // to our request. When we know the CAs we trust, then + // we can send them down, so that the client can choose + // an appropriate certificate to give to us. + if c.config.ClientCAs != nil { + certReq.certificateAuthorities = c.config.ClientCAs.Subjects() + } + if _, err := hs.c.writeHandshakeRecord(certReq, &hs.finishedHash); err != nil { + return err + } + } + + helloDone := new(serverHelloDoneMsg) + if _, err := hs.c.writeHandshakeRecord(helloDone, &hs.finishedHash); err != nil { + return err + } + + if _, err := c.flush(); err != nil { + return err + } + + var pub crypto.PublicKey // public key for client auth, if any + + msg, err := c.readHandshake(&hs.finishedHash) + if err != nil { + return err + } + + // If we requested a client certificate, then the client must send a + // certificate message, even if it's empty. + if c.config.ClientAuth >= RequestClientCert { + certMsg, ok := msg.(*certificateMsg) + if !ok { + c.sendAlert(alertUnexpectedMessage) + return unexpectedMessageError(certMsg, msg) + } + + if err := c.processCertsFromClient(Certificate{ + Certificate: certMsg.certificates, + }); err != nil { + return err + } + if len(certMsg.certificates) != 0 { + pub = c.peerCertificates[0].PublicKey + } + + msg, err = c.readHandshake(&hs.finishedHash) + if err != nil { + return err + } + } + if c.config.VerifyConnection != nil { + if err := c.config.VerifyConnection(c.connectionStateLocked()); err != nil { + c.sendAlert(alertBadCertificate) + return err + } + } + + // Get client key exchange + ckx, ok := msg.(*clientKeyExchangeMsg) + if !ok { + c.sendAlert(alertUnexpectedMessage) + return unexpectedMessageError(ckx, msg) + } + + preMasterSecret, err := keyAgreement.processClientKeyExchange(c.config, hs.cert, ckx, c.vers) + if err != nil { + c.sendAlert(alertIllegalParameter) + return err + } + if hs.hello.extendedMasterSecret { + c.extMasterSecret = true + hs.masterSecret = extMasterFromPreMasterSecret(c.vers, hs.suite, preMasterSecret, + hs.finishedHash.Sum()) + } else { + if fips140tls.Required() { + c.sendAlert(alertHandshakeFailure) + return errors.New("tls: FIPS 140-3 requires the use of Extended Master Secret") + } + hs.masterSecret = masterFromPreMasterSecret(c.vers, hs.suite, preMasterSecret, + hs.clientHello.random, hs.hello.random) + } + if err := c.config.writeKeyLog(keyLogLabelTLS12, hs.clientHello.random, hs.masterSecret); err != nil { + c.sendAlert(alertInternalError) + return err + } + + // If we received a client cert in response to our certificate request message, + // the client will send us a certificateVerifyMsg immediately after the + // clientKeyExchangeMsg. This message is a digest of all preceding + // handshake-layer messages that is signed using the private key corresponding + // to the client's certificate. This allows us to verify that the client is in + // possession of the private key of the certificate. + if len(c.peerCertificates) > 0 { + // certificateVerifyMsg is included in the transcript, but not until + // after we verify the handshake signature, since the state before + // this message was sent is used. + msg, err = c.readHandshake(nil) + if err != nil { + return err + } + certVerify, ok := msg.(*certificateVerifyMsg) + if !ok { + c.sendAlert(alertUnexpectedMessage) + return unexpectedMessageError(certVerify, msg) + } + + var sigType uint8 + var sigHash crypto.Hash + if c.vers >= VersionTLS12 { + if !isSupportedSignatureAlgorithm(certVerify.signatureAlgorithm, certReq.supportedSignatureAlgorithms) { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: client certificate used with invalid signature algorithm") + } + sigType, sigHash, err = typeAndHashFromSignatureScheme(certVerify.signatureAlgorithm) + if err != nil { + return c.sendAlert(alertInternalError) + } + if sigHash == crypto.SHA1 { + tlssha1.Value() // ensure godebug is initialized + tlssha1.IncNonDefault() + } + if hs.finishedHash.buffer == nil { + c.sendAlert(alertInternalError) + return errors.New("tls: internal error: did not keep handshake transcript for TLS 1.2") + } + if err := verifyHandshakeSignature(sigType, pub, sigHash, hs.finishedHash.buffer, certVerify.signature); err != nil { + c.sendAlert(alertDecryptError) + return errors.New("tls: invalid signature by the client certificate: " + err.Error()) + } + } else { + sigType, sigHash, err = legacyTypeAndHashFromPublicKey(pub) + if err != nil { + c.sendAlert(alertIllegalParameter) + return err + } + signed := hs.finishedHash.hashForClientCertificate(sigType) + if err := verifyLegacyHandshakeSignature(sigType, pub, sigHash, signed, certVerify.signature); err != nil { + c.sendAlert(alertDecryptError) + return errors.New("tls: invalid signature by the client certificate: " + err.Error()) + } + } + + c.peerSigAlg = certVerify.signatureAlgorithm + + if err := transcriptMsg(certVerify, &hs.finishedHash); err != nil { + return err + } + } + + hs.finishedHash.discardHandshakeBuffer() + + return nil +} + +func (hs *serverHandshakeState) establishKeys() error { + c := hs.c + + clientMAC, serverMAC, clientKey, serverKey, clientIV, serverIV := + keysFromMasterSecret(c.vers, hs.suite, hs.masterSecret, hs.clientHello.random, hs.hello.random, hs.suite.macLen, hs.suite.keyLen, hs.suite.ivLen) + + var clientCipher, serverCipher any + var clientHash, serverHash hash.Hash + + if hs.suite.aead == nil { + clientCipher = hs.suite.cipher(clientKey, clientIV, true /* for reading */) + clientHash = hs.suite.mac(clientMAC) + serverCipher = hs.suite.cipher(serverKey, serverIV, false /* not for reading */) + serverHash = hs.suite.mac(serverMAC) + } else { + clientCipher = hs.suite.aead(clientKey, clientIV) + serverCipher = hs.suite.aead(serverKey, serverIV) + } + + c.in.prepareCipherSpec(c.vers, clientCipher, clientHash) + c.out.prepareCipherSpec(c.vers, serverCipher, serverHash) + + return nil +} + +func (hs *serverHandshakeState) readFinished(out []byte) error { + c := hs.c + + if err := c.readChangeCipherSpec(); err != nil { + return err + } + + // finishedMsg is included in the transcript, but not until after we + // check the client version, since the state before this message was + // sent is used during verification. + msg, err := c.readHandshake(nil) + if err != nil { + return err + } + clientFinished, ok := msg.(*finishedMsg) + if !ok { + c.sendAlert(alertUnexpectedMessage) + return unexpectedMessageError(clientFinished, msg) + } + + verify := hs.finishedHash.clientSum(hs.masterSecret) + if len(verify) != len(clientFinished.verifyData) || + subtle.ConstantTimeCompare(verify, clientFinished.verifyData) != 1 { + c.sendAlert(alertHandshakeFailure) + return errors.New("tls: client's Finished message is incorrect") + } + + if err := transcriptMsg(clientFinished, &hs.finishedHash); err != nil { + return err + } + + copy(out, verify) + return nil +} + +func (hs *serverHandshakeState) sendSessionTicket() error { + if !hs.hello.ticketSupported { + return nil + } + + c := hs.c + m := new(newSessionTicketMsg) + + state := c.sessionState() + state.secret = hs.masterSecret + if hs.sessionState != nil { + // If this is re-wrapping an old key, then keep + // the original time it was created. + state.createdAt = hs.sessionState.createdAt + } + if c.config.WrapSession != nil { + var err error + m.ticket, err = c.config.WrapSession(c.connectionStateLocked(), state) + if err != nil { + return err + } + } else { + stateBytes, err := state.Bytes() + if err != nil { + return err + } + m.ticket, err = c.config.encryptTicket(stateBytes, c.ticketKeys) + if err != nil { + return err + } + } + + if _, err := hs.c.writeHandshakeRecord(m, &hs.finishedHash); err != nil { + return err + } + + return nil +} + +func (hs *serverHandshakeState) sendFinished(out []byte) error { + c := hs.c + + if err := c.writeChangeCipherRecord(); err != nil { + return err + } + + finished := new(finishedMsg) + finished.verifyData = hs.finishedHash.serverSum(hs.masterSecret) + if _, err := hs.c.writeHandshakeRecord(finished, &hs.finishedHash); err != nil { + return err + } + + copy(out, finished.verifyData) + + return nil +} + +// processCertsFromClient takes a chain of client certificates either from a +// certificateMsg message or a certificateMsgTLS13 message and verifies them. +func (c *Conn) processCertsFromClient(certificate Certificate) error { + certificates := certificate.Certificate + certs := make([]*x509.Certificate, len(certificates)) + var err error + for i, asn1Data := range certificates { + if certs[i], err = x509.ParseCertificate(asn1Data); err != nil { + c.sendAlert(alertDecodeError) + return errors.New("tls: failed to parse client certificate: " + err.Error()) + } + if certs[i].PublicKeyAlgorithm == x509.RSA { + n := certs[i].PublicKey.(*rsa.PublicKey).N.BitLen() + if max, ok := checkKeySize(n); !ok { + c.sendAlert(alertBadCertificate) + return fmt.Errorf("tls: client sent certificate containing RSA key larger than %d bits", max) + } + } + } + + if len(certs) == 0 && requiresClientCert(c.config.ClientAuth) { + if c.vers == VersionTLS13 { + c.sendAlert(alertCertificateRequired) + } else { + c.sendAlert(alertHandshakeFailure) + } + return errors.New("tls: client didn't provide a certificate") + } + + if c.config.ClientAuth >= VerifyClientCertIfGiven && len(certs) > 0 { + opts := x509.VerifyOptions{ + Roots: c.config.ClientCAs, + CurrentTime: c.config.time(), + Intermediates: x509.NewCertPool(), + KeyUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth}, + } + + for _, cert := range certs[1:] { + opts.Intermediates.AddCert(cert) + } + + chains, err := certs[0].Verify(opts) + if err != nil { + if _, ok := errors.AsType[x509.UnknownAuthorityError](err); ok { + c.sendAlert(alertUnknownCA) + } else if errCertificateInvalid, ok := errors.AsType[x509.CertificateInvalidError](err); ok && errCertificateInvalid.Reason == x509.Expired { + c.sendAlert(alertCertificateExpired) + } else { + c.sendAlert(alertBadCertificate) + } + return &CertificateVerificationError{UnverifiedCertificates: certs, Err: err} + } + + c.verifiedChains, err = fipsAllowedChains(chains) + if err != nil { + c.sendAlert(alertBadCertificate) + return &CertificateVerificationError{UnverifiedCertificates: certs, Err: err} + } + } + + c.peerCertificates = certs + c.ocspResponse = certificate.OCSPStaple + c.scts = certificate.SignedCertificateTimestamps + + if len(certs) > 0 { + switch certs[0].PublicKey.(type) { + case *ecdsa.PublicKey, *rsa.PublicKey, ed25519.PublicKey: + default: + c.sendAlert(alertUnsupportedCertificate) + return fmt.Errorf("tls: client certificate contains an unsupported public key of type %T", certs[0].PublicKey) + } + } + + if c.config.VerifyPeerCertificate != nil { + if err := c.config.VerifyPeerCertificate(certificates, c.verifiedChains); err != nil { + c.sendAlert(alertBadCertificate) + return err + } + } + + return nil +} + +func clientHelloInfo(ctx context.Context, c *Conn, clientHello *clientHelloMsg) *ClientHelloInfo { + supportedVersions := clientHello.supportedVersions + if len(clientHello.supportedVersions) == 0 { + supportedVersions = supportedVersionsFromMax(clientHello.vers) + } + + return &ClientHelloInfo{ + CipherSuites: clientHello.cipherSuites, + ServerName: clientHello.serverName, + SupportedCurves: clientHello.supportedCurves, + SupportedPoints: clientHello.supportedPoints, + SignatureSchemes: clientHello.supportedSignatureAlgorithms, + SupportedProtos: clientHello.alpnProtocols, + SupportedVersions: supportedVersions, + Extensions: clientHello.extensions, + Conn: c.conn, + HelloRetryRequest: c.didHRR, + config: c.config, + ctx: ctx, + } +} diff --git a/go/src/crypto/tls/handshake_server_test.go b/go/src/crypto/tls/handshake_server_test.go new file mode 100644 index 0000000000000000000000000000000000000000..736bb831ab64a2bb59c5b4b96400466ef2dac26e --- /dev/null +++ b/go/src/crypto/tls/handshake_server_test.go @@ -0,0 +1,2503 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "bytes" + "context" + "crypto" + "crypto/ecdh" + "crypto/elliptic" + "crypto/rand" + "crypto/tls/internal/fips140tls" + "crypto/x509" + "crypto/x509/pkix" + "encoding/pem" + "errors" + "fmt" + "io" + "net" + "os" + "os/exec" + "path/filepath" + "runtime" + "slices" + "strings" + "sync/atomic" + "testing" + "time" +) + +func testClientHello(t *testing.T, serverConfig *Config, m handshakeMessage) { + t.Helper() + testClientHelloFailure(t, serverConfig, m, "") +} + +// testFatal is a hack to prevent the compiler from complaining that there is a +// call to t.Fatal from a non-test goroutine +func testFatal(t *testing.T, err error) { + t.Helper() + t.Fatal(err) +} + +func testClientHelloFailure(t *testing.T, serverConfig *Config, m handshakeMessage, expectedSubStr string) { + c, s := localPipe(t) + go func() { + cli := Client(c, testConfig) + if ch, ok := m.(*clientHelloMsg); ok { + cli.vers = ch.vers + } + if _, err := cli.writeHandshakeRecord(m, nil); err != nil { + testFatal(t, err) + } + c.Close() + }() + ctx := context.Background() + conn := Server(s, serverConfig) + ch, ech, err := conn.readClientHello(ctx) + if conn.vers == VersionTLS13 { + hs := serverHandshakeStateTLS13{ + c: conn, + ctx: ctx, + clientHello: ch, + echContext: ech, + } + if err == nil { + err = hs.processClientHello() + } + if err == nil { + err = hs.checkForResumption() + } + if err == nil { + err = hs.pickCertificate() + } + } else { + hs := serverHandshakeState{ + c: conn, + ctx: ctx, + clientHello: ch, + } + if err == nil { + err = hs.processClientHello() + } + if err == nil { + err = hs.pickCipherSuite() + } + } + s.Close() + t.Helper() + if len(expectedSubStr) == 0 { + if err != nil && err != io.EOF { + t.Errorf("Got error: %s; expected to succeed", err) + } + } else if err == nil || !strings.Contains(err.Error(), expectedSubStr) { + t.Errorf("Got error: %v; expected to match substring '%s'", err, expectedSubStr) + } +} + +func TestSimpleError(t *testing.T) { + testClientHelloFailure(t, testConfig, &serverHelloDoneMsg{}, "unexpected handshake message") +} + +var badProtocolVersions = []uint16{0x0000, 0x0005, 0x0100, 0x0105, 0x0200, 0x0205, VersionSSL30} + +func TestRejectBadProtocolVersion(t *testing.T) { + config := testConfig.Clone() + config.MinVersion = VersionSSL30 + for _, v := range badProtocolVersions { + testClientHelloFailure(t, config, &clientHelloMsg{ + vers: v, + random: make([]byte, 32), + }, "unsupported versions") + } + testClientHelloFailure(t, config, &clientHelloMsg{ + vers: VersionTLS12, + supportedVersions: badProtocolVersions, + random: make([]byte, 32), + }, "unsupported versions") +} + +func TestNoSuiteOverlap(t *testing.T) { + clientHello := &clientHelloMsg{ + vers: VersionTLS12, + random: make([]byte, 32), + cipherSuites: []uint16{0xff00}, + compressionMethods: []uint8{compressionNone}, + } + testClientHelloFailure(t, testConfig, clientHello, "no cipher suite supported by both client and server") +} + +func TestNoCompressionOverlap(t *testing.T) { + clientHello := &clientHelloMsg{ + vers: VersionTLS12, + random: make([]byte, 32), + cipherSuites: []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256}, + compressionMethods: []uint8{0xff}, + } + testClientHelloFailure(t, testConfig, clientHello, "client does not support uncompressed connections") +} + +func TestNoRC4ByDefault(t *testing.T) { + clientHello := &clientHelloMsg{ + vers: VersionTLS12, + random: make([]byte, 32), + cipherSuites: []uint16{TLS_RSA_WITH_RC4_128_SHA}, + compressionMethods: []uint8{compressionNone}, + } + serverConfig := testConfig.Clone() + // Reset the enabled cipher suites to nil in order to test the + // defaults. + serverConfig.CipherSuites = nil + testClientHelloFailure(t, serverConfig, clientHello, "no cipher suite supported by both client and server") +} + +func TestRejectSNIWithTrailingDot(t *testing.T) { + testClientHelloFailure(t, testConfig, &clientHelloMsg{ + vers: VersionTLS12, + random: make([]byte, 32), + serverName: "foo.com.", + }, "decoding message") +} + +func TestDontSelectECDSAWithRSAKey(t *testing.T) { + // Test that, even when both sides support an ECDSA cipher suite, it + // won't be selected if the server's private key doesn't support it. + clientHello := &clientHelloMsg{ + vers: VersionTLS12, + random: make([]byte, 32), + cipherSuites: []uint16{TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384}, + compressionMethods: []uint8{compressionNone}, + supportedCurves: []CurveID{CurveP256}, + supportedPoints: []uint8{pointFormatUncompressed}, + } + serverConfig := testConfig.Clone() + serverConfig.CipherSuites = clientHello.cipherSuites + serverConfig.Certificates = make([]Certificate, 1) + serverConfig.Certificates[0].Certificate = [][]byte{testECDSACertificate} + serverConfig.Certificates[0].PrivateKey = testECDSAPrivateKey + serverConfig.BuildNameToCertificate() + // First test that it *does* work when the server's key is ECDSA. + testClientHello(t, serverConfig, clientHello) + + // Now test that switching to an RSA key causes the expected error (and + // not an internal error about a signing failure). + serverConfig.Certificates = testConfig.Certificates + testClientHelloFailure(t, serverConfig, clientHello, "no cipher suite supported by both client and server") +} + +func TestDontSelectRSAWithECDSAKey(t *testing.T) { + // Test that, even when both sides support an RSA cipher suite, it + // won't be selected if the server's private key doesn't support it. + clientHello := &clientHelloMsg{ + vers: VersionTLS12, + random: make([]byte, 32), + cipherSuites: []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256}, + compressionMethods: []uint8{compressionNone}, + supportedCurves: []CurveID{CurveP256}, + supportedPoints: []uint8{pointFormatUncompressed}, + } + serverConfig := testConfig.Clone() + serverConfig.CipherSuites = clientHello.cipherSuites + // First test that it *does* work when the server's key is RSA. + testClientHello(t, serverConfig, clientHello) + + // Now test that switching to an ECDSA key causes the expected error + // (and not an internal error about a signing failure). + serverConfig.Certificates = make([]Certificate, 1) + serverConfig.Certificates[0].Certificate = [][]byte{testECDSACertificate} + serverConfig.Certificates[0].PrivateKey = testECDSAPrivateKey + serverConfig.BuildNameToCertificate() + testClientHelloFailure(t, serverConfig, clientHello, "no cipher suite supported by both client and server") +} + +func TestRenegotiationExtension(t *testing.T) { + skipFIPS(t) // #70505 + + clientHello := &clientHelloMsg{ + vers: VersionTLS12, + compressionMethods: []uint8{compressionNone}, + random: make([]byte, 32), + secureRenegotiationSupported: true, + cipherSuites: []uint16{TLS_RSA_WITH_RC4_128_SHA}, + } + + bufChan := make(chan []byte, 1) + c, s := localPipe(t) + + go func() { + cli := Client(c, testConfig) + cli.vers = clientHello.vers + if _, err := cli.writeHandshakeRecord(clientHello, nil); err != nil { + testFatal(t, err) + } + + buf := make([]byte, 1024) + n, err := c.Read(buf) + if err != nil { + t.Errorf("Server read returned error: %s", err) + } + c.Close() + bufChan <- buf[:n] + }() + + Server(s, testConfig).Handshake() + buf := <-bufChan + + if len(buf) < 5+4 { + t.Fatalf("Server returned short message of length %d", len(buf)) + } + // buf contains a TLS record, with a 5 byte record header and a 4 byte + // handshake header. The length of the ServerHello is taken from the + // handshake header. + serverHelloLen := int(buf[6])<<16 | int(buf[7])<<8 | int(buf[8]) + + var serverHello serverHelloMsg + // unmarshal expects to be given the handshake header, but + // serverHelloLen doesn't include it. + if !serverHello.unmarshal(buf[5 : 9+serverHelloLen]) { + t.Fatalf("Failed to parse ServerHello") + } + + if !serverHello.secureRenegotiationSupported { + t.Errorf("Secure renegotiation extension was not echoed.") + } +} + +func TestTLS12OnlyCipherSuites(t *testing.T) { + skipFIPS(t) // No TLS 1.1 in FIPS mode. + + // Test that a Server doesn't select a TLS 1.2-only cipher suite when + // the client negotiates TLS 1.1. + clientHello := &clientHelloMsg{ + vers: VersionTLS11, + random: make([]byte, 32), + cipherSuites: []uint16{ + // The Server, by default, will use the client's + // preference order. So the GCM cipher suite + // will be selected unless it's excluded because + // of the version in this ClientHello. + TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + TLS_RSA_WITH_RC4_128_SHA, + }, + compressionMethods: []uint8{compressionNone}, + supportedCurves: []CurveID{CurveP256, CurveP384, CurveP521}, + supportedPoints: []uint8{pointFormatUncompressed}, + } + + c, s := localPipe(t) + replyChan := make(chan any) + go func() { + cli := Client(c, testConfig) + cli.vers = clientHello.vers + if _, err := cli.writeHandshakeRecord(clientHello, nil); err != nil { + testFatal(t, err) + } + reply, err := cli.readHandshake(nil) + c.Close() + if err != nil { + replyChan <- err + } else { + replyChan <- reply + } + }() + config := testConfig.Clone() + config.CipherSuites = clientHello.cipherSuites + Server(s, config).Handshake() + s.Close() + reply := <-replyChan + if err, ok := reply.(error); ok { + t.Fatal(err) + } + serverHello, ok := reply.(*serverHelloMsg) + if !ok { + t.Fatalf("didn't get ServerHello message in reply. Got %v\n", reply) + } + if s := serverHello.cipherSuite; s != TLS_RSA_WITH_RC4_128_SHA { + t.Fatalf("bad cipher suite from server: %x", s) + } +} + +func TestTLSPointFormats(t *testing.T) { + // Test that a Server returns the ec_point_format extension when ECC is + // negotiated, and not on a RSA handshake or if ec_point_format is missing. + tests := []struct { + name string + cipherSuites []uint16 + supportedCurves []CurveID + supportedPoints []uint8 + wantSupportedPoints bool + }{ + {"ECC", []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256}, []CurveID{CurveP256}, []uint8{pointFormatUncompressed}, true}, + {"ECC without ec_point_format", []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256}, []CurveID{CurveP256}, nil, false}, + {"ECC with extra values", []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256}, []CurveID{CurveP256}, []uint8{13, 37, pointFormatUncompressed, 42}, true}, + {"RSA", []uint16{TLS_RSA_WITH_AES_256_GCM_SHA384}, nil, nil, false}, + {"RSA with ec_point_format", []uint16{TLS_RSA_WITH_AES_256_GCM_SHA384}, nil, []uint8{pointFormatUncompressed}, false}, + } + for _, tt := range tests { + // The RSA subtests should be enabled for FIPS 140 required mode: #70505 + if strings.HasPrefix(tt.name, "RSA") && fips140tls.Required() { + t.Logf("skipping in FIPS mode.") + continue + } + t.Run(tt.name, func(t *testing.T) { + clientHello := &clientHelloMsg{ + vers: VersionTLS12, + random: make([]byte, 32), + cipherSuites: tt.cipherSuites, + compressionMethods: []uint8{compressionNone}, + supportedCurves: tt.supportedCurves, + supportedPoints: tt.supportedPoints, + } + + c, s := localPipe(t) + replyChan := make(chan any) + go func() { + clientConfig := testConfig.Clone() + clientConfig.Certificates = []Certificate{{Certificate: [][]byte{testRSA2048Certificate}, PrivateKey: testRSA2048PrivateKey}} + cli := Client(c, clientConfig) + cli.vers = clientHello.vers + if _, err := cli.writeHandshakeRecord(clientHello, nil); err != nil { + testFatal(t, err) + } + reply, err := cli.readHandshake(nil) + c.Close() + if err != nil { + replyChan <- err + } else { + replyChan <- reply + } + }() + serverConfig := testConfig.Clone() + serverConfig.Certificates = []Certificate{{Certificate: [][]byte{testRSA2048Certificate}, PrivateKey: testRSA2048PrivateKey}} + serverConfig.CipherSuites = clientHello.cipherSuites + Server(s, serverConfig).Handshake() + s.Close() + reply := <-replyChan + if err, ok := reply.(error); ok { + t.Fatal(err) + } + serverHello, ok := reply.(*serverHelloMsg) + if !ok { + t.Fatalf("didn't get ServerHello message in reply. Got %v\n", reply) + } + if tt.wantSupportedPoints { + if !bytes.Equal(serverHello.supportedPoints, []uint8{pointFormatUncompressed}) { + t.Fatal("incorrect ec_point_format extension from server") + } + } else { + if len(serverHello.supportedPoints) != 0 { + t.Fatalf("unexpected ec_point_format extension from server: %v", serverHello.supportedPoints) + } + } + }) + } +} + +func TestAlertForwarding(t *testing.T) { + c, s := localPipe(t) + go func() { + Client(c, testConfig).sendAlert(alertUnknownCA) + c.Close() + }() + + err := Server(s, testConfig).Handshake() + s.Close() + if opErr, ok := errors.AsType[*net.OpError](err); !ok || opErr.Err != error(alertUnknownCA) { + t.Errorf("Got error: %s; expected: %s", err, error(alertUnknownCA)) + } +} + +func TestClose(t *testing.T) { + c, s := localPipe(t) + go c.Close() + + err := Server(s, testConfig).Handshake() + s.Close() + if err != io.EOF { + t.Errorf("Got error: %s; expected: %s", err, io.EOF) + } +} + +func TestVersion(t *testing.T) { + serverConfig := &Config{ + Certificates: testConfig.Certificates, + MaxVersion: VersionTLS13, + } + clientConfig := &Config{ + InsecureSkipVerify: true, + MinVersion: VersionTLS12, + } + state, _, err := testHandshake(t, clientConfig, serverConfig) + if err != nil { + t.Fatalf("handshake failed: %s", err) + } + if state.Version != VersionTLS13 { + t.Fatalf("incorrect version %x, should be %x", state.Version, VersionTLS11) + } + + clientConfig.MinVersion = 0 + serverConfig.MaxVersion = VersionTLS11 + _, _, err = testHandshake(t, clientConfig, serverConfig) + if err == nil { + t.Fatalf("expected failure to connect with TLS 1.0/1.1") + } +} + +func TestCipherSuitePreference(t *testing.T) { + skipFIPS(t) // No RC4 or CHACHA20_POLY1305 in FIPS mode. + + serverConfig := &Config{ + CipherSuites: []uint16{TLS_RSA_WITH_RC4_128_SHA, TLS_AES_128_GCM_SHA256, + TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256}, + Certificates: testConfig.Certificates, + MaxVersion: VersionTLS12, + GetConfigForClient: func(chi *ClientHelloInfo) (*Config, error) { + if chi.CipherSuites[0] != TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 { + t.Error("the advertised order should not depend on Config.CipherSuites") + } + if len(chi.CipherSuites) != 2+len(defaultCipherSuitesTLS13) { + t.Error("the advertised TLS 1.2 suites should be filtered by Config.CipherSuites") + } + return nil, nil + }, + } + clientConfig := &Config{ + CipherSuites: []uint16{TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256}, + InsecureSkipVerify: true, + } + state, _, err := testHandshake(t, clientConfig, serverConfig) + if err != nil { + t.Fatalf("handshake failed: %s", err) + } + if state.CipherSuite != TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 { + t.Error("the preference order should not depend on Config.CipherSuites") + } +} + +func TestSCTHandshake(t *testing.T) { + t.Run("TLSv12", func(t *testing.T) { testSCTHandshake(t, VersionTLS12) }) + t.Run("TLSv13", func(t *testing.T) { testSCTHandshake(t, VersionTLS13) }) +} + +func testSCTHandshake(t *testing.T, version uint16) { + expected := [][]byte{[]byte("certificate"), []byte("transparency")} + serverConfig := &Config{ + Certificates: []Certificate{{ + Certificate: [][]byte{testRSACertificate}, + PrivateKey: testRSAPrivateKey, + SignedCertificateTimestamps: expected, + }}, + MaxVersion: version, + } + clientConfig := &Config{ + InsecureSkipVerify: true, + } + _, state, err := testHandshake(t, clientConfig, serverConfig) + if err != nil { + t.Fatalf("handshake failed: %s", err) + } + actual := state.SignedCertificateTimestamps + if len(actual) != len(expected) { + t.Fatalf("got %d scts, want %d", len(actual), len(expected)) + } + for i, sct := range expected { + if !bytes.Equal(sct, actual[i]) { + t.Fatalf("SCT #%d was %x, but expected %x", i, actual[i], sct) + } + } +} + +func TestCrossVersionResume(t *testing.T) { + t.Run("TLSv12", func(t *testing.T) { testCrossVersionResume(t, VersionTLS12) }) + t.Run("TLSv13", func(t *testing.T) { testCrossVersionResume(t, VersionTLS13) }) +} + +func testCrossVersionResume(t *testing.T, version uint16) { + serverConfig := &Config{ + CipherSuites: []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256}, + Certificates: testConfig.Certificates, + Time: testTime, + } + clientConfig := &Config{ + CipherSuites: []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256}, + InsecureSkipVerify: true, + ClientSessionCache: NewLRUClientSessionCache(1), + ServerName: "servername", + MinVersion: VersionTLS12, + Time: testTime, + } + + // Establish a session at TLS 1.3. + clientConfig.MaxVersion = VersionTLS13 + _, _, err := testHandshake(t, clientConfig, serverConfig) + if err != nil { + t.Fatalf("handshake failed: %s", err) + } + + // The client session cache now contains a TLS 1.3 session. + state, _, err := testHandshake(t, clientConfig, serverConfig) + if err != nil { + t.Fatalf("handshake failed: %s", err) + } + if !state.DidResume { + t.Fatalf("handshake did not resume at the same version") + } + + // Test that the server will decline to resume at a lower version. + clientConfig.MaxVersion = VersionTLS12 + state, _, err = testHandshake(t, clientConfig, serverConfig) + if err != nil { + t.Fatalf("handshake failed: %s", err) + } + if state.DidResume { + t.Fatalf("handshake resumed at a lower version") + } + + // The client session cache now contains a TLS 1.2 session. + state, _, err = testHandshake(t, clientConfig, serverConfig) + if err != nil { + t.Fatalf("handshake failed: %s", err) + } + if !state.DidResume { + t.Fatalf("handshake did not resume at the same version") + } + + // Test that the server will decline to resume at a higher version. + clientConfig.MaxVersion = VersionTLS13 + state, _, err = testHandshake(t, clientConfig, serverConfig) + if err != nil { + t.Fatalf("handshake failed: %s", err) + } + if state.DidResume { + t.Fatalf("handshake resumed at a higher version") + } +} + +// Note: see comment in handshake_test.go for details of how the reference +// tests work. + +// serverTest represents a test of the TLS server handshake against a reference +// implementation. +type serverTest struct { + // name is a freeform string identifying the test and the file in which + // the expected results will be stored. + name string + // command, if not empty, contains a series of arguments for the + // command to run for the reference server. + command []string + // expectedPeerCerts contains a list of PEM blocks of expected + // certificates from the client. + expectedPeerCerts []string + // config, if not nil, contains a custom Config to use for this test. + config *Config + // expectHandshakeErrorIncluding, when not empty, contains a string + // that must be a substring of the error resulting from the handshake. + expectHandshakeErrorIncluding string + // validate, if not nil, is a function that will be called with the + // ConnectionState of the resulting connection. It returns false if the + // ConnectionState is unacceptable. + validate func(ConnectionState) error + // wait, if true, prevents this subtest from calling t.Parallel. + // If false, runServerTest* returns immediately. + wait bool +} + +var defaultClientCommand = []string{"openssl", "s_client", "-no_ticket"} + +// connFromCommand starts opens a listening socket and starts the reference +// client to connect to it. It returns a recordingConn that wraps the resulting +// connection. +func (test *serverTest) connFromCommand() (conn *recordingConn, child *exec.Cmd, err error) { + l, err := net.ListenTCP("tcp", &net.TCPAddr{ + IP: net.IPv4(127, 0, 0, 1), + Port: 0, + }) + if err != nil { + return nil, nil, err + } + defer l.Close() + + port := l.Addr().(*net.TCPAddr).Port + + var command []string + command = append(command, test.command...) + if len(command) == 0 { + command = defaultClientCommand + } + command = append(command, "-connect") + command = append(command, fmt.Sprintf("127.0.0.1:%d", port)) + cmd := exec.Command(command[0], command[1:]...) + cmd.Stdin = nil + var output bytes.Buffer + cmd.Stdout = &output + cmd.Stderr = &output + if err := cmd.Start(); err != nil { + return nil, nil, err + } + + connChan := make(chan any, 1) + go func() { + tcpConn, err := l.Accept() + if err != nil { + connChan <- err + return + } + connChan <- tcpConn + }() + + var tcpConn net.Conn + select { + case connOrError := <-connChan: + if err, ok := connOrError.(error); ok { + return nil, nil, err + } + tcpConn = connOrError.(net.Conn) + case <-time.After(2 * time.Second): + return nil, nil, errors.New("timed out waiting for connection from child process") + } + + record := &recordingConn{ + Conn: tcpConn, + } + + return record, cmd, nil +} + +func (test *serverTest) dataPath() string { + return filepath.Join("testdata", "Server-"+test.name) +} + +func (test *serverTest) loadData() (flows [][]byte, err error) { + in, err := os.Open(test.dataPath()) + if err != nil { + return nil, err + } + defer in.Close() + return parseTestData(in) +} + +func (test *serverTest) run(t *testing.T, write bool) { + var serverConn net.Conn + var recordingConn *recordingConn + var childProcess *exec.Cmd + + if write { + var err error + recordingConn, childProcess, err = test.connFromCommand() + if err != nil { + t.Fatalf("Failed to start subcommand: %s", err) + } + serverConn = recordingConn + defer func() { + if t.Failed() { + t.Logf("OpenSSL output:\n\n%s", childProcess.Stdout) + } + }() + } else { + flows, err := test.loadData() + if err != nil { + t.Fatalf("Failed to load data from %s", test.dataPath()) + } + serverConn = &replayingConn{t: t, flows: flows, reading: true} + } + config := test.config + if config == nil { + config = testConfig + } + server := Server(serverConn, config) + + _, err := server.Write([]byte("hello, world\n")) + if len(test.expectHandshakeErrorIncluding) > 0 { + if err == nil { + t.Errorf("Error expected, but no error returned") + } else if s := err.Error(); !strings.Contains(s, test.expectHandshakeErrorIncluding) { + t.Errorf("Error expected containing '%s' but got '%s'", test.expectHandshakeErrorIncluding, s) + } + } else { + if err != nil { + t.Logf("Error from Server.Write: '%s'", err) + } + } + server.Close() + + connState := server.ConnectionState() + peerCerts := connState.PeerCertificates + if len(peerCerts) == len(test.expectedPeerCerts) { + for i, peerCert := range peerCerts { + block, _ := pem.Decode([]byte(test.expectedPeerCerts[i])) + if !bytes.Equal(block.Bytes, peerCert.Raw) { + t.Fatalf("%s: mismatch on peer cert %d", test.name, i+1) + } + } + } else { + t.Fatalf("%s: mismatch on peer list length: %d (wanted) != %d (got)", test.name, len(test.expectedPeerCerts), len(peerCerts)) + } + + if test.validate != nil && !t.Failed() { + if err := test.validate(connState); err != nil { + t.Fatalf("validate callback returned error: %s", err) + } + } + + if write { + serverConn.Close() + path := test.dataPath() + out, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) + if err != nil { + t.Fatalf("Failed to create output file: %s", err) + } + defer out.Close() + recordingConn.Close() + if len(recordingConn.flows) < 3 { + if len(test.expectHandshakeErrorIncluding) == 0 { + t.Fatalf("Handshake failed") + } + } + recordingConn.WriteTo(out) + t.Logf("Wrote %s\n", path) + childProcess.Wait() + } +} + +func runServerTestForVersion(t *testing.T, template *serverTest, version, option string) { + // Make a deep copy of the template before going parallel. + test := *template + if template.config != nil { + test.config = template.config.Clone() + } + test.name = version + "-" + test.name + if len(test.command) == 0 { + test.command = defaultClientCommand + } + test.command = append([]string(nil), test.command...) + test.command = append(test.command, option) + + runTestAndUpdateIfNeeded(t, version, test.run, test.wait) +} + +func runServerTestTLS10(t *testing.T, template *serverTest) { + runServerTestForVersion(t, template, "TLSv10", "-tls1") +} + +func runServerTestTLS11(t *testing.T, template *serverTest) { + runServerTestForVersion(t, template, "TLSv11", "-tls1_1") +} + +func runServerTestTLS12(t *testing.T, template *serverTest) { + runServerTestForVersion(t, template, "TLSv12", "-tls1_2") +} + +func runServerTestTLS13(t *testing.T, template *serverTest) { + runServerTestForVersion(t, template, "TLSv13", "-tls1_3") +} + +func TestHandshakeServerRSARC4(t *testing.T) { + test := &serverTest{ + name: "RSA-RC4", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "RC4-SHA"}, + } + runServerTestTLS10(t, test) + runServerTestTLS11(t, test) + runServerTestTLS12(t, test) +} + +func TestHandshakeServerRSA3DES(t *testing.T) { + test := &serverTest{ + name: "RSA-3DES", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "DES-CBC3-SHA"}, + } + runServerTestTLS10(t, test) + runServerTestTLS12(t, test) +} + +func TestHandshakeServerRSAAES(t *testing.T) { + test := &serverTest{ + name: "RSA-AES", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA"}, + } + runServerTestTLS10(t, test) + runServerTestTLS12(t, test) +} + +func TestHandshakeServerAESGCM(t *testing.T) { + test := &serverTest{ + name: "RSA-AES-GCM", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "ECDHE-RSA-AES128-GCM-SHA256"}, + } + runServerTestTLS12(t, test) +} + +func TestHandshakeServerAES256GCMSHA384(t *testing.T) { + test := &serverTest{ + name: "RSA-AES256-GCM-SHA384", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "ECDHE-RSA-AES256-GCM-SHA384"}, + } + runServerTestTLS12(t, test) +} + +func TestHandshakeServerAES128SHA256(t *testing.T) { + test := &serverTest{ + name: "AES128-SHA256", + command: []string{"openssl", "s_client", "-no_ticket", "-ciphersuites", "TLS_AES_128_GCM_SHA256"}, + } + runServerTestTLS13(t, test) +} +func TestHandshakeServerAES256SHA384(t *testing.T) { + test := &serverTest{ + name: "AES256-SHA384", + command: []string{"openssl", "s_client", "-no_ticket", "-ciphersuites", "TLS_AES_256_GCM_SHA384"}, + } + runServerTestTLS13(t, test) +} +func TestHandshakeServerCHACHA20SHA256(t *testing.T) { + test := &serverTest{ + name: "CHACHA20-SHA256", + command: []string{"openssl", "s_client", "-no_ticket", "-ciphersuites", "TLS_CHACHA20_POLY1305_SHA256"}, + } + runServerTestTLS13(t, test) +} + +func TestHandshakeServerECDHEECDSAAES(t *testing.T) { + config := testConfig.Clone() + config.Certificates = make([]Certificate, 1) + config.Certificates[0].Certificate = [][]byte{testECDSACertificate} + config.Certificates[0].PrivateKey = testECDSAPrivateKey + config.BuildNameToCertificate() + + test := &serverTest{ + name: "ECDHE-ECDSA-AES", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "ECDHE-ECDSA-AES256-SHA", "-ciphersuites", "TLS_AES_128_GCM_SHA256"}, + config: config, + } + runServerTestTLS10(t, test) + runServerTestTLS12(t, test) + runServerTestTLS13(t, test) +} + +func TestHandshakeServerX25519(t *testing.T) { + config := testConfig.Clone() + config.CurvePreferences = []CurveID{X25519} + + test := &serverTest{ + name: "X25519", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "ECDHE-RSA-CHACHA20-POLY1305", "-ciphersuites", "TLS_CHACHA20_POLY1305_SHA256", "-curves", "X25519"}, + config: config, + } + runServerTestTLS12(t, test) + runServerTestTLS13(t, test) +} + +func TestHandshakeServerP256(t *testing.T) { + config := testConfig.Clone() + config.CurvePreferences = []CurveID{CurveP256} + + test := &serverTest{ + name: "P256", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "ECDHE-RSA-CHACHA20-POLY1305", "-ciphersuites", "TLS_CHACHA20_POLY1305_SHA256", "-curves", "P-256"}, + config: config, + } + runServerTestTLS12(t, test) + runServerTestTLS13(t, test) +} + +func TestHandshakeServerHelloRetryRequest(t *testing.T) { + config := testConfig.Clone() + config.CurvePreferences = []CurveID{CurveP256} + + var clientHelloInfoHRR bool + var getCertificateCalled bool + eeCert := config.Certificates[0] + config.Certificates = nil + config.GetCertificate = func(clientHello *ClientHelloInfo) (*Certificate, error) { + getCertificateCalled = true + clientHelloInfoHRR = clientHello.HelloRetryRequest + return &eeCert, nil + } + + test := &serverTest{ + name: "HelloRetryRequest", + command: []string{"openssl", "s_client", "-no_ticket", "-ciphersuites", "TLS_CHACHA20_POLY1305_SHA256", "-curves", "X25519:P-256"}, + config: config, + validate: func(cs ConnectionState) error { + if !cs.HelloRetryRequest { + return errors.New("expected HelloRetryRequest") + } + if !getCertificateCalled { + return errors.New("expected GetCertificate to be called") + } + if !clientHelloInfoHRR { + return errors.New("expected ClientHelloInfo.HelloRetryRequest to be true") + } + return nil + }, + } + runServerTestTLS13(t, test) +} + +// TestHandshakeServerKeySharePreference checks that we prefer a key share even +// if it's later in the CurvePreferences order, and that the client hello HRR +// field is correctly represented. +func TestHandshakeServerKeySharePreference(t *testing.T) { + config := testConfig.Clone() + config.CurvePreferences = []CurveID{X25519, CurveP256} + + // We also use this test as a convenient place to assert the ClientHelloInfo + // HelloRetryRequest field is _not_ set for a non-HRR hello. + var clientHelloInfoHRR bool + var getCertificateCalled bool + eeCert := config.Certificates[0] + config.Certificates = nil + config.GetCertificate = func(clientHello *ClientHelloInfo) (*Certificate, error) { + getCertificateCalled = true + clientHelloInfoHRR = clientHello.HelloRetryRequest + return &eeCert, nil + } + + test := &serverTest{ + name: "KeySharePreference", + command: []string{"openssl", "s_client", "-no_ticket", "-ciphersuites", "TLS_CHACHA20_POLY1305_SHA256", "-curves", "P-256:X25519"}, + config: config, + validate: func(cs ConnectionState) error { + if cs.HelloRetryRequest { + return errors.New("unexpected HelloRetryRequest") + } + if !getCertificateCalled { + return errors.New("expected GetCertificate to be called") + } + if clientHelloInfoHRR { + return errors.New("expected ClientHelloInfo.HelloRetryRequest to be false") + } + return nil + }, + } + runServerTestTLS13(t, test) +} + +func TestHandshakeServerALPN(t *testing.T) { + config := testConfig.Clone() + config.NextProtos = []string{"proto1", "proto2"} + + test := &serverTest{ + name: "ALPN", + // Note that this needs OpenSSL 1.0.2 because that is the first + // version that supports the -alpn flag. + command: []string{"openssl", "s_client", "-alpn", "proto2,proto1", "-cipher", "ECDHE-RSA-CHACHA20-POLY1305", "-ciphersuites", "TLS_CHACHA20_POLY1305_SHA256"}, + config: config, + validate: func(state ConnectionState) error { + // The server's preferences should override the client. + if state.NegotiatedProtocol != "proto1" { + return fmt.Errorf("Got protocol %q, wanted proto1", state.NegotiatedProtocol) + } + return nil + }, + } + runServerTestTLS12(t, test) + runServerTestTLS13(t, test) +} + +func TestHandshakeServerALPNNoMatch(t *testing.T) { + config := testConfig.Clone() + config.NextProtos = []string{"proto3"} + + test := &serverTest{ + name: "ALPN-NoMatch", + // Note that this needs OpenSSL 1.0.2 because that is the first + // version that supports the -alpn flag. + command: []string{"openssl", "s_client", "-alpn", "proto2,proto1", "-cipher", "ECDHE-RSA-CHACHA20-POLY1305", "-ciphersuites", "TLS_CHACHA20_POLY1305_SHA256"}, + config: config, + expectHandshakeErrorIncluding: "client requested unsupported application protocol", + } + runServerTestTLS12(t, test) + runServerTestTLS13(t, test) +} + +func TestHandshakeServerALPNNotConfigured(t *testing.T) { + config := testConfig.Clone() + config.NextProtos = nil + + test := &serverTest{ + name: "ALPN-NotConfigured", + // Note that this needs OpenSSL 1.0.2 because that is the first + // version that supports the -alpn flag. + command: []string{"openssl", "s_client", "-alpn", "proto2,proto1", "-cipher", "ECDHE-RSA-CHACHA20-POLY1305", "-ciphersuites", "TLS_CHACHA20_POLY1305_SHA256"}, + config: config, + validate: func(state ConnectionState) error { + if state.NegotiatedProtocol != "" { + return fmt.Errorf("Got protocol %q, wanted nothing", state.NegotiatedProtocol) + } + return nil + }, + } + runServerTestTLS12(t, test) + runServerTestTLS13(t, test) +} + +func TestHandshakeServerALPNFallback(t *testing.T) { + config := testConfig.Clone() + config.NextProtos = []string{"proto1", "h2", "proto2"} + + test := &serverTest{ + name: "ALPN-Fallback", + // Note that this needs OpenSSL 1.0.2 because that is the first + // version that supports the -alpn flag. + command: []string{"openssl", "s_client", "-alpn", "proto3,http/1.1,proto4", "-cipher", "ECDHE-RSA-CHACHA20-POLY1305", "-ciphersuites", "TLS_CHACHA20_POLY1305_SHA256"}, + config: config, + validate: func(state ConnectionState) error { + if state.NegotiatedProtocol != "" { + return fmt.Errorf("Got protocol %q, wanted nothing", state.NegotiatedProtocol) + } + return nil + }, + } + runServerTestTLS12(t, test) + runServerTestTLS13(t, test) +} + +// TestHandshakeServerSNI involves a client sending an SNI extension of +// "snitest.com", which happens to match the CN of testSNICertificate. The test +// verifies that the server correctly selects that certificate. +func TestHandshakeServerSNI(t *testing.T) { + test := &serverTest{ + name: "SNI", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", "-servername", "snitest.com"}, + } + runServerTestTLS12(t, test) +} + +// TestHandshakeServerSNIGetCertificate is similar to TestHandshakeServerSNI, but +// tests the dynamic GetCertificate method +func TestHandshakeServerSNIGetCertificate(t *testing.T) { + config := testConfig.Clone() + + // Replace the NameToCertificate map with a GetCertificate function + nameToCert := config.NameToCertificate + config.NameToCertificate = nil + config.GetCertificate = func(clientHello *ClientHelloInfo) (*Certificate, error) { + cert := nameToCert[clientHello.ServerName] + return cert, nil + } + test := &serverTest{ + name: "SNI-GetCertificate", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", "-servername", "snitest.com"}, + config: config, + } + runServerTestTLS12(t, test) +} + +// TestHandshakeServerSNIGetCertificateNotFound is similar to +// TestHandshakeServerSNICertForName, but tests to make sure that when the +// GetCertificate method doesn't return a cert, we fall back to what's in +// the NameToCertificate map. +func TestHandshakeServerSNIGetCertificateNotFound(t *testing.T) { + config := testConfig.Clone() + + config.GetCertificate = func(clientHello *ClientHelloInfo) (*Certificate, error) { + return nil, nil + } + test := &serverTest{ + name: "SNI-GetCertificateNotFound", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", "-servername", "snitest.com"}, + config: config, + } + runServerTestTLS12(t, test) +} + +// TestHandshakeServerGetCertificateExtensions tests to make sure that the +// Extensions passed to GetCertificate match what we expect based on the +// clientHelloMsg +func TestHandshakeServerGetCertificateExtensions(t *testing.T) { + const errMsg = "TestHandshakeServerGetCertificateExtensions error" + // ensure the test condition inside our GetCertificate callback + // is actually invoked + var called atomic.Int32 + + testVersions := []uint16{VersionTLS12, VersionTLS13} + for _, vers := range testVersions { + t.Run(fmt.Sprintf("TLS version %04x", vers), func(t *testing.T) { + pk, _ := ecdh.P256().GenerateKey(rand.Reader) + clientHello := &clientHelloMsg{ + vers: vers, + random: make([]byte, 32), + cipherSuites: []uint16{TLS_AES_128_GCM_SHA256}, + compressionMethods: []uint8{compressionNone}, + serverName: "test", + keyShares: []keyShare{{group: CurveP256, data: pk.PublicKey().Bytes()}}, + supportedCurves: []CurveID{CurveP256}, + supportedSignatureAlgorithms: []SignatureScheme{ECDSAWithP256AndSHA256}, + } + + // the clientHelloMsg initialized just above is serialized with + // two extensions: server_name(0) and application_layer_protocol_negotiation(16) + expectedExtensions := []uint16{ + extensionServerName, + extensionSupportedCurves, + extensionSignatureAlgorithms, + extensionKeyShare, + } + + if vers == VersionTLS13 { + clientHello.supportedVersions = []uint16{VersionTLS13} + expectedExtensions = append(expectedExtensions, extensionSupportedVersions) + } + + // Go's TLS client presents extensions in the ClientHello sorted by extension ID + slices.Sort(expectedExtensions) + + serverConfig := testConfig.Clone() + serverConfig.GetCertificate = func(clientHello *ClientHelloInfo) (*Certificate, error) { + if !slices.Equal(expectedExtensions, clientHello.Extensions) { + t.Errorf("expected extensions on ClientHelloInfo (%v) to match clientHelloMsg (%v)", expectedExtensions, clientHello.Extensions) + } + called.Add(1) + + return nil, errors.New(errMsg) + } + testClientHelloFailure(t, serverConfig, clientHello, errMsg) + }) + } + + if int(called.Load()) != len(testVersions) { + t.Error("expected our GetCertificate test to be called twice") + } +} + +// TestHandshakeServerSNIGetCertificateError tests to make sure that errors in +// GetCertificate result in a tls alert. +func TestHandshakeServerSNIGetCertificateError(t *testing.T) { + const errMsg = "TestHandshakeServerSNIGetCertificateError error" + + serverConfig := testConfig.Clone() + serverConfig.GetCertificate = func(clientHello *ClientHelloInfo) (*Certificate, error) { + return nil, errors.New(errMsg) + } + + clientHello := &clientHelloMsg{ + vers: VersionTLS12, + random: make([]byte, 32), + cipherSuites: []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256}, + compressionMethods: []uint8{compressionNone}, + serverName: "test", + } + testClientHelloFailure(t, serverConfig, clientHello, errMsg) +} + +// TestHandshakeServerEmptyCertificates tests that GetCertificates is called in +// the case that Certificates is empty, even without SNI. +func TestHandshakeServerEmptyCertificates(t *testing.T) { + const errMsg = "TestHandshakeServerEmptyCertificates error" + + serverConfig := testConfig.Clone() + serverConfig.GetCertificate = func(clientHello *ClientHelloInfo) (*Certificate, error) { + return nil, errors.New(errMsg) + } + serverConfig.Certificates = nil + + clientHello := &clientHelloMsg{ + vers: VersionTLS12, + random: make([]byte, 32), + cipherSuites: []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256}, + compressionMethods: []uint8{compressionNone}, + } + testClientHelloFailure(t, serverConfig, clientHello, errMsg) + + // With an empty Certificates and a nil GetCertificate, the server + // should always return a “no certificates” error. + serverConfig.GetCertificate = nil + + clientHello = &clientHelloMsg{ + vers: VersionTLS12, + random: make([]byte, 32), + cipherSuites: []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256}, + compressionMethods: []uint8{compressionNone}, + } + testClientHelloFailure(t, serverConfig, clientHello, "no certificates") +} + +func TestServerResumption(t *testing.T) { + sessionFilePath := tempFile("") + defer os.Remove(sessionFilePath) + + testIssue := &serverTest{ + name: "IssueTicket", + command: []string{"openssl", "s_client", "-cipher", "AES128-SHA", "-ciphersuites", "TLS_AES_128_GCM_SHA256", "-sess_out", sessionFilePath}, + wait: true, + } + testResume := &serverTest{ + name: "Resume", + command: []string{"openssl", "s_client", "-cipher", "AES128-SHA", "-ciphersuites", "TLS_AES_128_GCM_SHA256", "-sess_in", sessionFilePath}, + validate: func(state ConnectionState) error { + if !state.DidResume { + return errors.New("did not resume") + } + return nil + }, + } + + runServerTestTLS12(t, testIssue) + runServerTestTLS12(t, testResume) + + runServerTestTLS13(t, testIssue) + runServerTestTLS13(t, testResume) + + config := testConfig.Clone() + config.CurvePreferences = []CurveID{CurveP256} + + testResumeHRR := &serverTest{ + name: "Resume-HelloRetryRequest", + command: []string{"openssl", "s_client", "-curves", "X25519:P-256", "-cipher", "AES128-SHA", "-ciphersuites", + "TLS_AES_128_GCM_SHA256", "-sess_in", sessionFilePath}, + config: config, + validate: func(state ConnectionState) error { + if !state.DidResume { + return errors.New("did not resume") + } + return nil + }, + } + + runServerTestTLS13(t, testResumeHRR) +} + +func TestServerResumptionDisabled(t *testing.T) { + sessionFilePath := tempFile("") + defer os.Remove(sessionFilePath) + + config := testConfig.Clone() + + testIssue := &serverTest{ + name: "IssueTicketPreDisable", + command: []string{"openssl", "s_client", "-cipher", "AES128-SHA", "-ciphersuites", "TLS_AES_128_GCM_SHA256", "-sess_out", sessionFilePath}, + config: config, + wait: true, + } + testResume := &serverTest{ + name: "ResumeDisabled", + command: []string{"openssl", "s_client", "-cipher", "AES128-SHA", "-ciphersuites", "TLS_AES_128_GCM_SHA256", "-sess_in", sessionFilePath}, + config: config, + validate: func(state ConnectionState) error { + if state.DidResume { + return errors.New("resumed with SessionTicketsDisabled") + } + return nil + }, + } + + config.SessionTicketsDisabled = false + runServerTestTLS12(t, testIssue) + config.SessionTicketsDisabled = true + runServerTestTLS12(t, testResume) + + config.SessionTicketsDisabled = false + runServerTestTLS13(t, testIssue) + config.SessionTicketsDisabled = true + runServerTestTLS13(t, testResume) +} + +func TestFallbackSCSV(t *testing.T) { + serverConfig := Config{ + Certificates: testConfig.Certificates, + MinVersion: VersionTLS11, + } + test := &serverTest{ + name: "FallbackSCSV", + config: &serverConfig, + // OpenSSL 1.0.1j is needed for the -fallback_scsv option. + command: []string{"openssl", "s_client", "-fallback_scsv"}, + expectHandshakeErrorIncluding: "inappropriate protocol fallback", + } + runServerTestTLS11(t, test) +} + +func TestHandshakeServerExportKeyingMaterial(t *testing.T) { + test := &serverTest{ + name: "ExportKeyingMaterial", + command: []string{"openssl", "s_client", "-cipher", "ECDHE-RSA-AES256-SHA", "-ciphersuites", "TLS_CHACHA20_POLY1305_SHA256"}, + config: testConfig.Clone(), + validate: func(state ConnectionState) error { + if km, err := state.ExportKeyingMaterial("test", nil, 42); err != nil { + return fmt.Errorf("ExportKeyingMaterial failed: %v", err) + } else if len(km) != 42 { + return fmt.Errorf("Got %d bytes from ExportKeyingMaterial, wanted %d", len(km), 42) + } + return nil + }, + } + runServerTestTLS10(t, test) + runServerTestTLS12(t, test) + runServerTestTLS13(t, test) +} + +func TestHandshakeServerRSAPKCS1v15(t *testing.T) { + test := &serverTest{ + name: "RSA-RSAPKCS1v15", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "ECDHE-RSA-CHACHA20-POLY1305", "-sigalgs", "rsa_pkcs1_sha256"}, + } + runServerTestTLS12(t, test) +} + +func TestHandshakeServerRSAPSS(t *testing.T) { + // We send rsa_pss_rsae_sha512 first, as the test key won't fit, and we + // verify the server implementation will disregard the client preference in + // that case. See Issue 29793. + test := &serverTest{ + name: "RSA-RSAPSS", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "ECDHE-RSA-CHACHA20-POLY1305", "-ciphersuites", "TLS_CHACHA20_POLY1305_SHA256", "-sigalgs", "rsa_pss_rsae_sha512:rsa_pss_rsae_sha256"}, + } + runServerTestTLS12(t, test) + runServerTestTLS13(t, test) + + test = &serverTest{ + name: "RSA-RSAPSS-TooSmall", + command: []string{"openssl", "s_client", "-no_ticket", "-ciphersuites", "TLS_CHACHA20_POLY1305_SHA256", "-sigalgs", "rsa_pss_rsae_sha512"}, + expectHandshakeErrorIncluding: "peer doesn't support any of the certificate's signature algorithms", + } + runServerTestTLS13(t, test) +} + +func TestHandshakeServerEd25519(t *testing.T) { + config := testConfig.Clone() + config.Certificates = make([]Certificate, 1) + config.Certificates[0].Certificate = [][]byte{testEd25519Certificate} + config.Certificates[0].PrivateKey = testEd25519PrivateKey + config.BuildNameToCertificate() + + test := &serverTest{ + name: "Ed25519", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "ECDHE-ECDSA-CHACHA20-POLY1305", "-ciphersuites", "TLS_CHACHA20_POLY1305_SHA256"}, + config: config, + } + runServerTestTLS12(t, test) + runServerTestTLS13(t, test) +} + +func benchmarkHandshakeServer(b *testing.B, version uint16, cipherSuite uint16, curve CurveID, cert []byte, key crypto.PrivateKey) { + config := testConfig.Clone() + config.CipherSuites = []uint16{cipherSuite} + config.CurvePreferences = []CurveID{curve} + config.Certificates = make([]Certificate, 1) + config.Certificates[0].Certificate = [][]byte{cert} + config.Certificates[0].PrivateKey = key + config.BuildNameToCertificate() + + clientConn, serverConn := localPipe(b) + serverConn = &recordingConn{Conn: serverConn} + go func() { + config := testConfig.Clone() + config.MaxVersion = version + config.CurvePreferences = []CurveID{curve} + client := Client(clientConn, config) + client.Handshake() + }() + server := Server(serverConn, config) + if err := server.Handshake(); err != nil { + b.Fatalf("handshake failed: %v", err) + } + serverConn.Close() + flows := serverConn.(*recordingConn).flows + + b.ResetTimer() + for i := 0; i < b.N; i++ { + replay := &replayingConn{t: b, flows: slices.Clone(flows), reading: true} + server := Server(replay, config) + if err := server.Handshake(); err != nil { + b.Fatalf("handshake failed: %v", err) + } + } +} + +func BenchmarkHandshakeServer(b *testing.B) { + b.Run("RSA", func(b *testing.B) { + benchmarkHandshakeServer(b, VersionTLS12, TLS_RSA_WITH_AES_128_GCM_SHA256, + 0, testRSACertificate, testRSAPrivateKey) + }) + b.Run("ECDHE-P256-RSA", func(b *testing.B) { + b.Run("TLSv13", func(b *testing.B) { + benchmarkHandshakeServer(b, VersionTLS13, TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, + CurveP256, testRSACertificate, testRSAPrivateKey) + }) + b.Run("TLSv12", func(b *testing.B) { + benchmarkHandshakeServer(b, VersionTLS12, TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, + CurveP256, testRSACertificate, testRSAPrivateKey) + }) + }) + b.Run("ECDHE-P256-ECDSA-P256", func(b *testing.B) { + b.Run("TLSv13", func(b *testing.B) { + benchmarkHandshakeServer(b, VersionTLS13, TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, + CurveP256, testP256Certificate, testP256PrivateKey) + }) + b.Run("TLSv12", func(b *testing.B) { + benchmarkHandshakeServer(b, VersionTLS12, TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, + CurveP256, testP256Certificate, testP256PrivateKey) + }) + }) + b.Run("ECDHE-X25519-ECDSA-P256", func(b *testing.B) { + b.Run("TLSv13", func(b *testing.B) { + benchmarkHandshakeServer(b, VersionTLS13, TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, + X25519, testP256Certificate, testP256PrivateKey) + }) + b.Run("TLSv12", func(b *testing.B) { + benchmarkHandshakeServer(b, VersionTLS12, TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, + X25519, testP256Certificate, testP256PrivateKey) + }) + }) + b.Run("ECDHE-P521-ECDSA-P521", func(b *testing.B) { + if testECDSAPrivateKey.PublicKey.Curve != elliptic.P521() { + b.Fatal("test ECDSA key doesn't use curve P-521") + } + b.Run("TLSv13", func(b *testing.B) { + benchmarkHandshakeServer(b, VersionTLS13, TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, + CurveP521, testECDSACertificate, testECDSAPrivateKey) + }) + b.Run("TLSv12", func(b *testing.B) { + benchmarkHandshakeServer(b, VersionTLS12, TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, + CurveP521, testECDSACertificate, testECDSAPrivateKey) + }) + }) +} + +func TestClientAuth(t *testing.T) { + var certPath, keyPath, ecdsaCertPath, ecdsaKeyPath, ed25519CertPath, ed25519KeyPath string + + if *update { + certPath = tempFile(clientCertificatePEM) + defer os.Remove(certPath) + keyPath = tempFile(clientKeyPEM) + defer os.Remove(keyPath) + ecdsaCertPath = tempFile(clientECDSACertificatePEM) + defer os.Remove(ecdsaCertPath) + ecdsaKeyPath = tempFile(clientECDSAKeyPEM) + defer os.Remove(ecdsaKeyPath) + ed25519CertPath = tempFile(clientEd25519CertificatePEM) + defer os.Remove(ed25519CertPath) + ed25519KeyPath = tempFile(clientEd25519KeyPEM) + defer os.Remove(ed25519KeyPath) + } else { + t.Parallel() + } + + config := testConfig.Clone() + config.ClientAuth = RequestClientCert + + test := &serverTest{ + name: "ClientAuthRequestedNotGiven", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", "-ciphersuites", "TLS_AES_128_GCM_SHA256"}, + config: config, + } + runServerTestTLS12(t, test) + runServerTestTLS13(t, test) + + test = &serverTest{ + name: "ClientAuthRequestedAndGiven", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", "-ciphersuites", "TLS_AES_128_GCM_SHA256", + "-cert", certPath, "-key", keyPath, "-client_sigalgs", "rsa_pss_rsae_sha256"}, + config: config, + expectedPeerCerts: []string{clientCertificatePEM}, + } + runServerTestTLS12(t, test) + runServerTestTLS13(t, test) + + test = &serverTest{ + name: "ClientAuthRequestedAndECDSAGiven", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", "-ciphersuites", "TLS_AES_128_GCM_SHA256", + "-cert", ecdsaCertPath, "-key", ecdsaKeyPath}, + config: config, + expectedPeerCerts: []string{clientECDSACertificatePEM}, + } + runServerTestTLS12(t, test) + runServerTestTLS13(t, test) + + test = &serverTest{ + name: "ClientAuthRequestedAndEd25519Given", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", "-ciphersuites", "TLS_AES_128_GCM_SHA256", + "-cert", ed25519CertPath, "-key", ed25519KeyPath}, + config: config, + expectedPeerCerts: []string{clientEd25519CertificatePEM}, + } + runServerTestTLS12(t, test) + runServerTestTLS13(t, test) + + test = &serverTest{ + name: "ClientAuthRequestedAndPKCS1v15Given", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", + "-cert", certPath, "-key", keyPath, "-client_sigalgs", "rsa_pkcs1_sha256"}, + config: config, + expectedPeerCerts: []string{clientCertificatePEM}, + } + runServerTestTLS12(t, test) +} + +func TestSNIGivenOnFailure(t *testing.T) { + const expectedServerName = "test.testing" + + clientHello := &clientHelloMsg{ + vers: VersionTLS12, + random: make([]byte, 32), + cipherSuites: []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256}, + compressionMethods: []uint8{compressionNone}, + serverName: expectedServerName, + } + + serverConfig := testConfig.Clone() + // Erase the server's cipher suites to ensure the handshake fails. + serverConfig.CipherSuites = nil + + c, s := localPipe(t) + go func() { + cli := Client(c, testConfig) + cli.vers = clientHello.vers + if _, err := cli.writeHandshakeRecord(clientHello, nil); err != nil { + testFatal(t, err) + } + c.Close() + }() + conn := Server(s, serverConfig) + ctx := context.Background() + ch, _, err := conn.readClientHello(ctx) + hs := serverHandshakeState{ + c: conn, + ctx: ctx, + clientHello: ch, + } + if err == nil { + err = hs.processClientHello() + } + if err == nil { + err = hs.pickCipherSuite() + } + defer s.Close() + + if err == nil { + t.Error("No error reported from server") + } + + cs := hs.c.ConnectionState() + if cs.HandshakeComplete { + t.Error("Handshake registered as complete") + } + + if cs.ServerName != expectedServerName { + t.Errorf("Expected ServerName of %q, but got %q", expectedServerName, cs.ServerName) + } +} + +var getConfigForClientTests = []struct { + setup func(config *Config) + callback func(clientHello *ClientHelloInfo) (*Config, error) + errorSubstring string + verify func(config *Config) error +}{ + { + nil, + func(clientHello *ClientHelloInfo) (*Config, error) { + return nil, nil + }, + "", + nil, + }, + { + nil, + func(clientHello *ClientHelloInfo) (*Config, error) { + return nil, errors.New("should bubble up") + }, + "should bubble up", + nil, + }, + { + nil, + func(clientHello *ClientHelloInfo) (*Config, error) { + config := testConfig.Clone() + // Setting a maximum version of TLS 1.1 should cause + // the handshake to fail, as the client MinVersion is TLS 1.2. + config.MaxVersion = VersionTLS11 + return config, nil + }, + "client offered only unsupported versions", + nil, + }, + { + func(config *Config) { + for i := range config.SessionTicketKey { + config.SessionTicketKey[i] = byte(i) + } + config.sessionTicketKeys = nil + }, + func(clientHello *ClientHelloInfo) (*Config, error) { + config := testConfig.Clone() + clear(config.SessionTicketKey[:]) + config.sessionTicketKeys = nil + return config, nil + }, + "", + func(config *Config) error { + if config.SessionTicketKey == [32]byte{} { + return fmt.Errorf("expected SessionTicketKey to be set") + } + return nil + }, + }, + { + func(config *Config) { + var dummyKey [32]byte + for i := range dummyKey { + dummyKey[i] = byte(i) + } + + config.SetSessionTicketKeys([][32]byte{dummyKey}) + }, + func(clientHello *ClientHelloInfo) (*Config, error) { + config := testConfig.Clone() + config.sessionTicketKeys = nil + return config, nil + }, + "", + func(config *Config) error { + if config.SessionTicketKey == [32]byte{} { + return fmt.Errorf("expected SessionTicketKey to be set") + } + return nil + }, + }, +} + +func TestGetConfigForClient(t *testing.T) { + serverConfig := testConfig.Clone() + clientConfig := testConfig.Clone() + clientConfig.MinVersion = VersionTLS12 + + for i, test := range getConfigForClientTests { + if test.setup != nil { + test.setup(serverConfig) + } + + var configReturned *Config + serverConfig.GetConfigForClient = func(clientHello *ClientHelloInfo) (*Config, error) { + config, err := test.callback(clientHello) + configReturned = config + return config, err + } + c, s := localPipe(t) + done := make(chan error) + + go func() { + defer s.Close() + done <- Server(s, serverConfig).Handshake() + }() + + clientErr := Client(c, clientConfig).Handshake() + c.Close() + + serverErr := <-done + + if len(test.errorSubstring) == 0 { + if serverErr != nil || clientErr != nil { + t.Errorf("test[%d]: expected no error but got serverErr: %q, clientErr: %q", i, serverErr, clientErr) + } + if test.verify != nil { + if err := test.verify(configReturned); err != nil { + t.Errorf("test[%d]: verify returned error: %v", i, err) + } + } + } else { + if serverErr == nil { + t.Errorf("test[%d]: expected error containing %q but got no error", i, test.errorSubstring) + } else if !strings.Contains(serverErr.Error(), test.errorSubstring) { + t.Errorf("test[%d]: expected error to contain %q but it was %q", i, test.errorSubstring, serverErr) + } + } + } +} + +func TestCloseServerConnectionOnIdleClient(t *testing.T) { + clientConn, serverConn := localPipe(t) + server := Server(serverConn, testConfig.Clone()) + go func() { + clientConn.Write([]byte{'0'}) + server.Close() + }() + server.SetReadDeadline(time.Now().Add(time.Minute)) + err := server.Handshake() + if err != nil { + if err, ok := err.(net.Error); ok && err.Timeout() { + t.Errorf("Expected a closed network connection error but got '%s'", err.Error()) + } + } else { + t.Errorf("Error expected, but no error returned") + } +} + +func TestCloneHash(t *testing.T) { + h1 := crypto.SHA256.New() + h1.Write([]byte("test")) + s1 := h1.Sum(nil) + h2 := cloneHash(h1, crypto.SHA256) + s2 := h2.Sum(nil) + if !bytes.Equal(s1, s2) { + t.Error("cloned hash generated a different sum") + } +} + +func expectError(t *testing.T, err error, sub string) { + if err == nil { + t.Errorf(`expected error %q, got nil`, sub) + } else if !strings.Contains(err.Error(), sub) { + t.Errorf(`expected error %q, got %q`, sub, err) + } +} + +func TestKeyTooSmallForRSAPSS(t *testing.T) { + cert, err := X509KeyPair([]byte(`-----BEGIN CERTIFICATE----- +MIIBcTCCARugAwIBAgIQGjQnkCFlUqaFlt6ixyz/tDANBgkqhkiG9w0BAQsFADAS +MRAwDgYDVQQKEwdBY21lIENvMB4XDTE5MDExODIzMjMyOFoXDTIwMDExODIzMjMy +OFowEjEQMA4GA1UEChMHQWNtZSBDbzBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDd +ez1rFUDwax2HTxbcnFUP9AhcgEGMHVV2nn4VVEWFJB6I8C/Nkx0XyyQlrmFYBzEQ +nIPhKls4T0hFoLvjJnXpAgMBAAGjTTBLMA4GA1UdDwEB/wQEAwIFoDATBgNVHSUE +DDAKBggrBgEFBQcDATAMBgNVHRMBAf8EAjAAMBYGA1UdEQQPMA2CC2V4YW1wbGUu +Y29tMA0GCSqGSIb3DQEBCwUAA0EAxDuUS+BrrS3c+h+k+fQPOmOScy6yTX9mHw0Q +KbucGamXYEy0URIwOdO0tQ3LHPc1YGvYSPwkDjkjqECs2Vm/AA== +-----END CERTIFICATE-----`), []byte(testingKey(`-----BEGIN RSA TESTING KEY----- +MIIBOgIBAAJBAN17PWsVQPBrHYdPFtycVQ/0CFyAQYwdVXaefhVURYUkHojwL82T +HRfLJCWuYVgHMRCcg+EqWzhPSEWgu+MmdekCAwEAAQJBALjQYNTdXF4CFBbXwUz/ +yt9QFDYT9B5WT/12jeGAe653gtYS6OOi/+eAkGmzg1GlRnw6fOfn+HYNFDORST7z +4j0CIQDn2xz9hVWQEu9ee3vecNT3f60huDGTNoRhtqgweQGX0wIhAPSLj1VcRZEz +nKpbtU22+PbIMSJ+e80fmY9LIPx5N4HTAiAthGSimMR9bloz0EY3GyuUEyqoDgMd +hXxjuno2WesoJQIgemilbcALXpxsLmZLgcQ2KSmaVr7jb5ECx9R+hYKTw1sCIG4s +T+E0J8wlH24pgwQHzy7Ko2qLwn1b5PW8ecrlvP1g +-----END RSA TESTING KEY-----`))) + if err != nil { + t.Fatal(err) + } + + clientConn, serverConn := localPipe(t) + client := Client(clientConn, testConfig) + done := make(chan struct{}) + go func() { + config := testConfig.Clone() + config.Certificates = []Certificate{cert} + config.MinVersion = VersionTLS13 + server := Server(serverConn, config) + err := server.Handshake() + expectError(t, err, "key size too small") + close(done) + }() + err = client.Handshake() + expectError(t, err, "handshake failure") + <-done +} + +func TestMultipleCertificates(t *testing.T) { + clientConfig := testConfig.Clone() + clientConfig.CipherSuites = []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256} + clientConfig.MaxVersion = VersionTLS12 + + serverConfig := testConfig.Clone() + serverConfig.Certificates = []Certificate{{ + Certificate: [][]byte{testECDSACertificate}, + PrivateKey: testECDSAPrivateKey, + }, { + Certificate: [][]byte{testRSACertificate}, + PrivateKey: testRSAPrivateKey, + }} + + _, clientState, err := testHandshake(t, clientConfig, serverConfig) + if err != nil { + t.Fatal(err) + } + if got := clientState.PeerCertificates[0].PublicKeyAlgorithm; got != x509.RSA { + t.Errorf("expected RSA certificate, got %v", got) + } +} + +func TestAESCipherReordering(t *testing.T) { + skipFIPS(t) // No CHACHA20_POLY1305 for FIPS. + + currentAESSupport := hasAESGCMHardwareSupport + defer func() { hasAESGCMHardwareSupport = currentAESSupport }() + + tests := []struct { + name string + clientCiphers []uint16 + serverHasAESGCM bool + serverCiphers []uint16 + expectedCipher uint16 + }{ + { + name: "server has hardware AES, client doesn't (pick ChaCha)", + clientCiphers: []uint16{ + TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, + TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + TLS_RSA_WITH_AES_128_CBC_SHA, + }, + serverHasAESGCM: true, + expectedCipher: TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, + }, + { + name: "client prefers AES-GCM, server doesn't have hardware AES (pick ChaCha)", + clientCiphers: []uint16{ + TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, + TLS_RSA_WITH_AES_128_CBC_SHA, + }, + serverHasAESGCM: false, + expectedCipher: TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, + }, + { + name: "client prefers AES-GCM, server has hardware AES (pick AES-GCM)", + clientCiphers: []uint16{ + TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, + TLS_RSA_WITH_AES_128_CBC_SHA, + }, + serverHasAESGCM: true, + expectedCipher: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + }, + { + name: "client prefers AES-GCM and sends GREASE, server has hardware AES (pick AES-GCM)", + clientCiphers: []uint16{ + 0x0A0A, // GREASE value + TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, + TLS_RSA_WITH_AES_128_CBC_SHA, + }, + serverHasAESGCM: true, + expectedCipher: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + }, + { + name: "client prefers AES-GCM and doesn't support ChaCha, server doesn't have hardware AES (pick AES-GCM)", + clientCiphers: []uint16{ + TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, + TLS_RSA_WITH_AES_128_CBC_SHA, + }, + serverHasAESGCM: false, + expectedCipher: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + }, + { + name: "client prefers AES-GCM and AES-CBC over ChaCha, server doesn't have hardware AES (pick ChaCha)", + clientCiphers: []uint16{ + TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + TLS_RSA_WITH_AES_128_CBC_SHA, + TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, + }, + serverHasAESGCM: false, + expectedCipher: TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, + }, + { + name: "client prefers AES-GCM over ChaCha and sends GREASE, server doesn't have hardware AES (pick ChaCha)", + clientCiphers: []uint16{ + 0x0A0A, // GREASE value + TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, + TLS_RSA_WITH_AES_128_CBC_SHA, + }, + serverHasAESGCM: false, + expectedCipher: TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, + }, + { + name: "client supports multiple AES-GCM, server doesn't have hardware AES and doesn't support ChaCha (AES-GCM)", + clientCiphers: []uint16{ + TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, + TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, + TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + }, + serverHasAESGCM: false, + serverCiphers: []uint16{ + TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, + TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + }, + expectedCipher: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + }, + { + name: "client prefers AES-GCM, server has hardware but doesn't support AES (pick ChaCha)", + clientCiphers: []uint16{ + TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, + TLS_RSA_WITH_AES_128_CBC_SHA, + }, + serverHasAESGCM: true, + serverCiphers: []uint16{ + TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, + }, + expectedCipher: TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + hasAESGCMHardwareSupport = tc.serverHasAESGCM + hs := &serverHandshakeState{ + c: &Conn{ + config: &Config{ + CipherSuites: tc.serverCiphers, + }, + vers: VersionTLS12, + }, + clientHello: &clientHelloMsg{ + cipherSuites: tc.clientCiphers, + vers: VersionTLS12, + }, + ecdheOk: true, + rsaSignOk: true, + rsaDecryptOk: true, + } + + err := hs.pickCipherSuite() + if err != nil { + t.Errorf("pickCipherSuite failed: %s", err) + } + + if tc.expectedCipher != hs.suite.id { + t.Errorf("unexpected cipher chosen: want %d, got %d", tc.expectedCipher, hs.suite.id) + } + }) + } +} + +func TestAESCipherReorderingTLS13(t *testing.T) { + skipFIPS(t) // No CHACHA20_POLY1305 for FIPS. + + currentAESSupport := hasAESGCMHardwareSupport + defer func() { hasAESGCMHardwareSupport = currentAESSupport }() + + tests := []struct { + name string + clientCiphers []uint16 + serverHasAESGCM bool + expectedCipher uint16 + }{ + { + name: "server has hardware AES, client doesn't (pick ChaCha)", + clientCiphers: []uint16{ + TLS_CHACHA20_POLY1305_SHA256, + TLS_AES_128_GCM_SHA256, + }, + serverHasAESGCM: true, + expectedCipher: TLS_CHACHA20_POLY1305_SHA256, + }, + { + name: "neither server nor client have hardware AES (pick ChaCha)", + clientCiphers: []uint16{ + TLS_CHACHA20_POLY1305_SHA256, + TLS_AES_128_GCM_SHA256, + }, + serverHasAESGCM: false, + expectedCipher: TLS_CHACHA20_POLY1305_SHA256, + }, + { + name: "client prefers AES, server doesn't have hardware (pick ChaCha)", + clientCiphers: []uint16{ + TLS_AES_128_GCM_SHA256, + TLS_CHACHA20_POLY1305_SHA256, + }, + serverHasAESGCM: false, + expectedCipher: TLS_CHACHA20_POLY1305_SHA256, + }, + { + name: "client prefers AES and sends GREASE, server doesn't have hardware (pick ChaCha)", + clientCiphers: []uint16{ + 0x0A0A, // GREASE value + TLS_AES_128_GCM_SHA256, + TLS_CHACHA20_POLY1305_SHA256, + }, + serverHasAESGCM: false, + expectedCipher: TLS_CHACHA20_POLY1305_SHA256, + }, + { + name: "client prefers AES, server has hardware AES (pick AES)", + clientCiphers: []uint16{ + TLS_AES_128_GCM_SHA256, + TLS_CHACHA20_POLY1305_SHA256, + }, + serverHasAESGCM: true, + expectedCipher: TLS_AES_128_GCM_SHA256, + }, + { + name: "client prefers AES and sends GREASE, server has hardware AES (pick AES)", + clientCiphers: []uint16{ + 0x0A0A, // GREASE value + TLS_AES_128_GCM_SHA256, + TLS_CHACHA20_POLY1305_SHA256, + }, + serverHasAESGCM: true, + expectedCipher: TLS_AES_128_GCM_SHA256, + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + hasAESGCMHardwareSupport = tc.serverHasAESGCM + pk, _ := ecdh.X25519().GenerateKey(rand.Reader) + hs := &serverHandshakeStateTLS13{ + c: &Conn{ + config: &Config{}, + vers: VersionTLS13, + }, + clientHello: &clientHelloMsg{ + cipherSuites: tc.clientCiphers, + supportedVersions: []uint16{VersionTLS13}, + compressionMethods: []uint8{compressionNone}, + keyShares: []keyShare{{group: X25519, data: pk.PublicKey().Bytes()}}, + supportedCurves: []CurveID{X25519}, + }, + } + + err := hs.processClientHello() + if err != nil { + t.Errorf("pickCipherSuite failed: %s", err) + } + + if tc.expectedCipher != hs.suite.id { + t.Errorf("unexpected cipher chosen: want %d, got %d", tc.expectedCipher, hs.suite.id) + } + }) + } +} + +// TestServerHandshakeContextCancellation tests that canceling +// the context given to the server side conn.HandshakeContext +// interrupts the in-progress handshake. +func TestServerHandshakeContextCancellation(t *testing.T) { + c, s := localPipe(t) + ctx, cancel := context.WithCancel(context.Background()) + unblockClient := make(chan struct{}) + defer close(unblockClient) + go func() { + cancel() + <-unblockClient + _ = c.Close() + }() + conn := Server(s, testConfig) + // Initiates server side handshake, which will block until a client hello is read + // unless the cancellation works. + err := conn.HandshakeContext(ctx) + if err == nil { + t.Fatal("Server handshake did not error when the context was canceled") + } + if err != context.Canceled { + t.Errorf("Unexpected server handshake error: %v", err) + } + if runtime.GOOS == "js" || runtime.GOOS == "wasip1" { + t.Skip("conn.Close does not error as expected when called multiple times on GOOS=js or GOOS=wasip1") + } + err = conn.Close() + if err == nil { + t.Error("Server connection was not closed when the context was canceled") + } +} + +// TestHandshakeContextHierarchy tests whether the contexts +// available to GetClientCertificate and GetCertificate are +// derived from the context provided to HandshakeContext, and +// that those contexts are canceled after HandshakeContext has +// returned. +func TestHandshakeContextHierarchy(t *testing.T) { + c, s := localPipe(t) + clientErr := make(chan error, 1) + clientConfig := testConfig.Clone() + serverConfig := testConfig.Clone() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + key := struct{}{} + ctx = context.WithValue(ctx, key, true) + go func() { + defer close(clientErr) + defer c.Close() + var innerCtx context.Context + clientConfig.Certificates = nil + clientConfig.GetClientCertificate = func(certificateRequest *CertificateRequestInfo) (*Certificate, error) { + if val, ok := certificateRequest.Context().Value(key).(bool); !ok || !val { + t.Errorf("GetClientCertificate context was not child of HandshakeContext") + } + innerCtx = certificateRequest.Context() + return &Certificate{ + Certificate: [][]byte{testRSACertificate}, + PrivateKey: testRSAPrivateKey, + }, nil + } + cli := Client(c, clientConfig) + err := cli.HandshakeContext(ctx) + if err != nil { + clientErr <- err + return + } + select { + case <-innerCtx.Done(): + default: + t.Errorf("GetClientCertificate context was not canceled after HandshakeContext returned.") + } + }() + var innerCtx context.Context + serverConfig.Certificates = nil + serverConfig.ClientAuth = RequestClientCert + serverConfig.GetCertificate = func(clientHello *ClientHelloInfo) (*Certificate, error) { + if val, ok := clientHello.Context().Value(key).(bool); !ok || !val { + t.Errorf("GetClientCertificate context was not child of HandshakeContext") + } + innerCtx = clientHello.Context() + return &Certificate{ + Certificate: [][]byte{testRSACertificate}, + PrivateKey: testRSAPrivateKey, + }, nil + } + conn := Server(s, serverConfig) + err := conn.HandshakeContext(ctx) + if err != nil { + t.Errorf("Unexpected server handshake error: %v", err) + } + select { + case <-innerCtx.Done(): + default: + t.Errorf("GetCertificate context was not canceled after HandshakeContext returned.") + } + if err := <-clientErr; err != nil { + t.Errorf("Unexpected client error: %v", err) + } +} + +func TestHandshakeChainExpiryResumption(t *testing.T) { + t.Run("TLS1.2", func(t *testing.T) { + testHandshakeChainExpiryResumption(t, VersionTLS12) + }) + t.Run("TLS1.3", func(t *testing.T) { + testHandshakeChainExpiryResumption(t, VersionTLS13) + }) +} + +func testHandshakeChainExpiryResumption(t *testing.T, version uint16) { + now := time.Now() + + createChain := func(leafNotAfter, rootNotAfter time.Time) (leafDER, expiredLeafDER []byte, root *x509.Certificate) { + tmpl := &x509.Certificate{ + Subject: pkix.Name{CommonName: "root"}, + NotBefore: rootNotAfter.Add(-time.Hour * 24), + NotAfter: rootNotAfter, + IsCA: true, + BasicConstraintsValid: true, + } + rootDER, err := x509.CreateCertificate(rand.Reader, tmpl, tmpl, &testECDSAPrivateKey.PublicKey, testECDSAPrivateKey) + if err != nil { + t.Fatalf("CreateCertificate: %v", err) + } + root, err = x509.ParseCertificate(rootDER) + if err != nil { + t.Fatalf("ParseCertificate: %v", err) + } + + tmpl = &x509.Certificate{ + Subject: pkix.Name{}, + DNSNames: []string{"expired-resume.example.com"}, + NotBefore: leafNotAfter.Add(-time.Hour * 24), + NotAfter: leafNotAfter, + KeyUsage: x509.KeyUsageDigitalSignature, + } + leafCertDER, err := x509.CreateCertificate(rand.Reader, tmpl, root, &testECDSAPrivateKey.PublicKey, testECDSAPrivateKey) + if err != nil { + t.Fatalf("CreateCertificate: %v", err) + } + tmpl.NotBefore, tmpl.NotAfter = leafNotAfter.Add(-time.Hour*24*365), leafNotAfter.Add(-time.Hour*24*364) + expiredLeafDERCertDER, err := x509.CreateCertificate(rand.Reader, tmpl, root, &testECDSAPrivateKey.PublicKey, testECDSAPrivateKey) + if err != nil { + t.Fatalf("CreateCertificate: %v", err) + } + + return leafCertDER, expiredLeafDERCertDER, root + } + testExpiration := func(name string, leafNotAfter, rootNotAfter time.Time) { + t.Run(name, func(t *testing.T) { + initialLeafDER, expiredLeafDER, initialRoot := createChain(leafNotAfter, rootNotAfter) + + serverConfig := testConfig.Clone() + serverConfig.MaxVersion = version + serverConfig.Certificates = []Certificate{{ + Certificate: [][]byte{initialLeafDER, expiredLeafDER}, + PrivateKey: testECDSAPrivateKey, + }} + serverConfig.ClientCAs = x509.NewCertPool() + serverConfig.ClientCAs.AddCert(initialRoot) + serverConfig.ClientAuth = RequireAndVerifyClientCert + serverConfig.Time = func() time.Time { + return now + } + serverConfig.InsecureSkipVerify = false + serverConfig.ServerName = "expired-resume.example.com" + + clientConfig := testConfig.Clone() + clientConfig.MaxVersion = version + clientConfig.Certificates = []Certificate{{ + Certificate: [][]byte{initialLeafDER, expiredLeafDER}, + PrivateKey: testECDSAPrivateKey, + }} + clientConfig.RootCAs = x509.NewCertPool() + clientConfig.RootCAs.AddCert(initialRoot) + clientConfig.ServerName = "expired-resume.example.com" + clientConfig.ClientSessionCache = NewLRUClientSessionCache(32) + clientConfig.InsecureSkipVerify = false + clientConfig.ServerName = "expired-resume.example.com" + clientConfig.Time = func() time.Time { + return now + } + + testResume := func(t *testing.T, sc, cc *Config, expectResume bool) { + t.Helper() + ss, cs, err := testHandshake(t, cc, sc) + if err != nil { + t.Fatalf("handshake: %v", err) + } + if cs.DidResume != expectResume { + t.Fatalf("DidResume = %v; want %v", cs.DidResume, expectResume) + } + if ss.DidResume != expectResume { + t.Fatalf("DidResume = %v; want %v", cs.DidResume, expectResume) + } + } + + testResume(t, serverConfig, clientConfig, false) + testResume(t, serverConfig, clientConfig, true) + + expiredNow := time.Unix(0, min(leafNotAfter.UnixNano(), rootNotAfter.UnixNano())).Add(time.Minute) + + freshLeafDER, expiredLeafDER, freshRoot := createChain(expiredNow.Add(time.Hour), expiredNow.Add(time.Hour)) + clientConfig.Certificates = []Certificate{{ + Certificate: [][]byte{freshLeafDER, expiredLeafDER}, + PrivateKey: testECDSAPrivateKey, + }} + serverConfig.Time = func() time.Time { + return expiredNow + } + serverConfig.ClientCAs = x509.NewCertPool() + serverConfig.ClientCAs.AddCert(freshRoot) + + testResume(t, serverConfig, clientConfig, false) + }) + } + + testExpiration("LeafExpiresBeforeRoot", now.Add(2*time.Hour), now.Add(3*time.Hour)) + testExpiration("LeafExpiresAfterRoot", now.Add(2*time.Hour), now.Add(time.Hour)) +} + +func TestHandshakeGetConfigForClientDifferentClientCAs(t *testing.T) { + t.Run("TLS1.2", func(t *testing.T) { + testHandshakeGetConfigForClientDifferentClientCAs(t, VersionTLS12) + }) + t.Run("TLS1.3", func(t *testing.T) { + testHandshakeGetConfigForClientDifferentClientCAs(t, VersionTLS13) + }) +} + +func testHandshakeGetConfigForClientDifferentClientCAs(t *testing.T, version uint16) { + now := time.Now() + tmpl := &x509.Certificate{ + Subject: pkix.Name{CommonName: "root"}, + NotBefore: now.Add(-time.Hour * 24), + NotAfter: now.Add(time.Hour * 24), + IsCA: true, + BasicConstraintsValid: true, + } + rootDER, err := x509.CreateCertificate(rand.Reader, tmpl, tmpl, &testECDSAPrivateKey.PublicKey, testECDSAPrivateKey) + if err != nil { + t.Fatalf("CreateCertificate: %v", err) + } + rootA, err := x509.ParseCertificate(rootDER) + if err != nil { + t.Fatalf("ParseCertificate: %v", err) + } + rootDER, err = x509.CreateCertificate(rand.Reader, tmpl, tmpl, &testRSA2048PrivateKey.PublicKey, testRSA2048PrivateKey) + if err != nil { + t.Fatalf("CreateCertificate: %v", err) + } + rootB, err := x509.ParseCertificate(rootDER) + if err != nil { + t.Fatalf("ParseCertificate: %v", err) + } + + tmpl = &x509.Certificate{ + Subject: pkix.Name{}, + DNSNames: []string{"example.com"}, + NotBefore: now.Add(-time.Hour * 24), + NotAfter: now.Add(time.Hour * 24), + KeyUsage: x509.KeyUsageDigitalSignature, + } + certA, err := x509.CreateCertificate(rand.Reader, tmpl, rootA, &testECDSAPrivateKey.PublicKey, testECDSAPrivateKey) + if err != nil { + t.Fatalf("CreateCertificate: %v", err) + } + certB, err := x509.CreateCertificate(rand.Reader, tmpl, rootB, &testECDSAPrivateKey.PublicKey, testRSA2048PrivateKey) + if err != nil { + t.Fatalf("CreateCertificate: %v", err) + } + + serverConfig := testConfig.Clone() + serverConfig.MaxVersion = version + serverConfig.Certificates = []Certificate{{ + Certificate: [][]byte{certA}, + PrivateKey: testECDSAPrivateKey, + }} + serverConfig.Time = func() time.Time { + return now + } + serverConfig.ClientCAs = x509.NewCertPool() + serverConfig.ClientCAs.AddCert(rootA) + serverConfig.ClientAuth = RequireAndVerifyClientCert + switchConfig := false + serverConfig.GetConfigForClient = func(clientHello *ClientHelloInfo) (*Config, error) { + if !switchConfig { + return nil, nil + } + cfg := serverConfig.Clone() + cfg.ClientCAs = x509.NewCertPool() + cfg.ClientCAs.AddCert(rootB) + return cfg, nil + } + serverConfig.InsecureSkipVerify = false + serverConfig.ServerName = "example.com" + + clientConfig := testConfig.Clone() + clientConfig.MaxVersion = version + clientConfig.Certificates = []Certificate{{ + Certificate: [][]byte{certA}, + PrivateKey: testECDSAPrivateKey, + }} + clientConfig.ClientSessionCache = NewLRUClientSessionCache(32) + clientConfig.RootCAs = x509.NewCertPool() + clientConfig.RootCAs.AddCert(rootA) + clientConfig.Time = func() time.Time { + return now + } + clientConfig.InsecureSkipVerify = false + clientConfig.ServerName = "example.com" + + testResume := func(t *testing.T, sc, cc *Config, expectResume bool) { + t.Helper() + ss, cs, err := testHandshake(t, cc, sc) + if err != nil { + t.Fatalf("handshake: %v", err) + } + if cs.DidResume != expectResume { + t.Fatalf("DidResume = %v; want %v", cs.DidResume, expectResume) + } + if ss.DidResume != expectResume { + t.Fatalf("DidResume = %v; want %v", cs.DidResume, expectResume) + } + } + + testResume(t, serverConfig, clientConfig, false) + testResume(t, serverConfig, clientConfig, true) + + clientConfig.Certificates[0].Certificate = [][]byte{certB} + + // Cause GetConfigForClient to return a config cloned from the base config, + // but with a different ClientCAs pool. This should cause resumption to fail. + switchConfig = true + + testResume(t, serverConfig, clientConfig, false) + testResume(t, serverConfig, clientConfig, true) +} + +func TestHandshakeChangeRootCAsResumption(t *testing.T) { + t.Run("TLS1.2", func(t *testing.T) { + testHandshakeChangeRootCAsResumption(t, VersionTLS12) + }) + t.Run("TLS1.3", func(t *testing.T) { + testHandshakeChangeRootCAsResumption(t, VersionTLS13) + }) +} + +func testHandshakeChangeRootCAsResumption(t *testing.T, version uint16) { + now := time.Now() + tmpl := &x509.Certificate{ + Subject: pkix.Name{CommonName: "root"}, + NotBefore: now.Add(-time.Hour * 24), + NotAfter: now.Add(time.Hour * 24), + IsCA: true, + BasicConstraintsValid: true, + } + rootDER, err := x509.CreateCertificate(rand.Reader, tmpl, tmpl, &testECDSAPrivateKey.PublicKey, testECDSAPrivateKey) + if err != nil { + t.Fatalf("CreateCertificate: %v", err) + } + rootA, err := x509.ParseCertificate(rootDER) + if err != nil { + t.Fatalf("ParseCertificate: %v", err) + } + rootDER, err = x509.CreateCertificate(rand.Reader, tmpl, tmpl, &testRSA2048PrivateKey.PublicKey, testRSA2048PrivateKey) + if err != nil { + t.Fatalf("CreateCertificate: %v", err) + } + rootB, err := x509.ParseCertificate(rootDER) + if err != nil { + t.Fatalf("ParseCertificate: %v", err) + } + + tmpl = &x509.Certificate{ + Subject: pkix.Name{}, + DNSNames: []string{"example.com"}, + NotBefore: now.Add(-time.Hour * 24), + NotAfter: now.Add(time.Hour * 24), + KeyUsage: x509.KeyUsageDigitalSignature, + } + certA, err := x509.CreateCertificate(rand.Reader, tmpl, rootA, &testECDSAPrivateKey.PublicKey, testECDSAPrivateKey) + if err != nil { + t.Fatalf("CreateCertificate: %v", err) + } + certB, err := x509.CreateCertificate(rand.Reader, tmpl, rootB, &testECDSAPrivateKey.PublicKey, testRSA2048PrivateKey) + if err != nil { + t.Fatalf("CreateCertificate: %v", err) + } + + serverConfig := testConfig.Clone() + serverConfig.MaxVersion = version + serverConfig.Certificates = []Certificate{{ + Certificate: [][]byte{certA}, + PrivateKey: testECDSAPrivateKey, + }} + serverConfig.Time = func() time.Time { + return now + } + serverConfig.ClientCAs = x509.NewCertPool() + serverConfig.ClientCAs.AddCert(rootA) + serverConfig.ClientAuth = RequireAndVerifyClientCert + serverConfig.InsecureSkipVerify = false + serverConfig.ServerName = "example.com" + + clientConfig := testConfig.Clone() + clientConfig.MaxVersion = version + clientConfig.Certificates = []Certificate{{ + Certificate: [][]byte{certA}, + PrivateKey: testECDSAPrivateKey, + }} + clientConfig.ClientSessionCache = NewLRUClientSessionCache(32) + clientConfig.RootCAs = x509.NewCertPool() + clientConfig.RootCAs.AddCert(rootA) + clientConfig.Time = func() time.Time { + return now + } + clientConfig.InsecureSkipVerify = false + clientConfig.ServerName = "example.com" + + testResume := func(t *testing.T, sc, cc *Config, expectResume bool) { + t.Helper() + ss, cs, err := testHandshake(t, cc, sc) + if err != nil { + t.Fatalf("handshake: %v", err) + } + if cs.DidResume != expectResume { + t.Fatalf("DidResume = %v; want %v", cs.DidResume, expectResume) + } + if ss.DidResume != expectResume { + t.Fatalf("DidResume = %v; want %v", cs.DidResume, expectResume) + } + } + + testResume(t, serverConfig, clientConfig, false) + testResume(t, serverConfig, clientConfig, true) + + clientConfig = clientConfig.Clone() + clientConfig.RootCAs = x509.NewCertPool() + clientConfig.RootCAs.AddCert(rootB) + + serverConfig.Certificates[0].Certificate = [][]byte{certB} + + testResume(t, serverConfig, clientConfig, false) + testResume(t, serverConfig, clientConfig, true) +} diff --git a/go/src/crypto/tls/handshake_server_tls13.go b/go/src/crypto/tls/handshake_server_tls13.go new file mode 100644 index 0000000000000000000000000000000000000000..b45d7cbc537ffea4157357a596e8540fad225d94 --- /dev/null +++ b/go/src/crypto/tls/handshake_server_tls13.go @@ -0,0 +1,1144 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "bytes" + "context" + "crypto" + "crypto/hkdf" + "crypto/hmac" + "crypto/hpke" + "crypto/internal/fips140/tls13" + "crypto/rsa" + "crypto/tls/internal/fips140tls" + "crypto/x509" + "errors" + "fmt" + "hash" + "internal/byteorder" + "io" + "slices" + "sort" + "time" +) + +// maxClientPSKIdentities is the number of client PSK identities the server will +// attempt to validate. It will ignore the rest not to let cheap ClientHello +// messages cause too much work in session ticket decryption attempts. +const maxClientPSKIdentities = 5 + +type echServerContext struct { + hpkeContext *hpke.Recipient + configID uint8 + ciphersuite echCipher + transcript hash.Hash + // inner indicates that the initial client_hello we received contained an + // encrypted_client_hello extension that indicated it was an "inner" hello. + // We don't do any additional processing of the hello in this case, so all + // fields above are unset. + inner bool +} + +type serverHandshakeStateTLS13 struct { + c *Conn + ctx context.Context + clientHello *clientHelloMsg + hello *serverHelloMsg + sentDummyCCS bool + usingPSK bool + earlyData bool + suite *cipherSuiteTLS13 + cert *Certificate + sigAlg SignatureScheme + earlySecret *tls13.EarlySecret + sharedKey []byte + handshakeSecret *tls13.HandshakeSecret + masterSecret *tls13.MasterSecret + trafficSecret []byte // client_application_traffic_secret_0 + transcript hash.Hash + clientFinished []byte + echContext *echServerContext +} + +func (hs *serverHandshakeStateTLS13) handshake() error { + c := hs.c + + // For an overview of the TLS 1.3 handshake, see RFC 8446, Section 2. + if err := hs.processClientHello(); err != nil { + return err + } + if err := hs.checkForResumption(); err != nil { + return err + } + if err := hs.pickCertificate(); err != nil { + return err + } + c.buffering = true + if err := hs.sendServerParameters(); err != nil { + return err + } + if err := hs.sendServerCertificate(); err != nil { + return err + } + if err := hs.sendServerFinished(); err != nil { + return err + } + // Note that at this point we could start sending application data without + // waiting for the client's second flight, but the application might not + // expect the lack of replay protection of the ClientHello parameters. + if _, err := c.flush(); err != nil { + return err + } + if err := hs.readClientCertificate(); err != nil { + return err + } + if err := hs.readClientFinished(); err != nil { + return err + } + + c.isHandshakeComplete.Store(true) + + return nil +} + +func (hs *serverHandshakeStateTLS13) processClientHello() error { + c := hs.c + + hs.hello = new(serverHelloMsg) + + // TLS 1.3 froze the ServerHello.legacy_version field, and uses + // supported_versions instead. See RFC 8446, sections 4.1.3 and 4.2.1. + hs.hello.vers = VersionTLS12 + hs.hello.supportedVersion = c.vers + + if len(hs.clientHello.supportedVersions) == 0 { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: client used the legacy version field to negotiate TLS 1.3") + } + + // Abort if the client is doing a fallback and landing lower than what we + // support. See RFC 7507, which however does not specify the interaction + // with supported_versions. The only difference is that with + // supported_versions a client has a chance to attempt a [TLS 1.2, TLS 1.4] + // handshake in case TLS 1.3 is broken but 1.2 is not. Alas, in that case, + // it will have to drop the TLS_FALLBACK_SCSV protection if it falls back to + // TLS 1.2, because a TLS 1.3 server would abort here. The situation before + // supported_versions was not better because there was just no way to do a + // TLS 1.4 handshake without risking the server selecting TLS 1.3. + for _, id := range hs.clientHello.cipherSuites { + if id == TLS_FALLBACK_SCSV { + // Use c.vers instead of max(supported_versions) because an attacker + // could defeat this by adding an arbitrary high version otherwise. + if c.vers < c.config.maxSupportedVersion(roleServer) { + c.sendAlert(alertInappropriateFallback) + return errors.New("tls: client using inappropriate protocol fallback") + } + break + } + } + + if len(hs.clientHello.compressionMethods) != 1 || + hs.clientHello.compressionMethods[0] != compressionNone { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: TLS 1.3 client supports illegal compression methods") + } + + hs.hello.random = make([]byte, 32) + if _, err := io.ReadFull(c.config.rand(), hs.hello.random); err != nil { + c.sendAlert(alertInternalError) + return err + } + + if len(hs.clientHello.secureRenegotiation) != 0 { + c.sendAlert(alertHandshakeFailure) + return errors.New("tls: initial handshake had non-empty renegotiation extension") + } + + if hs.clientHello.earlyData && c.quic != nil { + if len(hs.clientHello.pskIdentities) == 0 { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: early_data without pre_shared_key") + } + } else if hs.clientHello.earlyData { + // See RFC 8446, Section 4.2.10 for the complicated behavior required + // here. The scenario is that a different server at our address offered + // to accept early data in the past, which we can't handle. For now, all + // 0-RTT enabled session tickets need to expire before a Go server can + // replace a server or join a pool. That's the same requirement that + // applies to mixing or replacing with any TLS 1.2 server. + c.sendAlert(alertUnsupportedExtension) + return errors.New("tls: client sent unexpected early data") + } + + hs.hello.sessionId = hs.clientHello.sessionId + hs.hello.compressionMethod = compressionNone + + preferenceList := defaultCipherSuitesTLS13 + if !hasAESGCMHardwareSupport || !isAESGCMPreferred(hs.clientHello.cipherSuites) { + preferenceList = defaultCipherSuitesTLS13NoAES + } + if fips140tls.Required() { + preferenceList = allowedCipherSuitesTLS13FIPS + } + for _, suiteID := range preferenceList { + hs.suite = mutualCipherSuiteTLS13(hs.clientHello.cipherSuites, suiteID) + if hs.suite != nil { + break + } + } + if hs.suite == nil { + c.sendAlert(alertHandshakeFailure) + return fmt.Errorf("tls: no cipher suite supported by both client and server; client offered: %x", + hs.clientHello.cipherSuites) + } + c.cipherSuite = hs.suite.id + hs.hello.cipherSuite = hs.suite.id + hs.transcript = hs.suite.hash.New() + + // First, if a post-quantum key exchange is available, use one. See + // draft-ietf-tls-key-share-prediction-01, Section 4 for why this must be + // first. + // + // Second, if the client sent a key share for a group we support, use that, + // to avoid a HelloRetryRequest round-trip. + // + // Finally, pick in our fixed preference order. + preferredGroups := c.config.curvePreferences(c.vers) + preferredGroups = slices.DeleteFunc(preferredGroups, func(group CurveID) bool { + return !slices.Contains(hs.clientHello.supportedCurves, group) + }) + if len(preferredGroups) == 0 { + c.sendAlert(alertHandshakeFailure) + return errors.New("tls: no key exchanges supported by both client and server") + } + hasKeyShare := func(group CurveID) bool { + for _, ks := range hs.clientHello.keyShares { + if ks.group == group { + return true + } + } + return false + } + sort.SliceStable(preferredGroups, func(i, j int) bool { + return hasKeyShare(preferredGroups[i]) && !hasKeyShare(preferredGroups[j]) + }) + sort.SliceStable(preferredGroups, func(i, j int) bool { + return isPQKeyExchange(preferredGroups[i]) && !isPQKeyExchange(preferredGroups[j]) + }) + selectedGroup := preferredGroups[0] + + var clientKeyShare *keyShare + for _, ks := range hs.clientHello.keyShares { + if ks.group == selectedGroup { + clientKeyShare = &ks + break + } + } + if clientKeyShare == nil { + ks, err := hs.doHelloRetryRequest(selectedGroup) + if err != nil { + return err + } + clientKeyShare = ks + } + c.curveID = selectedGroup + + ke, err := keyExchangeForCurveID(selectedGroup) + if err != nil { + c.sendAlert(alertInternalError) + return errors.New("tls: CurvePreferences includes unsupported curve") + } + hs.sharedKey, hs.hello.serverShare, err = ke.serverSharedSecret(c.config.rand(), clientKeyShare.data) + if err != nil { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: invalid client key share") + } + + selectedProto, err := negotiateALPN(c.config.NextProtos, hs.clientHello.alpnProtocols, c.quic != nil) + if err != nil { + c.sendAlert(alertNoApplicationProtocol) + return err + } + c.clientProtocol = selectedProto + + if c.quic != nil { + // RFC 9001 Section 4.2: Clients MUST NOT offer TLS versions older than 1.3. + for _, v := range hs.clientHello.supportedVersions { + if v < VersionTLS13 { + c.sendAlert(alertProtocolVersion) + return errors.New("tls: client offered TLS version older than TLS 1.3") + } + } + // RFC 9001 Section 8.2. + if hs.clientHello.quicTransportParameters == nil { + c.sendAlert(alertMissingExtension) + return errors.New("tls: client did not send a quic_transport_parameters extension") + } + c.quicSetTransportParameters(hs.clientHello.quicTransportParameters) + } else { + if hs.clientHello.quicTransportParameters != nil { + c.sendAlert(alertUnsupportedExtension) + return errors.New("tls: client sent an unexpected quic_transport_parameters extension") + } + } + + c.serverName = hs.clientHello.serverName + return nil +} + +func (hs *serverHandshakeStateTLS13) checkForResumption() error { + c := hs.c + + if c.config.SessionTicketsDisabled { + return nil + } + + modeOK := false + for _, mode := range hs.clientHello.pskModes { + if mode == pskModeDHE { + modeOK = true + break + } + } + if !modeOK { + return nil + } + + if len(hs.clientHello.pskIdentities) != len(hs.clientHello.pskBinders) { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: invalid or missing PSK binders") + } + if len(hs.clientHello.pskIdentities) == 0 { + return nil + } + + for i, identity := range hs.clientHello.pskIdentities { + if i >= maxClientPSKIdentities { + break + } + + var sessionState *SessionState + if c.config.UnwrapSession != nil { + var err error + sessionState, err = c.config.UnwrapSession(identity.label, c.connectionStateLocked()) + if err != nil { + return err + } + if sessionState == nil { + continue + } + } else { + plaintext := c.config.decryptTicket(identity.label, c.ticketKeys) + if plaintext == nil { + continue + } + var err error + sessionState, err = ParseSessionState(plaintext) + if err != nil { + continue + } + } + + if sessionState.version != VersionTLS13 { + continue + } + + createdAt := time.Unix(int64(sessionState.createdAt), 0) + if c.config.time().Sub(createdAt) > maxSessionTicketLifetime { + continue + } + + pskSuite := cipherSuiteTLS13ByID(sessionState.cipherSuite) + if pskSuite == nil || pskSuite.hash != hs.suite.hash { + continue + } + + // PSK connections don't re-establish client certificates, but carry + // them over in the session ticket. Ensure the presence of client certs + // in the ticket is consistent with the configured requirements. + sessionHasClientCerts := len(sessionState.peerCertificates) != 0 + needClientCerts := requiresClientCert(c.config.ClientAuth) + if needClientCerts && !sessionHasClientCerts { + continue + } + if sessionHasClientCerts && c.config.ClientAuth == NoClientCert { + continue + } + if sessionHasClientCerts && c.config.time().After(sessionState.peerCertificates[0].NotAfter) { + continue + } + opts := x509.VerifyOptions{ + CurrentTime: c.config.time(), + Roots: c.config.ClientCAs, + KeyUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth}, + } + if sessionHasClientCerts && c.config.ClientAuth >= VerifyClientCertIfGiven && + !anyValidVerifiedChain(sessionState.verifiedChains, opts) { + continue + } + + if c.quic != nil && c.quic.enableSessionEvents { + if err := c.quicResumeSession(sessionState); err != nil { + return err + } + } + + hs.earlySecret = tls13.NewEarlySecret(hs.suite.hash.New, sessionState.secret) + binderKey := hs.earlySecret.ResumptionBinderKey() + // Clone the transcript in case a HelloRetryRequest was recorded. + transcript := cloneHash(hs.transcript, hs.suite.hash) + if transcript == nil { + c.sendAlert(alertInternalError) + return errors.New("tls: internal error: failed to clone hash") + } + clientHelloBytes, err := hs.clientHello.marshalWithoutBinders() + if err != nil { + c.sendAlert(alertInternalError) + return err + } + transcript.Write(clientHelloBytes) + pskBinder := hs.suite.finishedHash(binderKey, transcript) + if !hmac.Equal(hs.clientHello.pskBinders[i], pskBinder) { + c.sendAlert(alertDecryptError) + return errors.New("tls: invalid PSK binder") + } + + if c.quic != nil && hs.clientHello.earlyData && i == 0 && + sessionState.EarlyData && sessionState.cipherSuite == hs.suite.id && + sessionState.alpnProtocol == c.clientProtocol { + hs.earlyData = true + + transcript := hs.suite.hash.New() + if err := transcriptMsg(hs.clientHello, transcript); err != nil { + return err + } + earlyTrafficSecret := hs.earlySecret.ClientEarlyTrafficSecret(transcript) + if err := c.quicSetReadSecret(QUICEncryptionLevelEarly, hs.suite.id, earlyTrafficSecret); err != nil { + return err + } + } + + c.didResume = true + c.peerCertificates = sessionState.peerCertificates + c.ocspResponse = sessionState.ocspResponse + c.scts = sessionState.scts + c.verifiedChains = sessionState.verifiedChains + + hs.hello.selectedIdentityPresent = true + hs.hello.selectedIdentity = uint16(i) + hs.usingPSK = true + return nil + } + + return nil +} + +// cloneHash uses [hash.Cloner] to clone in. If [hash.Cloner] +// is not implemented or not supported, then it falls back to the +// [encoding.BinaryMarshaler] and [encoding.BinaryUnmarshaler] +// interfaces implemented by standard library hashes to clone the state of in +// to a new instance of h. It returns nil if the operation fails. +func cloneHash(in hash.Hash, h crypto.Hash) hash.Hash { + if cloner, ok := in.(hash.Cloner); ok { + if out, err := cloner.Clone(); err == nil { + return out + } + } + // Recreate the interface to avoid importing encoding. + type binaryMarshaler interface { + MarshalBinary() (data []byte, err error) + UnmarshalBinary(data []byte) error + } + marshaler, ok := in.(binaryMarshaler) + if !ok { + return nil + } + state, err := marshaler.MarshalBinary() + if err != nil { + return nil + } + out := h.New() + unmarshaler, ok := out.(binaryMarshaler) + if !ok { + return nil + } + if err := unmarshaler.UnmarshalBinary(state); err != nil { + return nil + } + return out +} + +func (hs *serverHandshakeStateTLS13) pickCertificate() error { + c := hs.c + + // Only one of PSK and certificates are used at a time. + if hs.usingPSK { + return nil + } + + // signature_algorithms is required in TLS 1.3. See RFC 8446, Section 4.2.3. + if len(hs.clientHello.supportedSignatureAlgorithms) == 0 { + return c.sendAlert(alertMissingExtension) + } + + certificate, err := c.config.getCertificate(clientHelloInfo(hs.ctx, c, hs.clientHello)) + if err != nil { + if err == errNoCertificates { + c.sendAlert(alertUnrecognizedName) + } else { + c.sendAlert(alertInternalError) + } + return err + } + hs.sigAlg, err = selectSignatureScheme(c.vers, certificate, hs.clientHello.supportedSignatureAlgorithms) + if err != nil { + // getCertificate returned a certificate that is unsupported or + // incompatible with the client's signature algorithms. + c.sendAlert(alertHandshakeFailure) + return err + } + hs.cert = certificate + + return nil +} + +// sendDummyChangeCipherSpec sends a ChangeCipherSpec record for compatibility +// with middleboxes that didn't implement TLS correctly. See RFC 8446, Appendix D.4. +func (hs *serverHandshakeStateTLS13) sendDummyChangeCipherSpec() error { + if hs.c.quic != nil { + return nil + } + if hs.sentDummyCCS { + return nil + } + hs.sentDummyCCS = true + + return hs.c.writeChangeCipherRecord() +} + +func (hs *serverHandshakeStateTLS13) doHelloRetryRequest(selectedGroup CurveID) (*keyShare, error) { + c := hs.c + + // Make sure the client didn't send extra handshake messages alongside + // their initial client_hello. If they sent two client_hello messages, + // we will consume the second before they respond to the server_hello. + if c.hand.Len() != 0 { + c.sendAlert(alertUnexpectedMessage) + return nil, errors.New("tls: handshake buffer not empty before HelloRetryRequest") + } + + // The first ClientHello gets double-hashed into the transcript upon a + // HelloRetryRequest. See RFC 8446, Section 4.4.1. + if err := transcriptMsg(hs.clientHello, hs.transcript); err != nil { + return nil, err + } + chHash := hs.transcript.Sum(nil) + hs.transcript.Reset() + hs.transcript.Write([]byte{typeMessageHash, 0, 0, uint8(len(chHash))}) + hs.transcript.Write(chHash) + + helloRetryRequest := &serverHelloMsg{ + vers: hs.hello.vers, + random: helloRetryRequestRandom, + sessionId: hs.hello.sessionId, + cipherSuite: hs.hello.cipherSuite, + compressionMethod: hs.hello.compressionMethod, + supportedVersion: hs.hello.supportedVersion, + selectedGroup: selectedGroup, + } + + if hs.echContext != nil { + // Compute the acceptance message. + helloRetryRequest.encryptedClientHello = make([]byte, 8) + confTranscript := cloneHash(hs.transcript, hs.suite.hash) + if err := transcriptMsg(helloRetryRequest, confTranscript); err != nil { + return nil, err + } + h := hs.suite.hash.New + prf, err := hkdf.Extract(h, hs.clientHello.random, nil) + if err != nil { + c.sendAlert(alertInternalError) + return nil, err + } + acceptConfirmation := tls13.ExpandLabel(h, prf, "hrr ech accept confirmation", confTranscript.Sum(nil), 8) + helloRetryRequest.encryptedClientHello = acceptConfirmation + } + + if _, err := hs.c.writeHandshakeRecord(helloRetryRequest, hs.transcript); err != nil { + return nil, err + } + + if err := hs.sendDummyChangeCipherSpec(); err != nil { + return nil, err + } + + // clientHelloMsg is not included in the transcript. + msg, err := c.readHandshake(nil) + if err != nil { + return nil, err + } + + clientHello, ok := msg.(*clientHelloMsg) + if !ok { + c.sendAlert(alertUnexpectedMessage) + return nil, unexpectedMessageError(clientHello, msg) + } + + if hs.echContext != nil { + if len(clientHello.encryptedClientHello) == 0 { + c.sendAlert(alertMissingExtension) + return nil, errors.New("tls: second client hello missing encrypted client hello extension") + } + + echType, echCiphersuite, configID, encap, payload, err := parseECHExt(clientHello.encryptedClientHello) + if err != nil { + c.sendAlert(alertDecodeError) + return nil, errors.New("tls: client sent invalid encrypted client hello extension") + } + + if echType == outerECHExt && hs.echContext.inner || echType == innerECHExt && !hs.echContext.inner { + c.sendAlert(alertDecodeError) + return nil, errors.New("tls: unexpected switch in encrypted client hello extension type") + } + + if echType == outerECHExt { + if echCiphersuite != hs.echContext.ciphersuite || configID != hs.echContext.configID || len(encap) != 0 { + c.sendAlert(alertIllegalParameter) + return nil, errors.New("tls: second client hello encrypted client hello extension does not match") + } + + encodedInner, err := decryptECHPayload(hs.echContext.hpkeContext, clientHello.original, payload) + if err != nil { + c.sendAlert(alertDecryptError) + return nil, errors.New("tls: failed to decrypt second client hello encrypted client hello extension payload") + } + + echInner, err := decodeInnerClientHello(clientHello, encodedInner) + if err != nil { + c.sendAlert(alertIllegalParameter) + return nil, errors.New("tls: client sent invalid encrypted client hello extension") + } + + clientHello = echInner + } + } + + if len(clientHello.keyShares) != 1 { + c.sendAlert(alertIllegalParameter) + return nil, errors.New("tls: client didn't send one key share in second ClientHello") + } + ks := &clientHello.keyShares[0] + + if ks.group != selectedGroup { + c.sendAlert(alertIllegalParameter) + return nil, errors.New("tls: client sent unexpected key share in second ClientHello") + } + + if clientHello.earlyData { + c.sendAlert(alertIllegalParameter) + return nil, errors.New("tls: client indicated early data in second ClientHello") + } + + if illegalClientHelloChange(clientHello, hs.clientHello) { + c.sendAlert(alertIllegalParameter) + return nil, errors.New("tls: client illegally modified second ClientHello") + } + + c.didHRR = true + hs.clientHello = clientHello + return ks, nil +} + +// illegalClientHelloChange reports whether the two ClientHello messages are +// different, with the exception of the changes allowed before and after a +// HelloRetryRequest. See RFC 8446, Section 4.1.2. +func illegalClientHelloChange(ch, ch1 *clientHelloMsg) bool { + if len(ch.supportedVersions) != len(ch1.supportedVersions) || + len(ch.cipherSuites) != len(ch1.cipherSuites) || + len(ch.supportedCurves) != len(ch1.supportedCurves) || + len(ch.supportedSignatureAlgorithms) != len(ch1.supportedSignatureAlgorithms) || + len(ch.supportedSignatureAlgorithmsCert) != len(ch1.supportedSignatureAlgorithmsCert) || + len(ch.alpnProtocols) != len(ch1.alpnProtocols) { + return true + } + for i := range ch.supportedVersions { + if ch.supportedVersions[i] != ch1.supportedVersions[i] { + return true + } + } + for i := range ch.cipherSuites { + if ch.cipherSuites[i] != ch1.cipherSuites[i] { + return true + } + } + for i := range ch.supportedCurves { + if ch.supportedCurves[i] != ch1.supportedCurves[i] { + return true + } + } + for i := range ch.supportedSignatureAlgorithms { + if ch.supportedSignatureAlgorithms[i] != ch1.supportedSignatureAlgorithms[i] { + return true + } + } + for i := range ch.supportedSignatureAlgorithmsCert { + if ch.supportedSignatureAlgorithmsCert[i] != ch1.supportedSignatureAlgorithmsCert[i] { + return true + } + } + for i := range ch.alpnProtocols { + if ch.alpnProtocols[i] != ch1.alpnProtocols[i] { + return true + } + } + return ch.vers != ch1.vers || + !bytes.Equal(ch.random, ch1.random) || + !bytes.Equal(ch.sessionId, ch1.sessionId) || + !bytes.Equal(ch.compressionMethods, ch1.compressionMethods) || + ch.serverName != ch1.serverName || + ch.ocspStapling != ch1.ocspStapling || + !bytes.Equal(ch.supportedPoints, ch1.supportedPoints) || + ch.ticketSupported != ch1.ticketSupported || + !bytes.Equal(ch.sessionTicket, ch1.sessionTicket) || + ch.secureRenegotiationSupported != ch1.secureRenegotiationSupported || + !bytes.Equal(ch.secureRenegotiation, ch1.secureRenegotiation) || + ch.scts != ch1.scts || + !bytes.Equal(ch.cookie, ch1.cookie) || + !bytes.Equal(ch.pskModes, ch1.pskModes) +} + +func (hs *serverHandshakeStateTLS13) sendServerParameters() error { + c := hs.c + + if hs.echContext != nil { + copy(hs.hello.random[32-8:], make([]byte, 8)) + echTranscript := cloneHash(hs.transcript, hs.suite.hash) + echTranscript.Write(hs.clientHello.original) + if err := transcriptMsg(hs.hello, echTranscript); err != nil { + return err + } + // compute the acceptance message + h := hs.suite.hash.New + prk, err := hkdf.Extract(h, hs.clientHello.random, nil) + if err != nil { + c.sendAlert(alertInternalError) + return err + } + acceptConfirmation := tls13.ExpandLabel(h, prk, "ech accept confirmation", echTranscript.Sum(nil), 8) + copy(hs.hello.random[32-8:], acceptConfirmation) + } + + if err := transcriptMsg(hs.clientHello, hs.transcript); err != nil { + return err + } + + if _, err := hs.c.writeHandshakeRecord(hs.hello, hs.transcript); err != nil { + return err + } + + if err := hs.sendDummyChangeCipherSpec(); err != nil { + return err + } + + earlySecret := hs.earlySecret + if earlySecret == nil { + earlySecret = tls13.NewEarlySecret(hs.suite.hash.New, nil) + } + hs.handshakeSecret = earlySecret.HandshakeSecret(hs.sharedKey) + + serverSecret := hs.handshakeSecret.ServerHandshakeTrafficSecret(hs.transcript) + c.setWriteTrafficSecret(hs.suite, QUICEncryptionLevelHandshake, serverSecret) + clientSecret := hs.handshakeSecret.ClientHandshakeTrafficSecret(hs.transcript) + if err := c.setReadTrafficSecret(hs.suite, QUICEncryptionLevelHandshake, clientSecret, false); err != nil { + return err + } + + if c.quic != nil { + c.quicSetWriteSecret(QUICEncryptionLevelHandshake, hs.suite.id, serverSecret) + if err := c.quicSetReadSecret(QUICEncryptionLevelHandshake, hs.suite.id, clientSecret); err != nil { + return err + } + } + + err := c.config.writeKeyLog(keyLogLabelClientHandshake, hs.clientHello.random, clientSecret) + if err != nil { + c.sendAlert(alertInternalError) + return err + } + err = c.config.writeKeyLog(keyLogLabelServerHandshake, hs.clientHello.random, serverSecret) + if err != nil { + c.sendAlert(alertInternalError) + return err + } + + encryptedExtensions := new(encryptedExtensionsMsg) + encryptedExtensions.alpnProtocol = c.clientProtocol + + if c.quic != nil { + p, err := c.quicGetTransportParameters() + if err != nil { + return err + } + encryptedExtensions.quicTransportParameters = p + encryptedExtensions.earlyData = hs.earlyData + } + + if !hs.c.didResume && hs.clientHello.serverName != "" { + encryptedExtensions.serverNameAck = true + } + + // If client sent ECH extension, but we didn't accept it, + // send retry configs, if available. + echKeys := hs.c.config.EncryptedClientHelloKeys + if hs.c.config.GetEncryptedClientHelloKeys != nil { + echKeys, err = hs.c.config.GetEncryptedClientHelloKeys(clientHelloInfo(hs.ctx, c, hs.clientHello)) + if err != nil { + c.sendAlert(alertInternalError) + return err + } + } + if len(echKeys) > 0 && len(hs.clientHello.encryptedClientHello) > 0 && hs.echContext == nil { + encryptedExtensions.echRetryConfigs, err = buildRetryConfigList(echKeys) + if err != nil { + c.sendAlert(alertInternalError) + return err + } + } + + if _, err := hs.c.writeHandshakeRecord(encryptedExtensions, hs.transcript); err != nil { + return err + } + + return nil +} + +func (hs *serverHandshakeStateTLS13) requestClientCert() bool { + return hs.c.config.ClientAuth >= RequestClientCert && !hs.usingPSK +} + +func (hs *serverHandshakeStateTLS13) sendServerCertificate() error { + c := hs.c + + // Only one of PSK and certificates are used at a time. + if hs.usingPSK { + return nil + } + + if hs.requestClientCert() { + // Request a client certificate + certReq := new(certificateRequestMsgTLS13) + certReq.ocspStapling = true + certReq.scts = true + certReq.supportedSignatureAlgorithms = supportedSignatureAlgorithms(c.vers) + certReq.supportedSignatureAlgorithmsCert = supportedSignatureAlgorithmsCert() + if c.config.ClientCAs != nil { + certReq.certificateAuthorities = c.config.ClientCAs.Subjects() + } + + if _, err := hs.c.writeHandshakeRecord(certReq, hs.transcript); err != nil { + return err + } + } + + certMsg := new(certificateMsgTLS13) + + certMsg.certificate = *hs.cert + certMsg.scts = hs.clientHello.scts && len(hs.cert.SignedCertificateTimestamps) > 0 + certMsg.ocspStapling = hs.clientHello.ocspStapling && len(hs.cert.OCSPStaple) > 0 + + if _, err := hs.c.writeHandshakeRecord(certMsg, hs.transcript); err != nil { + return err + } + + certVerifyMsg := new(certificateVerifyMsg) + certVerifyMsg.hasSignatureAlgorithm = true + certVerifyMsg.signatureAlgorithm = hs.sigAlg + + sigType, sigHash, err := typeAndHashFromSignatureScheme(hs.sigAlg) + if err != nil { + return c.sendAlert(alertInternalError) + } + + signed := signedMessage(serverSignatureContext, hs.transcript) + signOpts := crypto.SignerOpts(sigHash) + if sigType == signatureRSAPSS { + signOpts = &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash, Hash: sigHash} + } + sig, err := crypto.SignMessage(hs.cert.PrivateKey.(crypto.Signer), c.config.rand(), signed, signOpts) + if err != nil { + public := hs.cert.PrivateKey.(crypto.Signer).Public() + if rsaKey, ok := public.(*rsa.PublicKey); ok && sigType == signatureRSAPSS && + rsaKey.N.BitLen()/8 < sigHash.Size()*2+2 { // key too small for RSA-PSS + c.sendAlert(alertHandshakeFailure) + } else { + c.sendAlert(alertInternalError) + } + return errors.New("tls: failed to sign handshake: " + err.Error()) + } + certVerifyMsg.signature = sig + + if _, err := hs.c.writeHandshakeRecord(certVerifyMsg, hs.transcript); err != nil { + return err + } + + return nil +} + +func (hs *serverHandshakeStateTLS13) sendServerFinished() error { + c := hs.c + + finished := &finishedMsg{ + verifyData: hs.suite.finishedHash(c.out.trafficSecret, hs.transcript), + } + + if _, err := hs.c.writeHandshakeRecord(finished, hs.transcript); err != nil { + return err + } + + // Derive secrets that take context through the server Finished. + + hs.masterSecret = hs.handshakeSecret.MasterSecret() + + hs.trafficSecret = hs.masterSecret.ClientApplicationTrafficSecret(hs.transcript) + serverSecret := hs.masterSecret.ServerApplicationTrafficSecret(hs.transcript) + c.setWriteTrafficSecret(hs.suite, QUICEncryptionLevelApplication, serverSecret) + + if c.quic != nil { + c.quicSetWriteSecret(QUICEncryptionLevelApplication, hs.suite.id, serverSecret) + } + + err := c.config.writeKeyLog(keyLogLabelClientTraffic, hs.clientHello.random, hs.trafficSecret) + if err != nil { + c.sendAlert(alertInternalError) + return err + } + err = c.config.writeKeyLog(keyLogLabelServerTraffic, hs.clientHello.random, serverSecret) + if err != nil { + c.sendAlert(alertInternalError) + return err + } + + c.ekm = hs.suite.exportKeyingMaterial(hs.masterSecret, hs.transcript) + + // If we did not request client certificates, at this point we can + // precompute the client finished and roll the transcript forward to send + // session tickets in our first flight. + if !hs.requestClientCert() { + if err := hs.sendSessionTickets(); err != nil { + return err + } + } + + return nil +} + +func (hs *serverHandshakeStateTLS13) shouldSendSessionTickets() bool { + if hs.c.config.SessionTicketsDisabled { + return false + } + + // QUIC tickets are sent by QUICConn.SendSessionTicket, not automatically. + if hs.c.quic != nil { + return false + } + + // Don't send tickets the client wouldn't use. See RFC 8446, Section 4.2.9. + return slices.Contains(hs.clientHello.pskModes, pskModeDHE) +} + +func (hs *serverHandshakeStateTLS13) sendSessionTickets() error { + c := hs.c + + hs.clientFinished = hs.suite.finishedHash(c.in.trafficSecret, hs.transcript) + finishedMsg := &finishedMsg{ + verifyData: hs.clientFinished, + } + if err := transcriptMsg(finishedMsg, hs.transcript); err != nil { + return err + } + + c.resumptionSecret = hs.masterSecret.ResumptionMasterSecret(hs.transcript) + + if !hs.shouldSendSessionTickets() { + return nil + } + return c.sendSessionTicket(false, nil) +} + +func (c *Conn) sendSessionTicket(earlyData bool, extra [][]byte) error { + suite := cipherSuiteTLS13ByID(c.cipherSuite) + if suite == nil { + return errors.New("tls: internal error: unknown cipher suite") + } + // ticket_nonce, which must be unique per connection, is always left at + // zero because we only ever send one ticket per connection. + psk := tls13.ExpandLabel(suite.hash.New, c.resumptionSecret, "resumption", + nil, suite.hash.Size()) + + m := new(newSessionTicketMsgTLS13) + + state := c.sessionState() + state.secret = psk + state.EarlyData = earlyData + state.Extra = extra + if c.config.WrapSession != nil { + var err error + m.label, err = c.config.WrapSession(c.connectionStateLocked(), state) + if err != nil { + return err + } + } else { + stateBytes, err := state.Bytes() + if err != nil { + c.sendAlert(alertInternalError) + return err + } + m.label, err = c.config.encryptTicket(stateBytes, c.ticketKeys) + if err != nil { + return err + } + } + m.lifetime = uint32(maxSessionTicketLifetime / time.Second) + + // ticket_age_add is a random 32-bit value. See RFC 8446, section 4.6.1 + // The value is not stored anywhere; we never need to check the ticket age + // because 0-RTT is not supported. + ageAdd := make([]byte, 4) + if _, err := c.config.rand().Read(ageAdd); err != nil { + return err + } + m.ageAdd = byteorder.LEUint32(ageAdd) + + if earlyData { + // RFC 9001, Section 4.6.1 + m.maxEarlyData = 0xffffffff + } + + if _, err := c.writeHandshakeRecord(m, nil); err != nil { + return err + } + + return nil +} + +func (hs *serverHandshakeStateTLS13) readClientCertificate() error { + c := hs.c + + if !hs.requestClientCert() { + // Make sure the connection is still being verified whether or not + // the server requested a client certificate. + if c.config.VerifyConnection != nil { + if err := c.config.VerifyConnection(c.connectionStateLocked()); err != nil { + c.sendAlert(alertBadCertificate) + return err + } + } + return nil + } + + // If we requested a client certificate, then the client must send a + // certificate message. If it's empty, no CertificateVerify is sent. + + msg, err := c.readHandshake(hs.transcript) + if err != nil { + return err + } + + certMsg, ok := msg.(*certificateMsgTLS13) + if !ok { + c.sendAlert(alertUnexpectedMessage) + return unexpectedMessageError(certMsg, msg) + } + + if err := c.processCertsFromClient(certMsg.certificate); err != nil { + return err + } + + if c.config.VerifyConnection != nil { + if err := c.config.VerifyConnection(c.connectionStateLocked()); err != nil { + c.sendAlert(alertBadCertificate) + return err + } + } + + if len(certMsg.certificate.Certificate) != 0 { + // certificateVerifyMsg is included in the transcript, but not until + // after we verify the handshake signature, since the state before + // this message was sent is used. + msg, err = c.readHandshake(nil) + if err != nil { + return err + } + + certVerify, ok := msg.(*certificateVerifyMsg) + if !ok { + c.sendAlert(alertUnexpectedMessage) + return unexpectedMessageError(certVerify, msg) + } + + // See RFC 8446, Section 4.4.3. + // We don't use certReq.supportedSignatureAlgorithms because it would + // require keeping the certificateRequestMsgTLS13 around in the hs. + if !isSupportedSignatureAlgorithm(certVerify.signatureAlgorithm, supportedSignatureAlgorithms(c.vers)) || + !isSupportedSignatureAlgorithm(certVerify.signatureAlgorithm, signatureSchemesForPublicKey(c.vers, c.peerCertificates[0].PublicKey)) { + c.sendAlert(alertIllegalParameter) + return errors.New("tls: client certificate used with invalid signature algorithm") + } + sigType, sigHash, err := typeAndHashFromSignatureScheme(certVerify.signatureAlgorithm) + if err != nil { + return c.sendAlert(alertInternalError) + } + if sigType == signaturePKCS1v15 || sigHash == crypto.SHA1 { + return c.sendAlert(alertInternalError) + } + signed := signedMessage(clientSignatureContext, hs.transcript) + if err := verifyHandshakeSignature(sigType, c.peerCertificates[0].PublicKey, + sigHash, signed, certVerify.signature); err != nil { + c.sendAlert(alertDecryptError) + return errors.New("tls: invalid signature by the client certificate: " + err.Error()) + } + c.peerSigAlg = certVerify.signatureAlgorithm + + if err := transcriptMsg(certVerify, hs.transcript); err != nil { + return err + } + } + + // If we waited until the client certificates to send session tickets, we + // are ready to do it now. + if err := hs.sendSessionTickets(); err != nil { + return err + } + + return nil +} + +func (hs *serverHandshakeStateTLS13) readClientFinished() error { + c := hs.c + + // finishedMsg is not included in the transcript. + msg, err := c.readHandshake(nil) + if err != nil { + return err + } + + finished, ok := msg.(*finishedMsg) + if !ok { + c.sendAlert(alertUnexpectedMessage) + return unexpectedMessageError(finished, msg) + } + + if !hmac.Equal(hs.clientFinished, finished.verifyData) { + c.sendAlert(alertDecryptError) + return errors.New("tls: invalid client finished hash") + } + + if err := c.setReadTrafficSecret(hs.suite, QUICEncryptionLevelApplication, hs.trafficSecret, false); err != nil { + return err + } + + return nil +} diff --git a/go/src/crypto/tls/handshake_test.go b/go/src/crypto/tls/handshake_test.go new file mode 100644 index 0000000000000000000000000000000000000000..7cf0ee2343b132e51a39bc15f7b81679cb199535 --- /dev/null +++ b/go/src/crypto/tls/handshake_test.go @@ -0,0 +1,837 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "bufio" + "bytes" + "context" + "crypto/ed25519" + "crypto/x509" + "encoding/hex" + "errors" + "flag" + "fmt" + "io" + "net" + "os" + "os/exec" + "runtime" + "strconv" + "strings" + "sync" + "testing" + "time" +) + +// TLS reference tests run a connection against a reference implementation +// (OpenSSL) of TLS and record the bytes of the resulting connection. The Go +// code, during a test, is configured with deterministic randomness and so the +// reference test can be reproduced exactly in the future. +// +// In order to save everyone who wishes to run the tests from needing the +// reference implementation installed, the reference connections are saved in +// files in the testdata directory. Thus running the tests involves nothing +// external, but creating and updating them requires the reference +// implementation. +// +// Tests can be updated by running them with the -update flag. This will cause +// the test files for failing tests to be regenerated. Since the reference +// implementation will always generate fresh random numbers, large parts of the +// reference connection will always change. + +var ( + update = flag.Bool("update", false, "update golden files on failure") + keyFile = flag.String("keylog", "", "destination file for KeyLogWriter") + bogoMode = flag.Bool("bogo-mode", false, "Enabled bogo shim mode, ignore everything else") + bogoFilter = flag.String("bogo-filter", "", "BoGo test filter") + bogoLocalDir = flag.String("bogo-local-dir", "", + "If not-present, checkout BoGo into this dir, or otherwise use it as a pre-existing checkout") + bogoReport = flag.String("bogo-html-report", "", "File path to render an HTML report with BoGo results") +) + +func runTestAndUpdateIfNeeded(t *testing.T, name string, run func(t *testing.T, update bool), wait bool) { + // FIPS mode is non-deterministic and so isn't suited for testing against static test transcripts. + skipFIPS(t) + + success := t.Run(name, func(t *testing.T) { + if !*update && !wait { + t.Parallel() + } + run(t, false) + }) + + if !success && *update { + t.Run(name+"#update", func(t *testing.T) { + run(t, true) + }) + } +} + +// checkOpenSSLVersion ensures that the version of OpenSSL looks reasonable +// before updating the test data. +func checkOpenSSLVersion() error { + if !*update { + return nil + } + + openssl := exec.Command("openssl", "version") + output, err := openssl.CombinedOutput() + if err != nil { + return err + } + + version := string(output) + if strings.HasPrefix(version, "OpenSSL 1.1.1") { + return nil + } + + println("***********************************************") + println("") + println("You need to build OpenSSL 1.1.1 from source in order") + println("to update the test data.") + println("") + println("Configure it with:") + println("./Configure enable-weak-ssl-ciphers no-shared") + println("and then add the apps/ directory at the front of your PATH.") + println("***********************************************") + + return errors.New("version of OpenSSL does not appear to be suitable for updating test data") +} + +// recordingConn is a net.Conn that records the traffic that passes through it. +// WriteTo can be used to produce output that can be later be loaded with +// ParseTestData. +type recordingConn struct { + net.Conn + sync.Mutex + flows [][]byte + reading bool +} + +func (r *recordingConn) Read(b []byte) (n int, err error) { + if n, err = r.Conn.Read(b); n == 0 { + return + } + b = b[:n] + + r.Lock() + defer r.Unlock() + + if l := len(r.flows); l == 0 || !r.reading { + buf := make([]byte, len(b)) + copy(buf, b) + r.flows = append(r.flows, buf) + } else { + r.flows[l-1] = append(r.flows[l-1], b[:n]...) + } + r.reading = true + return +} + +func (r *recordingConn) Write(b []byte) (n int, err error) { + if n, err = r.Conn.Write(b); n == 0 { + return + } + b = b[:n] + + r.Lock() + defer r.Unlock() + + if l := len(r.flows); l == 0 || r.reading { + buf := make([]byte, len(b)) + copy(buf, b) + r.flows = append(r.flows, buf) + } else { + r.flows[l-1] = append(r.flows[l-1], b[:n]...) + } + r.reading = false + return +} + +// WriteTo writes Go source code to w that contains the recorded traffic. +func (r *recordingConn) WriteTo(w io.Writer) (int64, error) { + // TLS always starts with a client to server flow. + clientToServer := true + var written int64 + for i, flow := range r.flows { + source, dest := "client", "server" + if !clientToServer { + source, dest = dest, source + } + n, err := fmt.Fprintf(w, ">>> Flow %d (%s to %s)\n", i+1, source, dest) + written += int64(n) + if err != nil { + return written, err + } + dumper := hex.Dumper(w) + n, err = dumper.Write(flow) + written += int64(n) + if err != nil { + return written, err + } + err = dumper.Close() + if err != nil { + return written, err + } + clientToServer = !clientToServer + } + return written, nil +} + +func parseTestData(r io.Reader) (flows [][]byte, err error) { + var currentFlow []byte + + scanner := bufio.NewScanner(r) + for scanner.Scan() { + line := scanner.Text() + // If the line starts with ">>> " then it marks the beginning + // of a new flow. + if strings.HasPrefix(line, ">>> ") { + if len(currentFlow) > 0 || len(flows) > 0 { + flows = append(flows, currentFlow) + currentFlow = nil + } + continue + } + + // Otherwise the line is a line of hex dump that looks like: + // 00000170 fc f5 06 bf (...) |.....X{&?......!| + // (Some bytes have been omitted from the middle section.) + _, after, ok := strings.Cut(line, " ") + if !ok { + return nil, errors.New("invalid test data") + } + line = after + + before, _, ok := strings.Cut(line, "|") + if !ok { + return nil, errors.New("invalid test data") + } + line = before + + hexBytes := strings.Fields(line) + for _, hexByte := range hexBytes { + val, err := strconv.ParseUint(hexByte, 16, 8) + if err != nil { + return nil, errors.New("invalid hex byte in test data: " + err.Error()) + } + currentFlow = append(currentFlow, byte(val)) + } + } + + if len(currentFlow) > 0 { + flows = append(flows, currentFlow) + } + + return flows, nil +} + +// replayingConn is a net.Conn that replays flows recorded by recordingConn. +type replayingConn struct { + t testing.TB + sync.Mutex + flows [][]byte + reading bool +} + +var _ net.Conn = (*replayingConn)(nil) + +func (r *replayingConn) Read(b []byte) (n int, err error) { + r.Lock() + defer r.Unlock() + + if !r.reading { + r.t.Errorf("expected write, got read") + return 0, fmt.Errorf("recording expected write, got read") + } + + n = copy(b, r.flows[0]) + r.flows[0] = r.flows[0][n:] + if len(r.flows[0]) == 0 { + r.flows = r.flows[1:] + if len(r.flows) == 0 { + return n, io.EOF + } else { + r.reading = false + } + } + return n, nil +} + +func (r *replayingConn) Write(b []byte) (n int, err error) { + r.Lock() + defer r.Unlock() + + if r.reading { + r.t.Errorf("expected read, got write") + return 0, fmt.Errorf("recording expected read, got write") + } + + if !bytes.HasPrefix(r.flows[0], b) { + r.t.Errorf("write mismatch: expected %x, got %x", r.flows[0], b) + return 0, fmt.Errorf("write mismatch") + } + r.flows[0] = r.flows[0][len(b):] + if len(r.flows[0]) == 0 { + r.flows = r.flows[1:] + r.reading = true + } + return len(b), nil +} + +func (r *replayingConn) Close() error { + r.Lock() + defer r.Unlock() + + if len(r.flows) > 0 { + r.t.Errorf("closed with unfinished flows") + return fmt.Errorf("unexpected close") + } + return nil +} + +func (r *replayingConn) LocalAddr() net.Addr { return nil } +func (r *replayingConn) RemoteAddr() net.Addr { return nil } +func (r *replayingConn) SetDeadline(t time.Time) error { return nil } +func (r *replayingConn) SetReadDeadline(t time.Time) error { return nil } +func (r *replayingConn) SetWriteDeadline(t time.Time) error { return nil } + +// tempFile creates a temp file containing contents and returns its path. +func tempFile(contents string) string { + file, err := os.CreateTemp("", "go-tls-test") + if err != nil { + panic("failed to create temp file: " + err.Error()) + } + path := file.Name() + file.WriteString(contents) + file.Close() + return path +} + +// localListener is set up by TestMain and used by localPipe to create Conn +// pairs like net.Pipe, but connected by an actual buffered TCP connection. +var localListener struct { + mu sync.Mutex + addr net.Addr + ch chan net.Conn +} + +const localFlakes = 0 // change to 1 or 2 to exercise localServer/localPipe handling of mismatches + +func localServer(l net.Listener) { + for n := 0; ; n++ { + c, err := l.Accept() + if err != nil { + return + } + if localFlakes == 1 && n%2 == 0 { + c.Close() + continue + } + localListener.ch <- c + } +} + +var isConnRefused = func(err error) bool { return false } + +func localPipe(t testing.TB) (net.Conn, net.Conn) { + localListener.mu.Lock() + defer localListener.mu.Unlock() + + addr := localListener.addr + + var err error +Dialing: + // We expect a rare mismatch, but probably not 5 in a row. + for i := 0; i < 5; i++ { + tooSlow := time.NewTimer(1 * time.Second) + defer tooSlow.Stop() + var c1 net.Conn + c1, err = net.Dial(addr.Network(), addr.String()) + if err != nil { + if runtime.GOOS == "dragonfly" && (isConnRefused(err) || os.IsTimeout(err)) { + // golang.org/issue/29583: Dragonfly sometimes returns a spurious + // ECONNREFUSED or ETIMEDOUT. + <-tooSlow.C + continue + } + t.Fatalf("localPipe: %v", err) + } + if localFlakes == 2 && i == 0 { + c1.Close() + continue + } + for { + select { + case <-tooSlow.C: + t.Logf("localPipe: timeout waiting for %v", c1.LocalAddr()) + c1.Close() + continue Dialing + + case c2 := <-localListener.ch: + if c2.RemoteAddr().String() == c1.LocalAddr().String() { + t.Cleanup(func() { c1.Close() }) + t.Cleanup(func() { c2.Close() }) + return c1, c2 + } + t.Logf("localPipe: unexpected connection: %v != %v", c2.RemoteAddr(), c1.LocalAddr()) + c2.Close() + } + } + } + + t.Fatalf("localPipe: failed to connect: %v", err) + panic("unreachable") +} + +// zeroSource is an io.Reader that returns an unlimited number of zero bytes. +type zeroSource struct{} + +func (zeroSource) Read(b []byte) (n int, err error) { + clear(b) + return len(b), nil +} + +func allCipherSuites() []uint16 { + ids := make([]uint16, len(cipherSuites)) + for i, suite := range cipherSuites { + ids[i] = suite.id + } + + return ids +} + +var testConfig *Config + +func TestMain(m *testing.M) { + flag.Usage = func() { + fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args) + flag.PrintDefaults() + if *bogoMode { + os.Exit(89) + } + } + + flag.Parse() + + if *bogoMode { + bogoShim() + os.Exit(0) + } + + os.Exit(runMain(m)) +} + +func runMain(m *testing.M) int { + // Cipher suites preferences change based on the architecture. Force them to + // the version without AES acceleration for test consistency. + hasAESGCMHardwareSupport = false + + // Set up localPipe. + l, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + l, err = net.Listen("tcp6", "[::1]:0") + } + if err != nil { + fmt.Fprintf(os.Stderr, "Failed to open local listener: %v", err) + os.Exit(1) + } + localListener.ch = make(chan net.Conn) + localListener.addr = l.Addr() + defer l.Close() + go localServer(l) + + if err := checkOpenSSLVersion(); err != nil { + fmt.Fprintf(os.Stderr, "Error: %v", err) + os.Exit(1) + } + + // TODO(filippo): deprecate Config.Rand, and regenerate handshake recordings + // to use cryptotest.SetGlobalRandom instead. + os.Setenv("GODEBUG", "cryptocustomrand=1,"+os.Getenv("GODEBUG")) + + testConfig = &Config{ + Time: func() time.Time { return time.Unix(0, 0) }, + Rand: zeroSource{}, + Certificates: make([]Certificate, 2), + InsecureSkipVerify: true, + CipherSuites: allCipherSuites(), + CurvePreferences: []CurveID{X25519, CurveP256, CurveP384, CurveP521}, + MinVersion: VersionTLS10, + MaxVersion: VersionTLS13, + } + testConfig.Certificates[0].Certificate = [][]byte{testRSACertificate} + testConfig.Certificates[0].PrivateKey = testRSAPrivateKey + testConfig.Certificates[1].Certificate = [][]byte{testSNICertificate} + testConfig.Certificates[1].PrivateKey = testRSAPrivateKey + testConfig.BuildNameToCertificate() + if *keyFile != "" { + f, err := os.OpenFile(*keyFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) + if err != nil { + panic("failed to open -keylog file: " + err.Error()) + } + testConfig.KeyLogWriter = f + defer f.Close() + } + + testConfigFIPS140 = testConfig.Clone() + // Only crypto/rand.Reader is allowed in FIPS 140-only mode. + testConfigFIPS140.Rand = nil + // FIPS 140-only mode requires 2048-bit RSA keys. + testConfigFIPS140.Certificates = []Certificate{{ + Certificate: [][]byte{testRSA2048Certificate}, + PrivateKey: testRSA2048PrivateKey, + }} + + return m.Run() +} + +func testHandshake(t *testing.T, clientConfig, serverConfig *Config) (serverState, clientState ConnectionState, err error) { + const sentinel = "SENTINEL\n" + c, s := localPipe(t) + errChan := make(chan error, 1) + go func() { + cli := Client(c, clientConfig) + err := cli.Handshake() + if err != nil { + errChan <- fmt.Errorf("client: %v", err) + c.Close() + return + } + defer func() { errChan <- nil }() + clientState = cli.ConnectionState() + buf, err := io.ReadAll(cli) + if err != nil { + t.Errorf("failed to call cli.Read: %v", err) + } + if got := string(buf); got != sentinel { + t.Errorf("read %q from TLS connection, but expected %q", got, sentinel) + } + // We discard the error because after ReadAll returns the server must + // have already closed the connection. Sending data (the closeNotify + // alert) can cause a reset, that will make Close return an error. + cli.Close() + }() + server := Server(s, serverConfig) + err = server.Handshake() + if err == nil { + serverState = server.ConnectionState() + if _, err := io.WriteString(server, sentinel); err != nil { + t.Errorf("failed to call server.Write: %v", err) + } + if err := server.Close(); err != nil { + t.Errorf("failed to call server.Close: %v", err) + } + } else { + err = fmt.Errorf("server: %v", err) + s.Close() + } + err = errors.Join(err, <-errChan) + return +} + +func fromHex(s string) []byte { + b, _ := hex.DecodeString(s) + return b +} + +// testTime is 2016-10-20T17:32:09.000Z, which is within the validity period of +// [testRSACertificate], [testRSACertificateIssuer], [testRSA2048Certificate], +// [testRSA2048CertificateIssuer], and [testECDSACertificate]. +var testTime = func() time.Time { return time.Unix(1476984729, 0) } + +var testRSACertificate = fromHex("3082024b308201b4a003020102020900e8f09d3fe25beaa6300d06092a864886f70d01010b0500301f310b3009060355040a1302476f3110300e06035504031307476f20526f6f74301e170d3136303130313030303030305a170d3235303130313030303030305a301a310b3009060355040a1302476f310b300906035504031302476f30819f300d06092a864886f70d010101050003818d0030818902818100db467d932e12270648bc062821ab7ec4b6a25dfe1e5245887a3647a5080d92425bc281c0be97799840fb4f6d14fd2b138bc2a52e67d8d4099ed62238b74a0b74732bc234f1d193e596d9747bf3589f6c613cc0b041d4d92b2b2423775b1c3bbd755dce2054cfa163871d1e24c4f31d1a508baab61443ed97a77562f414c852d70203010001a38193308190300e0603551d0f0101ff0404030205a0301d0603551d250416301406082b0601050507030106082b06010505070302300c0603551d130101ff0402300030190603551d0e041204109f91161f43433e49a6de6db680d79f60301b0603551d230414301280104813494d137e1631bba301d5acab6e7b30190603551d1104123010820e6578616d706c652e676f6c616e67300d06092a864886f70d01010b0500038181009d30cc402b5b50a061cbbae55358e1ed8328a9581aa938a495a1ac315a1a84663d43d32dd90bf297dfd320643892243a00bccf9c7db74020015faad3166109a276fd13c3cce10c5ceeb18782f16c04ed73bbb343778d0c1cf10fa1d8408361c94c722b9daedb4606064df4c1b33ec0d1bd42d4dbfe3d1360845c21d33be9fae7") + +var testRSACertificateIssuer = fromHex("3082021930820182a003020102020900ca5e4e811a965964300d06092a864886f70d01010b0500301f310b3009060355040a1302476f3110300e06035504031307476f20526f6f74301e170d3136303130313030303030305a170d3235303130313030303030305a301f310b3009060355040a1302476f3110300e06035504031307476f20526f6f7430819f300d06092a864886f70d010101050003818d0030818902818100d667b378bb22f34143b6cd2008236abefaf2852adf3ab05e01329e2c14834f5105df3f3073f99dab5442d45ee5f8f57b0111c8cb682fbb719a86944eebfffef3406206d898b8c1b1887797c9c5006547bb8f00e694b7a063f10839f269f2c34fff7a1f4b21fbcd6bfdfb13ac792d1d11f277b5c5b48600992203059f2a8f8cc50203010001a35d305b300e0603551d0f0101ff040403020204301d0603551d250416301406082b0601050507030106082b06010505070302300f0603551d130101ff040530030101ff30190603551d0e041204104813494d137e1631bba301d5acab6e7b300d06092a864886f70d01010b050003818100c1154b4bab5266221f293766ae4138899bd4c5e36b13cee670ceeaa4cbdf4f6679017e2fe649765af545749fe4249418a56bd38a04b81e261f5ce86b8d5c65413156a50d12449554748c59a30c515bc36a59d38bddf51173e899820b282e40aa78c806526fd184fb6b4cf186ec728edffa585440d2b3225325f7ab580e87dd76") + +var testRSA2048Certificate = fromHex("30820316308201fea003020102020900e8f09d3fe25beaa6300d06092a864886f70d01010b0500301f310b3009060355040a1302476f3110300e06035504031307476f20526f6f74301e170d3136303130313030303030305a170d3338303130313030303030305a301a310b3009060355040a1302476f310b300906035504031302476f30820122300d06092a864886f70d01010105000382010f003082010a0282010100e0ac47db9ba1b7f98a996c62dc1d248d4ee570544136fe4e911e22fccc0fe2b20982f3c4cdd8f4065c5068c873ca0a768b80dc915edc66541a5f26cdea44e56e411221e2f9927bf4e009fee76dbe0e118dcc13392efd6f42d8eb2fd5bc8f63ac77800c84d3be90c20c321273254b9137ef61f825dad1ec2c5e75aa4be6d3104899bd5ac400da7ab942b4227a3870ae5bb97870aa09a1082fb8e78b944cd7fd1b0c6fb1cce03b5430b12ef9ce2d95e01821766e998df0cc99202a57cf030577bd2dc0ec85a49f203511bb6f0e9f43398ead0958f8d7534c61e81daf4501faaa68d9cbc725b58401900fa48a3e2333b15c88cf0c5cc8f33fb9464f9d5f5768b8f10203010001a35a3058300e0603551d0f0101ff0404030205a0301d0603551d250416301406082b0601050507030106082b06010505070302300c0603551d130101ff0402300030190603551d1104123010820e6578616d706c652e676f6c616e67300d06092a864886f70d01010b050003820101009e83f835e2da08204ee6f8bdca793cf83c7aec175349c1642dfbe9f4d0dcfb1aedb4d0122e16c2ad92e63dd31cce10ca5dd04be48cded0fdc8fea49e891d9d93e778a67d54b619ac167ce7bb0f6000ca00c5677d09df3eb10080134ba32bfe4132d33954dc479cb266288d53d3f43af9c78c0ca59d396498bdc56d4966dc6b7e49081f7f2ae1d704bb9f9effed93c57d3b738da02edff3999e3f1a5dce2b093951947d233d9c6b6a12b4b1611826aa02544980089eebbcf22a1a96bd35a3ddf638578989334a93d5081fab442b4383ba6213b7cdd74110582244a2abd937828b311d8dd69178756db7874293b9810c5c2e833f91d49d283a62caaf359141997f") + +var testRSA2048CertificateIssuer = fromHex("308203223082020aa003020102020900ca5e4e811a965964300d06092a864886f70d01010b0500301f310b3009060355040a1302476f3110300e06035504031307476f20526f6f74301e170d3136303130313030303030305a170d3235303130313030303030305a301f310b3009060355040a1302476f3110300e06035504031307476f20526f6f7430820122300d06092a864886f70d01010105000382010f003082010a0282010100b308c1720c7054abe66e1be6f8a11246808215a810e8936e47601f7ec1afeb02ad69a5000959d4e08ebc4455ef90b39616f380b8ff2e76f29942d7e009cf010824fe56f69140ac39b761595255ec2aa35155ca2eea884f57b25f8a52f41f56f65b0197cb6c637f9adfa97d8ac27565449f64e67f8b918646ffd630601b0badd8d38aea421fe413ee94f10ea5874c2fd6d8c1b9febaa5ca0ce759993a232c9c48e52230bbf58777b0c30e07e9e0914133730d844b9887b950d5a17c779ac69de2d9c65d26f1ea46c7dd7ac636af6d77df7c9218f78c7b5f08b025867f343ac66cd43a657ac44bfd7e9d07e95a22ff9a0babf72dcffc66eba0a1d90731f67e3bbd0203010001a361305f300e0603551d0f0101ff040403020204301d0603551d250416301406082b0601050507030106082b06010505070302300f0603551d130101ff040530030101ff301d0603551d0e0416041460145a6ce2e8a15b1b68db9a4752ce8684d6ba2d300d06092a864886f70d01010b050003820101001d342fe0b50a25d57a8b13bc14d0abb1eea7431ee752aa423e1306654183e44e9d48bbf592cd32ce77310fdc4e8bbcd724fc43d2723f454bfe605ff90d38d8c6fe60b36c6f4d2d7e4e79bceeb2484f0565274b0d0c4a8562370677624a4c133e332a9e63d4b47544c14e4908ee8685dd0760ae6f4ab089ede2b0cdc595ecefbee7d8be80d57b2d4e4510b6ceda54d1a5980540214191d81cc89a983da43d4043f8efe97a2e231c5153bded520acce87ec8c64a3408f0eb4c742c4a877e8b5b7b7f72497734a41a95994a7a103262ea6d598d03fd5cb0579ed4702424da8893334c58215bc655d49656aedcd02d18676f45d6b9469ae04b89abe9b358391cce99") + +var testRSA2048PrivateKey, _ = x509.ParsePKCS1PrivateKey(fromHex("308204a40201000282010100e0ac47db9ba1b7f98a996c62dc1d248d4ee570544136fe4e911e22fccc0fe2b20982f3c4cdd8f4065c5068c873ca0a768b80dc915edc66541a5f26cdea44e56e411221e2f9927bf4e009fee76dbe0e118dcc13392efd6f42d8eb2fd5bc8f63ac77800c84d3be90c20c321273254b9137ef61f825dad1ec2c5e75aa4be6d3104899bd5ac400da7ab942b4227a3870ae5bb97870aa09a1082fb8e78b944cd7fd1b0c6fb1cce03b5430b12ef9ce2d95e01821766e998df0cc99202a57cf030577bd2dc0ec85a49f203511bb6f0e9f43398ead0958f8d7534c61e81daf4501faaa68d9cbc725b58401900fa48a3e2333b15c88cf0c5cc8f33fb9464f9d5f5768b8f10203010001028201007aac96efca229b199e1bf79a63256677e1c455792bc2a348b2e409a68ea57dda486740430d4290bb885c3f5a741eb567d4f41f7b2098a726f4df4f88cf899edc7c9b31f584dffedece15a7212642c7dbbdd8d806392a183e1fc30af36169c9bab9e528f0bdcd27ad4c8b6a97849da6452c6809de61848db80c3ba3289e785042cdfd46fbfee5f78adcba2927fcd8cbe9dcaa97190457eaa45d77adbe0db820aff0c8511d837ab5b307bad5f85afd2cc70d9659ec58045d97ced1eb7950670ac559449c0305fddefda1bac88d36629a177f65abad182c6470830b39e7f6dbdef4df813ccaef01d5a42d37213b2b9647e2ff56a63e6b6a4b6e8a1567bbfd77042102818100eb66f205e8507c78f7167dbef3ddf02fde6a67bd15152609e9296576e28c79678177145ae98e0a2fee58fdb3d626fb6beae3e0ae0b76bc47d16fcdeb16f0caca8a0902779979382609705ae84514de480c2fb2ddda3049347cc1bde9f1a359747079ef3dce020a3c186c90e63bc20b5489a40d768b1c1c35c679edc5662e18c702818100f454ffff95b126b55cb13b68a3841600fc0bc69ff4064f7ceb122495fa972fdb05ca2fa1c6e2e84432f81c96875ab12226e8ce92ba808c4f6325f27ce058791f05db96e623687d3cfc198e748a07521a8c7ee9e7e8faf95b0985be82b867a49f7d5d50fac3881d2c39dedfdbca3ebe847b859c9864cf7a543e4688f5a60118870281806cee737ac65950704daeebbb8c701c709a54d4f28baa00b33f6137a1bf0e5033d4963d2620c3e8f4eb2fe51eee2f95d3079c31e1784e96ac093fdaa33a376d3032961ebd27990fa192669abab715041385082196461c6813d0d37ac5a25afbcf452937cb7ae438c63c6b28d651bae6b1550c446aa1cefd42e9388d0df6cdc80b02818100cac172c33504923bb494fad8e5c0a9c5dd63244bfe63f238969632b82700a95cd71c2694d887d9f92656d0da75ae640a1441e392cda3f94bb3da7cb4f6335527d2639c809467946e34423cfe26c0d6786398ba20922d1b1a59f79bd5bc937d8040b75c890c13fb298548977a3c05ff71cf535c54f66b5a77684a7e4363a3cb2702818100a4d782f35d5a07f9c1f8f9c378564b220387d1e481cc856b631de7637d8bb77c851db070122050ac230dc6e45edf4523471c717c1cb86a36b2fd3358fae349d51be54d71d7dbeaa6af668323e2b51933f0b8488aa12723e0f32207068b4aa64ed54bcef4acbbbe35b92802faba7ed45ae52bef8313d9ef4393ccc5cf868ddbf8")) + +// testRSAPSSCertificate has signatureAlgorithm rsassaPss, but subjectPublicKeyInfo +// algorithm rsaEncryption, for use with the rsa_pss_rsae_* SignatureSchemes. +// See also TestRSAPSSKeyError. testRSAPSSCertificate is self-signed. +var testRSAPSSCertificate = fromHex("308202583082018da003020102021100f29926eb87ea8a0db9fcc247347c11b0304106092a864886f70d01010a3034a00f300d06096086480165030402010500a11c301a06092a864886f70d010108300d06096086480165030402010500a20302012030123110300e060355040a130741636d6520436f301e170d3137313132333136313631305a170d3138313132333136313631305a30123110300e060355040a130741636d6520436f30819f300d06092a864886f70d010101050003818d0030818902818100db467d932e12270648bc062821ab7ec4b6a25dfe1e5245887a3647a5080d92425bc281c0be97799840fb4f6d14fd2b138bc2a52e67d8d4099ed62238b74a0b74732bc234f1d193e596d9747bf3589f6c613cc0b041d4d92b2b2423775b1c3bbd755dce2054cfa163871d1e24c4f31d1a508baab61443ed97a77562f414c852d70203010001a3463044300e0603551d0f0101ff0404030205a030130603551d25040c300a06082b06010505070301300c0603551d130101ff04023000300f0603551d110408300687047f000001304106092a864886f70d01010a3034a00f300d06096086480165030402010500a11c301a06092a864886f70d010108300d06096086480165030402010500a20302012003818100cdac4ef2ce5f8d79881042707f7cbf1b5a8a00ef19154b40151771006cd41626e5496d56da0c1a139fd84695593cb67f87765e18aa03ea067522dd78d2a589b8c92364e12838ce346c6e067b51f1a7e6f4b37ffab13f1411896679d18e880e0ba09e302ac067efca460288e9538122692297ad8093d4f7dd701424d7700a46a1") + +var testECDSACertificate = fromHex("3082020030820162020900b8bf2d47a0d2ebf4300906072a8648ce3d04013045310b3009060355040613024155311330110603550408130a536f6d652d53746174653121301f060355040a1318496e7465726e6574205769646769747320507479204c7464301e170d3132313132323135303633325a170d3232313132303135303633325a3045310b3009060355040613024155311330110603550408130a536f6d652d53746174653121301f060355040a1318496e7465726e6574205769646769747320507479204c746430819b301006072a8648ce3d020106052b81040023038186000400c4a1edbe98f90b4873367ec316561122f23d53c33b4d213dcd6b75e6f6b0dc9adf26c1bcb287f072327cb3642f1c90bcea6823107efee325c0483a69e0286dd33700ef0462dd0da09c706283d881d36431aa9e9731bd96b068c09b23de76643f1a5c7fe9120e5858b65f70dd9bd8ead5d7f5d5ccb9b69f30665b669a20e227e5bffe3b300906072a8648ce3d040103818c0030818802420188a24febe245c5487d1bacf5ed989dae4770c05e1bb62fbdf1b64db76140d311a2ceee0b7e927eff769dc33b7ea53fcefa10e259ec472d7cacda4e970e15a06fd00242014dfcbe67139c2d050ebd3fa38c25c13313830d9406bbd4377af6ec7ac9862eddd711697f857c56defb31782be4c7780daecbbe9e4e3624317b6a0f399512078f2a") + +var testEd25519Certificate = fromHex("3082012e3081e1a00302010202100f431c425793941de987e4f1ad15005d300506032b657030123110300e060355040a130741636d6520436f301e170d3139303531363231333830315a170d3230303531353231333830315a30123110300e060355040a130741636d6520436f302a300506032b65700321003fe2152ee6e3ef3f4e854a7577a3649eede0bf842ccc92268ffa6f3483aaec8fa34d304b300e0603551d0f0101ff0404030205a030130603551d25040c300a06082b06010505070301300c0603551d130101ff0402300030160603551d11040f300d820b6578616d706c652e636f6d300506032b65700341006344ed9cc4be5324539fd2108d9fe82108909539e50dc155ff2c16b71dfcab7d4dd4e09313d0a942e0b66bfe5d6748d79f50bc6ccd4b03837cf20858cdaccf0c") + +var testSNICertificate = fromHex("0441883421114c81480804c430820237308201a0a003020102020900e8f09d3fe25beaa6300d06092a864886f70d01010b0500301f310b3009060355040a1302476f3110300e06035504031307476f20526f6f74301e170d3136303130313030303030305a170d3235303130313030303030305a3023310b3009060355040a1302476f311430120603550403130b736e69746573742e636f6d30819f300d06092a864886f70d010101050003818d0030818902818100db467d932e12270648bc062821ab7ec4b6a25dfe1e5245887a3647a5080d92425bc281c0be97799840fb4f6d14fd2b138bc2a52e67d8d4099ed62238b74a0b74732bc234f1d193e596d9747bf3589f6c613cc0b041d4d92b2b2423775b1c3bbd755dce2054cfa163871d1e24c4f31d1a508baab61443ed97a77562f414c852d70203010001a3773075300e0603551d0f0101ff0404030205a0301d0603551d250416301406082b0601050507030106082b06010505070302300c0603551d130101ff0402300030190603551d0e041204109f91161f43433e49a6de6db680d79f60301b0603551d230414301280104813494d137e1631bba301d5acab6e7b300d06092a864886f70d01010b0500038181007beeecff0230dbb2e7a334af65430b7116e09f327c3bbf918107fc9c66cb497493207ae9b4dbb045cb63d605ec1b5dd485bb69124d68fa298dc776699b47632fd6d73cab57042acb26f083c4087459bc5a3bb3ca4d878d7fe31016b7bc9a627438666566e3389bfaeebe6becc9a0093ceed18d0f9ac79d56f3a73f18188988ed") + +var testP256Certificate = fromHex("308201693082010ea00302010202105012dc24e1124ade4f3e153326ff27bf300a06082a8648ce3d04030230123110300e060355040a130741636d6520436f301e170d3137303533313232343934375a170d3138303533313232343934375a30123110300e060355040a130741636d6520436f3059301306072a8648ce3d020106082a8648ce3d03010703420004c02c61c9b16283bbcc14956d886d79b358aa614596975f78cece787146abf74c2d5dc578c0992b4f3c631373479ebf3892efe53d21c4f4f1cc9a11c3536b7f75a3463044300e0603551d0f0101ff0404030205a030130603551d25040c300a06082b06010505070301300c0603551d130101ff04023000300f0603551d1104083006820474657374300a06082a8648ce3d0403020349003046022100963712d6226c7b2bef41512d47e1434131aaca3ba585d666c924df71ac0448b3022100f4d05c725064741aef125f243cdbccaa2a5d485927831f221c43023bd5ae471a") + +var testRSAPrivateKey, _ = x509.ParsePKCS1PrivateKey(fromHex("3082025b02010002818100db467d932e12270648bc062821ab7ec4b6a25dfe1e5245887a3647a5080d92425bc281c0be97799840fb4f6d14fd2b138bc2a52e67d8d4099ed62238b74a0b74732bc234f1d193e596d9747bf3589f6c613cc0b041d4d92b2b2423775b1c3bbd755dce2054cfa163871d1e24c4f31d1a508baab61443ed97a77562f414c852d702030100010281800b07fbcf48b50f1388db34b016298b8217f2092a7c9a04f77db6775a3d1279b62ee9951f7e371e9de33f015aea80660760b3951dc589a9f925ed7de13e8f520e1ccbc7498ce78e7fab6d59582c2386cc07ed688212a576ff37833bd5943483b5554d15a0b9b4010ed9bf09f207e7e9805f649240ed6c1256ed75ab7cd56d9671024100fded810da442775f5923debae4ac758390a032a16598d62f059bb2e781a9c2f41bfa015c209f966513fe3bf5a58717cbdb385100de914f88d649b7d15309fa49024100dd10978c623463a1802c52f012cfa72ff5d901f25a2292446552c2568b1840e49a312e127217c2186615aae4fb6602a4f6ebf3f3d160f3b3ad04c592f65ae41f02400c69062ca781841a09de41ed7a6d9f54adc5d693a2c6847949d9e1358555c9ac6a8d9e71653ac77beb2d3abaf7bb1183aa14278956575dbebf525d0482fd72d90240560fe1900ba36dae3022115fd952f2399fb28e2975a1c3e3d0b679660bdcb356cc189d611cfdd6d87cd5aea45aa30a2082e8b51e94c2f3dd5d5c6036a8a615ed0240143993d80ece56f877cb80048335701eb0e608cc0c1ca8c2227b52edf8f1ac99c562f2541b5ce81f0515af1c5b4770dba53383964b4b725ff46fdec3d08907df")) + +var testECDSAPrivateKey, _ = x509.ParseECPrivateKey(fromHex("3081dc0201010442019883e909ad0ac9ea3d33f9eae661f1785206970f8ca9a91672f1eedca7a8ef12bd6561bb246dda5df4b4d5e7e3a92649bc5d83a0bf92972e00e62067d0c7bd99d7a00706052b81040023a18189038186000400c4a1edbe98f90b4873367ec316561122f23d53c33b4d213dcd6b75e6f6b0dc9adf26c1bcb287f072327cb3642f1c90bcea6823107efee325c0483a69e0286dd33700ef0462dd0da09c706283d881d36431aa9e9731bd96b068c09b23de76643f1a5c7fe9120e5858b65f70dd9bd8ead5d7f5d5ccb9b69f30665b669a20e227e5bffe3b")) + +var testP256PrivateKey, _ = x509.ParseECPrivateKey(fromHex("30770201010420012f3b52bc54c36ba3577ad45034e2e8efe1e6999851284cb848725cfe029991a00a06082a8648ce3d030107a14403420004c02c61c9b16283bbcc14956d886d79b358aa614596975f78cece787146abf74c2d5dc578c0992b4f3c631373479ebf3892efe53d21c4f4f1cc9a11c3536b7f75")) + +var testEd25519PrivateKey = ed25519.PrivateKey(fromHex("3a884965e76b3f55e5faf9615458a92354894234de3ec9f684d46d55cebf3dc63fe2152ee6e3ef3f4e854a7577a3649eede0bf842ccc92268ffa6f3483aaec8f")) + +const clientCertificatePEM = ` +-----BEGIN CERTIFICATE----- +MIIB7zCCAVigAwIBAgIQXBnBiWWDVW/cC8m5k5/pvDANBgkqhkiG9w0BAQsFADAS +MRAwDgYDVQQKEwdBY21lIENvMB4XDTE2MDgxNzIxNTIzMVoXDTE3MDgxNzIxNTIz +MVowEjEQMA4GA1UEChMHQWNtZSBDbzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC +gYEAum+qhr3Pv5/y71yUYHhv6BPy0ZZvzdkybiI3zkH5yl0prOEn2mGi7oHLEMff +NFiVhuk9GeZcJ3NgyI14AvQdpJgJoxlwaTwlYmYqqyIjxXuFOE8uCXMyp70+m63K +hAfmDzr/d8WdQYUAirab7rCkPy1MTOZCPrtRyN1IVPQMjkcCAwEAAaNGMEQwDgYD +VR0PAQH/BAQDAgWgMBMGA1UdJQQMMAoGCCsGAQUFBwMBMAwGA1UdEwEB/wQCMAAw +DwYDVR0RBAgwBocEfwAAATANBgkqhkiG9w0BAQsFAAOBgQBGq0Si+yhU+Fpn+GKU +8ZqyGJ7ysd4dfm92lam6512oFmyc9wnTN+RLKzZ8Aa1B0jLYw9KT+RBrjpW5LBeK +o0RIvFkTgxYEiKSBXCUNmAysEbEoVr4dzWFihAm/1oDGRY2CLLTYg5vbySK3KhIR +e/oCO8HJ/+rJnahJ05XX1Q7lNQ== +-----END CERTIFICATE-----` + +var clientKeyPEM = testingKey(` +-----BEGIN RSA TESTING KEY----- +MIICXQIBAAKBgQC6b6qGvc+/n/LvXJRgeG/oE/LRlm/N2TJuIjfOQfnKXSms4Sfa +YaLugcsQx980WJWG6T0Z5lwnc2DIjXgC9B2kmAmjGXBpPCViZiqrIiPFe4U4Ty4J +czKnvT6brcqEB+YPOv93xZ1BhQCKtpvusKQ/LUxM5kI+u1HI3UhU9AyORwIDAQAB +AoGAEJZ03q4uuMb7b26WSQsOMeDsftdatT747LGgs3pNRkMJvTb/O7/qJjxoG+Mc +qeSj0TAZXp+PXXc3ikCECAc+R8rVMfWdmp903XgO/qYtmZGCorxAHEmR80SrfMXv +PJnznLQWc8U9nphQErR+tTESg7xWEzmFcPKwnZd1xg8ERYkCQQDTGtrFczlB2b/Z +9TjNMqUlMnTLIk/a/rPE2fLLmAYhK5sHnJdvDURaH2mF4nso0EGtENnTsh6LATnY +dkrxXGm9AkEA4hXHG2q3MnhgK1Z5hjv+Fnqd+8bcbII9WW4flFs15EKoMgS1w/PJ +zbsySaSy5IVS8XeShmT9+3lrleed4sy+UwJBAJOOAbxhfXP5r4+5R6ql66jES75w +jUCVJzJA5ORJrn8g64u2eGK28z/LFQbv9wXgCwfc72R468BdawFSLa/m2EECQGbZ +rWiFla26IVXV0xcD98VWJsTBZMlgPnSOqoMdM1kSEd4fUmlAYI/dFzV1XYSkOmVr +FhdZnklmpVDeu27P4c0CQQCuCOup0FlJSBpWY1TTfun/KMBkBatMz0VMA3d7FKIU +csPezl677Yjo8u1r/KzeI6zLg87Z8E6r6ZWNc9wBSZK6 +-----END RSA TESTING KEY-----`) + +const clientECDSACertificatePEM = ` +-----BEGIN CERTIFICATE----- +MIIB/DCCAV4CCQCaMIRsJjXZFzAJBgcqhkjOPQQBMEUxCzAJBgNVBAYTAkFVMRMw +EQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0 +eSBMdGQwHhcNMTIxMTE0MTMyNTUzWhcNMjIxMTEyMTMyNTUzWjBBMQswCQYDVQQG +EwJBVTEMMAoGA1UECBMDTlNXMRAwDgYDVQQHEwdQeXJtb250MRIwEAYDVQQDEwlK +b2VsIFNpbmcwgZswEAYHKoZIzj0CAQYFK4EEACMDgYYABACVjJF1FMBexFe01MNv +ja5oHt1vzobhfm6ySD6B5U7ixohLZNz1MLvT/2XMW/TdtWo+PtAd3kfDdq0Z9kUs +jLzYHQFMH3CQRnZIi4+DzEpcj0B22uCJ7B0rxE4wdihBsmKo+1vx+U56jb0JuK7q +ixgnTy5w/hOWusPTQBbNZU6sER7m8TAJBgcqhkjOPQQBA4GMADCBiAJCAOAUxGBg +C3JosDJdYUoCdFzCgbkWqD8pyDbHgf9stlvZcPE4O1BIKJTLCRpS8V3ujfK58PDa +2RU6+b0DeoeiIzXsAkIBo9SKeDUcSpoj0gq+KxAxnZxfvuiRs9oa9V2jI/Umi0Vw +jWVim34BmT0Y9hCaOGGbLlfk+syxis7iI6CH8OFnUes= +-----END CERTIFICATE-----` + +var clientECDSAKeyPEM = testingKey(` +-----BEGIN EC PARAMETERS----- +BgUrgQQAIw== +-----END EC PARAMETERS----- +-----BEGIN EC TESTING KEY----- +MIHcAgEBBEIBkJN9X4IqZIguiEVKMqeBUP5xtRsEv4HJEtOpOGLELwO53SD78Ew8 +k+wLWoqizS3NpQyMtrU8JFdWfj+C57UNkOugBwYFK4EEACOhgYkDgYYABACVjJF1 +FMBexFe01MNvja5oHt1vzobhfm6ySD6B5U7ixohLZNz1MLvT/2XMW/TdtWo+PtAd +3kfDdq0Z9kUsjLzYHQFMH3CQRnZIi4+DzEpcj0B22uCJ7B0rxE4wdihBsmKo+1vx ++U56jb0JuK7qixgnTy5w/hOWusPTQBbNZU6sER7m8Q== +-----END EC TESTING KEY-----`) + +const clientEd25519CertificatePEM = ` +-----BEGIN CERTIFICATE----- +MIIBLjCB4aADAgECAhAX0YGTviqMISAQJRXoNCNPMAUGAytlcDASMRAwDgYDVQQK +EwdBY21lIENvMB4XDTE5MDUxNjIxNTQyNloXDTIwMDUxNTIxNTQyNlowEjEQMA4G +A1UEChMHQWNtZSBDbzAqMAUGAytlcAMhAAvgtWC14nkwPb7jHuBQsQTIbcd4bGkv +xRStmmNveRKRo00wSzAOBgNVHQ8BAf8EBAMCBaAwEwYDVR0lBAwwCgYIKwYBBQUH +AwIwDAYDVR0TAQH/BAIwADAWBgNVHREEDzANggtleGFtcGxlLmNvbTAFBgMrZXAD +QQD8GRcqlKUx+inILn9boF2KTjRAOdazENwZ/qAicbP1j6FYDc308YUkv+Y9FN/f +7Q7hF9gRomDQijcjKsJGqjoI +-----END CERTIFICATE-----` + +var clientEd25519KeyPEM = testingKey(` +-----BEGIN TESTING KEY----- +MC4CAQAwBQYDK2VwBCIEINifzf07d9qx3d44e0FSbV4mC/xQxT644RRbpgNpin7I +-----END TESTING KEY-----`) + +func TestServerHelloTrailingMessage(t *testing.T) { + // In TLS 1.3 the change cipher spec message is optional. If a CCS message + // is not sent, after reading the ServerHello, the read traffic secret is + // set, and all following messages must be encrypted. If the server sends + // additional unencrypted messages in a record with the ServerHello, the + // client must either fail or ignore the additional messages. + + c, s := localPipe(t) + go func() { + ctx := context.Background() + srv := Server(s, testConfig) + clientHello, _, err := srv.readClientHello(ctx) + if err != nil { + testFatal(t, err) + } + + hs := serverHandshakeStateTLS13{ + c: srv, + ctx: ctx, + clientHello: clientHello, + } + if err := hs.processClientHello(); err != nil { + testFatal(t, err) + } + if err := transcriptMsg(hs.clientHello, hs.transcript); err != nil { + testFatal(t, err) + } + + record, err := concatHandshakeMessages(hs.hello, &encryptedExtensionsMsg{alpnProtocol: "h2"}) + if err != nil { + testFatal(t, err) + } + + if _, err := s.Write(record); err != nil { + testFatal(t, err) + } + srv.Close() + }() + + cli := Client(c, testConfig) + expectedErr := "tls: handshake buffer not empty before setting read traffic secret" + if err := cli.Handshake(); err == nil { + t.Fatal("expected error from incomplete handshake, got nil") + } else if err.Error() != expectedErr { + t.Fatalf("expected error %q, got %q", expectedErr, err.Error()) + } +} + +func TestClientHelloTrailingMessage(t *testing.T) { + // Same as TestServerHelloTrailingMessage but for the client side. + + c, s := localPipe(t) + go func() { + cli := Client(c, testConfig) + + hello, _, _, err := cli.makeClientHello() + if err != nil { + testFatal(t, err) + } + + record, err := concatHandshakeMessages(hello, &certificateMsgTLS13{}) + if err != nil { + testFatal(t, err) + } + + if _, err := c.Write(record); err != nil { + testFatal(t, err) + } + cli.Close() + }() + + srv := Server(s, testConfig) + expectedErr := "tls: handshake buffer not empty before setting read traffic secret" + if err := srv.Handshake(); err == nil { + t.Fatal("expected error from incomplete handshake, got nil") + } else if err.Error() != expectedErr { + t.Fatalf("expected error %q, got %q", expectedErr, err.Error()) + } +} + +func TestDoubleClientHelloHRR(t *testing.T) { + // If a client sends two ClientHello messages in a single record, and the + // server sends a HRR after reading the first ClientHello, the server must + // either fail or ignore the trailing ClientHello. + + c, s := localPipe(t) + + go func() { + cli := Client(c, testConfig) + + hello, _, _, err := cli.makeClientHello() + if err != nil { + testFatal(t, err) + } + hello.keyShares = nil + + record, err := concatHandshakeMessages(hello, hello) + if err != nil { + testFatal(t, err) + } + + if _, err := c.Write(record); err != nil { + testFatal(t, err) + } + cli.Close() + }() + + srv := Server(s, testConfig) + expectedErr := "tls: handshake buffer not empty before HelloRetryRequest" + if err := srv.Handshake(); err == nil { + t.Fatal("expected error from incomplete handshake, got nil") + } else if err.Error() != expectedErr { + t.Fatalf("expected error %q, got %q", expectedErr, err.Error()) + } +} + +// concatHandshakeMessages marshals and concatenates the given handshake +// messages into a single record. +func concatHandshakeMessages(msgs ...handshakeMessage) ([]byte, error) { + var marshalled []byte + for _, msg := range msgs { + data, err := msg.marshal() + if err != nil { + return nil, err + } + marshalled = append(marshalled, data...) + } + m := len(marshalled) + outBuf := make([]byte, recordHeaderLen) + outBuf[0] = byte(recordTypeHandshake) + vers := VersionTLS12 + outBuf[1] = byte(vers >> 8) + outBuf[2] = byte(vers) + outBuf[3] = byte(m >> 8) + outBuf[4] = byte(m) + outBuf = append(outBuf, marshalled...) + return outBuf, nil +} + +func TestMultipleKeyUpdate(t *testing.T) { + for _, requestUpdate := range []bool{true, false} { + t.Run(fmt.Sprintf("requestUpdate=%t", requestUpdate), func(t *testing.T) { + + c, s := localPipe(t) + cfg := testConfig.Clone() + cfg.MinVersion = VersionTLS13 + cfg.MaxVersion = VersionTLS13 + client := Client(c, testConfig) + server := Server(s, testConfig) + + clientHandshakeDone := make(chan struct{}) + go func() { + if err := client.Handshake(); err != nil { + } + close(clientHandshakeDone) + io.Copy(io.Discard, server) + }() + + if err := server.Handshake(); err != nil { + t.Fatalf("server handshake failed: %v\n", err) + } + <-clientHandshakeDone + + c.SetReadDeadline(time.Now().Add(1 * time.Second)) + s.SetReadDeadline(time.Now().Add(1 * time.Second)) + + kuMsg, err := (&keyUpdateMsg{updateRequested: requestUpdate}).marshal() + if err != nil { + t.Fatalf("failed to marshal key update message: %v", err) + } + + client.out.Lock() + if _, err := client.writeRecordLocked(recordTypeHandshake, append(kuMsg, kuMsg...)); err != nil { + t.Fatalf("failed to write key update messages: %v", err) + } + client.out.Unlock() + + _, err = io.Copy(io.Discard, client) + if err == nil { + t.Fatal("expected multiple key update messages to cause an error, got nil") + } else if !strings.HasSuffix(err.Error(), "tls: unexpected message") { + t.Fatalf("unexpected error: %v", err) + } + }) + } +} diff --git a/go/src/crypto/tls/handshake_unix_test.go b/go/src/crypto/tls/handshake_unix_test.go new file mode 100644 index 0000000000000000000000000000000000000000..86a48f299bf918fe44badcdd8ca3b43728c98163 --- /dev/null +++ b/go/src/crypto/tls/handshake_unix_test.go @@ -0,0 +1,18 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build unix + +package tls + +import ( + "errors" + "syscall" +) + +func init() { + isConnRefused = func(err error) bool { + return errors.Is(err, syscall.ECONNREFUSED) + } +} diff --git a/go/src/crypto/tls/key_agreement.go b/go/src/crypto/tls/key_agreement.go new file mode 100644 index 0000000000000000000000000000000000000000..ad2be5ddf9b0f8e44b109f137f2961b886e7295d --- /dev/null +++ b/go/src/crypto/tls/key_agreement.go @@ -0,0 +1,403 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "crypto" + "crypto/ecdh" + "crypto/md5" + "crypto/rsa" + "crypto/sha1" + "crypto/x509" + "errors" + "fmt" + "io" + "slices" +) + +// A keyAgreement implements the client and server side of a TLS 1.0–1.2 key +// agreement protocol by generating and processing key exchange messages. +type keyAgreement interface { + // On the server side, the first two methods are called in order. + + // In the case that the key agreement protocol doesn't use a + // ServerKeyExchange message, generateServerKeyExchange can return nil, + // nil. + generateServerKeyExchange(*Config, *Certificate, *clientHelloMsg, *serverHelloMsg) (*serverKeyExchangeMsg, error) + processClientKeyExchange(*Config, *Certificate, *clientKeyExchangeMsg, uint16) ([]byte, error) + + // On the client side, the next two methods are called in order. + + // This method may not be called if the server doesn't send a + // ServerKeyExchange message. + processServerKeyExchange(*Config, *clientHelloMsg, *serverHelloMsg, *x509.Certificate, *serverKeyExchangeMsg) error + generateClientKeyExchange(*Config, *clientHelloMsg, *x509.Certificate) ([]byte, *clientKeyExchangeMsg, error) +} + +var errClientKeyExchange = errors.New("tls: invalid ClientKeyExchange message") +var errServerKeyExchange = errors.New("tls: invalid ServerKeyExchange message") + +// rsaKeyAgreement implements the standard TLS key agreement where the client +// encrypts the pre-master secret to the server's public key. +type rsaKeyAgreement struct{} + +func (ka rsaKeyAgreement) generateServerKeyExchange(config *Config, cert *Certificate, clientHello *clientHelloMsg, hello *serverHelloMsg) (*serverKeyExchangeMsg, error) { + return nil, nil +} + +func (ka rsaKeyAgreement) processClientKeyExchange(config *Config, cert *Certificate, ckx *clientKeyExchangeMsg, version uint16) ([]byte, error) { + if len(ckx.ciphertext) < 2 { + return nil, errClientKeyExchange + } + ciphertextLen := int(ckx.ciphertext[0])<<8 | int(ckx.ciphertext[1]) + if ciphertextLen != len(ckx.ciphertext)-2 { + return nil, errClientKeyExchange + } + ciphertext := ckx.ciphertext[2:] + + priv, ok := cert.PrivateKey.(crypto.Decrypter) + if !ok { + return nil, errors.New("tls: certificate private key does not implement crypto.Decrypter") + } + // Perform constant time RSA PKCS #1 v1.5 decryption + preMasterSecret, err := priv.Decrypt(config.rand(), ciphertext, &rsa.PKCS1v15DecryptOptions{SessionKeyLen: 48}) + if err != nil { + return nil, err + } + // We don't check the version number in the premaster secret. For one, + // by checking it, we would leak information about the validity of the + // encrypted pre-master secret. Secondly, it provides only a small + // benefit against a downgrade attack and some implementations send the + // wrong version anyway. See the discussion at the end of section + // 7.4.7.1 of RFC 4346. + return preMasterSecret, nil +} + +func (ka rsaKeyAgreement) processServerKeyExchange(config *Config, clientHello *clientHelloMsg, serverHello *serverHelloMsg, cert *x509.Certificate, skx *serverKeyExchangeMsg) error { + return errors.New("tls: unexpected ServerKeyExchange") +} + +func (ka rsaKeyAgreement) generateClientKeyExchange(config *Config, clientHello *clientHelloMsg, cert *x509.Certificate) ([]byte, *clientKeyExchangeMsg, error) { + preMasterSecret := make([]byte, 48) + preMasterSecret[0] = byte(clientHello.vers >> 8) + preMasterSecret[1] = byte(clientHello.vers) + _, err := io.ReadFull(config.rand(), preMasterSecret[2:]) + if err != nil { + return nil, nil, err + } + + rsaKey, ok := cert.PublicKey.(*rsa.PublicKey) + if !ok { + return nil, nil, errors.New("tls: server certificate contains incorrect key type for selected ciphersuite") + } + encrypted, err := rsa.EncryptPKCS1v15(config.rand(), rsaKey, preMasterSecret) + if err != nil { + return nil, nil, err + } + ckx := new(clientKeyExchangeMsg) + ckx.ciphertext = make([]byte, len(encrypted)+2) + ckx.ciphertext[0] = byte(len(encrypted) >> 8) + ckx.ciphertext[1] = byte(len(encrypted)) + copy(ckx.ciphertext[2:], encrypted) + return preMasterSecret, ckx, nil +} + +// sha1Hash calculates a SHA1 hash over the given byte slices. +func sha1Hash(slices [][]byte) []byte { + hsha1 := sha1.New() + for _, slice := range slices { + hsha1.Write(slice) + } + return hsha1.Sum(nil) +} + +// md5SHA1Hash implements TLS 1.0's hybrid hash function which consists of the +// concatenation of an MD5 and SHA1 hash. +func md5SHA1Hash(slices [][]byte) []byte { + md5sha1 := make([]byte, md5.Size+sha1.Size) + hmd5 := md5.New() + for _, slice := range slices { + hmd5.Write(slice) + } + copy(md5sha1, hmd5.Sum(nil)) + copy(md5sha1[md5.Size:], sha1Hash(slices)) + return md5sha1 +} + +// hashForServerKeyExchange hashes the given slices and returns their digest +// using a hash based on the sigType. It can only be used for TLS 1.0 and 1.1. +func hashForServerKeyExchange(sigType uint8, slices ...[]byte) []byte { + if sigType == signatureECDSA { + return sha1Hash(slices) + } + return md5SHA1Hash(slices) +} + +// ecdheKeyAgreement implements a TLS key agreement where the server +// generates an ephemeral EC public/private key pair and signs it. The +// pre-master secret is then calculated using ECDH. The signature may +// be ECDSA, Ed25519 or RSA. +type ecdheKeyAgreement struct { + version uint16 + isRSA bool + + // ckx and preMasterSecret are generated in processServerKeyExchange + // and returned in generateClientKeyExchange. + ckx *clientKeyExchangeMsg + preMasterSecret []byte + + // curveID, signatureAlgorithm, and key are set by processServerKeyExchange + // and generateServerKeyExchange. + curveID CurveID + signatureAlgorithm SignatureScheme + key *ecdh.PrivateKey +} + +func (ka *ecdheKeyAgreement) generateServerKeyExchange(config *Config, cert *Certificate, clientHello *clientHelloMsg, hello *serverHelloMsg) (*serverKeyExchangeMsg, error) { + for _, c := range clientHello.supportedCurves { + if config.supportsCurve(ka.version, c) { + ka.curveID = c + break + } + } + + if ka.curveID == 0 { + return nil, errors.New("tls: no supported elliptic curves offered") + } + if _, ok := curveForCurveID(ka.curveID); !ok { + return nil, errors.New("tls: CurvePreferences includes unsupported curve") + } + + key, err := generateECDHEKey(config.rand(), ka.curveID) + if err != nil { + return nil, err + } + ka.key = key + + // See RFC 4492, Section 5.4. + ecdhePublic := key.PublicKey().Bytes() + serverECDHEParams := make([]byte, 1+2+1+len(ecdhePublic)) + serverECDHEParams[0] = 3 // named curve + serverECDHEParams[1] = byte(ka.curveID >> 8) + serverECDHEParams[2] = byte(ka.curveID) + serverECDHEParams[3] = byte(len(ecdhePublic)) + copy(serverECDHEParams[4:], ecdhePublic) + + priv, ok := cert.PrivateKey.(crypto.Signer) + if !ok { + return nil, fmt.Errorf("tls: certificate private key of type %T does not implement crypto.Signer", cert.PrivateKey) + } + + var sig []byte + if ka.version >= VersionTLS12 { + ka.signatureAlgorithm, err = selectSignatureScheme(ka.version, cert, clientHello.supportedSignatureAlgorithms) + if err != nil { + return nil, err + } + sigType, sigHash, err := typeAndHashFromSignatureScheme(ka.signatureAlgorithm) + if err != nil { + return nil, err + } + if sigHash == crypto.SHA1 { + tlssha1.Value() // ensure godebug is initialized + tlssha1.IncNonDefault() + } + signed := slices.Concat(clientHello.random, hello.random, serverECDHEParams) + if (sigType == signaturePKCS1v15 || sigType == signatureRSAPSS) != ka.isRSA { + return nil, errors.New("tls: certificate cannot be used with the selected cipher suite") + } + signOpts := crypto.SignerOpts(sigHash) + if sigType == signatureRSAPSS { + signOpts = &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash, Hash: sigHash} + } + sig, err = crypto.SignMessage(priv, config.rand(), signed, signOpts) + if err != nil { + return nil, errors.New("tls: failed to sign ECDHE parameters: " + err.Error()) + } + } else { + sigType, sigHash, err := legacyTypeAndHashFromPublicKey(priv.Public()) + if err != nil { + return nil, err + } + signed := hashForServerKeyExchange(sigType, clientHello.random, hello.random, serverECDHEParams) + if (sigType == signaturePKCS1v15) != ka.isRSA { + return nil, errors.New("tls: certificate cannot be used with the selected cipher suite") + } + sig, err = priv.Sign(config.rand(), signed, sigHash) + if err != nil { + return nil, errors.New("tls: failed to sign ECDHE parameters: " + err.Error()) + } + } + + skx := new(serverKeyExchangeMsg) + sigAndHashLen := 0 + if ka.version >= VersionTLS12 { + sigAndHashLen = 2 + } + skx.key = make([]byte, len(serverECDHEParams)+sigAndHashLen+2+len(sig)) + copy(skx.key, serverECDHEParams) + k := skx.key[len(serverECDHEParams):] + if ka.version >= VersionTLS12 { + k[0] = byte(ka.signatureAlgorithm >> 8) + k[1] = byte(ka.signatureAlgorithm) + k = k[2:] + } + k[0] = byte(len(sig) >> 8) + k[1] = byte(len(sig)) + copy(k[2:], sig) + + return skx, nil +} + +func (ka *ecdheKeyAgreement) processClientKeyExchange(config *Config, cert *Certificate, ckx *clientKeyExchangeMsg, version uint16) ([]byte, error) { + if len(ckx.ciphertext) == 0 || int(ckx.ciphertext[0]) != len(ckx.ciphertext)-1 { + return nil, errClientKeyExchange + } + + peerKey, err := ka.key.Curve().NewPublicKey(ckx.ciphertext[1:]) + if err != nil { + return nil, errClientKeyExchange + } + preMasterSecret, err := ka.key.ECDH(peerKey) + if err != nil { + return nil, errClientKeyExchange + } + + return preMasterSecret, nil +} + +func (ka *ecdheKeyAgreement) processServerKeyExchange(config *Config, clientHello *clientHelloMsg, serverHello *serverHelloMsg, cert *x509.Certificate, skx *serverKeyExchangeMsg) error { + if len(skx.key) < 4 { + return errServerKeyExchange + } + if skx.key[0] != 3 { // named curve + return errors.New("tls: server selected unsupported curve") + } + ka.curveID = CurveID(skx.key[1])<<8 | CurveID(skx.key[2]) + + publicLen := int(skx.key[3]) + if publicLen+4 > len(skx.key) { + return errServerKeyExchange + } + serverECDHEParams := skx.key[:4+publicLen] + publicKey := serverECDHEParams[4:] + + sig := skx.key[4+publicLen:] + if len(sig) < 2 { + return errServerKeyExchange + } + if ka.version >= VersionTLS12 { + ka.signatureAlgorithm = SignatureScheme(sig[0])<<8 | SignatureScheme(sig[1]) + sig = sig[2:] + if len(sig) < 2 { + return errServerKeyExchange + } + } + sigLen := int(sig[0])<<8 | int(sig[1]) + if sigLen+2 != len(sig) { + return errServerKeyExchange + } + sig = sig[2:] + + if !slices.Contains(clientHello.supportedCurves, ka.curveID) { + return errors.New("tls: server selected unoffered curve") + } + + if _, ok := curveForCurveID(ka.curveID); !ok { + return errors.New("tls: server selected unsupported curve") + } + + key, err := generateECDHEKey(config.rand(), ka.curveID) + if err != nil { + return err + } + ka.key = key + + peerKey, err := key.Curve().NewPublicKey(publicKey) + if err != nil { + return errServerKeyExchange + } + ka.preMasterSecret, err = key.ECDH(peerKey) + if err != nil { + return errServerKeyExchange + } + + ourPublicKey := key.PublicKey().Bytes() + ka.ckx = new(clientKeyExchangeMsg) + ka.ckx.ciphertext = make([]byte, 1+len(ourPublicKey)) + ka.ckx.ciphertext[0] = byte(len(ourPublicKey)) + copy(ka.ckx.ciphertext[1:], ourPublicKey) + + var sigType uint8 + var sigHash crypto.Hash + if ka.version >= VersionTLS12 { + if !isSupportedSignatureAlgorithm(ka.signatureAlgorithm, clientHello.supportedSignatureAlgorithms) { + return errors.New("tls: certificate used with invalid signature algorithm") + } + sigType, sigHash, err = typeAndHashFromSignatureScheme(ka.signatureAlgorithm) + if err != nil { + return err + } + if sigHash == crypto.SHA1 { + tlssha1.Value() // ensure godebug is initialized + tlssha1.IncNonDefault() + } + if (sigType == signaturePKCS1v15 || sigType == signatureRSAPSS) != ka.isRSA { + return errServerKeyExchange + } + signed := slices.Concat(clientHello.random, serverHello.random, serverECDHEParams) + if err := verifyHandshakeSignature(sigType, cert.PublicKey, sigHash, signed, sig); err != nil { + return errors.New("tls: invalid signature by the server certificate: " + err.Error()) + } + } else { + sigType, sigHash, err = legacyTypeAndHashFromPublicKey(cert.PublicKey) + if err != nil { + return err + } + if (sigType == signaturePKCS1v15) != ka.isRSA { + return errServerKeyExchange + } + signed := hashForServerKeyExchange(sigType, clientHello.random, serverHello.random, serverECDHEParams) + if err := verifyLegacyHandshakeSignature(sigType, cert.PublicKey, sigHash, signed, sig); err != nil { + return errors.New("tls: invalid signature by the server certificate: " + err.Error()) + } + } + + return nil +} + +func (ka *ecdheKeyAgreement) generateClientKeyExchange(config *Config, clientHello *clientHelloMsg, cert *x509.Certificate) ([]byte, *clientKeyExchangeMsg, error) { + if ka.ckx == nil { + return nil, nil, errors.New("tls: missing ServerKeyExchange message") + } + + return ka.preMasterSecret, ka.ckx, nil +} + +// generateECDHEKey returns a PrivateKey that implements Diffie-Hellman +// according to RFC 8446, Section 4.2.8.2. +func generateECDHEKey(rand io.Reader, curveID CurveID) (*ecdh.PrivateKey, error) { + curve, ok := curveForCurveID(curveID) + if !ok { + return nil, errors.New("tls: internal error: unsupported curve") + } + + return curve.GenerateKey(rand) +} + +func curveForCurveID(id CurveID) (ecdh.Curve, bool) { + switch id { + case X25519: + return ecdh.X25519(), true + case CurveP256: + return ecdh.P256(), true + case CurveP384: + return ecdh.P384(), true + case CurveP521: + return ecdh.P521(), true + default: + return nil, false + } +} diff --git a/go/src/crypto/tls/key_schedule.go b/go/src/crypto/tls/key_schedule.go new file mode 100644 index 0000000000000000000000000000000000000000..97f4993a179939bfffdccd3379b220f78f3ef5de --- /dev/null +++ b/go/src/crypto/tls/key_schedule.go @@ -0,0 +1,273 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "crypto" + "crypto/ecdh" + "crypto/fips140" + "crypto/hmac" + "crypto/internal/fips140/tls13" + "crypto/mlkem" + "errors" + "hash" + "io" +) + +// This file contains the functions necessary to compute the TLS 1.3 key +// schedule. See RFC 8446, Section 7. + +// nextTrafficSecret generates the next traffic secret, given the current one, +// according to RFC 8446, Section 7.2. +func (c *cipherSuiteTLS13) nextTrafficSecret(trafficSecret []byte) []byte { + return tls13.ExpandLabel(c.hash.New, trafficSecret, "traffic upd", nil, c.hash.Size()) +} + +// trafficKey generates traffic keys according to RFC 8446, Section 7.3. +func (c *cipherSuiteTLS13) trafficKey(trafficSecret []byte) (key, iv []byte) { + key = tls13.ExpandLabel(c.hash.New, trafficSecret, "key", nil, c.keyLen) + iv = tls13.ExpandLabel(c.hash.New, trafficSecret, "iv", nil, aeadNonceLength) + return +} + +// finishedHash generates the Finished verify_data or PskBinderEntry according +// to RFC 8446, Section 4.4.4. See sections 4.4 and 4.2.11.2 for the baseKey +// selection. +func (c *cipherSuiteTLS13) finishedHash(baseKey []byte, transcript hash.Hash) []byte { + finishedKey := tls13.ExpandLabel(c.hash.New, baseKey, "finished", nil, c.hash.Size()) + verifyData := hmac.New(c.hash.New, finishedKey) + verifyData.Write(transcript.Sum(nil)) + return verifyData.Sum(nil) +} + +// exportKeyingMaterial implements RFC5705 exporters for TLS 1.3 according to +// RFC 8446, Section 7.5. +func (c *cipherSuiteTLS13) exportKeyingMaterial(s *tls13.MasterSecret, transcript hash.Hash) func(string, []byte, int) ([]byte, error) { + expMasterSecret := s.ExporterMasterSecret(transcript) + return func(label string, context []byte, length int) ([]byte, error) { + return expMasterSecret.Exporter(label, context, length), nil + } +} + +type keySharePrivateKeys struct { + ecdhe *ecdh.PrivateKey + mlkem crypto.Decapsulator +} + +// A keyExchange implements a TLS 1.3 KEM. +type keyExchange interface { + // keyShares generates one or two key shares. + // + // The first one will match the id, the second (if present) reuses the + // traditional component of the requested hybrid, as allowed by + // draft-ietf-tls-hybrid-design-09, Section 3.2. + keyShares(rand io.Reader) (*keySharePrivateKeys, []keyShare, error) + + // serverSharedSecret computes the shared secret and the server's key share. + serverSharedSecret(rand io.Reader, clientKeyShare []byte) ([]byte, keyShare, error) + + // clientSharedSecret computes the shared secret given the server's key + // share and the keys generated by keyShares. + clientSharedSecret(priv *keySharePrivateKeys, serverKeyShare []byte) ([]byte, error) +} + +func keyExchangeForCurveID(id CurveID) (keyExchange, error) { + newMLKEMPrivateKey768 := func(b []byte) (crypto.Decapsulator, error) { + return mlkem.NewDecapsulationKey768(b) + } + newMLKEMPrivateKey1024 := func(b []byte) (crypto.Decapsulator, error) { + return mlkem.NewDecapsulationKey1024(b) + } + newMLKEMPublicKey768 := func(b []byte) (crypto.Encapsulator, error) { + return mlkem.NewEncapsulationKey768(b) + } + newMLKEMPublicKey1024 := func(b []byte) (crypto.Encapsulator, error) { + return mlkem.NewEncapsulationKey1024(b) + } + switch id { + case X25519: + return &ecdhKeyExchange{id, ecdh.X25519()}, nil + case CurveP256: + return &ecdhKeyExchange{id, ecdh.P256()}, nil + case CurveP384: + return &ecdhKeyExchange{id, ecdh.P384()}, nil + case CurveP521: + return &ecdhKeyExchange{id, ecdh.P521()}, nil + case X25519MLKEM768: + return &hybridKeyExchange{id, ecdhKeyExchange{X25519, ecdh.X25519()}, + 32, mlkem.EncapsulationKeySize768, mlkem.CiphertextSize768, + newMLKEMPrivateKey768, newMLKEMPublicKey768}, nil + case SecP256r1MLKEM768: + return &hybridKeyExchange{id, ecdhKeyExchange{CurveP256, ecdh.P256()}, + 65, mlkem.EncapsulationKeySize768, mlkem.CiphertextSize768, + newMLKEMPrivateKey768, newMLKEMPublicKey768}, nil + case SecP384r1MLKEM1024: + return &hybridKeyExchange{id, ecdhKeyExchange{CurveP384, ecdh.P384()}, + 97, mlkem.EncapsulationKeySize1024, mlkem.CiphertextSize1024, + newMLKEMPrivateKey1024, newMLKEMPublicKey1024}, nil + default: + return nil, errors.New("tls: unsupported key exchange") + } +} + +type ecdhKeyExchange struct { + id CurveID + curve ecdh.Curve +} + +func (ke *ecdhKeyExchange) keyShares(rand io.Reader) (*keySharePrivateKeys, []keyShare, error) { + priv, err := ke.curve.GenerateKey(rand) + if err != nil { + return nil, nil, err + } + return &keySharePrivateKeys{ecdhe: priv}, []keyShare{{ke.id, priv.PublicKey().Bytes()}}, nil +} + +func (ke *ecdhKeyExchange) serverSharedSecret(rand io.Reader, clientKeyShare []byte) ([]byte, keyShare, error) { + key, err := ke.curve.GenerateKey(rand) + if err != nil { + return nil, keyShare{}, err + } + peerKey, err := ke.curve.NewPublicKey(clientKeyShare) + if err != nil { + return nil, keyShare{}, err + } + sharedKey, err := key.ECDH(peerKey) + if err != nil { + return nil, keyShare{}, err + } + return sharedKey, keyShare{ke.id, key.PublicKey().Bytes()}, nil +} + +func (ke *ecdhKeyExchange) clientSharedSecret(priv *keySharePrivateKeys, serverKeyShare []byte) ([]byte, error) { + peerKey, err := ke.curve.NewPublicKey(serverKeyShare) + if err != nil { + return nil, err + } + sharedKey, err := priv.ecdhe.ECDH(peerKey) + if err != nil { + return nil, err + } + return sharedKey, nil +} + +type hybridKeyExchange struct { + id CurveID + ecdh ecdhKeyExchange + + ecdhElementSize int + mlkemPublicKeySize int + mlkemCiphertextSize int + + newMLKEMPrivateKey func([]byte) (crypto.Decapsulator, error) + newMLKEMPublicKey func([]byte) (crypto.Encapsulator, error) +} + +func (ke *hybridKeyExchange) keyShares(rand io.Reader) (*keySharePrivateKeys, []keyShare, error) { + var ( + priv *keySharePrivateKeys + ecdhShares []keyShare + err error + ) + fips140.WithoutEnforcement(func() { // Hybrid of ML-KEM, which is Approved. + priv, ecdhShares, err = ke.ecdh.keyShares(rand) + }) + if err != nil { + return nil, nil, err + } + seed := make([]byte, mlkem.SeedSize) + if _, err := io.ReadFull(rand, seed); err != nil { + return nil, nil, err + } + priv.mlkem, err = ke.newMLKEMPrivateKey(seed) + if err != nil { + return nil, nil, err + } + var shareData []byte + // For X25519MLKEM768, the ML-KEM-768 encapsulation key comes first. + // For SecP256r1MLKEM768 and SecP384r1MLKEM1024, the ECDH share comes first. + // See draft-ietf-tls-ecdhe-mlkem-02, Section 4.1. + if ke.id == X25519MLKEM768 { + shareData = append(priv.mlkem.Encapsulator().Bytes(), ecdhShares[0].data...) + } else { + shareData = append(ecdhShares[0].data, priv.mlkem.Encapsulator().Bytes()...) + } + return priv, []keyShare{{ke.id, shareData}, ecdhShares[0]}, nil +} + +func (ke *hybridKeyExchange) serverSharedSecret(rand io.Reader, clientKeyShare []byte) ([]byte, keyShare, error) { + if len(clientKeyShare) != ke.ecdhElementSize+ke.mlkemPublicKeySize { + return nil, keyShare{}, errors.New("tls: invalid client key share length for hybrid key exchange") + } + var ecdhShareData, mlkemShareData []byte + if ke.id == X25519MLKEM768 { + mlkemShareData = clientKeyShare[:ke.mlkemPublicKeySize] + ecdhShareData = clientKeyShare[ke.mlkemPublicKeySize:] + } else { + ecdhShareData = clientKeyShare[:ke.ecdhElementSize] + mlkemShareData = clientKeyShare[ke.ecdhElementSize:] + } + var ( + ecdhSharedSecret []byte + ks keyShare + err error + ) + fips140.WithoutEnforcement(func() { // Hybrid of ML-KEM, which is Approved. + ecdhSharedSecret, ks, err = ke.ecdh.serverSharedSecret(rand, ecdhShareData) + }) + if err != nil { + return nil, keyShare{}, err + } + mlkemPeerKey, err := ke.newMLKEMPublicKey(mlkemShareData) + if err != nil { + return nil, keyShare{}, err + } + mlkemSharedSecret, mlkemKeyShare := mlkemPeerKey.Encapsulate() + var sharedKey []byte + if ke.id == X25519MLKEM768 { + sharedKey = append(mlkemSharedSecret, ecdhSharedSecret...) + ks.data = append(mlkemKeyShare, ks.data...) + } else { + sharedKey = append(ecdhSharedSecret, mlkemSharedSecret...) + ks.data = append(ks.data, mlkemKeyShare...) + } + ks.group = ke.id + return sharedKey, ks, nil +} + +func (ke *hybridKeyExchange) clientSharedSecret(priv *keySharePrivateKeys, serverKeyShare []byte) ([]byte, error) { + if len(serverKeyShare) != ke.ecdhElementSize+ke.mlkemCiphertextSize { + return nil, errors.New("tls: invalid server key share length for hybrid key exchange") + } + var ecdhShareData, mlkemShareData []byte + if ke.id == X25519MLKEM768 { + mlkemShareData = serverKeyShare[:ke.mlkemCiphertextSize] + ecdhShareData = serverKeyShare[ke.mlkemCiphertextSize:] + } else { + ecdhShareData = serverKeyShare[:ke.ecdhElementSize] + mlkemShareData = serverKeyShare[ke.ecdhElementSize:] + } + var ( + ecdhSharedSecret []byte + err error + ) + fips140.WithoutEnforcement(func() { // Hybrid of ML-KEM, which is Approved. + ecdhSharedSecret, err = ke.ecdh.clientSharedSecret(priv, ecdhShareData) + }) + if err != nil { + return nil, err + } + mlkemSharedSecret, err := priv.mlkem.Decapsulate(mlkemShareData) + if err != nil { + return nil, err + } + var sharedKey []byte + if ke.id == X25519MLKEM768 { + sharedKey = append(mlkemSharedSecret, ecdhSharedSecret...) + } else { + sharedKey = append(ecdhSharedSecret, mlkemSharedSecret...) + } + return sharedKey, nil +} diff --git a/go/src/crypto/tls/key_schedule_test.go b/go/src/crypto/tls/key_schedule_test.go new file mode 100644 index 0000000000000000000000000000000000000000..1710994d91c656704a5e26cf1b4bd6902e3c8a83 --- /dev/null +++ b/go/src/crypto/tls/key_schedule_test.go @@ -0,0 +1,119 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "bytes" + "crypto/internal/fips140/tls13" + "crypto/sha256" + "encoding/hex" + "strings" + "testing" + "unicode" +) + +func TestACVPVectors(t *testing.T) { + // https://github.com/usnistgov/ACVP-Server/blob/3a7333f63/gen-val/json-files/TLS-v1.3-KDF-RFC8446/prompt.json#L428-L436 + psk := fromHex("56288B726C73829F7A3E47B103837C8139ACF552E7530C7A710B35ED41191698") + dhe := fromHex("EFFE9EC26AA29FD750DFA6A10B944D74071595B27EE88887D5E11C84590B5CC3") + helloClientRandom := fromHex("E9137679E582BA7C1DB41CF725F86C6D09C8C05F297BAD9A65B552EAF524FDE4") + helloServerRandom := fromHex("23ECCFD030790748C8F8D8A656FD98D717F1B62AF3712F97211D2070B499F98A") + finishedClientRandom := fromHex("62A62FA75563ED4FDCAA0BC16567B314871C304ACF06B0FFC3F08C1797594D43") + finishedServerRandom := fromHex("C750EDA6696CD101B142BD79E00E6AC8C5F2C0ABC78DD64F4D991326659E9299") + + // https://github.com/usnistgov/ACVP-Server/blob/3a7333f63/gen-val/json-files/TLS-v1.3-KDF-RFC8446/expectedResults.json#L571-L581 + clientEarlyTrafficSecret := fromHex("3272189698C3594D18F58EFA3F12B638A249515099BE7A2FA9836BABE74F0111") + earlyExporterMasterSecret := fromHex("88E078F562CDC930219F6A5E98A1CE8C6E5F3DAC5AC516459A96F2EF8F114C66") + clientHandshakeTrafficSecret := fromHex("B32306C3CE9932C460A1FE6C0F060593974842036B96FA45049B7352E71C2AD2") + serverHandshakeTrafficSecret := fromHex("22787F8CA269D34BC549AC8BA19F2040938A3AA370D7CC9D60F720882B88D01B") + clientApplicationTrafficSecret := fromHex("47D7EA08397B5871154B0FE85584BCC30A87C69E84D69B56007C5B21F76493BA") + serverApplicationTrafficSecret := fromHex("EFBDB0C873C0480DA57307083839A8984BE25B9A8545E4FCA029940FE2800565") + exporterMasterSecret := fromHex("8A43D787EE3804EAD4A2A5B32972F9896B696295645D7222E1FD081DDD939834") + resumptionMasterSecret := fromHex("5F4C961329C91044011ACBECB0B289282E0E3FED045CB3EA924DFFE5FE654B3D") + + // The "Random" values are undocumented, but they are meant to be written to + // the hash in sequence to develop the transcript. + transcript := sha256.New() + + es := tls13.NewEarlySecret(sha256.New, psk) + + transcript.Write(helloClientRandom) + + if got := es.ClientEarlyTrafficSecret(transcript); !bytes.Equal(got, clientEarlyTrafficSecret) { + t.Errorf("clientEarlyTrafficSecret = %x, want %x", got, clientEarlyTrafficSecret) + } + if got := tls13.TestingOnlyExporterSecret(es.EarlyExporterMasterSecret(transcript)); !bytes.Equal(got, earlyExporterMasterSecret) { + t.Errorf("earlyExporterMasterSecret = %x, want %x", got, earlyExporterMasterSecret) + } + + hs := es.HandshakeSecret(dhe) + + transcript.Write(helloServerRandom) + + if got := hs.ClientHandshakeTrafficSecret(transcript); !bytes.Equal(got, clientHandshakeTrafficSecret) { + t.Errorf("clientHandshakeTrafficSecret = %x, want %x", got, clientHandshakeTrafficSecret) + } + if got := hs.ServerHandshakeTrafficSecret(transcript); !bytes.Equal(got, serverHandshakeTrafficSecret) { + t.Errorf("serverHandshakeTrafficSecret = %x, want %x", got, serverHandshakeTrafficSecret) + } + + ms := hs.MasterSecret() + + transcript.Write(finishedServerRandom) + + if got := ms.ClientApplicationTrafficSecret(transcript); !bytes.Equal(got, clientApplicationTrafficSecret) { + t.Errorf("clientApplicationTrafficSecret = %x, want %x", got, clientApplicationTrafficSecret) + } + if got := ms.ServerApplicationTrafficSecret(transcript); !bytes.Equal(got, serverApplicationTrafficSecret) { + t.Errorf("serverApplicationTrafficSecret = %x, want %x", got, serverApplicationTrafficSecret) + } + if got := tls13.TestingOnlyExporterSecret(ms.ExporterMasterSecret(transcript)); !bytes.Equal(got, exporterMasterSecret) { + t.Errorf("exporterMasterSecret = %x, want %x", got, exporterMasterSecret) + } + + transcript.Write(finishedClientRandom) + + if got := ms.ResumptionMasterSecret(transcript); !bytes.Equal(got, resumptionMasterSecret) { + t.Errorf("resumptionMasterSecret = %x, want %x", got, resumptionMasterSecret) + } +} + +// This file contains tests derived from draft-ietf-tls-tls13-vectors-07. + +func parseVector(v string) []byte { + v = strings.Map(func(c rune) rune { + if unicode.IsSpace(c) { + return -1 + } + return c + }, v) + parts := strings.Split(v, ":") + v = parts[len(parts)-1] + res, err := hex.DecodeString(v) + if err != nil { + panic(err) + } + return res +} + +func TestTrafficKey(t *testing.T) { + trafficSecret := parseVector( + `PRK (32 octets): b6 7b 7d 69 0c c1 6c 4e 75 e5 42 13 cb 2d 37 b4 + e9 c9 12 bc de d9 10 5d 42 be fd 59 d3 91 ad 38`) + wantKey := parseVector( + `key expanded (16 octets): 3f ce 51 60 09 c2 17 27 d0 f2 e4 e8 6e + e4 03 bc`) + wantIV := parseVector( + `iv expanded (12 octets): 5d 31 3e b2 67 12 76 ee 13 00 0b 30`) + + c := cipherSuitesTLS13[0] + gotKey, gotIV := c.trafficKey(trafficSecret) + if !bytes.Equal(gotKey, wantKey) { + t.Errorf("cipherSuiteTLS13.trafficKey() gotKey = % x, want % x", gotKey, wantKey) + } + if !bytes.Equal(gotIV, wantIV) { + t.Errorf("cipherSuiteTLS13.trafficKey() gotIV = % x, want % x", gotIV, wantIV) + } +} diff --git a/go/src/crypto/tls/link_test.go b/go/src/crypto/tls/link_test.go new file mode 100644 index 0000000000000000000000000000000000000000..cc681d1dfbd0d0a5f5aaf9f151f79b4f3900cbe1 --- /dev/null +++ b/go/src/crypto/tls/link_test.go @@ -0,0 +1,104 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "bytes" + "internal/testenv" + "os" + "path/filepath" + "testing" +) + +// Tests that the linker is able to remove references to the Client or Server if unused. +func TestLinkerGC(t *testing.T) { + if testing.Short() { + t.Skip("skipping in short mode") + } + t.Parallel() + + tests := []struct { + name string + program string + want []string + bad []string + }{ + { + name: "empty_import", + program: `package main +import _ "crypto/tls" +func main() {} +`, + bad: []string{ + "tls.(*Conn)", + "type:crypto/tls.clientHandshakeState", + "type:crypto/tls.serverHandshakeState", + }, + }, + { + name: "client_and_server", + program: `package main +import "crypto/tls" +func main() { + tls.Dial("", "", nil) + tls.Server(nil, nil) +} +`, + want: []string{ + "crypto/tls.(*Conn).clientHandshake", + "crypto/tls.(*Conn).serverHandshake", + }, + }, + { + name: "only_client", + program: `package main +import "crypto/tls" +func main() { tls.Dial("", "", nil) } +`, + want: []string{ + "crypto/tls.(*Conn).clientHandshake", + }, + bad: []string{ + "crypto/tls.(*Conn).serverHandshake", + }, + }, + // TODO: add only_server like func main() { tls.Server(nil, nil) } + // That currently brings in the client via Conn.handleRenegotiation. + + } + tmpDir := t.TempDir() + goFile := filepath.Join(tmpDir, "x.go") + exeFile := filepath.Join(tmpDir, "x.exe") + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if err := os.WriteFile(goFile, []byte(tt.program), 0644); err != nil { + t.Fatal(err) + } + os.Remove(exeFile) + cmd := testenv.Command(t, testenv.GoToolPath(t), "build", "-o", "x.exe", "x.go") + cmd.Dir = tmpDir + if out, err := cmd.CombinedOutput(); err != nil { + t.Fatalf("compile: %v\n%s", err, out) + } + + cmd = testenv.Command(t, testenv.GoToolPath(t), "tool", "nm", "x.exe") + cmd.Dir = tmpDir + nm, err := testenv.CleanCmdEnv(cmd).CombinedOutput() + if err != nil { + t.Fatalf("nm: %v\n%s", err, nm) + } + for _, sym := range tt.want { + if !bytes.Contains(nm, []byte(sym)) { + t.Errorf("expected symbol %q not found", sym) + } + } + for _, sym := range tt.bad { + if bytes.Contains(nm, []byte(sym)) { + t.Errorf("unexpected symbol %q found", sym) + } + } + }) + } +} diff --git a/go/src/crypto/tls/prf.go b/go/src/crypto/tls/prf.go new file mode 100644 index 0000000000000000000000000000000000000000..19f80ac2c91c208de582ce802e35517eeaac6934 --- /dev/null +++ b/go/src/crypto/tls/prf.go @@ -0,0 +1,282 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "crypto" + "crypto/hmac" + "crypto/internal/fips140/tls12" + "crypto/md5" + "crypto/sha1" + "crypto/sha256" + "crypto/sha512" + "errors" + "fmt" + "hash" +) + +type prfFunc func(secret []byte, label string, seed []byte, keyLen int) []byte + +// Split a premaster secret in two as specified in RFC 4346, Section 5. +func splitPreMasterSecret(secret []byte) (s1, s2 []byte) { + s1 = secret[0 : (len(secret)+1)/2] + s2 = secret[len(secret)/2:] + return +} + +// pHash implements the P_hash function, as defined in RFC 4346, Section 5. +func pHash(result, secret, seed []byte, hash func() hash.Hash) { + h := hmac.New(hash, secret) + h.Write(seed) + a := h.Sum(nil) + + j := 0 + for j < len(result) { + h.Reset() + h.Write(a) + h.Write(seed) + b := h.Sum(nil) + copy(result[j:], b) + j += len(b) + + h.Reset() + h.Write(a) + a = h.Sum(nil) + } +} + +// prf10 implements the TLS 1.0 pseudo-random function, as defined in RFC 2246, Section 5. +func prf10(secret []byte, label string, seed []byte, keyLen int) []byte { + result := make([]byte, keyLen) + hashSHA1 := sha1.New + hashMD5 := md5.New + + labelAndSeed := make([]byte, len(label)+len(seed)) + copy(labelAndSeed, label) + copy(labelAndSeed[len(label):], seed) + + s1, s2 := splitPreMasterSecret(secret) + pHash(result, s1, labelAndSeed, hashMD5) + result2 := make([]byte, len(result)) + pHash(result2, s2, labelAndSeed, hashSHA1) + + for i, b := range result2 { + result[i] ^= b + } + + return result +} + +// prf12 implements the TLS 1.2 pseudo-random function, as defined in RFC 5246, Section 5. +func prf12(hashFunc func() hash.Hash) prfFunc { + return func(secret []byte, label string, seed []byte, keyLen int) []byte { + return tls12.PRF(hashFunc, secret, label, seed, keyLen) + } +} + +const ( + masterSecretLength = 48 // Length of a master secret in TLS 1.1. + finishedVerifyLength = 12 // Length of verify_data in a Finished message. +) + +const masterSecretLabel = "master secret" +const extendedMasterSecretLabel = "extended master secret" +const keyExpansionLabel = "key expansion" +const clientFinishedLabel = "client finished" +const serverFinishedLabel = "server finished" + +func prfAndHashForVersion(version uint16, suite *cipherSuite) (prfFunc, crypto.Hash) { + switch version { + case VersionTLS10, VersionTLS11: + return prf10, crypto.Hash(0) + case VersionTLS12: + if suite.flags&suiteSHA384 != 0 { + return prf12(sha512.New384), crypto.SHA384 + } + return prf12(sha256.New), crypto.SHA256 + default: + panic("unknown version") + } +} + +func prfForVersion(version uint16, suite *cipherSuite) prfFunc { + prf, _ := prfAndHashForVersion(version, suite) + return prf +} + +// masterFromPreMasterSecret generates the master secret from the pre-master +// secret. See RFC 5246, Section 8.1. +func masterFromPreMasterSecret(version uint16, suite *cipherSuite, preMasterSecret, clientRandom, serverRandom []byte) []byte { + seed := make([]byte, 0, len(clientRandom)+len(serverRandom)) + seed = append(seed, clientRandom...) + seed = append(seed, serverRandom...) + + return prfForVersion(version, suite)(preMasterSecret, masterSecretLabel, seed, masterSecretLength) +} + +// extMasterFromPreMasterSecret generates the extended master secret from the +// pre-master secret. See RFC 7627. +func extMasterFromPreMasterSecret(version uint16, suite *cipherSuite, preMasterSecret, transcript []byte) []byte { + prf, hash := prfAndHashForVersion(version, suite) + if version == VersionTLS12 { + // Use the FIPS 140-3 module only for TLS 1.2 with EMS, which is the + // only TLS 1.0-1.2 approved mode per IG D.Q. + return tls12.MasterSecret(hash.New, preMasterSecret, transcript) + } + return prf(preMasterSecret, extendedMasterSecretLabel, transcript, masterSecretLength) +} + +// keysFromMasterSecret generates the connection keys from the master +// secret, given the lengths of the MAC key, cipher key and IV, as defined in +// RFC 2246, Section 6.3. +func keysFromMasterSecret(version uint16, suite *cipherSuite, masterSecret, clientRandom, serverRandom []byte, macLen, keyLen, ivLen int) (clientMAC, serverMAC, clientKey, serverKey, clientIV, serverIV []byte) { + seed := make([]byte, 0, len(serverRandom)+len(clientRandom)) + seed = append(seed, serverRandom...) + seed = append(seed, clientRandom...) + + n := 2*macLen + 2*keyLen + 2*ivLen + keyMaterial := prfForVersion(version, suite)(masterSecret, keyExpansionLabel, seed, n) + clientMAC = keyMaterial[:macLen] + keyMaterial = keyMaterial[macLen:] + serverMAC = keyMaterial[:macLen] + keyMaterial = keyMaterial[macLen:] + clientKey = keyMaterial[:keyLen] + keyMaterial = keyMaterial[keyLen:] + serverKey = keyMaterial[:keyLen] + keyMaterial = keyMaterial[keyLen:] + clientIV = keyMaterial[:ivLen] + keyMaterial = keyMaterial[ivLen:] + serverIV = keyMaterial[:ivLen] + return +} + +func newFinishedHash(version uint16, cipherSuite *cipherSuite) finishedHash { + var buffer []byte + if version >= VersionTLS12 { + buffer = []byte{} + } + + prf, hash := prfAndHashForVersion(version, cipherSuite) + if hash != 0 { + return finishedHash{hash.New(), hash.New(), nil, nil, buffer, version, prf} + } + + return finishedHash{sha1.New(), sha1.New(), md5.New(), md5.New(), buffer, version, prf} +} + +// A finishedHash calculates the hash of a set of handshake messages suitable +// for including in a Finished message. +type finishedHash struct { + client hash.Hash + server hash.Hash + + // Prior to TLS 1.2, an additional MD5 hash is required. + clientMD5 hash.Hash + serverMD5 hash.Hash + + // In TLS 1.2, a full buffer is sadly required. + buffer []byte + + version uint16 + prf prfFunc +} + +func (h *finishedHash) Write(msg []byte) (n int, err error) { + h.client.Write(msg) + h.server.Write(msg) + + if h.version < VersionTLS12 { + h.clientMD5.Write(msg) + h.serverMD5.Write(msg) + } + + if h.buffer != nil { + h.buffer = append(h.buffer, msg...) + } + + return len(msg), nil +} + +func (h finishedHash) Sum() []byte { + if h.version >= VersionTLS12 { + return h.client.Sum(nil) + } + + out := make([]byte, 0, md5.Size+sha1.Size) + out = h.clientMD5.Sum(out) + return h.client.Sum(out) +} + +// clientSum returns the contents of the verify_data member of a client's +// Finished message. +func (h finishedHash) clientSum(masterSecret []byte) []byte { + return h.prf(masterSecret, clientFinishedLabel, h.Sum(), finishedVerifyLength) +} + +// serverSum returns the contents of the verify_data member of a server's +// Finished message. +func (h finishedHash) serverSum(masterSecret []byte) []byte { + return h.prf(masterSecret, serverFinishedLabel, h.Sum(), finishedVerifyLength) +} + +// hashForClientCertificate returns the handshake messages so far, pre-hashed, +// suitable for signing by a TLS 1.0 and 1.1 client certificate. +func (h finishedHash) hashForClientCertificate(sigType uint8) []byte { + if sigType == signatureECDSA { + return h.server.Sum(nil) + } + + return h.Sum() +} + +// discardHandshakeBuffer is called when there is no more need to +// buffer the entirety of the handshake messages. +func (h *finishedHash) discardHandshakeBuffer() { + h.buffer = nil +} + +// noEKMBecauseRenegotiation is used as a value of +// ConnectionState.ekm when renegotiation is enabled and thus +// we wish to fail all key-material export requests. +func noEKMBecauseRenegotiation(label string, context []byte, length int) ([]byte, error) { + return nil, errors.New("crypto/tls: ExportKeyingMaterial is unavailable when renegotiation is enabled") +} + +// noEKMBecauseNoEMS is used as a value of ConnectionState.ekm when Extended +// Master Secret is not negotiated and thus we wish to fail all key-material +// export requests. +func noEKMBecauseNoEMS(label string, context []byte, length int) ([]byte, error) { + return nil, errors.New("crypto/tls: ExportKeyingMaterial is unavailable when neither TLS 1.3 nor Extended Master Secret are negotiated; override with GODEBUG=tlsunsafeekm=1") +} + +// ekmFromMasterSecret generates exported keying material as defined in RFC 5705. +func ekmFromMasterSecret(version uint16, suite *cipherSuite, masterSecret, clientRandom, serverRandom []byte) func(string, []byte, int) ([]byte, error) { + return func(label string, context []byte, length int) ([]byte, error) { + switch label { + case "client finished", "server finished", "master secret", "key expansion": + // These values are reserved and may not be used. + return nil, fmt.Errorf("crypto/tls: reserved ExportKeyingMaterial label: %s", label) + } + + seedLen := len(serverRandom) + len(clientRandom) + if context != nil { + seedLen += 2 + len(context) + } + seed := make([]byte, 0, seedLen) + + seed = append(seed, clientRandom...) + seed = append(seed, serverRandom...) + + if context != nil { + if len(context) >= 1<<16 { + return nil, fmt.Errorf("crypto/tls: ExportKeyingMaterial context too long") + } + seed = append(seed, byte(len(context)>>8), byte(len(context))) + seed = append(seed, context...) + } + + return prfForVersion(version, suite)(masterSecret, label, seed, length), nil + } +} diff --git a/go/src/crypto/tls/prf_test.go b/go/src/crypto/tls/prf_test.go new file mode 100644 index 0000000000000000000000000000000000000000..8233985a62bd22532555aa1eb1d5b57c699be507 --- /dev/null +++ b/go/src/crypto/tls/prf_test.go @@ -0,0 +1,140 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "encoding/hex" + "testing" +) + +type testSplitPreMasterSecretTest struct { + in, out1, out2 string +} + +var testSplitPreMasterSecretTests = []testSplitPreMasterSecretTest{ + {"", "", ""}, + {"00", "00", "00"}, + {"0011", "00", "11"}, + {"001122", "0011", "1122"}, + {"00112233", "0011", "2233"}, +} + +func TestSplitPreMasterSecret(t *testing.T) { + for i, test := range testSplitPreMasterSecretTests { + in, _ := hex.DecodeString(test.in) + out1, out2 := splitPreMasterSecret(in) + s1 := hex.EncodeToString(out1) + s2 := hex.EncodeToString(out2) + if s1 != test.out1 || s2 != test.out2 { + t.Errorf("#%d: got: (%s, %s) want: (%s, %s)", i, s1, s2, test.out1, test.out2) + } + } +} + +type testKeysFromTest struct { + version uint16 + suite *cipherSuite + preMasterSecret string + clientRandom, serverRandom string + masterSecret string + clientMAC, serverMAC string + clientKey, serverKey string + macLen, keyLen int + contextKeyingMaterial, noContextKeyingMaterial string +} + +func TestKeysFromPreMasterSecret(t *testing.T) { + for i, test := range testKeysFromTests { + in, _ := hex.DecodeString(test.preMasterSecret) + clientRandom, _ := hex.DecodeString(test.clientRandom) + serverRandom, _ := hex.DecodeString(test.serverRandom) + + masterSecret := masterFromPreMasterSecret(test.version, test.suite, in, clientRandom, serverRandom) + if s := hex.EncodeToString(masterSecret); s != test.masterSecret { + t.Errorf("#%d: bad master secret %s, want %s", i, s, test.masterSecret) + continue + } + + clientMAC, serverMAC, clientKey, serverKey, _, _ := keysFromMasterSecret(test.version, test.suite, masterSecret, clientRandom, serverRandom, test.macLen, test.keyLen, 0) + clientMACString := hex.EncodeToString(clientMAC) + serverMACString := hex.EncodeToString(serverMAC) + clientKeyString := hex.EncodeToString(clientKey) + serverKeyString := hex.EncodeToString(serverKey) + if clientMACString != test.clientMAC || + serverMACString != test.serverMAC || + clientKeyString != test.clientKey || + serverKeyString != test.serverKey { + t.Errorf("#%d: got: (%s, %s, %s, %s) want: (%s, %s, %s, %s)", i, clientMACString, serverMACString, clientKeyString, serverKeyString, test.clientMAC, test.serverMAC, test.clientKey, test.serverKey) + } + + ekm := ekmFromMasterSecret(test.version, test.suite, masterSecret, clientRandom, serverRandom) + contextKeyingMaterial, err := ekm("label", []byte("context"), 32) + if err != nil { + t.Fatalf("ekmFromMasterSecret failed: %v", err) + } + + noContextKeyingMaterial, err := ekm("label", nil, 32) + if err != nil { + t.Fatalf("ekmFromMasterSecret failed: %v", err) + } + + if hex.EncodeToString(contextKeyingMaterial) != test.contextKeyingMaterial || + hex.EncodeToString(noContextKeyingMaterial) != test.noContextKeyingMaterial { + t.Errorf("#%d: got keying material: (%s, %s) want: (%s, %s)", i, contextKeyingMaterial, noContextKeyingMaterial, test.contextKeyingMaterial, test.noContextKeyingMaterial) + } + } +} + +// These test vectors were generated from GnuTLS using `gnutls-cli --insecure -d 9 ` +var testKeysFromTests = []testKeysFromTest{ + { + VersionTLS10, + cipherSuiteByID(TLS_RSA_WITH_RC4_128_SHA), + "0302cac83ad4b1db3b9ab49ad05957de2a504a634a386fc600889321e1a971f57479466830ac3e6f468e87f5385fa0c5", + "4ae66303755184a3917fcb44880605fcc53baa01912b22ed94473fc69cebd558", + "4ae663020ec16e6bb5130be918cfcafd4d765979a3136a5d50c593446e4e44db", + "3d851bab6e5556e959a16bc36d66cfae32f672bfa9ecdef6096cbb1b23472df1da63dbbd9827606413221d149ed08ceb", + "805aaa19b3d2c0a0759a4b6c9959890e08480119", + "2d22f9fe519c075c16448305ceee209fc24ad109", + "d50b5771244f850cd8117a9ccafe2cf1", + "e076e33206b30507a85c32855acd0919", + 20, + 16, + "4d1bb6fc278c37d27aa6e2a13c2e079095d143272c2aa939da33d88c1c0cec22", + "93fba89599b6321ae538e27c6548ceb8b46821864318f5190d64a375e5d69d41", + }, + { + VersionTLS10, + cipherSuiteByID(TLS_RSA_WITH_RC4_128_SHA), + "03023f7527316bc12cbcd69e4b9e8275d62c028f27e65c745cfcddc7ce01bd3570a111378b63848127f1c36e5f9e4890", + "4ae66364b5ea56b20ce4e25555aed2d7e67f42788dd03f3fee4adae0459ab106", + "4ae66363ab815cbf6a248b87d6b556184e945e9b97fbdf247858b0bdafacfa1c", + "7d64be7c80c59b740200b4b9c26d0baaa1c5ae56705acbcf2307fe62beb4728c19392c83f20483801cce022c77645460", + "97742ed60a0554ca13f04f97ee193177b971e3b0", + "37068751700400e03a8477a5c7eec0813ab9e0dc", + "207cddbc600d2a200abac6502053ee5c", + "df3f94f6e1eacc753b815fe16055cd43", + 20, + 16, + "2c9f8961a72b97cbe76553b5f954caf8294fc6360ef995ac1256fe9516d0ce7f", + "274f19c10291d188857ad8878e2119f5aa437d4da556601cf1337aff23154016", + }, + { + VersionTLS10, + cipherSuiteByID(TLS_RSA_WITH_RC4_128_SHA), + "832d515f1d61eebb2be56ba0ef79879efb9b527504abb386fb4310ed5d0e3b1f220d3bb6b455033a2773e6d8bdf951d278a187482b400d45deb88a5d5a6bb7d6a7a1decc04eb9ef0642876cd4a82d374d3b6ff35f0351dc5d411104de431375355addc39bfb1f6329fb163b0bc298d658338930d07d313cd980a7e3d9196cac1", + "4ae663b2ee389c0de147c509d8f18f5052afc4aaf9699efe8cb05ece883d3a5e", + "4ae664d503fd4cff50cfc1fb8fc606580f87b0fcdac9554ba0e01d785bdf278e", + "1aff2e7a2c4279d0126f57a65a77a8d9d0087cf2733366699bec27eb53d5740705a8574bb1acc2abbe90e44f0dd28d6c", + "3c7647c93c1379a31a609542aa44e7f117a70085", + "0d73102994be74a575a3ead8532590ca32a526d4", + "ac7581b0b6c10d85bbd905ffbf36c65e", + "ff07edde49682b45466bd2e39464b306", + 20, + 16, + "678b0d43f607de35241dc7e9d1a7388a52c35033a1a0336d4d740060a6638fe2", + "f3b4ac743f015ef21d79978297a53da3e579ee047133f38c234d829c0f907dab", + }, +} diff --git a/go/src/crypto/tls/quic.go b/go/src/crypto/tls/quic.go new file mode 100644 index 0000000000000000000000000000000000000000..c7d8508acb7be6a79c6f72a5946b10f83d85958c --- /dev/null +++ b/go/src/crypto/tls/quic.go @@ -0,0 +1,527 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "context" + "errors" + "fmt" +) + +// QUICEncryptionLevel represents a QUIC encryption level used to transmit +// handshake messages. +type QUICEncryptionLevel int + +const ( + QUICEncryptionLevelInitial = QUICEncryptionLevel(iota) + QUICEncryptionLevelEarly + QUICEncryptionLevelHandshake + QUICEncryptionLevelApplication +) + +func (l QUICEncryptionLevel) String() string { + switch l { + case QUICEncryptionLevelInitial: + return "Initial" + case QUICEncryptionLevelEarly: + return "Early" + case QUICEncryptionLevelHandshake: + return "Handshake" + case QUICEncryptionLevelApplication: + return "Application" + default: + return fmt.Sprintf("QUICEncryptionLevel(%v)", int(l)) + } +} + +// A QUICConn represents a connection which uses a QUIC implementation as the underlying +// transport as described in RFC 9001. +// +// Methods of QUICConn are not safe for concurrent use. +type QUICConn struct { + conn *Conn + + sessionTicketSent bool +} + +// A QUICConfig configures a [QUICConn]. +type QUICConfig struct { + TLSConfig *Config + + // EnableSessionEvents may be set to true to enable the + // [QUICStoreSession] and [QUICResumeSession] events for client connections. + // When this event is enabled, sessions are not automatically + // stored in the client session cache. + // The application should use [QUICConn.StoreSession] to store sessions. + EnableSessionEvents bool +} + +// A QUICEventKind is a type of operation on a QUIC connection. +type QUICEventKind int + +const ( + // QUICNoEvent indicates that there are no events available. + QUICNoEvent QUICEventKind = iota + + // QUICSetReadSecret and QUICSetWriteSecret provide the read and write + // secrets for a given encryption level. + // QUICEvent.Level, QUICEvent.Data, and QUICEvent.Suite are set. + // + // Secrets for the Initial encryption level are derived from the initial + // destination connection ID, and are not provided by the QUICConn. + QUICSetReadSecret + QUICSetWriteSecret + + // QUICWriteData provides data to send to the peer in CRYPTO frames. + // QUICEvent.Data is set. + QUICWriteData + + // QUICTransportParameters provides the peer's QUIC transport parameters. + // QUICEvent.Data is set. + QUICTransportParameters + + // QUICTransportParametersRequired indicates that the caller must provide + // QUIC transport parameters to send to the peer. The caller should set + // the transport parameters with QUICConn.SetTransportParameters and call + // QUICConn.NextEvent again. + // + // If transport parameters are set before calling QUICConn.Start, the + // connection will never generate a QUICTransportParametersRequired event. + QUICTransportParametersRequired + + // QUICRejectedEarlyData indicates that the server rejected 0-RTT data even + // if we offered it. It's returned before QUICEncryptionLevelApplication + // keys are returned. + // This event only occurs on client connections. + QUICRejectedEarlyData + + // QUICHandshakeDone indicates that the TLS handshake has completed. + QUICHandshakeDone + + // QUICResumeSession indicates that a client is attempting to resume a previous session. + // [QUICEvent.SessionState] is set. + // + // For client connections, this event occurs when the session ticket is selected. + // For server connections, this event occurs when receiving the client's session ticket. + // + // The application may set [QUICEvent.SessionState.EarlyData] to false before the + // next call to [QUICConn.NextEvent] to decline 0-RTT even if the session supports it. + QUICResumeSession + + // QUICStoreSession indicates that the server has provided state permitting + // the client to resume the session. + // [QUICEvent.SessionState] is set. + // The application should use [QUICConn.StoreSession] session to store the [SessionState]. + // The application may modify the [SessionState] before storing it. + // This event only occurs on client connections. + QUICStoreSession + + // QUICErrorEvent indicates that a fatal error has occurred. + // The handshake cannot proceed and the connection must be closed. + // QUICEvent.Err is set. + QUICErrorEvent +) + +// A QUICEvent is an event occurring on a QUIC connection. +// +// The type of event is specified by the Kind field. +// The contents of the other fields are kind-specific. +type QUICEvent struct { + Kind QUICEventKind + + // Set for QUICSetReadSecret, QUICSetWriteSecret, and QUICWriteData. + Level QUICEncryptionLevel + + // Set for QUICTransportParameters, QUICSetReadSecret, QUICSetWriteSecret, and QUICWriteData. + // The contents are owned by crypto/tls, and are valid until the next NextEvent call. + Data []byte + + // Set for QUICSetReadSecret and QUICSetWriteSecret. + Suite uint16 + + // Set for QUICResumeSession and QUICStoreSession. + SessionState *SessionState + + // Set for QUICErrorEvent. + // The error will wrap AlertError. + Err error +} + +type quicState struct { + events []QUICEvent + nextEvent int + + // eventArr is a statically allocated event array, large enough to handle + // the usual maximum number of events resulting from a single call: transport + // parameters, Initial data, Early read secret, Handshake write and read + // secrets, Handshake data, Application write secret, Application data. + eventArr [8]QUICEvent + + started bool + signalc chan struct{} // handshake data is available to be read + blockedc chan struct{} // handshake is waiting for data, closed when done + ctx context.Context // handshake context + cancel context.CancelFunc + + waitingForDrain bool + errorReturned bool + + // readbuf is shared between HandleData and the handshake goroutine. + // HandshakeCryptoData passes ownership to the handshake goroutine by + // reading from signalc, and reclaims ownership by reading from blockedc. + readbuf []byte + + transportParams []byte // to send to the peer + + enableSessionEvents bool +} + +// QUICClient returns a new TLS client side connection using QUICTransport as the +// underlying transport. The config cannot be nil. +// +// The config's MinVersion must be at least TLS 1.3. +func QUICClient(config *QUICConfig) *QUICConn { + return newQUICConn(Client(nil, config.TLSConfig), config) +} + +// QUICServer returns a new TLS server side connection using QUICTransport as the +// underlying transport. The config cannot be nil. +// +// The config's MinVersion must be at least TLS 1.3. +func QUICServer(config *QUICConfig) *QUICConn { + return newQUICConn(Server(nil, config.TLSConfig), config) +} + +func newQUICConn(conn *Conn, config *QUICConfig) *QUICConn { + conn.quic = &quicState{ + signalc: make(chan struct{}), + blockedc: make(chan struct{}), + enableSessionEvents: config.EnableSessionEvents, + } + conn.quic.events = conn.quic.eventArr[:0] + return &QUICConn{ + conn: conn, + } +} + +// Start starts the client or server handshake protocol. +// It may produce connection events, which may be read with [QUICConn.NextEvent]. +// +// Start must be called at most once. +func (q *QUICConn) Start(ctx context.Context) error { + if q.conn.quic.started { + return quicError(errors.New("tls: Start called more than once")) + } + q.conn.quic.started = true + if q.conn.config.MinVersion < VersionTLS13 { + return quicError(errors.New("tls: Config MinVersion must be at least TLS 1.3")) + } + go q.conn.HandshakeContext(ctx) + if _, ok := <-q.conn.quic.blockedc; !ok { + return q.conn.handshakeErr + } + return nil +} + +// NextEvent returns the next event occurring on the connection. +// It returns an event with a Kind of [QUICNoEvent] when no events are available. +func (q *QUICConn) NextEvent() QUICEvent { + qs := q.conn.quic + if last := qs.nextEvent - 1; last >= 0 && len(qs.events[last].Data) > 0 { + // Write over some of the previous event's data, + // to catch callers erroneously retaining it. + qs.events[last].Data[0] = 0 + } + if qs.nextEvent >= len(qs.events) && qs.waitingForDrain { + qs.waitingForDrain = false + <-qs.signalc + <-qs.blockedc + } + if err := q.conn.handshakeErr; err != nil { + if qs.errorReturned { + return QUICEvent{Kind: QUICNoEvent} + } + qs.errorReturned = true + qs.events = nil + qs.nextEvent = 0 + return QUICEvent{Kind: QUICErrorEvent, Err: q.conn.handshakeErr} + } + if qs.nextEvent >= len(qs.events) { + qs.events = qs.events[:0] + qs.nextEvent = 0 + return QUICEvent{Kind: QUICNoEvent} + } + e := qs.events[qs.nextEvent] + qs.events[qs.nextEvent] = QUICEvent{} // zero out references to data + qs.nextEvent++ + return e +} + +// Close closes the connection and stops any in-progress handshake. +func (q *QUICConn) Close() error { + if q.conn.quic.ctx == nil { + return nil // never started + } + q.conn.quic.cancel() + <-q.conn.quic.signalc + for range q.conn.quic.blockedc { + // Wait for the handshake goroutine to return. + } + return q.conn.handshakeErr +} + +// HandleData handles handshake bytes received from the peer. +// It may produce connection events, which may be read with [QUICConn.NextEvent]. +func (q *QUICConn) HandleData(level QUICEncryptionLevel, data []byte) error { + c := q.conn + if c.in.level != level { + return quicError(c.in.setErrorLocked(errors.New("tls: handshake data received at wrong level"))) + } + c.quic.readbuf = data + <-c.quic.signalc + _, ok := <-c.quic.blockedc + if ok { + // The handshake goroutine is waiting for more data. + return nil + } + // The handshake goroutine has exited. + c.handshakeMutex.Lock() + defer c.handshakeMutex.Unlock() + c.hand.Write(c.quic.readbuf) + c.quic.readbuf = nil + for q.conn.hand.Len() >= 4 && q.conn.handshakeErr == nil { + b := q.conn.hand.Bytes() + n := int(b[1])<<16 | int(b[2])<<8 | int(b[3]) + if n > maxHandshake { + q.conn.handshakeErr = fmt.Errorf("tls: handshake message of length %d bytes exceeds maximum of %d bytes", n, maxHandshake) + break + } + if len(b) < 4+n { + return nil + } + if err := q.conn.handlePostHandshakeMessage(); err != nil { + q.conn.handshakeErr = err + } + } + if q.conn.handshakeErr != nil { + return quicError(q.conn.handshakeErr) + } + return nil +} + +type QUICSessionTicketOptions struct { + // EarlyData specifies whether the ticket may be used for 0-RTT. + EarlyData bool + Extra [][]byte +} + +// SendSessionTicket sends a session ticket to the client. +// It produces connection events, which may be read with [QUICConn.NextEvent]. +// Currently, it can only be called once. +func (q *QUICConn) SendSessionTicket(opts QUICSessionTicketOptions) error { + c := q.conn + if c.config.SessionTicketsDisabled { + return nil + } + if !c.isHandshakeComplete.Load() { + return quicError(errors.New("tls: SendSessionTicket called before handshake completed")) + } + if c.isClient { + return quicError(errors.New("tls: SendSessionTicket called on the client")) + } + if q.sessionTicketSent { + return quicError(errors.New("tls: SendSessionTicket called multiple times")) + } + q.sessionTicketSent = true + return quicError(c.sendSessionTicket(opts.EarlyData, opts.Extra)) +} + +// StoreSession stores a session previously received in a QUICStoreSession event +// in the ClientSessionCache. +// The application may process additional events or modify the SessionState +// before storing the session. +func (q *QUICConn) StoreSession(session *SessionState) error { + c := q.conn + if !c.isClient { + return quicError(errors.New("tls: StoreSessionTicket called on the server")) + } + cacheKey := c.clientSessionCacheKey() + if cacheKey == "" { + return nil + } + cs := &ClientSessionState{session: session} + c.config.ClientSessionCache.Put(cacheKey, cs) + return nil +} + +// ConnectionState returns basic TLS details about the connection. +func (q *QUICConn) ConnectionState() ConnectionState { + return q.conn.ConnectionState() +} + +// SetTransportParameters sets the transport parameters to send to the peer. +// +// Server connections may delay setting the transport parameters until after +// receiving the client's transport parameters. See [QUICTransportParametersRequired]. +func (q *QUICConn) SetTransportParameters(params []byte) { + if params == nil { + params = []byte{} + } + q.conn.quic.transportParams = params + if q.conn.quic.started { + <-q.conn.quic.signalc + <-q.conn.quic.blockedc + } +} + +// quicError ensures err is an AlertError. +// If err is not already, quicError wraps it with alertInternalError. +func quicError(err error) error { + if err == nil { + return nil + } + if _, ok := errors.AsType[AlertError](err); ok { + return err + } + a, ok := errors.AsType[alert](err) + if !ok { + a = alertInternalError + } + // Return an error wrapping the original error and an AlertError. + // Truncate the text of the alert to 0 characters. + return fmt.Errorf("%w%.0w", err, AlertError(a)) +} + +func (c *Conn) quicReadHandshakeBytes(n int) error { + for c.hand.Len() < n { + if err := c.quicWaitForSignal(); err != nil { + return err + } + } + return nil +} + +func (c *Conn) quicSetReadSecret(level QUICEncryptionLevel, suite uint16, secret []byte) error { + // Ensure that there are no buffered handshake messages before changing the + // read keys, since that can cause messages to be parsed that were encrypted + // using old keys which are no longer appropriate. + // TODO(roland): we should merge this check with the similar one in setReadTrafficSecret. + if c.hand.Len() != 0 { + c.sendAlert(alertUnexpectedMessage) + return errors.New("tls: handshake buffer not empty before setting read traffic secret") + } + c.quic.events = append(c.quic.events, QUICEvent{ + Kind: QUICSetReadSecret, + Level: level, + Suite: suite, + Data: secret, + }) + return nil +} + +func (c *Conn) quicSetWriteSecret(level QUICEncryptionLevel, suite uint16, secret []byte) { + c.quic.events = append(c.quic.events, QUICEvent{ + Kind: QUICSetWriteSecret, + Level: level, + Suite: suite, + Data: secret, + }) +} + +func (c *Conn) quicWriteCryptoData(level QUICEncryptionLevel, data []byte) { + var last *QUICEvent + if len(c.quic.events) > 0 { + last = &c.quic.events[len(c.quic.events)-1] + } + if last == nil || last.Kind != QUICWriteData || last.Level != level { + c.quic.events = append(c.quic.events, QUICEvent{ + Kind: QUICWriteData, + Level: level, + }) + last = &c.quic.events[len(c.quic.events)-1] + } + last.Data = append(last.Data, data...) +} + +func (c *Conn) quicResumeSession(session *SessionState) error { + c.quic.events = append(c.quic.events, QUICEvent{ + Kind: QUICResumeSession, + SessionState: session, + }) + c.quic.waitingForDrain = true + for c.quic.waitingForDrain { + if err := c.quicWaitForSignal(); err != nil { + return err + } + } + return nil +} + +func (c *Conn) quicStoreSession(session *SessionState) { + c.quic.events = append(c.quic.events, QUICEvent{ + Kind: QUICStoreSession, + SessionState: session, + }) +} + +func (c *Conn) quicSetTransportParameters(params []byte) { + c.quic.events = append(c.quic.events, QUICEvent{ + Kind: QUICTransportParameters, + Data: params, + }) +} + +func (c *Conn) quicGetTransportParameters() ([]byte, error) { + if c.quic.transportParams == nil { + c.quic.events = append(c.quic.events, QUICEvent{ + Kind: QUICTransportParametersRequired, + }) + } + for c.quic.transportParams == nil { + if err := c.quicWaitForSignal(); err != nil { + return nil, err + } + } + return c.quic.transportParams, nil +} + +func (c *Conn) quicHandshakeComplete() { + c.quic.events = append(c.quic.events, QUICEvent{ + Kind: QUICHandshakeDone, + }) +} + +func (c *Conn) quicRejectedEarlyData() { + c.quic.events = append(c.quic.events, QUICEvent{ + Kind: QUICRejectedEarlyData, + }) +} + +// quicWaitForSignal notifies the QUICConn that handshake progress is blocked, +// and waits for a signal that the handshake should proceed. +// +// The handshake may become blocked waiting for handshake bytes +// or for the user to provide transport parameters. +func (c *Conn) quicWaitForSignal() error { + // Drop the handshake mutex while blocked to allow the user + // to call ConnectionState before the handshake completes. + c.handshakeMutex.Unlock() + defer c.handshakeMutex.Lock() + // Send on blockedc to notify the QUICConn that the handshake is blocked. + // Exported methods of QUICConn wait for the handshake to become blocked + // before returning to the user. + c.quic.blockedc <- struct{}{} + // The QUICConn reads from signalc to notify us that the handshake may + // be able to proceed. (The QUICConn reads, because we close signalc to + // indicate that the handshake has completed.) + c.quic.signalc <- struct{}{} + if c.quic.ctx.Err() != nil { + // The connection has been canceled. + return c.sendAlertLocked(alertCloseNotify) + } + c.hand.Write(c.quic.readbuf) + c.quic.readbuf = nil + return nil +} diff --git a/go/src/crypto/tls/quic_test.go b/go/src/crypto/tls/quic_test.go new file mode 100644 index 0000000000000000000000000000000000000000..0cf8b337e161c96545dd3307a9c1fb2470735bbb --- /dev/null +++ b/go/src/crypto/tls/quic_test.go @@ -0,0 +1,706 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "bytes" + "context" + "errors" + "fmt" + "reflect" + "strings" + "sync" + "testing" +) + +type testQUICConn struct { + t *testing.T + conn *QUICConn + readSecret map[QUICEncryptionLevel]suiteSecret + writeSecret map[QUICEncryptionLevel]suiteSecret + ticketOpts QUICSessionTicketOptions + onResumeSession func(*SessionState) + gotParams []byte + gotError error + earlyDataRejected bool + complete bool +} + +func newTestQUICClient(t *testing.T, config *QUICConfig) *testQUICConn { + q := &testQUICConn{ + t: t, + conn: QUICClient(config), + } + t.Cleanup(func() { + q.conn.Close() + }) + return q +} + +func newTestQUICServer(t *testing.T, config *QUICConfig) *testQUICConn { + q := &testQUICConn{ + t: t, + conn: QUICServer(config), + } + t.Cleanup(func() { + q.conn.Close() + }) + return q +} + +type suiteSecret struct { + suite uint16 + secret []byte +} + +func (q *testQUICConn) setReadSecret(level QUICEncryptionLevel, suite uint16, secret []byte) { + if _, ok := q.writeSecret[level]; !ok && level != QUICEncryptionLevelEarly { + q.t.Errorf("SetReadSecret for level %v called before SetWriteSecret", level) + } + if level == QUICEncryptionLevelApplication && !q.complete { + q.t.Errorf("SetReadSecret for level %v called before HandshakeComplete", level) + } + if _, ok := q.readSecret[level]; ok { + q.t.Errorf("SetReadSecret for level %v called twice", level) + } + if q.readSecret == nil { + q.readSecret = map[QUICEncryptionLevel]suiteSecret{} + } + switch level { + case QUICEncryptionLevelHandshake, + QUICEncryptionLevelEarly, + QUICEncryptionLevelApplication: + q.readSecret[level] = suiteSecret{suite, secret} + default: + q.t.Errorf("SetReadSecret for unexpected level %v", level) + } +} + +func (q *testQUICConn) setWriteSecret(level QUICEncryptionLevel, suite uint16, secret []byte) { + if _, ok := q.writeSecret[level]; ok { + q.t.Errorf("SetWriteSecret for level %v called twice", level) + } + if q.writeSecret == nil { + q.writeSecret = map[QUICEncryptionLevel]suiteSecret{} + } + switch level { + case QUICEncryptionLevelHandshake, + QUICEncryptionLevelEarly, + QUICEncryptionLevelApplication: + q.writeSecret[level] = suiteSecret{suite, secret} + default: + q.t.Errorf("SetWriteSecret for unexpected level %v", level) + } +} + +var errTransportParametersRequired = errors.New("transport parameters required") + +func runTestQUICConnection(ctx context.Context, cli, srv *testQUICConn, onEvent func(e QUICEvent, src, dst *testQUICConn) bool) error { + a, b := cli, srv + for _, c := range []*testQUICConn{a, b} { + if !c.conn.conn.quic.started { + if err := c.conn.Start(ctx); err != nil { + return err + } + } + } + idleCount := 0 + for { + e := a.conn.NextEvent() + if onEvent != nil && onEvent(e, a, b) { + continue + } + if a.gotError != nil && e.Kind != QUICNoEvent { + return fmt.Errorf("unexpected event %v after QUICErrorEvent", e.Kind) + } + switch e.Kind { + case QUICNoEvent: + idleCount++ + if idleCount == 2 { + if !a.complete || !b.complete { + return errors.New("handshake incomplete") + } + return nil + } + a, b = b, a + case QUICSetReadSecret: + a.setReadSecret(e.Level, e.Suite, e.Data) + case QUICSetWriteSecret: + a.setWriteSecret(e.Level, e.Suite, e.Data) + case QUICWriteData: + if err := b.conn.HandleData(e.Level, e.Data); err != nil { + return err + } + case QUICTransportParameters: + a.gotParams = e.Data + if a.gotParams == nil { + a.gotParams = []byte{} + } + case QUICTransportParametersRequired: + return errTransportParametersRequired + case QUICHandshakeDone: + a.complete = true + if a == srv { + if err := srv.conn.SendSessionTicket(srv.ticketOpts); err != nil { + return err + } + } + case QUICStoreSession: + if a != cli { + return errors.New("unexpected QUICStoreSession event received by server") + } + a.conn.StoreSession(e.SessionState) + case QUICResumeSession: + if a.onResumeSession != nil { + a.onResumeSession(e.SessionState) + } + case QUICRejectedEarlyData: + a.earlyDataRejected = true + case QUICErrorEvent: + if e.Err == nil { + return errors.New("unexpected QUICErrorEvent with no Err") + } + a.gotError = e.Err + } + if e.Kind != QUICNoEvent { + idleCount = 0 + } + } +} + +func TestQUICConnection(t *testing.T) { + config := &QUICConfig{TLSConfig: testConfig.Clone()} + config.TLSConfig.MinVersion = VersionTLS13 + + cli := newTestQUICClient(t, config) + cli.conn.SetTransportParameters(nil) + + srv := newTestQUICServer(t, config) + srv.conn.SetTransportParameters(nil) + + if err := runTestQUICConnection(context.Background(), cli, srv, nil); err != nil { + t.Fatalf("error during connection handshake: %v", err) + } + + if _, ok := cli.readSecret[QUICEncryptionLevelHandshake]; !ok { + t.Errorf("client has no Handshake secret") + } + if _, ok := cli.readSecret[QUICEncryptionLevelApplication]; !ok { + t.Errorf("client has no Application secret") + } + if _, ok := srv.readSecret[QUICEncryptionLevelHandshake]; !ok { + t.Errorf("server has no Handshake secret") + } + if _, ok := srv.readSecret[QUICEncryptionLevelApplication]; !ok { + t.Errorf("server has no Application secret") + } + for _, level := range []QUICEncryptionLevel{QUICEncryptionLevelHandshake, QUICEncryptionLevelApplication} { + if _, ok := cli.readSecret[level]; !ok { + t.Errorf("client has no %v read secret", level) + } + if _, ok := srv.readSecret[level]; !ok { + t.Errorf("server has no %v read secret", level) + } + if !reflect.DeepEqual(cli.readSecret[level], srv.writeSecret[level]) { + t.Errorf("client read secret does not match server write secret for level %v", level) + } + if !reflect.DeepEqual(cli.writeSecret[level], srv.readSecret[level]) { + t.Errorf("client write secret does not match server read secret for level %v", level) + } + } +} + +func TestQUICSessionResumption(t *testing.T) { + clientConfig := &QUICConfig{TLSConfig: testConfig.Clone()} + clientConfig.TLSConfig.MinVersion = VersionTLS13 + clientConfig.TLSConfig.ClientSessionCache = NewLRUClientSessionCache(1) + clientConfig.TLSConfig.ServerName = "example.go.dev" + + serverConfig := &QUICConfig{TLSConfig: testConfig.Clone()} + serverConfig.TLSConfig.MinVersion = VersionTLS13 + + cli := newTestQUICClient(t, clientConfig) + cli.conn.SetTransportParameters(nil) + srv := newTestQUICServer(t, serverConfig) + srv.conn.SetTransportParameters(nil) + if err := runTestQUICConnection(context.Background(), cli, srv, nil); err != nil { + t.Fatalf("error during first connection handshake: %v", err) + } + if cli.conn.ConnectionState().DidResume { + t.Errorf("first connection unexpectedly used session resumption") + } + + cli2 := newTestQUICClient(t, clientConfig) + cli2.conn.SetTransportParameters(nil) + srv2 := newTestQUICServer(t, serverConfig) + srv2.conn.SetTransportParameters(nil) + if err := runTestQUICConnection(context.Background(), cli2, srv2, nil); err != nil { + t.Fatalf("error during second connection handshake: %v", err) + } + if !cli2.conn.ConnectionState().DidResume { + t.Errorf("second connection did not use session resumption") + } + + clientConfig.TLSConfig.SessionTicketsDisabled = true + cli3 := newTestQUICClient(t, clientConfig) + cli3.conn.SetTransportParameters(nil) + srv3 := newTestQUICServer(t, serverConfig) + srv3.conn.SetTransportParameters(nil) + if err := runTestQUICConnection(context.Background(), cli3, srv3, nil); err != nil { + t.Fatalf("error during third connection handshake: %v", err) + } + if cli3.conn.ConnectionState().DidResume { + t.Errorf("third connection unexpectedly used session resumption") + } +} + +func TestQUICFragmentaryData(t *testing.T) { + clientConfig := &QUICConfig{TLSConfig: testConfig.Clone()} + clientConfig.TLSConfig.MinVersion = VersionTLS13 + clientConfig.TLSConfig.ClientSessionCache = NewLRUClientSessionCache(1) + clientConfig.TLSConfig.ServerName = "example.go.dev" + + serverConfig := &QUICConfig{TLSConfig: testConfig.Clone()} + serverConfig.TLSConfig.MinVersion = VersionTLS13 + + cli := newTestQUICClient(t, clientConfig) + cli.conn.SetTransportParameters(nil) + srv := newTestQUICServer(t, serverConfig) + srv.conn.SetTransportParameters(nil) + onEvent := func(e QUICEvent, src, dst *testQUICConn) bool { + if e.Kind == QUICWriteData { + // Provide the data one byte at a time. + for i := range e.Data { + if err := dst.conn.HandleData(e.Level, e.Data[i:i+1]); err != nil { + t.Errorf("HandleData: %v", err) + break + } + } + return true + } + return false + } + if err := runTestQUICConnection(context.Background(), cli, srv, onEvent); err != nil { + t.Fatalf("error during first connection handshake: %v", err) + } +} + +func TestQUICPostHandshakeClientAuthentication(t *testing.T) { + // RFC 9001, Section 4.4. + config := &QUICConfig{TLSConfig: testConfig.Clone()} + config.TLSConfig.MinVersion = VersionTLS13 + cli := newTestQUICClient(t, config) + cli.conn.SetTransportParameters(nil) + srv := newTestQUICServer(t, config) + srv.conn.SetTransportParameters(nil) + if err := runTestQUICConnection(context.Background(), cli, srv, nil); err != nil { + t.Fatalf("error during connection handshake: %v", err) + } + + certReq := new(certificateRequestMsgTLS13) + certReq.ocspStapling = true + certReq.scts = true + certReq.supportedSignatureAlgorithms = supportedSignatureAlgorithms(VersionTLS13) + certReqBytes, err := certReq.marshal() + if err != nil { + t.Fatal(err) + } + if err := cli.conn.HandleData(QUICEncryptionLevelApplication, append([]byte{ + byte(typeCertificateRequest), + byte(0), byte(0), byte(len(certReqBytes)), + }, certReqBytes...)); err == nil { + t.Fatalf("post-handshake authentication request: got no error, want one") + } +} + +func TestQUICPostHandshakeKeyUpdate(t *testing.T) { + // RFC 9001, Section 6. + config := &QUICConfig{TLSConfig: testConfig.Clone()} + config.TLSConfig.MinVersion = VersionTLS13 + cli := newTestQUICClient(t, config) + cli.conn.SetTransportParameters(nil) + srv := newTestQUICServer(t, config) + srv.conn.SetTransportParameters(nil) + if err := runTestQUICConnection(context.Background(), cli, srv, nil); err != nil { + t.Fatalf("error during connection handshake: %v", err) + } + + keyUpdate := new(keyUpdateMsg) + keyUpdateBytes, err := keyUpdate.marshal() + if err != nil { + t.Fatal(err) + } + expectedErr := "unexpected key update message" + if err = cli.conn.HandleData(QUICEncryptionLevelApplication, keyUpdateBytes); err == nil { + t.Fatalf("key update request: expected error from post-handshake key update, got nil") + } else if !strings.Contains(err.Error(), expectedErr) { + t.Fatalf("key update request: got error %v, expected substring %q", err, expectedErr) + } +} + +func TestQUICPostHandshakeMessageTooLarge(t *testing.T) { + config := &QUICConfig{TLSConfig: testConfig.Clone()} + config.TLSConfig.MinVersion = VersionTLS13 + cli := newTestQUICClient(t, config) + cli.conn.SetTransportParameters(nil) + srv := newTestQUICServer(t, config) + srv.conn.SetTransportParameters(nil) + if err := runTestQUICConnection(context.Background(), cli, srv, nil); err != nil { + t.Fatalf("error during connection handshake: %v", err) + } + + size := maxHandshake + 1 + if err := cli.conn.HandleData(QUICEncryptionLevelApplication, []byte{ + byte(typeNewSessionTicket), + byte(size >> 16), + byte(size >> 8), + byte(size), + }); err == nil { + t.Fatalf("%v-byte post-handshake message: got no error, want one", size) + } +} + +func TestQUICHandshakeError(t *testing.T) { + clientConfig := &QUICConfig{TLSConfig: testConfig.Clone()} + clientConfig.TLSConfig.MinVersion = VersionTLS13 + clientConfig.TLSConfig.InsecureSkipVerify = false + clientConfig.TLSConfig.ServerName = "name" + + serverConfig := &QUICConfig{TLSConfig: testConfig.Clone()} + serverConfig.TLSConfig.MinVersion = VersionTLS13 + + cli := newTestQUICClient(t, clientConfig) + cli.conn.SetTransportParameters(nil) + srv := newTestQUICServer(t, serverConfig) + srv.conn.SetTransportParameters(nil) + err := runTestQUICConnection(context.Background(), cli, srv, nil) + if !errors.Is(err, AlertError(alertBadCertificate)) { + t.Errorf("connection handshake terminated with error %q, want alertBadCertificate", err) + } + if _, ok := errors.AsType[*CertificateVerificationError](err); !ok { + t.Errorf("connection handshake terminated with error %q, want CertificateVerificationError", err) + } + + ev := cli.conn.NextEvent() + if ev.Kind != QUICErrorEvent { + t.Errorf("client.NextEvent: no QUICErrorEvent, want one") + } + if ev.Err != err { + t.Errorf("client.NextEvent: want same error returned by Start, got %v", ev.Err) + } +} + +// Test that we can report an error produced by the GetEncryptedClientHelloKeys function. +func TestQUICECHKeyError(t *testing.T) { + getECHKeysError := errors.New("error returned by GetEncryptedClientHelloKeys") + config := &QUICConfig{TLSConfig: testConfig.Clone()} + config.TLSConfig.MinVersion = VersionTLS13 + config.TLSConfig.NextProtos = []string{"h3"} + config.TLSConfig.GetEncryptedClientHelloKeys = func(*ClientHelloInfo) ([]EncryptedClientHelloKey, error) { + return nil, getECHKeysError + } + cli := newTestQUICClient(t, config) + cli.conn.SetTransportParameters(nil) + srv := newTestQUICServer(t, config) + + if err := runTestQUICConnection(context.Background(), cli, srv, nil); err != errTransportParametersRequired { + t.Fatalf("handshake with no client parameters: %v; want errTransportParametersRequired", err) + } + srv.conn.SetTransportParameters(nil) + if err := runTestQUICConnection(context.Background(), cli, srv, nil); err == nil { + t.Fatalf("handshake with GetEncryptedClientHelloKeys errors: nil, want error") + } + if srv.gotError == nil { + t.Fatalf("after GetEncryptedClientHelloKeys error, server did not see QUICErrorEvent") + } + if _, ok := errors.AsType[AlertError](srv.gotError); !ok { + t.Errorf("connection handshake terminated with error %T, want AlertError", srv.gotError) + } + if !errors.Is(srv.gotError, getECHKeysError) { + t.Errorf("connection handshake terminated with error %v, want error returned by GetEncryptedClientHelloKeys", srv.gotError) + } +} + +// Test that QUICConn.ConnectionState can be used during the handshake, +// and that it reports the application protocol as soon as it has been +// negotiated. +func TestQUICConnectionState(t *testing.T) { + config := &QUICConfig{TLSConfig: testConfig.Clone()} + config.TLSConfig.MinVersion = VersionTLS13 + config.TLSConfig.NextProtos = []string{"h3"} + cli := newTestQUICClient(t, config) + cli.conn.SetTransportParameters(nil) + srv := newTestQUICServer(t, config) + srv.conn.SetTransportParameters(nil) + onEvent := func(e QUICEvent, src, dst *testQUICConn) bool { + cliCS := cli.conn.ConnectionState() + if _, ok := cli.readSecret[QUICEncryptionLevelApplication]; ok { + if want, got := cliCS.NegotiatedProtocol, "h3"; want != got { + t.Errorf("cli.ConnectionState().NegotiatedProtocol = %q, want %q", want, got) + } + } + srvCS := srv.conn.ConnectionState() + if _, ok := srv.readSecret[QUICEncryptionLevelHandshake]; ok { + if want, got := srvCS.NegotiatedProtocol, "h3"; want != got { + t.Errorf("srv.ConnectionState().NegotiatedProtocol = %q, want %q", want, got) + } + } + return false + } + if err := runTestQUICConnection(context.Background(), cli, srv, onEvent); err != nil { + t.Fatalf("error during connection handshake: %v", err) + } +} + +func TestQUICStartContextPropagation(t *testing.T) { + const key = "key" + const value = "value" + ctx := context.WithValue(context.Background(), key, value) + config := &QUICConfig{TLSConfig: testConfig.Clone()} + config.TLSConfig.MinVersion = VersionTLS13 + calls := 0 + config.TLSConfig.GetConfigForClient = func(info *ClientHelloInfo) (*Config, error) { + calls++ + got, _ := info.Context().Value(key).(string) + if got != value { + t.Errorf("GetConfigForClient context key %q has value %q, want %q", key, got, value) + } + return nil, nil + } + cli := newTestQUICClient(t, config) + cli.conn.SetTransportParameters(nil) + srv := newTestQUICServer(t, config) + srv.conn.SetTransportParameters(nil) + if err := runTestQUICConnection(ctx, cli, srv, nil); err != nil { + t.Fatalf("error during connection handshake: %v", err) + } + if calls != 1 { + t.Errorf("GetConfigForClient called %v times, want 1", calls) + } +} + +func TestQUICContextCancelation(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + config := &QUICConfig{TLSConfig: testConfig.Clone()} + config.TLSConfig.MinVersion = VersionTLS13 + cli := newTestQUICClient(t, config) + cli.conn.SetTransportParameters(nil) + srv := newTestQUICServer(t, config) + srv.conn.SetTransportParameters(nil) + // Verify that canceling the connection context concurrently does not cause any races. + // See https://go.dev/issue/77274. + var wg sync.WaitGroup + wg.Go(func() { + _ = runTestQUICConnection(ctx, cli, srv, nil) + }) + wg.Go(cancel) + wg.Wait() +} + +func TestQUICDelayedTransportParameters(t *testing.T) { + clientConfig := &QUICConfig{TLSConfig: testConfig.Clone()} + clientConfig.TLSConfig.MinVersion = VersionTLS13 + clientConfig.TLSConfig.ClientSessionCache = NewLRUClientSessionCache(1) + clientConfig.TLSConfig.ServerName = "example.go.dev" + + serverConfig := &QUICConfig{TLSConfig: testConfig.Clone()} + serverConfig.TLSConfig.MinVersion = VersionTLS13 + + cliParams := "client params" + srvParams := "server params" + + cli := newTestQUICClient(t, clientConfig) + srv := newTestQUICServer(t, serverConfig) + if err := runTestQUICConnection(context.Background(), cli, srv, nil); err != errTransportParametersRequired { + t.Fatalf("handshake with no client parameters: %v; want errTransportParametersRequired", err) + } + cli.conn.SetTransportParameters([]byte(cliParams)) + if err := runTestQUICConnection(context.Background(), cli, srv, nil); err != errTransportParametersRequired { + t.Fatalf("handshake with no server parameters: %v; want errTransportParametersRequired", err) + } + srv.conn.SetTransportParameters([]byte(srvParams)) + if err := runTestQUICConnection(context.Background(), cli, srv, nil); err != nil { + t.Fatalf("error during connection handshake: %v", err) + } + + if got, want := string(cli.gotParams), srvParams; got != want { + t.Errorf("client got transport params: %q, want %q", got, want) + } + if got, want := string(srv.gotParams), cliParams; got != want { + t.Errorf("server got transport params: %q, want %q", got, want) + } +} + +func TestQUICEmptyTransportParameters(t *testing.T) { + config := &QUICConfig{TLSConfig: testConfig.Clone()} + config.TLSConfig.MinVersion = VersionTLS13 + + cli := newTestQUICClient(t, config) + cli.conn.SetTransportParameters(nil) + srv := newTestQUICServer(t, config) + srv.conn.SetTransportParameters(nil) + if err := runTestQUICConnection(context.Background(), cli, srv, nil); err != nil { + t.Fatalf("error during connection handshake: %v", err) + } + + if cli.gotParams == nil { + t.Errorf("client did not get transport params") + } + if srv.gotParams == nil { + t.Errorf("server did not get transport params") + } + if len(cli.gotParams) != 0 { + t.Errorf("client got transport params: %v, want empty", cli.gotParams) + } + if len(srv.gotParams) != 0 { + t.Errorf("server got transport params: %v, want empty", srv.gotParams) + } +} + +func TestQUICCanceledWaitingForData(t *testing.T) { + config := &QUICConfig{TLSConfig: testConfig.Clone()} + config.TLSConfig.MinVersion = VersionTLS13 + cli := newTestQUICClient(t, config) + cli.conn.SetTransportParameters(nil) + cli.conn.Start(context.Background()) + for cli.conn.NextEvent().Kind != QUICNoEvent { + } + err := cli.conn.Close() + if !errors.Is(err, alertCloseNotify) { + t.Errorf("conn.Close() = %v, want alertCloseNotify", err) + } +} + +func TestQUICCanceledWaitingForTransportParams(t *testing.T) { + config := &QUICConfig{TLSConfig: testConfig.Clone()} + config.TLSConfig.MinVersion = VersionTLS13 + cli := newTestQUICClient(t, config) + cli.conn.Start(context.Background()) + for cli.conn.NextEvent().Kind != QUICTransportParametersRequired { + } + err := cli.conn.Close() + if !errors.Is(err, alertCloseNotify) { + t.Errorf("conn.Close() = %v, want alertCloseNotify", err) + } +} + +func TestQUICEarlyData(t *testing.T) { + clientConfig := &QUICConfig{TLSConfig: testConfig.Clone()} + clientConfig.TLSConfig.MinVersion = VersionTLS13 + clientConfig.TLSConfig.ClientSessionCache = NewLRUClientSessionCache(1) + clientConfig.TLSConfig.ServerName = "example.go.dev" + clientConfig.TLSConfig.NextProtos = []string{"h3"} + + serverConfig := &QUICConfig{TLSConfig: testConfig.Clone()} + serverConfig.TLSConfig.MinVersion = VersionTLS13 + serverConfig.TLSConfig.NextProtos = []string{"h3"} + + cli := newTestQUICClient(t, clientConfig) + cli.conn.SetTransportParameters(nil) + srv := newTestQUICServer(t, serverConfig) + srv.conn.SetTransportParameters(nil) + srv.ticketOpts.EarlyData = true + if err := runTestQUICConnection(context.Background(), cli, srv, nil); err != nil { + t.Fatalf("error during first connection handshake: %v", err) + } + if cli.conn.ConnectionState().DidResume { + t.Errorf("first connection unexpectedly used session resumption") + } + + cli2 := newTestQUICClient(t, clientConfig) + cli2.conn.SetTransportParameters(nil) + srv2 := newTestQUICServer(t, serverConfig) + srv2.conn.SetTransportParameters(nil) + onEvent := func(e QUICEvent, src, dst *testQUICConn) bool { + switch e.Kind { + case QUICStoreSession, QUICResumeSession: + t.Errorf("with EnableSessionEvents=false, got unexpected event %v", e.Kind) + } + return false + } + if err := runTestQUICConnection(context.Background(), cli2, srv2, onEvent); err != nil { + t.Fatalf("error during second connection handshake: %v", err) + } + if !cli2.conn.ConnectionState().DidResume { + t.Errorf("second connection did not use session resumption") + } + cliSecret := cli2.writeSecret[QUICEncryptionLevelEarly] + if cliSecret.secret == nil { + t.Errorf("client did not receive early data write secret") + } + srvSecret := srv2.readSecret[QUICEncryptionLevelEarly] + if srvSecret.secret == nil { + t.Errorf("server did not receive early data read secret") + } + if cliSecret.suite != srvSecret.suite || !bytes.Equal(cliSecret.secret, srvSecret.secret) { + t.Errorf("client early data secret does not match server") + } +} + +func TestQUICEarlyDataDeclined(t *testing.T) { + t.Run("server", func(t *testing.T) { + testQUICEarlyDataDeclined(t, true) + }) + t.Run("client", func(t *testing.T) { + testQUICEarlyDataDeclined(t, false) + }) +} + +func testQUICEarlyDataDeclined(t *testing.T, server bool) { + clientConfig := &QUICConfig{TLSConfig: testConfig.Clone()} + clientConfig.EnableSessionEvents = true + clientConfig.TLSConfig.MinVersion = VersionTLS13 + clientConfig.TLSConfig.ClientSessionCache = NewLRUClientSessionCache(1) + clientConfig.TLSConfig.ServerName = "example.go.dev" + clientConfig.TLSConfig.NextProtos = []string{"h3"} + + serverConfig := &QUICConfig{TLSConfig: testConfig.Clone()} + serverConfig.EnableSessionEvents = true + serverConfig.TLSConfig.MinVersion = VersionTLS13 + serverConfig.TLSConfig.NextProtos = []string{"h3"} + + cli := newTestQUICClient(t, clientConfig) + cli.conn.SetTransportParameters(nil) + srv := newTestQUICServer(t, serverConfig) + srv.conn.SetTransportParameters(nil) + srv.ticketOpts.EarlyData = true + if err := runTestQUICConnection(context.Background(), cli, srv, nil); err != nil { + t.Fatalf("error during first connection handshake: %v", err) + } + if cli.conn.ConnectionState().DidResume { + t.Errorf("first connection unexpectedly used session resumption") + } + + cli2 := newTestQUICClient(t, clientConfig) + cli2.conn.SetTransportParameters(nil) + srv2 := newTestQUICServer(t, serverConfig) + srv2.conn.SetTransportParameters(nil) + declineEarlyData := func(state *SessionState) { + state.EarlyData = false + } + if server { + srv2.onResumeSession = declineEarlyData + } else { + cli2.onResumeSession = declineEarlyData + } + if err := runTestQUICConnection(context.Background(), cli2, srv2, nil); err != nil { + t.Fatalf("error during second connection handshake: %v", err) + } + if !cli2.conn.ConnectionState().DidResume { + t.Errorf("second connection did not use session resumption") + } + _, cliEarlyData := cli2.writeSecret[QUICEncryptionLevelEarly] + if server { + if !cliEarlyData { + t.Errorf("client did not receive early data write secret") + } + if !cli2.earlyDataRejected { + t.Errorf("client did not receive QUICEarlyDataRejected") + } + } + if _, srvEarlyData := srv2.readSecret[QUICEncryptionLevelEarly]; srvEarlyData { + t.Errorf("server received early data read secret") + } +} diff --git a/go/src/crypto/tls/testdata/Client-TLSv10-ClientCert-ECDSA-ECDSA b/go/src/crypto/tls/testdata/Client-TLSv10-ClientCert-ECDSA-ECDSA new file mode 100644 index 0000000000000000000000000000000000000000..3bd86fd90ed92a7e8ff4f4de90d848ca8f0c9746 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv10-ClientCert-ECDSA-ECDSA @@ -0,0 +1,136 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 01 00 5d 02 00 00 59 03 01 1a 76 c4 d5 b5 |....]...Y...v...| +00000010 7e 30 1c 1e c3 62 8b 92 a8 19 9b 62 4e 36 a1 d3 |~0...b.....bN6..| +00000020 c8 e3 55 f6 64 5f 06 aa 19 9a 48 20 24 a4 2d a9 |..U.d_....H $.-.| +00000030 8a bd cf 4e 9b cf 7d c7 8e 8f e8 ed f5 09 37 ad |...N..}.......7.| +00000040 06 c9 6b a4 d5 de 7f 07 07 a6 9d c7 c0 09 00 00 |..k.............| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 01 02 0e 0b 00 02 0a 00 02 07 00 02 |................| +00000070 04 30 82 02 00 30 82 01 62 02 09 00 b8 bf 2d 47 |.0...0..b.....-G| +00000080 a0 d2 eb f4 30 09 06 07 2a 86 48 ce 3d 04 01 30 |....0...*.H.=..0| +00000090 45 31 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 |E1.0...U....AU1.| +000000a0 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 |0...U....Some-St| +000000b0 61 74 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e |ate1!0...U....In| +000000c0 74 65 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 |ternet Widgits P| +000000d0 74 79 20 4c 74 64 30 1e 17 0d 31 32 31 31 32 32 |ty Ltd0...121122| +000000e0 31 35 30 36 33 32 5a 17 0d 32 32 31 31 32 30 31 |150632Z..2211201| +000000f0 35 30 36 33 32 5a 30 45 31 0b 30 09 06 03 55 04 |50632Z0E1.0...U.| +00000100 06 13 02 41 55 31 13 30 11 06 03 55 04 08 13 0a |...AU1.0...U....| +00000110 53 6f 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 |Some-State1!0...| +00000120 55 04 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 |U....Internet Wi| +00000130 64 67 69 74 73 20 50 74 79 20 4c 74 64 30 81 9b |dgits Pty Ltd0..| +00000140 30 10 06 07 2a 86 48 ce 3d 02 01 06 05 2b 81 04 |0...*.H.=....+..| +00000150 00 23 03 81 86 00 04 00 c4 a1 ed be 98 f9 0b 48 |.#.............H| +00000160 73 36 7e c3 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d |s6~..V.".=S.;M!=| +00000170 cd 6b 75 e6 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 |.ku......&.....r| +00000180 32 7c b3 64 2f 1c 90 bc ea 68 23 10 7e fe e3 25 |2|.d/....h#.~..%| +00000190 c0 48 3a 69 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 |.H:i.(m.7...b...| +000001a0 9c 70 62 83 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 |.pb....d1...1...| +000001b0 68 c0 9b 23 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 |h..#.vd?.\....XX| +000001c0 b6 5f 70 dd 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 |._p............0| +000001d0 66 5b 66 9a 20 e2 27 e5 bf fe 3b 30 09 06 07 2a |f[f. .'...;0...*| +000001e0 86 48 ce 3d 04 01 03 81 8c 00 30 81 88 02 42 01 |.H.=......0...B.| +000001f0 88 a2 4f eb e2 45 c5 48 7d 1b ac f5 ed 98 9d ae |..O..E.H}.......| +00000200 47 70 c0 5e 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 |Gp.^../...M.a@..| +00000210 a2 ce ee 0b 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce |....~.~.v..;~.?.| +00000220 fa 10 e2 59 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f |...Y.G-|..N....o| +00000230 d0 02 42 01 4d fc be 67 13 9c 2d 05 0e bd 3f a3 |..B.M..g..-...?.| +00000240 8c 25 c1 33 13 83 0d 94 06 bb d4 37 7a f6 ec 7a |.%.3.......7z..z| +00000250 c9 86 2e dd d7 11 69 7f 85 7c 56 de fb 31 78 2b |......i..|V..1x+| +00000260 e4 c7 78 0d ae cb be 9e 4e 36 24 31 7b 6a 0f 39 |..x.....N6$1{j.9| +00000270 95 12 07 8f 2a 16 03 01 00 b5 0c 00 00 b1 03 00 |....*...........| +00000280 1d 20 3e 61 33 da 82 02 f5 6d 70 2d e5 07 df 43 |. >a3....mp-...C| +00000290 d7 e6 1a b2 81 3e 58 03 dc 27 37 34 3b 2e 5a d5 |.....>X..'74;.Z.| +000002a0 d4 1a 00 8b 30 81 88 02 42 00 8b 0c f4 0f fe 8c |....0...B.......| +000002b0 01 70 3a c5 e5 29 53 1c ad 6c f4 35 53 e3 e6 ce |.p:..)S..l.5S...| +000002c0 19 21 03 de f5 e3 df 8e e5 6b 43 00 08 b7 24 2c |.!.......kC...$,| +000002d0 27 9e 2b bc 2f 96 07 a0 f9 a9 6b d4 b7 75 a8 5d |'.+./.....k..u.]| +000002e0 99 13 ab 5a dd 35 56 08 6d 9c a1 02 42 01 29 62 |...Z.5V.m...B.)b| +000002f0 b9 64 8b 6d 91 b7 f5 59 73 9d 2d bc 9d 9a 5b 43 |.d.m...Ys.-...[C| +00000300 d8 d5 76 be 2a 8f c5 f0 2e 5d a8 be 7b d0 36 fe |..v.*....]..{.6.| +00000310 62 97 7f 17 96 f6 c3 b4 06 2a e2 cb 77 80 ff 28 |b........*..w..(| +00000320 02 64 cb bb c7 a9 77 4b 96 7d 07 11 7e e8 28 16 |.d....wK.}..~.(.| +00000330 03 01 00 0a 0d 00 00 06 03 01 02 40 00 00 16 03 |...........@....| +00000340 01 00 04 0e 00 00 00 |.......| +>>> Flow 3 (client to server) +00000000 16 03 01 02 0a 0b 00 02 06 00 02 03 00 02 00 30 |...............0| +00000010 82 01 fc 30 82 01 5e 02 09 00 9a 30 84 6c 26 35 |...0..^....0.l&5| +00000020 d9 17 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 |..0...*.H.=..0E1| +00000030 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 30 11 |.0...U....AU1.0.| +00000040 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 |..U....Some-Stat| +00000050 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 |e1!0...U....Inte| +00000060 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 79 |rnet Widgits Pty| +00000070 20 4c 74 64 30 1e 17 0d 31 32 31 31 31 34 31 33 | Ltd0...12111413| +00000080 32 35 35 33 5a 17 0d 32 32 31 31 31 32 31 33 32 |2553Z..221112132| +00000090 35 35 33 5a 30 41 31 0b 30 09 06 03 55 04 06 13 |553Z0A1.0...U...| +000000a0 02 41 55 31 0c 30 0a 06 03 55 04 08 13 03 4e 53 |.AU1.0...U....NS| +000000b0 57 31 10 30 0e 06 03 55 04 07 13 07 50 79 72 6d |W1.0...U....Pyrm| +000000c0 6f 6e 74 31 12 30 10 06 03 55 04 03 13 09 4a 6f |ont1.0...U....Jo| +000000d0 65 6c 20 53 69 6e 67 30 81 9b 30 10 06 07 2a 86 |el Sing0..0...*.| +000000e0 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 86 00 |H.=....+...#....| +000000f0 04 00 95 8c 91 75 14 c0 5e c4 57 b4 d4 c3 6f 8d |.....u..^.W...o.| +00000100 ae 68 1e dd 6f ce 86 e1 7e 6e b2 48 3e 81 e5 4e |.h..o...~n.H>..N| +00000110 e2 c6 88 4b 64 dc f5 30 bb d3 ff 65 cc 5b f4 dd |...Kd..0...e.[..| +00000120 b5 6a 3e 3e d0 1d de 47 c3 76 ad 19 f6 45 2c 8c |.j>>...G.v...E,.| +00000130 bc d8 1d 01 4c 1f 70 90 46 76 48 8b 8f 83 cc 4a |....L.p.FvH....J| +00000140 5c 8f 40 76 da e0 89 ec 1d 2b c4 4e 30 76 28 41 |\.@v.....+.N0v(A| +00000150 b2 62 a8 fb 5b f1 f9 4e 7a 8d bd 09 b8 ae ea 8b |.b..[..Nz.......| +00000160 18 27 4f 2e 70 fe 13 96 ba c3 d3 40 16 cd 65 4e |.'O.p......@..eN| +00000170 ac 11 1e e6 f1 30 09 06 07 2a 86 48 ce 3d 04 01 |.....0...*.H.=..| +00000180 03 81 8c 00 30 81 88 02 42 00 e0 14 c4 60 60 0b |....0...B....``.| +00000190 72 68 b0 32 5d 61 4a 02 74 5c c2 81 b9 16 a8 3f |rh.2]aJ.t\.....?| +000001a0 29 c8 36 c7 81 ff 6c b6 5b d9 70 f1 38 3b 50 48 |).6...l.[.p.8;PH| +000001b0 28 94 cb 09 1a 52 f1 5d ee 8d f2 b9 f0 f0 da d9 |(....R.]........| +000001c0 15 3a f9 bd 03 7a 87 a2 23 35 ec 02 42 01 a3 d4 |.:...z..#5..B...| +000001d0 8a 78 35 1c 4a 9a 23 d2 0a be 2b 10 31 9d 9c 5f |.x5.J.#...+.1.._| +000001e0 be e8 91 b3 da 1a f5 5d a3 23 f5 26 8b 45 70 8d |.......].#.&.Ep.| +000001f0 65 62 9b 7e 01 99 3d 18 f6 10 9a 38 61 9b 2e 57 |eb.~..=....8a..W| +00000200 e4 fa cc b1 8a ce e2 23 a0 87 f0 e1 67 51 eb 16 |.......#....gQ..| +00000210 03 01 00 25 10 00 00 21 20 2f e5 7d a3 47 cd 62 |...%...! /.}.G.b| +00000220 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf |C.(.._.).0......| +00000230 c2 ed 90 99 5f 58 cb 3b 74 16 03 01 00 90 0f 00 |...._X.;t.......| +00000240 00 8c 00 8a 30 81 87 02 41 46 5f cc 88 bc 2b e5 |....0...AF_...+.| +00000250 20 33 a9 ff 52 bb 25 dc cf a1 08 45 b5 82 9a 1b | 3..R.%....E....| +00000260 53 04 18 b4 23 20 c4 d2 d8 92 9b 21 a7 ec 36 d6 |S...# .....!..6.| +00000270 63 35 68 4c 21 c4 0e 20 07 0c 8f 38 2f 9b b7 9e |c5hL!.. ...8/...| +00000280 e7 9d 6d ea da 1c a6 f1 c5 d3 02 42 01 ed 54 c8 |..m........B..T.| +00000290 9e b2 45 f1 1f 77 ee e3 a7 3a 40 9b fe 9b 1d 38 |..E..w...:@....8| +000002a0 ff 9b b4 c6 e7 94 07 b8 5f 93 bd 38 8d 31 dd 80 |........_..8.1..| +000002b0 2f 82 6e b5 85 8f 15 8b cd b2 04 81 e2 0b 2a fa |/.n...........*.| +000002c0 d9 4b 47 0b 86 26 8b 4e 83 a6 15 9e 93 15 14 03 |.KG..&.N........| +000002d0 01 00 01 01 16 03 01 00 30 f3 06 0e 6f 16 1b 0b |........0...o...| +000002e0 46 54 37 fd c6 80 0f ec 4b dd d7 d4 17 b2 d7 8d |FT7.....K.......| +000002f0 4e 6a 7f 2a af d2 ea 19 11 8f 23 57 b7 e7 2f b3 |Nj.*......#W../.| +00000300 97 f6 93 3f ac 0d 5c f8 f5 |...?..\..| +>>> Flow 4 (server to client) +00000000 14 03 01 00 01 01 16 03 01 00 30 03 aa a1 4c bf |..........0...L.| +00000010 ab 53 f3 96 e7 db b1 a4 d7 19 f7 2f c0 b7 32 ea |.S........./..2.| +00000020 bd f3 4a 7c 0d 4c df a4 5f a0 3d f3 1b 57 65 a1 |..J|.L.._.=..We.| +00000030 d1 31 ae 52 6e ed 15 d2 d9 23 68 |.1.Rn....#h| +>>> Flow 5 (client to server) +00000000 17 03 01 00 20 aa 0c f4 30 17 b7 59 47 33 91 07 |.... ...0..YG3..| +00000010 cc 52 7b 52 f8 a0 82 44 25 03 0e b4 45 6e 0c 5a |.R{R...D%...En.Z| +00000020 37 6d d6 6d 80 17 03 01 00 20 bc c7 70 3b 94 cc |7m.m..... ..p;..| +00000030 09 db 15 84 d8 b9 c5 cf d6 01 91 93 5b 20 5a b1 |............[ Z.| +00000040 6a 43 23 30 7e 02 ea 8b e0 28 15 03 01 00 20 c2 |jC#0~....(.... .| +00000050 7f c9 90 b3 ef c6 52 68 44 df 05 30 17 39 d9 42 |......RhD..0.9.B| +00000060 76 7a 1d a1 17 2b fa b4 92 ca 40 a9 58 d4 87 |vz...+....@.X..| diff --git a/go/src/crypto/tls/testdata/Client-TLSv10-ClientCert-ECDSA-RSA b/go/src/crypto/tls/testdata/Client-TLSv10-ClientCert-ECDSA-RSA new file mode 100644 index 0000000000000000000000000000000000000000..de3de89cd1661687cc536091be9927045fa860fe --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv10-ClientCert-ECDSA-RSA @@ -0,0 +1,140 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 01 00 5d 02 00 00 59 03 01 fc 68 73 9f 1a |....]...Y...hs..| +00000010 9d 3b 9b f9 10 cf b5 84 b9 31 f4 a8 e9 47 ab 33 |.;.......1...G.3| +00000020 55 42 0b c0 f2 8e fa e7 a0 39 55 20 56 cd 87 f6 |UB.......9U V...| +00000030 05 e0 b1 e9 aa b8 b2 ca 33 9d 46 02 fd d8 f0 11 |........3.F.....| +00000040 0e fc 96 7e b4 fa fc c2 f3 da c4 2b c0 13 00 00 |...~.......+....| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 01 02 59 0b 00 02 55 00 02 52 00 02 |......Y...U..R..| +00000070 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 |O0..K0..........| +00000080 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 |....?.[..0...*.H| +00000090 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 |........0.1.0...| +000000a0 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 |U....Go1.0...U..| +000000b0 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 |..Go Root0...160| +000000c0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| +000000d0 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 |01000000Z0.1.0..| +000000e0 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 |.U....Go1.0...U.| +000000f0 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |...Go0..0...*.H.| +00000100 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +00000110 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab |...F}...'.H..(!.| +00000120 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d |~...]..RE.z6G...| +00000130 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd |.B[.....y.@.Om..| +00000140 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a |+.....g....."8.J| +00000150 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 |.ts+.4......t{.X| +00000160 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c |.la<..A..++$#w[.| +00000170 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 |;.u]. T..c...$..| +00000180 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 |..P....C...ub...| +00000190 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 |R.........0..0..| +000001a0 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 |.U...........0..| +000001b0 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 |.U.%..0...+.....| +000001c0 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 |....+.......0...| +000001d0 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d |U.......0.0...U.| +000001e0 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d |.........CC>I..m| +000001f0 b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 |....`0...U.#..0.| +00000200 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab |..H.IM.~.1......| +00000210 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |n{0...U....0...e| +00000220 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| +00000230 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| +00000240 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed |.0.@+[P.a...SX..| +00000250 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 |.(.X..8....1Z..f| +00000260 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a |=C.-...... d8.$:| +00000270 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 |....}.@ ._...a..| +00000280 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed |v......\.....l..| +00000290 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 |s..Cw.......@.a.| +000002a0 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 |Lr+...F..M...>..| +000002b0 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 |.B...=.`.\!.;...| +000002c0 16 03 01 00 aa 0c 00 00 a6 03 00 1d 20 74 0e 72 |............ t.r| +000002d0 d9 71 10 de 9b f7 59 f0 c0 a2 b9 35 68 6a 3d f3 |.q....Y....5hj=.| +000002e0 27 fb 13 3d a1 c0 4c f6 17 9b f1 25 50 00 80 c2 |'..=..L....%P...| +000002f0 20 fd 4f 8b c9 6a fc 97 61 9d b3 b0 1d 2d 9a 2f | .O..j..a....-./| +00000300 90 15 44 a7 04 01 0b 6f a9 47 5d a1 46 aa 30 f1 |..D....o.G].F.0.| +00000310 5f 9b db 4d 8d 7a a4 99 3f 5c cb 4a ff 0a 49 b1 |_..M.z..?\.J..I.| +00000320 fc df 0a f7 31 90 a9 98 cd da 8c 49 a5 1f 0f c7 |....1......I....| +00000330 48 63 ee ff a8 fb 07 0a fe e1 d7 1b ed b3 3f ce |Hc............?.| +00000340 39 ef bb 50 e9 a0 f4 c1 6f a6 7e 5b c8 36 1a 76 |9..P....o.~[.6.v| +00000350 c8 00 3b e2 04 98 88 f1 fa 56 34 8f 02 86 0a 8e |..;......V4.....| +00000360 29 4f eb 70 fb 2f 21 ed 8d fa a9 91 66 c9 c0 16 |)O.p./!.....f...| +00000370 03 01 00 0a 0d 00 00 06 03 01 02 40 00 00 16 03 |...........@....| +00000380 01 00 04 0e 00 00 00 |.......| +>>> Flow 3 (client to server) +00000000 16 03 01 02 0a 0b 00 02 06 00 02 03 00 02 00 30 |...............0| +00000010 82 01 fc 30 82 01 5e 02 09 00 9a 30 84 6c 26 35 |...0..^....0.l&5| +00000020 d9 17 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 |..0...*.H.=..0E1| +00000030 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 30 11 |.0...U....AU1.0.| +00000040 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 |..U....Some-Stat| +00000050 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 |e1!0...U....Inte| +00000060 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 79 |rnet Widgits Pty| +00000070 20 4c 74 64 30 1e 17 0d 31 32 31 31 31 34 31 33 | Ltd0...12111413| +00000080 32 35 35 33 5a 17 0d 32 32 31 31 31 32 31 33 32 |2553Z..221112132| +00000090 35 35 33 5a 30 41 31 0b 30 09 06 03 55 04 06 13 |553Z0A1.0...U...| +000000a0 02 41 55 31 0c 30 0a 06 03 55 04 08 13 03 4e 53 |.AU1.0...U....NS| +000000b0 57 31 10 30 0e 06 03 55 04 07 13 07 50 79 72 6d |W1.0...U....Pyrm| +000000c0 6f 6e 74 31 12 30 10 06 03 55 04 03 13 09 4a 6f |ont1.0...U....Jo| +000000d0 65 6c 20 53 69 6e 67 30 81 9b 30 10 06 07 2a 86 |el Sing0..0...*.| +000000e0 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 86 00 |H.=....+...#....| +000000f0 04 00 95 8c 91 75 14 c0 5e c4 57 b4 d4 c3 6f 8d |.....u..^.W...o.| +00000100 ae 68 1e dd 6f ce 86 e1 7e 6e b2 48 3e 81 e5 4e |.h..o...~n.H>..N| +00000110 e2 c6 88 4b 64 dc f5 30 bb d3 ff 65 cc 5b f4 dd |...Kd..0...e.[..| +00000120 b5 6a 3e 3e d0 1d de 47 c3 76 ad 19 f6 45 2c 8c |.j>>...G.v...E,.| +00000130 bc d8 1d 01 4c 1f 70 90 46 76 48 8b 8f 83 cc 4a |....L.p.FvH....J| +00000140 5c 8f 40 76 da e0 89 ec 1d 2b c4 4e 30 76 28 41 |\.@v.....+.N0v(A| +00000150 b2 62 a8 fb 5b f1 f9 4e 7a 8d bd 09 b8 ae ea 8b |.b..[..Nz.......| +00000160 18 27 4f 2e 70 fe 13 96 ba c3 d3 40 16 cd 65 4e |.'O.p......@..eN| +00000170 ac 11 1e e6 f1 30 09 06 07 2a 86 48 ce 3d 04 01 |.....0...*.H.=..| +00000180 03 81 8c 00 30 81 88 02 42 00 e0 14 c4 60 60 0b |....0...B....``.| +00000190 72 68 b0 32 5d 61 4a 02 74 5c c2 81 b9 16 a8 3f |rh.2]aJ.t\.....?| +000001a0 29 c8 36 c7 81 ff 6c b6 5b d9 70 f1 38 3b 50 48 |).6...l.[.p.8;PH| +000001b0 28 94 cb 09 1a 52 f1 5d ee 8d f2 b9 f0 f0 da d9 |(....R.]........| +000001c0 15 3a f9 bd 03 7a 87 a2 23 35 ec 02 42 01 a3 d4 |.:...z..#5..B...| +000001d0 8a 78 35 1c 4a 9a 23 d2 0a be 2b 10 31 9d 9c 5f |.x5.J.#...+.1.._| +000001e0 be e8 91 b3 da 1a f5 5d a3 23 f5 26 8b 45 70 8d |.......].#.&.Ep.| +000001f0 65 62 9b 7e 01 99 3d 18 f6 10 9a 38 61 9b 2e 57 |eb.~..=....8a..W| +00000200 e4 fa cc b1 8a ce e2 23 a0 87 f0 e1 67 51 eb 16 |.......#....gQ..| +00000210 03 01 00 25 10 00 00 21 20 2f e5 7d a3 47 cd 62 |...%...! /.}.G.b| +00000220 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf |C.(.._.).0......| +00000230 c2 ed 90 99 5f 58 cb 3b 74 16 03 01 00 91 0f 00 |...._X.;t.......| +00000240 00 8d 00 8b 30 81 88 02 42 00 88 3e 14 10 fa b5 |....0...B..>....| +00000250 65 d8 03 71 7e b7 44 a5 db 04 85 d2 f4 5d c5 de |e..q~.D......]..| +00000260 71 e4 f9 ad 5e 47 6c 83 eb 6a 2b fc 8d 60 6b 1b |q...^Gl..j+..`k.| +00000270 55 89 7b 03 60 fb 9c b2 b1 42 ef 02 63 29 59 03 |U.{.`....B..c)Y.| +00000280 02 a8 48 4d 9a 3d f3 e9 6b ac 76 02 42 01 90 36 |..HM.=..k.v.B..6| +00000290 5d d0 ec dd 76 75 0c 97 66 7f 10 ec 1d 39 5e bb |]...vu..f....9^.| +000002a0 2c 81 9e 15 fa 59 3f e8 77 3f 33 03 b6 2d 02 5a |,....Y?.w?3..-.Z| +000002b0 28 82 53 7a 18 69 29 5b d9 7d ce 4f 94 d9 69 29 |(.Sz.i)[.}.O..i)| +000002c0 b2 84 87 4a 15 47 c6 da 6f c3 df ca 8a 58 0b 14 |...J.G..o....X..| +000002d0 03 01 00 01 01 16 03 01 00 30 89 15 96 15 9d 93 |.........0......| +000002e0 e3 ae 94 14 f9 ea 39 d7 3b d6 98 e1 ed c8 0a 3f |......9.;......?| +000002f0 6f 2c a2 9b cd c5 ea 1a 1f 27 89 1a 7d ff 60 07 |o,.......'..}.`.| +00000300 22 1f bc b8 56 3a ee 24 5a ff |"...V:.$Z.| +>>> Flow 4 (server to client) +00000000 14 03 01 00 01 01 16 03 01 00 30 bf 0c 82 bd 43 |..........0....C| +00000010 ba 60 ec df 88 4d 48 be d5 c4 0c b5 7d c4 94 c4 |.`...MH.....}...| +00000020 15 6e 50 45 77 56 ce d5 e0 4c 15 fc da 96 0b 41 |.nPEwV...L.....A| +00000030 fd 70 39 e9 33 3f 57 77 f5 a3 67 |.p9.3?Ww..g| +>>> Flow 5 (client to server) +00000000 17 03 01 00 20 50 1e 02 79 6b 4b 67 77 bb c0 a7 |.... P..ykKgw...| +00000010 ef 5a c1 cc bc 28 14 86 2c 83 4f 3f 34 97 c4 73 |.Z...(..,.O?4..s| +00000020 24 44 ad 59 8c 17 03 01 00 20 e3 52 89 d7 d1 9a |$D.Y..... .R....| +00000030 33 21 78 e4 41 36 b1 11 74 c0 73 fb ea c9 42 88 |3!x.A6..t.s...B.| +00000040 7f 71 ea 40 a0 3a 62 54 dc b7 15 03 01 00 20 4a |.q.@.:bT...... J| +00000050 ff f4 c6 c0 5f fd e2 b3 bd 4a a9 aa 19 64 2d 98 |...._....J...d-.| +00000060 f1 ea 56 4e 3a c9 1c be 8d fb c3 6c 2f 98 ff |..VN:......l/..| diff --git a/go/src/crypto/tls/testdata/Client-TLSv10-ClientCert-Ed25519 b/go/src/crypto/tls/testdata/Client-TLSv10-ClientCert-Ed25519 new file mode 100644 index 0000000000000000000000000000000000000000..a14cef135690b9017dc7d5d0bd7ddbed781469d9 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv10-ClientCert-Ed25519 @@ -0,0 +1,110 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a8 |.............2..| +00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| +00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| +00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| +00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| +00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| +000000a0 00 00 0d 00 1a 00 18 08 04 08 05 08 06 04 01 04 |................| +000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 08 07 ff |................| +000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| +000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| +000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| +>>> Flow 2 (server to client) +00000000 16 03 01 00 59 02 00 00 55 03 01 55 df 11 fe c6 |....Y...U..U....| +00000010 aa d4 85 4b 87 c2 35 4c ac a9 c3 15 a3 7f 6d 7e |...K..5L......m~| +00000020 15 d1 47 b2 d2 09 16 4d 08 1b dd 20 49 d9 51 42 |..G....M... I.QB| +00000030 97 cf 36 b3 74 3e 05 0a e5 c9 97 ef 01 9c 24 34 |..6.t>........$4| +00000040 31 17 e1 8a 6a ce 37 60 02 47 46 7f c0 13 00 00 |1...j.7`.GF.....| +00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| +00000060 01 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| +00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| +00000080 3f e2 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 |?.[..0...*.H....| +00000090 01 0b 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 |....0.1.0...U...| +000000a0 02 47 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f |.Go1.0...U....Go| +000000b0 20 52 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 | Root0...1601010| +000000c0 30 30 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 |00000Z..25010100| +000000d0 30 30 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a |0000Z0.1.0...U..| +000000e0 13 02 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 |..Go1.0...U....G| +000000f0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| +00000100 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 |.......0.......F| +00000110 7d 93 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 |}...'.H..(!.~...| +00000120 5d fe 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 |]..RE.z6G....B[.| +00000130 81 c0 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 |....y.@.Om..+...| +00000140 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b |..g....."8.J.ts+| +00000150 c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c |.4......t{.X.la<| +00000160 c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d |..A..++$#w[.;.u]| +00000170 ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b |. T..c...$....P.| +00000180 aa b6 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 |...C...ub...R...| +00000190 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| +000001a0 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| +000001b0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| +000001c0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| +000001d0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| +000001e0 10 9f 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f |.....CC>I..m....| +000001f0 60 30 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 |`0...U.#..0...H.| +00000200 49 4d 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 |IM.~.1......n{0.| +00000210 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| +00000220 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| +00000230 86 f7 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 |.............0.@| +00000240 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 |+[P.a...SX...(.X| +00000250 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d |..8....1Z..f=C.-| +00000260 d9 0b f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c |...... d8.$:....| +00000270 7d b7 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 |}.@ ._...a..v...| +00000280 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 |...\.....l..s..C| +00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| +000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| +000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 01 00 |.=.`.\!.;.......| +000002c0 aa 0c 00 00 a6 03 00 1d 20 17 27 58 d2 5f 59 a3 |........ .'X._Y.| +000002d0 62 62 d4 97 4a 49 c4 ff ec dc f7 d3 c9 ea f3 00 |bb..JI..........| +000002e0 61 1b d3 73 38 9e af 7d 17 00 80 59 7a 4e 55 97 |a..s8..}...YzNU.| +000002f0 5a 81 0e 2e 85 0b c2 61 f0 79 72 0e d1 d5 3b bf |Z......a.yr...;.| +00000300 6a 77 03 0a 9a 51 42 f5 98 2f 09 d5 7b 17 76 b8 |jw...QB../..{.v.| +00000310 2c a7 95 ee 61 65 d7 37 b3 1b 16 3c 48 7e 9d ed |,...ae.7...>> Flow 3 (client to server) +00000000 16 03 01 01 3c 0b 00 01 38 00 01 35 00 01 32 30 |....<...8..5..20| +00000010 82 01 2e 30 81 e1 a0 03 02 01 02 02 10 17 d1 81 |...0............| +00000020 93 be 2a 8c 21 20 10 25 15 e8 34 23 4f 30 05 06 |..*.! .%..4#O0..| +00000030 03 2b 65 70 30 12 31 10 30 0e 06 03 55 04 0a 13 |.+ep0.1.0...U...| +00000040 07 41 63 6d 65 20 43 6f 30 1e 17 0d 31 39 30 35 |.Acme Co0...1905| +00000050 31 36 32 31 35 34 32 36 5a 17 0d 32 30 30 35 31 |16215426Z..20051| +00000060 35 32 31 35 34 32 36 5a 30 12 31 10 30 0e 06 03 |5215426Z0.1.0...| +00000070 55 04 0a 13 07 41 63 6d 65 20 43 6f 30 2a 30 05 |U....Acme Co0*0.| +00000080 06 03 2b 65 70 03 21 00 0b e0 b5 60 b5 e2 79 30 |..+ep.!....`..y0| +00000090 3d be e3 1e e0 50 b1 04 c8 6d c7 78 6c 69 2f c5 |=....P...m.xli/.| +000000a0 14 ad 9a 63 6f 79 12 91 a3 4d 30 4b 30 0e 06 03 |...coy...M0K0...| +000000b0 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 |U...........0...| +000000c0 55 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 |U.%..0...+......| +000000d0 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 |.0...U.......0.0| +000000e0 16 06 03 55 1d 11 04 0f 30 0d 82 0b 65 78 61 6d |...U....0...exam| +000000f0 70 6c 65 2e 63 6f 6d 30 05 06 03 2b 65 70 03 41 |ple.com0...+ep.A| +00000100 00 fc 19 17 2a 94 a5 31 fa 29 c8 2e 7f 5b a0 5d |....*..1.)...[.]| +00000110 8a 4e 34 40 39 d6 b3 10 dc 19 fe a0 22 71 b3 f5 |.N4@9......."q..| +00000120 8f a1 58 0d cd f4 f1 85 24 bf e6 3d 14 df df ed |..X.....$..=....| +00000130 0e e1 17 d8 11 a2 60 d0 8a 37 23 2a c2 46 aa 3a |......`..7#*.F.:| +00000140 08 16 03 01 00 25 10 00 00 21 20 2f e5 7d a3 47 |.....%...! /.}.G| +00000150 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af |.bC.(.._.).0....| +00000160 c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 01 00 46 |......_X.;t....F| +00000170 0f 00 00 42 00 40 14 6a d7 c1 9c 3d 81 fa e9 da |...B.@.j...=....| +00000180 96 5c 3a 09 e2 fc 36 e2 30 39 e4 6e 0d ac aa 54 |.\:...6.09.n...T| +00000190 24 4d 8c f0 35 14 b0 0b e9 5b 57 52 31 02 9f 6c |$M..5....[WR1..l| +000001a0 6f 6c d7 e9 b5 7f cb 30 fe b9 ba b9 7a 46 67 e3 |ol.....0....zFg.| +000001b0 a7 50 ca ce e4 04 14 03 01 00 01 01 16 03 01 00 |.P..............| +000001c0 30 8d 0a ca d1 5e 2c 7e 92 d0 69 f4 d9 e8 5d 0a |0....^,~..i...].| +000001d0 11 72 67 20 3e 80 64 29 e5 79 f5 33 ad 06 78 07 |.rg >.d).y.3..x.| +000001e0 4c 03 fc 2e 16 35 70 b1 72 e7 35 a9 cc 49 b8 29 |L....5p.r.5..I.)| +000001f0 30 |0| +>>> Flow 4 (server to client) +00000000 15 03 01 00 02 02 50 |......P| diff --git a/go/src/crypto/tls/testdata/Client-TLSv10-ClientCert-RSA-ECDSA b/go/src/crypto/tls/testdata/Client-TLSv10-ClientCert-RSA-ECDSA new file mode 100644 index 0000000000000000000000000000000000000000..8ce1bad1908d8e19c36e08227a853493b525bf00 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv10-ClientCert-RSA-ECDSA @@ -0,0 +1,135 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 01 00 5d 02 00 00 59 03 01 ef c9 5c 4d 29 |....]...Y....\M)| +00000010 07 24 2a 41 08 94 39 cc d3 fb 92 88 1c ff 64 6b |.$*A..9.......dk| +00000020 0a 14 41 89 c6 5d 9b 25 7e a7 04 20 a0 aa ad 46 |..A..].%~.. ...F| +00000030 14 01 d2 dd 37 44 05 4b 1d 9f ea e5 98 29 1e 36 |....7D.K.....).6| +00000040 09 e2 ab 90 93 ee c1 99 7d 17 77 9b c0 09 00 00 |........}.w.....| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 01 02 0e 0b 00 02 0a 00 02 07 00 02 |................| +00000070 04 30 82 02 00 30 82 01 62 02 09 00 b8 bf 2d 47 |.0...0..b.....-G| +00000080 a0 d2 eb f4 30 09 06 07 2a 86 48 ce 3d 04 01 30 |....0...*.H.=..0| +00000090 45 31 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 |E1.0...U....AU1.| +000000a0 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 |0...U....Some-St| +000000b0 61 74 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e |ate1!0...U....In| +000000c0 74 65 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 |ternet Widgits P| +000000d0 74 79 20 4c 74 64 30 1e 17 0d 31 32 31 31 32 32 |ty Ltd0...121122| +000000e0 31 35 30 36 33 32 5a 17 0d 32 32 31 31 32 30 31 |150632Z..2211201| +000000f0 35 30 36 33 32 5a 30 45 31 0b 30 09 06 03 55 04 |50632Z0E1.0...U.| +00000100 06 13 02 41 55 31 13 30 11 06 03 55 04 08 13 0a |...AU1.0...U....| +00000110 53 6f 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 |Some-State1!0...| +00000120 55 04 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 |U....Internet Wi| +00000130 64 67 69 74 73 20 50 74 79 20 4c 74 64 30 81 9b |dgits Pty Ltd0..| +00000140 30 10 06 07 2a 86 48 ce 3d 02 01 06 05 2b 81 04 |0...*.H.=....+..| +00000150 00 23 03 81 86 00 04 00 c4 a1 ed be 98 f9 0b 48 |.#.............H| +00000160 73 36 7e c3 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d |s6~..V.".=S.;M!=| +00000170 cd 6b 75 e6 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 |.ku......&.....r| +00000180 32 7c b3 64 2f 1c 90 bc ea 68 23 10 7e fe e3 25 |2|.d/....h#.~..%| +00000190 c0 48 3a 69 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 |.H:i.(m.7...b...| +000001a0 9c 70 62 83 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 |.pb....d1...1...| +000001b0 68 c0 9b 23 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 |h..#.vd?.\....XX| +000001c0 b6 5f 70 dd 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 |._p............0| +000001d0 66 5b 66 9a 20 e2 27 e5 bf fe 3b 30 09 06 07 2a |f[f. .'...;0...*| +000001e0 86 48 ce 3d 04 01 03 81 8c 00 30 81 88 02 42 01 |.H.=......0...B.| +000001f0 88 a2 4f eb e2 45 c5 48 7d 1b ac f5 ed 98 9d ae |..O..E.H}.......| +00000200 47 70 c0 5e 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 |Gp.^../...M.a@..| +00000210 a2 ce ee 0b 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce |....~.~.v..;~.?.| +00000220 fa 10 e2 59 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f |...Y.G-|..N....o| +00000230 d0 02 42 01 4d fc be 67 13 9c 2d 05 0e bd 3f a3 |..B.M..g..-...?.| +00000240 8c 25 c1 33 13 83 0d 94 06 bb d4 37 7a f6 ec 7a |.%.3.......7z..z| +00000250 c9 86 2e dd d7 11 69 7f 85 7c 56 de fb 31 78 2b |......i..|V..1x+| +00000260 e4 c7 78 0d ae cb be 9e 4e 36 24 31 7b 6a 0f 39 |..x.....N6$1{j.9| +00000270 95 12 07 8f 2a 16 03 01 00 b4 0c 00 00 b0 03 00 |....*...........| +00000280 1d 20 a4 4e 43 df 00 5c c7 1c e8 d4 8e 9b cf b0 |. .NC..\........| +00000290 36 85 64 7c d7 69 95 c0 b4 6f d8 0b 45 b8 a4 34 |6.d|.i...o..E..4| +000002a0 1a 18 00 8a 30 81 87 02 42 01 d0 4a 3f 65 9d 46 |....0...B..J?e.F| +000002b0 20 80 34 28 12 93 56 6e dc e4 0e 91 0b 45 4b 83 | .4(..Vn.....EK.| +000002c0 c5 e9 83 2c 41 d6 dc 49 15 15 e6 65 9f 18 ba a6 |...,A..I...e....| +000002d0 20 a6 de c7 20 7e 09 71 e6 59 86 9e aa 32 be 43 | ... ~.q.Y...2.C| +000002e0 b7 c3 27 98 ba 5b 49 9b 1d b9 67 02 41 4e 36 0e |..'..[I...g.AN6.| +000002f0 6d 29 c8 7d 0b d9 6f 06 92 ca 0b b9 33 7e 11 58 |m).}..o.....3~.X| +00000300 2f cc 06 ae ad 57 80 f4 38 a1 8a e3 6a ef 37 86 |/....W..8...j.7.| +00000310 58 1a 59 f9 4a 9a 64 89 5b 7c 8a 7a c5 78 dd b5 |X.Y.J.d.[|.z.x..| +00000320 6c 96 b8 23 ff fc 88 20 59 0b e9 74 99 b9 16 03 |l..#... Y..t....| +00000330 01 00 0a 0d 00 00 06 03 01 02 40 00 00 16 03 01 |..........@.....| +00000340 00 04 0e 00 00 00 |......| +>>> Flow 3 (client to server) +00000000 16 03 01 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0| +00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.| +00000020 c1 89 65 83 55 6f dc 0b c9 b9 93 9f e9 bc 30 0d |..e.Uo........0.| +00000030 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 12 31 |..*.H........0.1| +00000040 10 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 |.0...U....Acme C| +00000050 6f 30 1e 17 0d 31 36 30 38 31 37 32 31 35 32 33 |o0...16081721523| +00000060 31 5a 17 0d 31 37 30 38 31 37 32 31 35 32 33 31 |1Z..170817215231| +00000070 5a 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 63 |Z0.1.0...U....Ac| +00000080 6d 65 20 43 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |me Co0..0...*.H.| +00000090 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +000000a0 81 00 ba 6f aa 86 bd cf bf 9f f2 ef 5c 94 60 78 |...o........\.`x| +000000b0 6f e8 13 f2 d1 96 6f cd d9 32 6e 22 37 ce 41 f9 |o.....o..2n"7.A.| +000000c0 ca 5d 29 ac e1 27 da 61 a2 ee 81 cb 10 c7 df 34 |.])..'.a.......4| +000000d0 58 95 86 e9 3d 19 e6 5c 27 73 60 c8 8d 78 02 f4 |X...=..\'s`..x..| +000000e0 1d a4 98 09 a3 19 70 69 3c 25 62 66 2a ab 22 23 |......pi<%bf*."#| +000000f0 c5 7b 85 38 4f 2e 09 73 32 a7 bd 3e 9b ad ca 84 |.{.8O..s2..>....| +00000100 07 e6 0f 3a ff 77 c5 9d 41 85 00 8a b6 9b ee b0 |...:.w..A.......| +00000110 a4 3f 2d 4c 4c e6 42 3e bb 51 c8 dd 48 54 f4 0c |.?-LL.B>.Q..HT..| +00000120 8e 47 02 03 01 00 01 a3 46 30 44 30 0e 06 03 55 |.G......F0D0...U| +00000130 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 55 |...........0...U| +00000140 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......| +00000150 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0f |0...U.......0.0.| +00000160 06 03 55 1d 11 04 08 30 06 87 04 7f 00 00 01 30 |..U....0.......0| +00000170 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 |...*.H..........| +00000180 81 00 46 ab 44 a2 fb 28 54 f8 5a 67 f8 62 94 f1 |..F.D..(T.Zg.b..| +00000190 9a b2 18 9e f2 b1 de 1d 7e 6f 76 95 a9 ba e7 5d |........~ov....]| +000001a0 a8 16 6c 9c f7 09 d3 37 e4 4b 2b 36 7c 01 ad 41 |..l....7.K+6|..A| +000001b0 d2 32 d8 c3 d2 93 f9 10 6b 8e 95 b9 2c 17 8a a3 |.2......k...,...| +000001c0 44 48 bc 59 13 83 16 04 88 a4 81 5c 25 0d 98 0c |DH.Y.......\%...| +000001d0 ac 11 b1 28 56 be 1d cd 61 62 84 09 bf d6 80 c6 |...(V...ab......| +000001e0 45 8d 82 2c b4 d8 83 9b db c9 22 b7 2a 12 11 7b |E..,......".*..{| +000001f0 fa 02 3b c1 c9 ff ea c9 9d a8 49 d3 95 d7 d5 0e |..;.......I.....| +00000200 e5 35 16 03 01 00 25 10 00 00 21 20 2f e5 7d a3 |.5....%...! /.}.| +00000210 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...| +00000220 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 01 00 |......._X.;t....| +00000230 86 0f 00 00 82 00 80 a4 68 2d 1f 8a 97 43 76 aa |........h-...Cv.| +00000240 f9 24 95 20 62 13 c0 a3 45 c6 18 1c a3 34 70 02 |.$. b...E....4p.| +00000250 ff f5 01 4e ba e2 20 1c f9 06 a6 67 92 d9 e6 9d |...N.. ....g....| +00000260 a3 49 e0 75 3e 11 00 74 52 b1 36 58 4b 1e 54 83 |.I.u>..tR.6XK.T.| +00000270 e0 9a 48 4d df 2c ab fd cd 5e 7a cf c9 b8 32 08 |..HM.,...^z...2.| +00000280 74 e6 ae 75 20 f4 41 3a 7c a9 a3 19 38 a0 8d 05 |t..u .A:|...8...| +00000290 0a e9 3e 50 6c f6 f8 a3 89 a9 55 ea dc 3f be b1 |..>Pl.....U..?..| +000002a0 0a 92 83 cc f0 9b c9 e1 49 13 db 64 be 55 46 b5 |........I..d.UF.| +000002b0 12 b1 0b 88 32 e3 f1 14 03 01 00 01 01 16 03 01 |....2...........| +000002c0 00 30 81 77 0f 6c 7a bc a8 d2 41 f9 8b a7 da 96 |.0.w.lz...A.....| +000002d0 29 f1 2f b1 31 f3 57 03 09 21 5c fa dc f7 5c f6 |)./.1.W..!\...\.| +000002e0 7f a8 24 08 30 70 bb 34 16 22 f8 c6 b2 4d a7 16 |..$.0p.4."...M..| +000002f0 68 61 |ha| +>>> Flow 4 (server to client) +00000000 14 03 01 00 01 01 16 03 01 00 30 71 d2 ee cd f8 |..........0q....| +00000010 c5 fe b4 96 d5 02 ee cb f7 f8 93 34 f2 8a ed 71 |...........4...q| +00000020 9a b7 1f 01 9d fb 6c 3f ee 22 bb 5c b0 8c 08 f5 |......l?.".\....| +00000030 bf 1e d3 1c 12 ec 7b 86 05 bd e5 |......{....| +>>> Flow 5 (client to server) +00000000 17 03 01 00 20 8a 57 b3 89 76 41 f0 b3 51 da f4 |.... .W..vA..Q..| +00000010 e7 6a f8 46 75 77 4d 8b 67 41 f9 f9 eb a0 cd 12 |.j.FuwM.gA......| +00000020 78 08 12 d1 7b 17 03 01 00 20 9d 44 6a dd 48 ad |x...{.... .Dj.H.| +00000030 0a d9 3f 80 da b1 3d b3 50 be 40 c1 85 b5 bb 59 |..?...=.P.@....Y| +00000040 e8 b9 2a 9f f5 2e 98 d3 2b c1 15 03 01 00 20 bd |..*.....+..... .| +00000050 69 41 45 bb 53 de f8 b7 bf a5 87 12 02 32 1a 05 |iAE.S........2..| +00000060 09 94 40 a5 64 b3 31 7d 0d dc 01 ff 25 ca 31 |..@.d.1}....%.1| diff --git a/go/src/crypto/tls/testdata/Client-TLSv10-ClientCert-RSA-RSA b/go/src/crypto/tls/testdata/Client-TLSv10-ClientCert-RSA-RSA new file mode 100644 index 0000000000000000000000000000000000000000..37d05fc481914fbb5606117235e6ece5bf6ac585 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv10-ClientCert-RSA-RSA @@ -0,0 +1,139 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 01 00 5d 02 00 00 59 03 01 71 32 68 84 f2 |....]...Y..q2h..| +00000010 93 91 32 5b 71 e6 d1 fd 26 83 00 87 0f 56 f3 8a |..2[q...&....V..| +00000020 70 17 5e c9 c3 b3 ce 61 9a 1d 4d 20 85 cc 39 26 |p.^....a..M ..9&| +00000030 32 1a 78 34 d5 d3 6c e2 df 89 f5 a0 51 2c f5 2d |2.x4..l.....Q,.-| +00000040 e0 17 51 e7 51 f4 61 8d 35 72 75 92 c0 13 00 00 |..Q.Q.a.5ru.....| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 01 02 59 0b 00 02 55 00 02 52 00 02 |......Y...U..R..| +00000070 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 |O0..K0..........| +00000080 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 |....?.[..0...*.H| +00000090 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 |........0.1.0...| +000000a0 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 |U....Go1.0...U..| +000000b0 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 |..Go Root0...160| +000000c0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| +000000d0 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 |01000000Z0.1.0..| +000000e0 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 |.U....Go1.0...U.| +000000f0 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |...Go0..0...*.H.| +00000100 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +00000110 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab |...F}...'.H..(!.| +00000120 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d |~...]..RE.z6G...| +00000130 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd |.B[.....y.@.Om..| +00000140 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a |+.....g....."8.J| +00000150 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 |.ts+.4......t{.X| +00000160 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c |.la<..A..++$#w[.| +00000170 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 |;.u]. T..c...$..| +00000180 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 |..P....C...ub...| +00000190 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 |R.........0..0..| +000001a0 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 |.U...........0..| +000001b0 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 |.U.%..0...+.....| +000001c0 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 |....+.......0...| +000001d0 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d |U.......0.0...U.| +000001e0 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d |.........CC>I..m| +000001f0 b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 |....`0...U.#..0.| +00000200 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab |..H.IM.~.1......| +00000210 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |n{0...U....0...e| +00000220 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| +00000230 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| +00000240 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed |.0.@+[P.a...SX..| +00000250 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 |.(.X..8....1Z..f| +00000260 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a |=C.-...... d8.$:| +00000270 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 |....}.@ ._...a..| +00000280 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed |v......\.....l..| +00000290 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 |s..Cw.......@.a.| +000002a0 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 |Lr+...F..M...>..| +000002b0 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 |.B...=.`.\!.;...| +000002c0 16 03 01 00 aa 0c 00 00 a6 03 00 1d 20 3a 64 e7 |............ :d.| +000002d0 9a 59 c3 4e fc 40 5e 2f 5c 89 cd e1 94 85 4e 1f |.Y.N.@^/\.....N.| +000002e0 29 37 0b 53 fe 3a 13 76 56 25 2a 97 65 00 80 08 |)7.S.:.vV%*.e...| +000002f0 1c de 63 0d 31 9b 72 7b 85 0c 03 b0 08 ea 80 a1 |..c.1.r{........| +00000300 ee 00 03 f9 29 a3 ba 8e c8 71 3e b4 4d b3 28 54 |....)....q>.M.(T| +00000310 2c e7 11 3a 15 e0 43 06 f0 36 15 50 54 5e 88 48 |,..:..C..6.PT^.H| +00000320 ac c4 68 db 83 dc 0c 22 e4 99 4a 08 2a 00 7d 19 |..h...."..J.*.}.| +00000330 0d 74 ba 7a 27 9c 39 dc 29 41 52 cf a2 ac 29 94 |.t.z'.9.)AR...).| +00000340 e6 b0 87 60 e5 d3 58 af 3e 8e 41 bd be 48 ba 90 |...`..X.>.A..H..| +00000350 49 b2 b1 d3 8e b0 49 98 4a 12 70 60 c7 57 d9 a7 |I.....I.J.p`.W..| +00000360 db dc 41 b0 dc 81 37 1b 6d ac 9c 69 12 f4 fa 16 |..A...7.m..i....| +00000370 03 01 00 0a 0d 00 00 06 03 01 02 40 00 00 16 03 |...........@....| +00000380 01 00 04 0e 00 00 00 |.......| +>>> Flow 3 (client to server) +00000000 16 03 01 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0| +00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.| +00000020 c1 89 65 83 55 6f dc 0b c9 b9 93 9f e9 bc 30 0d |..e.Uo........0.| +00000030 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 12 31 |..*.H........0.1| +00000040 10 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 |.0...U....Acme C| +00000050 6f 30 1e 17 0d 31 36 30 38 31 37 32 31 35 32 33 |o0...16081721523| +00000060 31 5a 17 0d 31 37 30 38 31 37 32 31 35 32 33 31 |1Z..170817215231| +00000070 5a 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 63 |Z0.1.0...U....Ac| +00000080 6d 65 20 43 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |me Co0..0...*.H.| +00000090 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +000000a0 81 00 ba 6f aa 86 bd cf bf 9f f2 ef 5c 94 60 78 |...o........\.`x| +000000b0 6f e8 13 f2 d1 96 6f cd d9 32 6e 22 37 ce 41 f9 |o.....o..2n"7.A.| +000000c0 ca 5d 29 ac e1 27 da 61 a2 ee 81 cb 10 c7 df 34 |.])..'.a.......4| +000000d0 58 95 86 e9 3d 19 e6 5c 27 73 60 c8 8d 78 02 f4 |X...=..\'s`..x..| +000000e0 1d a4 98 09 a3 19 70 69 3c 25 62 66 2a ab 22 23 |......pi<%bf*."#| +000000f0 c5 7b 85 38 4f 2e 09 73 32 a7 bd 3e 9b ad ca 84 |.{.8O..s2..>....| +00000100 07 e6 0f 3a ff 77 c5 9d 41 85 00 8a b6 9b ee b0 |...:.w..A.......| +00000110 a4 3f 2d 4c 4c e6 42 3e bb 51 c8 dd 48 54 f4 0c |.?-LL.B>.Q..HT..| +00000120 8e 47 02 03 01 00 01 a3 46 30 44 30 0e 06 03 55 |.G......F0D0...U| +00000130 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 55 |...........0...U| +00000140 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......| +00000150 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0f |0...U.......0.0.| +00000160 06 03 55 1d 11 04 08 30 06 87 04 7f 00 00 01 30 |..U....0.......0| +00000170 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 |...*.H..........| +00000180 81 00 46 ab 44 a2 fb 28 54 f8 5a 67 f8 62 94 f1 |..F.D..(T.Zg.b..| +00000190 9a b2 18 9e f2 b1 de 1d 7e 6f 76 95 a9 ba e7 5d |........~ov....]| +000001a0 a8 16 6c 9c f7 09 d3 37 e4 4b 2b 36 7c 01 ad 41 |..l....7.K+6|..A| +000001b0 d2 32 d8 c3 d2 93 f9 10 6b 8e 95 b9 2c 17 8a a3 |.2......k...,...| +000001c0 44 48 bc 59 13 83 16 04 88 a4 81 5c 25 0d 98 0c |DH.Y.......\%...| +000001d0 ac 11 b1 28 56 be 1d cd 61 62 84 09 bf d6 80 c6 |...(V...ab......| +000001e0 45 8d 82 2c b4 d8 83 9b db c9 22 b7 2a 12 11 7b |E..,......".*..{| +000001f0 fa 02 3b c1 c9 ff ea c9 9d a8 49 d3 95 d7 d5 0e |..;.......I.....| +00000200 e5 35 16 03 01 00 25 10 00 00 21 20 2f e5 7d a3 |.5....%...! /.}.| +00000210 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...| +00000220 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 01 00 |......._X.;t....| +00000230 86 0f 00 00 82 00 80 21 34 0c d8 10 ac 90 53 f9 |.......!4.....S.| +00000240 18 52 42 05 ca e8 c7 4f 33 c4 43 4b 8e 7c e4 23 |.RB....O3.CK.|.#| +00000250 21 6d e4 07 ef 3f 06 d1 ea 1c 9d 3b e0 d2 66 36 |!m...?.....;..f6| +00000260 b5 c9 a1 da fe 54 fd e0 fe 0c b6 12 90 93 41 1f |.....T........A.| +00000270 43 00 00 e4 a4 04 14 af 00 3e 1b db 16 d6 07 4b |C........>.....K| +00000280 55 2f ed 55 e1 e1 a8 8b d8 e1 fe cb 41 1d fe bc |U/.U........A...| +00000290 6d d9 ba 8f 2b 1c 26 19 9d 93 a9 78 fb 8a 54 59 |m...+.&....x..TY| +000002a0 76 3b 0a df e6 71 2c c0 63 dd 22 8d c6 70 ef 0e |v;...q,.c."..p..| +000002b0 4f 1b 4c da 65 11 f6 14 03 01 00 01 01 16 03 01 |O.L.e...........| +000002c0 00 30 b5 c2 b0 f3 b6 6c 4a 99 de f2 98 2f 37 2b |.0.....lJ..../7+| +000002d0 8a d8 ab 96 91 c2 9b cc 56 5c fb e1 4f 5b 89 09 |........V\..O[..| +000002e0 5f 94 05 60 0e 83 b5 49 9a 15 9b 0f 5d 1a 2b a2 |_..`...I....].+.| +000002f0 11 23 |.#| +>>> Flow 4 (server to client) +00000000 14 03 01 00 01 01 16 03 01 00 30 63 a2 f0 9b 1c |..........0c....| +00000010 48 6d 23 54 62 b1 2a 19 e7 89 51 fd 0d 83 97 87 |Hm#Tb.*...Q.....| +00000020 9b 73 31 11 5e 42 56 62 62 37 4d e5 e6 72 8a 6d |.s1.^BVbb7M..r.m| +00000030 a3 02 2b 2c 9e a5 1a 5c 34 f2 0d |..+,...\4..| +>>> Flow 5 (client to server) +00000000 17 03 01 00 20 63 1a 2c 25 27 68 ed de ba 94 52 |.... c.,%'h....R| +00000010 73 f2 7a 28 ed 8c e9 3f a2 48 9a 07 62 22 27 6d |s.z(...?.H..b"'m| +00000020 4e be ba e4 67 17 03 01 00 20 1d ee ac 7c fc a7 |N...g.... ...|..| +00000030 df 74 93 16 c6 ec 58 5e 04 5d 2e 98 0a ba 52 4f |.t....X^.]....RO| +00000040 a0 02 c5 79 c3 d6 f0 ab 8d 33 15 03 01 00 20 bb |...y.....3.... .| +00000050 54 a6 65 a7 c9 03 e7 83 ae a1 f3 26 9f 73 76 6b |T.e........&.svk| +00000060 e6 1e f7 e0 76 e5 ca 9f c8 87 14 ac 27 f1 e3 |....v.......'..| diff --git a/go/src/crypto/tls/testdata/Client-TLSv10-ECDHE-ECDSA-AES b/go/src/crypto/tls/testdata/Client-TLSv10-ECDHE-ECDSA-AES new file mode 100644 index 0000000000000000000000000000000000000000..a8593e249b046775705ddd22d4337d56b84a1ca3 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv10-ECDHE-ECDSA-AES @@ -0,0 +1,93 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 01 00 5d 02 00 00 59 03 01 3e 61 ab b7 94 |....]...Y..>a...| +00000010 d9 7c 76 db 26 b6 fc 86 00 8f c4 af bd c6 1a 22 |.|v.&.........."| +00000020 dd 72 ce 5d 2a 4c d8 61 a1 20 6b 20 c9 82 ca c9 |.r.]*L.a. k ....| +00000030 99 59 80 37 6c 01 d2 b3 b5 0d 68 9f 65 b0 15 7d |.Y.7l.....h.e..}| +00000040 a6 b0 15 b0 49 5a ae 38 d2 77 5e 06 c0 09 00 00 |....IZ.8.w^.....| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 01 02 0e 0b 00 02 0a 00 02 07 00 02 |................| +00000070 04 30 82 02 00 30 82 01 62 02 09 00 b8 bf 2d 47 |.0...0..b.....-G| +00000080 a0 d2 eb f4 30 09 06 07 2a 86 48 ce 3d 04 01 30 |....0...*.H.=..0| +00000090 45 31 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 |E1.0...U....AU1.| +000000a0 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 |0...U....Some-St| +000000b0 61 74 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e |ate1!0...U....In| +000000c0 74 65 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 |ternet Widgits P| +000000d0 74 79 20 4c 74 64 30 1e 17 0d 31 32 31 31 32 32 |ty Ltd0...121122| +000000e0 31 35 30 36 33 32 5a 17 0d 32 32 31 31 32 30 31 |150632Z..2211201| +000000f0 35 30 36 33 32 5a 30 45 31 0b 30 09 06 03 55 04 |50632Z0E1.0...U.| +00000100 06 13 02 41 55 31 13 30 11 06 03 55 04 08 13 0a |...AU1.0...U....| +00000110 53 6f 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 |Some-State1!0...| +00000120 55 04 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 |U....Internet Wi| +00000130 64 67 69 74 73 20 50 74 79 20 4c 74 64 30 81 9b |dgits Pty Ltd0..| +00000140 30 10 06 07 2a 86 48 ce 3d 02 01 06 05 2b 81 04 |0...*.H.=....+..| +00000150 00 23 03 81 86 00 04 00 c4 a1 ed be 98 f9 0b 48 |.#.............H| +00000160 73 36 7e c3 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d |s6~..V.".=S.;M!=| +00000170 cd 6b 75 e6 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 |.ku......&.....r| +00000180 32 7c b3 64 2f 1c 90 bc ea 68 23 10 7e fe e3 25 |2|.d/....h#.~..%| +00000190 c0 48 3a 69 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 |.H:i.(m.7...b...| +000001a0 9c 70 62 83 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 |.pb....d1...1...| +000001b0 68 c0 9b 23 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 |h..#.vd?.\....XX| +000001c0 b6 5f 70 dd 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 |._p............0| +000001d0 66 5b 66 9a 20 e2 27 e5 bf fe 3b 30 09 06 07 2a |f[f. .'...;0...*| +000001e0 86 48 ce 3d 04 01 03 81 8c 00 30 81 88 02 42 01 |.H.=......0...B.| +000001f0 88 a2 4f eb e2 45 c5 48 7d 1b ac f5 ed 98 9d ae |..O..E.H}.......| +00000200 47 70 c0 5e 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 |Gp.^../...M.a@..| +00000210 a2 ce ee 0b 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce |....~.~.v..;~.?.| +00000220 fa 10 e2 59 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f |...Y.G-|..N....o| +00000230 d0 02 42 01 4d fc be 67 13 9c 2d 05 0e bd 3f a3 |..B.M..g..-...?.| +00000240 8c 25 c1 33 13 83 0d 94 06 bb d4 37 7a f6 ec 7a |.%.3.......7z..z| +00000250 c9 86 2e dd d7 11 69 7f 85 7c 56 de fb 31 78 2b |......i..|V..1x+| +00000260 e4 c7 78 0d ae cb be 9e 4e 36 24 31 7b 6a 0f 39 |..x.....N6$1{j.9| +00000270 95 12 07 8f 2a 16 03 01 00 b5 0c 00 00 b1 03 00 |....*...........| +00000280 1d 20 73 36 95 70 b0 c6 fd c6 cf 68 f3 77 1e 46 |. s6.p.....h.w.F| +00000290 c2 22 3e f8 e6 f4 37 82 73 8e 8d ec 40 64 0d a9 |.">...7.s...@d..| +000002a0 f7 6f 00 8b 30 81 88 02 42 01 2f 8b 24 b7 24 65 |.o..0...B./.$.$e| +000002b0 6e f8 a3 55 53 3f da 67 a2 b6 35 b3 ef 8b 87 39 |n..US?.g..5....9| +000002c0 2f 44 e8 a6 9d 2c 16 c1 82 a9 a9 f6 20 0f 1b 36 |/D...,...... ..6| +000002d0 32 b8 7a 96 2d 5a b0 4d 43 53 ec c9 06 82 83 0e |2.z.-Z.MCS......| +000002e0 fb 0b 8c f8 0b 47 b6 dd 19 4c 96 02 42 01 c6 7e |.....G...L..B..~| +000002f0 20 9e d9 2f 33 1f 5f 25 bc 79 a3 df 96 9d e0 05 | ../3._%.y......| +00000300 d7 72 75 29 7d b3 f2 0a 5e 81 39 71 b7 f9 68 e8 |.ru)}...^.9q..h.| +00000310 82 07 93 80 88 31 77 2c db 8b 58 49 28 c5 7b c1 |.....1w,..XI(.{.| +00000320 e3 84 3c b9 08 2e a0 ab 66 12 b9 3c b9 a2 e8 16 |..<.....f..<....| +00000330 03 01 00 04 0e 00 00 00 |........| +>>> Flow 3 (client to server) +00000000 16 03 01 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 01 00 01 01 |....._X.;t......| +00000030 16 03 01 00 30 9a 24 ee 81 ee 6e b3 fe ab 63 04 |....0.$...n...c.| +00000040 ae b1 1b 11 91 b0 cc 45 b8 67 74 9e 92 15 fd b1 |.......E.gt.....| +00000050 b4 49 49 b4 f4 a5 61 01 1b ec 91 23 ec c0 98 8d |.II...a....#....| +00000060 ee 21 fd 29 95 |.!.).| +>>> Flow 4 (server to client) +00000000 14 03 01 00 01 01 16 03 01 00 30 74 d2 f1 68 1e |..........0t..h.| +00000010 1e 11 8a eb 51 ae a6 19 af 60 09 c4 85 65 3e 71 |....Q....`...e>q| +00000020 af d0 94 14 c3 80 18 91 72 23 97 26 f8 91 2f d6 |........r#.&../.| +00000030 65 3c 02 06 10 d0 bb e7 92 57 b0 |e<.......W.| +>>> Flow 5 (client to server) +00000000 17 03 01 00 20 bf f3 92 9c 91 50 02 1e d2 29 17 |.... .....P...).| +00000010 2c 5d 5f 43 c9 de 49 db 7b 0b bf eb 77 c5 9a 37 |,]_C..I.{...w..7| +00000020 c7 e1 c3 83 a3 17 03 01 00 20 df 80 0b 7e 80 39 |......... ...~.9| +00000030 b3 46 d8 7c 09 7a a8 c1 3a 04 77 2f 94 30 eb 8e |.F.|.z..:.w/.0..| +00000040 5d 56 08 95 bb 50 80 76 4b e7 15 03 01 00 20 0e |]V...P.vK..... .| +00000050 91 ba 25 bb d6 f6 ee 42 e0 8e 08 a1 7f d5 8f e3 |..%....B........| +00000060 18 05 85 24 b6 0c 81 80 98 89 ae 2c 04 0e 8a |...$.......,...| diff --git a/go/src/crypto/tls/testdata/Client-TLSv10-ECDHE-RSA-AES b/go/src/crypto/tls/testdata/Client-TLSv10-ECDHE-RSA-AES new file mode 100644 index 0000000000000000000000000000000000000000..b73fd761c46d7e86e867e74150b66a2ac259669a --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv10-ECDHE-RSA-AES @@ -0,0 +1,97 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 01 00 5d 02 00 00 59 03 01 79 f2 d6 96 d6 |....]...Y..y....| +00000010 6d c9 a1 7a 04 ba 6d 7d 29 8d 91 3f 8e 2e 17 0f |m..z..m})..?....| +00000020 c8 c4 3a e1 3c 64 00 28 f8 21 9d 20 16 7b 80 30 |..:.I..m| +000001f0 b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 |....`0...U.#..0.| +00000200 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab |..H.IM.~.1......| +00000210 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |n{0...U....0...e| +00000220 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| +00000230 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| +00000240 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed |.0.@+[P.a...SX..| +00000250 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 |.(.X..8....1Z..f| +00000260 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a |=C.-...... d8.$:| +00000270 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 |....}.@ ._...a..| +00000280 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed |v......\.....l..| +00000290 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 |s..Cw.......@.a.| +000002a0 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 |Lr+...F..M...>..| +000002b0 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 |.B...=.`.\!.;...| +000002c0 16 03 01 00 aa 0c 00 00 a6 03 00 1d 20 69 9e db |............ i..| +000002d0 5f 4b 5e 7d 1e 00 1e 91 a6 49 81 e3 d9 ee ea 5e |_K^}.....I.....^| +000002e0 5c 40 f0 68 fd dd eb 6e e4 85 58 91 70 00 80 8e |\@.h...n..X.p...| +000002f0 d6 64 01 3a 56 c2 58 5c 60 28 bc f6 bd 1e bf 73 |.d.:V.X\`(.....s| +00000300 21 b8 1a ea fb c2 df d5 f1 b9 4d d7 6f 1c 8b 24 |!.........M.o..$| +00000310 99 35 a5 ef 20 75 00 3e 83 34 da 40 4e ec e3 43 |.5.. u.>.4.@N..C| +00000320 04 a4 f2 1e bb 97 23 3e 21 32 88 43 80 99 ec 43 |......#>!2.C...C| +00000330 66 c3 09 87 1e e2 ad bb c3 1c db f7 9a 59 3a a8 |f............Y:.| +00000340 46 43 b6 3d 9a 6e c3 42 5b 1a 7d 85 dc db 96 cc |FC.=.n.B[.}.....| +00000350 8d 06 cc 08 d2 f0 09 c3 c6 ed 5f 3b f6 b0 a3 69 |.........._;...i| +00000360 6c a8 9a a5 ef ad 59 c1 07 96 e8 34 1d f0 d9 16 |l.....Y....4....| +00000370 03 01 00 04 0e 00 00 00 |........| +>>> Flow 3 (client to server) +00000000 16 03 01 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 01 00 01 01 |....._X.;t......| +00000030 16 03 01 00 30 d1 17 2f 22 e5 fa 78 a0 b3 d3 22 |....0../"..x..."| +00000040 ab cb d2 54 52 e6 b2 74 11 bd 3c 69 9a 71 e8 69 |...TR..t..>> Flow 4 (server to client) +00000000 14 03 01 00 01 01 16 03 01 00 30 d1 2e 43 5c f7 |..........0..C\.| +00000010 fc 5f 96 b7 e6 84 60 08 aa b3 22 d1 d9 e2 f3 4d |._....`..."....M| +00000020 c8 44 62 9b fa 0e 18 7c 84 fe 1e 75 09 4a f4 94 |.Db....|...u.J..| +00000030 67 03 91 79 90 26 70 2d 0e 97 6a |g..y.&p-..j| +>>> Flow 5 (client to server) +00000000 17 03 01 00 20 c9 ce 68 cc e9 a7 f7 1f 3c 19 76 |.... ..h.....<.v| +00000010 4e a6 2d 64 86 4d 35 9b 5e 5b 8b c7 a1 15 d9 d4 |N.-d.M5.^[......| +00000020 5e 59 67 df 4d 17 03 01 00 20 26 09 76 e2 16 41 |^Yg.M.... &.v..A| +00000030 a3 7f 3e 8e cc 75 ab a0 cf e1 42 8d 3c 51 d4 bb |..>..u....B.>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 01 00 5d 02 00 00 59 03 01 97 c9 b8 e6 c1 |....]...Y.......| +00000010 0e b3 68 29 30 ed ff df a6 f3 cd b7 e0 80 a9 76 |..h)0..........v| +00000020 84 1b 45 bb 42 29 e0 c8 7f 52 4b 20 95 97 03 66 |..E.B)...RK ...f| +00000030 6b 45 44 7c 5d 4b 9e 47 fc 72 53 5d 3c 8a 28 6e |kED|]K.G.rS]<.(n| +00000040 bc 40 6d c3 96 67 f9 f2 72 ec 6d 0d c0 13 00 00 |.@m..g..r.m.....| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 01 02 59 0b 00 02 55 00 02 52 00 02 |......Y...U..R..| +00000070 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 |O0..K0..........| +00000080 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 |....?.[..0...*.H| +00000090 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 |........0.1.0...| +000000a0 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 |U....Go1.0...U..| +000000b0 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 |..Go Root0...160| +000000c0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| +000000d0 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 |01000000Z0.1.0..| +000000e0 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 |.U....Go1.0...U.| +000000f0 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |...Go0..0...*.H.| +00000100 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +00000110 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab |...F}...'.H..(!.| +00000120 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d |~...]..RE.z6G...| +00000130 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd |.B[.....y.@.Om..| +00000140 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a |+.....g....."8.J| +00000150 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 |.ts+.4......t{.X| +00000160 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c |.la<..A..++$#w[.| +00000170 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 |;.u]. T..c...$..| +00000180 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 |..P....C...ub...| +00000190 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 |R.........0..0..| +000001a0 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 |.U...........0..| +000001b0 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 |.U.%..0...+.....| +000001c0 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 |....+.......0...| +000001d0 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d |U.......0.0...U.| +000001e0 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d |.........CC>I..m| +000001f0 b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 |....`0...U.#..0.| +00000200 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab |..H.IM.~.1......| +00000210 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |n{0...U....0...e| +00000220 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| +00000230 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| +00000240 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed |.0.@+[P.a...SX..| +00000250 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 |.(.X..8....1Z..f| +00000260 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a |=C.-...... d8.$:| +00000270 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 |....}.@ ._...a..| +00000280 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed |v......\.....l..| +00000290 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 |s..Cw.......@.a.| +000002a0 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 |Lr+...F..M...>..| +000002b0 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 |.B...=.`.\!.;...| +000002c0 16 03 01 00 aa 0c 00 00 a6 03 00 1d 20 15 0b 17 |............ ...| +000002d0 fd fb 69 3e 44 71 3c 68 b2 6a 99 9e 8c 57 ba e8 |..i>Dq.$.`....9...Z| +00000300 12 2c c9 3e a7 db 25 ab 32 32 e4 79 9e 0a 9f 98 |.,.>..%.22.y....| +00000310 99 cd be b3 28 34 40 e1 78 3e 3d 20 35 74 79 7f |....(4@.x>= 5ty.| +00000320 f6 c5 5d 4c 54 30 1d 64 31 49 78 bd a2 cb 62 5a |..]LT0.d1Ix...bZ| +00000330 89 1a bf 65 bf 7f 1c ff 7d 61 6c 7d d2 76 8c 9e |...e....}al}.v..| +00000340 e4 80 56 7d 96 79 48 36 ca c0 99 db 9b ea 3a e7 |..V}.yH6......:.| +00000350 a7 fe cb ed d8 3b 34 8c be d5 ee be 59 d5 e2 5f |.....;4.....Y.._| +00000360 59 17 f3 57 29 eb c8 0e ed 1a 06 79 c0 3c 16 16 |Y..W)......y.<..| +00000370 03 01 00 04 0e 00 00 00 |........| +>>> Flow 3 (client to server) +00000000 16 03 01 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 01 00 01 01 |....._X.;t......| +00000030 16 03 01 00 30 c6 d7 ad 2c 52 90 50 3c 50 ec 66 |....0...,R.P>> Flow 4 (server to client) +00000000 14 03 01 00 01 01 16 03 01 00 30 8c a1 03 f1 fb |..........0.....| +00000010 fe f8 1b 43 7b fb 10 59 c3 ed b3 34 b9 74 e1 89 |...C{..Y...4.t..| +00000020 7f 5c 9b 81 b1 4f 13 bf 67 c5 87 92 31 96 7f e7 |.\...O..g...1...| +00000030 35 7b b0 da 2c 79 2e be 43 f4 cf |5{..,y..C..| +>>> Flow 5 (client to server) +00000000 17 03 01 00 20 61 e8 5a b2 15 88 f2 f9 e2 09 61 |.... a.Z.......a| +00000010 53 a5 7f 79 4b e8 c7 8d a9 5d 29 bf b9 0a 1d f7 |S..yK....]).....| +00000020 90 9f 3b 89 39 17 03 01 00 20 86 93 3b 08 7f 77 |..;.9.... ..;..w| +00000030 55 e5 51 06 ca 0e 80 96 9d 40 73 55 45 18 28 c7 |U.Q......@sUE.(.| +00000040 54 6a d8 15 d7 67 1e 4b 52 1e 15 03 01 00 20 56 |Tj...g.KR..... V| +00000050 d8 23 be 5a 8a a8 a4 8f 13 2f f0 34 24 90 96 87 |.#.Z...../.4$...| +00000060 59 48 3f 76 77 47 d5 eb 4d cb 80 00 bc 11 cf |YH?vwG..M......| diff --git a/go/src/crypto/tls/testdata/Client-TLSv10-RSA-RC4 b/go/src/crypto/tls/testdata/Client-TLSv10-RSA-RC4 new file mode 100644 index 0000000000000000000000000000000000000000..c217b1112ac1ff1bf70951485e247aa4ab181be1 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv10-RSA-RC4 @@ -0,0 +1,87 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 01 00 55 02 00 00 51 03 01 6a dd d7 0d bb |....U...Q..j....| +00000010 bd b4 9c de 87 94 32 27 fa 4b 66 e0 8b 95 f2 11 |......2'.Kf.....| +00000020 a0 a5 30 15 34 6f 76 6b f7 23 ec 20 ef 7d 52 7d |..0.4ovk.#. .}R}| +00000030 2c 3b 30 1b f2 16 e7 8f b6 62 64 79 51 5b 31 36 |,;0......bdyQ[16| +00000040 b7 59 b1 f9 d5 26 d6 21 94 ff 7f bd 00 05 00 00 |.Y...&.!........| +00000050 09 ff 01 00 01 00 00 17 00 00 16 03 01 02 59 0b |..............Y.| +00000060 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 82 01 |..U..R..O0..K0..| +00000070 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 5b ea |............?.[.| +00000080 a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |.0...*.H........| +00000090 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 |0.1.0...U....Go1| +000000a0 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 6f 6f |.0...U....Go Roo| +000000b0 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 30 30 |t0...16010100000| +000000c0 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 30 30 |0Z..250101000000| +000000d0 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 47 6f |Z0.1.0...U....Go| +000000e0 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 81 9f |1.0...U....Go0..| +000000f0 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 |0...*.H.........| +00000100 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 2e 12 |...0.......F}...| +00000110 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 |'.H..(!.~...]..R| +00000120 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 |E.z6G....B[.....| +00000130 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 |y.@.Om..+.....g.| +00000140 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 |...."8.J.ts+.4..| +00000150 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 |....t{.X.la<..A.| +00000160 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf |.++$#w[.;.u]. T.| +00000170 a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 |.c...$....P....C| +00000180 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 |...ub...R.......| +00000190 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 ff 04 |..0..0...U......| +000001a0 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 30 14 |.....0...U.%..0.| +000001b0 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 01 05 |..+.........+...| +000001c0 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 |....0...U.......| +000001d0 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f 91 16 |0.0...U.........| +000001e0 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 |.CC>I..m....`0..| +000001f0 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d 13 7e |.U.#..0...H.IM.~| +00000200 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 55 1d |.1......n{0...U.| +00000210 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 2e 67 |...0...example.g| +00000220 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 0d 01 |olang0...*.H....| +00000230 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 |.........0.@+[P.| +00000240 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 |a...SX...(.X..8.| +00000250 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 |...1Z..f=C.-....| +00000260 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 40 20 |.. d8.$:....}.@ | +00000270 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c |._...a..v......\| +00000280 ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c |.....l..s..Cw...| +00000290 f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db 46 06 |....@.a.Lr+...F.| +000002a0 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 |.M...>...B...=.`| +000002b0 84 5c 21 d3 3b e9 fa e7 16 03 01 00 04 0e 00 00 |.\!.;...........| +000002c0 00 |.| +>>> Flow 3 (client to server) +00000000 16 03 01 00 86 10 00 00 82 00 80 b9 65 8d bf a7 |............e...| +00000010 c8 4b 79 ce 6f cb 8b 13 1c ac b9 7d 66 5e e9 ba |.Ky.o......}f^..| +00000020 1d 71 4e a9 e9 34 ae f6 64 65 90 3b d8 16 52 a2 |.qN..4..de.;..R.| +00000030 6f f4 cb 8a 13 74 a2 ee b7 27 69 b4 41 c0 90 68 |o....t...'i.A..h| +00000040 bc 02 69 e1 c6 48 4f 39 36 30 25 ca 4c 17 ce 83 |..i..HO960%.L...| +00000050 9e 08 56 e3 05 49 93 9e 2e c4 fb e6 c8 01 f1 0f |..V..I..........| +00000060 c5 70 0f 08 83 48 e9 48 ef 6e 50 8b 05 7e e5 84 |.p...H.H.nP..~..| +00000070 25 fa 55 c7 ae 31 02 27 00 ef 3f 98 86 20 12 89 |%.U..1.'..?.. ..| +00000080 91 59 28 b4 f7 d7 af d2 69 61 35 14 03 01 00 01 |.Y(.....ia5.....| +00000090 01 16 03 01 00 24 0e 49 42 d7 a8 ca 08 09 a6 63 |.....$.IB......c| +000000a0 0f b1 4b 06 30 37 5e cb 3a c8 d6 ce f9 9c bf 2f |..K.07^.:....../| +000000b0 4a c1 c7 fb 2e 02 a6 b0 de ed |J.........| +>>> Flow 4 (server to client) +00000000 14 03 01 00 01 01 16 03 01 00 24 ea 96 7b ce ae |..........$..{..| +00000010 69 a8 0d 6d 0c af a7 4f 5f 27 8d 2a 99 38 18 5a |i..m...O_'.*.8.Z| +00000020 f4 4f 67 56 0a 6a f5 fc f5 ee a0 44 01 b0 d0 |.OgV.j.....D...| +>>> Flow 5 (client to server) +00000000 17 03 01 00 1a d3 71 0b 8e 0d d4 e0 06 04 e2 30 |......q........0| +00000010 59 2c fe 84 81 45 1c e4 59 90 b1 b1 11 85 cb 15 |Y,...E..Y.......| +00000020 03 01 00 16 ad 5d 98 96 4e 9d 83 af b0 50 64 77 |.....]..N....Pdw| +00000030 62 a1 2b 1a 63 59 16 9e 60 da |b.+.cY..`.| diff --git a/go/src/crypto/tls/testdata/Client-TLSv11-ECDHE-ECDSA-AES b/go/src/crypto/tls/testdata/Client-TLSv11-ECDHE-ECDSA-AES new file mode 100644 index 0000000000000000000000000000000000000000..dbaefe8eb36ee792a8c9f7fd9c5c441d149e0bda --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv11-ECDHE-ECDSA-AES @@ -0,0 +1,95 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 02 00 5d 02 00 00 59 03 02 14 c4 6e 18 e9 |....]...Y....n..| +00000010 5b 74 0d 7f 05 01 75 e3 a3 af 90 f0 ea e3 a8 f0 |[t....u.........| +00000020 6e b5 7d 29 97 4d f3 7e e9 06 20 20 ba 37 13 9f |n.}).M.~.. .7..| +00000030 4e dd 10 6d 52 96 14 d0 93 3b 99 5b c2 cd f3 9c |N..mR....;.[....| +00000040 48 c1 12 78 c2 e5 e7 9d a1 d6 b4 da c0 09 00 00 |H..x............| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 02 02 0e 0b 00 02 0a 00 02 07 00 02 |................| +00000070 04 30 82 02 00 30 82 01 62 02 09 00 b8 bf 2d 47 |.0...0..b.....-G| +00000080 a0 d2 eb f4 30 09 06 07 2a 86 48 ce 3d 04 01 30 |....0...*.H.=..0| +00000090 45 31 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 |E1.0...U....AU1.| +000000a0 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 |0...U....Some-St| +000000b0 61 74 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e |ate1!0...U....In| +000000c0 74 65 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 |ternet Widgits P| +000000d0 74 79 20 4c 74 64 30 1e 17 0d 31 32 31 31 32 32 |ty Ltd0...121122| +000000e0 31 35 30 36 33 32 5a 17 0d 32 32 31 31 32 30 31 |150632Z..2211201| +000000f0 35 30 36 33 32 5a 30 45 31 0b 30 09 06 03 55 04 |50632Z0E1.0...U.| +00000100 06 13 02 41 55 31 13 30 11 06 03 55 04 08 13 0a |...AU1.0...U....| +00000110 53 6f 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 |Some-State1!0...| +00000120 55 04 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 |U....Internet Wi| +00000130 64 67 69 74 73 20 50 74 79 20 4c 74 64 30 81 9b |dgits Pty Ltd0..| +00000140 30 10 06 07 2a 86 48 ce 3d 02 01 06 05 2b 81 04 |0...*.H.=....+..| +00000150 00 23 03 81 86 00 04 00 c4 a1 ed be 98 f9 0b 48 |.#.............H| +00000160 73 36 7e c3 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d |s6~..V.".=S.;M!=| +00000170 cd 6b 75 e6 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 |.ku......&.....r| +00000180 32 7c b3 64 2f 1c 90 bc ea 68 23 10 7e fe e3 25 |2|.d/....h#.~..%| +00000190 c0 48 3a 69 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 |.H:i.(m.7...b...| +000001a0 9c 70 62 83 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 |.pb....d1...1...| +000001b0 68 c0 9b 23 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 |h..#.vd?.\....XX| +000001c0 b6 5f 70 dd 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 |._p............0| +000001d0 66 5b 66 9a 20 e2 27 e5 bf fe 3b 30 09 06 07 2a |f[f. .'...;0...*| +000001e0 86 48 ce 3d 04 01 03 81 8c 00 30 81 88 02 42 01 |.H.=......0...B.| +000001f0 88 a2 4f eb e2 45 c5 48 7d 1b ac f5 ed 98 9d ae |..O..E.H}.......| +00000200 47 70 c0 5e 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 |Gp.^../...M.a@..| +00000210 a2 ce ee 0b 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce |....~.~.v..;~.?.| +00000220 fa 10 e2 59 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f |...Y.G-|..N....o| +00000230 d0 02 42 01 4d fc be 67 13 9c 2d 05 0e bd 3f a3 |..B.M..g..-...?.| +00000240 8c 25 c1 33 13 83 0d 94 06 bb d4 37 7a f6 ec 7a |.%.3.......7z..z| +00000250 c9 86 2e dd d7 11 69 7f 85 7c 56 de fb 31 78 2b |......i..|V..1x+| +00000260 e4 c7 78 0d ae cb be 9e 4e 36 24 31 7b 6a 0f 39 |..x.....N6$1{j.9| +00000270 95 12 07 8f 2a 16 03 02 00 b5 0c 00 00 b1 03 00 |....*...........| +00000280 1d 20 d1 90 13 d3 6d b1 e1 ec a3 e1 8b a1 d6 a6 |. ....m.........| +00000290 40 ac 8e cf 6e 42 06 7d a8 80 9a 9e a8 06 00 84 |@...nB.}........| +000002a0 69 1f 00 8b 30 81 88 02 42 01 b6 ba 66 1c de c4 |i...0...B...f...| +000002b0 8b a1 4a a7 0e f5 cb aa 5c 76 65 59 ba bb e2 7f |..J.....\veY....| +000002c0 a5 ee 91 26 77 40 e9 5d 25 73 5a d6 f9 b4 aa ac |...&w@.]%sZ.....| +000002d0 c8 bd 2b a4 95 b3 ef e0 c7 bb f1 d0 5e da 76 34 |..+.........^.v4| +000002e0 a4 34 5b 6c d6 c8 3b 13 b1 d0 12 02 42 01 e1 18 |.4[l..;.....B...| +000002f0 d5 90 79 c5 06 00 6b 7a 86 19 e0 2f 67 49 db 9e |..y...kz.../gI..| +00000300 4a 74 07 30 51 15 7b a1 01 89 9c 94 d8 17 18 a6 |Jt.0Q.{.........| +00000310 31 aa fb 4b 57 24 52 00 41 1d cc 36 89 6e b4 ed |1..KW$R.A..6.n..| +00000320 fc 23 33 63 dd 94 3b 40 6f f1 af d7 78 27 0c 16 |.#3c..;@o...x'..| +00000330 03 02 00 04 0e 00 00 00 |........| +>>> Flow 3 (client to server) +00000000 16 03 02 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 02 00 01 01 |....._X.;t......| +00000030 16 03 02 00 40 00 00 00 00 00 00 00 00 00 00 00 |....@...........| +00000040 00 00 00 00 00 bd f5 0b 25 31 b7 e6 3f 74 dc 39 |........%1..?t.9| +00000050 c8 a4 f5 3f 78 f5 6f 66 1b 59 53 51 40 d2 e1 14 |...?x.of.YSQ@...| +00000060 56 96 ea 1f 08 30 3f 66 ca e4 e4 a0 b5 9f 60 9b |V....0?f......`.| +00000070 f8 b0 c7 b8 79 |....y| +>>> Flow 4 (server to client) +00000000 14 03 02 00 01 01 16 03 02 00 40 68 2d 60 78 1b |..........@h-`x.| +00000010 a7 b8 28 3a 2b f5 cd b8 ef 4e 8e ab 3c d5 67 7b |..(:+....N..<.g{| +00000020 1f 29 9e 59 de ca 43 3a 4c 0c f5 70 43 cb 0b 40 |.).Y..C:L..pC..@| +00000030 69 a3 7c f7 1a 3b 48 2f b8 a2 7c b4 4a 03 36 2a |i.|..;H/..|.J.6*| +00000040 24 c9 78 9a 06 6e 18 2e 4a c0 54 |$.x..n..J.T| +>>> Flow 5 (client to server) +00000000 17 03 02 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| +00000010 00 00 00 00 00 f6 ff 38 da 12 09 78 fe de fb 0f |.......8...x....| +00000020 ea d3 5a d8 57 65 73 78 41 2d 0b 1b a4 8d f6 e7 |..Z.WesxA-......| +00000030 ed 58 97 c9 ea 15 03 02 00 30 00 00 00 00 00 00 |.X.......0......| +00000040 00 00 00 00 00 00 00 00 00 00 7d 4a 10 43 93 8a |..........}J.C..| +00000050 6d d2 50 34 92 22 24 f6 7a 9a c4 1f 57 e8 6d f8 |m.P4."$.z...W.m.| +00000060 74 c4 cb 8b e0 4d 99 dd ce 0a |t....M....| diff --git a/go/src/crypto/tls/testdata/Client-TLSv11-ECDHE-RSA-AES b/go/src/crypto/tls/testdata/Client-TLSv11-ECDHE-RSA-AES new file mode 100644 index 0000000000000000000000000000000000000000..d0093da76c9ec5e2cda561d086e6bd4b621d682c --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv11-ECDHE-RSA-AES @@ -0,0 +1,99 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 02 00 5d 02 00 00 59 03 02 3d 12 00 a1 c0 |....]...Y..=....| +00000010 6f b2 13 96 d8 c3 b6 4e 81 60 03 60 fa 9a 4b 54 |o......N.`.`..KT| +00000020 a9 1d e3 e9 10 e6 8d 84 e3 af 76 20 7c 6d 5c 41 |..........v |m\A| +00000030 f6 19 49 92 b0 d2 1d 74 22 5d 6a 3f c6 5e 77 c0 |..I....t"]j?.^w.| +00000040 c4 bb 31 2d 62 8d 7b 5c 66 6d c4 94 c0 13 00 00 |..1-b.{\fm......| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 02 02 59 0b 00 02 55 00 02 52 00 02 |......Y...U..R..| +00000070 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 |O0..K0..........| +00000080 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 |....?.[..0...*.H| +00000090 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 |........0.1.0...| +000000a0 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 |U....Go1.0...U..| +000000b0 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 |..Go Root0...160| +000000c0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| +000000d0 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 |01000000Z0.1.0..| +000000e0 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 |.U....Go1.0...U.| +000000f0 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |...Go0..0...*.H.| +00000100 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +00000110 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab |...F}...'.H..(!.| +00000120 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d |~...]..RE.z6G...| +00000130 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd |.B[.....y.@.Om..| +00000140 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a |+.....g....."8.J| +00000150 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 |.ts+.4......t{.X| +00000160 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c |.la<..A..++$#w[.| +00000170 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 |;.u]. T..c...$..| +00000180 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 |..P....C...ub...| +00000190 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 |R.........0..0..| +000001a0 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 |.U...........0..| +000001b0 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 |.U.%..0...+.....| +000001c0 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 |....+.......0...| +000001d0 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d |U.......0.0...U.| +000001e0 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d |.........CC>I..m| +000001f0 b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 |....`0...U.#..0.| +00000200 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab |..H.IM.~.1......| +00000210 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |n{0...U....0...e| +00000220 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| +00000230 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| +00000240 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed |.0.@+[P.a...SX..| +00000250 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 |.(.X..8....1Z..f| +00000260 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a |=C.-...... d8.$:| +00000270 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 |....}.@ ._...a..| +00000280 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed |v......\.....l..| +00000290 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 |s..Cw.......@.a.| +000002a0 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 |Lr+...F..M...>..| +000002b0 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 |.B...=.`.\!.;...| +000002c0 16 03 02 00 aa 0c 00 00 a6 03 00 1d 20 73 f2 57 |............ s.W| +000002d0 12 5a 50 bb 9d 2d 14 f0 ca ee c1 41 bf da 9e 8e |.ZP..-.....A....| +000002e0 d5 a9 25 c3 84 07 e7 5c 35 87 8b 70 3d 00 80 d3 |..%....\5..p=...| +000002f0 86 1b 82 48 5c 14 9b cf e4 a0 2b 24 bc 8c ad e9 |...H\.....+$....| +00000300 7c 1e 4f da c2 22 10 91 76 47 bc 9f 64 ca 1c 69 ||.O.."..vG..d..i| +00000310 77 c0 c7 2c 50 ea 1a 07 d0 8c ec da aa ed 82 9d |w..,P...........| +00000320 a5 6c d6 27 05 f8 24 19 f9 d4 b1 c6 e3 0f 49 6f |.l.'..$.......Io| +00000330 e4 47 25 9a 36 f1 d3 ed b1 b5 a0 cc 66 50 75 64 |.G%.6.......fPud| +00000340 97 ee 3c 65 84 1b 62 f8 1a 8f 02 5a d4 2c 49 b3 |..>> Flow 3 (client to server) +00000000 16 03 02 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 02 00 01 01 |....._X.;t......| +00000030 16 03 02 00 40 00 00 00 00 00 00 00 00 00 00 00 |....@...........| +00000040 00 00 00 00 00 93 60 ad fa 30 93 3e 31 6d 2c 0c |......`..0.>1m,.| +00000050 21 3d 6a 53 b1 51 f9 a9 1f 74 ee 42 7a 90 8a 08 |!=jS.Q...t.Bz...| +00000060 9e a0 7f 42 19 c4 28 06 77 bb 32 c1 a0 0d ec 71 |...B..(.w.2....q| +00000070 4f 20 89 c1 7d |O ..}| +>>> Flow 4 (server to client) +00000000 14 03 02 00 01 01 16 03 02 00 40 fb 97 d9 4a c6 |..........@...J.| +00000010 10 21 6f 7b 77 ba e0 41 b2 50 d3 8c df 54 b1 9f |.!o{w..A.P...T..| +00000020 98 55 e7 0e fb bd 25 67 fb fb 5a 5c 86 b8 f0 17 |.U....%g..Z\....| +00000030 2b 56 b3 81 21 45 58 98 38 63 24 0a ec aa 17 55 |+V..!EX.8c$....U| +00000040 8c 46 67 a6 44 57 00 8d 49 83 28 |.Fg.DW..I.(| +>>> Flow 5 (client to server) +00000000 17 03 02 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| +00000010 00 00 00 00 00 e7 87 56 3d 84 0b 17 94 41 94 67 |.......V=....A.g| +00000020 48 ff 0f e4 2d a9 1c 7a 68 fc 42 36 17 27 b0 66 |H...-..zh.B6.'.f| +00000030 af 97 25 90 a2 15 03 02 00 30 00 00 00 00 00 00 |..%......0......| +00000040 00 00 00 00 00 00 00 00 00 00 55 a4 8a bc 52 98 |..........U...R.| +00000050 07 3a dd 7a dc 4f 2c 8d f2 1b f0 76 09 ca 88 36 |.:.z.O,....v...6| +00000060 d4 fa f9 f4 b7 2e ce 6e 26 82 |.......n&.| diff --git a/go/src/crypto/tls/testdata/Client-TLSv11-Ed25519 b/go/src/crypto/tls/testdata/Client-TLSv11-Ed25519 new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/go/src/crypto/tls/testdata/Client-TLSv11-RSA-RC4 b/go/src/crypto/tls/testdata/Client-TLSv11-RSA-RC4 new file mode 100644 index 0000000000000000000000000000000000000000..64b06a8f17a035afd6f691d66b3f2eac76bef8b6 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv11-RSA-RC4 @@ -0,0 +1,87 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 02 00 55 02 00 00 51 03 02 3d a4 ea 71 81 |....U...Q..=..q.| +00000010 c9 47 24 2b 53 22 83 07 df 5a 9e 76 ef ca d8 1b |.G$+S"...Z.v....| +00000020 1f 16 15 cd 7e e4 62 93 1e 5d a7 20 9d ac ea 5a |....~.b..]. ...Z| +00000030 9e e3 7c 14 94 9d 1b 9e 2a 7b 2d 80 55 85 2f 9e |..|.....*{-.U./.| +00000040 ed 17 20 79 66 a2 6c 88 81 cb b0 79 00 05 00 00 |.. yf.l....y....| +00000050 09 ff 01 00 01 00 00 17 00 00 16 03 02 02 59 0b |..............Y.| +00000060 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 82 01 |..U..R..O0..K0..| +00000070 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 5b ea |............?.[.| +00000080 a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |.0...*.H........| +00000090 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 |0.1.0...U....Go1| +000000a0 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 6f 6f |.0...U....Go Roo| +000000b0 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 30 30 |t0...16010100000| +000000c0 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 30 30 |0Z..250101000000| +000000d0 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 47 6f |Z0.1.0...U....Go| +000000e0 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 81 9f |1.0...U....Go0..| +000000f0 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 |0...*.H.........| +00000100 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 2e 12 |...0.......F}...| +00000110 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 |'.H..(!.~...]..R| +00000120 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 |E.z6G....B[.....| +00000130 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 |y.@.Om..+.....g.| +00000140 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 |...."8.J.ts+.4..| +00000150 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 |....t{.X.la<..A.| +00000160 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf |.++$#w[.;.u]. T.| +00000170 a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 |.c...$....P....C| +00000180 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 |...ub...R.......| +00000190 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 ff 04 |..0..0...U......| +000001a0 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 30 14 |.....0...U.%..0.| +000001b0 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 01 05 |..+.........+...| +000001c0 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 |....0...U.......| +000001d0 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f 91 16 |0.0...U.........| +000001e0 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 |.CC>I..m....`0..| +000001f0 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d 13 7e |.U.#..0...H.IM.~| +00000200 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 55 1d |.1......n{0...U.| +00000210 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 2e 67 |...0...example.g| +00000220 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 0d 01 |olang0...*.H....| +00000230 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 |.........0.@+[P.| +00000240 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 |a...SX...(.X..8.| +00000250 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 |...1Z..f=C.-....| +00000260 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 40 20 |.. d8.$:....}.@ | +00000270 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c |._...a..v......\| +00000280 ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c |.....l..s..Cw...| +00000290 f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db 46 06 |....@.a.Lr+...F.| +000002a0 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 |.M...>...B...=.`| +000002b0 84 5c 21 d3 3b e9 fa e7 16 03 02 00 04 0e 00 00 |.\!.;...........| +000002c0 00 |.| +>>> Flow 3 (client to server) +00000000 16 03 02 00 86 10 00 00 82 00 80 b9 65 8d bf a7 |............e...| +00000010 c8 4b 79 ce 6f cb 8b 13 1c ac b9 7d 66 5e e9 ba |.Ky.o......}f^..| +00000020 1d 71 4e a9 e9 34 ae f6 64 65 90 3b d8 16 52 a2 |.qN..4..de.;..R.| +00000030 6f f4 cb 8a 13 74 a2 ee b7 27 69 b4 41 c0 90 68 |o....t...'i.A..h| +00000040 bc 02 69 e1 c6 48 4f 39 36 30 25 ca 4c 17 ce 83 |..i..HO960%.L...| +00000050 9e 08 56 e3 05 49 93 9e 2e c4 fb e6 c8 01 f1 0f |..V..I..........| +00000060 c5 70 0f 08 83 48 e9 48 ef 6e 50 8b 05 7e e5 84 |.p...H.H.nP..~..| +00000070 25 fa 55 c7 ae 31 02 27 00 ef 3f 98 86 20 12 89 |%.U..1.'..?.. ..| +00000080 91 59 28 b4 f7 d7 af d2 69 61 35 14 03 02 00 01 |.Y(.....ia5.....| +00000090 01 16 03 02 00 24 30 52 7f 8a 5c 3a 31 65 87 8c |.....$0R..\:1e..| +000000a0 9e 31 8f b1 22 15 ed af 99 6c 19 47 46 fd e1 3b |.1.."....l.GF..;| +000000b0 b3 f4 3a 5b d8 e5 a6 1a 7c 5e |..:[....|^| +>>> Flow 4 (server to client) +00000000 14 03 02 00 01 01 16 03 02 00 24 c1 5d da 6d 6e |..........$.].mn| +00000010 55 3e 70 a4 52 15 d9 ba 88 a1 b7 f0 40 71 09 fa |U>p.R.......@q..| +00000020 3f 00 6f 39 72 88 89 a1 3d cf 7a 7a 97 15 b7 |?.o9r...=.zz...| +>>> Flow 5 (client to server) +00000000 17 03 02 00 1a 56 ea a4 ed 0f 9d 98 3b 48 bc 76 |.....V......;H.v| +00000010 35 3f fb 78 92 d9 ce ef 53 b2 ef a6 13 9a 4c 15 |5?.x....S.....L.| +00000020 03 02 00 16 b5 41 d0 98 50 73 73 90 c0 fe ec 11 |.....A..Pss.....| +00000030 ec 98 d5 fb 02 c0 11 11 29 1c |........).| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-AES128-GCM-SHA256 b/go/src/crypto/tls/testdata/Client-TLSv12-AES128-GCM-SHA256 new file mode 100644 index 0000000000000000000000000000000000000000..33e01c140b0139cce319e4c72a177fe3f1b4be71 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-AES128-GCM-SHA256 @@ -0,0 +1,89 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 55 02 00 00 51 03 03 c5 da f3 88 41 |....U...Q......A| +00000010 ed 43 a7 4e 49 ad db 74 04 c6 fb c2 13 49 86 14 |.C.NI..t.....I..| +00000020 fd d0 e1 7a ab d3 df 65 62 c6 1f 20 29 1a 03 bf |...z...eb.. )...| +00000030 10 35 3c 58 36 fd 4d 7a 7d dc f1 fd be d0 c6 b5 |.5I..m....`0..| +000001f0 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d 13 7e |.U.#..0...H.IM.~| +00000200 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 55 1d |.1......n{0...U.| +00000210 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 2e 67 |...0...example.g| +00000220 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 0d 01 |olang0...*.H....| +00000230 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 |.........0.@+[P.| +00000240 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 |a...SX...(.X..8.| +00000250 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 |...1Z..f=C.-....| +00000260 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 40 20 |.. d8.$:....}.@ | +00000270 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c |._...a..v......\| +00000280 ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c |.....l..s..Cw...| +00000290 f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db 46 06 |....@.a.Lr+...F.| +000002a0 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 |.M...>...B...=.`| +000002b0 84 5c 21 d3 3b e9 fa e7 16 03 03 00 04 0e 00 00 |.\!.;...........| +000002c0 00 |.| +>>> Flow 3 (client to server) +00000000 16 03 03 00 86 10 00 00 82 00 80 b9 65 8d bf a7 |............e...| +00000010 c8 4b 79 ce 6f cb 8b 13 1c ac b9 7d 66 5e e9 ba |.Ky.o......}f^..| +00000020 1d 71 4e a9 e9 34 ae f6 64 65 90 3b d8 16 52 a2 |.qN..4..de.;..R.| +00000030 6f f4 cb 8a 13 74 a2 ee b7 27 69 b4 41 c0 90 68 |o....t...'i.A..h| +00000040 bc 02 69 e1 c6 48 4f 39 36 30 25 ca 4c 17 ce 83 |..i..HO960%.L...| +00000050 9e 08 56 e3 05 49 93 9e 2e c4 fb e6 c8 01 f1 0f |..V..I..........| +00000060 c5 70 0f 08 83 48 e9 48 ef 6e 50 8b 05 7e e5 84 |.p...H.H.nP..~..| +00000070 25 fa 55 c7 ae 31 02 27 00 ef 3f 98 86 20 12 89 |%.U..1.'..?.. ..| +00000080 91 59 28 b4 f7 d7 af d2 69 61 35 14 03 03 00 01 |.Y(.....ia5.....| +00000090 01 16 03 03 00 28 00 00 00 00 00 00 00 00 2c 46 |.....(........,F| +000000a0 31 d0 81 b9 6e 55 b0 5b 7b 15 a0 27 da e2 d7 71 |1...nU.[{..'...q| +000000b0 f4 d0 83 6c 98 d9 75 e2 f4 4c 61 0b fe 3c |...l..u..La..<| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 28 e5 b5 71 5d e0 |..........(..q].| +00000010 c8 9a 75 4c 6e 72 4e a2 5f f9 b4 9f f4 40 a0 de |..uLnrN._....@..| +00000020 73 48 9c 01 f3 0b 78 91 5f 85 29 9c 51 dc 77 bc |sH....x._.).Q.w.| +00000030 c0 32 42 |.2B| +>>> Flow 5 (client to server) +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 9e 81 42 |...............B| +00000010 90 9e ab a2 29 b3 f7 a6 31 45 5f a4 2e d5 52 f7 |....)...1E_...R.| +00000020 72 8b 3b 15 03 03 00 1a 00 00 00 00 00 00 00 02 |r.;.............| +00000030 96 5a f4 de 37 1b 2c f1 8d 90 91 17 6f 81 90 7f |.Z..7.,.....o...| +00000040 e7 9d |..| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-AES128-SHA256 b/go/src/crypto/tls/testdata/Client-TLSv12-AES128-SHA256 new file mode 100644 index 0000000000000000000000000000000000000000..b373f27aaeb622122786feaddd0ac4272be11a28 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-AES128-SHA256 @@ -0,0 +1,98 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 55 02 00 00 51 03 03 eb c3 6e 78 2e |....U...Q....nx.| +00000010 9f 47 ec 9d 0e bc 8d 49 d2 46 11 75 5e 50 a5 07 |.G.....I.F.u^P..| +00000020 0a 99 90 34 34 2d 81 75 1b f4 ca 20 fb 28 c1 8c |...44-.u... .(..| +00000030 55 27 36 be 4e d1 c7 ee e8 b3 2a eb 7a be f1 2a |U'6.N.....*.z..*| +00000040 fc 81 df d8 5b c2 1f 1e 7b 47 0f 06 00 3c 00 00 |....[...{G...<..| +00000050 09 ff 01 00 01 00 00 17 00 00 16 03 03 02 59 0b |..............Y.| +00000060 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 82 01 |..U..R..O0..K0..| +00000070 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 5b ea |............?.[.| +00000080 a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |.0...*.H........| +00000090 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 |0.1.0...U....Go1| +000000a0 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 6f 6f |.0...U....Go Roo| +000000b0 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 30 30 |t0...16010100000| +000000c0 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 30 30 |0Z..250101000000| +000000d0 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 47 6f |Z0.1.0...U....Go| +000000e0 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 81 9f |1.0...U....Go0..| +000000f0 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 |0...*.H.........| +00000100 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 2e 12 |...0.......F}...| +00000110 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 |'.H..(!.~...]..R| +00000120 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 |E.z6G....B[.....| +00000130 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 |y.@.Om..+.....g.| +00000140 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 |...."8.J.ts+.4..| +00000150 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 |....t{.X.la<..A.| +00000160 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf |.++$#w[.;.u]. T.| +00000170 a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 |.c...$....P....C| +00000180 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 |...ub...R.......| +00000190 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 ff 04 |..0..0...U......| +000001a0 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 30 14 |.....0...U.%..0.| +000001b0 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 01 05 |..+.........+...| +000001c0 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 |....0...U.......| +000001d0 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f 91 16 |0.0...U.........| +000001e0 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 |.CC>I..m....`0..| +000001f0 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d 13 7e |.U.#..0...H.IM.~| +00000200 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 55 1d |.1......n{0...U.| +00000210 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 2e 67 |...0...example.g| +00000220 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 0d 01 |olang0...*.H....| +00000230 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 |.........0.@+[P.| +00000240 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 |a...SX...(.X..8.| +00000250 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 |...1Z..f=C.-....| +00000260 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 40 20 |.. d8.$:....}.@ | +00000270 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c |._...a..v......\| +00000280 ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c |.....l..s..Cw...| +00000290 f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db 46 06 |....@.a.Lr+...F.| +000002a0 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 |.M...>...B...=.`| +000002b0 84 5c 21 d3 3b e9 fa e7 16 03 03 00 04 0e 00 00 |.\!.;...........| +000002c0 00 |.| +>>> Flow 3 (client to server) +00000000 16 03 03 00 86 10 00 00 82 00 80 b9 65 8d bf a7 |............e...| +00000010 c8 4b 79 ce 6f cb 8b 13 1c ac b9 7d 66 5e e9 ba |.Ky.o......}f^..| +00000020 1d 71 4e a9 e9 34 ae f6 64 65 90 3b d8 16 52 a2 |.qN..4..de.;..R.| +00000030 6f f4 cb 8a 13 74 a2 ee b7 27 69 b4 41 c0 90 68 |o....t...'i.A..h| +00000040 bc 02 69 e1 c6 48 4f 39 36 30 25 ca 4c 17 ce 83 |..i..HO960%.L...| +00000050 9e 08 56 e3 05 49 93 9e 2e c4 fb e6 c8 01 f1 0f |..V..I..........| +00000060 c5 70 0f 08 83 48 e9 48 ef 6e 50 8b 05 7e e5 84 |.p...H.H.nP..~..| +00000070 25 fa 55 c7 ae 31 02 27 00 ef 3f 98 86 20 12 89 |%.U..1.'..?.. ..| +00000080 91 59 28 b4 f7 d7 af d2 69 61 35 14 03 03 00 01 |.Y(.....ia5.....| +00000090 01 16 03 03 00 50 00 00 00 00 00 00 00 00 00 00 |.....P..........| +000000a0 00 00 00 00 00 00 ee 37 21 73 05 93 63 ca 4f 0e |.......7!s..c.O.| +000000b0 e2 29 7f 90 6f 3a aa 52 a0 e0 71 97 5f f9 66 cf |.)..o:.R..q._.f.| +000000c0 06 19 09 51 03 5f 2e 0c 57 26 42 15 ef 8f 4e a9 |...Q._..W&B...N.| +000000d0 c4 97 95 0a d1 ce 30 2c bf 7a 85 4b a9 d0 a9 e0 |......0,.z.K....| +000000e0 64 11 1a dc 48 1d |d...H.| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 50 58 d1 09 93 e9 |..........PX....| +00000010 97 c1 cc c3 db 1d 65 d8 97 35 c1 b4 3f 9f a0 00 |......e..5..?...| +00000020 9f 81 2a 81 61 b5 51 9f ec 15 94 d0 86 0f a1 70 |..*.a.Q........p| +00000030 e9 90 59 dd 16 d3 e7 33 21 b7 d8 6e 4b a8 fd fb |..Y....3!..nK...| +00000040 dd 98 78 95 16 44 f8 da bd e3 e2 3f f0 e1 d9 39 |..x..D.....?...9| +00000050 c0 2e 0d c4 fe a5 ac 41 66 2d f3 |.......Af-.| +>>> Flow 5 (client to server) +00000000 17 03 03 00 40 00 00 00 00 00 00 00 00 00 00 00 |....@...........| +00000010 00 00 00 00 00 2f d9 4b fc 22 0f 20 dd 2c 20 83 |...../.K.". ., .| +00000020 bd f0 49 5b bc 57 55 bc fb 41 13 79 a7 19 4d e3 |..I[.WU..A.y..M.| +00000030 71 66 ce b5 77 35 9c 54 86 0e fc 21 d6 9e c4 66 |qf..w5.T...!...f| +00000040 ee 95 3f 0a d5 15 03 03 00 40 00 00 00 00 00 00 |..?......@......| +00000050 00 00 00 00 00 00 00 00 00 00 54 25 cd 1a 0a d4 |..........T%....| +00000060 7b a4 ce f1 62 c8 8f 62 af 93 8e 0e e8 fd ef 55 |{...b..b.......U| +00000070 1d 47 a4 ac 1c 80 25 6f c4 a2 51 11 84 e9 63 cb |.G....%o..Q...c.| +00000080 db d8 e6 bf 2c 89 4e 1a d4 11 |....,.N...| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-AES256-GCM-SHA384 b/go/src/crypto/tls/testdata/Client-TLSv12-AES256-GCM-SHA384 new file mode 100644 index 0000000000000000000000000000000000000000..9920621be3b77035fb8a51e3945d153d11da2d9b --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-AES256-GCM-SHA384 @@ -0,0 +1,89 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 55 02 00 00 51 03 03 9f 42 e3 1b 5f |....U...Q...B.._| +00000010 00 d9 00 0a a5 fa 6d 63 95 11 d2 5a ff 51 b0 f8 |......mc...Z.Q..| +00000020 bc a9 7f 18 3c 8d d7 38 d5 e8 2d 20 be 5b 08 a0 |....<..8..- .[..| +00000030 2f 7b 50 d9 06 0c bf 7c 2d cc f0 39 3a 90 e4 e7 |/{P....|-..9:...| +00000040 9c 27 9b 88 ea ff c0 51 f8 79 cd b9 00 9d 00 00 |.'.....Q.y......| +00000050 09 ff 01 00 01 00 00 17 00 00 16 03 03 02 59 0b |..............Y.| +00000060 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 82 01 |..U..R..O0..K0..| +00000070 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 5b ea |............?.[.| +00000080 a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |.0...*.H........| +00000090 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 |0.1.0...U....Go1| +000000a0 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 6f 6f |.0...U....Go Roo| +000000b0 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 30 30 |t0...16010100000| +000000c0 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 30 30 |0Z..250101000000| +000000d0 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 47 6f |Z0.1.0...U....Go| +000000e0 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 81 9f |1.0...U....Go0..| +000000f0 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 |0...*.H.........| +00000100 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 2e 12 |...0.......F}...| +00000110 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 |'.H..(!.~...]..R| +00000120 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 |E.z6G....B[.....| +00000130 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 |y.@.Om..+.....g.| +00000140 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 |...."8.J.ts+.4..| +00000150 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 |....t{.X.la<..A.| +00000160 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf |.++$#w[.;.u]. T.| +00000170 a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 |.c...$....P....C| +00000180 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 |...ub...R.......| +00000190 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 ff 04 |..0..0...U......| +000001a0 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 30 14 |.....0...U.%..0.| +000001b0 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 01 05 |..+.........+...| +000001c0 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 |....0...U.......| +000001d0 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f 91 16 |0.0...U.........| +000001e0 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 |.CC>I..m....`0..| +000001f0 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d 13 7e |.U.#..0...H.IM.~| +00000200 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 55 1d |.1......n{0...U.| +00000210 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 2e 67 |...0...example.g| +00000220 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 0d 01 |olang0...*.H....| +00000230 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 |.........0.@+[P.| +00000240 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 |a...SX...(.X..8.| +00000250 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 |...1Z..f=C.-....| +00000260 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 40 20 |.. d8.$:....}.@ | +00000270 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c |._...a..v......\| +00000280 ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c |.....l..s..Cw...| +00000290 f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db 46 06 |....@.a.Lr+...F.| +000002a0 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 |.M...>...B...=.`| +000002b0 84 5c 21 d3 3b e9 fa e7 16 03 03 00 04 0e 00 00 |.\!.;...........| +000002c0 00 |.| +>>> Flow 3 (client to server) +00000000 16 03 03 00 86 10 00 00 82 00 80 b9 65 8d bf a7 |............e...| +00000010 c8 4b 79 ce 6f cb 8b 13 1c ac b9 7d 66 5e e9 ba |.Ky.o......}f^..| +00000020 1d 71 4e a9 e9 34 ae f6 64 65 90 3b d8 16 52 a2 |.qN..4..de.;..R.| +00000030 6f f4 cb 8a 13 74 a2 ee b7 27 69 b4 41 c0 90 68 |o....t...'i.A..h| +00000040 bc 02 69 e1 c6 48 4f 39 36 30 25 ca 4c 17 ce 83 |..i..HO960%.L...| +00000050 9e 08 56 e3 05 49 93 9e 2e c4 fb e6 c8 01 f1 0f |..V..I..........| +00000060 c5 70 0f 08 83 48 e9 48 ef 6e 50 8b 05 7e e5 84 |.p...H.H.nP..~..| +00000070 25 fa 55 c7 ae 31 02 27 00 ef 3f 98 86 20 12 89 |%.U..1.'..?.. ..| +00000080 91 59 28 b4 f7 d7 af d2 69 61 35 14 03 03 00 01 |.Y(.....ia5.....| +00000090 01 16 03 03 00 28 00 00 00 00 00 00 00 00 0e dd |.....(..........| +000000a0 10 e6 7a dd b2 02 5c 0d 0c 73 b4 f1 a1 89 85 95 |..z...\..s......| +000000b0 91 a9 e4 7a 47 49 9a 52 96 77 93 0b cc 74 |...zGI.R.w...t| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 28 72 c3 d3 ad 10 |..........(r....| +00000010 71 48 c4 32 9b 24 ac c0 a4 88 db 35 e9 be fe 34 |qH.2.$.....5...4| +00000020 ee 9a bb 5a a5 90 b6 ec 31 9a bc 4c 56 e2 e6 d5 |...Z....1..LV...| +00000030 f9 2b 93 |.+.| +>>> Flow 5 (client to server) +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 ed af c7 |................| +00000010 74 44 64 5d e3 1b 0c d4 bd a1 7e 7e 87 10 8d bc |tDd]......~~....| +00000020 26 db e8 15 03 03 00 1a 00 00 00 00 00 00 00 02 |&...............| +00000030 42 6b 3e 59 c5 e4 e5 5b 53 0f fe d9 3f 0c 5c f0 |Bk>Y...[S...?.\.| +00000040 67 d5 |g.| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-ALPN b/go/src/crypto/tls/testdata/Client-TLSv12-ALPN new file mode 100644 index 0000000000000000000000000000000000000000..6686f6e9c0f7c5e85d8d993910581a64f2b5b1f9 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-ALPN @@ -0,0 +1,95 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 2c 01 00 01 28 03 03 00 00 00 00 00 |....,...(.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 ad 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 10 00 10 00 0e 06 70 72 6f |.............pro| +000000f0 74 6f 32 06 70 72 6f 74 6f 31 00 2b 00 09 08 03 |to2.proto1.+....| +00000100 04 03 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 |........3.&.$...| +00000110 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)| +00000120 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;| +00000130 74 |t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 6a 02 00 00 66 03 03 37 57 f9 cb 6a |....j...f..7W..j| +00000010 dc 6c e2 4b 1d 74 93 8e e1 1a 05 e7 fd 8d 29 57 |.l.K.t........)W| +00000020 5e b4 fc 9a ba 7d df de 56 cc e7 20 57 f3 1a b0 |^....}..V.. W...| +00000030 20 cd ac a1 e3 93 b9 79 f5 1c ce d2 d1 24 da fc | ......y.....$..| +00000040 88 97 25 fb 36 72 75 bb cc a3 2a 79 cc a8 00 00 |..%.6ru...*y....| +00000050 1e ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 10 |................| +00000060 00 09 00 07 06 70 72 6f 74 6f 31 00 17 00 00 16 |.....proto1.....| +00000070 03 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 |...Y...U..R..O0.| +00000080 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 |.K0.............| +00000090 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d |.?.[..0...*.H...| +000000a0 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 55 04 0a |.....0.1.0...U..| +000000b0 13 02 47 6f 31 10 30 0e 06 03 55 04 03 13 07 47 |..Go1.0...U....G| +000000c0 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 |o Root0...160101| +000000d0 30 30 30 30 30 30 5a 17 0d 32 35 30 31 30 31 30 |000000Z..2501010| +000000e0 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 |00000Z0.1.0...U.| +000000f0 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 03 13 02 |...Go1.0...U....| +00000100 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 |Go0..0...*.H....| +00000110 01 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 db |........0.......| +00000120 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 |F}...'.H..(!.~..| +00000130 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b |.]..RE.z6G....B[| +00000140 c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b |.....y.@.Om..+..| +00000150 c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 |...g....."8.J.ts| +00000160 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 |+.4......t{.X.la| +00000170 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 |<..A..++$#w[.;.u| +00000180 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 |]. T..c...$....P| +00000190 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 |....C...ub...R..| +000001a0 03 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d |.......0..0...U.| +000001b0 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d |..........0...U.| +000001c0 25 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 |%..0...+........| +000001d0 08 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 |.+.......0...U..| +000001e0 01 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 |.....0.0...U....| +000001f0 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 |......CC>I..m...| +00000200 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 80 10 48 |.`0...U.#..0...H| +00000210 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 |.IM.~.1......n{0| +00000220 19 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d |...U....0...exam| +00000230 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 |ple.golang0...*.| +00000240 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc |H.............0.| +00000250 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 |@+[P.a...SX...(.| +00000260 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 |X..8....1Z..f=C.| +00000270 2d d9 0b f2 97 df d3 20 64 38 92 24 3a 00 bc cf |-...... d8.$:...| +00000280 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 |.}.@ ._...a..v..| +00000290 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 |....\.....l..s..| +000002a0 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b |Cw.......@.a.Lr+| +000002b0 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 |...F..M...>...B.| +000002c0 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 |..=.`.\!.;......| +000002d0 00 ac 0c 00 00 a8 03 00 1d 20 27 fd a6 7d 32 28 |......... '..}2(| +000002e0 d2 44 43 d5 2a 95 3b e2 7e 77 5a d2 66 87 4a 92 |.DC.*.;.~wZ.f.J.| +000002f0 12 56 ba 40 3e 09 43 b4 90 02 08 04 00 80 8b e9 |.V.@>.C.........| +00000300 93 0c 5e 72 b8 a8 49 1c c3 b7 fc 39 af 58 9c 3a |..^r..I....9.X.:| +00000310 27 b6 20 23 9a 5d 35 0e dd 21 da 1b be 34 32 23 |'. #.]5..!...42#| +00000320 76 2e c8 9e 3d c8 e5 9e cd 04 11 a9 be 97 52 53 |v...=.........RS| +00000330 81 b6 01 fc 60 5d 0d dd 0d ba 05 a6 15 3b 29 4e |....`].......;)N| +00000340 88 a0 69 b9 c2 46 d9 c2 6d 17 b2 d0 c0 ee de f9 |..i..F..m.......| +00000350 94 fe 25 31 66 df 72 7d 02 77 a6 2c a6 ad da eb |..%1f.r}.w.,....| +00000360 dc 4b ea d4 5b 0a d4 e6 c8 89 15 cf 3f 81 58 20 |.K..[.......?.X | +00000370 0f 83 2f e1 db a1 cc a7 e1 61 79 7d 14 4b 16 03 |../......ay}.K..| +00000380 03 00 04 0e 00 00 00 |.......| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| +00000030 16 03 03 00 20 50 e7 36 59 68 f6 0f cd b0 cc ae |.... P.6Yh......| +00000040 bc 18 23 d3 c0 fb c9 41 49 91 ec 8f cd f0 69 84 |..#....AI.....i.| +00000050 49 3c 68 6e 05 |I>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 20 84 30 04 4f 3e |.......... .0.O>| +00000010 72 f6 d8 6a dc ae fb 55 82 69 8e a3 77 c2 1f 27 |r..j...U.i..w..'| +00000020 88 14 5b 8d 10 79 4c 6a 41 3e e5 |..[..yLjA>.| +>>> Flow 5 (client to server) +00000000 17 03 03 00 16 03 a8 d7 eb 5d 79 60 d4 65 1d c1 |.........]y`.e..| +00000010 2b 32 b5 c3 fb b2 2f 10 83 4e 39 15 03 03 00 12 |+2..../..N9.....| +00000020 90 eb 89 fc e7 4c a2 94 02 33 b3 0e 72 6e bc 4e |.....L...3..rn.N| +00000030 d4 e7 |..| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-ALPN-NoMatch b/go/src/crypto/tls/testdata/Client-TLSv12-ALPN-NoMatch new file mode 100644 index 0000000000000000000000000000000000000000..62e7d11bb8d86219e8d30b78a0707bcf77d692ca --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-ALPN-NoMatch @@ -0,0 +1,91 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 9c 01 00 00 98 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 28 c0 2f |.............(./| +00000030 c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 c0 09 c0 14 |.+.0.,.'...#....| +00000040 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 c0 12 00 0a |.......<./.5....| +00000050 00 05 c0 11 c0 07 01 00 00 47 33 74 00 00 00 05 |.........G3t....| +00000060 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 17 00 |................| +00000070 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 0c 04 |................| +00000080 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 01 00 |................| +00000090 00 10 00 09 00 07 06 70 72 6f 74 6f 33 00 12 00 |.......proto3...| +000000a0 00 |.| +>>> Flow 2 (server to client) +00000000 16 03 03 00 59 02 00 00 55 03 03 36 0e 9f 51 42 |....Y...U..6..QB| +00000010 82 65 fa b5 17 7a 86 d6 40 33 a9 67 d3 3d aa 2f |.e...z..@3.g.=./| +00000020 89 a0 39 82 af 16 30 8e 64 80 d4 20 23 a6 d0 12 |..9...0.d.. #...| +00000030 ff 8c fc b4 b5 47 ec 10 fe ba 73 fb 0f ab e8 1c |.....G....s.....| +00000040 15 c1 fb 11 c1 b2 e1 8a f7 5d 5b ad c0 2f 00 00 |.........][../..| +00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| +00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| +00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| +00000080 3f e2 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 |?.[..0...*.H....| +00000090 01 0b 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 |....0.1.0...U...| +000000a0 02 47 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f |.Go1.0...U....Go| +000000b0 20 52 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 | Root0...1601010| +000000c0 30 30 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 |00000Z..25010100| +000000d0 30 30 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a |0000Z0.1.0...U..| +000000e0 13 02 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 |..Go1.0...U....G| +000000f0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| +00000100 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 |.......0.......F| +00000110 7d 93 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 |}...'.H..(!.~...| +00000120 5d fe 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 |]..RE.z6G....B[.| +00000130 81 c0 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 |....y.@.Om..+...| +00000140 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b |..g....."8.J.ts+| +00000150 c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c |.4......t{.X.la<| +00000160 c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d |..A..++$#w[.;.u]| +00000170 ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b |. T..c...$....P.| +00000180 aa b6 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 |...C...ub...R...| +00000190 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| +000001a0 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| +000001b0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| +000001c0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| +000001d0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| +000001e0 10 9f 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f |.....CC>I..m....| +000001f0 60 30 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 |`0...U.#..0...H.| +00000200 49 4d 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 |IM.~.1......n{0.| +00000210 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| +00000220 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| +00000230 86 f7 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 |.............0.@| +00000240 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 |+[P.a...SX...(.X| +00000250 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d |..8....1Z..f=C.-| +00000260 d9 0b f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c |...... d8.$:....| +00000270 7d b7 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 |}.@ ._...a..v...| +00000280 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 |...\.....l..s..C| +00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| +000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| +000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| +000002c0 cd 0c 00 00 c9 03 00 17 41 04 11 b4 a9 10 7e 5c |........A.....~\| +000002d0 41 5e 39 12 15 a3 ed 5b 3e 5d 68 c8 ad 48 39 ef |A^9....[>]h..H9.| +000002e0 09 8b b1 a7 bf db 5f 54 49 cd d5 de 4d b3 47 4c |......_TI...M.GL| +000002f0 18 02 84 7c ec 75 4e d0 3e 8a d1 6c 80 83 98 64 |...|.uN.>..l...d| +00000300 4a 81 bc 8f 84 c7 e5 b4 2d fa 04 01 00 80 72 ee |J.......-.....r.| +00000310 41 38 f2 b8 a1 56 81 d8 04 78 75 05 f4 78 5f f2 |A8...V...xu..x_.| +00000320 2b 5d a2 46 23 9d 48 c8 63 a9 1d de a8 78 6e 99 |+].F#.H.c....xn.| +00000330 cd 59 6b 19 20 f5 b1 11 e1 f8 1c 5b 40 c3 b8 cd |.Yk. ......[@...| +00000340 66 a3 98 37 c5 c2 5c b7 d6 cc 61 b4 5e 97 fa dd |f..7..\...a.^...| +00000350 b7 85 5d b6 34 8c 39 4a 60 5a 03 20 47 7f e3 65 |..].4.9J`Z. G..e| +00000360 01 18 00 2c c3 eb be d4 aa 58 57 a9 5e 69 fb 3c |...,.....XW.^i.<| +00000370 fa c6 28 1a 5c f7 00 d5 21 e5 c1 30 db 84 38 c3 |..(.\...!..0..8.| +00000380 08 aa 08 5f c9 fd a0 b7 8e d0 66 77 bf 13 16 03 |..._......fw....| +00000390 03 00 04 0e 00 00 00 |.......| +>>> Flow 3 (client to server) +00000000 16 03 03 00 46 10 00 00 42 41 04 1e 18 37 ef 0d |....F...BA...7..| +00000010 19 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd |.Q.5uq..T[....g.| +00000020 a7 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e |.$ >.V...(^.+-O.| +00000030 f1 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 |...lK[.V.2B.X..I| +00000040 a6 b5 68 1a 41 03 56 6b dc 5a 89 14 03 03 00 01 |..h.A.Vk.Z......| +00000050 01 16 03 03 00 28 00 00 00 00 00 00 00 00 4f 7e |.....(........O~| +00000060 9a 3a cc 74 a4 91 77 01 0b 0e 28 0a c5 bd 55 b7 |.:.t..w...(...U.| +00000070 9a 4c 40 4e e9 c9 46 d5 5f c5 e1 77 c3 f2 |.L@N..F._..w..| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 28 62 4b 13 ef 22 |..........(bK.."| +00000010 f9 a8 8d ec 42 3a 36 80 5d a8 5b e9 60 d1 ba 65 |....B:6.].[.`..e| +00000020 2b d8 37 64 e5 12 b2 ef 84 75 87 0c 0f 3d 35 6e |+.7d.....u...=5n| +00000030 59 7c 51 |Y|Q| +>>> Flow 5 (client to server) +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 5f cd 4d |............._.M| +00000010 7b a7 c0 f9 6c 1f 80 93 cf 55 3b 12 c7 21 12 86 |{...l....U;..!..| +00000020 f6 b1 52 15 03 03 00 1a 00 00 00 00 00 00 00 02 |..R.............| +00000030 fd 31 a4 4b d1 e9 f0 e0 18 b5 96 28 f7 b4 0c 29 |.1.K.......(...)| +00000040 8c 0c |..| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-ECDSA-ECDSA b/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-ECDSA-ECDSA new file mode 100644 index 0000000000000000000000000000000000000000..784e95f87e58747def7171aeb84d5dcc21b65049 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-ECDSA-ECDSA @@ -0,0 +1,141 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 4a 0b 4d 4a 05 |....]...Y..J.MJ.| +00000010 a0 5b ca 5d 65 4f f7 7e 82 3c 54 1d a3 42 64 7c |.[.]eO.~.>> Flow 3 (client to server) +00000000 16 03 03 02 0a 0b 00 02 06 00 02 03 00 02 00 30 |...............0| +00000010 82 01 fc 30 82 01 5e 02 09 00 9a 30 84 6c 26 35 |...0..^....0.l&5| +00000020 d9 17 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 |..0...*.H.=..0E1| +00000030 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 30 11 |.0...U....AU1.0.| +00000040 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 |..U....Some-Stat| +00000050 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 |e1!0...U....Inte| +00000060 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 79 |rnet Widgits Pty| +00000070 20 4c 74 64 30 1e 17 0d 31 32 31 31 31 34 31 33 | Ltd0...12111413| +00000080 32 35 35 33 5a 17 0d 32 32 31 31 31 32 31 33 32 |2553Z..221112132| +00000090 35 35 33 5a 30 41 31 0b 30 09 06 03 55 04 06 13 |553Z0A1.0...U...| +000000a0 02 41 55 31 0c 30 0a 06 03 55 04 08 13 03 4e 53 |.AU1.0...U....NS| +000000b0 57 31 10 30 0e 06 03 55 04 07 13 07 50 79 72 6d |W1.0...U....Pyrm| +000000c0 6f 6e 74 31 12 30 10 06 03 55 04 03 13 09 4a 6f |ont1.0...U....Jo| +000000d0 65 6c 20 53 69 6e 67 30 81 9b 30 10 06 07 2a 86 |el Sing0..0...*.| +000000e0 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 86 00 |H.=....+...#....| +000000f0 04 00 95 8c 91 75 14 c0 5e c4 57 b4 d4 c3 6f 8d |.....u..^.W...o.| +00000100 ae 68 1e dd 6f ce 86 e1 7e 6e b2 48 3e 81 e5 4e |.h..o...~n.H>..N| +00000110 e2 c6 88 4b 64 dc f5 30 bb d3 ff 65 cc 5b f4 dd |...Kd..0...e.[..| +00000120 b5 6a 3e 3e d0 1d de 47 c3 76 ad 19 f6 45 2c 8c |.j>>...G.v...E,.| +00000130 bc d8 1d 01 4c 1f 70 90 46 76 48 8b 8f 83 cc 4a |....L.p.FvH....J| +00000140 5c 8f 40 76 da e0 89 ec 1d 2b c4 4e 30 76 28 41 |\.@v.....+.N0v(A| +00000150 b2 62 a8 fb 5b f1 f9 4e 7a 8d bd 09 b8 ae ea 8b |.b..[..Nz.......| +00000160 18 27 4f 2e 70 fe 13 96 ba c3 d3 40 16 cd 65 4e |.'O.p......@..eN| +00000170 ac 11 1e e6 f1 30 09 06 07 2a 86 48 ce 3d 04 01 |.....0...*.H.=..| +00000180 03 81 8c 00 30 81 88 02 42 00 e0 14 c4 60 60 0b |....0...B....``.| +00000190 72 68 b0 32 5d 61 4a 02 74 5c c2 81 b9 16 a8 3f |rh.2]aJ.t\.....?| +000001a0 29 c8 36 c7 81 ff 6c b6 5b d9 70 f1 38 3b 50 48 |).6...l.[.p.8;PH| +000001b0 28 94 cb 09 1a 52 f1 5d ee 8d f2 b9 f0 f0 da d9 |(....R.]........| +000001c0 15 3a f9 bd 03 7a 87 a2 23 35 ec 02 42 01 a3 d4 |.:...z..#5..B...| +000001d0 8a 78 35 1c 4a 9a 23 d2 0a be 2b 10 31 9d 9c 5f |.x5.J.#...+.1.._| +000001e0 be e8 91 b3 da 1a f5 5d a3 23 f5 26 8b 45 70 8d |.......].#.&.Ep.| +000001f0 65 62 9b 7e 01 99 3d 18 f6 10 9a 38 61 9b 2e 57 |eb.~..=....8a..W| +00000200 e4 fa cc b1 8a ce e2 23 a0 87 f0 e1 67 51 eb 16 |.......#....gQ..| +00000210 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd 62 |...%...! /.}.G.b| +00000220 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf |C.(.._.).0......| +00000230 c2 ed 90 99 5f 58 cb 3b 74 16 03 03 00 93 0f 00 |...._X.;t.......| +00000240 00 8f 04 03 00 8b 30 81 88 02 42 01 dd bf fd e0 |......0...B.....| +00000250 db 99 16 0b f0 bc a9 4b 93 10 d9 59 06 d2 eb 30 |.......K...Y...0| +00000260 dc b1 44 69 1d 54 2d 9b b4 a4 c9 3a f8 d8 9d 2e |..Di.T-....:....| +00000270 36 71 3e ff aa 05 98 8a 27 00 dd 65 6a 15 b7 c9 |6q>.....'..ej...| +00000280 fe 1d 4d 45 02 58 09 4f 38 ea cd 88 3c 02 42 00 |..ME.X.O8...<.B.| +00000290 a6 27 a5 d7 e7 9e 66 7e f8 38 37 03 7b 6d df c4 |.'....f~.87.{m..| +000002a0 81 6a 59 af 5b c7 06 2e 57 e9 8f 8d 1f 9c 9d 94 |.jY.[...W.......| +000002b0 70 4c 74 ed 03 24 3d df 35 51 a1 76 a7 8f 9b 40 |pLt..$=.5Q.v...@| +000002c0 16 c6 4f 0e 49 95 34 20 22 dc 5c ce 1d c0 ed bf |..O.I.4 ".\.....| +000002d0 f4 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 |...........@....| +000002e0 00 00 00 00 00 00 00 00 00 00 00 00 b7 d5 df bf |................| +000002f0 2b 32 a9 9e e4 78 40 84 ca c9 7d 54 4e 38 89 3b |+2...x@...}TN8.;| +00000300 0f 83 23 42 75 95 6e 4d 70 d4 b6 5a 1a 26 dd bb |..#Bu.nMp..Z.&..| +00000310 37 4a 85 88 ab 60 ba 3c 19 bd 02 79 |7J...`.<...y| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 40 07 8e 16 c5 c2 |..........@.....| +00000010 e1 e5 32 41 2d 8b 3c fb 2e 3e b2 84 89 56 4d b5 |..2A-.<..>...VM.| +00000020 1c bd 1e a5 11 a1 b0 18 29 ce eb 46 f8 11 ff dc |........)..F....| +00000030 c0 cc ed 5a 38 33 5a 8f 48 df bf e9 8e 09 be b0 |...Z83Z.H.......| +00000040 9d 70 85 f7 71 f5 1e 5c aa 6f 88 |.p..q..\.o.| +>>> Flow 5 (client to server) +00000000 17 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| +00000010 00 00 00 00 00 37 b7 99 22 eb 67 a0 32 57 76 b5 |.....7..".g.2Wv.| +00000020 53 86 fc 5b 79 c5 4a 4f 3a 6b a9 0f d8 c8 30 de |S..[y.JO:k....0.| +00000030 0a 5b 9b af e2 15 03 03 00 30 00 00 00 00 00 00 |.[.......0......| +00000040 00 00 00 00 00 00 00 00 00 00 57 9c 4b ca 83 a3 |..........W.K...| +00000050 c0 3a 52 71 24 f5 b1 37 1e 4d c1 5a 2d 29 1c 90 |.:Rq$..7.M.Z-)..| +00000060 9b 96 cf 1e 07 39 f1 1b 03 2b |.....9...+| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-ECDSA-RSA b/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-ECDSA-RSA new file mode 100644 index 0000000000000000000000000000000000000000..c20bd95d7f3065f9702a1d5a4d7fbfa193466f43 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-ECDSA-RSA @@ -0,0 +1,141 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 48 41 85 3e fc |....]...Y..HA.>.| +00000010 9f e7 b6 84 da fe 2f a7 1d e9 ba 12 4e a1 cf cb |....../.....N...| +00000020 9e f8 df 76 7c e7 29 c1 3b 9e 23 20 07 c9 55 c7 |...v|.).;.# ..U.| +00000030 0e 45 5c 26 17 94 b4 14 6b 58 39 27 43 4e dc 9b |.E\&....kX9'CN..| +00000040 65 30 0e f2 bd 59 d9 a2 a1 f3 0a 01 c0 2f 00 00 |e0...Y......./..| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 02 59 0b 00 02 55 00 02 52 00 02 |......Y...U..R..| +00000070 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 |O0..K0..........| +00000080 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 |....?.[..0...*.H| +00000090 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 |........0.1.0...| +000000a0 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 |U....Go1.0...U..| +000000b0 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 |..Go Root0...160| +000000c0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| +000000d0 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 |01000000Z0.1.0..| +000000e0 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 |.U....Go1.0...U.| +000000f0 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |...Go0..0...*.H.| +00000100 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +00000110 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab |...F}...'.H..(!.| +00000120 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d |~...]..RE.z6G...| +00000130 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd |.B[.....y.@.Om..| +00000140 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a |+.....g....."8.J| +00000150 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 |.ts+.4......t{.X| +00000160 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c |.la<..A..++$#w[.| +00000170 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 |;.u]. T..c...$..| +00000180 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 |..P....C...ub...| +00000190 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 |R.........0..0..| +000001a0 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 |.U...........0..| +000001b0 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 |.U.%..0...+.....| +000001c0 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 |....+.......0...| +000001d0 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d |U.......0.0...U.| +000001e0 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d |.........CC>I..m| +000001f0 b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 |....`0...U.#..0.| +00000200 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab |..H.IM.~.1......| +00000210 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |n{0...U....0...e| +00000220 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| +00000230 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| +00000240 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed |.0.@+[P.a...SX..| +00000250 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 |.(.X..8....1Z..f| +00000260 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a |=C.-...... d8.$:| +00000270 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 |....}.@ ._...a..| +00000280 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed |v......\.....l..| +00000290 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 |s..Cw.......@.a.| +000002a0 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 |Lr+...F..M...>..| +000002b0 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 |.B...=.`.\!.;...| +000002c0 16 03 03 00 ac 0c 00 00 a8 03 00 1d 20 73 d3 a9 |............ s..| +000002d0 7e 93 32 e3 dd ad 1c b3 c1 ff 03 c2 b9 08 da 09 |~.2.............| +000002e0 d3 1b 67 95 9c 8c d1 05 12 2e 8b dc 7a 08 04 00 |..g.........z...| +000002f0 80 85 af 3b 06 67 b0 ab 07 70 21 02 b1 3a 89 40 |...;.g...p!..:.@| +00000300 d6 90 ef a5 5b 89 49 81 18 20 74 9f 7b dd 58 65 |....[.I.. t.{.Xe| +00000310 28 6f 2a f1 aa 3f 35 91 b9 88 79 27 a0 f3 e7 41 |(o*..?5...y'...A| +00000320 9a a5 77 be 55 5e 70 89 37 b6 4a 7b 3b 8c df ad |..w.U^p.7.J{;...| +00000330 47 cc ac 45 47 43 05 05 ad c9 7b d8 1d d6 a8 fa |G..EGC....{.....| +00000340 38 45 c3 54 35 0c 28 a1 29 be 1f 73 98 a6 02 01 |8E.T5.(.)..s....| +00000350 fb 9d 12 64 1a 9c f3 82 e5 3f f6 0c 20 67 59 72 |...d.....?.. gYr| +00000360 3f a7 59 4e ef b4 58 ba 49 4e c9 b6 ea 95 b2 b3 |?.YN..X.IN......| +00000370 78 16 03 03 00 3a 0d 00 00 36 03 01 02 40 00 2e |x....:...6...@..| +00000380 04 03 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b |................| +00000390 08 04 08 05 08 06 04 01 05 01 06 01 03 03 02 03 |................| +000003a0 03 01 02 01 03 02 02 02 04 02 05 02 06 02 00 00 |................| +000003b0 16 03 03 00 04 0e 00 00 00 |.........| +>>> Flow 3 (client to server) +00000000 16 03 03 02 0a 0b 00 02 06 00 02 03 00 02 00 30 |...............0| +00000010 82 01 fc 30 82 01 5e 02 09 00 9a 30 84 6c 26 35 |...0..^....0.l&5| +00000020 d9 17 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 |..0...*.H.=..0E1| +00000030 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 30 11 |.0...U....AU1.0.| +00000040 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 |..U....Some-Stat| +00000050 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 |e1!0...U....Inte| +00000060 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 79 |rnet Widgits Pty| +00000070 20 4c 74 64 30 1e 17 0d 31 32 31 31 31 34 31 33 | Ltd0...12111413| +00000080 32 35 35 33 5a 17 0d 32 32 31 31 31 32 31 33 32 |2553Z..221112132| +00000090 35 35 33 5a 30 41 31 0b 30 09 06 03 55 04 06 13 |553Z0A1.0...U...| +000000a0 02 41 55 31 0c 30 0a 06 03 55 04 08 13 03 4e 53 |.AU1.0...U....NS| +000000b0 57 31 10 30 0e 06 03 55 04 07 13 07 50 79 72 6d |W1.0...U....Pyrm| +000000c0 6f 6e 74 31 12 30 10 06 03 55 04 03 13 09 4a 6f |ont1.0...U....Jo| +000000d0 65 6c 20 53 69 6e 67 30 81 9b 30 10 06 07 2a 86 |el Sing0..0...*.| +000000e0 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 86 00 |H.=....+...#....| +000000f0 04 00 95 8c 91 75 14 c0 5e c4 57 b4 d4 c3 6f 8d |.....u..^.W...o.| +00000100 ae 68 1e dd 6f ce 86 e1 7e 6e b2 48 3e 81 e5 4e |.h..o...~n.H>..N| +00000110 e2 c6 88 4b 64 dc f5 30 bb d3 ff 65 cc 5b f4 dd |...Kd..0...e.[..| +00000120 b5 6a 3e 3e d0 1d de 47 c3 76 ad 19 f6 45 2c 8c |.j>>...G.v...E,.| +00000130 bc d8 1d 01 4c 1f 70 90 46 76 48 8b 8f 83 cc 4a |....L.p.FvH....J| +00000140 5c 8f 40 76 da e0 89 ec 1d 2b c4 4e 30 76 28 41 |\.@v.....+.N0v(A| +00000150 b2 62 a8 fb 5b f1 f9 4e 7a 8d bd 09 b8 ae ea 8b |.b..[..Nz.......| +00000160 18 27 4f 2e 70 fe 13 96 ba c3 d3 40 16 cd 65 4e |.'O.p......@..eN| +00000170 ac 11 1e e6 f1 30 09 06 07 2a 86 48 ce 3d 04 01 |.....0...*.H.=..| +00000180 03 81 8c 00 30 81 88 02 42 00 e0 14 c4 60 60 0b |....0...B....``.| +00000190 72 68 b0 32 5d 61 4a 02 74 5c c2 81 b9 16 a8 3f |rh.2]aJ.t\.....?| +000001a0 29 c8 36 c7 81 ff 6c b6 5b d9 70 f1 38 3b 50 48 |).6...l.[.p.8;PH| +000001b0 28 94 cb 09 1a 52 f1 5d ee 8d f2 b9 f0 f0 da d9 |(....R.]........| +000001c0 15 3a f9 bd 03 7a 87 a2 23 35 ec 02 42 01 a3 d4 |.:...z..#5..B...| +000001d0 8a 78 35 1c 4a 9a 23 d2 0a be 2b 10 31 9d 9c 5f |.x5.J.#...+.1.._| +000001e0 be e8 91 b3 da 1a f5 5d a3 23 f5 26 8b 45 70 8d |.......].#.&.Ep.| +000001f0 65 62 9b 7e 01 99 3d 18 f6 10 9a 38 61 9b 2e 57 |eb.~..=....8a..W| +00000200 e4 fa cc b1 8a ce e2 23 a0 87 f0 e1 67 51 eb 16 |.......#....gQ..| +00000210 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd 62 |...%...! /.}.G.b| +00000220 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf |C.(.._.).0......| +00000230 c2 ed 90 99 5f 58 cb 3b 74 16 03 03 00 91 0f 00 |...._X.;t.......| +00000240 00 8d 04 03 00 89 30 81 86 02 41 66 64 90 bc df |......0...Afd...| +00000250 a5 d0 19 89 2b ed fc a5 8f 7e 14 d0 9f a2 07 6b |....+....~.....k| +00000260 d3 09 07 46 f8 29 4d b5 6c 01 e5 2e 0d d8 a4 b9 |...F.)M.l.......| +00000270 1a 86 2f b1 10 4c 29 5b de e7 29 e6 b9 32 53 ca |../..L)[..)..2S.| +00000280 d0 fc 7b a1 82 6e 34 2f 11 7a 2b 98 02 41 74 a4 |..{..n4/.z+..At.| +00000290 51 21 0c 57 ac 99 d1 a3 8c 86 f6 f2 b8 66 b8 1f |Q!.W.........f..| +000002a0 2d db 49 1a c1 34 e6 02 fd ce 50 14 7c 9b a4 52 |-.I..4....P.|..R| +000002b0 17 bc 96 ab 11 5f 97 9a 7f be ab 26 f7 1f 2b cf |....._.....&..+.| +000002c0 30 f1 da 80 b5 82 a0 da 44 be c1 00 51 1d b4 14 |0.......D...Q...| +000002d0 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 00 |.........(......| +000002e0 00 00 39 c2 3d 4e 74 16 e2 8c 4b f9 11 38 94 12 |..9.=Nt...K..8..| +000002f0 8f d3 16 18 9b ad 41 ef c9 ed 56 7f e3 ed d7 e5 |......A...V.....| +00000300 0e 52 |.R| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 28 c0 9a 2a 35 ef |..........(..*5.| +00000010 fa 87 1f 74 0a e9 b7 ea 3c 1c ab 1c ce 6e bb 95 |...t....<....n..| +00000020 ef 92 f3 cb 07 c0 e6 af b1 2a 60 fb 09 2a d7 68 |.........*`..*.h| +00000030 27 b0 f1 |'..| +>>> Flow 5 (client to server) +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 b1 98 56 |...............V| +00000010 38 68 a7 d0 da c6 83 4b 00 31 40 d7 1e 81 35 1a |8h.....K.1@...5.| +00000020 2f e3 42 15 03 03 00 1a 00 00 00 00 00 00 00 02 |/.B.............| +00000030 1d 8f a1 cf 12 2f 53 37 4d 60 46 90 e2 db 97 ce |...../S7M`F.....| +00000040 3e 99 |>.| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-Ed25519 b/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-Ed25519 new file mode 100644 index 0000000000000000000000000000000000000000..9eb522b86b968ed48e264465a09339a775ba06b8 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-Ed25519 @@ -0,0 +1,121 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 7f e3 92 d1 05 |....]...Y.......| +00000010 fd a2 f7 b4 24 f8 e6 e2 2f 15 51 f2 4b 72 12 59 |....$.../.Q.Kr.Y| +00000020 e6 af fe c9 0b 86 8b 53 a3 ce ff 20 68 97 1d e3 |.......S... h...| +00000030 6d 6c fb 67 78 05 ba fc 10 5b 83 87 8c 04 e9 57 |ml.gx....[.....W| +00000040 19 32 3f ee 88 a0 30 61 de 1c d2 2d cc a8 00 00 |.2?...0a...-....| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 02 59 0b 00 02 55 00 02 52 00 02 |......Y...U..R..| +00000070 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 |O0..K0..........| +00000080 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 |....?.[..0...*.H| +00000090 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 |........0.1.0...| +000000a0 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 |U....Go1.0...U..| +000000b0 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 |..Go Root0...160| +000000c0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| +000000d0 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 |01000000Z0.1.0..| +000000e0 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 |.U....Go1.0...U.| +000000f0 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |...Go0..0...*.H.| +00000100 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +00000110 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab |...F}...'.H..(!.| +00000120 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d |~...]..RE.z6G...| +00000130 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd |.B[.....y.@.Om..| +00000140 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a |+.....g....."8.J| +00000150 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 |.ts+.4......t{.X| +00000160 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c |.la<..A..++$#w[.| +00000170 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 |;.u]. T..c...$..| +00000180 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 |..P....C...ub...| +00000190 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 |R.........0..0..| +000001a0 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 |.U...........0..| +000001b0 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 |.U.%..0...+.....| +000001c0 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 |....+.......0...| +000001d0 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d |U.......0.0...U.| +000001e0 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d |.........CC>I..m| +000001f0 b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 |....`0...U.#..0.| +00000200 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab |..H.IM.~.1......| +00000210 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |n{0...U....0...e| +00000220 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| +00000230 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| +00000240 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed |.0.@+[P.a...SX..| +00000250 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 |.(.X..8....1Z..f| +00000260 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a |=C.-...... d8.$:| +00000270 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 |....}.@ ._...a..| +00000280 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed |v......\.....l..| +00000290 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 |s..Cw.......@.a.| +000002a0 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 |Lr+...F..M...>..| +000002b0 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 |.B...=.`.\!.;...| +000002c0 16 03 03 00 ac 0c 00 00 a8 03 00 1d 20 55 93 3e |............ U.>| +000002d0 dd fc 30 52 61 80 f3 e8 7e e2 fb f8 03 ab e4 86 |..0Ra...~.......| +000002e0 bc 8b 69 5b f5 8c fd 4b fc 12 2e 99 1a 08 04 00 |..i[...K........| +000002f0 80 43 60 48 4c 88 e9 fc 78 36 5f a9 6a 61 54 7e |.C`HL...x6_.jaT~| +00000300 a8 a3 67 91 df ff 78 66 d6 b6 ce 95 26 af 8e ac |..g...xf....&...| +00000310 42 fa 95 e1 a3 c6 9b 73 bb 7b dc e6 aa ca 6f a0 |B......s.{....o.| +00000320 17 6b ee 50 ff d9 20 ed 11 c4 e5 81 23 1d 6b 02 |.k.P.. .....#.k.| +00000330 a8 e6 f6 ef fc 1f 69 9e c1 28 d9 bd 36 98 ad f6 |......i..(..6...| +00000340 f3 40 5a e8 a4 e9 3c 62 b2 8d 53 a1 88 06 e6 81 |.@Z...>> Flow 3 (client to server) +00000000 16 03 03 01 3c 0b 00 01 38 00 01 35 00 01 32 30 |....<...8..5..20| +00000010 82 01 2e 30 81 e1 a0 03 02 01 02 02 10 17 d1 81 |...0............| +00000020 93 be 2a 8c 21 20 10 25 15 e8 34 23 4f 30 05 06 |..*.! .%..4#O0..| +00000030 03 2b 65 70 30 12 31 10 30 0e 06 03 55 04 0a 13 |.+ep0.1.0...U...| +00000040 07 41 63 6d 65 20 43 6f 30 1e 17 0d 31 39 30 35 |.Acme Co0...1905| +00000050 31 36 32 31 35 34 32 36 5a 17 0d 32 30 30 35 31 |16215426Z..20051| +00000060 35 32 31 35 34 32 36 5a 30 12 31 10 30 0e 06 03 |5215426Z0.1.0...| +00000070 55 04 0a 13 07 41 63 6d 65 20 43 6f 30 2a 30 05 |U....Acme Co0*0.| +00000080 06 03 2b 65 70 03 21 00 0b e0 b5 60 b5 e2 79 30 |..+ep.!....`..y0| +00000090 3d be e3 1e e0 50 b1 04 c8 6d c7 78 6c 69 2f c5 |=....P...m.xli/.| +000000a0 14 ad 9a 63 6f 79 12 91 a3 4d 30 4b 30 0e 06 03 |...coy...M0K0...| +000000b0 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 |U...........0...| +000000c0 55 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 |U.%..0...+......| +000000d0 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 |.0...U.......0.0| +000000e0 16 06 03 55 1d 11 04 0f 30 0d 82 0b 65 78 61 6d |...U....0...exam| +000000f0 70 6c 65 2e 63 6f 6d 30 05 06 03 2b 65 70 03 41 |ple.com0...+ep.A| +00000100 00 fc 19 17 2a 94 a5 31 fa 29 c8 2e 7f 5b a0 5d |....*..1.)...[.]| +00000110 8a 4e 34 40 39 d6 b3 10 dc 19 fe a0 22 71 b3 f5 |.N4@9......."q..| +00000120 8f a1 58 0d cd f4 f1 85 24 bf e6 3d 14 df df ed |..X.....$..=....| +00000130 0e e1 17 d8 11 a2 60 d0 8a 37 23 2a c2 46 aa 3a |......`..7#*.F.:| +00000140 08 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 |.....%...! /.}.G| +00000150 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af |.bC.(.._.).0....| +00000160 c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 03 00 48 |......_X.;t....H| +00000170 0f 00 00 44 08 07 00 40 ff da 51 80 4b 76 25 5d |...D...@..Q.Kv%]| +00000180 89 dc ce 9a fe 11 c3 95 c5 9a c2 fa ee 8a ba 87 |................| +00000190 42 be 46 93 da 10 c7 2a ab 7c 4c 24 a8 a7 b1 de |B.F....*.|L$....| +000001a0 17 6a b4 85 13 ff db 8d 69 9a be 0a b1 7d 1d d6 |.j......i....}..| +000001b0 b1 83 26 d1 2f 26 59 06 14 03 03 00 01 01 16 03 |..&./&Y.........| +000001c0 03 00 20 7b 59 a9 9c 67 42 6e ce 78 78 cb d0 94 |.. {Y..gBn.xx...| +000001d0 d1 b1 38 06 65 a7 97 56 3c cf 14 2f 80 1c f4 04 |..8.e..V<../....| +000001e0 59 de 4d |Y.M| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 20 91 2c 24 55 e8 |.......... .,$U.| +00000010 70 9e 88 07 53 e1 60 9e 86 af 53 d4 21 d9 99 ad |p...S.`...S.!...| +00000020 3a 2b 83 b0 bc f7 93 5e 63 04 50 |:+.....^c.P| +>>> Flow 5 (client to server) +00000000 17 03 03 00 16 e0 69 be 8e c5 4d 63 0e 77 88 42 |......i...Mc.w.B| +00000010 4e a8 e9 8f f4 c5 05 56 99 92 70 15 03 03 00 12 |N......V..p.....| +00000020 64 5c 05 8f 23 af e8 aa f6 76 1b b6 90 36 d9 d5 |d\..#....v...6..| +00000030 59 e6 |Y.| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-AES256-GCM-SHA384 b/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-AES256-GCM-SHA384 new file mode 100644 index 0000000000000000000000000000000000000000..e9f6604b2f5cacc8ddcbc09ab73528dc6aed2d15 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-AES256-GCM-SHA384 @@ -0,0 +1,139 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 bc b7 27 59 a9 |....]...Y....'Y.| +00000010 a7 ac ce 8b f5 5b 13 56 60 19 70 2a a7 f0 a2 ea |.....[.V`.p*....| +00000020 1a ce 27 2a 67 53 e0 5c 7e 5e 80 20 d5 c6 de 6d |..'*gS.\~^. ...m| +00000030 d1 3c 6d cb c9 49 77 00 cc 31 87 0a 86 45 06 70 |.I..m| +000001f0 b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 |....`0...U.#..0.| +00000200 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab |..H.IM.~.1......| +00000210 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |n{0...U....0...e| +00000220 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| +00000230 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| +00000240 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed |.0.@+[P.a...SX..| +00000250 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 |.(.X..8....1Z..f| +00000260 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a |=C.-...... d8.$:| +00000270 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 |....}.@ ._...a..| +00000280 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed |v......\.....l..| +00000290 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 |s..Cw.......@.a.| +000002a0 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 |Lr+...F..M...>..| +000002b0 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 |.B...=.`.\!.;...| +000002c0 16 03 03 00 ac 0c 00 00 a8 03 00 1d 20 8b ea d3 |............ ...| +000002d0 e4 1f c2 21 cb 32 99 00 d2 a9 a4 f3 e4 9a d7 6e |...!.2.........n| +000002e0 f0 6e 7c 45 ca 41 51 60 a3 31 61 f0 34 08 04 00 |.n|E.AQ`.1a.4...| +000002f0 80 96 62 58 0c b4 72 a7 49 1c b8 73 72 5a c7 ba |..bX..r.I..srZ..| +00000300 e2 fe dc a6 a4 54 3d 21 83 70 ab ef de d8 d8 db |.....T=!.p......| +00000310 82 56 22 4f 9d f6 04 c2 b6 f7 9d a0 41 88 53 c9 |.V"O........A.S.| +00000320 2b 57 80 71 a2 bd d7 84 b6 4b cd 65 3d c3 10 cb |+W.q.....K.e=...| +00000330 5d 89 03 af 46 d5 b0 39 b8 c8 2d 74 1b 46 8d 0d |]...F..9..-t.F..| +00000340 ca 13 30 34 54 10 ea ec 77 ca 84 a6 2c 88 68 d6 |..04T...w...,.h.| +00000350 69 e6 f3 95 aa 65 af 05 7d e0 c2 84 48 f5 fa ae |i....e..}...H...| +00000360 d5 90 2a 79 0c 45 c6 7d d3 b7 de 85 e8 b5 2b 68 |..*y.E.}......+h| +00000370 bf 16 03 03 00 3a 0d 00 00 36 03 01 02 40 00 2e |.....:...6...@..| +00000380 04 03 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b |................| +00000390 08 04 08 05 08 06 04 01 05 01 06 01 03 03 02 03 |................| +000003a0 03 01 02 01 03 02 02 02 04 02 05 02 06 02 00 00 |................| +000003b0 16 03 03 00 04 0e 00 00 00 |.........| +>>> Flow 3 (client to server) +00000000 16 03 03 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0| +00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.| +00000020 c1 89 65 83 55 6f dc 0b c9 b9 93 9f e9 bc 30 0d |..e.Uo........0.| +00000030 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 12 31 |..*.H........0.1| +00000040 10 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 |.0...U....Acme C| +00000050 6f 30 1e 17 0d 31 36 30 38 31 37 32 31 35 32 33 |o0...16081721523| +00000060 31 5a 17 0d 31 37 30 38 31 37 32 31 35 32 33 31 |1Z..170817215231| +00000070 5a 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 63 |Z0.1.0...U....Ac| +00000080 6d 65 20 43 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |me Co0..0...*.H.| +00000090 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +000000a0 81 00 ba 6f aa 86 bd cf bf 9f f2 ef 5c 94 60 78 |...o........\.`x| +000000b0 6f e8 13 f2 d1 96 6f cd d9 32 6e 22 37 ce 41 f9 |o.....o..2n"7.A.| +000000c0 ca 5d 29 ac e1 27 da 61 a2 ee 81 cb 10 c7 df 34 |.])..'.a.......4| +000000d0 58 95 86 e9 3d 19 e6 5c 27 73 60 c8 8d 78 02 f4 |X...=..\'s`..x..| +000000e0 1d a4 98 09 a3 19 70 69 3c 25 62 66 2a ab 22 23 |......pi<%bf*."#| +000000f0 c5 7b 85 38 4f 2e 09 73 32 a7 bd 3e 9b ad ca 84 |.{.8O..s2..>....| +00000100 07 e6 0f 3a ff 77 c5 9d 41 85 00 8a b6 9b ee b0 |...:.w..A.......| +00000110 a4 3f 2d 4c 4c e6 42 3e bb 51 c8 dd 48 54 f4 0c |.?-LL.B>.Q..HT..| +00000120 8e 47 02 03 01 00 01 a3 46 30 44 30 0e 06 03 55 |.G......F0D0...U| +00000130 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 55 |...........0...U| +00000140 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......| +00000150 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0f |0...U.......0.0.| +00000160 06 03 55 1d 11 04 08 30 06 87 04 7f 00 00 01 30 |..U....0.......0| +00000170 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 |...*.H..........| +00000180 81 00 46 ab 44 a2 fb 28 54 f8 5a 67 f8 62 94 f1 |..F.D..(T.Zg.b..| +00000190 9a b2 18 9e f2 b1 de 1d 7e 6f 76 95 a9 ba e7 5d |........~ov....]| +000001a0 a8 16 6c 9c f7 09 d3 37 e4 4b 2b 36 7c 01 ad 41 |..l....7.K+6|..A| +000001b0 d2 32 d8 c3 d2 93 f9 10 6b 8e 95 b9 2c 17 8a a3 |.2......k...,...| +000001c0 44 48 bc 59 13 83 16 04 88 a4 81 5c 25 0d 98 0c |DH.Y.......\%...| +000001d0 ac 11 b1 28 56 be 1d cd 61 62 84 09 bf d6 80 c6 |...(V...ab......| +000001e0 45 8d 82 2c b4 d8 83 9b db c9 22 b7 2a 12 11 7b |E..,......".*..{| +000001f0 fa 02 3b c1 c9 ff ea c9 9d a8 49 d3 95 d7 d5 0e |..;.......I.....| +00000200 e5 35 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 |.5....%...! /.}.| +00000210 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...| +00000220 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 03 00 |......._X.;t....| +00000230 88 0f 00 00 84 08 04 00 80 48 ae 01 b6 4e e2 f0 |.........H...N..| +00000240 6b d9 58 e9 95 fb 93 56 10 8f 15 dc e8 3e c7 49 |k.X....V.....>.I| +00000250 b3 26 c2 06 91 4a 02 27 36 6b 21 cd aa 4a 62 6a |.&...J.'6k!..Jbj| +00000260 9d 44 6a b7 6c 16 d4 52 23 12 20 9d e5 5c 83 04 |.Dj.l..R#. ..\..| +00000270 d8 38 45 61 8b 30 5b 7b 6b 77 be 47 5a f8 fe 4d |.8Ea.0[{kw.GZ..M| +00000280 c8 e7 83 97 44 b4 fb 71 89 30 f2 cf d2 49 82 e8 |....D..q.0...I..| +00000290 d4 a8 73 86 44 29 30 17 7b b6 0e 4f 5f 6b 0c 33 |..s.D)0.{..O_k.3| +000002a0 43 7f 9b 84 a4 9b c6 30 18 ff 1b 85 a7 a9 17 23 |C......0.......#| +000002b0 2e 08 d3 57 10 af 49 95 2a 14 03 03 00 01 01 16 |...W..I.*.......| +000002c0 03 03 00 28 00 00 00 00 00 00 00 00 43 b8 4c 8a |...(........C.L.| +000002d0 84 1e 6c 41 02 fb b6 74 1e 4d 69 0d c0 f8 fc 8b |..lA...t.Mi.....| +000002e0 ce 64 53 95 40 c8 e8 52 31 5f a3 65 |.dS.@..R1_.e| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 28 04 f3 da a1 b9 |..........(.....| +00000010 b9 1a cf f3 a8 19 aa 23 12 65 8d 68 dc 37 09 9a |.......#.e.h.7..| +00000020 e4 0c cd e5 d4 3d cb 42 89 e4 ad 9e 49 34 de 05 |.....=.B....I4..| +00000030 74 f0 33 |t.3| +>>> Flow 5 (client to server) +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 00 33 c0 |..............3.| +00000010 3f 9c 56 3e 9b ed bb 5e 81 0c 4a 01 65 91 f5 da |?.V>...^..J.e...| +00000020 f6 4b 62 15 03 03 00 1a 00 00 00 00 00 00 00 02 |.Kb.............| +00000030 55 6f 8d 18 50 1f aa 00 94 9b 79 26 f0 3e 0a c6 |Uo..P.....y&.>..| +00000040 45 b0 |E.| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-ECDSA b/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-ECDSA new file mode 100644 index 0000000000000000000000000000000000000000..25120914e850cd9fb9d343aafa5d5d7d01583ffc --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-ECDSA @@ -0,0 +1,140 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 80 e4 9b 9d a9 |....]...Y.......| +00000010 59 27 7f 44 b9 4b 90 31 c7 66 03 90 d6 9b ef 17 |Y'.D.K.1.f......| +00000020 f8 fb e5 63 04 68 f6 ce a1 a6 f4 20 cb 84 55 fa |...c.h..... ..U.| +00000030 41 77 48 0f 0a 5a 24 92 e3 59 b2 d9 91 0c 18 4a |AwH..Z$..Y.....J| +00000040 bf af ad db 64 db cb 57 d8 0b de 46 c0 09 00 00 |....d..W...F....| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 02 0e 0b 00 02 0a 00 02 07 00 02 |................| +00000070 04 30 82 02 00 30 82 01 62 02 09 00 b8 bf 2d 47 |.0...0..b.....-G| +00000080 a0 d2 eb f4 30 09 06 07 2a 86 48 ce 3d 04 01 30 |....0...*.H.=..0| +00000090 45 31 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 |E1.0...U....AU1.| +000000a0 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 |0...U....Some-St| +000000b0 61 74 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e |ate1!0...U....In| +000000c0 74 65 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 |ternet Widgits P| +000000d0 74 79 20 4c 74 64 30 1e 17 0d 31 32 31 31 32 32 |ty Ltd0...121122| +000000e0 31 35 30 36 33 32 5a 17 0d 32 32 31 31 32 30 31 |150632Z..2211201| +000000f0 35 30 36 33 32 5a 30 45 31 0b 30 09 06 03 55 04 |50632Z0E1.0...U.| +00000100 06 13 02 41 55 31 13 30 11 06 03 55 04 08 13 0a |...AU1.0...U....| +00000110 53 6f 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 |Some-State1!0...| +00000120 55 04 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 |U....Internet Wi| +00000130 64 67 69 74 73 20 50 74 79 20 4c 74 64 30 81 9b |dgits Pty Ltd0..| +00000140 30 10 06 07 2a 86 48 ce 3d 02 01 06 05 2b 81 04 |0...*.H.=....+..| +00000150 00 23 03 81 86 00 04 00 c4 a1 ed be 98 f9 0b 48 |.#.............H| +00000160 73 36 7e c3 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d |s6~..V.".=S.;M!=| +00000170 cd 6b 75 e6 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 |.ku......&.....r| +00000180 32 7c b3 64 2f 1c 90 bc ea 68 23 10 7e fe e3 25 |2|.d/....h#.~..%| +00000190 c0 48 3a 69 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 |.H:i.(m.7...b...| +000001a0 9c 70 62 83 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 |.pb....d1...1...| +000001b0 68 c0 9b 23 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 |h..#.vd?.\....XX| +000001c0 b6 5f 70 dd 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 |._p............0| +000001d0 66 5b 66 9a 20 e2 27 e5 bf fe 3b 30 09 06 07 2a |f[f. .'...;0...*| +000001e0 86 48 ce 3d 04 01 03 81 8c 00 30 81 88 02 42 01 |.H.=......0...B.| +000001f0 88 a2 4f eb e2 45 c5 48 7d 1b ac f5 ed 98 9d ae |..O..E.H}.......| +00000200 47 70 c0 5e 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 |Gp.^../...M.a@..| +00000210 a2 ce ee 0b 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce |....~.~.v..;~.?.| +00000220 fa 10 e2 59 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f |...Y.G-|..N....o| +00000230 d0 02 42 01 4d fc be 67 13 9c 2d 05 0e bd 3f a3 |..B.M..g..-...?.| +00000240 8c 25 c1 33 13 83 0d 94 06 bb d4 37 7a f6 ec 7a |.%.3.......7z..z| +00000250 c9 86 2e dd d7 11 69 7f 85 7c 56 de fb 31 78 2b |......i..|V..1x+| +00000260 e4 c7 78 0d ae cb be 9e 4e 36 24 31 7b 6a 0f 39 |..x.....N6$1{j.9| +00000270 95 12 07 8f 2a 16 03 03 00 b6 0c 00 00 b2 03 00 |....*...........| +00000280 1d 20 2f 6b 4c 95 75 59 25 2f f7 fd b1 1f d2 9e |. /kL.uY%/......| +00000290 2f 38 5e 57 1a 7c 36 99 1e 11 4a 3f f7 13 5b 0b |/8^W.|6...J?..[.| +000002a0 90 33 04 03 00 8a 30 81 87 02 42 01 b4 34 3f d0 |.3....0...B..4?.| +000002b0 41 09 00 12 f4 79 20 f4 b7 80 5c d1 35 9d 8b d2 |A....y ...\.5...| +000002c0 fa c9 4a a9 44 6b 05 95 c5 a7 50 08 0d 73 66 3e |..J.Dk....P..sf>| +000002d0 dd 49 e4 a4 c6 c0 12 ca 0b 4a df bc c1 3e ec 88 |.I.......J...>..| +000002e0 ec 9a 0e 71 15 4d 45 98 04 3a 51 7a 67 02 41 15 |...q.ME..:Qzg.A.| +000002f0 17 de b0 5c 03 a5 74 0e 0f 2b 53 6e 55 17 73 b8 |...\..t..+SnU.s.| +00000300 ac 16 70 1a 95 f9 25 b1 fc 4b 9d c7 b1 f4 71 f6 |..p...%..K....q.| +00000310 86 2d 5b 74 9e d3 4e 1b 40 67 f4 a6 62 2e c8 4d |.-[t..N.@g..b..M| +00000320 66 f7 32 e9 05 df d5 b0 e8 1a b7 b1 48 c4 1c 91 |f.2.........H...| +00000330 16 03 03 00 3a 0d 00 00 36 03 01 02 40 00 2e 04 |....:...6...@...| +00000340 03 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b 08 |................| +00000350 04 08 05 08 06 04 01 05 01 06 01 03 03 02 03 03 |................| +00000360 01 02 01 03 02 02 02 04 02 05 02 06 02 00 00 16 |................| +00000370 03 03 00 04 0e 00 00 00 |........| +>>> Flow 3 (client to server) +00000000 16 03 03 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0| +00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.| +00000020 c1 89 65 83 55 6f dc 0b c9 b9 93 9f e9 bc 30 0d |..e.Uo........0.| +00000030 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 12 31 |..*.H........0.1| +00000040 10 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 |.0...U....Acme C| +00000050 6f 30 1e 17 0d 31 36 30 38 31 37 32 31 35 32 33 |o0...16081721523| +00000060 31 5a 17 0d 31 37 30 38 31 37 32 31 35 32 33 31 |1Z..170817215231| +00000070 5a 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 63 |Z0.1.0...U....Ac| +00000080 6d 65 20 43 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |me Co0..0...*.H.| +00000090 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +000000a0 81 00 ba 6f aa 86 bd cf bf 9f f2 ef 5c 94 60 78 |...o........\.`x| +000000b0 6f e8 13 f2 d1 96 6f cd d9 32 6e 22 37 ce 41 f9 |o.....o..2n"7.A.| +000000c0 ca 5d 29 ac e1 27 da 61 a2 ee 81 cb 10 c7 df 34 |.])..'.a.......4| +000000d0 58 95 86 e9 3d 19 e6 5c 27 73 60 c8 8d 78 02 f4 |X...=..\'s`..x..| +000000e0 1d a4 98 09 a3 19 70 69 3c 25 62 66 2a ab 22 23 |......pi<%bf*."#| +000000f0 c5 7b 85 38 4f 2e 09 73 32 a7 bd 3e 9b ad ca 84 |.{.8O..s2..>....| +00000100 07 e6 0f 3a ff 77 c5 9d 41 85 00 8a b6 9b ee b0 |...:.w..A.......| +00000110 a4 3f 2d 4c 4c e6 42 3e bb 51 c8 dd 48 54 f4 0c |.?-LL.B>.Q..HT..| +00000120 8e 47 02 03 01 00 01 a3 46 30 44 30 0e 06 03 55 |.G......F0D0...U| +00000130 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 55 |...........0...U| +00000140 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......| +00000150 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0f |0...U.......0.0.| +00000160 06 03 55 1d 11 04 08 30 06 87 04 7f 00 00 01 30 |..U....0.......0| +00000170 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 |...*.H..........| +00000180 81 00 46 ab 44 a2 fb 28 54 f8 5a 67 f8 62 94 f1 |..F.D..(T.Zg.b..| +00000190 9a b2 18 9e f2 b1 de 1d 7e 6f 76 95 a9 ba e7 5d |........~ov....]| +000001a0 a8 16 6c 9c f7 09 d3 37 e4 4b 2b 36 7c 01 ad 41 |..l....7.K+6|..A| +000001b0 d2 32 d8 c3 d2 93 f9 10 6b 8e 95 b9 2c 17 8a a3 |.2......k...,...| +000001c0 44 48 bc 59 13 83 16 04 88 a4 81 5c 25 0d 98 0c |DH.Y.......\%...| +000001d0 ac 11 b1 28 56 be 1d cd 61 62 84 09 bf d6 80 c6 |...(V...ab......| +000001e0 45 8d 82 2c b4 d8 83 9b db c9 22 b7 2a 12 11 7b |E..,......".*..{| +000001f0 fa 02 3b c1 c9 ff ea c9 9d a8 49 d3 95 d7 d5 0e |..;.......I.....| +00000200 e5 35 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 |.5....%...! /.}.| +00000210 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...| +00000220 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 03 00 |......._X.;t....| +00000230 88 0f 00 00 84 08 04 00 80 70 66 f2 ac fb f7 29 |.........pf....)| +00000240 15 31 a2 12 de 37 3f cc 97 74 5c 5b 7e 6d e4 f8 |.1...7?..t\[~m..| +00000250 b0 b3 3d 9c ee 32 bf d7 64 90 d7 af ad 8f 61 77 |..=..2..d.....aw| +00000260 f2 c0 7e 6f 91 1d 4e 95 92 3e ab 23 f0 ac d8 de |..~o..N..>.#....| +00000270 32 69 cd bc 04 4c d1 a3 77 7a af ac f0 64 41 aa |2i...L..wz...dA.| +00000280 a0 53 f0 89 89 a4 6f 1f 67 21 16 55 4e dc cb a8 |.S....o.g!.UN...| +00000290 12 7d cb a0 5c a9 48 48 d9 af 03 f0 75 ed 32 72 |.}..\.HH....u.2r| +000002a0 d5 da 34 a3 ea 82 08 8f 00 fc 7d 1d b8 11 ff f7 |..4.......}.....| +000002b0 09 52 a8 cc a8 66 b0 06 1e 14 03 03 00 01 01 16 |.R...f..........| +000002c0 03 03 00 40 00 00 00 00 00 00 00 00 00 00 00 00 |...@............| +000002d0 00 00 00 00 9c 7d d4 9e 59 53 e7 66 64 63 9c cb |.....}..YS.fdc..| +000002e0 58 03 03 26 fe d9 15 eb 03 1c 8f a7 9c 5a 86 4a |X..&.........Z.J| +000002f0 6c 4e 06 4a 80 91 94 00 6f 7d 38 6a ea a3 68 df |lN.J....o}8j..h.| +00000300 17 08 14 ed |....| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 40 7e 6d 15 90 c5 |..........@~m...| +00000010 99 96 ca bb 16 b5 5a 55 3e b0 ef 3f ab e5 b6 8c |......ZU>..?....| +00000020 51 1d 18 c7 c2 25 86 e0 db c1 d0 38 85 51 4e 8d |Q....%.....8.QN.| +00000030 37 51 92 cc d0 64 37 b7 67 7b 2c fc e7 1e 16 f6 |7Q...d7.g{,.....| +00000040 76 3a 94 48 68 eb dc cc cf 2a 4d |v:.Hh....*M| +>>> Flow 5 (client to server) +00000000 17 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| +00000010 00 00 00 00 00 db 14 ae 78 62 50 37 42 b8 fc c6 |........xbP7B...| +00000020 f1 84 40 75 7c e4 3f 8a 57 b8 1c 12 4a 6f 11 f2 |..@u|.?.W...Jo..| +00000030 ba 1a a6 9b 20 15 03 03 00 30 00 00 00 00 00 00 |.... ....0......| +00000040 00 00 00 00 00 00 00 00 00 00 09 93 aa 80 fd b2 |................| +00000050 66 e2 83 0e f8 83 45 3d e1 39 06 5d a3 12 9e 12 |f.....E=.9.]....| +00000060 fd f5 cb 32 c4 3b ce 20 e4 10 |...2.;. ..| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSA b/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSA new file mode 100644 index 0000000000000000000000000000000000000000..3bfb4aaabd829ace1188351befebe157e62a97ad --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSA @@ -0,0 +1,139 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 c0 dd 18 ad 41 |....]...Y......A| +00000010 2b ee fd 45 1f c0 c1 10 75 a7 1d 80 74 3e 8e 66 |+..E....u...t>.f| +00000020 18 c8 64 c2 b4 89 4f 19 ff e0 0c 20 be c6 2a 8e |..d...O.... ..*.| +00000030 73 0a 1e 7a 2a d2 81 71 11 ba e9 de 02 0a aa 52 |s..z*..q.......R| +00000040 76 b7 43 a3 49 a0 81 24 9c 57 4c 26 c0 2f 00 00 |v.C.I..$.WL&./..| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 02 59 0b 00 02 55 00 02 52 00 02 |......Y...U..R..| +00000070 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 |O0..K0..........| +00000080 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 |....?.[..0...*.H| +00000090 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 |........0.1.0...| +000000a0 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 |U....Go1.0...U..| +000000b0 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 |..Go Root0...160| +000000c0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| +000000d0 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 |01000000Z0.1.0..| +000000e0 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 |.U....Go1.0...U.| +000000f0 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |...Go0..0...*.H.| +00000100 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +00000110 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab |...F}...'.H..(!.| +00000120 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d |~...]..RE.z6G...| +00000130 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd |.B[.....y.@.Om..| +00000140 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a |+.....g....."8.J| +00000150 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 |.ts+.4......t{.X| +00000160 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c |.la<..A..++$#w[.| +00000170 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 |;.u]. T..c...$..| +00000180 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 |..P....C...ub...| +00000190 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 |R.........0..0..| +000001a0 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 |.U...........0..| +000001b0 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 |.U.%..0...+.....| +000001c0 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 |....+.......0...| +000001d0 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d |U.......0.0...U.| +000001e0 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d |.........CC>I..m| +000001f0 b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 |....`0...U.#..0.| +00000200 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab |..H.IM.~.1......| +00000210 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |n{0...U....0...e| +00000220 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| +00000230 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| +00000240 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed |.0.@+[P.a...SX..| +00000250 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 |.(.X..8....1Z..f| +00000260 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a |=C.-...... d8.$:| +00000270 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 |....}.@ ._...a..| +00000280 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed |v......\.....l..| +00000290 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 |s..Cw.......@.a.| +000002a0 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 |Lr+...F..M...>..| +000002b0 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 |.B...=.`.\!.;...| +000002c0 16 03 03 00 ac 0c 00 00 a8 03 00 1d 20 5a f3 c3 |............ Z..| +000002d0 1b 34 9a 1a 01 68 65 fd 25 e5 e4 62 f4 17 d6 00 |.4...he.%..b....| +000002e0 88 ae 5e fa 6b ef 60 96 e9 96 1e 33 0f 08 04 00 |..^.k.`....3....| +000002f0 80 74 91 43 7a 3e 02 93 c6 6c 6d 36 86 2f 74 51 |.t.Cz>...lm6./tQ| +00000300 50 84 a2 0b 1c b4 90 71 72 2b f9 7d 35 2a a6 fc |P......qr+.}5*..| +00000310 56 b1 fa 36 e0 cb ea 5a 4e 89 71 3f 28 d3 fc 90 |V..6...ZN.q?(...| +00000320 de 21 0c 03 84 d9 23 78 b6 58 f2 03 02 27 48 f9 |.!....#x.X...'H.| +00000330 6d 6c 2b eb 62 36 47 66 55 fc d9 77 42 1e 9b 93 |ml+.b6GfU..wB...| +00000340 00 0f 5a 71 76 af 2c d9 b7 c3 6e e8 7a 64 34 0f |..Zqv.,...n.zd4.| +00000350 78 36 d7 cf a1 bb 3d 0a 23 64 c4 70 f0 78 8e 42 |x6....=.#d.p.x.B| +00000360 80 42 1f 0f 1d 7f c9 b6 7b 9c 2a 30 6c 7a ef 0c |.B......{.*0lz..| +00000370 2f 16 03 03 00 3a 0d 00 00 36 03 01 02 40 00 2e |/....:...6...@..| +00000380 04 03 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b |................| +00000390 08 04 08 05 08 06 04 01 05 01 06 01 03 03 02 03 |................| +000003a0 03 01 02 01 03 02 02 02 04 02 05 02 06 02 00 00 |................| +000003b0 16 03 03 00 04 0e 00 00 00 |.........| +>>> Flow 3 (client to server) +00000000 16 03 03 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0| +00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.| +00000020 c1 89 65 83 55 6f dc 0b c9 b9 93 9f e9 bc 30 0d |..e.Uo........0.| +00000030 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 12 31 |..*.H........0.1| +00000040 10 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 |.0...U....Acme C| +00000050 6f 30 1e 17 0d 31 36 30 38 31 37 32 31 35 32 33 |o0...16081721523| +00000060 31 5a 17 0d 31 37 30 38 31 37 32 31 35 32 33 31 |1Z..170817215231| +00000070 5a 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 63 |Z0.1.0...U....Ac| +00000080 6d 65 20 43 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |me Co0..0...*.H.| +00000090 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +000000a0 81 00 ba 6f aa 86 bd cf bf 9f f2 ef 5c 94 60 78 |...o........\.`x| +000000b0 6f e8 13 f2 d1 96 6f cd d9 32 6e 22 37 ce 41 f9 |o.....o..2n"7.A.| +000000c0 ca 5d 29 ac e1 27 da 61 a2 ee 81 cb 10 c7 df 34 |.])..'.a.......4| +000000d0 58 95 86 e9 3d 19 e6 5c 27 73 60 c8 8d 78 02 f4 |X...=..\'s`..x..| +000000e0 1d a4 98 09 a3 19 70 69 3c 25 62 66 2a ab 22 23 |......pi<%bf*."#| +000000f0 c5 7b 85 38 4f 2e 09 73 32 a7 bd 3e 9b ad ca 84 |.{.8O..s2..>....| +00000100 07 e6 0f 3a ff 77 c5 9d 41 85 00 8a b6 9b ee b0 |...:.w..A.......| +00000110 a4 3f 2d 4c 4c e6 42 3e bb 51 c8 dd 48 54 f4 0c |.?-LL.B>.Q..HT..| +00000120 8e 47 02 03 01 00 01 a3 46 30 44 30 0e 06 03 55 |.G......F0D0...U| +00000130 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 55 |...........0...U| +00000140 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......| +00000150 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0f |0...U.......0.0.| +00000160 06 03 55 1d 11 04 08 30 06 87 04 7f 00 00 01 30 |..U....0.......0| +00000170 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 |...*.H..........| +00000180 81 00 46 ab 44 a2 fb 28 54 f8 5a 67 f8 62 94 f1 |..F.D..(T.Zg.b..| +00000190 9a b2 18 9e f2 b1 de 1d 7e 6f 76 95 a9 ba e7 5d |........~ov....]| +000001a0 a8 16 6c 9c f7 09 d3 37 e4 4b 2b 36 7c 01 ad 41 |..l....7.K+6|..A| +000001b0 d2 32 d8 c3 d2 93 f9 10 6b 8e 95 b9 2c 17 8a a3 |.2......k...,...| +000001c0 44 48 bc 59 13 83 16 04 88 a4 81 5c 25 0d 98 0c |DH.Y.......\%...| +000001d0 ac 11 b1 28 56 be 1d cd 61 62 84 09 bf d6 80 c6 |...(V...ab......| +000001e0 45 8d 82 2c b4 d8 83 9b db c9 22 b7 2a 12 11 7b |E..,......".*..{| +000001f0 fa 02 3b c1 c9 ff ea c9 9d a8 49 d3 95 d7 d5 0e |..;.......I.....| +00000200 e5 35 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 |.5....%...! /.}.| +00000210 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...| +00000220 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 03 00 |......._X.;t....| +00000230 88 0f 00 00 84 08 04 00 80 56 a2 bb f3 05 94 90 |.........V......| +00000240 46 bc ef 79 ea 74 f9 a4 5c 27 59 dd 93 53 c3 9f |F..y.t..\'Y..S..| +00000250 07 b0 bf c1 e2 dc 39 b9 0d 63 62 d1 d0 88 65 e4 |......9..cb...e.| +00000260 2b 28 d3 ad b1 78 60 4c 0d a6 1f 2e a1 bc 36 81 |+(...x`L......6.| +00000270 31 f0 aa 0b 52 e6 04 69 ba 8a 9d c1 fd 25 d3 50 |1...R..i.....%.P| +00000280 43 5b ed fc 78 21 2b cc 13 f8 db f1 8b e7 57 d8 |C[..x!+.......W.| +00000290 59 f3 cf 54 ab d0 ea d6 8c 61 32 79 b8 be a6 c7 |Y..T.....a2y....| +000002a0 87 0a 35 88 70 f7 3f 2d bd 1b 7c 57 35 32 1b 81 |..5.p.?-..|W52..| +000002b0 87 08 e3 b0 1f a1 2b 13 fb 14 03 03 00 01 01 16 |......+.........| +000002c0 03 03 00 28 00 00 00 00 00 00 00 00 49 94 ed a1 |...(........I...| +000002d0 a3 13 e0 f4 20 2a 63 4d ef 24 d3 6c 8d 6c de b3 |.... *cM.$.l.l..| +000002e0 92 16 21 0d b0 6c 64 df 1b 32 ca dc |..!..ld..2..| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 28 b9 2c 96 43 03 |..........(.,.C.| +00000010 f9 8c 28 34 4e 8b 58 ba d7 1a c4 87 d8 67 5c 0f |..(4N.X......g\.| +00000020 36 36 67 54 4e f4 6c 9c 0c 0e 1f df ca a3 8d ab |66gTN.l.........| +00000030 31 f2 84 |1..| +>>> Flow 5 (client to server) +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 de 90 16 |................| +00000010 8e ec 2c 60 b8 a7 4f b6 26 8a c9 78 ff e0 73 19 |..,`..O.&..x..s.| +00000020 b3 01 c1 15 03 03 00 1a 00 00 00 00 00 00 00 02 |................| +00000030 8a 4b 2c 4b 99 51 81 27 34 28 63 00 15 24 e1 47 |.K,K.Q.'4(c..$.G| +00000040 4a 2f |J/| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSAPKCS1v15 b/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSAPKCS1v15 new file mode 100644 index 0000000000000000000000000000000000000000..b933f592befe72e0308c8cff404435700c7dee01 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSAPKCS1v15 @@ -0,0 +1,136 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 0e 33 06 1f 9d |....]...Y...3...| +00000010 3d 0e 59 21 38 7d 4c ea a2 2a 2a c7 99 7b e9 bf |=.Y!8}L..**..{..| +00000020 61 e2 44 a1 10 5e 5d a1 e4 fd 90 20 c1 f0 1c 8e |a.D..^].... ....| +00000030 00 2f d9 a0 45 23 76 35 e0 01 2e 49 b8 4d b4 76 |./..E#v5...I.M.v| +00000040 08 65 3f cd 8b dc 80 ea fd 31 9f 47 c0 2f 00 00 |.e?......1.G./..| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 02 59 0b 00 02 55 00 02 52 00 02 |......Y...U..R..| +00000070 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 |O0..K0..........| +00000080 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 |....?.[..0...*.H| +00000090 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 |........0.1.0...| +000000a0 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 |U....Go1.0...U..| +000000b0 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 |..Go Root0...160| +000000c0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| +000000d0 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 |01000000Z0.1.0..| +000000e0 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 |.U....Go1.0...U.| +000000f0 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |...Go0..0...*.H.| +00000100 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +00000110 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab |...F}...'.H..(!.| +00000120 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d |~...]..RE.z6G...| +00000130 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd |.B[.....y.@.Om..| +00000140 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a |+.....g....."8.J| +00000150 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 |.ts+.4......t{.X| +00000160 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c |.la<..A..++$#w[.| +00000170 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 |;.u]. T..c...$..| +00000180 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 |..P....C...ub...| +00000190 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 |R.........0..0..| +000001a0 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 |.U...........0..| +000001b0 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 |.U.%..0...+.....| +000001c0 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 |....+.......0...| +000001d0 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d |U.......0.0...U.| +000001e0 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d |.........CC>I..m| +000001f0 b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 |....`0...U.#..0.| +00000200 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab |..H.IM.~.1......| +00000210 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |n{0...U....0...e| +00000220 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| +00000230 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| +00000240 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed |.0.@+[P.a...SX..| +00000250 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 |.(.X..8....1Z..f| +00000260 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a |=C.-...... d8.$:| +00000270 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 |....}.@ ._...a..| +00000280 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed |v......\.....l..| +00000290 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 |s..Cw.......@.a.| +000002a0 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 |Lr+...F..M...>..| +000002b0 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 |.B...=.`.\!.;...| +000002c0 16 03 03 00 ac 0c 00 00 a8 03 00 1d 20 09 ce 63 |............ ..c| +000002d0 9c 52 37 83 ef 21 78 60 eb 8b dd 22 91 fb 34 4f |.R7..!x`..."..4O| +000002e0 ee 04 ef 48 75 2f 49 7e 3f 0b 00 62 15 04 01 00 |...Hu/I~?..b....| +000002f0 80 a0 11 99 d2 bc a9 fd 59 ad 38 20 bb 44 85 8e |........Y.8 .D..| +00000300 89 35 2e 42 ff a2 87 81 86 f5 e3 6c 9d 84 2a cf |.5.B.......l..*.| +00000310 0d cc 6a c0 ce 31 01 91 48 78 75 23 24 3e 3d 93 |..j..1..Hxu#$>=.| +00000320 bf ad c9 49 9d 63 66 cd 4b cc 92 0f 6d 64 2c 80 |...I.cf.K...md,.| +00000330 71 22 bf 6d 62 8e 8a f7 19 6f 50 2a 86 46 e4 46 |q".mb....oP*.F.F| +00000340 71 73 df 8c 25 84 6f 28 a7 8c bd 78 01 22 a2 91 |qs..%.o(...x."..| +00000350 f4 17 ef 88 55 9d d5 ac 42 5a 8a c8 7a 1b bf d1 |....U...BZ..z...| +00000360 d9 6d 15 42 b9 37 16 7b 2b 3c c7 58 99 da ab 98 |.m.B.7.{+<.X....| +00000370 f3 16 03 03 00 0c 0d 00 00 08 01 01 00 02 04 01 |................| +00000380 00 00 16 03 03 00 04 0e 00 00 00 |...........| +>>> Flow 3 (client to server) +00000000 16 03 03 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0| +00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.| +00000020 c1 89 65 83 55 6f dc 0b c9 b9 93 9f e9 bc 30 0d |..e.Uo........0.| +00000030 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 12 31 |..*.H........0.1| +00000040 10 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 |.0...U....Acme C| +00000050 6f 30 1e 17 0d 31 36 30 38 31 37 32 31 35 32 33 |o0...16081721523| +00000060 31 5a 17 0d 31 37 30 38 31 37 32 31 35 32 33 31 |1Z..170817215231| +00000070 5a 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 63 |Z0.1.0...U....Ac| +00000080 6d 65 20 43 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |me Co0..0...*.H.| +00000090 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +000000a0 81 00 ba 6f aa 86 bd cf bf 9f f2 ef 5c 94 60 78 |...o........\.`x| +000000b0 6f e8 13 f2 d1 96 6f cd d9 32 6e 22 37 ce 41 f9 |o.....o..2n"7.A.| +000000c0 ca 5d 29 ac e1 27 da 61 a2 ee 81 cb 10 c7 df 34 |.])..'.a.......4| +000000d0 58 95 86 e9 3d 19 e6 5c 27 73 60 c8 8d 78 02 f4 |X...=..\'s`..x..| +000000e0 1d a4 98 09 a3 19 70 69 3c 25 62 66 2a ab 22 23 |......pi<%bf*."#| +000000f0 c5 7b 85 38 4f 2e 09 73 32 a7 bd 3e 9b ad ca 84 |.{.8O..s2..>....| +00000100 07 e6 0f 3a ff 77 c5 9d 41 85 00 8a b6 9b ee b0 |...:.w..A.......| +00000110 a4 3f 2d 4c 4c e6 42 3e bb 51 c8 dd 48 54 f4 0c |.?-LL.B>.Q..HT..| +00000120 8e 47 02 03 01 00 01 a3 46 30 44 30 0e 06 03 55 |.G......F0D0...U| +00000130 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 55 |...........0...U| +00000140 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......| +00000150 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0f |0...U.......0.0.| +00000160 06 03 55 1d 11 04 08 30 06 87 04 7f 00 00 01 30 |..U....0.......0| +00000170 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 |...*.H..........| +00000180 81 00 46 ab 44 a2 fb 28 54 f8 5a 67 f8 62 94 f1 |..F.D..(T.Zg.b..| +00000190 9a b2 18 9e f2 b1 de 1d 7e 6f 76 95 a9 ba e7 5d |........~ov....]| +000001a0 a8 16 6c 9c f7 09 d3 37 e4 4b 2b 36 7c 01 ad 41 |..l....7.K+6|..A| +000001b0 d2 32 d8 c3 d2 93 f9 10 6b 8e 95 b9 2c 17 8a a3 |.2......k...,...| +000001c0 44 48 bc 59 13 83 16 04 88 a4 81 5c 25 0d 98 0c |DH.Y.......\%...| +000001d0 ac 11 b1 28 56 be 1d cd 61 62 84 09 bf d6 80 c6 |...(V...ab......| +000001e0 45 8d 82 2c b4 d8 83 9b db c9 22 b7 2a 12 11 7b |E..,......".*..{| +000001f0 fa 02 3b c1 c9 ff ea c9 9d a8 49 d3 95 d7 d5 0e |..;.......I.....| +00000200 e5 35 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 |.5....%...! /.}.| +00000210 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...| +00000220 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 03 00 |......._X.;t....| +00000230 88 0f 00 00 84 04 01 00 80 01 83 0b 8b bf a3 50 |...............P| +00000240 03 89 e8 24 9b 9e 2e f5 7b 72 58 b1 b1 ba b2 64 |...$....{rX....d| +00000250 9f a9 e2 b4 00 78 79 50 ec 55 18 43 e5 c4 a4 76 |.....xyP.U.C...v| +00000260 c8 21 bc 7e e0 c4 2d 78 85 d7 33 ca d7 4d e0 f1 |.!.~..-x..3..M..| +00000270 cd 6d bd 17 2f a0 b9 39 93 29 ba d7 09 4f bb 08 |.m../..9.)...O..| +00000280 b0 b0 05 f1 83 de d0 db 39 f9 b4 34 a3 ca d3 76 |........9..4...v| +00000290 97 35 f6 ea cd 53 fe bb 94 99 30 e3 a2 0a 29 1a |.5...S....0...).| +000002a0 5f f4 28 0e 8c 80 fc 75 84 a4 e2 3a 29 a9 50 be |_.(....u...:).P.| +000002b0 11 99 bb a5 12 64 5c af 5f 14 03 03 00 01 01 16 |.....d\._.......| +000002c0 03 03 00 28 00 00 00 00 00 00 00 00 8e 51 58 0e |...(.........QX.| +000002d0 1a fd 8e 01 f1 6b 59 94 54 ab 00 be 45 8b 4c ae |.....kY.T...E.L.| +000002e0 70 c3 db 53 de 82 12 6c cb df 32 72 |p..S...l..2r| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 28 7b 7f 81 c9 d7 |..........({....| +00000010 1d 3a 32 48 da 92 d6 9f 78 6e 2f d3 e9 7e 9f 12 |.:2H....xn/..~..| +00000020 9b 0b e1 00 e8 2f 4b 63 2c 3d 94 e4 f8 1e 06 7d |...../Kc,=.....}| +00000030 a7 7e 6a |.~j| +>>> Flow 5 (client to server) +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 ee 21 1b |..............!.| +00000010 45 15 6a 0c 79 12 4d 79 d2 26 db fc e4 da 0f e4 |E.j.y.My.&......| +00000020 20 7e c7 15 03 03 00 1a 00 00 00 00 00 00 00 02 | ~..............| +00000030 2a 46 62 6b 5e c3 14 56 e1 fb d0 61 f5 e8 7b 2f |*Fbk^..V...a..{/| +00000040 cc fd |..| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSAPSS b/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSAPSS new file mode 100644 index 0000000000000000000000000000000000000000..646026793f0a58cf6defbc8cddc9f0bfdf348f4a --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSAPSS @@ -0,0 +1,144 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 cd 47 5d a7 66 |....]...Y...G].f| +00000010 aa b1 e1 bd ed 83 bd 3d 4a b7 b2 08 b8 79 08 c5 |.......=J....y..| +00000020 22 7b 8d be fe 55 4c 2d b5 4c b9 20 13 26 2a e6 |"{...UL-.L. .&*.| +00000030 ab 60 4c 53 8c b7 27 c4 d5 12 ff 38 64 b1 a2 1d |.`LS..'....8d...| +00000040 4f a4 c7 28 53 95 01 8f 7e 4a 7b 02 c0 2f 00 00 |O..(S...~J{../..| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 02 66 0b 00 02 62 00 02 5f 00 02 |......f...b.._..| +00000070 5c 30 82 02 58 30 82 01 8d a0 03 02 01 02 02 11 |\0..X0..........| +00000080 00 f2 99 26 eb 87 ea 8a 0d b9 fc c2 47 34 7c 11 |...&........G4|.| +00000090 b0 30 41 06 09 2a 86 48 86 f7 0d 01 01 0a 30 34 |.0A..*.H......04| +000000a0 a0 0f 30 0d 06 09 60 86 48 01 65 03 04 02 01 05 |..0...`.H.e.....| +000000b0 00 a1 1c 30 1a 06 09 2a 86 48 86 f7 0d 01 01 08 |...0...*.H......| +000000c0 30 0d 06 09 60 86 48 01 65 03 04 02 01 05 00 a2 |0...`.H.e.......| +000000d0 03 02 01 20 30 12 31 10 30 0e 06 03 55 04 0a 13 |... 0.1.0...U...| +000000e0 07 41 63 6d 65 20 43 6f 30 1e 17 0d 31 37 31 31 |.Acme Co0...1711| +000000f0 32 33 31 36 31 36 31 30 5a 17 0d 31 38 31 31 32 |23161610Z..18112| +00000100 33 31 36 31 36 31 30 5a 30 12 31 10 30 0e 06 03 |3161610Z0.1.0...| +00000110 55 04 0a 13 07 41 63 6d 65 20 43 6f 30 81 9f 30 |U....Acme Co0..0| +00000120 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 |...*.H..........| +00000130 8d 00 30 81 89 02 81 81 00 db 46 7d 93 2e 12 27 |..0.......F}...'| +00000140 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 |.H..(!.~...]..RE| +00000150 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 |.z6G....B[.....y| +00000160 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 |.@.Om..+.....g..| +00000170 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 |..."8.J.ts+.4...| +00000180 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 |...t{.X.la<..A..| +00000190 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 |++$#w[.;.u]. T..| +000001a0 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed |c...$....P....C.| +000001b0 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 46 |..ub...R.......F| +000001c0 30 44 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 |0D0...U.........| +000001d0 05 a0 30 13 06 03 55 1d 25 04 0c 30 0a 06 08 2b |..0...U.%..0...+| +000001e0 06 01 05 05 07 03 01 30 0c 06 03 55 1d 13 01 01 |.......0...U....| +000001f0 ff 04 02 30 00 30 0f 06 03 55 1d 11 04 08 30 06 |...0.0...U....0.| +00000200 87 04 7f 00 00 01 30 41 06 09 2a 86 48 86 f7 0d |......0A..*.H...| +00000210 01 01 0a 30 34 a0 0f 30 0d 06 09 60 86 48 01 65 |...04..0...`.H.e| +00000220 03 04 02 01 05 00 a1 1c 30 1a 06 09 2a 86 48 86 |........0...*.H.| +00000230 f7 0d 01 01 08 30 0d 06 09 60 86 48 01 65 03 04 |.....0...`.H.e..| +00000240 02 01 05 00 a2 03 02 01 20 03 81 81 00 cd ac 4e |........ ......N| +00000250 f2 ce 5f 8d 79 88 10 42 70 7f 7c bf 1b 5a 8a 00 |.._.y..Bp.|..Z..| +00000260 ef 19 15 4b 40 15 17 71 00 6c d4 16 26 e5 49 6d |...K@..q.l..&.Im| +00000270 56 da 0c 1a 13 9f d8 46 95 59 3c b6 7f 87 76 5e |V......F.Y<...v^| +00000280 18 aa 03 ea 06 75 22 dd 78 d2 a5 89 b8 c9 23 64 |.....u".x.....#d| +00000290 e1 28 38 ce 34 6c 6e 06 7b 51 f1 a7 e6 f4 b3 7f |.(8.4ln.{Q......| +000002a0 fa b1 3f 14 11 89 66 79 d1 8e 88 0e 0b a0 9e 30 |..?...fy.......0| +000002b0 2a c0 67 ef ca 46 02 88 e9 53 81 22 69 22 97 ad |*.g..F...S."i"..| +000002c0 80 93 d4 f7 dd 70 14 24 d7 70 0a 46 a1 16 03 03 |.....p.$.p.F....| +000002d0 00 ac 0c 00 00 a8 03 00 1d 20 a8 94 95 94 cc 16 |......... ......| +000002e0 f1 dc 11 b6 c5 52 b3 fe 95 4d 28 34 1f 2d 87 ec |.....R...M(4.-..| +000002f0 8d 56 51 0e 5b 92 03 f9 60 0d 08 04 00 80 09 3a |.VQ.[...`......:| +00000300 99 39 d8 3f 63 b4 86 12 ba ce e6 6d d6 22 aa d8 |.9.?c......m."..| +00000310 31 60 86 eb 48 cc c0 87 97 a5 0d c7 42 86 cc f8 |1`..H.......B...| +00000320 f7 f9 d5 1a 34 86 ec 41 02 08 99 c2 93 9b d1 b5 |....4..A........| +00000330 57 a4 84 3c a8 93 0a c9 f7 1e a1 33 07 ca 60 c4 |W..<.......3..`.| +00000340 4b 40 32 20 a6 22 3f 6d 4e 28 22 3b 52 70 9a 4d |K@2 ."?mN(";Rp.M| +00000350 fa 84 67 88 ba b5 0d 92 eb 23 94 90 00 e2 68 74 |..g......#....ht| +00000360 5f 13 a3 d4 2d fb 24 f2 32 09 b1 e3 63 15 39 b1 |_...-.$.2...c.9.| +00000370 9e 1e a6 61 fd 8d c6 cf 1f f7 f7 43 0c 64 16 03 |...a.......C.d..| +00000380 03 00 0c 0d 00 00 08 01 01 00 02 08 04 00 00 16 |................| +00000390 03 03 00 04 0e 00 00 00 |........| +>>> Flow 3 (client to server) +00000000 16 03 03 02 66 0b 00 02 62 00 02 5f 00 02 5c 30 |....f...b.._..\0| +00000010 82 02 58 30 82 01 8d a0 03 02 01 02 02 11 00 f2 |..X0............| +00000020 99 26 eb 87 ea 8a 0d b9 fc c2 47 34 7c 11 b0 30 |.&........G4|..0| +00000030 41 06 09 2a 86 48 86 f7 0d 01 01 0a 30 34 a0 0f |A..*.H......04..| +00000040 30 0d 06 09 60 86 48 01 65 03 04 02 01 05 00 a1 |0...`.H.e.......| +00000050 1c 30 1a 06 09 2a 86 48 86 f7 0d 01 01 08 30 0d |.0...*.H......0.| +00000060 06 09 60 86 48 01 65 03 04 02 01 05 00 a2 03 02 |..`.H.e.........| +00000070 01 20 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 |. 0.1.0...U....A| +00000080 63 6d 65 20 43 6f 30 1e 17 0d 31 37 31 31 32 33 |cme Co0...171123| +00000090 31 36 31 36 31 30 5a 17 0d 31 38 31 31 32 33 31 |161610Z..1811231| +000000a0 36 31 36 31 30 5a 30 12 31 10 30 0e 06 03 55 04 |61610Z0.1.0...U.| +000000b0 0a 13 07 41 63 6d 65 20 43 6f 30 81 9f 30 0d 06 |...Acme Co0..0..| +000000c0 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 |.*.H............| +000000d0 30 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 |0.......F}...'.H| +000000e0 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a |..(!.~...]..RE.z| +000000f0 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 |6G....B[.....y.@| +00000100 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e |.Om..+.....g....| +00000110 d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 |."8.J.ts+.4.....| +00000120 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b |.t{.X.la<..A..++| +00000130 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 |$#w[.;.u]. T..c.| +00000140 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 |..$....P....C...| +00000150 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 46 30 44 |ub...R.......F0D| +00000160 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 |0...U...........| +00000170 30 13 06 03 55 1d 25 04 0c 30 0a 06 08 2b 06 01 |0...U.%..0...+..| +00000180 05 05 07 03 01 30 0c 06 03 55 1d 13 01 01 ff 04 |.....0...U......| +00000190 02 30 00 30 0f 06 03 55 1d 11 04 08 30 06 87 04 |.0.0...U....0...| +000001a0 7f 00 00 01 30 41 06 09 2a 86 48 86 f7 0d 01 01 |....0A..*.H.....| +000001b0 0a 30 34 a0 0f 30 0d 06 09 60 86 48 01 65 03 04 |.04..0...`.H.e..| +000001c0 02 01 05 00 a1 1c 30 1a 06 09 2a 86 48 86 f7 0d |......0...*.H...| +000001d0 01 01 08 30 0d 06 09 60 86 48 01 65 03 04 02 01 |...0...`.H.e....| +000001e0 05 00 a2 03 02 01 20 03 81 81 00 cd ac 4e f2 ce |...... ......N..| +000001f0 5f 8d 79 88 10 42 70 7f 7c bf 1b 5a 8a 00 ef 19 |_.y..Bp.|..Z....| +00000200 15 4b 40 15 17 71 00 6c d4 16 26 e5 49 6d 56 da |.K@..q.l..&.ImV.| +00000210 0c 1a 13 9f d8 46 95 59 3c b6 7f 87 76 5e 18 aa |.....F.Y<...v^..| +00000220 03 ea 06 75 22 dd 78 d2 a5 89 b8 c9 23 64 e1 28 |...u".x.....#d.(| +00000230 38 ce 34 6c 6e 06 7b 51 f1 a7 e6 f4 b3 7f fa b1 |8.4ln.{Q........| +00000240 3f 14 11 89 66 79 d1 8e 88 0e 0b a0 9e 30 2a c0 |?...fy.......0*.| +00000250 67 ef ca 46 02 88 e9 53 81 22 69 22 97 ad 80 93 |g..F...S."i"....| +00000260 d4 f7 dd 70 14 24 d7 70 0a 46 a1 16 03 03 00 25 |...p.$.p.F.....%| +00000270 10 00 00 21 20 2f e5 7d a3 47 cd 62 43 15 28 da |...! /.}.G.bC.(.| +00000280 ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed 90 99 |._.).0..........| +00000290 5f 58 cb 3b 74 16 03 03 00 88 0f 00 00 84 08 04 |_X.;t...........| +000002a0 00 80 86 14 3f 28 40 db 2b 02 d6 56 d3 58 d0 77 |....?(@.+..V.X.w| +000002b0 58 f8 a3 25 1f 18 d1 9c 0a d2 56 09 32 59 34 db |X..%......V.2Y4.| +000002c0 d9 2e 0a bf b4 c2 0a 86 ee 6e 29 56 53 aa 82 11 |.........n)VS...| +000002d0 96 6d 86 29 7c 85 a4 71 56 04 71 5f e6 68 3f 3f |.m.)|..qV.q_.h??| +000002e0 71 54 13 a2 22 b4 3e 38 fa c2 96 a4 c4 ab 83 c6 |qT..".>8........| +000002f0 f5 ca 7a ea 2c 8d 62 4d 76 d6 db 9c f0 0e 8c 2a |..z.,.bMv......*| +00000300 38 2f 9d 24 34 f4 33 73 54 a2 44 9a e3 4c 1f a7 |8/.$4.3sT.D..L..| +00000310 ca 49 16 e8 35 29 29 d1 48 95 0a 38 19 64 4c e7 |.I..5)).H..8.dL.| +00000320 0d a5 14 03 03 00 01 01 16 03 03 00 28 00 00 00 |............(...| +00000330 00 00 00 00 00 09 7f fa f5 c5 e5 b1 46 7e 3d e2 |............F~=.| +00000340 d4 51 a7 b8 ae 0a 56 a3 8c 45 40 97 d4 c5 81 4e |.Q....V..E@....N| +00000350 6f 12 50 b3 f6 |o.P..| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 28 0b 0d 27 bb 5f |..........(..'._| +00000010 c5 fa 62 08 8f 7a 24 65 90 bc de be 28 ae a4 e2 |..b..z$e....(...| +00000020 1f ac 18 7a 83 3e 90 bb 76 2f 73 ec 35 ca d3 e7 |...z.>..v/s.5...| +00000030 d8 25 7f |.%.| +>>> Flow 5 (client to server) +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 a7 07 a5 |................| +00000010 b5 4c 26 d0 d1 6b 52 10 8f 7c 3a 4c 31 ce 74 fa |.L&..kR..|:L1.t.| +00000020 4a c7 9b 15 03 03 00 1a 00 00 00 00 00 00 00 02 |J...............| +00000030 22 22 5a b9 ef 4f 05 9f 2e 1e 9c 11 e1 6c 0b 1e |""Z..O.......l..| +00000040 bd 10 |..| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES b/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES new file mode 100644 index 0000000000000000000000000000000000000000..6268dbcc7a4b61b758b0dcca88cfb36531e64867 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES @@ -0,0 +1,95 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 61 e9 cc eb 72 |....]...Y..a...r| +00000010 7c 11 18 0e 9d 6b 72 e9 be 84 f3 92 8d 5f e6 4c ||....kr......_.L| +00000020 ec 9e f0 00 ca 00 6f af 90 5b de 20 29 97 82 6d |......o..[. )..m| +00000030 57 ac 60 59 41 1d bb 29 b1 12 a4 ac 60 18 3b 51 |W.`YA..)....`.;Q| +00000040 af 5c e7 80 1a dc 9d 72 ed 3a 74 96 c0 09 00 00 |.\.....r.:t.....| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 02 0e 0b 00 02 0a 00 02 07 00 02 |................| +00000070 04 30 82 02 00 30 82 01 62 02 09 00 b8 bf 2d 47 |.0...0..b.....-G| +00000080 a0 d2 eb f4 30 09 06 07 2a 86 48 ce 3d 04 01 30 |....0...*.H.=..0| +00000090 45 31 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 |E1.0...U....AU1.| +000000a0 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 |0...U....Some-St| +000000b0 61 74 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e |ate1!0...U....In| +000000c0 74 65 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 |ternet Widgits P| +000000d0 74 79 20 4c 74 64 30 1e 17 0d 31 32 31 31 32 32 |ty Ltd0...121122| +000000e0 31 35 30 36 33 32 5a 17 0d 32 32 31 31 32 30 31 |150632Z..2211201| +000000f0 35 30 36 33 32 5a 30 45 31 0b 30 09 06 03 55 04 |50632Z0E1.0...U.| +00000100 06 13 02 41 55 31 13 30 11 06 03 55 04 08 13 0a |...AU1.0...U....| +00000110 53 6f 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 |Some-State1!0...| +00000120 55 04 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 |U....Internet Wi| +00000130 64 67 69 74 73 20 50 74 79 20 4c 74 64 30 81 9b |dgits Pty Ltd0..| +00000140 30 10 06 07 2a 86 48 ce 3d 02 01 06 05 2b 81 04 |0...*.H.=....+..| +00000150 00 23 03 81 86 00 04 00 c4 a1 ed be 98 f9 0b 48 |.#.............H| +00000160 73 36 7e c3 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d |s6~..V.".=S.;M!=| +00000170 cd 6b 75 e6 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 |.ku......&.....r| +00000180 32 7c b3 64 2f 1c 90 bc ea 68 23 10 7e fe e3 25 |2|.d/....h#.~..%| +00000190 c0 48 3a 69 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 |.H:i.(m.7...b...| +000001a0 9c 70 62 83 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 |.pb....d1...1...| +000001b0 68 c0 9b 23 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 |h..#.vd?.\....XX| +000001c0 b6 5f 70 dd 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 |._p............0| +000001d0 66 5b 66 9a 20 e2 27 e5 bf fe 3b 30 09 06 07 2a |f[f. .'...;0...*| +000001e0 86 48 ce 3d 04 01 03 81 8c 00 30 81 88 02 42 01 |.H.=......0...B.| +000001f0 88 a2 4f eb e2 45 c5 48 7d 1b ac f5 ed 98 9d ae |..O..E.H}.......| +00000200 47 70 c0 5e 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 |Gp.^../...M.a@..| +00000210 a2 ce ee 0b 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce |....~.~.v..;~.?.| +00000220 fa 10 e2 59 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f |...Y.G-|..N....o| +00000230 d0 02 42 01 4d fc be 67 13 9c 2d 05 0e bd 3f a3 |..B.M..g..-...?.| +00000240 8c 25 c1 33 13 83 0d 94 06 bb d4 37 7a f6 ec 7a |.%.3.......7z..z| +00000250 c9 86 2e dd d7 11 69 7f 85 7c 56 de fb 31 78 2b |......i..|V..1x+| +00000260 e4 c7 78 0d ae cb be 9e 4e 36 24 31 7b 6a 0f 39 |..x.....N6$1{j.9| +00000270 95 12 07 8f 2a 16 03 03 00 b7 0c 00 00 b3 03 00 |....*...........| +00000280 1d 20 88 7d 69 d3 1b 2d b5 dd 4e 0a f4 98 f3 8c |. .}i..-..N.....| +00000290 42 d7 ee e2 7c 28 dc f2 75 ec b0 9e ca ad cb 21 |B...|(..u......!| +000002a0 59 34 04 03 00 8b 30 81 88 02 42 01 32 2c 84 f3 |Y4....0...B.2,..| +000002b0 d8 7c 05 58 ac d0 25 46 42 11 b4 7c 0a cb ee 83 |.|.X..%FB..|....| +000002c0 7f 68 36 b6 be f8 d2 0a 8d d7 bc 8a 95 d8 2d b3 |.h6...........-.| +000002d0 fa 87 56 ae 4c 01 3f bf 29 d1 81 c1 5d e9 f0 93 |..V.L.?.)...]...| +000002e0 f6 32 91 e7 da 18 84 dd 8d a4 94 3f 81 02 42 01 |.2.........?..B.| +000002f0 70 96 e1 3c c9 aa b8 72 8d 8e 13 68 00 50 65 9c |p..<...r...h.Pe.| +00000300 cf c6 1e 5f 5a d0 80 e8 8b ff 24 df a9 55 42 d9 |..._Z.....$..UB.| +00000310 75 83 67 d7 20 69 f1 29 2d 15 f4 83 f9 ff 3d c8 |u.g. i.)-.....=.| +00000320 0e 79 a9 3e 86 38 4a c5 a2 93 f1 47 a2 43 41 a5 |.y.>.8J....G.CA.| +00000330 bb 16 03 03 00 04 0e 00 00 00 |..........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| +00000030 16 03 03 00 40 00 00 00 00 00 00 00 00 00 00 00 |....@...........| +00000040 00 00 00 00 00 84 08 13 72 05 4e a7 cb ac c1 40 |........r.N....@| +00000050 9e 31 9c a4 8f 7f f1 41 c6 63 19 39 3d d4 27 74 |.1.....A.c.9=.'t| +00000060 f9 5c 59 88 15 c3 e2 a7 6a 6f 6d fb 52 6f 94 36 |.\Y.....jom.Ro.6| +00000070 1e 8d 47 50 db |..GP.| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 40 9f 65 82 54 e1 |..........@.e.T.| +00000010 50 68 92 33 d1 f2 a1 1d 95 81 e1 df c3 b2 4c 9b |Ph.3..........L.| +00000020 f4 8d ee b2 4b 43 2f e9 e3 af 60 ae d4 4c 7a 4b |....KC/...`..LzK| +00000030 f5 03 22 f0 11 58 de 4d ac 46 5a bf 98 da 01 1d |.."..X.M.FZ.....| +00000040 fa 19 ad a6 48 66 fa c1 25 4b a0 |....Hf..%K.| +>>> Flow 5 (client to server) +00000000 17 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| +00000010 00 00 00 00 00 b3 26 24 39 5d 7c fc 25 23 ee fc |......&$9]|.%#..| +00000020 3a 6a 38 08 f5 bf 5e cc dc 34 83 1f 5e af b0 b4 |:j8...^..4..^...| +00000030 ee 34 fc f5 e1 15 03 03 00 30 00 00 00 00 00 00 |.4.......0......| +00000040 00 00 00 00 00 00 00 00 00 00 84 b2 cc 06 95 78 |...............x| +00000050 de 1d a0 cc d3 15 32 b7 89 74 8d 99 70 13 37 c3 |......2..t..p.7.| +00000060 e2 99 6e fe 8c 2d 69 77 cc 93 |..n..-iw..| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES-GCM b/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES-GCM new file mode 100644 index 0000000000000000000000000000000000000000..e235f27b75f9923f8decf11dfd3433f1f243efa7 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES-GCM @@ -0,0 +1,90 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 ac 28 cc 34 03 |....]...Y...(.4.| +00000010 c8 91 48 22 79 a2 98 74 e4 55 df 72 6b 41 cb 40 |..H"y..t.U.rkA.@| +00000020 58 ba 04 93 e7 f3 1c 8e 0a 19 d1 20 98 93 cb 7c |X.......... ...|| +00000030 a3 57 a1 c7 ca 19 13 5c e1 ac c4 44 17 30 cb a3 |.W.....\...D.0..| +00000040 b2 83 81 90 82 1d 37 c3 71 ae b8 45 c0 2b 00 00 |......7.q..E.+..| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 02 0e 0b 00 02 0a 00 02 07 00 02 |................| +00000070 04 30 82 02 00 30 82 01 62 02 09 00 b8 bf 2d 47 |.0...0..b.....-G| +00000080 a0 d2 eb f4 30 09 06 07 2a 86 48 ce 3d 04 01 30 |....0...*.H.=..0| +00000090 45 31 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 |E1.0...U....AU1.| +000000a0 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 |0...U....Some-St| +000000b0 61 74 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e |ate1!0...U....In| +000000c0 74 65 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 |ternet Widgits P| +000000d0 74 79 20 4c 74 64 30 1e 17 0d 31 32 31 31 32 32 |ty Ltd0...121122| +000000e0 31 35 30 36 33 32 5a 17 0d 32 32 31 31 32 30 31 |150632Z..2211201| +000000f0 35 30 36 33 32 5a 30 45 31 0b 30 09 06 03 55 04 |50632Z0E1.0...U.| +00000100 06 13 02 41 55 31 13 30 11 06 03 55 04 08 13 0a |...AU1.0...U....| +00000110 53 6f 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 |Some-State1!0...| +00000120 55 04 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 |U....Internet Wi| +00000130 64 67 69 74 73 20 50 74 79 20 4c 74 64 30 81 9b |dgits Pty Ltd0..| +00000140 30 10 06 07 2a 86 48 ce 3d 02 01 06 05 2b 81 04 |0...*.H.=....+..| +00000150 00 23 03 81 86 00 04 00 c4 a1 ed be 98 f9 0b 48 |.#.............H| +00000160 73 36 7e c3 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d |s6~..V.".=S.;M!=| +00000170 cd 6b 75 e6 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 |.ku......&.....r| +00000180 32 7c b3 64 2f 1c 90 bc ea 68 23 10 7e fe e3 25 |2|.d/....h#.~..%| +00000190 c0 48 3a 69 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 |.H:i.(m.7...b...| +000001a0 9c 70 62 83 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 |.pb....d1...1...| +000001b0 68 c0 9b 23 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 |h..#.vd?.\....XX| +000001c0 b6 5f 70 dd 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 |._p............0| +000001d0 66 5b 66 9a 20 e2 27 e5 bf fe 3b 30 09 06 07 2a |f[f. .'...;0...*| +000001e0 86 48 ce 3d 04 01 03 81 8c 00 30 81 88 02 42 01 |.H.=......0...B.| +000001f0 88 a2 4f eb e2 45 c5 48 7d 1b ac f5 ed 98 9d ae |..O..E.H}.......| +00000200 47 70 c0 5e 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 |Gp.^../...M.a@..| +00000210 a2 ce ee 0b 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce |....~.~.v..;~.?.| +00000220 fa 10 e2 59 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f |...Y.G-|..N....o| +00000230 d0 02 42 01 4d fc be 67 13 9c 2d 05 0e bd 3f a3 |..B.M..g..-...?.| +00000240 8c 25 c1 33 13 83 0d 94 06 bb d4 37 7a f6 ec 7a |.%.3.......7z..z| +00000250 c9 86 2e dd d7 11 69 7f 85 7c 56 de fb 31 78 2b |......i..|V..1x+| +00000260 e4 c7 78 0d ae cb be 9e 4e 36 24 31 7b 6a 0f 39 |..x.....N6$1{j.9| +00000270 95 12 07 8f 2a 16 03 03 00 b6 0c 00 00 b2 03 00 |....*...........| +00000280 1d 20 40 9c d1 ec 0a 11 08 c3 fa a0 33 80 00 62 |. @.........3..b| +00000290 5b 65 59 c6 4f 4e 32 8a 79 fc df 63 2f ee f6 59 |[eY.ON2.y..c/..Y| +000002a0 40 4a 04 03 00 8a 30 81 87 02 41 39 af 63 7a fa |@J....0...A9.cz.| +000002b0 dc e3 40 85 19 9d 1b 8f ca 55 26 e4 00 a1 f5 01 |..@......U&.....| +000002c0 73 e6 b5 6f ab bb c3 f3 b4 e0 c2 a1 33 37 ae ec |s..o........37..| +000002d0 e7 90 f6 dd b4 a4 c8 f1 3c 51 67 94 c1 ee d7 f3 |........>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| +00000030 16 03 03 00 28 00 00 00 00 00 00 00 00 50 16 81 |....(........P..| +00000040 fe 51 5b ac de d7 31 1b 9a 09 4f 1e d4 de a4 af |.Q[...1...O.....| +00000050 c9 62 5d 38 85 23 84 8c ae 4f 55 5d 0d |.b]8.#...OU].| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 28 d3 0d f6 53 0f |..........(...S.| +00000010 c8 3e f0 e6 c0 2c ed ec bc 8f cc 19 5e 33 30 69 |.>...,......^30i| +00000020 3c d9 55 8b e4 14 e2 0e 3a f9 89 39 fc a7 89 70 |<.U.....:..9...p| +00000030 58 16 44 |X.D| +>>> Flow 5 (client to server) +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 0b 26 61 |..............&a| +00000010 e6 d8 6a 6d db c6 2d 8a c3 8e f4 17 1a f7 8e f3 |..jm..-.........| +00000020 ce 04 ce 15 03 03 00 1a 00 00 00 00 00 00 00 02 |................| +00000030 fa f7 0a 81 bb 8d 83 f3 82 05 ee 26 69 22 90 b2 |...........&i"..| +00000040 bb b1 |..| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES128-SHA256 b/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES128-SHA256 new file mode 100644 index 0000000000000000000000000000000000000000..f81845ab3d91d6161f7b3b6bc4d7bc0ac8cdacf5 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES128-SHA256 @@ -0,0 +1,99 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 be 62 2f ca 91 |....]...Y...b/..| +00000010 8b 79 1d ce e3 3f 2e 37 bc 74 da c8 7d de a5 85 |.y...?.7.t..}...| +00000020 58 c8 04 55 4e c6 51 f2 18 60 33 20 2f 33 8b c1 |X..UN.Q..`3 /3..| +00000030 b6 be 54 3e 3f 78 12 1b d9 d0 db 71 fa 0c ee f9 |..T>?x.....q....| +00000040 60 fb 49 08 a1 83 a4 f6 22 e8 dc 2c c0 23 00 00 |`.I....."..,.#..| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 02 0e 0b 00 02 0a 00 02 07 00 02 |................| +00000070 04 30 82 02 00 30 82 01 62 02 09 00 b8 bf 2d 47 |.0...0..b.....-G| +00000080 a0 d2 eb f4 30 09 06 07 2a 86 48 ce 3d 04 01 30 |....0...*.H.=..0| +00000090 45 31 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 |E1.0...U....AU1.| +000000a0 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 |0...U....Some-St| +000000b0 61 74 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e |ate1!0...U....In| +000000c0 74 65 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 |ternet Widgits P| +000000d0 74 79 20 4c 74 64 30 1e 17 0d 31 32 31 31 32 32 |ty Ltd0...121122| +000000e0 31 35 30 36 33 32 5a 17 0d 32 32 31 31 32 30 31 |150632Z..2211201| +000000f0 35 30 36 33 32 5a 30 45 31 0b 30 09 06 03 55 04 |50632Z0E1.0...U.| +00000100 06 13 02 41 55 31 13 30 11 06 03 55 04 08 13 0a |...AU1.0...U....| +00000110 53 6f 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 |Some-State1!0...| +00000120 55 04 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 |U....Internet Wi| +00000130 64 67 69 74 73 20 50 74 79 20 4c 74 64 30 81 9b |dgits Pty Ltd0..| +00000140 30 10 06 07 2a 86 48 ce 3d 02 01 06 05 2b 81 04 |0...*.H.=....+..| +00000150 00 23 03 81 86 00 04 00 c4 a1 ed be 98 f9 0b 48 |.#.............H| +00000160 73 36 7e c3 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d |s6~..V.".=S.;M!=| +00000170 cd 6b 75 e6 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 |.ku......&.....r| +00000180 32 7c b3 64 2f 1c 90 bc ea 68 23 10 7e fe e3 25 |2|.d/....h#.~..%| +00000190 c0 48 3a 69 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 |.H:i.(m.7...b...| +000001a0 9c 70 62 83 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 |.pb....d1...1...| +000001b0 68 c0 9b 23 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 |h..#.vd?.\....XX| +000001c0 b6 5f 70 dd 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 |._p............0| +000001d0 66 5b 66 9a 20 e2 27 e5 bf fe 3b 30 09 06 07 2a |f[f. .'...;0...*| +000001e0 86 48 ce 3d 04 01 03 81 8c 00 30 81 88 02 42 01 |.H.=......0...B.| +000001f0 88 a2 4f eb e2 45 c5 48 7d 1b ac f5 ed 98 9d ae |..O..E.H}.......| +00000200 47 70 c0 5e 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 |Gp.^../...M.a@..| +00000210 a2 ce ee 0b 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce |....~.~.v..;~.?.| +00000220 fa 10 e2 59 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f |...Y.G-|..N....o| +00000230 d0 02 42 01 4d fc be 67 13 9c 2d 05 0e bd 3f a3 |..B.M..g..-...?.| +00000240 8c 25 c1 33 13 83 0d 94 06 bb d4 37 7a f6 ec 7a |.%.3.......7z..z| +00000250 c9 86 2e dd d7 11 69 7f 85 7c 56 de fb 31 78 2b |......i..|V..1x+| +00000260 e4 c7 78 0d ae cb be 9e 4e 36 24 31 7b 6a 0f 39 |..x.....N6$1{j.9| +00000270 95 12 07 8f 2a 16 03 03 00 b6 0c 00 00 b2 03 00 |....*...........| +00000280 1d 20 72 d6 7b c0 ab ad 36 11 45 d6 b8 4a ea be |. r.{...6.E..J..| +00000290 bd ad 7a f6 29 f8 9d 0e ac d8 fc 67 f7 9c d7 63 |..z.)......g...c| +000002a0 32 22 04 03 00 8a 30 81 87 02 42 01 09 a3 3e 2b |2"....0...B...>+| +000002b0 e8 b6 0b c9 76 80 60 6f 9a c5 4c 6e 7c d8 53 00 |....v.`o..Ln|.S.| +000002c0 56 c7 f9 37 36 32 2d dc 82 d8 0c 67 7a 96 5c 34 |V..762-....gz.\4| +000002d0 db 10 71 4e f4 29 e0 20 84 01 09 9a dc 74 76 39 |..qN.). .....tv9| +000002e0 63 e3 b2 c5 b4 7b cc 20 92 77 f1 3b a0 02 41 5d |c....{. .w.;..A]| +000002f0 36 ae 86 8c 27 7f 9e 0d 17 8e 16 48 20 2a 43 ac |6...'......H *C.| +00000300 d4 ce c6 9b 6a 95 47 5a 47 5c 13 b6 eb db 0b a6 |....j.GZG\......| +00000310 fa 23 fe 0c 76 e0 a9 b2 97 76 02 ff 68 3d 68 c5 |.#..v....v..h=h.| +00000320 17 08 54 25 1a 22 c0 a3 06 bd a3 f6 7c 68 07 9e |..T%."......|h..| +00000330 16 03 03 00 04 0e 00 00 00 |.........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| +00000030 16 03 03 00 50 00 00 00 00 00 00 00 00 00 00 00 |....P...........| +00000040 00 00 00 00 00 27 1a a1 cf 9d f5 8f 91 e4 7f dc |.....'..........| +00000050 2f 81 3f 1e 3a c3 40 21 c2 6d dd dd 8f f6 9c 4b |/.?.:.@!.m.....K| +00000060 0b da 8d 10 f6 83 da 35 bb b9 a4 bf 2f 29 27 a5 |.......5..../)'.| +00000070 12 52 6a 74 6e 15 8d 82 cf 86 df f0 52 26 32 ca |.Rjtn.......R&2.| +00000080 02 91 8c 03 f7 |.....| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 50 1f 1c 35 9b 6c |..........P..5.l| +00000010 a8 9f 58 0d bf 0f db b5 91 c6 74 de b1 b7 68 b6 |..X.......t...h.| +00000020 05 0d 39 68 87 7d b3 b0 8b 86 15 67 ba 7e 54 0c |..9h.}.....g.~T.| +00000030 0d 4f 6e f3 ad d8 27 e8 1d fa 43 31 be 30 67 d2 |.On...'...C1.0g.| +00000040 bc 0a 30 37 78 3e 30 62 bf 81 2e 53 da b3 88 73 |..07x>0b...S...s| +00000050 17 42 79 ee ef 0e d3 3c 87 c8 85 |.By....<...| +>>> Flow 5 (client to server) +00000000 17 03 03 00 40 00 00 00 00 00 00 00 00 00 00 00 |....@...........| +00000010 00 00 00 00 00 2c 39 43 06 0a c3 81 10 24 e8 bb |.....,9C.....$..| +00000020 de b8 74 00 a9 a3 ab 9a 2a a7 8a 0e 62 b8 2a 23 |..t.....*...b.*#| +00000030 10 46 1b 76 dc a7 81 2d 37 2e e8 5f b5 75 5e 65 |.F.v...-7.._.u^e| +00000040 73 11 ef 71 16 15 03 03 00 40 00 00 00 00 00 00 |s..q.....@......| +00000050 00 00 00 00 00 00 00 00 00 00 a5 24 00 67 c6 ae |...........$.g..| +00000060 7f 05 91 ab 17 c9 ea eb 5a f8 8f 07 f3 e5 9b 9c |........Z.......| +00000070 20 41 63 21 69 3e f1 bb 66 7e 0b 3d c0 0a 14 b1 | Ac!i>..f~.=....| +00000080 a3 de 2e d9 10 23 37 84 4d 88 |.....#7.M.| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES256-GCM-SHA384 b/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES256-GCM-SHA384 new file mode 100644 index 0000000000000000000000000000000000000000..bf3f0192605d4a58f27aa430c95dba8e89ebde3a --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES256-GCM-SHA384 @@ -0,0 +1,90 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 45 43 2c 7b 07 |....]...Y..EC,{.| +00000010 6e 76 10 6b f3 9c 7c 2e b8 c9 6b 8d a0 b6 7b be |nv.k..|...k...{.| +00000020 79 7a 52 ab 8d f8 c6 cb 00 f6 48 20 a3 a7 3c ca |yzR.......H ..<.| +00000030 d7 57 be c7 6e 45 d6 75 c1 70 e0 86 1e 58 14 a3 |.W..nE.u.p...X..| +00000040 b4 7d 78 2c ca 82 2f 38 b8 96 ef c4 c0 2c 00 00 |.}x,../8.....,..| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 02 0e 0b 00 02 0a 00 02 07 00 02 |................| +00000070 04 30 82 02 00 30 82 01 62 02 09 00 b8 bf 2d 47 |.0...0..b.....-G| +00000080 a0 d2 eb f4 30 09 06 07 2a 86 48 ce 3d 04 01 30 |....0...*.H.=..0| +00000090 45 31 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 |E1.0...U....AU1.| +000000a0 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 |0...U....Some-St| +000000b0 61 74 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e |ate1!0...U....In| +000000c0 74 65 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 |ternet Widgits P| +000000d0 74 79 20 4c 74 64 30 1e 17 0d 31 32 31 31 32 32 |ty Ltd0...121122| +000000e0 31 35 30 36 33 32 5a 17 0d 32 32 31 31 32 30 31 |150632Z..2211201| +000000f0 35 30 36 33 32 5a 30 45 31 0b 30 09 06 03 55 04 |50632Z0E1.0...U.| +00000100 06 13 02 41 55 31 13 30 11 06 03 55 04 08 13 0a |...AU1.0...U....| +00000110 53 6f 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 |Some-State1!0...| +00000120 55 04 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 |U....Internet Wi| +00000130 64 67 69 74 73 20 50 74 79 20 4c 74 64 30 81 9b |dgits Pty Ltd0..| +00000140 30 10 06 07 2a 86 48 ce 3d 02 01 06 05 2b 81 04 |0...*.H.=....+..| +00000150 00 23 03 81 86 00 04 00 c4 a1 ed be 98 f9 0b 48 |.#.............H| +00000160 73 36 7e c3 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d |s6~..V.".=S.;M!=| +00000170 cd 6b 75 e6 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 |.ku......&.....r| +00000180 32 7c b3 64 2f 1c 90 bc ea 68 23 10 7e fe e3 25 |2|.d/....h#.~..%| +00000190 c0 48 3a 69 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 |.H:i.(m.7...b...| +000001a0 9c 70 62 83 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 |.pb....d1...1...| +000001b0 68 c0 9b 23 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 |h..#.vd?.\....XX| +000001c0 b6 5f 70 dd 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 |._p............0| +000001d0 66 5b 66 9a 20 e2 27 e5 bf fe 3b 30 09 06 07 2a |f[f. .'...;0...*| +000001e0 86 48 ce 3d 04 01 03 81 8c 00 30 81 88 02 42 01 |.H.=......0...B.| +000001f0 88 a2 4f eb e2 45 c5 48 7d 1b ac f5 ed 98 9d ae |..O..E.H}.......| +00000200 47 70 c0 5e 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 |Gp.^../...M.a@..| +00000210 a2 ce ee 0b 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce |....~.~.v..;~.?.| +00000220 fa 10 e2 59 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f |...Y.G-|..N....o| +00000230 d0 02 42 01 4d fc be 67 13 9c 2d 05 0e bd 3f a3 |..B.M..g..-...?.| +00000240 8c 25 c1 33 13 83 0d 94 06 bb d4 37 7a f6 ec 7a |.%.3.......7z..z| +00000250 c9 86 2e dd d7 11 69 7f 85 7c 56 de fb 31 78 2b |......i..|V..1x+| +00000260 e4 c7 78 0d ae cb be 9e 4e 36 24 31 7b 6a 0f 39 |..x.....N6$1{j.9| +00000270 95 12 07 8f 2a 16 03 03 00 b5 0c 00 00 b1 03 00 |....*...........| +00000280 1d 20 2c 21 c0 1d 0f 62 0d 25 60 02 a2 5f 10 5b |. ,!...b.%`.._.[| +00000290 68 fb b8 74 a5 2f 33 d6 1e 3f 05 43 19 6d 1c 74 |h..t./3..?.C.m.t| +000002a0 ce 5b 04 03 00 89 30 81 86 02 41 4c 6b 04 c2 3f |.[....0...ALk..?| +000002b0 98 87 0d 54 5a d5 1f 4c 77 1b b6 e5 f8 1f 35 29 |...TZ..Lw.....5)| +000002c0 e9 72 13 34 ba f8 f9 b3 0f 49 ed b5 69 bd 03 3e |.r.4.....I..i..>| +000002d0 10 7d a5 0f 7a aa a6 c5 e0 48 24 2a 61 85 17 5d |.}..z....H$*a..]| +000002e0 ac 93 35 47 41 60 f6 3b d6 41 32 20 02 41 02 4b |..5GA`.;.A2 .A.K| +000002f0 b7 28 37 9d 5d f3 fe 87 7b 13 9a 71 b0 59 7b f0 |.(7.]...{..q.Y{.| +00000300 50 e2 87 aa 9a ef 0e e8 47 bd 85 60 d5 41 32 00 |P.......G..`.A2.| +00000310 aa 26 e4 f3 c9 4c 9d df 6c dc 6a de 2b fc 76 b2 |.&...L..l.j.+.v.| +00000320 99 28 41 1c d3 04 a2 e0 71 92 41 97 0a b3 4b 16 |.(A.....q.A...K.| +00000330 03 03 00 04 0e 00 00 00 |........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| +00000030 16 03 03 00 28 00 00 00 00 00 00 00 00 5a b1 f1 |....(........Z..| +00000040 5a c2 32 50 dd 2b 6c 8a 0b de b7 04 cd 69 de 3a |Z.2P.+l......i.:| +00000050 45 3c 72 94 80 e2 f6 6c 66 98 c3 2d 4d |E>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 28 be d2 0b b0 a2 |..........(.....| +00000010 ac 18 1e dc 59 4f b4 85 be 3a 81 bd 73 51 47 35 |....YO...:..sQG5| +00000020 b3 2b b2 84 45 3a 08 11 a3 40 13 0e 5d ef 4b 26 |.+..E:...@..].K&| +00000030 9d e6 83 |...| +>>> Flow 5 (client to server) +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 0f 8d 3a |...............:| +00000010 5b dd b2 49 18 84 73 e7 a5 c0 46 c0 ad fa cc 44 |[..I..s...F....D| +00000020 60 0d 8c 15 03 03 00 1a 00 00 00 00 00 00 00 02 |`...............| +00000030 f6 4c c6 95 ff e5 01 3a 3b a9 46 23 f3 bc 24 29 |.L.....:;.F#..$)| +00000040 6d 52 |mR| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-CHACHA20-POLY1305 b/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-CHACHA20-POLY1305 new file mode 100644 index 0000000000000000000000000000000000000000..db53e96a01e48fc40eea5313dbaca739e5f79e90 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-CHACHA20-POLY1305 @@ -0,0 +1,86 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 ee 01 00 00 ea 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 08 cc a9 |................| +00000050 13 03 13 01 13 02 01 00 00 99 00 0b 00 02 01 00 |................| +00000060 ff 01 00 01 00 00 17 00 00 00 12 00 00 00 05 00 |................| +00000070 05 01 00 00 00 00 00 0a 00 0a 00 08 00 1d 00 17 |................| +00000080 00 18 00 19 00 0d 00 16 00 14 08 04 04 03 08 07 |................| +00000090 08 05 08 06 04 01 05 01 06 01 05 03 06 03 00 32 |...............2| +000000a0 00 1a 00 18 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000b0 05 01 06 01 05 03 06 03 02 01 02 03 00 2b 00 09 |.............+..| +000000c0 08 03 04 03 03 03 02 03 01 00 33 00 26 00 24 00 |..........3.&.$.| +000000d0 1d 00 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f |.. /.}.G.bC.(.._| +000000e0 bb 29 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 |.).0.........._X| +000000f0 cb 3b 74 |.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 74 9e c0 76 74 |....]...Y..t..vt| +00000010 c1 54 da a1 cf ad 75 4c fe 91 3b e2 06 e9 fb 1a |.T....uL..;.....| +00000020 9c 69 ee bf 30 1f 5c 0c 92 ca 58 20 a9 bb 64 3d |.i..0.\...X ..d=| +00000030 1e 8a 19 db 31 25 15 f2 65 5a 78 ad 7e d2 98 90 |....1%..eZx.~...| +00000040 8a 8b 0f 0e 77 53 db a2 93 b4 76 6d cc a9 00 00 |....wS....vm....| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 02 0e 0b 00 02 0a 00 02 07 00 02 |................| +00000070 04 30 82 02 00 30 82 01 62 02 09 00 b8 bf 2d 47 |.0...0..b.....-G| +00000080 a0 d2 eb f4 30 09 06 07 2a 86 48 ce 3d 04 01 30 |....0...*.H.=..0| +00000090 45 31 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 |E1.0...U....AU1.| +000000a0 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 |0...U....Some-St| +000000b0 61 74 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e |ate1!0...U....In| +000000c0 74 65 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 |ternet Widgits P| +000000d0 74 79 20 4c 74 64 30 1e 17 0d 31 32 31 31 32 32 |ty Ltd0...121122| +000000e0 31 35 30 36 33 32 5a 17 0d 32 32 31 31 32 30 31 |150632Z..2211201| +000000f0 35 30 36 33 32 5a 30 45 31 0b 30 09 06 03 55 04 |50632Z0E1.0...U.| +00000100 06 13 02 41 55 31 13 30 11 06 03 55 04 08 13 0a |...AU1.0...U....| +00000110 53 6f 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 |Some-State1!0...| +00000120 55 04 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 |U....Internet Wi| +00000130 64 67 69 74 73 20 50 74 79 20 4c 74 64 30 81 9b |dgits Pty Ltd0..| +00000140 30 10 06 07 2a 86 48 ce 3d 02 01 06 05 2b 81 04 |0...*.H.=....+..| +00000150 00 23 03 81 86 00 04 00 c4 a1 ed be 98 f9 0b 48 |.#.............H| +00000160 73 36 7e c3 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d |s6~..V.".=S.;M!=| +00000170 cd 6b 75 e6 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 |.ku......&.....r| +00000180 32 7c b3 64 2f 1c 90 bc ea 68 23 10 7e fe e3 25 |2|.d/....h#.~..%| +00000190 c0 48 3a 69 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 |.H:i.(m.7...b...| +000001a0 9c 70 62 83 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 |.pb....d1...1...| +000001b0 68 c0 9b 23 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 |h..#.vd?.\....XX| +000001c0 b6 5f 70 dd 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 |._p............0| +000001d0 66 5b 66 9a 20 e2 27 e5 bf fe 3b 30 09 06 07 2a |f[f. .'...;0...*| +000001e0 86 48 ce 3d 04 01 03 81 8c 00 30 81 88 02 42 01 |.H.=......0...B.| +000001f0 88 a2 4f eb e2 45 c5 48 7d 1b ac f5 ed 98 9d ae |..O..E.H}.......| +00000200 47 70 c0 5e 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 |Gp.^../...M.a@..| +00000210 a2 ce ee 0b 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce |....~.~.v..;~.?.| +00000220 fa 10 e2 59 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f |...Y.G-|..N....o| +00000230 d0 02 42 01 4d fc be 67 13 9c 2d 05 0e bd 3f a3 |..B.M..g..-...?.| +00000240 8c 25 c1 33 13 83 0d 94 06 bb d4 37 7a f6 ec 7a |.%.3.......7z..z| +00000250 c9 86 2e dd d7 11 69 7f 85 7c 56 de fb 31 78 2b |......i..|V..1x+| +00000260 e4 c7 78 0d ae cb be 9e 4e 36 24 31 7b 6a 0f 39 |..x.....N6$1{j.9| +00000270 95 12 07 8f 2a 16 03 03 00 b6 0c 00 00 b2 03 00 |....*...........| +00000280 1d 20 6b 7f 5e 5e cd 37 8e 2a cf 07 bf 99 89 93 |. k.^^.7.*......| +00000290 05 be e6 3c 1d a8 67 07 b4 0d 28 22 be 3f 57 88 |...<..g...(".?W.| +000002a0 e4 41 04 03 00 8a 30 81 87 02 42 00 ce 0f 5f f7 |.A....0...B..._.| +000002b0 52 8c 44 e3 58 4c ed 4a 4f bf 2d 14 77 0f 3c a7 |R.D.XL.JO.-.w.<.| +000002c0 8a 7b fc 2d 0f 94 6e 51 01 51 e0 8c 58 b0 72 e4 |.{.-..nQ.Q..X.r.| +000002d0 57 cd ab ad fd a9 8c c2 e7 92 f3 0e e0 a0 22 64 |W............."d| +000002e0 a0 36 f9 e1 a3 f5 19 c8 8a b8 25 f6 0b 02 41 5d |.6........%...A]| +000002f0 d3 7c a0 42 5b f9 5d b8 f9 c2 a3 d4 8f 0e 4c c7 |.|.B[.].......L.| +00000300 d4 61 11 73 f0 35 7e b1 73 29 0f 97 52 75 8a 1f |.a.s.5~.s)..Ru..| +00000310 00 e9 6e 59 25 bb ca 72 bd 1e 4f 34 fc 55 ef 66 |..nY%..r..O4.U.f| +00000320 33 3d 5f fc e2 8d ac 09 7f 20 85 ca b3 a4 b3 ca |3=_...... ......| +00000330 16 03 03 00 04 0e 00 00 00 |.........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| +00000030 16 03 03 00 20 1a fc 19 6c ef eb a5 d1 28 d9 aa |.... ...l....(..| +00000040 56 3f b7 12 a0 18 eb 76 16 be 6d 1e d9 3b 6f 14 |V?.....v..m..;o.| +00000050 51 68 9c 63 b3 |Qh.c.| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 20 38 c9 5f c3 6f |.......... 8._.o| +00000010 1b 84 54 77 40 98 70 cb f1 d1 5f 9e 11 16 24 c6 |..Tw@.p..._...$.| +00000020 c4 7e f0 44 32 2c ce 29 dd 8e 20 |.~.D2,.).. | +>>> Flow 5 (client to server) +00000000 17 03 03 00 16 86 12 a2 e2 ae df 03 ed e4 a4 74 |...............t| +00000010 d0 8b 8c 17 92 20 4d bd c2 29 ac 15 03 03 00 12 |..... M..)......| +00000020 e1 66 4e 21 16 24 34 9f 0f 95 63 80 d6 22 52 c4 |.fN!.$4...c.."R.| +00000030 67 ac |g.| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-RSA-AES b/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-RSA-AES new file mode 100644 index 0000000000000000000000000000000000000000..70b43803f15ce575e008897d568b4353bfac99bc --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-RSA-AES @@ -0,0 +1,99 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 c7 61 5d 9b a7 |....]...Y...a]..| +00000010 9f 27 4f de 56 2b 83 b8 dc 21 7d 27 e5 23 c0 b4 |.'O.V+...!}'.#..| +00000020 a7 b1 61 3c 7c b7 af 1a b0 c6 ed 20 82 8c 08 27 |..a<|...... ...'| +00000030 79 99 c6 a7 dd 7e 33 bb 6c d0 4b 4a 02 e7 2e 87 |y....~3.l.KJ....| +00000040 69 24 05 ac 32 6f 40 4f dc 2e 11 3f c0 13 00 00 |i$..2o@O...?....| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 02 59 0b 00 02 55 00 02 52 00 02 |......Y...U..R..| +00000070 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 |O0..K0..........| +00000080 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 |....?.[..0...*.H| +00000090 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 |........0.1.0...| +000000a0 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 |U....Go1.0...U..| +000000b0 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 |..Go Root0...160| +000000c0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| +000000d0 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 |01000000Z0.1.0..| +000000e0 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 |.U....Go1.0...U.| +000000f0 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |...Go0..0...*.H.| +00000100 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +00000110 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab |...F}...'.H..(!.| +00000120 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d |~...]..RE.z6G...| +00000130 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd |.B[.....y.@.Om..| +00000140 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a |+.....g....."8.J| +00000150 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 |.ts+.4......t{.X| +00000160 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c |.la<..A..++$#w[.| +00000170 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 |;.u]. T..c...$..| +00000180 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 |..P....C...ub...| +00000190 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 |R.........0..0..| +000001a0 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 |.U...........0..| +000001b0 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 |.U.%..0...+.....| +000001c0 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 |....+.......0...| +000001d0 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d |U.......0.0...U.| +000001e0 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d |.........CC>I..m| +000001f0 b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 |....`0...U.#..0.| +00000200 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab |..H.IM.~.1......| +00000210 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |n{0...U....0...e| +00000220 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| +00000230 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| +00000240 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed |.0.@+[P.a...SX..| +00000250 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 |.(.X..8....1Z..f| +00000260 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a |=C.-...... d8.$:| +00000270 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 |....}.@ ._...a..| +00000280 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed |v......\.....l..| +00000290 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 |s..Cw.......@.a.| +000002a0 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 |Lr+...F..M...>..| +000002b0 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 |.B...=.`.\!.;...| +000002c0 16 03 03 00 ac 0c 00 00 a8 03 00 1d 20 5c ce 07 |............ \..| +000002d0 a8 0b 8f ff 08 19 e7 d7 38 62 98 bf c1 f7 92 27 |........8b.....'| +000002e0 cb 7b 5e 50 36 51 83 61 8d b4 d6 29 1c 08 04 00 |.{^P6Q.a...)....| +000002f0 80 98 88 66 48 81 8b 9d 9b e0 6e 6e c4 c4 99 fb |...fH.....nn....| +00000300 63 46 fd 8c 7e e1 d0 dd 01 e6 bb 23 97 b8 21 2e |cF..~......#..!.| +00000310 53 06 e0 5d 58 c8 79 c3 01 a5 01 e2 81 7b c7 a9 |S..]X.y......{..| +00000320 04 15 98 9b 53 98 42 0b 3d 4e 97 93 b9 88 80 2c |....S.B.=N.....,| +00000330 78 fd 9b 99 12 7f a8 de a0 c0 c4 1d 15 59 d4 d8 |x............Y..| +00000340 ef 0d bd 0b 46 c3 6e e6 4b 04 69 91 c0 db 74 ca |....F.n.K.i...t.| +00000350 99 2e 6f 47 8b 9b 22 3f b3 4a e3 10 47 2d dd 47 |..oG.."?.J..G-.G| +00000360 d5 e1 9b 66 8f d9 b2 fb b7 52 ae 6a 14 74 32 2d |...f.....R.j.t2-| +00000370 6e 16 03 03 00 04 0e 00 00 00 |n.........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| +00000030 16 03 03 00 40 00 00 00 00 00 00 00 00 00 00 00 |....@...........| +00000040 00 00 00 00 00 99 c9 2d 35 8b 96 18 36 f4 db a4 |.......-5...6...| +00000050 9a 56 67 6a 6b 9d ee b1 cb 95 54 43 93 7c 0e ff |.Vgjk.....TC.|..| +00000060 c0 54 84 83 14 bf d5 95 85 a1 b5 c5 2c fe c3 29 |.T..........,..)| +00000070 81 7b 1e 16 2e |.{...| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 40 8b 6e b0 cb bf |..........@.n...| +00000010 35 8d c3 7e 48 27 92 77 20 8a 38 c6 81 94 17 d4 |5..~H'.w .8.....| +00000020 b8 18 4e 23 e7 8b 0a 89 7b d1 72 58 aa b9 9b bb |..N#....{.rX....| +00000030 c9 40 c7 c4 8e 74 77 f3 3e 90 9c b0 19 04 6c ea |.@...tw.>.....l.| +00000040 87 85 f1 fd d9 fd 2d 57 57 f1 c9 |......-WW..| +>>> Flow 5 (client to server) +00000000 17 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| +00000010 00 00 00 00 00 b9 8c 86 6d 84 db d0 60 f7 11 22 |........m...`.."| +00000020 97 52 b3 fe bb 1c 0c bd 26 9c a1 84 51 3d a2 2b |.R......&...Q=.+| +00000030 c0 79 e5 a5 96 15 03 03 00 30 00 00 00 00 00 00 |.y.......0......| +00000040 00 00 00 00 00 00 00 00 00 00 7a 42 27 d5 ae 30 |..........zB'..0| +00000050 81 b5 94 05 55 c9 93 e0 11 98 6d f8 aa 18 92 f4 |....U.....m.....| +00000060 32 8f d1 aa a6 86 cd df 11 c2 |2.........| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-RSA-AES128-SHA256 b/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-RSA-AES128-SHA256 new file mode 100644 index 0000000000000000000000000000000000000000..9081031e737b029662a78cfbefba2e6d3c24bf78 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-RSA-AES128-SHA256 @@ -0,0 +1,103 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 7b 18 cc 97 f2 |....]...Y..{....| +00000010 59 62 62 18 bc ee e1 09 0c 7b 8c 3e f0 36 3d 8b |Ybb......{.>.6=.| +00000020 96 54 26 93 c8 ac bb 7c 19 63 6a 20 96 8e 51 d2 |.T&....|.cj ..Q.| +00000030 18 6d 8a 72 6b 5d d2 5e 2b 53 4e a5 43 cf 75 4f |.m.rk].^+SN.C.uO| +00000040 e6 9c 3a 30 f5 23 3f bf 66 bc fe a2 c0 27 00 00 |..:0.#?.f....'..| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 02 59 0b 00 02 55 00 02 52 00 02 |......Y...U..R..| +00000070 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 |O0..K0..........| +00000080 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 |....?.[..0...*.H| +00000090 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 |........0.1.0...| +000000a0 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 |U....Go1.0...U..| +000000b0 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 |..Go Root0...160| +000000c0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| +000000d0 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 |01000000Z0.1.0..| +000000e0 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 |.U....Go1.0...U.| +000000f0 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |...Go0..0...*.H.| +00000100 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +00000110 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab |...F}...'.H..(!.| +00000120 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d |~...]..RE.z6G...| +00000130 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd |.B[.....y.@.Om..| +00000140 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a |+.....g....."8.J| +00000150 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 |.ts+.4......t{.X| +00000160 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c |.la<..A..++$#w[.| +00000170 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 |;.u]. T..c...$..| +00000180 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 |..P....C...ub...| +00000190 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 |R.........0..0..| +000001a0 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 |.U...........0..| +000001b0 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 |.U.%..0...+.....| +000001c0 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 |....+.......0...| +000001d0 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d |U.......0.0...U.| +000001e0 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d |.........CC>I..m| +000001f0 b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 |....`0...U.#..0.| +00000200 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab |..H.IM.~.1......| +00000210 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |n{0...U....0...e| +00000220 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| +00000230 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| +00000240 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed |.0.@+[P.a...SX..| +00000250 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 |.(.X..8....1Z..f| +00000260 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a |=C.-...... d8.$:| +00000270 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 |....}.@ ._...a..| +00000280 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed |v......\.....l..| +00000290 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 |s..Cw.......@.a.| +000002a0 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 |Lr+...F..M...>..| +000002b0 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 |.B...=.`.\!.;...| +000002c0 16 03 03 00 ac 0c 00 00 a8 03 00 1d 20 e4 05 36 |............ ..6| +000002d0 05 47 cf b0 62 f8 f6 d6 e0 ce a5 f9 45 f6 28 f9 |.G..b.......E.(.| +000002e0 d2 58 47 6c 0a 58 9d 85 74 52 d3 0d 17 08 04 00 |.XGl.X..tR......| +000002f0 80 d0 8b 12 95 dd 2a 7f b2 55 33 e0 13 28 41 47 |......*..U3..(AG| +00000300 06 38 fe fb 11 b3 3f 66 c4 62 db 1c f9 29 9e ea |.8....?f.b...)..| +00000310 2f e4 62 22 4f 99 36 05 fb 89 8f d5 29 bf a6 e0 |/.b"O.6.....)...| +00000320 fc 12 88 d8 60 9a 4d 82 eb 64 ba 99 1c 1c 82 ff |....`.M..d......| +00000330 df 57 a9 b9 14 d5 a7 ad 57 45 1d e0 91 db 61 90 |.W......WE....a.| +00000340 ca 15 9b 0c 49 f8 a9 40 5f 34 6b d2 fe 00 48 e5 |....I..@_4k...H.| +00000350 ea 1e 3b ae 1f 81 a9 d7 91 ff 46 e9 af 48 04 b3 |..;.......F..H..| +00000360 83 0c 95 91 ea 5f 1f 5b 48 98 2a 9c f6 80 2a db |....._.[H.*...*.| +00000370 d2 16 03 03 00 04 0e 00 00 00 |..........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| +00000030 16 03 03 00 50 00 00 00 00 00 00 00 00 00 00 00 |....P...........| +00000040 00 00 00 00 00 c0 4e 63 30 1d 23 c8 dc ef 03 e9 |......Nc0.#.....| +00000050 29 7c 61 b8 7a a4 52 c3 09 f4 aa 97 30 3c 5a 7c |)|a.z.R.....0>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 50 bd 21 3f c1 94 |..........P.!?..| +00000010 2f 3e 00 3c 43 00 17 39 90 74 b2 4f 40 5d 0c 2b |/>.>> Flow 5 (client to server) +00000000 17 03 03 00 40 00 00 00 00 00 00 00 00 00 00 00 |....@...........| +00000010 00 00 00 00 00 ad 41 d8 27 7d f4 06 b7 6c 89 f4 |......A.'}...l..| +00000020 e3 c5 de 6d 06 80 0c 2e f8 42 5a 2c da f1 e2 b6 |...m.....BZ,....| +00000030 e6 e8 6f 5c ee e0 aa 4b d6 8a 7a 04 6a 5e 8c 99 |..o\...K..z.j^..| +00000040 1b 36 be f9 d0 15 03 03 00 40 00 00 00 00 00 00 |.6.......@......| +00000050 00 00 00 00 00 00 00 00 00 00 f1 cf 76 91 15 bd |............v...| +00000060 33 f3 96 25 c7 d9 77 30 a6 84 1a 06 c1 96 96 27 |3..%..w0.......'| +00000070 70 ff d2 ce 82 1e 39 8f 19 75 c7 f2 0f cb de bc |p.....9..u......| +00000080 9a ef 4c 93 e3 3c 0c 2f 97 ad |..L..<./..| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-RSA-CHACHA20-POLY1305 b/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-RSA-CHACHA20-POLY1305 new file mode 100644 index 0000000000000000000000000000000000000000..30ea8ec568a905251fa7e234e63faf22303fd7aa --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-ECDHE-RSA-CHACHA20-POLY1305 @@ -0,0 +1,90 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 ee 01 00 00 ea 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 08 cc a8 |................| +00000050 13 03 13 01 13 02 01 00 00 99 00 0b 00 02 01 00 |................| +00000060 ff 01 00 01 00 00 17 00 00 00 12 00 00 00 05 00 |................| +00000070 05 01 00 00 00 00 00 0a 00 0a 00 08 00 1d 00 17 |................| +00000080 00 18 00 19 00 0d 00 16 00 14 08 04 04 03 08 07 |................| +00000090 08 05 08 06 04 01 05 01 06 01 05 03 06 03 00 32 |...............2| +000000a0 00 1a 00 18 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000b0 05 01 06 01 05 03 06 03 02 01 02 03 00 2b 00 09 |.............+..| +000000c0 08 03 04 03 03 03 02 03 01 00 33 00 26 00 24 00 |..........3.&.$.| +000000d0 1d 00 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f |.. /.}.G.bC.(.._| +000000e0 bb 29 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 |.).0.........._X| +000000f0 cb 3b 74 |.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 1b 61 37 54 ad |....]...Y...a7T.| +00000010 7e 92 6a 93 df 5e f8 16 be e7 06 12 3f e7 23 84 |~.j..^......?.#.| +00000020 be 2a 30 78 98 cf 60 8a 8a 2d 26 20 44 fb 40 31 |.*0x..`..-& D.@1| +00000030 88 38 6e fc ce 1d af 07 e3 c0 49 05 ff bc 92 ae |.8n.......I.....| +00000040 58 79 51 ec a7 24 82 75 9a 16 45 fa cc a8 00 00 |XyQ..$.u..E.....| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 02 59 0b 00 02 55 00 02 52 00 02 |......Y...U..R..| +00000070 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 |O0..K0..........| +00000080 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 |....?.[..0...*.H| +00000090 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 |........0.1.0...| +000000a0 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 |U....Go1.0...U..| +000000b0 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 |..Go Root0...160| +000000c0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| +000000d0 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 |01000000Z0.1.0..| +000000e0 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 |.U....Go1.0...U.| +000000f0 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |...Go0..0...*.H.| +00000100 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +00000110 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab |...F}...'.H..(!.| +00000120 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d |~...]..RE.z6G...| +00000130 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd |.B[.....y.@.Om..| +00000140 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a |+.....g....."8.J| +00000150 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 |.ts+.4......t{.X| +00000160 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c |.la<..A..++$#w[.| +00000170 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 |;.u]. T..c...$..| +00000180 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 |..P....C...ub...| +00000190 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 |R.........0..0..| +000001a0 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 |.U...........0..| +000001b0 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 |.U.%..0...+.....| +000001c0 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 |....+.......0...| +000001d0 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d |U.......0.0...U.| +000001e0 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d |.........CC>I..m| +000001f0 b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 |....`0...U.#..0.| +00000200 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab |..H.IM.~.1......| +00000210 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |n{0...U....0...e| +00000220 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| +00000230 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| +00000240 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed |.0.@+[P.a...SX..| +00000250 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 |.(.X..8....1Z..f| +00000260 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a |=C.-...... d8.$:| +00000270 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 |....}.@ ._...a..| +00000280 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed |v......\.....l..| +00000290 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 |s..Cw.......@.a.| +000002a0 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 |Lr+...F..M...>..| +000002b0 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 |.B...=.`.\!.;...| +000002c0 16 03 03 00 ac 0c 00 00 a8 03 00 1d 20 8b cc 79 |............ ..y| +000002d0 1e 8e 20 61 5d 00 97 27 cb 24 5c 7c 5f 3f df db |.. a]..'.$\|_?..| +000002e0 2d ba 3b f4 a1 1d 3e 3c 08 da 98 22 68 08 04 00 |-.;...><..."h...| +000002f0 80 10 fc 5b 90 af a6 8e d4 1b 5e 63 13 55 88 55 |...[......^c.U.U| +00000300 f3 bb ad 7a 5b 14 95 55 6b 2f 01 eb 22 88 fb 21 |...z[..Uk/.."..!| +00000310 40 88 d1 7f 52 b2 a2 ff 51 f9 05 8c c8 28 70 77 |@...R...Q....(pw| +00000320 3c 7a b0 48 28 f0 34 19 cc 8e c8 c9 43 93 aa fa |..a...4..r}..| +00000360 98 f2 bb c0 ae 5f b8 8e 00 6a 47 9c 8d cf 91 eb |....._...jG.....| +00000370 e7 16 03 03 00 04 0e 00 00 00 |..........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| +00000030 16 03 03 00 20 af 23 75 51 f1 3c 68 f8 87 2e 2b |.... .#uQ.>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 20 c0 52 cb d5 de |.......... .R...| +00000010 b1 43 8a 0b 75 a6 a4 d4 8f af 85 63 71 1d 3b 4f |.C..u......cq.;O| +00000020 7a ad 9b 77 85 1a 1d 7e 4b 42 13 |z..w...~KB.| +>>> Flow 5 (client to server) +00000000 17 03 03 00 16 30 b8 0e dd 42 64 a4 17 ee f5 70 |.....0...Bd....p| +00000010 1e 00 e8 da a7 f6 8e 73 c7 70 32 15 03 03 00 12 |.......s.p2.....| +00000020 57 be 7b cf bb 7b fe cb 7e b2 bb 38 9f 31 65 07 |W.{..{..~..8.1e.| +00000030 ba 61 |.a| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-Ed25519 b/go/src/crypto/tls/testdata/Client-TLSv12-Ed25519 new file mode 100644 index 0000000000000000000000000000000000000000..40b2f35137dc4278c6251df7817a8c51faf0f03e --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-Ed25519 @@ -0,0 +1,70 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 cc 3c fc d0 c6 |....]...Y...<...| +00000010 b8 3e 6b cb 59 8d 68 04 0b 94 10 28 ad 71 06 14 |.>k.Y.h....(.q..| +00000020 08 6c 10 12 aa 8d e4 f9 aa 7d 9b 20 a0 b8 96 40 |.l.......}. ...@| +00000030 1a ce 65 ae a6 a2 4d 4d 92 41 8e 2c 8d 94 d1 02 |..e...MM.A.,....| +00000040 c1 cb bd 6d 8b ee 36 ae c5 ec 6a 40 cc a9 00 00 |...m..6...j@....| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 01 3c 0b 00 01 38 00 01 35 00 01 |......<...8..5..| +00000070 32 30 82 01 2e 30 81 e1 a0 03 02 01 02 02 10 0f |20...0..........| +00000080 43 1c 42 57 93 94 1d e9 87 e4 f1 ad 15 00 5d 30 |C.BW..........]0| +00000090 05 06 03 2b 65 70 30 12 31 10 30 0e 06 03 55 04 |...+ep0.1.0...U.| +000000a0 0a 13 07 41 63 6d 65 20 43 6f 30 1e 17 0d 31 39 |...Acme Co0...19| +000000b0 30 35 31 36 32 31 33 38 30 31 5a 17 0d 32 30 30 |0516213801Z..200| +000000c0 35 31 35 32 31 33 38 30 31 5a 30 12 31 10 30 0e |515213801Z0.1.0.| +000000d0 06 03 55 04 0a 13 07 41 63 6d 65 20 43 6f 30 2a |..U....Acme Co0*| +000000e0 30 05 06 03 2b 65 70 03 21 00 3f e2 15 2e e6 e3 |0...+ep.!.?.....| +000000f0 ef 3f 4e 85 4a 75 77 a3 64 9e ed e0 bf 84 2c cc |.?N.Juw.d.....,.| +00000100 92 26 8f fa 6f 34 83 aa ec 8f a3 4d 30 4b 30 0e |.&..o4.....M0K0.| +00000110 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 |..U...........0.| +00000120 06 03 55 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 |..U.%..0...+....| +00000130 07 03 01 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 |...0...U.......0| +00000140 00 30 16 06 03 55 1d 11 04 0f 30 0d 82 0b 65 78 |.0...U....0...ex| +00000150 61 6d 70 6c 65 2e 63 6f 6d 30 05 06 03 2b 65 70 |ample.com0...+ep| +00000160 03 41 00 63 44 ed 9c c4 be 53 24 53 9f d2 10 8d |.A.cD....S$S....| +00000170 9f e8 21 08 90 95 39 e5 0d c1 55 ff 2c 16 b7 1d |..!...9...U.,...| +00000180 fc ab 7d 4d d4 e0 93 13 d0 a9 42 e0 b6 6b fe 5d |..}M......B..k.]| +00000190 67 48 d7 9f 50 bc 6c cd 4b 03 83 7c f2 08 58 cd |gH..P.l.K..|..X.| +000001a0 ac cf 0c 16 03 03 00 6c 0c 00 00 68 03 00 1d 20 |.......l...h... | +000001b0 fd f1 12 74 21 62 15 da 36 af d5 6c f3 0a cd 1e |...t!b..6..l....| +000001c0 09 37 aa 55 32 1a 27 a7 5b 37 34 32 35 36 f5 14 |.7.U2.'.[74256..| +000001d0 08 07 00 40 3d 7c 51 33 98 02 91 19 da 47 1a 1a |...@=|Q3.....G..| +000001e0 fe 03 4e 1b e8 5c 5e a7 12 9c e6 8a c2 74 18 dd |..N..\^......t..| +000001f0 18 9a 9d d6 60 f3 c8 63 00 33 d8 81 3e 2e 40 0f |....`..c.3..>.@.| +00000200 c5 98 fc a8 1c 6b 0c 19 70 f5 16 a5 25 ce 7b b8 |.....k..p...%.{.| +00000210 f2 f5 87 04 16 03 03 00 04 0e 00 00 00 |.............| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| +00000030 16 03 03 00 20 91 a7 c4 90 65 85 ce 63 66 fa 8b |.... ....e..cf..| +00000040 5c 22 e1 1d fb 14 c2 6c 86 7c 52 7c d1 96 3b 41 |\".....l.|R|..;A| +00000050 20 0d bf 09 e8 | ....| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 20 d0 3e 15 0e 08 |.......... .>...| +00000010 5b fd a8 b7 5f 01 7f ca 6d af 78 6e 33 7a 93 42 |[..._...m.xn3z.B| +00000020 aa 6e e4 f4 a1 bb 9a 2d bb 17 6f |.n.....-..o| +>>> Flow 5 (client to server) +00000000 17 03 03 00 16 7b f9 2f ce ac bc 43 3c 6b 10 3b |.....{./...C>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 ad 2d c6 4e 13 |....]...Y...-.N.| +00000010 72 ea 19 e0 65 33 ec cb aa 5c 70 bd f5 70 e0 b4 |r...e3...\p..p..| +00000020 ca 7e 64 da 5e 5f cb a6 69 d4 8c 20 79 45 e2 0a |.~d.^_..i.. yE..| +00000030 c7 b2 be 37 28 b5 c6 35 f9 0c c9 34 39 4d 38 3b |...7(..5...49M8;| +00000040 c0 47 31 44 e2 47 f7 6f 70 0f 8b 2d cc a8 00 00 |.G1D.G.op..-....| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 02 59 0b 00 02 55 00 02 52 00 02 |......Y...U..R..| +00000070 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 |O0..K0..........| +00000080 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 |....?.[..0...*.H| +00000090 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 |........0.1.0...| +000000a0 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 |U....Go1.0...U..| +000000b0 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 |..Go Root0...160| +000000c0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| +000000d0 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 |01000000Z0.1.0..| +000000e0 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 |.U....Go1.0...U.| +000000f0 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |...Go0..0...*.H.| +00000100 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +00000110 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab |...F}...'.H..(!.| +00000120 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d |~...]..RE.z6G...| +00000130 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd |.B[.....y.@.Om..| +00000140 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a |+.....g....."8.J| +00000150 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 |.ts+.4......t{.X| +00000160 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c |.la<..A..++$#w[.| +00000170 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 |;.u]. T..c...$..| +00000180 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 |..P....C...ub...| +00000190 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 |R.........0..0..| +000001a0 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 |.U...........0..| +000001b0 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 |.U.%..0...+.....| +000001c0 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 |....+.......0...| +000001d0 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d |U.......0.0...U.| +000001e0 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d |.........CC>I..m| +000001f0 b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 |....`0...U.#..0.| +00000200 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab |..H.IM.~.1......| +00000210 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |n{0...U....0...e| +00000220 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| +00000230 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| +00000240 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed |.0.@+[P.a...SX..| +00000250 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 |.(.X..8....1Z..f| +00000260 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a |=C.-...... d8.$:| +00000270 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 |....}.@ ._...a..| +00000280 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed |v......\.....l..| +00000290 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 |s..Cw.......@.a.| +000002a0 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 |Lr+...F..M...>..| +000002b0 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 |.B...=.`.\!.;...| +000002c0 16 03 03 00 ac 0c 00 00 a8 03 00 1d 20 f4 07 0a |............ ...| +000002d0 38 0a 4e 5d 59 90 98 e7 19 02 7b 51 76 59 2e 3d |8.N]Y.....{QvY.=| +000002e0 d2 f5 2f 1c 87 29 61 94 a0 ad 95 8b 4b 08 04 00 |../..)a.....K...| +000002f0 80 22 b1 ac 42 df 30 4f ea 41 75 a5 28 2e a7 50 |."..B.0O.Au.(..P| +00000300 2a 4f c8 f4 1f c3 35 82 88 47 78 de fe 00 43 ed |*O....5..Gx...C.| +00000310 84 48 52 8b bf 77 22 00 fd 92 c4 e0 67 66 28 5c |.HR..w".....gf(\| +00000320 8a 7f 32 21 c2 5a bd b2 8f d5 72 48 3a 83 3b d7 |..2!.Z....rH:.;.| +00000330 c8 c0 fb 54 52 28 41 49 3f 6d b4 4c ef 87 3a e5 |...TR(AI?m.L..:.| +00000340 30 db e2 c8 5c ed f1 46 a8 f4 04 0b 02 2b 93 03 |0...\..F.....+..| +00000350 de dc 41 88 50 f6 22 c5 2a 30 ac 47 f2 db 00 5c |..A.P.".*0.G...\| +00000360 7e 14 25 fd 72 de 81 ed 30 c8 62 1c 6d 44 4e 90 |~.%.r...0.b.mDN.| +00000370 3f 16 03 03 00 04 0e 00 00 00 |?.........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| +00000030 16 03 03 00 20 e1 88 c9 ef 40 26 52 ca d2 d9 31 |.... ....@&R...1| +00000040 9c 51 a6 fa b3 40 6b 62 7e ad 00 ea da 8f 54 bf |.Q...@kb~.....T.| +00000050 f5 89 4b c9 a9 |..K..| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 20 6f e3 54 91 aa |.......... o.T..| +00000010 00 b4 8e f3 b2 51 1e 76 48 91 49 b9 ba dc 5f e4 |.....Q.vH.I..._.| +00000020 9f 0e 49 b5 54 f5 e3 9d 25 75 38 |..I.T...%u8| +>>> Flow 5 (client to server) +00000000 17 03 03 00 16 7b 2a af 79 d3 1c 0d cf 0f 83 04 |.....{*.y.......| +00000010 9e 96 63 69 0c ec f7 98 02 33 12 15 03 03 00 12 |..ci.....3......| +00000020 58 d3 1a 60 74 2c 92 91 61 2c 13 23 6d e9 5f de |X..`t,..a,.#m._.| +00000030 65 42 |eB| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-P256-ECDHE b/go/src/crypto/tls/testdata/Client-TLSv12-P256-ECDHE new file mode 100644 index 0000000000000000000000000000000000000000..0cac7e7545cb2955c099bc8ad200fb6fe98a241d --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-P256-ECDHE @@ -0,0 +1,100 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 33 01 00 01 2f 03 03 00 00 00 00 00 |....3.../.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 b4 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 04 00 02 00 17 00 0d 00 16 00 14 08 04 |................| +000000b0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000c0 06 03 00 32 00 1a 00 18 08 04 04 03 08 07 08 05 |...2............| +000000d0 08 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 |................| +000000e0 00 2b 00 09 08 03 04 03 03 03 02 03 01 00 33 00 |.+............3.| +000000f0 47 00 45 00 17 00 41 04 1e 18 37 ef 0d 19 51 88 |G.E...A...7...Q.| +00000100 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd a7 24 20 |5uq..T[....g..$ | +00000110 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e f1 07 9f |>.V...(^.+-O....| +00000120 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 a6 b5 68 |lK[.V.2B.X..I..h| +00000130 1a 41 03 56 6b dc 5a 89 |.A.Vk.Z.| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 d9 70 61 62 c5 |....]...Y...pab.| +00000010 f4 b4 22 c6 ea f6 e9 8c fc 29 e8 8c 24 2d 4b c4 |.."......)..$-K.| +00000020 04 57 01 ae e5 41 7e 7f 6f ec c3 20 86 6b 38 a9 |.W...A~.o.. .k8.| +00000030 ea cd 51 3b 0f 05 5c a3 98 0c 4d ba 46 d6 99 f3 |..Q;..\...M.F...| +00000040 67 da f2 62 56 29 f7 e6 8c 14 8a 7a c0 2f 00 00 |g..bV).....z./..| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 02 59 0b 00 02 55 00 02 52 00 02 |......Y...U..R..| +00000070 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 |O0..K0..........| +00000080 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 |....?.[..0...*.H| +00000090 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 |........0.1.0...| +000000a0 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 |U....Go1.0...U..| +000000b0 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 |..Go Root0...160| +000000c0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| +000000d0 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 |01000000Z0.1.0..| +000000e0 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 |.U....Go1.0...U.| +000000f0 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |...Go0..0...*.H.| +00000100 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +00000110 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab |...F}...'.H..(!.| +00000120 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d |~...]..RE.z6G...| +00000130 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd |.B[.....y.@.Om..| +00000140 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a |+.....g....."8.J| +00000150 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 |.ts+.4......t{.X| +00000160 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c |.la<..A..++$#w[.| +00000170 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 |;.u]. T..c...$..| +00000180 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 |..P....C...ub...| +00000190 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 |R.........0..0..| +000001a0 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 |.U...........0..| +000001b0 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 |.U.%..0...+.....| +000001c0 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 |....+.......0...| +000001d0 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d |U.......0.0...U.| +000001e0 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d |.........CC>I..m| +000001f0 b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 |....`0...U.#..0.| +00000200 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab |..H.IM.~.1......| +00000210 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |n{0...U....0...e| +00000220 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| +00000230 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| +00000240 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed |.0.@+[P.a...SX..| +00000250 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 |.(.X..8....1Z..f| +00000260 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a |=C.-...... d8.$:| +00000270 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 |....}.@ ._...a..| +00000280 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed |v......\.....l..| +00000290 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 |s..Cw.......@.a.| +000002a0 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 |Lr+...F..M...>..| +000002b0 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 |.B...=.`.\!.;...| +000002c0 16 03 03 00 cd 0c 00 00 c9 03 00 17 41 04 a0 b7 |............A...| +000002d0 0f 94 44 46 c4 72 5a 3c b8 5c cd f1 9e b0 49 17 |..DF.rZ<.\....I.| +000002e0 ea a0 ca 1d 17 d8 85 5f 0a e3 4a 85 5d f4 bb 52 |......._..J.]..R| +000002f0 23 79 24 a9 50 81 9f 8a 5e e4 2f 5d cc 7d e2 10 |#y$.P...^./].}..| +00000300 db 42 f0 26 98 61 b7 f5 39 16 46 d6 04 f7 08 04 |.B.&.a..9.F.....| +00000310 00 80 05 70 60 b3 39 e0 61 6e 72 b3 13 2c 8c 2d |...p`.9.anr..,.-| +00000320 e1 d9 37 8e cd 13 64 2f 4b 65 4f 7c a0 2a 7e 91 |..7...d/KeO|.*~.| +00000330 e1 fd 7d 3b e3 35 dd 5a c8 ab 56 13 c3 c6 07 90 |..};.5.Z..V.....| +00000340 fb d3 cf 22 dd 78 4c 33 c7 d3 6e 64 7e 65 ba 02 |...".xL3..nd~e..| +00000350 ca 04 50 77 08 65 d5 80 c9 4f c3 b3 5b 97 b2 80 |..Pw.e...O..[...| +00000360 3d 48 37 20 ab 28 15 0c f2 86 dd b6 19 66 46 e3 |=H7 .(.......fF.| +00000370 23 69 e2 5d fb 70 65 fb c6 ae fc a4 02 42 9f fe |#i.].pe......B..| +00000380 b4 5c f0 4b 23 92 2a 4f a4 1a f4 86 3b 5c 25 9d |.\.K#.*O....;\%.| +00000390 86 e2 16 03 03 00 04 0e 00 00 00 |...........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 46 10 00 00 42 41 04 1e 18 37 ef 0d |....F...BA...7..| +00000010 19 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd |.Q.5uq..T[....g.| +00000020 a7 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e |.$ >.V...(^.+-O.| +00000030 f1 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 |...lK[.V.2B.X..I| +00000040 a6 b5 68 1a 41 03 56 6b dc 5a 89 14 03 03 00 01 |..h.A.Vk.Z......| +00000050 01 16 03 03 00 28 00 00 00 00 00 00 00 00 3f 54 |.....(........?T| +00000060 35 c8 33 70 66 0f 9d 3d 57 d7 a8 7f 57 45 63 a4 |5.3pf..=W...WEc.| +00000070 67 a2 83 c4 17 5b 22 8f 1c 89 78 1c 43 8d |g....["...x.C.| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 28 25 5d 63 2d f3 |..........(%]c-.| +00000010 a5 91 45 d0 7d 68 39 f6 0e 04 6f 4b c9 dd 4a 54 |..E.}h9...oK..JT| +00000020 f5 a2 04 54 d2 57 4b 40 75 4d 2f b3 5d 00 5b 11 |...T.WK@uM/.].[.| +00000030 89 0e 92 |...| +>>> Flow 5 (client to server) +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 0c 9c ab |................| +00000010 24 e8 b2 cf a2 6f f9 8e 54 ed 35 43 07 4d 8f 89 |$....o..T.5C.M..| +00000020 5c 08 15 15 03 03 00 1a 00 00 00 00 00 00 00 02 |\...............| +00000030 f8 65 48 1e a4 03 c0 3b 2f 23 c7 9e 92 59 f6 be |.eH....;/#...Y..| +00000040 b4 a2 |..| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-RSA-RC4 b/go/src/crypto/tls/testdata/Client-TLSv12-RSA-RC4 new file mode 100644 index 0000000000000000000000000000000000000000..faa48c784371b604d0966a559a6e67b794d2f425 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-RSA-RC4 @@ -0,0 +1,87 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 55 02 00 00 51 03 03 c4 5b d6 0f d4 |....U...Q...[...| +00000010 64 3a 37 34 a3 84 9d 3d 1b 33 c3 d4 4f 42 f7 3a |d:74...=.3..OB.:| +00000020 e8 da 8c 8b 97 1a e5 f4 56 a4 bd 20 03 30 25 fd |........V.. .0%.| +00000030 d9 01 7a 7c b8 9d 63 f0 a3 7a 1c 00 6b 75 16 d8 |..z|..c..z..ku..| +00000040 68 5c 7a 8d 4a ae ed 52 fc 92 e5 03 00 05 00 00 |h\z.J..R........| +00000050 09 ff 01 00 01 00 00 17 00 00 16 03 03 02 59 0b |..............Y.| +00000060 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 82 01 |..U..R..O0..K0..| +00000070 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 5b ea |............?.[.| +00000080 a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |.0...*.H........| +00000090 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 |0.1.0...U....Go1| +000000a0 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 6f 6f |.0...U....Go Roo| +000000b0 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 30 30 |t0...16010100000| +000000c0 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 30 30 |0Z..250101000000| +000000d0 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 47 6f |Z0.1.0...U....Go| +000000e0 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 81 9f |1.0...U....Go0..| +000000f0 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 |0...*.H.........| +00000100 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 2e 12 |...0.......F}...| +00000110 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 |'.H..(!.~...]..R| +00000120 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 |E.z6G....B[.....| +00000130 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 |y.@.Om..+.....g.| +00000140 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 |...."8.J.ts+.4..| +00000150 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 |....t{.X.la<..A.| +00000160 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf |.++$#w[.;.u]. T.| +00000170 a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 |.c...$....P....C| +00000180 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 |...ub...R.......| +00000190 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 ff 04 |..0..0...U......| +000001a0 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 30 14 |.....0...U.%..0.| +000001b0 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 01 05 |..+.........+...| +000001c0 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 |....0...U.......| +000001d0 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f 91 16 |0.0...U.........| +000001e0 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 |.CC>I..m....`0..| +000001f0 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d 13 7e |.U.#..0...H.IM.~| +00000200 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 55 1d |.1......n{0...U.| +00000210 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 2e 67 |...0...example.g| +00000220 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 0d 01 |olang0...*.H....| +00000230 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 |.........0.@+[P.| +00000240 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 |a...SX...(.X..8.| +00000250 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 |...1Z..f=C.-....| +00000260 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 40 20 |.. d8.$:....}.@ | +00000270 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c |._...a..v......\| +00000280 ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c |.....l..s..Cw...| +00000290 f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db 46 06 |....@.a.Lr+...F.| +000002a0 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 |.M...>...B...=.`| +000002b0 84 5c 21 d3 3b e9 fa e7 16 03 03 00 04 0e 00 00 |.\!.;...........| +000002c0 00 |.| +>>> Flow 3 (client to server) +00000000 16 03 03 00 86 10 00 00 82 00 80 b9 65 8d bf a7 |............e...| +00000010 c8 4b 79 ce 6f cb 8b 13 1c ac b9 7d 66 5e e9 ba |.Ky.o......}f^..| +00000020 1d 71 4e a9 e9 34 ae f6 64 65 90 3b d8 16 52 a2 |.qN..4..de.;..R.| +00000030 6f f4 cb 8a 13 74 a2 ee b7 27 69 b4 41 c0 90 68 |o....t...'i.A..h| +00000040 bc 02 69 e1 c6 48 4f 39 36 30 25 ca 4c 17 ce 83 |..i..HO960%.L...| +00000050 9e 08 56 e3 05 49 93 9e 2e c4 fb e6 c8 01 f1 0f |..V..I..........| +00000060 c5 70 0f 08 83 48 e9 48 ef 6e 50 8b 05 7e e5 84 |.p...H.H.nP..~..| +00000070 25 fa 55 c7 ae 31 02 27 00 ef 3f 98 86 20 12 89 |%.U..1.'..?.. ..| +00000080 91 59 28 b4 f7 d7 af d2 69 61 35 14 03 03 00 01 |.Y(.....ia5.....| +00000090 01 16 03 03 00 24 83 66 73 cf 08 6f c7 29 1b ea |.....$.fs..o.)..| +000000a0 86 aa 02 66 2d d9 d4 7b 19 0d cc e5 9e dc e9 20 |...f-..{....... | +000000b0 d9 62 82 59 bd e9 91 6b 90 62 |.b.Y...k.b| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 24 ef bb 0c 3b fb |..........$...;.| +00000010 4e 36 53 b9 fa d4 c3 d0 37 5e 2b 22 a2 12 b6 9e |N6S.....7^+"....| +00000020 1c a3 f7 93 74 60 38 18 f1 cc 72 e4 ba 1a 3d |....t`8...r...=| +>>> Flow 5 (client to server) +00000000 17 03 03 00 1a 62 a3 b3 3a 89 25 05 89 bc 5a 21 |.....b..:.%...Z!| +00000010 30 61 84 b0 97 52 26 a2 18 87 25 43 17 1a 52 15 |0a...R&...%C..R.| +00000020 03 03 00 16 97 d6 18 0c 30 b3 9b 8f 2b f1 f9 3f |........0...+..?| +00000030 c7 8d a2 e1 ff 36 0c d6 c2 f1 |.....6....| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-RenegotiateOnce b/go/src/crypto/tls/testdata/Client-TLSv12-RenegotiateOnce new file mode 100644 index 0000000000000000000000000000000000000000..868b527396bd004224ee127f57f12d1e88bb381a --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-RenegotiateOnce @@ -0,0 +1,249 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 9e b0 dd 2b 97 |....]...Y.....+.| +00000010 86 13 76 2e 65 fc 27 bc fd 01 c0 05 86 b9 e3 bd |..v.e.'.........| +00000020 b9 46 3b 09 37 2a fe 3a eb ee e0 20 65 ad 7c 0b |.F;.7*.:... e.|.| +00000030 1a 0b 9b da b0 8d 56 86 b6 e1 04 1b dd 5d 93 8e |......V......]..| +00000040 a9 ea b6 b7 17 c9 75 26 58 5a c5 37 cc a8 00 00 |......u&XZ.7....| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 02 59 0b 00 02 55 00 02 52 00 02 |......Y...U..R..| +00000070 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 |O0..K0..........| +00000080 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 |....?.[..0...*.H| +00000090 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 |........0.1.0...| +000000a0 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 |U....Go1.0...U..| +000000b0 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 |..Go Root0...160| +000000c0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| +000000d0 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 |01000000Z0.1.0..| +000000e0 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 |.U....Go1.0...U.| +000000f0 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |...Go0..0...*.H.| +00000100 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +00000110 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab |...F}...'.H..(!.| +00000120 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d |~...]..RE.z6G...| +00000130 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd |.B[.....y.@.Om..| +00000140 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a |+.....g....."8.J| +00000150 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 |.ts+.4......t{.X| +00000160 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c |.la<..A..++$#w[.| +00000170 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 |;.u]. T..c...$..| +00000180 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 |..P....C...ub...| +00000190 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 |R.........0..0..| +000001a0 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 |.U...........0..| +000001b0 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 |.U.%..0...+.....| +000001c0 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 |....+.......0...| +000001d0 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d |U.......0.0...U.| +000001e0 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d |.........CC>I..m| +000001f0 b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 |....`0...U.#..0.| +00000200 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab |..H.IM.~.1......| +00000210 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |n{0...U....0...e| +00000220 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| +00000230 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| +00000240 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed |.0.@+[P.a...SX..| +00000250 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 |.(.X..8....1Z..f| +00000260 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a |=C.-...... d8.$:| +00000270 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 |....}.@ ._...a..| +00000280 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed |v......\.....l..| +00000290 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 |s..Cw.......@.a.| +000002a0 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 |Lr+...F..M...>..| +000002b0 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 |.B...=.`.\!.;...| +000002c0 16 03 03 00 ac 0c 00 00 a8 03 00 1d 20 41 0e e9 |............ A..| +000002d0 28 d0 77 ab a1 9e 93 62 b1 ec d9 e4 17 7d cb 29 |(.w....b.....}.)| +000002e0 25 28 6f 7d de fa 2e 89 8c 02 f7 22 25 08 04 00 |%(o}......."%...| +000002f0 80 c9 63 f4 f2 99 a9 c3 dd 81 1b 3a c2 85 0a e7 |..c........:....| +00000300 0f a6 5d 71 54 42 9e b9 68 35 5f ff b5 f3 51 9f |..]qTB..h5_...Q.| +00000310 16 46 c3 55 44 15 34 22 6d 68 15 6f 86 60 36 27 |.F.UD.4"mh.o.`6'| +00000320 29 b1 f5 f3 21 5a c5 bc 95 b9 18 f3 57 7b f7 90 |)...!Z......W{..| +00000330 20 c1 41 f2 53 d2 a0 a6 4a c8 3b 2b 75 7d 27 84 | .A.S...J.;+u}'.| +00000340 fb 90 1c 9c 29 26 91 71 e8 25 0b 2a f1 76 b5 5c |....)&.q.%.*.v.\| +00000350 7f df 02 86 1c a9 ba 5a 4a 6c 25 95 1d 3c 51 21 |.......ZJl%..>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| +00000030 16 03 03 00 20 5b d2 2a ad 40 50 6f a8 b8 70 d0 |.... [.*.@Po..p.| +00000040 b9 aa ab d5 d7 2a f1 2b f7 d7 9b cd 10 a5 80 e9 |.....*.+........| +00000050 d3 15 3f 4f 00 |..?O.| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 20 dd 90 d8 8a 0a |.......... .....| +00000010 11 a6 30 9b b0 29 50 c8 b1 70 36 bc fb 84 6e 6d |..0..)P..p6...nm| +00000020 a9 5e 67 3c e2 2e 0b 09 b2 44 38 |.^g<.....D8| +>>> Flow 5 (client to server) +00000000 17 03 03 00 16 9f e0 6a fc e9 a2 bf cf b4 df 07 |.......j........| +00000010 ba b4 8b 8b 08 ca bd a7 d5 02 2a |..........*| +>>> Flow 6 (server to client) +00000000 16 03 03 00 14 ed 9b 22 44 dd b2 e2 c3 7e ab 0c |......."D....~..| +00000010 69 98 d0 7b 40 9e da e2 67 |i..{@...g| +>>> Flow 7 (client to server) +00000000 16 03 03 01 34 0d de 90 41 3c 76 1d 54 9d c2 7e |....4...A?J..}......| +00000070 4c 1c fb 2c 88 4c 13 8d c8 d0 e3 7f f6 cb 2e ca |L..,.L..........| +00000080 cb 92 ae 30 fe ea 3c 3e ae 57 51 6a d6 98 5c d6 |...0..<>.WQj..\.| +00000090 19 85 72 bd 62 56 fa c2 ea 08 eb b4 d9 75 ac de |..r.bV.......u..| +000000a0 a5 40 8d 8b 1f c4 8f f6 6d b2 5f d1 6d fb 14 fa |.@......m._.m...| +000000b0 e2 92 9e 04 37 d3 60 83 28 4a f9 92 8c b3 4a d2 |....7.`.(J....J.| +000000c0 ce 6d 95 e4 40 79 7c 3d 98 11 e7 da 5c 56 0a 95 |.m..@y|=....\V..| +000000d0 e0 6f 36 80 07 da 29 ef 88 44 db cd 2b 5a a5 27 |.o6...)..D..+Z.'| +000000e0 56 5a 94 49 aa 51 ae 48 f9 12 8d df e0 2a a7 67 |VZ.I.Q.H.....*.g| +000000f0 7f 55 3e 7a b6 bb 28 e3 a8 d9 44 67 e9 03 8f e5 |.U>z..(...Dg....| +00000100 2b 40 a3 37 fb e4 51 0a 18 8f bb 14 2e 5b 62 93 |+@.7..Q......[b.| +00000110 ab a4 40 d7 5f 15 12 cf 93 74 37 d0 ec 14 d3 a3 |..@._....t7.....| +00000120 eb 6f 61 35 4a c4 b5 d7 d1 bb ae fe 11 6d 04 ac |.oa5J........m..| +00000130 58 72 a6 72 b6 06 9d 93 a5 |Xr.r.....| +>>> Flow 8 (server to client) +00000000 16 03 03 00 85 8b 8d 61 42 37 50 ee 69 d8 fb e9 |.......aB7P.i...| +00000010 89 a4 04 63 5d 87 a4 31 cc 22 26 c0 2c 22 1a 73 |...c]..1."&.,".s| +00000020 cc f0 9f be 65 c4 e0 ad 6d b0 b5 d3 86 2c 0b 59 |....e...m....,.Y| +00000030 e6 ae 58 38 b5 5f 4f 6e 7c ec e9 27 23 5f 4a 92 |..X8._On|..'#_J.| +00000040 78 5f cc 9f 7f 2b bb 2c dd 04 17 ea d4 87 b9 6d |x_...+.,.......m| +00000050 d0 1e 35 01 b4 4d 5d 73 6a 9f de 1d 71 47 78 d6 |..5..M]sj...qGx.| +00000060 89 dc c2 d6 5c 69 0c dc bb 7b 59 60 56 47 e9 5c |....\i...{Y`VG.\| +00000070 04 3e 3c 93 18 9b 40 4b 95 1f 20 e3 17 c6 ab 35 |.><...@K.. ....5| +00000080 db 3f 88 d7 4b 89 5a 53 b7 a9 16 03 03 02 69 85 |.?..K.ZS......i.| +00000090 49 cc 00 5a 45 40 9d be 80 06 97 16 a0 c0 dc bb |I..ZE@..........| +000000a0 32 62 18 88 31 3b 14 ec 9d f2 3f ed c0 36 ad bb |2b..1;....?..6..| +000000b0 69 fa 32 f5 13 54 2b 77 f3 db 6e 20 0a 2b 5c a5 |i.2..T+w..n .+\.| +000000c0 d8 aa 5a 63 8d c1 51 50 41 f6 6c f7 ef 2f 15 81 |..Zc..QPA.l../..| +000000d0 85 af 6e e5 01 95 9a 5e 70 26 cb c1 c8 89 3f b8 |..n....^p&....?.| +000000e0 3d 5a 1b 68 a6 25 08 48 ad dd 29 db bf ce 75 44 |=Z.h.%.H..)...uD| +000000f0 ca cd 92 79 47 d8 25 f1 23 9a 63 62 15 05 d8 2c |...yG.%.#.cb...,| +00000100 c0 30 a4 65 a7 f9 89 a4 fe 87 32 21 07 24 d9 16 |.0.e......2!.$..| +00000110 64 26 48 75 ab a7 00 e1 9b 48 5c 77 3d 66 18 69 |d&Hu.....H\w=f.i| +00000120 35 a9 4c 03 f5 9f 42 ff 50 98 73 b1 82 16 fd ff |5.L...B.P.s.....| +00000130 94 fd aa 3c 46 1f b5 99 fd de ab 2e 6a 24 00 5a |.........."| +00000300 3d 8d 48 5d 28 cd ae 94 db 95 2e a6 44 77 da d5 |=.H](.......Dw..| +00000310 a1 09 7c a3 4c 3f a6 18 80 92 cf 5c 77 9d 18 5d |..|.L?.....\w..]| +00000320 43 78 05 bb cb 8e 27 7c cc 2e 9c 54 95 ff 1c 74 |Cx....'|...T...t| +00000330 48 fb df 47 e8 e1 24 94 94 5d cc 2c b2 df 48 6c |H..G..$..].,..Hl| +00000340 22 1e 61 f1 e3 c6 56 fb 79 70 b0 ab c5 70 ca 7f |".a...V.yp...p..| +00000350 c0 32 8d 6d a5 55 6d 94 8c 7b 9d da 0b 35 d1 da |.2.m.Um..{...5..| +00000360 77 85 01 66 15 be 10 c3 3c 9b 80 61 b3 c0 1a 29 |w..f....<..a...)| +00000370 22 d1 d1 ba 4a ea 01 58 72 94 79 f0 6e 5f 36 23 |"...J..Xr.y.n_6#| +00000380 8a cf 16 fa 2c 5f 6d dd 54 61 df bc 6f 91 d4 df |....,_m.Ta..o...| +00000390 e7 6f 50 8f 9c 27 04 04 19 80 10 a2 8d a5 61 81 |.oP..'........a.| +000003a0 06 1f b0 79 87 c0 95 87 f7 d8 87 22 75 a5 87 30 |...y......."u..0| +000003b0 f4 33 6d cb 59 f7 18 75 0f 16 03 03 00 4a d3 e9 |.3m.Y..u.....J..| +000003c0 2e 47 65 f2 29 70 4c 74 3f e9 13 88 e7 66 c6 73 |.Ge.)pLt?....f.s| +000003d0 0f e4 7a 8f 0e 49 49 39 90 e7 ff d4 1f 8a d6 c6 |..z..II9........| +000003e0 91 16 f6 a6 fe 60 d8 ba 26 a6 5e 44 f5 76 88 63 |.....`..&.^D.v.c| +000003f0 10 d0 89 2f 6b ae 55 64 13 0c 63 76 69 df 6a 4a |.../k.Ud..cvi.jJ| +00000400 74 15 51 0b 4d 74 db 49 16 03 03 00 14 f2 0f e7 |t.Q.Mt.I........| +00000410 38 90 33 ff 5e 20 60 42 32 40 72 2c c8 70 d7 ba |8.3.^ `B2@r,.p..| +00000420 a1 |.| +>>> Flow 9 (client to server) +00000000 16 03 03 02 69 78 39 27 1a 64 94 f7 9c 64 ac 37 |....ix9'.d...d.7| +00000010 28 be d0 a4 74 98 34 51 8e 3b c7 14 02 83 ee a5 |(...t.4Q.;......| +00000020 05 55 59 f8 04 43 59 cd 33 e6 c4 44 57 30 68 db |.UY..CY.3..DW0h.| +00000030 b2 cb 50 db c1 e6 c4 04 a3 79 22 40 15 f9 89 57 |..P......y"@...W| +00000040 7b 7a 68 d6 d1 15 c9 7f 6b d8 3a 6c dc 32 4f 72 |{zh.....k.:l.2Or| +00000050 97 57 32 25 f9 78 e6 07 91 f4 45 67 b1 41 dd f9 |.W2%.x....Eg.A..| +00000060 5b fd 76 53 d5 7d 0f 74 6e 2e ea d9 9c 2d 00 39 |[.vS.}.tn....-.9| +00000070 2f 7f 49 97 24 bf e4 f2 c7 7e 21 f9 dd 30 3a 78 |/.I.$....~!..0:x| +00000080 3c 53 41 58 5c 97 3a ff 6f 60 f4 b6 d6 23 a9 ad |.c....| +000000e0 6c b5 0d 0c d3 c6 6d 47 2e a8 3a d8 ec fd d3 42 |l.....mG..:....B| +000000f0 ef 8b e8 75 a6 04 06 3b 5e 57 ae a3 10 2e 6d 01 |...u...;^W....m.| +00000100 0e ea 94 e6 78 1b 91 f0 a0 1e 55 d3 25 13 15 ac |....x.....U.%...| +00000110 eb a4 7c c3 66 83 62 00 a3 d2 f5 7c 64 c6 39 fb |..|.f.b....|d.9.| +00000120 6d ee 01 50 d4 13 5d 10 5f 31 30 09 90 91 64 ad |m..P..]._10...d.| +00000130 f1 c5 4b ed 9d ef 2a 71 e5 7a b2 5d a8 57 bc b8 |..K...*q.z.].W..| +00000140 1f 32 c6 f0 61 f0 08 9e 07 9b d3 99 5b 5e a5 32 |.2..a.......[^.2| +00000150 1f 8a f7 30 1f e9 e6 39 b1 5a c6 a5 22 c8 98 49 |...0...9.Z.."..I| +00000160 04 f2 58 4d e2 15 e6 cd d1 2b 05 54 81 cc b8 33 |..XM.....+.T...3| +00000170 5d 26 52 65 95 32 84 01 f6 05 fa 19 58 c6 57 53 |]&Re.2......X.WS| +00000180 c8 d7 3d ef 56 4e 6e e4 17 45 1c bc 40 ee 06 32 |..=.VNn..E..@..2| +00000190 60 74 9e 62 02 47 52 a8 92 57 26 1f ba 2d 93 67 |`t.b.GR..W&..-.g| +000001a0 94 46 0f c4 0d f5 df 75 b0 d9 27 02 56 f3 82 e1 |.F.....u..'.V...| +000001b0 da 1c 3b 3e 97 93 c8 2d 12 bd b4 5b 36 7a 5c bf |..;>...-...[6z\.| +000001c0 27 9a 75 11 f9 4d 9b c0 ae 6b be 71 5f 37 33 b5 |'.u..M...k.q_73.| +000001d0 4e d4 5a fb 98 71 c5 77 8c fc e2 f3 91 73 35 f4 |N.Z..q.w.....s5.| +000001e0 e7 13 b1 ea bd c2 a9 46 b9 ea 88 06 58 a2 49 a2 |.......F....X.I.| +000001f0 97 2b cf 1b 25 a3 71 a0 22 95 4c 54 81 eb 41 7f |.+..%.q.".LT..A.| +00000200 80 15 82 ec 19 0c f8 a3 21 fe 37 2e e1 ca 34 02 |........!.7...4.| +00000210 5d ec 78 d9 eb 99 93 5d 96 26 cd 4c 56 3a 35 6a |].x....].&.LV:5j| +00000220 7f d0 0c c7 b7 c3 80 c6 fe d0 04 54 00 8c 4c 8b |...........T..L.| +00000230 43 f4 36 b8 ea 51 35 3c 5e b5 b9 45 dc d2 19 bd |C.6..Q5<^..E....| +00000240 d2 2a 95 bc 7f 22 43 4f 84 be bd 7b ab a8 5c 4d |.*..."CO...{..\M| +00000250 28 99 e6 e5 05 33 05 38 be 17 55 80 2d e1 de cf |(....3.8..U.-...| +00000260 39 4e 5b 7d 89 b4 a6 d3 0a e3 fd 47 e1 2c 16 03 |9N[}.......G.,..| +00000270 03 00 35 f3 2d 2c 7b fa 06 39 06 40 27 5b ea 9e |..5.-,{..9.@'[..| +00000280 2f 4a 6c 32 df 62 c3 bc af ed 21 6a 1a 34 82 cf |/Jl2.b....!j.4..| +00000290 73 e5 b9 1d 8d 42 3d 8e b7 e6 1c 0a e0 81 3e cd |s....B=.......>.| +000002a0 88 23 f3 56 55 09 e2 6e 16 03 03 00 98 73 0f 59 |.#.VU..n.....s.Y| +000002b0 0e 1b 1b d1 db db 6d 47 d9 05 f8 e1 29 32 e5 16 |......mG....)2..| +000002c0 f9 f6 24 2b 0f 2d bb 74 da fd 75 9b ec 6a 3f 02 |..$+.-.t..u..j?.| +000002d0 c8 3a ab 23 ec cb 77 c6 d7 7b ba ce 29 85 66 54 |.:.#..w..{..).fT| +000002e0 ab df c9 74 2a 50 b5 cd 45 03 e2 ce 6f d3 d0 f1 |...t*P..E...o...| +000002f0 1a 3e e4 c0 34 72 e1 53 1e 69 9a d7 41 4f d4 3a |.>..4r.S.i..AO.:| +00000300 31 af 1a 0b 83 82 e7 6c 4f f6 9a d5 84 bb 9a 14 |1......lO.......| +00000310 e3 ec 04 12 c8 83 9c c8 d9 81 c1 c9 16 db 35 6e |..............5n| +00000320 0f af a0 b3 e6 a9 2b ad a5 1f cd a0 fb 45 01 84 |......+......E..| +00000330 ae b5 42 49 21 d8 29 06 0a 0e e8 26 8e f4 f1 56 |..BI!.)....&...V| +00000340 c2 7c 8f d6 4a 14 03 03 00 11 c6 06 37 68 e0 2b |.|..J.......7h.+| +00000350 dd 32 2a b5 c7 b6 ad e2 c8 7c d8 16 03 03 00 20 |.2*......|..... | +00000360 1d 80 95 df 2d d3 38 50 a2 2d bc 09 50 e4 e8 47 |....-.8P.-..P..G| +00000370 5f 3e 26 03 5e d3 9b 5a ee ed d4 bb cb da 05 5b |_>&.^..Z.......[| +>>> Flow 10 (server to client) +00000000 14 03 03 00 11 13 75 b3 44 ec 4c 6b 24 d3 52 90 |......u.D.Lk$.R.| +00000010 28 c1 47 92 5c 0d 16 03 03 00 20 c2 61 ed 34 d2 |(.G.\..... .a.4.| +00000020 c5 cf fd b3 31 3d 1d 5f 30 87 18 65 01 47 da 0f |....1=._0..e.G..| +00000030 d9 eb 4f 0f 50 2e 02 86 fe eb 13 17 03 03 00 19 |..O.P...........| +00000040 3f ac 26 1c 16 0e 16 bf b1 d3 80 86 dd c6 e2 b6 |?.&.............| +00000050 3f 5a 0b 0c 3e 7d 3b a8 d5 |?Z..>};..| +>>> Flow 11 (client to server) +00000000 15 03 03 00 12 ea 81 9d df ec c1 0c 3d 21 8b fe |............=!..| +00000010 b5 24 d8 92 43 1d 3d |.$..C.=| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-RenegotiateTwice b/go/src/crypto/tls/testdata/Client-TLSv12-RenegotiateTwice new file mode 100644 index 0000000000000000000000000000000000000000..e83ad4b285c3108cb74707732c9c6d34c4c95b4b --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-RenegotiateTwice @@ -0,0 +1,351 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 36 29 60 e0 b5 |....]...Y..6)`..| +00000010 ee 59 a6 3b 1a de 96 8a 51 0c c1 15 30 ce 6a 70 |.Y.;....Q...0.jp| +00000020 ca 5b fa a5 86 f4 59 79 44 cd 73 20 ad b7 a9 d5 |.[....YyD.s ....| +00000030 c1 aa a6 49 6d a8 36 a9 bf 40 1e 3a d4 2c 21 4a |...Im.6..@.:.,!J| +00000040 5d aa fa 75 80 d4 cb fc be 2b 41 36 cc a8 00 00 |]..u.....+A6....| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 02 59 0b 00 02 55 00 02 52 00 02 |......Y...U..R..| +00000070 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 |O0..K0..........| +00000080 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 |....?.[..0...*.H| +00000090 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 |........0.1.0...| +000000a0 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 |U....Go1.0...U..| +000000b0 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 |..Go Root0...160| +000000c0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| +000000d0 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 |01000000Z0.1.0..| +000000e0 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 |.U....Go1.0...U.| +000000f0 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |...Go0..0...*.H.| +00000100 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +00000110 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab |...F}...'.H..(!.| +00000120 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d |~...]..RE.z6G...| +00000130 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd |.B[.....y.@.Om..| +00000140 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a |+.....g....."8.J| +00000150 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 |.ts+.4......t{.X| +00000160 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c |.la<..A..++$#w[.| +00000170 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 |;.u]. T..c...$..| +00000180 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 |..P....C...ub...| +00000190 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 |R.........0..0..| +000001a0 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 |.U...........0..| +000001b0 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 |.U.%..0...+.....| +000001c0 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 |....+.......0...| +000001d0 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d |U.......0.0...U.| +000001e0 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d |.........CC>I..m| +000001f0 b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 |....`0...U.#..0.| +00000200 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab |..H.IM.~.1......| +00000210 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |n{0...U....0...e| +00000220 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| +00000230 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| +00000240 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed |.0.@+[P.a...SX..| +00000250 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 |.(.X..8....1Z..f| +00000260 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a |=C.-...... d8.$:| +00000270 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 |....}.@ ._...a..| +00000280 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed |v......\.....l..| +00000290 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 |s..Cw.......@.a.| +000002a0 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 |Lr+...F..M...>..| +000002b0 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 |.B...=.`.\!.;...| +000002c0 16 03 03 00 ac 0c 00 00 a8 03 00 1d 20 f1 5a 89 |............ .Z.| +000002d0 7f 84 c0 86 59 fb ca 59 19 b9 7b e8 96 ba 5a fc |....Y..Y..{...Z.| +000002e0 3f 2d b5 0f 2f 0e a3 5c 4a 04 1f 55 1a 08 04 00 |?-../..\J..U....| +000002f0 80 c9 fe 35 a0 c1 cc a5 ea f9 5a 8d 92 b8 e6 cd |...5......Z.....| +00000300 5e 56 70 9c e1 de fe 69 73 b8 3c 97 86 6f e1 2a |^Vp....is.<..o.*| +00000310 e7 f4 12 fb b8 32 fd 5b 09 80 f8 0f ba 59 ed c4 |.....2.[.....Y..| +00000320 86 07 33 e9 57 01 49 f8 cb 2d b4 16 07 e7 78 12 |..3.W.I..-....x.| +00000330 3f e6 b4 d1 21 99 bc d5 cf 93 76 2c 24 18 d1 4d |?...!.....v,$..M| +00000340 c4 6c 3f 1c c6 1a fe 04 5a 3e 7b 57 cd 8b 84 2a |.l?.....Z>{W...*| +00000350 85 0d b0 5f bf a5 8e 74 55 72 dc 2c 5c 60 52 93 |..._...tUr.,\`R.| +00000360 1e 28 9d 36 9f fd da a5 3b 51 96 4e 12 d6 d4 ca |.(.6....;Q.N....| +00000370 d3 16 03 03 00 04 0e 00 00 00 |..........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| +00000030 16 03 03 00 20 e4 80 79 12 42 80 88 c3 66 6b 9b |.... ..y.B...fk.| +00000040 a2 03 59 f9 a3 54 2f 7f 03 de 90 97 1d cb 48 08 |..Y..T/.......H.| +00000050 19 a4 bb 13 64 |....d| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 20 9e 59 22 68 f2 |.......... .Y"h.| +00000010 3c 38 7d cf 43 eb 77 73 94 6c 35 e5 3f 3e 7e 03 |<8}.C.ws.l5.?>~.| +00000020 29 96 e8 c6 f7 5c b4 39 c3 77 61 |)....\.9.wa| +>>> Flow 5 (client to server) +00000000 17 03 03 00 16 ec 02 9b 89 68 8b 8a c6 e1 36 f1 |.........h....6.| +00000010 4a b7 c4 d5 63 0a e8 d9 2c 1f ce |J...c...,..| +>>> Flow 6 (server to client) +00000000 16 03 03 00 14 a8 ab 9e 3c 00 e4 6f b3 26 dd 3a |........<..o.&.:| +00000010 67 ab ee 28 a0 a1 65 83 91 |g..(..e..| +>>> Flow 7 (client to server) +00000000 16 03 03 01 34 d8 7e 6c f6 7b d5 eb 3f 49 63 78 |....4.~l.{..?Icx| +00000010 28 92 1c 8b 67 f2 70 a7 ff e2 91 42 43 d8 90 4e |(...g.p....BC..N| +00000020 01 47 0a 12 bb 9d a2 9a e1 a2 d6 ee 5e 91 8c 4d |.G..........^..M| +00000030 86 8e 29 d4 e0 b3 67 0f c4 5e a9 02 c9 e3 8f f0 |..)...g..^......| +00000040 e6 ea 24 50 da 57 70 35 58 98 81 3e ff b8 8d ea |..$P.Wp5X..>....| +00000050 b3 e0 f0 a1 91 39 69 33 40 bc 0f 67 21 10 67 f4 |.....9i3@..g!.g.| +00000060 93 66 0c f2 66 aa fd a5 2c 8d 2b 38 31 30 b3 50 |.f..f...,.+810.P| +00000070 71 09 de ce 22 59 c3 96 5a 07 84 c0 1f 96 5c e3 |q..."Y..Z.....\.| +00000080 7e 6b c8 7e 3f a5 32 77 20 3c 7b 92 df bc 11 57 |~k.~?.2w <{....W| +00000090 86 e5 a1 03 78 9c 08 ea 49 bc a7 1b 6b fb 47 6d |....x...I...k.Gm| +000000a0 9a 86 14 fa cc 98 e6 9a f8 39 18 57 36 fb 1b ff |.........9.W6...| +000000b0 ae ce 1e 96 20 9d 16 be c6 00 45 51 2a 5a 7b 46 |.... .....EQ*Z{F| +000000c0 9c c9 c1 eb fb fc 37 52 8d b2 22 e3 58 6a d1 fe |......7R..".Xj..| +000000d0 71 55 18 4b ff 92 e1 16 62 29 cb fb d0 0d 94 22 |qU.K....b)....."| +000000e0 13 ee 8e bb 75 2e 1c ae 11 61 3d 37 69 0d 51 b0 |....u....a=7i.Q.| +000000f0 61 e3 7f 94 08 54 3a 49 68 94 b5 64 da ac a9 a4 |a....T:Ih..d....| +00000100 e2 3f 65 ad d7 42 8e 0b 70 5f 4f 6d 6e 0c 27 51 |.?e..B..p_Omn.'Q| +00000110 5a 48 57 71 6e 9b 58 e0 6e 05 40 48 a8 20 36 98 |ZHWqn.X.n.@H. 6.| +00000120 f8 71 a3 ef 2d db 8c ae fa a5 14 d8 1f ff ad 7b |.q..-..........{| +00000130 2a 15 0d fb 3d e8 1b fe 48 |*...=...H| +>>> Flow 8 (server to client) +00000000 16 03 03 00 85 1b 2d 33 65 c9 76 7a 52 fc bf 49 |......-3e.vzR..I| +00000010 7f 21 89 e6 3d 0e 79 55 83 8d 2e de b9 c4 57 08 |.!..=.yU......W.| +00000020 fc 79 f5 32 95 9f 97 fe a9 40 3a e6 c6 ec 2a e2 |.y.2.....@:...*.| +00000030 92 4c cc 48 0b ac bc 66 58 c6 0f 5c b6 62 3d a6 |.L.H...fX..\.b=.| +00000040 86 9f 4c f5 0d 2e 4b 69 cb 7a 62 25 08 04 de 51 |..L...Ki.zb%...Q| +00000050 6c 78 99 ff b2 96 5f 3d 85 60 34 28 2e b4 64 ec |lx...._=.`4(..d.| +00000060 33 d8 c1 09 49 cf 10 ee 19 6c 89 67 28 b1 4d 00 |3...I....l.g(.M.| +00000070 08 43 33 8e 8e b9 bf 25 73 a9 88 5d 0d 97 09 26 |.C3....%s..]...&| +00000080 d3 3d 7f 7e fa da e4 89 16 a5 16 03 03 02 69 3c |.=.~..........i<| +00000090 8b c1 7c 1e a4 46 7d 21 40 ed 6f 45 c2 c0 19 d3 |..|..F}!@.oE....| +000000a0 18 e3 b7 e1 a4 d0 c0 ad 4f cf a7 0f d3 39 ad 0f |........O....9..| +000000b0 6a 70 28 d2 ab 8e 26 93 e1 f4 4d 25 65 1a 7e 44 |jp(...&...M%e.~D| +000000c0 63 30 3c 54 8a 2f 1e 31 f6 d2 e2 26 66 43 91 df |c0...d...V*.h| +000001e0 45 68 13 da c6 eb 5d f2 7b 51 bd b4 8e 25 0d b7 |Eh....].{Q...%..| +000001f0 f0 03 dd 2b cd 93 7f 00 96 ca 75 c1 1b c7 d0 95 |...+......u.....| +00000200 0f 08 52 e0 d6 c9 2c b2 42 b3 0b 0c ed e1 01 e3 |..R...,.B.......| +00000210 7d ef b1 fb 80 76 c8 08 ec 9f c2 13 a5 04 05 fe |}....v..........| +00000220 33 c2 b7 2e 1a 2b 4a 74 f5 f5 92 ad e8 cf f7 76 |3....+Jt.......v| +00000230 3e 7c 69 4b 2d be 9b 08 3b 80 97 66 63 e5 df db |>|iK-...;..fc...| +00000240 1a a4 aa 8a bd 43 2a 65 44 6d f1 e6 60 92 cd 98 |.....C*eDm..`...| +00000250 a9 ac 81 de fb 22 06 f4 ca 90 4a 67 64 3f 25 ab |....."....Jgd?%.| +00000260 3c db 77 cb bc 32 55 bc 2d 48 4e 32 c7 48 d1 2f |<.w..2U.-HN2.H./| +00000270 bf 80 03 7e 27 92 8b 6a 90 35 ab 8e 93 dd 27 c7 |...~'..j.5....'.| +00000280 7d d6 a7 ea d8 1f 6a 43 57 34 d2 a9 7c c3 23 55 |}.....jCW4..|.#U| +00000290 62 5b 98 80 a1 ec 61 53 63 b9 a7 89 85 7e a8 0e |b[....aSc....~..| +000002a0 31 e9 9f 82 e9 1a b3 25 b8 d3 bf 4b f7 da 40 ce |1......%...K..@.| +000002b0 30 95 8f 41 75 9e 99 f5 3f fd 90 57 77 ee ad b7 |0..Au...?..Ww...| +000002c0 56 1e fd a6 d6 98 ae d3 a0 36 8a e0 19 a5 64 63 |V........6....dc| +000002d0 8f 08 d3 e6 2b c3 8a 29 90 8d e0 d7 1d 8b 84 6d |....+..).......m| +000002e0 a8 7a 0d 8b 6d 0e d5 fa bd c1 31 13 c7 39 61 f6 |.z..m.....1..9a.| +000002f0 e8 b3 fd 4d fe 49 a0 2c 16 03 03 00 bc 6d 99 1c |...M.I.,.....m..| +00000300 76 24 e6 f4 79 ac da e5 71 78 32 8d df a7 74 a4 |v$..y...qx2...t.| +00000310 e1 22 43 86 62 7a 99 34 9e c1 c7 82 82 f2 ad c0 |."C.bz.4........| +00000320 cb e5 54 c7 2d 3f bd 00 ba 4f 9f 6b 90 c2 2c bf |..T.-?...O.k..,.| +00000330 d5 d1 20 48 28 f0 bc 21 d4 1f 8d a9 89 82 ce 3d |.. H(..!.......=| +00000340 b2 52 bd 91 57 65 da 07 74 d9 56 b3 54 a7 2c 20 |.R..We..t.V.T., | +00000350 93 5e 79 59 d0 d3 33 95 a9 de f6 a4 48 37 11 10 |.^yY..3.....H7..| +00000360 a7 34 2a 2b 30 a5 24 03 5b d5 63 78 1f ad ca 70 |.4*+0.$.[.cx...p| +00000370 ff f9 22 ca bc 23 ac 4d eb 5a d7 de af 31 72 25 |.."..#.M.Z...1r%| +00000380 84 24 72 b7 b8 c0 a5 7a b6 7e a9 95 42 bb 5e 52 |.$r....z.~..B.^R| +00000390 6c 13 87 c2 b5 17 04 a8 0a 43 d0 b4 96 12 12 4b |l........C.....K| +000003a0 1e d1 0b ab a1 5d 1a bc 48 15 ec 88 e6 7b 57 aa |.....]..H....{W.| +000003b0 da 3b 7f 0b cc 11 93 8f ee 16 03 03 00 4a 35 4e |.;...........J5N| +000003c0 5f 82 88 e9 d5 24 cc 81 3c 0a cc 49 63 13 ea 0c |_....$..<..Ic...| +000003d0 e6 d7 a9 f2 7b 4f 7f d4 c1 d8 71 4e 1d e6 68 e6 |....{O....qN..h.| +000003e0 7e ba 73 f8 23 a5 af 1a 05 35 4c bf 88 8d 8a 90 |~.s.#....5L.....| +000003f0 09 26 34 1d b6 88 92 2d 60 92 52 2c cb 45 02 a4 |.&4....-`.R,.E..| +00000400 78 54 3d a3 44 d3 f9 46 16 03 03 00 14 58 29 f7 |xT=.D..F.....X).| +00000410 44 f4 a0 9f 65 d8 47 1a 01 7e 1b 95 3b 5f 1f 4a |D...e.G..~..;_.J| +00000420 12 |.| +>>> Flow 9 (client to server) +00000000 16 03 03 02 69 ef e7 da 35 77 b6 d6 09 a1 71 43 |....i...5w....qC| +00000010 1c 2b 72 d6 65 ea b4 38 e4 13 c1 85 c3 36 bb f4 |.+r.e..8.....6..| +00000020 ef 1a b8 94 de 11 22 6e b8 28 14 05 88 2a 5d 7a |......"n.(...*]z| +00000030 7c 0a 00 ac 74 ce 4f f8 b3 94 5d 5c a1 aa 3e 20 ||...t.O...]\..> | +00000040 ee 0b e3 50 3d e7 4f 4d ad 5c 9e 6e 8e 75 26 b4 |...P=.OM.\.n.u&.| +00000050 80 e1 85 3f ae 76 6f 95 6e f0 79 98 3d 86 17 9c |...?.vo.n.y.=...| +00000060 e9 d6 35 1d f5 15 ea c5 29 67 15 9d 03 4b 41 9d |..5.....)g...KA.| +00000070 25 b3 ab 3a b0 12 d1 ff fc 9e 25 af ff 8a c8 1c |%..:......%.....| +00000080 4b 4e f0 10 9d d3 98 6e 66 0a 13 82 b9 04 d7 39 |KN.....nf......9| +00000090 b2 2c c5 f9 cf be 4b 8b 8a 28 e9 24 db c8 fe d6 |.,....K..(.$....| +000000a0 a1 b1 3c 9e 19 92 0b 5d 2e c8 5f 56 35 dc 16 46 |..<....].._V5..F| +000000b0 7b a1 d2 43 d9 ee 3f a7 74 c1 4c ed 2a 84 4a ad |{..C..?.t.L.*.J.| +000000c0 76 a2 bc 90 8d 19 06 11 1a 6d b8 e0 3a 8e 0d 33 |v........m..:..3| +000000d0 f2 ad 06 d7 e5 a3 16 8c 14 07 4c 84 8a 47 13 c1 |..........L..G..| +000000e0 b1 cb 81 8b d7 5b fb 04 2b da 3c 7f d1 0f 2b 8b |.....[..+.<...+.| +000000f0 23 ad f5 f1 09 82 24 80 5c bc f7 68 69 c0 90 5f |#.....$.\..hi.._| +00000100 fa 96 b4 9d 51 0e 96 1e 06 2a d1 98 5d 96 95 68 |....Q....*..]..h| +00000110 de df 40 f9 f6 b1 f2 ef a7 c4 0c 05 ee b3 63 8d |..@...........c.| +00000120 3a 1e a2 d8 34 2a b2 99 c3 17 03 60 18 4f 43 21 |:...4*.....`.OC!| +00000130 99 4f 81 c1 11 8e a4 45 79 d8 fa fc b2 9a f8 d0 |.O.....Ey.......| +00000140 95 10 79 38 45 1b 82 42 f0 bb 75 27 6b a2 53 d3 |..y8E..B..u'k.S.| +00000150 e6 dd 2d 43 f5 80 fd 9a 59 ec 07 42 ee b0 9d bd |..-C....Y..B....| +00000160 33 dd 58 c8 57 e8 16 de a4 21 c9 92 51 d2 e5 8b |3.X.W....!..Q...| +00000170 48 f5 cb a8 3a d8 f6 a3 b2 00 90 9e f0 e0 ca c7 |H...:...........| +00000180 fe 79 70 f7 8e 5c 4b 3c 86 c8 cc ca b1 b6 05 e2 |.yp..\K<........| +00000190 90 66 db 85 fc 7c 87 6f e0 44 ed 2a c9 66 b7 de |.f...|.o.D.*.f..| +000001a0 c5 f0 d2 80 dd f2 c2 26 5b 84 cf b0 c4 78 7e 65 |.......&[....x~e| +000001b0 66 d9 d8 c5 fe 97 b9 27 6e 55 11 c0 0b 3e e2 c9 |f......'nU...>..| +000001c0 ce 4d dd 27 28 6f 62 45 70 b3 e4 0c 18 31 f1 b2 |.M.'(obEp....1..| +000001d0 33 8f 7d 34 7c f6 f3 50 d9 a9 6b ec a7 cf c2 7b |3.}4|..P..k....{| +000001e0 36 21 d7 76 68 c1 0e 90 8d af 2e c5 d5 26 c7 c1 |6!.vh........&..| +000001f0 0b 1c 43 85 a6 43 3e 96 67 46 2d 1e 0a c8 90 99 |..C..C>.gF-.....| +00000200 0f 71 cc 60 49 68 2c df 17 68 e4 fa 79 05 50 ac |.q.`Ih,..h..y.P.| +00000210 16 d0 26 1f 7e 58 a2 dc 73 e9 05 8d 92 f6 8c 56 |..&.~X..s......V| +00000220 db 08 0a b7 99 64 f7 5b d0 5f f3 88 f5 02 f5 d0 |.....d.[._......| +00000230 66 55 e3 db f4 d1 c9 d3 c1 f4 ab 8c 5c 39 fd 64 |fU..........\9.d| +00000240 ec cd ab 63 da 7b 3e 64 1a b4 c3 d9 79 bd 92 e3 |...c.{>d....y...| +00000250 97 68 a4 83 b5 f1 fa f5 05 04 84 39 e9 82 a6 84 |.h.........9....| +00000260 e5 a0 6f a2 6d ea 6b ab 4c f8 a5 87 9c 9c 16 03 |..o.m.k.L.......| +00000270 03 00 35 08 0b 50 f9 90 d3 e9 58 e5 5b df a1 99 |..5..P....X.[...| +00000280 89 ea 0b 1a f1 4d e3 fd a6 79 2c 61 ac 6f da 7c |.....M...y,a.o.|| +00000290 2a 78 e1 38 05 35 2e 8b db eb 25 fd eb 2f d7 a3 |*x.8.5....%../..| +000002a0 27 9d 27 f2 b3 ff 20 8a 16 03 03 00 98 95 42 7e |'.'... .......B~| +000002b0 d5 86 40 42 dc 93 fe 80 ef 70 cc fb 2f b1 51 bd |..@B.....p../.Q.| +000002c0 ca 5f 1e 0d a0 3f c6 e0 c9 69 0e d4 dc 18 25 52 |._...?...i....%R| +000002d0 5c c2 8c 37 f6 a8 e6 4d 48 27 81 4d 7a f3 49 5c |\..7...MH'.Mz.I\| +000002e0 92 92 68 a9 e0 dc d6 c5 b5 ea 99 5c 51 df 93 a1 |..h........\Q...| +000002f0 36 2d 65 a8 cb ca 72 76 53 92 7d c7 81 5f 19 2c |6-e...rvS.}.._.,| +00000300 3e 83 29 16 41 65 4f 81 d7 3f 5c 15 f0 36 d9 75 |>.).AeO..?\..6.u| +00000310 a7 c8 52 6f 5b b6 98 46 5e 39 31 83 1c 99 3f f9 |..Ro[..F^91...?.| +00000320 9e 28 d7 94 ae a7 b4 f7 c9 ce 5b 74 2f 88 9e fd |.(........[t/...| +00000330 3c 1c 1e eb f4 b3 39 65 39 07 14 8e 3e 95 87 b2 |<.....9e9...>...| +00000340 b8 4c e8 7d 3b 14 03 03 00 11 cc eb 21 2a 7c 9a |.L.};.......!*|.| +00000350 5c 35 9f 35 e3 09 dd f8 7a 4f 43 16 03 03 00 20 |\5.5....zOC.... | +00000360 0b ff 00 c0 96 43 18 d9 9d ad 51 55 44 40 11 2f |.....C....QUD@./| +00000370 cd 1c bd ae ea 0a c9 eb de 57 95 c2 81 63 79 4c |.........W...cyL| +>>> Flow 10 (server to client) +00000000 14 03 03 00 11 d8 35 87 10 ce 65 af f6 19 4d 34 |......5...e...M4| +00000010 6c 01 68 91 74 2d 16 03 03 00 20 70 df d4 bd c1 |l.h.t-.... p....| +00000020 29 ac f3 f8 70 a4 5b ca cb 7e 20 d4 1b 7e 2f 4b |)...p.[..~ ..~/K| +00000030 79 0b ea a3 ff 41 4a 5c ff 5b 16 17 03 03 00 19 |y....AJ\.[......| +00000040 4b 34 71 05 b5 b8 40 44 d4 2a ec f1 dc e1 ee 6a |K4q...@D.*.....j| +00000050 4f e6 c2 bf 44 98 0c 25 9b 16 03 03 00 14 98 20 |O...D..%....... | +00000060 3c 7a 9f ba ba fd 6e 1f a1 b9 4b d5 b9 d0 4c 75 |>> Flow 11 (client to server) +00000000 16 03 03 01 34 82 8c 60 3d d0 8e d7 cd d6 37 37 |....4..`=.....77| +00000010 d8 18 6f b1 8c b5 81 f3 0a bf 4f ca 6d 04 9e 6a |..o.......O.m..j| +00000020 4f ee bb a0 6c 40 40 96 96 94 b7 44 3d 56 1b 86 |O...l@@....D=V..| +00000030 eb 52 55 5d 4d da eb 99 85 fb 28 b6 20 33 1c ec |.RU]M.....(. 3..| +00000040 95 d9 23 1d 69 fa 40 8f 3f 2b ae 5f 08 c9 eb 71 |..#.i.@.?+._...q| +00000050 24 b8 4f b0 20 9f db 3d cb d1 9e d7 7f f0 2e e9 |$.O. ..=........| +00000060 c0 b5 81 ea 67 3f 70 cc 51 db 8c 00 6b 30 87 61 |....g?p.Q...k0.a| +00000070 aa 75 dc 1e bc 19 33 82 c2 d4 6e 47 9c c8 ce 60 |.u....3...nG...`| +00000080 01 73 f2 a9 73 c4 49 da 2e 69 4e 38 66 d8 ab 05 |.s..s.I..iN8f...| +00000090 39 6b 42 13 43 22 26 ad bd d7 78 f4 c6 81 b4 8a |9kB.C"&...x.....| +000000a0 73 52 6c b8 02 4c 08 fd 7c 79 3b 04 73 61 66 5b |sRl..L..|y;.saf[| +000000b0 59 98 50 7d d0 25 89 39 70 b0 e2 b4 3f c6 f1 ce |Y.P}.%.9p...?...| +000000c0 83 4b 4a a4 88 7b c5 59 c7 9e 3a e0 a9 d5 95 57 |.KJ..{.Y..:....W| +000000d0 6f f0 ce 33 c6 58 69 30 04 8b 98 7d 80 74 35 2a |o..3.Xi0...}.t5*| +000000e0 a5 40 fe 3b e8 9b c7 2e 30 8c 61 9d e9 f5 56 b2 |.@.;....0.a...V.| +000000f0 b7 a5 cd 9b a7 91 87 05 ee da e1 5e c7 00 c3 ae |...........^....| +00000100 1d c0 71 5d 02 03 15 e6 1b bc a5 da 04 78 89 c6 |..q].........x..| +00000110 aa 3e 97 31 00 ff e9 12 23 9e 86 74 45 7b 8a db |.>.1....#..tE{..| +00000120 d8 c8 c0 8b 00 72 ee d8 a9 64 b8 1b 48 77 98 b9 |.....r...d..Hw..| +00000130 20 61 b8 23 17 b5 65 7c fb | a.#..e|.| +>>> Flow 12 (server to client) +00000000 16 03 03 00 85 93 93 97 db ec 52 74 ce 78 ca e6 |..........Rt.x..| +00000010 95 19 ac 68 2c 81 ad 6b c3 6d d5 f7 84 a1 00 d0 |...h,..k.m......| +00000020 15 4c ae 2d 10 6a 07 d3 82 af af f8 d9 5d 9d 65 |.L.-.j.......].e| +00000030 8d c9 1e 8c 61 3e b3 67 71 89 41 7e 94 1e 4a 27 |....a>.gq.A~..J'| +00000040 73 53 83 d4 70 44 9a 4f 8d e7 62 af 9b 71 9e 83 |sS..pD.O..b..q..| +00000050 72 9a a1 e2 03 47 5f c3 11 4f 56 b9 6f 02 b5 b8 |r....G_..OV.o...| +00000060 8b 4a cb 99 ed 62 58 45 2d 0f f1 25 ce e9 de 7d |.J...bXE-..%...}| +00000070 3f 17 a8 35 d5 73 06 6e d6 bc 77 2a 82 27 d7 92 |?..5.s.n..w*.'..| +00000080 91 67 68 07 52 4b ed a0 3c 95 16 03 03 02 69 11 |.gh.RK..<.....i.| +00000090 73 93 d5 ad 00 17 11 3b 83 81 68 6d 3a 8a 02 1b |s......;..hm:...| +000000a0 90 df 84 f6 2b 4a b8 98 cf 50 0d dd 29 22 9d 58 |....+J...P..)".X| +000000b0 ea 7b 2c 30 2d e7 e2 d1 ae ad 00 9e 01 f6 ef 96 |.{,0-...........| +000000c0 ae a4 48 58 29 63 1d 2c 19 f3 c2 49 6f cf c9 7b |..HX)c.,...Io..{| +000000d0 e3 ca 5c e7 30 a0 b5 72 a9 3d 61 a2 0f 96 e4 d6 |..\.0..r.=a.....| +000000e0 8f 93 66 f1 de 24 88 14 9f 8b 14 9a b5 94 f7 70 |..f..$.........p| +000000f0 79 e4 94 68 b7 e0 f1 8e d0 1b 56 da d0 ce 90 b2 |y..h......V.....| +00000100 13 b3 4b b5 20 99 77 4a a4 83 47 4e 1b 1f db 35 |..K. .wJ..GN...5| +00000110 96 16 f0 d8 2b 7e 18 bf 0c b7 a3 da 44 fe 4c 96 |....+~......D.L.| +00000120 86 06 52 81 f9 a1 f4 ab 43 6d a3 fd 50 f6 83 08 |..R.....Cm..P...| +00000130 ba b5 d5 15 55 16 aa 84 95 77 1d 9e cd d6 53 d0 |....U....w....S.| +00000140 d3 c7 1c 9a 12 4d 8d 7a b5 0b 02 34 3f cf b5 0f |.....M.z...4?...| +00000150 98 56 cc 6e 15 ef 60 88 e0 71 2e 47 46 ce 19 11 |.V.n..`..q.GF...| +00000160 81 21 fe c6 80 86 d7 be d9 a7 6f a1 8c 8d ff ba |.!........o.....| +00000170 fb 8b 8b 8f 35 95 03 cb 10 e6 f5 71 18 d5 3c e0 |....5......q..<.| +00000180 60 e7 a2 47 36 41 a0 a3 c4 a3 c1 23 6c da 55 6a |`..G6A.....#l.Uj| +00000190 5f ef cd 58 e7 5d d3 cf 50 7b 3d b5 c6 7c 73 d9 |_..X.]..P{=..|s.| +000001a0 ce c3 ae 6a 46 4a 9a e6 10 57 53 b3 6c e5 ec 9d |...jFJ...WS.l...| +000001b0 f0 25 3c a4 a6 f0 42 1a 1e 8c 2b 40 79 e5 51 84 |.%<...B...+@y.Q.| +000001c0 79 6b c5 8a 3d 25 11 38 97 ca 15 11 e7 51 74 29 |yk..=%.8.....Qt)| +000001d0 66 9e 4d 4d 50 6a ec 1d 94 6b 4d c9 e9 a7 f8 4e |f.MMPj...kM....N| +000001e0 5b c3 06 74 ba 1d a1 79 3c 24 94 c9 3b b0 b1 16 |[..t...y<$..;...| +000001f0 fe 42 31 fe d0 4b e4 51 e6 06 63 89 2d 3b 56 6a |.B1..K.Q..c.-;Vj| +00000200 cf 89 4c 45 49 fd 10 58 9b 6b 4b 35 eb d8 c9 9d |..LEI..X.kK5....| +00000210 c0 31 b6 3e 33 da 7e 87 39 e3 c0 6a f8 7f bd 9a |.1.>3.~.9..j....| +00000220 26 4f 42 51 86 40 fb f7 fb cc 50 80 b6 0a 63 f4 |&OBQ.@....P...c.| +00000230 41 62 68 c0 b8 99 7d 8e ab e1 8a 15 92 f2 35 a4 |Abh...}.......5.| +00000240 cc 0e e7 9e 74 2d c1 b4 44 be 25 10 92 02 4f e3 |....t-..D.%...O.| +00000250 e7 ea c4 77 83 18 62 36 ba 9c 77 a6 d4 c1 6f 66 |...w..b6..w...of| +00000260 fc 07 4b 1a 00 98 a4 10 5e bc d5 93 07 e7 0c e3 |..K.....^.......| +00000270 34 05 32 23 c7 60 22 a8 52 fa 6e de 3f f9 c6 cc |4.2#.`".R.n.?...| +00000280 c2 54 08 d4 2a 98 39 20 09 f4 1d 8e d5 18 77 5a |.T..*.9 ......wZ| +00000290 f0 f4 08 a4 66 a7 8e fe f5 25 50 16 ca 4a 8d f0 |....f....%P..J..| +000002a0 b4 9f f1 37 e6 9b db 24 25 d0 a0 57 06 74 e2 14 |...7...$%..W.t..| +000002b0 46 51 e9 9c 03 f0 e0 16 17 d0 c9 54 54 29 e6 04 |FQ.........TT)..| +000002c0 9a c3 47 93 69 78 1a de ca f1 d4 b1 52 ff c0 5c |..G.ix......R..\| +000002d0 9f 5f 16 a9 35 01 f9 18 47 7b ee 06 f4 f3 3a 1d |._..5...G{....:.| +000002e0 94 b9 d5 2c 29 a0 80 85 b0 31 55 37 63 bc a6 e6 |...,)....1U7c...| +000002f0 67 66 21 5f eb 1c 17 15 16 03 03 00 bc 93 4b d6 |gf!_..........K.| +00000300 07 b0 12 ca 98 9f 52 b8 14 c3 6e d4 3b f2 74 e4 |......R...n.;.t.| +00000310 f5 6f 51 40 04 cd 1a 5f 69 fb 3d 68 2b 4e 09 df |.oQ@..._i.=h+N..| +00000320 c8 c9 6f c2 87 ae b6 f9 14 6a 41 fa 59 08 0b b0 |..o......jA.Y...| +00000330 d9 0b d0 61 fd 64 c6 52 3e 40 f2 96 75 b0 82 7a |...a.d.R>@..u..z| +00000340 8e 68 11 d2 bc 22 a0 bc 30 d8 a6 1a 88 26 00 d5 |.h..."..0....&..| +00000350 b5 26 49 c2 5d f3 19 c5 c0 9d 75 c3 f4 3e 95 85 |.&I.].....u..>..| +00000360 d0 8b de 31 79 b5 5c 27 6e 99 ab 50 fe ef 3a 07 |...1y.\'n..P..:.| +00000370 a0 a9 ce b7 4b 29 6b 93 42 6d db 34 6b 14 03 a9 |....K)k.Bm.4k...| +00000380 a8 1f c2 57 65 64 c3 95 ff 2a f8 39 de c3 36 f4 |...Wed...*.9..6.| +00000390 dd 77 b0 cf 86 be c4 9c 1d d5 ea 88 3c 8c ed 81 |.w..........<...| +000003a0 51 fc a9 80 78 bc 59 7d d1 e4 48 d5 d6 07 88 e1 |Q...x.Y}..H.....| +000003b0 d7 85 80 81 3a 35 9c 57 21 16 03 03 00 14 d9 b1 |....:5.W!.......| +000003c0 fb 95 82 67 c4 35 92 cd 47 cb 7b 0f 63 1a e0 32 |...g.5..G.{.c..2| +000003d0 43 75 |Cu| +>>> Flow 13 (client to server) +00000000 16 03 03 00 35 36 32 d0 64 c8 ba 33 1d 4f 31 73 |....562.d..3.O1s| +00000010 68 35 f2 76 0c b1 52 12 f5 4b 8a ea 74 0a 7f c2 |h5.v..R..K..t...| +00000020 a4 90 75 1f 24 0a 76 77 1f 01 15 9d 59 fa 16 56 |..u.$.vw....Y..V| +00000030 cc fd f9 08 74 76 31 cc f4 4c 14 03 03 00 11 c0 |....tv1..L......| +00000040 12 9b 35 78 94 a3 4e c3 b2 30 aa c7 fa 44 20 e6 |..5x..N..0...D .| +00000050 16 03 03 00 20 c6 a5 79 48 7b c3 2b 2d 6a 73 0a |.... ..yH{.+-js.| +00000060 83 a9 2b a7 ba 90 ea 6f b5 c2 c1 13 d7 7a 86 37 |..+....o.....z.7| +00000070 5a 24 8e f9 b3 |Z$...| +>>> Flow 14 (server to client) +00000000 14 03 03 00 11 c4 0e 59 d8 5e f6 5b 1d e6 20 7b |.......Y.^.[.. {| +00000010 45 4f 89 cd 2b a9 16 03 03 00 20 58 ff 80 6c f2 |EO..+..... X..l.| +00000020 fd 94 e7 66 b3 6d e3 37 57 8a 8c 35 98 4e bb c3 |...f.m.7W..5.N..| +00000030 42 87 32 b7 3b 6f ee 0f f1 7d 08 17 03 03 00 19 |B.2.;o...}......| +00000040 8a f6 02 17 4e 8a 1e 2b db 44 24 d4 aa c6 d4 af |....N..+.D$.....| +00000050 ef 5a a3 17 ba 77 f4 54 6e |.Z...w.Tn| +>>> Flow 15 (client to server) +00000000 15 03 03 00 12 84 3f 11 0b 00 bd 12 5e be 74 4d |......?.....^.tM| +00000010 04 e4 44 b2 01 73 66 |..D..sf| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-RenegotiateTwiceRejected b/go/src/crypto/tls/testdata/Client-TLSv12-RenegotiateTwiceRejected new file mode 100644 index 0000000000000000000000000000000000000000..62b6831a47b7a58cc35cf123a8e161d699137188 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-RenegotiateTwiceRejected @@ -0,0 +1,252 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 a1 1a ae 12 c9 |....]...Y.......| +00000010 55 34 c9 23 81 cb 4f b0 d8 35 97 8e d5 b7 ac 67 |U4.#..O..5.....g| +00000020 e1 9c fd ec 35 61 48 7b d5 c8 8b 20 e1 e9 61 af |....5aH{... ..a.| +00000030 0b 5c 69 7b cb f9 7a ee 73 31 20 07 c3 b9 27 47 |.\i{..z.s1 ...'G| +00000040 07 e1 c0 34 7c c5 8f 31 ac 9d cd 8c cc a8 00 00 |...4|..1........| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 02 59 0b 00 02 55 00 02 52 00 02 |......Y...U..R..| +00000070 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 |O0..K0..........| +00000080 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 |....?.[..0...*.H| +00000090 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 |........0.1.0...| +000000a0 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 |U....Go1.0...U..| +000000b0 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 |..Go Root0...160| +000000c0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| +000000d0 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 |01000000Z0.1.0..| +000000e0 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 |.U....Go1.0...U.| +000000f0 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |...Go0..0...*.H.| +00000100 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +00000110 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab |...F}...'.H..(!.| +00000120 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d |~...]..RE.z6G...| +00000130 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd |.B[.....y.@.Om..| +00000140 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a |+.....g....."8.J| +00000150 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 |.ts+.4......t{.X| +00000160 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c |.la<..A..++$#w[.| +00000170 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 |;.u]. T..c...$..| +00000180 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 |..P....C...ub...| +00000190 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 |R.........0..0..| +000001a0 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 |.U...........0..| +000001b0 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 |.U.%..0...+.....| +000001c0 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 |....+.......0...| +000001d0 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d |U.......0.0...U.| +000001e0 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d |.........CC>I..m| +000001f0 b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 |....`0...U.#..0.| +00000200 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab |..H.IM.~.1......| +00000210 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |n{0...U....0...e| +00000220 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| +00000230 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| +00000240 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed |.0.@+[P.a...SX..| +00000250 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 |.(.X..8....1Z..f| +00000260 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a |=C.-...... d8.$:| +00000270 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 |....}.@ ._...a..| +00000280 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed |v......\.....l..| +00000290 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 |s..Cw.......@.a.| +000002a0 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 |Lr+...F..M...>..| +000002b0 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 |.B...=.`.\!.;...| +000002c0 16 03 03 00 ac 0c 00 00 a8 03 00 1d 20 95 6f d7 |............ .o.| +000002d0 37 b9 49 ff 98 39 6f 25 c5 c0 e0 89 61 23 2d 22 |7.I..9o%....a#-"| +000002e0 5b 86 d6 7f a1 19 07 f7 12 4d 01 e6 1b 08 04 00 |[........M......| +000002f0 80 ca fd 6e 23 09 33 a7 0c 9b 4b 2b 38 37 a0 32 |...n#.3...K+87.2| +00000300 21 a4 e4 fe 56 b6 4e c6 d1 e6 86 fa d9 13 b4 f3 |!...V.N.........| +00000310 72 bf 31 ef c3 33 e9 99 a1 bf a4 e5 10 46 44 7d |r.1..3.......FD}| +00000320 cb ea 38 99 d0 bc 1f 16 81 fb ad 09 7e 9e 54 99 |..8.........~.T.| +00000330 40 c2 44 65 94 53 88 c3 28 db 7f 1b fa 52 f1 63 |@.De.S..(....R.c| +00000340 9a e9 f2 43 7f 19 2b 3e 02 3d 53 ed a1 f9 9a ff |...C..+>.=S.....| +00000350 aa af 8d 4c ab bf d2 7a b4 ea 1e f9 22 fe ee 7e |...L...z...."..~| +00000360 a1 3e dc d4 f1 76 d1 4e 7b 1b 84 f6 b3 a7 f7 a9 |.>...v.N{.......| +00000370 37 16 03 03 00 04 0e 00 00 00 |7.........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| +00000030 16 03 03 00 20 d0 64 37 7c 81 1c cd 86 e7 ab 97 |.... .d7|.......| +00000040 25 1d c5 ee bd 5a 49 44 69 c8 3e db 37 6a dc 9a |%....ZIDi.>.7j..| +00000050 fd e2 5e 82 16 |..^..| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 20 18 71 b3 67 a3 |.......... .q.g.| +00000010 98 36 20 8f e4 17 30 e4 73 de 91 88 ef f7 f3 8a |.6 ...0.s.......| +00000020 c6 0e 5e b2 1f e2 e6 5a 52 f6 72 |..^....ZR.r| +>>> Flow 5 (client to server) +00000000 17 03 03 00 16 20 c3 2a be 39 d2 7c 1c 83 30 cc |..... .*.9.|..0.| +00000010 7b cd 44 ae 2b e8 d4 19 50 69 81 |{.D.+...Pi.| +>>> Flow 6 (server to client) +00000000 16 03 03 00 14 96 2f 3a b5 b5 56 c9 d5 38 c0 1a |....../:..V..8..| +00000010 eb 35 c5 b9 dd 1c 5b e6 50 |.5....[.P| +>>> Flow 7 (client to server) +00000000 16 03 03 01 34 ae 4f 4c 78 20 df 3b 9e f3 c1 82 |....4.OLx .;....| +00000010 37 6b ca fc 48 2a 2c 9a 71 7e c3 20 a0 e8 f7 d5 |7k..H*,.q~. ....| +00000020 76 af 11 81 dd 69 e9 93 58 df 58 8c fb f1 82 ad |v....i..X.X.....| +00000030 35 0e fb 6c a9 58 7a 5d 79 38 cb d7 77 1f 93 34 |5..l.Xz]y8..w..4| +00000040 7e bb 88 61 9e 19 1a 98 bb 6f ad 78 2c a6 73 ab |~..a.....o.x,.s.| +00000050 a4 7e 4b d7 75 69 7b 92 47 68 3d 7b 40 03 60 59 |.~K.ui{.Gh={@.`Y| +00000060 2e 04 bc cd fc ca 45 2c 2c f7 e5 0a 66 49 0b 86 |......E,,...fI..| +00000070 c5 ec 86 e6 ae c9 39 4b 05 1f 21 db 78 8d 51 e6 |......9K..!.x.Q.| +00000080 5d fe be 6a 1d 85 e1 15 23 56 86 4c ba 09 bf 7b |]..j....#V.L...{| +00000090 9e 36 e9 7a 8f 06 af 10 7b 4a 4b af 58 db f9 4e |.6.z....{JK.X..N| +000000a0 13 36 61 f4 e3 a9 c6 37 11 d4 ed 9e 6a c7 bf 16 |.6a....7....j...| +000000b0 ea a4 ae 01 99 4a b5 3e 9c ca 6c ce e8 a2 3d b8 |.....J.>..l...=.| +000000c0 81 ef 60 7b 51 79 81 22 87 49 ad ab fb c6 f6 48 |..`{Qy.".I.....H| +000000d0 c0 ba e0 2b d7 90 42 f7 a8 0d f0 cf 2c 7a 55 7d |...+..B.....,zU}| +000000e0 be 65 a6 67 bd 96 7f 01 6f ce db f6 50 2f 45 b6 |.e.g....o...P/E.| +000000f0 6f cc 74 ba 6f 57 3b e3 a4 08 34 92 e6 ac e4 99 |o.t.oW;...4.....| +00000100 2e b6 9b 29 4d 26 dd 7f 5c f5 1b 7e 5e 5c fd f7 |...)M&..\..~^\..| +00000110 d4 da 81 47 51 8c 3f 94 e1 95 5b de b9 6e 4a 76 |...GQ.?...[..nJv| +00000120 bc 59 6a bb 1f 1c 79 02 93 2e 21 b3 6d be ae b4 |.Yj...y...!.m...| +00000130 95 6b 8a 48 cb 84 fb ab b3 |.k.H.....| +>>> Flow 8 (server to client) +00000000 16 03 03 00 85 60 c6 c2 9b 61 f1 1f 81 6f f1 0b |.....`...a...o..| +00000010 87 2d f2 93 a6 4e 7e 74 c2 61 cf 1d a1 00 32 8f |.-...N~t.a....2.| +00000020 f7 3d 93 da 91 cc 5b d5 21 c6 ba 4c 1b eb 81 a9 |.=....[.!..L....| +00000030 a1 2a fe 88 6d 3e 1d 1f 57 22 9c ff fe 6c 85 ca |.*..m>..W"...l..| +00000040 0b 13 f3 9f 63 55 b9 49 61 2b dd 5e 2b e1 fd ec |....cU.Ia+.^+...| +00000050 1d 0d 94 06 42 dc 2c 6f 88 22 cb 30 4f 66 6f 16 |....B.,o.".0Ofo.| +00000060 3a a0 c0 23 12 82 46 38 70 68 e5 12 b9 16 12 e7 |:..#..F8ph......| +00000070 38 6b 50 64 55 f0 47 a9 e0 cd 19 01 8e d5 12 96 |8kPdU.G.........| +00000080 09 db 5c 52 4b db 9b 26 43 37 16 03 03 02 69 41 |..\RK..&C7....iA| +00000090 52 a8 ca e5 8f e0 33 4b 52 93 74 ef bb 42 20 d1 |R.....3KR.t..B .| +000000a0 cc 24 79 ce df 51 90 e0 19 b1 11 fb e9 ef b5 e4 |.$y..Q..........| +000000b0 ae da 72 e1 35 a8 41 88 a8 4b 68 d2 50 58 ba ef |..r.5.A..Kh.PX..| +000000c0 b0 1e 20 26 a3 c2 86 a7 68 60 84 2d 23 14 38 21 |.. &....h`.-#.8!| +000000d0 12 60 05 2f 79 9e c0 08 4c 87 a7 41 b3 d3 84 9a |.`./y...L..A....| +000000e0 f1 45 bd 2d ff 7c b5 bd c4 3a b1 48 10 9a d8 cf |.E.-.|...:.H....| +000000f0 ce 58 47 75 e1 6d 01 b6 18 bd 78 6b 86 a1 f2 1b |.XGu.m....xk....| +00000100 c8 03 4d 0a ce ce d4 68 8f 9a 54 1e 83 83 89 2c |..M....h..T....,| +00000110 36 a2 3a b5 95 09 de c5 8e 8c d0 a4 95 59 7e d6 |6.:..........Y~.| +00000120 f8 5f 96 e9 c5 cb 9b 6c c0 b7 55 15 b3 b4 d0 ea |._.....l..U.....| +00000130 bf 11 1c 89 1a 5c f2 09 74 9a 43 73 4f 6f 00 33 |.....\..t.CsOo.3| +00000140 b9 e0 6a 99 b9 e0 02 86 dd cd 07 68 72 63 0d 8b |..j........hrc..| +00000150 e0 e8 12 68 4d f6 3b dc 0a 93 82 48 ce f7 96 ba |...hM.;....H....| +00000160 7f c5 90 07 45 66 3d 47 b8 8d 5f 0d 41 8d 88 76 |....Ef=G.._.A..v| +00000170 bf ce 9c 2a 2e 25 7c 47 f6 96 73 0b 43 42 73 2c |...*.%|G..s.CBs,| +00000180 d5 b3 bc 82 c5 19 2f 5d c4 69 21 7d c8 7b 1b b8 |....../].i!}.{..| +00000190 b6 d1 37 89 92 a6 b7 44 cd e6 23 1f a1 03 08 05 |..7....D..#.....| +000001a0 1e cf 54 78 e9 af 04 bc e3 94 aa 12 ce 67 62 ce |..Tx.........gb.| +000001b0 f4 2f ef f7 2b 8d 65 06 08 07 2f c6 fa b2 d2 c8 |./..+.e.../.....| +000001c0 f1 d7 c4 1f cc 8b 0e b8 f2 b2 1d fb 09 19 5a b0 |..............Z.| +000001d0 a3 23 6e 05 20 9a 28 39 16 05 0e c4 7d d0 59 f5 |.#n. .(9....}.Y.| +000001e0 9a de 88 da a2 c0 fb 7b 84 19 05 7d 80 6f 9a 03 |.......{...}.o..| +000001f0 0a f8 5f 97 a2 b4 c0 d9 6d 79 f5 c0 51 d3 63 d2 |.._.....my..Q.c.| +00000200 b8 ee a6 b0 76 59 7f 92 6d ad 3c bb 96 34 ac 0c |....vY..m.<..4..| +00000210 81 61 c5 07 7e 65 f1 c3 dd 3e 69 ad ee 7f 56 8d |.a..~e...>i...V.| +00000220 d7 92 48 5c 23 be 94 44 2e 8a 13 76 ce a3 cb d2 |..H\#..D...v....| +00000230 86 d5 eb 2c 48 55 fd 31 c1 94 08 55 69 8c 20 cd |...,HU.1...Ui. .| +00000240 65 fa 47 5e 8e 7f 04 a4 a0 54 c3 cf 4e b5 a0 61 |e.G^.....T..N..a| +00000250 3a 66 fd 21 5d 42 ab b3 46 d8 2a 64 69 1a d3 da |:f.!]B..F.*di...| +00000260 41 65 2c 36 50 f1 79 c3 83 01 d2 87 41 d9 10 1d |Ae,6P.y.....A...| +00000270 75 a2 74 de 48 e3 9c 9e c8 96 58 45 43 82 dd d6 |u.t.H.....XEC...| +00000280 e1 46 66 2f 13 e4 1d fe 81 8f ea 3d 6d 83 d7 97 |.Ff/.......=m...| +00000290 4d ed c6 67 0e 4b e5 a1 ca 2b 24 c5 b1 24 af df |M..g.K...+$..$..| +000002a0 7a 0e 44 b9 c1 5f 07 43 c1 6f 94 d3 22 fb 14 df |z.D.._.C.o.."...| +000002b0 a3 23 38 c9 91 ff 12 41 fa 47 f7 83 fb b6 ca ea |.#8....A.G......| +000002c0 19 01 22 8a ba d7 86 c5 d2 82 2f ac f5 4c a4 e9 |.."......./..L..| +000002d0 90 f5 52 c7 88 96 ae f3 0a 91 53 1c db bf 4b a9 |..R.......S...K.| +000002e0 42 43 0d 2d cc f2 6a 79 1e 9a 3a bd 55 da 5d 6c |BC.-..jy..:.U.]l| +000002f0 a3 84 79 76 7d 96 62 5e 16 03 03 00 bc 51 62 b9 |..yv}.b^.....Qb.| +00000300 26 c9 f7 dd 55 83 aa cd 90 5d e9 9a 29 92 8c 6f |&...U....]..)..o| +00000310 b1 df 4c b7 be 75 89 2b dc b1 ad ae 01 38 27 0f |..L..u.+.....8'.| +00000320 36 43 0b 04 69 6b a4 3a 52 b5 4f df 50 1d 04 ee |6C..ik.:R.O.P...| +00000330 4a f1 a0 6c 06 6f 24 2a f3 dc 7c a4 96 12 e2 83 |J..l.o$*..|.....| +00000340 9c d8 2d 63 2e 3b 1c 73 e6 32 ce 15 76 01 9a a9 |..-c.;.s.2..v...| +00000350 3b a7 dc aa 40 82 4d 5a 68 24 78 4e fe 64 db a4 |;...@.MZh$xN.d..| +00000360 ff 87 6d 90 bc d9 ec 0d ed 8b 54 12 bd 74 16 1d |..m.......T..t..| +00000370 2c 30 57 8f 67 56 7c 09 e6 b1 12 f8 4a 9f e3 79 |,0W.gV|.....J..y| +00000380 c1 8b fa 91 f7 1a 29 bd a3 1f 59 59 16 26 04 10 |......)...YY.&..| +00000390 e4 19 c9 91 a6 b3 c5 b5 df a3 b0 11 a5 87 29 4e |..............)N| +000003a0 5b 9f 96 cf 88 19 9e ae b4 e6 63 19 6d c5 ee 7a |[.........c.m..z| +000003b0 c9 38 2d 0a fd f6 3b f8 f5 16 03 03 00 4a f5 3f |.8-...;......J.?| +000003c0 ef a3 f8 86 1b f5 ce 8e 48 f2 d0 cb 75 d6 80 b2 |........H...u...| +000003d0 78 ef bc 77 a6 aa 91 cd 88 39 62 f8 42 78 7c f3 |x..w.....9b.Bx|.| +000003e0 8b c7 86 71 9c a5 9f 1c 5f 40 25 e9 c6 69 82 a1 |...q...._@%..i..| +000003f0 45 ee d1 9d f7 9c a0 b9 34 b8 82 72 f9 f8 1d fb |E.......4..r....| +00000400 a5 74 b5 a5 68 04 82 c4 16 03 03 00 14 07 9c 37 |.t..h..........7| +00000410 77 ad 83 27 66 2c 3a ba 26 22 2f 72 b4 d1 c8 c1 |w..'f,:.&"/r....| +00000420 06 |.| +>>> Flow 9 (client to server) +00000000 16 03 03 02 69 70 78 66 7a 28 3b 50 a6 21 b2 cc |....ipxfz(;P.!..| +00000010 52 a6 74 f7 29 8a dc fd c0 1c 79 d0 20 23 d0 74 |R.t.).....y. #.t| +00000020 d3 16 a6 4c 6d df 6e 32 2e 69 46 dd 8d 22 9e 8e |...Lm.n2.iF.."..| +00000030 cb 75 44 75 7e 24 69 ed ce cf 5c 4b a9 a2 b5 d0 |.uDu~$i...\K....| +00000040 48 bf 08 d8 1d 16 d9 9f 6d b4 24 ee f1 f3 58 79 |H.......m.$...Xy| +00000050 4c 19 4c 99 7f 01 a8 80 b1 3c 4e 55 d1 64 75 89 |L.L......?.Pjad*Q...| +00000120 01 2e 5a 1c 8b 12 58 c5 32 e1 3f ea 0b ac 4c 3b |..Z...X.2.?...L;| +00000130 1d 97 11 e9 92 6d 52 f0 1e f7 5a f8 71 5f f5 a6 |.....mR...Z.q_..| +00000140 6b aa 30 4f 85 41 c6 49 83 37 3a 72 86 1a be 7a |k.0O.A.I.7:r...z| +00000150 1d bc d6 ad 67 6c 95 42 5d 74 10 8e ac 4b 8d b3 |....gl.B]t...K..| +00000160 6e 3d 9c 8f 08 71 be ce ce aa 64 26 62 2a 58 8c |n=...q....d&b*X.| +00000170 e4 7b 75 e9 61 90 38 b2 c2 a0 8d c7 a9 11 cf 5b |.{u.a.8........[| +00000180 30 a7 33 3b 2b c2 fd 2a 6b db 3d cf 35 6c 23 28 |0.3;+..*k.=.5l#(| +00000190 14 e4 7b 10 50 e8 00 9f af 60 69 cf a9 d9 93 f3 |..{.P....`i.....| +000001a0 8f 7d 39 49 97 5b 92 4a 35 2a 6c 68 3b 48 25 77 |.}9I.[.J5*lh;H%w| +000001b0 6e d0 57 76 c4 94 83 10 e3 3d 00 e8 b9 fe da d9 |n.Wv.....=......| +000001c0 a5 56 22 61 e0 f4 33 dd c8 dd 4d 2f 39 51 35 12 |.V"a..3...M/9Q5.| +000001d0 9a cb dd e1 03 d3 27 9f 41 71 83 5c c7 6c a3 38 |......'.Aq.\.l.8| +000001e0 9f db 39 1c 2a f6 4b e0 48 44 61 1b 34 3c bc ed |..9.*.K.HDa.4<..| +000001f0 7a 31 c9 9f 8e 82 2d fb b6 bd 6e 4c 57 76 23 f5 |z1....-...nLWv#.| +00000200 7d 68 ff 02 75 42 10 e7 2d 24 83 4a 04 7a 78 d7 |}h..uB..-$.J.zx.| +00000210 60 b2 70 07 3f e4 bc 54 42 65 22 c3 2e aa 35 85 |`.p.?..TBe"...5.| +00000220 df fa e5 c9 c9 f5 ee 6a 50 82 7a bf 92 96 78 5e |.......jP.z...x^| +00000230 a8 ac 2a d1 5e e2 f0 20 6b 51 97 3d 74 71 eb d8 |..*.^.. kQ.=tq..| +00000240 40 5f 06 72 b6 8c 1c 2a 71 dd 53 38 fb de b6 31 |@_.r...*q.S8...1| +00000250 53 8d 8f 4e 0f c1 a5 ea bf 27 fa ed ff 0c 56 34 |S..N.....'....V4| +00000260 55 88 e1 d2 65 a7 e5 10 02 4d ba 8e ad fa 16 03 |U...e....M......| +00000270 03 00 35 94 36 93 c6 5e c8 ec 8e 63 86 7b 13 d6 |..5.6..^...c.{..| +00000280 78 b2 5d 2f 54 55 5a 41 1c 65 5e b2 69 ab c2 bd |x.]/TUZA.e^.i...| +00000290 d9 a3 55 42 d1 96 29 51 c4 38 c4 ec 1f d4 19 6c |..UB..)Q.8.....l| +000002a0 2b 82 75 81 37 07 79 35 16 03 03 00 98 d9 a2 ba |+.u.7.y5........| +000002b0 86 ca f4 24 e1 e0 72 0e 21 81 f6 c5 d7 0a 1c 17 |...$..r.!.......| +000002c0 05 1f ce b8 4d d3 d8 e6 13 c8 a6 4d f3 da 0f 4d |....M......M...M| +000002d0 e3 21 29 84 78 90 fa 11 a5 06 19 3a cd ca f2 1f |.!).x......:....| +000002e0 a2 39 4d b3 03 8d 22 27 eb bc f4 8b b8 61 c0 f3 |.9M..."'.....a..| +000002f0 70 34 56 80 28 a2 85 1e 21 7c 11 b8 c6 0c 0d bd |p4V.(...!|......| +00000300 02 56 8a b5 d5 7b 22 97 3e 70 20 31 00 a0 16 2d |.V...{".>p 1...-| +00000310 87 b5 c7 b0 5e 40 2d 08 82 97 38 64 c4 14 e3 16 |....^@-...8d....| +00000320 0d 6f d1 b1 6b 5f 7c 14 18 66 67 aa 8a b6 6b 66 |.o..k_|..fg...kf| +00000330 7d e3 68 ca 97 13 ad ca 0a 46 06 6b 4a a9 c0 ee |}.h......F.kJ...| +00000340 8b 61 6d 2d cc 14 03 03 00 11 93 6d 0b 63 c5 e2 |.am-.......m.c..| +00000350 3f 0f da dd f4 7c ae 95 2a e8 65 16 03 03 00 20 |?....|..*.e.... | +00000360 62 97 ee b8 34 aa be 0a 2c 24 30 6c 89 f2 80 08 |b...4...,$0l....| +00000370 05 69 bb ad a8 5c 90 21 04 77 96 44 ae 5f d4 d5 |.i...\.!.w.D._..| +>>> Flow 10 (server to client) +00000000 14 03 03 00 11 03 06 35 7b 36 e4 b2 df 80 68 80 |.......5{6....h.| +00000010 df e3 d6 3c bb b7 16 03 03 00 20 08 9b ed a0 ae |...<...... .....| +00000020 e7 f9 42 9a f5 10 21 7a 38 dc a2 6d 27 a8 bc 00 |..B...!z8..m'...| +00000030 58 85 6a 85 04 b9 3b 3f ca 26 68 17 03 03 00 19 |X.j...;?.&h.....| +00000040 d5 24 ff 37 e7 a2 5d eb f2 45 ca 73 60 3b c3 8c |.$.7..]..E.s`;..| +00000050 87 10 d8 31 c3 a2 e5 3d 0f 16 03 03 00 14 31 8a |...1...=......1.| +00000060 c9 a6 3a 3e 36 e0 4f d6 f1 f5 67 70 34 8a ab dc |..:>6.O...gp4...| +00000070 82 e2 |..| +>>> Flow 11 (client to server) +00000000 15 03 03 00 12 be b2 bb cf 44 91 f3 b9 71 00 af |.........D...q..| +00000010 9e b6 f5 07 64 36 7b 15 03 03 00 12 ae b2 33 16 |....d6{.......3.| +00000020 de f1 45 31 a5 fd 07 97 6e 57 f8 22 cc b2 |..E1....nW."..| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-RenegotiationRejected b/go/src/crypto/tls/testdata/Client-TLSv12-RenegotiationRejected new file mode 100644 index 0000000000000000000000000000000000000000..c907c7cb2ea9cb7f50f40d7898114434eea47945 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-RenegotiationRejected @@ -0,0 +1,97 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 ea a3 8e 85 79 |....]...Y......y| +00000010 9f 41 1f 7e 05 76 70 3d bd f4 bb f4 dd 49 a6 fd |.A.~.vp=.....I..| +00000020 11 83 a9 70 89 86 87 36 2f 09 b9 20 1a 00 de fc |...p...6/.. ....| +00000030 6b e5 93 4e da 98 0b e1 a8 93 8d fc 4b c3 48 6b |k..N........K.Hk| +00000040 15 6d de fd e3 0f 36 67 61 1c 91 8e cc a8 00 00 |.m....6ga.......| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 02 59 0b 00 02 55 00 02 52 00 02 |......Y...U..R..| +00000070 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 |O0..K0..........| +00000080 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 |....?.[..0...*.H| +00000090 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 |........0.1.0...| +000000a0 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 |U....Go1.0...U..| +000000b0 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 |..Go Root0...160| +000000c0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| +000000d0 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 |01000000Z0.1.0..| +000000e0 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 |.U....Go1.0...U.| +000000f0 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |...Go0..0...*.H.| +00000100 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +00000110 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab |...F}...'.H..(!.| +00000120 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d |~...]..RE.z6G...| +00000130 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd |.B[.....y.@.Om..| +00000140 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a |+.....g....."8.J| +00000150 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 |.ts+.4......t{.X| +00000160 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c |.la<..A..++$#w[.| +00000170 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 |;.u]. T..c...$..| +00000180 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 |..P....C...ub...| +00000190 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 |R.........0..0..| +000001a0 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 |.U...........0..| +000001b0 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 |.U.%..0...+.....| +000001c0 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 |....+.......0...| +000001d0 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d |U.......0.0...U.| +000001e0 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d |.........CC>I..m| +000001f0 b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 |....`0...U.#..0.| +00000200 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab |..H.IM.~.1......| +00000210 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |n{0...U....0...e| +00000220 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| +00000230 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| +00000240 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed |.0.@+[P.a...SX..| +00000250 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 |.(.X..8....1Z..f| +00000260 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a |=C.-...... d8.$:| +00000270 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 |....}.@ ._...a..| +00000280 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed |v......\.....l..| +00000290 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 |s..Cw.......@.a.| +000002a0 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 |Lr+...F..M...>..| +000002b0 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 |.B...=.`.\!.;...| +000002c0 16 03 03 00 ac 0c 00 00 a8 03 00 1d 20 6a e1 91 |............ j..| +000002d0 5d 5d fe 77 50 be a5 52 f1 12 43 30 34 aa 46 87 |]].wP..R..C04.F.| +000002e0 f9 6a 80 37 eb 46 fb 92 d6 ce 18 c4 0b 08 04 00 |.j.7.F..........| +000002f0 80 46 10 ab ff 45 fe c5 88 5a da d0 07 b5 a1 30 |.F...E...Z.....0| +00000300 03 d8 b0 5f 88 37 45 75 ef b7 96 5c c9 1f 47 14 |..._.7Eu...\..G.| +00000310 24 28 de cf 1f c9 c6 a4 0c 41 1b 51 70 7a e6 e8 |$(.......A.Qpz..| +00000320 88 1b 35 ce 63 e7 4f 2b 02 c9 35 0a 56 b2 2a 59 |..5.c.O+..5.V.*Y| +00000330 e9 02 53 11 82 f2 f6 18 06 3a 3e 2e 8e 21 78 9d |..S......:>..!x.| +00000340 41 43 e2 ed 49 ce 87 cd 93 b7 13 6c 35 6e 4e 95 |AC..I......l5nN.| +00000350 68 1b 4b 75 de fa ed 48 53 56 54 40 5f 3f 36 cb |h.Ku...HSVT@_?6.| +00000360 6b 57 de 3c fc 51 f4 fb 9d 8d 55 2e e9 ce fc 79 |kW.<.Q....U....y| +00000370 08 16 03 03 00 04 0e 00 00 00 |..........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| +00000030 16 03 03 00 20 be b4 f9 49 91 3c c8 f8 7c da ef |.... ...I.<..|..| +00000040 06 bd d5 9e d3 b4 74 f6 22 2e b8 5c b6 e2 2d 01 |......t."..\..-.| +00000050 cb d5 3f 94 7f |..?..| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 20 21 a2 e6 72 21 |.......... !..r!| +00000010 6d 45 36 87 6d 3f c9 70 89 1f b3 0a cc c2 5b 18 |mE6.m?.p......[.| +00000020 27 37 d8 1f 4e 55 f9 9d 07 96 2f |'7..NU..../| +>>> Flow 5 (client to server) +00000000 17 03 03 00 16 81 33 71 a4 ec a6 67 b2 17 ba 80 |......3q...g....| +00000010 27 80 a1 62 fb 1e ab 3f cd b9 fe |'..b...?...| +>>> Flow 6 (server to client) +00000000 16 03 03 00 14 b3 2b 93 6f bc d1 11 45 fa 9a d3 |......+.o...E...| +00000010 f3 82 75 6c ce 40 38 21 5e |..ul.@8!^| +>>> Flow 7 (client to server) +00000000 15 03 03 00 12 48 45 72 03 40 44 98 c6 db 40 d4 |.....HEr.@D...@.| +00000010 a6 9b 67 5d 8b c1 a9 15 03 03 00 12 21 d2 4b 7d |..g]........!.K}| +00000020 51 c7 3c 53 0b d9 67 90 aa e6 42 e2 8c 83 |Q.>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 01 ca 02 00 01 c6 03 03 28 44 55 f3 f5 |...........(DU..| +00000010 c1 63 ac 0b fd 1c 29 d3 90 a5 5c 96 2a d9 13 20 |.c....)...\.*.. | +00000020 fe 96 11 3f 30 0a e1 a9 8e d9 e6 20 ca 40 de 01 |...?0...... .@..| +00000030 4f 00 88 88 41 0f df af 85 0e 0e 22 9d a7 46 e8 |O...A......"..F.| +00000040 df 9c 8e 8c 47 5b 94 91 94 06 f4 14 cc a8 00 01 |....G[..........| +00000050 7e 00 12 01 69 01 67 00 75 00 a4 b9 09 90 b4 18 |~...i.g.u.......| +00000060 58 14 87 bb 13 a2 cc 67 70 0a 3c 35 98 04 f9 1b |X......gp.<5....| +00000070 df b8 e3 77 cd 0e c8 0d dc 10 00 00 01 47 97 99 |...w.........G..| +00000080 ee 16 00 00 04 03 00 46 30 44 02 20 1c 4b 82 5d |.......F0D. .K.]| +00000090 95 6e 67 5b db 04 95 4b f6 ce f4 32 3e 86 7a 7a |.ng[...K...2>.zz| +000000a0 32 ab 18 60 74 de 08 da 05 91 4c 2f 02 20 73 54 |2..`t.....L/. sT| +000000b0 1b 6e 7f a1 b0 7d 11 bc e6 f3 85 2f 97 66 1a f7 |.n...}...../.f..| +000000c0 8a e4 10 25 8f 12 f4 6f 39 0f d2 9e 18 f0 00 76 |...%...o9......v| +000000d0 00 68 f6 98 f8 1f 64 82 be 3a 8c ee b9 28 1d 4c |.h....d..:...(.L| +000000e0 fc 71 51 5d 67 93 d4 44 d1 0a 67 ac bb 4f 4f fb |.qQ]g..D..g..OO.| +000000f0 c4 00 00 01 47 97 e1 b5 70 00 00 04 03 00 47 30 |....G...p.....G0| +00000100 45 02 20 32 21 14 38 06 d8 72 2e 00 30 64 1a e2 |E. 2!.8..r..0d..| +00000110 e8 6d 4e 5a e1 d9 42 1e 82 4b 96 25 89 d5 26 13 |.mNZ..B..K.%..&.| +00000120 d3 9c fa 02 21 00 8f 12 28 64 51 4f 44 d5 8c 18 |....!...(dQOD...| +00000130 62 23 b2 43 93 33 05 f3 43 55 a1 d9 ee cd c5 71 |b#.C.3..CU.....q| +00000140 35 91 dd 49 d1 0b 00 76 00 ee 4b bd b7 75 ce 60 |5..I...v..K..u.`| +00000150 ba e1 42 69 1f ab e1 9e 66 a3 0f 7e 5f b0 72 d8 |..Bi....f..~_.r.| +00000160 83 00 c4 7b 89 7a a8 fd cb 00 00 01 48 5c 64 8a |...{.z......H\d.| +00000170 87 00 00 04 03 00 47 30 45 02 20 29 89 d6 b0 53 |......G0E. )...S| +00000180 d3 d2 e9 91 bc f1 b5 40 be 1e 2e e7 5c b4 74 27 |.......@....\.t'| +00000190 ed 8f 9b 02 e9 fa c2 4c ba a2 be 02 21 00 af 43 |.......L....!..C| +000001a0 64 52 71 15 29 58 40 91 c7 08 16 96 03 a8 73 a5 |dRq.)X@.......s.| +000001b0 65 a0 6c b8 48 56 5a b6 29 83 64 6d 2a 9d ff 01 |e.l.HVZ.).dm*...| +000001c0 00 01 00 00 0b 00 04 03 00 01 02 00 17 00 00 16 |................| +000001d0 03 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 |...Y...U..R..O0.| +000001e0 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 |.K0.............| +000001f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d |.?.[..0...*.H...| +00000200 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 55 04 0a |.....0.1.0...U..| +00000210 13 02 47 6f 31 10 30 0e 06 03 55 04 03 13 07 47 |..Go1.0...U....G| +00000220 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 |o Root0...160101| +00000230 30 30 30 30 30 30 5a 17 0d 32 35 30 31 30 31 30 |000000Z..2501010| +00000240 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 |00000Z0.1.0...U.| +00000250 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 03 13 02 |...Go1.0...U....| +00000260 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 |Go0..0...*.H....| +00000270 01 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 db |........0.......| +00000280 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 |F}...'.H..(!.~..| +00000290 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b |.]..RE.z6G....B[| +000002a0 c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b |.....y.@.Om..+..| +000002b0 c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 |...g....."8.J.ts| +000002c0 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 |+.4......t{.X.la| +000002d0 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 |<..A..++$#w[.;.u| +000002e0 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 |]. T..c...$....P| +000002f0 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 |....C...ub...R..| +00000300 03 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d |.......0..0...U.| +00000310 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d |..........0...U.| +00000320 25 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 |%..0...+........| +00000330 08 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 |.+.......0...U..| +00000340 01 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 |.....0.0...U....| +00000350 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 |......CC>I..m...| +00000360 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 80 10 48 |.`0...U.#..0...H| +00000370 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 |.IM.~.1......n{0| +00000380 19 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d |...U....0...exam| +00000390 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 |ple.golang0...*.| +000003a0 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc |H.............0.| +000003b0 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 |@+[P.a...SX...(.| +000003c0 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 |X..8....1Z..f=C.| +000003d0 2d d9 0b f2 97 df d3 20 64 38 92 24 3a 00 bc cf |-...... d8.$:...| +000003e0 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 |.}.@ ._...a..v..| +000003f0 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 |....\.....l..s..| +00000400 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b |Cw.......@.a.Lr+| +00000410 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 |...F..M...>...B.| +00000420 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 |..=.`.\!.;......| +00000430 00 ac 0c 00 00 a8 03 00 1d 20 26 24 4e d8 a6 cc |......... &$N...| +00000440 2f c9 0e 68 d8 20 e3 97 5b c1 08 72 1e 79 46 d9 |/..h. ..[..r.yF.| +00000450 a6 00 9c e9 f8 21 9b cd 29 17 08 04 00 80 aa 6d |.....!..)......m| +00000460 36 bb 06 e6 11 66 82 44 87 5d 81 53 e2 9a 95 11 |6....f.D.].S....| +00000470 54 a3 cc a7 c9 9c 19 f6 da 98 4f 91 a6 dd 9e 10 |T.........O.....| +00000480 14 83 04 55 2d 6c 9a af 26 7c 5d f0 aa ca 69 83 |...U-l..&|]...i.| +00000490 af fe a5 cb a4 1a d4 bd 86 91 52 11 03 4d 9a ca |..........R..M..| +000004a0 37 fd 01 48 e8 5d a8 ea ad a2 a5 08 cb ce 5f 52 |7..H.]........_R| +000004b0 92 30 83 de 77 2a 06 c2 f2 53 4d 47 40 b9 2f 61 |.0..w*...SMG@./a| +000004c0 9c 41 c4 05 45 42 5e 42 d5 5e 30 95 30 4e a1 77 |.A..EB^B.^0.0N.w| +000004d0 79 b5 50 5c df d6 e7 74 42 d8 2b 66 02 fa 16 03 |y.P\...tB.+f....| +000004e0 03 00 04 0e 00 00 00 |.......| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| +00000030 16 03 03 00 20 93 c8 47 ed fd 9b 41 69 97 58 97 |.... ..G...Ai.X.| +00000040 cc 31 9c 93 a6 77 41 36 7a 90 f0 73 13 4a 7d 85 |.1...wA6z..s.J}.| +00000050 12 20 7d 91 fa |. }..| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 20 16 00 35 d2 e0 |.......... ..5..| +00000010 ad f5 4c 10 98 fb 4f c7 81 1f 05 4b d6 7d 9c ac |..L...O....K.}..| +00000020 50 94 84 c8 35 80 ec 54 fc f3 ee |P...5..T...| +>>> Flow 5 (client to server) +00000000 17 03 03 00 16 83 e6 0f 3a ad c2 28 6c 82 ee 4a |........:..(l..J| +00000010 38 47 cc 86 75 70 e2 94 77 e6 6e 15 03 03 00 12 |8G..up..w.n.....| +00000020 13 c0 a0 4f 02 5e 6f 33 f6 ae d3 52 7d 72 72 a0 |...O.^o3...R}rr.| +00000030 1e 8d |..| diff --git a/go/src/crypto/tls/testdata/Client-TLSv12-X25519-ECDHE b/go/src/crypto/tls/testdata/Client-TLSv12-X25519-ECDHE new file mode 100644 index 0000000000000000000000000000000000000000..6f59dc6636b0232090581250857576dad781c330 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv12-X25519-ECDHE @@ -0,0 +1,94 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 12 01 00 01 0e 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 93 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 04 00 02 00 1d 00 0d 00 16 00 14 08 04 |................| +000000b0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000c0 06 03 00 32 00 1a 00 18 08 04 04 03 08 07 08 05 |...2............| +000000d0 08 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 |................| +000000e0 00 2b 00 09 08 03 04 03 03 03 02 03 01 00 33 00 |.+............3.| +000000f0 26 00 24 00 1d 00 20 2f e5 7d a3 47 cd 62 43 15 |&.$... /.}.G.bC.| +00000100 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed |(.._.).0........| +00000110 90 99 5f 58 cb 3b 74 |.._X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 5d 02 00 00 59 03 03 64 5a cc e0 63 |....]...Y..dZ..c| +00000010 02 82 64 75 5e 2c b3 5f 23 c6 98 c8 95 07 40 00 |..du^,._#.....@.| +00000020 3e ef fd f6 00 af 81 0c 3a 47 a0 20 a1 fc 21 83 |>.......:G. ..!.| +00000030 cf 2b 34 5e b7 7b bd ec bb 8f 26 6a f2 26 7f 8f |.+4^.{....&j.&..| +00000040 51 13 6f ba 0d 1a f5 b7 1c 9d 6d 91 c0 2f 00 00 |Q.o.......m../..| +00000050 11 ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 17 |................| +00000060 00 00 16 03 03 02 59 0b 00 02 55 00 02 52 00 02 |......Y...U..R..| +00000070 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 |O0..K0..........| +00000080 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 |....?.[..0...*.H| +00000090 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 |........0.1.0...| +000000a0 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 |U....Go1.0...U..| +000000b0 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 |..Go Root0...160| +000000c0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| +000000d0 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 |01000000Z0.1.0..| +000000e0 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 |.U....Go1.0...U.| +000000f0 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |...Go0..0...*.H.| +00000100 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +00000110 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab |...F}...'.H..(!.| +00000120 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d |~...]..RE.z6G...| +00000130 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd |.B[.....y.@.Om..| +00000140 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a |+.....g....."8.J| +00000150 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 |.ts+.4......t{.X| +00000160 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c |.la<..A..++$#w[.| +00000170 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 |;.u]. T..c...$..| +00000180 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 |..P....C...ub...| +00000190 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 |R.........0..0..| +000001a0 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 |.U...........0..| +000001b0 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 |.U.%..0...+.....| +000001c0 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 |....+.......0...| +000001d0 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d |U.......0.0...U.| +000001e0 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d |.........CC>I..m| +000001f0 b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 |....`0...U.#..0.| +00000200 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab |..H.IM.~.1......| +00000210 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |n{0...U....0...e| +00000220 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| +00000230 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| +00000240 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed |.0.@+[P.a...SX..| +00000250 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 |.(.X..8....1Z..f| +00000260 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a |=C.-...... d8.$:| +00000270 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 |....}.@ ._...a..| +00000280 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed |v......\.....l..| +00000290 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 |s..Cw.......@.a.| +000002a0 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 |Lr+...F..M...>..| +000002b0 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 |.B...=.`.\!.;...| +000002c0 16 03 03 00 ac 0c 00 00 a8 03 00 1d 20 15 d1 98 |............ ...| +000002d0 53 f4 98 b6 58 a5 cd 89 bb 32 21 83 4a e5 ad ba |S...X....2!.J...| +000002e0 1f ba db d0 4c c5 a3 89 0e 96 9f 59 60 08 04 00 |....L......Y`...| +000002f0 80 4e 14 a0 a7 33 e8 47 d5 7d 01 26 19 ff 1d 3c |.N...3.G.}.&...<| +00000300 2a f9 77 58 84 c0 07 b7 dc cc 82 85 a6 18 e9 33 |*.wX...........3| +00000310 70 15 04 75 bb 59 59 9c fa c0 cd b4 b7 f8 a3 0e |p..u.YY.........| +00000320 21 cd ac 7d 18 d2 34 e5 a9 c7 a1 5d 86 f3 74 2b |!..}..4....]..t+| +00000330 9b b0 21 5f cb 91 7f a0 d8 78 f0 7c 56 e3 69 ec |..!_.....x.|V.i.| +00000340 43 55 80 3f 02 d7 e0 10 52 15 4d 1b bc 2c 7f b7 |CU.?....R.M..,..| +00000350 86 cd 07 5d b9 f1 21 7e 18 da fc f8 45 45 cf 39 |...]..!~....EE.9| +00000360 62 3e c8 f1 6c 75 f4 fb fe f8 23 89 6a 0d b5 2e |b>..lu....#.j...| +00000370 4d 16 03 03 00 04 0e 00 00 00 |M.........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| +00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| +00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| +00000030 16 03 03 00 28 00 00 00 00 00 00 00 00 e3 a2 01 |....(...........| +00000040 72 d5 55 57 f7 1a da 10 9a 04 7d 33 f4 18 b1 9a |r.UW......}3....| +00000050 09 38 45 dd 74 13 21 70 52 9c cc c2 3f |.8E.t.!pR...?| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 28 86 a1 0b 2b ef |..........(...+.| +00000010 13 8d 20 82 ad 17 92 64 0b 44 21 0f f0 dd 20 43 |.. ....d.D!... C| +00000020 4c db 92 3c 25 3a 12 ca 27 56 86 16 ca 9f ba 46 |L..<%:..'V.....F| +00000030 dc 96 86 |...| +>>> Flow 5 (client to server) +00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 20 7c 62 |............. |b| +00000010 05 52 7a 91 a7 13 96 96 29 11 1b 1a fe fa ad 7f |.Rz.....).......| +00000020 d2 3a 26 15 03 03 00 1a 00 00 00 00 00 00 00 02 |.:&.............| +00000030 c7 2b 60 1b 9c 6b cb 22 08 f1 e3 c0 44 ab 70 21 |.+`..k."....D.p!| +00000040 68 48 |hH| diff --git a/go/src/crypto/tls/testdata/Client-TLSv13-AES128-SHA256 b/go/src/crypto/tls/testdata/Client-TLSv13-AES128-SHA256 new file mode 100644 index 0000000000000000000000000000000000000000..3673b8da39367f9f6fa449bbcd94d6f70bef0f4f --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv13-AES128-SHA256 @@ -0,0 +1,92 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 07 aa 6b aa b6 |....z...v....k..| +00000010 ef a5 5c 62 d7 05 bb f8 9d ea 03 34 13 bf 00 1f |..\b.......4....| +00000020 e6 95 7b ef a5 2b ad e8 20 2f 21 20 00 00 00 00 |..{..+.. /! ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 01 00 00 |................| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 53 |..+.....3.$... S| +00000060 3c 5e 7d 61 39 39 6c f7 ea 14 d3 f0 40 23 30 8b |<^}a99l.....@#0.| +00000070 7e 1f 41 86 f8 2e 12 0a f5 67 13 28 46 6f 14 14 |~.A......g.(Fo..| +00000080 03 03 00 01 01 17 03 03 00 17 a8 64 4a 9d f1 a0 |...........dJ...| +00000090 3c 1b e3 20 a2 66 80 7f 13 b5 a9 f0 8f ee 5b 4b |<.. .f........[K| +000000a0 af 17 03 03 02 6d 26 d2 8f df b4 d5 d3 9a c8 92 |.....m&.........| +000000b0 4c 32 63 80 6b 5f 99 11 0f 4b be 14 77 55 86 d1 |L2c.k_...K..wU..| +000000c0 27 94 18 50 27 1c 84 9c 38 03 fb 11 d3 5a ea 64 |'..P'...8....Z.d| +000000d0 d1 15 47 1d fc cc 6e bf 5e 4d 45 74 f2 ca 44 77 |..G...n.^MEt..Dw| +000000e0 32 6d 02 3a 9f 44 aa 5c 5d 62 64 ee 44 0d 45 05 |2m.:.D.\]bd.D.E.| +000000f0 de 40 d0 83 c9 b3 21 39 a0 8f 5b 5a e1 96 2f 0b |.@....!9..[Z../.| +00000100 4b 12 da a7 dc 7b 2a 73 14 7f cc 93 fd a8 47 1c |K....{*s......G.| +00000110 f7 88 76 5d 30 29 af 65 ac 52 25 04 13 be 96 92 |..v]0).e.R%.....| +00000120 bb e4 86 a0 b7 c8 67 63 ef cb 1f 78 7e bf 3c 5f |......gc...x~.<_| +00000130 7a a6 89 4a 94 f3 2e 01 8b b9 81 21 57 00 5e 26 |z..J.......!W.^&| +00000140 22 9b eb e0 73 87 cd 77 46 d4 c8 1d 0a 4f d8 83 |"...s..wF....O..| +00000150 0b 0a 43 3f 37 53 e2 0a 4b bb ef e8 8d 2a dc 51 |..C?7S..K....*.Q| +00000160 b0 b9 90 7e 1a c5 31 e0 1b 0f 0c 7e 96 7b aa 49 |...~..1....~.{.I| +00000170 ad 84 b0 0a 75 d6 37 58 bd 7f f6 ac 50 c5 d7 93 |....u.7X....P...| +00000180 70 ce b1 cd 00 7c 79 1a e5 ec 04 7b 12 8f fb 80 |p....|y....{....| +00000190 54 d0 2b a0 9e 83 0d 05 a7 f5 4b e8 b4 36 1c d0 |T.+.......K..6..| +000001a0 88 34 a6 71 51 d6 cf 59 c9 ad 03 d8 38 f2 15 f0 |.4.qQ..Y....8...| +000001b0 63 9d 34 a3 f4 bc de 8f ae 26 97 c0 98 8e 59 4e |c.4......&....YN| +000001c0 1f 74 a1 d4 2c 1a 18 20 ef e8 06 58 74 dd ed 40 |.t..,.. ...Xt..@| +000001d0 50 dd 8b a4 77 15 1b 9e 63 7e c7 11 63 1a a9 d5 |P...w...c~..c...| +000001e0 16 c2 8f f5 6c ce cd 03 e6 2d cc da 75 1a ce cb |....l....-..u...| +000001f0 ea 41 de dd 59 e5 68 90 98 69 76 a3 d0 d4 ed d1 |.A..Y.h..iv.....| +00000200 e9 9a cd b8 29 73 eb 9c e6 6f ee 8d 91 84 9e 2e |....)s...o......| +00000210 b9 23 2b 04 a0 f6 5f 0b 16 07 49 ae 6f 33 b0 ee |.#+..._...I.o3..| +00000220 be ff 75 52 da 7b 06 05 6c 8f 87 1f 48 2f fb 59 |..uR.{..l...H/.Y| +00000230 79 a6 99 cb a6 0b 73 fb 4c d0 cc eb ba 51 1a 6d |y.....s.L....Q.m| +00000240 9a 33 27 e3 f4 cf 16 bc c0 82 da 21 04 4a 7b e0 |.3'........!.J{.| +00000250 12 a5 5e de 22 d2 df b4 c4 c9 fa 11 97 7b 07 ea |..^."........{..| +00000260 11 c8 2c 55 b8 6d c2 64 6d fa e0 6f b8 5c 50 ae |..,U.m.dm..o.\P.| +00000270 a6 2e aa bf 2f 2a 74 2d 1c 11 c2 44 d7 28 b8 5e |..../*t-...D.(.^| +00000280 6a 2d bc 0d 2e a7 a2 b6 b6 ae 12 2c a2 c4 ba 5c |j-.........,...\| +00000290 0b 3f 17 2e 98 30 ce 6c 8e 88 3c f9 a8 e1 68 8d |.?...0.l..<...h.| +000002a0 52 c8 a1 b3 3f 12 e1 35 f0 eb ee 9f 0d bb 3c 90 |R...?..5......<.| +000002b0 2c e2 2c 95 2e f3 e2 f6 f2 f1 be b8 03 02 84 69 |,.,............i| +000002c0 56 8f 3b 1d 68 77 f1 52 eb 48 4f e8 c8 5b 0a df |V.;.hw.R.HO..[..| +000002d0 a1 74 1e e1 47 a2 9a 9a 83 6d c2 ea f3 1b fc 8f |.t..G....m......| +000002e0 b6 aa 18 7e 85 46 ff 33 0b 6e 1f 5b f1 70 c0 45 |...~.F.3.n.[.p.E| +000002f0 f6 bb a0 da 74 e0 9a 3c a7 e2 07 ef 0b e5 9a 5b |....t..<.......[| +00000300 6e 9b aa 6c a4 97 84 5d 77 f5 33 b8 e3 45 c0 00 |n..l...]w.3..E..| +00000310 21 c7 91 17 03 03 00 99 ee bf d2 9c 82 9f 68 b4 |!.............h.| +00000320 5e 15 09 1a 7a c1 f9 72 ff ca 0e d9 f1 9f 7f 8c |^...z..r........| +00000330 dc 4a 8d d3 37 7b 81 42 ef 9b 2b 5f 9a 4b 40 8e |.J..7{.B..+_.K@.| +00000340 6b 24 53 79 32 b0 d1 24 2a 6f c9 fb a8 82 c1 01 |k$Sy2..$*o......| +00000350 1e 0b 11 7f 85 c7 ee d4 29 12 08 99 8f 00 ef af |........).......| +00000360 2c 5d c5 b1 25 a3 a9 f0 f1 a3 2b f8 7f e6 31 1b |,]..%.....+...1.| +00000370 51 20 af 3f a7 4e 5c 3d 73 21 04 0f 2c 5c cd f3 |Q .?.N\=s!..,\..| +00000380 eb d1 01 ef b0 e3 64 f7 33 d3 05 82 9f a6 71 3b |......d.3.....q;| +00000390 b2 ab 08 61 57 ad 74 d1 e2 8f 2c c9 73 c3 e0 ac |...aW.t...,.s...| +000003a0 ed 18 4b 70 0d 9a bf ae b4 db 07 7d 25 3e 7f 3d |..Kp.......}%>.=| +000003b0 14 17 03 03 00 35 db be d2 61 e1 3f a3 0b fe 39 |.....5...a.?...9| +000003c0 b2 86 42 72 a6 ee 02 90 c2 d1 d1 5c 3d 61 c8 28 |..Br.......\=a.(| +000003d0 28 7c 01 40 26 f1 e1 f1 81 50 03 4c 6c 32 6d 8b |(|.@&....P.Ll2m.| +000003e0 dd 60 cf fc a9 3c fe e1 4d d0 d2 |.`...<..M..| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 00 35 bd 1e ca 07 84 |..........5.....| +00000010 c8 ba 87 6d d3 ed 53 20 79 76 34 af 30 e6 bf c5 |...m..S yv4.0...| +00000020 74 a0 d0 b3 13 17 a9 3c c7 b3 47 5b e7 b4 6d 18 |t......<..G[..m.| +00000030 e5 3f 12 5c ca c9 26 87 c4 96 c4 9b 45 23 7f f7 |.?.\..&.....E#..| +00000040 17 03 03 00 17 28 0b 72 a0 6e ac 55 ec c0 b7 21 |.....(.r.n.U...!| +00000050 3f 7a 16 98 40 76 7d 3c 95 24 98 3b 17 03 03 00 |?z..@v}<.$.;....| +00000060 13 8e 23 e0 33 31 dc 39 fb 54 a6 a2 63 36 e4 2a |..#.31.9.T..c6.*| +00000070 5a 1c bc 09 |Z...| diff --git a/go/src/crypto/tls/testdata/Client-TLSv13-AES256-SHA384 b/go/src/crypto/tls/testdata/Client-TLSv13-AES256-SHA384 new file mode 100644 index 0000000000000000000000000000000000000000..5fcaba0d4fd54a781a8739b62a25f4c9620821ac --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv13-AES256-SHA384 @@ -0,0 +1,94 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 76 2d 81 0b a9 |....z...v..v-...| +00000010 70 b7 fe 52 ef d3 80 c4 1d bf f7 19 99 3c 4c aa |p..R.............|.I+NU.t..| +00000130 23 32 9d aa b1 17 15 3d 37 85 42 0e 5f 7c fa 5b |#2.....=7.B._|.[| +00000140 b8 ae f3 b9 4d b2 40 b5 e2 de e2 b3 f0 27 a6 f2 |....M.@......'..| +00000150 0c 28 4b 77 ee 38 dc ec 17 28 18 03 13 85 60 2c |.(Kw.8...(....`,| +00000160 ab 16 e1 1c c6 e1 91 e0 5f f3 b6 f7 1c 3b 5f 03 |........_....;_.| +00000170 6a d5 b0 a0 5b ab 6d 9c b2 ee 8e 50 49 94 7d db |j...[.m....PI.}.| +00000180 3b fe 68 e2 79 3e 2d 33 06 a6 b2 9c 8b 7d 93 04 |;.h.y>-3.....}..| +00000190 b4 9e 07 6d 15 80 63 38 8e 4b c5 e6 88 a0 6a f2 |...m..c8.K....j.| +000001a0 11 60 11 7a f7 6e 7e 47 9f fd 77 12 c9 d5 8e 58 |.`.z.n~G..w....X| +000001b0 84 51 2c f6 fd 2b d1 dc a6 51 d8 20 3f 06 76 ad |.Q,..+...Q. ?.v.| +000001c0 dd 37 b6 e9 86 4e cb 31 76 79 60 26 c7 b4 d5 67 |.7...N.1vy`&...g| +000001d0 2c 70 22 f4 4d b5 60 61 41 48 65 a8 d0 b5 d8 47 |,p".M.`aAHe....G| +000001e0 08 bf 5b 67 e8 99 c4 a5 91 1e 36 6b 37 53 7b 65 |..[g......6k7S{e| +000001f0 ac af 2d df 8e 77 e2 46 1a 65 45 0a 00 f2 8f 9d |..-..w.F.eE.....| +00000200 47 1c 93 64 52 c3 d9 91 47 41 88 7f 81 ea 8f 2b |G..dR...GA.....+| +00000210 a9 fa 4b d5 9d 6f 30 36 dc af e0 96 b3 f0 e4 6a |..K..o06.......j| +00000220 a3 10 cf 0e 53 64 e3 18 52 08 a9 16 e3 6d e9 0a |....Sd..R....m..| +00000230 ec 4d a4 f7 f1 ee 38 28 88 31 aa 38 a7 14 09 f4 |.M....8(.1.8....| +00000240 1a 31 ac 40 46 dd f2 4f 7f ff f4 fc 71 42 61 73 |.1.@F..O....qBas| +00000250 03 47 9f ec 69 7f 77 e3 91 29 cd 89 7f 45 6b 9d |.G..i.w..)...Ek.| +00000260 f5 33 66 8b 74 bc 53 ff 54 c3 af 48 8e d8 25 0a |.3f.t.S.T..H..%.| +00000270 99 49 08 29 f3 b2 a5 d0 5b ca 89 e2 d7 f5 5f 40 |.I.)....[....._@| +00000280 72 6f b4 d6 20 39 79 4a 0e 7c 00 60 68 eb 1e ab |ro.. 9yJ.|.`h...| +00000290 ee 38 35 f2 db 83 9c 0b 52 80 15 14 ae 6b dc f5 |.85.....R....k..| +000002a0 d5 f3 83 cb e7 5f 5c 98 e2 f2 d0 52 68 92 ff f6 |....._\....Rh...| +000002b0 7a ce ff ae 96 6e ad 11 d2 5e bc 60 16 55 cd 81 |z....n...^.`.U..| +000002c0 25 67 5b db 76 59 36 a8 48 d6 91 86 4f cb 87 5f |%g[.vY6.H...O.._| +000002d0 ea 96 e4 71 df ac 54 5a a0 e1 0a bd 88 68 ff 0a |...q..TZ.....h..| +000002e0 97 be 9b da cf aa e1 b1 74 c9 8d 5f 19 f5 df 53 |........t.._...S| +000002f0 a0 57 93 7d c3 fe 37 78 2a ba 6b c2 a1 51 41 f4 |.W.}..7x*.k..QA.| +00000300 ee 57 ed d2 7d 48 14 31 4a f7 14 d4 0e 42 9e fb |.W..}H.1J....B..| +00000310 fb f4 cd 17 03 03 00 99 6b 70 ae fc d3 07 5e 7f |........kp....^.| +00000320 39 2a 27 34 54 8a b6 4d 39 36 d4 38 0c ed 8c 24 |9*'4T..M96.8...$| +00000330 fc 29 1d 59 74 99 f1 e1 a1 23 4b 6d 27 31 f4 2d |.).Yt....#Km'1.-| +00000340 8b b3 23 aa 92 5f 01 3d a1 f6 b5 24 8e 56 ea eb |..#.._.=...$.V..| +00000350 4e 0a dc 23 ae 32 1b 0d cb bc 60 87 b7 35 32 5f |N..#.2....`..52_| +00000360 10 32 fb 89 32 3f 99 0e 30 0d 65 28 69 c4 3b f8 |.2..2?..0.e(i.;.| +00000370 6c 04 a5 bf ec e9 aa c4 bc b4 55 e2 d0 09 a1 4b |l.........U....K| +00000380 82 f8 a5 37 ab ca 69 f4 bc 24 69 c4 ce 07 6c ee |...7..i..$i...l.| +00000390 d6 08 92 14 41 ca 8f c8 c9 37 ae b5 f3 29 ff 69 |....A....7...).i| +000003a0 7a 18 4e 93 dd eb 52 58 d2 6b 22 6d b6 29 70 b3 |z.N...RX.k"m.)p.| +000003b0 ea 17 03 03 00 45 10 35 86 2e d4 e3 92 35 a3 0e |.....E.5.....5..| +000003c0 a1 cd 79 11 05 cd 77 c4 93 f4 6a ba f8 fc 4b bd |..y...w...j...K.| +000003d0 63 5d c0 2d a0 c9 c2 2a 10 79 e9 0c bc 0b 18 c1 |c].-...*.y......| +000003e0 15 18 c0 8a d7 05 39 f1 de 6e 8e cb dd 73 5f ee |......9..n...s_.| +000003f0 28 93 f9 92 35 56 1f c1 e4 8d 89 |(...5V.....| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 00 45 2f 08 54 f6 2b |..........E/.T.+| +00000010 fd 13 5d 87 d3 b6 73 5e 20 88 af 53 db 7e 3c 37 |..]...s^ ..S.~<7| +00000020 1d 52 a4 ae 91 3f 24 a7 30 26 02 da 13 f3 c5 60 |.R...?$.0&.....`| +00000030 28 e6 eb 8f e1 1b 58 2d bb d0 06 c4 67 33 1c a1 |(.....X-....g3..| +00000040 03 cb 16 56 1b 91 06 08 b6 34 c5 de 97 04 ee f0 |...V.....4......| +00000050 17 03 03 00 17 6c 7e 3d 5d 98 4e 42 81 42 c5 2c |.....l~=].NB.B.,| +00000060 b2 c2 d3 c9 58 bc 13 bc 61 cd 63 f2 17 03 03 00 |....X...a.c.....| +00000070 13 83 c7 4a b6 10 69 b4 16 be 25 a1 db cb c9 94 |...J..i...%.....| +00000080 8f a2 27 22 |..'"| diff --git a/go/src/crypto/tls/testdata/Client-TLSv13-ALPN b/go/src/crypto/tls/testdata/Client-TLSv13-ALPN new file mode 100644 index 0000000000000000000000000000000000000000..ff0989c567b149330757669c7ab6a1aeccb40abb --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv13-ALPN @@ -0,0 +1,95 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 2c 01 00 01 28 03 03 00 00 00 00 00 |....,...(.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 ad 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 10 00 10 00 0e 06 70 72 6f |.............pro| +000000f0 74 6f 32 06 70 72 6f 74 6f 31 00 2b 00 09 08 03 |to2.proto1.+....| +00000100 04 03 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 |........3.&.$...| +00000110 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)| +00000120 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;| +00000130 74 |t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 bb 72 d9 b8 e5 |....z...v...r...| +00000010 0b 80 14 4c 16 9b 86 ec 26 62 f2 f9 00 85 a6 ae |...L....&b......| +00000020 44 f4 27 c4 13 67 4a 2e 96 e6 33 20 00 00 00 00 |D.'..gJ...3 ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 03 00 00 |................| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 69 |..+.....3.$... i| +00000060 d7 31 51 9b e6 1d 98 09 9f 5f 6c 05 10 ba 64 b5 |.1Q......_l...d.| +00000070 b9 8f b8 c0 2a c1 7f 89 13 ed 04 38 e9 78 43 14 |....*......8.xC.| +00000080 03 03 00 01 01 17 03 03 00 24 99 f3 d5 db e2 35 |.........$.....5| +00000090 4b fb b2 05 e6 03 c2 f2 c4 ea 64 d2 e4 d3 17 e7 |K.........d.....| +000000a0 72 34 e8 b2 d6 61 91 3b b3 03 ea 1c 33 57 17 03 |r4...a.;....3W..| +000000b0 03 02 6d 22 da 71 90 42 da 0a 03 52 98 42 e3 71 |..m".q.B...R.B.q| +000000c0 db 57 e0 9d 70 89 4b 4c a9 a5 4d 39 02 19 f1 09 |.W..p.KL..M9....| +000000d0 5a 9c 33 c9 f2 8d 7e 78 c3 b3 ae 1b 2c 7b 73 ef |Z.3...~x....,{s.| +000000e0 3a ad d8 51 82 90 bc 6b 0d 6f a6 f0 46 8d 72 29 |:..Q...k.o..F.r)| +000000f0 ca 84 d8 b1 27 e3 8d 8f f5 ce f0 f0 d9 2f 9c 71 |....'......../.q| +00000100 b9 bc 89 af 92 18 d2 c9 07 b2 eb 94 40 42 d2 7a |............@B.z| +00000110 c8 be 49 35 b6 b7 f3 b9 64 c1 56 fe fc d8 11 04 |..I5....d.V.....| +00000120 6c d7 e9 18 98 29 eb d5 6f 59 0d fa 25 85 f7 3c |l....)..oY..%..<| +00000130 df 76 d9 52 10 72 59 d6 36 5b b0 54 01 1d ac 9e |.v.R.rY.6[.T....| +00000140 9b 86 5f 5b ee 18 74 ec 8e 8b da 0f df 71 50 e2 |.._[..t......qP.| +00000150 cd 58 98 23 a0 21 94 ac eb db 3a fe f6 8d aa cc |.X.#.!....:.....| +00000160 21 23 e6 35 f7 0e 42 0e 50 48 14 22 f3 83 91 3d |!#.5..B.PH."...=| +00000170 73 22 5b 74 e7 e8 d1 b5 ee cd 7e c3 ee 0d 13 a9 |s"[t......~.....| +00000180 aa ae 0b 12 b0 3a 9d 6f 01 68 27 e4 62 e0 0e 67 |.....:.o.h'.b..g| +00000190 e4 de 69 74 8d f1 7a 3b 16 bb 1d a0 ad bf c5 4b |..it..z;.......K| +000001a0 50 9e b0 dc 08 73 14 99 c9 ad de 04 df 75 09 de |P....s.......u..| +000001b0 e4 27 ec 2b 75 79 db 82 8c aa 42 af 40 df 32 0e |.'.+uy....B.@.2.| +000001c0 e6 1d 93 d1 00 f7 18 59 43 9c 03 6c f7 bf ac a2 |.......YC..l....| +000001d0 8b 10 be b1 a8 b6 4e 84 2b c0 ff 87 4d 26 c2 8f |......N.+...M&..| +000001e0 63 64 7a 66 a6 12 0b e4 06 9e ff af fe 03 55 c7 |cdzf..........U.| +000001f0 13 92 22 ec ed 89 76 2d 36 8a 4a 92 f1 a5 b6 ac |.."...v-6.J.....| +00000200 d4 19 46 9d f3 e0 52 6d 01 ee bf ab d5 17 c0 33 |..F...Rm.......3| +00000210 b5 81 e1 81 a2 e9 44 b7 20 0e f4 f0 35 bb d4 8d |......D. ...5...| +00000220 bc 83 fc 59 fb 1d 5e e0 c4 4c 9e cc c3 72 b7 3d |...Y..^..L...r.=| +00000230 01 a4 f2 df e2 a7 44 d1 f1 20 90 31 53 09 50 eb |......D.. .1S.P.| +00000240 80 85 23 52 68 7d b2 51 60 0c 00 87 c3 42 88 07 |..#Rh}.Q`....B..| +00000250 de 59 fd 3d 68 a3 22 50 cb 67 43 94 02 77 24 6a |.Y.=h."P.gC..w$j| +00000260 8d a4 4f 85 7f 19 a0 b5 10 76 2a 85 4c 84 12 e3 |..O......v*.L...| +00000270 f7 ce b8 30 9f d0 9f 8a 26 42 28 f4 cb f7 c4 c2 |...0....&B(.....| +00000280 aa 34 c2 72 64 dc 6d 9d d4 26 2f 14 4d 97 2c 00 |.4.rd.m..&/.M.,.| +00000290 2d 46 0f 07 9c 3d 76 d4 55 a7 15 13 b2 41 e3 f4 |-F...=v.U....A..| +000002a0 33 ae 1b 26 68 43 62 de c1 c2 61 26 08 1b 20 13 |3..&hCb...a&.. .| +000002b0 bc 58 72 c2 16 fe 4d 2e 68 8b 31 61 ac c9 55 c5 |.Xr...M.h.1a..U.| +000002c0 3c 5a 77 c2 61 47 4a d6 0d c4 8a bc bb 63 ca ea |0....8bA.L94..| +000003e0 ee 48 70 3c 23 65 90 cb f9 4f 76 72 dd f3 64 83 |.Hp<#e...Ovr..d.| +000003f0 23 38 79 13 d2 93 57 fb |#8y...W.| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 00 35 f1 1a 54 a4 02 |..........5..T..| +00000010 59 df 81 64 1d 06 93 27 55 41 83 40 9c a0 fa 44 |Y..d...'UA.@...D| +00000020 dd 80 16 6b ed fb 36 ec 0d 49 ee 93 99 84 55 30 |...k..6..I....U0| +00000030 94 4c 46 7a b9 ba db f0 6a e5 90 ce 58 b1 95 2e |.LFz....j...X...| +00000040 17 03 03 00 17 ed 07 24 e5 f8 f3 91 4c f1 05 dc |.......$....L...| +00000050 d0 ea a5 c2 cd fb bf 14 45 99 69 53 17 03 03 00 |........E.iS....| +00000060 13 d7 bf a6 c1 66 5d 7b 00 fb 5a 6e b8 81 99 3a |.....f]{..Zn...:| +00000070 30 08 a2 3c |0..<| diff --git a/go/src/crypto/tls/testdata/Client-TLSv13-CHACHA20-SHA256 b/go/src/crypto/tls/testdata/Client-TLSv13-CHACHA20-SHA256 new file mode 100644 index 0000000000000000000000000000000000000000..f2c1cb499afddf020f9e1874d21257684ea6896e --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv13-CHACHA20-SHA256 @@ -0,0 +1,92 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 f9 23 d9 5d 6c |....z...v...#.]l| +00000010 ae 6b 63 2a d8 2c a0 27 8e 7b 39 29 35 04 0e a9 |.kc*.,.'.{9)5...| +00000020 31 f7 a0 c5 77 a7 f3 c5 25 ca 2f 20 00 00 00 00 |1...w...%./ ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 03 00 00 |................| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 ba |..+.....3.$... .| +00000060 2b 6b 27 27 14 c0 42 b6 1f bc ad 77 f1 1f 4a b3 |+k''..B....w..J.| +00000070 42 94 a6 3a 2c 7f e6 aa 72 8e d0 70 e8 0e 53 14 |B..:,...r..p..S.| +00000080 03 03 00 01 01 17 03 03 00 17 33 bb 8a 47 b0 a9 |..........3..G..| +00000090 29 d7 bf e4 94 7d 42 8a 19 95 4e d9 7c b7 9a 87 |)....}B...N.|...| +000000a0 83 17 03 03 02 6d 86 a7 6c 3c 4e 45 95 f6 f6 66 |.....m..l.`.`~.....r| +000001d0 a4 bc 66 a7 bd 46 83 88 6e 9f b3 db de e7 b3 04 |..f..F..n.......| +000001e0 62 4c 61 d6 d0 89 84 e4 30 d7 4d a0 61 4f 56 ad |bLa.....0.M.aOV.| +000001f0 51 c6 1f 10 01 9e 8d 75 55 fb 89 b8 d0 57 e3 ce |Q......uU....W..| +00000200 40 72 41 27 96 e0 5b f4 cc ba d0 ec 8c d4 91 ca |@rA'..[.........| +00000210 8f f0 db 11 86 d5 8e 02 6a 1f 29 00 f6 ff 42 a2 |........j.)...B.| +00000220 7c c9 e7 18 38 39 c9 e4 2b 0e e9 36 40 d3 dd bc ||...89..+..6@...| +00000230 f7 e3 7c 2d e9 f0 52 31 16 85 b4 e2 a8 54 cd d0 |..|-..R1.....T..| +00000240 d6 e2 ed f4 fc 91 9f 50 68 a0 74 af 37 c7 4c bd |.......Ph.t.7.L.| +00000250 de 9e c7 78 06 41 6b 62 07 8c 8b f4 f5 ea ab 16 |...x.Akb........| +00000260 b0 16 b9 ea 06 2c ee 66 d5 da b3 2c 0f 03 d2 f6 |.....,.f...,....| +00000270 ae f7 11 85 d8 b6 b8 bf 7e a5 c8 ff 0d 41 29 86 |........~....A).| +00000280 94 e4 32 58 6c 0e 05 47 b8 c5 77 de d1 81 8d 72 |..2Xl..G..w....r| +00000290 d4 e0 64 66 f7 17 8a 96 88 bf 1c 04 22 40 e0 cf |..df........"@..| +000002a0 28 6d f5 4f 89 e2 4a 23 4b 71 e1 15 3b da 45 0b |(m.O..J#Kq..;.E.| +000002b0 13 ee 1f 7f 4e 45 3d 8e d2 f3 bd 23 e7 4c f3 d2 |....NE=....#.L..| +000002c0 0f 4b 6e 6a 3d 6a f1 26 b7 ae f6 1d 39 73 cd fd |.Knj=j.&....9s..| +000002d0 1c c8 c7 45 fa e0 67 d5 2c eb e9 2b 32 8e 65 7b |...E..g.,..+2.e{| +000002e0 c5 32 cc e6 01 91 fc fd 92 6e ab 9a 13 f6 63 81 |.2.......n....c.| +000002f0 e5 b9 25 6d ce 73 39 9e 82 ae 18 89 a5 32 cb d3 |..%m.s9......2..| +00000300 a3 85 55 f5 cd 26 96 18 91 1c 41 36 69 49 93 f2 |..U..&....A6iI..| +00000310 aa 05 ab 17 03 03 00 99 9c 1d 79 c5 7b 73 b9 f9 |..........y.{s..| +00000320 00 2d ea ff c2 8d f6 57 65 7c 92 fa ba 22 18 03 |.-.....We|..."..| +00000330 69 69 e9 05 e0 74 1a e5 9d f9 30 9f 1c 39 86 30 |ii...t....0..9.0| +00000340 aa 1b 86 fa 20 26 20 13 ea 8d eb 8b 4e 8b c1 50 |.... & .....N..P| +00000350 86 ef a3 c5 8e 48 b2 a1 5a ac 05 e7 8f 23 8a 34 |.....H..Z....#.4| +00000360 ab 1f 8e 90 b1 e5 9a d3 d7 28 90 b6 12 35 dc cb |.........(...5..| +00000370 c5 3c 8d 3d fc e2 99 2a 8b f0 6a f4 8b a9 62 3f |.<.=...*..j...b?| +00000380 b6 19 29 fd 79 b9 35 72 b0 89 59 ab 78 c6 c9 f0 |..).y.5r..Y.x...| +00000390 68 bc 0d f5 9a 45 dd 4f d2 40 75 19 47 af e9 6f |h....E.O.@u.G..o| +000003a0 56 ec 73 ce cd 19 31 c0 39 08 b1 63 e0 ac d4 49 |V.s...1.9..c...I| +000003b0 e5 17 03 03 00 35 0d 34 de e9 22 e4 56 18 4a 33 |.....5.4..".V.J3| +000003c0 d1 05 c4 d4 f2 64 24 62 d7 da 6a 8e 34 3b 51 13 |.....d$b..j.4;Q.| +000003d0 27 69 88 37 4b ba 29 9d c5 78 af 62 2b 62 6e 5a |'i.7K.)..x.b+bnZ| +000003e0 28 7a 93 c5 9a f3 84 1d 50 9a 94 |(z......P..| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 00 35 4f 9c 2d 01 8b |..........5O.-..| +00000010 4a 31 16 77 b4 f2 2b 40 cb 8e d5 7d 93 bd 66 59 |J1.w..+@...}..fY| +00000020 f8 f1 f4 45 69 fd f7 9b 88 5a e5 0a 40 67 e2 17 |...Ei....Z..@g..| +00000030 72 de b0 1d 02 ba b5 a7 58 35 4a 3e b6 2a 0c e8 |r.......X5J>.*..| +00000040 17 03 03 00 17 4a 50 b7 f1 94 a4 64 9e a2 95 0a |.....JP....d....| +00000050 6c f6 93 7f d6 6d 12 10 7a 69 8a d2 17 03 03 00 |l....m..zi......| +00000060 13 10 60 24 3f 6e c9 ee c6 27 50 72 5e 19 22 e0 |..`$?n...'Pr^.".| +00000070 76 12 45 e5 |v.E.| diff --git a/go/src/crypto/tls/testdata/Client-TLSv13-ClientCert-ECDSA-RSA b/go/src/crypto/tls/testdata/Client-TLSv13-ClientCert-ECDSA-RSA new file mode 100644 index 0000000000000000000000000000000000000000..6611cdfed22fae24a620ab70b3563b57114d92f7 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv13-ClientCert-ECDSA-RSA @@ -0,0 +1,141 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 ea 4e 78 a5 f4 |....z...v...Nx..| +00000010 71 78 37 5b 2c e4 69 b2 00 4d 49 8c 8b 86 4c 80 |qx7[,.i..MI...L.| +00000020 f9 db 03 3f cc 1e 42 f9 87 ff 7b 20 00 00 00 00 |...?..B...{ ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 03 00 00 |................| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 f1 |..+.....3.$... .| +00000060 bf 65 1e fd e0 5d 1b ca 02 b5 9e 3f a8 82 e0 5a |.e...].....?...Z| +00000070 97 eb af b5 f1 f7 77 3f 46 a8 66 93 de a8 39 14 |......w?F.f...9.| +00000080 03 03 00 01 01 17 03 03 00 17 16 a7 f6 48 b9 11 |.............H..| +00000090 59 75 3d d8 cf eb ba 72 6c f7 0d 26 50 ab 2d 2a |Yu=....rl..&P.-*| +000000a0 61 17 03 03 00 42 00 0f 78 f4 5a 62 c5 56 bd f5 |a....B..x.Zb.V..| +000000b0 4a df d3 78 76 bd 90 71 49 69 8a b3 60 5b 24 8b |J..xv..qIi..`[$.| +000000c0 45 fb c7 e0 ff 04 d8 7b c6 1f 93 c9 f9 b8 0d 38 |E......{.......8| +000000d0 53 d1 2e 95 99 32 52 2e 45 b2 11 08 45 c7 bc 64 |S....2R.E...E..d| +000000e0 6a c2 32 db 70 96 77 6f 17 03 03 02 6d ba 3e 97 |j.2.p.wo....m.>.| +000000f0 ea d7 dd c1 c5 39 9a c4 b1 eb 8b df 35 57 43 35 |.....9......5WC5| +00000100 31 7a 4c 71 ab 57 79 80 f9 48 96 67 5f 3b fe 98 |1zLq.Wy..H.g_;..| +00000110 0b 5d d0 ce 8c 0c 5a 03 28 8f 64 b4 3e 74 75 51 |.]....Z.(.d.>tuQ| +00000120 81 b3 09 a7 8e 33 45 92 49 72 91 b7 2c 45 68 5c |.....3E.Ir..,Eh\| +00000130 ee 27 e8 5b fd b0 80 e3 43 35 2f a2 bd e5 cf d6 |.'.[....C5/.....| +00000140 c3 fc 43 03 1e aa c9 c4 67 db ef 0c c3 aa 46 18 |..C.....g.....F.| +00000150 39 69 31 26 7f 0a 7a b2 e7 c4 cb 09 3a f1 8e a0 |9i1&..z.....:...| +00000160 05 70 87 a9 12 c6 f2 a1 25 87 72 0a 2d fb d5 51 |.p......%.r.-..Q| +00000170 ce 93 8e f8 08 0e 86 90 04 00 9b 76 fd 57 23 cb |...........v.W#.| +00000180 bc 78 23 07 8a 35 92 6e d6 cd f5 b5 2e e1 8f 33 |.x#..5.n.......3| +00000190 7a bb 61 54 65 4f 4d 12 4b ca db 19 4b 30 6e 2c |z.aTeOM.K...K0n,| +000001a0 56 62 b5 32 7a 98 b6 a4 10 98 5a 16 6b 26 8e 7c |Vb.2z.....Z.k&.|| +000001b0 e0 88 77 a6 20 60 c9 fb c5 e2 66 c3 6d 0d df dd |..w. `....f.m...| +000001c0 21 22 10 da 88 24 21 92 74 3b d8 92 c0 ec 2f 57 |!"...$!.t;..../W| +000001d0 79 d7 42 bd d7 b0 e0 23 d2 a0 45 7f 2a 2a ff df |y.B....#..E.**..| +000001e0 a4 61 53 ec 44 e2 3a 7a 06 15 8a ce 02 84 e7 78 |.aS.D.:z.......x| +000001f0 9b ef 15 0e 84 16 fe 0f dd 36 de 0f 69 14 e4 35 |.........6..i..5| +00000200 90 e4 a0 15 a6 97 e5 c9 a1 3c ed 79 c6 03 ae 39 |.........<.y...9| +00000210 f2 36 1e ca 20 4f 20 59 e6 6f c7 15 ba 90 ac 4a |.6.. O Y.o.....J| +00000220 11 ad 3e f5 48 df 94 fe f8 48 2f 12 25 01 6c 9a |..>.H....H/.%.l.| +00000230 e6 ee 41 7b 13 4c 2f cc 3a 2d 8d b8 e7 d5 62 88 |..A{.L/.:-....b.| +00000240 88 5d d4 6e c4 64 c5 32 0a e7 86 08 64 2c 0a 11 |.].n.d.2....d,..| +00000250 8e 51 63 f9 81 30 00 b1 29 fa b8 1c ab 87 88 22 |.Qc..0..)......"| +00000260 f0 ef 79 04 8c 85 78 df 72 6c 99 d6 c7 3a 9f 2a |..y...x.rl...:.*| +00000270 6d c6 24 05 e7 e5 d7 d0 c7 e5 7c 87 50 f9 b7 69 |m.$.......|.P..i| +00000280 6d 1f 39 77 5d 4c f2 98 35 f7 07 b6 30 0d d6 25 |m.9w]L..5...0..%| +00000290 40 cb a4 2d b2 f1 22 ca 26 5d 92 22 97 0a 65 a9 |@..-..".&]."..e.| +000002a0 a0 46 58 be 0d af a1 1c da c8 bf 98 28 72 ea ee |.FX.........(r..| +000002b0 46 f9 c0 0d b3 f1 11 12 5f b7 69 75 ea dd 60 d0 |F......._.iu..`.| +000002c0 53 51 01 ec 7c ff ef 41 68 04 ec a4 6b 51 bb 89 |SQ..|..Ah...kQ..| +000002d0 8b 8d a2 89 05 6f 78 81 16 f8 7a c2 f6 c3 0d ef |.....ox...z.....| +000002e0 b3 12 e2 57 54 95 a6 cd 5d 04 32 88 70 f9 db db |...WT...].2.p...| +000002f0 b3 45 75 32 6f ac 9a fa ad 54 e5 a5 82 ae 3e 73 |.Eu2o....T....>s| +00000300 2d 07 f4 48 83 e2 10 7d cb 2f 4c 18 94 75 37 24 |-..H...}./L..u7$| +00000310 cd 13 dc 3a 56 93 e8 80 a3 ba de b1 0d 14 79 48 |...:V.........yH| +00000320 08 69 a6 f3 2e 9f 7a 78 6e 9c de 16 ba 73 0b a6 |.i....zxn....s..| +00000330 f2 6c 04 e6 e6 89 3d 46 7d db a4 8f 9a e7 5d 0e |.l....=F}.....].| +00000340 b9 6b 05 59 4d 4d e9 48 1a 18 e9 59 7b 56 70 d6 |.k.YMM.H...Y{Vp.| +00000350 0f fc c2 93 31 03 fa ad b4 c9 17 03 03 00 99 62 |....1..........b| +00000360 c5 b8 11 10 72 af 5b 36 7b 4b 86 83 05 1f 5a c5 |....r.[6{K....Z.| +00000370 66 7b b6 ac 30 8d c0 03 64 ec 29 5d 60 e9 e9 9d |f{..0...d.)]`...| +00000380 6d 58 3e 55 7e 19 a3 59 f5 8b ca 1a f0 c8 ca 1b |mX>U~..Y........| +00000390 c6 ed 7f d7 70 fb 4b a5 6a 96 66 ce 4c 96 d1 b4 |....p.K.j.f.L...| +000003a0 de 99 e2 31 4a 88 64 51 7b 73 60 bb 5c 46 9b b7 |...1J.dQ{s`.\F..| +000003b0 9f d8 97 de 03 06 f3 3e 34 8b 75 43 ce cd 9a 12 |.......>4.uC....| +000003c0 1e 27 b5 28 5e 8f b6 04 d2 02 19 02 02 72 85 46 |.'.(^........r.F| +000003d0 1c cb 5e 63 09 e6 ba 81 69 29 97 5f 31 1e 8f f5 |..^c....i)._1...| +000003e0 1a ed 3b 1e 97 83 bf ee 1f 09 f4 f7 be 32 c7 bc |..;..........2..| +000003f0 b6 7e 70 b9 32 4b 07 99 17 03 03 00 35 67 1c 72 |.~p.2K......5g.r| +00000400 de 27 25 26 1b 12 b2 9a a3 38 5c a7 f7 13 a4 1e |.'%&.....8\.....| +00000410 bf f9 7f 1d 57 af ff 2f 89 4b 75 fc 23 c5 47 00 |....W../.Ku.#.G.| +00000420 cd b7 b6 89 af 4e f0 17 e9 e6 31 cd fb b0 31 19 |.....N....1...1.| +00000430 73 61 |sa| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 02 1e e9 c3 0a e9 35 |...............5| +00000010 c0 d7 d8 1e 01 13 31 2c 39 0c 31 57 df f2 8d 7f |......1,9.1W....| +00000020 ca 2e 8c a0 63 60 e2 61 c6 37 8f cf 66 62 e7 d6 |....c`.a.7..fb..| +00000030 3d 89 6b 3b bd 1c 45 ec 62 a5 1c b3 86 16 bc 03 |=.k;..E.b.......| +00000040 57 9e 2b cd 31 d4 4d ad 57 96 12 12 19 ce 61 14 |W.+.1.M.W.....a.| +00000050 d6 1f 7a d1 c8 9b d4 9e 18 cf 1c f7 d0 ca 84 bb |..z.............| +00000060 8e 93 85 97 4b 53 68 3d f6 45 76 e0 a7 42 df 6a |....KSh=.Ev..B.j| +00000070 96 04 b9 9e 03 97 bb 57 bf 7f 9c 27 68 ba 04 49 |.......W...'h..I| +00000080 a7 c9 a3 f3 77 83 1f 15 0e 02 05 b5 8c e4 a6 ed |....w...........| +00000090 f8 65 5b bb a4 65 08 a1 a3 34 2a 71 66 6c 2e c8 |.e[..e...4*qfl..| +000000a0 e2 5b 08 ca 59 91 da 07 14 61 17 b7 19 28 00 33 |.[..Y....a...(.3| +000000b0 d9 0c 45 df d8 74 83 2e 9b 99 c7 35 cd f4 de 53 |..E..t.....5...S| +000000c0 b0 df 5c 8b 15 b0 e0 81 77 a5 5d d5 33 40 51 60 |..\.....w.].3@Q`| +000000d0 09 36 4f b6 6f ce 95 2b d1 38 88 33 e0 13 a0 c1 |.6O.o..+.8.3....| +000000e0 5f 2c 15 77 56 d1 16 09 9a 78 5c 6f 8c 93 c3 44 |_,.wV....x\o...D| +000000f0 54 04 b4 d3 23 31 ff 61 74 e5 09 3a d3 9b f1 2f |T...#1.at..:.../| +00000100 de f4 a9 0b b8 9d ca 17 2c 3f d5 2b dd c0 9e 07 |........,?.+....| +00000110 48 50 6a 51 72 be 92 10 1a 91 b5 2d 39 76 10 a4 |HPjQr......-9v..| +00000120 42 63 31 df ce 31 9a 5c 0d ee 6e 55 c0 ba 44 9f |Bc1..1.\..nU..D.| +00000130 e4 75 77 0f 88 6d 1d 24 9f 1c a0 12 14 4c ce 68 |.uw..m.$.....L.h| +00000140 24 a5 aa f2 f2 c5 f4 4f a9 c7 e0 dd 5c 6b 4c 53 |$......O....\kLS| +00000150 b5 26 8b e2 a4 af e3 13 77 0a fc dd 2b 56 fa a2 |.&......w...+V..| +00000160 46 7f 9a 11 c6 a0 4c b6 36 29 93 9f 83 99 13 ad |F.....L.6)......| +00000170 a0 62 9a ef 42 d0 dd 49 fe ba e4 fd fd 09 4b d4 |.b..B..I......K.| +00000180 31 6e d9 a5 0e 4d ac 8c 90 7c 26 2b 6b 1a cb 55 |1n...M...|&+k..U| +00000190 47 53 47 e2 d4 a1 d8 2e 5d 9b 36 75 f0 a4 8a 39 |GSG.....].6u...9| +000001a0 88 07 c8 ed 75 40 fd 72 0e 57 02 a6 bf 8a 64 0a |....u@.r.W....d.| +000001b0 98 8a 1c f4 d3 3d c4 af 7d 97 6e b7 e0 f6 d8 10 |.....=..}.n.....| +000001c0 17 0b d1 5c f9 41 c9 5e 5c 8a 38 dd 66 b3 e9 74 |...\.A.^\.8.f..t| +000001d0 41 2a bd 2d f8 6a 27 57 da ef d6 ca 70 49 c6 e2 |A*.-.j'W....pI..| +000001e0 94 ef 1e c6 57 a0 c8 fc d1 05 4f 65 c1 71 e4 ab |....W.....Oe.q..| +000001f0 44 49 f3 e3 6d b1 f4 5a 69 e7 70 30 b5 81 19 3a |DI..m..Zi.p0...:| +00000200 06 33 ef a5 bd 81 8c 3c 7b 2f 9f 41 a5 7d a8 5f |.3.....<{/.A.}._| +00000210 3b 3d 95 6e 04 a8 5f 2a c1 de 6e e4 14 17 91 36 |;=.n.._*..n....6| +00000220 9d 57 9c 34 1a 7d c8 c3 42 17 03 03 00 a3 a0 20 |.W.4.}..B...... | +00000230 06 7e 90 c8 0a b2 db 90 28 38 8f 42 12 89 1d 21 |.~......(8.B...!| +00000240 04 b3 a6 7b 8c 63 60 49 33 4a 70 4b 1a 97 90 51 |...{.c`I3JpK...Q| +00000250 d2 13 6e 56 9a 1d 41 9c 65 19 31 43 56 96 e2 50 |..nV..A.e.1CV..P| +00000260 77 17 67 6e df 3b e1 43 22 fe 0c 49 74 ff b0 e9 |w.gn.;.C"..It...| +00000270 5c f2 66 4e a3 e5 ac 02 1c 69 11 ce de a1 d4 6b |\.fN.....i.....k| +00000280 1c 46 97 02 7e 81 d8 29 78 42 82 5e b7 e2 31 02 |.F..~..)xB.^..1.| +00000290 fb 74 e2 a6 5e 29 f1 28 cf 8a 9c bd f8 a0 09 45 |.t..^).(.......E| +000002a0 67 7e d7 7d 91 8d fe 43 03 92 16 b1 67 cc 7a 32 |g~.}...C....g.z2| +000002b0 7e 3a 88 fc 77 36 b5 69 07 09 a0 1c 5c 76 a7 68 |~:..w6.i....\v.h| +000002c0 93 1a 35 20 f6 c1 20 c7 8f de c9 da 81 25 7a 08 |..5 .. ......%z.| +000002d0 e0 17 03 03 00 35 fa 5b 68 55 45 ee dd d6 a2 cb |.....5.[hUE.....| +000002e0 09 a7 21 23 43 9c c4 ff 1c d6 66 4c ce e1 bd a9 |..!#C.....fL....| +000002f0 77 22 0b b0 d4 ad f9 23 a7 1c 0e 63 27 36 16 c6 |w".....#...c'6..| +00000300 a2 f8 00 ef 36 22 89 a7 d6 76 da 17 03 03 00 17 |....6"...v......| +00000310 ca d3 97 3a 7d cc a0 95 02 4a a8 d8 dd 6d 26 64 |...:}....J...m&d| +00000320 92 be 64 86 00 d9 bf 17 03 03 00 13 18 1e 4f 7b |..d...........O{| +00000330 f9 1a 63 8a 50 6a ee 81 07 76 53 a9 95 ea df |..c.Pj...vS....| diff --git a/go/src/crypto/tls/testdata/Client-TLSv13-ClientCert-Ed25519 b/go/src/crypto/tls/testdata/Client-TLSv13-ClientCert-Ed25519 new file mode 100644 index 0000000000000000000000000000000000000000..38382edbea7e6355f32f3e608d60e716a39f0174 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv13-ClientCert-Ed25519 @@ -0,0 +1,124 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 72 63 6c 83 50 |....z...v..rcl.P| +00000010 e9 4c 88 85 70 4f e3 cb c7 0e 0c c5 e5 44 b9 7e |.L..pO.......D.~| +00000020 4a 88 d3 32 d2 37 5c 16 d4 a1 e5 20 00 00 00 00 |J..2.7\.... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 03 00 00 |................| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 d7 |..+.....3.$... .| +00000060 fa 97 47 72 9a 7e 63 47 d6 62 2d dc 5d 4f 7f 9b |..Gr.~cG.b-.]O..| +00000070 aa 86 c9 ba 65 4c ae 91 82 40 38 ad 4b 46 73 14 |....eL...@8.KFs.| +00000080 03 03 00 01 01 17 03 03 00 17 27 2e 49 01 db 5e |..........'.I..^| +00000090 e1 45 48 97 54 02 31 9f ad 62 74 58 70 77 21 5b |.EH.T.1..btXpw![| +000000a0 81 17 03 03 00 42 2c 0a 8a a0 e0 40 32 b1 2f 9f |.....B,....@2./.| +000000b0 e6 13 9f fd 62 88 a7 34 bd 9a bc 64 5d 9d 17 b9 |....b..4...d]...| +000000c0 b0 f6 fc 84 ca 3f 80 0b 97 4f 7a d9 67 42 c5 0a |.....?...Oz.gB..| +000000d0 e5 18 21 e8 08 42 b4 e6 f5 7e c3 70 2c 0e d3 d8 |..!..B...~.p,...| +000000e0 15 36 37 57 1a d5 58 64 17 03 03 02 6d 07 11 32 |.67W..Xd....m..2| +000000f0 d3 1e 03 02 fb 04 35 f2 64 a8 78 c2 b2 f7 7d 5c |......5.d.x...}\| +00000100 7c 94 0c 7b 16 9a 87 7d 2f 96 de 01 74 d6 6c 6f ||..{...}/...t.lo| +00000110 ce 95 eb f0 df 6d 52 89 3a 19 ff 5b b5 f2 d8 6d |.....mR.:..[...m| +00000120 e6 10 94 f7 d9 c4 58 e8 80 db f5 30 22 b1 82 b1 |......X....0"...| +00000130 66 05 b5 d0 71 40 0f 68 83 ec 43 b5 51 c3 f8 ce |f...q@.h..C.Q...| +00000140 e9 71 4a c7 cf 57 b5 53 3f 60 99 ae 84 df 98 cc |.qJ..W.S?`......| +00000150 9f 90 d0 fc 1d 03 e9 80 72 7c 60 51 a1 89 93 6d |........r|`Q...m| +00000160 0a 57 18 c6 dc 22 82 71 be 66 87 93 dd 16 41 c8 |.W...".q.f....A.| +00000170 84 38 33 63 fc 82 db 38 63 f8 84 f7 12 08 3b 82 |.83c...8c.....;.| +00000180 18 cb c0 50 0d dd 19 25 16 88 23 97 35 56 6d 46 |...P...%..#.5VmF| +00000190 3d 75 e1 83 c3 62 e4 19 70 6c 03 f0 33 5d 94 ad |=u...b..pl..3]..| +000001a0 6d be d2 db c4 b8 ad d8 78 78 53 76 62 91 f7 cf |m.......xxSvb...| +000001b0 83 5b 1e 44 11 2f 27 6a 29 d4 ea 96 fb 40 1c 94 |.[.D./'j)....@..| +000001c0 69 c2 cc c7 90 2c 60 14 c7 d4 f2 9c f9 0e 66 1c |i....,`.......f.| +000001d0 08 76 6e 9f 3b 3a 47 8a 40 0a de 00 e4 6f 45 ca |.vn.;:G.@....oE.| +000001e0 1d 41 cc 34 5a 2c 67 78 58 34 eb 19 0c a5 0e a2 |.A.4Z,gxX4......| +000001f0 fb c1 0a 25 74 f5 ec 55 f8 c3 97 00 d0 a5 90 c5 |...%t..U........| +00000200 a1 9c aa 19 2b e6 ee c1 9d 73 a1 3c 1f fa 6a 91 |....+....s.<..j.| +00000210 2b 2d 27 be 06 f3 85 54 63 a5 d9 ac 55 73 0a e4 |+-'....Tc...Us..| +00000220 4f dc 25 a0 9f 39 c0 0e 1a 9d a7 4c bd c9 3c 64 |O.%..9.....L..>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 01 50 90 77 22 64 76 |..........P.w"dv| +00000010 a1 cd 65 49 53 cb f0 2e 21 6c 12 7c 63 e5 ff 49 |..eIS...!l.|c..I| +00000020 6c be e6 ba 70 2d 22 49 6e 5c 5b 65 46 4b 64 01 |l...p-"In\[eFKd.| +00000030 f7 1d 57 a3 5f d5 a3 39 b6 b9 79 62 b3 e2 52 35 |..W._..9..yb..R5| +00000040 95 26 d9 2b 72 39 60 23 c4 5f 7e 88 66 d4 c8 2b |.&.+r9`#._~.f..+| +00000050 2d 89 38 c8 b8 bd 73 0a 02 27 92 ab 89 8a ee 9b |-.8...s..'......| +00000060 a2 bc 9e 55 fd a0 d4 f3 02 d7 d6 4c 6c 49 ef 7e |...U.......LlI.~| +00000070 35 56 90 41 90 53 24 f5 c1 19 f0 ff a0 c8 7c 82 |5V.A.S$.......|.| +00000080 52 01 98 8c ef 87 69 09 d2 17 35 af 9c 4b 3b b3 |R.....i...5..K;.| +00000090 6c 36 70 63 48 a2 88 df cb 87 f3 40 03 a8 b0 64 |l6pcH......@...d| +000000a0 cc 66 fb cf ba b9 be 8c 67 2d 3c 99 ac 7f 93 c1 |.f......g-<.....| +000000b0 15 2e 05 ae 95 51 3d 71 d9 43 09 d7 44 cb df 67 |.....Q=q.C..D..g| +000000c0 b8 b3 33 62 c5 60 cf 22 20 e5 45 17 7c d6 74 12 |..3b.`." .E.|.t.| +000000d0 0f 6d af d0 db dd 91 ad 20 ea 4d 26 fc c4 2b bd |.m...... .M&..+.| +000000e0 ec 3d 75 c8 87 36 b2 d0 1e cc 1d 92 fd 58 5e d5 |.=u..6.......X^.| +000000f0 f7 ad c2 ed 0c b6 c6 bc 25 ff 39 75 ee cf fc 76 |........%.9u...v| +00000100 77 e0 15 2e 22 82 3b 6f 93 e4 e9 a1 5a bb 9d 78 |w...".;o....Z..x| +00000110 e2 3d 18 c8 e5 ea e3 82 52 de bf ca 32 c9 56 21 |.=......R...2.V!| +00000120 ba c9 2b 12 7d 7b f5 18 73 e5 5e 9c 1e e1 23 92 |..+.}{..s.^...#.| +00000130 ec 58 56 e5 a4 aa dc 2b 59 75 71 19 06 77 83 d7 |.XV....+Yuq..w..| +00000140 0b 28 03 e9 fa 2c 89 1a 8c 64 f0 84 b6 13 f0 02 |.(...,...d......| +00000150 22 02 33 cf c4 22 dd fb b0 76 8a 17 03 03 00 59 |".3.."...v.....Y| +00000160 9b 4c 67 95 f4 37 c9 2c b7 33 c7 78 1c e0 1b 49 |.Lg..7.,.3.x...I| +00000170 41 6f 88 2d 99 a7 e3 d3 d1 d1 f6 36 b1 2a 8e df |Ao.-.......6.*..| +00000180 11 b6 8d 04 63 c7 11 49 e2 8c 79 03 6b b8 a4 8b |....c..I..y.k...| +00000190 2a 2c 04 ab b3 e2 50 03 51 77 65 eb 3a 45 f1 ce |*,....P.Qwe.:E..| +000001a0 65 9f 9c be d6 be 7f 28 14 6a 61 37 55 94 8f a7 |e......(.ja7U...| +000001b0 23 2f bc fc bb aa 89 47 76 17 03 03 00 35 f5 be |#/.....Gv....5..| +000001c0 e6 33 9b 48 97 74 b0 ad a4 fc 78 fe 20 ab cd fa |.3.H.t....x. ...| +000001d0 48 ad 8c 55 c3 46 b8 2e d6 ea f0 79 e3 a5 cf 29 |H..U.F.....y...)| +000001e0 56 19 ab 95 c4 7f fd 89 41 f7 a3 6f e4 19 2f 83 |V.......A..o../.| +000001f0 8c 3e 5d 17 03 03 00 17 74 24 c5 8d 30 40 0a 12 |.>].....t$..0@..| +00000200 57 37 d0 27 30 3e 24 ea 81 ca c7 0a f5 12 cf 17 |W7.'0>$.........| +00000210 03 03 00 13 ff 20 1a 76 60 da a1 15 22 16 10 8a |..... .v`..."...| +00000220 9f e1 ee 5d 62 a2 cc |...]b..| diff --git a/go/src/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-ECDSA b/go/src/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-ECDSA new file mode 100644 index 0000000000000000000000000000000000000000..10c83c4828d0052afe73c9700fd8b48b6d908f2f --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-ECDSA @@ -0,0 +1,136 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 af 7e fd 3d 23 |....z...v...~.=#| +00000010 96 b6 46 26 9c 09 13 f6 80 4f c9 d2 52 d9 df 52 |..F&.....O..R..R| +00000020 0b 7c da 61 52 ba 99 1b 32 5a 0c 20 00 00 00 00 |.|.aR...2Z. ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 03 00 00 |................| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 83 |..+.....3.$... .| +00000060 95 cf ff 0f f6 eb 66 dc 4f 61 f3 94 43 18 7b f5 |......f.Oa..C.{.| +00000070 91 6a e5 36 75 7b 6b 2c d4 38 f7 4f 36 f0 3c 14 |.j.6u{k,.8.O6.<.| +00000080 03 03 00 01 01 17 03 03 00 17 b7 83 3c 5c 9e ee |............<\..| +00000090 fc c3 14 33 45 62 69 8b 63 25 03 77 fe 7c 8b c0 |...3Ebi.c%.w.|..| +000000a0 0a 17 03 03 00 42 6c cd df 26 24 42 0d 2e 38 64 |.....Bl..&$B..8d| +000000b0 c5 92 7c 6b 18 47 cc 90 09 57 95 0a f9 cc 81 f1 |..|k.G...W......| +000000c0 db 90 29 ba b0 3f db 99 55 78 93 ab 05 34 91 46 |..)..?..Ux...4.F| +000000d0 ce cb c5 2c b8 fb 43 98 31 cc 18 8f 2e 2a 39 78 |...,..C.1....*9x| +000000e0 68 6d 01 29 05 ff 7e 4f 17 03 03 02 22 c1 3d c5 |hm.)..~O....".=.| +000000f0 cb 42 fe 5d a8 ea 65 fd 1a a8 cd a9 28 ed 8d 69 |.B.]..e.....(..i| +00000100 5b eb 28 11 c5 bb 9f 58 8d f2 2d 44 b4 8f 87 d6 |[.(....X..-D....| +00000110 3f af df 3f 13 c0 7e bf 6f b3 e0 fa 45 5c ee a2 |?..?..~.o...E\..| +00000120 13 70 08 94 2d 87 a7 1c 23 a9 aa a1 64 d2 49 ed |.p..-...#...d.I.| +00000130 33 2c ae 02 9e a7 03 24 3f 4c 43 d4 2e 54 b9 fc |3,.....$?LC..T..| +00000140 39 6c 32 8c b1 0c bb f6 31 60 d9 48 82 5b ed 2b |9l2.....1`.H.[.+| +00000150 ea dd e3 2d 1a 35 a3 22 be e1 f1 13 04 9c aa 1a |...-.5."........| +00000160 24 39 4a 0d 63 fb ce 31 71 af e6 1c f3 a3 dd c1 |$9J.c..1q.......| +00000170 51 40 28 5a 11 a0 9e 19 0a a5 74 e2 40 56 9c 55 |Q@(Z......t.@V.U| +00000180 40 45 e6 20 5d 23 aa 85 ec 42 5f 2c 24 10 fb ff |@E. ]#...B_,$...| +00000190 8a 52 e6 33 8f e1 1e e1 51 8a 9f 5d 6f 63 b8 04 |.R.3....Q..]oc..| +000001a0 13 ab fa 5d 85 ba d3 eb cf b9 0b 89 08 b7 7b a9 |...]..........{.| +000001b0 ea 07 b9 41 07 7a 08 7b 57 01 35 11 a1 65 99 4a |...A.z.{W.5..e.J| +000001c0 4c 4a 1f c2 94 5a 00 09 9a 13 37 23 16 60 45 62 |LJ...Z....7#.`Eb| +000001d0 96 fa 6b 7a 0f d6 68 14 f5 cd 40 d7 0a eb ea 75 |..kz..h...@....u| +000001e0 f0 29 cb ea 7f e7 55 36 d9 02 b2 a0 bc 54 ac 04 |.)....U6.....T..| +000001f0 1b 00 10 c0 db 45 81 e6 97 2a 4a 57 1d e7 de e3 |.....E...*JW....| +00000200 d1 0a 09 c7 73 6a 9e a0 3c 79 7f a8 26 6a 98 05 |....sj..B ]^..| +000003f0 a3 91 |..| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 02 11 e0 62 97 8a 4d |............b..M| +00000010 01 cf 8f e2 d2 a8 0d d4 9a fc f5 b2 d7 82 2b 7a |..............+z| +00000020 8c e7 ce 2a 99 3b 41 a2 a3 ca c4 9d 15 79 7f 2f |...*.;A......y./| +00000030 04 7a 18 e4 5b b6 01 d6 b5 03 d2 08 15 41 c7 18 |.z..[........A..| +00000040 8a 66 78 05 ed 33 19 8e 93 9e c3 ff 4a 92 bb 7b |.fx..3......J..{| +00000050 72 e5 81 a6 2a 7f b3 e1 72 67 01 7a 95 f4 3f bc |r...*...rg.z..?.| +00000060 cd e4 bc 45 74 9b 4c 1c 69 68 d0 75 89 9f d5 d0 |...Et.L.ih.u....| +00000070 de 59 d4 1c 47 cc 5e 2e dd bd f9 1f e4 16 c9 c8 |.Y..G.^.........| +00000080 9b 4e 07 6b 7a 12 e7 13 71 ae c1 26 48 32 d6 4e |.N.kz...q..&H2.N| +00000090 8a 15 c2 a0 91 59 9d 21 0d 28 d2 94 3f e9 fc 74 |.....Y.!.(..?..t| +000000a0 98 5b e5 be 50 ad 10 7d d9 a1 da 41 59 15 b3 85 |.[..P..}...AY...| +000000b0 2d 7b 81 b3 ae fb db 4c 00 24 31 57 f2 54 b7 f7 |-{.....L.$1W.T..| +000000c0 64 cc 73 23 bc 6a 93 e0 91 a7 5e 1b 63 f1 59 89 |d.s#.j....^.c.Y.| +000000d0 a9 d9 7b 88 35 17 7a 4d b9 66 d0 a5 f2 d6 79 ed |..{.5.zM.f....y.| +000000e0 c1 3a e7 98 88 96 e7 2f 31 66 bf 16 34 e2 fd 5f |.:...../1f..4.._| +000000f0 fb 0f fb 9a aa ba 78 d8 6a c9 72 d6 39 32 3a 99 |......x.j.r.92:.| +00000100 a2 11 8a 32 79 cf 18 d9 22 da 40 31 3e d3 c8 17 |...2y...".@1>...| +00000110 c4 1f e2 4f c8 7f b9 2f 83 d7 5e 59 48 d3 9b b9 |...O.../..^YH...| +00000120 68 9c c2 e4 45 c2 a3 26 91 cd 3a 26 47 c4 b8 7f |h...E..&..:&G...| +00000130 8f 91 c0 06 b5 6e 5e b4 65 05 42 ea 48 9e 40 bc |.....n^.e.B.H.@.| +00000140 0c 04 22 86 6a 54 6c 27 c3 77 b4 b9 22 99 6a f0 |..".jTl'.w..".j.| +00000150 91 bc 41 ca 24 41 52 fd e2 18 0f 64 13 7e a3 6b |..A.$AR....d.~.k| +00000160 ab 27 1e 15 87 0d 7f 71 1e 29 16 f9 af 81 ec bc |.'.....q.)......| +00000170 28 0b 45 bd 76 fd ff 0e fb 8d c5 0c aa ef a5 17 |(.E.v...........| +00000180 55 49 a6 3d 74 5c 8d 77 60 99 a1 8f aa a9 eb 0f |UI.=t\.w`.......| +00000190 75 1a 55 21 3a 96 da 08 a2 cd ad 11 78 15 6a ce |u.U!:.......x.j.| +000001a0 ef f6 fb 8b a3 dd fd ad 2d a5 2d 59 25 37 fe 53 |........-.-Y%7.S| +000001b0 48 90 fa 9a d3 3c 09 69 47 d3 d1 e4 48 30 fd df |H....<.iG...H0..| +000001c0 15 d7 64 ff ca 91 46 c2 36 82 30 ae 4e 75 12 be |..d...F.6.0.Nu..| +000001d0 58 5d da 63 da bd dc be 81 be ad 37 87 ea 0a 26 |X].c.......7...&| +000001e0 31 cf 1b 1e 7d de a8 04 e3 b8 e5 65 5a 21 db b6 |1...}......eZ!..| +000001f0 2b 7c e7 23 7c 2b e1 89 3f 28 27 97 dd 1c c6 00 |+|.#|+..?('.....| +00000200 0e e4 05 68 0f 9a 8a 1d e6 bd bd aa 1f 46 6e a2 |...h.........Fn.| +00000210 d9 69 91 9b e7 e3 6c 39 33 77 b8 76 17 03 03 00 |.i....l93w.v....| +00000220 99 c9 3e 7e 78 3b 91 65 35 cb 19 44 92 f7 77 f5 |..>~x;.e5..D..w.| +00000230 60 3c 19 2a 97 c5 a0 92 b2 28 e2 44 94 ec 1b 3d |`<.*.....(.D...=| +00000240 f8 1a c1 65 eb 41 3f 61 f1 db 42 1a 0d b8 32 12 |...e.A?a..B...2.| +00000250 f6 1b 83 be 37 d8 fe 78 bd 5b 66 d1 f2 6c 3e e3 |....7..x.[f..l>.| +00000260 8a 0f 3a 28 57 71 1a 78 ab 2a b5 5f ad a3 6e 2c |..:(Wq.x.*._..n,| +00000270 a3 d9 3a 0b d0 99 95 d6 dc 8e 7a f0 b6 e4 cb 46 |..:.......z....F| +00000280 ab cb eb cf ec 86 b3 fe e6 e6 73 2c a2 64 d2 d5 |..........s,.d..| +00000290 9c 8c 25 39 62 07 51 93 12 92 2b e3 4b 2e 3d f5 |..%9b.Q...+.K.=.| +000002a0 f1 d4 22 69 c3 90 cf 91 35 2f e4 60 35 44 6f bf |.."i....5/.`5Do.| +000002b0 7a 75 3d fb 70 bd 20 05 a8 f8 17 03 03 00 35 6e |zu=.p. .......5n| +000002c0 09 00 fa 13 8f d4 17 40 ee 9e 5f 8a 56 ba 7c 69 |.......@.._.V.|i| +000002d0 05 ee 65 8e fd 9c 62 7f f9 af 04 c7 46 20 07 da |..e...b.....F ..| +000002e0 bc 79 f8 cc 53 c6 fc 47 b5 54 9c fb 4d a3 cf 56 |.y..S..G.T..M..V| +000002f0 a4 57 c5 aa 17 03 03 00 17 d6 ea 39 50 a5 8e 67 |.W.........9P..g| +00000300 b9 79 76 17 77 86 a8 58 fb 86 03 74 1a e4 12 37 |.yv.w..X...t...7| +00000310 17 03 03 00 13 e7 07 59 c3 d0 27 b3 d8 e8 a3 7b |.......Y..'....{| +00000320 df e8 17 08 78 4e 9a 6b |....xN.k| diff --git a/go/src/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-RSAPSS b/go/src/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-RSAPSS new file mode 100644 index 0000000000000000000000000000000000000000..4892e2b55551582a4380c3b2d080669150e549b3 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-RSAPSS @@ -0,0 +1,145 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 56 a4 21 f9 b3 |....z...v..V.!..| +00000010 ff ed 23 dc a7 eb cd 4b f3 0a a9 12 a4 52 84 04 |..#....K.....R..| +00000020 77 59 23 09 26 6c 49 42 9f 68 b2 20 00 00 00 00 |wY#.&lIB.h. ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 03 00 00 |................| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 e0 |..+.....3.$... .| +00000060 70 9a 3d 69 69 1f 8f de d4 c8 7c dc 65 53 9a c6 |p.=ii.....|.eS..| +00000070 77 c2 c4 21 1b 06 2d c4 4f 24 61 52 5b 00 69 14 |w..!..-.O$aR[.i.| +00000080 03 03 00 01 01 17 03 03 00 17 96 99 40 9f d8 9d |............@...| +00000090 70 f0 cf f0 86 3e 7f 4a 3a 8a a4 63 6e e1 7f 24 |p....>.J:..cn..$| +000000a0 f4 17 03 03 00 20 72 bb 5a aa 0e 2e d9 cc 38 0c |..... r.Z.....8.| +000000b0 c8 b9 88 08 6f 19 d8 38 14 14 d7 97 42 6c 45 43 |....o..8....BlEC| +000000c0 51 dc 2b f6 02 e2 17 03 03 02 7a 8d 04 2f 64 c0 |Q.+.......z../d.| +000000d0 e2 7b b5 20 9d 04 69 5e 88 82 aa f3 c6 b2 8d 6c |.{. ..i^.......l| +000000e0 41 08 c3 b1 0c 7d d1 5f d6 e6 b7 1d c0 ad 2b 0d |A....}._......+.| +000000f0 02 c5 f7 6d a0 87 91 07 20 d3 d4 2e 5a 7d 5e 29 |...m.... ...Z}^)| +00000100 37 2b ac 5f d6 cb eb e9 99 a7 05 f7 e7 ea 9c 99 |7+._............| +00000110 cd 33 25 f8 45 95 43 f4 7a 59 2a 91 8c e2 ac 84 |.3%.E.C.zY*.....| +00000120 ba 99 ef d0 d7 ea 9b db 31 b0 27 0c 81 3b b2 83 |........1.'..;..| +00000130 20 c4 8b 7e 05 ac c6 82 e9 56 5a a2 b6 7c c7 33 | ..~.....VZ..|.3| +00000140 a8 31 2f ad 60 be ec c3 2d c0 a8 b4 40 50 98 ea |.1/.`...-...@P..| +00000150 83 d1 cc a8 34 20 11 7c 2e f7 7c ca d8 27 03 a2 |....4 .|..|..'..| +00000160 58 86 e8 e6 41 46 07 18 c7 a7 61 f9 cc 2f 7d 1e |X...AF....a../}.| +00000170 bb 34 7c 6e cb b3 9c 03 2f b0 dd e9 a1 32 13 10 |.4|n..../....2..| +00000180 85 1d fa a6 bf c7 4d ec 94 8f 26 07 94 34 b3 5f |......M...&..4._| +00000190 b8 e4 da 6f 3d 5b 0a 61 8f 44 58 10 1a 4c f3 bc |...o=[.a.DX..L..| +000001a0 ff c7 8f 09 0a e4 1b 35 e8 a9 dc 9c 14 86 e5 67 |.......5.......g| +000001b0 7e 96 e9 79 8d b2 d7 34 a0 7f 43 07 11 f1 03 68 |~..y...4..C....h| +000001c0 95 5e f5 fa e7 8f c8 d6 5b 23 c4 84 e4 c5 40 58 |.^......[#....@X| +000001d0 80 4a ac b7 a7 07 21 93 c1 a9 ad 9a 89 f7 f3 9e |.J....!.........| +000001e0 bb 7d 2a 00 d0 e0 66 9d f7 86 4a ba b1 c9 1e 3b |.}*...f...J....;| +000001f0 f1 c6 6e c1 9c 09 85 38 9d fa 5a b9 ca bb a4 f5 |..n....8..Z.....| +00000200 9e 3f ba d4 31 7d aa d7 f9 bf 83 05 5c 1f 61 18 |.?..1}......\.a.| +00000210 d4 5e 16 98 c6 92 7b bd 12 96 18 c7 33 75 ad 08 |.^....{.....3u..| +00000220 d1 0b 47 4c c8 73 3e 68 fb 53 ff e0 1a 10 6c 5a |..GL.s>h.S....lZ| +00000230 7f 9d 92 32 2f c2 2d 95 7d c6 ef 18 9b 44 a1 bc |...2/.-.}....D..| +00000240 6a f5 88 79 e1 00 a3 14 8f 66 07 03 16 2a 53 80 |j..y.....f...*S.| +00000250 9b 26 80 0d 0b 5e 0c c6 c9 fa a1 3b c9 a6 91 1f |.&...^.....;....| +00000260 bd fb 79 24 ab 93 e4 25 d1 a6 41 8b 9e a9 06 0f |..y$...%..A.....| +00000270 80 2e 4e 8c 20 2c 1e a8 7e 63 7a 4f b8 90 c3 56 |..N. ,..~czO...V| +00000280 a3 9e 63 2a 8b 85 9e ef 66 f5 16 be 79 c3 9b 47 |..c*....f...y..G| +00000290 dc 1c 75 0b 30 3c db 32 e8 ec 33 f9 9f 26 3d 56 |..u.0<.2..3..&=V| +000002a0 36 e9 ea 83 57 c4 59 ac 73 db 04 5a 1d 38 9b e4 |6...W.Y.s..Z.8..| +000002b0 47 50 f8 92 92 7f c9 09 4f f4 9c ab 3e 03 df 80 |GP......O...>...| +000002c0 cc 5b 50 0b 06 ef 8c 59 d2 f6 f3 a4 16 e7 0f 90 |.[P....Y........| +000002d0 c8 79 95 0a 39 0f 33 69 31 29 1c 30 77 72 58 b5 |.y..9.3i1).0wrX.| +000002e0 cf 0e 4c 30 fc 0a 01 93 b1 20 21 34 2a ce 28 8d |..L0..... !4*.(.| +000002f0 57 71 3e c9 b1 51 c9 4f e5 e4 09 0b 1e 32 52 4e |Wq>..Q.O.....2RN| +00000300 d0 be f2 a2 90 75 f4 a8 61 66 43 84 74 4e bb 28 |.....u..afC.tN.(| +00000310 7b ea 68 96 92 6d 4b 8c af 50 13 84 92 b9 6b 48 |{.h..mK..P....kH| +00000320 60 1c 60 62 28 a2 37 d1 1c 86 d4 60 27 a6 5b 6d |`.`b(.7....`'.[m| +00000330 88 d7 56 21 b7 86 f5 b6 34 f9 55 cf 47 f8 4f 90 |..V!....4.U.G.O.| +00000340 78 5c 56 52 97 17 03 03 00 99 35 71 51 6f 73 ba |x\VR......5qQos.| +00000350 76 60 e1 4a 5f ec ce 52 b6 91 58 3d 0c ea e6 58 |v`.J_..R..X=...X| +00000360 7e ee da 1e aa df bb 8e c9 89 ce 43 bd e7 34 9b |~..........C..4.| +00000370 b8 4b dd 50 73 0c f7 e5 15 e0 a1 c3 bd 07 08 62 |.K.Ps..........b| +00000380 a2 d5 2e 9f 46 f7 4d 9c ae ad be 22 89 0f b0 3e |....F.M...."...>| +00000390 82 1c 80 60 38 39 4f 06 f9 fc 4c f8 02 bf b3 5a |...`89O...L....Z| +000003a0 25 22 f4 62 61 ba eb 78 b2 40 68 ea 99 ef 95 90 |%".ba..x.@h.....| +000003b0 b1 b5 25 17 81 43 5c 15 bd a9 1f e8 0f b9 91 be |..%..C\.........| +000003c0 f1 47 91 99 ec 50 3b fa c2 06 fc 89 09 a3 d7 b3 |.G...P;.........| +000003d0 ed e3 3d 41 57 07 4b b0 3d 02 51 7e 13 bb d3 68 |..=AW.K.=.Q~...h| +000003e0 49 4c 6a 17 03 03 00 35 63 f7 b5 68 31 22 c7 f5 |ILj....5c..h1"..| +000003f0 50 ae c0 81 0f 50 fb ba 50 72 8a d7 e0 c0 73 07 |P....P..Pr....s.| +00000400 d0 88 ed 6d 7b e7 66 b3 8d e3 10 ca 2f 68 c3 39 |...m{.f...../h.9| +00000410 d9 b9 09 44 78 4a 11 91 fb 51 ea 9f 9a |...DxJ...Q...| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 02 7a 63 6c 83 c6 db |..........zcl...| +00000010 85 98 08 0a da be 96 d7 7a 2e 61 7b 7e d1 4f d4 |........z.a{~.O.| +00000020 45 03 25 05 50 fc 20 ee 8f ae 56 39 15 0b c3 44 |E.%.P. ...V9...D| +00000030 80 5c 81 45 55 df 1d cd 30 92 7c 5e 43 16 e1 29 |.\.EU...0.|^C..)| +00000040 46 77 d3 03 6d 36 11 d0 91 76 a8 34 f0 98 67 f6 |Fw..m6...v.4..g.| +00000050 88 f8 f7 d0 a3 ee e0 d1 30 9f 6f e9 75 ad d6 e9 |........0.o.u...| +00000060 e8 e9 6f 11 55 7e 66 87 9a 7e 9d a5 31 b2 67 fd |..o.U~f..~..1.g.| +00000070 a2 a7 c8 c8 4d d8 2b f1 5b a9 b5 df 03 42 55 96 |....M.+.[....BU.| +00000080 9e 73 9c 9a 6a b9 9f 2e a5 ec ba 0b a3 5b 99 b4 |.s..j........[..| +00000090 7c 57 96 fb f5 96 20 ac 71 90 bb 4b 76 dd 2e 01 ||W.... .q..Kv...| +000000a0 17 d0 63 76 c9 4a e5 ae 58 bd 59 b5 e1 85 6d 46 |..cv.J..X.Y...mF| +000000b0 9f d5 3e 9d a7 f0 92 96 ec 4e 90 c3 5a 52 ba e5 |..>......N..ZR..| +000000c0 bd fa f0 a7 88 d5 9e 76 9b 2b 23 fb 37 c0 f1 0a |.......v.+#.7...| +000000d0 d2 df d4 2c 5d 8c 64 f0 98 3c 85 3f bb ed 30 44 |...,].d..<.?..0D| +000000e0 eb cb fc 47 e5 8a 57 ff 37 23 6d e2 75 a7 15 e4 |...G..W.7#m.u...| +000000f0 dc f9 02 8f c4 af d8 e8 bb 07 43 90 5b c2 86 f3 |..........C.[...| +00000100 40 22 a7 bb b6 f1 f6 4c 2e d6 fd d8 02 f0 3d 27 |@".....L......='| +00000110 89 38 97 7d 6e d3 6c b1 4c 87 ca 30 e9 ec fe b3 |.8.}n.l.L..0....| +00000120 db 62 ea 2f 3a 83 95 18 4e 44 4f 97 c4 ff f6 bb |.b./:...NDO.....| +00000130 0b b0 98 c7 c6 c7 94 0a 8b c9 c0 d9 51 d3 6a e1 |............Q.j.| +00000140 36 55 79 c4 37 75 6f e7 14 53 60 9e 22 00 fe d7 |6Uy.7uo..S`."...| +00000150 ef e4 ca 60 38 12 25 8c c6 c9 7e 5f 1a 7c f1 c1 |...`8.%...~_.|..| +00000160 a7 15 b2 f4 32 31 de c8 a2 d4 59 46 1e 68 a6 94 |....21....YF.h..| +00000170 b8 18 52 df 44 01 0b a0 a0 02 60 83 84 fc ad 99 |..R.D.....`.....| +00000180 fc 60 0b 23 0a 7a f9 73 bf d8 a5 af 9b ea dd a3 |.`.#.z.s........| +00000190 fb 5b 41 17 95 0a 57 4a 94 7e 24 9f 31 74 06 65 |.[A...WJ.~$.1t.e| +000001a0 95 90 40 20 17 0b 95 22 b8 49 4e a6 a4 be e1 74 |..@ ...".IN....t| +000001b0 01 a2 7e cd 60 50 46 5c fd 2a 88 90 ef 7f 6c b8 |..~.`PF\.*....l.| +000001c0 3e a1 40 8e 91 cd 8d db ad 81 d0 08 b0 d0 d7 ae |>.@.............| +000001d0 18 4f 47 9b 1a 66 8b a5 d2 fb 01 d3 67 79 46 71 |.OG..f......gyFq| +000001e0 5a 49 dd df 06 c6 57 c7 e0 b1 60 39 d4 a9 37 88 |ZI....W...`9..7.| +000001f0 31 0d c0 92 4e c7 2a 25 c4 df b0 d8 df bb 31 1b |1...N.*%......1.| +00000200 ff 0a 34 46 46 88 0b 11 7d 20 32 cd 01 d0 3f 11 |..4FF...} 2...?.| +00000210 e1 6e 63 42 d7 4a 83 ab ad f7 51 bd c3 37 2b 76 |.ncB.J....Q..7+v| +00000220 9e bb 45 3b 81 d8 47 71 02 b9 fe 7c 56 46 78 3e |..E;..Gq...|VFx>| +00000230 9e 94 00 1b 98 17 72 37 c0 e5 36 a9 f0 02 b7 cf |......r7..6.....| +00000240 f0 b4 66 10 1b 91 07 5f bb 22 e8 12 d9 e3 33 dd |..f...._."....3.| +00000250 87 66 e4 f6 00 f6 3a dc 19 59 af ce 8e ae c4 d3 |.f....:..Y......| +00000260 03 d8 25 02 40 7e 95 70 31 85 53 bc 9e 96 11 69 |..%.@~.p1.S....i| +00000270 5b 2f b9 17 48 f4 ae c5 a1 c5 d1 7f 4a 10 06 b6 |[/..H.......J...| +00000280 2e 34 6c 09 12 17 03 03 00 99 16 4c 04 64 97 e0 |.4l........L.d..| +00000290 26 e1 66 e9 34 05 d7 d3 75 e3 b9 de 56 15 51 67 |&.f.4...u...V.Qg| +000002a0 fb fe 9a c6 9a 3c 38 08 2c c8 8c dd fe 49 c5 ed |.....<8.,....I..| +000002b0 a8 54 86 90 2c f6 7c d1 12 02 99 94 5e 2e 4b 4e |.T..,.|.....^.KN| +000002c0 84 e9 b4 96 5c dc 56 28 3d ea a9 4f 8f ad 51 ff |....\.V(=..O..Q.| +000002d0 02 b1 b9 7a 29 e5 32 7c 2a 8b 60 5d e2 fc b4 8f |...z).2|*.`]....| +000002e0 06 32 4a ea 37 ed 03 f0 68 72 b7 83 1f 04 10 2b |.2J.7...hr.....+| +000002f0 24 db 5b 10 6c 41 55 40 54 69 07 39 d4 db ac 10 |$.[.lAU@Ti.9....| +00000300 77 9f 04 f4 b9 3f 35 7e 04 af ab 7a a0 47 b9 d9 |w....?5~...z.G..| +00000310 4c 6e 25 00 ce ef 93 3f 28 2c 2d f6 42 e4 5f 3e |Ln%....?(,-.B._>| +00000320 26 92 13 17 03 03 00 35 fb 14 eb 5f 18 61 75 ba |&......5..._.au.| +00000330 e4 dc d2 95 fe 93 bb 54 29 e3 38 e3 59 54 81 9f |.......T).8.YT..| +00000340 4e 29 be c6 e6 cd ad 8c 9d 6a ad 28 ec d3 a6 e4 |N).......j.(....| +00000350 bc 5e 8c df a8 7e 14 d8 69 3c 30 7c 0a 17 03 03 |.^...~..i<0|....| +00000360 00 17 10 73 c0 75 88 af 51 90 ff 3f b2 83 47 27 |...s.u..Q..?..G'| +00000370 19 c0 e6 cd 14 a4 c7 8d a0 17 03 03 00 13 fb 1f |................| +00000380 ed 8e 47 c8 79 f9 53 df 6d 97 a7 1d 53 8d 80 85 |..G.y.S.m...S...| +00000390 dd |.| diff --git a/go/src/crypto/tls/testdata/Client-TLSv13-ECDSA b/go/src/crypto/tls/testdata/Client-TLSv13-ECDSA new file mode 100644 index 0000000000000000000000000000000000000000..eeab8711723b55e230260bd64ac24b6aa8138ba3 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv13-ECDSA @@ -0,0 +1,88 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 a5 7b 07 50 bc |....z...v...{.P.| +00000010 01 11 74 76 99 fb 85 e5 40 6b 02 14 d9 64 b1 8a |..tv....@k...d..| +00000020 8b 78 a3 ee 2e 4d b0 96 14 3a fb 20 00 00 00 00 |.x...M...:. ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 03 00 00 |................| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 67 |..+.....3.$... g| +00000060 b0 dc 13 4f 2b 92 43 27 38 b5 2c 7a 3a 87 83 6f |...O+.C'8.,z:..o| +00000070 a1 cc 43 fa 90 9e 2e 4d 88 f6 60 d4 20 32 6a 14 |..C....M..`. 2j.| +00000080 03 03 00 01 01 17 03 03 00 17 9b 51 d0 81 30 4b |...........Q..0K| +00000090 52 65 8b b5 fe 1a cc 44 c9 7a 10 83 41 0b 1a 00 |Re.....D.z..A...| +000000a0 76 17 03 03 02 22 4e 55 d0 64 9c 41 c8 22 2c 9c |v...."NU.d.A.",.| +000000b0 0e 0a 0c 2b 2b 2e 6e 08 d5 54 75 61 99 bf ea f5 |...++.n..Tua....| +000000c0 ca 12 3e 44 7f 81 a8 40 d1 7c 4d a0 a3 d2 f3 07 |..>D...@.|M.....| +000000d0 40 af 68 81 69 dd 7c 77 24 26 87 73 73 5e d2 0c |@.h.i.|w$&.ss^..| +000000e0 2a 32 c5 34 50 ef a8 0f 63 12 3a 47 34 8f f2 c6 |*2.4P...c.:G4...| +000000f0 9f bd 81 bf ea 69 47 04 8b 87 64 4e 67 81 10 a5 |.....iG...dNg...| +00000100 f1 76 92 5e d6 11 a5 48 5b cc ef a8 43 dd cf f5 |.v.^...H[...C...| +00000110 20 9d b8 2f f4 0d 92 10 55 af d1 fa ab 64 5f 99 | ../....U....d_.| +00000120 3e 6b e9 70 70 f1 22 d9 05 04 89 3a fa 65 ae 91 |>k.pp."....:.e..| +00000130 9d 07 ea 54 93 2d 02 0c c0 70 d9 e9 f0 9a 5a 81 |...T.-...p....Z.| +00000140 c6 c6 79 e0 e1 90 ad 34 78 bf d3 c8 9c 68 2e ac |..y....4x....h..| +00000150 e6 2d c0 e5 c8 3c 77 80 d7 dd e5 a4 ac b8 36 4f |.-...@..I<..FW.Ye.| +00000170 4e db 21 ea ab 72 47 79 e6 c1 4f ea 17 e3 b4 73 |N.!..rGy..O....s| +00000180 9d e2 e5 72 be 88 0a 60 1e 35 02 67 33 a0 7a 05 |...r...`.5.g3.z.| +00000190 b8 ae 05 b2 53 6c cd c5 e3 a5 16 56 2b b0 0e 8e |....Sl.....V+...| +000001a0 a0 ca 54 c0 34 6b 00 22 69 de e1 57 81 48 c6 1a |..T.4k."i..W.H..| +000001b0 cc 88 f6 15 1c 7e b6 1f b0 48 82 75 6b ff 42 78 |.....~...H.uk.Bx| +000001c0 f9 85 10 86 5b af 31 62 f6 7b d4 8a a6 86 3f 99 |....[.1b.{....?.| +000001d0 9b ce 91 c0 4d 44 5b 3f 16 81 d0 a9 4a e0 2d 85 |....MD[?....J.-.| +000001e0 a4 80 91 64 13 20 33 dc 84 48 da 79 2e 73 cb 78 |...d. 3..H.y.s.x| +000001f0 9c 05 8a 6c 42 ce b0 b0 45 3c 05 47 47 f7 92 3b |...lB...E<.GG..;| +00000200 d2 fb 65 f0 40 a3 52 b7 aa 04 ae 71 84 35 12 7a |..e.@.R....q.5.z| +00000210 33 f8 8b 0d 21 a3 29 ad 78 de df 7f 53 71 fb 5f |3...!.).x...Sq._| +00000220 a5 ab 07 89 3a 1f e9 ca 6d 8d bb 04 39 8d b3 50 |....:...m...9..P| +00000230 7e 2e bd 0f b8 ff 4f 3f d1 a5 23 b9 80 33 da b0 |~.....O?..#..3..| +00000240 2c dc 0f c2 26 b2 cf 59 d9 10 ef 66 52 40 e4 54 |,...&..Y...fR@.T| +00000250 28 5e 7f c1 94 62 8f 4f 9b 94 fc c9 32 af f5 17 |(^...b.O....2...| +00000260 5d 04 32 08 83 f4 90 68 68 01 d3 00 ed 82 f3 da |].2....hh.......| +00000270 81 2e d5 df 1e 13 c3 c3 76 83 c4 67 23 c4 32 c0 |........v..g#.2.| +00000280 59 5d dd 56 78 d9 74 ef 7b d5 c9 13 4d 62 29 85 |Y].Vx.t.{...Mb).| +00000290 ca 24 53 1a b1 2b 09 a1 a6 26 db 13 cf 2a 2b 92 |.$S..+...&...*+.| +000002a0 85 a3 51 2b 24 e1 90 2a fe 0c 74 ee 86 cc 3b 6a |..Q+$..*..t...;j| +000002b0 07 21 a6 b6 97 a4 e0 9f 3d 75 9a 2b 9e 91 ef d8 |.!......=u.+....| +000002c0 c9 94 28 ba 40 e4 cc 6a 17 03 03 00 a4 ab c3 c1 |..(.@..j........| +000002d0 32 1d 44 0d f7 85 e3 85 df 9e bb 0c 82 18 a2 9f |2.D.............| +000002e0 27 de 78 4f 06 9b 43 59 27 b5 8e 34 4d 96 b3 96 |'.xO..CY'..4M...| +000002f0 af 8b 98 d0 36 91 52 df 9c aa c2 fe e7 0f ed ca |....6.R.........| +00000300 ef 57 73 97 cc c8 dc 7c c8 15 73 ad a6 3e 54 93 |.Ws....|..s..>T.| +00000310 1a ab 72 f6 e0 e3 cb bb fe a5 d1 45 47 f3 1a 89 |..r........EG...| +00000320 40 f7 9d f5 e4 61 16 fa 12 0a 62 24 a7 34 ab 6f |@....a....b$.4.o| +00000330 08 85 b2 fe b2 5c 49 59 7b cb 05 b2 e3 1a 37 79 |.....\IY{.....7y| +00000340 b1 27 28 a5 ab ee ae 72 11 19 61 c0 3b ed 32 ec |.'(....r..a.;.2.| +00000350 57 26 76 8e 42 3c 98 4a ec 10 4e e0 eb e2 19 3d |W&v.B<.J..N....=| +00000360 67 47 99 9c e5 97 a4 07 ff 7a b5 15 65 0e b9 e4 |gG.......z..e...| +00000370 e3 17 03 03 00 35 61 d9 d8 36 a0 1e 83 b0 f8 1f |.....5a..6......| +00000380 74 61 a0 4b 93 7f 98 8b 63 1c 63 82 f4 cd 57 8d |ta.K....c.c...W.| +00000390 1f 75 7a 6d a9 1d e2 35 0b 2b 9a 5f 5f 71 cd 46 |.uzm...5.+.__q.F| +000003a0 48 7f 27 af a5 da 8b 35 b1 18 39 |H.'....5..9| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 00 35 3d 13 d4 8c 88 |..........5=....| +00000010 73 62 97 8b 18 04 f7 05 8d c8 56 d2 f4 0a 86 93 |sb........V.....| +00000020 d4 6f 08 1c d8 7f 57 be 50 03 a7 4a c8 37 80 04 |.o....W.P..J.7..| +00000030 43 1b 2a 86 21 25 ae 84 53 80 0c f6 4f 2e 73 67 |C.*.!%..S...O.sg| +00000040 17 03 03 00 17 43 99 86 f2 2f a2 22 05 36 d8 47 |.....C.../.".6.G| +00000050 c5 57 92 93 c7 79 d9 fd 13 70 8f 75 17 03 03 00 |.W...y...p.u....| +00000060 13 15 90 47 ea af 57 89 d4 19 70 e7 e1 ce 68 8a |...G..W...p...h.| +00000070 7b 83 8c a5 |{...| diff --git a/go/src/crypto/tls/testdata/Client-TLSv13-Ed25519 b/go/src/crypto/tls/testdata/Client-TLSv13-Ed25519 new file mode 100644 index 0000000000000000000000000000000000000000..274620a2576af4df36d6fa741122157e2997ff99 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv13-Ed25519 @@ -0,0 +1,70 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 5a e2 b6 f0 cf |....z...v..Z....| +00000010 f2 85 49 e0 28 8c d7 89 41 39 5f a4 e8 41 9b f6 |..I.(...A9_..A..| +00000020 1d 2b 3a 8a 3e a3 40 29 76 17 22 20 00 00 00 00 |.+:.>.@)v." ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 03 00 00 |................| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 d1 |..+.....3.$... .| +00000060 41 fa 43 c4 c8 0a 98 e0 da 88 c8 58 36 ab 12 61 |A.C........X6..a| +00000070 d5 2d 9a 5b 10 fd 1f 10 bf d4 df 23 d0 de 2c 14 |.-.[.......#..,.| +00000080 03 03 00 01 01 17 03 03 00 17 bf 64 74 65 06 48 |...........dte.H| +00000090 41 72 b9 9f 41 24 a9 d0 05 00 4e 8c 93 a8 bd 91 |Ar..A$....N.....| +000000a0 ce 17 03 03 01 50 20 58 c1 4f 42 ed e9 e6 50 86 |.....P X.OB...P.| +000000b0 5f 49 88 ac 8b b8 3d 25 1d 87 b5 7f 9f 1a a2 cd |_I....=%........| +000000c0 f2 90 d0 6d 13 ed a6 6c f9 1e af c8 73 dd 68 d4 |...m...l....s.h.| +000000d0 46 1f ce d4 74 87 57 0f c1 b7 dd bd 5a 44 7c 08 |F...t.W.....ZD|.| +000000e0 2d 60 ca 34 1f 94 ee 4a cd e7 4a 69 1c 8d 4c 64 |-`.4...J..Ji..Ld| +000000f0 e8 a1 90 89 75 e2 3b 5b 0e 58 f8 7a 0a fe 2d 6d |....u.;[.X.z..-m| +00000100 ee 82 ab 07 e3 09 ae 37 d5 d6 31 9f 47 a5 eb ca |.......7..1.G...| +00000110 fd d9 5e b3 f1 ab 8a 64 8f 66 7d e7 a5 66 b4 46 |..^....d.f}..f.F| +00000120 3c 3c 2c 2f f7 5a 46 b3 e7 8b a4 3e 5f 21 ab 66 |<<,/.ZF....>_!.f| +00000130 60 4d ca 20 4b 7b 75 5a 88 a5 65 97 1b 70 5b 69 |`M. K{uZ..e..p[i| +00000140 7b 22 87 48 e4 a2 a8 32 06 65 00 91 e6 ac 6c 9b |{".H...2.e....l.| +00000150 42 04 53 f5 e5 46 72 d6 3a 7d d8 c1 e4 f1 79 dc |B.S..Fr.:}....y.| +00000160 de 7b 21 83 d0 98 90 99 2d 9d 78 67 89 31 2a 7d |.{!.....-.xg.1*}| +00000170 6a 97 c7 80 a9 2a 91 4e e2 30 29 96 25 97 e9 94 |j....*.N.0).%...| +00000180 2d 0a e0 30 8c e3 54 00 2a 29 e9 60 ef 4c 60 1c |-..0..T.*).`.L`.| +00000190 76 51 db 5d d7 7c 0c ae f3 a8 9e 3b 49 c6 a7 ce |vQ.].|.....;I...| +000001a0 a3 e8 e6 8c 13 ea fa bd 7f 59 36 06 1e 0c 54 2d |.........Y6...T-| +000001b0 d2 75 8a 75 94 f3 5c 77 0a 8e a0 23 9f 21 d8 ed |.u.u..\w...#.!..| +000001c0 65 87 fa f0 65 e1 81 2b 45 50 91 9e 48 8f 4c 80 |e...e..+EP..H.L.| +000001d0 7a c7 32 07 9a d9 d4 59 7a 7c 11 01 c2 75 fd 25 |z.2....Yz|...u.%| +000001e0 15 7b de b1 72 54 42 9e 02 41 a8 1a 04 6a 64 ba |.{..rTB..A...jd.| +000001f0 97 48 48 48 24 3d 17 03 03 00 59 d7 53 12 64 01 |.HHH$=....Y.S.d.| +00000200 d4 b7 e4 bf e1 33 f6 49 24 cf e8 6f 48 56 d6 1b |.....3.I$..oHV..| +00000210 e3 11 e9 a5 fb 7d f7 f5 b7 06 6c ce 4d e7 3c ca |.....}....l.M.<.| +00000220 bc 30 27 2e 02 4a 50 ec 7e 8c d4 cd 7a 78 43 3f |.0'..JP.~...zxC?| +00000230 5d 17 d7 bd 3e 78 68 21 ad 98 93 ad 90 de f7 c9 |]...>xh!........| +00000240 ab 7d 36 59 7e 7b e8 10 92 de ee 44 a2 e3 df 41 |.}6Y~{.....D...A| +00000250 6c a8 6c 9b 17 03 03 00 35 3a 9b 88 fc 4d 78 aa |l.l.....5:...Mx.| +00000260 a3 96 c7 f9 80 87 75 88 41 e6 58 9c f7 f6 88 0c |......u.A.X.....| +00000270 8f 57 8f 41 b7 49 a9 c2 db d6 44 51 a6 cb eb c3 |.W.A.I....DQ....| +00000280 8d e5 32 19 4b e5 dd 4e 19 6b f4 38 cd 3d |..2.K..N.k.8.=| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 00 35 64 73 84 51 69 |..........5ds.Qi| +00000010 81 4c a7 ce 8b 39 08 0e 0f 25 d2 24 49 3c 9d 98 |.L...9...%.$I<..| +00000020 c7 46 f5 7e ba bd d1 9d 79 d3 f6 cb 29 00 95 90 |.F.~....y...)...| +00000030 c2 fa c6 65 01 f2 9d 12 a7 db 14 49 e6 0b 40 c9 |...e.......I..@.| +00000040 17 03 03 00 17 df ad 2a 5f f7 bd 94 90 dd 11 24 |.......*_......$| +00000050 b8 97 6e fc d3 93 91 47 36 26 2d e1 17 03 03 00 |..n....G6&-.....| +00000060 13 40 ad 3c c3 49 76 47 c0 02 f0 bc 80 66 3c e4 |.@.<.IvG.....f<.| +00000070 35 28 eb b5 |5(..| diff --git a/go/src/crypto/tls/testdata/Client-TLSv13-ExportKeyingMaterial b/go/src/crypto/tls/testdata/Client-TLSv13-ExportKeyingMaterial new file mode 100644 index 0000000000000000000000000000000000000000..13fb6048748dac290210d5c3d311eba3d2a46f13 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv13-ExportKeyingMaterial @@ -0,0 +1,92 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 67 c5 21 e2 8b |....z...v..g.!..| +00000010 b6 6a cc 42 40 24 b2 4f 55 61 d9 20 78 e2 e3 40 |.j.B@$.OUa. x..@| +00000020 83 62 3d 08 e3 0a 31 0b 55 f5 b6 20 00 00 00 00 |.b=...1.U.. ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 03 00 00 |................| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 ba |..+.....3.$... .| +00000060 d1 5b 5d b4 ca a0 c2 a8 20 f2 d4 12 03 c1 95 ba |.[]..... .......| +00000070 f0 ca 33 f0 22 56 f6 15 2c 15 b9 7b c6 78 6a 14 |..3."V..,..{.xj.| +00000080 03 03 00 01 01 17 03 03 00 17 da b1 6a 79 21 51 |............jy!Q| +00000090 6b 2a 57 47 22 f1 be 5d 24 36 ec 0f 82 fd bf b8 |k*WG"..]$6......| +000000a0 5e 17 03 03 02 6d e7 ed 1e c2 be f9 15 80 5e 01 |^....m........^.| +000000b0 73 b7 57 07 40 68 ae 88 d6 43 eb 6b fb 0c a3 4e |s.W.@h...C.k...N| +000000c0 b3 86 9d 5b 92 8a 1c da a2 9b a5 11 a3 e4 4e 2c |...[..........N,| +000000d0 8d 3f 96 20 ec 13 e8 ea 10 47 4a 4a cd 64 ad f9 |.?. .....GJJ.d..| +000000e0 48 af 11 58 ff 2f cd 29 6e 8e 0f fc 31 96 29 b4 |H..X./.)n...1.).| +000000f0 df 57 e4 e9 65 62 b5 35 8e 7f a0 36 1d b1 fd 19 |.W..eb.5...6....| +00000100 c1 b8 7e d9 59 44 a8 3c 97 15 57 fa 64 95 c8 ff |..~.YD.<..W.d...| +00000110 db a5 12 85 86 2c aa bc 87 f1 7e f3 2c 08 64 05 |.....,....~.,.d.| +00000120 4a b1 8e a3 6a 26 e3 e8 fd 80 47 3c 9c a3 4a bb |J...j&....G<..J.| +00000130 73 9b 5d 6e 18 06 ac e5 63 de a8 53 e4 a1 b0 41 |s.]n....c..S...A| +00000140 6a 88 ab 91 94 df 77 55 11 eb 29 97 69 59 67 19 |j.....wU..).iYg.| +00000150 b3 23 df bf 2c ac 15 03 77 88 ad bf df 8d 4e 96 |.#..,...w.....N.| +00000160 59 86 9b 77 e9 74 fc 29 c6 cd 65 c9 aa 7a 36 9b |Y..w.t.)..e..z6.| +00000170 11 f8 47 fd 8b 59 8b 26 8c f4 f1 f1 38 12 0e 02 |..G..Y.&....8...| +00000180 e8 27 f2 ce bc 4a be c3 22 ff ae ce ef 31 d0 4c |.'...J.."....1.L| +00000190 d2 13 b3 1b 40 fd a0 c0 e9 f3 00 54 cf b8 9c 9d |....@......T....| +000001a0 2c 4b de 9a f8 82 11 e7 ea eb cf 45 99 a2 f8 ff |,K.........E....| +000001b0 53 71 e5 e0 bd f1 bb 4e eb 39 7f 85 c4 e9 0d c0 |Sq.....N.9......| +000001c0 46 de b4 1b 0e 1f 18 8c 5b cf 12 03 8a 91 06 23 |F.......[......#| +000001d0 3f f3 54 3e e9 e6 e1 2c 84 d3 4e cc 16 f6 aa 92 |?.T>...,..N.....| +000001e0 6b 24 30 5d f8 a0 52 ca 02 9a 50 58 43 b6 22 04 |k$0]..R...PXC.".| +000001f0 47 c6 ba 1c e1 aa c2 2c ca 50 13 de 2b 2b 34 ec |G......,.P..++4.| +00000200 80 8c 34 77 20 ab f3 f3 42 d2 9a 2b 9d 38 32 f9 |..4w ...B..+.82.| +00000210 de 9c 7b ee 22 4f 41 9e ea 35 88 8c e7 74 f6 ac |..{."OA..5...t..| +00000220 a5 fe af d9 c4 b1 a4 87 aa 9f d9 02 3b 4b 92 2b |............;K.+| +00000230 f4 ea 6f 81 b8 54 ca 77 3d a2 37 f0 60 d8 26 e4 |..o..T.w=.7.`.&.| +00000240 27 04 c8 5b bf bc 5e 9c 8b a9 f6 c1 58 31 de 48 |'..[..^.....X1.H| +00000250 67 5b c5 d7 ae 35 cc d8 8d 01 9b e0 d0 c7 33 f8 |g[...5........3.| +00000260 36 c1 e8 50 32 27 87 6c 64 71 27 3f 66 82 fa 92 |6..P2'.ldq'?f...| +00000270 d3 fe b9 9e d3 e2 63 43 64 13 73 4b e9 34 d9 ae |......cCd.sK.4..| +00000280 49 dd 9c 17 f3 a6 34 27 3e 07 68 ed 6b 98 0a 69 |I.....4'>.h.k..i| +00000290 9c f5 4f 1e fc ac 72 08 7e bb bd 97 fe f9 c1 09 |..O...r.~.......| +000002a0 a2 69 75 c4 e7 a1 83 df 03 0f 74 21 e8 4c 4c d7 |.iu.......t!.LL.| +000002b0 a2 90 5a 4d d9 a2 fa f1 e4 dc ff 75 e8 fe a1 91 |..ZM.......u....| +000002c0 46 a4 c2 0b c3 9e 83 45 40 b4 ba fe ed 9e 3a 81 |F......E@.....:.| +000002d0 a9 27 b9 fa 6f 9e 38 10 2f e6 05 9a 00 43 e9 fb |.'..o.8./....C..| +000002e0 60 b8 26 2e 18 4a 0c 14 6a 9f aa 26 1d 53 9e 4f |`.&..J..j..&.S.O| +000002f0 fc 7e e1 90 60 28 b1 89 db b6 68 58 5d 2a fa 43 |.~..`(....hX]*.C| +00000300 91 99 c1 94 74 77 a9 30 cf 1e 9d 49 fc cd be 6c |....tw.0...I...l| +00000310 5a 72 90 17 03 03 00 99 1b 1f 16 9b 8e 85 5a 8a |Zr............Z.| +00000320 3c c7 d8 e5 86 20 eb 71 83 12 e7 3b 02 ca a1 18 |<.... .q...;....| +00000330 aa b7 ef 67 9d bf 57 46 14 3b ed b2 9b 2e f1 96 |...g..WF.;......| +00000340 67 b0 cc 20 ab 67 63 5c a9 96 d8 22 8e fa f0 94 |g.. .gc\..."....| +00000350 1e 83 6c 53 8a 75 a5 37 1d f1 de 1f a7 22 13 08 |..lS.u.7....."..| +00000360 b7 13 dd 25 26 eb 7a 85 72 33 ed a8 27 be cc ff |...%&.z.r3..'...| +00000370 8d 42 fa 6a f8 0a 59 44 6f 48 4d 58 27 d5 28 fb |.B.j..YDoHMX'.(.| +00000380 37 b0 85 25 49 d0 32 7c dd b8 46 1a aa dc 16 b7 |7..%I.2|..F.....| +00000390 f2 fd 99 17 67 41 c0 2d 75 0d 66 ef 65 e2 5f af |....gA.-u.f.e._.| +000003a0 d8 b4 aa 15 1c 24 40 0d 0d 4f a8 bc c9 92 1c ab |.....$@..O......| +000003b0 91 17 03 03 00 35 f9 69 7e 2a d6 fa 6e 42 25 6c |.....5.i~*..nB%l| +000003c0 da 96 f7 79 5f 02 44 1f d8 1c a2 41 fc eb a5 12 |...y_.D....A....| +000003d0 bf 37 ab b0 40 92 55 50 64 8e 7b e9 e5 f3 04 b5 |.7..@.UPd.{.....| +000003e0 0f 04 93 98 fa ca 24 69 a1 73 26 |......$i.s&| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 00 35 80 f8 9b f1 1d |..........5.....| +00000010 89 31 a8 ea b8 cc 44 a7 6c c3 f7 ea 0f fd f4 a3 |.1....D.l.......| +00000020 4c c2 15 06 bd 79 16 90 a1 bf 44 df e5 21 03 ff |L....y....D..!..| +00000030 e5 83 08 67 70 09 11 21 8e 96 47 e6 f4 e3 36 6e |...gp..!..G...6n| +00000040 17 03 03 00 17 7b 87 be 4e f8 ce 6f 30 b8 5b 95 |.....{..N..o0.[.| +00000050 20 79 23 f7 50 6b 17 b8 13 a2 38 6a 17 03 03 00 | y#.Pk....8j....| +00000060 13 2a d5 e0 a4 17 7d 4f 3b 5a 6c bc 9d 5a 79 5b |.*....}O;Zl..Zy[| +00000070 a8 f6 b2 4a |...J| diff --git a/go/src/crypto/tls/testdata/Client-TLSv13-HelloRetryRequest b/go/src/crypto/tls/testdata/Client-TLSv13-HelloRetryRequest new file mode 100644 index 0000000000000000000000000000000000000000..4d58f8d440da5be1282bc434aa7a98ec3fee8ff2 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv13-HelloRetryRequest @@ -0,0 +1,122 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 14 01 00 01 10 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 95 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 06 00 04 00 1d 00 17 00 0d 00 16 00 14 |................| +000000b0 08 04 04 03 08 07 08 05 08 06 04 01 05 01 06 01 |................| +000000c0 05 03 06 03 00 32 00 1a 00 18 08 04 04 03 08 07 |.....2..........| +000000d0 08 05 08 06 04 01 05 01 06 01 05 03 06 03 02 01 |................| +000000e0 02 03 00 2b 00 09 08 03 04 03 03 03 02 03 01 00 |...+............| +000000f0 33 00 26 00 24 00 1d 00 20 2f e5 7d a3 47 cd 62 |3.&.$... /.}.G.b| +00000100 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf |C.(.._.).0......| +00000110 c2 ed 90 99 5f 58 cb 3b 74 |...._X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 58 02 00 00 54 03 03 cf 21 ad 74 e5 |....X...T...!.t.| +00000010 9a 61 11 be 1d 8c 02 1e 65 b8 91 c2 a2 11 16 7a |.a......e......z| +00000020 bb 8c 5e 07 9e 09 e2 c8 a8 33 9c 20 00 00 00 00 |..^......3. ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 03 00 00 |................| +00000050 0c 00 2b 00 02 03 04 00 33 00 02 00 17 14 03 03 |..+.....3.......| +00000060 00 01 01 |...| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 16 03 03 01 35 01 00 01 31 03 |..........5...1.| +00000010 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000030 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |. ..............| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000050 00 00 00 32 cc a9 cc a8 c0 2b c0 2f c0 2c c0 30 |...2.....+./.,.0| +00000060 c0 09 c0 13 c0 0a c0 14 00 9c 00 9d 00 2f 00 35 |............./.5| +00000070 c0 12 00 0a c0 23 c0 27 00 3c c0 07 c0 11 00 05 |.....#.'.<......| +00000080 13 03 13 01 13 02 01 00 00 b6 00 0b 00 02 01 00 |................| +00000090 ff 01 00 01 00 00 17 00 00 00 12 00 00 00 05 00 |................| +000000a0 05 01 00 00 00 00 00 0a 00 06 00 04 00 1d 00 17 |................| +000000b0 00 0d 00 16 00 14 08 04 04 03 08 07 08 05 08 06 |................| +000000c0 04 01 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 |...........2....| +000000d0 08 04 04 03 08 07 08 05 08 06 04 01 05 01 06 01 |................| +000000e0 05 03 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 |.........+......| +000000f0 03 03 02 03 01 00 33 00 47 00 45 00 17 00 41 04 |......3.G.E...A.| +00000100 1e 18 37 ef 0d 19 51 88 35 75 71 b5 e5 54 5b 12 |..7...Q.5uq..T[.| +00000110 2e 8f 09 67 fd a7 24 20 3e b2 56 1c ce 97 28 5e |...g..$ >.V...(^| +00000120 f8 2b 2d 4f 9e f1 07 9f 6c 4b 5b 83 56 e2 32 42 |.+-O....lK[.V.2B| +00000130 e9 58 b6 d7 49 a6 b5 68 1a 41 03 56 6b dc 5a 89 |.X..I..h.A.Vk.Z.| +>>> Flow 4 (server to client) +00000000 16 03 03 00 9b 02 00 00 97 03 03 3e b5 60 d1 cd |...........>.`..| +00000010 f5 a6 76 2c bd 49 f6 0f c2 ff ff 6b c9 f6 45 19 |..v,.I.....k..E.| +00000020 f6 e3 e7 fc 31 8b 49 4e 88 29 55 20 00 00 00 00 |....1.IN.)U ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 03 00 00 |................| +00000050 4f 00 2b 00 02 03 04 00 33 00 45 00 17 00 41 04 |O.+.....3.E...A.| +00000060 f8 a5 4d 81 0a 05 43 42 0b d6 ca 3b 3e 02 44 20 |..M...CB...;>.D | +00000070 56 89 80 d3 03 50 1a b4 70 50 78 aa 81 2b 5b 03 |V....P..pPx..+[.| +00000080 6c 38 22 c1 17 4f e5 b9 57 ab 58 33 76 8e ae c9 |l8"..O..W.X3v...| +00000090 a0 74 47 a0 10 c0 5c a7 8c 77 24 c8 90 bb f4 2a |.tG...\..w$....*| +000000a0 17 03 03 00 17 0c 2a 67 cb 9f a8 e8 5b 97 4a 75 |......*g....[.Ju| +000000b0 24 80 65 28 15 a7 d4 71 eb 24 74 7e 17 03 03 02 |$.e(...q.$t~....| +000000c0 6d 89 a3 fa 0f a6 dd dc b5 5a f9 03 93 5a 2a a6 |m........Z...Z*.| +000000d0 2f 65 81 9e 0d 2c 21 25 0b 7c 04 41 40 3e 95 a4 |/e...,!%.|.A@>..| +000000e0 31 21 2a 08 db 35 bc 5a 93 aa b4 8f 30 28 0c e5 |1!*..5.Z....0(..| +000000f0 11 f6 31 d6 7a b0 df 9c f3 76 30 72 e2 27 1c d3 |..1.z....v0r.'..| +00000100 75 68 3d 63 71 27 da 72 7a 18 19 da 25 94 ee e3 |uh=cq'.rz...%...| +00000110 62 6f 45 c5 38 67 ba 4a 1f 6f f3 ea 46 c6 09 ad |boE.8g.J.o..F...| +00000120 db 3c 42 3c d7 8d 9c 49 8d 2c 22 15 74 98 60 5b |...| +00000190 c6 b2 c3 eb ec 03 7d d2 85 2b c3 7f e7 07 c1 50 |......}..+.....P| +000001a0 c9 b6 6f ab 7a 86 7b b3 fd 8b 9a 6a 3c ea 18 06 |..o.z.{....j<...| +000001b0 13 e4 a4 9b d0 2c ef 8c 3f ea 8e d8 c4 d4 54 33 |.....,..?.....T3| +000001c0 2e e5 b6 40 85 a8 4b 5d 9b 3c f2 9e 70 5a 23 d7 |...@..K].<..pZ#.| +000001d0 c1 e1 b4 7a 42 69 fb b1 49 99 cf 60 5c 8a c0 7f |...zBi..I..`\...| +000001e0 c2 8c 8c 26 4f 0f 6c 10 bd e4 51 ab 19 4d 2a 63 |...&O.l...Q..M*c| +000001f0 b3 39 1e d6 55 00 c9 89 3a c0 5a 2b 5b 0a e9 10 |.9..U...:.Z+[...| +00000200 56 4c 8a 88 2d 37 27 50 07 2a 77 19 92 6a a0 67 |VL..-7'P.*w..j.g| +00000210 c9 34 e7 b2 e4 f8 f8 fc e0 24 c1 8e 6a 04 b0 6a |.4.......$..j..j| +00000220 35 1b 5a 74 78 34 81 09 d5 ed bc 61 55 bd bf 6f |5.Ztx4.....aU..o| +00000230 e4 a1 13 e9 b1 9a de de 54 3b 99 19 f7 90 74 be |........T;....t.| +00000240 48 b0 80 92 e7 19 91 17 12 12 9a 08 77 bf 2c 21 |H...........w.,!| +00000250 33 51 9a 02 fc 8c c5 7b 90 52 89 61 df 64 1f af |3Q.....{.R.a.d..| +00000260 1e 49 2a 7b 33 1b 47 df 34 7f aa ca e3 16 2d 28 |.I*{3.G.4.....-(| +00000270 94 cc 07 d1 0d 1a 07 80 a4 c6 cc 10 a7 72 58 bc |.............rX.| +00000280 65 92 de a1 c7 8b e5 63 9a 83 85 eb ee e8 8d e9 |e......c........| +00000290 63 06 f0 6d 14 81 5a d5 a6 1b 84 d3 a2 5d f1 94 |c..m..Z......]..| +000002a0 a4 af f7 eb 85 d3 00 41 12 b3 bc bf 4a 1a c1 c0 |.......A....J...| +000002b0 b0 46 38 63 f4 05 de e0 c2 b7 ee 5b f8 c8 6c e7 |.F8c.......[..l.| +000002c0 fe a4 3d a2 52 e8 25 4c d0 b4 dd 1a aa e4 9c 5b |..=.R.%L.......[| +000002d0 3c 5c 9b 0f e2 ca 18 a8 59 1d 22 d8 2d cb ca 0d |<\......Y.".-...| +000002e0 61 f0 8e be 55 5e 0b b4 72 2f 32 f1 47 fe b8 94 |a...U^..r/2.G...| +000002f0 ec 14 af c4 59 dd f9 b1 1b 18 84 44 54 c0 16 f0 |....Y......DT...| +00000300 f4 e6 19 82 fb 00 84 6e c0 87 05 82 33 7b 62 d8 |.......n....3{b.| +00000310 e3 83 86 55 d6 06 bd e5 a3 1c c0 f1 ef b3 ae 2c |...U...........,| +00000320 f7 6e fa 9a 3d 6c cf de 5d 77 54 08 03 0c 17 03 |.n..=l..]wT.....| +00000330 03 00 99 03 00 b3 cc ca 76 27 18 16 0a 8e d0 81 |........v'......| +00000340 32 5d 9e 32 75 5e bb b4 c5 5c 6b 61 62 38 3d 2e |2].2u^...\kab8=.| +00000350 21 1a 93 c9 fc b7 90 74 17 78 ae 18 78 86 fc 6d |!......t.x..x..m| +00000360 0b 0c 50 d3 a6 5a 98 a8 76 6f ff 3b 98 f5 2f 11 |..P..Z..vo.;../.| +00000370 3d af 84 92 04 42 93 33 33 5c 9a f2 fc 5f 05 dd |=....B.33\..._..| +00000380 89 a8 c3 c1 e7 92 0f 76 3a ed da 7c 25 e0 96 89 |.......v:..|%...| +00000390 27 97 c1 3e 27 70 3f a4 15 f3 24 6a 47 43 7f d7 |'..>'p?...$jGC..| +000003a0 70 b9 7b 2d 3d 53 c0 f6 53 85 fb f7 62 4a 01 8e |p.{-=S..S...bJ..| +000003b0 3e 30 3b b4 79 17 af 2e 73 56 e5 de ba 48 0e 0c |>0;.y...sV...H..| +000003c0 e0 d3 0a 80 07 b9 53 f1 1d a6 cf 29 17 03 03 00 |......S....)....| +000003d0 35 f8 8f 94 ec 0a b9 d9 b1 2c d3 02 c9 0b ef 19 |5........,......| +000003e0 89 ee a9 c0 b1 f3 9c 87 09 0e fb 9a e2 ad 4a 1e |..............J.| +000003f0 16 6d 84 af b3 fa b9 af 98 79 54 7d 45 29 99 85 |.m.......yT}E)..| +00000400 8c a9 69 b6 ee 4e |..i..N| +>>> Flow 5 (client to server) +00000000 17 03 03 00 35 4c c3 af 0b 49 46 e0 51 3a 73 a8 |....5L...IF.Q:s.| +00000010 28 46 95 22 ef d7 05 8a fc 4f 12 98 2f 09 ca a9 |(F.".....O../...| +00000020 4d b8 17 e4 15 15 b5 13 3f 1a cb 8e 3d 19 00 d6 |M.......?...=...| +00000030 19 af 90 66 0e 93 d4 22 4d 54 17 03 03 00 17 56 |...f..."MT.....V| +00000040 31 7c 05 02 1d 84 64 d0 32 21 8d c1 61 7e 7f ce |1|....d.2!..a~..| +00000050 d3 45 b2 df ba df 17 03 03 00 13 3a 57 b6 2e 79 |.E.........:W..y| +00000060 96 09 e9 66 f2 85 7a 21 88 45 cc b4 ff 12 |...f..z!.E....| diff --git a/go/src/crypto/tls/testdata/Client-TLSv13-KeyUpdate b/go/src/crypto/tls/testdata/Client-TLSv13-KeyUpdate new file mode 100644 index 0000000000000000000000000000000000000000..7d04d95a272d9c2d435fdbd82e1619434fc65014 --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv13-KeyUpdate @@ -0,0 +1,104 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 18 01 00 01 14 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 99 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 19 00 0d |................| +000000b0 00 16 00 14 08 04 04 03 08 07 08 05 08 06 04 01 |................| +000000c0 05 01 06 01 05 03 06 03 00 32 00 1a 00 18 08 04 |.........2......| +000000d0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000e0 06 03 02 01 02 03 00 2b 00 09 08 03 04 03 03 03 |.......+........| +000000f0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| +00000100 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| +00000110 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 b2 4e f2 da 8b |....z...v...N...| +00000010 79 31 33 74 d5 37 8e 44 9d ad 6f 91 c4 bb 5d d4 |y13t.7.D..o...].| +00000020 fd f1 e2 42 50 43 f5 3c 7f cf 92 20 00 00 00 00 |...BPC.<... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 03 00 00 |................| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 74 |..+.....3.$... t| +00000060 4e d7 36 eb 1f e1 51 c6 8e 48 2d c4 67 e8 c1 d5 |N.6...Q..H-.g...| +00000070 32 2b 4b 64 77 43 ee 04 eb 9c 07 03 45 4f 25 14 |2+KdwC......EO%.| +00000080 03 03 00 01 01 17 03 03 00 17 c5 a9 04 f5 f0 9c |................| +00000090 db 59 34 64 cb 01 0d 41 fe c9 75 76 f5 0c 43 f0 |.Y4d...A..uv..C.| +000000a0 af 17 03 03 02 6d 85 7c c1 3f 80 ae 73 7a 81 6a |.....m.|.?..sz.j| +000000b0 cc ec 35 79 a9 6c b4 81 4b 11 2e a1 4b 59 23 9b |..5y.l..K...KY#.| +000000c0 fc ad 8a e6 ec 39 f8 db cc f9 36 c7 93 25 47 38 |.....9....6..%G8| +000000d0 9e 1c f9 9e 88 25 96 e4 bc cf 9c 8e c7 d3 e3 e4 |.....%..........| +000000e0 4b 9a 75 f1 fa d0 2b 46 a6 56 ff c2 59 16 77 8a |K.u...+F.V..Y.w.| +000000f0 f3 1f 31 14 0f cf b9 88 4b 21 7b d3 39 e5 96 82 |..1.....K!{.9...| +00000100 bd 16 fb 6a af 12 29 b2 7a 0a 11 ae 90 9b 3c 34 |...j..).z.....<4| +00000110 52 89 2d 4a b5 81 68 18 18 e4 c4 56 b7 76 c9 23 |R.-J..h....V.v.#| +00000120 5d 0e 8e f4 a5 a4 63 a2 76 06 66 67 a8 96 cd d8 |].....c.v.fg....| +00000130 3f cf bc 0d e5 c6 5c 27 7f 43 bf a8 b7 02 f9 24 |?.....\'.C.....$| +00000140 ee b5 a1 09 63 d6 7c 5a 9b e0 f4 3b 99 f9 03 42 |....c.|Z...;...B| +00000150 0a eb 55 f5 77 ee 38 70 6b de 27 63 47 2f ed 78 |..U.w.8pk.'cG/.x| +00000160 f7 a1 39 d8 c4 4a 9c a8 2b 38 8c 3c c4 3c 8a 24 |..9..J..+8.<.<.$| +00000170 63 7e df bc 9f 21 8e 04 9e 53 ce 0a 46 99 87 3d |c~...!...S..F..=| +00000180 80 70 cc 27 05 82 2a dc 7b bb 03 e9 84 6f 18 ca |.p.'..*.{....o..| +00000190 4d be b1 73 06 72 27 1e 80 c0 84 73 69 39 07 b3 |M..s.r'....si9..| +000001a0 72 81 09 9b 03 8d 97 36 a7 04 a7 08 01 94 d0 17 |r......6........| +000001b0 6c 13 cd 9d 47 a9 81 b1 59 fd 90 1b 47 04 b5 30 |l...G...Y...G..0| +000001c0 64 6a b6 f5 52 0f f8 41 83 0e e7 ee fc ac 7e f5 |dj..R..A......~.| +000001d0 02 65 eb 12 1d 9a 0e cc f1 4c 12 f9 17 98 4e 32 |.e.......L....N2| +000001e0 27 24 41 15 bf 17 c2 ae 73 1c 45 19 7b 68 e5 74 |'$A.....s.E.{h.t| +000001f0 07 6b 59 92 f3 a7 cc c0 c7 bb a4 60 d9 2d 17 e9 |.kY........`.-..| +00000200 4f e0 90 0c 70 00 0e 75 55 78 37 0c 4b 16 06 78 |O...p..uUx7.K..x| +00000210 bf cb 77 1c 8c 4b b3 f5 68 99 06 2d b7 50 a8 03 |..w..K..h..-.P..| +00000220 54 36 85 33 41 1c 1a 16 16 bc f3 76 9f d9 65 c8 |T6.3A......v..e.| +00000230 31 a5 f4 1f e1 ab 36 ac 33 54 bb fb f2 57 ec 46 |1.....6.3T...W.F| +00000240 85 79 15 35 30 84 cc 8b a6 bb d8 cf 6c 88 8b ab |.y.50.......l...| +00000250 d1 36 bd 2d 9a 11 6e 4d 09 5c 10 06 7e 26 23 b6 |.6.-..nM.\..~&#.| +00000260 57 4a 18 dd 5b 0c 45 1c 4c 60 27 6d cf 77 1c 70 |WJ..[.E.L`'m.w.p| +00000270 ef b9 81 af 02 fc 7b ca 80 0e 1f 48 ad 22 ce 33 |......{....H.".3| +00000280 44 2f 28 47 a8 cd a3 98 e6 28 8e dc ac df b5 1c |D/(G.....(......| +00000290 34 47 8a 7a 98 c5 79 c9 38 ba 34 7e 76 63 51 3d |4G.z..y.8.4~vcQ=| +000002a0 ae 9b eb 2c bb 89 6d 01 cd 81 ab a4 b8 4f 27 82 |...,..m......O'.| +000002b0 23 09 fb 9f b2 56 0f 7a a3 f6 13 70 c3 6d 13 61 |#....V.z...p.m.a| +000002c0 eb dd 39 da 99 8e a3 00 9e 7a 48 fe d8 78 c2 ff |..9......zH..x..| +000002d0 c9 ce 14 3f 37 8d 4d fb 80 6b 39 e6 cc f1 23 a0 |...?7.M..k9...#.| +000002e0 e2 e5 cd 3d ed 07 80 85 ea 60 9d 6b e0 93 7f 53 |...=.....`.k...S| +000002f0 89 94 32 b8 a1 4e f0 d7 33 f6 9c 07 48 f6 43 89 |..2..N..3...H.C.| +00000300 3b 52 89 0f 31 98 a8 86 5b 2b c5 6c 0d 0c 26 04 |;R..1...[+.l..&.| +00000310 9f 90 29 17 03 03 00 99 62 df 1f c6 0c 83 e0 8e |..).....b.......| +00000320 9e 30 43 4b 9b 63 c7 b7 96 bf 79 35 14 89 43 f6 |.0CK.c....y5..C.| +00000330 5e e6 fb ec 28 6a 62 cc 64 4a e8 86 07 da 38 f3 |^...(jb.dJ....8.| +00000340 30 c7 5a 98 78 fc e8 ee ab 53 81 72 15 92 e1 1b |0.Z.x....S.r....| +00000350 d1 78 1d d3 7a 5b 7a c6 78 82 6e 8e ec a6 bd d7 |.x..z[z.x.n.....| +00000360 8a da 12 68 64 65 2b ec 46 c4 b4 01 a8 e9 b6 00 |...hde+.F.......| +00000370 67 b1 bf ac 26 7e 11 64 3d de 40 ae 57 8d 7d 07 |g...&~.d=.@.W.}.| +00000380 3f 06 65 6c 92 10 42 b9 be 30 ef bd 26 a2 87 96 |?.el..B..0..&...| +00000390 12 61 4a 56 3b 26 c1 d2 81 d3 71 d0 4c 6d 01 c3 |.aJV;&....q.Lm..| +000003a0 a0 ec 55 96 0c 10 2a f6 9e 6c 99 78 5a 49 a8 50 |..U...*..l.xZI.P| +000003b0 af 17 03 03 00 35 5e 78 9a 3e c9 92 b6 2d 32 1d |.....5^x.>...-2.| +000003c0 cd 16 ab da cd e7 93 0d c2 90 a2 62 7b 3c 54 bb |...........b{>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 00 35 a8 d6 93 8f 7e |..........5....~| +00000010 65 3a ee 6f c8 37 2a 27 14 dc b7 19 0e aa 14 b6 |e:.o.7*'........| +00000020 22 21 2d ea f4 00 d1 60 55 c0 f1 56 db 43 7a f0 |"!-....`U..V.Cz.| +00000030 1a 47 ce 93 d9 07 7e 61 43 92 3a 95 a9 54 7b c6 |.G....~aC.:..T{.| +00000040 17 03 03 00 17 e6 e4 52 74 15 e2 18 d7 14 59 29 |.......Rt.....Y)| +00000050 59 d8 ce 49 68 3a a8 79 9e f4 ee f1 |Y..Ih:.y....| +>>> Flow 4 (server to client) +00000000 17 03 03 00 16 e6 cd 54 e3 31 d9 70 20 25 f4 aa |.......T.1.p %..| +00000010 cd 8f fe e7 88 6b 7f 62 9b 7b de |.....k.b.{.| +>>> Flow 5 (client to server) +00000000 17 03 03 00 16 bd e9 c4 24 4a 6d 76 aa 83 bb da |........$Jmv....| +00000010 ec 9e d0 c9 38 cc 6b 3c 65 38 91 |....8.k>> Flow 6 (server to client) +00000000 17 03 03 00 1a 6a e1 ea df 76 a9 fc 4a 80 7b 49 |.....j...v..J.{I| +00000010 dd fa c3 87 e9 e7 c9 b3 ab bf bc a7 d8 cd 36 |..............6| +>>> Flow 7 (client to server) +00000000 17 03 03 00 1d 1e c5 6f 93 48 41 07 03 e5 8c 6f |.......o.HA....o| +00000010 09 8e 2f 8e da cb 6e 01 e9 b8 6e f6 3f 59 5c 17 |../...n...n.?Y\.| +00000020 91 46 17 03 03 00 13 35 33 12 5e d3 97 0a 1c 54 |.F.....53.^....T| +00000030 cf 54 bb 7d 78 2e 57 a2 5b 39 |.T.}x.W.[9| diff --git a/go/src/crypto/tls/testdata/Client-TLSv13-P256-ECDHE b/go/src/crypto/tls/testdata/Client-TLSv13-P256-ECDHE new file mode 100644 index 0000000000000000000000000000000000000000..410f0dd189a8c53711f01e0ece156d2d935a8dcd --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv13-P256-ECDHE @@ -0,0 +1,96 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 33 01 00 01 2f 03 03 00 00 00 00 00 |....3.../.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 b4 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 04 00 02 00 17 00 0d 00 16 00 14 08 04 |................| +000000b0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000c0 06 03 00 32 00 1a 00 18 08 04 04 03 08 07 08 05 |...2............| +000000d0 08 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 |................| +000000e0 00 2b 00 09 08 03 04 03 03 03 02 03 01 00 33 00 |.+............3.| +000000f0 47 00 45 00 17 00 41 04 1e 18 37 ef 0d 19 51 88 |G.E...A...7...Q.| +00000100 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd a7 24 20 |5uq..T[....g..$ | +00000110 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e f1 07 9f |>.V...(^.+-O....| +00000120 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 a6 b5 68 |lK[.V.2B.X..I..h| +00000130 1a 41 03 56 6b dc 5a 89 |.A.Vk.Z.| +>>> Flow 2 (server to client) +00000000 16 03 03 00 9b 02 00 00 97 03 03 1f 9f 7f 3f 27 |..............?'| +00000010 c5 5c f2 f1 bb cc a2 89 0d 7f 66 6a ff 85 7e 55 |.\........fj..~U| +00000020 ec 47 a6 5e 9c 09 00 ec 96 e2 a7 20 00 00 00 00 |.G.^....... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 03 00 00 |................| +00000050 4f 00 2b 00 02 03 04 00 33 00 45 00 17 00 41 04 |O.+.....3.E...A.| +00000060 f0 c5 09 c6 22 3f 23 06 65 c7 e2 1c f8 e7 c2 59 |...."?#.e......Y| +00000070 a9 9f 00 3d 1a 48 fb b5 7f e4 ad 3d 4f 2d 91 d8 |...=.H.....=O-..| +00000080 f4 2f d5 31 5c dc 2b 53 63 2b 25 1b 60 47 31 3a |./.1\.+Sc+%.`G1:| +00000090 30 72 d8 5d a4 60 9d 68 51 48 45 69 32 73 58 a5 |0r.].`.hQHEi2sX.| +000000a0 14 03 03 00 01 01 17 03 03 00 17 e9 38 fa fe 25 |............8..%| +000000b0 89 ba 85 3b 0e 66 1e 3f b9 52 55 20 e0 3c 07 6f |...;.f.?.RU .<.o| +000000c0 2c 2f 17 03 03 02 6d cf 73 3f de 91 5b 86 ff 90 |,/....m.s?..[...| +000000d0 ca a3 c9 ba e2 9e 56 53 fc 72 28 e5 98 1f 08 ca |......VS.r(.....| +000000e0 6d 0e 80 96 d2 45 74 33 3b 45 ee 2b ab 12 94 57 |m....Et3;E.+...W| +000000f0 be 00 7e f6 14 93 64 62 7b 0d 81 0e 79 8b 63 49 |..~...db{...y.cI| +00000100 36 8a 67 5c bb 33 72 fa 73 0d e1 ab 66 58 fa a3 |6.g\.3r.s...fX..| +00000110 dd 66 c2 bb 0e 64 82 39 59 e1 a0 e1 5c 84 b1 b6 |.f...d.9Y...\...| +00000120 0d 60 94 f2 ff 94 39 72 62 45 cd f6 d8 f3 33 b5 |.`....9rbE....3.| +00000130 20 99 29 c8 d5 ba 8c 49 cb 29 54 e9 cf 7e 26 1f | .)....I.)T..~&.| +00000140 25 96 41 93 82 4c 38 15 0d 0c 6d 7f 89 51 7f 43 |%.A..L8...m..Q.C| +00000150 9d 04 3a 1a 58 86 97 4e 0c 29 c0 2e f0 e7 78 42 |..:.X..N.)....xB| +00000160 f0 b4 11 cb 50 ec 45 62 c5 0a 42 11 cc aa c4 d4 |....P.Eb..B.....| +00000170 33 15 ee 43 e1 80 6f 46 16 ea 30 27 09 d1 34 e6 |3..C..oF..0'..4.| +00000180 59 f7 b0 e0 6f ea 51 bd 02 79 17 06 3f 84 75 08 |Y...o.Q..y..?.u.| +00000190 63 91 b3 58 d3 1c 61 47 bf d9 2a 9e 11 75 b2 5e |c..X..aG..*..u.^| +000001a0 7e 09 62 f2 3c ba 63 4b 2b 09 c4 90 b5 78 9a c4 |~.b.<.cK+....x..| +000001b0 be 35 9b 7f e3 11 5a 82 d8 50 b3 67 20 7a 53 ec |.5....Z..P.g zS.| +000001c0 cb f9 1a b3 b3 b6 b6 39 1b f1 fe 7a 28 27 9c ed |.......9...z('..| +000001d0 25 35 f4 f1 21 11 eb 33 61 64 1d 54 eb ef c3 d0 |%5..!..3ad.T....| +000001e0 2c 0d 76 0d 7e 90 3f 8d a4 d0 b5 d9 27 49 c7 fc |,.v.~.?.....'I..| +000001f0 cc 59 8c c5 af 59 fc 09 98 63 9c fb 63 d8 09 6f |.Y...Y...c..c..o| +00000200 55 2d 1f d2 c7 83 5f 3d ae 00 ef ca 27 03 9d b9 |U-...._=....'...| +00000210 00 03 c5 c7 e5 2d 91 47 b0 6c 67 2a 09 3e bc 57 |.....-.G.lg*.>.W| +00000220 a3 02 3f cf b2 88 d8 3d 25 c5 e1 0e 2b a2 b7 5f |..?....=%...+.._| +00000230 57 18 5c eb 8e ae 5f d6 5f 11 1b 5c 48 3b f5 84 |W.\..._._..\H;..| +00000240 b0 6e 29 3e 58 71 36 6e 66 6e e0 d0 98 b0 1b 84 |.n)>Xq6nfn......| +00000250 ca 8c 53 83 86 ca 26 7a 15 6b 6a 7c 61 91 55 45 |..S...&z.kj|a.UE| +00000260 58 cb bd b2 df df 78 22 83 36 8e 4f b6 40 70 ea |X.....x".6.O.@p.| +00000270 d1 72 33 7d 85 00 01 48 f1 75 73 db b3 aa 1d da |.r3}...H.us.....| +00000280 78 c9 e3 37 7c 1c 52 74 62 6c f6 eb af af 0b 2d |x..7|.Rtbl.....-| +00000290 ef d4 85 3d 9f 48 de 5c 4a 6e 24 69 b9 7b 87 e7 |...=.H.\Jn$i.{..| +000002a0 62 3c 26 67 8a 52 b2 73 66 90 56 07 6f ec 14 62 |b<&g.R.sf.V.o..b| +000002b0 88 15 20 e6 27 59 d4 cf 0e f0 59 cd cb 8e bd e5 |.. .'Y....Y.....| +000002c0 ca 10 39 40 54 a5 57 4e 99 70 93 b4 86 60 5f f1 |..9@T.WN.p...`_.| +000002d0 70 f5 d7 21 ef f2 11 b2 da 7a 7f 27 a8 6b fe 7f |p..!.....z.'.k..| +000002e0 e4 eb 35 9c d5 24 ef 70 4b 3c ed bd 9b b9 b9 f3 |..5..$.pK<......| +000002f0 50 a4 61 7f 24 d0 8c 7f 4f 48 09 4f 1e 26 fb 46 |P.a.$...OH.O.&.F| +00000300 ec c2 84 12 a5 6a 5f 19 f0 03 cc 50 cc 07 26 23 |.....j_....P..&#| +00000310 58 6e 68 d8 20 ae eb db 2f be a6 7b a8 ed 86 20 |Xnh. .../..{... | +00000320 61 07 03 47 e5 19 9b a7 0d 27 e0 56 9f 2a d5 19 |a..G.....'.V.*..| +00000330 e7 b3 39 07 17 03 03 00 99 3a 9b b2 61 6a 40 3a |..9......:..aj@:| +00000340 46 a8 0b 50 e3 95 d2 80 5f 5a 08 c3 54 2e 47 ac |F..P...._Z..T.G.| +00000350 f1 83 07 13 21 7f 5e 4e 1b 67 66 cc 38 a7 f3 91 |....!.^N.gf.8...| +00000360 f0 5f ac 9a 39 55 de bf 02 30 2a 87 35 85 f8 1d |._..9U...0*.5...| +00000370 32 3a 8c f8 90 6a 22 21 b2 e8 87 5e 54 6a 45 de |2:...j"!...^TjE.| +00000380 74 ff 6d 37 00 92 07 6c 09 13 c1 5e 68 bc 28 80 |t.m7...l...^h.(.| +00000390 d6 24 e5 32 fc 13 ee 68 68 91 9a e6 15 74 21 7d |.$.2...hh....t!}| +000003a0 2d b2 c8 f5 1d 05 69 5c 80 ee 8b 7c 3e 23 be 35 |-.....i\...|>#.5| +000003b0 d4 54 3c 52 66 2a f1 12 98 5d 3a 3f 44 26 84 d8 |.T>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 00 35 70 3d 2c 7e 6a |..........5p=,~j| +00000010 d9 c5 58 7b 1d b5 d8 af 9e ca b8 30 2a 9b c3 c8 |..X{.......0*...| +00000020 fa 1c 76 f0 64 f8 4c 01 24 19 18 b2 2e 70 b9 e1 |..v.d.L.$....p..| +00000030 d3 45 96 e7 08 7e 7b c8 7d 1a c8 b7 87 13 9d 1d |.E...~{.}.......| +00000040 17 03 03 00 17 3f 62 68 a3 27 6c c3 12 33 ed e6 |.....?bh.'l..3..| +00000050 0e 87 e6 c4 3e 63 55 2a 15 11 aa 35 17 03 03 00 |....>cU*...5....| +00000060 13 f8 81 0f 72 73 8b d0 14 af fe f2 9d b7 c7 fd |....rs..........| +00000070 16 17 b9 60 |...`| diff --git a/go/src/crypto/tls/testdata/Client-TLSv13-X25519-ECDHE b/go/src/crypto/tls/testdata/Client-TLSv13-X25519-ECDHE new file mode 100644 index 0000000000000000000000000000000000000000..9e53626d5dc3447a2145266d1e97289bb2faec0d --- /dev/null +++ b/go/src/crypto/tls/testdata/Client-TLSv13-X25519-ECDHE @@ -0,0 +1,92 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 12 01 00 01 0e 03 03 00 00 00 00 00 |................| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| +00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| +00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| +00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| +00000080 01 00 00 93 00 0b 00 02 01 00 ff 01 00 01 00 00 |................| +00000090 17 00 00 00 12 00 00 00 05 00 05 01 00 00 00 00 |................| +000000a0 00 0a 00 04 00 02 00 1d 00 0d 00 16 00 14 08 04 |................| +000000b0 04 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 |................| +000000c0 06 03 00 32 00 1a 00 18 08 04 04 03 08 07 08 05 |...2............| +000000d0 08 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 |................| +000000e0 00 2b 00 09 08 03 04 03 03 03 02 03 01 00 33 00 |.+............3.| +000000f0 26 00 24 00 1d 00 20 2f e5 7d a3 47 cd 62 43 15 |&.$... /.}.G.bC.| +00000100 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed |(.._.).0........| +00000110 90 99 5f 58 cb 3b 74 |.._X.;t| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 5a 42 7b 30 69 |....z...v..ZB{0i| +00000010 87 6c 87 6a 9c c4 4f 41 b5 18 58 d5 7a 1d 7d da |.l.j..OA..X.z.}.| +00000020 92 29 4c dd 57 6b 4d 0c f9 7c 74 20 00 00 00 00 |.)L.WkM..|t ....| +00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 03 00 00 |................| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 f5 |..+.....3.$... .| +00000060 7b aa 52 58 70 5a dd 9b db b3 b8 17 02 fc db e4 |{.RXpZ..........| +00000070 b2 9d a2 e7 77 aa c1 d9 f9 a8 87 65 b8 c2 38 14 |....w......e..8.| +00000080 03 03 00 01 01 17 03 03 00 17 cf 0f a3 89 ff 85 |................| +00000090 ce 6f aa 9e 41 c6 cc e0 bb 9c dd f2 6c 2b f6 4f |.o..A.......l+.O| +000000a0 e5 17 03 03 02 6d eb 5d f8 b5 8a 60 c3 af a8 03 |.....m.]...`....| +000000b0 a7 55 8c 85 ee 94 9c 31 d5 2e de 80 71 70 c0 9d |.U.....1....qp..| +000000c0 9a b2 c6 fd 82 1f 72 09 3c eb 2d 38 3f 3a cd fd |......r.<.-8?:..| +000000d0 c2 6d b5 0a 30 20 4b 6c 64 26 e9 e2 f2 1f 27 da |.m..0 Kld&....'.| +000000e0 ed 81 98 fe 58 3e 27 f9 af 91 cf 90 b8 c2 a8 f0 |....X>'.........| +000000f0 14 3c a1 5b 2e 60 55 34 73 f2 1d c2 24 df 09 55 |.<.[.`U4s...$..U| +00000100 e5 5b b6 43 de d7 48 6b cd 15 da 06 f1 b6 56 0b |.[.C..Hk......V.| +00000110 fb 7e 97 f4 40 2f 6b c9 5b 4d 0c 70 8d d5 1c 21 |.~..@/k.[M.p...!| +00000120 d6 a2 4f ab e9 c7 cb 69 0e d0 86 d0 b8 1e c5 6b |..O....i.......k| +00000130 3d 2f 78 f7 ab fd db 06 5c 59 69 fe 74 69 2f c9 |=/x.....\Yi.ti/.| +00000140 a0 36 e2 08 2e 42 23 05 da 89 33 e7 b5 c3 b2 5a |.6...B#...3....Z| +00000150 d4 7e 4c 99 1c 24 a8 62 9b 92 7d bb c0 e1 4a 90 |.~L..$.b..}...J.| +00000160 72 83 4d b2 74 13 45 3f ef 91 7c b0 c4 6b 4e f5 |r.M.t.E?..|..kN.| +00000170 5c 3d 56 6f fe 96 63 c2 fe 2c 88 23 ab 92 08 bf |\=Vo..c..,.#....| +00000180 c5 08 25 81 a5 49 a6 5c 95 da 09 b2 c9 4b e0 f2 |..%..I.\.....K..| +00000190 59 4e 5a 67 6b 71 c7 ba 69 ff a8 f5 6d 21 52 68 |YNZgkq..i...m!Rh| +000001a0 05 d6 61 0e d6 67 d9 64 3d 26 a3 65 3c 55 11 42 |..a..g.d=&.e.}..E0L-rC.| +00000260 4f a3 08 d2 7f 70 e9 31 7b c8 cd 77 fc 3e 82 70 |O....p.1{..w.>.p| +00000270 48 ed 83 55 79 16 c1 8c 69 50 60 53 48 08 5b 66 |H..Uy...iP`SH.[f| +00000280 fe 78 02 06 16 ba 02 90 85 11 7b 49 36 71 58 35 |.x........{I6qX5| +00000290 46 7f fd 0f de dc 11 ae 3a bd df 79 93 f9 e3 8d |F.......:..y....| +000002a0 4c d8 c5 55 74 34 7f 01 dd 4d d5 ef ef 4e 3d d3 |L..Ut4...M...N=.| +000002b0 31 94 3f 1c 9b 6c 44 d0 3b 73 d1 5f b4 b6 48 5d |1.?..lD.;s._..H]| +000002c0 16 ba 17 0b d0 f5 b4 16 18 1f 85 be dc f1 75 71 |..............uq| +000002d0 17 f8 b0 8a f3 d2 80 24 d5 3b cd 58 f4 9b 03 e5 |.......$.;.X....| +000002e0 64 c5 ae 5e 9a 25 d2 bb a2 28 91 4b 2e 81 4d e4 |d..^.%...(.K..M.| +000002f0 4e 25 57 12 fc 7a 87 36 66 0b 76 21 66 17 a0 e5 |N%W..z.6f.v!f...| +00000300 0a f7 00 31 48 62 a9 70 f1 75 1b e0 78 c9 fa de |...1Hb.p.u..x...| +00000310 11 6f 3d 17 03 03 00 99 72 f9 ad 67 80 2a 9f 04 |.o=.....r..g.*..| +00000320 a9 0a fb 6f 03 90 88 35 7f cb 97 5f 4e a2 1e a8 |...o...5..._N...| +00000330 34 80 96 d1 60 b4 b4 12 ec c3 2b 15 c9 a0 f9 28 |4...`.....+....(| +00000340 50 1c 53 1d fc 32 a2 c7 c0 03 58 1b 83 a6 ee 94 |P.S..2....X.....| +00000350 2d 98 99 83 62 6a 52 a0 c5 42 94 4f 3a 26 2e 44 |-...bjR..B.O:&.D| +00000360 7b 03 f5 2a 0e 9e 48 e4 2a 18 2e 9b 42 7f 34 d2 |{..*..H.*...B.4.| +00000370 3c b2 92 52 cc 51 0e f0 fd c7 4d e6 d7 1b b2 44 |<..R.Q....M....D| +00000380 99 48 e7 da 1e 43 37 d1 ac 80 c5 34 21 1b d8 0c |.H...C7....4!...| +00000390 9c 92 0d b4 27 b0 78 43 06 a2 90 42 c4 99 5e 5f |....'.xC...B..^_| +000003a0 a4 36 69 a5 a1 92 12 5e 51 47 7f ff 50 07 ac 8a |.6i....^QG..P...| +000003b0 35 17 03 03 00 35 86 65 34 2f d0 12 2a 0b 7c 50 |5....5.e4/..*.|P| +000003c0 b4 c5 67 30 cc 4d cf 4f f7 be a5 0d 2c b2 96 ae |..g0.M.O....,...| +000003d0 da 70 a3 74 c2 e7 9a 18 61 17 95 da 00 ac cc 89 |.p.t....a.......| +000003e0 66 a1 e8 aa ca 8f 02 3c b5 16 3d |f......<..=| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 00 35 a0 a0 1c ae a9 |..........5.....| +00000010 1a 1f 74 01 92 fe bf 91 c4 aa 8b f2 84 7e 39 c1 |..t..........~9.| +00000020 cb f4 ae a8 76 0c de 9e 54 7f ca 4a a2 d3 07 ef |....v...T..J....| +00000030 8e ed 8a be 54 ad 76 fe b6 62 24 4d a7 88 d5 7a |....T.v..b$M...z| +00000040 17 03 03 00 17 a2 d4 e7 78 ef 4a 2e 66 52 6f 2a |........x.J.fRo*| +00000050 e3 07 e0 9c fc 19 f6 f8 96 88 bb be 17 03 03 00 |................| +00000060 13 43 01 14 16 42 27 8a b9 a9 98 5f c7 06 4d 20 |.C...B'...._..M | +00000070 8b c3 cb 33 |...3| diff --git a/go/src/crypto/tls/testdata/Server-TLSv10-ECDHE-ECDSA-AES b/go/src/crypto/tls/testdata/Server-TLSv10-ECDHE-ECDSA-AES new file mode 100644 index 0000000000000000000000000000000000000000..3bc3a75b366e7a8fbe8f0c0c8feef418d0cfd1ee --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv10-ECDHE-ECDSA-AES @@ -0,0 +1,79 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 51 01 00 00 4d 03 01 76 4b 58 ef 57 |....Q...M..vKX.W| +00000010 d5 8d ba b7 0b fe d4 b3 2b a7 76 7c f1 72 59 39 |........+.v|.rY9| +00000020 fa 02 66 88 4a 55 72 15 9e 42 8c 00 00 04 c0 0a |..f.JUr..B......| +00000030 00 ff 01 00 00 20 00 0b 00 04 03 00 01 02 00 0a |..... ..........| +00000040 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 16 |................| +00000050 00 00 00 17 00 00 |......| +>>> Flow 2 (server to client) +00000000 16 03 01 00 3b 02 00 00 37 03 01 00 00 00 00 00 |....;...7.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 00 00 c0 0a 00 00 |...DOWNGRD......| +00000030 0f ff 01 00 01 00 00 17 00 00 00 0b 00 02 01 00 |................| +00000040 16 03 01 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 |...............0| +00000050 82 02 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 |...0..b.....-G..| +00000060 eb f4 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 |..0...*.H.=..0E1| +00000070 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 30 11 |.0...U....AU1.0.| +00000080 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 |..U....Some-Stat| +00000090 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 |e1!0...U....Inte| +000000a0 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 79 |rnet Widgits Pty| +000000b0 20 4c 74 64 30 1e 17 0d 31 32 31 31 32 32 31 35 | Ltd0...12112215| +000000c0 30 36 33 32 5a 17 0d 32 32 31 31 32 30 31 35 30 |0632Z..221120150| +000000d0 36 33 32 5a 30 45 31 0b 30 09 06 03 55 04 06 13 |632Z0E1.0...U...| +000000e0 02 41 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f |.AU1.0...U....So| +000000f0 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 |me-State1!0...U.| +00000100 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 |...Internet Widg| +00000110 69 74 73 20 50 74 79 20 4c 74 64 30 81 9b 30 10 |its Pty Ltd0..0.| +00000120 06 07 2a 86 48 ce 3d 02 01 06 05 2b 81 04 00 23 |..*.H.=....+...#| +00000130 03 81 86 00 04 00 c4 a1 ed be 98 f9 0b 48 73 36 |.............Hs6| +00000140 7e c3 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d cd 6b |~..V.".=S.;M!=.k| +00000150 75 e6 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 32 7c |u......&.....r2|| +00000160 b3 64 2f 1c 90 bc ea 68 23 10 7e fe e3 25 c0 48 |.d/....h#.~..%.H| +00000170 3a 69 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 9c 70 |:i.(m.7...b....p| +00000180 62 83 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 68 c0 |b....d1...1...h.| +00000190 9b 23 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 b6 5f |.#.vd?.\....XX._| +000001a0 70 dd 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 66 5b |p............0f[| +000001b0 66 9a 20 e2 27 e5 bf fe 3b 30 09 06 07 2a 86 48 |f. .'...;0...*.H| +000001c0 ce 3d 04 01 03 81 8c 00 30 81 88 02 42 01 88 a2 |.=......0...B...| +000001d0 4f eb e2 45 c5 48 7d 1b ac f5 ed 98 9d ae 47 70 |O..E.H}.......Gp| +000001e0 c0 5e 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 a2 ce |.^../...M.a@....| +000001f0 ee 0b 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce fa 10 |..~.~.v..;~.?...| +00000200 e2 59 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f d0 02 |.Y.G-|..N....o..| +00000210 42 01 4d fc be 67 13 9c 2d 05 0e bd 3f a3 8c 25 |B.M..g..-...?..%| +00000220 c1 33 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 |.3.......7z..z..| +00000230 2e dd d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 |....i..|V..1x+..| +00000240 78 0d ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 |x.....N6$1{j.9..| +00000250 07 8f 2a 16 03 01 00 b3 0c 00 00 af 03 00 1d 20 |..*............ | +00000260 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 |/.}.G.bC.(.._.).| +00000270 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |0.........._X.;t| +00000280 00 89 30 81 86 02 41 00 b5 7c a4 63 77 fa 75 cd |..0...A..|.cw.u.| +00000290 82 a5 75 15 08 09 e8 6d e9 ba 07 1f f9 9c 24 a5 |..u....m......$.| +000002a0 30 08 d0 51 3b d1 82 14 14 dd 5a 5d c9 2d 91 6f |0..Q;.....Z].-.o| +000002b0 b3 92 30 f1 38 36 e8 34 9e 99 50 a0 c4 29 04 ef |..0.86.4..P..)..| +000002c0 97 f3 cd dc be 22 86 b9 02 41 6a dd 3a 57 5b 61 |....."...Aj.:W[a| +000002d0 ff 68 7d 1e 5e bb 67 5f 76 44 7c f2 f2 03 95 f2 |.h}.^.g_vD|.....| +000002e0 e0 1a 53 70 ce b0 fa cc 7a f3 9a e3 2f 37 a3 cf |..Sp....z.../7..| +000002f0 b5 ca 1d fb fe a3 0d e2 d6 c1 d2 7d 48 80 5b 82 |...........}H.[.| +00000300 56 29 1b b7 43 2e b3 38 19 39 49 16 03 01 00 04 |V)..C..8.9I.....| +00000310 0e 00 00 00 |....| +>>> Flow 3 (client to server) +00000000 16 03 01 00 25 10 00 00 21 20 82 03 ad 10 45 0a |....%...! ....E.| +00000010 b9 a4 85 0d 88 bb 9e 16 f1 6c 6a 17 c0 11 09 48 |.........lj....H| +00000020 b4 8b 27 4e 3a 45 a1 b7 a2 03 14 03 01 00 01 01 |..'N:E..........| +00000030 16 03 01 00 30 33 5d a1 85 df 96 6d cf a1 b3 c4 |....03]....m....| +00000040 3f 3c 40 aa 05 25 af 62 ee e9 ce 48 ba e8 08 88 |?<@..%.b...H....| +00000050 95 77 c7 f1 87 c6 ce 46 a2 50 2f 41 3c 8f bf 1a |.w.....F.P/A<...| +00000060 1e 1e 1b 39 9c |...9.| +>>> Flow 4 (server to client) +00000000 14 03 01 00 01 01 16 03 01 00 30 7b 30 af df 92 |..........0{0...| +00000010 2b ee 4d 02 e3 6c 6f 8b 72 32 16 0e 4d ba 71 0d |+.M..lo.r2..M.q.| +00000020 86 0d f5 7d fe dd 07 05 3d fe 70 9b 7f d9 2b c6 |...}....=.p...+.| +00000030 7e 04 82 5f ef 0c 0b c1 e7 a5 18 17 03 01 00 20 |~.._........... | +00000040 ad bd 43 a6 10 e8 e2 41 39 35 69 af a0 00 5f 81 |..C....A95i..._.| +00000050 1e 0a 5e 78 45 2f 66 27 cb 4f db 06 22 c0 ea 0f |..^xE/f'.O.."...| +00000060 17 03 01 00 30 16 69 7f fa 1c 89 36 9f 99 c6 49 |....0.i....6...I| +00000070 e6 0d 9a b7 81 00 75 f5 2d cc 89 e8 be 47 64 76 |......u.-....Gdv| +00000080 ef 34 27 a2 46 bd 8c 14 5b 15 67 ab f1 d9 30 c3 |.4'.F...[.g...0.| +00000090 df 96 a1 59 17 15 03 01 00 20 77 ea 6f e2 ae 81 |...Y..... w.o...| +000000a0 80 4f 37 7b ee 37 3f 40 df a3 e4 be 80 1e 3e 83 |.O7{.7?@......>.| +000000b0 9b 42 f7 95 50 af ab a5 60 54 |.B..P...`T| diff --git a/go/src/crypto/tls/testdata/Server-TLSv10-ExportKeyingMaterial b/go/src/crypto/tls/testdata/Server-TLSv10-ExportKeyingMaterial new file mode 100644 index 0000000000000000000000000000000000000000..114ec3708ee8eef2b8e649283f6bed9eb38d7ecf --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv10-ExportKeyingMaterial @@ -0,0 +1,92 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 55 01 00 00 51 03 01 fb 2f 2f 8e 61 |....U...Q...//.a| +00000010 23 39 d1 13 76 62 4e f8 d5 40 82 a3 89 78 bf fe |#9..vbN..@...x..| +00000020 31 e9 60 d5 e1 e2 1c 54 7a bc 0b 00 00 04 c0 14 |1.`....Tz.......| +00000030 00 ff 01 00 00 24 00 0b 00 04 03 00 01 02 00 0a |.....$..........| +00000040 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 23 |...............#| +00000050 00 00 00 16 00 00 00 17 00 00 |..........| +>>> Flow 2 (server to client) +00000000 16 03 01 00 3f 02 00 00 3b 03 01 00 00 00 00 00 |....?...;.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 00 00 c0 14 00 00 |...DOWNGRD......| +00000030 13 00 23 00 00 ff 01 00 01 00 00 17 00 00 00 0b |..#.............| +00000040 00 02 01 00 16 03 01 02 59 0b 00 02 55 00 02 52 |........Y...U..R| +00000050 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 |..O0..K0........| +00000060 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a |......?.[..0...*| +00000070 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 |.H........0.1.0.| +00000080 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 |..U....Go1.0...U| +00000090 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 |....Go Root0...1| +000000a0 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 |60101000000Z..25| +000000b0 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 |0101000000Z0.1.0| +000000c0 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 |...U....Go1.0...| +000000d0 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 |U....Go0..0...*.| +000000e0 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 |H............0..| +000000f0 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 |.....F}...'.H..(| +00000100 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 |!.~...]..RE.z6G.| +00000110 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d |...B[.....y.@.Om| +00000120 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 |..+.....g....."8| +00000130 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b |.J.ts+.4......t{| +00000140 f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 |.X.la<..A..++$#w| +00000150 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 |[.;.u]. T..c...$| +00000160 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 |....P....C...ub.| +00000170 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 |..R.........0..0| +00000180 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 |...U...........0| +00000190 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 |...U.%..0...+...| +000001a0 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c |......+.......0.| +000001b0 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 |..U.......0.0...| +000001c0 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 |U..........CC>I.| +000001d0 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 |.m....`0...U.#..| +000001e0 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 |0...H.IM.~.1....| +000001f0 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 |..n{0...U....0..| +00000200 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 |.example.golang0| +00000210 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 |...*.H..........| +00000220 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 |...0.@+[P.a...SX| +00000230 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a |...(.X..8....1Z.| +00000240 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 |.f=C.-...... d8.| +00000250 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 |$:....}.@ ._...a| +00000260 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c |..v......\.....l| +00000270 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 |..s..Cw.......@.| +00000280 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e |a.Lr+...F..M...>| +00000290 c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 |...B...=.`.\!.;.| +000002a0 fa e7 16 03 01 00 aa 0c 00 00 a6 03 00 1d 20 2f |.............. /| +000002b0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000002c0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 00 |.........._X.;t.| +000002d0 80 ca 44 f4 0f ef d9 cb a9 88 61 a3 b4 f2 1b 9c |..D.......a.....| +000002e0 e9 a1 c2 c7 84 58 0e 3e ee 95 21 52 61 be 80 64 |.....X.>..!Ra..d| +000002f0 46 17 d5 c7 71 7c 43 41 70 2d 84 9a 49 1c bf 34 |F...q|CAp-..I..4| +00000300 f4 05 1a 0f 9c 00 c5 2d 64 37 84 34 5e d7 5c 06 |.......-d7.4^.\.| +00000310 50 99 f9 d5 a0 19 4b 2d aa 67 e4 17 c7 b4 23 26 |P.....K-.g....#&| +00000320 94 a1 cd e0 cb b1 33 9b e6 c6 a3 a7 25 93 87 7e |......3.....%..~| +00000330 37 ee 9c a0 42 b6 fd 60 59 02 4b 17 4a 4d f3 f2 |7...B..`Y.K.JM..| +00000340 2d 2a e7 8d 96 41 86 43 0a 7b 4e fc c0 7d 38 f6 |-*...A.C.{N..}8.| +00000350 f6 16 03 01 00 04 0e 00 00 00 |..........| +>>> Flow 3 (client to server) +00000000 16 03 01 00 25 10 00 00 21 20 31 ff 4d ee 06 0b |....%...! 1.M...| +00000010 de ce ed 73 65 16 9e d5 f5 d6 dd 79 bf 08 28 77 |...se......y..(w| +00000020 39 7b 3a 49 f0 3d 94 48 24 03 14 03 01 00 01 01 |9{:I.=.H$.......| +00000030 16 03 01 00 30 26 b8 c3 f1 3a 49 50 d6 cf c3 83 |....0&...:IP....| +00000040 66 57 f0 8b 63 61 14 75 d4 34 fc ba 22 7f 41 15 |fW..ca.u.4..".A.| +00000050 30 40 56 35 7c f8 ad 5a 81 c2 11 a9 67 91 f7 2a |0@V5|..Z....g..*| +00000060 4c 07 13 60 dc |L..`.| +>>> Flow 4 (server to client) +00000000 16 03 01 00 85 04 00 00 81 00 00 00 00 00 7b 00 |..............{.| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 94 |................| +00000020 6d 2d 70 97 51 ed 14 ef 68 ca 42 c5 4c ed db 91 |m-p.Q...h.B.L...| +00000030 26 40 46 a4 da 9a 13 33 d7 75 7c e0 2f 98 9f 5a |&@F....3.u|./..Z| +00000040 9c a9 12 db 59 ba 75 b2 a1 cb cf f9 75 05 c3 55 |....Y.u.....u..U| +00000050 04 ee 2a 61 94 99 df 73 b3 0b 81 68 f3 49 38 16 |..*a...s...h.I8.| +00000060 7e 51 5c e5 15 c0 58 7d 52 07 a3 db 42 00 b3 4c |~Q\...X}R...B..L| +00000070 77 09 cd 17 5f c1 da 85 f3 09 46 d6 e9 ae 7c e8 |w..._.....F...|.| +00000080 3f 6a 74 38 f9 e7 de 23 0d 90 14 03 01 00 01 01 |?jt8...#........| +00000090 16 03 01 00 30 fa 7e 6e 18 87 06 c8 26 ae a0 34 |....0.~n....&..4| +000000a0 1a 58 05 9e 0c 47 60 93 8c 83 15 98 ad ee de 62 |.X...G`........b| +000000b0 53 6f 1b 44 90 45 d9 22 0b e3 d8 25 32 75 68 ae |So.D.E."...%2uh.| +000000c0 c4 39 b9 05 93 17 03 01 00 20 ac 7a ac 04 59 6a |.9....... .z..Yj| +000000d0 75 a3 26 96 49 c8 f3 ef 39 a6 1f 07 20 d2 e6 bf |u.&.I...9... ...| +000000e0 b8 06 69 55 97 6c c4 68 01 b9 17 03 01 00 30 8b |..iU.l.h......0.| +000000f0 67 6e 9a ea 62 2c dc eb aa 9b 57 e4 5f 82 14 c6 |gn..b,....W._...| +00000100 11 d2 44 e7 5a 9d 13 c0 3e 38 de a7 82 33 44 8e |..D.Z...>8...3D.| +00000110 10 c2 20 c8 6b d2 af 12 b5 44 84 17 a9 2a ec 15 |.. .k....D...*..| +00000120 03 01 00 20 56 39 68 ce 01 c1 52 dd 21 cb 65 a0 |... V9h...R.!.e.| +00000130 5d 28 00 d6 7f f0 c1 38 51 51 98 4f cb 13 5a 41 |](.....8QQ.O..ZA| +00000140 7b 34 be f8 |{4..| diff --git a/go/src/crypto/tls/testdata/Server-TLSv10-RSA-3DES b/go/src/crypto/tls/testdata/Server-TLSv10-RSA-3DES new file mode 100644 index 0000000000000000000000000000000000000000..e4853a4cc7d5ed8f02c6c701d5c140e7cf0fe5c4 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv10-RSA-3DES @@ -0,0 +1,73 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 39 01 00 00 35 03 01 51 7a 48 8d de |....9...5..QzH..| +00000010 0b 30 0f 9a 91 56 30 20 30 dd bd 74 3b e2 d7 db |.0...V0 0..t;...| +00000020 46 3d bf 6f b6 ae 53 8a 7d 18 50 00 00 04 00 0a |F=.o..S.}.P.....| +00000030 00 ff 01 00 00 08 00 16 00 00 00 17 00 00 |..............| +>>> Flow 2 (server to client) +00000000 16 03 01 00 35 02 00 00 31 03 01 00 00 00 00 00 |....5...1.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 00 00 00 0a 00 00 |...DOWNGRD......| +00000030 09 ff 01 00 01 00 00 17 00 00 16 03 01 02 59 0b |..............Y.| +00000040 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 82 01 |..U..R..O0..K0..| +00000050 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 5b ea |............?.[.| +00000060 a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |.0...*.H........| +00000070 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 |0.1.0...U....Go1| +00000080 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 6f 6f |.0...U....Go Roo| +00000090 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 30 30 |t0...16010100000| +000000a0 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 30 30 |0Z..250101000000| +000000b0 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 47 6f |Z0.1.0...U....Go| +000000c0 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 81 9f |1.0...U....Go0..| +000000d0 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 |0...*.H.........| +000000e0 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 2e 12 |...0.......F}...| +000000f0 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 |'.H..(!.~...]..R| +00000100 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 |E.z6G....B[.....| +00000110 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 |y.@.Om..+.....g.| +00000120 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 |...."8.J.ts+.4..| +00000130 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 |....t{.X.la<..A.| +00000140 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf |.++$#w[.;.u]. T.| +00000150 a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 |.c...$....P....C| +00000160 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 |...ub...R.......| +00000170 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 ff 04 |..0..0...U......| +00000180 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 30 14 |.....0...U.%..0.| +00000190 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 01 05 |..+.........+...| +000001a0 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 |....0...U.......| +000001b0 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f 91 16 |0.0...U.........| +000001c0 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 |.CC>I..m....`0..| +000001d0 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d 13 7e |.U.#..0...H.IM.~| +000001e0 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 55 1d |.1......n{0...U.| +000001f0 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 2e 67 |...0...example.g| +00000200 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 0d 01 |olang0...*.H....| +00000210 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 |.........0.@+[P.| +00000220 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 |a...SX...(.X..8.| +00000230 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 |...1Z..f=C.-....| +00000240 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 40 20 |.. d8.$:....}.@ | +00000250 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c |._...a..v......\| +00000260 ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c |.....l..s..Cw...| +00000270 f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db 46 06 |....@.a.Lr+...F.| +00000280 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 |.M...>...B...=.`| +00000290 84 5c 21 d3 3b e9 fa e7 16 03 01 00 04 0e 00 00 |.\!.;...........| +000002a0 00 |.| +>>> Flow 3 (client to server) +00000000 16 03 01 00 86 10 00 00 82 00 80 54 53 e6 48 5d |...........TS.H]| +00000010 bb 47 19 7e ab 31 3b 4a c8 fb da 69 9d 74 b3 e1 |.G.~.1;J...i.t..| +00000020 dc 8c ea 36 f7 a1 06 68 52 79 c3 08 be b9 5c 1a |...6...hRy....\.| +00000030 80 cc 13 b8 7b b8 02 98 5e f8 50 47 a5 0d 37 dd |....{...^.PG..7.| +00000040 86 c5 69 9c 1c 1c 91 39 ea 80 dc d1 87 d3 f8 f6 |..i....9........| +00000050 84 c6 65 72 af 71 dc 98 56 9e bc e7 a9 9d 9b 31 |..er.q..V......1| +00000060 d0 c3 54 28 05 86 91 e4 03 40 f7 2a cb 07 13 41 |..T(.....@.*...A| +00000070 1e 30 0b b1 2d 52 ae 1f a1 6b a9 db c2 76 1d 4a |.0..-R...k...v.J| +00000080 a6 81 ba 3c cb e9 3a 6b f3 70 ed 14 03 01 00 01 |...<..:k.p......| +00000090 01 16 03 01 00 28 01 84 d8 e4 7a b1 11 3e 27 fb |.....(....z..>'.| +000000a0 66 10 1a db 20 fb 9e e3 f1 a5 a7 86 2f fd c9 d2 |f... ......./...| +000000b0 1c b8 a4 2b af 2b 66 fc ad 31 72 28 d7 1a |...+.+f..1r(..| +>>> Flow 4 (server to client) +00000000 14 03 01 00 01 01 16 03 01 00 28 67 3d c4 e9 a6 |..........(g=...| +00000010 bb 99 57 90 eb fa 86 ee ab 00 08 61 2d c8 50 5b |..W........a-.P[| +00000020 83 9c ce 83 60 7a 89 33 90 b7 f9 31 e9 37 04 3d |....`z.3...1.7.=| +00000030 d6 01 44 17 03 01 00 18 0a 1c 6c 75 23 bc b2 e7 |..D.......lu#...| +00000040 30 2d 61 57 d3 a6 a2 72 6a 7a 2d 8a 7b fd 45 67 |0-aW...rjz-.{.Eg| +00000050 17 03 01 00 28 23 8b 77 dd a3 f2 b6 0e 59 40 3b |....(#.w.....Y@;| +00000060 4e 3a 1b 0c 11 2f 99 00 b9 e1 2c 11 89 53 fb 23 |N:.../....,..S.#| +00000070 fb 6c 60 71 db a8 43 a4 92 ad 68 24 e9 15 03 01 |.l`q..C...h$....| +00000080 00 18 24 19 84 35 13 29 ed 3a f0 57 a9 e1 b6 e9 |..$..5.).:.W....| +00000090 05 64 fe 46 c0 ca b1 88 12 a7 |.d.F......| diff --git a/go/src/crypto/tls/testdata/Server-TLSv10-RSA-AES b/go/src/crypto/tls/testdata/Server-TLSv10-RSA-AES new file mode 100644 index 0000000000000000000000000000000000000000..f362a7a611406cbbb09051696af0118b64944cd8 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv10-RSA-AES @@ -0,0 +1,76 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 39 01 00 00 35 03 01 96 f7 15 21 fc |....9...5.....!.| +00000010 31 f5 cf cf e9 82 0f 84 db 34 a8 e4 3c e9 39 b4 |1........4..<.9.| +00000020 90 af d7 47 2b b5 71 8a bb 26 b5 00 00 04 00 2f |...G+.q..&...../| +00000030 00 ff 01 00 00 08 00 16 00 00 00 17 00 00 |..............| +>>> Flow 2 (server to client) +00000000 16 03 01 00 35 02 00 00 31 03 01 00 00 00 00 00 |....5...1.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 00 00 00 2f 00 00 |...DOWNGRD.../..| +00000030 09 ff 01 00 01 00 00 17 00 00 16 03 01 02 59 0b |..............Y.| +00000040 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 82 01 |..U..R..O0..K0..| +00000050 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 5b ea |............?.[.| +00000060 a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |.0...*.H........| +00000070 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 |0.1.0...U....Go1| +00000080 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 6f 6f |.0...U....Go Roo| +00000090 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 30 30 |t0...16010100000| +000000a0 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 30 30 |0Z..250101000000| +000000b0 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 47 6f |Z0.1.0...U....Go| +000000c0 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 81 9f |1.0...U....Go0..| +000000d0 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 |0...*.H.........| +000000e0 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 2e 12 |...0.......F}...| +000000f0 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 |'.H..(!.~...]..R| +00000100 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 |E.z6G....B[.....| +00000110 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 |y.@.Om..+.....g.| +00000120 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 |...."8.J.ts+.4..| +00000130 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 |....t{.X.la<..A.| +00000140 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf |.++$#w[.;.u]. T.| +00000150 a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 |.c...$....P....C| +00000160 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 |...ub...R.......| +00000170 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 ff 04 |..0..0...U......| +00000180 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 30 14 |.....0...U.%..0.| +00000190 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 01 05 |..+.........+...| +000001a0 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 |....0...U.......| +000001b0 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f 91 16 |0.0...U.........| +000001c0 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 |.CC>I..m....`0..| +000001d0 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d 13 7e |.U.#..0...H.IM.~| +000001e0 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 55 1d |.1......n{0...U.| +000001f0 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 2e 67 |...0...example.g| +00000200 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 0d 01 |olang0...*.H....| +00000210 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 |.........0.@+[P.| +00000220 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 |a...SX...(.X..8.| +00000230 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 |...1Z..f=C.-....| +00000240 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 40 20 |.. d8.$:....}.@ | +00000250 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c |._...a..v......\| +00000260 ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c |.....l..s..Cw...| +00000270 f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db 46 06 |....@.a.Lr+...F.| +00000280 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 |.M...>...B...=.`| +00000290 84 5c 21 d3 3b e9 fa e7 16 03 01 00 04 0e 00 00 |.\!.;...........| +000002a0 00 |.| +>>> Flow 3 (client to server) +00000000 16 03 01 00 86 10 00 00 82 00 80 47 20 04 47 3e |...........G .G>| +00000010 d0 67 d1 d9 5d 17 eb 85 2c 3f 1c 4b 93 f9 ff 51 |.g..]...,?.K...Q| +00000020 ca 61 eb 04 54 6d 49 97 02 67 fe 28 79 be 4d 37 |.a..TmI..g.(y.M7| +00000030 f7 ba e8 e0 2b 90 31 fe 66 d8 04 ad bf fb 2c 05 |....+.1.f.....,.| +00000040 7e 41 a0 5d 00 47 20 84 83 2c 39 7f 29 aa 72 72 |~A.].G ..,9.).rr| +00000050 89 e3 c7 bb ea 07 d2 29 94 de 54 23 eb 9f ae fa |.......)..T#....| +00000060 3b 9a 23 bd a8 43 11 ab b5 6c 8a ae c6 71 2c c4 |;.#..C...l...q,.| +00000070 f6 4d 0d 19 8e f6 7e 44 d2 04 58 68 a7 bd 84 34 |.M....~D..Xh...4| +00000080 5f e5 98 56 a5 1e 61 57 f2 f4 ea 14 03 01 00 01 |_..V..aW........| +00000090 01 16 03 01 00 30 eb 07 c2 ed 41 24 ab 50 74 82 |.....0....A$.Pt.| +000000a0 c4 83 28 2c b3 33 88 a1 c7 61 89 61 29 58 78 fc |..(,.3...a.a)Xx.| +000000b0 b5 99 54 d2 c2 2b 14 e4 6b a9 9b b8 69 17 6c 53 |..T..+..k...i.lS| +000000c0 dd dd d7 7b a5 a7 |...{..| +>>> Flow 4 (server to client) +00000000 14 03 01 00 01 01 16 03 01 00 30 17 39 24 df 39 |..........0.9$.9| +00000010 2f b4 09 7b d8 76 fa c2 0a e2 68 f9 23 0c be 1b |/..{.v....h.#...| +00000020 9d ba 91 16 2c f3 5b 6a 3d d3 63 12 35 76 91 38 |....,.[j=.c.5v.8| +00000030 f3 a5 37 4a bc 65 f4 85 cb b8 65 17 03 01 00 20 |..7J.e....e.... | +00000040 0c 59 ac 4f 44 97 46 bd d5 ae 98 74 9f 86 3e ef |.Y.OD.F....t..>.| +00000050 b3 09 3c c4 0c 45 58 10 4f fd e0 be 86 ac 3e c8 |..<..EX.O.....>.| +00000060 17 03 01 00 30 8c 76 1f 5a 4a 3b 98 4d 5c 0d c7 |....0.v.ZJ;.M\..| +00000070 dc 55 df 70 ed 75 22 d2 a5 28 a7 4e 9f ed 83 3b |.U.p.u"..(.N...;| +00000080 88 85 7d 1a 7e f9 6f e7 f3 26 e1 b1 7b 4e 52 a5 |..}.~.o..&..{NR.| +00000090 29 55 a4 04 df 15 03 01 00 20 8b 10 5c 79 5e f8 |)U....... ..\y^.| +000000a0 1d 41 1c b2 05 fd 58 5a 80 69 e5 ce db c3 ac a4 |.A....XZ.i......| +000000b0 e6 95 1d 9d 32 e2 66 4b af 43 |....2.fK.C| diff --git a/go/src/crypto/tls/testdata/Server-TLSv10-RSA-RC4 b/go/src/crypto/tls/testdata/Server-TLSv10-RSA-RC4 new file mode 100644 index 0000000000000000000000000000000000000000..e07b8d855f2d92939f239eb4d13393482a6a532a --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv10-RSA-RC4 @@ -0,0 +1,70 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 39 01 00 00 35 03 01 eb 78 34 78 f6 |....9...5...x4x.| +00000010 8f 87 2f ee 5e da ee 37 5d 0a d5 79 d5 0e db b1 |../.^..7]..y....| +00000020 b7 03 37 1f 2d ce 04 b9 2d 65 d7 00 00 04 00 05 |..7.-...-e......| +00000030 00 ff 01 00 00 08 00 16 00 00 00 17 00 00 |..............| +>>> Flow 2 (server to client) +00000000 16 03 01 00 35 02 00 00 31 03 01 00 00 00 00 00 |....5...1.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 00 00 00 05 00 00 |...DOWNGRD......| +00000030 09 ff 01 00 01 00 00 17 00 00 16 03 01 02 59 0b |..............Y.| +00000040 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 82 01 |..U..R..O0..K0..| +00000050 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 5b ea |............?.[.| +00000060 a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |.0...*.H........| +00000070 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 |0.1.0...U....Go1| +00000080 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 6f 6f |.0...U....Go Roo| +00000090 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 30 30 |t0...16010100000| +000000a0 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 30 30 |0Z..250101000000| +000000b0 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 47 6f |Z0.1.0...U....Go| +000000c0 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 81 9f |1.0...U....Go0..| +000000d0 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 |0...*.H.........| +000000e0 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 2e 12 |...0.......F}...| +000000f0 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 |'.H..(!.~...]..R| +00000100 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 |E.z6G....B[.....| +00000110 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 |y.@.Om..+.....g.| +00000120 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 |...."8.J.ts+.4..| +00000130 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 |....t{.X.la<..A.| +00000140 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf |.++$#w[.;.u]. T.| +00000150 a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 |.c...$....P....C| +00000160 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 |...ub...R.......| +00000170 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 ff 04 |..0..0...U......| +00000180 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 30 14 |.....0...U.%..0.| +00000190 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 01 05 |..+.........+...| +000001a0 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 |....0...U.......| +000001b0 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f 91 16 |0.0...U.........| +000001c0 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 |.CC>I..m....`0..| +000001d0 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d 13 7e |.U.#..0...H.IM.~| +000001e0 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 55 1d |.1......n{0...U.| +000001f0 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 2e 67 |...0...example.g| +00000200 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 0d 01 |olang0...*.H....| +00000210 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 |.........0.@+[P.| +00000220 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 |a...SX...(.X..8.| +00000230 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 |...1Z..f=C.-....| +00000240 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 40 20 |.. d8.$:....}.@ | +00000250 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c |._...a..v......\| +00000260 ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c |.....l..s..Cw...| +00000270 f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db 46 06 |....@.a.Lr+...F.| +00000280 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 |.M...>...B...=.`| +00000290 84 5c 21 d3 3b e9 fa e7 16 03 01 00 04 0e 00 00 |.\!.;...........| +000002a0 00 |.| +>>> Flow 3 (client to server) +00000000 16 03 01 00 86 10 00 00 82 00 80 d4 db 61 0b 26 |.............a.&| +00000010 06 af 94 37 9d fc 50 3f 50 4f 58 37 b9 b1 c2 d2 |...7..P?POX7....| +00000020 92 2b f5 c9 fe 7f 3d f4 32 e3 ee ba 46 ea e5 36 |.+....=.2...F..6| +00000030 9b fd c5 89 c9 14 45 e7 f7 ea 1a a9 63 c5 62 fb |......E.....c.b.| +00000040 34 c4 80 1e 59 60 39 d9 ca 68 3f 3f 1a f9 6a 14 |4...Y`9..h??..j.| +00000050 f7 c8 91 3b 7d eb cc b9 8c 42 f1 ef d8 0f cd 17 |...;}....B......| +00000060 64 f3 b8 30 6e 50 d4 23 bb 26 78 c3 fe f0 c4 42 |d..0nP.#.&x....B| +00000070 0a 89 90 fb 43 fe 7f 0f 06 82 e8 7f fb 42 dd 46 |....C........B.F| +00000080 fc 38 6e d0 14 05 41 b8 05 6b e7 14 03 01 00 01 |.8n...A..k......| +00000090 01 16 03 01 00 24 b4 bb 3e 8f 6b 91 43 c2 b9 16 |.....$..>.k.C...| +000000a0 59 ba 7d f9 89 a4 89 ce 12 c8 76 b0 e3 8f 36 03 |Y.}.......v...6.| +000000b0 f7 48 03 7e 4a fe e5 8e 88 91 |.H.~J.....| +>>> Flow 4 (server to client) +00000000 14 03 01 00 01 01 16 03 01 00 24 06 5d 9f 70 98 |..........$.].p.| +00000010 8b 42 79 f1 ba 73 40 8e b3 f6 ff a1 45 57 c4 f3 |.By..s@.....EW..| +00000020 6d 00 4e b5 52 f5 3d 08 b4 57 33 74 ab 6f 62 17 |m.N.R.=..W3t.ob.| +00000030 03 01 00 21 6e 3a c7 a5 63 fb 81 78 10 9c 85 ab |...!n:..c..x....| +00000040 3d 3b 50 3a 12 0b c2 0f f5 7e a2 d3 f7 82 3c 7f |=;P:.....~....<.| +00000050 45 29 2c 1e eb 15 03 01 00 16 66 a4 bb 6d d1 fc |E),.......f..m..| +00000060 36 b2 a9 e7 e5 7a da a1 37 f1 cf fa 8f 0c 73 f5 |6....z..7.....s.| diff --git a/go/src/crypto/tls/testdata/Server-TLSv11-FallbackSCSV b/go/src/crypto/tls/testdata/Server-TLSv11-FallbackSCSV new file mode 100644 index 0000000000000000000000000000000000000000..7bd034105ec6bbf59da0b7a0735bb419f1873c9f --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv11-FallbackSCSV @@ -0,0 +1,11 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 77 01 00 00 73 03 02 0a 6b c9 55 9d |....w...s...k.U.| +00000010 bf 4e 61 b2 0a c7 c6 96 9f eb 90 91 87 ca d3 d3 |.Na.............| +00000020 62 dc b6 b4 db ea 41 fe 43 3e a3 00 00 14 c0 0a |b.....A.C>......| +00000030 c0 14 00 39 c0 09 c0 13 00 33 00 35 00 2f 00 ff |...9.....3.5./..| +00000040 56 00 01 00 00 36 00 00 00 0e 00 0c 00 00 09 31 |V....6.........1| +00000050 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| +00000060 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| +00000070 00 23 00 00 00 16 00 00 00 17 00 00 |.#..........| +>>> Flow 2 (server to client) +00000000 15 03 02 00 02 02 56 |......V| diff --git a/go/src/crypto/tls/testdata/Server-TLSv11-RSA-RC4 b/go/src/crypto/tls/testdata/Server-TLSv11-RSA-RC4 new file mode 100644 index 0000000000000000000000000000000000000000..27062da0d24d2681af7c229f146a58ed7e3984d6 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv11-RSA-RC4 @@ -0,0 +1,70 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 39 01 00 00 35 03 02 ac 4f 36 f3 4c |....9...5...O6.L| +00000010 64 ae 8d fc 50 a3 e1 e4 70 5d ba 8c de de c8 07 |d...P...p]......| +00000020 70 24 8d bd c1 69 a3 0e ad 16 38 00 00 04 00 05 |p$...i....8.....| +00000030 00 ff 01 00 00 08 00 16 00 00 00 17 00 00 |..............| +>>> Flow 2 (server to client) +00000000 16 03 02 00 35 02 00 00 31 03 02 00 00 00 00 00 |....5...1.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 00 00 00 05 00 00 |...DOWNGRD......| +00000030 09 ff 01 00 01 00 00 17 00 00 16 03 02 02 59 0b |..............Y.| +00000040 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 82 01 |..U..R..O0..K0..| +00000050 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 5b ea |............?.[.| +00000060 a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |.0...*.H........| +00000070 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 |0.1.0...U....Go1| +00000080 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 6f 6f |.0...U....Go Roo| +00000090 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 30 30 |t0...16010100000| +000000a0 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 30 30 |0Z..250101000000| +000000b0 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 47 6f |Z0.1.0...U....Go| +000000c0 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 81 9f |1.0...U....Go0..| +000000d0 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 |0...*.H.........| +000000e0 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 2e 12 |...0.......F}...| +000000f0 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 |'.H..(!.~...]..R| +00000100 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 |E.z6G....B[.....| +00000110 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 |y.@.Om..+.....g.| +00000120 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 |...."8.J.ts+.4..| +00000130 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 |....t{.X.la<..A.| +00000140 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf |.++$#w[.;.u]. T.| +00000150 a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 |.c...$....P....C| +00000160 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 |...ub...R.......| +00000170 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 ff 04 |..0..0...U......| +00000180 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 30 14 |.....0...U.%..0.| +00000190 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 01 05 |..+.........+...| +000001a0 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 |....0...U.......| +000001b0 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f 91 16 |0.0...U.........| +000001c0 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 |.CC>I..m....`0..| +000001d0 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d 13 7e |.U.#..0...H.IM.~| +000001e0 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 55 1d |.1......n{0...U.| +000001f0 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 2e 67 |...0...example.g| +00000200 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 0d 01 |olang0...*.H....| +00000210 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 |.........0.@+[P.| +00000220 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 |a...SX...(.X..8.| +00000230 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 |...1Z..f=C.-....| +00000240 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 40 20 |.. d8.$:....}.@ | +00000250 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c |._...a..v......\| +00000260 ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c |.....l..s..Cw...| +00000270 f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db 46 06 |....@.a.Lr+...F.| +00000280 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 |.M...>...B...=.`| +00000290 84 5c 21 d3 3b e9 fa e7 16 03 02 00 04 0e 00 00 |.\!.;...........| +000002a0 00 |.| +>>> Flow 3 (client to server) +00000000 16 03 02 00 86 10 00 00 82 00 80 49 c4 5f 04 e0 |...........I._..| +00000010 63 96 72 bd c9 00 af 17 b1 59 b4 c7 40 a5 b7 b5 |c.r......Y..@...| +00000020 68 79 d2 7b b0 2a e7 06 7e 97 ad da d8 3f cb f8 |hy.{.*..~....?..| +00000030 7c b9 f1 9d be 49 7c 09 6a b0 25 49 9c 06 2a c3 ||....I|.j.%I..*.| +00000040 d5 0a ae cc cc 08 31 5d 14 82 06 a7 57 fc 66 9c |......1]....W.f.| +00000050 90 b7 be aa 15 46 2b aa ae fc 3a ce 3d 64 4e 80 |.....F+...:.=dN.| +00000060 90 3f 77 c6 60 cd 6b dc 69 c1 92 a9 1e 8e 30 6a |.?w.`.k.i.....0j| +00000070 34 a3 db 1a f5 a3 f9 ac 1c 07 4f be 38 d1 a5 61 |4.........O.8..a| +00000080 e5 5f 84 99 f0 87 40 dc b2 cc 05 14 03 02 00 01 |._....@.........| +00000090 01 16 03 02 00 24 eb d9 48 20 7b db 97 48 f2 c7 |.....$..H {..H..| +000000a0 bb c1 ef fa 74 44 d8 a1 55 63 f3 d0 90 ef f2 0b |....tD..Uc......| +000000b0 67 10 98 27 76 8a 70 78 0b df |g..'v.px..| +>>> Flow 4 (server to client) +00000000 14 03 02 00 01 01 16 03 02 00 24 41 50 b9 88 0e |..........$AP...| +00000010 3f 27 36 f0 27 70 ca b8 bc 38 df e9 68 3e 29 cf |?'6.'p...8..h>).| +00000020 80 b5 e8 59 bd 52 45 b7 0d fa a7 6d 77 a0 9e 17 |...Y.RE....mw...| +00000030 03 02 00 21 94 2a 6a ca f0 b3 7e 1c d6 58 3f 64 |...!.*j...~..X?d| +00000040 ef 62 35 72 aa c6 84 7b 19 c6 07 0e 04 63 c4 14 |.b5r...{.....c..| +00000050 43 d8 73 ff 2f 15 03 02 00 16 5a 45 ba 51 95 c9 |C.s./.....ZE.Q..| +00000060 53 2a a6 b1 61 35 db 0a 7b f9 8e a9 fb 18 87 b1 |S*..a5..{.......| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-ALPN b/go/src/crypto/tls/testdata/Server-TLSv12-ALPN new file mode 100644 index 0000000000000000000000000000000000000000..6ee4bc8086d989a97ea0a84af5c5ddb224fd115e --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-ALPN @@ -0,0 +1,91 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 9d 01 00 00 99 03 03 4c 3c dd 9a 33 |...........L<..3| +00000010 a3 3d c3 9d 54 4c a8 e7 d4 2d 20 59 11 bc 48 71 |.=..TL...- Y..Hq| +00000020 bc 5d 6b 24 fd 97 a2 30 4a 2f c8 00 00 04 cc a8 |.]k$...0J/......| +00000030 00 ff 01 00 00 6c 00 0b 00 04 03 00 01 02 00 0a |.....l..........| +00000040 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 23 |...............#| +00000050 00 00 00 10 00 10 00 0e 06 70 72 6f 74 6f 32 06 |.........proto2.| +00000060 70 72 6f 74 6f 31 00 16 00 00 00 17 00 00 00 0d |proto1..........| +00000070 00 30 00 2e 04 03 05 03 06 03 08 07 08 08 08 09 |.0..............| +00000080 08 0a 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 |................| +00000090 03 03 02 03 03 01 02 01 03 02 02 02 04 02 05 02 |................| +000000a0 06 02 |..| +>>> Flow 2 (server to client) +00000000 16 03 03 00 4c 02 00 00 48 03 03 00 00 00 00 00 |....L...H.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 cc a8 00 00 |...DOWNGRD......| +00000030 20 00 23 00 00 ff 01 00 01 00 00 17 00 00 00 10 | .#.............| +00000040 00 09 00 07 06 70 72 6f 74 6f 31 00 0b 00 02 01 |.....proto1.....| +00000050 00 16 03 03 02 59 0b 00 02 55 00 02 52 00 02 4f |.....Y...U..R..O| +00000060 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 |0..K0...........| +00000070 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 86 |...?.[..0...*.H.| +00000080 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 55 |.......0.1.0...U| +00000090 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 13 |....Go1.0...U...| +000000a0 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 31 |.Go Root0...1601| +000000b0 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 30 |01000000Z..25010| +000000c0 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 03 |1000000Z0.1.0...| +000000d0 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 03 |U....Go1.0...U..| +000000e0 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 |..Go0..0...*.H..| +000000f0 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 81 |..........0.....| +00000100 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab 7e |..F}...'.H..(!.~| +00000110 c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d 92 |...]..RE.z6G....| +00000120 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd 2b |B[.....y.@.Om..+| +00000130 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a 0b |.....g....."8.J.| +00000140 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 9f |ts+.4......t{.X.| +00000150 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c 3b |la<..A..++$#w[.;| +00000160 bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 1d |.u]. T..c...$...| +00000170 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 52 |.P....C...ub...R| +00000180 d7 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 03 |.........0..0...| +00000190 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 |U...........0...| +000001a0 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 03 |U.%..0...+......| +000001b0 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 55 |...+.......0...U| +000001c0 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d 0e |.......0.0...U..| +000001d0 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d b6 |........CC>I..m.| +000001e0 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 80 |...`0...U.#..0..| +000001f0 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab 6e |.H.IM.~.1......n| +00000200 7b 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 78 |{0...U....0...ex| +00000210 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 |ample.golang0...| +00000220 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 9d |*.H.............| +00000230 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed 83 |0.@+[P.a...SX...| +00000240 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 3d |(.X..8....1Z..f=| +00000250 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a 00 |C.-...... d8.$:.| +00000260 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 76 |...}.@ ._...a..v| +00000270 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed 73 |......\.....l..s| +00000280 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c |..Cw.......@.a.L| +00000290 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd |r+...F..M...>...| +000002a0 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 |B...=.`.\!.;....| +000002b0 03 03 00 ac 0c 00 00 a8 03 00 1d 20 2f e5 7d a3 |........... /.}.| +000002c0 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...| +000002d0 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 08 04 00 80 |......._X.;t....| +000002e0 82 9a 38 98 24 59 07 8b a9 7e d3 9f c3 70 8d 87 |..8.$Y...~...p..| +000002f0 2d 1b 53 f3 36 96 4a 07 83 80 1e 62 23 b4 79 c9 |-.S.6.J....b#.y.| +00000300 93 48 0a 54 ad 03 5e 71 c3 69 d9 b7 be 93 c0 e8 |.H.T..^q.i......| +00000310 13 bd 10 67 b1 ea 8f f0 72 ed e1 54 b1 e5 a8 ca |...g....r..T....| +00000320 c7 b2 ac 2e 14 ab 6a 84 2b 97 e6 8f 68 1c e9 83 |......j.+...h...| +00000330 73 70 24 40 99 f7 86 2a c7 08 1f bc bd df a2 24 |sp$@...*.......$| +00000340 75 33 81 29 18 69 d5 5e 93 91 63 62 ee e9 8f b6 |u3.).i.^..cb....| +00000350 fc d1 00 5d b2 b5 cc 5f c9 83 8d fd f8 dd 7a cd |...]..._......z.| +00000360 16 03 03 00 04 0e 00 00 00 |.........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 61 d8 61 58 30 ba |....%...! a.aX0.| +00000010 44 5b 31 35 e3 4e 92 87 d0 10 0c 83 96 98 b5 73 |D[15.N.........s| +00000020 31 40 7a fd 78 8a cf b4 af 53 14 03 03 00 01 01 |1@z.x....S......| +00000030 16 03 03 00 20 14 80 2b 46 28 9e a8 1b d5 9a bd |.... ..+F(......| +00000040 6c da 22 62 a9 7d d8 c1 e5 d7 63 6f 26 3f ca 1c |l."b.}....co&?..| +00000050 5e 53 8b 3c f3 |^S.<.| +>>> Flow 4 (server to client) +00000000 16 03 03 00 85 04 00 00 81 00 00 00 00 00 7b 00 |..............{.| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 94 |................| +00000020 6f 2d 7c 2b 51 ed 14 ef 68 ca 42 c5 4c a3 4e 47 |o-|+Q...h.B.L.NG| +00000030 75 8d 90 24 a8 60 43 a8 3b 00 81 b1 1d 41 ce bf |u..$.`C.;....A..| +00000040 ec 75 e9 32 6b 9b 21 9f 0f 56 27 b2 e5 9e 9a 01 |.u.2k.!..V'.....| +00000050 aa c7 63 81 8b 90 45 fa 64 75 96 e3 c8 49 38 16 |..c...E.du...I8.| +00000060 7e 51 5c e5 15 c0 58 7d 52 07 32 1b 54 23 7f 75 |~Q\...X}R.2.T#.u| +00000070 8a 30 1c 6a 94 57 27 7d 06 25 05 b7 ae ce 5c a4 |.0.j.W'}.%....\.| +00000080 58 21 47 f2 04 bc 3a f1 6d 20 14 03 03 00 01 01 |X!G...:.m ......| +00000090 16 03 03 00 20 94 0c cf 54 2b fb 49 26 19 d4 06 |.... ...T+.I&...| +000000a0 0e b6 71 b5 d9 24 f6 d1 99 36 78 1c 96 b4 12 e0 |..q..$...6x.....| +000000b0 20 5a 2a a7 ad 17 03 03 00 1d 19 36 ef 7d 53 24 | Z*........6.}S$| +000000c0 0c 5e 48 24 c6 ad 91 ca 44 0d 2e fb 10 fd 58 2f |.^H$....D.....X/| +000000d0 86 5c be c6 64 01 c6 15 03 03 00 12 26 94 16 38 |.\..d.......&..8| +000000e0 6c 23 4e 29 03 96 c6 6a a8 af 32 0b 2e 9e |l#N)...j..2...| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-ALPN-Fallback b/go/src/crypto/tls/testdata/Server-TLSv12-ALPN-Fallback new file mode 100644 index 0000000000000000000000000000000000000000..a453fcc5227f9245c847d44ec5dcf5d751c60a56 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-ALPN-Fallback @@ -0,0 +1,90 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 a6 01 00 00 a2 03 03 74 b9 ce 14 2f |...........t.../| +00000010 85 a9 93 bf 60 4e 5c 5c 6e 47 34 cf b8 27 f8 dc |....`N\\nG4..'..| +00000020 b1 5b a8 eb e0 fa da a0 1b b6 9c 00 00 04 cc a8 |.[..............| +00000030 00 ff 01 00 00 75 00 0b 00 04 03 00 01 02 00 0a |.....u..........| +00000040 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 23 |...............#| +00000050 00 00 00 10 00 19 00 17 06 70 72 6f 74 6f 33 08 |.........proto3.| +00000060 68 74 74 70 2f 31 2e 31 06 70 72 6f 74 6f 34 00 |http/1.1.proto4.| +00000070 16 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 05 |..........0.....| +00000080 03 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 |................| +00000090 05 08 06 04 01 05 01 06 01 03 03 02 03 03 01 02 |................| +000000a0 01 03 02 02 02 04 02 05 02 06 02 |...........| +>>> Flow 2 (server to client) +00000000 16 03 03 00 3f 02 00 00 3b 03 03 00 00 00 00 00 |....?...;.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 cc a8 00 00 |...DOWNGRD......| +00000030 13 00 23 00 00 ff 01 00 01 00 00 17 00 00 00 0b |..#.............| +00000040 00 02 01 00 16 03 03 02 59 0b 00 02 55 00 02 52 |........Y...U..R| +00000050 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 |..O0..K0........| +00000060 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a |......?.[..0...*| +00000070 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 |.H........0.1.0.| +00000080 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 |..U....Go1.0...U| +00000090 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 |....Go Root0...1| +000000a0 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 |60101000000Z..25| +000000b0 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 |0101000000Z0.1.0| +000000c0 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 |...U....Go1.0...| +000000d0 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 |U....Go0..0...*.| +000000e0 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 |H............0..| +000000f0 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 |.....F}...'.H..(| +00000100 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 |!.~...]..RE.z6G.| +00000110 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d |...B[.....y.@.Om| +00000120 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 |..+.....g....."8| +00000130 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b |.J.ts+.4......t{| +00000140 f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 |.X.la<..A..++$#w| +00000150 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 |[.;.u]. T..c...$| +00000160 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 |....P....C...ub.| +00000170 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 |..R.........0..0| +00000180 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 |...U...........0| +00000190 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 |...U.%..0...+...| +000001a0 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c |......+.......0.| +000001b0 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 |..U.......0.0...| +000001c0 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 |U..........CC>I.| +000001d0 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 |.m....`0...U.#..| +000001e0 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 |0...H.IM.~.1....| +000001f0 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 |..n{0...U....0..| +00000200 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 |.example.golang0| +00000210 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 |...*.H..........| +00000220 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 |...0.@+[P.a...SX| +00000230 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a |...(.X..8....1Z.| +00000240 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 |.f=C.-...... d8.| +00000250 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 |$:....}.@ ._...a| +00000260 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c |..v......\.....l| +00000270 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 |..s..Cw.......@.| +00000280 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e |a.Lr+...F..M...>| +00000290 c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 |...B...=.`.\!.;.| +000002a0 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d 20 2f |.............. /| +000002b0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000002c0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 08 |.........._X.;t.| +000002d0 04 00 80 22 97 55 0d 4c fe 5e 4e 45 b7 9b b2 f8 |...".U.L.^NE....| +000002e0 29 c7 7a 33 b5 e0 06 92 4f b3 6e 67 ad 4e 69 20 |).z3....O.ng.Ni | +000002f0 e5 82 b6 93 84 52 05 fd 99 d1 94 67 e4 7d bc 1d |.....R.....g.}..| +00000300 f7 16 d7 24 95 61 db ed 92 16 11 ee c1 c5 6f 82 |...$.a........o.| +00000310 8e 6b 10 69 31 d2 17 1a 6f 25 a0 d5 4b 7e c9 ba |.k.i1...o%..K~..| +00000320 13 3e c4 94 46 63 e2 6e c6 ca d0 e4 09 5a 2a 39 |.>..Fc.n.....Z*9| +00000330 12 c0 fc 37 14 4e a8 1f 74 4e 44 86 1a 29 d4 a0 |...7.N..tND..)..| +00000340 5f e5 0a 22 6c 09 78 29 be 33 a5 2c d9 b3 5f ec |_.."l.x).3.,.._.| +00000350 f1 5e 87 16 03 03 00 04 0e 00 00 00 |.^..........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 a4 f2 f3 f8 81 68 |....%...! .....h| +00000010 6f 8d d5 2c 93 fe ee cf f6 28 ae 06 9f 81 fa 0d |o..,.....(......| +00000020 ac 31 2b cf 05 4e cb a0 b3 14 14 03 03 00 01 01 |.1+..N..........| +00000030 16 03 03 00 20 ca 3e f2 cd 68 42 34 26 61 40 29 |.... .>..hB4&a@)| +00000040 dd 71 e1 52 b7 0e ec 1f 77 8e 1d 1b 95 dd 07 4f |.q.R....w......O| +00000050 c4 4d d8 02 83 |.M...| +>>> Flow 4 (server to client) +00000000 16 03 03 00 85 04 00 00 81 00 00 00 00 00 7b 00 |..............{.| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 94 |................| +00000020 6f 2d 7c 2b 51 ed 14 ef 68 ca 42 c5 4c 23 bb 4f |o-|+Q...h.B.L#.O| +00000030 57 15 7b bb 5c 23 ff bd b0 3b c9 ce d7 8e b9 d8 |W.{.\#...;......| +00000040 b6 35 dd 0b 5b fd 3f bf c6 c9 74 86 d4 4e 1c 22 |.5..[.?...t..N."| +00000050 fb 4e ea 39 16 d3 9d 08 c8 08 c8 94 c7 49 38 16 |.N.9.........I8.| +00000060 7e 51 5c e5 15 c0 58 7d 52 07 e6 23 d9 47 91 c4 |~Q\...X}R..#.G..| +00000070 55 a3 14 46 22 5a 68 ec 70 f1 cd 8b e0 36 5d 20 |U..F"Zh.p....6] | +00000080 bb 33 6b d2 cc e0 bc 81 f6 ba 14 03 03 00 01 01 |.3k.............| +00000090 16 03 03 00 20 06 6c 46 46 01 02 e9 42 de 4a dc |.... .lFF...B.J.| +000000a0 4b 55 15 6d e4 2c da 02 67 af 08 f1 15 f6 5a 72 |KU.m.,..g.....Zr| +000000b0 0b 70 d3 28 ba 17 03 03 00 1d 5b 4f 16 d3 78 dd |.p.(......[O..x.| +000000c0 fb cb 38 70 cc dc 26 36 99 ad 67 e3 dc 2b c8 62 |..8p..&6..g..+.b| +000000d0 1f a1 ad 3b e2 fd d7 15 03 03 00 12 e4 ca da 87 |...;............| +000000e0 78 97 b2 b3 27 0f 3e 1a 97 8d ab fc 7c b9 |x...'.>.....|.| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-ALPN-NoMatch b/go/src/crypto/tls/testdata/Server-TLSv12-ALPN-NoMatch new file mode 100644 index 0000000000000000000000000000000000000000..2d8a2eb8e8a5d0b45e41341076d12e9e02a37637 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-ALPN-NoMatch @@ -0,0 +1,14 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 9d 01 00 00 99 03 03 24 15 a8 f2 f5 |...........$....| +00000010 53 02 78 f0 4c f7 82 3c 68 7d a0 b1 9a 0f 29 32 |S.x.L..>> Flow 2 (server to client) +00000000 15 03 03 00 02 02 78 |......x| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-ALPN-NotConfigured b/go/src/crypto/tls/testdata/Server-TLSv12-ALPN-NotConfigured new file mode 100644 index 0000000000000000000000000000000000000000..97d300d76b92835bd77dfc8a1445df4c35e3a1e5 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-ALPN-NotConfigured @@ -0,0 +1,90 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 9d 01 00 00 99 03 03 23 13 3f 28 85 |...........#.?(.| +00000010 56 f7 0f d1 b4 ee 5f 18 a0 58 8c c5 83 a4 13 24 |V....._..X.....$| +00000020 9b 53 29 6e 28 35 a8 8c 0e 07 2a 00 00 04 cc a8 |.S)n(5....*.....| +00000030 00 ff 01 00 00 6c 00 0b 00 04 03 00 01 02 00 0a |.....l..........| +00000040 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 23 |...............#| +00000050 00 00 00 10 00 10 00 0e 06 70 72 6f 74 6f 32 06 |.........proto2.| +00000060 70 72 6f 74 6f 31 00 16 00 00 00 17 00 00 00 0d |proto1..........| +00000070 00 30 00 2e 04 03 05 03 06 03 08 07 08 08 08 09 |.0..............| +00000080 08 0a 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 |................| +00000090 03 03 02 03 03 01 02 01 03 02 02 02 04 02 05 02 |................| +000000a0 06 02 |..| +>>> Flow 2 (server to client) +00000000 16 03 03 00 3f 02 00 00 3b 03 03 00 00 00 00 00 |....?...;.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 cc a8 00 00 |...DOWNGRD......| +00000030 13 00 23 00 00 ff 01 00 01 00 00 17 00 00 00 0b |..#.............| +00000040 00 02 01 00 16 03 03 02 59 0b 00 02 55 00 02 52 |........Y...U..R| +00000050 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 |..O0..K0........| +00000060 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a |......?.[..0...*| +00000070 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 |.H........0.1.0.| +00000080 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 |..U....Go1.0...U| +00000090 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 |....Go Root0...1| +000000a0 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 |60101000000Z..25| +000000b0 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 |0101000000Z0.1.0| +000000c0 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 |...U....Go1.0...| +000000d0 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 |U....Go0..0...*.| +000000e0 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 |H............0..| +000000f0 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 |.....F}...'.H..(| +00000100 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 |!.~...]..RE.z6G.| +00000110 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d |...B[.....y.@.Om| +00000120 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 |..+.....g....."8| +00000130 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b |.J.ts+.4......t{| +00000140 f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 |.X.la<..A..++$#w| +00000150 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 |[.;.u]. T..c...$| +00000160 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 |....P....C...ub.| +00000170 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 |..R.........0..0| +00000180 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 |...U...........0| +00000190 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 |...U.%..0...+...| +000001a0 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c |......+.......0.| +000001b0 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 |..U.......0.0...| +000001c0 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 |U..........CC>I.| +000001d0 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 |.m....`0...U.#..| +000001e0 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 |0...H.IM.~.1....| +000001f0 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 |..n{0...U....0..| +00000200 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 |.example.golang0| +00000210 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 |...*.H..........| +00000220 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 |...0.@+[P.a...SX| +00000230 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a |...(.X..8....1Z.| +00000240 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 |.f=C.-...... d8.| +00000250 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 |$:....}.@ ._...a| +00000260 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c |..v......\.....l| +00000270 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 |..s..Cw.......@.| +00000280 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e |a.Lr+...F..M...>| +00000290 c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 |...B...=.`.\!.;.| +000002a0 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d 20 2f |.............. /| +000002b0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000002c0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 08 |.........._X.;t.| +000002d0 04 00 80 66 f8 99 59 3a 3a 64 36 75 11 53 eb 34 |...f..Y::d6u.S.4| +000002e0 1d d7 56 1b fb 73 58 63 69 2d 3d b5 d0 05 ce 4d |..V..sXci-=....M| +000002f0 6d 6e 49 46 c2 ad 91 43 de b3 63 12 4b e6 e2 c8 |mnIF...C..c.K...| +00000300 59 09 09 45 f2 b8 1e 95 71 b2 38 60 78 36 c5 46 |Y..E....q.8`x6.F| +00000310 15 85 66 4b 83 e2 6f 07 df 3e 87 60 eb 85 2d 01 |..fK..o..>.`..-.| +00000320 c4 ae 50 b8 0e e5 19 b4 1d a4 90 af 97 b7 87 9e |..P.............| +00000330 cb 3a 13 1f ec 78 6c d9 5d 14 03 b7 4b 8b 8d 92 |.:...xl.]...K...| +00000340 06 cf a3 dc 59 30 36 0f 7f 24 11 ca b8 ff 46 4b |....Y06..$....FK| +00000350 0c 4e c2 16 03 03 00 04 0e 00 00 00 |.N..........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 16 8d 5b 4a f7 e1 |....%...! ..[J..| +00000010 c0 dd 5d e2 82 7d 4e c6 ef 66 ef 87 50 85 bf 0d |..]..}N..f..P...| +00000020 b5 3f 03 cc 64 f4 48 93 79 27 14 03 03 00 01 01 |.?..d.H.y'......| +00000030 16 03 03 00 20 2c 69 26 7b 1b 84 2b 1d 33 43 cf |.... ,i&{..+.3C.| +00000040 95 c5 72 d6 7a 88 8f f9 aa 82 72 f4 02 c5 6e aa |..r.z.....r...n.| +00000050 a9 f7 f0 b9 44 |....D| +>>> Flow 4 (server to client) +00000000 16 03 03 00 85 04 00 00 81 00 00 00 00 00 7b 00 |..............{.| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 94 |................| +00000020 6f 2d 7c 2b 51 ed 14 ef 68 ca 42 c5 4c 2e ba 80 |o-|+Q...h.B.L...| +00000030 92 a2 2f 66 80 b9 56 b8 7b be 8f 7f 3e f1 92 8d |../f..V.{...>...| +00000040 bf a9 6d 23 58 04 c5 70 85 af a7 db e4 0f e5 87 |..m#X..p........| +00000050 6e aa a1 58 2a 7c 3f 9b 15 36 ac a3 00 49 38 16 |n..X*|?..6...I8.| +00000060 7e 51 5c e5 15 c0 58 7d 52 07 ff f3 10 e5 6f 3a |~Q\...X}R.....o:| +00000070 6f e9 dd 79 00 6d 46 a8 9d a3 6c 3b 1b 39 da 98 |o..y.mF...l;.9..| +00000080 5a 36 f1 64 1f a6 4b f8 2b ff 14 03 03 00 01 01 |Z6.d..K.+.......| +00000090 16 03 03 00 20 d1 e3 4a cc 06 f0 a9 b6 f7 66 2d |.... ..J......f-| +000000a0 3d 07 70 e2 93 39 a1 2a c2 72 f3 e7 b3 ca a0 77 |=.p..9.*.r.....w| +000000b0 ff cf 9b 0f 2f 17 03 03 00 1d 4b e5 61 b4 4c 6b |..../.....K.a.Lk| +000000c0 b0 ca 5e e4 96 7b f2 18 9a c2 19 b2 be c2 39 8b |..^..{........9.| +000000d0 ee 88 e7 53 27 3a 8d 15 03 03 00 12 2a 21 52 fc |...S':......*!R.| +000000e0 3b ae 6e fb ac 9c 42 bc 1a 7d 6b 8d 84 5d |;.n...B..}k..]| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndECDSAGiven b/go/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndECDSAGiven new file mode 100644 index 0000000000000000000000000000000000000000..73d54e6579036fd76de5edcabe5d2aad5a5813b1 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndECDSAGiven @@ -0,0 +1,126 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 6d 01 00 00 69 03 03 5e 1c 8d af f1 |....m...i..^....| +00000010 4a ab 9d e1 c7 9c 85 c3 ab b8 84 84 ee 39 66 0b |J............9f.| +00000020 6d d7 b2 3b 7b bf 4e d1 90 a4 92 00 00 04 00 2f |m..;{.N......../| +00000030 00 ff 01 00 00 3c 00 16 00 00 00 17 00 00 00 0d |.....<..........| +00000040 00 30 00 2e 04 03 05 03 06 03 08 07 08 08 08 09 |.0..............| +00000050 08 0a 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 |................| +00000060 03 03 02 03 03 01 02 01 03 02 02 02 04 02 05 02 |................| +00000070 06 02 |..| +>>> Flow 2 (server to client) +00000000 16 03 03 00 35 02 00 00 31 03 03 00 00 00 00 00 |....5...1.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 2f 00 00 |...DOWNGRD.../..| +00000030 09 ff 01 00 01 00 00 17 00 00 16 03 03 02 59 0b |..............Y.| +00000040 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 82 01 |..U..R..O0..K0..| +00000050 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 5b ea |............?.[.| +00000060 a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |.0...*.H........| +00000070 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 |0.1.0...U....Go1| +00000080 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 6f 6f |.0...U....Go Roo| +00000090 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 30 30 |t0...16010100000| +000000a0 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 30 30 |0Z..250101000000| +000000b0 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 47 6f |Z0.1.0...U....Go| +000000c0 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 81 9f |1.0...U....Go0..| +000000d0 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 |0...*.H.........| +000000e0 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 2e 12 |...0.......F}...| +000000f0 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 |'.H..(!.~...]..R| +00000100 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 |E.z6G....B[.....| +00000110 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 |y.@.Om..+.....g.| +00000120 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 |...."8.J.ts+.4..| +00000130 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 |....t{.X.la<..A.| +00000140 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf |.++$#w[.;.u]. T.| +00000150 a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 |.c...$....P....C| +00000160 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 |...ub...R.......| +00000170 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 ff 04 |..0..0...U......| +00000180 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 30 14 |.....0...U.%..0.| +00000190 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 01 05 |..+.........+...| +000001a0 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 |....0...U.......| +000001b0 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f 91 16 |0.0...U.........| +000001c0 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 |.CC>I..m....`0..| +000001d0 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d 13 7e |.U.#..0...H.IM.~| +000001e0 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 55 1d |.1......n{0...U.| +000001f0 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 2e 67 |...0...example.g| +00000200 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 0d 01 |olang0...*.H....| +00000210 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 |.........0.@+[P.| +00000220 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 |a...SX...(.X..8.| +00000230 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 |...1Z..f=C.-....| +00000240 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 40 20 |.. d8.$:....}.@ | +00000250 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c |._...a..v......\| +00000260 ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c |.....l..s..Cw...| +00000270 f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db 46 06 |....@.a.Lr+...F.| +00000280 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 |.M...>...B...=.`| +00000290 84 5c 21 d3 3b e9 fa e7 16 03 03 00 1f 0d 00 00 |.\!.;...........| +000002a0 1b 02 01 40 00 14 08 04 04 03 08 07 08 05 08 06 |...@............| +000002b0 04 01 05 01 06 01 05 03 06 03 00 00 16 03 03 00 |................| +000002c0 04 0e 00 00 00 |.....| +>>> Flow 3 (client to server) +00000000 16 03 03 02 0a 0b 00 02 06 00 02 03 00 02 00 30 |...............0| +00000010 82 01 fc 30 82 01 5e 02 09 00 9a 30 84 6c 26 35 |...0..^....0.l&5| +00000020 d9 17 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 |..0...*.H.=..0E1| +00000030 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 30 11 |.0...U....AU1.0.| +00000040 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 |..U....Some-Stat| +00000050 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 |e1!0...U....Inte| +00000060 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 79 |rnet Widgits Pty| +00000070 20 4c 74 64 30 1e 17 0d 31 32 31 31 31 34 31 33 | Ltd0...12111413| +00000080 32 35 35 33 5a 17 0d 32 32 31 31 31 32 31 33 32 |2553Z..221112132| +00000090 35 35 33 5a 30 41 31 0b 30 09 06 03 55 04 06 13 |553Z0A1.0...U...| +000000a0 02 41 55 31 0c 30 0a 06 03 55 04 08 13 03 4e 53 |.AU1.0...U....NS| +000000b0 57 31 10 30 0e 06 03 55 04 07 13 07 50 79 72 6d |W1.0...U....Pyrm| +000000c0 6f 6e 74 31 12 30 10 06 03 55 04 03 13 09 4a 6f |ont1.0...U....Jo| +000000d0 65 6c 20 53 69 6e 67 30 81 9b 30 10 06 07 2a 86 |el Sing0..0...*.| +000000e0 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 86 00 |H.=....+...#....| +000000f0 04 00 95 8c 91 75 14 c0 5e c4 57 b4 d4 c3 6f 8d |.....u..^.W...o.| +00000100 ae 68 1e dd 6f ce 86 e1 7e 6e b2 48 3e 81 e5 4e |.h..o...~n.H>..N| +00000110 e2 c6 88 4b 64 dc f5 30 bb d3 ff 65 cc 5b f4 dd |...Kd..0...e.[..| +00000120 b5 6a 3e 3e d0 1d de 47 c3 76 ad 19 f6 45 2c 8c |.j>>...G.v...E,.| +00000130 bc d8 1d 01 4c 1f 70 90 46 76 48 8b 8f 83 cc 4a |....L.p.FvH....J| +00000140 5c 8f 40 76 da e0 89 ec 1d 2b c4 4e 30 76 28 41 |\.@v.....+.N0v(A| +00000150 b2 62 a8 fb 5b f1 f9 4e 7a 8d bd 09 b8 ae ea 8b |.b..[..Nz.......| +00000160 18 27 4f 2e 70 fe 13 96 ba c3 d3 40 16 cd 65 4e |.'O.p......@..eN| +00000170 ac 11 1e e6 f1 30 09 06 07 2a 86 48 ce 3d 04 01 |.....0...*.H.=..| +00000180 03 81 8c 00 30 81 88 02 42 00 e0 14 c4 60 60 0b |....0...B....``.| +00000190 72 68 b0 32 5d 61 4a 02 74 5c c2 81 b9 16 a8 3f |rh.2]aJ.t\.....?| +000001a0 29 c8 36 c7 81 ff 6c b6 5b d9 70 f1 38 3b 50 48 |).6...l.[.p.8;PH| +000001b0 28 94 cb 09 1a 52 f1 5d ee 8d f2 b9 f0 f0 da d9 |(....R.]........| +000001c0 15 3a f9 bd 03 7a 87 a2 23 35 ec 02 42 01 a3 d4 |.:...z..#5..B...| +000001d0 8a 78 35 1c 4a 9a 23 d2 0a be 2b 10 31 9d 9c 5f |.x5.J.#...+.1.._| +000001e0 be e8 91 b3 da 1a f5 5d a3 23 f5 26 8b 45 70 8d |.......].#.&.Ep.| +000001f0 65 62 9b 7e 01 99 3d 18 f6 10 9a 38 61 9b 2e 57 |eb.~..=....8a..W| +00000200 e4 fa cc b1 8a ce e2 23 a0 87 f0 e1 67 51 eb 16 |.......#....gQ..| +00000210 03 03 00 86 10 00 00 82 00 80 b1 e6 1d 71 51 c1 |.............qQ.| +00000220 3a bd 0a 32 95 14 0c 83 7a 2b ec 89 24 f2 29 d8 |:..2....z+..$.).| +00000230 72 84 ae 13 33 90 58 93 b6 46 6c 54 11 54 5b d3 |r...3.X..FlT.T[.| +00000240 59 da 02 4a de 2a 56 67 04 32 3b 44 6b ac 6d 6c |Y..J.*Vg.2;Dk.ml| +00000250 c5 de 9d b2 9e 7b ec 27 05 9d 47 6d a1 0b 50 71 |.....{.'..Gm..Pq| +00000260 ea 19 cc 60 5e db 6c 2f 06 b7 6e ce 51 bf 93 a9 |...`^.l/..n.Q...| +00000270 0e c7 85 c1 83 d2 ac fe 6a d2 a9 bd b3 54 4f 45 |........j....TOE| +00000280 4b e4 40 68 fb 30 21 ec 1c fc 76 a6 db 8b e1 46 |K.@h.0!...v....F| +00000290 8c 0c 56 1f c0 e5 9b 2c 54 eb 16 03 03 00 93 0f |..V....,T.......| +000002a0 00 00 8f 04 03 00 8b 30 81 88 02 42 01 11 9a de |.......0...B....| +000002b0 07 19 df 8b d0 56 e7 b5 b0 d2 d4 c1 32 58 93 88 |.....V......2X..| +000002c0 ea a6 73 86 f9 e6 be b5 c5 1f d6 0d da 28 59 89 |..s..........(Y.| +000002d0 21 73 fe e8 30 b9 f0 d1 01 d3 e0 54 79 a6 67 0d |!s..0......Ty.g.| +000002e0 84 88 94 2c b9 b6 0e 19 06 34 cc f1 5f 01 02 42 |...,.....4.._..B| +000002f0 00 fe 02 83 e8 46 a8 5f ef 5a f0 e1 6f 3f 73 b9 |.....F._.Z..o?s.| +00000300 0f a1 64 db a7 c4 fb 1e 9f ac da 33 ac a2 7f ff |..d........3....| +00000310 64 c1 26 37 17 41 c0 5e f4 37 5c 76 23 7d 92 3a |d.&7.A.^.7\v#}.:| +00000320 ea 35 7f 83 03 7b a4 65 44 5d fb 84 08 39 c7 90 |.5...{.eD]...9..| +00000330 cc 4a 14 03 03 00 01 01 16 03 03 00 40 7b 06 98 |.J..........@{..| +00000340 ff f7 d5 a1 68 60 23 25 bc df 12 27 7f 64 1e c8 |....h`#%...'.d..| +00000350 bc 6d 26 28 29 d0 9f 56 6a f1 5b cd 4e 17 6c 32 |.m&()..Vj.[.N.l2| +00000360 15 b9 7a 55 02 9b 66 1c e3 97 40 26 69 7b e7 02 |..zU..f...@&i{..| +00000370 b0 37 d1 ec ed 96 2e 92 5a 5f 90 c1 be |.7......Z_...| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| +00000010 00 00 00 00 00 00 00 00 00 00 00 0f e2 df ef c7 |................| +00000020 0e 11 83 70 ba a8 fa 90 e3 d5 df 76 dd 7a f1 63 |...p.......v.z.c| +00000030 ca a3 12 c7 42 45 ae 1a a3 0f 3b 4c 46 52 91 8e |....BE....;LFR..| +00000040 bf df 21 be cb ed 93 12 8a ba 88 17 03 03 00 40 |..!............@| +00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000060 12 fd 68 02 2d 6e aa 2f df e4 0b a1 2c 13 e1 23 |..h.-n./....,..#| +00000070 f9 78 4b 18 a3 1f 28 78 4d f6 25 83 4c 0c 8c df |.xK...(xM.%.L...| +00000080 8b ed a9 b2 87 8c 95 e3 87 8e 71 ad d9 23 05 91 |..........q..#..| +00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| +000000a0 00 00 00 00 00 80 9a 8c 0e 27 b9 7a f9 61 a4 a6 |.........'.z.a..| +000000b0 4e c9 24 02 ce 1c 93 5c 5a 7a c9 1e 5f b2 a1 9b |N.$....\Zz.._...| +000000c0 e3 0d 47 85 ab |..G..| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndEd25519Given b/go/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndEd25519Given new file mode 100644 index 0000000000000000000000000000000000000000..4ca8a034ed21da7e7a0728e18f9a9e236b6781a1 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndEd25519Given @@ -0,0 +1,109 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 6d 01 00 00 69 03 03 73 b2 f2 a9 ed |....m...i..s....| +00000010 88 e0 79 65 b4 3b 58 0d b2 d8 ab cf d7 12 12 c6 |..ye.;X.........| +00000020 99 f9 36 75 d3 f8 3e 94 cf 39 25 00 00 04 00 2f |..6u..>..9%..../| +00000030 00 ff 01 00 00 3c 00 16 00 00 00 17 00 00 00 0d |.....<..........| +00000040 00 30 00 2e 04 03 05 03 06 03 08 07 08 08 08 09 |.0..............| +00000050 08 0a 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 |................| +00000060 03 03 02 03 03 01 02 01 03 02 02 02 04 02 05 02 |................| +00000070 06 02 |..| +>>> Flow 2 (server to client) +00000000 16 03 03 00 35 02 00 00 31 03 03 00 00 00 00 00 |....5...1.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 2f 00 00 |...DOWNGRD.../..| +00000030 09 ff 01 00 01 00 00 17 00 00 16 03 03 02 59 0b |..............Y.| +00000040 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 82 01 |..U..R..O0..K0..| +00000050 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 5b ea |............?.[.| +00000060 a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |.0...*.H........| +00000070 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 |0.1.0...U....Go1| +00000080 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 6f 6f |.0...U....Go Roo| +00000090 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 30 30 |t0...16010100000| +000000a0 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 30 30 |0Z..250101000000| +000000b0 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 47 6f |Z0.1.0...U....Go| +000000c0 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 81 9f |1.0...U....Go0..| +000000d0 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 |0...*.H.........| +000000e0 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 2e 12 |...0.......F}...| +000000f0 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 |'.H..(!.~...]..R| +00000100 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 |E.z6G....B[.....| +00000110 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 |y.@.Om..+.....g.| +00000120 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 |...."8.J.ts+.4..| +00000130 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 |....t{.X.la<..A.| +00000140 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf |.++$#w[.;.u]. T.| +00000150 a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 |.c...$....P....C| +00000160 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 |...ub...R.......| +00000170 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 ff 04 |..0..0...U......| +00000180 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 30 14 |.....0...U.%..0.| +00000190 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 01 05 |..+.........+...| +000001a0 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 |....0...U.......| +000001b0 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f 91 16 |0.0...U.........| +000001c0 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 |.CC>I..m....`0..| +000001d0 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d 13 7e |.U.#..0...H.IM.~| +000001e0 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 55 1d |.1......n{0...U.| +000001f0 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 2e 67 |...0...example.g| +00000200 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 0d 01 |olang0...*.H....| +00000210 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 |.........0.@+[P.| +00000220 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 |a...SX...(.X..8.| +00000230 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 |...1Z..f=C.-....| +00000240 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 40 20 |.. d8.$:....}.@ | +00000250 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c |._...a..v......\| +00000260 ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c |.....l..s..Cw...| +00000270 f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db 46 06 |....@.a.Lr+...F.| +00000280 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 |.M...>...B...=.`| +00000290 84 5c 21 d3 3b e9 fa e7 16 03 03 00 1f 0d 00 00 |.\!.;...........| +000002a0 1b 02 01 40 00 14 08 04 04 03 08 07 08 05 08 06 |...@............| +000002b0 04 01 05 01 06 01 05 03 06 03 00 00 16 03 03 00 |................| +000002c0 04 0e 00 00 00 |.....| +>>> Flow 3 (client to server) +00000000 16 03 03 01 3c 0b 00 01 38 00 01 35 00 01 32 30 |....<...8..5..20| +00000010 82 01 2e 30 81 e1 a0 03 02 01 02 02 10 17 d1 81 |...0............| +00000020 93 be 2a 8c 21 20 10 25 15 e8 34 23 4f 30 05 06 |..*.! .%..4#O0..| +00000030 03 2b 65 70 30 12 31 10 30 0e 06 03 55 04 0a 13 |.+ep0.1.0...U...| +00000040 07 41 63 6d 65 20 43 6f 30 1e 17 0d 31 39 30 35 |.Acme Co0...1905| +00000050 31 36 32 31 35 34 32 36 5a 17 0d 32 30 30 35 31 |16215426Z..20051| +00000060 35 32 31 35 34 32 36 5a 30 12 31 10 30 0e 06 03 |5215426Z0.1.0...| +00000070 55 04 0a 13 07 41 63 6d 65 20 43 6f 30 2a 30 05 |U....Acme Co0*0.| +00000080 06 03 2b 65 70 03 21 00 0b e0 b5 60 b5 e2 79 30 |..+ep.!....`..y0| +00000090 3d be e3 1e e0 50 b1 04 c8 6d c7 78 6c 69 2f c5 |=....P...m.xli/.| +000000a0 14 ad 9a 63 6f 79 12 91 a3 4d 30 4b 30 0e 06 03 |...coy...M0K0...| +000000b0 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 |U...........0...| +000000c0 55 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 |U.%..0...+......| +000000d0 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 |.0...U.......0.0| +000000e0 16 06 03 55 1d 11 04 0f 30 0d 82 0b 65 78 61 6d |...U....0...exam| +000000f0 70 6c 65 2e 63 6f 6d 30 05 06 03 2b 65 70 03 41 |ple.com0...+ep.A| +00000100 00 fc 19 17 2a 94 a5 31 fa 29 c8 2e 7f 5b a0 5d |....*..1.)...[.]| +00000110 8a 4e 34 40 39 d6 b3 10 dc 19 fe a0 22 71 b3 f5 |.N4@9......."q..| +00000120 8f a1 58 0d cd f4 f1 85 24 bf e6 3d 14 df df ed |..X.....$..=....| +00000130 0e e1 17 d8 11 a2 60 d0 8a 37 23 2a c2 46 aa 3a |......`..7#*.F.:| +00000140 08 16 03 03 00 86 10 00 00 82 00 80 1c aa 0a c6 |................| +00000150 76 22 2b bc 67 c7 db 5a 59 0c 2b 1d 1a 66 9b c5 |v"+.g..ZY.+..f..| +00000160 55 ac 80 bf 23 11 68 96 82 df 44 cf bc 44 4f 54 |U...#.h...D..DOT| +00000170 ce 0c 32 01 59 5e 3e a8 28 e1 33 7d 7d fb 2a 87 |..2.Y^>.(.3}}.*.| +00000180 53 d1 32 25 b8 29 5a 5e 45 24 4d a8 47 58 bc 9c |S.2%.)Z^E$M.GX..| +00000190 6f f3 61 a9 ca e0 ad 32 88 04 1a da 83 ff fd 31 |o.a....2.......1| +000001a0 84 65 9e 33 bb 79 d4 71 55 52 bc 57 fd 2e d5 98 |.e.3.y.qUR.W....| +000001b0 46 b9 dc 74 58 7c c9 25 44 3c 07 97 5d bc 65 b5 |F..tX|.%D<..].e.| +000001c0 b5 46 50 fa 52 f9 45 d7 0f f5 d2 4e 16 03 03 00 |.FP.R.E....N....| +000001d0 48 0f 00 00 44 08 07 00 40 e2 1c ab 11 6c 52 e6 |H...D...@....lR.| +000001e0 e8 7f 67 f0 6e 6a e4 a8 4f 25 89 31 d7 f8 dd 6f |..g.nj..O%.1...o| +000001f0 fd c7 84 e9 59 6b 77 b6 3b fb bc b3 d6 a7 96 4c |....Ykw.;......L| +00000200 2f 54 d2 cf 6b 06 5f a5 69 b6 85 0e a9 a2 90 aa |/T..k._.i.......| +00000210 c4 b2 89 17 b3 c7 b9 73 00 14 03 03 00 01 01 16 |.......s........| +00000220 03 03 00 40 45 8d 48 5b 23 74 21 05 ae 22 ce c0 |...@E.H[#t!.."..| +00000230 8a 05 9a 15 7e fb 61 73 dd 45 fd d0 97 a4 ca f5 |....~.as.E......| +00000240 84 f0 01 c4 e4 44 78 c2 14 4f b6 27 0f e8 5a 9d |.....Dx..O.'..Z.| +00000250 69 7c 9b c4 c5 a3 4d 42 bf 2b 89 c6 a3 c2 ca 7a |i|....MB.+.....z| +00000260 d3 6c 5e 51 |.l^Q| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| +00000010 00 00 00 00 00 00 00 00 00 00 00 d0 d7 ea c0 57 |...............W| +00000020 b8 c4 0e ad 2b ba 7e f7 40 0e 92 42 0b c1 55 38 |....+.~.@..B..U8| +00000030 89 ac d8 9f 46 96 89 c8 a0 06 e7 84 ac 42 6f a8 |....F........Bo.| +00000040 e2 67 49 fe 5b 2f 66 3e 47 c3 14 17 03 03 00 40 |.gI.[/f>G......@| +00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000060 95 78 c4 75 cf 05 a9 ce aa 85 0b 8e 4e fc 4b dc |.x.u........N.K.| +00000070 59 70 3e 68 85 68 97 9a eb 22 22 3a 8c 61 91 a4 |Yp>h.h..."":.a..| +00000080 89 06 bd 9e fc 8d 1d 4b ed fe 4b d6 e7 0a 6e 2b |.......K..K...n+| +00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| +000000a0 00 00 00 00 00 92 d4 46 1f 6b d5 63 a7 95 0d c2 |.......F.k.c....| +000000b0 2f a9 a2 5f 0d 70 8f a5 31 e3 5c 1d fa ac f6 2e |/.._.p..1.\.....| +000000c0 02 6d e8 9f 95 |.m...| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven b/go/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven new file mode 100644 index 0000000000000000000000000000000000000000..585e6af6579bd12165252b2e56418a89f7f6152d --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven @@ -0,0 +1,125 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 6d 01 00 00 69 03 03 0e c0 95 b1 0b |....m...i.......| +00000010 7b b5 57 cc 04 e7 03 d0 66 8d ee 9d da 65 dc 74 |{.W.....f....e.t| +00000020 0d de 11 47 38 cd 19 12 f4 06 17 00 00 04 00 2f |...G8........../| +00000030 00 ff 01 00 00 3c 00 16 00 00 00 17 00 00 00 0d |.....<..........| +00000040 00 30 00 2e 04 03 05 03 06 03 08 07 08 08 08 09 |.0..............| +00000050 08 0a 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 |................| +00000060 03 03 02 03 03 01 02 01 03 02 02 02 04 02 05 02 |................| +00000070 06 02 |..| +>>> Flow 2 (server to client) +00000000 16 03 03 00 35 02 00 00 31 03 03 00 00 00 00 00 |....5...1.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 2f 00 00 |...DOWNGRD.../..| +00000030 09 ff 01 00 01 00 00 17 00 00 16 03 03 02 59 0b |..............Y.| +00000040 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 82 01 |..U..R..O0..K0..| +00000050 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 5b ea |............?.[.| +00000060 a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |.0...*.H........| +00000070 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 |0.1.0...U....Go1| +00000080 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 6f 6f |.0...U....Go Roo| +00000090 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 30 30 |t0...16010100000| +000000a0 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 30 30 |0Z..250101000000| +000000b0 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 47 6f |Z0.1.0...U....Go| +000000c0 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 81 9f |1.0...U....Go0..| +000000d0 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 |0...*.H.........| +000000e0 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 2e 12 |...0.......F}...| +000000f0 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 |'.H..(!.~...]..R| +00000100 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 |E.z6G....B[.....| +00000110 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 |y.@.Om..+.....g.| +00000120 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 |...."8.J.ts+.4..| +00000130 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 |....t{.X.la<..A.| +00000140 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf |.++$#w[.;.u]. T.| +00000150 a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 |.c...$....P....C| +00000160 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 |...ub...R.......| +00000170 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 ff 04 |..0..0...U......| +00000180 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 30 14 |.....0...U.%..0.| +00000190 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 01 05 |..+.........+...| +000001a0 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 |....0...U.......| +000001b0 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f 91 16 |0.0...U.........| +000001c0 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 |.CC>I..m....`0..| +000001d0 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d 13 7e |.U.#..0...H.IM.~| +000001e0 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 55 1d |.1......n{0...U.| +000001f0 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 2e 67 |...0...example.g| +00000200 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 0d 01 |olang0...*.H....| +00000210 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 |.........0.@+[P.| +00000220 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 |a...SX...(.X..8.| +00000230 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 |...1Z..f=C.-....| +00000240 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 40 20 |.. d8.$:....}.@ | +00000250 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c |._...a..v......\| +00000260 ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c |.....l..s..Cw...| +00000270 f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db 46 06 |....@.a.Lr+...F.| +00000280 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 |.M...>...B...=.`| +00000290 84 5c 21 d3 3b e9 fa e7 16 03 03 00 1f 0d 00 00 |.\!.;...........| +000002a0 1b 02 01 40 00 14 08 04 04 03 08 07 08 05 08 06 |...@............| +000002b0 04 01 05 01 06 01 05 03 06 03 00 00 16 03 03 00 |................| +000002c0 04 0e 00 00 00 |.....| +>>> Flow 3 (client to server) +00000000 16 03 03 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0| +00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.| +00000020 c1 89 65 83 55 6f dc 0b c9 b9 93 9f e9 bc 30 0d |..e.Uo........0.| +00000030 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 12 31 |..*.H........0.1| +00000040 10 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 |.0...U....Acme C| +00000050 6f 30 1e 17 0d 31 36 30 38 31 37 32 31 35 32 33 |o0...16081721523| +00000060 31 5a 17 0d 31 37 30 38 31 37 32 31 35 32 33 31 |1Z..170817215231| +00000070 5a 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 63 |Z0.1.0...U....Ac| +00000080 6d 65 20 43 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |me Co0..0...*.H.| +00000090 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +000000a0 81 00 ba 6f aa 86 bd cf bf 9f f2 ef 5c 94 60 78 |...o........\.`x| +000000b0 6f e8 13 f2 d1 96 6f cd d9 32 6e 22 37 ce 41 f9 |o.....o..2n"7.A.| +000000c0 ca 5d 29 ac e1 27 da 61 a2 ee 81 cb 10 c7 df 34 |.])..'.a.......4| +000000d0 58 95 86 e9 3d 19 e6 5c 27 73 60 c8 8d 78 02 f4 |X...=..\'s`..x..| +000000e0 1d a4 98 09 a3 19 70 69 3c 25 62 66 2a ab 22 23 |......pi<%bf*."#| +000000f0 c5 7b 85 38 4f 2e 09 73 32 a7 bd 3e 9b ad ca 84 |.{.8O..s2..>....| +00000100 07 e6 0f 3a ff 77 c5 9d 41 85 00 8a b6 9b ee b0 |...:.w..A.......| +00000110 a4 3f 2d 4c 4c e6 42 3e bb 51 c8 dd 48 54 f4 0c |.?-LL.B>.Q..HT..| +00000120 8e 47 02 03 01 00 01 a3 46 30 44 30 0e 06 03 55 |.G......F0D0...U| +00000130 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 55 |...........0...U| +00000140 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......| +00000150 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0f |0...U.......0.0.| +00000160 06 03 55 1d 11 04 08 30 06 87 04 7f 00 00 01 30 |..U....0.......0| +00000170 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 |...*.H..........| +00000180 81 00 46 ab 44 a2 fb 28 54 f8 5a 67 f8 62 94 f1 |..F.D..(T.Zg.b..| +00000190 9a b2 18 9e f2 b1 de 1d 7e 6f 76 95 a9 ba e7 5d |........~ov....]| +000001a0 a8 16 6c 9c f7 09 d3 37 e4 4b 2b 36 7c 01 ad 41 |..l....7.K+6|..A| +000001b0 d2 32 d8 c3 d2 93 f9 10 6b 8e 95 b9 2c 17 8a a3 |.2......k...,...| +000001c0 44 48 bc 59 13 83 16 04 88 a4 81 5c 25 0d 98 0c |DH.Y.......\%...| +000001d0 ac 11 b1 28 56 be 1d cd 61 62 84 09 bf d6 80 c6 |...(V...ab......| +000001e0 45 8d 82 2c b4 d8 83 9b db c9 22 b7 2a 12 11 7b |E..,......".*..{| +000001f0 fa 02 3b c1 c9 ff ea c9 9d a8 49 d3 95 d7 d5 0e |..;.......I.....| +00000200 e5 35 16 03 03 00 86 10 00 00 82 00 80 cc d2 66 |.5.............f| +00000210 37 df f1 5d cb 6f 1d 6b 64 ea 62 45 97 dd 47 f8 |7..].o.kd.bE..G.| +00000220 e5 a0 f6 84 46 9b 6c 5b c9 79 60 07 b0 d1 5a e6 |....F.l[.y`...Z.| +00000230 5c 1a 43 b1 04 9f f2 3d 7a 09 da e0 45 ea 30 8a |\.C....=z...E.0.| +00000240 5c 08 07 67 17 2e 55 f5 0a 13 96 5c 92 e5 61 66 |\..g..U....\..af| +00000250 92 fe c6 44 9c 4f 62 54 10 12 df f7 e4 11 74 f6 |...D.ObT......t.| +00000260 35 81 bb 55 4f ce 43 dc 7f 4d bc 4f 8b 0c ef 13 |5..UO.C..M.O....| +00000270 43 8a e5 80 dc 38 3e 8a f5 7b 5c 5d 1c 76 10 06 |C....8>..{\].v..| +00000280 3d c5 05 5b cb 9a 17 20 13 29 a5 36 5d 16 03 03 |=..[... .).6]...| +00000290 00 88 0f 00 00 84 08 04 00 80 a7 7f 2c 3b d1 82 |............,;..| +000002a0 8a 17 50 2a f6 c4 ac ce 47 1b 25 23 4b 0c d0 17 |..P*....G.%#K...| +000002b0 89 18 98 a6 e4 b8 51 70 6a 59 72 1a aa 68 e8 25 |......QpjYr..h.%| +000002c0 f5 4d 72 66 be bb 25 61 9b 36 e0 24 a5 34 e4 36 |.Mrf..%a.6.$.4.6| +000002d0 23 0a 36 a8 81 f4 19 62 98 2b af 1b f5 c4 55 d2 |#.6....b.+....U.| +000002e0 d5 65 58 b8 31 21 f4 fe ce 44 cc ea 77 8e 1d f7 |.eX.1!...D..w...| +000002f0 bc a4 4c e5 cc 90 10 f3 a0 8d 10 72 08 d4 50 1c |..L........r..P.| +00000300 88 82 a7 61 da cb 35 ba 26 3c 18 11 6c 14 d6 1a |...a..5.&<..l...| +00000310 7f 65 3d 2c 74 f0 92 a3 aa fd 14 03 03 00 01 01 |.e=,t...........| +00000320 16 03 03 00 40 f3 3a f0 23 48 35 41 7f d0 ed 22 |....@.:.#H5A..."| +00000330 5b 1a 47 71 60 08 b0 6b cd 32 56 c0 d0 05 90 b3 |[.Gq`..k.2V.....| +00000340 0b 35 3c 03 49 ec 06 5d b4 ce 1d 10 4e bc 75 bf |.5<.I..]....N.u.| +00000350 23 3b f1 d6 8f f6 f0 70 b6 94 8f 51 fd 4f 47 0b |#;.....p...Q.OG.| +00000360 e1 c9 ad c8 14 |.....| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| +00000010 00 00 00 00 00 00 00 00 00 00 00 6e d3 79 f1 02 |...........n.y..| +00000020 4d 8e ad 3b 33 5a 92 10 55 79 94 b7 43 ed 08 c1 |M..;3Z..Uy..C...| +00000030 e1 5f 04 c6 01 82 ce 96 70 c7 97 8d cc 0a ca d3 |._......p.......| +00000040 46 d4 2f 9f b8 78 57 27 ee 14 aa 17 03 03 00 40 |F./..xW'.......@| +00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000060 ed 9f 38 f6 99 84 f5 cf 5e ee 27 64 f7 29 3c 18 |..8.....^.'d.)<.| +00000070 a0 55 23 b7 db 4a 6d 2d 80 c9 75 a5 a3 1f 38 24 |.U#..Jm-..u...8$| +00000080 0a 99 18 0d 0b 5d 7d 03 f7 8d d2 55 fd 98 7f 69 |.....]}....U...i| +00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| +000000a0 00 00 00 00 00 aa 43 ca 95 7d 1a 47 d5 0b 0e c7 |......C..}.G....| +000000b0 cc 61 3d 43 5b 69 05 a1 39 eb 03 52 41 05 54 e9 |.a=C[i..9..RA.T.| +000000c0 5d b6 ca 56 2c |]..V,| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndPKCS1v15Given b/go/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndPKCS1v15Given new file mode 100644 index 0000000000000000000000000000000000000000..10949e5e3badeb4f6322d1ab97de37d26442bc33 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndPKCS1v15Given @@ -0,0 +1,125 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 6d 01 00 00 69 03 03 c2 c7 15 c0 0f |....m...i.......| +00000010 0d fc 44 60 25 22 6c 4a ec f1 b0 66 5d c4 f3 bc |..D`%"lJ...f]...| +00000020 fe da b2 9a af 24 04 b7 bb 74 79 00 00 04 00 2f |.....$...ty..../| +00000030 00 ff 01 00 00 3c 00 16 00 00 00 17 00 00 00 0d |.....<..........| +00000040 00 30 00 2e 04 03 05 03 06 03 08 07 08 08 08 09 |.0..............| +00000050 08 0a 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 |................| +00000060 03 03 02 03 03 01 02 01 03 02 02 02 04 02 05 02 |................| +00000070 06 02 |..| +>>> Flow 2 (server to client) +00000000 16 03 03 00 35 02 00 00 31 03 03 00 00 00 00 00 |....5...1.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 2f 00 00 |...DOWNGRD.../..| +00000030 09 ff 01 00 01 00 00 17 00 00 16 03 03 02 59 0b |..............Y.| +00000040 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 82 01 |..U..R..O0..K0..| +00000050 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 5b ea |............?.[.| +00000060 a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |.0...*.H........| +00000070 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 |0.1.0...U....Go1| +00000080 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 6f 6f |.0...U....Go Roo| +00000090 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 30 30 |t0...16010100000| +000000a0 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 30 30 |0Z..250101000000| +000000b0 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 47 6f |Z0.1.0...U....Go| +000000c0 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 81 9f |1.0...U....Go0..| +000000d0 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 |0...*.H.........| +000000e0 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 2e 12 |...0.......F}...| +000000f0 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 |'.H..(!.~...]..R| +00000100 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 |E.z6G....B[.....| +00000110 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 |y.@.Om..+.....g.| +00000120 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 |...."8.J.ts+.4..| +00000130 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 |....t{.X.la<..A.| +00000140 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf |.++$#w[.;.u]. T.| +00000150 a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 |.c...$....P....C| +00000160 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 |...ub...R.......| +00000170 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 ff 04 |..0..0...U......| +00000180 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 30 14 |.....0...U.%..0.| +00000190 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 01 05 |..+.........+...| +000001a0 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 |....0...U.......| +000001b0 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f 91 16 |0.0...U.........| +000001c0 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 |.CC>I..m....`0..| +000001d0 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d 13 7e |.U.#..0...H.IM.~| +000001e0 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 55 1d |.1......n{0...U.| +000001f0 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 2e 67 |...0...example.g| +00000200 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 0d 01 |olang0...*.H....| +00000210 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 |.........0.@+[P.| +00000220 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 |a...SX...(.X..8.| +00000230 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 |...1Z..f=C.-....| +00000240 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 40 20 |.. d8.$:....}.@ | +00000250 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c |._...a..v......\| +00000260 ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c |.....l..s..Cw...| +00000270 f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db 46 06 |....@.a.Lr+...F.| +00000280 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 |.M...>...B...=.`| +00000290 84 5c 21 d3 3b e9 fa e7 16 03 03 00 1f 0d 00 00 |.\!.;...........| +000002a0 1b 02 01 40 00 14 08 04 04 03 08 07 08 05 08 06 |...@............| +000002b0 04 01 05 01 06 01 05 03 06 03 00 00 16 03 03 00 |................| +000002c0 04 0e 00 00 00 |.....| +>>> Flow 3 (client to server) +00000000 16 03 03 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0| +00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.| +00000020 c1 89 65 83 55 6f dc 0b c9 b9 93 9f e9 bc 30 0d |..e.Uo........0.| +00000030 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 12 31 |..*.H........0.1| +00000040 10 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 |.0...U....Acme C| +00000050 6f 30 1e 17 0d 31 36 30 38 31 37 32 31 35 32 33 |o0...16081721523| +00000060 31 5a 17 0d 31 37 30 38 31 37 32 31 35 32 33 31 |1Z..170817215231| +00000070 5a 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 63 |Z0.1.0...U....Ac| +00000080 6d 65 20 43 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |me Co0..0...*.H.| +00000090 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| +000000a0 81 00 ba 6f aa 86 bd cf bf 9f f2 ef 5c 94 60 78 |...o........\.`x| +000000b0 6f e8 13 f2 d1 96 6f cd d9 32 6e 22 37 ce 41 f9 |o.....o..2n"7.A.| +000000c0 ca 5d 29 ac e1 27 da 61 a2 ee 81 cb 10 c7 df 34 |.])..'.a.......4| +000000d0 58 95 86 e9 3d 19 e6 5c 27 73 60 c8 8d 78 02 f4 |X...=..\'s`..x..| +000000e0 1d a4 98 09 a3 19 70 69 3c 25 62 66 2a ab 22 23 |......pi<%bf*."#| +000000f0 c5 7b 85 38 4f 2e 09 73 32 a7 bd 3e 9b ad ca 84 |.{.8O..s2..>....| +00000100 07 e6 0f 3a ff 77 c5 9d 41 85 00 8a b6 9b ee b0 |...:.w..A.......| +00000110 a4 3f 2d 4c 4c e6 42 3e bb 51 c8 dd 48 54 f4 0c |.?-LL.B>.Q..HT..| +00000120 8e 47 02 03 01 00 01 a3 46 30 44 30 0e 06 03 55 |.G......F0D0...U| +00000130 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 55 |...........0...U| +00000140 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......| +00000150 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0f |0...U.......0.0.| +00000160 06 03 55 1d 11 04 08 30 06 87 04 7f 00 00 01 30 |..U....0.......0| +00000170 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 |...*.H..........| +00000180 81 00 46 ab 44 a2 fb 28 54 f8 5a 67 f8 62 94 f1 |..F.D..(T.Zg.b..| +00000190 9a b2 18 9e f2 b1 de 1d 7e 6f 76 95 a9 ba e7 5d |........~ov....]| +000001a0 a8 16 6c 9c f7 09 d3 37 e4 4b 2b 36 7c 01 ad 41 |..l....7.K+6|..A| +000001b0 d2 32 d8 c3 d2 93 f9 10 6b 8e 95 b9 2c 17 8a a3 |.2......k...,...| +000001c0 44 48 bc 59 13 83 16 04 88 a4 81 5c 25 0d 98 0c |DH.Y.......\%...| +000001d0 ac 11 b1 28 56 be 1d cd 61 62 84 09 bf d6 80 c6 |...(V...ab......| +000001e0 45 8d 82 2c b4 d8 83 9b db c9 22 b7 2a 12 11 7b |E..,......".*..{| +000001f0 fa 02 3b c1 c9 ff ea c9 9d a8 49 d3 95 d7 d5 0e |..;.......I.....| +00000200 e5 35 16 03 03 00 86 10 00 00 82 00 80 40 fe b5 |.5...........@..| +00000210 07 31 4a 29 12 9e 52 56 8b a7 7c 33 5e 8f 67 d4 |.1J)..RV..|3^.g.| +00000220 c7 c3 82 e3 cf 62 11 12 dc 2a 03 4f 07 04 21 7e |.....b...*.O..!~| +00000230 70 72 fc 3a d3 4f 6e ed 92 f7 6d 92 a0 28 10 55 |pr.:.On...m..(.U| +00000240 14 cb fa cb 19 06 9c e4 b1 6d 30 44 2a 74 6b 3a |.........m0D*tk:| +00000250 db d4 d6 be 20 25 b1 d4 73 9f 58 3d e7 18 6f 06 |.... %..s.X=..o.| +00000260 54 b8 ce 9a 7d 92 76 c6 23 bc 19 ca 84 5e f2 18 |T...}.v.#....^..| +00000270 0a cc b8 43 e1 ff 9e bc 61 64 e0 62 f0 6d 03 11 |...C....ad.b.m..| +00000280 5f 65 fa 84 35 fe 81 ec cb c9 1d 0a 48 16 03 03 |_e..5.......H...| +00000290 00 88 0f 00 00 84 04 01 00 80 95 e5 ba e5 ef 6f |...............o| +000002a0 6d 68 2c c5 ee 96 7e 0d 4f 98 4a cb 31 8b 82 f7 |mh,...~.O.J.1...| +000002b0 b3 2d 18 6e d8 f3 6f 19 5a 3f 3f 18 a3 53 6e e9 |.-.n..o.Z??..Sn.| +000002c0 a0 3d 8a 78 02 a2 4a f3 a2 e6 f3 c2 83 63 e1 fd |.=.x..J......c..| +000002d0 4b 05 ce cf 0e a6 7e db bb d1 95 5f 4e c9 91 83 |K.....~...._N...| +000002e0 9c 3c da 85 6e 23 71 78 e1 dc b9 f9 5f 8d 6f e4 |.<..n#qx...._.o.| +000002f0 76 cc bc a5 18 03 41 e7 44 dc f6 c0 7b ea 05 40 |v.....A.D...{..@| +00000300 95 7b 54 62 75 ba a5 59 37 8c cf ea ad c6 7c d1 |.{Tbu..Y7.....|.| +00000310 8a 8a 85 03 fc 46 f4 58 9e a9 14 03 03 00 01 01 |.....F.X........| +00000320 16 03 03 00 40 e1 c1 7d 5b 18 51 c1 8f 98 70 14 |....@..}[.Q...p.| +00000330 f1 c1 61 0b 13 1e f1 5f d6 df 85 b9 a6 e0 f1 c8 |..a...._........| +00000340 6e 47 eb 15 98 38 ba 2d 27 30 7e 29 8e db c6 4e |nG...8.-'0~)...N| +00000350 09 15 d8 5f 4a ef 14 95 5f 78 e3 02 c4 92 de 44 |..._J..._x.....D| +00000360 bb cc 09 27 6f |...'o| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| +00000010 00 00 00 00 00 00 00 00 00 00 00 0c 22 6e 84 b2 |............"n..| +00000020 a1 f9 18 62 3a 86 16 7e e6 17 3b 8e e5 88 b8 8e |...b:..~..;.....| +00000030 3c c5 08 11 8e 0a df df d4 69 bc 01 7d c8 63 33 |<........i..}.c3| +00000040 b5 15 bf 03 5e df 50 29 c5 c4 c2 17 03 03 00 40 |....^.P).......@| +00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000060 45 76 91 63 fa 48 9b c9 47 6a f6 7b fa 72 ab 78 |Ev.c.H..Gj.{.r.x| +00000070 4f cb c4 bb 68 78 7c 71 13 f9 47 32 33 59 d4 16 |O...hx|q..G23Y..| +00000080 83 fa 8e db 37 b6 cb d5 a1 1a e5 21 1b 50 a6 d3 |....7......!.P..| +00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| +000000a0 00 00 00 00 00 47 3b be 7e be 4e 24 16 45 85 27 |.....G;.~.N$.E.'| +000000b0 0f 31 2a 5a ab 8b 83 61 bb e9 27 8d 12 dc 6f 6d |.1*Z...a..'...om| +000000c0 55 17 39 51 4c |U.9QL| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedNotGiven b/go/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedNotGiven new file mode 100644 index 0000000000000000000000000000000000000000..605368730639d284777f711b09ec58d775ef6700 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedNotGiven @@ -0,0 +1,85 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 6d 01 00 00 69 03 03 f2 1b 6e dc ce |....m...i....n..| +00000010 fe af a8 4b 44 88 5f ba eb c5 d7 92 7e 69 d7 19 |...KD._.....~i..| +00000020 b3 32 d3 99 e6 be 1f 4f 94 04 e6 00 00 04 00 2f |.2.....O......./| +00000030 00 ff 01 00 00 3c 00 16 00 00 00 17 00 00 00 0d |.....<..........| +00000040 00 30 00 2e 04 03 05 03 06 03 08 07 08 08 08 09 |.0..............| +00000050 08 0a 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 |................| +00000060 03 03 02 03 03 01 02 01 03 02 02 02 04 02 05 02 |................| +00000070 06 02 |..| +>>> Flow 2 (server to client) +00000000 16 03 03 00 35 02 00 00 31 03 03 00 00 00 00 00 |....5...1.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 2f 00 00 |...DOWNGRD.../..| +00000030 09 ff 01 00 01 00 00 17 00 00 16 03 03 02 59 0b |..............Y.| +00000040 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 82 01 |..U..R..O0..K0..| +00000050 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 5b ea |............?.[.| +00000060 a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |.0...*.H........| +00000070 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 |0.1.0...U....Go1| +00000080 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 6f 6f |.0...U....Go Roo| +00000090 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 30 30 |t0...16010100000| +000000a0 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 30 30 |0Z..250101000000| +000000b0 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 47 6f |Z0.1.0...U....Go| +000000c0 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 81 9f |1.0...U....Go0..| +000000d0 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 |0...*.H.........| +000000e0 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 2e 12 |...0.......F}...| +000000f0 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 |'.H..(!.~...]..R| +00000100 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 |E.z6G....B[.....| +00000110 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 |y.@.Om..+.....g.| +00000120 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 |...."8.J.ts+.4..| +00000130 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 |....t{.X.la<..A.| +00000140 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf |.++$#w[.;.u]. T.| +00000150 a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 |.c...$....P....C| +00000160 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 |...ub...R.......| +00000170 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 ff 04 |..0..0...U......| +00000180 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 30 14 |.....0...U.%..0.| +00000190 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 01 05 |..+.........+...| +000001a0 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 |....0...U.......| +000001b0 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f 91 16 |0.0...U.........| +000001c0 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 |.CC>I..m....`0..| +000001d0 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d 13 7e |.U.#..0...H.IM.~| +000001e0 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 55 1d |.1......n{0...U.| +000001f0 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 2e 67 |...0...example.g| +00000200 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 0d 01 |olang0...*.H....| +00000210 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 |.........0.@+[P.| +00000220 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 |a...SX...(.X..8.| +00000230 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 |...1Z..f=C.-....| +00000240 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 40 20 |.. d8.$:....}.@ | +00000250 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c |._...a..v......\| +00000260 ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c |.....l..s..Cw...| +00000270 f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db 46 06 |....@.a.Lr+...F.| +00000280 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 |.M...>...B...=.`| +00000290 84 5c 21 d3 3b e9 fa e7 16 03 03 00 1f 0d 00 00 |.\!.;...........| +000002a0 1b 02 01 40 00 14 08 04 04 03 08 07 08 05 08 06 |...@............| +000002b0 04 01 05 01 06 01 05 03 06 03 00 00 16 03 03 00 |................| +000002c0 04 0e 00 00 00 |.....| +>>> Flow 3 (client to server) +00000000 16 03 03 00 07 0b 00 00 03 00 00 00 16 03 03 00 |................| +00000010 86 10 00 00 82 00 80 36 1c ba 9d 08 27 52 8b f7 |.......6....'R..| +00000020 24 d9 e6 18 d7 21 75 1d 76 e0 13 a0 35 d5 08 7d |$....!u.v...5..}| +00000030 c1 8e 3f b2 aa 10 b4 f9 d4 77 e6 cd b3 92 94 0e |..?......w......| +00000040 7a c9 0b 5f e2 34 88 ad fc 02 1b 84 10 ff e8 2a |z.._.4.........*| +00000050 dd 2d 82 5c bb ca 15 f8 73 74 ad dd 9f 9d e7 38 |.-.\....st.....8| +00000060 7c cd 74 8e 37 0f 87 62 cf 30 68 8a e2 15 9d d2 ||.t.7..b.0h.....| +00000070 43 4b e3 29 69 e4 db 94 9b 5a 7c c6 9b e8 7d 26 |CK.)i....Z|...}&| +00000080 4b a8 4a 28 c1 47 cf 15 7b 22 a2 1d 6b ac 16 e4 |K.J(.G..{"..k...| +00000090 e1 62 6e be 9a 05 67 14 03 03 00 01 01 16 03 03 |.bn...g.........| +000000a0 00 40 98 4e 3d 6c 72 d8 7f 81 b6 b8 ed 32 2e 98 |.@.N=lr......2..| +000000b0 8d fc c1 1d 56 97 82 ef 3f 7c 86 79 e3 27 06 ed |....V...?|.y.'..| +000000c0 87 c4 28 2d 6b f1 b1 88 d0 67 34 64 ba e1 d9 34 |..(-k....g4d...4| +000000d0 a4 2c ff e0 b2 38 21 5d 04 64 99 a4 34 62 aa 81 |.,...8!].d..4b..| +000000e0 cf 21 |.!| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| +00000010 00 00 00 00 00 00 00 00 00 00 00 66 31 30 4e 0f |...........f10N.| +00000020 de bd de 72 65 0c 74 ab 64 d8 59 47 fc 6b ad d8 |...re.t.d.YG.k..| +00000030 73 24 da 77 62 ba 0a 8c 69 d3 c4 6f 89 ef 5b 92 |s$.wb...i..o..[.| +00000040 d3 ca 3b e8 67 2b 7c bf 39 7c 8b 17 03 03 00 40 |..;.g+|.9|.....@| +00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000060 5c a8 b1 1c 7e e1 76 b8 d0 0c 4d 3d 3f 36 a8 26 |\...~.v...M=?6.&| +00000070 66 00 dd 47 3c ae 1c 8b 6f b0 6b 80 75 c4 0b 7e |f..G<...o.k.u..~| +00000080 ee fb 8c fe 2f 2f 65 1b 9b e1 72 a9 ac 8f cf da |....//e...r.....| +00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| +000000a0 00 00 00 00 00 9d 96 95 12 3b 42 41 a8 30 b2 8c |.........;BA.0..| +000000b0 3d 18 f6 27 b7 77 30 d9 29 0c 68 ec 2b 09 26 91 |=..'.w0.).h.+.&.| +000000c0 23 0c e2 10 07 |#....| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-ECDHE-ECDSA-AES b/go/src/crypto/tls/testdata/Server-TLSv12-ECDHE-ECDSA-AES new file mode 100644 index 0000000000000000000000000000000000000000..f0d266bdc7af1305a66e376998f248f58e542a8e --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-ECDHE-ECDSA-AES @@ -0,0 +1,84 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 85 01 00 00 81 03 03 19 8a e1 c7 50 |...............P| +00000010 ba 63 15 9b d5 85 f1 8c 55 43 d3 ce 9c d6 35 20 |.c......UC....5 | +00000020 f3 49 3d 55 a5 11 57 6d db 42 1d 00 00 04 c0 0a |.I=U..Wm.B......| +00000030 00 ff 01 00 00 54 00 0b 00 04 03 00 01 02 00 0a |.....T..........| +00000040 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 16 |................| +00000050 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 05 03 |.........0......| +00000060 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 |................| +00000070 08 06 04 01 05 01 06 01 03 03 02 03 03 01 02 01 |................| +00000080 03 02 02 02 04 02 05 02 06 02 |..........| +>>> Flow 2 (server to client) +00000000 16 03 03 00 3b 02 00 00 37 03 03 00 00 00 00 00 |....;...7.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 c0 0a 00 00 |...DOWNGRD......| +00000030 0f ff 01 00 01 00 00 17 00 00 00 0b 00 02 01 00 |................| +00000040 16 03 03 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 |...............0| +00000050 82 02 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 |...0..b.....-G..| +00000060 eb f4 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 |..0...*.H.=..0E1| +00000070 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 30 11 |.0...U....AU1.0.| +00000080 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 |..U....Some-Stat| +00000090 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 |e1!0...U....Inte| +000000a0 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 79 |rnet Widgits Pty| +000000b0 20 4c 74 64 30 1e 17 0d 31 32 31 31 32 32 31 35 | Ltd0...12112215| +000000c0 30 36 33 32 5a 17 0d 32 32 31 31 32 30 31 35 30 |0632Z..221120150| +000000d0 36 33 32 5a 30 45 31 0b 30 09 06 03 55 04 06 13 |632Z0E1.0...U...| +000000e0 02 41 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f |.AU1.0...U....So| +000000f0 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 |me-State1!0...U.| +00000100 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 |...Internet Widg| +00000110 69 74 73 20 50 74 79 20 4c 74 64 30 81 9b 30 10 |its Pty Ltd0..0.| +00000120 06 07 2a 86 48 ce 3d 02 01 06 05 2b 81 04 00 23 |..*.H.=....+...#| +00000130 03 81 86 00 04 00 c4 a1 ed be 98 f9 0b 48 73 36 |.............Hs6| +00000140 7e c3 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d cd 6b |~..V.".=S.;M!=.k| +00000150 75 e6 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 32 7c |u......&.....r2|| +00000160 b3 64 2f 1c 90 bc ea 68 23 10 7e fe e3 25 c0 48 |.d/....h#.~..%.H| +00000170 3a 69 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 9c 70 |:i.(m.7...b....p| +00000180 62 83 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 68 c0 |b....d1...1...h.| +00000190 9b 23 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 b6 5f |.#.vd?.\....XX._| +000001a0 70 dd 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 66 5b |p............0f[| +000001b0 66 9a 20 e2 27 e5 bf fe 3b 30 09 06 07 2a 86 48 |f. .'...;0...*.H| +000001c0 ce 3d 04 01 03 81 8c 00 30 81 88 02 42 01 88 a2 |.=......0...B...| +000001d0 4f eb e2 45 c5 48 7d 1b ac f5 ed 98 9d ae 47 70 |O..E.H}.......Gp| +000001e0 c0 5e 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 a2 ce |.^../...M.a@....| +000001f0 ee 0b 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce fa 10 |..~.~.v..;~.?...| +00000200 e2 59 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f d0 02 |.Y.G-|..N....o..| +00000210 42 01 4d fc be 67 13 9c 2d 05 0e bd 3f a3 8c 25 |B.M..g..-...?..%| +00000220 c1 33 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 |.3.......7z..z..| +00000230 2e dd d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 |....i..|V..1x+..| +00000240 78 0d ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 |x.....N6$1{j.9..| +00000250 07 8f 2a 16 03 03 00 b6 0c 00 00 b2 03 00 1d 20 |..*............ | +00000260 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 |/.}.G.bC.(.._.).| +00000270 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |0.........._X.;t| +00000280 04 03 00 8a 30 81 87 02 42 01 f2 09 77 4a e7 f5 |....0...B...wJ..| +00000290 a8 35 3b dd 9d 62 5a 07 97 1e 76 93 b6 07 21 3e |.5;..bZ...v...!>| +000002a0 c8 fd 99 35 50 8a 8b ad e5 de 03 07 c8 5e fe 03 |...5P........^..| +000002b0 c1 99 04 ad 53 b6 76 67 eb 04 99 54 11 4d 4d e9 |....S.vg...T.MM.| +000002c0 74 3f 89 6e d9 c8 02 98 c5 3c cf 02 41 4e 64 21 |t?.n.....<..ANd!| +000002d0 1a 01 5f 2e 89 17 cc 65 33 d0 59 ed 17 59 c4 43 |.._....e3.Y..Y.C| +000002e0 0a fc 68 30 9c e2 c3 86 fb 2a c1 4a ae 32 ef 1d |..h0.....*.J.2..| +000002f0 06 27 36 7d d5 cd 68 23 4c e9 7e 64 b8 eb 42 05 |.'6}..h#L.~d..B.| +00000300 ef 83 36 b2 9e a7 ae 1a cd b0 3a 17 3a 46 16 03 |..6.......:.:F..| +00000310 03 00 04 0e 00 00 00 |.......| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 73 43 c2 08 92 f5 |....%...! sC....| +00000010 db bf 2f 8a eb 49 55 f7 5d 6b 80 64 f7 d9 75 1f |../..IU.]k.d..u.| +00000020 67 f6 35 21 3c 95 3f 1c 04 1a 14 03 03 00 01 01 |g.5!<.?.........| +00000030 16 03 03 00 40 59 bb 5a 5d 76 73 a5 30 0e 29 d3 |....@Y.Z]vs.0.).| +00000040 17 d8 2f 30 e6 ed 02 c6 83 12 44 42 d8 79 86 e0 |../0......DB.y..| +00000050 78 7b 43 8d 5b 7c 85 42 fb 7c 67 b0 d0 71 03 0e |x{C.[|.B.|g..q..| +00000060 d0 6b b6 06 f1 16 72 c0 16 66 cf 53 df ae 62 3b |.k....r..f.S..b;| +00000070 f3 57 52 4d 08 |.WRM.| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| +00000010 00 00 00 00 00 00 00 00 00 00 00 c3 13 7d 0a ed |.............}..| +00000020 12 16 0f a5 e9 09 bb 38 9e bb 25 3f d3 36 f2 57 |.......8..%?.6.W| +00000030 37 2b cf c7 9e d4 ed b6 ee 0e 07 8e a7 ae 71 c9 |7+............q.| +00000040 1e cb 40 65 8b c5 9c e0 14 c5 f3 17 03 03 00 40 |..@e...........@| +00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000060 0d 8e c2 8a a5 5a 8b bc d8 86 a0 05 cf c6 39 a7 |.....Z........9.| +00000070 6d 65 f1 a7 bb 74 25 1d 3e 75 fd f8 1f a5 06 b6 |me...t%.>u......| +00000080 cd 14 5b 4b 0a 7b a2 e6 54 b3 bd 3c f0 eb ca 78 |..[K.{..T..<...x| +00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| +000000a0 00 00 00 00 00 e6 4b 35 cc 69 58 89 49 67 99 f4 |......K5.iX.Ig..| +000000b0 c2 14 2a bb e7 21 2b fe fe b5 60 ae b2 2a 96 15 |..*..!+...`..*..| +000000c0 e0 65 d2 54 0b |.e.T.| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-Ed25519 b/go/src/crypto/tls/testdata/Server-TLSv12-Ed25519 new file mode 100644 index 0000000000000000000000000000000000000000..42bb15412c90399d30302903ec28f1de709bd170 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-Ed25519 @@ -0,0 +1,58 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 85 01 00 00 81 03 03 f3 04 e3 e7 a2 |................| +00000010 39 79 b2 9e 94 35 cf c3 a8 54 77 ab 96 72 b6 40 |9y...5...Tw..r.@| +00000020 de 59 6b cf d4 f5 f4 2c fd 7d f6 00 00 04 cc a9 |.Yk....,.}......| +00000030 00 ff 01 00 00 54 00 0b 00 04 03 00 01 02 00 0a |.....T..........| +00000040 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 16 |................| +00000050 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 05 03 |.........0......| +00000060 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 |................| +00000070 08 06 04 01 05 01 06 01 03 03 02 03 03 01 02 01 |................| +00000080 03 02 02 02 04 02 05 02 06 02 |..........| +>>> Flow 2 (server to client) +00000000 16 03 03 00 3b 02 00 00 37 03 03 00 00 00 00 00 |....;...7.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 cc a9 00 00 |...DOWNGRD......| +00000030 0f ff 01 00 01 00 00 17 00 00 00 0b 00 02 01 00 |................| +00000040 16 03 03 01 3c 0b 00 01 38 00 01 35 00 01 32 30 |....<...8..5..20| +00000050 82 01 2e 30 81 e1 a0 03 02 01 02 02 10 0f 43 1c |...0..........C.| +00000060 42 57 93 94 1d e9 87 e4 f1 ad 15 00 5d 30 05 06 |BW..........]0..| +00000070 03 2b 65 70 30 12 31 10 30 0e 06 03 55 04 0a 13 |.+ep0.1.0...U...| +00000080 07 41 63 6d 65 20 43 6f 30 1e 17 0d 31 39 30 35 |.Acme Co0...1905| +00000090 31 36 32 31 33 38 30 31 5a 17 0d 32 30 30 35 31 |16213801Z..20051| +000000a0 35 32 31 33 38 30 31 5a 30 12 31 10 30 0e 06 03 |5213801Z0.1.0...| +000000b0 55 04 0a 13 07 41 63 6d 65 20 43 6f 30 2a 30 05 |U....Acme Co0*0.| +000000c0 06 03 2b 65 70 03 21 00 3f e2 15 2e e6 e3 ef 3f |..+ep.!.?......?| +000000d0 4e 85 4a 75 77 a3 64 9e ed e0 bf 84 2c cc 92 26 |N.Juw.d.....,..&| +000000e0 8f fa 6f 34 83 aa ec 8f a3 4d 30 4b 30 0e 06 03 |..o4.....M0K0...| +000000f0 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 |U...........0...| +00000100 55 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 |U.%..0...+......| +00000110 01 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 |.0...U.......0.0| +00000120 16 06 03 55 1d 11 04 0f 30 0d 82 0b 65 78 61 6d |...U....0...exam| +00000130 70 6c 65 2e 63 6f 6d 30 05 06 03 2b 65 70 03 41 |ple.com0...+ep.A| +00000140 00 63 44 ed 9c c4 be 53 24 53 9f d2 10 8d 9f e8 |.cD....S$S......| +00000150 21 08 90 95 39 e5 0d c1 55 ff 2c 16 b7 1d fc ab |!...9...U.,.....| +00000160 7d 4d d4 e0 93 13 d0 a9 42 e0 b6 6b fe 5d 67 48 |}M......B..k.]gH| +00000170 d7 9f 50 bc 6c cd 4b 03 83 7c f2 08 58 cd ac cf |..P.l.K..|..X...| +00000180 0c 16 03 03 00 6c 0c 00 00 68 03 00 1d 20 2f e5 |.....l...h... /.| +00000190 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff |}.G.bC.(.._.).0.| +000001a0 f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 08 07 |........._X.;t..| +000001b0 00 40 a2 12 66 be 81 b1 24 93 f2 e1 60 9f c4 13 |.@..f...$...`...| +000001c0 04 3f 39 77 8f fe e4 33 5b f7 9d 84 f5 0f 96 aa |.?9w...3[.......| +000001d0 a0 d6 9d da ae b2 eb 76 64 02 82 58 d4 bc 5a 44 |.......vd..X..ZD| +000001e0 b9 5a f5 33 57 fa a6 9c d5 05 84 9a 19 0b 65 37 |.Z.3W.........e7| +000001f0 bc 05 16 03 03 00 04 0e 00 00 00 |...........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 95 58 05 04 03 27 |....%...! .X...'| +00000010 5e 14 d4 41 5a 3b eb d3 13 ad d4 16 fb 43 bf d6 |^..AZ;.......C..| +00000020 7c 0a 1e a9 6c f9 72 84 47 1a 14 03 03 00 01 01 ||...l.r.G.......| +00000030 16 03 03 00 20 06 f8 af f4 38 35 de 88 74 d6 cc |.... ....85..t..| +00000040 a8 fa 2c ee a4 88 42 5c 4a aa 62 49 dc 32 da 15 |..,...B\J.bI.2..| +00000050 1d 9c 5a b8 59 |..Z.Y| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 20 3a 16 00 b6 c5 |.......... :....| +00000010 76 1f 39 6b 17 2d 2f 34 83 c2 fd 1b 57 c4 0c 02 |v.9k.-/4....W...| +00000020 18 16 6c d2 92 69 63 9b 32 33 e0 17 03 03 00 1d |..l..ic.23......| +00000030 04 97 df f0 2c 4b 3d 69 99 36 eb 0b 11 56 97 ab |....,K=i.6...V..| +00000040 98 5d d9 d4 6f 93 92 5c cc f6 7e 77 40 15 03 03 |.]..o..\..~w@...| +00000050 00 12 58 cf 6e 90 04 6b ae 4f cf 6b 71 15 80 22 |..X.n..k.O.kq.."| +00000060 f5 80 fa df |....| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-ExportKeyingMaterial b/go/src/crypto/tls/testdata/Server-TLSv12-ExportKeyingMaterial new file mode 100644 index 0000000000000000000000000000000000000000..a670f05d58c54fb27d73b7577176023974fe8193 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-ExportKeyingMaterial @@ -0,0 +1,96 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 89 01 00 00 85 03 03 ba bc af a2 f7 |................| +00000010 a2 a0 19 81 f0 3b c0 76 56 10 e6 95 ce ab 89 82 |.....;.vV.......| +00000020 d5 27 b3 78 69 f2 d3 5b 2d 97 77 00 00 04 c0 14 |.'.xi..[-.w.....| +00000030 00 ff 01 00 00 58 00 0b 00 04 03 00 01 02 00 0a |.....X..........| +00000040 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 23 |...............#| +00000050 00 00 00 16 00 00 00 17 00 00 00 0d 00 30 00 2e |.............0..| +00000060 04 03 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b |................| +00000070 08 04 08 05 08 06 04 01 05 01 06 01 03 03 02 03 |................| +00000080 03 01 02 01 03 02 02 02 04 02 05 02 06 02 |..............| +>>> Flow 2 (server to client) +00000000 16 03 03 00 3f 02 00 00 3b 03 03 00 00 00 00 00 |....?...;.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 c0 14 00 00 |...DOWNGRD......| +00000030 13 00 23 00 00 ff 01 00 01 00 00 17 00 00 00 0b |..#.............| +00000040 00 02 01 00 16 03 03 02 59 0b 00 02 55 00 02 52 |........Y...U..R| +00000050 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 01 02 |..O0..K0........| +00000060 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a |......?.[..0...*| +00000070 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b 30 09 |.H........0.1.0.| +00000080 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 03 55 |..U....Go1.0...U| +00000090 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 |....Go Root0...1| +000000a0 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 |60101000000Z..25| +000000b0 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 0b 30 |0101000000Z0.1.0| +000000c0 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 06 03 |...U....Go1.0...| +000000d0 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 |U....Go0..0...*.| +000000e0 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 |H............0..| +000000f0 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc 06 28 |.....F}...'.H..(| +00000100 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 |!.~...]..RE.z6G.| +00000110 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb 4f 6d |...B[.....y.@.Om| +00000120 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 |..+.....g....."8| +00000130 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b |.J.ts+.4......t{| +00000140 f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 |.X.la<..A..++$#w| +00000150 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d 1e 24 |[.;.u]. T..c...$| +00000160 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 62 f4 |....P....C...ub.| +00000170 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 90 30 |..R.........0..0| +00000180 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 |...U...........0| +00000190 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 |...U.%..0...+...| +000001a0 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c |......+.......0.| +000001b0 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 |..U.......0.0...| +000001c0 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e 49 a6 |U..........CC>I.| +000001d0 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 04 14 |.m....`0...U.#..| +000001e0 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 01 d5 |0...H.IM.~.1....| +000001f0 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 10 82 |..n{0...U....0..| +00000200 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 |.example.golang0| +00000210 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 |...*.H..........| +00000220 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 |...0.@+[P.a...SX| +00000230 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a |...(.X..8....1Z.| +00000240 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 38 92 |.f=C.-...... d8.| +00000250 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 16 61 |$:....}.@ ._...a| +00000260 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c |..v......\.....l| +00000270 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 |..s..Cw.......@.| +00000280 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 b3 3e |a.Lr+...F..M...>| +00000290 c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 |...B...=.`.\!.;.| +000002a0 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d 20 2f |.............. /| +000002b0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +000002c0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 08 |.........._X.;t.| +000002d0 04 00 80 59 86 4b 13 6a 34 c5 bd 82 a9 ae d8 bf |...Y.K.j4.......| +000002e0 7b 9b f2 c2 0a aa 81 99 25 d8 14 68 32 49 00 ab |{.......%..h2I..| +000002f0 b0 18 4e 05 50 31 0e 25 f3 db 5f 93 45 13 a4 3e |..N.P1.%.._.E..>| +00000300 38 76 a1 0d d8 87 0f 85 81 0c af cb cd e8 43 cd |8v............C.| +00000310 67 01 f2 15 e0 7e 11 44 2a 8d ba 12 33 94 01 c9 |g....~.D*...3...| +00000320 81 bd 99 0d 9f 84 04 a0 7c 0f 24 dd 79 34 53 ba |........|.$.y4S.| +00000330 fa ae 32 16 0c 30 6c f0 76 5d 75 c1 ba d9 35 86 |..2..0l.v]u...5.| +00000340 b0 94 2f 1f 35 7f 1c 1f 92 10 c5 88 55 cc 2c 5b |../.5.......U.,[| +00000350 89 b3 58 16 03 03 00 04 0e 00 00 00 |..X.........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 7b e4 41 19 92 fc |....%...! {.A...| +00000010 73 0d 4b 88 2d bd e2 a1 f3 6a ad 5b 8c 10 9b 9e |s.K.-....j.[....| +00000020 46 7a c0 81 96 03 0b 4c 03 7d 14 03 03 00 01 01 |Fz.....L.}......| +00000030 16 03 03 00 40 e5 e4 11 bd 7c 54 b8 be 80 44 82 |....@....|T...D.| +00000040 03 22 51 7f f5 de 92 20 7d 34 b0 9a 7b 17 ce 12 |."Q.... }4..{...| +00000050 b4 75 44 9b 37 b1 cd 1f 0c f8 86 4c 75 d9 1e 75 |.uD.7......Lu..u| +00000060 d3 7e bf 6e 3e 9d be 3b c1 47 11 6d f1 09 10 2e |.~.n>..;.G.m....| +00000070 d0 0d cd 1f 26 |....&| +>>> Flow 4 (server to client) +00000000 16 03 03 00 85 04 00 00 81 00 00 00 00 00 7b 00 |..............{.| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 94 |................| +00000020 6f 2d 70 97 51 ed 14 ef 68 ca 42 c5 4c e2 2f 01 |o-p.Q...h.B.L./.| +00000030 02 b4 98 0b ab 81 e1 03 a3 a3 58 3e ea 75 9a 4c |..........X>.u.L| +00000040 72 93 e7 50 f9 17 7b 90 0d 70 e7 b8 5c 7b 93 81 |r..P..{..p..\{..| +00000050 66 e1 64 b0 a9 25 34 84 bc 49 42 f5 13 49 38 16 |f.d..%4..IB..I8.| +00000060 7e 51 5c e5 15 c0 58 7d 52 07 da 2f 56 e0 05 62 |~Q\...X}R../V..b| +00000070 16 1e 0c 62 76 cc b5 ff 25 a1 c3 2e 1f 28 71 29 |...bv...%....(q)| +00000080 9c d0 c1 0a 05 dd 22 57 7a 19 14 03 03 00 01 01 |......"Wz.......| +00000090 16 03 03 00 40 00 00 00 00 00 00 00 00 00 00 00 |....@...........| +000000a0 00 00 00 00 00 9a 9d 01 bc db e5 21 c2 d2 f8 d8 |...........!....| +000000b0 b8 c1 86 87 fc b6 79 df 69 be d2 97 cd 69 76 9d |......y.i....iv.| +000000c0 04 95 7f d4 e8 c7 78 52 c0 d1 ac bc 55 08 57 a7 |......xR....U.W.| +000000d0 9c 28 d4 7b df 17 03 03 00 40 00 00 00 00 00 00 |.(.{.....@......| +000000e0 00 00 00 00 00 00 00 00 00 00 81 f0 80 62 50 04 |.............bP.| +000000f0 7f 86 ee f1 73 46 b0 c3 c1 0d 92 ab dd 4f b9 2a |....sF.......O.*| +00000100 58 4f 17 9f be 60 ff 8b 1a d6 e3 94 aa dc 8b 60 |XO...`.........`| +00000110 d8 2b 4c c8 5a 69 18 74 65 49 15 03 03 00 30 00 |.+L.Zi.teI....0.| +00000120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18 |................| +00000130 36 4f 05 fe ab 47 92 6e 48 42 4f 06 c4 f3 e1 70 |6O...G.nHBO....p| +00000140 c6 66 00 1d aa 84 6b 2b d4 23 37 c9 42 fb 6d |.f....k+.#7.B.m| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-IssueTicket b/go/src/crypto/tls/testdata/Server-TLSv12-IssueTicket new file mode 100644 index 0000000000000000000000000000000000000000..b05669d073b0477f05d970fcb3596ccf8fea94da --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-IssueTicket @@ -0,0 +1,90 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 71 01 00 00 6d 03 03 ae 71 d4 07 74 |....q...m...q..t| +00000010 03 93 b0 1f 88 72 ef d2 54 61 44 34 5f 3f ea 16 |.....r..TaD4_?..| +00000020 32 41 11 a9 00 9b 59 ba 50 a8 ab 00 00 04 00 2f |2A....Y.P....../| +00000030 00 ff 01 00 00 40 00 23 00 00 00 16 00 00 00 17 |.....@.#........| +00000040 00 00 00 0d 00 30 00 2e 04 03 05 03 06 03 08 07 |.....0..........| +00000050 08 08 08 09 08 0a 08 0b 08 04 08 05 08 06 04 01 |................| +00000060 05 01 06 01 03 03 02 03 03 01 02 01 03 02 02 02 |................| +00000070 04 02 05 02 06 02 |......| +>>> Flow 2 (server to client) +00000000 16 03 03 00 39 02 00 00 35 03 03 00 00 00 00 00 |....9...5.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 2f 00 00 |...DOWNGRD.../..| +00000030 0d 00 23 00 00 ff 01 00 01 00 00 17 00 00 16 03 |..#.............| +00000040 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| +00000050 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| +00000060 3f e2 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 |?.[..0...*.H....| +00000070 01 0b 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 |....0.1.0...U...| +00000080 02 47 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f |.Go1.0...U....Go| +00000090 20 52 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 | Root0...1601010| +000000a0 30 30 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 |00000Z..25010100| +000000b0 30 30 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a |0000Z0.1.0...U..| +000000c0 13 02 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 |..Go1.0...U....G| +000000d0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| +000000e0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 |.......0.......F| +000000f0 7d 93 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 |}...'.H..(!.~...| +00000100 5d fe 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 |]..RE.z6G....B[.| +00000110 81 c0 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 |....y.@.Om..+...| +00000120 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b |..g....."8.J.ts+| +00000130 c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c |.4......t{.X.la<| +00000140 c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d |..A..++$#w[.;.u]| +00000150 ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b |. T..c...$....P.| +00000160 aa b6 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 |...C...ub...R...| +00000170 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| +00000180 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| +00000190 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| +000001a0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| +000001b0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| +000001c0 10 9f 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f |.....CC>I..m....| +000001d0 60 30 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 |`0...U.#..0...H.| +000001e0 49 4d 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 |IM.~.1......n{0.| +000001f0 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| +00000200 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| +00000210 86 f7 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 |.............0.@| +00000220 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 |+[P.a...SX...(.X| +00000230 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d |..8....1Z..f=C.-| +00000240 d9 0b f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c |...... d8.$:....| +00000250 7d b7 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 |}.@ ._...a..v...| +00000260 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 |...\.....l..s..C| +00000270 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| +00000280 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| +00000290 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| +000002a0 04 0e 00 00 00 |.....| +>>> Flow 3 (client to server) +00000000 16 03 03 00 86 10 00 00 82 00 80 1a 4a c4 37 68 |............J.7h| +00000010 6a c0 28 f1 ea ea 14 20 fe c3 b6 61 28 67 75 7b |j.(.... ...a(gu{| +00000020 74 e0 6b ab 2c dd c8 13 0a be d6 71 a1 13 96 5a |t.k.,......q...Z| +00000030 bf 89 2e 6e 6a 61 24 ca d4 88 3f f8 20 ed 20 1f |...nja$...?. . .| +00000040 0a 9c 11 9b 96 e1 cd d8 38 42 05 be b8 6e e5 fe |........8B...n..| +00000050 54 c8 93 b8 56 67 01 97 a0 bc 37 33 7c 40 f7 77 |T...Vg....73|@.w| +00000060 5d 8b 63 bc 3f 7b e3 e9 0a b0 13 06 12 6e 8e 1c |].c.?{.......n..| +00000070 7c e7 ed 99 6d c3 5a 93 92 d2 4a fe fa d9 10 1c ||...m.Z...J.....| +00000080 76 e2 9e d7 d4 cd c7 b9 7a 40 54 14 03 03 00 01 |v.......z@T.....| +00000090 01 16 03 03 00 40 ac 11 71 60 db b6 db b9 db fb |.....@..q`......| +000000a0 09 20 8d 00 e9 69 25 15 f9 14 8f 08 7a 6c 8c 29 |. ...i%.....zl.)| +000000b0 0d f4 9b d3 ca c8 c8 f3 11 0a 85 d6 c2 cc 60 a7 |..............`.| +000000c0 8c a3 32 06 08 15 bd 84 a0 4f 17 b9 6b 9b 6a 7c |..2......O..k.j|| +000000d0 23 9d 74 22 7f fd |#.t"..| +>>> Flow 4 (server to client) +00000000 16 03 03 00 85 04 00 00 81 00 00 00 00 00 7b 00 |..............{.| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 94 |................| +00000020 6f 2d b0 ac 51 ed 14 ef 68 ca 42 c5 4c 52 2e 96 |o-..Q...h.B.LR..| +00000030 6b e5 cc b4 0c ee 82 5b c1 57 52 8e dd 26 c8 58 |k......[.WR..&.X| +00000040 27 01 5f ec 58 a0 5c ad 74 e8 82 b7 ab 86 71 25 |'._.X.\.t.....q%| +00000050 aa ed ec ef 69 5f 7e 1d f2 58 30 13 75 49 38 16 |....i_~..X0.uI8.| +00000060 7e 51 5c e5 15 c0 58 7d 52 1a 43 47 27 99 9d 0f |~Q\...X}R.CG'...| +00000070 e0 4c f4 3b e0 b0 76 ae e6 5d a4 a0 34 38 8b b0 |.L.;..v..]..48..| +00000080 3a ba 26 90 a3 dd c2 dc 26 98 14 03 03 00 01 01 |:.&.....&.......| +00000090 16 03 03 00 40 00 00 00 00 00 00 00 00 00 00 00 |....@...........| +000000a0 00 00 00 00 00 55 e7 9a 32 83 32 d1 01 6e 0e 5a |.....U..2.2..n.Z| +000000b0 dd 72 c5 f9 90 24 6b da 73 d9 ed 39 b8 d5 f6 93 |.r...$k.s..9....| +000000c0 e0 f0 3e 20 db d0 0c 8a b0 10 78 1e 08 fb 47 44 |..> ......x...GD| +000000d0 27 74 30 c4 73 17 03 03 00 40 00 00 00 00 00 00 |'t0.s....@......| +000000e0 00 00 00 00 00 00 00 00 00 00 0a ae 7e 4e c4 37 |............~N.7| +000000f0 65 b9 bf 66 a5 c5 5d a2 bc 76 7a db c9 cd 0b 85 |e..f..]..vz.....| +00000100 de 86 e4 94 2c f2 87 1f 7a 4b 31 b7 4d 77 18 8a |....,...zK1.Mw..| +00000110 6d 5e af d0 eb 87 bf d9 c5 e3 15 03 03 00 30 00 |m^............0.| +00000120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 9f |................| +00000130 8a 39 93 10 94 78 d1 dc 81 07 b6 1a 1a c3 96 c1 |.9...x..........| +00000140 28 d3 30 eb 3d 1a d3 d6 d8 3a d2 33 ec ed 6c |(.0.=....:.3..l| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-IssueTicketPreDisable b/go/src/crypto/tls/testdata/Server-TLSv12-IssueTicketPreDisable new file mode 100644 index 0000000000000000000000000000000000000000..a86d19c35a817878e7d4374388d08176923db5ef --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-IssueTicketPreDisable @@ -0,0 +1,90 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 71 01 00 00 6d 03 03 9d 49 68 d2 e5 |....q...m...Ih..| +00000010 4a 77 05 39 fb b6 c2 e8 79 b8 cd e7 42 dd f5 29 |Jw.9....y...B..)| +00000020 4f 24 92 27 bf 94 95 89 8a 0c 5f 00 00 04 00 2f |O$.'......_..../| +00000030 00 ff 01 00 00 40 00 23 00 00 00 16 00 00 00 17 |.....@.#........| +00000040 00 00 00 0d 00 30 00 2e 04 03 05 03 06 03 08 07 |.....0..........| +00000050 08 08 08 09 08 0a 08 0b 08 04 08 05 08 06 04 01 |................| +00000060 05 01 06 01 03 03 02 03 03 01 02 01 03 02 02 02 |................| +00000070 04 02 05 02 06 02 |......| +>>> Flow 2 (server to client) +00000000 16 03 03 00 39 02 00 00 35 03 03 00 00 00 00 00 |....9...5.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 2f 00 00 |...DOWNGRD.../..| +00000030 0d 00 23 00 00 ff 01 00 01 00 00 17 00 00 16 03 |..#.............| +00000040 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| +00000050 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| +00000060 3f e2 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 |?.[..0...*.H....| +00000070 01 0b 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 |....0.1.0...U...| +00000080 02 47 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f |.Go1.0...U....Go| +00000090 20 52 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 | Root0...1601010| +000000a0 30 30 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 |00000Z..25010100| +000000b0 30 30 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a |0000Z0.1.0...U..| +000000c0 13 02 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 |..Go1.0...U....G| +000000d0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| +000000e0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 |.......0.......F| +000000f0 7d 93 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 |}...'.H..(!.~...| +00000100 5d fe 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 |]..RE.z6G....B[.| +00000110 81 c0 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 |....y.@.Om..+...| +00000120 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b |..g....."8.J.ts+| +00000130 c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c |.4......t{.X.la<| +00000140 c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d |..A..++$#w[.;.u]| +00000150 ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b |. T..c...$....P.| +00000160 aa b6 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 |...C...ub...R...| +00000170 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| +00000180 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| +00000190 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| +000001a0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| +000001b0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| +000001c0 10 9f 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f |.....CC>I..m....| +000001d0 60 30 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 |`0...U.#..0...H.| +000001e0 49 4d 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 |IM.~.1......n{0.| +000001f0 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| +00000200 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| +00000210 86 f7 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 |.............0.@| +00000220 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 |+[P.a...SX...(.X| +00000230 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d |..8....1Z..f=C.-| +00000240 d9 0b f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c |...... d8.$:....| +00000250 7d b7 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 |}.@ ._...a..v...| +00000260 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 |...\.....l..s..C| +00000270 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| +00000280 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| +00000290 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| +000002a0 04 0e 00 00 00 |.....| +>>> Flow 3 (client to server) +00000000 16 03 03 00 86 10 00 00 82 00 80 2b 09 f3 6c 39 |...........+..l9| +00000010 25 51 ab 73 c9 5d e4 de bb b3 7d 8e 40 96 df f9 |%Q.s.]....}.@...| +00000020 28 24 82 47 21 40 2d cb bd 7d a5 2a 89 91 7d e0 |($.G!@-..}.*..}.| +00000030 4c 92 ca 8f 2c 2d be 93 d1 a2 00 ef 3a 4b 6b de |L...,-......:Kk.| +00000040 e9 ab 38 0b 19 21 35 5d fb 06 b1 1f dd 75 db d6 |..8..!5].....u..| +00000050 6b 16 7e 1e 32 ef 58 11 78 ef 6e 7f cc 1f cd 8e |k.~.2.X.x.n.....| +00000060 57 01 96 eb 06 bf 09 10 99 ed 3c 35 94 9f 03 66 |W.........<5...f| +00000070 a4 e1 96 22 eb f5 cd 28 1f 4e 2c b9 2c 48 29 bf |..."...(.N,.,H).| +00000080 b3 43 c1 b9 f0 aa 2b 29 47 a4 38 14 03 03 00 01 |.C....+)G.8.....| +00000090 01 16 03 03 00 40 75 ac e5 40 a2 19 82 90 ef 25 |.....@u..@.....%| +000000a0 9c 3b c2 95 fb 58 b9 c8 72 2c b3 94 d5 23 e9 f6 |.;...X..r,...#..| +000000b0 0d 03 2e 24 54 73 c3 5b 0d 84 2d 5b 12 f6 f9 5a |...$Ts.[..-[...Z| +000000c0 59 6d ea 80 5e b6 ab 34 5f 57 98 fb 2c c8 e2 d0 |Ym..^..4_W..,...| +000000d0 3e fb 32 4c b1 93 |>.2L..| +>>> Flow 4 (server to client) +00000000 16 03 03 00 85 04 00 00 81 00 00 00 00 00 7b 00 |..............{.| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 94 |................| +00000020 6f 2d b0 ac 51 ed 14 ef 68 ca 42 c5 4c ba fa 12 |o-..Q...h.B.L...| +00000030 47 15 bc 82 f4 35 e2 0f 0f 2b d3 02 30 a7 c3 bb |G....5...+..0...| +00000040 48 06 b7 80 c5 21 70 95 bf fd e5 fa d8 aa ee 9c |H....!p.........| +00000050 d6 10 79 3b f9 e6 9e 21 21 bd e9 50 ba 49 38 16 |..y;...!!..P.I8.| +00000060 7e 51 5c e5 15 c0 58 7d 52 1a 2e ee ae e1 df 6c |~Q\...X}R......l| +00000070 d2 82 e8 11 4b d9 3a b4 ed 46 56 6a 8e cd 4b 70 |....K.:..FVj..Kp| +00000080 37 5c 82 fc ef d7 ff 38 65 e6 14 03 03 00 01 01 |7\.....8e.......| +00000090 16 03 03 00 40 00 00 00 00 00 00 00 00 00 00 00 |....@...........| +000000a0 00 00 00 00 00 8a 27 b1 df e3 23 8d 5e a8 06 e0 |......'...#.^...| +000000b0 3b 70 3a 8a f2 36 09 e5 0b 91 03 0c ab c7 6b 2c |;p:..6........k,| +000000c0 ee 8d fd b3 d1 3b 0b d6 08 45 af 26 40 ad c7 fd |.....;...E.&@...| +000000d0 8f fa fa f6 c0 17 03 03 00 40 00 00 00 00 00 00 |.........@......| +000000e0 00 00 00 00 00 00 00 00 00 00 c0 62 b3 b3 3d 17 |...........b..=.| +000000f0 5d 7f a6 7d 7b eb ea 35 f5 46 3c 69 94 a0 37 ca |]..}{..5.F>> Flow 1 (client to server) +00000000 16 03 01 00 7d 01 00 00 79 03 03 26 b5 ad b7 ec |....}...y..&....| +00000010 e9 2f d5 cc 9e c2 f6 6f dd ab c5 4b 2c 74 48 a5 |./.....o...K,tH.| +00000020 9c c5 21 41 fd 32 91 04 8f 1b 6c 00 00 04 cc a8 |..!A.2....l.....| +00000030 00 ff 01 00 00 4c 00 0b 00 04 03 00 01 02 00 0a |.....L..........| +00000040 00 04 00 02 00 17 00 16 00 00 00 17 00 00 00 0d |................| +00000050 00 30 00 2e 04 03 05 03 06 03 08 07 08 08 08 09 |.0..............| +00000060 08 0a 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 |................| +00000070 03 03 02 03 03 01 02 01 03 02 02 02 04 02 05 02 |................| +00000080 06 02 |..| +>>> Flow 2 (server to client) +00000000 16 03 03 00 3b 02 00 00 37 03 03 00 00 00 00 00 |....;...7.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 cc a8 00 00 |...DOWNGRD......| +00000030 0f ff 01 00 01 00 00 17 00 00 00 0b 00 02 01 00 |................| +00000040 16 03 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 |....Y...U..R..O0| +00000050 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 |..K0............| +00000060 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 86 f7 |..?.[..0...*.H..| +00000070 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 55 04 |......0.1.0...U.| +00000080 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 13 07 |...Go1.0...U....| +00000090 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 31 30 |Go Root0...16010| +000000a0 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 30 31 |1000000Z..250101| +000000b0 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 03 55 |000000Z0.1.0...U| +000000c0 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 03 13 |....Go1.0...U...| +000000d0 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d |.Go0..0...*.H...| +000000e0 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 |.........0......| +000000f0 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab 7e c4 |.F}...'.H..(!.~.| +00000100 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d 92 42 |..]..RE.z6G....B| +00000110 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 |[.....y.@.Om..+.| +00000120 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 |....g....."8.J.t| +00000130 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c |s+.4......t{.X.l| +00000140 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd |a<..A..++$#w[.;.| +00000150 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a |u]. T..c...$....| +00000160 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 |P....C...ub...R.| +00000170 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 |........0..0...U| +00000180 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 |...........0...U| +00000190 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......| +000001a0 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d |..+.......0...U.| +000001b0 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 |......0.0...U...| +000001c0 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d b6 80 |.......CC>I..m..| +000001d0 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 80 10 |..`0...U.#..0...| +000001e0 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b |H.IM.~.1......n{| +000001f0 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 |0...U....0...exa| +00000200 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a |mple.golang0...*| +00000210 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 9d 30 |.H.............0| +00000220 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed 83 28 |.@+[P.a...SX...(| +00000230 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 |.X..8....1Z..f=C| +00000240 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a 00 bc |.-...... d8.$:..| +00000250 cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 76 fd |..}.@ ._...a..v.| +00000260 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb |.....\.....l..s.| +00000270 b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 |.Cw.......@.a.Lr| +00000280 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 |+...F..M...>...B| +00000290 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 |...=.`.\!.;.....| +000002a0 03 00 cd 0c 00 00 c9 03 00 17 41 04 1e 18 37 ef |..........A...7.| +000002b0 0d 19 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 |..Q.5uq..T[....g| +000002c0 fd a7 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f |..$ >.V...(^.+-O| +000002d0 9e f1 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 |....lK[.V.2B.X..| +000002e0 49 a6 b5 68 1a 41 03 56 6b dc 5a 89 08 04 00 80 |I..h.A.Vk.Z.....| +000002f0 ca 2e 5d 9c 99 56 e6 7a 60 e2 b6 65 09 2e 4f ee |..]..V.z`..e..O.| +00000300 5d 7f d0 c0 f6 01 fe 62 13 12 14 dd 4d c9 eb e5 |]......b....M...| +00000310 ee 27 ab 56 77 d1 0b 65 83 96 e5 72 ea 9a 78 85 |.'.Vw..e...r..x.| +00000320 07 e6 86 bf 58 84 a8 4d 08 4a 56 14 a6 7f 0c 5a |....X..M.JV....Z| +00000330 68 3c 6a 9e 0e 2a 70 6a 4f 58 96 45 f2 14 11 45 |h>> Flow 3 (client to server) +00000000 16 03 03 00 46 10 00 00 42 41 04 1c 05 a2 39 1b |....F...BA....9.| +00000010 b9 e6 ef 38 6d 6f fe 95 0e ef 8d 8a 1b 70 10 b6 |...8mo.......p..| +00000020 fc 0e 5f ee 0f 6e 08 b6 2d 4f 26 b1 5a af be f8 |.._..n..-O&.Z...| +00000030 77 72 e4 19 5d a3 91 c6 0c 72 a3 19 9f 20 4f 6e |wr..]....r... On| +00000040 75 91 ef 62 4f 1a aa 29 b2 75 6f 14 03 03 00 01 |u..bO..).uo.....| +00000050 01 16 03 03 00 20 44 af 52 7b ff ca cf 30 ce 71 |..... D.R{...0.q| +00000060 94 6d 90 2b 6d f3 0e a6 5d 60 15 29 b2 03 81 59 |.m.+m...]`.)...Y| +00000070 ec 37 a1 cf a5 79 |.7...y| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 20 af 15 24 30 06 |.......... ..$0.| +00000010 dd 4c 8b 8a 87 e1 f5 24 ac 36 bc 43 8d 89 20 19 |.L.....$.6.C.. .| +00000020 04 d2 9c 14 c4 af 24 30 bf ef 1e 17 03 03 00 1d |......$0........| +00000030 82 3b 55 e7 67 fe 89 bf 5b c1 7e d6 98 94 36 1f |.;U.g...[.~...6.| +00000040 74 f3 34 2b cb 95 48 ed 4d 33 64 b9 ce 15 03 03 |t.4+..H.M3d.....| +00000050 00 12 ca bf 01 54 b4 c3 b4 f8 04 87 6d 75 ef 8c |.....T......mu..| +00000060 c7 9d 1b 1c |....| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-RSA-3DES b/go/src/crypto/tls/testdata/Server-TLSv12-RSA-3DES new file mode 100644 index 0000000000000000000000000000000000000000..0298d49ca40b2e2459898bb5a5ef3b790fd25d51 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-RSA-3DES @@ -0,0 +1,78 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 6d 01 00 00 69 03 03 6c 16 54 e2 20 |....m...i..l.T. | +00000010 da ff dc 37 ae f5 5d e2 77 32 fe 7b 7a cc 31 1f |...7..].w2.{z.1.| +00000020 f5 49 6e 75 89 27 b0 aa 67 e7 99 00 00 04 00 0a |.Inu.'..g.......| +00000030 00 ff 01 00 00 3c 00 16 00 00 00 17 00 00 00 0d |.....<..........| +00000040 00 30 00 2e 04 03 05 03 06 03 08 07 08 08 08 09 |.0..............| +00000050 08 0a 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 |................| +00000060 03 03 02 03 03 01 02 01 03 02 02 02 04 02 05 02 |................| +00000070 06 02 |..| +>>> Flow 2 (server to client) +00000000 16 03 03 00 35 02 00 00 31 03 03 00 00 00 00 00 |....5...1.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 0a 00 00 |...DOWNGRD......| +00000030 09 ff 01 00 01 00 00 17 00 00 16 03 03 02 59 0b |..............Y.| +00000040 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 82 01 |..U..R..O0..K0..| +00000050 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 5b ea |............?.[.| +00000060 a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |.0...*.H........| +00000070 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 |0.1.0...U....Go1| +00000080 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 6f 6f |.0...U....Go Roo| +00000090 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 30 30 |t0...16010100000| +000000a0 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 30 30 |0Z..250101000000| +000000b0 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 47 6f |Z0.1.0...U....Go| +000000c0 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 81 9f |1.0...U....Go0..| +000000d0 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 |0...*.H.........| +000000e0 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 2e 12 |...0.......F}...| +000000f0 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 |'.H..(!.~...]..R| +00000100 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 |E.z6G....B[.....| +00000110 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 |y.@.Om..+.....g.| +00000120 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 |...."8.J.ts+.4..| +00000130 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 |....t{.X.la<..A.| +00000140 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf |.++$#w[.;.u]. T.| +00000150 a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 |.c...$....P....C| +00000160 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 |...ub...R.......| +00000170 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 ff 04 |..0..0...U......| +00000180 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 30 14 |.....0...U.%..0.| +00000190 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 01 05 |..+.........+...| +000001a0 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 |....0...U.......| +000001b0 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f 91 16 |0.0...U.........| +000001c0 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 |.CC>I..m....`0..| +000001d0 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d 13 7e |.U.#..0...H.IM.~| +000001e0 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 55 1d |.1......n{0...U.| +000001f0 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 2e 67 |...0...example.g| +00000200 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 0d 01 |olang0...*.H....| +00000210 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 |.........0.@+[P.| +00000220 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 |a...SX...(.X..8.| +00000230 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 |...1Z..f=C.-....| +00000240 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 40 20 |.. d8.$:....}.@ | +00000250 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c |._...a..v......\| +00000260 ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c |.....l..s..Cw...| +00000270 f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db 46 06 |....@.a.Lr+...F.| +00000280 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 |.M...>...B...=.`| +00000290 84 5c 21 d3 3b e9 fa e7 16 03 03 00 04 0e 00 00 |.\!.;...........| +000002a0 00 |.| +>>> Flow 3 (client to server) +00000000 16 03 03 00 86 10 00 00 82 00 80 bc bb c4 2a df |..............*.| +00000010 56 75 8b 3e e1 cd 12 f8 58 29 4d 4d ab f0 12 0c |Vu.>....X)MM....| +00000020 d7 20 3b cb d5 68 5e c1 a4 03 89 f7 d4 f4 ee c9 |. ;..h^.........| +00000030 38 8e bb 42 de e4 fb c6 9f df db 7f af 6c ae b5 |8..B.........l..| +00000040 6a 99 70 3c 1e 88 38 22 aa 1e 81 51 1e 7d 36 31 |j.p<..8"...Q.}61| +00000050 4e d2 a9 08 c0 bc 11 d8 27 41 26 75 f3 35 74 74 |N.......'A&u.5tt| +00000060 ef 50 0e 2b bd da 41 ed 81 56 b9 e4 13 74 e9 80 |.P.+..A..V...t..| +00000070 9f a2 90 d1 fd 85 26 02 f3 aa 75 53 d9 58 bc 2f |......&...uS.X./| +00000080 3b e5 60 cb f8 ac e6 32 6e 5f 80 14 03 03 00 01 |;.`....2n_......| +00000090 01 16 03 03 00 30 8c e6 a6 6a 76 aa 84 32 0c 6b |.....0...jv..2.k| +000000a0 17 41 9d 56 46 46 5c 34 a1 37 d5 7f e6 ab 55 de |.A.VFF\4.7....U.| +000000b0 70 54 69 0a 6d 18 1c 14 87 ee 73 8b f9 57 37 2f |pTi.m.....s..W7/| +000000c0 2e bb 07 4c f1 a9 |...L..| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 30 00 00 00 00 00 |..........0.....| +00000010 00 00 00 49 b9 2a 89 cb 6e 15 d4 a6 f7 24 a5 3a |...I.*..n....$.:| +00000020 da f3 5b ac ff 43 a2 a6 5b 27 36 9c 6d 55 ba c8 |..[..C..['6.mU..| +00000030 f4 77 f7 44 8c bc a7 5e 3f c6 59 17 03 03 00 30 |.w.D...^?.Y....0| +00000040 00 00 00 00 00 00 00 00 44 44 d7 76 36 88 a6 84 |........DD.v6...| +00000050 02 27 40 d6 d1 bb a5 20 41 d5 06 66 3a 56 05 94 |.'@.... A..f:V..| +00000060 41 97 fc 85 95 70 28 85 7a 7a ce 43 71 5d ad a8 |A....p(.zz.Cq]..| +00000070 15 03 03 00 20 00 00 00 00 00 00 00 00 8e 63 57 |.... .........cW| +00000080 61 6d c1 0b ca ea 89 9e b4 9e 6d fb 9f 3b 2a fc |am........m..;*.| +00000090 a0 56 d1 21 5d |.V.!]| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-RSA-AES b/go/src/crypto/tls/testdata/Server-TLSv12-RSA-AES new file mode 100644 index 0000000000000000000000000000000000000000..68a1cb1bc3fd05786497f4c256892996e5be6dbd --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-RSA-AES @@ -0,0 +1,82 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 6d 01 00 00 69 03 03 0a b6 18 8a 8f |....m...i.......| +00000010 90 e2 fb ee cd e3 d5 62 53 17 45 bd b3 7f 53 4d |.......bS.E...SM| +00000020 4e 06 62 66 25 60 b1 3f 96 b0 21 00 00 04 00 2f |N.bf%`.?..!..../| +00000030 00 ff 01 00 00 3c 00 16 00 00 00 17 00 00 00 0d |.....<..........| +00000040 00 30 00 2e 04 03 05 03 06 03 08 07 08 08 08 09 |.0..............| +00000050 08 0a 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 |................| +00000060 03 03 02 03 03 01 02 01 03 02 02 02 04 02 05 02 |................| +00000070 06 02 |..| +>>> Flow 2 (server to client) +00000000 16 03 03 00 35 02 00 00 31 03 03 00 00 00 00 00 |....5...1.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 2f 00 00 |...DOWNGRD.../..| +00000030 09 ff 01 00 01 00 00 17 00 00 16 03 03 02 59 0b |..............Y.| +00000040 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 82 01 |..U..R..O0..K0..| +00000050 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 5b ea |............?.[.| +00000060 a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |.0...*.H........| +00000070 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 |0.1.0...U....Go1| +00000080 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 6f 6f |.0...U....Go Roo| +00000090 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 30 30 |t0...16010100000| +000000a0 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 30 30 |0Z..250101000000| +000000b0 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 47 6f |Z0.1.0...U....Go| +000000c0 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 81 9f |1.0...U....Go0..| +000000d0 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 |0...*.H.........| +000000e0 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 2e 12 |...0.......F}...| +000000f0 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 |'.H..(!.~...]..R| +00000100 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 |E.z6G....B[.....| +00000110 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 |y.@.Om..+.....g.| +00000120 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 |...."8.J.ts+.4..| +00000130 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 |....t{.X.la<..A.| +00000140 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf |.++$#w[.;.u]. T.| +00000150 a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 |.c...$....P....C| +00000160 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 |...ub...R.......| +00000170 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 ff 04 |..0..0...U......| +00000180 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 30 14 |.....0...U.%..0.| +00000190 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 01 05 |..+.........+...| +000001a0 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 |....0...U.......| +000001b0 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f 91 16 |0.0...U.........| +000001c0 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 |.CC>I..m....`0..| +000001d0 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d 13 7e |.U.#..0...H.IM.~| +000001e0 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 55 1d |.1......n{0...U.| +000001f0 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 2e 67 |...0...example.g| +00000200 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 0d 01 |olang0...*.H....| +00000210 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 |.........0.@+[P.| +00000220 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 |a...SX...(.X..8.| +00000230 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 |...1Z..f=C.-....| +00000240 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 40 20 |.. d8.$:....}.@ | +00000250 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c |._...a..v......\| +00000260 ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c |.....l..s..Cw...| +00000270 f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db 46 06 |....@.a.Lr+...F.| +00000280 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 |.M...>...B...=.`| +00000290 84 5c 21 d3 3b e9 fa e7 16 03 03 00 04 0e 00 00 |.\!.;...........| +000002a0 00 |.| +>>> Flow 3 (client to server) +00000000 16 03 03 00 86 10 00 00 82 00 80 19 dc d4 4c b0 |..............L.| +00000010 5c 30 24 b8 fd e1 cd 4e af bc c3 f5 78 12 8c 51 |\0$....N....x..Q| +00000020 a9 a9 ab fd 87 72 a4 bc 0c fc 87 5e 1d af 67 02 |.....r.....^..g.| +00000030 13 c5 c2 8c 00 5f 33 d1 86 43 50 b3 3a 1d b8 69 |....._3..CP.:..i| +00000040 b1 2f ce 82 cd 8d 31 0d 15 c1 fb af b3 47 64 57 |./....1......GdW| +00000050 38 24 33 46 03 d5 ba 33 36 a0 eb de 21 2b ae 64 |8$3F...36...!+.d| +00000060 cc 0c 43 fe a3 7b 34 a1 d2 de d5 85 ec ac c7 0d |..C..{4.........| +00000070 04 ec 63 62 ab fe 86 ba e9 ee 31 2c 09 84 13 6a |..cb......1,...j| +00000080 10 bc 0f 71 93 9d e8 c4 e3 f6 a9 14 03 03 00 01 |...q............| +00000090 01 16 03 03 00 40 b7 75 28 6e 6b 9a 60 8f fc 5b |.....@.u(nk.`..[| +000000a0 91 0a 16 54 ec b1 4b 55 b8 b2 5c 53 48 92 aa dc |...T..KU..\SH...| +000000b0 55 64 2c b0 dc 77 b4 6f 7a a9 23 9c 44 8b 74 64 |Ud,..w.oz.#.D.td| +000000c0 c5 28 ea c7 8d 97 9b c8 a3 ec 11 d7 93 81 08 20 |.(............. | +000000d0 9c 2f 79 32 92 45 |./y2.E| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| +00000010 00 00 00 00 00 00 00 00 00 00 00 92 50 e8 02 a0 |............P...| +00000020 14 d6 03 5d db bb 29 21 09 a3 71 08 54 f3 5e 7c |...]..)!..q.T.^|| +00000030 9a 64 18 f3 4f 64 84 4d b7 e9 82 a8 2c 3b 46 70 |.d..Od.M....,;Fp| +00000040 cb cb de b5 e3 c3 12 d5 7b 6f 08 17 03 03 00 40 |........{o.....@| +00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000060 4f 4f fe dd e5 b1 38 6b b1 2f 5d 23 8b b2 34 b1 |OO....8k./]#..4.| +00000070 c6 9f 8d 32 83 5f b5 36 0b df a6 aa 3f 90 30 b7 |...2._.6....?.0.| +00000080 1d 66 26 89 29 ab 71 dc 00 14 d6 8e 7e 47 bd ee |.f&.).q.....~G..| +00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| +000000a0 00 00 00 00 00 e3 72 e5 7c 8c c6 f5 72 ba 37 52 |......r.|...r.7R| +000000b0 be 38 a0 a2 62 71 d9 f6 a2 9e b5 4a af 0f 13 3e |.8..bq.....J...>| +000000c0 3c 85 ab ea eb |<....| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-RSA-AES-GCM b/go/src/crypto/tls/testdata/Server-TLSv12-RSA-AES-GCM new file mode 100644 index 0000000000000000000000000000000000000000..8d8c3b4022a36e3431385c2320c1f4d3f53a9c5e --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-RSA-AES-GCM @@ -0,0 +1,81 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 85 01 00 00 81 03 03 6e 70 d5 90 98 |...........np...| +00000010 0a 70 40 22 4f 31 e8 7d a0 81 bd 22 e8 4e 97 8b |.p@"O1.}...".N..| +00000020 4d bb 3d d1 d6 2f 09 b9 bd 2f 43 00 00 04 c0 2f |M.=../.../C..../| +00000030 00 ff 01 00 00 54 00 0b 00 04 03 00 01 02 00 0a |.....T..........| +00000040 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 16 |................| +00000050 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 05 03 |.........0......| +00000060 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 |................| +00000070 08 06 04 01 05 01 06 01 03 03 02 03 03 01 02 01 |................| +00000080 03 02 02 02 04 02 05 02 06 02 |..........| +>>> Flow 2 (server to client) +00000000 16 03 03 00 3b 02 00 00 37 03 03 00 00 00 00 00 |....;...7.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 c0 2f 00 00 |...DOWNGRD.../..| +00000030 0f ff 01 00 01 00 00 17 00 00 00 0b 00 02 01 00 |................| +00000040 16 03 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 |....Y...U..R..O0| +00000050 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 |..K0............| +00000060 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 86 f7 |..?.[..0...*.H..| +00000070 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 55 04 |......0.1.0...U.| +00000080 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 13 07 |...Go1.0...U....| +00000090 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 31 30 |Go Root0...16010| +000000a0 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 30 31 |1000000Z..250101| +000000b0 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 03 55 |000000Z0.1.0...U| +000000c0 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 03 13 |....Go1.0...U...| +000000d0 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d |.Go0..0...*.H...| +000000e0 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 |.........0......| +000000f0 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab 7e c4 |.F}...'.H..(!.~.| +00000100 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d 92 42 |..]..RE.z6G....B| +00000110 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 |[.....y.@.Om..+.| +00000120 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 |....g....."8.J.t| +00000130 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c |s+.4......t{.X.l| +00000140 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd |a<..A..++$#w[.;.| +00000150 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a |u]. T..c...$....| +00000160 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 |P....C...ub...R.| +00000170 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 |........0..0...U| +00000180 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 |...........0...U| +00000190 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......| +000001a0 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d |..+.......0...U.| +000001b0 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 |......0.0...U...| +000001c0 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d b6 80 |.......CC>I..m..| +000001d0 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 80 10 |..`0...U.#..0...| +000001e0 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b |H.IM.~.1......n{| +000001f0 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 |0...U....0...exa| +00000200 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a |mple.golang0...*| +00000210 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 9d 30 |.H.............0| +00000220 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed 83 28 |.@+[P.a...SX...(| +00000230 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 |.X..8....1Z..f=C| +00000240 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a 00 bc |.-...... d8.$:..| +00000250 cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 76 fd |..}.@ ._...a..v.| +00000260 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb |.....\.....l..s.| +00000270 b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 |.Cw.......@.a.Lr| +00000280 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 |+...F..M...>...B| +00000290 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 |...=.`.\!.;.....| +000002a0 03 00 ac 0c 00 00 a8 03 00 1d 20 2f e5 7d a3 47 |.......... /.}.G| +000002b0 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af |.bC.(.._.).0....| +000002c0 c4 cf c2 ed 90 99 5f 58 cb 3b 74 08 04 00 80 49 |......_X.;t....I| +000002d0 51 c7 81 cd e1 9f 67 83 76 7e 51 19 83 2a 34 47 |Q.....g.v~Q..*4G| +000002e0 5a e8 6d 13 dd e5 44 eb 1a 20 42 ac d3 65 e8 2e |Z.m...D.. B..e..| +000002f0 8d c5 79 56 e6 5e 26 00 9b 2a 80 16 d8 2e af 42 |..yV.^&..*.....B| +00000300 35 b7 0f f8 6a 41 87 b6 c5 6a 37 6e bc 17 5e a4 |5...jA...j7n..^.| +00000310 1f ba 93 33 98 92 92 2e 76 7b 49 55 8d 37 c2 c3 |...3....v{IU.7..| +00000320 d5 65 4a 73 84 28 6c 0a 4b 26 62 61 fa 46 0f 47 |.eJs.(l.K&ba.F.G| +00000330 d5 e5 99 05 57 23 76 6d c9 7b 0d 8d ff 91 98 eb |....W#vm.{......| +00000340 17 96 c0 00 a6 88 3c be 03 5b db e7 a5 84 ae 16 |......<..[......| +00000350 03 03 00 04 0e 00 00 00 |........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 7d 0c 38 84 cd 0b |....%...! }.8...| +00000010 d1 65 02 f7 ab 8b 8b 4e 8f 05 a5 ea 7a 32 db 1b |.e.....N....z2..| +00000020 e7 42 5b 2b 83 95 2b e1 aa 30 14 03 03 00 01 01 |.B[+..+..0......| +00000030 16 03 03 00 28 7d f6 5b 8f 2e 17 84 50 23 db ad |....(}.[....P#..| +00000040 47 84 59 ba e8 d7 ab c5 28 dc 06 51 aa 9c 7a d0 |G.Y.....(..Q..z.| +00000050 6e ae 27 90 e9 aa 92 9e 83 6f 4e eb 6a |n.'......oN.j| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....| +00000010 00 00 00 a5 ec 31 bb 01 5d a3 15 01 22 88 0e f1 |.....1..]..."...| +00000020 2a 21 18 47 10 64 3d f0 d0 fb f8 fd 27 ed 34 88 |*!.G.d=.....'.4.| +00000030 c1 b5 b3 17 03 03 00 25 00 00 00 00 00 00 00 01 |.......%........| +00000040 e4 3c 6a db 2b a9 59 64 d1 3f 4b a0 98 37 52 03 |.>> Flow 1 (client to server) +00000000 16 03 01 00 85 01 00 00 81 03 03 0f 5a 3f b1 98 |............Z?..| +00000010 d1 40 d3 93 3a cf 86 50 56 51 7a b4 1d f5 c8 53 |.@..:..PVQz....S| +00000020 74 9e 5b c3 27 a3 7d fe a3 4a 73 00 00 04 c0 30 |t.[.'.}..Js....0| +00000030 00 ff 01 00 00 54 00 0b 00 04 03 00 01 02 00 0a |.....T..........| +00000040 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 16 |................| +00000050 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 05 03 |.........0......| +00000060 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 |................| +00000070 08 06 04 01 05 01 06 01 03 03 02 03 03 01 02 01 |................| +00000080 03 02 02 02 04 02 05 02 06 02 |..........| +>>> Flow 2 (server to client) +00000000 16 03 03 00 3b 02 00 00 37 03 03 00 00 00 00 00 |....;...7.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 c0 30 00 00 |...DOWNGRD...0..| +00000030 0f ff 01 00 01 00 00 17 00 00 00 0b 00 02 01 00 |................| +00000040 16 03 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 |....Y...U..R..O0| +00000050 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 |..K0............| +00000060 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 86 f7 |..?.[..0...*.H..| +00000070 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 55 04 |......0.1.0...U.| +00000080 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 13 07 |...Go1.0...U....| +00000090 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 31 30 |Go Root0...16010| +000000a0 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 30 31 |1000000Z..250101| +000000b0 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 03 55 |000000Z0.1.0...U| +000000c0 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 03 13 |....Go1.0...U...| +000000d0 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d |.Go0..0...*.H...| +000000e0 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 |.........0......| +000000f0 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab 7e c4 |.F}...'.H..(!.~.| +00000100 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d 92 42 |..]..RE.z6G....B| +00000110 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 |[.....y.@.Om..+.| +00000120 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 |....g....."8.J.t| +00000130 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c |s+.4......t{.X.l| +00000140 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd |a<..A..++$#w[.;.| +00000150 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a |u]. T..c...$....| +00000160 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 |P....C...ub...R.| +00000170 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 |........0..0...U| +00000180 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 |...........0...U| +00000190 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......| +000001a0 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d |..+.......0...U.| +000001b0 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 |......0.0...U...| +000001c0 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d b6 80 |.......CC>I..m..| +000001d0 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 80 10 |..`0...U.#..0...| +000001e0 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b |H.IM.~.1......n{| +000001f0 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 |0...U....0...exa| +00000200 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a |mple.golang0...*| +00000210 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 9d 30 |.H.............0| +00000220 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed 83 28 |.@+[P.a...SX...(| +00000230 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 |.X..8....1Z..f=C| +00000240 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a 00 bc |.-...... d8.$:..| +00000250 cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 76 fd |..}.@ ._...a..v.| +00000260 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb |.....\.....l..s.| +00000270 b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 |.Cw.......@.a.Lr| +00000280 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 |+...F..M...>...B| +00000290 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 |...=.`.\!.;.....| +000002a0 03 00 ac 0c 00 00 a8 03 00 1d 20 2f e5 7d a3 47 |.......... /.}.G| +000002b0 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af |.bC.(.._.).0....| +000002c0 c4 cf c2 ed 90 99 5f 58 cb 3b 74 08 04 00 80 da |......_X.;t.....| +000002d0 4d 5e f1 10 1f ed 70 d1 88 7a 22 79 6e 5c c9 4c |M^....p..z"yn\.L| +000002e0 e3 e7 a2 bd f4 3d f4 75 dc a3 85 5e f1 af 55 6f |.....=.u...^..Uo| +000002f0 e3 36 21 c6 8a 44 e9 58 29 89 32 4d 14 90 9d 1b |.6!..D.X).2M....| +00000300 bd 0e fa c3 eb 40 5d 05 5d ba 58 55 3e f9 30 b8 |.....@].].XU>.0.| +00000310 8f 56 35 71 12 33 92 0e 14 f9 90 2c ee 36 03 50 |.V5q.3.....,.6.P| +00000320 1c f6 76 a7 99 3e fd bb 5f 21 96 c5 56 1e ed 28 |..v..>.._!..V..(| +00000330 00 0b cd ac cd 70 1a 7e 2d 2d 7d 1d 76 7d e6 89 |.....p.~--}.v}..| +00000340 ba 35 dc e1 9f 48 39 ff 9e a9 48 77 8e d3 71 16 |.5...H9...Hw..q.| +00000350 03 03 00 04 0e 00 00 00 |........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 80 4d 7d 95 1c e0 |....%...! .M}...| +00000010 d5 c1 f6 6d 43 92 08 23 82 cb 30 e0 d7 15 d8 51 |...mC..#..0....Q| +00000020 14 2f 8a 1c 3a 07 be d9 96 54 14 03 03 00 01 01 |./..:....T......| +00000030 16 03 03 00 28 00 a6 4e 03 ff 76 94 d4 b8 c6 c5 |....(..N..v.....| +00000040 7d 4d 2b 7e 5d 4f 5c b8 5a 78 46 c9 0f ce 57 7f |}M+~]O\.ZxF...W.| +00000050 02 a0 1a 83 b1 92 3f 96 ce 8a 00 8f 30 |......?.....0| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....| +00000010 00 00 00 2f ec 4b c3 a6 99 1f ab 91 62 01 d5 e6 |.../.K......b...| +00000020 93 23 20 7e b8 61 be 90 a0 10 e3 f1 8a 82 f9 bc |.# ~.a..........| +00000030 27 fe 65 17 03 03 00 25 00 00 00 00 00 00 00 01 |'.e....%........| +00000040 54 bd d1 e8 02 9a ab fa 2f d1 19 e9 45 81 05 d1 |T......./...E...| +00000050 ba d2 d7 77 54 88 cc fe 14 b3 3b d1 28 15 03 03 |...wT.....;.(...| +00000060 00 1a 00 00 00 00 00 00 00 02 de 3f 93 32 6e f5 |...........?.2n.| +00000070 07 60 ed 65 6f 81 62 90 52 f6 4a a2 |.`.eo.b.R.J.| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-RSA-RC4 b/go/src/crypto/tls/testdata/Server-TLSv12-RSA-RC4 new file mode 100644 index 0000000000000000000000000000000000000000..30b00f6532ce9afa0e5ff280efc7ece5e168a3a0 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-RSA-RC4 @@ -0,0 +1,74 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 6d 01 00 00 69 03 03 dd 92 e1 75 15 |....m...i.....u.| +00000010 1d 9f 00 c5 2b 8a 14 86 aa 93 7c c0 32 2a 29 14 |....+.....|.2*).| +00000020 38 75 ce 62 a7 df c1 4a eb 1e 0c 00 00 04 00 05 |8u.b...J........| +00000030 00 ff 01 00 00 3c 00 16 00 00 00 17 00 00 00 0d |.....<..........| +00000040 00 30 00 2e 04 03 05 03 06 03 08 07 08 08 08 09 |.0..............| +00000050 08 0a 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 |................| +00000060 03 03 02 03 03 01 02 01 03 02 02 02 04 02 05 02 |................| +00000070 06 02 |..| +>>> Flow 2 (server to client) +00000000 16 03 03 00 35 02 00 00 31 03 03 00 00 00 00 00 |....5...1.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 05 00 00 |...DOWNGRD......| +00000030 09 ff 01 00 01 00 00 17 00 00 16 03 03 02 59 0b |..............Y.| +00000040 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 82 01 |..U..R..O0..K0..| +00000050 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 5b ea |............?.[.| +00000060 a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |.0...*.H........| +00000070 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 |0.1.0...U....Go1| +00000080 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 6f 6f |.0...U....Go Roo| +00000090 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 30 30 |t0...16010100000| +000000a0 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 30 30 |0Z..250101000000| +000000b0 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 47 6f |Z0.1.0...U....Go| +000000c0 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 81 9f |1.0...U....Go0..| +000000d0 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 |0...*.H.........| +000000e0 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 2e 12 |...0.......F}...| +000000f0 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 |'.H..(!.~...]..R| +00000100 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 |E.z6G....B[.....| +00000110 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 |y.@.Om..+.....g.| +00000120 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 |...."8.J.ts+.4..| +00000130 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 |....t{.X.la<..A.| +00000140 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf |.++$#w[.;.u]. T.| +00000150 a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 |.c...$....P....C| +00000160 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 |...ub...R.......| +00000170 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 ff 04 |..0..0...U......| +00000180 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 30 14 |.....0...U.%..0.| +00000190 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 01 05 |..+.........+...| +000001a0 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 |....0...U.......| +000001b0 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f 91 16 |0.0...U.........| +000001c0 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 |.CC>I..m....`0..| +000001d0 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d 13 7e |.U.#..0...H.IM.~| +000001e0 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 55 1d |.1......n{0...U.| +000001f0 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 2e 67 |...0...example.g| +00000200 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 0d 01 |olang0...*.H....| +00000210 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 |.........0.@+[P.| +00000220 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 |a...SX...(.X..8.| +00000230 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 |...1Z..f=C.-....| +00000240 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 40 20 |.. d8.$:....}.@ | +00000250 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c |._...a..v......\| +00000260 ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c |.....l..s..Cw...| +00000270 f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db 46 06 |....@.a.Lr+...F.| +00000280 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 |.M...>...B...=.`| +00000290 84 5c 21 d3 3b e9 fa e7 16 03 03 00 04 0e 00 00 |.\!.;...........| +000002a0 00 |.| +>>> Flow 3 (client to server) +00000000 16 03 03 00 86 10 00 00 82 00 80 8d bb 5a 48 87 |.............ZH.| +00000010 95 ca 2d eb a8 47 de 35 4d 70 3e 89 a1 ce c5 8d |..-..G.5Mp>.....| +00000020 02 95 f6 ac e6 2f 1f ae c5 4a 82 08 22 d5 89 0b |...../...J.."...| +00000030 c1 0e be 18 39 d0 e9 e5 ed 87 92 6e 61 3f 68 e5 |....9......na?h.| +00000040 ed 1d a5 cc 43 d1 42 28 be 4d 31 11 27 f7 dd 25 |....C.B(.M1.'..%| +00000050 58 b7 fc 76 bb 7c 06 d8 c2 69 0a 87 2b 54 bf 4e |X..v.|...i..+T.N| +00000060 8a fa 54 db 78 d4 98 51 21 e4 32 28 49 31 51 c0 |..T.x..Q!.2(I1Q.| +00000070 a8 7e f0 97 d9 f3 f7 18 d7 a9 74 79 4d 2f 3f df |.~........tyM/?.| +00000080 b1 25 88 9e 15 cf 94 42 15 68 65 14 03 03 00 01 |.%.....B.he.....| +00000090 01 16 03 03 00 24 cb ac 7c 7c 16 02 a9 08 c3 53 |.....$..||.....S| +000000a0 b8 0e ee 24 fa 51 e0 ce 37 40 e7 f2 ab 93 3d 81 |...$.Q..7@....=.| +000000b0 58 49 96 0e e7 54 43 67 42 1b |XI...TCgB.| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 24 e4 2f 5e 7f 6f |..........$./^.o| +00000010 46 22 85 a0 2d 5a fd 36 0b 9f eb 26 80 89 1d 7e |F"..-Z.6...&...~| +00000020 ca 57 a7 f5 5d 54 1c e4 85 77 f5 28 54 a5 15 17 |.W..]T...w.(T...| +00000030 03 03 00 21 84 a2 f5 c9 e4 df b4 31 8a cf 04 77 |...!.......1...w| +00000040 22 ab 93 9a ae d2 45 d0 d1 7d 42 11 92 b6 b5 1c |".....E..}B.....| +00000050 ac 60 0b d1 9e 15 03 03 00 16 ed f3 12 75 df bc |.`...........u..| +00000060 32 e6 c3 fa 74 7a 32 c6 d7 21 67 0a df be b1 15 |2...tz2..!g.....| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-RSA-RSAPKCS1v15 b/go/src/crypto/tls/testdata/Server-TLSv12-RSA-RSAPKCS1v15 new file mode 100644 index 0000000000000000000000000000000000000000..1c7bceae069c669ff62a39ee2357d66ac8bb248c --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-RSA-RSAPKCS1v15 @@ -0,0 +1,77 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 59 01 00 00 55 03 03 01 3d 46 ff b5 |....Y...U...=F..| +00000010 47 eb 03 bd 9b 27 66 92 92 db 11 f9 58 1d 21 ba |G....'f.....X.!.| +00000020 b9 51 90 81 d0 8f 7e 3c cd 7b b8 00 00 04 cc a8 |.Q....~<.{......| +00000030 00 ff 01 00 00 28 00 0b 00 04 03 00 01 02 00 0a |.....(..........| +00000040 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 16 |................| +00000050 00 00 00 17 00 00 00 0d 00 04 00 02 04 01 |..............| +>>> Flow 2 (server to client) +00000000 16 03 03 00 3b 02 00 00 37 03 03 00 00 00 00 00 |....;...7.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 cc a8 00 00 |...DOWNGRD......| +00000030 0f ff 01 00 01 00 00 17 00 00 00 0b 00 02 01 00 |................| +00000040 16 03 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 |....Y...U..R..O0| +00000050 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 |..K0............| +00000060 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 86 f7 |..?.[..0...*.H..| +00000070 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 55 04 |......0.1.0...U.| +00000080 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 13 07 |...Go1.0...U....| +00000090 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 31 30 |Go Root0...16010| +000000a0 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 30 31 |1000000Z..250101| +000000b0 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 03 55 |000000Z0.1.0...U| +000000c0 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 03 13 |....Go1.0...U...| +000000d0 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d |.Go0..0...*.H...| +000000e0 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 |.........0......| +000000f0 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab 7e c4 |.F}...'.H..(!.~.| +00000100 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d 92 42 |..]..RE.z6G....B| +00000110 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 |[.....y.@.Om..+.| +00000120 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 |....g....."8.J.t| +00000130 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c |s+.4......t{.X.l| +00000140 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd |a<..A..++$#w[.;.| +00000150 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a |u]. T..c...$....| +00000160 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 |P....C...ub...R.| +00000170 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 |........0..0...U| +00000180 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 |...........0...U| +00000190 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......| +000001a0 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d |..+.......0...U.| +000001b0 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 |......0.0...U...| +000001c0 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d b6 80 |.......CC>I..m..| +000001d0 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 80 10 |..`0...U.#..0...| +000001e0 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b |H.IM.~.1......n{| +000001f0 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 |0...U....0...exa| +00000200 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a |mple.golang0...*| +00000210 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 9d 30 |.H.............0| +00000220 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed 83 28 |.@+[P.a...SX...(| +00000230 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 |.X..8....1Z..f=C| +00000240 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a 00 bc |.-...... d8.$:..| +00000250 cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 76 fd |..}.@ ._...a..v.| +00000260 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb |.....\.....l..s.| +00000270 b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 |.Cw.......@.a.Lr| +00000280 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 |+...F..M...>...B| +00000290 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 |...=.`.\!.;.....| +000002a0 03 00 ac 0c 00 00 a8 03 00 1d 20 2f e5 7d a3 47 |.......... /.}.G| +000002b0 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af |.bC.(.._.).0....| +000002c0 c4 cf c2 ed 90 99 5f 58 cb 3b 74 04 01 00 80 21 |......_X.;t....!| +000002d0 b5 82 7e 5a 7d 93 55 15 db e1 eb cc 62 8d f8 45 |..~Z}.U.....b..E| +000002e0 2f e0 5d 57 51 08 80 86 b6 43 85 0f be f7 49 ca |/.]WQ....C....I.| +000002f0 97 f2 f1 20 51 e6 29 8d c6 88 91 e3 60 8c 88 69 |... Q.).....`..i| +00000300 73 9b 38 70 ad 2f 5b 44 62 05 05 20 28 92 57 f9 |s.8p./[Db.. (.W.| +00000310 51 6e 6b 8c b7 3f c3 6e a3 53 b9 bd 02 bd 69 ae |Qnk..?.n.S....i.| +00000320 ee 5f 96 57 7b a2 02 86 70 33 6b e7 ad 03 25 13 |._.W{...p3k...%.| +00000330 10 f8 d7 cb 2e 33 b2 1f 53 64 77 d1 e5 8a 32 bc |.....3..Sdw...2.| +00000340 e0 bc 65 9d 94 de fb 9a d5 66 00 7a 79 dc da 16 |..e......f.zy...| +00000350 03 03 00 04 0e 00 00 00 |........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 6d d3 b6 6a f0 ac |....%...! m..j..| +00000010 40 6e e8 73 db a2 04 41 6a 7f c1 cc ae 13 44 e1 |@n.s...Aj.....D.| +00000020 1c f4 5a 59 1b 88 4b a8 89 61 14 03 03 00 01 01 |..ZY..K..a......| +00000030 16 03 03 00 20 5f 09 a4 44 8e a8 6d 09 14 32 05 |.... _..D..m..2.| +00000040 ce ae f9 ad ad a2 d9 45 77 be e2 2c bd 97 22 1a |.......Ew..,..".| +00000050 7d 3b 54 db 82 |};T..| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 20 54 52 24 a8 3a |.......... TR$.:| +00000010 e3 45 a2 49 1c c5 10 62 6e d1 32 fe 70 0f 32 e0 |.E.I...bn.2.p.2.| +00000020 fc 95 22 81 32 38 ab f2 0a ba 6c 17 03 03 00 1d |..".28....l.....| +00000030 b7 a9 2a a5 ad e5 9e 39 cc a9 bc 81 ef a1 67 e1 |..*....9......g.| +00000040 85 08 9f f4 e7 04 c8 0b 0d fd 5c ec 94 15 03 03 |..........\.....| +00000050 00 12 d7 18 99 08 6c 98 dc 05 20 19 cd dd f2 29 |......l... ....)| +00000060 14 3c cf 31 |.<.1| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-RSA-RSAPSS b/go/src/crypto/tls/testdata/Server-TLSv12-RSA-RSAPSS new file mode 100644 index 0000000000000000000000000000000000000000..46ee1aae45807f13a40c1a038b29d66219f74380 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-RSA-RSAPSS @@ -0,0 +1,77 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 5b 01 00 00 57 03 03 ee 47 d0 cd 83 |....[...W...G...| +00000010 ff 1e f3 45 81 2e 59 6a 84 da c9 29 bd b0 8b f5 |...E..Yj...)....| +00000020 3c 47 58 b0 94 59 33 9a f6 00 2d 00 00 04 cc a8 |>> Flow 2 (server to client) +00000000 16 03 03 00 3b 02 00 00 37 03 03 00 00 00 00 00 |....;...7.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 cc a8 00 00 |...DOWNGRD......| +00000030 0f ff 01 00 01 00 00 17 00 00 00 0b 00 02 01 00 |................| +00000040 16 03 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 |....Y...U..R..O0| +00000050 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 |..K0............| +00000060 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 86 f7 |..?.[..0...*.H..| +00000070 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 55 04 |......0.1.0...U.| +00000080 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 13 07 |...Go1.0...U....| +00000090 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 31 30 |Go Root0...16010| +000000a0 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 30 31 |1000000Z..250101| +000000b0 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 03 55 |000000Z0.1.0...U| +000000c0 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 03 13 |....Go1.0...U...| +000000d0 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d |.Go0..0...*.H...| +000000e0 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 |.........0......| +000000f0 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab 7e c4 |.F}...'.H..(!.~.| +00000100 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d 92 42 |..]..RE.z6G....B| +00000110 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 |[.....y.@.Om..+.| +00000120 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 |....g....."8.J.t| +00000130 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c |s+.4......t{.X.l| +00000140 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd |a<..A..++$#w[.;.| +00000150 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a |u]. T..c...$....| +00000160 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 |P....C...ub...R.| +00000170 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 |........0..0...U| +00000180 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 |...........0...U| +00000190 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......| +000001a0 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d |..+.......0...U.| +000001b0 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 |......0.0...U...| +000001c0 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d b6 80 |.......CC>I..m..| +000001d0 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 80 10 |..`0...U.#..0...| +000001e0 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b |H.IM.~.1......n{| +000001f0 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 |0...U....0...exa| +00000200 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a |mple.golang0...*| +00000210 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 9d 30 |.H.............0| +00000220 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed 83 28 |.@+[P.a...SX...(| +00000230 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 |.X..8....1Z..f=C| +00000240 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a 00 bc |.-...... d8.$:..| +00000250 cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 76 fd |..}.@ ._...a..v.| +00000260 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb |.....\.....l..s.| +00000270 b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 |.Cw.......@.a.Lr| +00000280 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 |+...F..M...>...B| +00000290 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 |...=.`.\!.;.....| +000002a0 03 00 ac 0c 00 00 a8 03 00 1d 20 2f e5 7d a3 47 |.......... /.}.G| +000002b0 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af |.bC.(.._.).0....| +000002c0 c4 cf c2 ed 90 99 5f 58 cb 3b 74 08 04 00 80 95 |......_X.;t.....| +000002d0 e0 3f 63 8b d7 e0 51 5a eb ea 5e de ce da 62 02 |.?c...QZ..^...b.| +000002e0 7d 7d 42 7f 9f db 53 a2 a9 e5 be b4 32 47 65 9a |}}B...S.....2Ge.| +000002f0 cc d6 9f ee 4c bc 28 7d 27 00 69 e2 fa fd fa 65 |....L.(}'.i....e| +00000300 a0 3d c1 00 85 a9 28 8c d1 9b 6d 49 2f 84 17 b0 |.=....(...mI/...| +00000310 59 cd ac 79 a8 6d cc 8a a0 05 e9 ca e8 df 14 2d |Y..y.m.........-| +00000320 a0 59 a3 75 a6 c6 ec 91 37 e1 e6 dc 6d d8 74 96 |.Y.u....7...m.t.| +00000330 95 bc ff 11 ca fe 91 4a d6 9e d7 73 5f bd 28 6a |.......J...s_.(j| +00000340 23 6d c5 2b ee 25 17 6c e1 50 c1 f9 42 7e 3c 16 |#m.+.%.l.P..B~<.| +00000350 03 03 00 04 0e 00 00 00 |........| +>>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 51 de e0 c4 a5 8f |....%...! Q.....| +00000010 ee 05 c5 d5 a2 ce 9c 4a 19 6d 14 cb 61 88 a6 fe |.......J.m..a...| +00000020 38 24 b6 4e d7 f0 c5 27 97 32 14 03 03 00 01 01 |8$.N...'.2......| +00000030 16 03 03 00 20 0e 14 d4 f5 c2 10 a1 80 b3 b4 90 |.... ...........| +00000040 17 43 1f 22 69 78 00 bb 87 c3 78 23 8e 03 8f c4 |.C."ix....x#....| +00000050 28 1c f8 42 e6 |(..B.| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 20 6f a9 ff 13 fb |.......... o....| +00000010 85 fa e4 fc cd ca 74 59 21 cd 3c fd 73 43 a2 48 |......tY!.<.sC.H| +00000020 f5 cf cd f7 9b 24 1d db 8a 52 a6 17 03 03 00 1d |.....$...R......| +00000030 63 25 92 b2 0c f7 d1 92 83 95 3c 13 ee 78 4c c1 |c%........<..xL.| +00000040 60 66 60 ed 8e 86 5b 1d 2d 1b a5 ab 38 15 03 03 |`f`...[.-...8...| +00000050 00 12 d5 3c b4 59 87 f5 45 fc 68 9b 03 7e 5b 97 |...<.Y..E.h..~[.| +00000060 c1 83 13 33 |...3| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-Resume b/go/src/crypto/tls/testdata/Server-TLSv12-Resume new file mode 100644 index 0000000000000000000000000000000000000000..2aac24b1a55f4aa80bf49e13b25068cedc494389 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-Resume @@ -0,0 +1,55 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 0c 01 00 01 08 03 03 a6 8e 75 2d a5 |.............u-.| +00000010 52 ef 15 c3 e3 42 53 88 55 21 76 a9 8c 44 e8 df |R....BS.U!v..D..| +00000020 f4 1c 40 08 1a 35 46 4b 6d 4f ff 20 e3 91 5e 82 |..@..5FKmO. ..^.| +00000030 58 5e 5a 37 a7 16 d8 fe 96 0e 2c 45 13 ac 4f 30 |X^Z7......,E..O0| +00000040 96 a3 17 a2 16 49 00 d6 8e b6 6a 4d 00 04 00 2f |.....I....jM.../| +00000050 00 ff 01 00 00 bb 00 23 00 7b 00 00 00 00 00 00 |.......#.{......| +00000060 00 00 00 00 00 00 00 00 00 00 94 6f 2d b0 ac 51 |...........o-..Q| +00000070 ed 14 ef 68 ca 42 c5 4c 52 2e 96 6b e5 cc b4 0c |...h.B.LR..k....| +00000080 ee 82 5b c1 57 52 8e dd 26 c8 58 27 01 5f ec 58 |..[.WR..&.X'._.X| +00000090 a0 5c ad 74 e8 82 b7 ab 86 71 25 aa ed ec ef 69 |.\.t.....q%....i| +000000a0 5f 7e 1d f2 58 30 13 75 49 38 16 7e 51 5c e5 15 |_~..X0.uI8.~Q\..| +000000b0 c0 58 7d 52 1a 43 47 27 99 9d 0f e0 4c f4 3b e0 |.X}R.CG'....L.;.| +000000c0 b0 76 ae e6 5d a4 a0 34 38 8b b0 3a ba 26 90 a3 |.v..]..48..:.&..| +000000d0 dd c2 dc 26 98 00 16 00 00 00 17 00 00 00 0d 00 |...&............| +000000e0 30 00 2e 04 03 05 03 06 03 08 07 08 08 08 09 08 |0...............| +000000f0 0a 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 03 |................| +00000100 03 02 03 03 01 02 01 03 02 02 02 04 02 05 02 06 |................| +00000110 02 |.| +>>> Flow 2 (server to client) +00000000 16 03 03 00 59 02 00 00 55 03 03 00 00 00 00 00 |....Y...U.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 20 e3 91 5e 82 |...DOWNGRD. ..^.| +00000030 58 5e 5a 37 a7 16 d8 fe 96 0e 2c 45 13 ac 4f 30 |X^Z7......,E..O0| +00000040 96 a3 17 a2 16 49 00 d6 8e b6 6a 4d 00 2f 00 00 |.....I....jM./..| +00000050 0d 00 23 00 00 ff 01 00 01 00 00 17 00 00 16 03 |..#.............| +00000060 03 00 85 04 00 00 81 00 00 00 00 00 7b 00 00 00 |............{...| +00000070 00 00 00 00 00 00 00 00 00 00 00 00 00 94 6f 2d |..............o-| +00000080 b0 ac 51 ed 14 ef 68 ca 42 c5 4c 52 2e 96 6b e5 |..Q...h.B.LR..k.| +00000090 cc b4 0c ee 82 5b c1 57 52 8e dd 26 c8 58 27 01 |.....[.WR..&.X'.| +000000a0 5f ec 58 a0 5c ad 74 e8 82 b7 ab 86 71 25 aa ed |_.X.\.t.....q%..| +000000b0 ec ef 69 5f 7e 1d f2 58 30 13 75 49 38 16 7e 51 |..i_~..X0.uI8.~Q| +000000c0 5c e5 15 c0 58 7d 52 1a 43 47 27 99 9d 0f e0 4c |\...X}R.CG'....L| +000000d0 f4 3b e0 b0 76 ae e6 5d a4 a0 34 38 8b b0 3a ba |.;..v..]..48..:.| +000000e0 26 90 a3 dd c2 dc 26 98 14 03 03 00 01 01 16 03 |&.....&.........| +000000f0 03 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 |..@.............| +00000100 00 00 00 fb 6c 2b 7d a1 a6 a1 aa 6f 38 3f e2 8a |....l+}....o8?..| +00000110 09 da 48 94 ce 2a 70 70 8c d3 5d bd 8c e5 74 fc |..H..*pp..]...t.| +00000120 91 05 dc 9e f1 2d a6 db 3c d6 06 50 b7 9d 4d 8b |.....-..<..P..M.| +00000130 b7 d4 06 |...| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 16 03 03 00 40 b0 47 45 3b 24 |..........@.GE;$| +00000010 ae 4b 98 d6 cc 37 28 ab 3b ea 7e 6b bc 1f ed a5 |.K...7(.;.~k....| +00000020 bb 67 e2 5e 72 bf d5 28 90 dc 1b 98 87 2c 49 c6 |.g.^r..(.....,I.| +00000030 90 73 45 3f 1b 8c a2 c5 50 84 48 09 41 e1 ea 52 |.sE?....P.H.A..R| +00000040 9e 17 ad 8f d6 cd cd 16 7a 90 64 |........z.d| +>>> Flow 4 (server to client) +00000000 17 03 03 00 40 00 00 00 00 00 00 00 00 00 00 00 |....@...........| +00000010 00 00 00 00 00 a6 e7 61 5a 2b 01 ce 94 48 d2 09 |.......aZ+...H..| +00000020 13 a5 90 a8 58 47 8d fd ab 69 85 fa 42 00 3d 99 |....XG...i..B.=.| +00000030 d1 fd 16 88 0b 2a 43 92 54 e7 55 2e dd 70 86 e1 |.....*C.T.U..p..| +00000040 f1 c5 5c c8 1e 15 03 03 00 30 00 00 00 00 00 00 |..\......0......| +00000050 00 00 00 00 00 00 00 00 00 00 ba 42 cf 74 9f 00 |...........B.t..| +00000060 4a 76 d5 cf 48 23 ed 4a 42 62 be 1a 35 d2 8c d2 |Jv..H#.JBb..5...| +00000070 ee 86 2f 3a f5 4d 96 64 f7 b8 |../:.M.d..| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-ResumeDisabled b/go/src/crypto/tls/testdata/Server-TLSv12-ResumeDisabled new file mode 100644 index 0000000000000000000000000000000000000000..9110f54350b9f06a1570ab35eba559eaf6dc9f75 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-ResumeDisabled @@ -0,0 +1,91 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 01 06 01 00 01 02 03 03 dc 6d 25 a7 37 |............m%.7| +00000010 5a 18 ef e8 ba a7 4b cb 25 8b 5a 61 bd fd 99 56 |Z.....K.%.Za...V| +00000020 a8 7f 10 26 f7 f4 e9 3e 16 89 ce 20 ac c3 35 13 |...&...>... ..5.| +00000030 d1 28 31 15 15 2d 6b e9 50 20 07 2c c5 48 6c 21 |.(1..-k.P .,.Hl!| +00000040 78 bf c9 7c c4 39 e7 2e 0a ed 71 21 00 04 00 2f |x..|.9....q!.../| +00000050 00 ff 01 00 00 b5 00 23 00 75 00 00 00 00 00 00 |.......#.u......| +00000060 00 00 00 00 00 00 00 00 00 00 94 6f 2d b0 ac 51 |...........o-..Q| +00000070 ed 14 ef 68 ca 42 c5 4c 22 21 0e 9f b0 e7 07 47 |...h.B.L"!.....G| +00000080 1d 09 01 ee 9b 67 49 2f 06 cb 51 1b d9 33 b3 ff |.....gI/..Q..3..| +00000090 30 6c d4 a3 d6 6b 49 aa f8 2e 20 35 79 5a 76 91 |0l...kI... 5yZv.| +000000a0 46 71 26 91 22 4f 32 50 49 38 16 7f 51 5c e5 47 |Fq&."O2PI8..Q\.G| +000000b0 26 64 f4 0c dd 12 66 59 0d 8f 92 07 ab ff 68 01 |&d....fY......h.| +000000c0 0d d5 54 06 2d 08 b1 09 a1 3c ff f9 bc 78 03 00 |..T.-....<...x..| +000000d0 16 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 05 |..........0.....| +000000e0 03 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 |................| +000000f0 05 08 06 04 01 05 01 06 01 03 03 02 03 03 01 02 |................| +00000100 01 03 02 02 02 04 02 05 02 06 02 |...........| +>>> Flow 2 (server to client) +00000000 16 03 03 00 35 02 00 00 31 03 03 00 00 00 00 00 |....5...1.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 2f 00 00 |...DOWNGRD.../..| +00000030 09 ff 01 00 01 00 00 17 00 00 16 03 03 02 59 0b |..............Y.| +00000040 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 82 01 |..U..R..O0..K0..| +00000050 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 5b ea |............?.[.| +00000060 a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |.0...*.H........| +00000070 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 |0.1.0...U....Go1| +00000080 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 6f 6f |.0...U....Go Roo| +00000090 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 30 30 |t0...16010100000| +000000a0 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 30 30 |0Z..250101000000| +000000b0 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 47 6f |Z0.1.0...U....Go| +000000c0 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 81 9f |1.0...U....Go0..| +000000d0 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 |0...*.H.........| +000000e0 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 2e 12 |...0.......F}...| +000000f0 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 |'.H..(!.~...]..R| +00000100 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 |E.z6G....B[.....| +00000110 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 |y.@.Om..+.....g.| +00000120 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 |...."8.J.ts+.4..| +00000130 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 |....t{.X.la<..A.| +00000140 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf |.++$#w[.;.u]. T.| +00000150 a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 |.c...$....P....C| +00000160 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 |...ub...R.......| +00000170 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 ff 04 |..0..0...U......| +00000180 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 30 14 |.....0...U.%..0.| +00000190 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 01 05 |..+.........+...| +000001a0 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff 04 02 |....0...U.......| +000001b0 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f 91 16 |0.0...U.........| +000001c0 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 |.CC>I..m....`0..| +000001d0 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d 13 7e |.U.#..0...H.IM.~| +000001e0 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 55 1d |.1......n{0...U.| +000001f0 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 2e 67 |...0...example.g| +00000200 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 0d 01 |olang0...*.H....| +00000210 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 |.........0.@+[P.| +00000220 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 |a...SX...(.X..8.| +00000230 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 |...1Z..f=C.-....| +00000240 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 40 20 |.. d8.$:....}.@ | +00000250 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c |._...a..v......\| +00000260 ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c |.....l..s..Cw...| +00000270 f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db 46 06 |....@.a.Lr+...F.| +00000280 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 |.M...>...B...=.`| +00000290 84 5c 21 d3 3b e9 fa e7 16 03 03 00 04 0e 00 00 |.\!.;...........| +000002a0 00 |.| +>>> Flow 3 (client to server) +00000000 16 03 03 00 86 10 00 00 82 00 80 c0 3f 68 b7 3f |............?h.?| +00000010 6c 1f de 6b 2d 67 9e 1b 13 13 ad 67 d8 0f b2 b1 |l..k-g.....g....| +00000020 95 17 e7 0b e1 ba 6f 93 20 43 aa c7 a4 02 8e 38 |......o. C.....8| +00000030 01 6b 53 55 33 6e 82 ea 70 d7 e2 a6 bd be 57 2d |.kSU3n..p.....W-| +00000040 85 1c 4a 28 30 42 34 e6 f9 38 9c 59 ed 1c fc ff |..J(0B4..8.Y....| +00000050 19 0f 1d 71 f1 4b 2a 7a b1 c6 d9 11 a5 5e ca 1c |...q.K*z.....^..| +00000060 14 70 71 4c 3a c8 8d ca d9 4b 57 f8 76 2c 8f 89 |.pqL:....KW.v,..| +00000070 84 41 96 fb 37 2d 17 a9 28 c8 c6 47 1b fb 3d 42 |.A..7-..(..G..=B| +00000080 64 12 8f c7 e7 36 35 bf ce df d7 14 03 03 00 01 |d....65.........| +00000090 01 16 03 03 00 40 47 f9 4a d1 3b af 27 48 8a 15 |.....@G.J.;.'H..| +000000a0 c1 61 61 41 cc c3 4f 1d 9c 86 42 a9 17 1d e3 68 |.aaA..O...B....h| +000000b0 84 1f ae b7 9f 4b 70 be 72 0b 2c 48 88 ea ff 43 |.....Kp.r.,H...C| +000000c0 37 01 cc 37 c0 2d e9 da 8b 94 ef ed f9 02 95 a9 |7..7.-..........| +000000d0 bf 63 0f 6a 7c c0 |.c.j|.| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| +00000010 00 00 00 00 00 00 00 00 00 00 00 4a bf f1 2b 6a |...........J..+j| +00000020 af e5 b9 51 69 38 3e a3 47 bf 0b 67 83 15 e0 91 |...Qi8>.G..g....| +00000030 c6 b3 cb fc 24 05 31 b7 51 3d fa bb 08 9a f9 f8 |....$.1.Q=......| +00000040 89 2a f1 5a b1 a8 1a ed aa 63 00 17 03 03 00 40 |.*.Z.....c.....@| +00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000060 80 37 dc f6 b1 a2 80 91 0e c9 71 c6 1c 1e 45 14 |.7........q...E.| +00000070 50 cd 39 85 73 8a f5 90 75 28 05 ab 69 ae 1a bd |P.9.s...u(..i...| +00000080 b9 ee 39 e8 3f 2d 73 4d 21 fa 2e 05 b4 a1 02 64 |..9.?-sM!......d| +00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| +000000a0 00 00 00 00 00 14 1e f7 64 d8 47 a6 93 aa 03 aa |........d.G.....| +000000b0 7c f3 a2 fb b8 6f cf f2 0d e4 2d d1 d6 67 f3 6b ||....o....-..g.k| +000000c0 ef e3 5d dc 5b |..].[| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-SNI b/go/src/crypto/tls/testdata/Server-TLSv12-SNI new file mode 100644 index 0000000000000000000000000000000000000000..b7889def656bd4e3eda1e8124514082e7bedcf9f --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-SNI @@ -0,0 +1,83 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 81 01 00 00 7d 03 03 5b 8e 50 b3 0e |........}..[.P..| +00000010 1f d7 4f a4 0f 53 de 37 1a c6 86 2f 01 c0 0b 15 |..O..S.7.../....| +00000020 cf a9 f4 f5 30 c0 aa 7e cc 5b 4e 00 00 04 00 2f |....0..~.[N..../| +00000030 00 ff 01 00 00 50 00 00 00 10 00 0e 00 00 0b 73 |.....P.........s| +00000040 6e 69 74 65 73 74 2e 63 6f 6d 00 16 00 00 00 17 |nitest.com......| +00000050 00 00 00 0d 00 30 00 2e 04 03 05 03 06 03 08 07 |.....0..........| +00000060 08 08 08 09 08 0a 08 0b 08 04 08 05 08 06 04 01 |................| +00000070 05 01 06 01 03 03 02 03 03 01 02 01 03 02 02 02 |................| +00000080 04 02 05 02 06 02 |......| +>>> Flow 2 (server to client) +00000000 16 03 03 00 39 02 00 00 35 03 03 00 00 00 00 00 |....9...5.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 2f 00 00 |...DOWNGRD.../..| +00000030 0d ff 01 00 01 00 00 17 00 00 00 00 00 00 16 03 |................| +00000040 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| +00000050 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| +00000060 3f e2 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 |?.[..0...*.H....| +00000070 01 0b 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 |....0.1.0...U...| +00000080 02 47 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f |.Go1.0...U....Go| +00000090 20 52 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 | Root0...1601010| +000000a0 30 30 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 |00000Z..25010100| +000000b0 30 30 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a |0000Z0.1.0...U..| +000000c0 13 02 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 |..Go1.0...U....G| +000000d0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| +000000e0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 |.......0.......F| +000000f0 7d 93 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 |}...'.H..(!.~...| +00000100 5d fe 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 |]..RE.z6G....B[.| +00000110 81 c0 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 |....y.@.Om..+...| +00000120 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b |..g....."8.J.ts+| +00000130 c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c |.4......t{.X.la<| +00000140 c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d |..A..++$#w[.;.u]| +00000150 ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b |. T..c...$....P.| +00000160 aa b6 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 |...C...ub...R...| +00000170 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| +00000180 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| +00000190 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| +000001a0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| +000001b0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| +000001c0 10 9f 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f |.....CC>I..m....| +000001d0 60 30 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 |`0...U.#..0...H.| +000001e0 49 4d 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 |IM.~.1......n{0.| +000001f0 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| +00000200 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| +00000210 86 f7 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 |.............0.@| +00000220 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 |+[P.a...SX...(.X| +00000230 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d |..8....1Z..f=C.-| +00000240 d9 0b f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c |...... d8.$:....| +00000250 7d b7 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 |}.@ ._...a..v...| +00000260 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 |...\.....l..s..C| +00000270 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| +00000280 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| +00000290 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| +000002a0 04 0e 00 00 00 |.....| +>>> Flow 3 (client to server) +00000000 16 03 03 00 86 10 00 00 82 00 80 25 3d 8b d1 c0 |...........%=...| +00000010 ef 86 34 20 a5 4b 4b 94 d9 c8 04 ff 02 13 24 57 |..4 .KK.......$W| +00000020 21 7f f1 c1 06 0b ea 1f b1 06 e8 fa 9b 5c 34 96 |!............\4.| +00000030 23 2a 4b ef cb d7 47 75 05 74 f3 7f ed fb 28 6a |#*K...Gu.t....(j| +00000040 cd b8 16 12 96 4b b7 cf 0c c3 b0 93 c3 ea b0 78 |.....K.........x| +00000050 65 93 9d 6d a9 d5 b7 ed be 8b 3a f6 12 bb 5d ae |e..m......:...].| +00000060 2b 17 2f 62 ca 21 68 7d 12 52 e3 2c cc 32 4b 94 |+./b.!h}.R.,.2K.| +00000070 4b 1d 73 9a 2e 60 60 da e6 32 dd d3 4d 39 69 c8 |K.s..``..2..M9i.| +00000080 b7 9d 8a 1d d8 57 90 13 4c 2a a9 14 03 03 00 01 |.....W..L*......| +00000090 01 16 03 03 00 40 c4 71 f6 06 63 08 15 02 63 0a |.....@.q..c...c.| +000000a0 59 40 55 52 28 17 3f 16 c8 48 93 af 80 87 e6 a8 |Y@UR(.?..H......| +000000b0 37 a4 4f 20 f0 37 88 5b 55 f3 32 60 c7 c4 1d ce |7.O .7.[U.2`....| +000000c0 b2 b8 d1 2d 8b fb a6 87 39 c8 75 31 22 77 33 82 |...-....9.u1"w3.| +000000d0 64 0f f2 10 9d ee |d.....| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| +00000010 00 00 00 00 00 00 00 00 00 00 00 f2 12 bf 38 31 |..............81| +00000020 ee c9 9a 6a 8d fb 1c 53 41 f1 06 3a 44 9c 31 31 |...j...SA..:D.11| +00000030 25 7b 28 08 f5 3a 85 84 f1 83 61 9b 8c e3 cf 79 |%{(..:....a....y| +00000040 3a c2 ce e2 9c b8 52 ca 4f 5c b1 17 03 03 00 40 |:.....R.O\.....@| +00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000060 56 57 a0 ee c3 3e 4a 13 70 d5 05 2a 7d ed 49 81 |VW...>J.p..*}.I.| +00000070 52 37 e0 dc bd d0 e3 de f8 8e 18 a2 8b f8 62 71 |R7............bq| +00000080 7f a9 35 50 91 81 6f 33 63 e3 c5 ec cf fa 1b 05 |..5P..o3c.......| +00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| +000000a0 00 00 00 00 00 e5 05 33 38 e8 33 35 a3 f0 aa f8 |.......38.35....| +000000b0 8c b7 c5 2b 8c d0 9e 40 57 c5 c9 52 61 ae 5e c7 |...+...@W..Ra.^.| +000000c0 50 f1 5a 28 50 |P.Z(P| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificate b/go/src/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificate new file mode 100644 index 0000000000000000000000000000000000000000..b7756a3d10af1b964b540ac29bd1c35b4176eb28 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificate @@ -0,0 +1,83 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 81 01 00 00 7d 03 03 37 94 a0 f3 65 |........}..7...e| +00000010 7b 07 88 ab 9f 29 dd 9a 56 a8 27 84 75 29 4f 24 |{....)..V.'.u)O$| +00000020 ce a2 ef 9b 34 ff 69 06 4c c8 e5 00 00 04 00 2f |....4.i.L....../| +00000030 00 ff 01 00 00 50 00 00 00 10 00 0e 00 00 0b 73 |.....P.........s| +00000040 6e 69 74 65 73 74 2e 63 6f 6d 00 16 00 00 00 17 |nitest.com......| +00000050 00 00 00 0d 00 30 00 2e 04 03 05 03 06 03 08 07 |.....0..........| +00000060 08 08 08 09 08 0a 08 0b 08 04 08 05 08 06 04 01 |................| +00000070 05 01 06 01 03 03 02 03 03 01 02 01 03 02 02 02 |................| +00000080 04 02 05 02 06 02 |......| +>>> Flow 2 (server to client) +00000000 16 03 03 00 39 02 00 00 35 03 03 00 00 00 00 00 |....9...5.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 2f 00 00 |...DOWNGRD.../..| +00000030 0d ff 01 00 01 00 00 17 00 00 00 00 00 00 16 03 |................| +00000040 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| +00000050 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| +00000060 3f e2 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 |?.[..0...*.H....| +00000070 01 0b 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 |....0.1.0...U...| +00000080 02 47 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f |.Go1.0...U....Go| +00000090 20 52 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 | Root0...1601010| +000000a0 30 30 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 |00000Z..25010100| +000000b0 30 30 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a |0000Z0.1.0...U..| +000000c0 13 02 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 |..Go1.0...U....G| +000000d0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| +000000e0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 |.......0.......F| +000000f0 7d 93 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 |}...'.H..(!.~...| +00000100 5d fe 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 |]..RE.z6G....B[.| +00000110 81 c0 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 |....y.@.Om..+...| +00000120 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b |..g....."8.J.ts+| +00000130 c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c |.4......t{.X.la<| +00000140 c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d |..A..++$#w[.;.u]| +00000150 ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b |. T..c...$....P.| +00000160 aa b6 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 |...C...ub...R...| +00000170 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| +00000180 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| +00000190 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| +000001a0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| +000001b0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| +000001c0 10 9f 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f |.....CC>I..m....| +000001d0 60 30 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 |`0...U.#..0...H.| +000001e0 49 4d 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 |IM.~.1......n{0.| +000001f0 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| +00000200 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| +00000210 86 f7 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 |.............0.@| +00000220 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 |+[P.a...SX...(.X| +00000230 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d |..8....1Z..f=C.-| +00000240 d9 0b f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c |...... d8.$:....| +00000250 7d b7 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 |}.@ ._...a..v...| +00000260 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 |...\.....l..s..C| +00000270 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| +00000280 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| +00000290 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| +000002a0 04 0e 00 00 00 |.....| +>>> Flow 3 (client to server) +00000000 16 03 03 00 86 10 00 00 82 00 80 1f fb a2 ec cf |................| +00000010 39 a3 cd db ee 86 8e 22 91 e1 47 5b ac 3b c0 f6 |9......"..G[.;..| +00000020 37 0f d0 b6 19 c5 a4 4c 1a 8f 8b 67 8a 20 0e 06 |7......L...g. ..| +00000030 6a 25 d9 13 58 37 cb dc 9b 3a 0f 9d 12 02 45 3f |j%..X7...:....E?| +00000040 2d 51 f5 cd 9f 45 be 5e f9 af 13 53 c2 15 a6 ca |-Q...E.^...S....| +00000050 8a cb 27 e0 d1 23 7a 19 06 26 d6 86 de 76 e7 9c |..'..#z..&...v..| +00000060 eb f8 15 1d 85 3f be 38 c4 bc 48 c3 74 d4 10 9b |.....?.8..H.t...| +00000070 9e 97 4c 1c 56 18 9d 65 1c be 33 3c 4c 90 e0 e4 |..L.V..e..3.]| +000000b0 3e c1 c2 0c c5 20 eb 76 e1 14 16 95 9c 56 10 67 |>.... .v.....V.g| +000000c0 02 61 2f a6 af 01 b3 64 73 4a 80 53 4a 94 b3 a0 |.a/....dsJ.SJ...| +000000d0 ee b5 95 b6 6a 20 |....j | +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| +00000010 00 00 00 00 00 00 00 00 00 00 00 0e 0d f6 1c 84 |................| +00000020 d7 1a 4b 45 a1 9b e1 22 78 31 89 0c 4d f3 5b b8 |..KE..."x1..M.[.| +00000030 41 22 4f b2 aa 99 9e 5c 7c ff 2d ca db 32 01 eb |A"O....\|.-..2..| +00000040 55 2a f4 66 58 4a c2 fd 9f e5 7e 17 03 03 00 40 |U*.fXJ....~....@| +00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000060 6c e0 c3 a0 c9 bd 12 83 58 56 e7 f4 cf 31 8f 1d |l.......XV...1..| +00000070 02 17 ce 2b 24 1c 2f 04 11 cc b2 15 38 62 d2 7d |...+$./.....8b.}| +00000080 1b 75 bc 20 a6 3a 65 48 2e 47 14 17 19 51 aa 71 |.u. .:eH.G...Q.q| +00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| +000000a0 00 00 00 00 00 34 81 ed 3f e0 b9 5d 01 6e d7 e8 |.....4..?..].n..| +000000b0 45 9f 2c 93 27 28 11 34 b4 a9 32 d5 97 9f ea 05 |E.,.'(.4..2.....| +000000c0 39 90 90 dc e5 |9....| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificateNotFound b/go/src/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificateNotFound new file mode 100644 index 0000000000000000000000000000000000000000..975b9fbe599b79cc56008de6060ec1befcc76eb4 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificateNotFound @@ -0,0 +1,83 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 81 01 00 00 7d 03 03 7a 13 72 a9 8d |........}..z.r..| +00000010 6d 7e 8e 9c ba c1 9d 5c 09 87 9e 2f 7b e1 ba 39 |m~.....\.../{..9| +00000020 f8 ee fd 1c a7 08 61 73 b9 d7 be 00 00 04 00 2f |......as......./| +00000030 00 ff 01 00 00 50 00 00 00 10 00 0e 00 00 0b 73 |.....P.........s| +00000040 6e 69 74 65 73 74 2e 63 6f 6d 00 16 00 00 00 17 |nitest.com......| +00000050 00 00 00 0d 00 30 00 2e 04 03 05 03 06 03 08 07 |.....0..........| +00000060 08 08 08 09 08 0a 08 0b 08 04 08 05 08 06 04 01 |................| +00000070 05 01 06 01 03 03 02 03 03 01 02 01 03 02 02 02 |................| +00000080 04 02 05 02 06 02 |......| +>>> Flow 2 (server to client) +00000000 16 03 03 00 39 02 00 00 35 03 03 00 00 00 00 00 |....9...5.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 2f 00 00 |...DOWNGRD.../..| +00000030 0d ff 01 00 01 00 00 17 00 00 00 00 00 00 16 03 |................| +00000040 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| +00000050 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| +00000060 3f e2 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 |?.[..0...*.H....| +00000070 01 0b 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 |....0.1.0...U...| +00000080 02 47 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f |.Go1.0...U....Go| +00000090 20 52 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 | Root0...1601010| +000000a0 30 30 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 |00000Z..25010100| +000000b0 30 30 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a |0000Z0.1.0...U..| +000000c0 13 02 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 |..Go1.0...U....G| +000000d0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| +000000e0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 |.......0.......F| +000000f0 7d 93 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 |}...'.H..(!.~...| +00000100 5d fe 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 |]..RE.z6G....B[.| +00000110 81 c0 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 |....y.@.Om..+...| +00000120 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b |..g....."8.J.ts+| +00000130 c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c |.4......t{.X.la<| +00000140 c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d |..A..++$#w[.;.u]| +00000150 ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b |. T..c...$....P.| +00000160 aa b6 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 |...C...ub...R...| +00000170 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| +00000180 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| +00000190 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| +000001a0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| +000001b0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| +000001c0 10 9f 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f |.....CC>I..m....| +000001d0 60 30 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 |`0...U.#..0...H.| +000001e0 49 4d 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 |IM.~.1......n{0.| +000001f0 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| +00000200 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| +00000210 86 f7 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 |.............0.@| +00000220 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 |+[P.a...SX...(.X| +00000230 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d |..8....1Z..f=C.-| +00000240 d9 0b f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c |...... d8.$:....| +00000250 7d b7 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 |}.@ ._...a..v...| +00000260 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 |...\.....l..s..C| +00000270 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| +00000280 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| +00000290 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| +000002a0 04 0e 00 00 00 |.....| +>>> Flow 3 (client to server) +00000000 16 03 03 00 86 10 00 00 82 00 80 6a be 75 35 e3 |...........j.u5.| +00000010 38 f9 8e b5 c3 64 bb 5f 95 95 5e 2c 6a 61 84 8d |8....d._..^,ja..| +00000020 aa 41 88 de 30 55 ba ae 38 48 e5 d9 19 fa ad 09 |.A..0U..8H......| +00000030 94 16 93 df 08 4a a6 0b 0b 53 2a 2a 37 65 cb ed |.....J...S**7e..| +00000040 2c 07 6b 7d 99 6e 14 1d 9b de 60 e8 25 da 0d c5 |,.k}.n....`.%...| +00000050 73 e5 a9 87 25 ce c7 8f 68 88 c5 68 14 ee ac 91 |s...%...h..h....| +00000060 ab 44 fe 31 e0 b5 e1 cd 9b 56 b7 0a 5a d6 b3 54 |.D.1.....V..Z..T| +00000070 9c aa 30 17 ea e2 8c b5 61 89 a7 b1 96 d6 25 0f |..0.....a.....%.| +00000080 30 91 ba 95 2e a8 c0 53 ad 18 e4 14 03 03 00 01 |0......S........| +00000090 01 16 03 03 00 40 b1 5f 16 fb 6e 9d 3b 05 20 be |.....@._..n.;. .| +000000a0 19 0e 6d 74 c1 4a aa 00 db af 58 92 4a 83 f3 23 |..mt.J....X.J..#| +000000b0 e2 6c 0f f2 00 08 0f fd f4 f8 71 b3 c3 8e 8c 57 |.l........q....W| +000000c0 db 98 ff d6 7c f9 26 0b 13 8c 83 36 32 9a 5a 58 |....|.&....62.ZX| +000000d0 0a 41 7d 3f 30 c0 |.A}?0.| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| +00000010 00 00 00 00 00 00 00 00 00 00 00 88 5b 28 f3 14 |............[(..| +00000020 18 d4 cd f1 1b b8 4b 47 50 0c 76 07 8a f9 ad 9d |......KGP.v.....| +00000030 ba 87 e7 69 cf 47 d7 79 2f 45 55 74 e8 2a 8f d3 |...i.G.y/EUt.*..| +00000040 02 10 ee d8 80 a0 36 9a 5b 70 4d 17 03 03 00 40 |......6.[pM....@| +00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000060 43 e0 95 80 4c ce 68 fb 8c ad a8 77 99 d7 53 7f |C...L.h....w..S.| +00000070 b7 bf 03 59 23 f1 b4 3c d8 db 38 f4 b5 9b f5 3f |...Y#..<..8....?| +00000080 12 b6 f3 2a f5 f8 66 57 0c 03 7b 00 16 01 8a 70 |...*..fW..{....p| +00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| +000000a0 00 00 00 00 00 3a fa 64 7c f3 25 08 c6 06 fb 02 |.....:.d|.%.....| +000000b0 ce a0 97 81 c9 ea 53 fc cf 39 b9 8a f7 0c df 2f |......S..9...../| +000000c0 5f 56 62 78 86 |_Vbx.| diff --git a/go/src/crypto/tls/testdata/Server-TLSv12-X25519 b/go/src/crypto/tls/testdata/Server-TLSv12-X25519 new file mode 100644 index 0000000000000000000000000000000000000000..09f321e3e61e377441ead854881a5027777ca900 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv12-X25519 @@ -0,0 +1,80 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 7d 01 00 00 79 03 03 dc 04 e9 5b d1 |....}...y.....[.| +00000010 6b d9 b9 5e f7 4c 01 7e 58 4a 99 d9 90 c8 a2 7b |k..^.L.~XJ.....{| +00000020 f4 55 08 68 9b 42 34 6a 14 6c 01 00 00 04 cc a8 |.U.h.B4j.l......| +00000030 00 ff 01 00 00 4c 00 0b 00 04 03 00 01 02 00 0a |.....L..........| +00000040 00 04 00 02 00 1d 00 16 00 00 00 17 00 00 00 0d |................| +00000050 00 30 00 2e 04 03 05 03 06 03 08 07 08 08 08 09 |.0..............| +00000060 08 0a 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 |................| +00000070 03 03 02 03 03 01 02 01 03 02 02 02 04 02 05 02 |................| +00000080 06 02 |..| +>>> Flow 2 (server to client) +00000000 16 03 03 00 3b 02 00 00 37 03 03 00 00 00 00 00 |....;...7.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 cc a8 00 00 |...DOWNGRD......| +00000030 0f ff 01 00 01 00 00 17 00 00 00 0b 00 02 01 00 |................| +00000040 16 03 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 |....Y...U..R..O0| +00000050 82 02 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 |..K0............| +00000060 f0 9d 3f e2 5b ea a6 30 0d 06 09 2a 86 48 86 f7 |..?.[..0...*.H..| +00000070 0d 01 01 0b 05 00 30 1f 31 0b 30 09 06 03 55 04 |......0.1.0...U.| +00000080 0a 13 02 47 6f 31 10 30 0e 06 03 55 04 03 13 07 |...Go1.0...U....| +00000090 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 36 30 31 30 |Go Root0...16010| +000000a0 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 30 31 |1000000Z..250101| +000000b0 30 30 30 30 30 30 5a 30 1a 31 0b 30 09 06 03 55 |000000Z0.1.0...U| +000000c0 04 0a 13 02 47 6f 31 0b 30 09 06 03 55 04 03 13 |....Go1.0...U...| +000000d0 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d |.Go0..0...*.H...| +000000e0 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 |.........0......| +000000f0 db 46 7d 93 2e 12 27 06 48 bc 06 28 21 ab 7e c4 |.F}...'.H..(!.~.| +00000100 b6 a2 5d fe 1e 52 45 88 7a 36 47 a5 08 0d 92 42 |..]..RE.z6G....B| +00000110 5b c2 81 c0 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 |[.....y.@.Om..+.| +00000120 8b c2 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 |....g....."8.J.t| +00000130 73 2b c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c |s+.4......t{.X.l| +00000140 61 3c c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd |a<..A..++$#w[.;.| +00000150 75 5d ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a |u]. T..c...$....| +00000160 50 8b aa b6 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 |P....C...ub...R.| +00000170 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 |........0..0...U| +00000180 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 |...........0...U| +00000190 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......| +000001a0 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d |..+.......0...U.| +000001b0 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 |......0.0...U...| +000001c0 12 04 10 9f 91 16 1f 43 43 3e 49 a6 de 6d b6 80 |.......CC>I..m..| +000001d0 d7 9f 60 30 1b 06 03 55 1d 23 04 14 30 12 80 10 |..`0...U.#..0...| +000001e0 48 13 49 4d 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b |H.IM.~.1......n{| +000001f0 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 |0...U....0...exa| +00000200 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a |mple.golang0...*| +00000210 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 9d 30 |.H.............0| +00000220 cc 40 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed 83 28 |.@+[P.a...SX...(| +00000230 a9 58 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 |.X..8....1Z..f=C| +00000240 d3 2d d9 0b f2 97 df d3 20 64 38 92 24 3a 00 bc |.-...... d8.$:..| +00000250 cf 9c 7d b7 40 20 01 5f aa d3 16 61 09 a2 76 fd |..}.@ ._...a..v.| +00000260 13 c3 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb |.....\.....l..s.| +00000270 b3 43 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 |.Cw.......@.a.Lr| +00000280 2b 9d ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 |+...F..M...>...B| +00000290 d4 db fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 |...=.`.\!.;.....| +000002a0 03 00 ac 0c 00 00 a8 03 00 1d 20 2f e5 7d a3 47 |.......... /.}.G| +000002b0 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af |.bC.(.._.).0....| +000002c0 c4 cf c2 ed 90 99 5f 58 cb 3b 74 08 04 00 80 27 |......_X.;t....'| +000002d0 d6 32 9d 2d 17 61 04 13 02 29 ad c2 af f7 ac 7b |.2.-.a...).....{| +000002e0 65 1c 6b cd 1d 7d 05 d7 b9 55 82 1b 23 92 6b b5 |e.k..}...U..#.k.| +000002f0 a2 d6 65 d7 42 6f a3 b6 2a f0 ac a4 6c dd f3 11 |..e.Bo..*...l...| +00000300 a0 20 ee 45 42 33 fc 45 d1 9e d7 bb 75 0e d1 bd |. .EB3.E....u...| +00000310 cd 8f 64 35 85 79 88 9b 63 1e 8c 08 1b fd 19 5e |..d5.y..c......^| +00000320 a9 ac 06 79 1e 4a 95 fa cd 60 86 e3 10 e4 d0 39 |...y.J...`.....9| +00000330 0c a0 0b 6f 6f 55 a4 7d 65 d4 41 ee 60 62 42 a8 |...ooU.}e.A.`bB.| +00000340 5e 22 55 48 3c 54 53 f0 28 e1 7f 67 4f f0 1f 16 |^"UH>> Flow 3 (client to server) +00000000 16 03 03 00 25 10 00 00 21 20 35 e6 c9 e2 76 cf |....%...! 5...v.| +00000010 36 af dc 27 30 6b eb f4 ae 62 f1 f4 40 81 04 d2 |6..'0k...b..@...| +00000020 f1 c7 d5 af 7d 64 ef 64 d0 58 14 03 03 00 01 01 |....}d.d.X......| +00000030 16 03 03 00 20 5b 64 ec 49 29 26 ba 8c ed 85 fb |.... [d.I)&.....| +00000040 3e 09 c4 66 bb 60 4e d7 b1 69 73 5a 67 51 77 20 |>..f.`N..isZgQw | +00000050 5b 14 1f c0 69 |[...i| +>>> Flow 4 (server to client) +00000000 14 03 03 00 01 01 16 03 03 00 20 74 49 81 b6 d3 |.......... tI...| +00000010 79 68 0d 78 47 7a 97 a7 cd 3b 2c 24 a3 42 83 18 |yh.xGz...;,$.B..| +00000020 e4 0c c3 da 4a 1c ff 7b 5d 4c 08 17 03 03 00 1d |....J..{]L......| +00000030 c2 8a f4 f2 de db 53 69 79 61 c9 30 7b ae 74 cc |......Siya.0{.t.| +00000040 eb 37 b7 e8 19 cb e6 5f 49 7f 3d a0 37 15 03 03 |.7....._I.=.7...| +00000050 00 12 99 68 9b 76 f6 66 52 55 fc 8e 4f 17 56 a7 |...h.v.fRU..O.V.| +00000060 33 0b db 05 |3...| diff --git a/go/src/crypto/tls/testdata/Server-TLSv13-AES128-SHA256 b/go/src/crypto/tls/testdata/Server-TLSv13-AES128-SHA256 new file mode 100644 index 0000000000000000000000000000000000000000..465d5f9f7e6993a7f9fd7ad0a260257b50e58e0a --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv13-AES128-SHA256 @@ -0,0 +1,97 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 ca 01 00 00 c6 03 03 8e 4c 3b 7c dc |............L;|.| +00000010 d6 2d c0 19 de dd 85 01 ce 5a 48 3e 63 ab 4a 21 |.-.......ZH>c.J!| +00000020 9c 0e 23 4f 41 99 43 bd 78 5b 82 20 90 e6 4e 23 |..#OA.C.x[. ..N#| +00000030 34 72 2a ad 9a cf 95 20 20 f0 e9 cf 7a 4a 57 65 |4r*.... ...zJWe| +00000040 87 09 c7 76 79 25 9c 3e 16 22 4c c5 00 04 13 01 |...vy%.>."L.....| +00000050 00 ff 01 00 00 79 00 0b 00 04 03 00 01 02 00 0a |.....y..........| +00000060 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 16 |................| +00000070 00 00 00 17 00 00 00 0d 00 1e 00 1c 04 03 05 03 |................| +00000080 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 |................| +00000090 08 06 04 01 05 01 06 01 00 2b 00 03 02 03 04 00 |.........+......| +000000a0 2d 00 02 01 01 00 33 00 26 00 24 00 1d 00 20 74 |-.....3.&.$... t| +000000b0 47 39 80 c0 36 61 58 c4 16 58 d5 e1 9f 60 ca a8 |G9..6aX..X...`..| +000000c0 f8 ef 86 40 65 2d 5b 5d 4b cc 37 1d 66 15 66 |...@e-[]K.7.f.f| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 00 00 00 00 00 |....z...v.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 90 e6 4e 23 |........... ..N#| +00000030 34 72 2a ad 9a cf 95 20 20 f0 e9 cf 7a 4a 57 65 |4r*.... ...zJWe| +00000040 87 09 c7 76 79 25 9c 3e 16 22 4c c5 13 01 00 00 |...vy%.>."L.....| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 2f |..+.....3.$... /| +00000060 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +00000070 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 14 |.........._X.;t.| +00000080 03 03 00 01 01 17 03 03 00 17 e2 d2 17 5f 12 74 |............._.t| +00000090 c1 79 bc 63 27 63 e7 52 05 50 f5 13 16 ea 3e 9e |.y.c'c.R.P....>.| +000000a0 19 17 03 03 02 6d dd 67 27 89 03 8e f4 db 9b 65 |.....m.g'......e| +000000b0 bc ff 5e 8a 9b a2 20 3c 4d ee b2 98 e3 52 94 b1 |..^... ...i| +000001c0 69 d5 56 45 b2 3b 5f 24 42 b9 4f 43 ec 0d 0d 6c |i.VE.;_$B.OC...l| +000001d0 0e 44 10 e6 45 e1 a2 11 27 e6 70 a8 d3 a4 2e a1 |.D..E...'.p.....| +000001e0 43 d6 a5 46 79 d1 e8 37 07 c0 29 68 fa ab dc 67 |C..Fy..7..)h...g| +000001f0 91 94 04 28 aa 12 01 3f c7 4f d6 a8 93 99 53 5e |...(...?.O....S^| +00000200 0b 5f ff 83 a0 14 47 23 e6 5e 3c a0 e4 47 28 74 |._....G#.^<..G(t| +00000210 20 a4 cc 28 03 41 62 5a 27 eb 22 33 ba ac e2 63 | ..(.AbZ'."3...c| +00000220 c7 a6 09 c7 87 70 45 1a 8b df 96 89 bc 3f 14 0d |.....pE......?..| +00000230 28 5a 67 a1 d4 30 a3 c3 3a 4b 1f 0e a7 7d 40 cd |(Zg..0..:K...}@.| +00000240 0e 59 12 2d be 40 ea c1 cb fc b0 d3 42 72 56 4b |.Y.-.@......BrVK| +00000250 7a a8 e8 70 d6 07 e0 0a 69 ad e6 0b e9 da b7 27 |z..p....i......'| +00000260 57 e6 aa d3 0d 46 86 93 c0 ce e6 1a b8 8f bb 95 |W....F..........| +00000270 09 58 e7 51 96 53 4e 71 70 bf 34 7a b0 e9 a8 e7 |.X.Q.SNqp.4z....| +00000280 51 0f 0c 68 f1 9f 17 28 53 d4 ac 7a 9f 06 cc ce |Q..h...(S..z....| +00000290 36 81 e7 bf f2 85 b5 5b 4e 23 84 70 67 d5 45 a3 |6......[N#.pg.E.| +000002a0 3a df f2 26 7c 93 d0 47 f9 0d 87 21 a0 e3 05 a3 |:..&|..G...!....| +000002b0 ed 7b 99 7d 56 1f 43 77 4e fb db 7d 63 70 a0 fb |.{.}V.CwN..}cp..| +000002c0 bf 41 d7 48 a8 ae b1 70 1e 99 ae 2b e5 1c 7b 4d |.A.H...p...+..{M| +000002d0 a8 a6 86 39 83 d4 63 32 56 57 44 4c 44 2e 77 22 |...9..c2VWDLD.w"| +000002e0 7b e4 33 3a 40 df f1 7e 21 8a 8d da 72 dd 6f 29 |{.3:@..~!...r.o)| +000002f0 5a de 90 0c a2 76 e0 73 7a 82 d3 26 88 e1 f7 c5 |Z....v.sz..&....| +00000300 69 c2 04 9b 98 4b 49 7f e3 ac 18 90 85 4f ec c7 |i....KI......O..| +00000310 29 67 b7 17 03 03 00 99 1c 83 e0 03 3a 6e 3e 08 |)g..........:n>.| +00000320 e5 33 26 ca 22 a7 01 d9 8c fa f8 75 74 4a 34 a9 |.3&."......utJ4.| +00000330 12 f7 0a fd 49 2e ef 7d 07 97 59 d7 5a 69 b2 cb |....I..}..Y.Zi..| +00000340 07 a4 5e 5d 52 f5 4b 50 b3 df 46 fd 3e 86 fe 07 |..^]R.KP..F.>...| +00000350 98 94 ad cd 2b a2 11 03 1c 1b 13 03 ba 13 68 e4 |....+.........h.| +00000360 45 5a 70 41 92 a1 67 65 a3 23 4b 81 47 3b 18 a4 |EZpA..ge.#K.G;..| +00000370 6e 8f 62 e1 2b ee 5f 77 35 e2 07 f7 c9 39 ec 9f |n.b.+._w5....9..| +00000380 e5 dc b6 e9 64 b9 83 50 02 3f e6 2f ba 3e f6 97 |....d..P.?./.>..| +00000390 0b 75 9d e2 d6 ac 86 89 a2 ce 99 29 7b 11 de 6a |.u.........){..j| +000003a0 23 da 7c 84 ec d3 71 f4 fd 6b 5c 0a c0 25 3e c0 |#.|...q..k\..%>.| +000003b0 11 17 03 03 00 35 39 bb d8 45 80 5d 07 86 99 65 |.....59..E.]...e| +000003c0 7c 85 6f 3a 08 e2 a4 fa 2e be 23 63 51 64 71 7c ||.o:......#cQdq|| +000003d0 d7 5d 87 31 91 53 6e 77 7d ea d1 66 fd b7 a9 0e |.].1.Snw}..f....| +000003e0 c9 da dc ba b7 d9 5f 0f 33 fd 52 17 03 03 00 8b |......_.3.R.....| +000003f0 99 86 2a e1 93 87 40 c9 6e 9d 27 7d dd a0 03 a2 |..*...@.n.'}....| +00000400 65 cb c2 63 33 59 2f 4a a7 01 56 94 28 e4 ec c7 |e..c3Y/J..V.(...| +00000410 8f 62 ed 71 c1 80 b9 f8 55 07 0b ab 2a bd f8 68 |.b.q....U...*..h| +00000420 7d 90 a9 98 36 5b d8 f3 00 22 d9 a9 76 30 ef cd |}...6[..."..v0..| +00000430 3f 42 68 af 70 5b 12 c8 9d f8 00 01 3d 02 82 44 |?Bh.p[......=..D| +00000440 2d a6 2e dc 3b b4 42 5c c6 01 c4 fb a3 32 86 10 |-...;.B\.....2..| +00000450 d8 25 ab 87 24 d7 38 7f dd b8 5f f9 5e 47 a9 57 |.%..$.8..._.^G.W| +00000460 cc 48 fb 0f 74 4a db 4f db 92 21 be 08 7c 53 6f |.H..tJ.O..!..|So| +00000470 89 3f 68 77 cd 02 a7 aa 9c 9d b5 |.?hw.......| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 00 35 1d f1 fe e2 c3 |..........5.....| +00000010 4e 95 57 0b 7e d6 32 45 6b 9c ed 89 c2 69 62 70 |N.W.~.2Ek....ibp| +00000020 79 0f a8 42 72 94 05 ad f5 fe a5 83 4b 56 80 41 |y..Br.......KV.A| +00000030 2c 58 e0 e2 00 70 de c1 39 c8 fa c4 bb 89 57 aa |,X...p..9.....W.| +>>> Flow 4 (server to client) +00000000 17 03 03 00 1e a3 8a 39 2d 93 5d d3 ce cd 5a 31 |.......9-.]...Z1| +00000010 19 21 b8 b5 6f 3e 58 7a 0c 09 9b a8 4b 23 3d 3d |.!..o>Xz....K#==| +00000020 d7 73 7a 17 03 03 00 13 d1 a5 7c 5e 2e fa 6b 86 |.sz.......|^..k.| +00000030 f9 36 3c 8d 2b 5b 7e 58 db c8 0d |.6<.+[~X...| diff --git a/go/src/crypto/tls/testdata/Server-TLSv13-AES256-SHA384 b/go/src/crypto/tls/testdata/Server-TLSv13-AES256-SHA384 new file mode 100644 index 0000000000000000000000000000000000000000..64310a1546b60a03fb39337e88257ee675e9aaeb --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv13-AES256-SHA384 @@ -0,0 +1,100 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 ca 01 00 00 c6 03 03 c4 ac 32 36 24 |.............26$| +00000010 08 b0 6c 1d 1e 58 7e b3 3d 52 35 29 85 52 3a b3 |..l..X~.=R5).R:.| +00000020 32 a2 71 86 4b 33 5d bb b8 b8 ac 20 77 6d 45 2f |2.q.K3].... wmE/| +00000030 a3 fe 59 3f 9b cf 4e 60 55 84 f7 99 c2 f5 7e 1e |..Y?..N`U.....~.| +00000040 6f 0a 4d fe bf 13 e8 95 80 a7 7d c6 00 04 13 02 |o.M.......}.....| +00000050 00 ff 01 00 00 79 00 0b 00 04 03 00 01 02 00 0a |.....y..........| +00000060 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 16 |................| +00000070 00 00 00 17 00 00 00 0d 00 1e 00 1c 04 03 05 03 |................| +00000080 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 |................| +00000090 08 06 04 01 05 01 06 01 00 2b 00 03 02 03 04 00 |.........+......| +000000a0 2d 00 02 01 01 00 33 00 26 00 24 00 1d 00 20 8f |-.....3.&.$... .| +000000b0 5a 28 ca 6a 1b 42 2f 1a 53 8f cc 4f 88 b3 0c ad |Z(.j.B/.S..O....| +000000c0 35 59 c5 10 46 ef a4 5f 1e d4 63 69 93 4f 15 |5Y..F.._..ci.O.| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 00 00 00 00 00 |....z...v.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 77 6d 45 2f |........... wmE/| +00000030 a3 fe 59 3f 9b cf 4e 60 55 84 f7 99 c2 f5 7e 1e |..Y?..N`U.....~.| +00000040 6f 0a 4d fe bf 13 e8 95 80 a7 7d c6 13 02 00 00 |o.M.......}.....| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 2f |..+.....3.$... /| +00000060 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +00000070 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 14 |.........._X.;t.| +00000080 03 03 00 01 01 17 03 03 00 17 e4 b2 43 7d 15 fc |............C}..| +00000090 ae 58 44 9d 0d 82 a4 1c 21 c4 3f 86 fb 4b 6b d1 |.XD.....!.?..Kk.| +000000a0 96 17 03 03 02 6d 03 84 7a 2c 7e d8 c8 ca 31 07 |.....m..z,~...1.| +000000b0 fc 2c 47 5b e4 c1 e1 5f 1a c9 a0 45 4e 9a 3d 63 |.,G[..._...EN.=c| +000000c0 11 3b 26 d7 05 e3 6c 36 c3 49 46 c3 73 4e ee 97 |.;&...l6.IF.sN..| +000000d0 dc 4e 09 f4 22 0f 34 05 e1 84 d5 ed 76 a1 4e ba |.N..".4.....v.N.| +000000e0 7c d7 9c 9d 16 ae 96 0f 62 41 64 80 ed fc 4c 1e ||.......bAd...L.| +000000f0 75 a4 5a fe bf 7c 95 6f 81 ef bb e9 9c 69 63 df |u.Z..|.o.....ic.| +00000100 b0 07 d1 4f 1e 96 9e c9 a4 09 d6 79 f2 33 58 eb |...O.......y.3X.| +00000110 78 a5 a7 29 27 58 1b 99 79 79 e3 1d 61 6e fd 7b |x..)'X..yy..an.{| +00000120 c8 7f c6 07 3a f5 23 d6 4d 7a 74 af 53 f6 b1 63 |....:.#.Mzt.S..c| +00000130 2f eb 51 65 b5 91 ac af 4b bf 9e 98 90 8a ae 02 |/.Qe....K.......| +00000140 86 35 78 66 13 2c de 95 5b e1 d8 78 18 bf 65 8f |.5xf.,..[..x..e.| +00000150 a2 30 ae e7 fa aa ac bc 44 72 03 f5 86 b1 1b c2 |.0......Dr......| +00000160 d5 61 dc 4d 74 47 73 67 f1 43 11 1a 95 6f e3 88 |.a.MtGsg.C...o..| +00000170 51 9a 4b c7 bd dc 36 8f 5d de 56 4c 8d 30 8d ec |Q.K...6.].VL.0..| +00000180 08 0b 90 be c8 dc df 7d 6e e7 85 c9 ab dd be a9 |.......}n.......| +00000190 57 c4 6a 76 36 bb a8 4b e2 be d1 28 67 3b a9 0c |W.jv6..K...(g;..| +000001a0 a1 78 2e e4 af f4 51 a3 f5 8c b3 8d c8 7c 8e e7 |.x....Q......|..| +000001b0 d2 7f 38 91 04 42 f4 e9 ae e2 3a 3d 37 10 78 f3 |..8..B....:=7.x.| +000001c0 2d 9c 9f f7 4f 49 f0 45 bd 1e 8d 7d e3 84 b9 9a |-...OI.E...}....| +000001d0 75 40 fb 2b 4f 71 2d b7 bd 1a 6e 4a 7a b4 53 f8 |u@.+Oq-...nJz.S.| +000001e0 d7 c9 6e d9 f6 7b de fa f0 12 5d fc c0 71 1a bf |..n..{....]..q..| +000001f0 76 d8 c4 ad c5 f7 e2 79 55 79 40 e5 55 ee bc dc |v......yUy@.U...| +00000200 42 06 97 89 da 2d a7 e9 26 e4 82 e1 63 5f e2 ee |B....-..&...c_..| +00000210 1a 37 6d 65 bf d7 5f 2e 86 a5 a8 4d b2 e1 31 2f |.7me.._....M..1/| +00000220 8b c5 0b 88 03 bf 1f 37 8c 96 ec 54 4f 75 9b f9 |.......7...TOu..| +00000230 00 98 96 e6 db c1 24 94 6a d1 dd f7 9b d2 2e 24 |......$.j......$| +00000240 82 c7 34 5a f6 aa 36 5b b7 63 11 b2 1d 15 a6 48 |..4Z..6[.c.....H| +00000250 74 5c a7 70 a9 c4 fc 14 67 51 7e 16 7c 90 5b 64 |t\.p....gQ~.|.[d| +00000260 ff 49 02 f6 4d 7a c2 f9 d7 1d 47 4b de bf ae ca |.I..Mz....GK....| +00000270 03 56 84 31 01 37 80 85 79 fb d8 f4 72 9f 98 a3 |.V.1.7..y...r...| +00000280 44 d4 52 f8 af 8c 98 d8 66 69 f7 71 58 db 42 fa |D.R.....fi.qX.B.| +00000290 d7 c9 05 d1 9d 7a df 9f a9 b1 12 53 d2 70 fa ca |.....z.....S.p..| +000002a0 7e a6 de 8d ed 08 69 b2 34 45 3a a5 ba 1d 2e d8 |~.....i.4E:.....| +000002b0 d5 ee ee 60 16 18 cc e1 db aa e6 1b 19 5a ec e6 |...`.........Z..| +000002c0 b8 ec 51 46 99 6d 1e 83 9b 9d 44 a7 85 5a 10 23 |..QF.m....D..Z.#| +000002d0 74 a3 b6 09 b5 d7 2a 12 6a e2 2a da 5d 87 d9 fe |t.....*.j.*.]...| +000002e0 b6 c7 8f c8 03 27 b0 6e 98 57 6f e4 d5 8b 88 5d |.....'.n.Wo....]| +000002f0 0a b3 c4 a1 ae df 89 53 af d5 8e 59 97 2d 65 c0 |.......S...Y.-e.| +00000300 52 e8 5f 8a 37 3f 8b ef 77 fc 93 0c b5 50 3b 94 |R._.7?..w....P;.| +00000310 13 1b 3b 17 03 03 00 99 3e e8 05 5a 69 dc 0c 90 |..;.....>..Zi...| +00000320 a3 17 35 ea 27 2b da 64 44 72 30 5b 9c a5 6b 1b |..5.'+.dDr0[..k.| +00000330 c2 a8 af 38 c3 43 52 14 fd ec a8 8b c9 ab 6b 67 |...8.CR.......kg| +00000340 32 84 f9 b4 e1 89 08 8f 6a c2 2a 17 b9 f5 92 c8 |2.......j.*.....| +00000350 3a 97 62 98 b8 93 94 5d a1 6b 05 17 56 5d 6e b5 |:.b....].k..V]n.| +00000360 d3 72 a6 06 77 b2 45 fe 2d 37 10 7e b8 16 16 f4 |.r..w.E.-7.~....| +00000370 70 86 56 a4 be 52 54 3e 90 7d 47 66 23 35 e9 a2 |p.V..RT>.}Gf#5..| +00000380 e9 4f 86 e2 a7 b9 20 b6 c8 9f 19 08 6b 73 93 86 |.O.... .....ks..| +00000390 d7 8d 1a 9a 00 6b cf fb cb 32 5d 36 91 4f 39 e2 |.....k...2]6.O9.| +000003a0 f5 0d fa 37 3d b8 c6 86 cb 57 71 a8 c6 f8 74 cb |...7=....Wq...t.| +000003b0 c0 17 03 03 00 45 67 fe 1b 83 1a bf ac 3b ee 0f |.....Eg......;..| +000003c0 31 35 da 42 6c e3 3f 14 63 4a f3 5b 5b 02 76 c8 |15.Bl.?.cJ.[[.v.| +000003d0 21 84 7e 11 42 e3 8c e7 b6 7c 1d ba 41 ec dd 68 |!.~.B....|..A..h| +000003e0 73 4a 1b c5 bc 11 fa 22 33 9b 51 7d f0 27 88 4a |sJ....."3.Q}.'.J| +000003f0 1b bf e8 a9 3f f5 2f 9a 05 ce 07 17 03 03 00 9b |....?./.........| +00000400 da 09 d0 83 a3 24 92 94 b7 9f 34 10 7b 1c b9 e4 |.....$....4.{...| +00000410 ca 56 c9 8f 71 03 99 0b c5 ea 6d 50 6d 75 dd 7b |.V..q.....mPmu.{| +00000420 28 4d 5c 6e 32 83 61 36 68 0b 64 ac b7 6b ec bb |(M\n2.a6h.d..k..| +00000430 22 72 56 4b 6a 58 98 a2 62 9c 15 28 fa a8 38 a3 |"rVKjX..b..(..8.| +00000440 63 b7 8b d4 3d 63 3f 64 34 45 e2 f1 ad e6 3e 66 |c...=c?d4E....>f| +00000450 8e 45 5f 3e ca fc 5e a8 40 17 a9 ac c6 52 e4 4e |.E_>..^.@....R.N| +00000460 14 15 0b a1 00 db 8c a2 dd 41 35 74 1f f4 06 ac |.........A5t....| +00000470 72 8c 86 1f a9 de 6d 1c 24 6d 2d 37 f2 dd 1a f9 |r.....m.$m-7....| +00000480 60 0d 48 fc 8e a3 97 5a 9b 6b 99 13 77 4c f8 bf |`.H....Z.k..wL..| +00000490 b3 e5 db 07 31 3d b9 a9 56 9f c2 |....1=..V..| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 00 45 2a e9 8b e0 d6 |..........E*....| +00000010 52 b2 a9 01 20 d1 48 61 5e 6a c3 cf 79 14 f3 c0 |R... .Ha^j..y...| +00000020 8e 1f 76 2b 16 d5 53 c8 ae a8 a5 7b 14 aa 8c 4b |..v+..S....{...K| +00000030 5d 76 e6 dd 5b b9 1f 87 39 62 f6 e5 72 13 1e d0 |]v..[...9b..r...| +00000040 48 06 f5 d9 ce b8 4d 32 42 49 f1 dd 52 96 e5 68 |H.....M2BI..R..h| +>>> Flow 4 (server to client) +00000000 17 03 03 00 1e 97 3a d5 e2 f1 22 da d5 0a 3a 2c |......:..."...:,| +00000010 c1 c0 53 ff 44 bd 06 02 02 eb b6 91 c5 b3 d7 c7 |..S.D...........| +00000020 c2 6e 56 17 03 03 00 13 af c2 91 94 6e db 5e 62 |.nV.........n.^b| +00000030 9a 1e 40 e4 50 a1 b4 9c 16 45 be |..@.P....E.| diff --git a/go/src/crypto/tls/testdata/Server-TLSv13-ALPN b/go/src/crypto/tls/testdata/Server-TLSv13-ALPN new file mode 100644 index 0000000000000000000000000000000000000000..7537272ee6d4b37b0f58836a509767ccb070b794 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv13-ALPN @@ -0,0 +1,100 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 e2 01 00 00 de 03 03 35 09 24 92 91 |...........5.$..| +00000010 f9 de f8 f0 68 a2 6d f2 e6 2a df de f1 7c c4 44 |....h.m..*...|.D| +00000020 7b 22 14 03 29 2a f2 1b 6c a2 0e 20 e4 bc 0e 83 |{"..)*..l.. ....| +00000030 35 d7 c1 4c ea 8f ba 77 32 ae c9 44 b0 51 16 05 |5..L...w2..D.Q..| +00000040 06 03 6b c9 23 06 42 26 80 25 6d 67 00 04 13 03 |..k.#.B&.%mg....| +00000050 00 ff 01 00 00 91 00 0b 00 04 03 00 01 02 00 0a |................| +00000060 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 23 |...............#| +00000070 00 00 00 10 00 10 00 0e 06 70 72 6f 74 6f 32 06 |.........proto2.| +00000080 70 72 6f 74 6f 31 00 16 00 00 00 17 00 00 00 0d |proto1..........| +00000090 00 1e 00 1c 04 03 05 03 06 03 08 07 08 08 08 09 |................| +000000a0 08 0a 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 |................| +000000b0 00 2b 00 03 02 03 04 00 2d 00 02 01 01 00 33 00 |.+......-.....3.| +000000c0 26 00 24 00 1d 00 20 59 cf 4e a0 d2 89 c8 fd 8b |&.$... Y.N......| +000000d0 22 e8 ce 43 a4 b4 2b b3 9f 12 46 c0 21 2a 10 55 |"..C..+...F.!*.U| +000000e0 fd a7 6f 65 04 51 21 |..oe.Q!| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 00 00 00 00 00 |....z...v.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 e4 bc 0e 83 |........... ....| +00000030 35 d7 c1 4c ea 8f ba 77 32 ae c9 44 b0 51 16 05 |5..L...w2..D.Q..| +00000040 06 03 6b c9 23 06 42 26 80 25 6d 67 13 03 00 00 |..k.#.B&.%mg....| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 2f |..+.....3.$... /| +00000060 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +00000070 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 14 |.........._X.;t.| +00000080 03 03 00 01 01 17 03 03 00 24 7a a5 d4 28 fe 61 |.........$z..(.a| +00000090 12 68 43 19 5a 01 88 e7 ae 24 e4 6f d3 c6 e7 13 |.hC.Z....$.o....| +000000a0 32 aa 80 56 e2 1b 8c bb 5f ee 33 5f 86 8e 17 03 |2..V...._.3_....| +000000b0 03 02 6d ee 98 f9 eb 4c 74 7f 2b 73 22 7e 79 e7 |..m....Lt.+s"~y.| +000000c0 ed ed 93 f5 0b 68 0b 5a 14 79 45 83 9a b7 ea e7 |.....h.Z.yE.....| +000000d0 9b 89 21 97 c4 dc cd 89 e7 27 44 d9 5c de a2 79 |..!......'D.\..y| +000000e0 5c bb 9b f1 4a fc 3e 04 64 b4 70 cc 30 a3 3a bc |\...J.>.d.p.0.:.| +000000f0 4c d3 4d 90 b8 1c cf 3f ad 63 12 a6 b7 df 6a a5 |L.M....?.c....j.| +00000100 03 1f a6 96 d5 94 ea fd fc a3 95 2b 38 cb 25 47 |...........+8.%G| +00000110 63 d4 42 10 2c 91 d3 d9 12 79 e2 ba 3e 0b 82 09 |c.B.,....y..>...| +00000120 c6 02 ee 55 14 17 73 3e 11 17 e9 d7 b5 9c d2 b7 |...U..s>........| +00000130 d7 2f f0 23 51 a1 d3 71 68 9d 4c 01 98 a9 07 e0 |./.#Q..qh.L.....| +00000140 b0 fd f8 74 0c bc eb 5e 57 1d 48 65 ac 80 d4 f4 |...t...^W.He....| +00000150 4e 56 1d 89 ce ab 21 5e 5f a0 5c ed a3 e7 07 5d |NV....!^_.\....]| +00000160 c3 d9 9d 31 62 e0 91 2b c6 e2 5c f6 69 2a 06 b8 |...1b..+..\.i*..| +00000170 e1 24 92 39 7b 06 58 72 a1 84 87 c4 e9 53 83 12 |.$.9{.Xr.....S..| +00000180 2a 03 24 6a 9d 84 55 30 04 15 7b 68 88 46 75 6e |*.$j..U0..{h.Fun| +00000190 3f 0a f7 e8 9f 64 04 32 b7 5e 8c 64 82 ec 6d 9b |?....d.2.^.d..m.| +000001a0 e0 41 33 69 e4 75 51 d9 e3 ba 7a 9e 7b 8f b7 3e |.A3i.uQ...z.{..>| +000001b0 bc 30 3a 55 10 81 ec 1f f9 c1 77 30 3d 7e 3f b5 |.0:U......w0=~?.| +000001c0 db 44 a5 54 d1 b3 81 64 20 5d 8d 31 48 19 5a 2f |.D.T...d ].1H.Z/| +000001d0 4a b9 b2 31 b8 56 f4 9c 9d ac 35 5d 54 55 0b 09 |J..1.V....5]TU..| +000001e0 e0 10 13 47 b1 ad 3f 9b 62 39 84 4e 49 99 d0 38 |...G..?.b9.NI..8| +000001f0 fe 7d 8b f2 a5 50 ab 62 54 85 7f 70 ae 51 13 6a |.}...P.bT..p.Q.j| +00000200 7a 5d eb cd c6 e2 29 47 a6 e0 a2 b1 46 da bc 7c |z]....)G....F..|| +00000210 38 8b 45 a7 07 c1 f4 e6 fe f0 83 24 fa 87 d1 17 |8.E........$....| +00000220 d1 6b 0d 6f 96 2a 28 35 81 5c 78 6e a8 16 f9 0a |.k.o.*(5.\xn....| +00000230 71 47 72 5d 21 ad b9 93 63 16 b9 58 e6 22 66 86 |qGr]!...c..X."f.| +00000240 b5 43 c0 91 c9 cd 70 8e f9 c0 38 c9 4d 04 fa 39 |.C....p...8.M..9| +00000250 e1 02 46 59 85 67 38 35 ce 84 ec b9 34 50 84 03 |..FY.g85....4P..| +00000260 82 12 75 ee 4a c5 db 61 d1 31 2e c5 62 88 cb 10 |..u.J..a.1..b...| +00000270 c9 bc 65 7b cd df d5 0a 56 75 81 a0 a8 f0 ee 54 |..e{....Vu.....T| +00000280 f5 b3 c8 36 13 c7 6d 95 4a 72 61 d9 98 c4 08 dc |...6..m.Jra.....| +00000290 7f 35 de 4c 5b aa 6f 7d 6d f2 e0 e2 46 1f 5d 72 |.5.L[.o}m...F.]r| +000002a0 a5 c1 ee 5e af 34 44 8b 07 90 9a 2f d3 3e cf 8d |...^.4D..../.>..| +000002b0 69 54 19 ae 3e c2 89 55 5e 0b 98 e1 24 c5 6b 88 |iT..>..U^...$.k.| +000002c0 2e 67 83 9e cc 97 b0 06 58 7d 5f 82 55 21 d3 79 |.g......X}_.U!.y| +000002d0 04 d8 2e 59 08 67 78 70 ee bc 9b 26 12 50 da 5a |...Y.gxp...&.P.Z| +000002e0 40 66 45 b8 36 16 50 5b 93 15 a9 a8 c0 85 34 ee |@fE.6.P[......4.| +000002f0 d2 ee 4e 7d 66 28 f6 65 5c 88 3c b1 de e9 de 8b |..N}f(.e\.<.....| +00000300 e8 b2 51 d7 f0 51 69 fd fe f1 8c 57 df 3f d5 40 |..Q..Qi....W.?.@| +00000310 e8 54 a0 b2 59 e1 75 27 fc fd b7 41 d9 ad 49 5e |.T..Y.u'...A..I^| +00000320 17 03 03 00 99 2c 47 73 11 39 91 57 05 d0 f6 0f |.....,Gs.9.W....| +00000330 8c 6c f2 66 a0 d1 cd 3f 80 3c bb f3 27 78 83 64 |.l.f...?.<..'x.d| +00000340 4d 33 de b8 f5 8b 27 a9 1f 8b 75 9f b2 c6 d7 08 |M3....'...u.....| +00000350 13 8e 73 a6 81 0e 71 fd 7b 33 87 c2 23 6f bc ad |..s...q.{3..#o..| +00000360 9b e6 60 91 12 3f 74 de 8f 7c 49 9f 0a 74 cc e0 |..`..?t..|I..t..| +00000370 68 e3 50 cc ca 2f a2 30 a9 32 31 ec 92 5f 4d d1 |h.P../.0.21.._M.| +00000380 39 f1 4d f6 2d 21 3c 54 33 38 a2 46 c0 7a 55 8c |9.M.-!>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 00 35 de e1 cc 43 bc |..........5...C.| +00000010 ae b2 a6 66 68 d4 c4 b9 18 72 1f 26 f7 03 c9 6e |...fh....r.&...n| +00000020 9b 12 0e ff 65 ff f5 5f 84 6c fb 99 be e6 b3 07 |....e.._.l......| +00000030 db ea d2 33 cc 7e 8c eb 42 db db fd e8 21 62 b0 |...3.~..B....!b.| +>>> Flow 4 (server to client) +00000000 17 03 03 00 1e 1e 5c 6b 1e dd ea a2 1d bd 6e 66 |......\k......nf| +00000010 0b 99 e0 91 0b c1 3e 9b 49 e7 40 0d a7 7a bb 31 |......>.I.@..z.1| +00000020 4c 5c c2 17 03 03 00 13 a5 98 a7 8a 05 a7 bb 60 |L\.............`| +00000030 11 aa b3 05 f6 cd 8b 16 3d 97 3e |........=.>| diff --git a/go/src/crypto/tls/testdata/Server-TLSv13-ALPN-Fallback b/go/src/crypto/tls/testdata/Server-TLSv13-ALPN-Fallback new file mode 100644 index 0000000000000000000000000000000000000000..d4a054d68686fc51bc6c6d5e0469f1b07a66c68c --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv13-ALPN-Fallback @@ -0,0 +1,99 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 eb 01 00 00 e7 03 03 ca 9d 80 22 cc |..............".| +00000010 77 d9 f2 87 3f a8 93 a1 13 6f a0 f5 4e d0 1b fe |w...?....o..N...| +00000020 cc 04 c0 7c 8d 7d 2e 5c c2 6d 69 20 1e 1f 96 97 |...|.}.\.mi ....| +00000030 82 97 85 5b fd c1 59 cb a5 2a 91 c1 b5 88 06 6c |...[..Y..*.....l| +00000040 b0 ed 5c 41 78 cc f6 3c 28 d9 29 2b 00 04 13 03 |..\Ax..<(.)+....| +00000050 00 ff 01 00 00 9a 00 0b 00 04 03 00 01 02 00 0a |................| +00000060 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 23 |...............#| +00000070 00 00 00 10 00 19 00 17 06 70 72 6f 74 6f 33 08 |.........proto3.| +00000080 68 74 74 70 2f 31 2e 31 06 70 72 6f 74 6f 34 00 |http/1.1.proto4.| +00000090 16 00 00 00 17 00 00 00 0d 00 1e 00 1c 04 03 05 |................| +000000a0 03 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 |................| +000000b0 05 08 06 04 01 05 01 06 01 00 2b 00 03 02 03 04 |..........+.....| +000000c0 00 2d 00 02 01 01 00 33 00 26 00 24 00 1d 00 20 |.-.....3.&.$... | +000000d0 c1 26 2b f3 64 5e 41 1a 11 9c 1d 4b 09 bd f4 98 |.&+.d^A....K....| +000000e0 b4 7d 06 bb 88 97 5c ef 01 24 0b 3d 9e ed 91 0f |.}....\..$.=....| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 00 00 00 00 00 |....z...v.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 1e 1f 96 97 |........... ....| +00000030 82 97 85 5b fd c1 59 cb a5 2a 91 c1 b5 88 06 6c |...[..Y..*.....l| +00000040 b0 ed 5c 41 78 cc f6 3c 28 d9 29 2b 13 03 00 00 |..\Ax..<(.)+....| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 2f |..+.....3.$... /| +00000060 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +00000070 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 14 |.........._X.;t.| +00000080 03 03 00 01 01 17 03 03 00 17 ca 84 74 0d 35 9d |............t.5.| +00000090 80 3d d8 95 cb f2 12 f1 10 6b f6 91 12 ab 37 ea |.=.......k....7.| +000000a0 a2 17 03 03 02 6d 1e 6b ca 76 70 67 ce 22 70 8c |.....m.k.vpg."p.| +000000b0 ab 4d 33 a8 2e 93 77 2c 2f b1 7a e3 42 ca 83 e2 |.M3...w,/.z.B...| +000000c0 e5 c9 45 dc 97 d3 85 64 e8 07 13 c8 55 7c cd bf |..E....d....U|..| +000000d0 20 d1 3b 43 a7 13 a1 f6 66 0e 98 e7 23 18 cf 38 | .;C....f...#..8| +000000e0 d3 92 d7 29 30 44 fa dc 81 1d e3 04 ca b0 b3 08 |...)0D..........| +000000f0 d4 a4 64 18 f4 4f 06 ca ca a0 bb 90 38 6d 09 21 |..d..O......8m.!| +00000100 42 c1 a0 c4 51 90 78 61 b1 55 eb 63 8d 65 73 47 |B...Q.xa.U.c.esG| +00000110 7c 6d f5 7f c6 dc 55 a1 a3 a4 16 6b 2d 62 d2 8d ||m....U....k-b..| +00000120 1f 96 8f 84 96 a6 94 f0 a0 9e 03 04 67 a2 e9 e3 |............g...| +00000130 38 0c cd f3 af 45 77 65 33 06 e7 aa cf a0 e6 01 |8....Ewe3.......| +00000140 a7 5f 62 95 32 18 b9 58 03 db 9c ca c7 50 80 cf |._b.2..X.....P..| +00000150 15 1c b0 7e 97 30 bb e2 bf d5 67 f4 e1 87 1e 07 |...~.0....g.....| +00000160 71 2f f5 31 7e 7e 05 8a cb a1 98 83 de de aa 87 |q/.1~~..........| +00000170 b9 d2 4a 5e 4c 27 04 15 6b 3a 21 02 28 2c 3a 76 |..J^L'..k:!.(,:v| +00000180 64 1f b0 f3 45 1e 2a fc 97 3f 0e 18 c8 00 a2 0b |d...E.*..?......| +00000190 51 4a 8f 1d d7 a6 d7 b9 64 11 bc ed 74 c9 90 bd |QJ......d...t...| +000001a0 a3 27 b3 c0 95 ea 49 88 af de 76 d9 82 67 01 0f |.'....I...v..g..| +000001b0 60 f1 f7 84 7e 56 46 65 c7 42 cc fb 99 25 a3 77 |`...~VFe.B...%.w| +000001c0 c5 8c 02 87 4e d4 78 17 0d 16 f1 00 de f9 d5 0b |....N.x.........| +000001d0 36 28 f5 27 59 4b fd ba 38 cb 3c 53 3d 02 3b 77 |6(.'YK..8....f..I| +00000200 9a cd 52 91 5e bc 1f a5 c6 78 2c d0 a4 67 14 3f |..R.^....x,..g.?| +00000210 94 2a 9c 9f 47 ee fa c7 50 ca 00 c2 30 69 d9 ca |.*..G...P...0i..| +00000220 30 b7 ac f4 3b d9 91 d7 33 40 87 de d9 a2 7f 77 |0...;...3@.....w| +00000230 5b b0 57 ca 10 03 ec 3b 95 e9 c2 de 50 f1 28 7a |[.W....;....P.(z| +00000240 49 c1 be ef 6d 99 ea 98 47 8b af 51 d0 fb 0a d0 |I...m...G..Q....| +00000250 b5 b2 ad e3 69 ba fc 34 c7 aa 04 8b d5 fc 17 54 |....i..4.......T| +00000260 e1 51 f0 26 32 21 71 90 0e 30 10 f6 68 6f 53 b7 |.Q.&2!q..0..hoS.| +00000270 b6 d8 1c 13 0a c9 fb 9e 46 13 22 4c 7c 93 18 ed |........F."L|...| +00000280 b8 72 69 56 00 ab df ec f5 4c 32 60 0e a4 a3 b0 |.riV.....L2`....| +00000290 b3 12 5c 61 26 1c aa b2 c2 68 64 65 cc 01 57 c9 |..\a&....hde..W.| +000002a0 70 18 f7 db 2c 0d 24 b3 68 3a 08 db 07 ff 3c f5 |p...,.$.h:....<.| +000002b0 2e 9a 1e d1 9c 62 4d 6d 4b 48 37 dd 62 0b 2b ab |.....bMmKH7.b.+.| +000002c0 49 a1 0f 7e 1b 6f 4e 43 69 63 3d 8e ce 51 f9 32 |I..~.oNCic=..Q.2| +000002d0 4e f4 21 97 f5 16 e4 2b 0b f3 6f 5d 15 7e 68 dd |N.!....+..o].~h.| +000002e0 c6 5b 5f ac 56 42 99 76 28 38 d2 8b ed 0e c6 a4 |.[_.VB.v(8......| +000002f0 69 d3 f1 c4 a9 d6 7a d2 00 ac ad ff 9c d2 8d 1e |i.....z.........| +00000300 46 88 64 24 51 78 2a a8 4a ea a4 fa 28 3b 70 3a |F.d$Qx*.J...(;p:| +00000310 75 8b 9d 17 03 03 00 99 22 d3 e9 8f ae 4e 5e 17 |u......."....N^.| +00000320 3e 86 54 cd fd 66 68 c6 fe 73 ac 19 98 c1 a1 66 |>.T..fh..s.....f| +00000330 4f 7a 4f 5e 0b c5 a1 43 74 d4 c2 0a ce 45 05 2f |OzO^...Ct....E./| +00000340 5f f1 1b 50 eb 08 8f 36 30 f0 78 e9 1d c1 e5 b0 |_..P...60.x.....| +00000350 cf 27 14 ed 67 ed 12 7e f1 4c 10 e8 ff 6f 13 7d |.'..g..~.L...o.}| +00000360 0f a8 c3 b6 19 22 9a 68 9b ab 6d 77 09 f5 56 de |.....".h..mw..V.| +00000370 84 23 d6 ed 38 62 06 4b 05 9b 59 39 2f 09 65 70 |.#..8b.K..Y9/.ep| +00000380 9e 9c f9 fe a2 e4 db 1e c0 12 d2 ee 41 77 b3 05 |............Aw..| +00000390 a1 c3 bb 41 70 0e dd f7 0d ca 41 58 12 9e 4f 23 |...Ap.....AX..O#| +000003a0 2e 72 00 9b 19 70 78 54 b4 27 69 16 15 e8 6f d4 |.r...pxT.'i...o.| +000003b0 e7 17 03 03 00 35 ad df 36 e1 d4 a4 04 8e fa 1a |.....5..6.......| +000003c0 77 da e7 99 62 e9 8f a0 27 af a6 ba 7f 47 49 47 |w...b...'....GIG| +000003d0 aa a3 bd bb cd 32 f6 e6 90 77 95 34 e5 72 f0 f9 |.....2...w.4.r..| +000003e0 75 8c cf 25 5b bc 2a b0 98 be fb 17 03 03 00 8b |u..%[.*.........| +000003f0 e9 20 f8 90 78 d5 78 11 c3 bb 5c 41 f0 cd 51 3e |. ..x.x...\A..Q>| +00000400 a1 20 bb 72 98 e3 d1 fe 9d 61 ae a4 8f 71 57 6c |. .r.....a...qWl| +00000410 e7 68 de 63 95 ed 46 00 f4 8f cd 59 c7 97 7f 98 |.h.c..F....Y....| +00000420 61 f3 68 18 18 1e 94 16 f7 f2 de 73 81 3d a5 7e |a.h........s.=.~| +00000430 12 68 65 70 6f ca bd 2b 92 f8 7c ec 88 2c 3f c0 |.hepo..+..|..,?.| +00000440 76 52 cc e3 38 e0 ce 0b dc 35 ef 87 cf ea 4b 2b |vR..8....5....K+| +00000450 53 88 52 3f f6 e1 d7 ea 5f a2 d9 4f a7 03 ac c1 |S.R?...._..O....| +00000460 7d ab 95 ce a5 f5 00 53 f6 6d ab 7e 07 88 51 9b |}......S.m.~..Q.| +00000470 2c e9 e9 ac 1b f9 17 ac 33 17 00 |,.......3..| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 00 35 52 13 5e 7a c8 |..........5R.^z.| +00000010 3e b6 e1 8e 59 c9 cf 54 0b c8 c2 17 ab 76 0d 3d |>...Y..T.....v.=| +00000020 ec 5c 76 2c 21 21 f3 1e a7 25 ba 67 97 8a 8f de |.\v,!!...%.g....| +00000030 03 7d 1a bc 0a 9e c7 e7 02 52 cf d4 80 3e 80 7e |.}.......R...>.~| +>>> Flow 4 (server to client) +00000000 17 03 03 00 1e 77 f7 66 ab db 08 5c e5 9d 7f a3 |.....w.f...\....| +00000010 f7 37 24 70 e7 7c d2 44 25 de 3d c3 71 18 aa 24 |.7$p.|.D%.=.q..$| +00000020 9b 9d 18 17 03 03 00 13 e3 6e e2 8a d9 ae 0f c3 |.........n......| +00000030 ad 90 03 90 40 be 42 fe 4e ad d2 |....@.B.N..| diff --git a/go/src/crypto/tls/testdata/Server-TLSv13-ALPN-NoMatch b/go/src/crypto/tls/testdata/Server-TLSv13-ALPN-NoMatch new file mode 100644 index 0000000000000000000000000000000000000000..a8b3d807384908b2ed821d1385b838f6706ccb62 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv13-ALPN-NoMatch @@ -0,0 +1,18 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 e2 01 00 00 de 03 03 3d ae 42 d4 d3 |...........=.B..| +00000010 a9 75 5b a6 8f 9f 47 6f fe e7 3d 3e 5c d8 35 01 |.u[...Go..=>\.5.| +00000020 c9 25 fd 94 e4 ac 7e b4 e1 4e 0f 20 56 29 44 cd |.%....~..N. V)D.| +00000030 7f 99 7b a6 9a 4d d4 3c e8 01 00 93 e5 e0 a8 7b |..{..M.<.......{| +00000040 81 13 85 e9 2e 4e 12 a2 b9 d4 7d 8e 00 04 13 03 |.....N....}.....| +00000050 00 ff 01 00 00 91 00 0b 00 04 03 00 01 02 00 0a |................| +00000060 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 23 |...............#| +00000070 00 00 00 10 00 10 00 0e 06 70 72 6f 74 6f 32 06 |.........proto2.| +00000080 70 72 6f 74 6f 31 00 16 00 00 00 17 00 00 00 0d |proto1..........| +00000090 00 1e 00 1c 04 03 05 03 06 03 08 07 08 08 08 09 |................| +000000a0 08 0a 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 |................| +000000b0 00 2b 00 03 02 03 04 00 2d 00 02 01 01 00 33 00 |.+......-.....3.| +000000c0 26 00 24 00 1d 00 20 3c 8b f2 09 ad ff 96 76 0f |&.$... <......v.| +000000d0 9b 05 eb c8 5a 48 68 be a6 6e dd f6 f5 7d 56 89 |....ZHh..n...}V.| +000000e0 ff 37 75 13 b1 1b 01 |.7u....| +>>> Flow 2 (server to client) +00000000 15 03 03 00 02 02 78 |......x| diff --git a/go/src/crypto/tls/testdata/Server-TLSv13-ALPN-NotConfigured b/go/src/crypto/tls/testdata/Server-TLSv13-ALPN-NotConfigured new file mode 100644 index 0000000000000000000000000000000000000000..c4bd0356af05185cb031f5fd798c4d14c4d2c054 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv13-ALPN-NotConfigured @@ -0,0 +1,99 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 e2 01 00 00 de 03 03 1f f5 b0 88 a0 |................| +00000010 fd 0e cd 4d 25 21 88 bf 07 16 95 49 6a 78 2d 70 |...M%!.....Ijx-p| +00000020 25 f7 06 36 f2 98 4c 23 16 41 a5 20 87 60 d3 78 |%..6..L#.A. .`.x| +00000030 c7 ab 8b f9 2b 2c 21 1e f4 5b 25 bc 81 53 18 5c |....+,!..[%..S.\| +00000040 3b 7e dd 3e 7b c4 ee d1 f8 9d bf 7a 00 04 13 03 |;~.>{......z....| +00000050 00 ff 01 00 00 91 00 0b 00 04 03 00 01 02 00 0a |................| +00000060 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 23 |...............#| +00000070 00 00 00 10 00 10 00 0e 06 70 72 6f 74 6f 32 06 |.........proto2.| +00000080 70 72 6f 74 6f 31 00 16 00 00 00 17 00 00 00 0d |proto1..........| +00000090 00 1e 00 1c 04 03 05 03 06 03 08 07 08 08 08 09 |................| +000000a0 08 0a 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 |................| +000000b0 00 2b 00 03 02 03 04 00 2d 00 02 01 01 00 33 00 |.+......-.....3.| +000000c0 26 00 24 00 1d 00 20 5f 8f fa 0f 94 46 78 3d a9 |&.$... _....Fx=.| +000000d0 7d d8 2b 65 f6 c1 55 6b fd aa 4b 65 23 7b ad 13 |}.+e..Uk..Ke#{..| +000000e0 88 06 ce 54 f1 77 63 |...T.wc| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 00 00 00 00 00 |....z...v.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 87 60 d3 78 |........... .`.x| +00000030 c7 ab 8b f9 2b 2c 21 1e f4 5b 25 bc 81 53 18 5c |....+,!..[%..S.\| +00000040 3b 7e dd 3e 7b c4 ee d1 f8 9d bf 7a 13 03 00 00 |;~.>{......z....| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 2f |..+.....3.$... /| +00000060 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +00000070 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 14 |.........._X.;t.| +00000080 03 03 00 01 01 17 03 03 00 17 30 cc 27 0f 8c cd |..........0.'...| +00000090 77 85 98 61 e4 19 19 63 ac 5b 55 37 c2 73 6d f6 |w..a...c.[U7.sm.| +000000a0 a1 17 03 03 02 6d 5f 60 9f d3 fc 5e 57 fb b6 35 |.....m_`...^W..5| +000000b0 99 3c a7 65 6f eb b5 89 5a 3c be e1 a5 c7 af 14 |.<.eo...Z<......| +000000c0 67 d4 0c 87 d4 dd c9 28 1c 5c 89 c6 55 68 e0 b3 |g......(.\..Uh..| +000000d0 42 d8 e4 4f 64 df 26 4a a2 14 eb 34 69 9f 8d 8e |B..Od.&J...4i...| +000000e0 fc 21 db 17 93 37 7d d4 57 bb 76 4d 1e 70 9f 58 |.!...7}.W.vM.p.X| +000000f0 f3 ae 12 71 aa 4b 30 e3 86 92 32 c6 55 12 08 42 |...q.K0...2.U..B| +00000100 bf 6a 6a f9 79 b9 50 37 11 15 a4 b3 c8 a8 16 da |.jj.y.P7........| +00000110 e9 62 ed 3d 80 da 38 22 c6 c3 fd 1c b2 d2 8c 74 |.b.=..8".......t| +00000120 23 39 70 67 b0 34 25 24 eb 72 e2 c1 63 d6 48 09 |#9pg.4%$.r..c.H.| +00000130 ee d7 5e 15 2b 78 64 97 c8 d0 6b 2a 1c b6 d8 12 |..^.+xd...k*....| +00000140 9e 9a b5 dc 24 51 5a 38 a1 4c 9c df 74 3f 63 f0 |....$QZ8.L..t?c.| +00000150 d2 45 49 58 5c 3c 42 f2 56 fd bc 0e c1 d6 8b 7d |.EIX\@;#...| +00000350 b0 1d b7 bb 4f 90 8c 73 5a d2 f5 5b 4a 74 b0 25 |....O..sZ..[Jt.%| +00000360 eb a8 7e a0 9d 1a e4 4e bf 4f 55 b8 9d 93 cf 5b |..~....N.OU....[| +00000370 a4 22 3d 3b d5 8f 23 de 41 70 47 d8 3b 82 6b ba |."=;..#.ApG.;.k.| +00000380 26 f2 a2 e9 45 8e a9 72 1e 37 2e 0d a9 4b 54 b2 |&...E..r.7...KT.| +00000390 6f 8f ec 04 97 86 b4 e4 4c cc f1 ed c9 e1 61 b1 |o.......L.....a.| +000003a0 f8 a2 d7 fc a5 1a 8c 44 95 16 fc e3 25 b1 a9 d6 |.......D....%...| +000003b0 21 17 03 03 00 35 fa ad 27 32 8d 61 3a 32 36 ef |!....5..'2.a:26.| +000003c0 ea ff 4e 95 cd a6 83 19 e2 72 85 44 33 b2 c0 45 |..N......r.D3..E| +000003d0 f0 34 92 ca 5a a2 14 4c 6c a3 95 bd fe 3b f8 fd |.4..Z..Ll....;..| +000003e0 e1 11 9b f6 8f 4f c6 ae 05 31 55 17 03 03 00 8b |.....O...1U.....| +000003f0 8a a3 df b3 a0 68 8a e1 4f db c6 2a 8e df dc b6 |.....h..O..*....| +00000400 07 b5 c4 c7 34 7f d8 e9 3f 88 0f 15 14 01 50 bc |....4...?.....P.| +00000410 64 05 8d 91 fa 24 1e 0e cf db 11 8c 46 58 6e f1 |d....$......FXn.| +00000420 09 68 14 9a 89 e0 6b ef ac 90 27 69 2b 01 6c 2e |.h....k...'i+.l.| +00000430 6d e9 26 9f b1 ff b8 6c 8b 33 bb e8 42 54 85 c9 |m.&....l.3..BT..| +00000440 14 d5 89 48 50 a6 8d be dd b8 96 f1 45 4f 90 08 |...HP.......EO..| +00000450 da cf 1f 75 33 85 d9 be 8e a5 4a c5 be a9 a3 16 |...u3.....J.....| +00000460 f6 37 02 79 ea c3 e5 10 ed ff d5 f2 3d 46 7b ed |.7.y........=F{.| +00000470 bf be 36 a2 8a 00 9f 30 02 54 71 |..6....0.Tq| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 00 35 b6 3d e7 c7 a8 |..........5.=...| +00000010 2d c2 a7 8b cc 13 db 7d c2 75 18 f9 86 20 2b f0 |-......}.u... +.| +00000020 e1 5d 11 b1 2d df 0c 12 a7 c5 3a 28 97 6e f8 f0 |.]..-.....:(.n..| +00000030 7f c0 81 72 68 a5 41 68 59 ef da 3e 2f ef 97 45 |...rh.AhY..>/..E| +>>> Flow 4 (server to client) +00000000 17 03 03 00 1e fd 53 e4 87 a2 41 38 98 a6 d8 fa |......S...A8....| +00000010 7b 65 66 98 37 a6 4a 06 6b 25 11 66 ed 9c 00 22 |{ef.7.J.k%.f..."| +00000020 83 6e f5 17 03 03 00 13 fc bb b9 93 79 3c 94 6c |.n..........y<.l| +00000030 1d 48 d9 5c 3e 51 86 fb 2a 0d d8 |.H.\>Q..*..| diff --git a/go/src/crypto/tls/testdata/Server-TLSv13-CHACHA20-SHA256 b/go/src/crypto/tls/testdata/Server-TLSv13-CHACHA20-SHA256 new file mode 100644 index 0000000000000000000000000000000000000000..1357ed41b29f52a9a573edfd018fe0d5708ef0a6 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv13-CHACHA20-SHA256 @@ -0,0 +1,97 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 ca 01 00 00 c6 03 03 c4 32 0e 10 66 |............2..f| +00000010 40 b2 cd 10 90 69 42 31 34 21 b1 a4 0e 15 f9 1e |@....iB14!......| +00000020 cd 2b 1d 1a 9a a5 4c 27 87 aa ba 20 6a f8 a9 57 |.+....L'... j..W| +00000030 72 d6 5b 81 86 e7 df a0 9c a3 f4 21 30 c9 68 f3 |r.[........!0.h.| +00000040 81 7c 2a 3a c6 fe 97 d7 40 c9 41 79 00 04 13 03 |.|*:....@.Ay....| +00000050 00 ff 01 00 00 79 00 0b 00 04 03 00 01 02 00 0a |.....y..........| +00000060 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 16 |................| +00000070 00 00 00 17 00 00 00 0d 00 1e 00 1c 04 03 05 03 |................| +00000080 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 |................| +00000090 08 06 04 01 05 01 06 01 00 2b 00 03 02 03 04 00 |.........+......| +000000a0 2d 00 02 01 01 00 33 00 26 00 24 00 1d 00 20 89 |-.....3.&.$... .| +000000b0 77 64 a7 d7 9f 30 4d 07 5c 4c f5 3b 67 a3 f2 e3 |wd...0M.\L.;g...| +000000c0 55 bb bb 9f 2e 18 26 04 b2 1a a2 64 c5 39 67 |U.....&....d.9g| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 00 00 00 00 00 |....z...v.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 6a f8 a9 57 |........... j..W| +00000030 72 d6 5b 81 86 e7 df a0 9c a3 f4 21 30 c9 68 f3 |r.[........!0.h.| +00000040 81 7c 2a 3a c6 fe 97 d7 40 c9 41 79 13 03 00 00 |.|*:....@.Ay....| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 2f |..+.....3.$... /| +00000060 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +00000070 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 14 |.........._X.;t.| +00000080 03 03 00 01 01 17 03 03 00 17 db 02 44 4c 7e 06 |............DL~.| +00000090 95 c7 f2 f7 8f f7 80 96 d0 11 b7 d7 d6 9e 40 3b |..............@;| +000000a0 0f 17 03 03 02 6d 63 90 e6 9e e7 fd 52 34 74 8f |.....mc.....R4t.| +000000b0 e5 db e8 90 49 90 89 8a c3 7f 33 a0 c7 91 2a 3f |....I.....3...*?| +000000c0 c5 1f 0c 00 58 9f 5e d7 01 35 24 92 a7 66 db 0e |....X.^..5$..f..| +000000d0 fd d3 6c ff 58 61 56 39 b3 9b 05 d2 a1 9f ab f1 |..l.XaV9........| +000000e0 29 ce b0 c6 37 c5 56 8d 0b 2a bd 0c 04 a3 c8 4e |)...7.V..*.....N| +000000f0 61 08 44 4b b7 f1 12 60 a9 f6 e7 02 14 e7 d4 1a |a.DK...`........| +00000100 cf e6 4d ce 11 7c e3 7b 44 95 6d fa 8e b2 3b f4 |..M..|.{D.m...;.| +00000110 bb 8e fa ed be ec fb f4 1d d0 12 56 d3 64 c8 cd |...........V.d..| +00000120 58 e0 e0 df c1 f2 c7 b5 7a 6c 23 ff d1 78 b7 76 |X.......zl#..x.v| +00000130 a5 96 66 5c 4e 49 5a 8e fd 9d 74 dc e7 f0 99 f8 |..f\NIZ...t.....| +00000140 d5 95 7a 5b ba b6 ab 87 90 a5 35 19 bf 99 2c 04 |..z[......5...,.| +00000150 93 61 e3 9b 5c 06 48 38 f0 25 8a be 30 cd 43 c0 |.a..\.H8.%..0.C.| +00000160 10 c9 1d 51 3e 93 5f 6c 02 1c 38 fe 78 44 1a ea |...Q>._l..8.xD..| +00000170 99 a4 ef 7d 03 ce 71 95 d7 1d e1 b3 b8 e2 20 99 |...}..q....... .| +00000180 aa 30 0f c1 75 a7 0d 39 98 12 96 27 c6 39 b8 57 |.0..u..9...'.9.W| +00000190 6e ab 79 c7 91 c2 56 9d b3 e1 cb 17 6a cc 42 47 |n.y...V.....j.BG| +000001a0 fc a4 52 10 ab cd 4b 1f 65 3e 35 61 ed 38 99 7b |..R...K.e>5a.8.{| +000001b0 a7 79 02 f2 16 cb 85 fb 85 f8 86 56 40 6b ee 2f |.y.........V@k./| +000001c0 38 c6 4f 9c 25 14 b6 e4 5f 5c cc 73 ef 69 f3 5a |8.O.%..._\.s.i.Z| +000001d0 c6 ef 0d 65 e8 d4 f8 c6 0c 5b 09 88 4d 09 e7 50 |...e.....[..M..P| +000001e0 86 d0 2d 6c 8c 99 d0 d9 6a 24 77 97 47 59 9d ce |..-l....j$w.GY..| +000001f0 b9 a5 34 99 f6 0b 08 9a 7e 79 8d 84 8e c2 ae ac |..4.....~y......| +00000200 ca b3 af 5d 7d 96 d2 99 3b da ee ec 36 b3 ad 71 |...]}...;...6..q| +00000210 89 17 de 52 71 75 99 ca e7 02 c2 ab ae da 5b 22 |...Rqu........["| +00000220 a7 88 0c ae c5 c0 b0 1f 3c cd da fa e7 8b 39 46 |........<.....9F| +00000230 84 c0 1a 33 29 ed 90 0e 5b 32 86 96 9f 97 69 66 |...3)...[2....if| +00000240 90 08 0e 0e 84 4d 43 55 c1 be 08 20 85 fc 9d 7a |.....MCU... ...z| +00000250 a6 df e8 31 b0 35 c3 69 b6 14 b2 ec 6c 7d ad ae |...1.5.i....l}..| +00000260 2b b4 c0 5a d1 07 a7 45 17 93 d6 a5 50 d0 e4 cc |+..Z...E....P...| +00000270 97 85 5d 06 21 62 e2 95 d7 b5 a5 a9 08 cf 34 f4 |..].!b........4.| +00000280 ae cc 17 e4 0e 4e 5a 13 b1 73 03 45 b9 29 b5 45 |.....NZ..s.E.).E| +00000290 77 a1 4b 2f 8f c5 72 41 dc ab f9 b7 f3 72 28 f4 |w.K/..rA.....r(.| +000002a0 cb 08 07 0a 20 7c 8b 26 70 92 7b 7b b9 99 61 0a |.... |.&p.{{..a.| +000002b0 63 17 e2 96 86 0a 6a 56 a1 90 1f 5e 50 bb 7f 72 |c.....jV...^P..r| +000002c0 73 58 f4 25 c8 18 ec a5 b1 86 cd 96 77 57 91 67 |sX.%........wW.g| +000002d0 76 e1 7a bf 1b 40 62 a0 58 d7 e8 2c 4c 86 7b ed |v.z..@b.X..,L.{.| +000002e0 7f 3f 43 38 88 97 f7 a1 5f 22 0c a0 4a a4 b3 b9 |.?C8...._"..J...| +000002f0 11 2c 31 f3 98 f0 21 42 fb 42 a7 9e 38 ce 58 5f |.,1...!B.B..8.X_| +00000300 bc d0 a5 43 07 d2 e1 4b 5f 5c fd 56 da 99 63 2a |...C...K_\.V..c*| +00000310 0d 7f 46 17 03 03 00 99 bf be 5f 82 e4 2b d8 9f |..F......._..+..| +00000320 cf ab 68 b0 3d a4 a0 c7 c3 41 dd e5 46 cf 7b 55 |..h.=....A..F.{U| +00000330 c7 6d 76 e4 62 60 c5 ae d3 a0 f0 44 8c 88 de 05 |.mv.b`.....D....| +00000340 5e 5e 03 61 fe 66 22 31 cf f5 75 b6 97 51 36 79 |^^.a.f"1..u..Q6y| +00000350 f0 b7 d1 7f e6 1a fa 04 73 23 ad 66 f8 6c 47 a7 |........s#.f.lG.| +00000360 cc 0b 96 c4 a7 a8 e8 4c 91 bc c9 32 30 ec db 2e |.......L...20...| +00000370 73 68 00 5b c3 83 17 60 51 b1 03 8d c3 f9 e1 e8 |sh.[...`Q.......| +00000380 f7 e7 a8 f4 94 b7 4f c1 bf aa 50 49 61 b1 11 0a |......O...PIa...| +00000390 78 24 cc 16 3b e5 10 72 95 df e4 a3 5d 2c ff ad |x$..;..r....],..| +000003a0 bd 50 04 93 3c 3c 48 28 0b e3 d9 d3 db 4d 4a 8f |.P..<.n....Rs| +00000410 b0 01 2c 04 8e 7b 70 c3 36 85 a4 44 aa 15 63 d6 |..,..{p.6..D..c.| +00000420 7d f4 81 86 3c 1e ad d3 b3 2c ea 33 bf 0e 71 68 |}...<....,.3..qh| +00000430 4a 1a 3a 98 bb 21 d4 75 6c 0d d2 30 b4 b3 86 5d |J.:..!.ul..0...]| +00000440 90 ab 49 dc 18 4f 08 10 8b 23 8d bd 61 68 75 ee |..I..O...#..ahu.| +00000450 87 62 54 2d 2d 1e c0 39 5c eb 32 40 7a da 4d 2f |.bT--..9\.2@z.M/| +00000460 83 f9 e8 1f 71 d7 79 99 24 8a b7 13 25 64 a6 ae |....q.y.$...%d..| +00000470 29 e2 48 6f f7 52 cf a4 aa c2 70 |).Ho.R....p| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 00 35 5e e5 2f e4 ed |..........5^./..| +00000010 87 c3 26 01 1a d0 4d c7 95 16 76 be 17 a3 f4 1f |..&...M...v.....| +00000020 57 27 f6 19 62 30 7e f0 47 6e 11 7f ce 85 54 9a |W'..b0~.Gn....T.| +00000030 1e 86 9a c6 10 5e 38 3c 0a de d1 4e 7e f1 9d 0f |.....^8<...N~...| +>>> Flow 4 (server to client) +00000000 17 03 03 00 1e 1f a0 f2 e5 47 62 54 e2 07 3d e2 |.........GbT..=.| +00000010 42 8a be ec e0 92 4e ae 1e 7a 75 6f 8d c0 65 73 |B.....N..zuo..es| +00000020 b5 eb bc 17 03 03 00 13 89 03 04 f9 42 a9 6d cf |............B.m.| +00000030 68 67 f4 ca e0 87 f9 ef d4 42 6a |hg.......Bj| diff --git a/go/src/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndECDSAGiven b/go/src/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndECDSAGiven new file mode 100644 index 0000000000000000000000000000000000000000..686011b0fa9b8251c513d7cbeb43ab9c171d8c81 --- /dev/null +++ b/go/src/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndECDSAGiven @@ -0,0 +1,182 @@ +>>> Flow 1 (client to server) +00000000 16 03 01 00 ca 01 00 00 c6 03 03 af 29 1d da b2 |............)...| +00000010 1b 14 96 f9 c9 6a 4d 28 cc 1d 9f c4 95 d0 a6 16 |.....jM(........| +00000020 1f 83 3d d6 17 80 5e 4f 9f d9 87 20 cb 34 16 64 |..=...^O... .4.d| +00000030 39 bb 98 16 55 43 38 3a a2 b4 e0 38 02 04 ee 6b |9...UC8:...8...k| +00000040 a6 4e b9 f8 83 09 aa 7b f5 de e0 79 00 04 13 01 |.N.....{...y....| +00000050 00 ff 01 00 00 79 00 0b 00 04 03 00 01 02 00 0a |.....y..........| +00000060 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 16 |................| +00000070 00 00 00 17 00 00 00 0d 00 1e 00 1c 04 03 05 03 |................| +00000080 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 |................| +00000090 08 06 04 01 05 01 06 01 00 2b 00 03 02 03 04 00 |.........+......| +000000a0 2d 00 02 01 01 00 33 00 26 00 24 00 1d 00 20 ee |-.....3.&.$... .| +000000b0 90 71 47 4a 18 b1 78 c4 9a 7d 65 5d 4e b3 88 96 |.qGJ..x..}e]N...| +000000c0 6c b1 bc 2d a3 9d 2d 8e a2 7a 7b eb 94 11 4e |l..-..-..z{...N| +>>> Flow 2 (server to client) +00000000 16 03 03 00 7a 02 00 00 76 03 03 00 00 00 00 00 |....z...v.......| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00000020 00 00 00 00 00 00 00 00 00 00 00 20 cb 34 16 64 |........... .4.d| +00000030 39 bb 98 16 55 43 38 3a a2 b4 e0 38 02 04 ee 6b |9...UC8:...8...k| +00000040 a6 4e b9 f8 83 09 aa 7b f5 de e0 79 13 01 00 00 |.N.....{...y....| +00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 2f |..+.....3.$... /| +00000060 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| +00000070 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 14 |.........._X.;t.| +00000080 03 03 00 01 01 17 03 03 00 17 c3 9d 29 f6 f8 18 |............)...| +00000090 b9 39 9f 93 b2 f5 ab 30 41 d6 95 40 21 ba f8 8e |.9.....0A..@!...| +000000a0 25 17 03 03 00 52 08 a9 80 f3 24 c6 a6 b6 aa bc |%....R....$.....| +000000b0 30 c2 f7 dd e6 47 10 88 db 0c dd 43 ab 78 bd 16 |0....G.....C.x..| +000000c0 82 7b 4f 26 9c 0e 47 6b 75 79 4e da 8e 43 8b e6 |.{O&..GkuyN..C..| +000000d0 6a 25 0d 47 50 bf 26 c8 16 70 41 1c b2 b5 cd d1 |j%.GP.&..pA.....| +000000e0 34 9b 26 13 92 45 b5 f5 03 04 cf 55 ee ff c8 e6 |4.&..E.....U....| +000000f0 92 9e 04 d9 c5 f5 fd 0f 17 03 03 02 6d f6 33 26 |............m.3&| +00000100 26 da 41 f2 4e 6e ed 41 23 44 29 5f 43 38 7d 24 |&.A.Nn.A#D)_C8}$| +00000110 f7 a1 01 d4 23 a5 bf 85 db 39 86 27 ff 9c e9 ac |....#....9.'....| +00000120 6c 0e 0e 51 c7 95 8d aa f6 59 53 0a 89 d4 e7 2d |l..Q.....YS....-| +00000130 6e f8 66 7d e5 b2 ac e4 7b b2 91 2b 31 c9 2b 4e |n.f}....{..+1.+N| +00000140 92 8f a9 c8 79 21 9a 8f a2 79 29 47 c4 ef ab 80 |....y!...y)G....| +00000150 25 02 d6 8c ae 32 3b 1a 55 0e f9 4a ba 92 b9 61 |%....2;.U..J...a| +00000160 86 39 04 0a a7 d6 eb 95 50 4f 86 1b c9 d1 1d 1e |.9......PO......| +00000170 61 06 43 00 c2 2a a9 e2 06 ff ce 4a fd 6f d0 19 |a.C..*.....J.o..| +00000180 2a 0e ec 14 86 19 9c bc 1d 96 e1 b1 00 b2 19 c4 |*...............| +00000190 15 64 4c 33 54 89 fc 15 01 90 13 3b ff 99 e6 23 |.dL3T......;...#| +000001a0 19 38 4f 67 97 ee ab b3 9f ca 1f 18 7d 45 ef 87 |.8Og........}E..| +000001b0 42 7b 57 51 d0 c3 43 50 35 a3 33 ff 19 df 54 8e |B{WQ..CP5.3...T.| +000001c0 e9 98 2f 46 93 87 b4 b1 c2 73 04 4f 06 5b 3c 0a |../F.....s.O.[<.| +000001d0 c3 87 6c 68 68 b4 61 a2 33 bd 11 06 93 19 fb 05 |..lhh.a.3.......| +000001e0 c3 e6 3f 14 e5 a6 6d ec 48 56 a6 37 60 81 a4 cd |..?...m.HV.7`...| +000001f0 89 b5 4e c8 dc 99 79 66 5e 40 44 de 4a 22 9a ce |..N...yf^@D.J"..| +00000200 3d c4 a0 17 03 45 e6 28 70 27 f5 24 e1 81 7a 5f |=....E.(p'.$..z_| +00000210 5d 6e 6c bc 28 c3 fb b1 8b 18 fa 3d 9d f3 c3 a5 |]nl.(......=....| +00000220 f0 41 7a 0d 87 c1 70 77 d3 3a fa ef 2b 11 9b 61 |.Az...pw.:..+..a| +00000230 12 f8 d1 25 73 bc 79 bf ee 9a 5e e0 3b fb 06 da |...%s.y...^.;...| +00000240 7e d6 08 aa 13 73 8a 8c 97 d7 5a e4 dc 88 51 60 |~....s....Z...Q`| +00000250 8c 61 51 65 f6 d0 4e 7d b0 b1 23 2c 69 77 20 fe |.aQe..N}..#,iw .| +00000260 d1 ff 13 57 d8 c5 58 1f 3c e9 86 f4 3a 45 1a 9c |...W..X.<...:E..| +00000270 c2 e0 4d da 67 1b 81 62 bf 07 de a6 ea 74 81 e3 |..M.g..b.....t..| +00000280 ba 1b 1f bf b0 d3 d3 08 c0 23 5f 05 d5 1f 41 51 |.........#_...AQ| +00000290 f2 11 2e 36 ed 00 f8 b5 ea f1 4c 0b b8 d0 a3 cc |...6......L.....| +000002a0 c6 a7 2a ee 1f 6c 6b 33 0d 38 5b 5c 6e f4 53 d2 |..*..lk3.8[\n.S.| +000002b0 6e 90 5b ce 44 e7 f1 50 1e 12 21 76 35 d1 2f 49 |n.[.D..P..!v5./I| +000002c0 a1 27 66 00 93 27 27 34 5d e5 ed 4b 6f 7e 3d e3 |.'f..''4]..Ko~=.| +000002d0 78 de 2f 48 9f 4c 36 a7 5d 62 98 1e 2c ee 82 3c |x./H.L6.]b..,..<| +000002e0 18 17 2d 80 f4 a2 ac e9 a6 c8 2c b9 92 d1 9e 2b |..-.......,....+| +000002f0 5f 3e 33 56 03 b5 76 51 ea c7 af 1c 42 8e 0e 65 |_>3V..vQ....B..e| +00000300 f7 0f ad 36 9f fe b5 a0 06 31 f0 89 02 b4 bf c3 |...6.....1......| +00000310 8e 2f 52 4d 97 99 dd 95 0f c4 32 9e 81 55 d1 2a |./RM......2..U.*| +00000320 05 ff b5 7a 02 0f 6f 1b ef f1 de 48 dc a8 f8 44 |...z..o....H...D| +00000330 35 8c eb df 6b 78 cd 89 75 ca ef 31 ba 8f b8 ff |5...kx..u..1....| +00000340 a3 74 39 ce 42 a0 01 8b db 68 34 21 0a bf 84 fd |.t9.B....h4!....| +00000350 5f 28 87 d4 09 b2 91 c2 f3 1f b8 39 da 2b 55 3c |_(.........9.+U<| +00000360 46 a2 fa 3d 65 eb 41 0c 37 c8 17 03 03 00 99 e8 |F..=e.A.7.......| +00000370 25 eb 99 2f 80 e2 09 ed 2f b9 78 90 7c dc e2 4a |%../..../.x.|..J| +00000380 78 19 49 46 a8 e7 82 a0 85 84 71 da 80 fb d2 5d |x.IF......q....]| +00000390 28 c4 69 cf ac 1c bc 1e ba 90 5c 0a ec dd 31 5c |(.i.......\...1\| +000003a0 87 d0 4f 31 3f 62 cd 91 1e 99 a5 08 c6 de 6c 75 |..O1?b........lu| +000003b0 91 be 31 83 12 5b fd 5a eb 96 ae 70 9c 06 c9 ee |..1..[.Z...p....| +000003c0 63 e9 3c a0 5b 9c 55 cb cd 9d a2 31 33 17 92 fa |c.<.[.U....13...| +000003d0 dc 34 20 43 71 92 8b 16 dd 1c 29 f5 ec a2 e4 ad |.4 Cq.....).....| +000003e0 d6 21 27 37 32 0c 7b f1 60 7f 58 aa fc d6 ae f3 |.!'72.{.`.X.....| +000003f0 c9 7b 5f 59 39 cf 79 ab 5b a3 7e ea 13 72 51 9f |.{_Y9.y.[.~..rQ.| +00000400 a9 c5 fc fb c0 da 39 2a 17 03 03 00 35 b7 6d ed |......9*....5.m.| +00000410 8d d3 c6 09 fd 9b 6b be 6e bc 01 64 3b a1 4e 2d |......k.n..d;.N-| +00000420 3d 85 e3 5b 4b 7b 44 49 81 fd c8 d9 07 fe e5 53 |=..[K{DI.......S| +00000430 ab 5f a3 64 f6 be 22 79 80 52 f0 ee 3c 1e 4e 65 |._.d.."y.R..<.Ne| +00000440 0e e3 |..| +>>> Flow 3 (client to server) +00000000 14 03 03 00 01 01 17 03 03 02 1e a8 48 8d 47 f6 |............H.G.| +00000010 3d d8 59 5b 26 9e bd fc d1 15 7c e1 37 1b db 3c |=.Y[&.....|.7..<| +00000020 e4 02 98 fd aa cc a6 45 97 6e c5 18 4e 45 8e d6 |.......E.n..NE..| +00000030 84 7a b5 e4 da 8b 17 34 e5 fb 21 3c f6 02 c2 5c |.z.....4..!<...\| +00000040 ea 57 ea 16 67 4a 6d b2 0e 5a 39 f8 6b 11 84 bd |.W..gJm..Z9.k...| +00000050 43 80 03 40 5e d2 d2 54 2e d1 38 bc 9a 16 4f 21 |C..@^..T..8...O!| +00000060 0e 07 38 b5 80 21 16 c6 a1 bb 23 79 a6 df ef 27 |..8..!....#y...'| +00000070 dc 30 3c 4a 53 b1 5c 54 a7 fb ff 73 e2 12 ab 90 |.0..*..`.d~q| +000001b0 45 26 b8 91 26 cc d6 bf d5 4d 26 3f 4f c8 73 99 |E&..&....M&?O.s.| +000001c0 a7 50 9d 14 09 b6 07 1a af aa 9b 02 31 b2 c6 22 |.P..........1.."| +000001d0 ca 3e e0 2f 27 87 27 2e 96 f4 b4 ba c6 01 77 d3 |.>./'.'.......w.| +000001e0 52 09 ea 79 9b ee b4 6a 41 29 b1 de de 74 6b b2 |R..y...jA)...tk.| +000001f0 11 b1 58 90 5c 6a 0d b5 51 4b 2e 1b 3e e6 f4 17 |..X.\j..QK..>...| +00000200 8e 8a 1d 1e c8 bd 55 3a fc f4 90 73 14 5f 63 1b |......U:...s._c.| +00000210 22 f0 81 fd 70 05 ca b2 fd 90 3c 9d 2e 73 d3 8c |"...p.....<..s..| +00000220 f0 0a 59 9e 46 fe 8c e2 22 17 03 03 00 a4 78 2b |..Y.F...".....x+| +00000230 ec c5 5e 71 85 c6 e5 5d 75 f3 b5 3d 55 de 1c f9 |..^q...]u..=U...| +00000240 06 92 be df ef 77 31 4b f3 13 b8 c7 7a 68 ec 1b |.....w1K....zh..| +00000250 e2 7c c0 ff b5 6f c2 62 bd 34 23 fd 6a 39 c7 ef |.|...o.b.4#.j9..| +00000260 91 47 77 7e 32 2e a9 b2 85 ae 01 3e 61 43 8a 93 |.Gw~2......>aC..| +00000270 72 14 e1 b7 a5 14 4b ca 6e cb 4d e7 a3 cd 74 98 |r.....K.n.M...t.| +00000280 4e 08 a4 d4 34 ea 73 17 4b 20 8b 40 03 10 a0 33 |N...4.s.K .@...3| +00000290 c9 2f c0 4c 3b a2 2c 61 3c ab ec e3 c0 e8 e2 d6 |./.L;.,a<.......| +000002a0 a0 85 fa 26 26 a9 65 dc 70 5b 8f b7 3f 9e b3 fb |...&&.e.p[..?...| +000002b0 44 36 62 79 75 af ef 94 05 6b d2 44 07 51 ae 91 |D6byu....k.D.Q..| +000002c0 ea e3 e7 d2 f4 2f 19 17 38 aa 1c ae cb 88 db 0b |...../..8.......| +000002d0 66 5a 17 03 03 00 35 6d d9 23 d1 3c c3 25 7b 5d |fZ....5m.#.<.%{]| +000002e0 8a 1a 41 00 00 f8 0c a7 3e 53 4e e5 f6 cb 11 3f |..A.....>SN....?| +000002f0 9c 66 62 80 98 6c 55 19 b1 6f 00 5d 46 93 d2 0b |.fb..lU..o.]F...| +00000300 79 58 1c d6 d7 f9 fc fb 38 c5 32 63 17 03 03 00 |yX......8.2c....| +00000310 13 72 a9 fd 60 5c cf 68 b3 32 15 04 33 1c e1 5f |.r..`\.h.2..3.._| +00000320 11 11 9e 8c |....| +>>> Flow 4 (server to client) +00000000 17 03 03 02 90 2e 71 49 81 51 71 9c 2f da 1e dc |......qI.Qq./...| +00000010 22 c0 a2 59 13 ad 41 ae 7b 18 56 d0 00 7b b5 cf |"..Y..A.{.V..{..| +00000020 47 e7 bc 8e 92 9e dc 88 78 3e 40 8e 8b 01 b0 30 |G.......x>@....0| +00000030 8f 7e 88 95 77 ed de 31 bf c5 78 ba a1 44 55 ec |.~..w..1..x..DU.| +00000040 b6 df 49 a9 df a0 92 b2 be b7 2c 1c 39 1b a0 63 |..I.......,.9..c| +00000050 18 e5 12 b7 5a a5 85 14 97 7d 9e e1 80 b7 15 c5 |....Z....}......| +00000060 2f ca e3 3b 48 91 42 07 f4 49 25 99 2c ee b8 b5 |/..;H.B..I%.,...| +00000070 05 a2 34 7d bb c0 87 4c f3 a8 07 89 fe b7 08 2c |..4}...L.......,| +00000080 e2 0b 27 6f 49 88 80 2f 3b 9c ae a6 3e 38 74 23 |..'oI../;...>8t#| +00000090 53 70 f5 84 0f 77 d4 94 68 f9 86 18 2f dc e1 94 |Sp...w..h.../...| +000000a0 3c e1 2c f2 84 07 f5 3c 88 99 63 ef a1 96 73 f9 |<.,....<..c...s.| +000000b0 46 43 c2 92 be 04 b8 6b 9e db e1 7f 63 b1 d4 15 |FC.....k....c...| +000000c0 36 2c 37 e3 c2 24 b2 4c c5 60 96 15 3b 20 01 67 |6,7..$.L.`..; .g| +000000d0 e5 52 9a 4f 17 6c 0a f1 a0 a3 31 48 e5 31 8e d3 |.R.O.l....1H.1..| +000000e0 b9 49 38 d2 55 4d 40 8e a2 bf dd 0f 19 25 42 55 |.I8.UM@......%BU| +000000f0 06 57 22 c5 06 c9 59 13 f7 c7 56 b1 68 20 f4 62 |.W"...Y...V.h .b| +00000100 19 0a 5d ab 5f 81 c6 50 b7 a2 f8 ce 55 f2 b6 6c |..]._..P....U..l| +00000110 67 39 75 82 1b a1 6b 85 58 37 c0 a5 12 64 a6 ee |g9u...k.X7...d..| +00000120 2e f8 f0 dc d2 50 08 47 0f 15 c8 37 2d ba 69 64 |.....P.G...7-.id| +00000130 e9 ea 7b fa 16 91 ed b6 24 0d fb e8 aa 74 6b 74 |..{.....$....tkt| +00000140 2d 78 2d 1c 2b 98 8e ab 74 6d 06 a3 00 8a e5 be |-x-.+...tm......| +00000150 c0 68 09 05 e0 95 0d c1 27 8a cf 05 09 0a 7c b9 |.h......'.....|.| +00000160 a1 3a 9b 45 3d d4 5d 16 64 5b d5 a3 6c d2 12 78 |.:.E=.].d[..l..x| +00000170 4f 6b ba 3a fe ad 35 9e 5e 0c 5f d4 f3 32 a2 0b |Ok.:..5.^._..2..| +00000180 f1 af d4 e5 f1 91 c6 6c 47 6b 30 a7 2f bf 60 05 |.......lGk0./.`.| +00000190 e3 c0 2d 9c 34 f2 f0 6b f2 ce 7f 19 d0 86 26 b0 |..-.4..k......&.| +000001a0 e1 7e 7b e0 0e 3d e7 f6 3c 7f 42 bc 9f a6 0a 25 |.~{..=..<.B....%| +000001b0 eb cf 1b 4b 44 10 df 7d f1 1f e3 a9 ea 4f 6d 52 |...KD..}.....OmR| +000001c0 70 b2 f0 0b a9 c5 bc 66 46 21 4d 92 c4 c3 f6 71 |p......fF!M....q| +000001d0 eb 46 c0 f3 e7 6f 4a ee 37 ad 8a ea 3b aa 51 79 |.F...oJ.7...;.Qy| +000001e0 d5 d5 18 7e e8 ae 31 1a db 16 04 d8 3c 94 17 f6 |...~..1.....<...| +000001f0 ad 8f 8b 5d 7d 14 fb b4 e9 b4 7e bb 75 f1 df de |...]}.....~.u...| +00000200 6f 0a 0d a8 f9 b5 d8 53 73 36 88 77 db e6 0e 84 |o......Ss6.w....| +00000210 fc 94 6b c9 cc 74 0f 01 40 39 c4 d0 66 2d 23 76 |..k..t..@9..f-#v| +00000220 9f 0d a1 53 94 a2 dd 56 83 9e 62 39 10 13 39 40 |...S...V..b9..9@| +00000230 55 09 b6 77 d2 22 9c 49 ef f9 af 93 ee d1 cf 3d |U..w.".I.......=| +00000240 1f 29 ef 27 94 3c 6d 23 d6 7c 33 e1 f7 cd 70 05 |.).'.Z..~..i7.| +000002b0 b0 90 43 11 e6 76 5e 2d 17 03 03 00 13 4b 69 75 |..C..v^-.....Kiu| +000002c0 3d 46 35 f6 85 4b 0b 6e f4 6b 30 2a 28 37 3c f1 |=F5..K.n.k0*(7<.| diff --git a/go/src/crypto/tls/testdata/example-cert.pem b/go/src/crypto/tls/testdata/example-cert.pem new file mode 100644 index 0000000000000000000000000000000000000000..e0bf7db58fff4f185117799386dfe755b7124414 --- /dev/null +++ b/go/src/crypto/tls/testdata/example-cert.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBhTCCASugAwIBAgIQIRi6zePL6mKjOipn+dNuaTAKBggqhkjOPQQDAjASMRAw +DgYDVQQKEwdBY21lIENvMB4XDTE3MTAyMDE5NDMwNloXDTE4MTAyMDE5NDMwNlow +EjEQMA4GA1UEChMHQWNtZSBDbzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABD0d +7VNhbWvZLWPuj/RtHFjvtJBEwOkhbN/BnnE8rnZR8+sbwnc/KhCk3FhnpHZnQz7B +5aETbbIgmuvewdjvSBSjYzBhMA4GA1UdDwEB/wQEAwICpDATBgNVHSUEDDAKBggr +BgEFBQcDATAPBgNVHRMBAf8EBTADAQH/MCkGA1UdEQQiMCCCDmxvY2FsaG9zdDo1 +NDUzgg4xMjcuMC4wLjE6NTQ1MzAKBggqhkjOPQQDAgNIADBFAiEA2zpJEPQyz6/l +Wf86aX6PepsntZv2GYlA5UpabfT2EZICICpJ5h/iI+i341gBmLiAFQOyTDT+/wQc +6MF9+Yw1Yy0t +-----END CERTIFICATE----- diff --git a/go/src/crypto/tls/testdata/example-key.pem b/go/src/crypto/tls/testdata/example-key.pem new file mode 100644 index 0000000000000000000000000000000000000000..104fb099f1cee6f401f45843bd0793acd353a2c3 --- /dev/null +++ b/go/src/crypto/tls/testdata/example-key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIIrYSSNQFaA2Hwf1duRSxKtLYX5CB04fSeQ6tF1aY/PuoAoGCCqGSM49 +AwEHoUQDQgAEPR3tU2Fta9ktY+6P9G0cWO+0kETA6SFs38GecTyudlHz6xvCdz8q +EKTcWGekdmdDPsHloRNtsiCa697B2O9IFA== +-----END EC PRIVATE KEY----- diff --git a/go/src/crypto/tls/ticket.go b/go/src/crypto/tls/ticket.go new file mode 100644 index 0000000000000000000000000000000000000000..11f7efde858539ff85d93db2addc4d3330d22413 --- /dev/null +++ b/go/src/crypto/tls/ticket.go @@ -0,0 +1,430 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "crypto/aes" + "crypto/cipher" + "crypto/hmac" + "crypto/sha256" + "crypto/subtle" + "crypto/x509" + "errors" + "io" + + "golang.org/x/crypto/cryptobyte" +) + +// A SessionState is a resumable session. +type SessionState struct { + // Encoded as a SessionState (in the language of RFC 8446, Section 3). + // + // enum { server(1), client(2) } SessionStateType; + // + // opaque Certificate<1..2^24-1>; + // + // Certificate CertificateChain<0..2^24-1>; + // + // opaque Extra<0..2^24-1>; + // + // struct { + // uint16 version; + // SessionStateType type; + // uint16 cipher_suite; + // uint64 created_at; + // opaque secret<1..2^8-1>; + // Extra extra<0..2^24-1>; + // uint8 ext_master_secret = { 0, 1 }; + // uint8 early_data = { 0, 1 }; + // CertificateEntry certificate_list<0..2^24-1>; + // CertificateChain verified_chains<0..2^24-1>; /* excluding leaf */ + // select (SessionState.early_data) { + // case 0: Empty; + // case 1: opaque alpn<1..2^8-1>; + // }; + // select (SessionState.version) { + // case VersionTLS10..VersionTLS12: uint16 curve_id; + // case VersionTLS13: select (SessionState.type) { + // case server: Empty; + // case client: struct { + // uint64 use_by; + // uint32 age_add; + // }; + // }; + // }; + // } SessionState; + // + // The format can be extended backwards-compatibly by adding new fields at + // the end. Otherwise, a new SessionStateType must be used, as different Go + // versions may share the same session ticket encryption key. + + // Extra is ignored by crypto/tls, but is encoded by [SessionState.Bytes] + // and parsed by [ParseSessionState]. + // + // This allows [Config.UnwrapSession]/[Config.WrapSession] and + // [ClientSessionCache] implementations to store and retrieve additional + // data alongside this session. + // + // To allow different layers in a protocol stack to share this field, + // applications must only append to it, not replace it, and must use entries + // that can be recognized even if out of order (for example, by starting + // with an id and version prefix). + Extra [][]byte + + // EarlyData indicates whether the ticket can be used for 0-RTT in a QUIC + // connection. The application may set this to false if it is true to + // decline to offer 0-RTT even if supported. + EarlyData bool + + version uint16 + isClient bool + cipherSuite uint16 + // createdAt is the generation time of the secret on the server (which for + // TLS 1.0–1.2 might be earlier than the current session) and the time at + // which the ticket was received on the client. + createdAt uint64 // seconds since UNIX epoch + secret []byte // master secret for TLS 1.2, or the PSK for TLS 1.3 + extMasterSecret bool + peerCertificates []*x509.Certificate + ocspResponse []byte + scts [][]byte + verifiedChains [][]*x509.Certificate + alpnProtocol string // only set if EarlyData is true + + // Client-side TLS 1.3-only fields. + useBy uint64 // seconds since UNIX epoch + ageAdd uint32 + ticket []byte + + // TLS 1.0–1.2 only fields. + curveID CurveID +} + +// Bytes encodes the session, including any private fields, so that it can be +// parsed by [ParseSessionState]. The encoding contains secret values critical +// to the security of future and possibly past sessions. +// +// The specific encoding should be considered opaque and may change incompatibly +// between Go versions. +func (s *SessionState) Bytes() ([]byte, error) { + var b cryptobyte.Builder + b.AddUint16(s.version) + if s.isClient { + b.AddUint8(2) // client + } else { + b.AddUint8(1) // server + } + b.AddUint16(s.cipherSuite) + addUint64(&b, s.createdAt) + b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddBytes(s.secret) + }) + b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { + for _, extra := range s.Extra { + b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddBytes(extra) + }) + } + }) + if s.extMasterSecret { + b.AddUint8(1) + } else { + b.AddUint8(0) + } + if s.EarlyData { + b.AddUint8(1) + } else { + b.AddUint8(0) + } + marshalCertificate(&b, Certificate{ + Certificate: certificatesToBytesSlice(s.peerCertificates), + OCSPStaple: s.ocspResponse, + SignedCertificateTimestamps: s.scts, + }) + b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { + for _, chain := range s.verifiedChains { + b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { + // We elide the first certificate because it's always the leaf. + if len(chain) == 0 { + b.SetError(errors.New("tls: internal error: empty verified chain")) + return + } + for _, cert := range chain[1:] { + b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddBytes(cert.Raw) + }) + } + }) + } + }) + if s.EarlyData { + b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { + b.AddBytes([]byte(s.alpnProtocol)) + }) + } + if s.version >= VersionTLS13 { + if s.isClient { + addUint64(&b, s.useBy) + b.AddUint32(s.ageAdd) + } + } else { + b.AddUint16(uint16(s.curveID)) + } + return b.Bytes() +} + +func certificatesToBytesSlice(certs []*x509.Certificate) [][]byte { + s := make([][]byte, 0, len(certs)) + for _, c := range certs { + s = append(s, c.Raw) + } + return s +} + +// ParseSessionState parses a [SessionState] encoded by [SessionState.Bytes]. +func ParseSessionState(data []byte) (*SessionState, error) { + ss := &SessionState{} + s := cryptobyte.String(data) + var typ, extMasterSecret, earlyData uint8 + var cert Certificate + var extra cryptobyte.String + if !s.ReadUint16(&ss.version) || + !s.ReadUint8(&typ) || + !s.ReadUint16(&ss.cipherSuite) || + !readUint64(&s, &ss.createdAt) || + !readUint8LengthPrefixed(&s, &ss.secret) || + !s.ReadUint24LengthPrefixed(&extra) || + !s.ReadUint8(&extMasterSecret) || + !s.ReadUint8(&earlyData) || + len(ss.secret) == 0 || + !unmarshalCertificate(&s, &cert) { + return nil, errors.New("tls: invalid session encoding") + } + for !extra.Empty() { + var e []byte + if !readUint24LengthPrefixed(&extra, &e) { + return nil, errors.New("tls: invalid session encoding") + } + ss.Extra = append(ss.Extra, e) + } + switch typ { + case 1: + ss.isClient = false + case 2: + ss.isClient = true + default: + return nil, errors.New("tls: unknown session encoding") + } + switch extMasterSecret { + case 0: + ss.extMasterSecret = false + case 1: + ss.extMasterSecret = true + default: + return nil, errors.New("tls: invalid session encoding") + } + switch earlyData { + case 0: + ss.EarlyData = false + case 1: + ss.EarlyData = true + default: + return nil, errors.New("tls: invalid session encoding") + } + for _, cert := range cert.Certificate { + c, err := globalCertCache.newCert(cert) + if err != nil { + return nil, err + } + ss.peerCertificates = append(ss.peerCertificates, c) + } + if ss.isClient && len(ss.peerCertificates) == 0 { + return nil, errors.New("tls: no server certificates in client session") + } + ss.ocspResponse = cert.OCSPStaple + ss.scts = cert.SignedCertificateTimestamps + var chainList cryptobyte.String + if !s.ReadUint24LengthPrefixed(&chainList) { + return nil, errors.New("tls: invalid session encoding") + } + for !chainList.Empty() { + var certList cryptobyte.String + if !chainList.ReadUint24LengthPrefixed(&certList) { + return nil, errors.New("tls: invalid session encoding") + } + var chain []*x509.Certificate + if len(ss.peerCertificates) == 0 { + return nil, errors.New("tls: invalid session encoding") + } + chain = append(chain, ss.peerCertificates[0]) + for !certList.Empty() { + var cert []byte + if !readUint24LengthPrefixed(&certList, &cert) { + return nil, errors.New("tls: invalid session encoding") + } + c, err := globalCertCache.newCert(cert) + if err != nil { + return nil, err + } + chain = append(chain, c) + } + ss.verifiedChains = append(ss.verifiedChains, chain) + } + if ss.EarlyData { + var alpn []byte + if !readUint8LengthPrefixed(&s, &alpn) { + return nil, errors.New("tls: invalid session encoding") + } + ss.alpnProtocol = string(alpn) + } + if ss.version >= VersionTLS13 { + if ss.isClient { + if !s.ReadUint64(&ss.useBy) || !s.ReadUint32(&ss.ageAdd) { + return nil, errors.New("tls: invalid session encoding") + } + } + } else { + if !s.ReadUint16((*uint16)(&ss.curveID)) { + return nil, errors.New("tls: invalid session encoding") + } + } + return ss, nil +} + +// sessionState returns a partially filled-out [SessionState] with information +// from the current connection. +func (c *Conn) sessionState() *SessionState { + return &SessionState{ + version: c.vers, + cipherSuite: c.cipherSuite, + createdAt: uint64(c.config.time().Unix()), + alpnProtocol: c.clientProtocol, + peerCertificates: c.peerCertificates, + ocspResponse: c.ocspResponse, + scts: c.scts, + isClient: c.isClient, + extMasterSecret: c.extMasterSecret, + verifiedChains: c.verifiedChains, + curveID: c.curveID, + } +} + +// EncryptTicket encrypts a ticket with the [Config]'s configured (or default) +// session ticket keys. It can be used as a [Config.WrapSession] implementation. +func (c *Config) EncryptTicket(cs ConnectionState, ss *SessionState) ([]byte, error) { + ticketKeys := c.ticketKeys(nil) + stateBytes, err := ss.Bytes() + if err != nil { + return nil, err + } + return c.encryptTicket(stateBytes, ticketKeys) +} + +func (c *Config) encryptTicket(state []byte, ticketKeys []ticketKey) ([]byte, error) { + if len(ticketKeys) == 0 { + return nil, errors.New("tls: internal error: session ticket keys unavailable") + } + + encrypted := make([]byte, aes.BlockSize+len(state)+sha256.Size) + iv := encrypted[:aes.BlockSize] + ciphertext := encrypted[aes.BlockSize : len(encrypted)-sha256.Size] + authenticated := encrypted[:len(encrypted)-sha256.Size] + macBytes := encrypted[len(encrypted)-sha256.Size:] + + if _, err := io.ReadFull(c.rand(), iv); err != nil { + return nil, err + } + key := ticketKeys[0] + block, err := aes.NewCipher(key.aesKey[:]) + if err != nil { + return nil, errors.New("tls: failed to create cipher while encrypting ticket: " + err.Error()) + } + cipher.NewCTR(block, iv).XORKeyStream(ciphertext, state) + + mac := hmac.New(sha256.New, key.hmacKey[:]) + mac.Write(authenticated) + mac.Sum(macBytes[:0]) + + return encrypted, nil +} + +// DecryptTicket decrypts a ticket encrypted by [Config.EncryptTicket]. It can +// be used as a [Config.UnwrapSession] implementation. +// +// If the ticket can't be decrypted or parsed, DecryptTicket returns (nil, nil). +func (c *Config) DecryptTicket(identity []byte, cs ConnectionState) (*SessionState, error) { + ticketKeys := c.ticketKeys(nil) + stateBytes := c.decryptTicket(identity, ticketKeys) + if stateBytes == nil { + return nil, nil + } + s, err := ParseSessionState(stateBytes) + if err != nil { + return nil, nil // drop unparsable tickets on the floor + } + return s, nil +} + +func (c *Config) decryptTicket(encrypted []byte, ticketKeys []ticketKey) []byte { + if len(encrypted) < aes.BlockSize+sha256.Size { + return nil + } + + iv := encrypted[:aes.BlockSize] + ciphertext := encrypted[aes.BlockSize : len(encrypted)-sha256.Size] + authenticated := encrypted[:len(encrypted)-sha256.Size] + macBytes := encrypted[len(encrypted)-sha256.Size:] + + for _, key := range ticketKeys { + mac := hmac.New(sha256.New, key.hmacKey[:]) + mac.Write(authenticated) + expected := mac.Sum(nil) + + if subtle.ConstantTimeCompare(macBytes, expected) != 1 { + continue + } + + block, err := aes.NewCipher(key.aesKey[:]) + if err != nil { + return nil + } + plaintext := make([]byte, len(ciphertext)) + cipher.NewCTR(block, iv).XORKeyStream(plaintext, ciphertext) + + return plaintext + } + + return nil +} + +// ClientSessionState contains the state needed by a client to +// resume a previous TLS session. +type ClientSessionState struct { + session *SessionState +} + +// ResumptionState returns the session ticket sent by the server (also known as +// the session's identity) and the state necessary to resume this session. +// +// It can be called by [ClientSessionCache.Put] to serialize (with +// [SessionState.Bytes]) and store the session. +func (cs *ClientSessionState) ResumptionState() (ticket []byte, state *SessionState, err error) { + if cs == nil || cs.session == nil { + return nil, nil, nil + } + return cs.session.ticket, cs.session, nil +} + +// NewResumptionState returns a state value that can be returned by +// [ClientSessionCache.Get] to resume a previous session. +// +// state needs to be returned by [ParseSessionState], and the ticket and session +// state must have been returned by [ClientSessionState.ResumptionState]. +func NewResumptionState(ticket []byte, state *SessionState) (*ClientSessionState, error) { + state.ticket = ticket + return &ClientSessionState{ + session: state, + }, nil +} diff --git a/go/src/crypto/tls/ticket_test.go b/go/src/crypto/tls/ticket_test.go new file mode 100644 index 0000000000000000000000000000000000000000..f925451cef03408b68edf4ebff2b3936c8bb7b68 --- /dev/null +++ b/go/src/crypto/tls/ticket_test.go @@ -0,0 +1,8 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +var _ = &Config{WrapSession: (&Config{}).EncryptTicket} +var _ = &Config{UnwrapSession: (&Config{}).DecryptTicket} diff --git a/go/src/crypto/tls/tls.go b/go/src/crypto/tls/tls.go new file mode 100644 index 0000000000000000000000000000000000000000..69f096870c9f489a64a389debacd04c97bf3f235 --- /dev/null +++ b/go/src/crypto/tls/tls.go @@ -0,0 +1,383 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package tls partially implements TLS 1.2, as specified in RFC 5246, +// and TLS 1.3, as specified in RFC 8446. +// +// # FIPS 140-3 mode +// +// When the program is in [FIPS 140-3 mode], this package behaves as if only +// SP 800-140C and SP 800-140D approved protocol versions, cipher suites, +// signature algorithms, certificate public key types and sizes, and key +// exchange and derivation algorithms were implemented. Others are silently +// ignored and not negotiated, or rejected. This set may depend on the +// algorithms supported by the FIPS 140-3 Go Cryptographic Module selected with +// GOFIPS140, and may change across Go versions. +// +// [FIPS 140-3 mode]: https://go.dev/doc/security/fips140 +package tls + +// BUG(agl): The crypto/tls package only implements some countermeasures +// against Lucky13 attacks on CBC-mode encryption, and only on SHA1 +// variants. See http://www.isg.rhul.ac.uk/tls/TLStiming.pdf and +// https://www.imperialviolet.org/2013/02/04/luckythirteen.html. + +import ( + "context" + "crypto" + "crypto/ecdsa" + "crypto/ed25519" + "crypto/rsa" + "crypto/x509" + "encoding/pem" + "errors" + "fmt" + "internal/godebug" + "net" + "os" + "strings" +) + +// Server returns a new TLS server side connection +// using conn as the underlying transport. +// The configuration config must be non-nil and must include +// at least one certificate or else set GetCertificate. +func Server(conn net.Conn, config *Config) *Conn { + c := &Conn{ + conn: conn, + config: config, + } + c.handshakeFn = c.serverHandshake + return c +} + +// Client returns a new TLS client side connection +// using conn as the underlying transport. +// The config cannot be nil: users must set either ServerName or +// InsecureSkipVerify in the config. +func Client(conn net.Conn, config *Config) *Conn { + c := &Conn{ + conn: conn, + config: config, + isClient: true, + } + c.handshakeFn = c.clientHandshake + return c +} + +// A listener implements a network listener (net.Listener) for TLS connections. +type listener struct { + net.Listener + config *Config +} + +// Accept waits for and returns the next incoming TLS connection. +// The returned connection is of type *Conn. +func (l *listener) Accept() (net.Conn, error) { + c, err := l.Listener.Accept() + if err != nil { + return nil, err + } + return Server(c, l.config), nil +} + +// NewListener creates a Listener which accepts connections from an inner +// Listener and wraps each connection with [Server]. +// The configuration config must be non-nil and must include +// at least one certificate or else set GetCertificate. +func NewListener(inner net.Listener, config *Config) net.Listener { + l := new(listener) + l.Listener = inner + l.config = config + return l +} + +// Listen creates a TLS listener accepting connections on the +// given network address using net.Listen. +// The configuration config must be non-nil and must include +// at least one certificate or else set GetCertificate. +func Listen(network, laddr string, config *Config) (net.Listener, error) { + // If this condition changes, consider updating http.Server.ServeTLS too. + if config == nil || len(config.Certificates) == 0 && + config.GetCertificate == nil && config.GetConfigForClient == nil { + return nil, errors.New("tls: neither Certificates, GetCertificate, nor GetConfigForClient set in Config") + } + l, err := net.Listen(network, laddr) + if err != nil { + return nil, err + } + return NewListener(l, config), nil +} + +type timeoutError struct{} + +func (timeoutError) Error() string { return "tls: DialWithDialer timed out" } +func (timeoutError) Timeout() bool { return true } +func (timeoutError) Temporary() bool { return true } + +// DialWithDialer connects to the given network address using dialer.Dial and +// then initiates a TLS handshake, returning the resulting TLS connection. Any +// timeout or deadline given in the dialer apply to connection and TLS +// handshake as a whole. +// +// DialWithDialer interprets a nil configuration as equivalent to the zero +// configuration; see the documentation of [Config] for the defaults. +// +// DialWithDialer uses context.Background internally; to specify the context, +// use [Dialer.DialContext] with NetDialer set to the desired dialer. +func DialWithDialer(dialer *net.Dialer, network, addr string, config *Config) (*Conn, error) { + return dial(context.Background(), dialer, network, addr, config) +} + +func dial(ctx context.Context, netDialer *net.Dialer, network, addr string, config *Config) (*Conn, error) { + if netDialer.Timeout != 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, netDialer.Timeout) + defer cancel() + } + + if !netDialer.Deadline.IsZero() { + var cancel context.CancelFunc + ctx, cancel = context.WithDeadline(ctx, netDialer.Deadline) + defer cancel() + } + + rawConn, err := netDialer.DialContext(ctx, network, addr) + if err != nil { + return nil, err + } + + colonPos := strings.LastIndex(addr, ":") + if colonPos == -1 { + colonPos = len(addr) + } + hostname := addr[:colonPos] + + if config == nil { + config = defaultConfig() + } + // If no ServerName is set, infer the ServerName + // from the hostname we're connecting to. + if config.ServerName == "" { + // Make a copy to avoid polluting argument or default. + c := config.Clone() + c.ServerName = hostname + config = c + } + + conn := Client(rawConn, config) + if err := conn.HandshakeContext(ctx); err != nil { + rawConn.Close() + return nil, err + } + return conn, nil +} + +// Dial connects to the given network address using net.Dial +// and then initiates a TLS handshake, returning the resulting +// TLS connection. +// Dial interprets a nil configuration as equivalent to +// the zero configuration; see the documentation of Config +// for the defaults. +func Dial(network, addr string, config *Config) (*Conn, error) { + return DialWithDialer(new(net.Dialer), network, addr, config) +} + +// Dialer dials TLS connections given a configuration and a Dialer for the +// underlying connection. +type Dialer struct { + // NetDialer is the optional dialer to use for the TLS connections' + // underlying TCP connections. + // A nil NetDialer is equivalent to the net.Dialer zero value. + NetDialer *net.Dialer + + // Config is the TLS configuration to use for new connections. + // A nil configuration is equivalent to the zero + // configuration; see the documentation of Config for the + // defaults. + Config *Config +} + +// Dial connects to the given network address and initiates a TLS +// handshake, returning the resulting TLS connection. +// +// The returned [Conn], if any, will always be of type *[Conn]. +// +// Dial uses context.Background internally; to specify the context, +// use [Dialer.DialContext]. +func (d *Dialer) Dial(network, addr string) (net.Conn, error) { + return d.DialContext(context.Background(), network, addr) +} + +func (d *Dialer) netDialer() *net.Dialer { + if d.NetDialer != nil { + return d.NetDialer + } + return new(net.Dialer) +} + +// DialContext connects to the given network address and initiates a TLS +// handshake, returning the resulting TLS connection. +// +// The provided Context must be non-nil. If the context expires before +// the connection is complete, an error is returned. Once successfully +// connected, any expiration of the context will not affect the +// connection. +// +// The returned [Conn], if any, will always be of type *[Conn]. +func (d *Dialer) DialContext(ctx context.Context, network, addr string) (net.Conn, error) { + c, err := dial(ctx, d.netDialer(), network, addr, d.Config) + if err != nil { + // Don't return c (a typed nil) in an interface. + return nil, err + } + return c, nil +} + +// LoadX509KeyPair reads and parses a public/private key pair from a pair of +// files. The files must contain PEM encoded data. The certificate file may +// contain intermediate certificates following the leaf certificate to form a +// certificate chain. On successful return, Certificate.Leaf will be populated. +// +// Before Go 1.23 Certificate.Leaf was left nil, and the parsed certificate was +// discarded. This behavior can be re-enabled by setting "x509keypairleaf=0" +// in the GODEBUG environment variable. +func LoadX509KeyPair(certFile, keyFile string) (Certificate, error) { + certPEMBlock, err := os.ReadFile(certFile) + if err != nil { + return Certificate{}, err + } + keyPEMBlock, err := os.ReadFile(keyFile) + if err != nil { + return Certificate{}, err + } + return X509KeyPair(certPEMBlock, keyPEMBlock) +} + +var x509keypairleaf = godebug.New("x509keypairleaf") + +// X509KeyPair parses a public/private key pair from a pair of +// PEM encoded data. On successful return, Certificate.Leaf will be populated. +// +// Before Go 1.23 Certificate.Leaf was left nil, and the parsed certificate was +// discarded. This behavior can be re-enabled by setting "x509keypairleaf=0" +// in the GODEBUG environment variable. +func X509KeyPair(certPEMBlock, keyPEMBlock []byte) (Certificate, error) { + fail := func(err error) (Certificate, error) { return Certificate{}, err } + + var cert Certificate + var skippedBlockTypes []string + for { + var certDERBlock *pem.Block + certDERBlock, certPEMBlock = pem.Decode(certPEMBlock) + if certDERBlock == nil { + break + } + if certDERBlock.Type == "CERTIFICATE" { + cert.Certificate = append(cert.Certificate, certDERBlock.Bytes) + } else { + skippedBlockTypes = append(skippedBlockTypes, certDERBlock.Type) + } + } + + if len(cert.Certificate) == 0 { + if len(skippedBlockTypes) == 0 { + return fail(errors.New("tls: failed to find any PEM data in certificate input")) + } + if len(skippedBlockTypes) == 1 && strings.HasSuffix(skippedBlockTypes[0], "PRIVATE KEY") { + return fail(errors.New("tls: failed to find certificate PEM data in certificate input, but did find a private key; PEM inputs may have been switched")) + } + return fail(fmt.Errorf("tls: failed to find \"CERTIFICATE\" PEM block in certificate input after skipping PEM blocks of the following types: %v", skippedBlockTypes)) + } + + skippedBlockTypes = skippedBlockTypes[:0] + var keyDERBlock *pem.Block + for { + keyDERBlock, keyPEMBlock = pem.Decode(keyPEMBlock) + if keyDERBlock == nil { + if len(skippedBlockTypes) == 0 { + return fail(errors.New("tls: failed to find any PEM data in key input")) + } + if len(skippedBlockTypes) == 1 && skippedBlockTypes[0] == "CERTIFICATE" { + return fail(errors.New("tls: found a certificate rather than a key in the PEM for the private key")) + } + return fail(fmt.Errorf("tls: failed to find PEM block with type ending in \"PRIVATE KEY\" in key input after skipping PEM blocks of the following types: %v", skippedBlockTypes)) + } + if keyDERBlock.Type == "PRIVATE KEY" || strings.HasSuffix(keyDERBlock.Type, " PRIVATE KEY") { + break + } + skippedBlockTypes = append(skippedBlockTypes, keyDERBlock.Type) + } + + // We don't need to parse the public key for TLS, but we so do anyway + // to check that it looks sane and matches the private key. + x509Cert, err := x509.ParseCertificate(cert.Certificate[0]) + if err != nil { + return fail(err) + } + + if x509keypairleaf.Value() != "0" { + cert.Leaf = x509Cert + } else { + x509keypairleaf.IncNonDefault() + } + + cert.PrivateKey, err = parsePrivateKey(keyDERBlock.Bytes) + if err != nil { + return fail(err) + } + + switch pub := x509Cert.PublicKey.(type) { + case *rsa.PublicKey: + priv, ok := cert.PrivateKey.(*rsa.PrivateKey) + if !ok { + return fail(errors.New("tls: private key type does not match public key type")) + } + if !priv.PublicKey.Equal(pub) { + return fail(errors.New("tls: private key does not match public key")) + } + case *ecdsa.PublicKey: + priv, ok := cert.PrivateKey.(*ecdsa.PrivateKey) + if !ok { + return fail(errors.New("tls: private key type does not match public key type")) + } + if !priv.PublicKey.Equal(pub) { + return fail(errors.New("tls: private key does not match public key")) + } + case ed25519.PublicKey: + priv, ok := cert.PrivateKey.(ed25519.PrivateKey) + if !ok { + return fail(errors.New("tls: private key type does not match public key type")) + } + if !priv.Public().(ed25519.PublicKey).Equal(pub) { + return fail(errors.New("tls: private key does not match public key")) + } + default: + return fail(errors.New("tls: unknown public key algorithm")) + } + + return cert, nil +} + +// Attempt to parse the given private key DER block. OpenSSL 0.9.8 generates +// PKCS #1 private keys by default, while OpenSSL 1.0.0 generates PKCS #8 keys. +// OpenSSL ecparam generates SEC1 EC private keys for ECDSA. We try all three. +func parsePrivateKey(der []byte) (crypto.PrivateKey, error) { + if key, err := x509.ParsePKCS1PrivateKey(der); err == nil { + return key, nil + } + if key, err := x509.ParsePKCS8PrivateKey(der); err == nil { + switch key := key.(type) { + case *rsa.PrivateKey, *ecdsa.PrivateKey, ed25519.PrivateKey: + return key, nil + default: + return nil, errors.New("tls: found unknown private key type in PKCS#8 wrapping") + } + } + if key, err := x509.ParseECPrivateKey(der); err == nil { + return key, nil + } + + return nil, errors.New("tls: failed to parse private key") +} diff --git a/go/src/crypto/tls/tls_test.go b/go/src/crypto/tls/tls_test.go new file mode 100644 index 0000000000000000000000000000000000000000..86322390862137772bfcce2e2ed472a7473a675c --- /dev/null +++ b/go/src/crypto/tls/tls_test.go @@ -0,0 +1,2506 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "bytes" + "context" + "crypto" + "crypto/ecdh" + "crypto/ecdsa" + "crypto/elliptic" + "crypto/fips140" + "crypto/internal/boring" + "crypto/rand" + "crypto/tls/internal/fips140tls" + "crypto/x509" + "crypto/x509/pkix" + "encoding/asn1" + "encoding/json" + "encoding/pem" + "errors" + "fmt" + "internal/testenv" + "io" + "math" + "math/big" + "net" + "os" + "reflect" + "slices" + "strings" + "testing" + "time" + + "golang.org/x/crypto/cryptobyte" +) + +var rsaCertPEM = `-----BEGIN CERTIFICATE----- +MIIB0zCCAX2gAwIBAgIJAI/M7BYjwB+uMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV +BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX +aWRnaXRzIFB0eSBMdGQwHhcNMTIwOTEyMjE1MjAyWhcNMTUwOTEyMjE1MjAyWjBF +MQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50 +ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANLJ +hPHhITqQbPklG3ibCVxwGMRfp/v4XqhfdQHdcVfHap6NQ5Wok/4xIA+ui35/MmNa +rtNuC+BdZ1tMuVCPFZcCAwEAAaNQME4wHQYDVR0OBBYEFJvKs8RfJaXTH08W+SGv +zQyKn0H8MB8GA1UdIwQYMBaAFJvKs8RfJaXTH08W+SGvzQyKn0H8MAwGA1UdEwQF +MAMBAf8wDQYJKoZIhvcNAQEFBQADQQBJlffJHybjDGxRMqaRmDhX0+6v02TUKZsW +r5QuVbpQhH6u+0UgcW0jp9QwpxoPTLTWGXEWBBBurxFwiCBhkQ+V +-----END CERTIFICATE----- +` + +var rsaKeyPEM = testingKey(`-----BEGIN RSA TESTING KEY----- +MIIBOwIBAAJBANLJhPHhITqQbPklG3ibCVxwGMRfp/v4XqhfdQHdcVfHap6NQ5Wo +k/4xIA+ui35/MmNartNuC+BdZ1tMuVCPFZcCAwEAAQJAEJ2N+zsR0Xn8/Q6twa4G +6OB1M1WO+k+ztnX/1SvNeWu8D6GImtupLTYgjZcHufykj09jiHmjHx8u8ZZB/o1N +MQIhAPW+eyZo7ay3lMz1V01WVjNKK9QSn1MJlb06h/LuYv9FAiEA25WPedKgVyCW +SmUwbPw8fnTcpqDWE3yTO3vKcebqMSsCIBF3UmVue8YU3jybC3NxuXq3wNm34R8T +xVLHwDXh/6NJAiEAl2oHGGLz64BuAfjKrqwz7qMYr9HCLIe/YsoWq/olzScCIQDi +D2lWusoe2/nEqfDVVWGWlyJ7yOmqaVm/iNUN9B2N2g== +-----END RSA TESTING KEY----- +`) + +// keyPEM is the same as rsaKeyPEM, but declares itself as just +// "PRIVATE KEY", not "RSA PRIVATE KEY". https://golang.org/issue/4477 +var keyPEM = testingKey(`-----BEGIN TESTING KEY----- +MIIBOwIBAAJBANLJhPHhITqQbPklG3ibCVxwGMRfp/v4XqhfdQHdcVfHap6NQ5Wo +k/4xIA+ui35/MmNartNuC+BdZ1tMuVCPFZcCAwEAAQJAEJ2N+zsR0Xn8/Q6twa4G +6OB1M1WO+k+ztnX/1SvNeWu8D6GImtupLTYgjZcHufykj09jiHmjHx8u8ZZB/o1N +MQIhAPW+eyZo7ay3lMz1V01WVjNKK9QSn1MJlb06h/LuYv9FAiEA25WPedKgVyCW +SmUwbPw8fnTcpqDWE3yTO3vKcebqMSsCIBF3UmVue8YU3jybC3NxuXq3wNm34R8T +xVLHwDXh/6NJAiEAl2oHGGLz64BuAfjKrqwz7qMYr9HCLIe/YsoWq/olzScCIQDi +D2lWusoe2/nEqfDVVWGWlyJ7yOmqaVm/iNUN9B2N2g== +-----END TESTING KEY----- +`) + +var ecdsaCertPEM = `-----BEGIN CERTIFICATE----- +MIIB/jCCAWICCQDscdUxw16XFDAJBgcqhkjOPQQBMEUxCzAJBgNVBAYTAkFVMRMw +EQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0 +eSBMdGQwHhcNMTIxMTE0MTI0MDQ4WhcNMTUxMTE0MTI0MDQ4WjBFMQswCQYDVQQG +EwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lk +Z2l0cyBQdHkgTHRkMIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQBY9+my9OoeSUR +lDQdV/x8LsOuLilthhiS1Tz4aGDHIPwC1mlvnf7fg5lecYpMCrLLhauAc1UJXcgl +01xoLuzgtAEAgv2P/jgytzRSpUYvgLBt1UA0leLYBy6mQQbrNEuqT3INapKIcUv8 +XxYP0xMEUksLPq6Ca+CRSqTtrd/23uTnapkwCQYHKoZIzj0EAQOBigAwgYYCQXJo +A7Sl2nLVf+4Iu/tAX/IF4MavARKC4PPHK3zfuGfPR3oCCcsAoz3kAzOeijvd0iXb +H5jBImIxPL4WxQNiBTexAkF8D1EtpYuWdlVQ80/h/f4pBcGiXPqX5h2PQSQY7hP1 ++jwM1FGS4fREIOvlBYr/SzzQRtwrvrzGYxDEDbsC0ZGRnA== +-----END CERTIFICATE----- +` + +var ecdsaKeyPEM = testingKey(`-----BEGIN EC PARAMETERS----- +BgUrgQQAIw== +-----END EC PARAMETERS----- +-----BEGIN EC TESTING KEY----- +MIHcAgEBBEIBrsoKp0oqcv6/JovJJDoDVSGWdirrkgCWxrprGlzB9o0X8fV675X0 +NwuBenXFfeZvVcwluO7/Q9wkYoPd/t3jGImgBwYFK4EEACOhgYkDgYYABAFj36bL +06h5JRGUNB1X/Hwuw64uKW2GGJLVPPhoYMcg/ALWaW+d/t+DmV5xikwKssuFq4Bz +VQldyCXTXGgu7OC0AQCC/Y/+ODK3NFKlRi+AsG3VQDSV4tgHLqZBBus0S6pPcg1q +kohxS/xfFg/TEwRSSws+roJr4JFKpO2t3/be5OdqmQ== +-----END EC TESTING KEY----- +`) + +var keyPairTests = []struct { + algo string + cert string + key string +}{ + {"ECDSA", ecdsaCertPEM, ecdsaKeyPEM}, + {"RSA", rsaCertPEM, rsaKeyPEM}, + {"RSA-untyped", rsaCertPEM, keyPEM}, // golang.org/issue/4477 +} + +func TestX509KeyPair(t *testing.T) { + t.Parallel() + var pem []byte + for _, test := range keyPairTests { + pem = []byte(test.cert + test.key) + if _, err := X509KeyPair(pem, pem); err != nil { + t.Errorf("Failed to load %s cert followed by %s key: %s", test.algo, test.algo, err) + } + pem = []byte(test.key + test.cert) + if _, err := X509KeyPair(pem, pem); err != nil { + t.Errorf("Failed to load %s key followed by %s cert: %s", test.algo, test.algo, err) + } + } +} + +func TestX509KeyPairErrors(t *testing.T) { + _, err := X509KeyPair([]byte(rsaKeyPEM), []byte(rsaCertPEM)) + if err == nil { + t.Fatalf("X509KeyPair didn't return an error when arguments were switched") + } + if subStr := "been switched"; !strings.Contains(err.Error(), subStr) { + t.Fatalf("Expected %q in the error when switching arguments to X509KeyPair, but the error was %q", subStr, err) + } + + _, err = X509KeyPair([]byte(rsaCertPEM), []byte(rsaCertPEM)) + if err == nil { + t.Fatalf("X509KeyPair didn't return an error when both arguments were certificates") + } + if subStr := "certificate"; !strings.Contains(err.Error(), subStr) { + t.Fatalf("Expected %q in the error when both arguments to X509KeyPair were certificates, but the error was %q", subStr, err) + } + + const nonsensePEM = ` +-----BEGIN NONSENSE----- +Zm9vZm9vZm9v +-----END NONSENSE----- +` + + _, err = X509KeyPair([]byte(nonsensePEM), []byte(nonsensePEM)) + if err == nil { + t.Fatalf("X509KeyPair didn't return an error when both arguments were nonsense") + } + if subStr := "NONSENSE"; !strings.Contains(err.Error(), subStr) { + t.Fatalf("Expected %q in the error when both arguments to X509KeyPair were nonsense, but the error was %q", subStr, err) + } +} + +func TestX509MixedKeyPair(t *testing.T) { + if _, err := X509KeyPair([]byte(rsaCertPEM), []byte(ecdsaKeyPEM)); err == nil { + t.Error("Load of RSA certificate succeeded with ECDSA private key") + } + if _, err := X509KeyPair([]byte(ecdsaCertPEM), []byte(rsaKeyPEM)); err == nil { + t.Error("Load of ECDSA certificate succeeded with RSA private key") + } +} + +func newLocalListener(t testing.TB) net.Listener { + t.Helper() + ln, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + ln, err = net.Listen("tcp6", "[::1]:0") + } + if err != nil { + t.Fatal(err) + } + return ln +} + +func runWithFIPSEnabled(t *testing.T, testFunc func(t *testing.T)) { + originalFIPS := fips140tls.Required() + defer func() { + if originalFIPS { + fips140tls.Force() + } else { + fips140tls.TestingOnlyAbandon() + } + }() + + fips140tls.Force() + t.Run("fips140tls", testFunc) +} + +func runWithFIPSDisabled(t *testing.T, testFunc func(t *testing.T)) { + if fips140.Enforced() { + t.Run("no-fips140tls", func(t *testing.T) { + t.Skip("can't run no-fips140tls tests in fips140=only mode") + }) + return + } + + originalFIPS := fips140tls.Required() + defer func() { + if originalFIPS { + fips140tls.Force() + } else { + fips140tls.TestingOnlyAbandon() + } + }() + + fips140tls.TestingOnlyAbandon() + t.Run("no-fips140tls", testFunc) +} + +func skipFIPS(t *testing.T) { + if fips140tls.Required() { + t.Skip("skipping test in FIPS mode") + } +} + +func TestDialTimeout(t *testing.T) { + if testing.Short() { + t.Skip("skipping in short mode") + } + + timeout := 100 * time.Microsecond + for !t.Failed() { + acceptc := make(chan net.Conn) + listener := newLocalListener(t) + go func() { + for { + conn, err := listener.Accept() + if err != nil { + close(acceptc) + return + } + acceptc <- conn + } + }() + + addr := listener.Addr().String() + dialer := &net.Dialer{ + Timeout: timeout, + } + if conn, err := DialWithDialer(dialer, "tcp", addr, nil); err == nil { + conn.Close() + t.Errorf("DialWithTimeout unexpectedly completed successfully") + } else if !isTimeoutError(err) { + t.Errorf("resulting error not a timeout: %v\nType %T: %#v", err, err, err) + } + + listener.Close() + + // We're looking for a timeout during the handshake, so check that the + // Listener actually accepted the connection to initiate it. (If the server + // takes too long to accept the connection, we might cancel before the + // underlying net.Conn is ever dialed — without ever attempting a + // handshake.) + lconn, ok := <-acceptc + if ok { + // The Listener accepted a connection, so assume that it was from our + // Dial: we triggered the timeout at the point where we wanted it! + t.Logf("Listener accepted a connection from %s", lconn.RemoteAddr()) + lconn.Close() + } + // Close any spurious extra connections from the listener. (This is + // possible if there are, for example, stray Dial calls from other tests.) + for extraConn := range acceptc { + t.Logf("spurious extra connection from %s", extraConn.RemoteAddr()) + extraConn.Close() + } + if ok { + break + } + + t.Logf("with timeout %v, DialWithDialer returned before listener accepted any connections; retrying", timeout) + timeout *= 2 + } +} + +func TestDeadlineOnWrite(t *testing.T) { + if testing.Short() { + t.Skip("skipping in short mode") + } + + ln := newLocalListener(t) + defer ln.Close() + + srvCh := make(chan *Conn, 1) + + go func() { + sconn, err := ln.Accept() + if err != nil { + srvCh <- nil + return + } + srv := Server(sconn, testConfig.Clone()) + if err := srv.Handshake(); err != nil { + srvCh <- nil + return + } + srvCh <- srv + }() + + clientConfig := testConfig.Clone() + clientConfig.MaxVersion = VersionTLS12 + conn, err := Dial("tcp", ln.Addr().String(), clientConfig) + if err != nil { + t.Fatal(err) + } + defer conn.Close() + + srv := <-srvCh + if srv == nil { + t.Error(err) + } + + // Make sure the client/server is setup correctly and is able to do a typical Write/Read + buf := make([]byte, 6) + if _, err := srv.Write([]byte("foobar")); err != nil { + t.Errorf("Write err: %v", err) + } + if n, err := conn.Read(buf); n != 6 || err != nil || string(buf) != "foobar" { + t.Errorf("Read = %d, %v, data %q; want 6, nil, foobar", n, err, buf) + } + + // Set a deadline which should cause Write to timeout + if err = srv.SetDeadline(time.Now()); err != nil { + t.Fatalf("SetDeadline(time.Now()) err: %v", err) + } + if _, err = srv.Write([]byte("should fail")); err == nil { + t.Fatal("Write should have timed out") + } + + // Clear deadline and make sure it still times out + if err = srv.SetDeadline(time.Time{}); err != nil { + t.Fatalf("SetDeadline(time.Time{}) err: %v", err) + } + if _, err = srv.Write([]byte("This connection is permanently broken")); err == nil { + t.Fatal("Write which previously failed should still time out") + } + + // Verify the error + if ne := err.(net.Error); ne.Temporary() != false { + t.Error("Write timed out but incorrectly classified the error as Temporary") + } + if !isTimeoutError(err) { + t.Error("Write timed out but did not classify the error as a Timeout") + } +} + +type readerFunc func([]byte) (int, error) + +func (f readerFunc) Read(b []byte) (int, error) { return f(b) } + +// TestDialer tests that tls.Dialer.DialContext can abort in the middle of a handshake. +// (The other cases are all handled by the existing dial tests in this package, which +// all also flow through the same code shared code paths) +func TestDialer(t *testing.T) { + ln := newLocalListener(t) + defer ln.Close() + + unblockServer := make(chan struct{}) // close-only + defer close(unblockServer) + go func() { + conn, err := ln.Accept() + if err != nil { + return + } + defer conn.Close() + <-unblockServer + }() + + ctx, cancel := context.WithCancel(context.Background()) + d := Dialer{Config: &Config{ + Rand: readerFunc(func(b []byte) (n int, err error) { + // By the time crypto/tls wants randomness, that means it has a TCP + // connection, so we're past the Dialer's dial and now blocked + // in a handshake. Cancel our context and see if we get unstuck. + // (Our TCP listener above never reads or writes, so the Handshake + // would otherwise be stuck forever) + cancel() + return len(b), nil + }), + ServerName: "foo", + }} + _, err := d.DialContext(ctx, "tcp", ln.Addr().String()) + if err != context.Canceled { + t.Errorf("err = %v; want context.Canceled", err) + } +} + +func isTimeoutError(err error) bool { + if ne, ok := err.(net.Error); ok { + return ne.Timeout() + } + return false +} + +// tests that Conn.Read returns (non-zero, io.EOF) instead of +// (non-zero, nil) when a Close (alertCloseNotify) is sitting right +// behind the application data in the buffer. +func TestConnReadNonzeroAndEOF(t *testing.T) { + // This test is racy: it assumes that after a write to a + // localhost TCP connection, the peer TCP connection can + // immediately read it. Because it's racy, we skip this test + // in short mode, and then retry it several times with an + // increasing sleep in between our final write (via srv.Close + // below) and the following read. + if testing.Short() { + t.Skip("skipping in short mode") + } + var err error + for delay := time.Millisecond; delay <= 64*time.Millisecond; delay *= 2 { + if err = testConnReadNonzeroAndEOF(t, delay); err == nil { + return + } + } + t.Error(err) +} + +func testConnReadNonzeroAndEOF(t *testing.T, delay time.Duration) error { + ln := newLocalListener(t) + defer ln.Close() + + srvCh := make(chan *Conn, 1) + var serr error + go func() { + sconn, err := ln.Accept() + if err != nil { + serr = err + srvCh <- nil + return + } + serverConfig := testConfig.Clone() + srv := Server(sconn, serverConfig) + if err := srv.Handshake(); err != nil { + serr = fmt.Errorf("handshake: %v", err) + srvCh <- nil + return + } + srvCh <- srv + }() + + clientConfig := testConfig.Clone() + // In TLS 1.3, alerts are encrypted and disguised as application data, so + // the opportunistic peek won't work. + clientConfig.MaxVersion = VersionTLS12 + conn, err := Dial("tcp", ln.Addr().String(), clientConfig) + if err != nil { + t.Fatal(err) + } + defer conn.Close() + + srv := <-srvCh + if srv == nil { + return serr + } + + buf := make([]byte, 6) + + srv.Write([]byte("foobar")) + n, err := conn.Read(buf) + if n != 6 || err != nil || string(buf) != "foobar" { + return fmt.Errorf("Read = %d, %v, data %q; want 6, nil, foobar", n, err, buf) + } + + srv.Write([]byte("abcdef")) + srv.Close() + time.Sleep(delay) + n, err = conn.Read(buf) + if n != 6 || string(buf) != "abcdef" { + return fmt.Errorf("Read = %d, buf= %q; want 6, abcdef", n, buf) + } + if err != io.EOF { + return fmt.Errorf("Second Read error = %v; want io.EOF", err) + } + return nil +} + +func TestTLSUniqueMatches(t *testing.T) { + ln := newLocalListener(t) + defer ln.Close() + + serverTLSUniques := make(chan []byte) + parentDone := make(chan struct{}) + childDone := make(chan struct{}) + defer close(parentDone) + go func() { + defer close(childDone) + for i := 0; i < 2; i++ { + sconn, err := ln.Accept() + if err != nil { + t.Error(err) + return + } + serverConfig := testConfig.Clone() + serverConfig.MaxVersion = VersionTLS12 // TLSUnique is not defined in TLS 1.3 + srv := Server(sconn, serverConfig) + if err := srv.Handshake(); err != nil { + t.Error(err) + return + } + select { + case <-parentDone: + return + case serverTLSUniques <- srv.ConnectionState().TLSUnique: + } + } + }() + + clientConfig := testConfig.Clone() + clientConfig.ClientSessionCache = NewLRUClientSessionCache(1) + conn, err := Dial("tcp", ln.Addr().String(), clientConfig) + if err != nil { + t.Fatal(err) + } + + var serverTLSUniquesValue []byte + select { + case <-childDone: + return + case serverTLSUniquesValue = <-serverTLSUniques: + } + + if !bytes.Equal(conn.ConnectionState().TLSUnique, serverTLSUniquesValue) { + t.Error("client and server channel bindings differ") + } + if serverTLSUniquesValue == nil || bytes.Equal(serverTLSUniquesValue, make([]byte, 12)) { + t.Error("tls-unique is empty or zero") + } + conn.Close() + + conn, err = Dial("tcp", ln.Addr().String(), clientConfig) + if err != nil { + t.Fatal(err) + } + defer conn.Close() + if !conn.ConnectionState().DidResume { + t.Error("second session did not use resumption") + } + + select { + case <-childDone: + return + case serverTLSUniquesValue = <-serverTLSUniques: + } + + if !bytes.Equal(conn.ConnectionState().TLSUnique, serverTLSUniquesValue) { + t.Error("client and server channel bindings differ when session resumption is used") + } + if serverTLSUniquesValue == nil || bytes.Equal(serverTLSUniquesValue, make([]byte, 12)) { + t.Error("resumption tls-unique is empty or zero") + } +} + +func TestVerifyHostname(t *testing.T) { + testenv.MustHaveExternalNetwork(t) + + c, err := Dial("tcp", "www.google.com:https", nil) + if err != nil { + t.Fatal(err) + } + if err := c.VerifyHostname("www.google.com"); err != nil { + t.Fatalf("verify www.google.com: %v", err) + } + if err := c.VerifyHostname("www.yahoo.com"); err == nil { + t.Fatalf("verify www.yahoo.com succeeded") + } + + c, err = Dial("tcp", "www.google.com:https", &Config{InsecureSkipVerify: true}) + if err != nil { + t.Fatal(err) + } + if err := c.VerifyHostname("www.google.com"); err == nil { + t.Fatalf("verify www.google.com succeeded with InsecureSkipVerify=true") + } +} + +func TestRealResumption(t *testing.T) { + testenv.MustHaveExternalNetwork(t) + + config := &Config{ + ServerName: "yahoo.com", + ClientSessionCache: NewLRUClientSessionCache(0), + } + + for range 10 { + conn, err := Dial("tcp", "yahoo.com:443", config) + if err != nil { + t.Log("Dial error:", err) + continue + } + // Do a read to consume the NewSessionTicket messages. + fmt.Fprintf(conn, "GET / HTTP/1.1\r\nHost: yahoo.com\r\nConnection: close\r\n\r\n") + conn.Read(make([]byte, 4096)) + conn.Close() + + conn, err = Dial("tcp", "yahoo.com:443", config) + if err != nil { + t.Log("second Dial error:", err) + continue + } + state := conn.ConnectionState() + conn.Close() + + if state.DidResume { + return + } + } + + t.Fatal("no connection used session resumption") +} + +func TestConnCloseBreakingWrite(t *testing.T) { + ln := newLocalListener(t) + defer ln.Close() + + srvCh := make(chan *Conn, 1) + var serr error + var sconn net.Conn + go func() { + var err error + sconn, err = ln.Accept() + if err != nil { + serr = err + srvCh <- nil + return + } + serverConfig := testConfig.Clone() + srv := Server(sconn, serverConfig) + if err := srv.Handshake(); err != nil { + serr = fmt.Errorf("handshake: %v", err) + srvCh <- nil + return + } + srvCh <- srv + }() + + cconn, err := net.Dial("tcp", ln.Addr().String()) + if err != nil { + t.Fatal(err) + } + defer cconn.Close() + + conn := &changeImplConn{ + Conn: cconn, + } + + clientConfig := testConfig.Clone() + tconn := Client(conn, clientConfig) + if err := tconn.Handshake(); err != nil { + t.Fatal(err) + } + + srv := <-srvCh + if srv == nil { + t.Fatal(serr) + } + defer sconn.Close() + + connClosed := make(chan struct{}) + conn.closeFunc = func() error { + close(connClosed) + return nil + } + + inWrite := make(chan bool, 1) + var errConnClosed = errors.New("conn closed for test") + conn.writeFunc = func(p []byte) (n int, err error) { + inWrite <- true + <-connClosed + return 0, errConnClosed + } + + closeReturned := make(chan bool, 1) + go func() { + <-inWrite + tconn.Close() // test that this doesn't block forever. + closeReturned <- true + }() + + _, err = tconn.Write([]byte("foo")) + if err != errConnClosed { + t.Errorf("Write error = %v; want errConnClosed", err) + } + + <-closeReturned + if err := tconn.Close(); err != net.ErrClosed { + t.Errorf("Close error = %v; want net.ErrClosed", err) + } +} + +func TestConnCloseWrite(t *testing.T) { + ln := newLocalListener(t) + defer ln.Close() + + clientDoneChan := make(chan struct{}) + + serverCloseWrite := func() error { + sconn, err := ln.Accept() + if err != nil { + return fmt.Errorf("accept: %v", err) + } + defer sconn.Close() + + serverConfig := testConfig.Clone() + srv := Server(sconn, serverConfig) + if err := srv.Handshake(); err != nil { + return fmt.Errorf("handshake: %v", err) + } + defer srv.Close() + + data, err := io.ReadAll(srv) + if err != nil { + return err + } + if len(data) > 0 { + return fmt.Errorf("Read data = %q; want nothing", data) + } + + if err := srv.CloseWrite(); err != nil { + return fmt.Errorf("server CloseWrite: %v", err) + } + + // Wait for clientCloseWrite to finish, so we know we + // tested the CloseWrite before we defer the + // sconn.Close above, which would also cause the + // client to unblock like CloseWrite. + <-clientDoneChan + return nil + } + + clientCloseWrite := func() error { + defer close(clientDoneChan) + + clientConfig := testConfig.Clone() + conn, err := Dial("tcp", ln.Addr().String(), clientConfig) + if err != nil { + return err + } + if err := conn.Handshake(); err != nil { + return err + } + defer conn.Close() + + if err := conn.CloseWrite(); err != nil { + return fmt.Errorf("client CloseWrite: %v", err) + } + + if _, err := conn.Write([]byte{0}); err != errShutdown { + return fmt.Errorf("CloseWrite error = %v; want errShutdown", err) + } + + data, err := io.ReadAll(conn) + if err != nil { + return err + } + if len(data) > 0 { + return fmt.Errorf("Read data = %q; want nothing", data) + } + return nil + } + + errChan := make(chan error, 2) + + go func() { errChan <- serverCloseWrite() }() + go func() { errChan <- clientCloseWrite() }() + + for i := 0; i < 2; i++ { + select { + case err := <-errChan: + if err != nil { + t.Fatal(err) + } + case <-time.After(10 * time.Second): + t.Fatal("deadlock") + } + } + + // Also test CloseWrite being called before the handshake is + // finished: + { + ln2 := newLocalListener(t) + defer ln2.Close() + + netConn, err := net.Dial("tcp", ln2.Addr().String()) + if err != nil { + t.Fatal(err) + } + defer netConn.Close() + conn := Client(netConn, testConfig.Clone()) + + if err := conn.CloseWrite(); err != errEarlyCloseWrite { + t.Errorf("CloseWrite error = %v; want errEarlyCloseWrite", err) + } + } +} + +func TestWarningAlertFlood(t *testing.T) { + ln := newLocalListener(t) + defer ln.Close() + + server := func() error { + sconn, err := ln.Accept() + if err != nil { + return fmt.Errorf("accept: %v", err) + } + defer sconn.Close() + + serverConfig := testConfig.Clone() + srv := Server(sconn, serverConfig) + if err := srv.Handshake(); err != nil { + return fmt.Errorf("handshake: %v", err) + } + defer srv.Close() + + _, err = io.ReadAll(srv) + if err == nil { + return errors.New("unexpected lack of error from server") + } + const expected = "too many ignored" + if str := err.Error(); !strings.Contains(str, expected) { + return fmt.Errorf("expected error containing %q, but saw: %s", expected, str) + } + + return nil + } + + errChan := make(chan error, 1) + go func() { errChan <- server() }() + + clientConfig := testConfig.Clone() + clientConfig.MaxVersion = VersionTLS12 // there are no warning alerts in TLS 1.3 + conn, err := Dial("tcp", ln.Addr().String(), clientConfig) + if err != nil { + t.Fatal(err) + } + defer conn.Close() + if err := conn.Handshake(); err != nil { + t.Fatal(err) + } + + for i := 0; i < maxUselessRecords+1; i++ { + conn.sendAlert(alertNoRenegotiation) + } + + if err := <-errChan; err != nil { + t.Fatal(err) + } +} + +func TestCloneFuncFields(t *testing.T) { + const expectedCount = 10 + called := 0 + + c1 := Config{ + Time: func() time.Time { + called |= 1 << 0 + return time.Time{} + }, + GetCertificate: func(*ClientHelloInfo) (*Certificate, error) { + called |= 1 << 1 + return nil, nil + }, + GetClientCertificate: func(*CertificateRequestInfo) (*Certificate, error) { + called |= 1 << 2 + return nil, nil + }, + GetConfigForClient: func(*ClientHelloInfo) (*Config, error) { + called |= 1 << 3 + return nil, nil + }, + VerifyPeerCertificate: func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error { + called |= 1 << 4 + return nil + }, + VerifyConnection: func(ConnectionState) error { + called |= 1 << 5 + return nil + }, + UnwrapSession: func(identity []byte, cs ConnectionState) (*SessionState, error) { + called |= 1 << 6 + return nil, nil + }, + WrapSession: func(cs ConnectionState, ss *SessionState) ([]byte, error) { + called |= 1 << 7 + return nil, nil + }, + EncryptedClientHelloRejectionVerify: func(ConnectionState) error { + called |= 1 << 8 + return nil + }, + GetEncryptedClientHelloKeys: func(*ClientHelloInfo) ([]EncryptedClientHelloKey, error) { + called |= 1 << 9 + return nil, nil + }, + } + + c2 := c1.Clone() + + c2.Time() + c2.GetCertificate(nil) + c2.GetClientCertificate(nil) + c2.GetConfigForClient(nil) + c2.VerifyPeerCertificate(nil, nil) + c2.VerifyConnection(ConnectionState{}) + c2.UnwrapSession(nil, ConnectionState{}) + c2.WrapSession(ConnectionState{}, nil) + c2.EncryptedClientHelloRejectionVerify(ConnectionState{}) + c2.GetEncryptedClientHelloKeys(nil) + + if called != (1< len(p) { + allowed = len(p) + } + if wrote < allowed { + n, err := c.Conn.Write(p[wrote:allowed]) + wrote += n + if err != nil { + return wrote, err + } + } + } + return len(p), nil +} + +func latency(b *testing.B, version uint16, bps int, dynamicRecordSizingDisabled bool) { + ln := newLocalListener(b) + defer ln.Close() + + N := b.N + + go func() { + for i := 0; i < N; i++ { + sconn, err := ln.Accept() + if err != nil { + // panic rather than synchronize to avoid benchmark overhead + // (cannot call b.Fatal in goroutine) + panic(fmt.Errorf("accept: %v", err)) + } + serverConfig := testConfig.Clone() + serverConfig.DynamicRecordSizingDisabled = dynamicRecordSizingDisabled + srv := Server(&slowConn{sconn, bps}, serverConfig) + if err := srv.Handshake(); err != nil { + panic(fmt.Errorf("handshake: %v", err)) + } + io.Copy(srv, srv) + } + }() + + clientConfig := testConfig.Clone() + clientConfig.DynamicRecordSizingDisabled = dynamicRecordSizingDisabled + clientConfig.MaxVersion = version + + buf := make([]byte, 16384) + peek := make([]byte, 1) + + for i := 0; i < N; i++ { + conn, err := Dial("tcp", ln.Addr().String(), clientConfig) + if err != nil { + b.Fatal(err) + } + // make sure we're connected and previous connection has stopped + if _, err := conn.Write(buf[:1]); err != nil { + b.Fatal(err) + } + if _, err := io.ReadFull(conn, peek); err != nil { + b.Fatal(err) + } + if _, err := conn.Write(buf); err != nil { + b.Fatal(err) + } + if _, err = io.ReadFull(conn, peek); err != nil { + b.Fatal(err) + } + conn.Close() + } +} + +func BenchmarkLatency(b *testing.B) { + for _, mode := range []string{"Max", "Dynamic"} { + for _, kbps := range []int{200, 500, 1000, 2000, 5000} { + name := fmt.Sprintf("%sPacket/%dkbps", mode, kbps) + b.Run(name, func(b *testing.B) { + b.Run("TLSv12", func(b *testing.B) { + latency(b, VersionTLS12, kbps*1000, mode == "Max") + }) + b.Run("TLSv13", func(b *testing.B) { + latency(b, VersionTLS13, kbps*1000, mode == "Max") + }) + }) + } + } +} + +func TestConnectionStateMarshal(t *testing.T) { + cs := &ConnectionState{} + _, err := json.Marshal(cs) + if err != nil { + t.Errorf("json.Marshal failed on ConnectionState: %v", err) + } +} + +func TestConnectionState(t *testing.T) { + issuer, err := x509.ParseCertificate(testRSA2048CertificateIssuer) + if err != nil { + panic(err) + } + rootCAs := x509.NewCertPool() + rootCAs.AddCert(issuer) + + const alpnProtocol = "golang" + const serverName = "example.golang" + var scts = [][]byte{[]byte("dummy sct 1"), []byte("dummy sct 2")} + var ocsp = []byte("dummy ocsp") + + checkConnectionState := func(t *testing.T, cs ConnectionState, version uint16, isClient bool) { + if cs.Version != version { + t.Errorf("got Version %x, expected %x", cs.Version, version) + } + + if !cs.HandshakeComplete { + t.Errorf("got HandshakeComplete %v, expected true", cs.HandshakeComplete) + } + + if cs.DidResume { + t.Errorf("got DidResume %v, expected false", cs.DidResume) + } + + if cs.CipherSuite == 0 { + t.Errorf("got zero CipherSuite") + } + + if cs.CurveID == 0 { + t.Errorf("got zero CurveID") + } + + if cs.NegotiatedProtocol != alpnProtocol { + t.Errorf("got ALPN protocol %q, expected %q", cs.NegotiatedProtocol, alpnProtocol) + } + + if !cs.NegotiatedProtocolIsMutual { + t.Errorf("got NegotiatedProtocolIsMutual %v, expected true", cs.NegotiatedProtocolIsMutual) + } + + if cs.ServerName != serverName { + t.Errorf("got ServerName %q, expected %q", cs.ServerName, serverName) + } + + if len(cs.PeerCertificates) != 1 { + t.Errorf("got %d PeerCertificates, expected %d", len(cs.PeerCertificates), 1) + } else if !bytes.Equal(cs.PeerCertificates[0].Raw, testRSA2048Certificate) { + t.Errorf("got PeerCertificates %x, expected %x", cs.PeerCertificates[0].Raw, testRSA2048Certificate) + } + + if len(cs.VerifiedChains) != 1 { + t.Errorf("got %d long verified chain, expected %d", len(cs.VerifiedChains), 1) + } else if len(cs.VerifiedChains[0]) != 2 { + t.Errorf("got %d verified chain, expected %d", len(cs.VerifiedChains[0]), 2) + } else if !bytes.Equal(cs.VerifiedChains[0][0].Raw, testRSA2048Certificate) { + t.Errorf("got verified chain[0][0] %x, expected %x", cs.VerifiedChains[0][0].Raw, testRSA2048Certificate) + } else if !bytes.Equal(cs.VerifiedChains[0][1].Raw, testRSA2048CertificateIssuer) { + t.Errorf("got verified chain[0][1] %x, expected %x", cs.VerifiedChains[0][1].Raw, testRSA2048CertificateIssuer) + } + + // Only TLS 1.3 supports OCSP and SCTs on client certs. + if isClient || version == VersionTLS13 { + if len(cs.SignedCertificateTimestamps) != 2 { + t.Errorf("got %d SCTs, expected %d", len(cs.SignedCertificateTimestamps), 2) + } else if !bytes.Equal(cs.SignedCertificateTimestamps[0], scts[0]) { + t.Errorf("got SCTs %x, expected %x", cs.SignedCertificateTimestamps[0], scts[0]) + } else if !bytes.Equal(cs.SignedCertificateTimestamps[1], scts[1]) { + t.Errorf("got SCTs %x, expected %x", cs.SignedCertificateTimestamps[1], scts[1]) + } + if !bytes.Equal(cs.OCSPResponse, ocsp) { + t.Errorf("got OCSP %x, expected %x", cs.OCSPResponse, ocsp) + } + } else { + if cs.SignedCertificateTimestamps != nil { + t.Errorf("got %d SCTs, expected nil", len(cs.SignedCertificateTimestamps)) + } + if cs.OCSPResponse != nil { + t.Errorf("got OCSP %x, expected nil", cs.OCSPResponse) + } + } + + if version == VersionTLS13 { + if cs.TLSUnique != nil { + t.Errorf("got TLSUnique %x, expected nil", cs.TLSUnique) + } + } else { + if cs.TLSUnique == nil { + t.Errorf("got nil TLSUnique") + } + } + } + + compareConnectionStates := func(t *testing.T, cs1, cs2 ConnectionState) { + if cs1.Version != cs2.Version { + t.Errorf("Version mismatch: %x != %x", cs1.Version, cs2.Version) + } + if cs1.HandshakeComplete != cs2.HandshakeComplete { + t.Errorf("HandshakeComplete mismatch: %v != %v", cs1.HandshakeComplete, cs2.HandshakeComplete) + } + // DidResume is expected to be different. + if cs1.CipherSuite != cs2.CipherSuite { + t.Errorf("CipherSuite mismatch: %x != %x", cs1.CipherSuite, cs2.CipherSuite) + } + if cs1.CurveID != cs2.CurveID { + t.Errorf("CurveID mismatch: %s != %s", cs1.CurveID, cs2.CurveID) + } + if cs1.NegotiatedProtocol != cs2.NegotiatedProtocol { + t.Errorf("NegotiatedProtocol mismatch: %q != %q", cs1.NegotiatedProtocol, cs2.NegotiatedProtocol) + } + if cs1.NegotiatedProtocolIsMutual != cs2.NegotiatedProtocolIsMutual { + t.Errorf("NegotiatedProtocolIsMutual mismatch: %v != %v", cs1.NegotiatedProtocolIsMutual, cs2.NegotiatedProtocolIsMutual) + } + if cs1.ServerName != cs2.ServerName { + t.Errorf("ServerName mismatch: %q != %q", cs1.ServerName, cs2.ServerName) + } + if !reflect.DeepEqual(cs1.PeerCertificates, cs2.PeerCertificates) { + t.Errorf("PeerCertificates mismatch") + } + if !reflect.DeepEqual(cs1.VerifiedChains, cs2.VerifiedChains) { + t.Errorf("VerifiedChains mismatch") + } + if !reflect.DeepEqual(cs1.SignedCertificateTimestamps, cs2.SignedCertificateTimestamps) { + t.Errorf("SignedCertificateTimestamps mismatch: %x != %x", cs1.SignedCertificateTimestamps, cs2.SignedCertificateTimestamps) + } + if !bytes.Equal(cs1.OCSPResponse, cs2.OCSPResponse) { + t.Errorf("OCSPResponse mismatch: %x != %x", cs1.OCSPResponse, cs2.OCSPResponse) + } + // TLSUnique is expected to be different. + } + + for _, v := range []uint16{VersionTLS10, VersionTLS12, VersionTLS13} { + if !isFIPSVersion(v) && fips140tls.Required() { + t.Skipf("skipping test in FIPS 140-3 mode for non-FIPS version %x", v) + } + var name string + switch v { + case VersionTLS10: + name = "TLSv10" + case VersionTLS12: + name = "TLSv12" + case VersionTLS13: + name = "TLSv13" + } + t.Run(name, func(t *testing.T) { + config := &Config{ + Time: testTime, + Certificates: make([]Certificate, 1), + MinVersion: v, + MaxVersion: v, + RootCAs: rootCAs, + ClientCAs: rootCAs, + ClientAuth: RequireAndVerifyClientCert, + NextProtos: []string{alpnProtocol}, + ServerName: serverName, + ClientSessionCache: NewLRUClientSessionCache(1), + } + config.Certificates[0].Certificate = [][]byte{testRSA2048Certificate} + config.Certificates[0].PrivateKey = testRSA2048PrivateKey + config.Certificates[0].SignedCertificateTimestamps = scts + config.Certificates[0].OCSPStaple = ocsp + + ss, cs, err := testHandshake(t, config, config) + if err != nil { + t.Fatalf("handshake failed: %v", err) + } + + t.Run("Client", func(t *testing.T) { checkConnectionState(t, cs, v, true) }) + t.Run("Server", func(t *testing.T) { checkConnectionState(t, ss, v, false) }) + + t.Run("Resume", func(t *testing.T) { + // TODO: test changing parameters between original and resumed + // connection when the protocol allows it. + + ss1, cs1, err := testHandshake(t, config, config) + if err != nil { + t.Fatalf("handshake failed: %v", err) + } + + if !cs1.DidResume || !ss1.DidResume { + t.Errorf("DidResume is false") + } + + t.Run("Client", func(t *testing.T) { compareConnectionStates(t, cs, cs1) }) + t.Run("Server", func(t *testing.T) { compareConnectionStates(t, ss, ss1) }) + }) + }) + } +} + +// Issue 28744: Ensure that we don't modify memory +// that Config doesn't own such as Certificates. +func TestBuildNameToCertificate_doesntModifyCertificates(t *testing.T) { + c0 := Certificate{ + Certificate: [][]byte{testRSACertificate}, + PrivateKey: testRSAPrivateKey, + } + c1 := Certificate{ + Certificate: [][]byte{testSNICertificate}, + PrivateKey: testRSAPrivateKey, + } + config := testConfig.Clone() + config.Certificates = []Certificate{c0, c1} + + config.BuildNameToCertificate() + got := config.Certificates + want := []Certificate{c0, c1} + if !reflect.DeepEqual(got, want) { + t.Fatalf("Certificates were mutated by BuildNameToCertificate\nGot: %#v\nWant: %#v\n", got, want) + } +} + +func testingKey(s string) string { return strings.ReplaceAll(s, "TESTING KEY", "PRIVATE KEY") } + +func TestClientHelloInfo_SupportsCertificate(t *testing.T) { + skipFIPS(t) // Test certificates not FIPS compatible. + + rsaCert := &Certificate{ + Certificate: [][]byte{testRSACertificate}, + PrivateKey: testRSAPrivateKey, + } + pkcs1Cert := &Certificate{ + Certificate: [][]byte{testRSACertificate}, + PrivateKey: testRSAPrivateKey, + SupportedSignatureAlgorithms: []SignatureScheme{PKCS1WithSHA1, PKCS1WithSHA256}, + } + ecdsaCert := &Certificate{ + // ECDSA P-256 certificate + Certificate: [][]byte{testP256Certificate}, + PrivateKey: testP256PrivateKey, + } + ed25519Cert := &Certificate{ + Certificate: [][]byte{testEd25519Certificate}, + PrivateKey: testEd25519PrivateKey, + } + + tests := []struct { + c *Certificate + chi *ClientHelloInfo + wantErr string + }{ + {rsaCert, &ClientHelloInfo{ + ServerName: "example.golang", + SignatureSchemes: []SignatureScheme{PSSWithSHA256}, + SupportedVersions: []uint16{VersionTLS13}, + }, ""}, + {ecdsaCert, &ClientHelloInfo{ + SignatureSchemes: []SignatureScheme{PSSWithSHA256, ECDSAWithP256AndSHA256}, + SupportedVersions: []uint16{VersionTLS13, VersionTLS12}, + }, ""}, + {rsaCert, &ClientHelloInfo{ + ServerName: "example.com", + SignatureSchemes: []SignatureScheme{PSSWithSHA256}, + SupportedVersions: []uint16{VersionTLS13}, + }, "not valid for requested server name"}, + {ecdsaCert, &ClientHelloInfo{ + SignatureSchemes: []SignatureScheme{ECDSAWithP384AndSHA384}, + SupportedVersions: []uint16{VersionTLS13}, + }, "signature algorithms"}, + {pkcs1Cert, &ClientHelloInfo{ + SignatureSchemes: []SignatureScheme{PSSWithSHA256, ECDSAWithP256AndSHA256}, + SupportedVersions: []uint16{VersionTLS13}, + }, "signature algorithms"}, + + {rsaCert, &ClientHelloInfo{ + CipherSuites: []uint16{TLS_RSA_WITH_AES_128_GCM_SHA256}, + SignatureSchemes: []SignatureScheme{PKCS1WithSHA1}, + SupportedVersions: []uint16{VersionTLS13, VersionTLS12}, + }, "signature algorithms"}, + {rsaCert, &ClientHelloInfo{ + CipherSuites: []uint16{TLS_RSA_WITH_AES_128_GCM_SHA256}, + SignatureSchemes: []SignatureScheme{PKCS1WithSHA1}, + SupportedVersions: []uint16{VersionTLS13, VersionTLS12}, + config: &Config{ + CipherSuites: []uint16{TLS_RSA_WITH_AES_128_GCM_SHA256}, + MaxVersion: VersionTLS12, + }, + }, ""}, // Check that mutual version selection works. + + {ecdsaCert, &ClientHelloInfo{ + CipherSuites: []uint16{TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256}, + SupportedCurves: []CurveID{CurveP256}, + SupportedPoints: []uint8{pointFormatUncompressed}, + SignatureSchemes: []SignatureScheme{ECDSAWithP256AndSHA256}, + SupportedVersions: []uint16{VersionTLS12}, + }, ""}, + {ecdsaCert, &ClientHelloInfo{ + CipherSuites: []uint16{TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256}, + SupportedCurves: []CurveID{CurveP256}, + SupportedPoints: []uint8{pointFormatUncompressed}, + SignatureSchemes: []SignatureScheme{ECDSAWithP384AndSHA384}, + SupportedVersions: []uint16{VersionTLS12}, + }, ""}, // TLS 1.2 does not restrict curves based on the SignatureScheme. + {ecdsaCert, &ClientHelloInfo{ + CipherSuites: []uint16{TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256}, + SupportedCurves: []CurveID{CurveP256}, + SupportedPoints: []uint8{pointFormatUncompressed}, + SignatureSchemes: nil, + SupportedVersions: []uint16{VersionTLS12}, + }, ""}, // TLS 1.2 comes with default signature schemes. + {ecdsaCert, &ClientHelloInfo{ + CipherSuites: []uint16{TLS_RSA_WITH_AES_128_GCM_SHA256}, + SupportedCurves: []CurveID{CurveP256}, + SupportedPoints: []uint8{pointFormatUncompressed}, + SignatureSchemes: []SignatureScheme{ECDSAWithP256AndSHA256}, + SupportedVersions: []uint16{VersionTLS12}, + }, "cipher suite"}, + {ecdsaCert, &ClientHelloInfo{ + CipherSuites: []uint16{TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256}, + SupportedCurves: []CurveID{CurveP256}, + SupportedPoints: []uint8{pointFormatUncompressed}, + SignatureSchemes: []SignatureScheme{ECDSAWithP256AndSHA256}, + SupportedVersions: []uint16{VersionTLS12}, + config: &Config{ + CipherSuites: []uint16{TLS_RSA_WITH_AES_128_GCM_SHA256}, + }, + }, "cipher suite"}, + {ecdsaCert, &ClientHelloInfo{ + CipherSuites: []uint16{TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256}, + SupportedCurves: []CurveID{CurveP384}, + SupportedPoints: []uint8{pointFormatUncompressed}, + SignatureSchemes: []SignatureScheme{ECDSAWithP256AndSHA256}, + SupportedVersions: []uint16{VersionTLS12}, + }, "certificate curve"}, + {ecdsaCert, &ClientHelloInfo{ + CipherSuites: []uint16{TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256}, + SupportedCurves: []CurveID{CurveP256}, + SupportedPoints: []uint8{1}, + SignatureSchemes: []SignatureScheme{ECDSAWithP256AndSHA256}, + SupportedVersions: []uint16{VersionTLS12}, + }, "only incompatible point formats"}, + {ecdsaCert, &ClientHelloInfo{ + CipherSuites: []uint16{TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256}, + SupportedCurves: []CurveID{CurveP256}, + SupportedPoints: []uint8{pointFormatUncompressed}, + SignatureSchemes: []SignatureScheme{PSSWithSHA256}, + SupportedVersions: []uint16{VersionTLS12}, + }, "signature algorithms"}, + + {ed25519Cert, &ClientHelloInfo{ + CipherSuites: []uint16{TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256}, + SupportedCurves: []CurveID{CurveP256}, // only relevant for ECDHE support + SupportedPoints: []uint8{pointFormatUncompressed}, + SignatureSchemes: []SignatureScheme{Ed25519}, + SupportedVersions: []uint16{VersionTLS12}, + }, ""}, + {ed25519Cert, &ClientHelloInfo{ + CipherSuites: []uint16{TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256}, + SupportedCurves: []CurveID{CurveP256}, // only relevant for ECDHE support + SupportedPoints: []uint8{pointFormatUncompressed}, + SignatureSchemes: []SignatureScheme{Ed25519}, + SupportedVersions: []uint16{VersionTLS10}, + config: &Config{MinVersion: VersionTLS10}, + }, "doesn't support Ed25519"}, + {ed25519Cert, &ClientHelloInfo{ + CipherSuites: []uint16{TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256}, + SupportedCurves: []CurveID{}, + SupportedPoints: []uint8{pointFormatUncompressed}, + SignatureSchemes: []SignatureScheme{Ed25519}, + SupportedVersions: []uint16{VersionTLS12}, + }, "doesn't support ECDHE"}, + + {rsaCert, &ClientHelloInfo{ + CipherSuites: []uint16{TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA}, + SupportedCurves: []CurveID{CurveP256}, // only relevant for ECDHE support + SupportedPoints: []uint8{pointFormatUncompressed}, + SupportedVersions: []uint16{VersionTLS10}, + config: &Config{MinVersion: VersionTLS10}, + }, ""}, + {rsaCert, &ClientHelloInfo{ + CipherSuites: []uint16{TLS_RSA_WITH_AES_128_GCM_SHA256}, + SupportedVersions: []uint16{VersionTLS12}, + config: &Config{ + CipherSuites: []uint16{TLS_RSA_WITH_AES_128_GCM_SHA256}, + }, + }, ""}, // static RSA fallback + } + for i, tt := range tests { + err := tt.chi.SupportsCertificate(tt.c) + switch { + case tt.wantErr == "" && err != nil: + t.Errorf("%d: unexpected error: %v", i, err) + case tt.wantErr != "" && err == nil: + t.Errorf("%d: unexpected success", i) + case tt.wantErr != "" && !strings.Contains(err.Error(), tt.wantErr): + t.Errorf("%d: got error %q, expected %q", i, err, tt.wantErr) + } + } +} + +func TestCipherSuites(t *testing.T) { + var lastID uint16 + for _, c := range CipherSuites() { + if lastID > c.ID { + t.Errorf("CipherSuites are not ordered by ID: got %#04x after %#04x", c.ID, lastID) + } else { + lastID = c.ID + } + + if c.Insecure { + t.Errorf("%#04x: Insecure CipherSuite returned by CipherSuites()", c.ID) + } + } + lastID = 0 + for _, c := range InsecureCipherSuites() { + if lastID > c.ID { + t.Errorf("InsecureCipherSuites are not ordered by ID: got %#04x after %#04x", c.ID, lastID) + } else { + lastID = c.ID + } + + if !c.Insecure { + t.Errorf("%#04x: not Insecure CipherSuite returned by InsecureCipherSuites()", c.ID) + } + } + + CipherSuiteByID := func(id uint16) *CipherSuite { + for _, c := range CipherSuites() { + if c.ID == id { + return c + } + } + for _, c := range InsecureCipherSuites() { + if c.ID == id { + return c + } + } + return nil + } + + for _, c := range cipherSuites { + cc := CipherSuiteByID(c.id) + if cc == nil { + t.Errorf("%#04x: no CipherSuite entry", c.id) + continue + } + + if tls12Only := c.flags&suiteTLS12 != 0; tls12Only && len(cc.SupportedVersions) != 1 { + t.Errorf("%#04x: suite is TLS 1.2 only, but SupportedVersions is %v", c.id, cc.SupportedVersions) + } else if !tls12Only && len(cc.SupportedVersions) != 3 { + t.Errorf("%#04x: suite TLS 1.0-1.2, but SupportedVersions is %v", c.id, cc.SupportedVersions) + } + + if cc.Insecure { + if slices.Contains(defaultCipherSuites(false), c.id) { + t.Errorf("%#04x: insecure suite in default list", c.id) + } + } else { + if !slices.Contains(defaultCipherSuites(false), c.id) { + t.Errorf("%#04x: secure suite not in default list", c.id) + } + } + + if got := CipherSuiteName(c.id); got != cc.Name { + t.Errorf("%#04x: unexpected CipherSuiteName: got %q, expected %q", c.id, got, cc.Name) + } + } + for _, c := range cipherSuitesTLS13 { + cc := CipherSuiteByID(c.id) + if cc == nil { + t.Errorf("%#04x: no CipherSuite entry", c.id) + continue + } + + if cc.Insecure { + t.Errorf("%#04x: Insecure %v, expected false", c.id, cc.Insecure) + } + if len(cc.SupportedVersions) != 1 || cc.SupportedVersions[0] != VersionTLS13 { + t.Errorf("%#04x: suite is TLS 1.3 only, but SupportedVersions is %v", c.id, cc.SupportedVersions) + } + + if got := CipherSuiteName(c.id); got != cc.Name { + t.Errorf("%#04x: unexpected CipherSuiteName: got %q, expected %q", c.id, got, cc.Name) + } + } + + if got := CipherSuiteName(0xabc); got != "0x0ABC" { + t.Errorf("unexpected fallback CipherSuiteName: got %q, expected 0x0ABC", got) + } + + if len(cipherSuitesPreferenceOrder) != len(cipherSuites) { + t.Errorf("cipherSuitesPreferenceOrder is not the same size as cipherSuites") + } + if len(cipherSuitesPreferenceOrderNoAES) != len(cipherSuitesPreferenceOrder) { + t.Errorf("cipherSuitesPreferenceOrderNoAES is not the same size as cipherSuitesPreferenceOrder") + } + + // Check that disabled suites are marked insecure. + for _, badSuites := range []map[uint16]bool{disabledCipherSuites, rsaKexCiphers} { + for id := range badSuites { + c := CipherSuiteByID(id) + if c == nil { + t.Errorf("%#04x: no CipherSuite entry", id) + continue + } + if !c.Insecure { + t.Errorf("%#04x: disabled by default but not marked insecure", id) + } + } + } + + for i, prefOrder := range [][]uint16{cipherSuitesPreferenceOrder, cipherSuitesPreferenceOrderNoAES} { + // Check that insecure and HTTP/2 bad cipher suites are at the end of + // the preference lists. + var sawInsecure, sawBad bool + for _, id := range prefOrder { + c := CipherSuiteByID(id) + if c == nil { + t.Errorf("%#04x: no CipherSuite entry", id) + continue + } + + if c.Insecure { + sawInsecure = true + } else if sawInsecure { + t.Errorf("%#04x: secure suite after insecure one(s)", id) + } + + if http2isBadCipher(id) { + sawBad = true + } else if sawBad { + t.Errorf("%#04x: non-bad suite after bad HTTP/2 one(s)", id) + } + } + + // Check that the list is sorted according to the documented criteria. + isBetter := func(a, b uint16) int { + aSuite, bSuite := cipherSuiteByID(a), cipherSuiteByID(b) + aName, bName := CipherSuiteName(a), CipherSuiteName(b) + // * < RC4 + if !strings.Contains(aName, "RC4") && strings.Contains(bName, "RC4") { + return -1 + } else if strings.Contains(aName, "RC4") && !strings.Contains(bName, "RC4") { + return +1 + } + // * < CBC_SHA256 + if !strings.Contains(aName, "CBC_SHA256") && strings.Contains(bName, "CBC_SHA256") { + return -1 + } else if strings.Contains(aName, "CBC_SHA256") && !strings.Contains(bName, "CBC_SHA256") { + return +1 + } + // * < 3DES + if !strings.Contains(aName, "3DES") && strings.Contains(bName, "3DES") { + return -1 + } else if strings.Contains(aName, "3DES") && !strings.Contains(bName, "3DES") { + return +1 + } + // ECDHE < * + if aSuite.flags&suiteECDHE != 0 && bSuite.flags&suiteECDHE == 0 { + return -1 + } else if aSuite.flags&suiteECDHE == 0 && bSuite.flags&suiteECDHE != 0 { + return +1 + } + // AEAD < CBC + if aSuite.aead != nil && bSuite.aead == nil { + return -1 + } else if aSuite.aead == nil && bSuite.aead != nil { + return +1 + } + // AES < ChaCha20 + if strings.Contains(aName, "AES") && strings.Contains(bName, "CHACHA20") { + // negative for cipherSuitesPreferenceOrder + if i == 0 { + return -1 + } else { + return +1 + } + } else if strings.Contains(aName, "CHACHA20") && strings.Contains(bName, "AES") { + // negative for cipherSuitesPreferenceOrderNoAES + if i != 0 { + return -1 + } else { + return +1 + } + } + // AES-128 < AES-256 + if strings.Contains(aName, "AES_128") && strings.Contains(bName, "AES_256") { + return -1 + } else if strings.Contains(aName, "AES_256") && strings.Contains(bName, "AES_128") { + return +1 + } + // ECDSA < RSA + if aSuite.flags&suiteECSign != 0 && bSuite.flags&suiteECSign == 0 { + return -1 + } else if aSuite.flags&suiteECSign == 0 && bSuite.flags&suiteECSign != 0 { + return +1 + } + t.Fatalf("two ciphersuites are equal by all criteria: %v and %v", aName, bName) + panic("unreachable") + } + if !slices.IsSortedFunc(prefOrder, isBetter) { + t.Error("preference order is not sorted according to the rules") + } + } +} + +func TestVersionName(t *testing.T) { + if got, exp := VersionName(VersionTLS13), "TLS 1.3"; got != exp { + t.Errorf("unexpected VersionName: got %q, expected %q", got, exp) + } + if got, exp := VersionName(0x12a), "0x012A"; got != exp { + t.Errorf("unexpected fallback VersionName: got %q, expected %q", got, exp) + } +} + +// http2isBadCipher is copied from net/http. +// TODO: if it ends up exposed somewhere, use that instead. +func http2isBadCipher(cipher uint16) bool { + switch cipher { + case TLS_RSA_WITH_RC4_128_SHA, + TLS_RSA_WITH_3DES_EDE_CBC_SHA, + TLS_RSA_WITH_AES_128_CBC_SHA, + TLS_RSA_WITH_AES_256_CBC_SHA, + TLS_RSA_WITH_AES_128_CBC_SHA256, + TLS_RSA_WITH_AES_128_GCM_SHA256, + TLS_RSA_WITH_AES_256_GCM_SHA384, + TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, + TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, + TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, + TLS_ECDHE_RSA_WITH_RC4_128_SHA, + TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, + TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, + TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, + TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, + TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256: + return true + default: + return false + } +} + +type brokenSigner struct{ crypto.Signer } + +func (s brokenSigner) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error) { + // Replace opts with opts.HashFunc(), so rsa.PSSOptions are discarded. + return s.Signer.Sign(rand, digest, opts.HashFunc()) +} + +// TestPKCS1OnlyCert uses a client certificate with a broken crypto.Signer that +// always makes PKCS #1 v1.5 signatures, so can't be used with RSA-PSS. +func TestPKCS1OnlyCert(t *testing.T) { + clientConfig := testConfig.Clone() + clientConfig.Certificates = []Certificate{{ + Certificate: [][]byte{testRSACertificate}, + PrivateKey: brokenSigner{testRSAPrivateKey}, + }} + serverConfig := testConfig.Clone() + serverConfig.MaxVersion = VersionTLS12 // TLS 1.3 doesn't support PKCS #1 v1.5 + serverConfig.ClientAuth = RequireAnyClientCert + + // If RSA-PSS is selected, the handshake should fail. + if _, _, err := testHandshake(t, clientConfig, serverConfig); err == nil { + t.Fatal("expected broken certificate to cause connection to fail") + } + + clientConfig.Certificates[0].SupportedSignatureAlgorithms = + []SignatureScheme{PKCS1WithSHA1, PKCS1WithSHA256} + + // But if the certificate restricts supported algorithms, RSA-PSS should not + // be selected, and the handshake should succeed. + if _, _, err := testHandshake(t, clientConfig, serverConfig); err != nil { + t.Error(err) + } +} + +func TestVerifyCertificates(t *testing.T) { + skipFIPS(t) // Test certificates not FIPS compatible. + + // See https://go.dev/issue/31641. + t.Run("TLSv12", func(t *testing.T) { testVerifyCertificates(t, VersionTLS12) }) + t.Run("TLSv13", func(t *testing.T) { testVerifyCertificates(t, VersionTLS13) }) +} + +func testVerifyCertificates(t *testing.T, version uint16) { + tests := []struct { + name string + + InsecureSkipVerify bool + ClientAuth ClientAuthType + ClientCertificates bool + }{ + { + name: "defaults", + }, + { + name: "InsecureSkipVerify", + InsecureSkipVerify: true, + }, + { + name: "RequestClientCert with no certs", + ClientAuth: RequestClientCert, + }, + { + name: "RequestClientCert with certs", + ClientAuth: RequestClientCert, + ClientCertificates: true, + }, + { + name: "RequireAnyClientCert", + ClientAuth: RequireAnyClientCert, + ClientCertificates: true, + }, + { + name: "VerifyClientCertIfGiven with no certs", + ClientAuth: VerifyClientCertIfGiven, + }, + { + name: "VerifyClientCertIfGiven with certs", + ClientAuth: VerifyClientCertIfGiven, + ClientCertificates: true, + }, + { + name: "RequireAndVerifyClientCert", + ClientAuth: RequireAndVerifyClientCert, + ClientCertificates: true, + }, + } + + issuer, err := x509.ParseCertificate(testRSACertificateIssuer) + if err != nil { + t.Fatal(err) + } + rootCAs := x509.NewCertPool() + rootCAs.AddCert(issuer) + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + t.Parallel() + + var serverVerifyConnection, clientVerifyConnection bool + var serverVerifyPeerCertificates, clientVerifyPeerCertificates bool + + clientConfig := testConfig.Clone() + clientConfig.Time = testTime + clientConfig.MaxVersion = version + clientConfig.MinVersion = version + clientConfig.RootCAs = rootCAs + clientConfig.ServerName = "example.golang" + clientConfig.ClientSessionCache = NewLRUClientSessionCache(1) + serverConfig := clientConfig.Clone() + serverConfig.ClientCAs = rootCAs + + clientConfig.VerifyConnection = func(cs ConnectionState) error { + clientVerifyConnection = true + return nil + } + clientConfig.VerifyPeerCertificate = func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error { + clientVerifyPeerCertificates = true + return nil + } + serverConfig.VerifyConnection = func(cs ConnectionState) error { + serverVerifyConnection = true + return nil + } + serverConfig.VerifyPeerCertificate = func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error { + serverVerifyPeerCertificates = true + return nil + } + + clientConfig.InsecureSkipVerify = test.InsecureSkipVerify + serverConfig.ClientAuth = test.ClientAuth + if !test.ClientCertificates { + clientConfig.Certificates = nil + } + + if _, _, err := testHandshake(t, clientConfig, serverConfig); err != nil { + t.Fatal(err) + } + + want := serverConfig.ClientAuth != NoClientCert + if serverVerifyPeerCertificates != want { + t.Errorf("VerifyPeerCertificates on the server: got %v, want %v", + serverVerifyPeerCertificates, want) + } + if !clientVerifyPeerCertificates { + t.Errorf("VerifyPeerCertificates not called on the client") + } + if !serverVerifyConnection { + t.Error("VerifyConnection did not get called on the server") + } + if !clientVerifyConnection { + t.Error("VerifyConnection did not get called on the client") + } + + serverVerifyPeerCertificates, clientVerifyPeerCertificates = false, false + serverVerifyConnection, clientVerifyConnection = false, false + cs, _, err := testHandshake(t, clientConfig, serverConfig) + if err != nil { + t.Fatal(err) + } + if !cs.DidResume { + t.Error("expected resumption") + } + + if serverVerifyPeerCertificates { + t.Error("VerifyPeerCertificates got called on the server on resumption") + } + if clientVerifyPeerCertificates { + t.Error("VerifyPeerCertificates got called on the client on resumption") + } + if !serverVerifyConnection { + t.Error("VerifyConnection did not get called on the server on resumption") + } + if !clientVerifyConnection { + t.Error("VerifyConnection did not get called on the client on resumption") + } + }) + } +} + +func TestHandshakeMLKEM(t *testing.T) { + if boring.Enabled && fips140tls.Required() { + t.Skip("ML-KEM not supported in BoringCrypto FIPS mode") + } + defaultWithPQ := []CurveID{X25519MLKEM768, SecP256r1MLKEM768, SecP384r1MLKEM1024, + X25519, CurveP256, CurveP384, CurveP521} + defaultWithoutPQ := []CurveID{X25519, CurveP256, CurveP384, CurveP521} + var tests = []struct { + name string + clientConfig func(*Config) + serverConfig func(*Config) + preparation func(*testing.T) + expectClient []CurveID + expectSelected CurveID + expectHRR bool + }{ + { + name: "Default", + expectClient: defaultWithPQ, + expectSelected: X25519MLKEM768, + }, + { + name: "ClientCurvePreferences", + clientConfig: func(config *Config) { + config.CurvePreferences = []CurveID{X25519} + }, + expectClient: []CurveID{X25519}, + expectSelected: X25519, + }, + { + name: "ServerCurvePreferencesX25519", + serverConfig: func(config *Config) { + config.CurvePreferences = []CurveID{X25519} + }, + expectClient: defaultWithPQ, + expectSelected: X25519, + }, + { + name: "ServerCurvePreferencesHRR", + serverConfig: func(config *Config) { + config.CurvePreferences = []CurveID{CurveP256} + }, + expectClient: defaultWithPQ, + expectSelected: CurveP256, + expectHRR: true, + }, + { + name: "SecP256r1MLKEM768-Only", + clientConfig: func(config *Config) { + config.CurvePreferences = []CurveID{SecP256r1MLKEM768} + }, + expectClient: []CurveID{SecP256r1MLKEM768}, + expectSelected: SecP256r1MLKEM768, + }, + { + name: "SecP256r1MLKEM768-HRR", + serverConfig: func(config *Config) { + config.CurvePreferences = []CurveID{SecP256r1MLKEM768, CurveP256} + }, + expectClient: defaultWithPQ, + expectSelected: SecP256r1MLKEM768, + expectHRR: true, + }, + { + name: "SecP384r1MLKEM1024", + clientConfig: func(config *Config) { + config.CurvePreferences = []CurveID{SecP384r1MLKEM1024, CurveP384} + }, + expectClient: []CurveID{SecP384r1MLKEM1024, CurveP384}, + expectSelected: SecP384r1MLKEM1024, + }, + { + name: "CurveP256NoHRR", + clientConfig: func(config *Config) { + config.CurvePreferences = []CurveID{SecP256r1MLKEM768, CurveP256} + }, + serverConfig: func(config *Config) { + config.CurvePreferences = []CurveID{CurveP256} + }, + expectClient: []CurveID{SecP256r1MLKEM768, CurveP256}, + expectSelected: CurveP256, + }, + { + name: "ClientMLKEMOnly", + clientConfig: func(config *Config) { + config.CurvePreferences = []CurveID{X25519MLKEM768} + }, + expectClient: []CurveID{X25519MLKEM768}, + expectSelected: X25519MLKEM768, + }, + { + name: "ClientSortedCurvePreferences", + clientConfig: func(config *Config) { + config.CurvePreferences = []CurveID{CurveP256, X25519MLKEM768} + }, + expectClient: []CurveID{X25519MLKEM768, CurveP256}, + expectSelected: X25519MLKEM768, + }, + { + name: "ClientTLSv12", + clientConfig: func(config *Config) { + config.MaxVersion = VersionTLS12 + }, + expectClient: defaultWithoutPQ, + expectSelected: X25519, + }, + { + name: "ServerTLSv12", + serverConfig: func(config *Config) { + config.MaxVersion = VersionTLS12 + }, + expectClient: defaultWithPQ, + expectSelected: X25519, + }, + { + name: "GODEBUG tlsmlkem=0", + preparation: func(t *testing.T) { + t.Setenv("GODEBUG", "tlsmlkem=0") + }, + expectClient: defaultWithoutPQ, + expectSelected: X25519, + }, + { + name: "GODEBUG tlssecpmlkem=0", + preparation: func(t *testing.T) { + t.Setenv("GODEBUG", "tlssecpmlkem=0") + }, + expectClient: []CurveID{X25519MLKEM768, X25519, CurveP256, CurveP384, CurveP521}, + expectSelected: X25519MLKEM768, + }, + } + + baseConfig := testConfig.Clone() + baseConfig.CurvePreferences = nil + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + if fips140tls.Required() && test.expectSelected == X25519 { + t.Skip("X25519 not supported in FIPS mode") + } + if test.preparation != nil { + test.preparation(t) + } else { + t.Parallel() + } + serverConfig := baseConfig.Clone() + if test.serverConfig != nil { + test.serverConfig(serverConfig) + } + serverConfig.GetConfigForClient = func(hello *ClientHelloInfo) (*Config, error) { + expectClient := slices.Clone(test.expectClient) + expectClient = slices.DeleteFunc(expectClient, func(c CurveID) bool { + return fips140tls.Required() && c == X25519 + }) + if !slices.Equal(hello.SupportedCurves, expectClient) { + t.Errorf("got client curves %v, expected %v", hello.SupportedCurves, expectClient) + } + return nil, nil + } + clientConfig := baseConfig.Clone() + if test.clientConfig != nil { + test.clientConfig(clientConfig) + } + ss, cs, err := testHandshake(t, clientConfig, serverConfig) + if err != nil { + t.Fatal(err) + } + if ss.CurveID != test.expectSelected { + t.Errorf("server selected curve %v, expected %v", ss.CurveID, test.expectSelected) + } + if cs.CurveID != test.expectSelected { + t.Errorf("client selected curve %v, expected %v", cs.CurveID, test.expectSelected) + } + if test.expectHRR { + if !ss.HelloRetryRequest { + t.Error("server did not use HRR") + } + if !cs.HelloRetryRequest { + t.Error("client did not use HRR") + } + } else { + if ss.HelloRetryRequest { + t.Error("server used HRR") + } + if cs.HelloRetryRequest { + t.Error("client used HRR") + } + } + }) + } +} + +func TestX509KeyPairPopulateCertificate(t *testing.T) { + key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatal(err) + } + keyDER, err := x509.MarshalPKCS8PrivateKey(key) + if err != nil { + t.Fatal(err) + } + keyPEM := pem.EncodeToMemory(&pem.Block{Type: "PRIVATE KEY", Bytes: keyDER}) + tmpl := &x509.Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{CommonName: "test"}, + } + certDER, err := x509.CreateCertificate(rand.Reader, tmpl, tmpl, key.Public(), key) + if err != nil { + t.Fatal(err) + } + certPEM := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: certDER}) + + t.Run("x509keypairleaf=0", func(t *testing.T) { + t.Setenv("GODEBUG", "x509keypairleaf=0") + cert, err := X509KeyPair(certPEM, keyPEM) + if err != nil { + t.Fatal(err) + } + if cert.Leaf != nil { + t.Fatal("Leaf should not be populated") + } + }) + t.Run("x509keypairleaf=1", func(t *testing.T) { + t.Setenv("GODEBUG", "x509keypairleaf=1") + cert, err := X509KeyPair(certPEM, keyPEM) + if err != nil { + t.Fatal(err) + } + if cert.Leaf == nil { + t.Fatal("Leaf should be populated") + } + }) + t.Run("GODEBUG unset", func(t *testing.T) { + cert, err := X509KeyPair(certPEM, keyPEM) + if err != nil { + t.Fatal(err) + } + if cert.Leaf == nil { + t.Fatal("Leaf should be populated") + } + }) +} + +func TestEarlyLargeCertMsg(t *testing.T) { + client, server := localPipe(t) + + go func() { + if _, err := client.Write([]byte{byte(recordTypeHandshake), 3, 4, 0, 4, typeCertificate, 1, 255, 255}); err != nil { + t.Log(err) + } + }() + + expectedErr := "tls: handshake message of length 131071 bytes exceeds maximum of 65536 bytes" + servConn := Server(server, testConfig) + err := servConn.Handshake() + if err == nil { + t.Fatal("unexpected success") + } + if err.Error() != expectedErr { + t.Fatalf("unexpected error: got %q, want %q", err, expectedErr) + } +} + +func TestLargeCertMsg(t *testing.T) { + k, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatal(err) + } + tmpl := &x509.Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{CommonName: "test"}, + ExtraExtensions: []pkix.Extension{ + { + Id: asn1.ObjectIdentifier{1, 2, 3}, + // Ballast to inflate the certificate beyond the + // regular handshake record size. + Value: make([]byte, 65536), + }, + }, + } + cert, err := x509.CreateCertificate(rand.Reader, tmpl, tmpl, k.Public(), k) + if err != nil { + t.Fatal(err) + } + + clientConfig, serverConfig := testConfig.Clone(), testConfig.Clone() + clientConfig.InsecureSkipVerify = true + serverConfig.Certificates = []Certificate{ + { + Certificate: [][]byte{cert}, + PrivateKey: k, + }, + } + if _, _, err := testHandshake(t, clientConfig, serverConfig); err != nil { + t.Fatalf("unexpected failure: %s", err) + } +} + +func TestECH(t *testing.T) { + k, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatal(err) + } + tmpl := &x509.Certificate{ + SerialNumber: big.NewInt(1), + DNSNames: []string{"public.example"}, + NotBefore: time.Now().Add(-time.Hour), + NotAfter: time.Now().Add(time.Hour), + } + publicCertDER, err := x509.CreateCertificate(rand.Reader, tmpl, tmpl, k.Public(), k) + if err != nil { + t.Fatal(err) + } + publicCert, err := x509.ParseCertificate(publicCertDER) + if err != nil { + t.Fatal(err) + } + tmpl.DNSNames[0] = "secret.example" + secretCertDER, err := x509.CreateCertificate(rand.Reader, tmpl, tmpl, k.Public(), k) + if err != nil { + t.Fatal(err) + } + secretCert, err := x509.ParseCertificate(secretCertDER) + if err != nil { + t.Fatal(err) + } + + marshalECHConfig := func(id uint8, pubKey []byte, publicName string, maxNameLen uint8) []byte { + builder := cryptobyte.NewBuilder(nil) + builder.AddUint16(extensionEncryptedClientHello) + builder.AddUint16LengthPrefixed(func(builder *cryptobyte.Builder) { + builder.AddUint8(id) + builder.AddUint16(0x0020 /* DHKEM(X25519, HKDF-SHA256) */) + builder.AddUint16LengthPrefixed(func(builder *cryptobyte.Builder) { + builder.AddBytes(pubKey) + }) + builder.AddUint16LengthPrefixed(func(builder *cryptobyte.Builder) { + builder.AddUint16(0x0001 /* HKDF-SHA256 */) + builder.AddUint16(0x0001 /* AES-128-GCM */) + }) + builder.AddUint8(maxNameLen) + builder.AddUint8LengthPrefixed(func(builder *cryptobyte.Builder) { + builder.AddBytes([]byte(publicName)) + }) + builder.AddUint16(0) // extensions + }) + + return builder.BytesOrPanic() + } + + echKey, err := ecdh.X25519().GenerateKey(rand.Reader) + if err != nil { + t.Fatal(err) + } + + echConfig := marshalECHConfig(123, echKey.PublicKey().Bytes(), "public.example", 32) + + builder := cryptobyte.NewBuilder(nil) + builder.AddUint16LengthPrefixed(func(builder *cryptobyte.Builder) { + builder.AddBytes(echConfig) + }) + echConfigList := builder.BytesOrPanic() + + clientConfig, serverConfig := testConfig.Clone(), testConfig.Clone() + clientConfig.InsecureSkipVerify = false + clientConfig.Rand = rand.Reader + clientConfig.Time = nil + clientConfig.MinVersion = VersionTLS13 + clientConfig.ServerName = "secret.example" + clientConfig.RootCAs = x509.NewCertPool() + clientConfig.RootCAs.AddCert(secretCert) + clientConfig.RootCAs.AddCert(publicCert) + clientConfig.EncryptedClientHelloConfigList = echConfigList + serverConfig.InsecureSkipVerify = false + serverConfig.Rand = rand.Reader + serverConfig.Time = nil + serverConfig.MinVersion = VersionTLS13 + serverConfig.ServerName = "public.example" + serverConfig.Certificates = []Certificate{ + {Certificate: [][]byte{publicCertDER}, PrivateKey: k}, + {Certificate: [][]byte{secretCertDER}, PrivateKey: k}, + } + serverConfig.EncryptedClientHelloKeys = []EncryptedClientHelloKey{ + {Config: echConfig, PrivateKey: echKey.Bytes(), SendAsRetry: true}, + } + + check := func() { + ss, cs, err := testHandshake(t, clientConfig, serverConfig) + if err != nil { + t.Fatalf("unexpected failure: %s", err) + } + if !ss.ECHAccepted { + t.Fatal("server ConnectionState shows ECH not accepted") + } + if !cs.ECHAccepted { + t.Fatal("client ConnectionState shows ECH not accepted") + } + if cs.ServerName != "secret.example" || ss.ServerName != "secret.example" { + t.Fatalf("unexpected ConnectionState.ServerName, want %q, got server:%q, client: %q", "secret.example", ss.ServerName, cs.ServerName) + } + if len(cs.VerifiedChains) != 1 { + t.Fatal("unexpect number of certificate chains") + } + if len(cs.VerifiedChains[0]) != 1 { + t.Fatal("unexpect number of certificates") + } + if !cs.VerifiedChains[0][0].Equal(secretCert) { + t.Fatal("unexpected certificate") + } + } + + check() + + serverConfig.GetEncryptedClientHelloKeys = func(_ *ClientHelloInfo) ([]EncryptedClientHelloKey, error) { + return []EncryptedClientHelloKey{{Config: echConfig, PrivateKey: echKey.Bytes(), SendAsRetry: true}}, nil + } + randKey, err := ecdh.X25519().GenerateKey(rand.Reader) + if err != nil { + t.Fatal(err) + } + randConfig := marshalECHConfig(32, randKey.PublicKey().Bytes(), "random.example", 32) + serverConfig.EncryptedClientHelloKeys = []EncryptedClientHelloKey{ + {Config: randConfig, PrivateKey: randKey.Bytes(), SendAsRetry: true}, + } + + check() +} + +func TestMessageSigner(t *testing.T) { + t.Run("TLSv10", func(t *testing.T) { testMessageSigner(t, VersionTLS10) }) + t.Run("TLSv12", func(t *testing.T) { testMessageSigner(t, VersionTLS12) }) + t.Run("TLSv13", func(t *testing.T) { testMessageSigner(t, VersionTLS13) }) +} + +func testMessageSigner(t *testing.T, version uint16) { + clientConfig, serverConfig := testConfig.Clone(), testConfig.Clone() + serverConfig.ClientAuth = RequireAnyClientCert + clientConfig.MinVersion = version + clientConfig.MaxVersion = version + serverConfig.MinVersion = version + serverConfig.MaxVersion = version + clientConfig.Certificates = []Certificate{{ + Certificate: [][]byte{testRSACertificate}, + PrivateKey: messageOnlySigner{testRSAPrivateKey}, + }} + serverConfig.Certificates = []Certificate{{ + Certificate: [][]byte{testRSACertificate}, + PrivateKey: messageOnlySigner{testRSAPrivateKey}, + }} + + _, _, err := testHandshake(t, clientConfig, serverConfig) + if version < VersionTLS12 { + if err == nil { + t.Fatal("expected failure for TLS 1.0/1.1") + } + } else { + if err != nil { + t.Fatalf("unexpected failure: %s", err) + } + } + + clientConfig.Certificates = []Certificate{{ + Certificate: [][]byte{testECDSACertificate}, + PrivateKey: messageOnlySigner{testECDSAPrivateKey}, + }} + serverConfig.Certificates = []Certificate{{ + Certificate: [][]byte{testECDSACertificate}, + PrivateKey: messageOnlySigner{testECDSAPrivateKey}, + }} + + _, _, err = testHandshake(t, clientConfig, serverConfig) + if version < VersionTLS12 { + if err == nil { + t.Fatal("expected failure for TLS 1.0/1.1") + } + } else { + if err != nil { + t.Fatalf("unexpected failure: %s", err) + } + } +} + +type messageOnlySigner struct{ crypto.Signer } + +func (s messageOnlySigner) Public() crypto.PublicKey { + return s.Signer.Public() +} + +func (s messageOnlySigner) Sign(rand io.Reader, msg []byte, opts crypto.SignerOpts) (signature []byte, err error) { + return nil, errors.New("messageOnlySigner: Sign called") +} + +func (s messageOnlySigner) SignMessage(rand io.Reader, msg []byte, opts crypto.SignerOpts) (signature []byte, err error) { + h := opts.HashFunc().New() + h.Write(msg) + digest := h.Sum(nil) + return s.Signer.Sign(rand, digest, opts) +} diff --git a/go/src/crypto/x509/bettertls_test.go b/go/src/crypto/x509/bettertls_test.go new file mode 100644 index 0000000000000000000000000000000000000000..3ef67b05a91753ed2b1ea52e3c7486a5b69fac05 --- /dev/null +++ b/go/src/crypto/x509/bettertls_test.go @@ -0,0 +1,225 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// This test uses Netflix's BetterTLS test suite to test the crypto/x509 +// path building and name constraint validation. +// +// The test data in JSON form is around 31MB, so we fetch the BetterTLS +// go module and use it to generate the JSON data on-the-fly in a tmp dir. +// +// For more information, see: +// https://github.com/netflix/bettertls +// https://netflixtechblog.com/bettertls-c9915cd255c0 + +package x509 + +import ( + "crypto/internal/cryptotest" + "encoding/base64" + "encoding/json" + "internal/testenv" + "os" + "path/filepath" + "testing" +) + +// TestBetterTLS runs the "pathbuilding" and "nameconstraints" suites of +// BetterTLS. +// +// The test cases in the pathbuilding suite are designed to test edge-cases +// for path building and validation. In particular, the ["chain of pain"][0] +// scenario where a validator treats path building as an operation with +// a single possible outcome, instead of many. +// +// The test cases in the nameconstraints suite are designed to test edge-cases +// for name constraint parsing and validation. +// +// [0]: https://medium.com/@sleevi_/path-building-vs-path-verifying-the-chain-of-pain-9fbab861d7d6 +func TestBetterTLS(t *testing.T) { + testenv.SkipIfShortAndSlow(t) + + data, roots := betterTLSTestData(t) + + for _, suite := range []string{"pathbuilding", "nameconstraints"} { + t.Run(suite, func(t *testing.T) { + runTestSuite(t, suite, &data, roots) + }) + } +} + +func runTestSuite(t *testing.T, suiteName string, data *betterTLS, roots *CertPool) { + suite, exists := data.Suites[suiteName] + if !exists { + t.Fatalf("missing %s suite", suiteName) + } + + t.Logf( + "running %s test suite with %d test cases", + suiteName, len(suite.TestCases)) + + for _, tc := range suite.TestCases { + t.Logf("testing %s test case %d", suiteName, tc.ID) + + certsDER, err := tc.Certs() + if err != nil { + t.Fatalf( + "failed to decode certificates for test case %d: %v", + tc.ID, err) + } + + if len(certsDER) == 0 { + t.Fatalf("test case %d has no certificates", tc.ID) + } + + eeCert, err := ParseCertificate(certsDER[0]) + if err != nil { + // Several constraint test cases contain invalid end-entity + // certificate extensions that we reject ahead of verification + // time. We consider this a pass and skip further processing. + // + // For example, a SAN with a uniformResourceIdentifier general name + // containing the value `"http://foo.bar, DNS:test.localhost"`, or + // an iPAddress general name of the wrong length. + if suiteName == "nameconstraints" && tc.Expected == expectedReject { + t.Logf( + "skipping expected reject test case %d "+ + "- end entity certificate parse error: %v", + tc.ID, err) + continue + } + t.Fatalf( + "failed to parse end entity certificate for test case %d: %v", + tc.ID, err) + } + + intermediates := NewCertPool() + for i, certDER := range certsDER[1:] { + cert, err := ParseCertificate(certDER) + if err != nil { + t.Fatalf( + "failed to parse intermediate certificate %d for test case %d: %v", + i+1, tc.ID, err) + } + intermediates.AddCert(cert) + } + + _, err = eeCert.Verify(VerifyOptions{ + Roots: roots, + Intermediates: intermediates, + DNSName: tc.Hostname, + KeyUsages: []ExtKeyUsage{ExtKeyUsageServerAuth}, + }) + + switch tc.Expected { + case expectedAccept: + if err != nil { + t.Errorf( + "test case %d failed: expected success, got error: %v", + tc.ID, err) + } + case expectedReject: + if err == nil { + t.Errorf( + "test case %d failed: expected failure, but verification succeeded", + tc.ID) + } + default: + t.Fatalf( + "test case %d failed: unknown expected result: %s", + tc.ID, tc.Expected) + } + } +} + +func betterTLSTestData(t *testing.T) (betterTLS, *CertPool) { + const ( + bettertlsModule = "github.com/Netflix/bettertls" + bettertlsVersion = "v0.0.0-20250909192348-e1e99e353074" + ) + + bettertlsDir := cryptotest.FetchModule(t, bettertlsModule, bettertlsVersion) + + tempDir := t.TempDir() + testsJSONPath := filepath.Join(tempDir, "tests.json") + + cmd := testenv.Command(t, testenv.GoToolPath(t), + "run", "./test-suites/cmd/bettertls", + "export-tests", + "--out", testsJSONPath) + cmd.Dir = bettertlsDir + t.Log("running bettertls export-tests command") + if out, err := cmd.CombinedOutput(); err != nil { + t.Fatalf("failed to run bettertls export-tests: %v\n%s", err, out) + } + + jsonData, err := os.ReadFile(testsJSONPath) + if err != nil { + t.Fatalf("failed to read exported tests.json: %v", err) + } + + t.Logf("successfully loaded tests.json at %s", testsJSONPath) + + var data betterTLS + if err := json.Unmarshal(jsonData, &data); err != nil { + t.Fatalf("failed to unmarshal JSON data: %v", err) + } + + t.Logf("testing betterTLS revision: %s", data.Revision) + t.Logf("number of test suites: %d", len(data.Suites)) + + rootDER, err := data.RootCert() + if err != nil { + t.Fatalf("failed to decode trust root: %v", err) + } + + rootCert, err := ParseCertificate(rootDER) + if err != nil { + t.Fatalf("failed to parse trust root certificate: %v", err) + } + + roots := NewCertPool() + roots.AddCert(rootCert) + + return data, roots +} + +type betterTLS struct { + Revision string `json:"betterTlsRevision"` + Root string `json:"trustRoot"` + Suites map[string]betterTLSSuite `json:"suites"` +} + +func (b *betterTLS) RootCert() ([]byte, error) { + return base64.StdEncoding.DecodeString(b.Root) +} + +type betterTLSSuite struct { + TestCases []betterTLSTest `json:"testCases"` +} + +type betterTLSTest struct { + ID uint32 `json:"id"` + Certificates []string `json:"certificates"` + Hostname string `json:"hostname"` + Expected expectedResult `json:"expected"` +} + +func (test *betterTLSTest) Certs() ([][]byte, error) { + certs := make([][]byte, len(test.Certificates)) + for i, cert := range test.Certificates { + decoded, err := base64.StdEncoding.DecodeString(cert) + if err != nil { + return nil, err + } + certs[i] = decoded + } + return certs, nil +} + +type expectedResult string + +const ( + expectedAccept expectedResult = "ACCEPT" + expectedReject expectedResult = "REJECT" +) diff --git a/go/src/crypto/x509/cert_pool.go b/go/src/crypto/x509/cert_pool.go new file mode 100644 index 0000000000000000000000000000000000000000..e4c5694fbe4f8961e9e9fc92e1490e707fe6e82a --- /dev/null +++ b/go/src/crypto/x509/cert_pool.go @@ -0,0 +1,294 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "bytes" + "crypto/sha256" + "encoding/pem" + "sync" +) + +type sum224 [sha256.Size224]byte + +// CertPool is a set of certificates. +type CertPool struct { + byName map[string][]int // cert.RawSubject => index into lazyCerts + + // lazyCerts contains funcs that return a certificate, + // lazily parsing/decompressing it as needed. + lazyCerts []lazyCert + + // haveSum maps from sum224(cert.Raw) to true. It's used only + // for AddCert duplicate detection, to avoid CertPool.contains + // calls in the AddCert path (because the contains method can + // call getCert and otherwise negate savings from lazy getCert + // funcs). + haveSum map[sum224]bool + + // systemPool indicates whether this is a special pool derived from the + // system roots. If it includes additional roots, it requires doing two + // verifications, one using the roots provided by the caller, and one using + // the system platform verifier. + systemPool bool +} + +// lazyCert is minimal metadata about a Cert and a func to retrieve it +// in its normal expanded *Certificate form. +type lazyCert struct { + // rawSubject is the Certificate.RawSubject value. + // It's the same as the CertPool.byName key, but in []byte + // form to make CertPool.Subjects (as used by crypto/tls) do + // fewer allocations. + rawSubject []byte + + // constraint is a function to run against a chain when it is a candidate to + // be added to the chain. This allows adding arbitrary constraints that are + // not specified in the certificate itself. + constraint func([]*Certificate) error + + // getCert returns the certificate. + // + // It is not meant to do network operations or anything else + // where a failure is likely; the func is meant to lazily + // parse/decompress data that is already known to be good. The + // error in the signature primarily is meant for use in the + // case where a cert file existed on local disk when the program + // started up is deleted later before it's read. + getCert func() (*Certificate, error) +} + +// NewCertPool returns a new, empty CertPool. +func NewCertPool() *CertPool { + return &CertPool{ + byName: make(map[string][]int), + haveSum: make(map[sum224]bool), + } +} + +// len returns the number of certs in the set. +// A nil set is a valid empty set. +func (s *CertPool) len() int { + if s == nil { + return 0 + } + return len(s.lazyCerts) +} + +// cert returns cert index n in s. +func (s *CertPool) cert(n int) (*Certificate, func([]*Certificate) error, error) { + cert, err := s.lazyCerts[n].getCert() + return cert, s.lazyCerts[n].constraint, err +} + +// Clone returns a copy of s. +func (s *CertPool) Clone() *CertPool { + p := &CertPool{ + byName: make(map[string][]int, len(s.byName)), + lazyCerts: make([]lazyCert, len(s.lazyCerts)), + haveSum: make(map[sum224]bool, len(s.haveSum)), + systemPool: s.systemPool, + } + for k, v := range s.byName { + indexes := make([]int, len(v)) + copy(indexes, v) + p.byName[k] = indexes + } + for k := range s.haveSum { + p.haveSum[k] = true + } + copy(p.lazyCerts, s.lazyCerts) + return p +} + +// SystemCertPool returns a copy of the system cert pool. +// +// On Unix systems other than macOS the environment variables SSL_CERT_FILE and +// SSL_CERT_DIR can be used to override the system default locations for the SSL +// certificate file and SSL certificate files directory, respectively. The +// latter can be a colon-separated list. +// +// Any mutations to the returned pool are not written to disk and do not affect +// any other pool returned by SystemCertPool. +// +// New changes in the system cert pool might not be reflected in subsequent calls. +func SystemCertPool() (*CertPool, error) { + if sysRoots := systemRootsPool(); sysRoots != nil { + return sysRoots.Clone(), nil + } + + return loadSystemRoots() +} + +type potentialParent struct { + cert *Certificate + constraint func([]*Certificate) error +} + +// findPotentialParents returns the certificates in s which might have signed +// cert. +func (s *CertPool) findPotentialParents(cert *Certificate) []potentialParent { + if s == nil { + return nil + } + + // consider all candidates where cert.Issuer matches cert.Subject. + // when picking possible candidates the list is built in the order + // of match plausibility as to save cycles in buildChains: + // AKID and SKID match + // AKID present, SKID missing / AKID missing, SKID present + // AKID and SKID don't match + var matchingKeyID, oneKeyID, mismatchKeyID []potentialParent + for _, c := range s.byName[string(cert.RawIssuer)] { + candidate, constraint, err := s.cert(c) + if err != nil { + continue + } + kidMatch := bytes.Equal(candidate.SubjectKeyId, cert.AuthorityKeyId) + switch { + case kidMatch: + matchingKeyID = append(matchingKeyID, potentialParent{candidate, constraint}) + case (len(candidate.SubjectKeyId) == 0 && len(cert.AuthorityKeyId) > 0) || + (len(candidate.SubjectKeyId) > 0 && len(cert.AuthorityKeyId) == 0): + oneKeyID = append(oneKeyID, potentialParent{candidate, constraint}) + default: + mismatchKeyID = append(mismatchKeyID, potentialParent{candidate, constraint}) + } + } + + found := len(matchingKeyID) + len(oneKeyID) + len(mismatchKeyID) + if found == 0 { + return nil + } + candidates := make([]potentialParent, 0, found) + candidates = append(candidates, matchingKeyID...) + candidates = append(candidates, oneKeyID...) + candidates = append(candidates, mismatchKeyID...) + return candidates +} + +func (s *CertPool) contains(cert *Certificate) bool { + if s == nil { + return false + } + return s.haveSum[sha256.Sum224(cert.Raw)] +} + +// AddCert adds a certificate to a pool. +func (s *CertPool) AddCert(cert *Certificate) { + if cert == nil { + panic("adding nil Certificate to CertPool") + } + s.addCertFunc(sha256.Sum224(cert.Raw), string(cert.RawSubject), func() (*Certificate, error) { + return cert, nil + }, nil) +} + +// addCertFunc adds metadata about a certificate to a pool, along with +// a func to fetch that certificate later when needed. +// +// The rawSubject is Certificate.RawSubject and must be non-empty. +// The getCert func may be called 0 or more times. +func (s *CertPool) addCertFunc(rawSum224 sum224, rawSubject string, getCert func() (*Certificate, error), constraint func([]*Certificate) error) { + if getCert == nil { + panic("getCert can't be nil") + } + + // Check that the certificate isn't being added twice. + if s.haveSum[rawSum224] { + return + } + + s.haveSum[rawSum224] = true + s.lazyCerts = append(s.lazyCerts, lazyCert{ + rawSubject: []byte(rawSubject), + getCert: getCert, + constraint: constraint, + }) + s.byName[rawSubject] = append(s.byName[rawSubject], len(s.lazyCerts)-1) +} + +// AppendCertsFromPEM attempts to parse a series of PEM encoded certificates. +// It appends any certificates found to s and reports whether any certificates +// were successfully parsed. +// +// On many Linux systems, /etc/ssl/cert.pem will contain the system wide set +// of root CAs in a format suitable for this function. +func (s *CertPool) AppendCertsFromPEM(pemCerts []byte) (ok bool) { + for len(pemCerts) > 0 { + var block *pem.Block + block, pemCerts = pem.Decode(pemCerts) + if block == nil { + break + } + if block.Type != "CERTIFICATE" || len(block.Headers) != 0 { + continue + } + + certBytes := block.Bytes + cert, err := ParseCertificate(certBytes) + if err != nil { + continue + } + var lazyCert struct { + sync.Once + v *Certificate + } + s.addCertFunc(sha256.Sum224(cert.Raw), string(cert.RawSubject), func() (*Certificate, error) { + lazyCert.Do(func() { + // This can't fail, as the same bytes already parsed above. + lazyCert.v, _ = ParseCertificate(certBytes) + certBytes = nil + }) + return lazyCert.v, nil + }, nil) + ok = true + } + + return ok +} + +// Subjects returns a list of the DER-encoded subjects of +// all of the certificates in the pool. +// +// Deprecated: if s was returned by [SystemCertPool], Subjects +// will not include the system roots. +func (s *CertPool) Subjects() [][]byte { + res := make([][]byte, s.len()) + for i, lc := range s.lazyCerts { + res[i] = lc.rawSubject + } + return res +} + +// Equal reports whether s and other are equal. +func (s *CertPool) Equal(other *CertPool) bool { + if s == nil || other == nil { + return s == other + } + if s.systemPool != other.systemPool || len(s.haveSum) != len(other.haveSum) { + return false + } + for h := range s.haveSum { + if !other.haveSum[h] { + return false + } + } + return true +} + +// AddCertWithConstraint adds a certificate to the pool with the additional +// constraint. When Certificate.Verify builds a chain which is rooted by cert, +// it will additionally pass the whole chain to constraint to determine its +// validity. If constraint returns a non-nil error, the chain will be discarded. +// constraint may be called concurrently from multiple goroutines. +func (s *CertPool) AddCertWithConstraint(cert *Certificate, constraint func([]*Certificate) error) { + if cert == nil { + panic("adding nil Certificate to CertPool") + } + s.addCertFunc(sha256.Sum224(cert.Raw), string(cert.RawSubject), func() (*Certificate, error) { + return cert, nil + }, constraint) +} diff --git a/go/src/crypto/x509/cert_pool_test.go b/go/src/crypto/x509/cert_pool_test.go new file mode 100644 index 0000000000000000000000000000000000000000..a12beda83d353984abdc6e9a45a3206f0d2d212a --- /dev/null +++ b/go/src/crypto/x509/cert_pool_test.go @@ -0,0 +1,108 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import "testing" + +func TestCertPoolEqual(t *testing.T) { + tc := &Certificate{Raw: []byte{1, 2, 3}, RawSubject: []byte{2}} + otherTC := &Certificate{Raw: []byte{9, 8, 7}, RawSubject: []byte{8}} + + emptyPool := NewCertPool() + nonSystemPopulated := NewCertPool() + nonSystemPopulated.AddCert(tc) + nonSystemPopulatedAlt := NewCertPool() + nonSystemPopulatedAlt.AddCert(otherTC) + emptySystem, err := SystemCertPool() + if err != nil { + t.Fatal(err) + } + populatedSystem, err := SystemCertPool() + if err != nil { + t.Fatal(err) + } + populatedSystem.AddCert(tc) + populatedSystemAlt, err := SystemCertPool() + if err != nil { + t.Fatal(err) + } + populatedSystemAlt.AddCert(otherTC) + tests := []struct { + name string + a *CertPool + b *CertPool + equal bool + }{ + { + name: "two empty pools", + a: emptyPool, + b: emptyPool, + equal: true, + }, + { + name: "one empty pool, one populated pool", + a: emptyPool, + b: nonSystemPopulated, + equal: false, + }, + { + name: "two populated pools", + a: nonSystemPopulated, + b: nonSystemPopulated, + equal: true, + }, + { + name: "two populated pools, different content", + a: nonSystemPopulated, + b: nonSystemPopulatedAlt, + equal: false, + }, + { + name: "two empty system pools", + a: emptySystem, + b: emptySystem, + equal: true, + }, + { + name: "one empty system pool, one populated system pool", + a: emptySystem, + b: populatedSystem, + equal: false, + }, + { + name: "two populated system pools", + a: populatedSystem, + b: populatedSystem, + equal: true, + }, + { + name: "two populated pools, different content", + a: populatedSystem, + b: populatedSystemAlt, + equal: false, + }, + { + name: "two nil pools", + a: nil, + b: nil, + equal: true, + }, + { + name: "one nil pool, one empty pool", + a: nil, + b: emptyPool, + equal: false, + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + equal := tc.a.Equal(tc.b) + if equal != tc.equal { + t.Errorf("Unexpected Equal result: got %t, want %t", equal, tc.equal) + } + }) + } +} diff --git a/go/src/crypto/x509/constraints.go b/go/src/crypto/x509/constraints.go new file mode 100644 index 0000000000000000000000000000000000000000..b7eb1e0f57d8662ab7084d30057fe66a2e58b1a1 --- /dev/null +++ b/go/src/crypto/x509/constraints.go @@ -0,0 +1,624 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "bytes" + "fmt" + "net" + "net/netip" + "net/url" + "slices" + "strings" +) + +// This file contains the data structures and functions necessary for +// efficiently checking X.509 name constraints. The method for constraint +// checking implemented in this file is based on a technique originally +// described by davidben@google.com. +// +// The basic concept is based on the fact that constraints describe possibly +// overlapping subtrees that we need to match against. If sorted in lexicographic +// order, and then pruned, removing any subtrees that overlap with preceding +// subtrees, a simple binary search can be used to find the nearest matching +// prefix. This reduces the complexity of name constraint checking from +// quadratic to log linear complexity. +// +// A close reading of RFC 5280 may suggest that constraints could also be +// implemented as a trie (or radix tree), which would present the possibility of +// doing construction and matching in linear time, but the memory cost of +// implementing them is actually quite high, and in the worst case (where each +// node has a high number of children) can be abused to require a program to use +// significant amounts of memory. The log linear approach taken here is +// extremely cheap in terms of memory because we directly alias the already +// parsed constraints, thus avoiding the need to do significant additional +// allocations. +// +// The basic data structure is nameConstraintsSet, which implements the sorting, +// pruning, and querying of the prefix sets. +// +// In order to check IP, DNS, URI, and email constraints, we need to use two +// different techniques, one for IP addresses, which is quite simple, and one +// for DNS names, which additionally compose the portions of URIs and emails we +// care about (technically we also need some special logic for email addresses +// as well for when constraints comprise of full email addresses) which is +// slightly more complex. +// +// IP addresses use two nameConstraintsSets, one for IPv4 addresses and one for +// IPv6 addresses, with no additional logic. +// +// DNS names require some extra logic in order to handle the distinctions +// between permitted and excluded subtrees, as well as for wildcards, and the +// semantics of leading period constraints (i.e. '.example.com'). This logic is +// implemented in the dnsConstraints type. +// +// Email addresses also require some additional logic, which does not make use +// of nameConstraintsSet, to handle constraints which define full email +// addresses (i.e. 'test@example.com'). For bare domain constraints, we use the +// dnsConstraints type described above, querying the domain portion of the email +// address. For full email addresses, we also hold a map of email addresses with +// the domain portion of the email lowercased, since it is case insensitive. When +// looking up an email address in the constraint set, we first check the full +// email address map, and if we don't find anything, we check the domain portion +// of the email address against the dnsConstraints. + +type nameConstraintsSet[T *net.IPNet | string, V net.IP | string] struct { + set []T +} + +// sortAndPrune sorts the constraints using the provided comparison function, and then +// prunes any constraints that are subsets of preceding constraints using the +// provided subset function. +func (nc *nameConstraintsSet[T, V]) sortAndPrune(cmp func(T, T) int, subset func(T, T) bool) { + if len(nc.set) < 2 { + return + } + + slices.SortFunc(nc.set, cmp) + + if len(nc.set) < 2 { + return + } + writeIndex := 1 + for readIndex := 1; readIndex < len(nc.set); readIndex++ { + if !subset(nc.set[writeIndex-1], nc.set[readIndex]) { + nc.set[writeIndex] = nc.set[readIndex] + writeIndex++ + } + } + nc.set = nc.set[:writeIndex] +} + +// search does a binary search over the constraints set for the provided value +// s, using the provided comparison function cmp to find the lower bound, and +// the match function to determine if the found constraint is a prefix of s. If +// a matching constraint is found, it is returned along with true. If no +// matching constraint is found, the zero value of T and false are returned. +func (nc *nameConstraintsSet[T, V]) search(s V, cmp func(T, V) int, match func(T, V) bool) (lowerBound T, exactMatch bool) { + if len(nc.set) == 0 { + return lowerBound, false + } + // Look for the lower bound of s in the set. + i, found := slices.BinarySearchFunc(nc.set, s, cmp) + // If we found an exact match, return it + if found { + return nc.set[i], true + } + + if i < 0 { + return lowerBound, false + } + + var constraint T + if i == 0 { + constraint = nc.set[0] + } else { + constraint = nc.set[i-1] + } + if match(constraint, s) { + return constraint, true + } + return lowerBound, false +} + +func ipNetworkSubset(a, b *net.IPNet) bool { + if !a.Contains(b.IP) { + return false + } + broadcast := make(net.IP, len(b.IP)) + for i := range b.IP { + broadcast[i] = b.IP[i] | (^b.Mask[i]) + } + return a.Contains(broadcast) +} + +func ipNetworkCompare(a, b *net.IPNet) int { + i := bytes.Compare(a.IP, b.IP) + if i != 0 { + return i + } + return bytes.Compare(a.Mask, b.Mask) +} + +func ipBinarySearch(constraint *net.IPNet, target net.IP) int { + return bytes.Compare(constraint.IP, target) +} + +func ipMatch(constraint *net.IPNet, target net.IP) bool { + return constraint.Contains(target) +} + +type ipConstraints struct { + // NOTE: we could store IP network prefixes as a pre-processed byte slice + // (i.e. by masking the IP) and doing the byte prefix checking using faster + // techniques, but this would require allocating new byte slices, which is + // likely significantly more expensive than just operating on the + // pre-allocated *net.IPNet and net.IP objects directly. + + ipv4 *nameConstraintsSet[*net.IPNet, net.IP] + ipv6 *nameConstraintsSet[*net.IPNet, net.IP] +} + +func newIPNetConstraints(l []*net.IPNet) interface { + query(net.IP) (*net.IPNet, bool) +} { + if len(l) == 0 { + return nil + } + var ipv4, ipv6 []*net.IPNet + for _, n := range l { + if len(n.IP) == net.IPv4len { + ipv4 = append(ipv4, n) + } else { + ipv6 = append(ipv6, n) + } + } + var v4c, v6c *nameConstraintsSet[*net.IPNet, net.IP] + if len(ipv4) > 0 { + v4c = &nameConstraintsSet[*net.IPNet, net.IP]{ + set: ipv4, + } + v4c.sortAndPrune(ipNetworkCompare, ipNetworkSubset) + } + if len(ipv6) > 0 { + v6c = &nameConstraintsSet[*net.IPNet, net.IP]{ + set: ipv6, + } + v6c.sortAndPrune(ipNetworkCompare, ipNetworkSubset) + } + return &ipConstraints{ipv4: v4c, ipv6: v6c} +} + +func (ipc *ipConstraints) query(ip net.IP) (*net.IPNet, bool) { + var c *nameConstraintsSet[*net.IPNet, net.IP] + if len(ip) == net.IPv4len { + c = ipc.ipv4 + } else { + c = ipc.ipv6 + } + if c == nil { + return nil, false + } + return c.search(ip, ipBinarySearch, ipMatch) +} + +// dnsHasSuffix case-insensitively checks if DNS name b is a label suffix of DNS +// name a, meaning that example.com is not considered a suffix of +// testexample.com, but is a suffix of test.example.com. +// +// dnsHasSuffix supports the URI "leading period" constraint semantics, which +// while not explicitly defined for dNSNames in RFC 5280, are widely supported +// (see errata 5997). In particular, a constraint of ".example.com" is +// considered to only match subdomains of example.com, but not example.com +// itself. +// +// a and b must both be non-empty strings representing (mostly) valid DNS names. +func dnsHasSuffix(a, b string) bool { + lenA := len(a) + lenB := len(b) + if lenA > lenB { + return false + } + i := lenA - 1 + offset := lenA - lenB + for ; i >= 0; i-- { + ar, br := a[i], b[i-(offset)] + if ar == br { + continue + } + if br < ar { + ar, br = br, ar + } + if 'A' <= ar && ar <= 'Z' && br == ar+'a'-'A' { + continue + } + return false + } + + if a[0] != '.' && lenB > lenA && b[lenB-lenA-1] != '.' { + return false + } + + return true +} + +// dnsCompareTable contains the ASCII alphabet mapped from a characters index in +// the table to its lowercased form. +var dnsCompareTable [256]byte + +func init() { + // NOTE: we don't actually need the + // full alphabet, but calculating offsets would be more expensive than just + // having redundant characters. + for i := 0; i < 256; i++ { + c := byte(i) + if 'A' <= c && c <= 'Z' { + // Lowercase uppercase characters A-Z. + c += 'a' - 'A' + } + dnsCompareTable[i] = c + } + // Set the period character to 0 so that we get the right sorting behavior. + // + // In particular, we need the period character to sort before the only + // other valid DNS name character which isn't a-z or 0-9, the hyphen, + // otherwise a name with a dash would be incorrectly sorted into the middle + // of another tree. + // + // For example, imagine a certificate with the constraints "a.com", "a.a.com", and + // "a-a.com". These would sort as "a.com", "a-a.com", "a.a.com", which would break + // the pruning step since we wouldn't see that "a.a.com" is a subset of "a.com". + // Sorting the period before the hyphen ensures that "a.a.com" sorts before "a-a.com". + dnsCompareTable['.'] = 0 +} + +// dnsCompare is a case-insensitive reversed implementation of strings.Compare +// that operates from the end to the start of the strings. This is more +// efficient that allocating reversed version of a and b and using +// strings.Compare directly (even though it is highly optimized). +// +// NOTE: this function treats the period character ('.') as sorting above every +// other character, which is necessary for us to properly sort names into their +// correct order. This is further discussed in the init function above. +func dnsCompare(a, b string) int { + idxA := len(a) - 1 + idxB := len(b) - 1 + + for idxA >= 0 && idxB >= 0 { + byteA := dnsCompareTable[a[idxA]] + byteB := dnsCompareTable[b[idxB]] + if byteA == byteB { + idxA-- + idxB-- + continue + } + ret := 1 + if byteA < byteB { + ret = -1 + } + return ret + } + + ret := 0 + if idxA < idxB { + ret = -1 + } else if idxB < idxA { + ret = 1 + } + return ret +} + +type dnsConstraints struct { + // all lets us short circuit the query logic if we see a zero length + // constraint which permits or excludes everything. + all bool + + // permitted indicates if these constraints are for permitted or excluded + // names. + permitted bool + + constraints *nameConstraintsSet[string, string] + + // parentConstraints contains a subset of constraints which are used for + // wildcard SAN queries, which are constructed by removing the first label + // from the constraints in constraints. parentConstraints is only populated + // if permitted is false. + parentConstraints map[string]string +} + +func newDNSConstraints(l []string, permitted bool) interface{ query(string) (string, bool) } { + if len(l) == 0 { + return nil + } + for _, n := range l { + if len(n) == 0 { + return &dnsConstraints{all: true} + } + } + constraints := slices.Clone(l) + + nc := &dnsConstraints{ + constraints: &nameConstraintsSet[string, string]{ + set: constraints, + }, + permitted: permitted, + } + + nc.constraints.sortAndPrune(dnsCompare, dnsHasSuffix) + + if !permitted { + parentConstraints := map[string]string{} + for _, name := range nc.constraints.set { + name = strings.ToLower(name) + trimmedName := trimFirstLabel(name) + if trimmedName == "" { + continue + } + parentConstraints[trimmedName] = name + } + if len(parentConstraints) > 0 { + nc.parentConstraints = parentConstraints + } + } + + return nc +} + +func (dnc *dnsConstraints) query(s string) (string, bool) { + if dnc.all { + return "", true + } + + constraint, match := dnc.constraints.search(s, dnsCompare, dnsHasSuffix) + if match { + return constraint, true + } + + if !dnc.permitted && len(s) > 0 && s[0] == '*' { + s = strings.ToLower(s) + trimmed := trimFirstLabel(s) + if constraint, found := dnc.parentConstraints[trimmed]; found { + return constraint, true + } + } + return "", false +} + +type emailConstraints struct { + dnsConstraints interface{ query(string) (string, bool) } + + // fullEmails is map of rfc2821Mailboxs that are fully specified in the + // constraints, which we need to check for separately since they don't + // follow the same matching rules as the domain-based constraints. The + // domain portion of the rfc2821Mailbox has been lowercased, since the + // domain portion is case insensitive. When checking the map for an email, + // the domain portion of the query should also be lowercased. + fullEmails map[rfc2821Mailbox]struct{} +} + +func newEmailConstraints(l []string, permitted bool) interface { + query(rfc2821Mailbox) (string, bool) +} { + if len(l) == 0 { + return nil + } + exactMap := map[rfc2821Mailbox]struct{}{} + var domains []string + for _, c := range l { + if !strings.ContainsRune(c, '@') { + domains = append(domains, c) + continue + } + parsed, ok := parseRFC2821Mailbox(c) + if !ok { + // We've already parsed these addresses in parseCertificate, and + // treat failures as a hard failure for parsing. The only way we can + // get a parse failure here is if the caller has mutated the + // certificate since parsing. + continue + } + parsed.domain = strings.ToLower(parsed.domain) + exactMap[parsed] = struct{}{} + } + ec := &emailConstraints{ + fullEmails: exactMap, + } + if len(domains) > 0 { + ec.dnsConstraints = newDNSConstraints(domains, permitted) + } + return ec +} + +func (ec *emailConstraints) query(s rfc2821Mailbox) (string, bool) { + if len(ec.fullEmails) > 0 { + if _, ok := ec.fullEmails[s]; ok { + return fmt.Sprintf("%s@%s", s.local, s.domain), true + } + } + if ec.dnsConstraints == nil { + return "", false + } + constraint, found := ec.dnsConstraints.query(s.domain) + return constraint, found +} + +type constraints[T any, V any] struct { + constraintType string + permitted interface{ query(V) (T, bool) } + excluded interface{ query(V) (T, bool) } +} + +func checkConstraints[T string | *net.IPNet, V any, P string | net.IP | parsedURI | rfc2821Mailbox](c constraints[T, V], s V, p P) error { + if c.permitted != nil { + if _, found := c.permitted.query(s); !found { + return fmt.Errorf("%s %q is not permitted by any constraint", c.constraintType, p) + } + } + if c.excluded != nil { + if constraint, found := c.excluded.query(s); found { + return fmt.Errorf("%s %q is excluded by constraint %q", c.constraintType, p, constraint) + } + } + return nil +} + +type chainConstraints struct { + ip constraints[*net.IPNet, net.IP] + dns constraints[string, string] + uri constraints[string, string] + email constraints[string, rfc2821Mailbox] + + index int + next *chainConstraints +} + +func (cc *chainConstraints) check(dns []string, uris []parsedURI, emails []rfc2821Mailbox, ips []net.IP) error { + for _, ip := range ips { + if err := checkConstraints(cc.ip, ip, ip); err != nil { + return err + } + } + for _, d := range dns { + if !domainNameValid(d, false) { + return fmt.Errorf("x509: cannot parse dnsName %q", d) + } + if err := checkConstraints(cc.dns, d, d); err != nil { + return err + } + } + for _, u := range uris { + if !domainNameValid(u.domain, false) { + return fmt.Errorf("x509: internal error: URI SAN %q failed to parse", u) + } + if err := checkConstraints(cc.uri, u.domain, u); err != nil { + return err + } + } + for _, e := range emails { + if !domainNameValid(e.domain, false) { + return fmt.Errorf("x509: cannot parse rfc822Name %q", e) + } + if err := checkConstraints(cc.email, e, e); err != nil { + return err + } + } + return nil +} + +func checkChainConstraints(chain []*Certificate) error { + var currentConstraints *chainConstraints + var last *chainConstraints + for i, c := range chain { + if !c.hasNameConstraints() { + continue + } + cc := &chainConstraints{ + ip: constraints[*net.IPNet, net.IP]{"IP address", newIPNetConstraints(c.PermittedIPRanges), newIPNetConstraints(c.ExcludedIPRanges)}, + dns: constraints[string, string]{"DNS name", newDNSConstraints(c.PermittedDNSDomains, true), newDNSConstraints(c.ExcludedDNSDomains, false)}, + uri: constraints[string, string]{"URI", newDNSConstraints(c.PermittedURIDomains, true), newDNSConstraints(c.ExcludedURIDomains, false)}, + email: constraints[string, rfc2821Mailbox]{"email address", newEmailConstraints(c.PermittedEmailAddresses, true), newEmailConstraints(c.ExcludedEmailAddresses, false)}, + index: i, + } + if currentConstraints == nil { + currentConstraints = cc + last = cc + } else if last != nil { + last.next = cc + last = cc + } + } + if currentConstraints == nil { + return nil + } + + for i, c := range chain { + if !c.hasSANExtension() { + continue + } + if i >= currentConstraints.index { + for currentConstraints.index <= i { + if currentConstraints.next == nil { + return nil + } + currentConstraints = currentConstraints.next + } + } + + uris, err := parseURIs(c.URIs) + if err != nil { + return err + } + emails, err := parseMailboxes(c.EmailAddresses) + if err != nil { + return err + } + + for n := currentConstraints; n != nil; n = n.next { + if err := n.check(c.DNSNames, uris, emails, c.IPAddresses); err != nil { + return err + } + } + } + + return nil +} + +type parsedURI struct { + uri *url.URL + domain string +} + +func (u parsedURI) String() string { + return u.uri.String() +} + +func parseURIs(uris []*url.URL) ([]parsedURI, error) { + parsed := make([]parsedURI, 0, len(uris)) + for _, uri := range uris { + host := strings.ToLower(uri.Host) + if len(host) == 0 { + return nil, fmt.Errorf("URI with empty host (%q) cannot be matched against constraints", uri.String()) + } + if strings.Contains(host, ":") && !strings.HasSuffix(host, "]") { + var err error + host, _, err = net.SplitHostPort(uri.Host) + if err != nil { + return nil, fmt.Errorf("cannot parse URI host %q: %v", uri.Host, err) + } + } + + // netip.ParseAddr will reject the URI IPv6 literal form "[...]", so we + // check if _either_ the string parses as an IP, or if it is enclosed in + // square brackets. + if _, err := netip.ParseAddr(host); err == nil || (strings.HasPrefix(host, "[") && strings.HasSuffix(host, "]")) { + return nil, fmt.Errorf("URI with IP (%q) cannot be matched against constraints", uri.String()) + } + + parsed = append(parsed, parsedURI{uri, host}) + } + return parsed, nil +} + +func parseMailboxes(emails []string) ([]rfc2821Mailbox, error) { + parsed := make([]rfc2821Mailbox, 0, len(emails)) + for _, email := range emails { + mailbox, ok := parseRFC2821Mailbox(email) + if !ok { + return nil, fmt.Errorf("cannot parse rfc822Name %q", email) + } + mailbox.domain = strings.ToLower(mailbox.domain) + parsed = append(parsed, mailbox) + } + return parsed, nil +} + +func trimFirstLabel(dnsName string) string { + firstDotInd := strings.IndexByte(dnsName, '.') + if firstDotInd < 0 { + // Constraint is a single label, we cannot trim it. + return "" + } + return dnsName[firstDotInd:] +} diff --git a/go/src/crypto/x509/example_test.go b/go/src/crypto/x509/example_test.go new file mode 100644 index 0000000000000000000000000000000000000000..19d249af7a65274ea9dfd09e53ea8a33bb808529 --- /dev/null +++ b/go/src/crypto/x509/example_test.go @@ -0,0 +1,137 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509_test + +import ( + "crypto/dsa" + "crypto/ecdsa" + "crypto/ed25519" + "crypto/rsa" + "crypto/x509" + "encoding/pem" + "fmt" +) + +func ExampleCertificate_Verify() { + // Verifying with a custom list of root certificates. + + const rootPEM = ` +-----BEGIN CERTIFICATE----- +MIIEBDCCAuygAwIBAgIDAjppMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT +MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i +YWwgQ0EwHhcNMTMwNDA1MTUxNTU1WhcNMTUwNDA0MTUxNTU1WjBJMQswCQYDVQQG +EwJVUzETMBEGA1UEChMKR29vZ2xlIEluYzElMCMGA1UEAxMcR29vZ2xlIEludGVy +bmV0IEF1dGhvcml0eSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +AJwqBHdc2FCROgajguDYUEi8iT/xGXAaiEZ+4I/F8YnOIe5a/mENtzJEiaB0C1NP +VaTOgmKV7utZX8bhBYASxF6UP7xbSDj0U/ck5vuR6RXE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CXsr3b5/dAOY8uMuG/IAR3FgwTbZ1dtoW +RvOTa8hYiU6A475WuZKyEHcwnGYe57u2I2KbMgcKjPniocj4QzgYsVAVKW3IwaOh +yE+vPxsiUkvQHdO2fojCkY8jg70jxM+gu59tPDNbw3Uh/2Ij310FgTHsnGQMyA== +-----END CERTIFICATE-----` + + // First, create the set of root certificates. For this example we only + // have one. It's also possible to omit this in order to use the + // default root set of the current operating system. + roots := x509.NewCertPool() + ok := roots.AppendCertsFromPEM([]byte(rootPEM)) + if !ok { + panic("failed to parse root certificate") + } + + block, _ := pem.Decode([]byte(certPEM)) + if block == nil { + panic("failed to parse certificate PEM") + } + cert, err := x509.ParseCertificate(block.Bytes) + if err != nil { + panic("failed to parse certificate: " + err.Error()) + } + + opts := x509.VerifyOptions{ + DNSName: "mail.google.com", + Roots: roots, + } + + if _, err := cert.Verify(opts); err != nil { + panic("failed to verify certificate: " + err.Error()) + } +} + +func ExampleParsePKIXPublicKey() { + const pubPEM = ` +-----BEGIN PUBLIC KEY----- +MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAlRuRnThUjU8/prwYxbty +WPT9pURI3lbsKMiB6Fn/VHOKE13p4D8xgOCADpdRagdT6n4etr9atzDKUSvpMtR3 +CP5noNc97WiNCggBjVWhs7szEe8ugyqF23XwpHQ6uV1LKH50m92MbOWfCtjU9p/x +qhNpQQ1AZhqNy5Gevap5k8XzRmjSldNAFZMY7Yv3Gi+nyCwGwpVtBUwhuLzgNFK/ +yDtw2WcWmUU7NuC8Q6MWvPebxVtCfVp/iQU6q60yyt6aGOBkhAX0LpKAEhKidixY +nP9PNVBvxgu3XZ4P36gZV6+ummKdBVnc3NqwBLu5+CcdRdusmHPHd5pHf4/38Z3/ +6qU2a/fPvWzceVTEgZ47QjFMTCTmCwNt29cvi7zZeQzjtwQgn4ipN9NibRH/Ax/q +TbIzHfrJ1xa2RteWSdFjwtxi9C20HUkjXSeI4YlzQMH0fPX6KCE7aVePTOnB69I/ +a9/q96DiXZajwlpq3wFctrs1oXqBp5DVrCIj8hU2wNgB7LtQ1mCtsYz//heai0K9 +PhE4X6hiE0YmeAZjR0uHl8M/5aW9xCoJ72+12kKpWAa0SFRWLy6FejNYCYpkupVJ +yecLk/4L1W0l6jQQZnWErXZYe0PNFcmwGXy1Rep83kfBRNKRy5tvocalLlwXLdUk +AIU+2GKjyT3iMuzZxxFxPFMCAwEAAQ== +-----END PUBLIC KEY-----` + + block, _ := pem.Decode([]byte(pubPEM)) + if block == nil { + panic("failed to parse PEM block containing the public key") + } + + pub, err := x509.ParsePKIXPublicKey(block.Bytes) + if err != nil { + panic("failed to parse DER encoded public key: " + err.Error()) + } + + switch pub := pub.(type) { + case *rsa.PublicKey: + fmt.Println("pub is of type RSA:", pub) + case *dsa.PublicKey: + fmt.Println("pub is of type DSA:", pub) + case *ecdsa.PublicKey: + fmt.Println("pub is of type ECDSA:", pub) + case ed25519.PublicKey: + fmt.Println("pub is of type Ed25519:", pub) + default: + panic("unknown type of public key") + } +} diff --git a/go/src/crypto/x509/hybrid_pool_test.go b/go/src/crypto/x509/hybrid_pool_test.go new file mode 100644 index 0000000000000000000000000000000000000000..d591c2e76456f4c22f0f319780b7ff5dac738fa3 --- /dev/null +++ b/go/src/crypto/x509/hybrid_pool_test.go @@ -0,0 +1,123 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509_test + +import ( + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "crypto/tls" + "crypto/x509" + "crypto/x509/pkix" + "internal/testenv" + "math/big" + "runtime" + "testing" + "time" +) + +func TestHybridPool(t *testing.T) { + t.Parallel() + if !(runtime.GOOS == "windows" || runtime.GOOS == "darwin" || runtime.GOOS == "ios") { + t.Skipf("platform verifier not available on %s", runtime.GOOS) + } + if !testenv.HasExternalNetwork() { + t.Skip() + } + if runtime.GOOS == "windows" { + // NOTE(#51599): on the Windows builders we sometimes see that the state + // of the root pool is not fully initialized, causing an expected + // platform verification to fail. In part this is because Windows + // dynamically populates roots into its local trust store at time of + // use. We can attempt to prime the pool by attempting TLS connections + // to google.com until it works, suggesting the pool has been properly + // updated. If after we hit the deadline, the pool has _still_ not been + // populated with the expected root, it's unlikely we are ever going to + // get into a good state, and so we just fail the test. #52108 suggests + // a better possible long term solution. + + deadline := time.Now().Add(time.Second * 10) + nextSleep := 10 * time.Millisecond + for i := 0; ; i++ { + c, err := tls.Dial("tcp", "google.com:443", nil) + if err == nil { + c.Close() + break + } + nextSleep = nextSleep * time.Duration(i) + if time.Until(deadline) < nextSleep { + t.Fatal("windows root pool appears to be in an uninitialized state (missing root that chains to google.com)") + } + time.Sleep(nextSleep) + } + } + + // Get the google.com chain, which should be valid on all platforms we + // are testing + c, err := tls.Dial("tcp", "google.com:443", &tls.Config{InsecureSkipVerify: true}) + if err != nil { + t.Fatalf("tls connection failed: %s", err) + } + googChain := c.ConnectionState().PeerCertificates + + rootTmpl := &x509.Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{CommonName: "Go test root"}, + IsCA: true, + BasicConstraintsValid: true, + NotBefore: time.Now().Add(-time.Hour), + NotAfter: time.Now().Add(time.Hour * 10), + } + k, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatalf("failed to generate test key: %s", err) + } + rootDER, err := x509.CreateCertificate(rand.Reader, rootTmpl, rootTmpl, k.Public(), k) + if err != nil { + t.Fatalf("failed to create test cert: %s", err) + } + root, err := x509.ParseCertificate(rootDER) + if err != nil { + t.Fatalf("failed to parse test cert: %s", err) + } + + pool, err := x509.SystemCertPool() + if err != nil { + t.Fatalf("SystemCertPool failed: %s", err) + } + opts := x509.VerifyOptions{Roots: pool} + + _, err = googChain[0].Verify(opts) + if err != nil { + t.Fatalf("verification failed for google.com chain (system only pool): %s", err) + } + + pool.AddCert(root) + + _, err = googChain[0].Verify(opts) + if err != nil { + t.Fatalf("verification failed for google.com chain (hybrid pool): %s", err) + } + + certTmpl := &x509.Certificate{ + SerialNumber: big.NewInt(1), + NotBefore: time.Now().Add(-time.Hour), + NotAfter: time.Now().Add(time.Hour * 10), + DNSNames: []string{"example.com"}, + } + certDER, err := x509.CreateCertificate(rand.Reader, certTmpl, rootTmpl, k.Public(), k) + if err != nil { + t.Fatalf("failed to create test cert: %s", err) + } + cert, err := x509.ParseCertificate(certDER) + if err != nil { + t.Fatalf("failed to parse test cert: %s", err) + } + + _, err = cert.Verify(opts) + if err != nil { + t.Fatalf("verification failed for custom chain (hybrid pool): %s", err) + } +} diff --git a/go/src/crypto/x509/internal/macos/corefoundation.go b/go/src/crypto/x509/internal/macos/corefoundation.go new file mode 100644 index 0000000000000000000000000000000000000000..23fbe35c248dd90fd914325ad1d8390559e83e0d --- /dev/null +++ b/go/src/crypto/x509/internal/macos/corefoundation.go @@ -0,0 +1,219 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build darwin + +// Package macos provides cgo-less wrappers for Core Foundation and +// Security.framework, similarly to how package syscall provides access to +// libSystem.dylib. +package macos + +import ( + "bytes" + "errors" + "internal/abi" + "runtime" + "time" + "unsafe" +) + +// Core Foundation linker flags for the external linker. See Issue 42459. +// +//go:cgo_ldflag "-framework" +//go:cgo_ldflag "CoreFoundation" + +// CFRef is an opaque reference to a Core Foundation object. It is a pointer, +// but to memory not owned by Go, so not an unsafe.Pointer. +type CFRef uintptr + +// CFDataToSlice returns a copy of the contents of data as a bytes slice. +func CFDataToSlice(data CFRef) []byte { + length := CFDataGetLength(data) + ptr := CFDataGetBytePtr(data) + src := unsafe.Slice((*byte)(unsafe.Pointer(ptr)), length) + return bytes.Clone(src) +} + +// CFStringToString returns a Go string representation of the passed +// in CFString, or an empty string if it's invalid. +func CFStringToString(ref CFRef) string { + data, err := CFStringCreateExternalRepresentation(ref) + if err != nil { + return "" + } + b := CFDataToSlice(data) + CFRelease(data) + return string(b) +} + +// TimeToCFDateRef converts a time.Time into an apple CFDateRef. +func TimeToCFDateRef(t time.Time) CFRef { + secs := t.Sub(time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)).Seconds() + ref := CFDateCreate(secs) + return ref +} + +type CFString CFRef + +const kCFAllocatorDefault = 0 +const kCFStringEncodingUTF8 = 0x08000100 + +//go:cgo_import_dynamic x509_CFDataCreate CFDataCreate "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation" + +func BytesToCFData(b []byte) CFRef { + p := unsafe.Pointer(unsafe.SliceData(b)) + ret := syscall(abi.FuncPCABI0(x509_CFDataCreate_trampoline), kCFAllocatorDefault, uintptr(p), uintptr(len(b)), 0, 0, 0) + runtime.KeepAlive(p) + return CFRef(ret) +} +func x509_CFDataCreate_trampoline() + +//go:cgo_import_dynamic x509_CFStringCreateWithBytes CFStringCreateWithBytes "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation" + +// StringToCFString returns a copy of the UTF-8 contents of s as a new CFString. +func StringToCFString(s string) CFString { + p := unsafe.Pointer(unsafe.StringData(s)) + ret := syscall(abi.FuncPCABI0(x509_CFStringCreateWithBytes_trampoline), kCFAllocatorDefault, uintptr(p), + uintptr(len(s)), uintptr(kCFStringEncodingUTF8), 0 /* isExternalRepresentation */, 0) + runtime.KeepAlive(p) + return CFString(ret) +} +func x509_CFStringCreateWithBytes_trampoline() + +//go:cgo_import_dynamic x509_CFDictionaryGetValueIfPresent CFDictionaryGetValueIfPresent "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation" + +func CFDictionaryGetValueIfPresent(dict CFRef, key CFString) (value CFRef, ok bool) { + ret := syscall(abi.FuncPCABI0(x509_CFDictionaryGetValueIfPresent_trampoline), uintptr(dict), uintptr(key), + uintptr(unsafe.Pointer(&value)), 0, 0, 0) + if ret == 0 { + return 0, false + } + return value, true +} +func x509_CFDictionaryGetValueIfPresent_trampoline() + +const kCFNumberSInt32Type = 3 + +//go:cgo_import_dynamic x509_CFNumberGetValue CFNumberGetValue "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation" + +func CFNumberGetValue(num CFRef) (int32, error) { + var value int32 + ret := syscall(abi.FuncPCABI0(x509_CFNumberGetValue_trampoline), uintptr(num), uintptr(kCFNumberSInt32Type), + uintptr(unsafe.Pointer(&value)), 0, 0, 0) + if ret == 0 { + return 0, errors.New("CFNumberGetValue call failed") + } + return value, nil +} +func x509_CFNumberGetValue_trampoline() + +//go:cgo_import_dynamic x509_CFDataGetLength CFDataGetLength "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation" + +func CFDataGetLength(data CFRef) int { + ret := syscall(abi.FuncPCABI0(x509_CFDataGetLength_trampoline), uintptr(data), 0, 0, 0, 0, 0) + return int(ret) +} +func x509_CFDataGetLength_trampoline() + +//go:cgo_import_dynamic x509_CFDataGetBytePtr CFDataGetBytePtr "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation" + +func CFDataGetBytePtr(data CFRef) uintptr { + ret := syscall(abi.FuncPCABI0(x509_CFDataGetBytePtr_trampoline), uintptr(data), 0, 0, 0, 0, 0) + return ret +} +func x509_CFDataGetBytePtr_trampoline() + +//go:cgo_import_dynamic x509_CFArrayGetCount CFArrayGetCount "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation" + +func CFArrayGetCount(array CFRef) int { + ret := syscall(abi.FuncPCABI0(x509_CFArrayGetCount_trampoline), uintptr(array), 0, 0, 0, 0, 0) + return int(ret) +} +func x509_CFArrayGetCount_trampoline() + +//go:cgo_import_dynamic x509_CFArrayGetValueAtIndex CFArrayGetValueAtIndex "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation" + +func CFArrayGetValueAtIndex(array CFRef, index int) CFRef { + ret := syscall(abi.FuncPCABI0(x509_CFArrayGetValueAtIndex_trampoline), uintptr(array), uintptr(index), 0, 0, 0, 0) + return CFRef(ret) +} +func x509_CFArrayGetValueAtIndex_trampoline() + +//go:cgo_import_dynamic x509_CFEqual CFEqual "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation" + +func CFEqual(a, b CFRef) bool { + ret := syscall(abi.FuncPCABI0(x509_CFEqual_trampoline), uintptr(a), uintptr(b), 0, 0, 0, 0) + return ret == 1 +} +func x509_CFEqual_trampoline() + +//go:cgo_import_dynamic x509_CFRelease CFRelease "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation" + +func CFRelease(ref CFRef) { + syscall(abi.FuncPCABI0(x509_CFRelease_trampoline), uintptr(ref), 0, 0, 0, 0, 0) +} +func x509_CFRelease_trampoline() + +//go:cgo_import_dynamic x509_CFArrayCreateMutable CFArrayCreateMutable "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation" + +func CFArrayCreateMutable() CFRef { + ret := syscall(abi.FuncPCABI0(x509_CFArrayCreateMutable_trampoline), kCFAllocatorDefault, 0, 0 /* kCFTypeArrayCallBacks */, 0, 0, 0) + return CFRef(ret) +} +func x509_CFArrayCreateMutable_trampoline() + +//go:cgo_import_dynamic x509_CFArrayAppendValue CFArrayAppendValue "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation" + +func CFArrayAppendValue(array CFRef, val CFRef) { + syscall(abi.FuncPCABI0(x509_CFArrayAppendValue_trampoline), uintptr(array), uintptr(val), 0, 0, 0, 0) +} +func x509_CFArrayAppendValue_trampoline() + +//go:cgo_import_dynamic x509_CFDateCreate CFDateCreate "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation" + +func CFDateCreate(seconds float64) CFRef { + ret := syscall(abi.FuncPCABI0(x509_CFDateCreate_trampoline), kCFAllocatorDefault, 0, 0, 0, 0, seconds) + return CFRef(ret) +} +func x509_CFDateCreate_trampoline() + +//go:cgo_import_dynamic x509_CFErrorCopyDescription CFErrorCopyDescription "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation" + +func CFErrorCopyDescription(errRef CFRef) CFRef { + ret := syscall(abi.FuncPCABI0(x509_CFErrorCopyDescription_trampoline), uintptr(errRef), 0, 0, 0, 0, 0) + return CFRef(ret) +} +func x509_CFErrorCopyDescription_trampoline() + +//go:cgo_import_dynamic x509_CFErrorGetCode CFErrorGetCode "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation" + +func CFErrorGetCode(errRef CFRef) int { + return int(syscall(abi.FuncPCABI0(x509_CFErrorGetCode_trampoline), uintptr(errRef), 0, 0, 0, 0, 0)) +} +func x509_CFErrorGetCode_trampoline() + +//go:cgo_import_dynamic x509_CFStringCreateExternalRepresentation CFStringCreateExternalRepresentation "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation" + +func CFStringCreateExternalRepresentation(strRef CFRef) (CFRef, error) { + ret := syscall(abi.FuncPCABI0(x509_CFStringCreateExternalRepresentation_trampoline), kCFAllocatorDefault, uintptr(strRef), kCFStringEncodingUTF8, 0, 0, 0) + if ret == 0 { + return 0, errors.New("string can't be represented as UTF-8") + } + return CFRef(ret), nil +} +func x509_CFStringCreateExternalRepresentation_trampoline() + +// syscall is implemented in the runtime package (runtime/sys_darwin.go) +func syscall(fn, a1, a2, a3, a4, a5 uintptr, f1 float64) uintptr + +// ReleaseCFArray iterates through an array, releasing its contents, and then +// releases the array itself. This is necessary because we cannot, easily, set the +// CFArrayCallBacks argument when creating CFArrays. +func ReleaseCFArray(array CFRef) { + for i := 0; i < CFArrayGetCount(array); i++ { + ref := CFArrayGetValueAtIndex(array, i) + CFRelease(ref) + } + CFRelease(array) +} diff --git a/go/src/crypto/x509/internal/macos/corefoundation.s b/go/src/crypto/x509/internal/macos/corefoundation.s new file mode 100644 index 0000000000000000000000000000000000000000..49cd084467b2c396e22cb2a06c983c6966dc8d7c --- /dev/null +++ b/go/src/crypto/x509/internal/macos/corefoundation.s @@ -0,0 +1,43 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build darwin + +#include "textflag.h" + +// The trampolines are ABIInternal as they are address-taken in +// Go code. + +TEXT ·x509_CFArrayGetCount_trampoline(SB),NOSPLIT,$0-0 + JMP x509_CFArrayGetCount(SB) +TEXT ·x509_CFArrayGetValueAtIndex_trampoline(SB),NOSPLIT,$0-0 + JMP x509_CFArrayGetValueAtIndex(SB) +TEXT ·x509_CFDataGetBytePtr_trampoline(SB),NOSPLIT,$0-0 + JMP x509_CFDataGetBytePtr(SB) +TEXT ·x509_CFDataGetLength_trampoline(SB),NOSPLIT,$0-0 + JMP x509_CFDataGetLength(SB) +TEXT ·x509_CFStringCreateWithBytes_trampoline(SB),NOSPLIT,$0-0 + JMP x509_CFStringCreateWithBytes(SB) +TEXT ·x509_CFRelease_trampoline(SB),NOSPLIT,$0-0 + JMP x509_CFRelease(SB) +TEXT ·x509_CFDictionaryGetValueIfPresent_trampoline(SB),NOSPLIT,$0-0 + JMP x509_CFDictionaryGetValueIfPresent(SB) +TEXT ·x509_CFNumberGetValue_trampoline(SB),NOSPLIT,$0-0 + JMP x509_CFNumberGetValue(SB) +TEXT ·x509_CFEqual_trampoline(SB),NOSPLIT,$0-0 + JMP x509_CFEqual(SB) +TEXT ·x509_CFArrayCreateMutable_trampoline(SB),NOSPLIT,$0-0 + JMP x509_CFArrayCreateMutable(SB) +TEXT ·x509_CFArrayAppendValue_trampoline(SB),NOSPLIT,$0-0 + JMP x509_CFArrayAppendValue(SB) +TEXT ·x509_CFDateCreate_trampoline(SB),NOSPLIT,$0-0 + JMP x509_CFDateCreate(SB) +TEXT ·x509_CFDataCreate_trampoline(SB),NOSPLIT,$0-0 + JMP x509_CFDataCreate(SB) +TEXT ·x509_CFErrorCopyDescription_trampoline(SB),NOSPLIT,$0-0 + JMP x509_CFErrorCopyDescription(SB) +TEXT ·x509_CFErrorGetCode_trampoline(SB),NOSPLIT,$0-0 + JMP x509_CFErrorGetCode(SB) +TEXT ·x509_CFStringCreateExternalRepresentation_trampoline(SB),NOSPLIT,$0-0 + JMP x509_CFStringCreateExternalRepresentation(SB) diff --git a/go/src/crypto/x509/internal/macos/security.go b/go/src/crypto/x509/internal/macos/security.go new file mode 100644 index 0000000000000000000000000000000000000000..6af19bafe59ce934673129796bb4b781acc98081 --- /dev/null +++ b/go/src/crypto/x509/internal/macos/security.go @@ -0,0 +1,147 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build darwin + +package macos + +import ( + "errors" + "internal/abi" + "strconv" + "unsafe" +) + +// Security.framework linker flags for the external linker. See Issue 42459. +// +//go:cgo_ldflag "-framework" +//go:cgo_ldflag "Security" + +// Based on https://opensource.apple.com/source/Security/Security-59306.41.2/base/Security.h + +const ( + // various macOS error codes that can be returned from + // SecTrustEvaluateWithError that we can map to Go cert + // verification error types. + ErrSecCertificateExpired = -67818 + ErrSecHostNameMismatch = -67602 + ErrSecNotTrusted = -67843 +) + +type OSStatus struct { + call string + status int32 +} + +func (s OSStatus) Error() string { + return s.call + " error: " + strconv.Itoa(int(s.status)) +} + +//go:cgo_import_dynamic x509_SecTrustCreateWithCertificates SecTrustCreateWithCertificates "/System/Library/Frameworks/Security.framework/Versions/A/Security" + +func SecTrustCreateWithCertificates(certs CFRef, policies CFRef) (CFRef, error) { + var trustObj CFRef + ret := syscall(abi.FuncPCABI0(x509_SecTrustCreateWithCertificates_trampoline), uintptr(certs), uintptr(policies), + uintptr(unsafe.Pointer(&trustObj)), 0, 0, 0) + if int32(ret) != 0 { + return 0, OSStatus{"SecTrustCreateWithCertificates", int32(ret)} + } + return trustObj, nil +} +func x509_SecTrustCreateWithCertificates_trampoline() + +//go:cgo_import_dynamic x509_SecCertificateCreateWithData SecCertificateCreateWithData "/System/Library/Frameworks/Security.framework/Versions/A/Security" + +func SecCertificateCreateWithData(b []byte) (CFRef, error) { + data := BytesToCFData(b) + defer CFRelease(data) + ret := syscall(abi.FuncPCABI0(x509_SecCertificateCreateWithData_trampoline), kCFAllocatorDefault, uintptr(data), 0, 0, 0, 0) + // Returns NULL if the data passed in the data parameter is not a valid + // DER-encoded X.509 certificate. + if ret == 0 { + return 0, errors.New("SecCertificateCreateWithData: invalid certificate") + } + return CFRef(ret), nil +} +func x509_SecCertificateCreateWithData_trampoline() + +//go:cgo_import_dynamic x509_SecPolicyCreateSSL SecPolicyCreateSSL "/System/Library/Frameworks/Security.framework/Versions/A/Security" + +func SecPolicyCreateSSL(name string) (CFRef, error) { + var hostname CFString + if name != "" { + hostname = StringToCFString(name) + defer CFRelease(CFRef(hostname)) + } + ret := syscall(abi.FuncPCABI0(x509_SecPolicyCreateSSL_trampoline), 1 /* true */, uintptr(hostname), 0, 0, 0, 0) + if ret == 0 { + return 0, OSStatus{"SecPolicyCreateSSL", int32(ret)} + } + return CFRef(ret), nil +} +func x509_SecPolicyCreateSSL_trampoline() + +//go:cgo_import_dynamic x509_SecTrustSetVerifyDate SecTrustSetVerifyDate "/System/Library/Frameworks/Security.framework/Versions/A/Security" + +func SecTrustSetVerifyDate(trustObj CFRef, dateRef CFRef) error { + ret := syscall(abi.FuncPCABI0(x509_SecTrustSetVerifyDate_trampoline), uintptr(trustObj), uintptr(dateRef), 0, 0, 0, 0) + if int32(ret) != 0 { + return OSStatus{"SecTrustSetVerifyDate", int32(ret)} + } + return nil +} +func x509_SecTrustSetVerifyDate_trampoline() + +//go:cgo_import_dynamic x509_SecTrustEvaluate SecTrustEvaluate "/System/Library/Frameworks/Security.framework/Versions/A/Security" + +func SecTrustEvaluate(trustObj CFRef) (CFRef, error) { + var result CFRef + ret := syscall(abi.FuncPCABI0(x509_SecTrustEvaluate_trampoline), uintptr(trustObj), uintptr(unsafe.Pointer(&result)), 0, 0, 0, 0) + if int32(ret) != 0 { + return 0, OSStatus{"SecTrustEvaluate", int32(ret)} + } + return CFRef(result), nil +} +func x509_SecTrustEvaluate_trampoline() + +//go:cgo_import_dynamic x509_SecTrustEvaluateWithError SecTrustEvaluateWithError "/System/Library/Frameworks/Security.framework/Versions/A/Security" + +func SecTrustEvaluateWithError(trustObj CFRef) (int, error) { + var errRef CFRef + ret := syscall(abi.FuncPCABI0(x509_SecTrustEvaluateWithError_trampoline), uintptr(trustObj), uintptr(unsafe.Pointer(&errRef)), 0, 0, 0, 0) + if int32(ret) != 1 { + errStr := CFErrorCopyDescription(errRef) + err := errors.New(CFStringToString(errStr)) + errCode := CFErrorGetCode(errRef) + CFRelease(errRef) + CFRelease(errStr) + return errCode, err + } + return 0, nil +} +func x509_SecTrustEvaluateWithError_trampoline() + +//go:cgo_import_dynamic x509_SecCertificateCopyData SecCertificateCopyData "/System/Library/Frameworks/Security.framework/Versions/A/Security" + +func SecCertificateCopyData(cert CFRef) ([]byte, error) { + ret := syscall(abi.FuncPCABI0(x509_SecCertificateCopyData_trampoline), uintptr(cert), 0, 0, 0, 0, 0) + if ret == 0 { + return nil, errors.New("x509: invalid certificate object") + } + b := CFDataToSlice(CFRef(ret)) + CFRelease(CFRef(ret)) + return b, nil +} +func x509_SecCertificateCopyData_trampoline() + +//go:cgo_import_dynamic x509_SecTrustCopyCertificateChain SecTrustCopyCertificateChain "/System/Library/Frameworks/Security.framework/Versions/A/Security" + +func SecTrustCopyCertificateChain(trustObj CFRef) (CFRef, error) { + ret := syscall(abi.FuncPCABI0(x509_SecTrustCopyCertificateChain_trampoline), uintptr(trustObj), 0, 0, 0, 0, 0) + if ret == 0 { + return 0, OSStatus{"SecTrustCopyCertificateChain", int32(ret)} + } + return CFRef(ret), nil +} +func x509_SecTrustCopyCertificateChain_trampoline() diff --git a/go/src/crypto/x509/internal/macos/security.s b/go/src/crypto/x509/internal/macos/security.s new file mode 100644 index 0000000000000000000000000000000000000000..ca5337c788d67310f9baa12144beb11de2647cfa --- /dev/null +++ b/go/src/crypto/x509/internal/macos/security.s @@ -0,0 +1,27 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build darwin + +#include "textflag.h" + +// The trampolines are ABIInternal as they are address-taken in +// Go code. + +TEXT ·x509_SecTrustCreateWithCertificates_trampoline(SB),NOSPLIT,$0-0 + JMP x509_SecTrustCreateWithCertificates(SB) +TEXT ·x509_SecCertificateCreateWithData_trampoline(SB),NOSPLIT,$0-0 + JMP x509_SecCertificateCreateWithData(SB) +TEXT ·x509_SecPolicyCreateSSL_trampoline(SB),NOSPLIT,$0-0 + JMP x509_SecPolicyCreateSSL(SB) +TEXT ·x509_SecTrustSetVerifyDate_trampoline(SB),NOSPLIT,$0-0 + JMP x509_SecTrustSetVerifyDate(SB) +TEXT ·x509_SecTrustEvaluate_trampoline(SB),NOSPLIT,$0-0 + JMP x509_SecTrustEvaluate(SB) +TEXT ·x509_SecTrustEvaluateWithError_trampoline(SB),NOSPLIT,$0-0 + JMP x509_SecTrustEvaluateWithError(SB) +TEXT ·x509_SecCertificateCopyData_trampoline(SB),NOSPLIT,$0-0 + JMP x509_SecCertificateCopyData(SB) +TEXT ·x509_SecTrustCopyCertificateChain_trampoline(SB),NOSPLIT,$0-0 + JMP x509_SecTrustCopyCertificateChain(SB) diff --git a/go/src/crypto/x509/name_constraints_test.go b/go/src/crypto/x509/name_constraints_test.go new file mode 100644 index 0000000000000000000000000000000000000000..97a2420a7f2e7bf71932aa77d34bc2d85604a59f --- /dev/null +++ b/go/src/crypto/x509/name_constraints_test.go @@ -0,0 +1,2246 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "bytes" + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "crypto/x509/pkix" + "encoding/asn1" + "encoding/hex" + "encoding/pem" + "fmt" + "internal/testenv" + "math/big" + "net" + "net/url" + "os" + "os/exec" + "strconv" + "strings" + "sync" + "testing" + "time" +) + +const ( + // testNameConstraintsAgainstOpenSSL can be set to true to run tests + // against the system OpenSSL. This is disabled by default because Go + // cannot depend on having OpenSSL installed at testing time. + testNameConstraintsAgainstOpenSSL = false + + // debugOpenSSLFailure can be set to true, when + // testNameConstraintsAgainstOpenSSL is also true, to cause + // intermediate files to be preserved for debugging. + debugOpenSSLFailure = false +) + +type nameConstraintsTest struct { + name string + roots []constraintsSpec + intermediates [][]constraintsSpec + leaf leafSpec + requestedEKUs []ExtKeyUsage + expectedError string + noOpenSSL bool + ignoreCN bool +} + +type constraintsSpec struct { + ok []string + bad []string + ekus []string +} + +type leafSpec struct { + sans []string + ekus []string + cn string +} + +var nameConstraintsTests = []nameConstraintsTest{ + { + name: "certificate generation process", + roots: make([]constraintsSpec, 1), + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + }, + }, + { + name: "single level of intermediate", + roots: make([]constraintsSpec, 1), + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + }, + }, + { + name: "two levels of intermediates", + roots: make([]constraintsSpec, 1), + intermediates: [][]constraintsSpec{ + { + {}, + }, + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + }, + }, + { + name: "matching DNS constraint in root", + roots: []constraintsSpec{ + { + ok: []string{"dns:example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + }, + }, + { + name: "matching DNS constraint in intermediate", + roots: make([]constraintsSpec, 1), + intermediates: [][]constraintsSpec{ + { + { + ok: []string{"dns:example.com"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + }, + }, + { + name: "leading period only matches subdomains", + roots: []constraintsSpec{ + { + ok: []string{"dns:.example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + }, + expectedError: "\"example.com\" is not permitted", + }, + { + name: "leading period matches subdomains", + roots: make([]constraintsSpec, 1), + intermediates: [][]constraintsSpec{ + { + { + ok: []string{"dns:.example.com"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:foo.example.com"}, + }, + }, + { + name: "leading period matches multiple levels of subdomains", + roots: []constraintsSpec{ + { + ok: []string{"dns:.example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:foo.bar.example.com"}, + }, + }, + { + name: "specifying a permitted list of names does not exclude other name types", + roots: []constraintsSpec{ + { + ok: []string{"dns:.example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"ip:10.1.1.1"}, + }, + }, + { + name: "specifying a permitted list of names does not exclude other name types", + roots: []constraintsSpec{ + { + ok: []string{"ip:10.0.0.0/8"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + }, + }, + { + name: "intermediates can try to permit other names, which isn't forbidden if the leaf doesn't mention them", + roots: []constraintsSpec{ + { + ok: []string{"dns:example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + { + ok: []string{"dns:example.com", "dns:foo.com"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + }, + }, + { + name: "intermediates cannot add permitted names that the root doesn't grant them", + roots: []constraintsSpec{ + { + ok: []string{"dns:example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + { + ok: []string{"dns:foo.example.com", "dns:foo.com"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:foo.com"}, + }, + expectedError: "\"foo.com\" is not permitted", + }, + { + name: "intermediates can further limit their scope if they wish", + roots: []constraintsSpec{ + { + ok: []string{"dns:.example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + { + ok: []string{"dns:.bar.example.com"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:foo.bar.example.com"}, + }, + }, + { + name: "intermediates can further limit their scope and that limitation is effective", + roots: []constraintsSpec{ + { + ok: []string{"dns:.example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + { + ok: []string{"dns:.bar.example.com"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:foo.notbar.example.com"}, + }, + expectedError: "\"foo.notbar.example.com\" is not permitted", + }, + { + name: "roots can exclude subtrees and that doesn't affect other names", + roots: []constraintsSpec{ + { + bad: []string{"dns:.example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:foo.com"}, + }, + }, + { + name: "roots exclusions are effective", + roots: []constraintsSpec{ + { + bad: []string{"dns:.example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:foo.example.com"}, + }, + expectedError: "\"foo.example.com\" is excluded", + }, + { + name: "intermediates can also exclude names and that doesn't affect other names", + roots: make([]constraintsSpec, 1), + intermediates: [][]constraintsSpec{ + { + { + bad: []string{"dns:.example.com"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:foo.com"}, + }, + }, + { + name: "intermediate exclusions are effective", + roots: make([]constraintsSpec, 1), + intermediates: [][]constraintsSpec{ + { + { + bad: []string{"dns:.example.com"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:foo.example.com"}, + }, + expectedError: "\"foo.example.com\" is excluded", + }, + { + name: "having an exclusion doesn't prohibit other types of names", + roots: []constraintsSpec{ + { + bad: []string{"dns:.example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:foo.com", "ip:10.1.1.1"}, + }, + }, + { + name: "IP-based exclusions are permitted and don't affect unrelated IP addresses", + roots: []constraintsSpec{ + { + bad: []string{"ip:10.0.0.0/8"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"ip:192.168.1.1"}, + }, + }, + { + name: "IP-based exclusions are effective", + roots: []constraintsSpec{ + { + bad: []string{"ip:10.0.0.0/8"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"ip:10.0.0.1"}, + }, + expectedError: "\"10.0.0.1\" is excluded", + }, + { + name: "intermediates can further constrain IP ranges", + roots: []constraintsSpec{ + { + bad: []string{"ip:0.0.0.0/1"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + { + bad: []string{"ip:11.0.0.0/8"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"ip:11.0.0.1"}, + }, + expectedError: "\"11.0.0.1\" is excluded", + }, + { + name: "multiple intermediates with incompatible constraints", + roots: make([]constraintsSpec, 1), + intermediates: [][]constraintsSpec{ + { + { + ok: []string{"dns:.foo.com"}, + }, + { + ok: []string{"dns:.example.com"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:foo.example.com"}, + }, + noOpenSSL: true, // OpenSSL's chain building is not informed by constraints. + }, + { + name: "multiple intermediates with incompatible constraints swapped", + roots: make([]constraintsSpec, 1), + intermediates: [][]constraintsSpec{ + { + { + ok: []string{"dns:.example.com"}, + }, + { + ok: []string{"dns:.foo.com"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:foo.example.com"}, + }, + noOpenSSL: true, // OpenSSL's chain building is not informed by constraints. + }, + { + name: "multiple roots with incompatible constraints", + roots: []constraintsSpec{ + {}, + { + ok: []string{"dns:foo.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + }, + noOpenSSL: true, // OpenSSL's chain building is not informed by constraints. + }, + { + name: "multiple roots with incompatible constraints swapped", + roots: []constraintsSpec{ + { + ok: []string{"dns:foo.com"}, + }, + {}, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + }, + noOpenSSL: true, // OpenSSL's chain building is not informed by constraints. + }, + { + name: "chain building with multiple intermediates and roots", + roots: []constraintsSpec{ + { + ok: []string{"dns:foo.com"}, + }, + { + ok: []string{"dns:example.com"}, + }, + {}, + }, + intermediates: [][]constraintsSpec{ + { + {}, + { + ok: []string{"dns:foo.com"}, + }, + }, + { + {}, + { + ok: []string{"dns:foo.com"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:bar.com"}, + }, + noOpenSSL: true, // OpenSSL's chain building is not informed by constraints. + }, + { + name: "chain building fails with no valid path", + roots: []constraintsSpec{ + { + ok: []string{"dns:foo.com"}, + }, + { + ok: []string{"dns:example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + { + ok: []string{"dns:foo.com"}, + }, + }, + { + { + ok: []string{"dns:bar.com"}, + }, + { + ok: []string{"dns:foo.com"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:bar.com"}, + }, + expectedError: "\"bar.com\" is not permitted", + }, + { + name: "unknown name types are unconstrained", + roots: make([]constraintsSpec, 1), + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"unknown:"}, + }, + }, + { + name: "unknown name types allowed in constrained chain", + roots: []constraintsSpec{ + { + ok: []string{"dns:foo.com", "dns:.foo.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"unknown:"}, + }, + }, + { + name: "CN is ignored in constrained chain", + roots: []constraintsSpec{ + { + ok: []string{"dns:foo.com", "dns:.foo.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{}, + cn: "foo.com", + }, + }, + { + name: "IPv6 permitted constraint", + roots: []constraintsSpec{ + { + ok: []string{"ip:2000:abcd::/32"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"ip:2000:abcd:1234::"}, + }, + }, + { + name: "IPv6 permitted constraint is effective", + roots: []constraintsSpec{ + { + ok: []string{"ip:2000:abcd::/32"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"ip:2000:1234:abcd::"}, + }, + expectedError: "\"2000:1234:abcd::\" is not permitted", + }, + { + name: "IPv6 permitted constraint does not affect DNS", + roots: []constraintsSpec{ + { + ok: []string{"ip:2000:abcd::/32"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"ip:2000:abcd::", "dns:foo.com"}, + }, + }, + { + name: "IPv6 excluded constraint", + roots: []constraintsSpec{ + { + bad: []string{"ip:2000:abcd::/32"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"ip:2000:1234::"}, + }, + }, + { + name: "IPv6 excluded constraint is effective", + roots: []constraintsSpec{ + { + bad: []string{"ip:2000:abcd::/32"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"ip:2000:abcd::"}, + }, + expectedError: "\"2000:abcd::\" is excluded", + }, + { + name: "IPv6 constraint does not permit IPv4", + roots: []constraintsSpec{ + { + ok: []string{"ip:2000:abcd::/32"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"ip:10.0.0.1"}, + }, + expectedError: "\"10.0.0.1\" is not permitted", + }, + { + name: "IPv4 constraint does not permit IPv6", + roots: []constraintsSpec{ + { + ok: []string{"ip:10.0.0.0/8"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"ip:2000:abcd::"}, + }, + expectedError: "\"2000:abcd::\" is not permitted", + }, + { + name: "unknown excluded constraint does not affect other names", + roots: []constraintsSpec{ + { + bad: []string{"unknown:"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + }, + }, + { + name: "unknown permitted constraint does not affect other names", + roots: []constraintsSpec{ + { + ok: []string{"unknown:"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + }, + }, + { + name: "exact email constraint", + roots: []constraintsSpec{ + { + ok: []string{"email:foo@example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"email:foo@example.com"}, + }, + }, + { + name: "exact email constraint is effective", + roots: []constraintsSpec{ + { + ok: []string{"email:foo@example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"email:bar@example.com"}, + }, + expectedError: "\"bar@example.com\" is not permitted", + }, + { + name: "email canonicalization", + roots: []constraintsSpec{ + { + ok: []string{"email:foo@example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"email:\"\\f\\o\\o\"@example.com"}, + }, + noOpenSSL: true, // OpenSSL doesn't canonicalise email addresses before matching + }, + { + name: "email host constraint", + roots: []constraintsSpec{ + { + ok: []string{"email:example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"email:foo@example.com"}, + }, + }, + { + name: "email subdomain constraint", + roots: []constraintsSpec{ + { + ok: []string{"email:.example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"email:foo@sub.example.com"}, + }, + }, + { + name: "email subdomain constraint does not match parent", + roots: []constraintsSpec{ + { + ok: []string{"email:.example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"email:foo@example.com"}, + }, + expectedError: "\"foo@example.com\" is not permitted", + }, + { + name: "email subdomain constraint matches deeper subdomains", + roots: []constraintsSpec{ + { + ok: []string{"email:.example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"email:foo@sub.sub.example.com"}, + }, + }, + { + name: "email local part is case-sensitive", + roots: []constraintsSpec{ + { + ok: []string{"email:foo@example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"email:Foo@example.com"}, + }, + expectedError: "\"Foo@example.com\" is not permitted", + }, + { + name: "email domain part is case-insensitive", + roots: []constraintsSpec{ + { + ok: []string{"email:foo@EXAMPLE.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"email:foo@example.com"}, + }, + }, + { + name: "DNS domain is case-insensitive", + roots: []constraintsSpec{ + { + ok: []string{"dns:EXAMPLE.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + }, + }, + { + name: "URI constraint covers host", + roots: []constraintsSpec{ + { + ok: []string{"uri:example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{ + "uri:http://example.com/bar", + "uri:http://example.com:8080/", + "uri:https://example.com/wibble#bar", + }, + }, + }, + { + name: "URI with IP is rejected", + roots: []constraintsSpec{ + { + ok: []string{"uri:example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"uri:http://1.2.3.4/"}, + }, + expectedError: "URI with IP", + }, + { + name: "URI with IP and port is rejected", + roots: []constraintsSpec{ + { + ok: []string{"uri:example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"uri:http://1.2.3.4:43/"}, + }, + expectedError: "URI with IP", + }, + { + name: "URI with IPv6 is rejected", + roots: []constraintsSpec{ + { + ok: []string{"uri:example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"uri:http://[2006:abcd::1]/"}, + }, + expectedError: "URI with IP", + }, + { + name: "URI with IPv6 and port is rejected", + roots: []constraintsSpec{ + { + ok: []string{"uri:example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"uri:http://[2006:abcd::1]:16/"}, + }, + expectedError: "URI with IP", + }, + { + name: "URI permitted constraint is effective", + roots: []constraintsSpec{ + { + ok: []string{"uri:example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"uri:http://bar.com/"}, + }, + expectedError: "\"http://bar.com/\" is not permitted", + }, + { + name: "URI excluded constraint is effective", + roots: []constraintsSpec{ + { + bad: []string{"uri:foo.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"uri:http://foo.com/"}, + }, + expectedError: "\"http://foo.com/\" is excluded", + }, + { + name: "URI subdomain constraint", + roots: []constraintsSpec{ + { + ok: []string{"uri:.foo.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"uri:http://www.foo.com/"}, + }, + }, + { + name: "IPv4-mapped-IPv6 exclusion does not affect IPv4", + roots: []constraintsSpec{ + { + bad: []string{"ip:::ffff:1.2.3.4/128"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"ip:1.2.3.4"}, + }, + }, + { + name: "URI constraint not matched by URN", + roots: []constraintsSpec{ + { + ok: []string{"uri:example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"uri:urn:example"}, + }, + expectedError: "URI with empty host", + }, + { + name: "IPv6 exclusion does not exclude all IPv4", + roots: []constraintsSpec{ + { + ok: []string{"ip:1.2.3.0/24"}, + bad: []string{"ip:::0/0"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"ip:1.2.3.4"}, + }, + }, + { + name: "empty EKU in CA means any is ok", + roots: make([]constraintsSpec, 1), + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + ekus: []string{"serverAuth", "other"}, + }, + }, + { + name: "any EKU means any is ok", + roots: make([]constraintsSpec, 1), + intermediates: [][]constraintsSpec{ + { + { + ekus: []string{"any"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + ekus: []string{"serverAuth", "other"}, + }, + }, + // default.) + { + name: "intermediate with enumerated EKUs", + roots: make([]constraintsSpec, 1), + intermediates: [][]constraintsSpec{ + { + { + ekus: []string{"email"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + ekus: []string{"serverAuth"}, + }, + expectedError: "incompatible key usage", + }, + { + name: "unknown EKU in leaf", + roots: make([]constraintsSpec, 1), + intermediates: [][]constraintsSpec{ + { + { + ekus: []string{"email"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + ekus: []string{"other"}, + }, + requestedEKUs: []ExtKeyUsage{ExtKeyUsageAny}, + }, + // certificate doesn't use them. + { + name: "intermediate cannot add EKUs not in root if leaf uses them", + roots: []constraintsSpec{ + { + ekus: []string{"serverAuth"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + { + ekus: []string{"serverAuth", "email"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + ekus: []string{"serverAuth"}, + }, + }, + { + name: "EKUs in root are effective", + roots: []constraintsSpec{ + { + ekus: []string{"email"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + { + ekus: []string{"serverAuth"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + ekus: []string{"serverAuth"}, + }, + expectedError: "incompatible key usage", + }, + { + name: "netscapeSGC EKU does not permit server/client auth", + roots: []constraintsSpec{ + {}, + }, + intermediates: [][]constraintsSpec{ + { + { + ekus: []string{"netscapeSGC"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + ekus: []string{"serverAuth", "clientAuth"}, + }, + expectedError: "incompatible key usage", + }, + { + name: "msSGC EKU does not permit server/client auth", + roots: make([]constraintsSpec, 1), + intermediates: [][]constraintsSpec{ + { + { + ekus: []string{"msSGC"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + ekus: []string{"serverAuth", "clientAuth"}, + }, + expectedError: "incompatible key usage", + }, + { + name: "empty DNS permitted constraint allows anything", + roots: []constraintsSpec{ + { + ok: []string{"dns:"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + }, + }, + { + name: "empty DNS excluded constraint rejects everything", + roots: []constraintsSpec{ + { + bad: []string{"dns:"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + }, + expectedError: "\"example.com\" is excluded", + }, + { + name: "empty email permitted constraint allows anything", + roots: []constraintsSpec{ + { + ok: []string{"email:"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"email:foo@example.com"}, + }, + }, + { + name: "empty email excluded constraint rejects everything", + roots: []constraintsSpec{ + { + bad: []string{"email:"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"email:foo@example.com"}, + }, + expectedError: "\"foo@example.com\" is excluded", + }, + { + name: "empty URI permitted constraint allows anything", + roots: []constraintsSpec{ + { + ok: []string{"uri:"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"uri:https://example.com/test"}, + }, + }, + { + name: "empty URI excluded constraint rejects everything", + roots: []constraintsSpec{ + { + bad: []string{"uri:"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"uri:https://example.com/test"}, + }, + expectedError: "\"https://example.com/test\" is excluded", + }, + { + name: "serverAuth EKU does not permit clientAuth", + roots: make([]constraintsSpec, 1), + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + ekus: []string{"serverAuth"}, + }, + requestedEKUs: []ExtKeyUsage{ExtKeyUsageClientAuth}, + expectedError: "incompatible key usage", + }, + { + name: "msSGC EKU does not permit serverAuth", + roots: make([]constraintsSpec, 1), + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + ekus: []string{"msSGC"}, + }, + requestedEKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}, + expectedError: "incompatible key usage", + }, + { + // An invalid DNS SAN should be detected only at validation time so + // that we can process CA certificates in the wild that have invalid SANs. + // See https://github.com/golang/go/issues/23995 + name: "invalid SANs are ignored with no constraints", + roots: make([]constraintsSpec, 1), + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:this is invalid", "email:this @ is invalid"}, + }, + }, + { + name: "invalid DNS SAN detected with constraints", + roots: []constraintsSpec{ + { + bad: []string{"uri:"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:this is invalid"}, + }, + expectedError: "cannot parse dnsName", + }, + { + name: "invalid email SAN detected with constraints", + roots: []constraintsSpec{ + { + bad: []string{"uri:"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"email:this @ is invalid"}, + }, + expectedError: "cannot parse rfc822Name", + }, + { + name: "any requested EKU is sufficient", + roots: make([]constraintsSpec, 1), + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + ekus: []string{"email"}, + }, + requestedEKUs: []ExtKeyUsage{ExtKeyUsageClientAuth, ExtKeyUsageEmailProtection}, + }, + { + name: "unrequested EKUs not required to be nested", + roots: make([]constraintsSpec, 1), + intermediates: [][]constraintsSpec{ + { + { + ekus: []string{"serverAuth"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:example.com"}, + // There's no email EKU in the intermediate. This would be rejected if + // full nesting was required. + ekus: []string{"email", "serverAuth"}, + }, + }, + { + name: "empty leaf is accepted in constrained chain", + roots: []constraintsSpec{ + { + ok: []string{"dns:foo.com", "dns:.foo.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{}, + }, + }, + { + name: "no SANs and non-hostname CN is accepted in constrained chain", + roots: []constraintsSpec{ + { + ok: []string{"dns:foo.com", "dns:.foo.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{}, + cn: "foo.bar", + }, + }, + { + name: "constraints don't apply to CN", + roots: []constraintsSpec{ + { + ok: []string{"dns:foo.com", "dns:.foo.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:foo.com"}, + cn: "foo.bar", + }, + }, + { + name: "DNS SAN cannot use leading period form", + roots: []constraintsSpec{{ok: []string{"dns:example.com"}}}, + leaf: leafSpec{sans: []string{"dns:.example.com"}}, + expectedError: "cannot parse dnsName \".example.com\"", + }, + { + name: "URI with IPv6 and zone is rejected", + roots: []constraintsSpec{ + { + ok: []string{"uri:example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"uri:http://[2006:abcd::1%25.example.com]:16/"}, + }, + expectedError: "URI with IP", + }, + { + name: "intermediate can narrow permitted dns scope", + roots: []constraintsSpec{ + { + ok: []string{"dns:"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + { + ok: []string{"dns:example.com"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:test.com"}, + }, + expectedError: "\"test.com\" is not permitted", + }, + { + name: "intermediate cannot narrow excluded dns scope", + roots: []constraintsSpec{ + { + bad: []string{"dns:"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + { + bad: []string{"dns:example.com"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:test.com"}, + }, + expectedError: "\"test.com\" is excluded by constraint \"\"", + }, + { + name: "intermediate can narrow excluded dns scope", + roots: []constraintsSpec{ + { + bad: []string{"dns:example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + { + bad: []string{"dns:"}, + }, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:test.com"}, + }, + expectedError: "\"test.com\" is excluded by constraint \"\"", + }, + { + name: "permitted dns constraint is not a prefix match", + roots: []constraintsSpec{ + { + ok: []string{"dns:example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:testexample.com"}, + }, + expectedError: "\"testexample.com\" is not permitted", + }, + { + name: "subdomain constraint does not allow wildcard", + roots: []constraintsSpec{ + { + ok: []string{"dns:a.com", "dns:foo.example.com", "dns:z.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:*.example.com"}, + }, + expectedError: "\"*.example.com\" is not permitted", + }, + { + name: "excluded dns constraint is not a prefix match", + roots: []constraintsSpec{ + { + bad: []string{"dns:example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:testexample.com"}, + }, + }, + { + name: "excluded email constraint, multiple email with matching local portion", + roots: []constraintsSpec{ + { + bad: []string{"email:a@example.com", "email:a@test.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"email:a@example.com"}, + }, + expectedError: "\"a@example.com\" is excluded by constraint \"a@example.com\"", + }, + { + name: "email_case_check", + roots: []constraintsSpec{ + { + ok: []string{"email:a@example.com"}, + }, + }, + intermediates: [][]constraintsSpec{ + { + {}, + }, + }, + leaf: leafSpec{ + sans: []string{"email:a@ExAmple.com"}, + }, + }, + { + name: "excluded constraint, empty DNS san", + roots: []constraintsSpec{ + { + bad: []string{"dns:example.com"}, + }, + }, + leaf: leafSpec{ + sans: []string{"dns:"}, + }, + }, + { + name: "subdomain exclusion blocks uppercase wildcard", + roots: []constraintsSpec{{ + bad: []string{"dns:sub.example.com"}, + }}, + intermediates: [][]constraintsSpec{{{}}}, + leaf: leafSpec{ + sans: []string{"dns:*.EXAMPLE.COM"}, + }, + expectedError: "\"*.EXAMPLE.COM\" is excluded by constraint \"sub.example.com\"", + }, + { + name: "uppercase subdomain exclusion blocks lowercase wildcard", + roots: []constraintsSpec{{ + bad: []string{"dns:SUB.EXAMPLE.COM"}, + }}, + intermediates: [][]constraintsSpec{{{}}}, + leaf: leafSpec{ + sans: []string{"dns:*.example.com"}, + }, + expectedError: "\"*.example.com\" is excluded by constraint \"sub.example.com\"", + }, +} + +func makeConstraintsCACert(constraints constraintsSpec, name string, key *ecdsa.PrivateKey, parent *Certificate, parentKey *ecdsa.PrivateKey) (*Certificate, error) { + var serialBytes [16]byte + rand.Read(serialBytes[:]) + + template := &Certificate{ + SerialNumber: new(big.Int).SetBytes(serialBytes[:]), + Subject: pkix.Name{ + CommonName: name, + }, + NotBefore: time.Unix(1000, 0), + NotAfter: time.Unix(2000, 0), + KeyUsage: KeyUsageCertSign, + BasicConstraintsValid: true, + IsCA: true, + } + + if err := addConstraintsToTemplate(constraints, template); err != nil { + return nil, err + } + + if parent == nil { + parent = template + } + derBytes, err := CreateCertificate(rand.Reader, template, parent, &key.PublicKey, parentKey) + if err != nil { + return nil, err + } + + caCert, err := ParseCertificate(derBytes) + if err != nil { + return nil, err + } + + return caCert, nil +} + +func makeConstraintsLeafCert(leaf leafSpec, key *ecdsa.PrivateKey, parent *Certificate, parentKey *ecdsa.PrivateKey) (*Certificate, error) { + var serialBytes [16]byte + rand.Read(serialBytes[:]) + + template := &Certificate{ + SerialNumber: new(big.Int).SetBytes(serialBytes[:]), + Subject: pkix.Name{ + OrganizationalUnit: []string{"Leaf"}, + CommonName: leaf.cn, + }, + NotBefore: time.Unix(1000, 0), + NotAfter: time.Unix(2000, 0), + KeyUsage: KeyUsageDigitalSignature, + BasicConstraintsValid: true, + IsCA: false, + } + + for _, name := range leaf.sans { + switch { + case strings.HasPrefix(name, "dns:"): + template.DNSNames = append(template.DNSNames, name[4:]) + + case strings.HasPrefix(name, "ip:"): + ip := net.ParseIP(name[3:]) + if ip == nil { + return nil, fmt.Errorf("cannot parse IP %q", name[3:]) + } + template.IPAddresses = append(template.IPAddresses, ip) + + case strings.HasPrefix(name, "invalidip:"): + ipBytes, err := hex.DecodeString(name[10:]) + if err != nil { + return nil, fmt.Errorf("cannot parse invalid IP: %s", err) + } + template.IPAddresses = append(template.IPAddresses, net.IP(ipBytes)) + + case strings.HasPrefix(name, "email:"): + template.EmailAddresses = append(template.EmailAddresses, name[6:]) + + case strings.HasPrefix(name, "uri:"): + uri, err := url.Parse(name[4:]) + if err != nil { + return nil, fmt.Errorf("cannot parse URI %q: %s", name[4:], err) + } + template.URIs = append(template.URIs, uri) + + case strings.HasPrefix(name, "unknown:"): + // This is a special case for testing unknown + // name types. A custom SAN extension is + // injected into the certificate. + if len(leaf.sans) != 1 { + panic("when using unknown name types, it must be the sole name") + } + + template.ExtraExtensions = append(template.ExtraExtensions, pkix.Extension{ + Id: []int{2, 5, 29, 17}, + Value: []byte{ + 0x30, // SEQUENCE + 3, // three bytes + 9, // undefined GeneralName type 9 + 1, + 1, + }, + }) + + default: + return nil, fmt.Errorf("unknown name type %q", name) + } + } + + var err error + if template.ExtKeyUsage, template.UnknownExtKeyUsage, err = parseEKUs(leaf.ekus); err != nil { + return nil, err + } + + if parent == nil { + parent = template + } + + derBytes, err := CreateCertificate(rand.Reader, template, parent, &key.PublicKey, parentKey) + if err != nil { + return nil, err + } + + return ParseCertificate(derBytes) +} + +func customConstraintsExtension(typeNum int, constraint []byte, isExcluded bool) pkix.Extension { + appendConstraint := func(contents []byte, tag uint8) []byte { + contents = append(contents, tag|32 /* constructed */ |0x80 /* context-specific */) + contents = append(contents, byte(4+len(constraint)) /* length */) + contents = append(contents, 0x30 /* SEQUENCE */) + contents = append(contents, byte(2+len(constraint)) /* length */) + contents = append(contents, byte(typeNum) /* GeneralName type */) + contents = append(contents, byte(len(constraint))) + return append(contents, constraint...) + } + + var contents []byte + if !isExcluded { + contents = appendConstraint(contents, 0 /* tag 0 for permitted */) + } else { + contents = appendConstraint(contents, 1 /* tag 1 for excluded */) + } + + var value []byte + value = append(value, 0x30 /* SEQUENCE */) + value = append(value, byte(len(contents))) + value = append(value, contents...) + + return pkix.Extension{ + Id: []int{2, 5, 29, 30}, + Value: value, + } +} + +func addConstraintsToTemplate(constraints constraintsSpec, template *Certificate) error { + parse := func(constraints []string) (dnsNames []string, ips []*net.IPNet, emailAddrs []string, uriDomains []string, err error) { + for _, constraint := range constraints { + switch { + case strings.HasPrefix(constraint, "dns:"): + dnsNames = append(dnsNames, constraint[4:]) + + case strings.HasPrefix(constraint, "ip:"): + _, ipNet, err := net.ParseCIDR(constraint[3:]) + if err != nil { + return nil, nil, nil, nil, err + } + ips = append(ips, ipNet) + + case strings.HasPrefix(constraint, "email:"): + emailAddrs = append(emailAddrs, constraint[6:]) + + case strings.HasPrefix(constraint, "uri:"): + uriDomains = append(uriDomains, constraint[4:]) + + default: + return nil, nil, nil, nil, fmt.Errorf("unknown constraint %q", constraint) + } + } + + return dnsNames, ips, emailAddrs, uriDomains, err + } + + handleSpecialConstraint := func(constraint string, isExcluded bool) bool { + switch { + case constraint == "unknown:": + template.ExtraExtensions = append(template.ExtraExtensions, customConstraintsExtension(9 /* undefined GeneralName type */, []byte{1}, isExcluded)) + + default: + return false + } + + return true + } + + if len(constraints.ok) == 1 && len(constraints.bad) == 0 { + if handleSpecialConstraint(constraints.ok[0], false) { + return nil + } + } + + if len(constraints.bad) == 1 && len(constraints.ok) == 0 { + if handleSpecialConstraint(constraints.bad[0], true) { + return nil + } + } + + var err error + template.PermittedDNSDomains, template.PermittedIPRanges, template.PermittedEmailAddresses, template.PermittedURIDomains, err = parse(constraints.ok) + if err != nil { + return err + } + + template.ExcludedDNSDomains, template.ExcludedIPRanges, template.ExcludedEmailAddresses, template.ExcludedURIDomains, err = parse(constraints.bad) + if err != nil { + return err + } + + if template.ExtKeyUsage, template.UnknownExtKeyUsage, err = parseEKUs(constraints.ekus); err != nil { + return err + } + + return nil +} + +func parseEKUs(ekuStrs []string) (ekus []ExtKeyUsage, unknowns []asn1.ObjectIdentifier, err error) { + for _, s := range ekuStrs { + switch s { + case "serverAuth": + ekus = append(ekus, ExtKeyUsageServerAuth) + case "clientAuth": + ekus = append(ekus, ExtKeyUsageClientAuth) + case "email": + ekus = append(ekus, ExtKeyUsageEmailProtection) + case "netscapeSGC": + ekus = append(ekus, ExtKeyUsageNetscapeServerGatedCrypto) + case "msSGC": + ekus = append(ekus, ExtKeyUsageMicrosoftServerGatedCrypto) + case "any": + ekus = append(ekus, ExtKeyUsageAny) + case "other": + unknowns = append(unknowns, asn1.ObjectIdentifier{2, 4, 1, 2, 3}) + default: + return nil, nil, fmt.Errorf("unknown EKU %q", s) + } + } + + return +} + +func TestConstraintCases(t *testing.T) { + privateKeys := sync.Pool{ + New: func() any { + priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + panic(err) + } + return priv + }, + } + + for i, test := range nameConstraintsTests { + t.Run(test.name, func(t *testing.T) { + rootPool := NewCertPool() + rootKey := privateKeys.Get().(*ecdsa.PrivateKey) + rootName := "Root " + strconv.Itoa(i) + + // keys keeps track of all the private keys used in a given + // test and puts them back in the privateKeys pool at the end. + keys := []*ecdsa.PrivateKey{rootKey} + + // At each level (root, intermediate(s), leaf), parent points to + // an example parent certificate and parentKey the key for the + // parent level. Since all certificates at a given level have + // the same name and public key, any parent certificate is + // sufficient to get the correct issuer name and authority + // key ID. + var parent *Certificate + parentKey := rootKey + + for _, root := range test.roots { + rootCert, err := makeConstraintsCACert(root, rootName, rootKey, nil, rootKey) + if err != nil { + t.Fatalf("failed to create root: %s", err) + } + + parent = rootCert + rootPool.AddCert(rootCert) + } + + intermediatePool := NewCertPool() + + for level, intermediates := range test.intermediates { + levelKey := privateKeys.Get().(*ecdsa.PrivateKey) + keys = append(keys, levelKey) + levelName := "Intermediate level " + strconv.Itoa(level) + var last *Certificate + + for _, intermediate := range intermediates { + caCert, err := makeConstraintsCACert(intermediate, levelName, levelKey, parent, parentKey) + if err != nil { + t.Fatalf("failed to create %q: %s", levelName, err) + } + + last = caCert + intermediatePool.AddCert(caCert) + } + + parent = last + parentKey = levelKey + } + + leafKey := privateKeys.Get().(*ecdsa.PrivateKey) + keys = append(keys, leafKey) + + leafCert, err := makeConstraintsLeafCert(test.leaf, leafKey, parent, parentKey) + if err != nil { + t.Fatalf("cannot create leaf: %s", err) + } + + // Skip tests with CommonName set because OpenSSL will try to match it + // against name constraints, while we ignore it when it's not hostname-looking. + if !test.noOpenSSL && testNameConstraintsAgainstOpenSSL && test.leaf.cn == "" { + output, err := testChainAgainstOpenSSL(t, leafCert, intermediatePool, rootPool) + if err == nil && len(test.expectedError) > 0 { + t.Error("unexpectedly succeeded against OpenSSL") + if debugOpenSSLFailure { + return + } + } + + if err != nil { + if _, ok := err.(*exec.ExitError); !ok { + t.Errorf("OpenSSL failed to run: %s", err) + } else if len(test.expectedError) == 0 { + t.Errorf("OpenSSL unexpectedly failed: %v", output) + if debugOpenSSLFailure { + return + } + } + } + } + + verifyOpts := VerifyOptions{ + Roots: rootPool, + Intermediates: intermediatePool, + CurrentTime: time.Unix(1500, 0), + KeyUsages: test.requestedEKUs, + } + _, err = leafCert.Verify(verifyOpts) + + logInfo := false + if len(test.expectedError) == 0 { + if err != nil { + t.Errorf("unexpected failure: %s", err) + } else { + logInfo = false + } + } else { + if err == nil { + t.Error("unexpected success") + } else if !strings.Contains(err.Error(), test.expectedError) { + t.Errorf("expected error containing %q, but got: %s", test.expectedError, err) + } else { + logInfo = false + } + } + + if logInfo { + certAsPEM := func(cert *Certificate) string { + var buf bytes.Buffer + pem.Encode(&buf, &pem.Block{Type: "CERTIFICATE", Bytes: cert.Raw}) + return buf.String() + } + t.Errorf("root:\n%s", certAsPEM(rootPool.mustCert(t, 0))) + if intermediates := allCerts(t, intermediatePool); len(intermediates) > 0 { + for ii, intermediate := range intermediates { + t.Errorf("intermediate %d:\n%s", ii, certAsPEM(intermediate)) + } + } + t.Errorf("leaf:\n%s", certAsPEM(leafCert)) + } + + for _, key := range keys { + privateKeys.Put(key) + } + }) + } +} + +func writePEMsToTempFile(certs []*Certificate) *os.File { + file, err := os.CreateTemp("", "name_constraints_test") + if err != nil { + panic("cannot create tempfile") + } + + pemBlock := &pem.Block{Type: "CERTIFICATE"} + for _, cert := range certs { + pemBlock.Bytes = cert.Raw + pem.Encode(file, pemBlock) + } + + return file +} + +func testChainAgainstOpenSSL(t *testing.T, leaf *Certificate, intermediates, roots *CertPool) (string, error) { + args := []string{"verify", "-no_check_time"} + + rootsFile := writePEMsToTempFile(allCerts(t, roots)) + if debugOpenSSLFailure { + println("roots file:", rootsFile.Name()) + } else { + defer os.Remove(rootsFile.Name()) + } + args = append(args, "-CAfile", rootsFile.Name()) + + if intermediates.len() > 0 { + intermediatesFile := writePEMsToTempFile(allCerts(t, intermediates)) + if debugOpenSSLFailure { + println("intermediates file:", intermediatesFile.Name()) + } else { + defer os.Remove(intermediatesFile.Name()) + } + args = append(args, "-untrusted", intermediatesFile.Name()) + } + + leafFile := writePEMsToTempFile([]*Certificate{leaf}) + if debugOpenSSLFailure { + println("leaf file:", leafFile.Name()) + } else { + defer os.Remove(leafFile.Name()) + } + args = append(args, leafFile.Name()) + + cmd := testenv.Command(t, "openssl", args...) + out, err := cmd.CombinedOutput() + return string(out), err +} + +var rfc2821Tests = []struct { + in string + localPart, domain string +}{ + {"foo@example.com", "foo", "example.com"}, + {"@example.com", "", ""}, + {"\"@example.com", "", ""}, + {"\"\"@example.com", "", "example.com"}, + {"\"a\"@example.com", "a", "example.com"}, + {"\"\\a\"@example.com", "a", "example.com"}, + {"a\"@example.com", "", ""}, + {"foo..bar@example.com", "", ""}, + {".foo.bar@example.com", "", ""}, + {"foo.bar.@example.com", "", ""}, + {"|{}?'@example.com", "|{}?'", "example.com"}, + + // Examples from RFC 3696 + {"Abc\\@def@example.com", "Abc@def", "example.com"}, + {"Fred\\ Bloggs@example.com", "Fred Bloggs", "example.com"}, + {"Joe.\\\\Blow@example.com", "Joe.\\Blow", "example.com"}, + {"\"Abc@def\"@example.com", "Abc@def", "example.com"}, + {"\"Fred Bloggs\"@example.com", "Fred Bloggs", "example.com"}, + {"customer/department=shipping@example.com", "customer/department=shipping", "example.com"}, + {"$A12345@example.com", "$A12345", "example.com"}, + {"!def!xyz%abc@example.com", "!def!xyz%abc", "example.com"}, + {"_somename@example.com", "_somename", "example.com"}, +} + +func TestRFC2821Parsing(t *testing.T) { + for i, test := range rfc2821Tests { + mailbox, ok := parseRFC2821Mailbox(test.in) + expectedFailure := len(test.localPart) == 0 && len(test.domain) == 0 + + if ok && expectedFailure { + t.Errorf("#%d: %q unexpectedly parsed as (%q, %q)", i, test.in, mailbox.local, mailbox.domain) + continue + } + + if !ok && !expectedFailure { + t.Errorf("#%d: unexpected failure for %q", i, test.in) + continue + } + + if !ok { + continue + } + + if mailbox.local != test.localPart || mailbox.domain != test.domain { + t.Errorf("#%d: %q parsed as (%q, %q), but wanted (%q, %q)", i, test.in, mailbox.local, mailbox.domain, test.localPart, test.domain) + } + } +} + +func TestBadNamesInConstraints(t *testing.T) { + constraintParseError := func(err error) bool { + str := err.Error() + return strings.Contains(str, "failed to parse ") && strings.Contains(str, "constraint") + } + + encodingError := func(err error) bool { + return strings.Contains(err.Error(), "cannot be encoded as an IA5String") + } + + // Bad names in constraints should not parse. + badNames := []struct { + name string + matcher func(error) bool + }{ + {"dns:foo.com.", constraintParseError}, + {"email:abc@foo.com.", constraintParseError}, + {"email:foo.com.", constraintParseError}, + {"uri:example.com.", constraintParseError}, + {"uri:1.2.3.4", constraintParseError}, + {"uri:ffff::1", constraintParseError}, + {"dns:not–hyphen.com", encodingError}, + {"email:foo@not–hyphen.com", encodingError}, + {"uri:not–hyphen.com", encodingError}, + } + + priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + panic(err) + } + + for _, test := range badNames { + _, err := makeConstraintsCACert(constraintsSpec{ + ok: []string{test.name}, + }, "TestAbsoluteNamesInConstraints", priv, nil, priv) + + if err == nil { + t.Errorf("bad name %q unexpectedly accepted in name constraint", test.name) + continue + } else { + if !test.matcher(err) { + t.Errorf("bad name %q triggered unrecognised error: %s", test.name, err) + } + } + } +} + +func TestBadNamesInSANs(t *testing.T) { + // Bad names in URI and IP SANs should not parse. Bad DNS and email SANs + // will parse and are tested in name constraint tests at the top of this + // file. + badNames := []string{ + "uri:https://example.com./dsf", + "invalidip:0102", + "invalidip:0102030405", + } + + priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + panic(err) + } + + for _, badName := range badNames { + _, err := makeConstraintsLeafCert(leafSpec{sans: []string{badName}}, priv, nil, priv) + + if err == nil { + t.Errorf("bad name %q unexpectedly accepted in SAN", badName) + continue + } + + if str := err.Error(); !strings.Contains(str, "cannot parse ") { + t.Errorf("bad name %q triggered unrecognised error: %s", badName, str) + } + } +} diff --git a/go/src/crypto/x509/oid.go b/go/src/crypto/x509/oid.go new file mode 100644 index 0000000000000000000000000000000000000000..8bf19a1433318b2c7bb006d78e53ac0dea596fe5 --- /dev/null +++ b/go/src/crypto/x509/oid.go @@ -0,0 +1,407 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "bytes" + "encoding/asn1" + "errors" + "math" + "math/big" + "math/bits" + "strconv" + "strings" +) + +var ( + errInvalidOID = errors.New("invalid oid") +) + +// An OID represents an ASN.1 OBJECT IDENTIFIER. +type OID struct { + der []byte +} + +// ParseOID parses a Object Identifier string, represented by ASCII numbers separated by dots. +func ParseOID(oid string) (OID, error) { + var o OID + return o, o.unmarshalOIDText(oid) +} + +func newOIDFromDER(der []byte) (OID, bool) { + if len(der) == 0 || der[len(der)-1]&0x80 != 0 { + return OID{}, false + } + + start := 0 + for i, v := range der { + // ITU-T X.690, section 8.19.2: + // The subidentifier shall be encoded in the fewest possible octets, + // that is, the leading octet of the subidentifier shall not have the value 0x80. + if i == start && v == 0x80 { + return OID{}, false + } + if v&0x80 == 0 { + start = i + 1 + } + } + + return OID{der}, true +} + +// OIDFromInts creates a new OID using ints, each integer is a separate component. +func OIDFromInts(oid []uint64) (OID, error) { + if len(oid) < 2 || oid[0] > 2 || (oid[0] < 2 && oid[1] >= 40) { + return OID{}, errInvalidOID + } + + length := base128IntLength(oid[0]*40 + oid[1]) + for _, v := range oid[2:] { + length += base128IntLength(v) + } + + der := make([]byte, 0, length) + der = appendBase128Int(der, oid[0]*40+oid[1]) + for _, v := range oid[2:] { + der = appendBase128Int(der, v) + } + return OID{der}, nil +} + +func base128IntLength(n uint64) int { + if n == 0 { + return 1 + } + return (bits.Len64(n) + 6) / 7 +} + +func appendBase128Int(dst []byte, n uint64) []byte { + for i := base128IntLength(n) - 1; i >= 0; i-- { + o := byte(n >> uint(i*7)) + o &= 0x7f + if i != 0 { + o |= 0x80 + } + dst = append(dst, o) + } + return dst +} + +func base128BigIntLength(n *big.Int) int { + if n.Cmp(big.NewInt(0)) == 0 { + return 1 + } + return (n.BitLen() + 6) / 7 +} + +func appendBase128BigInt(dst []byte, n *big.Int) []byte { + if n.Cmp(big.NewInt(0)) == 0 { + return append(dst, 0) + } + + for i := base128BigIntLength(n) - 1; i >= 0; i-- { + o := byte(big.NewInt(0).Rsh(n, uint(i)*7).Bits()[0]) + o &= 0x7f + if i != 0 { + o |= 0x80 + } + dst = append(dst, o) + } + return dst +} + +// AppendText implements [encoding.TextAppender] +func (o OID) AppendText(b []byte) ([]byte, error) { + return append(b, o.String()...), nil +} + +// MarshalText implements [encoding.TextMarshaler] +func (o OID) MarshalText() ([]byte, error) { + return o.AppendText(nil) +} + +// UnmarshalText implements [encoding.TextUnmarshaler] +func (o *OID) UnmarshalText(text []byte) error { + return o.unmarshalOIDText(string(text)) +} + +func (o *OID) unmarshalOIDText(oid string) error { + // (*big.Int).SetString allows +/- signs, but we don't want + // to allow them in the string representation of Object Identifier, so + // reject such encodings. + for _, c := range oid { + isDigit := c >= '0' && c <= '9' + if !isDigit && c != '.' { + return errInvalidOID + } + } + + var ( + firstNum string + secondNum string + ) + + var nextComponentExists bool + firstNum, oid, nextComponentExists = strings.Cut(oid, ".") + if !nextComponentExists { + return errInvalidOID + } + secondNum, oid, nextComponentExists = strings.Cut(oid, ".") + + var ( + first = big.NewInt(0) + second = big.NewInt(0) + ) + + if _, ok := first.SetString(firstNum, 10); !ok { + return errInvalidOID + } + if _, ok := second.SetString(secondNum, 10); !ok { + return errInvalidOID + } + + if first.Cmp(big.NewInt(2)) > 0 || (first.Cmp(big.NewInt(2)) < 0 && second.Cmp(big.NewInt(40)) >= 0) { + return errInvalidOID + } + + firstComponent := first.Mul(first, big.NewInt(40)) + firstComponent.Add(firstComponent, second) + + der := appendBase128BigInt(make([]byte, 0, 32), firstComponent) + + for nextComponentExists { + var strNum string + strNum, oid, nextComponentExists = strings.Cut(oid, ".") + b, ok := big.NewInt(0).SetString(strNum, 10) + if !ok { + return errInvalidOID + } + der = appendBase128BigInt(der, b) + } + + o.der = der + return nil +} + +// AppendBinary implements [encoding.BinaryAppender] +func (o OID) AppendBinary(b []byte) ([]byte, error) { + return append(b, o.der...), nil +} + +// MarshalBinary implements [encoding.BinaryMarshaler] +func (o OID) MarshalBinary() ([]byte, error) { + return o.AppendBinary(nil) +} + +// UnmarshalBinary implements [encoding.BinaryUnmarshaler] +func (o *OID) UnmarshalBinary(b []byte) error { + oid, ok := newOIDFromDER(bytes.Clone(b)) + if !ok { + return errInvalidOID + } + *o = oid + return nil +} + +// Equal returns true when oid and other represents the same Object Identifier. +func (oid OID) Equal(other OID) bool { + // There is only one possible DER encoding of + // each unique Object Identifier. + return bytes.Equal(oid.der, other.der) +} + +func parseBase128Int(bytes []byte, initOffset int) (ret, offset int, failed bool) { + offset = initOffset + var ret64 int64 + for shifted := 0; offset < len(bytes); shifted++ { + // 5 * 7 bits per byte == 35 bits of data + // Thus the representation is either non-minimal or too large for an int32 + if shifted == 5 { + failed = true + return + } + ret64 <<= 7 + b := bytes[offset] + // integers should be minimally encoded, so the leading octet should + // never be 0x80 + if shifted == 0 && b == 0x80 { + failed = true + return + } + ret64 |= int64(b & 0x7f) + offset++ + if b&0x80 == 0 { + ret = int(ret64) + // Ensure that the returned value fits in an int on all platforms + if ret64 > math.MaxInt32 { + failed = true + } + return + } + } + failed = true + return +} + +// EqualASN1OID returns whether an OID equals an asn1.ObjectIdentifier. If +// asn1.ObjectIdentifier cannot represent the OID specified by oid, because +// a component of OID requires more than 31 bits, it returns false. +func (oid OID) EqualASN1OID(other asn1.ObjectIdentifier) bool { + if len(other) < 2 { + return false + } + v, offset, failed := parseBase128Int(oid.der, 0) + if failed { + // This should never happen, since we've already parsed the OID, + // but just in case. + return false + } + if v < 80 { + a, b := v/40, v%40 + if other[0] != a || other[1] != b { + return false + } + } else { + a, b := 2, v-80 + if other[0] != a || other[1] != b { + return false + } + } + + i := 2 + for ; offset < len(oid.der); i++ { + v, offset, failed = parseBase128Int(oid.der, offset) + if failed { + // Again, shouldn't happen, since we've already parsed + // the OID, but better safe than sorry. + return false + } + if i >= len(other) || v != other[i] { + return false + } + } + + return i == len(other) +} + +// String returns the string representation of the Object Identifier. +func (oid OID) String() string { + var b strings.Builder + b.Grow(32) + const ( + valSize = 64 // size in bits of val. + bitsPerByte = 7 + maxValSafeShift = (1 << (valSize - bitsPerByte)) - 1 + ) + var ( + start = 0 + val = uint64(0) + numBuf = make([]byte, 0, 21) + bigVal *big.Int + overflow bool + ) + for i, v := range oid.der { + curVal := v & 0x7F + valEnd := v&0x80 == 0 + if valEnd { + if start != 0 { + b.WriteByte('.') + } + } + if !overflow && val > maxValSafeShift { + if bigVal == nil { + bigVal = new(big.Int) + } + bigVal = bigVal.SetUint64(val) + overflow = true + } + if overflow { + bigVal = bigVal.Lsh(bigVal, bitsPerByte).Or(bigVal, big.NewInt(int64(curVal))) + if valEnd { + if start == 0 { + b.WriteString("2.") + bigVal = bigVal.Sub(bigVal, big.NewInt(80)) + } + numBuf = bigVal.Append(numBuf, 10) + b.Write(numBuf) + numBuf = numBuf[:0] + val = 0 + start = i + 1 + overflow = false + } + continue + } + val <<= bitsPerByte + val |= uint64(curVal) + if valEnd { + if start == 0 { + if val < 80 { + b.Write(strconv.AppendUint(numBuf, val/40, 10)) + b.WriteByte('.') + b.Write(strconv.AppendUint(numBuf, val%40, 10)) + } else { + b.WriteString("2.") + b.Write(strconv.AppendUint(numBuf, val-80, 10)) + } + } else { + b.Write(strconv.AppendUint(numBuf, val, 10)) + } + val = 0 + start = i + 1 + } + } + return b.String() +} + +func (oid OID) toASN1OID() (asn1.ObjectIdentifier, bool) { + out := make([]int, 0, len(oid.der)+1) + + const ( + valSize = 31 // amount of usable bits of val for OIDs. + bitsPerByte = 7 + maxValSafeShift = (1 << (valSize - bitsPerByte)) - 1 + ) + + val := 0 + + for _, v := range oid.der { + if val > maxValSafeShift { + return nil, false + } + + val <<= bitsPerByte + val |= int(v & 0x7F) + + if v&0x80 == 0 { + if len(out) == 0 { + if val < 80 { + out = append(out, val/40) + out = append(out, val%40) + } else { + out = append(out, 2) + out = append(out, val-80) + } + val = 0 + continue + } + out = append(out, val) + val = 0 + } + } + + return out, true +} + +// OIDFromASN1OID creates a new OID using asn1OID. +func OIDFromASN1OID(asn1OID asn1.ObjectIdentifier) (OID, error) { + uint64OID := make([]uint64, 0, len(asn1OID)) + for _, component := range asn1OID { + if component < 0 { + return OID{}, errors.New("x509: OID components must be non-negative") + } + uint64OID = append(uint64OID, uint64(component)) + } + return OIDFromInts(uint64OID) +} diff --git a/go/src/crypto/x509/oid_test.go b/go/src/crypto/x509/oid_test.go new file mode 100644 index 0000000000000000000000000000000000000000..efc71fc2dc78e7ef1ccddd1c9f30fa9bd1d48871 --- /dev/null +++ b/go/src/crypto/x509/oid_test.go @@ -0,0 +1,369 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "encoding" + "encoding/asn1" + "math" + "testing" +) + +var oidTests = []struct { + raw []byte + valid bool + str string + ints []uint64 +}{ + {[]byte{}, false, "", nil}, + {[]byte{0x80, 0x01}, false, "", nil}, + {[]byte{0x01, 0x80, 0x01}, false, "", nil}, + + {[]byte{1, 2, 3}, true, "0.1.2.3", []uint64{0, 1, 2, 3}}, + {[]byte{41, 2, 3}, true, "1.1.2.3", []uint64{1, 1, 2, 3}}, + {[]byte{86, 2, 3}, true, "2.6.2.3", []uint64{2, 6, 2, 3}}, + + {[]byte{41, 255, 255, 255, 127}, true, "1.1.268435455", []uint64{1, 1, 268435455}}, + {[]byte{41, 0x87, 255, 255, 255, 127}, true, "1.1.2147483647", []uint64{1, 1, 2147483647}}, + {[]byte{41, 255, 255, 255, 255, 127}, true, "1.1.34359738367", []uint64{1, 1, 34359738367}}, + {[]byte{42, 255, 255, 255, 255, 255, 255, 255, 255, 127}, true, "1.2.9223372036854775807", []uint64{1, 2, 9223372036854775807}}, + {[]byte{43, 0x81, 255, 255, 255, 255, 255, 255, 255, 255, 127}, true, "1.3.18446744073709551615", []uint64{1, 3, 18446744073709551615}}, + {[]byte{44, 0x83, 255, 255, 255, 255, 255, 255, 255, 255, 127}, true, "1.4.36893488147419103231", nil}, + {[]byte{85, 255, 255, 255, 255, 255, 255, 255, 255, 255, 127}, true, "2.5.1180591620717411303423", nil}, + {[]byte{85, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 127}, true, "2.5.19342813113834066795298815", nil}, + + {[]byte{255, 255, 255, 127}, true, "2.268435375", []uint64{2, 268435375}}, + {[]byte{0x87, 255, 255, 255, 127}, true, "2.2147483567", []uint64{2, 2147483567}}, + {[]byte{255, 127}, true, "2.16303", []uint64{2, 16303}}, + {[]byte{255, 255, 255, 255, 127}, true, "2.34359738287", []uint64{2, 34359738287}}, + {[]byte{255, 255, 255, 255, 255, 255, 255, 255, 127}, true, "2.9223372036854775727", []uint64{2, 9223372036854775727}}, + {[]byte{0x81, 255, 255, 255, 255, 255, 255, 255, 255, 127}, true, "2.18446744073709551535", []uint64{2, 18446744073709551535}}, + {[]byte{0x83, 255, 255, 255, 255, 255, 255, 255, 255, 127}, true, "2.36893488147419103151", nil}, + {[]byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 127}, true, "2.1180591620717411303343", nil}, + {[]byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 127}, true, "2.19342813113834066795298735", nil}, + + {[]byte{41, 0x80 | 66, 0x80 | 44, 0x80 | 11, 33}, true, "1.1.139134369", []uint64{1, 1, 139134369}}, + {[]byte{0x80 | 66, 0x80 | 44, 0x80 | 11, 33}, true, "2.139134289", []uint64{2, 139134289}}, +} + +func TestOID(t *testing.T) { + for _, v := range oidTests { + oid, ok := newOIDFromDER(v.raw) + if ok != v.valid { + t.Errorf("newOIDFromDER(%v) = (%v, %v); want = (OID, %v)", v.raw, oid, ok, v.valid) + continue + } + + if !ok { + continue + } + + if str := oid.String(); str != v.str { + t.Errorf("(%#v).String() = %v, want; %v", oid, str, v.str) + } + + var asn1OID asn1.ObjectIdentifier + for _, v := range v.ints { + if v > math.MaxInt32 { + asn1OID = nil + break + } + asn1OID = append(asn1OID, int(v)) + } + + o, ok := oid.toASN1OID() + if shouldOk := asn1OID != nil; shouldOk != ok { + t.Errorf("(%#v).toASN1OID() = (%v, %v); want = (%v, %v)", oid, o, ok, asn1OID, shouldOk) + continue + } + + if asn1OID != nil && !o.Equal(asn1OID) { + t.Errorf("(%#v).toASN1OID() = (%v, true); want = (%v, true)", oid, o, asn1OID) + } + + if v.ints != nil { + oid2, err := OIDFromInts(v.ints) + if err != nil { + t.Errorf("OIDFromInts(%v) = (%v, %v); want = (%v, nil)", v.ints, oid2, err, oid) + } + if !oid2.Equal(oid) { + t.Errorf("OIDFromInts(%v) = (%v, nil); want = (%v, nil)", v.ints, oid2, oid) + } + } + } +} + +func TestInvalidOID(t *testing.T) { + cases := []struct { + str string + ints []uint64 + }{ + {str: "", ints: []uint64{}}, + {str: "1", ints: []uint64{1}}, + {str: "3", ints: []uint64{3}}, + {str: "3.100.200", ints: []uint64{3, 100, 200}}, + {str: "1.81", ints: []uint64{1, 81}}, + {str: "1.81.200", ints: []uint64{1, 81, 200}}, + } + + for _, tt := range cases { + oid, err := OIDFromInts(tt.ints) + if err == nil { + t.Errorf("OIDFromInts(%v) = (%v, %v); want = (OID{}, %v)", tt.ints, oid, err, errInvalidOID) + } + + oid2, err := ParseOID(tt.str) + if err == nil { + t.Errorf("ParseOID(%v) = (%v, %v); want = (OID{}, %v)", tt.str, oid2, err, errInvalidOID) + } + + var oid3 OID + err = oid3.UnmarshalText([]byte(tt.str)) + if err == nil { + t.Errorf("(*OID).UnmarshalText(%v) = (%v, %v); want = (OID{}, %v)", tt.str, oid3, err, errInvalidOID) + } + } +} + +func TestOIDEqual(t *testing.T) { + var cases = []struct { + oid OID + oid2 OID + eq bool + }{ + {oid: mustNewOIDFromInts([]uint64{1, 2, 3}), oid2: mustNewOIDFromInts([]uint64{1, 2, 3}), eq: true}, + {oid: mustNewOIDFromInts([]uint64{1, 2, 3}), oid2: mustNewOIDFromInts([]uint64{1, 2, 4}), eq: false}, + {oid: mustNewOIDFromInts([]uint64{1, 2, 3}), oid2: mustNewOIDFromInts([]uint64{1, 2, 3, 4}), eq: false}, + {oid: mustNewOIDFromInts([]uint64{2, 33, 22}), oid2: mustNewOIDFromInts([]uint64{2, 33, 23}), eq: false}, + {oid: OID{}, oid2: OID{}, eq: true}, + {oid: OID{}, oid2: mustNewOIDFromInts([]uint64{2, 33, 23}), eq: false}, + } + + for _, tt := range cases { + if eq := tt.oid.Equal(tt.oid2); eq != tt.eq { + t.Errorf("(%v).Equal(%v) = %v, want %v", tt.oid, tt.oid2, eq, tt.eq) + } + } +} + +var ( + _ encoding.BinaryMarshaler = OID{} + _ encoding.BinaryUnmarshaler = new(OID) + _ encoding.TextMarshaler = OID{} + _ encoding.TextUnmarshaler = new(OID) +) + +func TestOIDMarshal(t *testing.T) { + cases := []struct { + in string + out OID + err error + }{ + {in: "", err: errInvalidOID}, + {in: "0", err: errInvalidOID}, + {in: "1", err: errInvalidOID}, + {in: ".1", err: errInvalidOID}, + {in: ".1.", err: errInvalidOID}, + {in: "1.", err: errInvalidOID}, + {in: "1..", err: errInvalidOID}, + {in: "1.2.", err: errInvalidOID}, + {in: "1.2.333.", err: errInvalidOID}, + {in: "1.2.333..", err: errInvalidOID}, + {in: "1.2..", err: errInvalidOID}, + {in: "+1.2", err: errInvalidOID}, + {in: "-1.2", err: errInvalidOID}, + {in: "1.-2", err: errInvalidOID}, + {in: "1.2.+333", err: errInvalidOID}, + } + + for _, v := range oidTests { + oid, ok := newOIDFromDER(v.raw) + if !ok { + continue + } + cases = append(cases, struct { + in string + out OID + err error + }{ + in: v.str, + out: oid, + err: nil, + }) + } + + for _, tt := range cases { + o, err := ParseOID(tt.in) + if err != tt.err { + t.Errorf("ParseOID(%q) = %v; want = %v", tt.in, err, tt.err) + continue + } + + var o2 OID + err = o2.UnmarshalText([]byte(tt.in)) + if err != tt.err { + t.Errorf("(*OID).UnmarshalText(%q) = %v; want = %v", tt.in, err, tt.err) + continue + } + + if err != nil { + continue + } + + if !o.Equal(tt.out) { + t.Errorf("(*OID).UnmarshalText(%q) = %v; want = %v", tt.in, o, tt.out) + continue + } + + if !o2.Equal(tt.out) { + t.Errorf("ParseOID(%q) = %v; want = %v", tt.in, o2, tt.out) + continue + } + + marshalled, err := o.MarshalText() + if string(marshalled) != tt.in || err != nil { + t.Errorf("(%#v).MarshalText() = (%v, %v); want = (%v, nil)", o, string(marshalled), err, tt.in) + continue + } + + textAppend := make([]byte, 4) + textAppend, err = o.AppendText(textAppend) + textAppend = textAppend[4:] + if string(textAppend) != tt.in || err != nil { + t.Errorf("(%#v).AppendText() = (%v, %v); want = (%v, nil)", o, string(textAppend), err, tt.in) + continue + } + + binary, err := o.MarshalBinary() + if err != nil { + t.Errorf("(%#v).MarshalBinary() = %v; want = nil", o, err) + } + + var o3 OID + if err := o3.UnmarshalBinary(binary); err != nil { + t.Errorf("(*OID).UnmarshalBinary(%v) = %v; want = nil", binary, err) + } + + if !o3.Equal(tt.out) { + t.Errorf("(*OID).UnmarshalBinary(%v) = %v; want = %v", binary, o3, tt.out) + continue + } + + binaryAppend := make([]byte, 4) + binaryAppend, err = o.AppendBinary(binaryAppend) + binaryAppend = binaryAppend[4:] + if err != nil { + t.Errorf("(%#v).AppendBinary() = %v; want = nil", o, err) + } + + var o4 OID + if err := o4.UnmarshalBinary(binaryAppend); err != nil { + t.Errorf("(*OID).UnmarshalBinary(%v) = %v; want = nil", binaryAppend, err) + } + + if !o4.Equal(tt.out) { + t.Errorf("(*OID).UnmarshalBinary(%v) = %v; want = %v", binaryAppend, o4, tt.out) + continue + } + } +} + +func TestOIDEqualASN1OID(t *testing.T) { + maxInt32PlusOne := int64(math.MaxInt32) + 1 + var cases = []struct { + oid OID + oid2 asn1.ObjectIdentifier + eq bool + }{ + {oid: mustNewOIDFromInts([]uint64{1, 2, 3}), oid2: asn1.ObjectIdentifier{1, 2, 3}, eq: true}, + {oid: mustNewOIDFromInts([]uint64{1, 2, 3}), oid2: asn1.ObjectIdentifier{1, 2, 4}, eq: false}, + {oid: mustNewOIDFromInts([]uint64{1, 2, 3}), oid2: asn1.ObjectIdentifier{1, 2, 3, 4}, eq: false}, + {oid: mustNewOIDFromInts([]uint64{1, 33, 22}), oid2: asn1.ObjectIdentifier{1, 33, 23}, eq: false}, + {oid: mustNewOIDFromInts([]uint64{1, 33, 23}), oid2: asn1.ObjectIdentifier{1, 33, 22}, eq: false}, + {oid: mustNewOIDFromInts([]uint64{1, 33, 127}), oid2: asn1.ObjectIdentifier{1, 33, 127}, eq: true}, + {oid: mustNewOIDFromInts([]uint64{1, 33, 128}), oid2: asn1.ObjectIdentifier{1, 33, 127}, eq: false}, + {oid: mustNewOIDFromInts([]uint64{1, 33, 128}), oid2: asn1.ObjectIdentifier{1, 33, 128}, eq: true}, + {oid: mustNewOIDFromInts([]uint64{1, 33, 129}), oid2: asn1.ObjectIdentifier{1, 33, 129}, eq: true}, + {oid: mustNewOIDFromInts([]uint64{1, 33, 128}), oid2: asn1.ObjectIdentifier{1, 33, 129}, eq: false}, + {oid: mustNewOIDFromInts([]uint64{1, 33, 129}), oid2: asn1.ObjectIdentifier{1, 33, 128}, eq: false}, + {oid: mustNewOIDFromInts([]uint64{1, 33, 255}), oid2: asn1.ObjectIdentifier{1, 33, 255}, eq: true}, + {oid: mustNewOIDFromInts([]uint64{1, 33, 256}), oid2: asn1.ObjectIdentifier{1, 33, 256}, eq: true}, + {oid: mustNewOIDFromInts([]uint64{2, 33, 257}), oid2: asn1.ObjectIdentifier{2, 33, 256}, eq: false}, + {oid: mustNewOIDFromInts([]uint64{2, 33, 256}), oid2: asn1.ObjectIdentifier{2, 33, 257}, eq: false}, + + {oid: mustNewOIDFromInts([]uint64{1, 33}), oid2: asn1.ObjectIdentifier{1, 33, math.MaxInt32}, eq: false}, + {oid: mustNewOIDFromInts([]uint64{1, 33, math.MaxInt32}), oid2: asn1.ObjectIdentifier{1, 33}, eq: false}, + {oid: mustNewOIDFromInts([]uint64{1, 33, math.MaxInt32}), oid2: asn1.ObjectIdentifier{1, 33, math.MaxInt32}, eq: true}, + { + oid: mustNewOIDFromInts([]uint64{1, 33, math.MaxInt32 + 1}), + oid2: asn1.ObjectIdentifier{1, 33 /*convert to int, so that it compiles on 32bit*/, int(maxInt32PlusOne)}, + eq: false, + }, + + {oid: mustNewOIDFromInts([]uint64{1, 33, 256}), oid2: asn1.ObjectIdentifier{}, eq: false}, + {oid: OID{}, oid2: asn1.ObjectIdentifier{1, 33, 256}, eq: false}, + {oid: OID{}, oid2: asn1.ObjectIdentifier{}, eq: false}, + } + + for _, tt := range cases { + if eq := tt.oid.EqualASN1OID(tt.oid2); eq != tt.eq { + t.Errorf("(%v).EqualASN1OID(%v) = %v, want %v", tt.oid, tt.oid2, eq, tt.eq) + } + } +} + +func TestOIDUnmarshalBinary(t *testing.T) { + for _, tt := range oidTests { + var o OID + err := o.UnmarshalBinary(tt.raw) + + expectErr := errInvalidOID + if tt.valid { + expectErr = nil + } + + if err != expectErr { + t.Errorf("(o *OID).UnmarshalBinary(%v) = %v; want = %v; (o = %v)", tt.raw, err, expectErr, o) + } + } +} + +func BenchmarkOIDMarshalUnmarshalText(b *testing.B) { + oid := mustNewOIDFromInts([]uint64{1, 2, 3, 9999, 1024}) + for range b.N { + text, err := oid.MarshalText() + if err != nil { + b.Fatal(err) + } + var o OID + if err := o.UnmarshalText(text); err != nil { + b.Fatal(err) + } + } +} + +func TestOIDFromASN1OID(t *testing.T) { + negativeComponentOID := asn1.ObjectIdentifier{-1} + _, err := OIDFromASN1OID(negativeComponentOID) + if err == nil || err.Error() != "x509: OID components must be non-negative" { + t.Fatalf("OIDFromASN1OID() = %v; want = \"x509: OID components must be non-negative\"", err) + } + + shortOID := asn1.ObjectIdentifier{1} + _, err = OIDFromASN1OID(shortOID) + if err == nil || err != errInvalidOID { + t.Fatalf("OIDFromASN1OID() = %v; want = %q", err, errInvalidOID) + } + invalidOIDFirstComponent := asn1.ObjectIdentifier{255, 1} + _, err = OIDFromASN1OID(invalidOIDFirstComponent) + if err == nil || err != errInvalidOID { + t.Fatalf("OIDFromASN1OID() = %v; want = %q", err, errInvalidOID) + } + invalidOIDSecondComponent := asn1.ObjectIdentifier{1, 255} + _, err = OIDFromASN1OID(invalidOIDSecondComponent) + if err == nil || err != errInvalidOID { + t.Fatalf("OIDFromASN1OID() = %v; want = %q", err, errInvalidOID) + } +} diff --git a/go/src/crypto/x509/parser.go b/go/src/crypto/x509/parser.go new file mode 100644 index 0000000000000000000000000000000000000000..e255f7d604a40a770dee09f7e84065509d9390b6 --- /dev/null +++ b/go/src/crypto/x509/parser.go @@ -0,0 +1,1347 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "bytes" + "crypto/dsa" + "crypto/ecdh" + "crypto/ecdsa" + "crypto/ed25519" + "crypto/rsa" + "crypto/x509/pkix" + "encoding/asn1" + "errors" + "fmt" + "internal/godebug" + "math" + "math/big" + "net" + "net/url" + "strconv" + "strings" + "time" + "unicode/utf16" + "unicode/utf8" + + "golang.org/x/crypto/cryptobyte" + cryptobyte_asn1 "golang.org/x/crypto/cryptobyte/asn1" +) + +// isPrintable reports whether the given b is in the ASN.1 PrintableString set. +// This is a simplified version of encoding/asn1.isPrintable. +func isPrintable(b byte) bool { + return 'a' <= b && b <= 'z' || + 'A' <= b && b <= 'Z' || + '0' <= b && b <= '9' || + '\'' <= b && b <= ')' || + '+' <= b && b <= '/' || + b == ' ' || + b == ':' || + b == '=' || + b == '?' || + // This is technically not allowed in a PrintableString. + // However, x509 certificates with wildcard strings don't + // always use the correct string type so we permit it. + b == '*' || + // This is not technically allowed either. However, not + // only is it relatively common, but there are also a + // handful of CA certificates that contain it. At least + // one of which will not expire until 2027. + b == '&' +} + +// parseASN1String parses the ASN.1 string types T61String, PrintableString, +// UTF8String, BMPString, IA5String, and NumericString. This is mostly copied +// from the respective encoding/asn1.parse... methods, rather than just +// increasing the API surface of that package. +func parseASN1String(tag cryptobyte_asn1.Tag, value []byte) (string, error) { + switch tag { + case cryptobyte_asn1.T61String: + // T.61 is a defunct ITU 8-bit character encoding which preceded Unicode. + // T.61 uses a code page layout that _almost_ exactly maps to the code + // page layout of the ISO 8859-1 (Latin-1) character encoding, with the + // exception that a number of characters in Latin-1 are not present + // in T.61. + // + // Instead of mapping which characters are present in Latin-1 but not T.61, + // we just treat these strings as being encoded using Latin-1. This matches + // what most of the world does, including BoringSSL. + buf := make([]byte, 0, len(value)) + for _, v := range value { + // All the 1-byte UTF-8 runes map 1-1 with Latin-1. + buf = utf8.AppendRune(buf, rune(v)) + } + return string(buf), nil + case cryptobyte_asn1.PrintableString: + for _, b := range value { + if !isPrintable(b) { + return "", errors.New("invalid PrintableString") + } + } + return string(value), nil + case cryptobyte_asn1.UTF8String: + if !utf8.Valid(value) { + return "", errors.New("invalid UTF-8 string") + } + return string(value), nil + case cryptobyte_asn1.Tag(asn1.TagBMPString): + // BMPString uses the defunct UCS-2 16-bit character encoding, which + // covers the Basic Multilingual Plane (BMP). UTF-16 was an extension of + // UCS-2, containing all of the same code points, but also including + // multi-code point characters (by using surrogate code points). We can + // treat a UCS-2 encoded string as a UTF-16 encoded string, as long as + // we reject out the UTF-16 specific code points. This matches the + // BoringSSL behavior. + + if len(value)%2 != 0 { + return "", errors.New("invalid BMPString") + } + + // Strip terminator if present. + if l := len(value); l >= 2 && value[l-1] == 0 && value[l-2] == 0 { + value = value[:l-2] + } + + s := make([]uint16, 0, len(value)/2) + for len(value) > 0 { + point := uint16(value[0])<<8 + uint16(value[1]) + // Reject UTF-16 code points that are permanently reserved + // noncharacters (0xfffe, 0xffff, and 0xfdd0-0xfdef) and surrogates + // (0xd800-0xdfff). + if point == 0xfffe || point == 0xffff || + (point >= 0xfdd0 && point <= 0xfdef) || + (point >= 0xd800 && point <= 0xdfff) { + return "", errors.New("invalid BMPString") + } + s = append(s, point) + value = value[2:] + } + + return string(utf16.Decode(s)), nil + case cryptobyte_asn1.IA5String: + s := string(value) + if isIA5String(s) != nil { + return "", errors.New("invalid IA5String") + } + return s, nil + case cryptobyte_asn1.Tag(asn1.TagNumericString): + for _, b := range value { + if !('0' <= b && b <= '9' || b == ' ') { + return "", errors.New("invalid NumericString") + } + } + return string(value), nil + } + return "", fmt.Errorf("unsupported string type: %v", tag) +} + +// parseName parses a DER encoded Name as defined in RFC 5280. We may +// want to export this function in the future for use in crypto/tls. +func parseName(raw cryptobyte.String) (*pkix.RDNSequence, error) { + if !raw.ReadASN1(&raw, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: invalid RDNSequence") + } + + var rdnSeq pkix.RDNSequence + for !raw.Empty() { + var rdnSet pkix.RelativeDistinguishedNameSET + var set cryptobyte.String + if !raw.ReadASN1(&set, cryptobyte_asn1.SET) { + return nil, errors.New("x509: invalid RDNSequence") + } + for !set.Empty() { + var atav cryptobyte.String + if !set.ReadASN1(&atav, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: invalid RDNSequence: invalid attribute") + } + var attr pkix.AttributeTypeAndValue + if !atav.ReadASN1ObjectIdentifier(&attr.Type) { + return nil, errors.New("x509: invalid RDNSequence: invalid attribute type") + } + var rawValue cryptobyte.String + var valueTag cryptobyte_asn1.Tag + if !atav.ReadAnyASN1(&rawValue, &valueTag) { + return nil, errors.New("x509: invalid RDNSequence: invalid attribute value") + } + var err error + attr.Value, err = parseASN1String(valueTag, rawValue) + if err != nil { + return nil, fmt.Errorf("x509: invalid RDNSequence: invalid attribute value: %s", err) + } + rdnSet = append(rdnSet, attr) + } + + rdnSeq = append(rdnSeq, rdnSet) + } + + return &rdnSeq, nil +} + +func parseAI(der cryptobyte.String) (pkix.AlgorithmIdentifier, error) { + ai := pkix.AlgorithmIdentifier{} + if !der.ReadASN1ObjectIdentifier(&ai.Algorithm) { + return ai, errors.New("x509: malformed OID") + } + if der.Empty() { + return ai, nil + } + var params cryptobyte.String + var tag cryptobyte_asn1.Tag + if !der.ReadAnyASN1Element(¶ms, &tag) { + return ai, errors.New("x509: malformed parameters") + } + ai.Parameters.Tag = int(tag) + ai.Parameters.FullBytes = params + return ai, nil +} + +func parseTime(der *cryptobyte.String) (time.Time, error) { + var t time.Time + switch { + case der.PeekASN1Tag(cryptobyte_asn1.UTCTime): + if !der.ReadASN1UTCTime(&t) { + return t, errors.New("x509: malformed UTCTime") + } + case der.PeekASN1Tag(cryptobyte_asn1.GeneralizedTime): + if !der.ReadASN1GeneralizedTime(&t) { + return t, errors.New("x509: malformed GeneralizedTime") + } + default: + return t, errors.New("x509: unsupported time format") + } + return t, nil +} + +func parseValidity(der cryptobyte.String) (time.Time, time.Time, error) { + notBefore, err := parseTime(&der) + if err != nil { + return time.Time{}, time.Time{}, err + } + notAfter, err := parseTime(&der) + if err != nil { + return time.Time{}, time.Time{}, err + } + + return notBefore, notAfter, nil +} + +func parseExtension(der cryptobyte.String) (pkix.Extension, error) { + var ext pkix.Extension + if !der.ReadASN1ObjectIdentifier(&ext.Id) { + return ext, errors.New("x509: malformed extension OID field") + } + if der.PeekASN1Tag(cryptobyte_asn1.BOOLEAN) { + if !der.ReadASN1Boolean(&ext.Critical) { + return ext, errors.New("x509: malformed extension critical field") + } + } + var val cryptobyte.String + if !der.ReadASN1(&val, cryptobyte_asn1.OCTET_STRING) { + return ext, errors.New("x509: malformed extension value field") + } + ext.Value = val + return ext, nil +} + +func parsePublicKey(keyData *publicKeyInfo) (any, error) { + oid := keyData.Algorithm.Algorithm + params := keyData.Algorithm.Parameters + data := keyData.PublicKey.RightAlign() + switch { + case oid.Equal(oidPublicKeyRSA): + // RSA public keys must have a NULL in the parameters. + // See RFC 3279, Section 2.3.1. + if !bytes.Equal(params.FullBytes, asn1.NullBytes) { + return nil, errors.New("x509: RSA key missing NULL parameters") + } + + der := cryptobyte.String(data) + p := &pkcs1PublicKey{N: new(big.Int)} + if !der.ReadASN1(&der, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: invalid RSA public key") + } + if !der.ReadASN1Integer(p.N) { + return nil, errors.New("x509: invalid RSA modulus") + } + if !der.ReadASN1Integer(&p.E) { + return nil, errors.New("x509: invalid RSA public exponent") + } + + if p.N.Sign() <= 0 { + return nil, errors.New("x509: RSA modulus is not a positive number") + } + if p.E <= 0 { + return nil, errors.New("x509: RSA public exponent is not a positive number") + } + + pub := &rsa.PublicKey{ + E: p.E, + N: p.N, + } + return pub, nil + case oid.Equal(oidPublicKeyECDSA): + paramsDer := cryptobyte.String(params.FullBytes) + namedCurveOID := new(asn1.ObjectIdentifier) + if !paramsDer.ReadASN1ObjectIdentifier(namedCurveOID) { + return nil, errors.New("x509: invalid ECDSA parameters") + } + namedCurve := namedCurveFromOID(*namedCurveOID) + if namedCurve == nil { + return nil, errors.New("x509: unsupported elliptic curve") + } + return ecdsa.ParseUncompressedPublicKey(namedCurve, data) + case oid.Equal(oidPublicKeyEd25519): + // RFC 8410, Section 3 + // > For all of the OIDs, the parameters MUST be absent. + if len(params.FullBytes) != 0 { + return nil, errors.New("x509: Ed25519 key encoded with illegal parameters") + } + if len(data) != ed25519.PublicKeySize { + return nil, errors.New("x509: wrong Ed25519 public key size") + } + return ed25519.PublicKey(data), nil + case oid.Equal(oidPublicKeyX25519): + // RFC 8410, Section 3 + // > For all of the OIDs, the parameters MUST be absent. + if len(params.FullBytes) != 0 { + return nil, errors.New("x509: X25519 key encoded with illegal parameters") + } + return ecdh.X25519().NewPublicKey(data) + case oid.Equal(oidPublicKeyDSA): + der := cryptobyte.String(data) + y := new(big.Int) + if !der.ReadASN1Integer(y) { + return nil, errors.New("x509: invalid DSA public key") + } + pub := &dsa.PublicKey{ + Y: y, + Parameters: dsa.Parameters{ + P: new(big.Int), + Q: new(big.Int), + G: new(big.Int), + }, + } + paramsDer := cryptobyte.String(params.FullBytes) + if !paramsDer.ReadASN1(¶msDer, cryptobyte_asn1.SEQUENCE) || + !paramsDer.ReadASN1Integer(pub.Parameters.P) || + !paramsDer.ReadASN1Integer(pub.Parameters.Q) || + !paramsDer.ReadASN1Integer(pub.Parameters.G) { + return nil, errors.New("x509: invalid DSA parameters") + } + if pub.Y.Sign() <= 0 || pub.Parameters.P.Sign() <= 0 || + pub.Parameters.Q.Sign() <= 0 || pub.Parameters.G.Sign() <= 0 { + return nil, errors.New("x509: zero or negative DSA parameter") + } + return pub, nil + default: + return nil, errors.New("x509: unknown public key algorithm") + } +} + +func parseKeyUsageExtension(der cryptobyte.String) (KeyUsage, error) { + var usageBits asn1.BitString + if !der.ReadASN1BitString(&usageBits) { + return 0, errors.New("x509: invalid key usage") + } + + var usage int + for i := 0; i < 9; i++ { + if usageBits.At(i) != 0 { + usage |= 1 << uint(i) + } + } + return KeyUsage(usage), nil +} + +func parseBasicConstraintsExtension(der cryptobyte.String) (bool, int, error) { + var isCA bool + if !der.ReadASN1(&der, cryptobyte_asn1.SEQUENCE) { + return false, 0, errors.New("x509: invalid basic constraints") + } + if der.PeekASN1Tag(cryptobyte_asn1.BOOLEAN) { + if !der.ReadASN1Boolean(&isCA) { + return false, 0, errors.New("x509: invalid basic constraints") + } + } + + maxPathLen := -1 + if der.PeekASN1Tag(cryptobyte_asn1.INTEGER) { + var mpl uint + if !der.ReadASN1Integer(&mpl) || mpl > math.MaxInt { + return false, 0, errors.New("x509: invalid basic constraints") + } + maxPathLen = int(mpl) + } + + return isCA, maxPathLen, nil +} + +func forEachSAN(der cryptobyte.String, callback func(tag int, data []byte) error) error { + if !der.ReadASN1(&der, cryptobyte_asn1.SEQUENCE) { + return errors.New("x509: invalid subject alternative names") + } + for !der.Empty() { + var san cryptobyte.String + var tag cryptobyte_asn1.Tag + if !der.ReadAnyASN1(&san, &tag) { + return errors.New("x509: invalid subject alternative name") + } + if err := callback(int(tag^0x80), san); err != nil { + return err + } + } + + return nil +} + +func parseSANExtension(der cryptobyte.String) (dnsNames, emailAddresses []string, ipAddresses []net.IP, uris []*url.URL, err error) { + err = forEachSAN(der, func(tag int, data []byte) error { + switch tag { + case nameTypeEmail: + email := string(data) + if err := isIA5String(email); err != nil { + return errors.New("x509: SAN rfc822Name is malformed") + } + emailAddresses = append(emailAddresses, email) + case nameTypeDNS: + name := string(data) + if err := isIA5String(name); err != nil { + return errors.New("x509: SAN dNSName is malformed") + } + dnsNames = append(dnsNames, string(name)) + case nameTypeURI: + uriStr := string(data) + if err := isIA5String(uriStr); err != nil { + return errors.New("x509: SAN uniformResourceIdentifier is malformed") + } + uri, err := url.Parse(uriStr) + if err != nil { + return fmt.Errorf("x509: cannot parse URI %q: %s", uriStr, err) + } + if len(uri.Host) > 0 && !domainNameValid(uri.Host, false) { + return fmt.Errorf("x509: cannot parse URI %q: invalid domain", uriStr) + } + uris = append(uris, uri) + case nameTypeIP: + switch len(data) { + case net.IPv4len, net.IPv6len: + ipAddresses = append(ipAddresses, data) + default: + return errors.New("x509: cannot parse IP address of length " + strconv.Itoa(len(data))) + } + } + + return nil + }) + + return +} + +func parseAuthorityKeyIdentifier(e pkix.Extension) ([]byte, error) { + // RFC 5280, Section 4.2.1.1 + if e.Critical { + // Conforming CAs MUST mark this extension as non-critical + return nil, errors.New("x509: authority key identifier incorrectly marked critical") + } + val := cryptobyte.String(e.Value) + var akid cryptobyte.String + if !val.ReadASN1(&akid, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: invalid authority key identifier") + } + if akid.PeekASN1Tag(cryptobyte_asn1.Tag(0).ContextSpecific()) { + if !akid.ReadASN1(&akid, cryptobyte_asn1.Tag(0).ContextSpecific()) { + return nil, errors.New("x509: invalid authority key identifier") + } + return akid, nil + } + return nil, nil +} + +func parseExtKeyUsageExtension(der cryptobyte.String) ([]ExtKeyUsage, []asn1.ObjectIdentifier, error) { + var extKeyUsages []ExtKeyUsage + var unknownUsages []asn1.ObjectIdentifier + if !der.ReadASN1(&der, cryptobyte_asn1.SEQUENCE) { + return nil, nil, errors.New("x509: invalid extended key usages") + } + for !der.Empty() { + var eku asn1.ObjectIdentifier + if !der.ReadASN1ObjectIdentifier(&eku) { + return nil, nil, errors.New("x509: invalid extended key usages") + } + if extKeyUsage, ok := extKeyUsageFromOID(eku); ok { + extKeyUsages = append(extKeyUsages, extKeyUsage) + } else { + unknownUsages = append(unknownUsages, eku) + } + } + return extKeyUsages, unknownUsages, nil +} + +func parseCertificatePoliciesExtension(der cryptobyte.String) ([]OID, error) { + var oids []OID + seenOIDs := map[string]bool{} + if !der.ReadASN1(&der, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: invalid certificate policies") + } + for !der.Empty() { + var cp cryptobyte.String + var OIDBytes cryptobyte.String + if !der.ReadASN1(&cp, cryptobyte_asn1.SEQUENCE) || !cp.ReadASN1(&OIDBytes, cryptobyte_asn1.OBJECT_IDENTIFIER) { + return nil, errors.New("x509: invalid certificate policies") + } + if seenOIDs[string(OIDBytes)] { + return nil, errors.New("x509: invalid certificate policies") + } + seenOIDs[string(OIDBytes)] = true + oid, ok := newOIDFromDER(OIDBytes) + if !ok { + return nil, errors.New("x509: invalid certificate policies") + } + oids = append(oids, oid) + } + return oids, nil +} + +// isValidIPMask reports whether mask consists of zero or more 1 bits, followed by zero bits. +func isValidIPMask(mask []byte) bool { + seenZero := false + + for _, b := range mask { + if seenZero { + if b != 0 { + return false + } + + continue + } + + switch b { + case 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe: + seenZero = true + case 0xff: + default: + return false + } + } + + return true +} + +func parseNameConstraintsExtension(out *Certificate, e pkix.Extension) (unhandled bool, err error) { + // RFC 5280, 4.2.1.10 + + // NameConstraints ::= SEQUENCE { + // permittedSubtrees [0] GeneralSubtrees OPTIONAL, + // excludedSubtrees [1] GeneralSubtrees OPTIONAL } + // + // GeneralSubtrees ::= SEQUENCE SIZE (1..MAX) OF GeneralSubtree + // + // GeneralSubtree ::= SEQUENCE { + // base GeneralName, + // minimum [0] BaseDistance DEFAULT 0, + // maximum [1] BaseDistance OPTIONAL } + // + // BaseDistance ::= INTEGER (0..MAX) + + outer := cryptobyte.String(e.Value) + var toplevel, permitted, excluded cryptobyte.String + var havePermitted, haveExcluded bool + if !outer.ReadASN1(&toplevel, cryptobyte_asn1.SEQUENCE) || + !outer.Empty() || + !toplevel.ReadOptionalASN1(&permitted, &havePermitted, cryptobyte_asn1.Tag(0).ContextSpecific().Constructed()) || + !toplevel.ReadOptionalASN1(&excluded, &haveExcluded, cryptobyte_asn1.Tag(1).ContextSpecific().Constructed()) || + !toplevel.Empty() { + return false, errors.New("x509: invalid NameConstraints extension") + } + + if !havePermitted && !haveExcluded || len(permitted) == 0 && len(excluded) == 0 { + // From RFC 5280, Section 4.2.1.10: + // “either the permittedSubtrees field + // or the excludedSubtrees MUST be + // present” + return false, errors.New("x509: empty name constraints extension") + } + + getValues := func(subtrees cryptobyte.String) (dnsNames []string, ips []*net.IPNet, emails, uriDomains []string, err error) { + for !subtrees.Empty() { + var seq, value cryptobyte.String + var tag cryptobyte_asn1.Tag + if !subtrees.ReadASN1(&seq, cryptobyte_asn1.SEQUENCE) || + !seq.ReadAnyASN1(&value, &tag) { + return nil, nil, nil, nil, fmt.Errorf("x509: invalid NameConstraints extension") + } + + var ( + dnsTag = cryptobyte_asn1.Tag(2).ContextSpecific() + emailTag = cryptobyte_asn1.Tag(1).ContextSpecific() + ipTag = cryptobyte_asn1.Tag(7).ContextSpecific() + uriTag = cryptobyte_asn1.Tag(6).ContextSpecific() + ) + + switch tag { + case dnsTag: + domain := string(value) + if err := isIA5String(domain); err != nil { + return nil, nil, nil, nil, errors.New("x509: invalid constraint value: " + err.Error()) + } + + if !domainNameValid(domain, true) { + return nil, nil, nil, nil, fmt.Errorf("x509: failed to parse dnsName constraint %q", domain) + } + dnsNames = append(dnsNames, domain) + + case ipTag: + l := len(value) + var ip, mask []byte + + switch l { + case 8: + ip = value[:4] + mask = value[4:] + + case 32: + ip = value[:16] + mask = value[16:] + + default: + return nil, nil, nil, nil, fmt.Errorf("x509: IP constraint contained value of length %d", l) + } + + if !isValidIPMask(mask) { + return nil, nil, nil, nil, fmt.Errorf("x509: IP constraint contained invalid mask %x", mask) + } + + ips = append(ips, &net.IPNet{IP: net.IP(ip), Mask: net.IPMask(mask)}) + + case emailTag: + constraint := string(value) + if err := isIA5String(constraint); err != nil { + return nil, nil, nil, nil, errors.New("x509: invalid constraint value: " + err.Error()) + } + + // If the constraint contains an @ then + // it specifies an exact mailbox name. + if strings.Contains(constraint, "@") { + if _, ok := parseRFC2821Mailbox(constraint); !ok { + return nil, nil, nil, nil, fmt.Errorf("x509: failed to parse rfc822Name constraint %q", constraint) + } + } else { + if !domainNameValid(constraint, true) { + return nil, nil, nil, nil, fmt.Errorf("x509: failed to parse rfc822Name constraint %q", constraint) + } + } + emails = append(emails, constraint) + + case uriTag: + domain := string(value) + if err := isIA5String(domain); err != nil { + return nil, nil, nil, nil, errors.New("x509: invalid constraint value: " + err.Error()) + } + + if net.ParseIP(domain) != nil { + return nil, nil, nil, nil, fmt.Errorf("x509: failed to parse URI constraint %q: cannot be IP address", domain) + } + + if !domainNameValid(domain, true) { + return nil, nil, nil, nil, fmt.Errorf("x509: failed to parse URI constraint %q", domain) + } + uriDomains = append(uriDomains, domain) + + default: + unhandled = true + } + } + + return dnsNames, ips, emails, uriDomains, nil + } + + if out.PermittedDNSDomains, out.PermittedIPRanges, out.PermittedEmailAddresses, out.PermittedURIDomains, err = getValues(permitted); err != nil { + return false, err + } + if out.ExcludedDNSDomains, out.ExcludedIPRanges, out.ExcludedEmailAddresses, out.ExcludedURIDomains, err = getValues(excluded); err != nil { + return false, err + } + out.PermittedDNSDomainsCritical = e.Critical + + return unhandled, nil +} + +func processExtensions(out *Certificate) error { + var err error + for _, e := range out.Extensions { + unhandled := false + + if len(e.Id) == 4 && e.Id[0] == 2 && e.Id[1] == 5 && e.Id[2] == 29 { + switch e.Id[3] { + case 15: + out.KeyUsage, err = parseKeyUsageExtension(e.Value) + if err != nil { + return err + } + case 19: + out.IsCA, out.MaxPathLen, err = parseBasicConstraintsExtension(e.Value) + if err != nil { + return err + } + out.BasicConstraintsValid = true + out.MaxPathLenZero = out.MaxPathLen == 0 + case 17: + out.DNSNames, out.EmailAddresses, out.IPAddresses, out.URIs, err = parseSANExtension(e.Value) + if err != nil { + return err + } + + if len(out.DNSNames) == 0 && len(out.EmailAddresses) == 0 && len(out.IPAddresses) == 0 && len(out.URIs) == 0 { + // If we didn't parse anything then we do the critical check, below. + unhandled = true + } + + case 30: + unhandled, err = parseNameConstraintsExtension(out, e) + if err != nil { + return err + } + + case 31: + // RFC 5280, 4.2.1.13 + + // CRLDistributionPoints ::= SEQUENCE SIZE (1..MAX) OF DistributionPoint + // + // DistributionPoint ::= SEQUENCE { + // distributionPoint [0] DistributionPointName OPTIONAL, + // reasons [1] ReasonFlags OPTIONAL, + // cRLIssuer [2] GeneralNames OPTIONAL } + // + // DistributionPointName ::= CHOICE { + // fullName [0] GeneralNames, + // nameRelativeToCRLIssuer [1] RelativeDistinguishedName } + val := cryptobyte.String(e.Value) + if !val.ReadASN1(&val, cryptobyte_asn1.SEQUENCE) { + return errors.New("x509: invalid CRL distribution points") + } + for !val.Empty() { + var dpDER cryptobyte.String + if !val.ReadASN1(&dpDER, cryptobyte_asn1.SEQUENCE) { + return errors.New("x509: invalid CRL distribution point") + } + var dpNameDER cryptobyte.String + var dpNamePresent bool + if !dpDER.ReadOptionalASN1(&dpNameDER, &dpNamePresent, cryptobyte_asn1.Tag(0).Constructed().ContextSpecific()) { + return errors.New("x509: invalid CRL distribution point") + } + if !dpNamePresent { + continue + } + if !dpNameDER.ReadASN1(&dpNameDER, cryptobyte_asn1.Tag(0).Constructed().ContextSpecific()) { + return errors.New("x509: invalid CRL distribution point") + } + for !dpNameDER.Empty() { + if !dpNameDER.PeekASN1Tag(cryptobyte_asn1.Tag(6).ContextSpecific()) { + break + } + var uri cryptobyte.String + if !dpNameDER.ReadASN1(&uri, cryptobyte_asn1.Tag(6).ContextSpecific()) { + return errors.New("x509: invalid CRL distribution point") + } + out.CRLDistributionPoints = append(out.CRLDistributionPoints, string(uri)) + } + } + + case 35: + out.AuthorityKeyId, err = parseAuthorityKeyIdentifier(e) + if err != nil { + return err + } + case 36: + val := cryptobyte.String(e.Value) + if !val.ReadASN1(&val, cryptobyte_asn1.SEQUENCE) { + return errors.New("x509: invalid policy constraints extension") + } + if val.PeekASN1Tag(cryptobyte_asn1.Tag(0).ContextSpecific()) { + var v int64 + if !val.ReadASN1Int64WithTag(&v, cryptobyte_asn1.Tag(0).ContextSpecific()) { + return errors.New("x509: invalid policy constraints extension") + } + out.RequireExplicitPolicy = int(v) + // Check for overflow. + if int64(out.RequireExplicitPolicy) != v { + return errors.New("x509: policy constraints requireExplicitPolicy field overflows int") + } + out.RequireExplicitPolicyZero = out.RequireExplicitPolicy == 0 + } + if val.PeekASN1Tag(cryptobyte_asn1.Tag(1).ContextSpecific()) { + var v int64 + if !val.ReadASN1Int64WithTag(&v, cryptobyte_asn1.Tag(1).ContextSpecific()) { + return errors.New("x509: invalid policy constraints extension") + } + out.InhibitPolicyMapping = int(v) + // Check for overflow. + if int64(out.InhibitPolicyMapping) != v { + return errors.New("x509: policy constraints inhibitPolicyMapping field overflows int") + } + out.InhibitPolicyMappingZero = out.InhibitPolicyMapping == 0 + } + case 37: + out.ExtKeyUsage, out.UnknownExtKeyUsage, err = parseExtKeyUsageExtension(e.Value) + if err != nil { + return err + } + case 14: // RFC 5280, 4.2.1.2 + if e.Critical { + // Conforming CAs MUST mark this extension as non-critical + return errors.New("x509: subject key identifier incorrectly marked critical") + } + val := cryptobyte.String(e.Value) + var skid cryptobyte.String + if !val.ReadASN1(&skid, cryptobyte_asn1.OCTET_STRING) { + return errors.New("x509: invalid subject key identifier") + } + out.SubjectKeyId = skid + case 32: + out.Policies, err = parseCertificatePoliciesExtension(e.Value) + if err != nil { + return err + } + out.PolicyIdentifiers = make([]asn1.ObjectIdentifier, 0, len(out.Policies)) + for _, oid := range out.Policies { + if oid, ok := oid.toASN1OID(); ok { + out.PolicyIdentifiers = append(out.PolicyIdentifiers, oid) + } + } + case 33: + val := cryptobyte.String(e.Value) + if !val.ReadASN1(&val, cryptobyte_asn1.SEQUENCE) { + return errors.New("x509: invalid policy mappings extension") + } + for !val.Empty() { + var s cryptobyte.String + var issuer, subject cryptobyte.String + if !val.ReadASN1(&s, cryptobyte_asn1.SEQUENCE) || + !s.ReadASN1(&issuer, cryptobyte_asn1.OBJECT_IDENTIFIER) || + !s.ReadASN1(&subject, cryptobyte_asn1.OBJECT_IDENTIFIER) { + return errors.New("x509: invalid policy mappings extension") + } + out.PolicyMappings = append(out.PolicyMappings, PolicyMapping{OID{issuer}, OID{subject}}) + } + case 54: + val := cryptobyte.String(e.Value) + if !val.ReadASN1Integer(&out.InhibitAnyPolicy) { + return errors.New("x509: invalid inhibit any policy extension") + } + out.InhibitAnyPolicyZero = out.InhibitAnyPolicy == 0 + default: + // Unknown extensions are recorded if critical. + unhandled = true + } + } else if e.Id.Equal(oidExtensionAuthorityInfoAccess) { + // RFC 5280 4.2.2.1: Authority Information Access + if e.Critical { + // Conforming CAs MUST mark this extension as non-critical + return errors.New("x509: authority info access incorrectly marked critical") + } + val := cryptobyte.String(e.Value) + if !val.ReadASN1(&val, cryptobyte_asn1.SEQUENCE) { + return errors.New("x509: invalid authority info access") + } + for !val.Empty() { + var aiaDER cryptobyte.String + if !val.ReadASN1(&aiaDER, cryptobyte_asn1.SEQUENCE) { + return errors.New("x509: invalid authority info access") + } + var method asn1.ObjectIdentifier + if !aiaDER.ReadASN1ObjectIdentifier(&method) { + return errors.New("x509: invalid authority info access") + } + if !aiaDER.PeekASN1Tag(cryptobyte_asn1.Tag(6).ContextSpecific()) { + continue + } + if !aiaDER.ReadASN1(&aiaDER, cryptobyte_asn1.Tag(6).ContextSpecific()) { + return errors.New("x509: invalid authority info access") + } + switch { + case method.Equal(oidAuthorityInfoAccessOcsp): + out.OCSPServer = append(out.OCSPServer, string(aiaDER)) + case method.Equal(oidAuthorityInfoAccessIssuers): + out.IssuingCertificateURL = append(out.IssuingCertificateURL, string(aiaDER)) + } + } + } else { + // Unknown extensions are recorded if critical. + unhandled = true + } + + if e.Critical && unhandled { + out.UnhandledCriticalExtensions = append(out.UnhandledCriticalExtensions, e.Id) + } + } + + return nil +} + +var x509negativeserial = godebug.New("x509negativeserial") + +func parseCertificate(der []byte) (*Certificate, error) { + cert := &Certificate{} + + input := cryptobyte.String(der) + // we read the SEQUENCE including length and tag bytes so that + // we can populate Certificate.Raw, before unwrapping the + // SEQUENCE so it can be operated on + if !input.ReadASN1Element(&input, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed certificate") + } + cert.Raw = input + if !input.ReadASN1(&input, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed certificate") + } + + var tbs cryptobyte.String + // do the same trick again as above to extract the raw + // bytes for Certificate.RawTBSCertificate + if !input.ReadASN1Element(&tbs, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed tbs certificate") + } + cert.RawTBSCertificate = tbs + if !tbs.ReadASN1(&tbs, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed tbs certificate") + } + + if !tbs.ReadOptionalASN1Integer(&cert.Version, cryptobyte_asn1.Tag(0).Constructed().ContextSpecific(), 0) { + return nil, errors.New("x509: malformed version") + } + if cert.Version < 0 { + return nil, errors.New("x509: malformed version") + } + // for backwards compat reasons Version is one-indexed, + // rather than zero-indexed as defined in 5280 + cert.Version++ + if cert.Version > 3 { + return nil, errors.New("x509: invalid version") + } + + serial := new(big.Int) + if !tbs.ReadASN1Integer(serial) { + return nil, errors.New("x509: malformed serial number") + } + if serial.Sign() == -1 { + if x509negativeserial.Value() != "1" { + return nil, errors.New("x509: negative serial number") + } else { + x509negativeserial.IncNonDefault() + } + } + cert.SerialNumber = serial + + var sigAISeq cryptobyte.String + if !tbs.ReadASN1(&sigAISeq, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed signature algorithm identifier") + } + // Before parsing the inner algorithm identifier, extract + // the outer algorithm identifier and make sure that they + // match. + var outerSigAISeq cryptobyte.String + if !input.ReadASN1(&outerSigAISeq, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed algorithm identifier") + } + if !bytes.Equal(outerSigAISeq, sigAISeq) { + return nil, errors.New("x509: inner and outer signature algorithm identifiers don't match") + } + sigAI, err := parseAI(sigAISeq) + if err != nil { + return nil, err + } + cert.SignatureAlgorithm = getSignatureAlgorithmFromAI(sigAI) + + var issuerSeq cryptobyte.String + if !tbs.ReadASN1Element(&issuerSeq, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed issuer") + } + cert.RawIssuer = issuerSeq + issuerRDNs, err := parseName(issuerSeq) + if err != nil { + return nil, err + } + cert.Issuer.FillFromRDNSequence(issuerRDNs) + + var validity cryptobyte.String + if !tbs.ReadASN1(&validity, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed validity") + } + cert.NotBefore, cert.NotAfter, err = parseValidity(validity) + if err != nil { + return nil, err + } + + var subjectSeq cryptobyte.String + if !tbs.ReadASN1Element(&subjectSeq, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed issuer") + } + cert.RawSubject = subjectSeq + subjectRDNs, err := parseName(subjectSeq) + if err != nil { + return nil, err + } + cert.Subject.FillFromRDNSequence(subjectRDNs) + + var spki cryptobyte.String + if !tbs.ReadASN1Element(&spki, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed spki") + } + cert.RawSubjectPublicKeyInfo = spki + if !spki.ReadASN1(&spki, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed spki") + } + var pkAISeq cryptobyte.String + if !spki.ReadASN1(&pkAISeq, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed public key algorithm identifier") + } + pkAI, err := parseAI(pkAISeq) + if err != nil { + return nil, err + } + cert.PublicKeyAlgorithm = getPublicKeyAlgorithmFromOID(pkAI.Algorithm) + var spk asn1.BitString + if !spki.ReadASN1BitString(&spk) { + return nil, errors.New("x509: malformed subjectPublicKey") + } + if cert.PublicKeyAlgorithm != UnknownPublicKeyAlgorithm { + cert.PublicKey, err = parsePublicKey(&publicKeyInfo{ + Algorithm: pkAI, + PublicKey: spk, + }) + if err != nil { + return nil, err + } + } + + if cert.Version > 1 { + if !tbs.SkipOptionalASN1(cryptobyte_asn1.Tag(1).ContextSpecific()) { + return nil, errors.New("x509: malformed issuerUniqueID") + } + if !tbs.SkipOptionalASN1(cryptobyte_asn1.Tag(2).ContextSpecific()) { + return nil, errors.New("x509: malformed subjectUniqueID") + } + if cert.Version == 3 { + var extensions cryptobyte.String + var present bool + if !tbs.ReadOptionalASN1(&extensions, &present, cryptobyte_asn1.Tag(3).Constructed().ContextSpecific()) { + return nil, errors.New("x509: malformed extensions") + } + if present { + seenExts := make(map[string]bool) + if !extensions.ReadASN1(&extensions, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed extensions") + } + for !extensions.Empty() { + var extension cryptobyte.String + if !extensions.ReadASN1(&extension, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed extension") + } + ext, err := parseExtension(extension) + if err != nil { + return nil, err + } + oidStr := ext.Id.String() + if seenExts[oidStr] { + return nil, fmt.Errorf("x509: certificate contains duplicate extension with OID %q", oidStr) + } + seenExts[oidStr] = true + cert.Extensions = append(cert.Extensions, ext) + } + err = processExtensions(cert) + if err != nil { + return nil, err + } + } + } + } + + var signature asn1.BitString + if !input.ReadASN1BitString(&signature) { + return nil, errors.New("x509: malformed signature") + } + cert.Signature = signature.RightAlign() + + return cert, nil +} + +// ParseCertificate parses a single certificate from the given ASN.1 DER data. +// +// Before Go 1.23, ParseCertificate accepted certificates with negative serial +// numbers. This behavior can be restored by including "x509negativeserial=1" in +// the GODEBUG environment variable. +func ParseCertificate(der []byte) (*Certificate, error) { + cert, err := parseCertificate(der) + if err != nil { + return nil, err + } + if len(der) != len(cert.Raw) { + return nil, errors.New("x509: trailing data") + } + return cert, nil +} + +// ParseCertificates parses one or more certificates from the given ASN.1 DER +// data. The certificates must be concatenated with no intermediate padding. +func ParseCertificates(der []byte) ([]*Certificate, error) { + var certs []*Certificate + for len(der) > 0 { + cert, err := parseCertificate(der) + if err != nil { + return nil, err + } + certs = append(certs, cert) + der = der[len(cert.Raw):] + } + return certs, nil +} + +// The X.509 standards confusingly 1-indexed the version names, but 0-indexed +// the actual encoded version, so the version for X.509v2 is 1. +const x509v2Version = 1 + +// ParseRevocationList parses a X509 v2 [Certificate] Revocation List from the given +// ASN.1 DER data. +func ParseRevocationList(der []byte) (*RevocationList, error) { + rl := &RevocationList{} + + input := cryptobyte.String(der) + // we read the SEQUENCE including length and tag bytes so that + // we can populate RevocationList.Raw, before unwrapping the + // SEQUENCE so it can be operated on + if !input.ReadASN1Element(&input, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed crl") + } + rl.Raw = input + if !input.ReadASN1(&input, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed crl") + } + + var tbs cryptobyte.String + // do the same trick again as above to extract the raw + // bytes for Certificate.RawTBSCertificate + if !input.ReadASN1Element(&tbs, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed tbs crl") + } + rl.RawTBSRevocationList = tbs + if !tbs.ReadASN1(&tbs, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed tbs crl") + } + + var version int + if !tbs.PeekASN1Tag(cryptobyte_asn1.INTEGER) { + return nil, errors.New("x509: unsupported crl version") + } + if !tbs.ReadASN1Integer(&version) { + return nil, errors.New("x509: malformed crl") + } + if version != x509v2Version { + return nil, fmt.Errorf("x509: unsupported crl version: %d", version) + } + + var sigAISeq cryptobyte.String + if !tbs.ReadASN1(&sigAISeq, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed signature algorithm identifier") + } + // Before parsing the inner algorithm identifier, extract + // the outer algorithm identifier and make sure that they + // match. + var outerSigAISeq cryptobyte.String + if !input.ReadASN1(&outerSigAISeq, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed algorithm identifier") + } + if !bytes.Equal(outerSigAISeq, sigAISeq) { + return nil, errors.New("x509: inner and outer signature algorithm identifiers don't match") + } + sigAI, err := parseAI(sigAISeq) + if err != nil { + return nil, err + } + rl.SignatureAlgorithm = getSignatureAlgorithmFromAI(sigAI) + + var signature asn1.BitString + if !input.ReadASN1BitString(&signature) { + return nil, errors.New("x509: malformed signature") + } + rl.Signature = signature.RightAlign() + + var issuerSeq cryptobyte.String + if !tbs.ReadASN1Element(&issuerSeq, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed issuer") + } + rl.RawIssuer = issuerSeq + issuerRDNs, err := parseName(issuerSeq) + if err != nil { + return nil, err + } + rl.Issuer.FillFromRDNSequence(issuerRDNs) + + rl.ThisUpdate, err = parseTime(&tbs) + if err != nil { + return nil, err + } + if tbs.PeekASN1Tag(cryptobyte_asn1.GeneralizedTime) || tbs.PeekASN1Tag(cryptobyte_asn1.UTCTime) { + rl.NextUpdate, err = parseTime(&tbs) + if err != nil { + return nil, err + } + } + + if tbs.PeekASN1Tag(cryptobyte_asn1.SEQUENCE) { + var revokedSeq cryptobyte.String + if !tbs.ReadASN1(&revokedSeq, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed crl") + } + for !revokedSeq.Empty() { + rce := RevocationListEntry{} + + var certSeq cryptobyte.String + if !revokedSeq.ReadASN1Element(&certSeq, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed crl") + } + rce.Raw = certSeq + if !certSeq.ReadASN1(&certSeq, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed crl") + } + + rce.SerialNumber = new(big.Int) + if !certSeq.ReadASN1Integer(rce.SerialNumber) { + return nil, errors.New("x509: malformed serial number") + } + rce.RevocationTime, err = parseTime(&certSeq) + if err != nil { + return nil, err + } + var extensions cryptobyte.String + var present bool + if !certSeq.ReadOptionalASN1(&extensions, &present, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed extensions") + } + if present { + for !extensions.Empty() { + var extension cryptobyte.String + if !extensions.ReadASN1(&extension, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed extension") + } + ext, err := parseExtension(extension) + if err != nil { + return nil, err + } + if ext.Id.Equal(oidExtensionReasonCode) { + val := cryptobyte.String(ext.Value) + if !val.ReadASN1Enum(&rce.ReasonCode) { + return nil, fmt.Errorf("x509: malformed reasonCode extension") + } + } + rce.Extensions = append(rce.Extensions, ext) + } + } + + rl.RevokedCertificateEntries = append(rl.RevokedCertificateEntries, rce) + rcDeprecated := pkix.RevokedCertificate{ + SerialNumber: rce.SerialNumber, + RevocationTime: rce.RevocationTime, + Extensions: rce.Extensions, + } + rl.RevokedCertificates = append(rl.RevokedCertificates, rcDeprecated) + } + } + + var extensions cryptobyte.String + var present bool + if !tbs.ReadOptionalASN1(&extensions, &present, cryptobyte_asn1.Tag(0).Constructed().ContextSpecific()) { + return nil, errors.New("x509: malformed extensions") + } + if present { + if !extensions.ReadASN1(&extensions, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed extensions") + } + for !extensions.Empty() { + var extension cryptobyte.String + if !extensions.ReadASN1(&extension, cryptobyte_asn1.SEQUENCE) { + return nil, errors.New("x509: malformed extension") + } + ext, err := parseExtension(extension) + if err != nil { + return nil, err + } + if ext.Id.Equal(oidExtensionAuthorityKeyId) { + rl.AuthorityKeyId, err = parseAuthorityKeyIdentifier(ext) + if err != nil { + return nil, err + } + } else if ext.Id.Equal(oidExtensionCRLNumber) { + value := cryptobyte.String(ext.Value) + rl.Number = new(big.Int) + if !value.ReadASN1Integer(rl.Number) { + return nil, errors.New("x509: malformed crl number") + } + } + rl.Extensions = append(rl.Extensions, ext) + } + } + + return rl, nil +} + +// domainNameValid is an alloc-less version of the checks that +// domainToReverseLabels does. +func domainNameValid(s string, constraint bool) bool { + // TODO(#75835): This function omits a number of checks which we + // really should be doing to enforce that domain names are valid names per + // RFC 1034. We previously enabled these checks, but this broke a + // significant number of certificates we previously considered valid, and we + // happily create via CreateCertificate (et al). We should enable these + // checks, but will need to gate them behind a GODEBUG. + // + // I have left the checks we previously enabled, noted with "TODO(#75835)" so + // that we can easily re-enable them once we unbreak everyone. + + // TODO(#75835): this should only be true for constraints. + if len(s) == 0 { + return true + } + + // Do not allow trailing period (FQDN format is not allowed in SANs or + // constraints). + if s[len(s)-1] == '.' { + return false + } + + // TODO(#75835): domains must have at least one label, cannot have + // a leading empty label, and cannot be longer than 253 characters. + // if len(s) == 0 || (!constraint && s[0] == '.') || len(s) > 253 { + // return false + // } + + lastDot := -1 + if constraint && s[0] == '.' { + s = s[1:] + } + + for i := 0; i <= len(s); i++ { + if i < len(s) && (s[i] < 33 || s[i] > 126) { + // Invalid character. + return false + } + if i == len(s) || s[i] == '.' { + labelLen := i + if lastDot >= 0 { + labelLen -= lastDot + 1 + } + if labelLen == 0 { + return false + } + // TODO(#75835): labels cannot be longer than 63 characters. + // if labelLen > 63 { + // return false + // } + lastDot = i + } + } + + return true +} diff --git a/go/src/crypto/x509/parser_test.go b/go/src/crypto/x509/parser_test.go new file mode 100644 index 0000000000000000000000000000000000000000..d53b805b786990b1cdc34b1c2606ead22a159d01 --- /dev/null +++ b/go/src/crypto/x509/parser_test.go @@ -0,0 +1,360 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "encoding/asn1" + "encoding/pem" + "os" + "strings" + "testing" + + cryptobyte_asn1 "golang.org/x/crypto/cryptobyte/asn1" +) + +func TestParseASN1String(t *testing.T) { + tests := []struct { + name string + tag cryptobyte_asn1.Tag + value []byte + expected string + expectedErr string + }{ + { + name: "T61String", + tag: cryptobyte_asn1.T61String, + value: []byte{0xbf, 0x61, 0x3f}, + expected: string("¿a?"), + }, + { + name: "PrintableString", + tag: cryptobyte_asn1.PrintableString, + value: []byte{80, 81, 82}, + expected: string("PQR"), + }, + { + name: "PrintableString (invalid)", + tag: cryptobyte_asn1.PrintableString, + value: []byte{1, 2, 3}, + expectedErr: "invalid PrintableString", + }, + { + name: "UTF8String", + tag: cryptobyte_asn1.UTF8String, + value: []byte{80, 81, 82}, + expected: string("PQR"), + }, + { + name: "UTF8String (invalid)", + tag: cryptobyte_asn1.UTF8String, + value: []byte{255}, + expectedErr: "invalid UTF-8 string", + }, + { + name: "BMPString", + tag: cryptobyte_asn1.Tag(asn1.TagBMPString), + value: []byte{80, 81}, + expected: string("偑"), + }, + { + name: "BMPString (invalid length)", + tag: cryptobyte_asn1.Tag(asn1.TagBMPString), + value: []byte{255}, + expectedErr: "invalid BMPString", + }, + { + name: "BMPString (invalid surrogate)", + tag: cryptobyte_asn1.Tag(asn1.TagBMPString), + value: []byte{80, 81, 216, 1}, + expectedErr: "invalid BMPString", + }, + { + name: "BMPString (invalid noncharacter 0xfdd1)", + tag: cryptobyte_asn1.Tag(asn1.TagBMPString), + value: []byte{80, 81, 253, 209}, + expectedErr: "invalid BMPString", + }, + { + name: "BMPString (invalid noncharacter 0xffff)", + tag: cryptobyte_asn1.Tag(asn1.TagBMPString), + value: []byte{80, 81, 255, 255}, + expectedErr: "invalid BMPString", + }, + { + name: "BMPString (invalid noncharacter 0xfffe)", + tag: cryptobyte_asn1.Tag(asn1.TagBMPString), + value: []byte{80, 81, 255, 254}, + expectedErr: "invalid BMPString", + }, + { + name: "IA5String", + tag: cryptobyte_asn1.IA5String, + value: []byte{80, 81}, + expected: string("PQ"), + }, + { + name: "IA5String (invalid)", + tag: cryptobyte_asn1.IA5String, + value: []byte{255}, + expectedErr: "invalid IA5String", + }, + { + name: "NumericString", + tag: cryptobyte_asn1.Tag(asn1.TagNumericString), + value: []byte{49, 50}, + expected: string("12"), + }, + { + name: "NumericString (invalid)", + tag: cryptobyte_asn1.Tag(asn1.TagNumericString), + value: []byte{80}, + expectedErr: "invalid NumericString", + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + out, err := parseASN1String(tc.tag, tc.value) + if err != nil && err.Error() != tc.expectedErr { + t.Fatalf("parseASN1String returned unexpected error: got %q, want %q", err, tc.expectedErr) + } else if err == nil && tc.expectedErr != "" { + t.Fatalf("parseASN1String didn't fail, expected: %s", tc.expectedErr) + } + if out != tc.expected { + t.Fatalf("parseASN1String returned unexpected value: got %q, want %q", out, tc.expected) + } + }) + } +} + +const policyPEM = `-----BEGIN CERTIFICATE----- +MIIGeDCCBWCgAwIBAgIUED9KQBi0ScBDoufB2mgAJ63G5uIwDQYJKoZIhvcNAQEL +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UBvSc7+s9iQz9d/iRuAebrYu ++eqUlJ2lsjS1U8qyPmlH+spfPNbAEQEsuP32Aw== +-----END CERTIFICATE----- +` + +func TestPolicyParse(t *testing.T) { + b, _ := pem.Decode([]byte(policyPEM)) + c, err := ParseCertificate(b.Bytes) + if err != nil { + t.Fatal(err) + } + if len(c.Policies) != 9 { + t.Errorf("unexpected number of policies: got %d, want %d", len(c.Policies), 9) + } + if len(c.PolicyMappings) != 9 { + t.Errorf("unexpected number of policy mappings: got %d, want %d", len(c.PolicyMappings), 9) + } + if !c.RequireExplicitPolicyZero { + t.Error("expected RequireExplicitPolicyZero to be set") + } + if !c.InhibitPolicyMappingZero { + t.Error("expected InhibitPolicyMappingZero to be set") + } + if !c.InhibitAnyPolicyZero { + t.Error("expected InhibitAnyPolicyZero to be set") + } +} + +func TestParsePolicies(t *testing.T) { + for _, tc := range []string{ + "testdata/policy_leaf_duplicate.pem", + "testdata/policy_leaf_invalid.pem", + } { + t.Run(tc, func(t *testing.T) { + b, err := os.ReadFile(tc) + if err != nil { + t.Fatal(err) + } + p, _ := pem.Decode(b) + _, err = ParseCertificate(p.Bytes) + if err == nil { + t.Error("parsing should've failed") + } + }) + } +} + +func TestParseCertificateNegativeMaxPathLength(t *testing.T) { + certs := []string{ + // Certificate with MaxPathLen set to -1. + ` +-----BEGIN CERTIFICATE----- +MIIByTCCATKgAwIBAgIBATANBgkqhkiG9w0BAQsFADAPMQ0wCwYDVQQDEwRURVNU +MB4XDTcwMDEwMTAwMTY0MFoXDTcwMDEwMjAzNDY0MFowDzENMAsGA1UEAxMEVEVT +VDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAsaHglFuSicTT8TKfipgsSi3N +Wb/TcvuAhanFF1VGB+vS95kO7yFqyfRgX3GgOwT0KlJVsVjPjghEGR9RGTSLqkTD +UFbiBgm8+VEPMOrUtIHIHXhl+ye44AkOEStxfz7gjN/EAS2h8ffPKhvDTHOlShKw +Y3LQlxR0LdeJXq3eSqUCAwEAAaM1MDMwEgYDVR0TAQH/BAgwBgEB/wIB/zAdBgNV +HQ4EFgQUrbrk0tqQAEsce8uYifP0BIVhuFAwDQYJKoZIhvcNAQELBQADgYEAIkhV +ZBj1ThT+eyh50XsoU570NUysTg3Nj/3lbkEolzdcE+wu0CPXvgxLRM6Y62u1ey82 +8d5VQHstzF4dXgc3W+O9UySa+CKdcHx/q7o7seOGXdysT0IJtAY3w66mFkuF7PIn +y9b7M5t6pmWjb7N0QqGuWeNqi4ZvS8gLKmVEgGY= +-----END CERTIFICATE----- +`, + // Certificate with MaxPathLen set to -2. + ` +-----BEGIN CERTIFICATE----- +MIIByTCCATKgAwIBAgIBATANBgkqhkiG9w0BAQsFADAPMQ0wCwYDVQQDEwRURVNU +MB4XDTcwMDEwMTAwMTY0MFoXDTcwMDEwMjAzNDY0MFowDzENMAsGA1UEAxMEVEVT +VDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAsaHglFuSicTT8TKfipgsSi3N +Wb/TcvuAhanFF1VGB+vS95kO7yFqyfRgX3GgOwT0KlJVsVjPjghEGR9RGTSLqkTD +UFbiBgm8+VEPMOrUtIHIHXhl+ye44AkOEStxfz7gjN/EAS2h8ffPKhvDTHOlShKw +Y3LQlxR0LdeJXq3eSqUCAwEAAaM1MDMwEgYDVR0TAQH/BAgwBgEB/wIB/jAdBgNV +HQ4EFgQUrbrk0tqQAEsce8uYifP0BIVhuFAwDQYJKoZIhvcNAQELBQADgYEAGjIr +YGQc7Ods+BuKck7p+vpAMONM8SLEuUtKorCP3ecsO51MoA4/niLbgMHaOGNHwzMp +ajg0zLbY0Dj6Ml0VZ+lS3rjgTEhYXc626eZkoQqgUzL1jhe3S0ZbSxxmHMBKjJFl +d5l1tRhScKu2NBgm74nYmJxJYgvuTA38wGhRrGU= +-----END CERTIFICATE----- +`, + } + + for _, cert := range certs { + b, _ := pem.Decode([]byte(cert)) + _, err := ParseCertificate(b.Bytes) + if err == nil || err.Error() != "x509: invalid basic constraints" { + t.Errorf(`ParseCertificate() = %v; want = "x509: invalid basic constraints"`, err) + } + } +} + +func TestDomainNameValid(t *testing.T) { + for _, tc := range []struct { + name string + dnsName string + constraint bool + valid bool + }{ + // TODO(#75835): these tests are for stricter name validation, which we + // had to disable. Once we reenable these strict checks, behind a + // GODEBUG, we should add them back in. + // {"empty name, name", "", false, false}, + // {"254 char label, name", strings.Repeat("a.a", 84) + "aaa", false, false}, + // {"254 char label, constraint", strings.Repeat("a.a", 84) + "aaa", true, false}, + // {"253 char label, name", strings.Repeat("a.a", 84) + "aa", false, false}, + // {"253 char label, constraint", strings.Repeat("a.a", 84) + "aa", true, false}, + // {"64 char single label, name", strings.Repeat("a", 64), false, false}, + // {"64 char single label, constraint", strings.Repeat("a", 64), true, false}, + // {"64 char label, name", "a." + strings.Repeat("a", 64), false, false}, + // {"64 char label, constraint", "a." + strings.Repeat("a", 64), true, false}, + + // TODO(#75835): these are the inverse of the tests above, they should be removed + // once the strict checking is enabled. + {"254 char label, name", strings.Repeat("a.a", 84) + "aaa", false, true}, + {"254 char label, constraint", strings.Repeat("a.a", 84) + "aaa", true, true}, + {"253 char label, name", strings.Repeat("a.a", 84) + "aa", false, true}, + {"253 char label, constraint", strings.Repeat("a.a", 84) + "aa", true, true}, + {"64 char single label, name", strings.Repeat("a", 64), false, true}, + {"64 char single label, constraint", strings.Repeat("a", 64), true, true}, + {"64 char label, name", "a." + strings.Repeat("a", 64), false, true}, + {"64 char label, constraint", "a." + strings.Repeat("a", 64), true, true}, + + // Check we properly enforce properties of domain names. + {"empty name, constraint", "", true, true}, + {"empty label, name", "a..a", false, false}, + {"empty label, constraint", "a..a", true, false}, + {"period, name", ".", false, false}, + {"period, constraint", ".", true, false}, // TODO(roland): not entirely clear if this is a valid constraint (require at least one label?) + {"valid, name", "a.b.c", false, true}, + {"valid, constraint", "a.b.c", true, true}, + {"leading period, name", ".a.b.c", false, false}, + {"leading period, constraint", ".a.b.c", true, true}, + {"trailing period, name", "a.", false, false}, + {"trailing period, constraint", "a.", true, false}, + {"bare label, name", "a", false, true}, + {"bare label, constraint", "a", true, true}, + {"63 char single label, name", strings.Repeat("a", 63), false, true}, + {"63 char single label, constraint", strings.Repeat("a", 63), true, true}, + {"63 char label, name", "a." + strings.Repeat("a", 63), false, true}, + {"63 char label, constraint", "a." + strings.Repeat("a", 63), true, true}, + } { + t.Run(tc.name, func(t *testing.T) { + valid := domainNameValid(tc.dnsName, tc.constraint) + if tc.valid != valid { + t.Errorf("domainNameValid(%q, %t) = %v; want %v", tc.dnsName, tc.constraint, !tc.valid, tc.valid) + } + // Also check that we enforce the same properties as domainToReverseLabels + trimmedName := tc.dnsName + if tc.constraint && len(trimmedName) > 1 && trimmedName[0] == '.' { + trimmedName = trimmedName[1:] + } + _, revValid := domainToReverseLabels(trimmedName) + if valid != revValid { + t.Errorf("domainNameValid(%q, %t) = %t != domainToReverseLabels(%q) = %t", tc.dnsName, tc.constraint, valid, trimmedName, revValid) + } + }) + } +} + +func TestRoundtripWeirdSANs(t *testing.T) { + // TODO(#75835): check that certificates we create with CreateCertificate that have malformed SAN values + // can be parsed by ParseCertificate. We should eventually restrict this, but for now we have to maintain + // this property as people have been relying on it. + k, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatal(err) + } + badNames := []string{ + "baredomain", + "baredomain.", + strings.Repeat("a", 255), + strings.Repeat("a", 65) + ".com", + } + tmpl := &Certificate{ + EmailAddresses: badNames, + DNSNames: badNames, + } + b, err := CreateCertificate(rand.Reader, tmpl, tmpl, &k.PublicKey, k) + if err != nil { + t.Fatal(err) + } + _, err = ParseCertificate(b) + if err != nil { + t.Fatalf("Couldn't roundtrip certificate: %v", err) + } +} + +func FuzzDomainNameValid(f *testing.F) { + f.Fuzz(func(t *testing.T, data string) { + domainNameValid(data, false) + domainNameValid(data, true) + }) +} diff --git a/go/src/crypto/x509/pem_decrypt.go b/go/src/crypto/x509/pem_decrypt.go new file mode 100644 index 0000000000000000000000000000000000000000..4f96cde1b570feb9dad2b71c2e6c728ca46f2da1 --- /dev/null +++ b/go/src/crypto/x509/pem_decrypt.go @@ -0,0 +1,252 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +// RFC 1423 describes the encryption of PEM blocks. The algorithm used to +// generate a key from the password was derived by looking at the OpenSSL +// implementation. + +import ( + "crypto/aes" + "crypto/cipher" + "crypto/des" + "crypto/md5" + "encoding/hex" + "encoding/pem" + "errors" + "io" + "strings" +) + +type PEMCipher int + +// Possible values for the EncryptPEMBlock encryption algorithm. +const ( + _ PEMCipher = iota + PEMCipherDES + PEMCipher3DES + PEMCipherAES128 + PEMCipherAES192 + PEMCipherAES256 +) + +// rfc1423Algo holds a method for enciphering a PEM block. +type rfc1423Algo struct { + cipher PEMCipher + name string + cipherFunc func(key []byte) (cipher.Block, error) + keySize int + blockSize int +} + +// rfc1423Algos holds a slice of the possible ways to encrypt a PEM +// block. The ivSize numbers were taken from the OpenSSL source. +var rfc1423Algos = []rfc1423Algo{{ + cipher: PEMCipherDES, + name: "DES-CBC", + cipherFunc: des.NewCipher, + keySize: 8, + blockSize: des.BlockSize, +}, { + cipher: PEMCipher3DES, + name: "DES-EDE3-CBC", + cipherFunc: des.NewTripleDESCipher, + keySize: 24, + blockSize: des.BlockSize, +}, { + cipher: PEMCipherAES128, + name: "AES-128-CBC", + cipherFunc: aes.NewCipher, + keySize: 16, + blockSize: aes.BlockSize, +}, { + cipher: PEMCipherAES192, + name: "AES-192-CBC", + cipherFunc: aes.NewCipher, + keySize: 24, + blockSize: aes.BlockSize, +}, { + cipher: PEMCipherAES256, + name: "AES-256-CBC", + cipherFunc: aes.NewCipher, + keySize: 32, + blockSize: aes.BlockSize, +}, +} + +// deriveKey uses a key derivation function to stretch the password into a key +// with the number of bits our cipher requires. This algorithm was derived from +// the OpenSSL source. +func (c rfc1423Algo) deriveKey(password, salt []byte) []byte { + hash := md5.New() + out := make([]byte, c.keySize) + var digest []byte + + for i := 0; i < len(out); i += len(digest) { + hash.Reset() + hash.Write(digest) + hash.Write(password) + hash.Write(salt) + digest = hash.Sum(digest[:0]) + copy(out[i:], digest) + } + return out +} + +// IsEncryptedPEMBlock returns whether the PEM block is password encrypted +// according to RFC 1423. +// +// Deprecated: Legacy PEM encryption as specified in RFC 1423 is insecure by +// design. Since it does not authenticate the ciphertext, it is vulnerable to +// padding oracle attacks that can let an attacker recover the plaintext. +func IsEncryptedPEMBlock(b *pem.Block) bool { + _, ok := b.Headers["DEK-Info"] + return ok +} + +// IncorrectPasswordError is returned when an incorrect password is detected. +var IncorrectPasswordError = errors.New("x509: decryption password incorrect") + +// DecryptPEMBlock takes a PEM block encrypted according to RFC 1423 and the +// password used to encrypt it and returns a slice of decrypted DER encoded +// bytes. It inspects the DEK-Info header to determine the algorithm used for +// decryption. If no DEK-Info header is present, an error is returned. If an +// incorrect password is detected an [IncorrectPasswordError] is returned. Because +// of deficiencies in the format, it's not always possible to detect an +// incorrect password. In these cases no error will be returned but the +// decrypted DER bytes will be random noise. +// +// Deprecated: Legacy PEM encryption as specified in RFC 1423 is insecure by +// design. Since it does not authenticate the ciphertext, it is vulnerable to +// padding oracle attacks that can let an attacker recover the plaintext. +func DecryptPEMBlock(b *pem.Block, password []byte) ([]byte, error) { + dek, ok := b.Headers["DEK-Info"] + if !ok { + return nil, errors.New("x509: no DEK-Info header in block") + } + + mode, hexIV, ok := strings.Cut(dek, ",") + if !ok { + return nil, errors.New("x509: malformed DEK-Info header") + } + + ciph := cipherByName(mode) + if ciph == nil { + return nil, errors.New("x509: unknown encryption mode") + } + iv, err := hex.DecodeString(hexIV) + if err != nil { + return nil, err + } + if len(iv) != ciph.blockSize { + return nil, errors.New("x509: incorrect IV size") + } + + // Based on the OpenSSL implementation. The salt is the first 8 bytes + // of the initialization vector. + key := ciph.deriveKey(password, iv[:8]) + block, err := ciph.cipherFunc(key) + if err != nil { + return nil, err + } + + if len(b.Bytes)%block.BlockSize() != 0 { + return nil, errors.New("x509: encrypted PEM data is not a multiple of the block size") + } + + data := make([]byte, len(b.Bytes)) + dec := cipher.NewCBCDecrypter(block, iv) + dec.CryptBlocks(data, b.Bytes) + + // Blocks are padded using a scheme where the last n bytes of padding are all + // equal to n. It can pad from 1 to blocksize bytes inclusive. See RFC 1423. + // For example: + // [x y z 2 2] + // [x y 7 7 7 7 7 7 7] + // If we detect a bad padding, we assume it is an invalid password. + dlen := len(data) + if dlen == 0 || dlen%ciph.blockSize != 0 { + return nil, errors.New("x509: invalid padding") + } + last := int(data[dlen-1]) + if dlen < last { + return nil, IncorrectPasswordError + } + if last == 0 || last > ciph.blockSize { + return nil, IncorrectPasswordError + } + for _, val := range data[dlen-last:] { + if int(val) != last { + return nil, IncorrectPasswordError + } + } + return data[:dlen-last], nil +} + +// EncryptPEMBlock returns a PEM block of the specified type holding the +// given DER encoded data encrypted with the specified algorithm and +// password according to RFC 1423. +// +// Deprecated: Legacy PEM encryption as specified in RFC 1423 is insecure by +// design. Since it does not authenticate the ciphertext, it is vulnerable to +// padding oracle attacks that can let an attacker recover the plaintext. +func EncryptPEMBlock(rand io.Reader, blockType string, data, password []byte, alg PEMCipher) (*pem.Block, error) { + ciph := cipherByKey(alg) + if ciph == nil { + return nil, errors.New("x509: unknown encryption mode") + } + iv := make([]byte, ciph.blockSize) + if _, err := io.ReadFull(rand, iv); err != nil { + return nil, errors.New("x509: cannot generate IV: " + err.Error()) + } + // The salt is the first 8 bytes of the initialization vector, + // matching the key derivation in DecryptPEMBlock. + key := ciph.deriveKey(password, iv[:8]) + block, err := ciph.cipherFunc(key) + if err != nil { + return nil, err + } + enc := cipher.NewCBCEncrypter(block, iv) + pad := ciph.blockSize - len(data)%ciph.blockSize + encrypted := make([]byte, len(data), len(data)+pad) + // We could save this copy by encrypting all the whole blocks in + // the data separately, but it doesn't seem worth the additional + // code. + copy(encrypted, data) + // See RFC 1423, Section 1.1. + for i := 0; i < pad; i++ { + encrypted = append(encrypted, byte(pad)) + } + enc.CryptBlocks(encrypted, encrypted) + + return &pem.Block{ + Type: blockType, + Headers: map[string]string{ + "Proc-Type": "4,ENCRYPTED", + "DEK-Info": ciph.name + "," + hex.EncodeToString(iv), + }, + Bytes: encrypted, + }, nil +} + +func cipherByName(name string) *rfc1423Algo { + for i := range rfc1423Algos { + alg := &rfc1423Algos[i] + if alg.name == name { + return alg + } + } + return nil +} + +func cipherByKey(key PEMCipher) *rfc1423Algo { + for i := range rfc1423Algos { + alg := &rfc1423Algos[i] + if alg.cipher == key { + return alg + } + } + return nil +} diff --git a/go/src/crypto/x509/pem_decrypt_test.go b/go/src/crypto/x509/pem_decrypt_test.go new file mode 100644 index 0000000000000000000000000000000000000000..dacef8b8617087c9d2db6cf17ab39ceb518678b2 --- /dev/null +++ b/go/src/crypto/x509/pem_decrypt_test.go @@ -0,0 +1,249 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "bytes" + "crypto/rand" + "encoding/base64" + "encoding/pem" + "strings" + "testing" +) + +func TestDecrypt(t *testing.T) { + for i, data := range testData { + t.Logf("test %v. %v", i, data.kind) + block, rest := pem.Decode(data.pemData) + if len(rest) > 0 { + t.Error("extra data") + } + der, err := DecryptPEMBlock(block, data.password) + if err != nil { + t.Error("decrypt failed: ", err) + continue + } + if _, err := ParsePKCS1PrivateKey(der); err != nil { + t.Error("invalid private key: ", err) + } + plainDER, err := base64.StdEncoding.DecodeString(data.plainDER) + if err != nil { + t.Fatal("cannot decode test DER data: ", err) + } + if !bytes.Equal(der, plainDER) { + t.Error("data mismatch") + } + } +} + +func TestEncrypt(t *testing.T) { + for i, data := range testData { + t.Logf("test %v. %v", i, data.kind) + plainDER, err := base64.StdEncoding.DecodeString(data.plainDER) + if err != nil { + t.Fatal("cannot decode test DER data: ", err) + } + password := []byte("kremvax1") + block, err := EncryptPEMBlock(rand.Reader, "RSA PRIVATE KEY", plainDER, password, data.kind) + if err != nil { + t.Error("encrypt: ", err) + continue + } + if !IsEncryptedPEMBlock(block) { + t.Error("PEM block does not appear to be encrypted") + } + if block.Type != "RSA PRIVATE KEY" { + t.Errorf("unexpected block type; got %q want %q", block.Type, "RSA PRIVATE KEY") + } + if block.Headers["Proc-Type"] != "4,ENCRYPTED" { + t.Errorf("block does not have correct Proc-Type header") + } + der, err := DecryptPEMBlock(block, password) + if err != nil { + t.Error("decrypt: ", err) + continue + } + if !bytes.Equal(der, plainDER) { + t.Errorf("data mismatch") + } + } +} + +var testData = []struct { + kind PEMCipher + password []byte + pemData []byte + plainDER string +}{ + { + kind: PEMCipherDES, + password: []byte("asdf"), + pemData: []byte(testingKey(` +-----BEGIN RSA TESTING KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-CBC,34F09A4FC8DE22B5 + +WXxy8kbZdiZvANtKvhmPBLV7eVFj2A5z6oAxvI9KGyhG0ZK0skfnt00C24vfU7m5 +ICXeoqP67lzJ18xCzQfHjDaBNs53DSDT+Iz4e8QUep1xQ30+8QKX2NA2coee3nwc +6oM1cuvhNUDemBH2i3dKgMVkfaga0zQiiOq6HJyGSncCMSruQ7F9iWEfRbFcxFCx +qtHb1kirfGKEtgWTF+ynyco6+2gMXNu70L7nJcnxnV/RLFkHt7AUU1yrclxz7eZz +XOH9VfTjb52q/I8Suozq9coVQwg4tXfIoYUdT//O+mB7zJb9HI9Ps77b9TxDE6Gm +4C9brwZ3zg2vqXcwwV6QRZMtyll9rOpxkbw6NPlpfBqkc3xS51bbxivbO/Nve4KD +r12ymjFNF4stXCfJnNqKoZ50BHmEEUDu5Wb0fpVn82XrGw7CYc4iug== +-----END RSA TESTING KEY-----`)), + plainDER: ` +MIIBPAIBAAJBAPASZe+tCPU6p80AjHhDkVsLYa51D35e/YGa8QcZyooeZM8EHozo +KD0fNiKI+53bHdy07N+81VQ8/ejPcRoXPlsCAwEAAQJBAMTxIuSq27VpR+zZ7WJf +c6fvv1OBvpMZ0/d1pxL/KnOAgq2rD5hDtk9b0LGhTPgQAmrrMTKuSeGoIuYE+gKQ +QvkCIQD+GC1m+/do+QRurr0uo46Kx1LzLeSCrjBk34wiOp2+dwIhAPHfTLRXS2fv +7rljm0bYa4+eDZpz+E8RcXEgzhhvcQQ9AiAI5eHZJGOyml3MXnQjiPi55WcDOw0w +glcRgT6QCEtz2wIhANSyqaFtosIkHKqrDUGfz/bb5tqMYTAnBruVPaf/WEOBAiEA +9xORWeRG1tRpso4+dYy4KdDkuLPIO01KY6neYGm3BCM=`, + }, + { + kind: PEMCipher3DES, + password: []byte("asdf"), + pemData: []byte(testingKey(` +-----BEGIN RSA TESTING KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-EDE3-CBC,C1F4A6A03682C2C7 + +0JqVdBEH6iqM7drTkj+e2W/bE3LqakaiWhb9WUVonFkhyu8ca/QzebY3b5gCvAZQ +YwBvDcT/GHospKqPx+cxDHJNsUASDZws6bz8ZXWJGwZGExKzr0+Qx5fgXn44Ms3x +8g1ENFuTXtxo+KoNK0zuAMAqp66Llcds3Fjl4XR18QaD0CrVNAfOdgATWZm5GJxk +Fgx5f84nT+/ovvreG+xeOzWgvtKo0UUZVrhGOgfKLpa57adumcJ6SkUuBtEFpZFB +ldw5w7WC7d13x2LsRkwo8ZrDKgIV+Y9GNvhuCCkTzNP0V3gNeJpd201HZHR+9n3w +3z0VjR/MGqsfcy1ziEWMNOO53At3zlG6zP05aHMnMcZoVXadEK6L1gz++inSSDCq +gI0UJP4e3JVB7AkgYymYAwiYALAkoEIuanxoc50njJk= +-----END RSA TESTING KEY-----`)), + plainDER: ` +MIIBOwIBAAJBANOCXKdoNS/iP/MAbl9cf1/SF3P+Ns7ZeNL27CfmDh0O6Zduaax5 +NBiumd2PmjkaCu7lQ5JOibHfWn+xJsc3kw0CAwEAAQJANX/W8d1Q/sCqzkuAn4xl +B5a7qfJWaLHndu1QRLNTRJPn0Ee7OKJ4H0QKOhQM6vpjRrz+P2u9thn6wUxoPsef +QQIhAP/jCkfejFcy4v15beqKzwz08/tslVjF+Yq41eJGejmxAiEA05pMoqfkyjcx +fyvGhpoOyoCp71vSGUfR2I9CR65oKh0CIC1Msjs66LlfJtQctRq6bCEtFCxEcsP+ +eEjYo/Sk6WphAiEAxpgWPMJeU/shFT28gS+tmhjPZLpEoT1qkVlC14u0b3ECIQDX +tZZZxCtPAm7shftEib0VU77Lk8MsXJcx2C4voRsjEw==`, + }, + { + kind: PEMCipherAES128, + password: []byte("asdf"), + pemData: []byte(testingKey(` +-----BEGIN RSA TESTING KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,D4492E793FC835CC038A728ED174F78A + +EyfQSzXSjv6BaNH+NHdXRlkHdimpF9izWlugVJAPApgXrq5YldPe2aGIOFXyJ+QE +ZIG20DYqaPzJRjTEbPNZ6Es0S2JJ5yCpKxwJuDkgJZKtF39Q2i36JeGbSZQIuWJE +GZbBpf1jDH/pr0iGonuAdl2PCCZUiy+8eLsD2tyviHUkFLOB+ykYoJ5t8ngZ/B6D +33U43LLb7+9zD4y3Q9OVHqBFGyHcxCY9+9Qh4ZnFp7DTf6RY5TNEvE3s4g6aDpBs +3NbvRVvYTgs8K9EPk4K+5R+P2kD8J8KvEIGxVa1vz8QoCJ/jr7Ka2rvNgPCex5/E +080LzLHPCrXKdlr/f50yhNWq08ZxMWQFkui+FDHPDUaEELKAXV8/5PDxw80Rtybo +AVYoCVIbZXZCuCO81op8UcOgEpTtyU5Lgh3Mw5scQL0= +-----END RSA TESTING KEY-----`)), + plainDER: ` +MIIBOgIBAAJBAMBlj5FxYtqbcy8wY89d/S7n0+r5MzD9F63BA/Lpl78vQKtdJ5dT +cDGh/rBt1ufRrNp0WihcmZi7Mpl/3jHjiWECAwEAAQJABNOHYnKhtDIqFYj1OAJ3 +k3GlU0OlERmIOoeY/cL2V4lgwllPBEs7r134AY4wMmZSBUj8UR/O4SNO668ElKPE +cQIhAOuqY7/115x5KCdGDMWi+jNaMxIvI4ETGwV40ykGzqlzAiEA0P9oEC3m9tHB +kbpjSTxaNkrXxDgdEOZz8X0uOUUwHNsCIAwzcSCiGLyYJTULUmP1ESERfW1mlV78 +XzzESaJpIM/zAiBQkSTcl9VhcJreQqvjn5BnPZLP4ZHS4gPwJAGdsj5J4QIhAOVR +B3WlRNTXR2WsJ5JdByezg9xzdXzULqmga0OE339a`, + }, + { + kind: PEMCipherAES192, + password: []byte("asdf"), + pemData: []byte(testingKey(` +-----BEGIN RSA TESTING KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-192-CBC,E2C9FB02BCA23ADE1829F8D8BC5F5369 + +cqVslvHqDDM6qwU6YjezCRifXmKsrgEev7ng6Qs7UmDJOpHDgJQZI9fwMFUhIyn5 +FbCu1SHkLMW52Ld3CuEqMnzWMlhPrW8tFvUOrMWPYSisv7nNq88HobZEJcUNL2MM +Y15XmHW6IJwPqhKyLHpWXyOCVEh4ODND2nV15PCoi18oTa475baxSk7+1qH7GuIs +Rb7tshNTMqHbCpyo9Rn3UxeFIf9efdl8YLiMoIqc7J8E5e9VlbeQSdLMQOgDAQJG +ReUtTw8exmKsY4gsSjhkg5uiw7/ZB1Ihto0qnfQJgjGc680qGkT1d6JfvOfeYAk6 +xn5RqS/h8rYAYm64KnepfC9vIujo4NqpaREDmaLdX5MJPQ+SlytITQvgUsUq3q/t +Ss85xjQEZH3hzwjQqdJvmA4hYP6SUjxYpBM+02xZ1Xw= +-----END RSA TESTING KEY-----`)), + plainDER: ` +MIIBOwIBAAJBAMGcRrZiNNmtF20zyS6MQ7pdGx17aFDl+lTl+qnLuJRUCMUG05xs +OmxmL/O1Qlf+bnqR8Bgg65SfKg21SYuLhiMCAwEAAQJBAL94uuHyO4wux2VC+qpj +IzPykjdU7XRcDHbbvksf4xokSeUFjjD3PB0Qa83M94y89ZfdILIqS9x5EgSB4/lX +qNkCIQD6cCIqLfzq/lYbZbQgAAjpBXeQVYsbvVtJrPrXJAlVVQIhAMXpDKMeFPMn +J0g2rbx1gngx0qOa5r5iMU5w/noN4W2XAiBjf+WzCG5yFvazD+dOx3TC0A8+4x3P +uZ3pWbaXf5PNuQIgAcdXarvhelH2w2piY1g3BPeFqhzBSCK/yLGxR82KIh8CIQDD ++qGKsd09NhQ/G27y/DARzOYtml1NvdmCQAgsDIIOLA==`, + }, + { + kind: PEMCipherAES256, + password: []byte("asdf"), + pemData: []byte(testingKey(` +-----BEGIN RSA TESTING KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-256-CBC,8E7ED5CD731902CE938957A886A5FFBD + +4Mxr+KIzRVwoOP0wwq6caSkvW0iS+GE2h2Ov/u+n9ZTMwL83PRnmjfjzBgfRZLVf +JFPXxUK26kMNpIdssNnqGOds+DhB+oSrsNKoxgxSl5OBoYv9eJTVYm7qOyAFIsjr +DRKAcjYCmzfesr7PVTowwy0RtHmYwyXMGDlAzzZrEvaiySFFmMyKKvtoavwaFoc7 +Pz3RZScwIuubzTGJ1x8EzdffYOsdCa9Mtgpp3L136+23dOd6L/qK2EG2fzrJSHs/ +2XugkleBFSMKzEp9mxXKRfa++uidQvMZTFLDK9w5YjrRvMBo/l2BoZIsq0jAIE1N +sv5Z/KwlX+3MDEpPQpUwGPlGGdLnjI3UZ+cjgqBcoMiNc6HfgbBgYJSU6aDSHuCk +clCwByxWkBNgJ2GrkwNrF26v+bGJJJNR4SKouY1jQf0= +-----END RSA TESTING KEY-----`)), + plainDER: ` +MIIBOgIBAAJBAKy3GFkstoCHIEeUU/qO8207m8WSrjksR+p9B4tf1w5k+2O1V/GY +AQ5WFCApItcOkQe/I0yZZJk/PmCqMzSxrc8CAwEAAQJAOCAz0F7AW9oNelVQSP8F +Sfzx7O1yom+qWyAQQJF/gFR11gpf9xpVnnyu1WxIRnDUh1LZwUsjwlDYb7MB74id +oQIhANPcOiLwOPT4sIUpRM5HG6BF1BI7L77VpyGVk8xNP7X/AiEA0LMHZtk4I+lJ +nClgYp4Yh2JZ1Znbu7IoQMCEJCjwKDECIGd8Dzm5tViTkUW6Hs3Tlf73nNs65duF +aRnSglss8I3pAiEAonEnKruawgD8RavDFR+fUgmQiPz4FnGGeVgfwpGG1JECIBYq +PXHYtPqxQIbD2pScR5qum7iGUh11lEUPkmt+2uqS`, + }, + { + // generated with: + // openssl genrsa -aes128 -passout pass:asdf -out server.orig.key 128 + kind: PEMCipherAES128, + password: []byte("asdf"), + pemData: []byte(testingKey(` +-----BEGIN RSA TESTING KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,74611ABC2571AF11B1BF9B69E62C89E7 + +6ei/MlytjE0FFgZOGQ+jrwomKfpl8kdefeE0NSt/DMRrw8OacHAzBNi3pPEa0eX3 +eND9l7C9meCirWovjj9QWVHrXyugFuDIqgdhQ8iHTgCfF3lrmcttVrbIfMDw+smD +hTP8O1mS/MHl92NE0nhv0w== +-----END RSA TESTING KEY-----`)), + plainDER: ` +MGMCAQACEQC6ssxmYuauuHGOCDAI54RdAgMBAAECEQCWIn6Yv2O+kBcDF7STctKB +AgkA8SEfu/2i3g0CCQDGNlXbBHX7kQIIK3Ww5o0cYbECCQDCimPb0dYGsQIIeQ7A +jryIst8=`, + }, +} + +var incompleteBlockPEM = testingKey(` +-----BEGIN RSA TESTING KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,74611ABC2571AF11B1BF9B69E62C89E7 + +6L8yXK2MTQUWBk4ZD6OvCiYp+mXyR1594TQ1K38MxGvDw5pwcDME2Lek8RrR5fd40P2XsL2Z4KKt +ai+OP1BZUetfK6AW4MiqB2FDyIdOAJ8XeWuZy21Wtsh8wPD6yYOFM/w7WZL8weX3Y0TSeG/T +-----END RSA TESTING KEY-----`) + +func TestIncompleteBlock(t *testing.T) { + // incompleteBlockPEM contains ciphertext that is not a multiple of the + // block size. This previously panicked. See #11215. + block, _ := pem.Decode([]byte(incompleteBlockPEM)) + _, err := DecryptPEMBlock(block, []byte("foo")) + if err == nil { + t.Fatal("Bad PEM data decrypted successfully") + } + const expectedSubstr = "block size" + if e := err.Error(); !strings.Contains(e, expectedSubstr) { + t.Fatalf("Expected error containing %q but got: %q", expectedSubstr, e) + } +} + +func testingKey(s string) string { return strings.ReplaceAll(s, "TESTING KEY", "PRIVATE KEY") } diff --git a/go/src/crypto/x509/pkcs1.go b/go/src/crypto/x509/pkcs1.go new file mode 100644 index 0000000000000000000000000000000000000000..68aa8dd980c10e95d1d1388784a0932a1e14f5da --- /dev/null +++ b/go/src/crypto/x509/pkcs1.go @@ -0,0 +1,202 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "crypto/rsa" + "encoding/asn1" + "errors" + "internal/godebug" + "math/big" +) + +// pkcs1PrivateKey is a structure which mirrors the PKCS #1 ASN.1 for an RSA private key. +type pkcs1PrivateKey struct { + Version int + N *big.Int + E int + D *big.Int + P *big.Int + Q *big.Int + Dp *big.Int `asn1:"optional"` + Dq *big.Int `asn1:"optional"` + Qinv *big.Int `asn1:"optional"` + + AdditionalPrimes []pkcs1AdditionalRSAPrime `asn1:"optional,omitempty"` +} + +type pkcs1AdditionalRSAPrime struct { + Prime *big.Int + + // We ignore these values because rsa will calculate them. + Exp *big.Int + Coeff *big.Int +} + +// pkcs1PublicKey reflects the ASN.1 structure of a PKCS #1 public key. +type pkcs1PublicKey struct { + N *big.Int + E int +} + +// x509rsacrt, if zero, makes ParsePKCS1PrivateKey ignore and recompute invalid +// CRT values in the RSA private key. +var x509rsacrt = godebug.New("x509rsacrt") + +// ParsePKCS1PrivateKey parses an [RSA] private key in PKCS #1, ASN.1 DER form. +// +// This kind of key is commonly encoded in PEM blocks of type "RSA PRIVATE KEY". +// +// Before Go 1.24, the CRT parameters were ignored and recomputed. To restore +// the old behavior, use the GODEBUG=x509rsacrt=0 environment variable. +func ParsePKCS1PrivateKey(der []byte) (*rsa.PrivateKey, error) { + var priv pkcs1PrivateKey + rest, err := asn1.Unmarshal(der, &priv) + if len(rest) > 0 { + return nil, asn1.SyntaxError{Msg: "trailing data"} + } + if err != nil { + if _, err := asn1.Unmarshal(der, &ecPrivateKey{}); err == nil { + return nil, errors.New("x509: failed to parse private key (use ParseECPrivateKey instead for this key format)") + } + if _, err := asn1.Unmarshal(der, &pkcs8{}); err == nil { + return nil, errors.New("x509: failed to parse private key (use ParsePKCS8PrivateKey instead for this key format)") + } + return nil, err + } + + if priv.Version > 1 { + return nil, errors.New("x509: unsupported private key version") + } + + if priv.N.Sign() <= 0 || priv.D.Sign() <= 0 || priv.P.Sign() <= 0 || priv.Q.Sign() <= 0 || + priv.Dp != nil && priv.Dp.Sign() <= 0 || + priv.Dq != nil && priv.Dq.Sign() <= 0 || + priv.Qinv != nil && priv.Qinv.Sign() <= 0 { + return nil, errors.New("x509: private key contains zero or negative value") + } + + key := new(rsa.PrivateKey) + key.PublicKey = rsa.PublicKey{ + E: priv.E, + N: priv.N, + } + + key.D = priv.D + key.Primes = make([]*big.Int, 2+len(priv.AdditionalPrimes)) + key.Primes[0] = priv.P + key.Primes[1] = priv.Q + key.Precomputed.Dp = priv.Dp + key.Precomputed.Dq = priv.Dq + key.Precomputed.Qinv = priv.Qinv + for i, a := range priv.AdditionalPrimes { + if a.Prime.Sign() <= 0 { + return nil, errors.New("x509: private key contains zero or negative prime") + } + key.Primes[i+2] = a.Prime + // We ignore the other two values because rsa will calculate + // them as needed. + } + + key.Precompute() + if err := key.Validate(); err != nil { + // If x509rsacrt=0 is set, try dropping the CRT values and + // rerunning precomputation and key validation. + if x509rsacrt.Value() == "0" { + key.Precomputed.Dp = nil + key.Precomputed.Dq = nil + key.Precomputed.Qinv = nil + key.Precompute() + if err := key.Validate(); err == nil { + x509rsacrt.IncNonDefault() + return key, nil + } + } + + return nil, err + } + + return key, nil +} + +// MarshalPKCS1PrivateKey converts an [RSA] private key to PKCS #1, ASN.1 DER form. +// +// This kind of key is commonly encoded in PEM blocks of type "RSA PRIVATE KEY". +// For a more flexible key format which is not [RSA] specific, use +// [MarshalPKCS8PrivateKey]. +// +// The key must have passed validation by calling [rsa.PrivateKey.Validate] +// first. MarshalPKCS1PrivateKey calls [rsa.PrivateKey.Precompute], which may +// modify the key if not already precomputed. +func MarshalPKCS1PrivateKey(key *rsa.PrivateKey) []byte { + key.Precompute() + + version := 0 + if len(key.Primes) > 2 { + version = 1 + } + + priv := pkcs1PrivateKey{ + Version: version, + N: key.N, + E: key.PublicKey.E, + D: key.D, + P: key.Primes[0], + Q: key.Primes[1], + Dp: key.Precomputed.Dp, + Dq: key.Precomputed.Dq, + Qinv: key.Precomputed.Qinv, + } + + priv.AdditionalPrimes = make([]pkcs1AdditionalRSAPrime, len(key.Precomputed.CRTValues)) + for i, values := range key.Precomputed.CRTValues { + priv.AdditionalPrimes[i].Prime = key.Primes[2+i] + priv.AdditionalPrimes[i].Exp = values.Exp + priv.AdditionalPrimes[i].Coeff = values.Coeff + } + + b, _ := asn1.Marshal(priv) + return b +} + +// ParsePKCS1PublicKey parses an [RSA] public key in PKCS #1, ASN.1 DER form. +// +// This kind of key is commonly encoded in PEM blocks of type "RSA PUBLIC KEY". +func ParsePKCS1PublicKey(der []byte) (*rsa.PublicKey, error) { + var pub pkcs1PublicKey + rest, err := asn1.Unmarshal(der, &pub) + if err != nil { + if _, err := asn1.Unmarshal(der, &publicKeyInfo{}); err == nil { + return nil, errors.New("x509: failed to parse public key (use ParsePKIXPublicKey instead for this key format)") + } + return nil, err + } + if len(rest) > 0 { + return nil, asn1.SyntaxError{Msg: "trailing data"} + } + + if pub.N.Sign() <= 0 || pub.E <= 0 { + return nil, errors.New("x509: public key contains zero or negative value") + } + if pub.E > 1<<31-1 { + return nil, errors.New("x509: public key contains large public exponent") + } + + return &rsa.PublicKey{ + E: pub.E, + N: pub.N, + }, nil +} + +// MarshalPKCS1PublicKey converts an [RSA] public key to PKCS #1, ASN.1 DER form. +// +// This kind of key is commonly encoded in PEM blocks of type "RSA PUBLIC KEY". +func MarshalPKCS1PublicKey(key *rsa.PublicKey) []byte { + derBytes, _ := asn1.Marshal(pkcs1PublicKey{ + N: key.N, + E: key.E, + }) + return derBytes +} diff --git a/go/src/crypto/x509/pkcs8.go b/go/src/crypto/x509/pkcs8.go new file mode 100644 index 0000000000000000000000000000000000000000..d0ab573ff33236328031eb52312a21be3269fd6f --- /dev/null +++ b/go/src/crypto/x509/pkcs8.go @@ -0,0 +1,184 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "crypto/ecdh" + "crypto/ecdsa" + "crypto/ed25519" + "crypto/rsa" + "crypto/x509/pkix" + "encoding/asn1" + "errors" + "fmt" +) + +// pkcs8 reflects an ASN.1, PKCS #8 PrivateKey. See +// ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-8/pkcs-8v1_2.asn +// and RFC 5208. +type pkcs8 struct { + Version int + Algo pkix.AlgorithmIdentifier + PrivateKey []byte + // optional attributes omitted. +} + +// ParsePKCS8PrivateKey parses an unencrypted private key in PKCS #8, ASN.1 DER form. +// +// It returns a *[rsa.PrivateKey], an *[ecdsa.PrivateKey], an [ed25519.PrivateKey] (not +// a pointer), or an *[ecdh.PrivateKey] (for X25519). More types might be supported +// in the future. +// +// This kind of key is commonly encoded in PEM blocks of type "PRIVATE KEY". +// +// Before Go 1.24, the CRT parameters of RSA keys were ignored and recomputed. +// To restore the old behavior, use the GODEBUG=x509rsacrt=0 environment variable. +func ParsePKCS8PrivateKey(der []byte) (key any, err error) { + var privKey pkcs8 + if _, err := asn1.Unmarshal(der, &privKey); err != nil { + if _, err := asn1.Unmarshal(der, &ecPrivateKey{}); err == nil { + return nil, errors.New("x509: failed to parse private key (use ParseECPrivateKey instead for this key format)") + } + if _, err := asn1.Unmarshal(der, &pkcs1PrivateKey{}); err == nil { + return nil, errors.New("x509: failed to parse private key (use ParsePKCS1PrivateKey instead for this key format)") + } + return nil, err + } + switch { + case privKey.Algo.Algorithm.Equal(oidPublicKeyRSA): + key, err = ParsePKCS1PrivateKey(privKey.PrivateKey) + if err != nil { + return nil, errors.New("x509: failed to parse RSA private key embedded in PKCS#8: " + err.Error()) + } + return key, nil + + case privKey.Algo.Algorithm.Equal(oidPublicKeyECDSA): + bytes := privKey.Algo.Parameters.FullBytes + namedCurveOID := new(asn1.ObjectIdentifier) + if _, err := asn1.Unmarshal(bytes, namedCurveOID); err != nil { + namedCurveOID = nil + } + key, err = parseECPrivateKey(namedCurveOID, privKey.PrivateKey) + if err != nil { + return nil, errors.New("x509: failed to parse EC private key embedded in PKCS#8: " + err.Error()) + } + return key, nil + + case privKey.Algo.Algorithm.Equal(oidPublicKeyEd25519): + if l := len(privKey.Algo.Parameters.FullBytes); l != 0 { + return nil, errors.New("x509: invalid Ed25519 private key parameters") + } + var curvePrivateKey []byte + if _, err := asn1.Unmarshal(privKey.PrivateKey, &curvePrivateKey); err != nil { + return nil, fmt.Errorf("x509: invalid Ed25519 private key: %v", err) + } + if l := len(curvePrivateKey); l != ed25519.SeedSize { + return nil, fmt.Errorf("x509: invalid Ed25519 private key length: %d", l) + } + return ed25519.NewKeyFromSeed(curvePrivateKey), nil + + case privKey.Algo.Algorithm.Equal(oidPublicKeyX25519): + if l := len(privKey.Algo.Parameters.FullBytes); l != 0 { + return nil, errors.New("x509: invalid X25519 private key parameters") + } + var curvePrivateKey []byte + if _, err := asn1.Unmarshal(privKey.PrivateKey, &curvePrivateKey); err != nil { + return nil, fmt.Errorf("x509: invalid X25519 private key: %v", err) + } + return ecdh.X25519().NewPrivateKey(curvePrivateKey) + + default: + return nil, fmt.Errorf("x509: PKCS#8 wrapping contained private key with unknown algorithm: %v", privKey.Algo.Algorithm) + } +} + +// MarshalPKCS8PrivateKey converts a private key to PKCS #8, ASN.1 DER form. +// +// The following key types are currently supported: *[rsa.PrivateKey], +// *[ecdsa.PrivateKey], [ed25519.PrivateKey] (not a pointer), and *[ecdh.PrivateKey]. +// Unsupported key types result in an error. +// +// This kind of key is commonly encoded in PEM blocks of type "PRIVATE KEY". +// +// MarshalPKCS8PrivateKey runs [rsa.PrivateKey.Precompute] on RSA keys. +func MarshalPKCS8PrivateKey(key any) ([]byte, error) { + var privKey pkcs8 + + switch k := key.(type) { + case *rsa.PrivateKey: + privKey.Algo = pkix.AlgorithmIdentifier{ + Algorithm: oidPublicKeyRSA, + Parameters: asn1.NullRawValue, + } + k.Precompute() + if err := k.Validate(); err != nil { + return nil, err + } + privKey.PrivateKey = MarshalPKCS1PrivateKey(k) + + case *ecdsa.PrivateKey: + oid, ok := oidFromNamedCurve(k.Curve) + if !ok { + return nil, errors.New("x509: unknown curve while marshaling to PKCS#8") + } + oidBytes, err := asn1.Marshal(oid) + if err != nil { + return nil, errors.New("x509: failed to marshal curve OID: " + err.Error()) + } + privKey.Algo = pkix.AlgorithmIdentifier{ + Algorithm: oidPublicKeyECDSA, + Parameters: asn1.RawValue{ + FullBytes: oidBytes, + }, + } + if privKey.PrivateKey, err = marshalECPrivateKeyWithOID(k, nil); err != nil { + return nil, errors.New("x509: failed to marshal EC private key while building PKCS#8: " + err.Error()) + } + + case ed25519.PrivateKey: + privKey.Algo = pkix.AlgorithmIdentifier{ + Algorithm: oidPublicKeyEd25519, + } + curvePrivateKey, err := asn1.Marshal(k.Seed()) + if err != nil { + return nil, fmt.Errorf("x509: failed to marshal private key: %v", err) + } + privKey.PrivateKey = curvePrivateKey + + case *ecdh.PrivateKey: + if k.Curve() == ecdh.X25519() { + privKey.Algo = pkix.AlgorithmIdentifier{ + Algorithm: oidPublicKeyX25519, + } + var err error + if privKey.PrivateKey, err = asn1.Marshal(k.Bytes()); err != nil { + return nil, fmt.Errorf("x509: failed to marshal private key: %v", err) + } + } else { + oid, ok := oidFromECDHCurve(k.Curve()) + if !ok { + return nil, errors.New("x509: unknown curve while marshaling to PKCS#8") + } + oidBytes, err := asn1.Marshal(oid) + if err != nil { + return nil, errors.New("x509: failed to marshal curve OID: " + err.Error()) + } + privKey.Algo = pkix.AlgorithmIdentifier{ + Algorithm: oidPublicKeyECDSA, + Parameters: asn1.RawValue{ + FullBytes: oidBytes, + }, + } + if privKey.PrivateKey, err = marshalECDHPrivateKey(k); err != nil { + return nil, errors.New("x509: failed to marshal EC private key while building PKCS#8: " + err.Error()) + } + } + + default: + return nil, fmt.Errorf("x509: unknown key type while marshaling PKCS#8: %T", key) + } + + return asn1.Marshal(privKey) +} diff --git a/go/src/crypto/x509/pkcs8_test.go b/go/src/crypto/x509/pkcs8_test.go new file mode 100644 index 0000000000000000000000000000000000000000..d0328800bc086be7af76fbc2c49b353d5e39ebf9 --- /dev/null +++ b/go/src/crypto/x509/pkcs8_test.go @@ -0,0 +1,175 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "bytes" + "crypto/ecdh" + "crypto/ecdsa" + "crypto/ed25519" + "crypto/elliptic" + "crypto/rsa" + "encoding/hex" + "reflect" + "strings" + "testing" +) + +// Generated using: +// +// openssl genrsa 1024 | openssl pkcs8 -topk8 -nocrypt +var pkcs8RSAPrivateKeyHex = `30820278020100300d06092a864886f70d0101010500048202623082025e02010002818100cfb1b5bf9685ffa97b4f99df4ff122b70e59ac9b992f3bc2b3dde17d53c1a34928719b02e8fd17839499bfbd515bd6ef99c7a1c47a239718fe36bfd824c0d96060084b5f67f0273443007a24dfaf5634f7772c9346e10eb294c2306671a5a5e719ae24b4de467291bc571014b0e02dec04534d66a9bb171d644b66b091780e8d020301000102818100b595778383c4afdbab95d2bfed12b3f93bb0a73a7ad952f44d7185fd9ec6c34de8f03a48770f2009c8580bcd275e9632714e9a5e3f32f29dc55474b2329ff0ebc08b3ffcb35bc96e6516b483df80a4a59cceb71918cbabf91564e64a39d7e35dce21cb3031824fdbc845dba6458852ec16af5dddf51a8397a8797ae0337b1439024100ea0eb1b914158c70db39031dd8904d6f18f408c85fbbc592d7d20dee7986969efbda081fdf8bc40e1b1336d6b638110c836bfdc3f314560d2e49cd4fbde1e20b024100e32a4e793b574c9c4a94c8803db5152141e72d03de64e54ef2c8ed104988ca780cd11397bc359630d01b97ebd87067c5451ba777cf045ca23f5912f1031308c702406dfcdbbd5a57c9f85abc4edf9e9e29153507b07ce0a7ef6f52e60dcfebe1b8341babd8b789a837485da6c8d55b29bbb142ace3c24a1f5b54b454d01b51e2ad03024100bd6a2b60dee01e1b3bfcef6a2f09ed027c273cdbbaf6ba55a80f6dcc64e4509ee560f84b4f3e076bd03b11e42fe71a3fdd2dffe7e0902c8584f8cad877cdc945024100aa512fa4ada69881f1d8bb8ad6614f192b83200aef5edf4811313d5ef30a86cbd0a90f7b025c71ea06ec6b34db6306c86b1040670fd8654ad7291d066d06d031` + +// Generated using: +// +// openssl ecparam -genkey -name secp224r1 | openssl pkcs8 -topk8 -nocrypt +var pkcs8P224PrivateKeyHex = `3078020100301006072a8648ce3d020106052b810400210461305f020101041cca3d72b3e88fed2684576dad9b80a9180363a5424986900e3abcab3fa13c033a0004f8f2a6372872a4e61263ed893afb919576a4cacfecd6c081a2cbc76873cf4ba8530703c6042b3a00e2205087e87d2435d2e339e25702fae1` + +// Generated using: +// +// openssl ecparam -genkey -name secp256r1 | openssl pkcs8 -topk8 -nocrypt +var pkcs8P256PrivateKeyHex = `308187020100301306072a8648ce3d020106082a8648ce3d030107046d306b0201010420dad6b2f49ca774c36d8ae9517e935226f667c929498f0343d2424d0b9b591b43a14403420004b9c9b90095476afe7b860d8bd43568cab7bcb2eed7b8bf2fa0ce1762dd20b04193f859d2d782b1e4cbfd48492f1f533113a6804903f292258513837f07fda735` + +// Generated using: +// +// openssl ecparam -genkey -name secp384r1 | openssl pkcs8 -topk8 -nocrypt +var pkcs8P384PrivateKeyHex = `3081b6020100301006072a8648ce3d020106052b8104002204819e30819b02010104309bf832f6aaaeacb78ce47ffb15e6fd0fd48683ae79df6eca39bfb8e33829ac94aa29d08911568684c2264a08a4ceb679a164036200049070ad4ed993c7770d700e9f6dc2baa83f63dd165b5507f98e8ff29b5d2e78ccbe05c8ddc955dbf0f7497e8222cfa49314fe4e269459f8e880147f70d785e530f2939e4bf9f838325bb1a80ad4cf59272ae0e5efe9a9dc33d874492596304bd3` + +// Generated using: +// +// openssl ecparam -genkey -name secp521r1 | openssl pkcs8 -topk8 -nocrypt +// +// Note that OpenSSL will truncate the private key if it can (i.e. it emits it +// like an integer, even though it's an OCTET STRING field). Thus if you +// regenerate this you may, randomly, find that it's a byte shorter than +// expected and the Go test will fail to recreate it exactly. +var pkcs8P521PrivateKeyHex = `3081ee020100301006072a8648ce3d020106052b810400230481d63081d3020101044200cfe0b87113a205cf291bb9a8cd1a74ac6c7b2ebb8199aaa9a5010d8b8012276fa3c22ac913369fa61beec2a3b8b4516bc049bde4fb3b745ac11b56ab23ac52e361a1818903818600040138f75acdd03fbafa4f047a8e4b272ba9d555c667962b76f6f232911a5786a0964e5edea6bd21a6f8725720958de049c6e3e6661c1c91b227cebee916c0319ed6ca003db0a3206d372229baf9dd25d868bf81140a518114803ce40c1855074d68c4e9dab9e65efba7064c703b400f1767f217dac82715ac1f6d88c74baf47a7971de4ea` + +// From RFC 8410, Section 7. +var pkcs8Ed25519PrivateKeyHex = `302e020100300506032b657004220420d4ee72dbf913584ad5b6d8f1f769f8ad3afe7c28cbf1d4fbe097a88f44755842` + +// Generated using: +// +// openssl genpkey -algorithm x25519 +var pkcs8X25519PrivateKeyHex = `302e020100300506032b656e0422042068ff93a73c5adefd6d498b24e588fd4daa10924d992afed01b43ca5725025a6b` + +func TestPKCS8(t *testing.T) { + tests := []struct { + name string + keyHex string + keyType reflect.Type + curve elliptic.Curve + }{ + { + name: "RSA private key", + keyHex: pkcs8RSAPrivateKeyHex, + keyType: reflect.TypeOf(&rsa.PrivateKey{}), + }, + { + name: "P-224 private key", + keyHex: pkcs8P224PrivateKeyHex, + keyType: reflect.TypeOf(&ecdsa.PrivateKey{}), + curve: elliptic.P224(), + }, + { + name: "P-256 private key", + keyHex: pkcs8P256PrivateKeyHex, + keyType: reflect.TypeOf(&ecdsa.PrivateKey{}), + curve: elliptic.P256(), + }, + { + name: "P-384 private key", + keyHex: pkcs8P384PrivateKeyHex, + keyType: reflect.TypeOf(&ecdsa.PrivateKey{}), + curve: elliptic.P384(), + }, + { + name: "P-521 private key", + keyHex: pkcs8P521PrivateKeyHex, + keyType: reflect.TypeOf(&ecdsa.PrivateKey{}), + curve: elliptic.P521(), + }, + { + name: "Ed25519 private key", + keyHex: pkcs8Ed25519PrivateKeyHex, + keyType: reflect.TypeOf(ed25519.PrivateKey{}), + }, + { + name: "X25519 private key", + keyHex: pkcs8X25519PrivateKeyHex, + keyType: reflect.TypeOf(&ecdh.PrivateKey{}), + }, + } + + for _, test := range tests { + derBytes, err := hex.DecodeString(test.keyHex) + if err != nil { + t.Errorf("%s: failed to decode hex: %s", test.name, err) + continue + } + privKey, err := ParsePKCS8PrivateKey(derBytes) + if err != nil { + t.Errorf("%s: failed to decode PKCS#8: %s", test.name, err) + continue + } + if reflect.TypeOf(privKey) != test.keyType { + t.Errorf("%s: decoded PKCS#8 returned unexpected key type: %T", test.name, privKey) + continue + } + if ecKey, isEC := privKey.(*ecdsa.PrivateKey); isEC && ecKey.Curve != test.curve { + t.Errorf("%s: decoded PKCS#8 returned unexpected curve %#v", test.name, ecKey.Curve) + continue + } + reserialised, err := MarshalPKCS8PrivateKey(privKey) + if err != nil { + t.Errorf("%s: failed to marshal into PKCS#8: %s", test.name, err) + continue + } + if !bytes.Equal(derBytes, reserialised) { + t.Errorf("%s: marshaled PKCS#8 didn't match original: got %x, want %x", test.name, reserialised, derBytes) + continue + } + + if ecKey, isEC := privKey.(*ecdsa.PrivateKey); isEC { + ecdhKey, err := ecKey.ECDH() + if err != nil { + if ecKey.Curve != elliptic.P224() { + t.Errorf("%s: failed to convert to ecdh: %s", test.name, err) + } + continue + } + reserialised, err := MarshalPKCS8PrivateKey(ecdhKey) + if err != nil { + t.Errorf("%s: failed to marshal into PKCS#8: %s", test.name, err) + continue + } + if !bytes.Equal(derBytes, reserialised) { + t.Errorf("%s: marshaled PKCS#8 didn't match original: got %x, want %x", test.name, reserialised, derBytes) + continue + } + } + } +} + +const hexPKCS8TestPKCS1Key = "3082025c02010002818100b1a1e0945b9289c4d3f1329f8a982c4a2dcd59bfd372fb8085a9c517554607ebd2f7990eef216ac9f4605f71a03b04f42a5255b158cf8e0844191f5119348baa44c35056e20609bcf9510f30ead4b481c81d7865fb27b8e0090e112b717f3ee08cdfc4012da1f1f7cf2a1bc34c73a54a12b06372d09714742dd7895eadde4aa5020301000102818062b7fa1db93e993e40237de4d89b7591cc1ea1d04fed4904c643f17ae4334557b4295270d0491c161cb02a9af557978b32b20b59c267a721c4e6c956c2d147046e9ae5f2da36db0106d70021fa9343455f8f973a4b355a26fd19e6b39dee0405ea2b32deddf0f4817759ef705d02b34faab9ca93c6766e9f722290f119f34449024100d9c29a4a013a90e35fd1be14a3f747c589fac613a695282d61812a711906b8a0876c6181f0333ca1066596f57bff47e7cfcabf19c0fc69d9cd76df743038b3cb024100d0d3546fecf879b5551f2bd2c05e6385f2718a08a6face3d2aecc9d7e03645a480a46c81662c12ad6bd6901e3bd4f38029462de7290859567cdf371c79088d4f024100c254150657e460ea58573fcf01a82a4791e3d6223135c8bdfed69afe84fbe7857274f8eb5165180507455f9b4105c6b08b51fe8a481bb986a202245576b713530240045700003b7a867d0041df9547ae2e7f50248febd21c9040b12dae9c2feab0d3d4609668b208e4727a3541557f84d372ac68eaf74ce1018a4c9a0ef92682c8fd02405769731480bb3a4570abf422527c5f34bf732fa6c1e08cc322753c511ce055fac20fc770025663ad3165324314df907f1f1942f0448a7e9cdbf87ecd98b92156" +const hexPKCS8TestECKey = "3081a40201010430bdb9839c08ee793d1157886a7a758a3c8b2a17a4df48f17ace57c72c56b4723cf21dcda21d4e1ad57ff034f19fcfd98ea00706052b81040022a16403620004feea808b5ee2429cfcce13c32160e1c960990bd050bb0fdf7222f3decd0a55008e32a6aa3c9062051c4cba92a7a3b178b24567412d43cdd2f882fa5addddd726fe3e208d2c26d733a773a597abb749714df7256ead5105fa6e7b3650de236b50" + +var pkcs8MismatchKeyTests = []struct { + hexKey string + errorContains string +}{ + {hexKey: hexPKCS8TestECKey, errorContains: "use ParseECPrivateKey instead"}, + {hexKey: hexPKCS8TestPKCS1Key, errorContains: "use ParsePKCS1PrivateKey instead"}, +} + +func TestPKCS8MismatchKeyFormat(t *testing.T) { + for i, test := range pkcs8MismatchKeyTests { + derBytes, _ := hex.DecodeString(test.hexKey) + _, err := ParsePKCS8PrivateKey(derBytes) + if !strings.Contains(err.Error(), test.errorContains) { + t.Errorf("#%d: expected error containing %q, got %s", i, test.errorContains, err) + } + } +} diff --git a/go/src/crypto/x509/pkits_test.go b/go/src/crypto/x509/pkits_test.go new file mode 100644 index 0000000000000000000000000000000000000000..b1139bbf9c638ca4fcca807d5aa30edca6804d35 --- /dev/null +++ b/go/src/crypto/x509/pkits_test.go @@ -0,0 +1,186 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "encoding/json" + "os" + "path/filepath" + "slices" + "testing" +) + +var nistTestPolicies = map[string]OID{ + "anyPolicy": anyPolicyOID, + "NIST-test-policy-1": mustNewOIDFromInts([]uint64{2, 16, 840, 1, 101, 3, 2, 1, 48, 1}), + "NIST-test-policy-2": mustNewOIDFromInts([]uint64{2, 16, 840, 1, 101, 3, 2, 1, 48, 2}), + "NIST-test-policy-3": mustNewOIDFromInts([]uint64{2, 16, 840, 1, 101, 3, 2, 1, 48, 3}), + "NIST-test-policy-6": mustNewOIDFromInts([]uint64{2, 16, 840, 1, 101, 3, 2, 1, 48, 6}), +} + +func TestNISTPKITSPolicy(t *testing.T) { + // This test runs a subset of the NIST PKI path validation test suite that + // focuses of policy validation, rather than the entire suite. Since the + // suite assumes you are only validating the path, rather than building + // _and_ validating the path, we take the path as given and run + // policiesValid on it. + + certDir := "testdata/nist-pkits/certs" + + var testcases []struct { + Name string + CertPath []string + InitialPolicySet []string + InitialPolicyMappingInhibit bool + InitialExplicitPolicy bool + InitialAnyPolicyInhibit bool + ShouldValidate bool + Skipped bool + } + b, err := os.ReadFile("testdata/nist-pkits/vectors.json") + if err != nil { + t.Fatal(err) + } + if err := json.Unmarshal(b, &testcases); err != nil { + t.Fatal(err) + } + + policyTests := map[string]bool{ + "4.8.1 All Certificates Same Policy Test1 (Subpart 1)": true, + "4.8.1 All Certificates Same Policy Test1 (Subpart 2)": true, + "4.8.1 All Certificates Same Policy Test1 (Subpart 3)": true, + "4.8.1 All Certificates Same Policy Test1 (Subpart 4)": true, + "4.8.2 All Certificates No Policies Test2 (Subpart 1)": true, + "4.8.2 All Certificates No Policies Test2 (Subpart 2)": true, + "4.8.3 Different Policies Test3 (Subpart 1)": true, + "4.8.3 Different Policies Test3 (Subpart 2)": true, + "4.8.3 Different Policies Test3 (Subpart 3)": true, + "4.8.4 Different Policies Test4": true, + "4.8.5 Different Policies Test5": true, + "4.8.6 Overlapping Policies Test6 (Subpart 1)": true, + "4.8.6 Overlapping Policies Test6 (Subpart 2)": true, + "4.8.6 Overlapping Policies Test6 (Subpart 3)": true, + "4.8.7 Different Policies Test7": true, + "4.8.8 Different Policies Test8": true, + "4.8.9 Different Policies Test9": true, + "4.8.10 All Certificates Same Policies Test10 (Subpart 1)": true, + "4.8.10 All Certificates Same Policies Test10 (Subpart 2)": true, + "4.8.10 All Certificates Same Policies Test10 (Subpart 3)": true, + "4.8.11 All Certificates AnyPolicy Test11 (Subpart 1)": true, + "4.8.11 All Certificates AnyPolicy Test11 (Subpart 2)": true, + "4.8.12 Different Policies Test12": true, + "4.8.13 All Certificates Same Policies Test13 (Subpart 1)": true, + "4.8.13 All Certificates Same Policies Test13 (Subpart 2)": true, + "4.8.13 All Certificates Same Policies Test13 (Subpart 3)": true, + "4.8.14 AnyPolicy Test14 (Subpart 1)": true, + "4.8.14 AnyPolicy Test14 (Subpart 2)": true, + "4.8.15 User Notice Qualifier Test15": true, + "4.8.16 User Notice Qualifier Test16": true, + "4.8.17 User Notice Qualifier Test17": true, + "4.8.18 User Notice Qualifier Test18 (Subpart 1)": true, + "4.8.18 User Notice Qualifier Test18 (Subpart 2)": true, + "4.8.19 User Notice Qualifier Test19": true, + "4.8.20 CPS Pointer Qualifier Test20": true, + "4.9.1 Valid RequireExplicitPolicy Test1": true, + "4.9.2 Valid RequireExplicitPolicy Test2": true, + "4.9.3 Invalid RequireExplicitPolicy Test3": true, + "4.9.4 Valid RequireExplicitPolicy Test4": true, + "4.9.5 Invalid RequireExplicitPolicy Test5": true, + "4.9.6 Valid Self-Issued requireExplicitPolicy Test6": true, + "4.9.7 Invalid Self-Issued requireExplicitPolicy Test7": true, + "4.9.8 Invalid Self-Issued requireExplicitPolicy Test8": true, + "4.10.1.1 Valid Policy Mapping Test1 (Subpart 1)": true, + "4.10.1.2 Valid Policy Mapping Test1 (Subpart 2)": true, + "4.10.1.3 Valid Policy Mapping Test1 (Subpart 3)": true, + "4.10.2 Invalid Policy Mapping Test2 (Subpart 1)": true, + "4.10.2 Invalid Policy Mapping Test2 (Subpart 2)": true, + "4.10.3 Valid Policy Mapping Test3 (Subpart 1)": true, + "4.10.3 Valid Policy Mapping Test3 (Subpart 2)": true, + "4.10.4 Invalid Policy Mapping Test4": true, + "4.10.5 Valid Policy Mapping Test5 (Subpart 1)": true, + "4.10.5 Valid Policy Mapping Test5 (Subpart 2)": true, + "4.10.6 Valid Policy Mapping Test6 (Subpart 1)": true, + "4.10.6 Valid Policy Mapping Test6 (Subpart 2)": true, + "4.10.7 Invalid Mapping From anyPolicy Test7": true, + "4.10.8 Invalid Mapping To anyPolicy Test8": true, + "4.10.9 Valid Policy Mapping Test9": true, + "4.10.10 Invalid Policy Mapping Test10": true, + "4.10.11 Valid Policy Mapping Test11": true, + "4.10.12 Valid Policy Mapping Test12 (Subpart 1)": true, + "4.10.12 Valid Policy Mapping Test12 (Subpart 2)": true, + "4.10.13 Valid Policy Mapping Test13 (Subpart 1)": true, + "4.10.13 Valid Policy Mapping Test13 (Subpart 2)": true, + "4.10.13 Valid Policy Mapping Test13 (Subpart 3)": true, + "4.10.14 Valid Policy Mapping Test14": true, + "4.11.1 Invalid inhibitPolicyMapping Test1": true, + "4.11.2 Valid inhibitPolicyMapping Test2": true, + "4.11.3 Invalid inhibitPolicyMapping Test3": true, + "4.11.4 Valid inhibitPolicyMapping Test4": true, + "4.11.5 Invalid inhibitPolicyMapping Test5": true, + "4.11.6 Invalid inhibitPolicyMapping Test6": true, + "4.11.7 Valid Self-Issued inhibitPolicyMapping Test7": true, + "4.11.8 Invalid Self-Issued inhibitPolicyMapping Test8": true, + "4.11.9 Invalid Self-Issued inhibitPolicyMapping Test9": true, + "4.11.10 Invalid Self-Issued inhibitPolicyMapping Test10": true, + "4.11.11 Invalid Self-Issued inhibitPolicyMapping Test11": true, + "4.12.1 Invalid inhibitAnyPolicy Test1": true, + "4.12.2 Valid inhibitAnyPolicy Test2": true, + "4.12.3 inhibitAnyPolicy Test3 (Subpart 1)": true, + "4.12.3 inhibitAnyPolicy Test3 (Subpart 2)": true, + "4.12.4 Invalid inhibitAnyPolicy Test4": true, + "4.12.5 Invalid inhibitAnyPolicy Test5": true, + "4.12.6 Invalid inhibitAnyPolicy Test6": true, + "4.12.7 Valid Self-Issued inhibitAnyPolicy Test7": true, + "4.12.8 Invalid Self-Issued inhibitAnyPolicy Test8": true, + "4.12.9 Valid Self-Issued inhibitAnyPolicy Test9": true, + "4.12.10 Invalid Self-Issued inhibitAnyPolicy Test10": true, + } + + for _, tc := range testcases { + if !policyTests[tc.Name] { + continue + } + t.Run(tc.Name, func(t *testing.T) { + var chain []*Certificate + for _, c := range tc.CertPath { + certDER, err := os.ReadFile(filepath.Join(certDir, c)) + if err != nil { + t.Fatal(err) + } + cert, err := ParseCertificate(certDER) + if err != nil { + t.Fatal(err) + } + chain = append(chain, cert) + } + slices.Reverse(chain) + + var initialPolicies []OID + for _, pstr := range tc.InitialPolicySet { + policy, ok := nistTestPolicies[pstr] + if !ok { + t.Fatalf("unknown test policy: %s", pstr) + } + initialPolicies = append(initialPolicies, policy) + } + + valid := policiesValid(chain, VerifyOptions{ + CertificatePolicies: initialPolicies, + inhibitPolicyMapping: tc.InitialPolicyMappingInhibit, + requireExplicitPolicy: tc.InitialExplicitPolicy, + inhibitAnyPolicy: tc.InitialAnyPolicyInhibit, + }) + if !valid { + if !tc.ShouldValidate { + return + } + t.Fatalf("Failed to validate: %s", err) + } + if !tc.ShouldValidate { + t.Fatal("Expected path validation to fail") + } + }) + } +} diff --git a/go/src/crypto/x509/pkix/pkix.go b/go/src/crypto/x509/pkix/pkix.go new file mode 100644 index 0000000000000000000000000000000000000000..dfc6abca655327ad42d2df45027b900934f308e4 --- /dev/null +++ b/go/src/crypto/x509/pkix/pkix.go @@ -0,0 +1,320 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package pkix contains shared, low level structures used for ASN.1 parsing +// and serialization of X.509 certificates, CRL and OCSP. +package pkix + +import ( + "encoding/asn1" + "encoding/hex" + "fmt" + "math/big" + "time" +) + +// AlgorithmIdentifier represents the ASN.1 structure of the same name. See RFC +// 5280, section 4.1.1.2. +type AlgorithmIdentifier struct { + Algorithm asn1.ObjectIdentifier + Parameters asn1.RawValue `asn1:"optional"` +} + +type RDNSequence []RelativeDistinguishedNameSET + +var attributeTypeNames = map[string]string{ + "2.5.4.6": "C", + "2.5.4.10": "O", + "2.5.4.11": "OU", + "2.5.4.3": "CN", + "2.5.4.5": "SERIALNUMBER", + "2.5.4.7": "L", + "2.5.4.8": "ST", + "2.5.4.9": "STREET", + "2.5.4.17": "POSTALCODE", +} + +// String returns a string representation of the sequence r, +// roughly following the RFC 2253 Distinguished Names syntax. +func (r RDNSequence) String() string { + s := "" + for i := 0; i < len(r); i++ { + rdn := r[len(r)-1-i] + if i > 0 { + s += "," + } + for j, tv := range rdn { + if j > 0 { + s += "+" + } + + oidString := tv.Type.String() + typeName, ok := attributeTypeNames[oidString] + if !ok { + derBytes, err := asn1.Marshal(tv.Value) + if err == nil { + s += oidString + "=#" + hex.EncodeToString(derBytes) + continue // No value escaping necessary. + } + + typeName = oidString + } + + valueString := fmt.Sprint(tv.Value) + escaped := make([]rune, 0, len(valueString)) + + for k, c := range valueString { + escape := false + + switch c { + case ',', '+', '"', '\\', '<', '>', ';': + escape = true + + case ' ': + escape = k == 0 || k == len(valueString)-1 + + case '#': + escape = k == 0 + } + + if escape { + escaped = append(escaped, '\\', c) + } else { + escaped = append(escaped, c) + } + } + + s += typeName + "=" + string(escaped) + } + } + + return s +} + +type RelativeDistinguishedNameSET []AttributeTypeAndValue + +// AttributeTypeAndValue mirrors the ASN.1 structure of the same name in +// RFC 5280, Section 4.1.2.4. +type AttributeTypeAndValue struct { + Type asn1.ObjectIdentifier + Value any +} + +// AttributeTypeAndValueSET represents a set of ASN.1 sequences of +// [AttributeTypeAndValue] sequences from RFC 2986 (PKCS #10). +type AttributeTypeAndValueSET struct { + Type asn1.ObjectIdentifier + Value [][]AttributeTypeAndValue `asn1:"set"` +} + +// Extension represents the ASN.1 structure of the same name. See RFC +// 5280, section 4.2. +type Extension struct { + Id asn1.ObjectIdentifier + Critical bool `asn1:"optional"` + Value []byte +} + +// Name represents an X.509 distinguished name. This only includes the common +// elements of a DN. Note that Name is only an approximation of the X.509 +// structure. If an accurate representation is needed, asn1.Unmarshal the raw +// subject or issuer as an [RDNSequence]. +type Name struct { + Country, Organization, OrganizationalUnit []string + Locality, Province []string + StreetAddress, PostalCode []string + SerialNumber, CommonName string + + // Names contains all parsed attributes. When parsing distinguished names, + // this can be used to extract non-standard attributes that are not parsed + // by this package. When marshaling to RDNSequences, the Names field is + // ignored, see ExtraNames. + Names []AttributeTypeAndValue + + // ExtraNames contains attributes to be copied, raw, into any marshaled + // distinguished names. Values override any attributes with the same OID. + // The ExtraNames field is not populated when parsing, see Names. + ExtraNames []AttributeTypeAndValue +} + +// FillFromRDNSequence populates n from the provided [RDNSequence]. +// Multi-entry RDNs are flattened, all entries are added to the +// relevant n fields, and the grouping is not preserved. +func (n *Name) FillFromRDNSequence(rdns *RDNSequence) { + for _, rdn := range *rdns { + if len(rdn) == 0 { + continue + } + + for _, atv := range rdn { + n.Names = append(n.Names, atv) + value, ok := atv.Value.(string) + if !ok { + continue + } + + t := atv.Type + if len(t) == 4 && t[0] == 2 && t[1] == 5 && t[2] == 4 { + switch t[3] { + case 3: + n.CommonName = value + case 5: + n.SerialNumber = value + case 6: + n.Country = append(n.Country, value) + case 7: + n.Locality = append(n.Locality, value) + case 8: + n.Province = append(n.Province, value) + case 9: + n.StreetAddress = append(n.StreetAddress, value) + case 10: + n.Organization = append(n.Organization, value) + case 11: + n.OrganizationalUnit = append(n.OrganizationalUnit, value) + case 17: + n.PostalCode = append(n.PostalCode, value) + } + } + } + } +} + +var ( + oidCountry = []int{2, 5, 4, 6} + oidOrganization = []int{2, 5, 4, 10} + oidOrganizationalUnit = []int{2, 5, 4, 11} + oidCommonName = []int{2, 5, 4, 3} + oidSerialNumber = []int{2, 5, 4, 5} + oidLocality = []int{2, 5, 4, 7} + oidProvince = []int{2, 5, 4, 8} + oidStreetAddress = []int{2, 5, 4, 9} + oidPostalCode = []int{2, 5, 4, 17} +) + +// appendRDNs appends a relativeDistinguishedNameSET to the given RDNSequence +// and returns the new value. The relativeDistinguishedNameSET contains an +// attributeTypeAndValue for each of the given values. See RFC 5280, A.1, and +// search for AttributeTypeAndValue. +func (n Name) appendRDNs(in RDNSequence, values []string, oid asn1.ObjectIdentifier) RDNSequence { + if len(values) == 0 || oidInAttributeTypeAndValue(oid, n.ExtraNames) { + return in + } + + s := make([]AttributeTypeAndValue, len(values)) + for i, value := range values { + s[i].Type = oid + s[i].Value = value + } + + return append(in, s) +} + +// ToRDNSequence converts n into a single [RDNSequence]. The following +// attributes are encoded as multi-value RDNs: +// +// - Country +// - Organization +// - OrganizationalUnit +// - Locality +// - Province +// - StreetAddress +// - PostalCode +// +// Each ExtraNames entry is encoded as an individual RDN. +func (n Name) ToRDNSequence() (ret RDNSequence) { + ret = n.appendRDNs(ret, n.Country, oidCountry) + ret = n.appendRDNs(ret, n.Province, oidProvince) + ret = n.appendRDNs(ret, n.Locality, oidLocality) + ret = n.appendRDNs(ret, n.StreetAddress, oidStreetAddress) + ret = n.appendRDNs(ret, n.PostalCode, oidPostalCode) + ret = n.appendRDNs(ret, n.Organization, oidOrganization) + ret = n.appendRDNs(ret, n.OrganizationalUnit, oidOrganizationalUnit) + if len(n.CommonName) > 0 { + ret = n.appendRDNs(ret, []string{n.CommonName}, oidCommonName) + } + if len(n.SerialNumber) > 0 { + ret = n.appendRDNs(ret, []string{n.SerialNumber}, oidSerialNumber) + } + for _, atv := range n.ExtraNames { + ret = append(ret, []AttributeTypeAndValue{atv}) + } + + return ret +} + +// String returns the string form of n, roughly following +// the RFC 2253 Distinguished Names syntax. +func (n Name) String() string { + var rdns RDNSequence + // If there are no ExtraNames, surface the parsed value (all entries in + // Names) instead. + if n.ExtraNames == nil { + for _, atv := range n.Names { + t := atv.Type + if len(t) == 4 && t[0] == 2 && t[1] == 5 && t[2] == 4 { + switch t[3] { + case 3, 5, 6, 7, 8, 9, 10, 11, 17: + // These attributes were already parsed into named fields. + continue + } + } + // Place non-standard parsed values at the beginning of the sequence + // so they will be at the end of the string. See Issue 39924. + rdns = append(rdns, []AttributeTypeAndValue{atv}) + } + } + rdns = append(rdns, n.ToRDNSequence()...) + return rdns.String() +} + +// oidInAttributeTypeAndValue reports whether a type with the given OID exists +// in atv. +func oidInAttributeTypeAndValue(oid asn1.ObjectIdentifier, atv []AttributeTypeAndValue) bool { + for _, a := range atv { + if a.Type.Equal(oid) { + return true + } + } + return false +} + +// CertificateList represents the ASN.1 structure of the same name. See RFC +// 5280, section 5.1. Use Certificate.CheckCRLSignature to verify the +// signature. +// +// Deprecated: x509.RevocationList should be used instead. +type CertificateList struct { + TBSCertList TBSCertificateList + SignatureAlgorithm AlgorithmIdentifier + SignatureValue asn1.BitString +} + +// HasExpired reports whether certList should have been updated by now. +func (certList *CertificateList) HasExpired(now time.Time) bool { + return !now.Before(certList.TBSCertList.NextUpdate) +} + +// TBSCertificateList represents the ASN.1 structure of the same name. See RFC +// 5280, section 5.1. +// +// Deprecated: x509.RevocationList should be used instead. +type TBSCertificateList struct { + Raw asn1.RawContent + Version int `asn1:"optional,default:0"` + Signature AlgorithmIdentifier + Issuer RDNSequence + ThisUpdate time.Time + NextUpdate time.Time `asn1:"optional"` + RevokedCertificates []RevokedCertificate `asn1:"optional"` + Extensions []Extension `asn1:"tag:0,optional,explicit"` +} + +// RevokedCertificate represents the ASN.1 structure of the same name. See RFC +// 5280, section 5.1. +type RevokedCertificate struct { + SerialNumber *big.Int + RevocationTime time.Time + Extensions []Extension `asn1:"optional"` +} diff --git a/go/src/crypto/x509/platform_root_cert.pem b/go/src/crypto/x509/platform_root_cert.pem new file mode 100644 index 0000000000000000000000000000000000000000..bef31f4c4ecf73d04476cd6516c94a2779162ad3 --- /dev/null +++ b/go/src/crypto/x509/platform_root_cert.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB/DCCAaOgAwIBAgICIzEwCgYIKoZIzj0EAwIwLDEqMCgGA1UEAxMhR28gcGxh +dGZvcm0gdmVyaWZpZXIgdGVzdGluZyByb290MB4XDTIzMDUyNjE3NDQwMVoXDTI4 +MDUyNDE4NDQwMVowLDEqMCgGA1UEAxMhR28gcGxhdGZvcm0gdmVyaWZpZXIgdGVz +dGluZyByb290MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE5dNQY4FY29i2g3xx +7FyH4XiZz0C0AM4uyPUsXCZNb7CsctHDLhLtzABWSfFz76j+oVhq+qKrwIHsLX+7 +f6YTQqOBtDCBsTAOBgNVHQ8BAf8EBAMCAgQwEwYDVR0lBAwwCgYIKwYBBQUHAwEw +DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUEJInRbtQR6xTUSwvtdAe9A4XHwQw +WgYDVR0eAQH/BFAwTqAaMBiCFnRlc3RpbmcuZ29sYW5nLmludmFsaWShMDAKhwgA +AAAAAAAAADAihyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAKBggq +hkjOPQQDAgNHADBEAiBgzgLyQm4rK1AuIcElH3MdRqlteq3nzZCxKOI4xHXYjQIg +BCSzaCb1+/AK+mhRubrdebFYlUdveTH98wAfKQHaw64= +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/platform_root_key.pem b/go/src/crypto/x509/platform_root_key.pem new file mode 100644 index 0000000000000000000000000000000000000000..c0b6eeba8bc4877b229af7e93cfa2d7e5b6e9b3f --- /dev/null +++ b/go/src/crypto/x509/platform_root_key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIHhv8LVzb9gqJzAY0P442+FW0oqbfBrLnfqxyyAujOFSoAoGCCqGSM49 +AwEHoUQDQgAE5dNQY4FY29i2g3xx7FyH4XiZz0C0AM4uyPUsXCZNb7CsctHDLhLt +zABWSfFz76j+oVhq+qKrwIHsLX+7f6YTQg== +-----END EC PRIVATE KEY----- diff --git a/go/src/crypto/x509/platform_test.go b/go/src/crypto/x509/platform_test.go new file mode 100644 index 0000000000000000000000000000000000000000..44ceff43f454df0d79ac550943bb3725ffd1c028 --- /dev/null +++ b/go/src/crypto/x509/platform_test.go @@ -0,0 +1,248 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "encoding/pem" + "math/big" + "os" + "runtime" + "strings" + "testing" + "time" +) + +// In order to run this test suite locally, you need to insert the test root, at +// the path below, into your trust store. This root is constrained such that it +// should not be dangerous to local developers to trust, but care should be +// taken when inserting it into the trust store not to give it increased +// permissions. +// +// On macOS the certificate can be further constrained to only be valid for +// 'SSL' in the certificate properties pane of the 'Keychain Access' program. +// +// On Windows the certificate can also be constrained to only server +// authentication in the properties pane of the certificate in the +// "Certificates" snap-in of mmc.exe. + +const ( + rootCertPath = "platform_root_cert.pem" + rootKeyPath = "platform_root_key.pem" +) + +func TestPlatformVerifier(t *testing.T) { + if runtime.GOOS != "windows" && runtime.GOOS != "darwin" { + t.Skip("only tested on windows and darwin") + } + + der, err := os.ReadFile(rootCertPath) + if err != nil { + t.Fatalf("failed to read test root: %s", err) + } + b, _ := pem.Decode(der) + testRoot, err := ParseCertificate(b.Bytes) + if err != nil { + t.Fatalf("failed to parse test root: %s", err) + } + + der, err = os.ReadFile(rootKeyPath) + if err != nil { + t.Fatalf("failed to read test key: %s", err) + } + b, _ = pem.Decode(der) + testRootKey, err := ParseECPrivateKey(b.Bytes) + if err != nil { + t.Fatalf("failed to parse test key: %s", err) + } + + if _, err := testRoot.Verify(VerifyOptions{}); err != nil { + t.Skipf("test root is not in trust store, skipping (err: %q)", err) + } + + now := time.Now() + + tests := []struct { + name string + cert *Certificate + selfSigned bool + dnsName string + time time.Time + eku []ExtKeyUsage + + expectedErr string + windowsErr string + macosErr string + }{ + { + name: "valid", + cert: &Certificate{ + SerialNumber: big.NewInt(1), + DNSNames: []string{"valid.testing.golang.invalid"}, + NotBefore: now.Add(-time.Hour), + NotAfter: now.Add(time.Hour), + ExtKeyUsage: []ExtKeyUsage{ExtKeyUsageServerAuth}, + }, + }, + { + name: "valid (with name)", + cert: &Certificate{ + SerialNumber: big.NewInt(1), + DNSNames: []string{"valid.testing.golang.invalid"}, + NotBefore: now.Add(-time.Hour), + NotAfter: now.Add(time.Hour), + ExtKeyUsage: []ExtKeyUsage{ExtKeyUsageServerAuth}, + }, + dnsName: "valid.testing.golang.invalid", + }, + { + name: "valid (with time)", + cert: &Certificate{ + SerialNumber: big.NewInt(1), + DNSNames: []string{"valid.testing.golang.invalid"}, + NotBefore: now.Add(-time.Hour), + NotAfter: now.Add(time.Hour), + ExtKeyUsage: []ExtKeyUsage{ExtKeyUsageServerAuth}, + }, + time: now.Add(time.Minute * 30), + }, + { + name: "valid (with eku)", + cert: &Certificate{ + SerialNumber: big.NewInt(1), + DNSNames: []string{"valid.testing.golang.invalid"}, + NotBefore: now.Add(-time.Hour), + NotAfter: now.Add(time.Hour), + ExtKeyUsage: []ExtKeyUsage{ExtKeyUsageServerAuth}, + }, + eku: []ExtKeyUsage{ExtKeyUsageServerAuth}, + }, + { + name: "wrong name", + cert: &Certificate{ + SerialNumber: big.NewInt(1), + DNSNames: []string{"valid.testing.golang.invalid"}, + NotBefore: now.Add(-time.Hour), + NotAfter: now.Add(time.Hour), + ExtKeyUsage: []ExtKeyUsage{ExtKeyUsageServerAuth}, + }, + dnsName: "invalid.testing.golang.invalid", + expectedErr: "x509: certificate is valid for valid.testing.golang.invalid, not invalid.testing.golang.invalid", + }, + { + name: "expired (future)", + cert: &Certificate{ + SerialNumber: big.NewInt(1), + DNSNames: []string{"valid.testing.golang.invalid"}, + NotBefore: now.Add(-time.Hour), + NotAfter: now.Add(time.Hour), + ExtKeyUsage: []ExtKeyUsage{ExtKeyUsageServerAuth}, + }, + time: now.Add(time.Hour * 2), + expectedErr: "x509: certificate has expired or is not yet valid", + }, + { + name: "expired (past)", + cert: &Certificate{ + SerialNumber: big.NewInt(1), + DNSNames: []string{"valid.testing.golang.invalid"}, + NotBefore: now.Add(-time.Hour), + NotAfter: now.Add(time.Hour), + ExtKeyUsage: []ExtKeyUsage{ExtKeyUsageServerAuth}, + }, + time: now.Add(time.Hour * 2), + expectedErr: "x509: certificate has expired or is not yet valid", + }, + { + name: "self-signed", + cert: &Certificate{ + SerialNumber: big.NewInt(1), + DNSNames: []string{"valid.testing.golang.invalid"}, + NotBefore: now.Add(-time.Hour), + NotAfter: now.Add(time.Hour), + ExtKeyUsage: []ExtKeyUsage{ExtKeyUsageServerAuth}, + }, + selfSigned: true, + macosErr: "x509: “valid.testing.golang.invalid” certificate is not trusted", + windowsErr: "x509: certificate signed by unknown authority", + }, + { + name: "non-specified KU", + cert: &Certificate{ + SerialNumber: big.NewInt(1), + DNSNames: []string{"valid.testing.golang.invalid"}, + NotBefore: now.Add(-time.Hour), + NotAfter: now.Add(time.Hour), + ExtKeyUsage: []ExtKeyUsage{ExtKeyUsageServerAuth}, + }, + eku: []ExtKeyUsage{ExtKeyUsageEmailProtection}, + expectedErr: "x509: certificate specifies an incompatible key usage", + }, + { + name: "non-nested KU", + cert: &Certificate{ + SerialNumber: big.NewInt(1), + DNSNames: []string{"valid.testing.golang.invalid"}, + NotBefore: now.Add(-time.Hour), + NotAfter: now.Add(time.Hour), + ExtKeyUsage: []ExtKeyUsage{ExtKeyUsageEmailProtection}, + }, + macosErr: "x509: “valid.testing.golang.invalid” certificate is not permitted for this usage", + windowsErr: "x509: certificate specifies an incompatible key usage", + }, + } + + leafKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatalf("ecdsa.GenerateKey failed: %s", err) + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + parent := testRoot + if tc.selfSigned { + parent = tc.cert + } + certDER, err := CreateCertificate(rand.Reader, tc.cert, parent, leafKey.Public(), testRootKey) + if err != nil { + t.Fatalf("CreateCertificate failed: %s", err) + } + cert, err := ParseCertificate(certDER) + if err != nil { + t.Fatalf("ParseCertificate failed: %s", err) + } + + var opts VerifyOptions + if tc.dnsName != "" { + opts.DNSName = tc.dnsName + } + if !tc.time.IsZero() { + opts.CurrentTime = tc.time + } + if len(tc.eku) > 0 { + opts.KeyUsages = tc.eku + } + + expectedErr := tc.expectedErr + if runtime.GOOS == "darwin" && tc.macosErr != "" { + expectedErr = tc.macosErr + } else if runtime.GOOS == "windows" && tc.windowsErr != "" { + expectedErr = tc.windowsErr + } + + _, err = cert.Verify(opts) + if err != nil && expectedErr == "" { + t.Errorf("unexpected verification error: %s", err) + } else if err != nil && !strings.HasPrefix(err.Error(), expectedErr) { + t.Errorf("unexpected verification error: got %q, want %q", err.Error(), expectedErr) + } else if err == nil && expectedErr != "" { + t.Errorf("unexpected verification success: want %q", expectedErr) + } + }) + } +} diff --git a/go/src/crypto/x509/root.go b/go/src/crypto/x509/root.go new file mode 100644 index 0000000000000000000000000000000000000000..600f75979d6e9e37d21012ba18378262503cd8be --- /dev/null +++ b/go/src/crypto/x509/root.go @@ -0,0 +1,117 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "internal/godebug" + "sync" + _ "unsafe" // for linkname +) + +// systemRoots should be an internal detail, +// but widely used packages access it using linkname. +// Notable members of the hall of shame include: +// - github.com/breml/rootcerts +// +// Do not remove or change the type signature. +// See go.dev/issue/67401. +// +//go:linkname systemRoots +var ( + once sync.Once + systemRootsMu sync.RWMutex + systemRoots *CertPool + systemRootsErr error + fallbacksSet bool + useFallbackRoots bool +) + +func systemRootsPool() *CertPool { + once.Do(initSystemRoots) + systemRootsMu.RLock() + defer systemRootsMu.RUnlock() + return systemRoots +} + +func initSystemRoots() { + systemRootsMu.Lock() + defer systemRootsMu.Unlock() + + fallbackRoots := systemRoots + systemRoots, systemRootsErr = loadSystemRoots() + if systemRootsErr != nil { + systemRoots = nil + } + + if fallbackRoots == nil { + return // no fallbacks to try + } + + systemCertsAvail := systemRoots != nil && (systemRoots.len() > 0 || systemRoots.systemPool) + + if !useFallbackRoots && systemCertsAvail { + return + } + + if useFallbackRoots && systemCertsAvail { + x509usefallbackroots.IncNonDefault() // overriding system certs with fallback certs. + } + + systemRoots, systemRootsErr = fallbackRoots, nil +} + +var x509usefallbackroots = godebug.New("x509usefallbackroots") + +// SetFallbackRoots sets the roots to use during certificate verification, if no +// custom roots are specified and a platform verifier or a system certificate +// pool is not available (for instance in a container which does not have a root +// certificate bundle). SetFallbackRoots will panic if roots is nil. +// +// SetFallbackRoots may only be called once, if called multiple times it will +// panic. +// +// The fallback behavior can be forced on all platforms, even when there is a +// system certificate pool, by setting GODEBUG=x509usefallbackroots=1 (note that +// on Windows and macOS this will disable usage of the platform verification +// APIs and cause the pure Go verifier to be used). Setting +// x509usefallbackroots=1 without calling SetFallbackRoots has no effect. +func SetFallbackRoots(roots *CertPool) { + if roots == nil { + panic("roots must be non-nil") + } + + systemRootsMu.Lock() + defer systemRootsMu.Unlock() + + if fallbacksSet { + panic("SetFallbackRoots has already been called") + } + fallbacksSet = true + + // Handle case when initSystemRoots was not yet executed. + // We handle that specially instead of calling loadSystemRoots, to avoid + // spending excessive amount of cpu here, since the SetFallbackRoots in most cases + // is going to be called at program startup. + if systemRoots == nil && systemRootsErr == nil { + systemRoots = roots + useFallbackRoots = x509usefallbackroots.Value() == "1" + return + } + + once.Do(func() { panic("unreachable") }) // asserts that system roots were indeed loaded before. + + forceFallbackRoots := x509usefallbackroots.Value() == "1" + systemCertsAvail := systemRoots != nil && (systemRoots.len() > 0 || systemRoots.systemPool) + + if !forceFallbackRoots && systemCertsAvail { + return + } + + if forceFallbackRoots && systemCertsAvail { + x509usefallbackroots.IncNonDefault() // overriding system certs with fallback certs. + } + + systemRoots, systemRootsErr = roots, nil +} diff --git a/go/src/crypto/x509/root_aix.go b/go/src/crypto/x509/root_aix.go new file mode 100644 index 0000000000000000000000000000000000000000..99b7463a2a7149c0d132393964af0f78f0d9dc2b --- /dev/null +++ b/go/src/crypto/x509/root_aix.go @@ -0,0 +1,15 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +// Possible certificate files; stop after finding one. +var certFiles = []string{ + "/var/ssl/certs/ca-bundle.crt", +} + +// Possible directories with certificate files; all will be read. +var certDirectories = []string{ + "/var/ssl/certs", +} diff --git a/go/src/crypto/x509/root_bsd.go b/go/src/crypto/x509/root_bsd.go new file mode 100644 index 0000000000000000000000000000000000000000..a76aef8659b55a2551d08931b5d9963062798193 --- /dev/null +++ b/go/src/crypto/x509/root_bsd.go @@ -0,0 +1,22 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build dragonfly || freebsd || netbsd || openbsd + +package x509 + +// Possible certificate files; stop after finding one. +var certFiles = []string{ + "/usr/local/etc/ssl/cert.pem", // FreeBSD + "/etc/ssl/cert.pem", // OpenBSD + "/usr/local/share/certs/ca-root-nss.crt", // DragonFly + "/etc/openssl/certs/ca-certificates.crt", // NetBSD +} + +// Possible directories with certificate files; all will be read. +var certDirectories = []string{ + "/etc/ssl/certs", // FreeBSD 12.2+ + "/usr/local/share/certs", // FreeBSD + "/etc/openssl/certs", // NetBSD +} diff --git a/go/src/crypto/x509/root_darwin.go b/go/src/crypto/x509/root_darwin.go new file mode 100644 index 0000000000000000000000000000000000000000..3e9aa1ba097b368ee4f72009801f9818115eaaae --- /dev/null +++ b/go/src/crypto/x509/root_darwin.go @@ -0,0 +1,131 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "crypto/x509/internal/macos" + "errors" + "fmt" +) + +func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) { + certs := macos.CFArrayCreateMutable() + defer macos.ReleaseCFArray(certs) + leaf, err := macos.SecCertificateCreateWithData(c.Raw) + if err != nil { + return nil, errors.New("invalid leaf certificate") + } + macos.CFArrayAppendValue(certs, leaf) + if opts.Intermediates != nil { + for _, lc := range opts.Intermediates.lazyCerts { + c, err := lc.getCert() + if err != nil { + return nil, err + } + sc, err := macos.SecCertificateCreateWithData(c.Raw) + if err != nil { + return nil, err + } + macos.CFArrayAppendValue(certs, sc) + } + } + + policies := macos.CFArrayCreateMutable() + defer macos.ReleaseCFArray(policies) + sslPolicy, err := macos.SecPolicyCreateSSL(opts.DNSName) + if err != nil { + return nil, err + } + macos.CFArrayAppendValue(policies, sslPolicy) + + trustObj, err := macos.SecTrustCreateWithCertificates(certs, policies) + if err != nil { + return nil, err + } + defer macos.CFRelease(trustObj) + + if !opts.CurrentTime.IsZero() { + dateRef := macos.TimeToCFDateRef(opts.CurrentTime) + defer macos.CFRelease(dateRef) + if err := macos.SecTrustSetVerifyDate(trustObj, dateRef); err != nil { + return nil, err + } + } + + // TODO(roland): we may want to allow passing in SCTs via VerifyOptions and + // set them via SecTrustSetSignedCertificateTimestamps, since Apple will + // always enforce its SCT requirements, and there are still _some_ people + // using TLS or OCSP for that. + + if ret, err := macos.SecTrustEvaluateWithError(trustObj); err != nil { + switch ret { + case macos.ErrSecCertificateExpired: + return nil, CertificateInvalidError{c, Expired, err.Error()} + case macos.ErrSecHostNameMismatch: + return nil, HostnameError{c, opts.DNSName} + case macos.ErrSecNotTrusted: + return nil, UnknownAuthorityError{Cert: c} + default: + return nil, fmt.Errorf("x509: %s", err) + } + } + + chain := [][]*Certificate{{}} + chainRef, err := macos.SecTrustCopyCertificateChain(trustObj) + if err != nil { + return nil, err + } + defer macos.CFRelease(chainRef) + for i := 0; i < macos.CFArrayGetCount(chainRef); i++ { + certRef := macos.CFArrayGetValueAtIndex(chainRef, i) + cert, err := exportCertificate(certRef) + if err != nil { + return nil, err + } + chain[0] = append(chain[0], cert) + } + if len(chain[0]) == 0 { + // This should _never_ happen, but to be safe + return nil, errors.New("x509: macos certificate verification internal error") + } + + if opts.DNSName != "" { + // If we have a DNS name, apply our own name verification + if err := chain[0][0].VerifyHostname(opts.DNSName); err != nil { + return nil, err + } + } + + keyUsages := opts.KeyUsages + if len(keyUsages) == 0 { + keyUsages = []ExtKeyUsage{ExtKeyUsageServerAuth} + } + + // If any key usage is acceptable then we're done. + for _, usage := range keyUsages { + if usage == ExtKeyUsageAny { + return chain, nil + } + } + + if !checkChainForKeyUsage(chain[0], keyUsages) { + return nil, CertificateInvalidError{c, IncompatibleUsage, ""} + } + + return chain, nil +} + +// exportCertificate returns a *Certificate for a SecCertificateRef. +func exportCertificate(cert macos.CFRef) (*Certificate, error) { + data, err := macos.SecCertificateCopyData(cert) + if err != nil { + return nil, err + } + return ParseCertificate(data) +} + +func loadSystemRoots() (*CertPool, error) { + return &CertPool{systemPool: true}, nil +} diff --git a/go/src/crypto/x509/root_linux.go b/go/src/crypto/x509/root_linux.go new file mode 100644 index 0000000000000000000000000000000000000000..8e79ccb5f61f90b3b46ad90ce332a509fbda9968 --- /dev/null +++ b/go/src/crypto/x509/root_linux.go @@ -0,0 +1,32 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import "internal/goos" + +// Possible certificate files; stop after finding one. +var certFiles = []string{ + "/etc/ssl/certs/ca-certificates.crt", // Debian/Ubuntu/Gentoo etc. + "/etc/pki/tls/certs/ca-bundle.crt", // Fedora/RHEL 6 + "/etc/ssl/ca-bundle.pem", // OpenSUSE + "/etc/pki/tls/cacert.pem", // OpenELEC + "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem", // CentOS/RHEL 7 + "/etc/ssl/cert.pem", // Alpine Linux +} + +// Possible directories with certificate files; all will be read. +var certDirectories = []string{ + "/etc/ssl/certs", // SLES10/SLES11, https://golang.org/issue/12139 + "/etc/pki/tls/certs", // Fedora/RHEL +} + +func init() { + if goos.IsAndroid == 1 { + certDirectories = append(certDirectories, + "/system/etc/security/cacerts", // Android system roots + "/data/misc/keychain/certs-added", // User trusted CA folder + ) + } +} diff --git a/go/src/crypto/x509/root_linux_test.go b/go/src/crypto/x509/root_linux_test.go new file mode 100644 index 0000000000000000000000000000000000000000..8b8a29beeadcaf9096ebd72e89b142348d63d2da --- /dev/null +++ b/go/src/crypto/x509/root_linux_test.go @@ -0,0 +1,288 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build linux + +package x509 + +import ( + "encoding/pem" + "fmt" + "internal/testenv" + "os" + "syscall" + "testing" +) + +func TestSetFallbackRoots(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode") + } + + test := func(t *testing.T, name string, f func(t *testing.T)) { + t.Run(name, func(t *testing.T) { + if os.Getenv("CRYPTO_X509_SETFALLBACKROOTS_TEST") != "1" { + // Execute test in a separate process with CRYPTO_X509_SETFALBACKROOTS_TEST env. + cmd := testenv.Command(t, testenv.Executable(t), fmt.Sprintf("-test.run=^%v$", t.Name()), "-test.v") + cmd.Env = append(os.Environ(), "CRYPTO_X509_SETFALLBACKROOTS_TEST=1") + cmd.SysProcAttr = &syscall.SysProcAttr{ + Cloneflags: syscall.CLONE_NEWNS | syscall.CLONE_NEWUSER, + UidMappings: []syscall.SysProcIDMap{{ContainerID: 0, HostID: os.Getuid(), Size: 1}}, + GidMappings: []syscall.SysProcIDMap{{ContainerID: 0, HostID: os.Getgid(), Size: 1}}, + } + out, err := cmd.CombinedOutput() + if testenv.SyscallIsNotSupported(err) { + t.Skipf("skipping: could not start process with CLONE_NEWNS and CLONE_NEWUSER: %v", err) + } + t.Logf("running with CRYPTO_X509_SETFALLBACKROOTS_TEST=1:\n%s", out) + if err != nil { + t.Errorf("CRYPTO_X509_SETFALLBACKROOTS_TEST=1 subprocess failed: %v", err) + } + return + } + + // This test is executed in a separate user and mount namespace, thus + // we can mount a separate "/etc" empty bind mount, without the need for root access. + // On linux all certs reside in /etc, so as we bind an empty dir, we + // get a full control over the system CAs, required for this test. + if err := syscall.Mount(t.TempDir(), "/etc", "", syscall.MS_BIND, ""); err != nil { + if testenv.SyscallIsNotSupported(err) { + t.Skipf("Failed to mount /etc: %v", err) + } + t.Fatalf("Failed to mount /etc: %v", err) + } + + t.Cleanup(func() { + if err := syscall.Unmount("/etc", 0); err != nil { + t.Errorf("failed to unmount /etc: %v", err) + } + }) + + f(t) + }) + } + + newFallbackCertPool := func(t *testing.T) *CertPool { + t.Helper() + + const fallbackCert = `-----BEGIN CERTIFICATE----- +MIICGzCCAaGgAwIBAgIQQdKd0XLq7qeAwSxs6S+HUjAKBggqhkjOPQQDAzBPMQsw +CQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2gg +R3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBYMjAeFw0yMDA5MDQwMDAwMDBaFw00 +MDA5MTcxNjAwMDBaME8xCzAJBgNVBAYTAlVTMSkwJwYDVQQKEyBJbnRlcm5ldCBT +ZWN1cml0eSBSZXNlYXJjaCBHcm91cDEVMBMGA1UEAxMMSVNSRyBSb290IFgyMHYw +EAYHKoZIzj0CAQYFK4EEACIDYgAEzZvVn4CDCuwJSvMWSj5cz3es3mcFDR0HttwW ++1qLFNvicWDEukWVEYmO6gbf9yoWHKS5xcUy4APgHoIYOIvXRdgKam7mAHf7AlF9 +ItgKbppbd9/w+kHsOdx1ymgHDB/qo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0T +AQH/BAUwAwEB/zAdBgNVHQ4EFgQUfEKWrt5LSDv6kviejM9ti6lyN5UwCgYIKoZI +zj0EAwMDaAAwZQIwe3lORlCEwkSHRhtFcP9Ymd70/aTSVaYgLXTWNLxBo1BfASdW +tL4ndQavEi51mI38AjEAi/V3bNTIZargCyzuFJ0nN6T5U6VR5CmD1/iQMVtCnwr1 +/q4AaOeMSQ+2b1tbFfLn +-----END CERTIFICATE----- +` + b, _ := pem.Decode([]byte(fallbackCert)) + cert, err := ParseCertificate(b.Bytes) + if err != nil { + t.Fatal(err) + } + p := NewCertPool() + p.AddCert(cert) + return p + } + + installSystemRootCAs := func(t *testing.T) { + t.Helper() + + const systemCAs = `-----BEGIN CERTIFICATE----- +MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw +TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh +cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4 +WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu +ZXQgU2VjdXJpdHkgUmVzZWFyY2gg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kSsisRcOj/KK +NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5 +ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur +TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC +jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc +oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq +4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA +mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d +emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc= +-----END CERTIFICATE----- +` + if err := os.MkdirAll("/etc/ssl/certs", 06660); err != nil { + t.Fatal(err) + } + + if err := os.WriteFile("/etc/ssl/certs/ca-certificates.crt", []byte(systemCAs), 0666); err != nil { + t.Fatal(err) + } + } + + test(t, "after_first_load_no_system_CAs", func(t *testing.T) { + SystemCertPool() // load system certs, before setting fallbacks + fallback := newFallbackCertPool(t) + SetFallbackRoots(fallback) + got, err := SystemCertPool() + if err != nil { + t.Fatal(err) + } + if !got.Equal(fallback) { + t.Fatal("SystemCertPool returned a non-fallback CertPool") + } + }) + + test(t, "after_first_load_system_CA_read_error", func(t *testing.T) { + // This will fail to load in SystemCertPool since this is a directory, + // rather than a file with certificates. + if err := os.MkdirAll("/etc/ssl/certs/ca-certificates.crt", 0666); err != nil { + t.Fatal(err) + } + + _, err := SystemCertPool() // load system certs, before setting fallbacks + if err == nil { + t.Fatal("unexpected success") + } + + fallback := newFallbackCertPool(t) + SetFallbackRoots(fallback) + got, err := SystemCertPool() + if err != nil { + t.Fatal(err) + } + if !got.Equal(fallback) { + t.Fatal("SystemCertPool returned a non-fallback CertPool") + } + }) + + test(t, "after_first_load_with_system_CAs", func(t *testing.T) { + installSystemRootCAs(t) + + SystemCertPool() // load system certs, before setting fallbacks + + fallback := newFallbackCertPool(t) + SetFallbackRoots(fallback) + got, err := SystemCertPool() + if err != nil { + t.Fatal(err) + } + if got.Equal(fallback) { + t.Fatal("SystemCertPool returned the fallback CertPool") + } + }) + + test(t, "before_first_load_no_system_CAs", func(t *testing.T) { + fallback := newFallbackCertPool(t) + SetFallbackRoots(fallback) + got, err := SystemCertPool() + if err != nil { + t.Fatal(err) + } + if !got.Equal(fallback) { + t.Fatal("SystemCertPool returned a non-fallback CertPool") + } + }) + + test(t, "before_first_load_system_CA_read_error", func(t *testing.T) { + // This will fail to load in SystemCertPool since this is a directory, + // rather than a file with certificates. + if err := os.MkdirAll("/etc/ssl/certs/ca-certificates.crt", 0666); err != nil { + t.Fatal(err) + } + + fallback := newFallbackCertPool(t) + SetFallbackRoots(fallback) + got, err := SystemCertPool() + if err != nil { + t.Fatal(err) + } + if !got.Equal(fallback) { + t.Fatal("SystemCertPool returned a non-fallback CertPool") + } + }) + + test(t, "before_first_load_with_system_CAs", func(t *testing.T) { + installSystemRootCAs(t) + + fallback := newFallbackCertPool(t) + SetFallbackRoots(fallback) + got, err := SystemCertPool() + if err != nil { + t.Fatal(err) + } + if got.Equal(fallback) { + t.Fatal("SystemCertPool returned the fallback CertPool") + } + }) + + test(t, "before_first_load_force_godebug", func(t *testing.T) { + if err := os.Setenv("GODEBUG", "x509usefallbackroots=1"); err != nil { + t.Fatal(err) + } + + installSystemRootCAs(t) + + fallback := newFallbackCertPool(t) + SetFallbackRoots(fallback) + got, err := SystemCertPool() + if err != nil { + t.Fatal(err) + } + if !got.Equal(fallback) { + t.Fatal("SystemCertPool returned a non-fallback CertPool") + } + }) + + test(t, "after_first_load_force_godebug", func(t *testing.T) { + if err := os.Setenv("GODEBUG", "x509usefallbackroots=1"); err != nil { + t.Fatal(err) + } + + installSystemRootCAs(t) + SystemCertPool() // load system certs, before setting fallbacks + + fallback := newFallbackCertPool(t) + SetFallbackRoots(fallback) + got, err := SystemCertPool() + if err != nil { + t.Fatal(err) + } + if !got.Equal(fallback) { + t.Fatal("SystemCertPool returned a non-fallback CertPool") + } + }) + + test(t, "after_first_load_force_godebug_no_system_certs", func(t *testing.T) { + if err := os.Setenv("GODEBUG", "x509usefallbackroots=1"); err != nil { + t.Fatal(err) + } + + SystemCertPool() // load system certs, before setting fallbacks + + fallback := newFallbackCertPool(t) + SetFallbackRoots(fallback) + got, err := SystemCertPool() + if err != nil { + t.Fatal(err) + } + if !got.Equal(fallback) { + t.Fatal("SystemCertPool returned a non-fallback CertPool") + } + }) +} diff --git a/go/src/crypto/x509/root_plan9.go b/go/src/crypto/x509/root_plan9.go new file mode 100644 index 0000000000000000000000000000000000000000..3bd06fe50d85bf2f2e6eba64d126759b718de102 --- /dev/null +++ b/go/src/crypto/x509/root_plan9.go @@ -0,0 +1,39 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build plan9 + +package x509 + +import ( + "os" +) + +// Possible certificate files; stop after finding one. +var certFiles = []string{ + "/sys/lib/tls/ca.pem", +} + +func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) { + return nil, nil +} + +func loadSystemRoots() (*CertPool, error) { + roots := NewCertPool() + var bestErr error + for _, file := range certFiles { + data, err := os.ReadFile(file) + if err == nil { + roots.AppendCertsFromPEM(data) + return roots, nil + } + if bestErr == nil || (os.IsNotExist(bestErr) && !os.IsNotExist(err)) { + bestErr = err + } + } + if bestErr == nil { + return roots, nil + } + return nil, bestErr +} diff --git a/go/src/crypto/x509/root_solaris.go b/go/src/crypto/x509/root_solaris.go new file mode 100644 index 0000000000000000000000000000000000000000..617f26961f60bf335693a55acd0f4dbb5099744e --- /dev/null +++ b/go/src/crypto/x509/root_solaris.go @@ -0,0 +1,17 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +// Possible certificate files; stop after finding one. +var certFiles = []string{ + "/etc/certs/ca-certificates.crt", // Solaris 11.2+ + "/etc/ssl/certs/ca-certificates.crt", // Joyent SmartOS + "/etc/ssl/cacert.pem", // OmniOS +} + +// Possible directories with certificate files; all will be read. +var certDirectories = []string{ + "/etc/certs/CA", +} diff --git a/go/src/crypto/x509/root_test.go b/go/src/crypto/x509/root_test.go new file mode 100644 index 0000000000000000000000000000000000000000..218d2b6f98c7a61625352b920a69e2a638e59f83 --- /dev/null +++ b/go/src/crypto/x509/root_test.go @@ -0,0 +1,110 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "testing" +) + +func TestFallbackPanic(t *testing.T) { + defer func() { + if recover() == nil { + t.Fatal("Multiple calls to SetFallbackRoots should panic") + } + }() + SetFallbackRoots(nil) + SetFallbackRoots(nil) +} + +func TestFallback(t *testing.T) { + // call systemRootsPool so that the sync.Once is triggered, and we can + // manipulate systemRoots without worrying about our working being overwritten + systemRootsPool() + if systemRoots != nil { + originalSystemRoots := *systemRoots + defer func() { systemRoots = &originalSystemRoots }() + } + + tests := []struct { + name string + systemRoots *CertPool + systemPool bool + poolContent []*Certificate + forceFallback bool + returnsFallback bool + }{ + { + name: "nil systemRoots", + returnsFallback: true, + }, + { + name: "empty systemRoots", + systemRoots: NewCertPool(), + returnsFallback: true, + }, + { + name: "empty systemRoots system pool", + systemRoots: NewCertPool(), + systemPool: true, + }, + { + name: "filled systemRoots system pool", + systemRoots: NewCertPool(), + poolContent: []*Certificate{{}}, + systemPool: true, + }, + { + name: "filled systemRoots", + systemRoots: NewCertPool(), + poolContent: []*Certificate{{}}, + }, + { + name: "filled systemRoots, force fallback", + systemRoots: NewCertPool(), + poolContent: []*Certificate{{}}, + forceFallback: true, + returnsFallback: true, + }, + { + name: "filled systemRoot system pool, force fallback", + systemRoots: NewCertPool(), + poolContent: []*Certificate{{}}, + systemPool: true, + forceFallback: true, + returnsFallback: true, + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + useFallbackRoots = false + fallbacksSet = false + systemRoots = tc.systemRoots + + if systemRoots != nil { + systemRoots.systemPool = tc.systemPool + } + for _, c := range tc.poolContent { + systemRoots.AddCert(c) + } + if tc.forceFallback { + t.Setenv("GODEBUG", "x509usefallbackroots=1") + } else { + t.Setenv("GODEBUG", "x509usefallbackroots=0") + } + + fallbackPool := NewCertPool() + SetFallbackRoots(fallbackPool) + + systemPoolIsFallback := systemRoots == fallbackPool + + if tc.returnsFallback && !systemPoolIsFallback { + t.Error("systemRoots was not set to fallback pool") + } else if !tc.returnsFallback && systemPoolIsFallback { + t.Error("systemRoots was set to fallback pool when it shouldn't have been") + } + }) + } +} diff --git a/go/src/crypto/x509/root_unix.go b/go/src/crypto/x509/root_unix.go new file mode 100644 index 0000000000000000000000000000000000000000..c513b20169d1d951a8786abf0b3eda35ade4e228 --- /dev/null +++ b/go/src/crypto/x509/root_unix.go @@ -0,0 +1,108 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build aix || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || wasip1 + +package x509 + +import ( + "io/fs" + "os" + "path/filepath" + "strings" +) + +const ( + // certFileEnv is the environment variable which identifies where to locate + // the SSL certificate file. If set this overrides the system default. + certFileEnv = "SSL_CERT_FILE" + + // certDirEnv is the environment variable which identifies which directory + // to check for SSL certificate files. If set this overrides the system default. + // It is a colon separated list of directories. + // See https://www.openssl.org/docs/man1.0.2/man1/c_rehash.html. + certDirEnv = "SSL_CERT_DIR" +) + +func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) { + return nil, nil +} + +func loadSystemRoots() (*CertPool, error) { + roots := NewCertPool() + + files := certFiles + if f := os.Getenv(certFileEnv); f != "" { + files = []string{f} + } + + var firstErr error + for _, file := range files { + data, err := os.ReadFile(file) + if err == nil { + roots.AppendCertsFromPEM(data) + break + } + if firstErr == nil && !os.IsNotExist(err) { + firstErr = err + } + } + + dirs := certDirectories + if d := os.Getenv(certDirEnv); d != "" { + // OpenSSL and BoringSSL both use ":" as the SSL_CERT_DIR separator. + // See: + // * https://golang.org/issue/35325 + // * https://www.openssl.org/docs/man1.0.2/man1/c_rehash.html + dirs = strings.Split(d, ":") + } + + for _, directory := range dirs { + fis, err := readUniqueDirectoryEntries(directory) + if err != nil { + if firstErr == nil && !os.IsNotExist(err) { + firstErr = err + } + continue + } + for _, fi := range fis { + data, err := os.ReadFile(directory + "/" + fi.Name()) + if err == nil { + roots.AppendCertsFromPEM(data) + } + } + } + + if roots.len() > 0 || firstErr == nil { + return roots, nil + } + + return nil, firstErr +} + +// readUniqueDirectoryEntries is like os.ReadDir but omits +// symlinks that point within the directory. +func readUniqueDirectoryEntries(dir string) ([]fs.DirEntry, error) { + files, err := os.ReadDir(dir) + if err != nil { + return nil, err + } + uniq := files[:0] + for _, f := range files { + if !isSameDirSymlink(f, dir) { + uniq = append(uniq, f) + } + } + return uniq, nil +} + +// isSameDirSymlink reports whether fi in dir is a symlink with a +// target not containing a slash. +func isSameDirSymlink(f fs.DirEntry, dir string) bool { + if f.Type()&fs.ModeSymlink == 0 { + return false + } + target, err := os.Readlink(filepath.Join(dir, f.Name())) + return err == nil && !strings.Contains(target, "/") +} diff --git a/go/src/crypto/x509/root_unix_test.go b/go/src/crypto/x509/root_unix_test.go new file mode 100644 index 0000000000000000000000000000000000000000..b03a03d1169c06eaab278f2f6947388bf6ff046a --- /dev/null +++ b/go/src/crypto/x509/root_unix_test.go @@ -0,0 +1,237 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build dragonfly || freebsd || linux || netbsd || openbsd || solaris + +package x509 + +import ( + "bytes" + "fmt" + "os" + "path/filepath" + "slices" + "strings" + "testing" +) + +const ( + testDirCN = "test-dir" + testFile = "test-file.crt" + testFileCN = "test-file" + testMissing = "missing" +) + +func TestEnvVars(t *testing.T) { + tmpDir := t.TempDir() + testCert, err := os.ReadFile("testdata/test-dir.crt") + if err != nil { + t.Fatalf("failed to read test cert: %s", err) + } + if err := os.WriteFile(filepath.Join(tmpDir, testFile), testCert, 0644); err != nil { + if err != nil { + t.Fatalf("failed to write test cert: %s", err) + } + } + + testCases := []struct { + name string + fileEnv string + dirEnv string + files []string + dirs []string + cns []string + }{ + { + // Environment variables override the default locations preventing fall through. + name: "override-defaults", + fileEnv: testMissing, + dirEnv: testMissing, + files: []string{testFile}, + dirs: []string{tmpDir}, + cns: nil, + }, + { + // File environment overrides default file locations. + name: "file", + fileEnv: testFile, + dirEnv: "", + files: nil, + dirs: nil, + cns: []string{testFileCN}, + }, + { + // Directory environment overrides default directory locations. + name: "dir", + fileEnv: "", + dirEnv: tmpDir, + files: nil, + dirs: nil, + cns: []string{testDirCN}, + }, + { + // File & directory environment overrides both default locations. + name: "file+dir", + fileEnv: testFile, + dirEnv: tmpDir, + files: nil, + dirs: nil, + cns: []string{testFileCN, testDirCN}, + }, + { + // Environment variable empty / unset uses default locations. + name: "empty-fall-through", + fileEnv: "", + dirEnv: "", + files: []string{testFile}, + dirs: []string{tmpDir}, + cns: []string{testFileCN, testDirCN}, + }, + } + + // Save old settings so we can restore before the test ends. + origCertFiles, origCertDirectories := certFiles, certDirectories + origFile, origDir := os.Getenv(certFileEnv), os.Getenv(certDirEnv) + defer func() { + certFiles = origCertFiles + certDirectories = origCertDirectories + os.Setenv(certFileEnv, origFile) + os.Setenv(certDirEnv, origDir) + }() + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + if err := os.Setenv(certFileEnv, tc.fileEnv); err != nil { + t.Fatalf("setenv %q failed: %v", certFileEnv, err) + } + if err := os.Setenv(certDirEnv, tc.dirEnv); err != nil { + t.Fatalf("setenv %q failed: %v", certDirEnv, err) + } + + certFiles, certDirectories = tc.files, tc.dirs + + r, err := loadSystemRoots() + if err != nil { + t.Fatal("unexpected failure:", err) + } + + if r == nil { + t.Fatal("nil roots") + } + + // Verify that the returned certs match, otherwise report where the mismatch is. + for i, cn := range tc.cns { + if i >= r.len() { + t.Errorf("missing cert %v @ %v", cn, i) + } else if r.mustCert(t, i).Subject.CommonName != cn { + fmt.Printf("%#v\n", r.mustCert(t, 0).Subject) + t.Errorf("unexpected cert common name %q, want %q", r.mustCert(t, i).Subject.CommonName, cn) + } + } + if r.len() > len(tc.cns) { + t.Errorf("got %v certs, which is more than %v wanted", r.len(), len(tc.cns)) + } + }) + } +} + +// Ensure that "SSL_CERT_DIR" when used as the environment +// variable delimited by colons, allows loadSystemRoots to +// load all the roots from the respective directories. +// See https://golang.org/issue/35325. +func TestLoadSystemCertsLoadColonSeparatedDirs(t *testing.T) { + origFile, origDir := os.Getenv(certFileEnv), os.Getenv(certDirEnv) + origCertFiles := certFiles[:] + + // To prevent any other certs from being loaded in + // through "SSL_CERT_FILE" or from known "certFiles", + // clear them all, and they'll be reverting on defer. + certFiles = certFiles[:0] + os.Setenv(certFileEnv, "") + + defer func() { + certFiles = origCertFiles[:] + os.Setenv(certDirEnv, origDir) + os.Setenv(certFileEnv, origFile) + }() + + tmpDir := t.TempDir() + + rootPEMs := []string{ + gtsRoot, + googleLeaf, + } + + var certDirs []string + for i, certPEM := range rootPEMs { + certDir := filepath.Join(tmpDir, fmt.Sprintf("cert-%d", i)) + if err := os.MkdirAll(certDir, 0755); err != nil { + t.Fatalf("Failed to create certificate dir: %v", err) + } + certOutFile := filepath.Join(certDir, "cert.crt") + if err := os.WriteFile(certOutFile, []byte(certPEM), 0655); err != nil { + t.Fatalf("Failed to write certificate to file: %v", err) + } + certDirs = append(certDirs, certDir) + } + + // Sanity check: the number of certDirs should be equal to the number of roots. + if g, w := len(certDirs), len(rootPEMs); g != w { + t.Fatalf("Failed sanity check: len(certsDir)=%d is not equal to len(rootsPEMS)=%d", g, w) + } + + // Now finally concatenate them with a colon. + colonConcatCertDirs := strings.Join(certDirs, ":") + os.Setenv(certDirEnv, colonConcatCertDirs) + gotPool, err := loadSystemRoots() + if err != nil { + t.Fatalf("Failed to load system roots: %v", err) + } + subjects := gotPool.Subjects() + // We expect exactly len(rootPEMs) subjects back. + if g, w := len(subjects), len(rootPEMs); g != w { + t.Fatalf("Invalid number of subjects: got %d want %d", g, w) + } + + wantPool := NewCertPool() + for _, certPEM := range rootPEMs { + wantPool.AppendCertsFromPEM([]byte(certPEM)) + } + strCertPool := func(p *CertPool) string { + return string(bytes.Join(p.Subjects(), []byte("\n"))) + } + + if !certPoolEqual(gotPool, wantPool) { + g, w := strCertPool(gotPool), strCertPool(wantPool) + t.Fatalf("Mismatched certPools\nGot:\n%s\n\nWant:\n%s", g, w) + } +} + +func TestReadUniqueDirectoryEntries(t *testing.T) { + tmp := t.TempDir() + temp := func(base string) string { return filepath.Join(tmp, base) } + if f, err := os.Create(temp("file")); err != nil { + t.Fatal(err) + } else { + f.Close() + } + if err := os.Symlink("target-in", temp("link-in")); err != nil { + t.Fatal(err) + } + if err := os.Symlink("../target-out", temp("link-out")); err != nil { + t.Fatal(err) + } + got, err := readUniqueDirectoryEntries(tmp) + if err != nil { + t.Fatal(err) + } + gotNames := []string{} + for _, fi := range got { + gotNames = append(gotNames, fi.Name()) + } + wantNames := []string{"file", "link-out"} + if !slices.Equal(gotNames, wantNames) { + t.Errorf("got %q; want %q", gotNames, wantNames) + } +} diff --git a/go/src/crypto/x509/root_wasm.go b/go/src/crypto/x509/root_wasm.go new file mode 100644 index 0000000000000000000000000000000000000000..275c9213d9594db6c5742e818a5efdf2057d351c --- /dev/null +++ b/go/src/crypto/x509/root_wasm.go @@ -0,0 +1,13 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build wasm + +package x509 + +// Possible certificate files; stop after finding one. +var certFiles = []string{} + +// Possible directories with certificate files; all will be read. +var certDirectories = []string{} diff --git a/go/src/crypto/x509/root_windows.go b/go/src/crypto/x509/root_windows.go new file mode 100644 index 0000000000000000000000000000000000000000..4bea1081618a65adcb51b6c2cdc34691420e4839 --- /dev/null +++ b/go/src/crypto/x509/root_windows.go @@ -0,0 +1,277 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "bytes" + "errors" + "strings" + "syscall" + "unsafe" +) + +func loadSystemRoots() (*CertPool, error) { + return &CertPool{systemPool: true}, nil +} + +// Creates a new *syscall.CertContext representing the leaf certificate in an in-memory +// certificate store containing itself and all of the intermediate certificates specified +// in the opts.Intermediates CertPool. +// +// A pointer to the in-memory store is available in the returned CertContext's Store field. +// The store is automatically freed when the CertContext is freed using +// syscall.CertFreeCertificateContext. +func createStoreContext(leaf *Certificate, opts *VerifyOptions) (*syscall.CertContext, error) { + var storeCtx *syscall.CertContext + + leafCtx, err := syscall.CertCreateCertificateContext(syscall.X509_ASN_ENCODING|syscall.PKCS_7_ASN_ENCODING, &leaf.Raw[0], uint32(len(leaf.Raw))) + if err != nil { + return nil, err + } + defer syscall.CertFreeCertificateContext(leafCtx) + + handle, err := syscall.CertOpenStore(syscall.CERT_STORE_PROV_MEMORY, 0, 0, syscall.CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG, 0) + if err != nil { + return nil, err + } + defer syscall.CertCloseStore(handle, 0) + + err = syscall.CertAddCertificateContextToStore(handle, leafCtx, syscall.CERT_STORE_ADD_ALWAYS, &storeCtx) + if err != nil { + return nil, err + } + + if opts.Intermediates != nil { + for i := 0; i < opts.Intermediates.len(); i++ { + intermediate, _, err := opts.Intermediates.cert(i) + if err != nil { + return nil, err + } + ctx, err := syscall.CertCreateCertificateContext(syscall.X509_ASN_ENCODING|syscall.PKCS_7_ASN_ENCODING, &intermediate.Raw[0], uint32(len(intermediate.Raw))) + if err != nil { + return nil, err + } + + err = syscall.CertAddCertificateContextToStore(handle, ctx, syscall.CERT_STORE_ADD_ALWAYS, nil) + syscall.CertFreeCertificateContext(ctx) + if err != nil { + return nil, err + } + } + } + + return storeCtx, nil +} + +// extractSimpleChain extracts the final certificate chain from a CertSimpleChain. +func extractSimpleChain(simpleChain **syscall.CertSimpleChain, count int) (chain []*Certificate, err error) { + if simpleChain == nil || count == 0 { + return nil, errors.New("x509: invalid simple chain") + } + + simpleChains := unsafe.Slice(simpleChain, count) + lastChain := simpleChains[count-1] + elements := unsafe.Slice(lastChain.Elements, lastChain.NumElements) + for i := 0; i < int(lastChain.NumElements); i++ { + // Copy the buf, since ParseCertificate does not create its own copy. + cert := elements[i].CertContext + encodedCert := unsafe.Slice(cert.EncodedCert, cert.Length) + buf := bytes.Clone(encodedCert) + parsedCert, err := ParseCertificate(buf) + if err != nil { + return nil, err + } + chain = append(chain, parsedCert) + } + + return chain, nil +} + +// checkChainTrustStatus checks the trust status of the certificate chain, translating +// any errors it finds into Go errors in the process. +func checkChainTrustStatus(c *Certificate, chainCtx *syscall.CertChainContext) error { + if chainCtx.TrustStatus.ErrorStatus != syscall.CERT_TRUST_NO_ERROR { + status := chainCtx.TrustStatus.ErrorStatus + switch status { + case syscall.CERT_TRUST_IS_NOT_TIME_VALID: + return CertificateInvalidError{c, Expired, ""} + case syscall.CERT_TRUST_IS_NOT_VALID_FOR_USAGE: + return CertificateInvalidError{c, IncompatibleUsage, ""} + // TODO(filippo): surface more error statuses. + default: + return UnknownAuthorityError{c, nil, nil} + } + } + return nil +} + +// checkChainSSLServerPolicy checks that the certificate chain in chainCtx is valid for +// use as a certificate chain for a SSL/TLS server. +func checkChainSSLServerPolicy(c *Certificate, chainCtx *syscall.CertChainContext, opts *VerifyOptions) error { + servernamep, err := syscall.UTF16PtrFromString(strings.TrimSuffix(opts.DNSName, ".")) + if err != nil { + return err + } + sslPara := &syscall.SSLExtraCertChainPolicyPara{ + AuthType: syscall.AUTHTYPE_SERVER, + ServerName: servernamep, + } + sslPara.Size = uint32(unsafe.Sizeof(*sslPara)) + + para := &syscall.CertChainPolicyPara{ + ExtraPolicyPara: (syscall.Pointer)(unsafe.Pointer(sslPara)), + } + para.Size = uint32(unsafe.Sizeof(*para)) + + status := syscall.CertChainPolicyStatus{} + err = syscall.CertVerifyCertificateChainPolicy(syscall.CERT_CHAIN_POLICY_SSL, chainCtx, para, &status) + if err != nil { + return err + } + + // TODO(mkrautz): use the lChainIndex and lElementIndex fields + // of the CertChainPolicyStatus to provide proper context, instead + // using c. + if status.Error != 0 { + switch status.Error { + case syscall.CERT_E_EXPIRED: + return CertificateInvalidError{c, Expired, ""} + case syscall.CERT_E_CN_NO_MATCH: + return HostnameError{c, opts.DNSName} + case syscall.CERT_E_UNTRUSTEDROOT: + return UnknownAuthorityError{c, nil, nil} + default: + return UnknownAuthorityError{c, nil, nil} + } + } + + return nil +} + +// windowsExtKeyUsageOIDs are the C NUL-terminated string representations of the +// OIDs for use with the Windows API. +var windowsExtKeyUsageOIDs = make(map[ExtKeyUsage][]byte, len(extKeyUsageOIDs)) + +func init() { + for _, eku := range extKeyUsageOIDs { + windowsExtKeyUsageOIDs[eku.extKeyUsage] = []byte(eku.oid.String() + "\x00") + } +} + +func verifyChain(c *Certificate, chainCtx *syscall.CertChainContext, opts *VerifyOptions) (chain []*Certificate, err error) { + err = checkChainTrustStatus(c, chainCtx) + if err != nil { + return nil, err + } + + if opts != nil && len(opts.DNSName) > 0 { + err = checkChainSSLServerPolicy(c, chainCtx, opts) + if err != nil { + return nil, err + } + } + + chain, err = extractSimpleChain(chainCtx.Chains, int(chainCtx.ChainCount)) + if err != nil { + return nil, err + } + if len(chain) == 0 { + return nil, errors.New("x509: internal error: system verifier returned an empty chain") + } + + // Mitigate CVE-2020-0601, where the Windows system verifier might be + // tricked into using custom curve parameters for a trusted root, by + // double-checking all ECDSA signatures. If the system was tricked into + // using spoofed parameters, the signature will be invalid for the correct + // ones we parsed. (We don't support custom curves ourselves.) + for i, parent := range chain[1:] { + if parent.PublicKeyAlgorithm != ECDSA { + continue + } + if err := parent.CheckSignature(chain[i].SignatureAlgorithm, + chain[i].RawTBSCertificate, chain[i].Signature); err != nil { + return nil, err + } + } + return chain, nil +} + +// systemVerify is like Verify, except that it uses CryptoAPI calls +// to build certificate chains and verify them. +func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) { + storeCtx, err := createStoreContext(c, opts) + if err != nil { + return nil, err + } + defer syscall.CertFreeCertificateContext(storeCtx) + + para := new(syscall.CertChainPara) + para.Size = uint32(unsafe.Sizeof(*para)) + + keyUsages := opts.KeyUsages + if len(keyUsages) == 0 { + keyUsages = []ExtKeyUsage{ExtKeyUsageServerAuth} + } + oids := make([]*byte, 0, len(keyUsages)) + for _, eku := range keyUsages { + if eku == ExtKeyUsageAny { + oids = nil + break + } + if oid, ok := windowsExtKeyUsageOIDs[eku]; ok { + oids = append(oids, &oid[0]) + } + } + if oids != nil { + para.RequestedUsage.Type = syscall.USAGE_MATCH_TYPE_OR + para.RequestedUsage.Usage.Length = uint32(len(oids)) + para.RequestedUsage.Usage.UsageIdentifiers = &oids[0] + } else { + para.RequestedUsage.Type = syscall.USAGE_MATCH_TYPE_AND + para.RequestedUsage.Usage.Length = 0 + para.RequestedUsage.Usage.UsageIdentifiers = nil + } + + var verifyTime *syscall.Filetime + if opts != nil && !opts.CurrentTime.IsZero() { + ft := syscall.NsecToFiletime(opts.CurrentTime.UnixNano()) + verifyTime = &ft + } + + // The default is to return only the highest quality chain, + // setting this flag will add additional lower quality contexts. + // These are returned in the LowerQualityChains field. + const CERT_CHAIN_RETURN_LOWER_QUALITY_CONTEXTS = 0x00000080 + + // CertGetCertificateChain will traverse Windows's root stores in an attempt to build a verified certificate chain + var topCtx *syscall.CertChainContext + err = syscall.CertGetCertificateChain(syscall.Handle(0), storeCtx, verifyTime, storeCtx.Store, para, CERT_CHAIN_RETURN_LOWER_QUALITY_CONTEXTS, 0, &topCtx) + if err != nil { + return nil, err + } + defer syscall.CertFreeCertificateChain(topCtx) + + chain, topErr := verifyChain(c, topCtx, opts) + if topErr == nil { + chains = append(chains, chain) + } + + if lqCtxCount := topCtx.LowerQualityChainCount; lqCtxCount > 0 { + lqCtxs := unsafe.Slice(topCtx.LowerQualityChains, lqCtxCount) + for _, ctx := range lqCtxs { + chain, err := verifyChain(c, ctx, opts) + if err == nil { + chains = append(chains, chain) + } + } + } + + if len(chains) == 0 { + // Return the error from the highest quality context. + return nil, topErr + } + + return chains, nil +} diff --git a/go/src/crypto/x509/sec1.go b/go/src/crypto/x509/sec1.go new file mode 100644 index 0000000000000000000000000000000000000000..6212c2d4ff58ed95f6ca6d52ab18719aeba652cf --- /dev/null +++ b/go/src/crypto/x509/sec1.go @@ -0,0 +1,130 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "crypto/ecdh" + "crypto/ecdsa" + "crypto/elliptic" + "encoding/asn1" + "errors" + "fmt" +) + +const ecPrivKeyVersion = 1 + +// ecPrivateKey reflects an ASN.1 Elliptic Curve Private Key Structure. +// References: +// +// RFC 5915 +// SEC1 - http://www.secg.org/sec1-v2.pdf +// +// Per RFC 5915 the NamedCurveOID is marked as ASN.1 OPTIONAL, however in +// most cases it is not. +type ecPrivateKey struct { + Version int + PrivateKey []byte + NamedCurveOID asn1.ObjectIdentifier `asn1:"optional,explicit,tag:0"` + PublicKey asn1.BitString `asn1:"optional,explicit,tag:1"` +} + +// ParseECPrivateKey parses an EC private key in SEC 1, ASN.1 DER form. +// +// This kind of key is commonly encoded in PEM blocks of type "EC PRIVATE KEY". +func ParseECPrivateKey(der []byte) (*ecdsa.PrivateKey, error) { + return parseECPrivateKey(nil, der) +} + +// MarshalECPrivateKey converts an EC private key to SEC 1, ASN.1 DER form. +// +// This kind of key is commonly encoded in PEM blocks of type "EC PRIVATE KEY". +// For a more flexible key format which is not EC specific, use +// [MarshalPKCS8PrivateKey]. +func MarshalECPrivateKey(key *ecdsa.PrivateKey) ([]byte, error) { + oid, ok := oidFromNamedCurve(key.Curve) + if !ok { + return nil, errors.New("x509: unknown elliptic curve") + } + + return marshalECPrivateKeyWithOID(key, oid) +} + +// marshalECPrivateKeyWithOID marshals an EC private key into ASN.1, DER format and +// sets the curve ID to the given OID, or omits it if OID is nil. +func marshalECPrivateKeyWithOID(key *ecdsa.PrivateKey, oid asn1.ObjectIdentifier) ([]byte, error) { + privateKey, err := key.Bytes() + if err != nil { + return nil, err + } + publicKey, err := key.PublicKey.Bytes() + if err != nil { + return nil, err + } + return asn1.Marshal(ecPrivateKey{ + Version: 1, + PrivateKey: privateKey, + NamedCurveOID: oid, + PublicKey: asn1.BitString{Bytes: publicKey}, + }) +} + +// marshalECDHPrivateKey marshals an EC private key into ASN.1, DER format +// suitable for NIST curves. +func marshalECDHPrivateKey(key *ecdh.PrivateKey) ([]byte, error) { + return asn1.Marshal(ecPrivateKey{ + Version: 1, + PrivateKey: key.Bytes(), + PublicKey: asn1.BitString{Bytes: key.PublicKey().Bytes()}, + }) +} + +// parseECPrivateKey parses an ASN.1 Elliptic Curve Private Key Structure. +// The OID for the named curve may be provided from another source (such as +// the PKCS8 container) - if it is provided then use this instead of the OID +// that may exist in the EC private key structure. +func parseECPrivateKey(namedCurveOID *asn1.ObjectIdentifier, der []byte) (key *ecdsa.PrivateKey, err error) { + var privKey ecPrivateKey + if _, err := asn1.Unmarshal(der, &privKey); err != nil { + if _, err := asn1.Unmarshal(der, &pkcs8{}); err == nil { + return nil, errors.New("x509: failed to parse private key (use ParsePKCS8PrivateKey instead for this key format)") + } + if _, err := asn1.Unmarshal(der, &pkcs1PrivateKey{}); err == nil { + return nil, errors.New("x509: failed to parse private key (use ParsePKCS1PrivateKey instead for this key format)") + } + return nil, errors.New("x509: failed to parse EC private key: " + err.Error()) + } + if privKey.Version != ecPrivKeyVersion { + return nil, fmt.Errorf("x509: unknown EC private key version %d", privKey.Version) + } + + var curve elliptic.Curve + if namedCurveOID != nil { + curve = namedCurveFromOID(*namedCurveOID) + } else { + curve = namedCurveFromOID(privKey.NamedCurveOID) + } + if curve == nil { + return nil, errors.New("x509: unknown elliptic curve") + } + + size := (curve.Params().N.BitLen() + 7) / 8 + privateKey := make([]byte, size) + + // Some private keys have leading zero padding. This is invalid + // according to [SEC1], but this code will ignore it. + for len(privKey.PrivateKey) > len(privateKey) { + if privKey.PrivateKey[0] != 0 { + return nil, errors.New("x509: invalid private key length") + } + privKey.PrivateKey = privKey.PrivateKey[1:] + } + + // Some private keys remove all leading zeros, this is also invalid + // according to [SEC1] but since OpenSSL used to do this, we ignore + // this too. + copy(privateKey[len(privateKey)-len(privKey.PrivateKey):], privKey.PrivateKey) + + return ecdsa.ParseRawPrivateKey(curve, privateKey) +} diff --git a/go/src/crypto/x509/sec1_test.go b/go/src/crypto/x509/sec1_test.go new file mode 100644 index 0000000000000000000000000000000000000000..9ac251896bd995ecebcd70c2831b476750f9619c --- /dev/null +++ b/go/src/crypto/x509/sec1_test.go @@ -0,0 +1,66 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "bytes" + "encoding/hex" + "strings" + "testing" +) + +var ecKeyTests = []struct { + derHex string + shouldReserialize bool +}{ + // Generated using: + // openssl ecparam -genkey -name secp384r1 -outform PEM + {"3081a40201010430bdb9839c08ee793d1157886a7a758a3c8b2a17a4df48f17ace57c72c56b4723cf21dcda21d4e1ad57ff034f19fcfd98ea00706052b81040022a16403620004feea808b5ee2429cfcce13c32160e1c960990bd050bb0fdf7222f3decd0a55008e32a6aa3c9062051c4cba92a7a3b178b24567412d43cdd2f882fa5addddd726fe3e208d2c26d733a773a597abb749714df7256ead5105fa6e7b3650de236b50", true}, + // This key was generated by GnuTLS and has illegal zero-padding of the + // private key. See https://golang.org/issues/13699. + {"3078020101042100f9f43a04b9bdc3ab01f53be6df80e7a7bc3eaf7b87fc24e630a4a0aa97633645a00a06082a8648ce3d030107a1440342000441a51bc318461b4c39a45048a16d4fc2a935b1ea7fe86e8c1fa219d6f2438f7c7fd62957d3442efb94b6a23eb0ea66dda663dc42f379cda6630b21b7888a5d3d", false}, + // This was generated using an old version of OpenSSL and is missing a + // leading zero byte in the private key that should be present. + {"3081db0201010441607b4f985774ac21e633999794542e09312073480baa69550914d6d43d8414441e61b36650567901da714f94dffb3ce0e2575c31928a0997d51df5c440e983ca17a00706052b81040023a181890381860004001661557afedd7ac8d6b70e038e576558c626eb62edda36d29c3a1310277c11f67a8c6f949e5430a37dcfb95d902c1b5b5379c389873b9dd17be3bdb088a4774a7401072f830fb9a08d93bfa50a03dd3292ea07928724ddb915d831917a338f6b0aecfbc3cf5352c4a1295d356890c41c34116d29eeb93779aab9d9d78e2613437740f6", false}, +} + +func TestParseECPrivateKey(t *testing.T) { + for i, test := range ecKeyTests { + derBytes, _ := hex.DecodeString(test.derHex) + key, err := ParseECPrivateKey(derBytes) + if err != nil { + t.Fatalf("#%d: failed to decode EC private key: %s", i, err) + } + serialized, err := MarshalECPrivateKey(key) + if err != nil { + t.Fatalf("#%d: failed to encode EC private key: %s", i, err) + } + matches := bytes.Equal(serialized, derBytes) + if matches != test.shouldReserialize { + t.Fatalf("#%d: when serializing key: matches=%t, should match=%t: original %x, reserialized %x", i, matches, test.shouldReserialize, serialized, derBytes) + } + } +} + +const hexECTestPKCS1Key = "3082025c02010002818100b1a1e0945b9289c4d3f1329f8a982c4a2dcd59bfd372fb8085a9c517554607ebd2f7990eef216ac9f4605f71a03b04f42a5255b158cf8e0844191f5119348baa44c35056e20609bcf9510f30ead4b481c81d7865fb27b8e0090e112b717f3ee08cdfc4012da1f1f7cf2a1bc34c73a54a12b06372d09714742dd7895eadde4aa5020301000102818062b7fa1db93e993e40237de4d89b7591cc1ea1d04fed4904c643f17ae4334557b4295270d0491c161cb02a9af557978b32b20b59c267a721c4e6c956c2d147046e9ae5f2da36db0106d70021fa9343455f8f973a4b355a26fd19e6b39dee0405ea2b32deddf0f4817759ef705d02b34faab9ca93c6766e9f722290f119f34449024100d9c29a4a013a90e35fd1be14a3f747c589fac613a695282d61812a711906b8a0876c6181f0333ca1066596f57bff47e7cfcabf19c0fc69d9cd76df743038b3cb024100d0d3546fecf879b5551f2bd2c05e6385f2718a08a6face3d2aecc9d7e03645a480a46c81662c12ad6bd6901e3bd4f38029462de7290859567cdf371c79088d4f024100c254150657e460ea58573fcf01a82a4791e3d6223135c8bdfed69afe84fbe7857274f8eb5165180507455f9b4105c6b08b51fe8a481bb986a202245576b713530240045700003b7a867d0041df9547ae2e7f50248febd21c9040b12dae9c2feab0d3d4609668b208e4727a3541557f84d372ac68eaf74ce1018a4c9a0ef92682c8fd02405769731480bb3a4570abf422527c5f34bf732fa6c1e08cc322753c511ce055fac20fc770025663ad3165324314df907f1f1942f0448a7e9cdbf87ecd98b92156" +const hexECTestPKCS8Key = "30820278020100300d06092a864886f70d0101010500048202623082025e02010002818100cfb1b5bf9685ffa97b4f99df4ff122b70e59ac9b992f3bc2b3dde17d53c1a34928719b02e8fd17839499bfbd515bd6ef99c7a1c47a239718fe36bfd824c0d96060084b5f67f0273443007a24dfaf5634f7772c9346e10eb294c2306671a5a5e719ae24b4de467291bc571014b0e02dec04534d66a9bb171d644b66b091780e8d020301000102818100b595778383c4afdbab95d2bfed12b3f93bb0a73a7ad952f44d7185fd9ec6c34de8f03a48770f2009c8580bcd275e9632714e9a5e3f32f29dc55474b2329ff0ebc08b3ffcb35bc96e6516b483df80a4a59cceb71918cbabf91564e64a39d7e35dce21cb3031824fdbc845dba6458852ec16af5dddf51a8397a8797ae0337b1439024100ea0eb1b914158c70db39031dd8904d6f18f408c85fbbc592d7d20dee7986969efbda081fdf8bc40e1b1336d6b638110c836bfdc3f314560d2e49cd4fbde1e20b024100e32a4e793b574c9c4a94c8803db5152141e72d03de64e54ef2c8ed104988ca780cd11397bc359630d01b97ebd87067c5451ba777cf045ca23f5912f1031308c702406dfcdbbd5a57c9f85abc4edf9e9e29153507b07ce0a7ef6f52e60dcfebe1b8341babd8b789a837485da6c8d55b29bbb142ace3c24a1f5b54b454d01b51e2ad03024100bd6a2b60dee01e1b3bfcef6a2f09ed027c273cdbbaf6ba55a80f6dcc64e4509ee560f84b4f3e076bd03b11e42fe71a3fdd2dffe7e0902c8584f8cad877cdc945024100aa512fa4ada69881f1d8bb8ad6614f192b83200aef5edf4811313d5ef30a86cbd0a90f7b025c71ea06ec6b34db6306c86b1040670fd8654ad7291d066d06d031" + +var ecMismatchKeyTests = []struct { + hexKey string + errorContains string +}{ + {hexKey: hexECTestPKCS8Key, errorContains: "use ParsePKCS8PrivateKey instead"}, + {hexKey: hexECTestPKCS1Key, errorContains: "use ParsePKCS1PrivateKey instead"}, +} + +func TestECMismatchKeyFormat(t *testing.T) { + for i, test := range ecMismatchKeyTests { + derBytes, _ := hex.DecodeString(test.hexKey) + _, err := ParseECPrivateKey(derBytes) + if !strings.Contains(err.Error(), test.errorContains) { + t.Errorf("#%d: expected error containing %q, got %s", i, test.errorContains, err) + } + } +} diff --git a/go/src/crypto/x509/test-file.crt b/go/src/crypto/x509/test-file.crt new file mode 100644 index 0000000000000000000000000000000000000000..caa83b9f824c104c8f4aa03b13f770ad91b794e1 --- /dev/null +++ b/go/src/crypto/x509/test-file.crt @@ -0,0 +1,32 @@ +-----BEGIN CERTIFICATE----- +MIIFbTCCA1WgAwIBAgIJAN338vEmMtLsMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNV +BAYTAlVLMRMwEQYDVQQIDApUZXN0LVN0YXRlMRUwEwYDVQQKDAxHb2xhbmcgVGVz +dHMxEjAQBgNVBAMMCXRlc3QtZmlsZTAeFw0xNzAyMDEyMzUyMDhaFw0yNzAxMzAy +MzUyMDhaME0xCzAJBgNVBAYTAlVLMRMwEQYDVQQIDApUZXN0LVN0YXRlMRUwEwYD +VQQKDAxHb2xhbmcgVGVzdHMxEjAQBgNVBAMMCXRl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QM+IAtatzvaCPPczake +pbdLwmBZB/v8V+6jUajy6jOgdSH0PyffGnt7MWgDETmNC6p/Xigp5eh+C8Fb4NGT +xgHES5PBC+sruWp4u22bJGDKTvYNdZHsnw/CaKQWNsQqwisxa3/8N5v+PCff/pxl +r05pE3PdHn9JrCl4iWdVlgtiI9BoPtQyDfa/OEFaScE8KYR8LxaAgdgp3zYncWls +BpwQ6Y/A2wIkhlD9eEp5Ib2hz7isXOs9UwjdriKqrBXqcIAE5M+YIk3+KAQKxAtd +4YsK3CSJ010uphr12YKqlScj4vuKFjuOtd5RyyMIxUG3lrrhAu2AzCeKCLdVgA8+ +75FrYMApUdvcjp4uzbBoED4XRQlx9kdFHVbYgmE/+yddBYJM8u4YlgAL0hW2/D8p +z9JWIfxVmjJnBnXaKGBuiUyZ864A3PJndP6EMMo7TzS2CDnfCYuJjvI0KvDjFNmc +rQA04+qfMSEz3nmKhbbZu4eYLzlADhfH8tT4GMtXf71WLA5AUHGf2Y4+HIHTsmHG +vQ== +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/nist-pkits/README.md b/go/src/crypto/x509/testdata/nist-pkits/README.md new file mode 100644 index 0000000000000000000000000000000000000000..7b761260d6c046aee052d170a3a6e36e68219c7f --- /dev/null +++ b/go/src/crypto/x509/testdata/nist-pkits/README.md @@ -0,0 +1,6 @@ +Test vectors and certificates for the "Path Validation Testing Program" + portion of the NIST Public Key Infrastructure Testing suite: https://csrc.nist.gov/projects/pki-testing. + +Vectors are extracted from the provided PDF: https://csrc.nist.gov/CSRC/media/Projects/PKI-Testing/documents/PKITS.pdf. + +Vectors and test material are public domain (United States Government Work under 17 U.S.C. 105). \ No newline at end of file diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/AllCertificatesNoPoliciesTest2EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/AllCertificatesNoPoliciesTest2EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..ae6be6c4c8f63f4853d671e0b30d3e09d0cd5113 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/AllCertificatesNoPoliciesTest2EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/AllCertificatesSamePoliciesTest10EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/AllCertificatesSamePoliciesTest10EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..e36fdb8fc3721609d5fc84c8f93ba37e0d5dd1ec Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/AllCertificatesSamePoliciesTest10EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/AllCertificatesSamePoliciesTest13EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/AllCertificatesSamePoliciesTest13EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..c296e5a4308848dcc1efa76852ff0515898982c4 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/AllCertificatesSamePoliciesTest13EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/AllCertificatesanyPolicyTest11EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/AllCertificatesanyPolicyTest11EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..7439f85152a7850feb29f4d19081a61e9efd2993 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/AllCertificatesanyPolicyTest11EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/AnyPolicyTest14EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/AnyPolicyTest14EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..a6cf3528fa3c26162140cd7e7b920e7e426329f1 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/AnyPolicyTest14EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/BadCRLIssuerNameCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/BadCRLIssuerNameCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..05e4b3ddbe858be291fe6dd035a511f584a84c30 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/BadCRLIssuerNameCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/BadCRLSignatureCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/BadCRLSignatureCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..6dfa00d6b8ebf7170e60e14481856e20b0685a29 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/BadCRLSignatureCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/BadSignedCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/BadSignedCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..0a598fcb8eb03f9d1169377e3e311ca826bf3569 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/BadSignedCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/BadnotAfterDateCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/BadnotAfterDateCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..7a7dcec665123a801a7cc3254a86e46da9c7c235 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/BadnotAfterDateCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/BadnotBeforeDateCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/BadnotBeforeDateCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..33cfbd7ce8c7bc9e89fdc7510cd7d62477ad9a19 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/BadnotBeforeDateCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/BasicSelfIssuedCRLSigningKeyCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/BasicSelfIssuedCRLSigningKeyCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..4e1245299d42e8d9400af61a3106e82c8fedc856 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/BasicSelfIssuedCRLSigningKeyCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/BasicSelfIssuedCRLSigningKeyCRLCert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/BasicSelfIssuedCRLSigningKeyCRLCert.crt new file mode 100644 index 0000000000000000000000000000000000000000..7f86064c26b95d0f6252bcc5639b6af6c5350e10 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/BasicSelfIssuedCRLSigningKeyCRLCert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/BasicSelfIssuedNewKeyCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/BasicSelfIssuedNewKeyCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..1f83cb863f1d83b827ff5329985150d63d0f8578 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/BasicSelfIssuedNewKeyCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/BasicSelfIssuedNewKeyOldWithNewCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/BasicSelfIssuedNewKeyOldWithNewCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..8773e48464cb139645d7079868597feba315fc6a Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/BasicSelfIssuedNewKeyOldWithNewCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/BasicSelfIssuedOldKeyCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/BasicSelfIssuedOldKeyCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..b00748cc262b20871e9c0a460dc865bea275c649 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/BasicSelfIssuedOldKeyCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/BasicSelfIssuedOldKeyNewWithOldCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/BasicSelfIssuedOldKeyNewWithOldCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..963f57a485d4a986c4078da47c3ea70c3a4979a7 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/BasicSelfIssuedOldKeyNewWithOldCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/CPSPointerQualifierTest20EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/CPSPointerQualifierTest20EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..706d98d63b8d5d02756a7f9b2237572f44c2ca99 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/CPSPointerQualifierTest20EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/DSACACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/DSACACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..14787b05801bd1609875ca9bd1035f5301e776b2 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/DSACACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/DSAParametersInheritedCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/DSAParametersInheritedCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..5e2fa5bc921a70960132cee677e7918092080b3b Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/DSAParametersInheritedCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/DifferentPoliciesTest12EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/DifferentPoliciesTest12EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..7873bd8d36716beb02df54f2d200fe54bf96d8e9 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/DifferentPoliciesTest12EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/DifferentPoliciesTest3EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/DifferentPoliciesTest3EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..57f1df4334e9675b3a2c6ffe09b867899deeb0ac Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/DifferentPoliciesTest3EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/DifferentPoliciesTest4EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/DifferentPoliciesTest4EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..4967f41d30245fa1fc8167e6990266f7c54fdd8e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/DifferentPoliciesTest4EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/DifferentPoliciesTest5EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/DifferentPoliciesTest5EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..b6d31236e2c5ebcb34005b52422d00e7c7997f32 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/DifferentPoliciesTest5EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/DifferentPoliciesTest7EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/DifferentPoliciesTest7EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..4c9c82bbcdae6263292a16a09aef51954e971e21 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/DifferentPoliciesTest7EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/DifferentPoliciesTest8EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/DifferentPoliciesTest8EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..6c01f377f46c86824d67ef2e6c5565499bcf6255 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/DifferentPoliciesTest8EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/DifferentPoliciesTest9EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/DifferentPoliciesTest9EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..b2e30bd69217cc0f76f7c27140960f113b33ab44 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/DifferentPoliciesTest9EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/GeneralizedTimeCRLnextUpdateCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/GeneralizedTimeCRLnextUpdateCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..f4acda66ec5cd99fcc67fd55d34554295ec21c21 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/GeneralizedTimeCRLnextUpdateCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/GoodCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/GoodCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..edbfa648f247234570f0d7b843d591082d612a66 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/GoodCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/GoodsubCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/GoodsubCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..7a770c31ae73425460b00c15d337d1788a89d42e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/GoodsubCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/GoodsubCAPanyPolicyMapping1to2CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/GoodsubCAPanyPolicyMapping1to2CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..9f4d95f39533c50f3df78b40c031dc7c1f53809c Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/GoodsubCAPanyPolicyMapping1to2CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidBadCRLIssuerNameTest5EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidBadCRLIssuerNameTest5EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..e24d88d444d0dbdeb51a3b503936f02d1d1d186b Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidBadCRLIssuerNameTest5EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidBadCRLSignatureTest4EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidBadCRLSignatureTest4EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..4b35bd248ed3f535219be01431313bdc5d000de4 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidBadCRLSignatureTest4EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidBasicSelfIssuedCRLSigningKeyTest7EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidBasicSelfIssuedCRLSigningKeyTest7EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..348df8fe0db4961076f71c80c08eae7fa795cce1 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidBasicSelfIssuedCRLSigningKeyTest7EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidBasicSelfIssuedCRLSigningKeyTest8EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidBasicSelfIssuedCRLSigningKeyTest8EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..3ca799546005f83e5a6f0594f8f19539bcb8d985 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidBasicSelfIssuedCRLSigningKeyTest8EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidBasicSelfIssuedNewWithOldTest5EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidBasicSelfIssuedNewWithOldTest5EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..6cc192b8ba2195fc21f44401cd123ce34743fbf9 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidBasicSelfIssuedNewWithOldTest5EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidBasicSelfIssuedOldWithNewTest2EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidBasicSelfIssuedOldWithNewTest2EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..18033bc34b08de2db08663c7a201b74f547db21c Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidBasicSelfIssuedOldWithNewTest2EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidCASignatureTest2EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidCASignatureTest2EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..1f4ad3e1a15d5afb78fef7343185c23f15b79359 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidCASignatureTest2EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidCAnotAfterDateTest5EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidCAnotAfterDateTest5EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..a9938aa80e9552c031ea4591a53172ea7abbaac8 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidCAnotAfterDateTest5EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidCAnotBeforeDateTest1EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidCAnotBeforeDateTest1EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..f15d6a9ed22aff7c29e8e8ea9b49c100def7eaf1 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidCAnotBeforeDateTest1EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNSnameConstraintsTest31EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNSnameConstraintsTest31EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..5f7ad1535aa50a917f722f52058d22c7e60d76c0 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNSnameConstraintsTest31EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNSnameConstraintsTest33EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNSnameConstraintsTest33EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..fa59d6fbd0d9f4e8bf7fe10bb313c91ae34bb780 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNSnameConstraintsTest33EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNSnameConstraintsTest38EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNSnameConstraintsTest38EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..334fed1f1117833d7e7367bb037055a1cc2db990 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNSnameConstraintsTest38EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNandRFC822nameConstraintsTest28EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNandRFC822nameConstraintsTest28EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..f724473de877be2c24a86b7dc999c1189e7949b1 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNandRFC822nameConstraintsTest28EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNandRFC822nameConstraintsTest29EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNandRFC822nameConstraintsTest29EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..468cb7bede2ab3cf357bd947e045eabe403f1a1b Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNandRFC822nameConstraintsTest29EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest10EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest10EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..806ebf3ce7fcbd19d535660249402503c7a5d191 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest10EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest12EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest12EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..5f3a49f93e402b60be1e8060b555f961df1fa7a4 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest12EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest13EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest13EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..d64ddf53c7a101cd47bb9b2212613f8881004dfe Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest13EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest15EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest15EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..fd864ced34c1763f00e5ec21c5cdda4dad0293a6 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest15EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest16EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest16EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..455658dbc97ae5a81a61cc4ae8c8d43b6c7b2683 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest16EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest17EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest17EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..63f262b99fb256f094f866a868d8669e96564f12 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest17EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest20EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest20EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..a7ef3220436c1dea6820589ffa27984cfde90bcb Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest20EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest2EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest2EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..3fd895c9242de0c4314cb2dd88e8b73f762d8f1e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest2EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest3EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest3EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..decbf34aaceec2999b83492e201c5c6d755f3d6e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest3EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest7EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest7EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..6ac76654e5e7e347f48d2584258beb9bf9605205 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest7EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest8EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest8EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..48adc0a6d55c90ce0dd9c1a8f5ce152392a68367 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest8EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest9EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest9EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..ed753d42e6664959fc6db584c1b4db1984164246 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDNnameConstraintsTest9EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDSASignatureTest6EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDSASignatureTest6EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..a1725b19dacab890599e78357c2c8b4123a016d2 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidDSASignatureTest6EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidEESignatureTest3EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidEESignatureTest3EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..9238109b646e7d9fae59ea170a079560c45d80b7 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidEESignatureTest3EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidEEnotAfterDateTest6EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidEEnotAfterDateTest6EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..af6fdf8c5a91ced4ca4bddab927d445c35997464 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidEEnotAfterDateTest6EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidEEnotBeforeDateTest2EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidEEnotBeforeDateTest2EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..3ddef09cabffac1e6772570205da804a79d05b72 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidEEnotBeforeDateTest2EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidIDPwithindirectCRLTest23EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidIDPwithindirectCRLTest23EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..5cf92f7ce456958b42e455aeebedce6480f4f10b Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidIDPwithindirectCRLTest23EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidIDPwithindirectCRLTest26EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidIDPwithindirectCRLTest26EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..c4b45f87831eb714fd1134886e0a66573bcebf82 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidIDPwithindirectCRLTest26EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidLongSerialNumberTest18EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidLongSerialNumberTest18EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..56b1ab45831fb547129ed606b10b8b9fd90321f3 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidLongSerialNumberTest18EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidMappingFromanyPolicyTest7EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidMappingFromanyPolicyTest7EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..eec4c3c3a6de843d93de36bde07c0e9cfdd814f6 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidMappingFromanyPolicyTest7EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidMappingToanyPolicyTest8EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidMappingToanyPolicyTest8EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..ee6914c15aba209a9ba118c78fda02befd710bbe Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidMappingToanyPolicyTest8EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidMissingCRLTest1EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidMissingCRLTest1EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..30b027590338a44d691c4c5c85907e78d44285fe Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidMissingCRLTest1EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidMissingbasicConstraintsTest1EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidMissingbasicConstraintsTest1EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..80ba7a03dd1ad0fa897b651c2238e99929b50693 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidMissingbasicConstraintsTest1EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidNameChainingOrderTest2EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidNameChainingOrderTest2EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..6b7d7de29c65e338c3f0b3bca395cfb9bed538e7 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidNameChainingOrderTest2EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidNameChainingTest1EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidNameChainingTest1EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..ee18fa08fbb48d233ddb881f4bff98fe9cc8ae50 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidNameChainingTest1EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidNegativeSerialNumberTest15EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidNegativeSerialNumberTest15EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..2c479ca231f10f8fd283d3690cef6d8118ccdfad Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidNegativeSerialNumberTest15EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidOldCRLnextUpdateTest11EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidOldCRLnextUpdateTest11EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..1ec410d7554529c7b71796b8c183986a72671538 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidOldCRLnextUpdateTest11EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidPolicyMappingTest10EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidPolicyMappingTest10EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..053a608d7e63f75c05ad719553448a7962b78297 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidPolicyMappingTest10EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidPolicyMappingTest2EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidPolicyMappingTest2EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..1ed661582c49fe14b9f6848751c0330ac74af35c Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidPolicyMappingTest2EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidPolicyMappingTest4EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidPolicyMappingTest4EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..a194a040a70a07cede92b377a4890f494bee361d Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidPolicyMappingTest4EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidRFC822nameConstraintsTest22EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidRFC822nameConstraintsTest22EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..c9ad311ac0a01bf426dc2c31a0faaac71984aea0 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidRFC822nameConstraintsTest22EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidRFC822nameConstraintsTest24EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidRFC822nameConstraintsTest24EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..28ef8f7491e37dfd0ef06983210027426ba89f50 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidRFC822nameConstraintsTest24EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidRFC822nameConstraintsTest26EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidRFC822nameConstraintsTest26EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..0e7f71937a505464f0ac067c9007c259f6f9639f Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidRFC822nameConstraintsTest26EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidRevokedCATest2EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidRevokedCATest2EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..80545971141725598750df419c4964478a8f23e0 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidRevokedCATest2EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidRevokedEETest3EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidRevokedEETest3EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..455cb0240c4aeaa4776fddc59b4922895df41b03 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidRevokedEETest3EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedinhibitAnyPolicyTest10EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedinhibitAnyPolicyTest10EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..2e85ce5c21c86011f2e868184a413e49ec630dc8 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedinhibitAnyPolicyTest10EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedinhibitAnyPolicyTest8EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedinhibitAnyPolicyTest8EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..ee48b7fc85ec2d1d0ad8fa9b74f60cb55ce1baf4 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedinhibitAnyPolicyTest8EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedinhibitPolicyMappingTest10EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedinhibitPolicyMappingTest10EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..e729fe77cda740e003a776ffaec504f9ff94310a Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedinhibitPolicyMappingTest10EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedinhibitPolicyMappingTest11EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedinhibitPolicyMappingTest11EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..103e0940fe5c2648487c6b00e493c7c6db0032d9 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedinhibitPolicyMappingTest11EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedinhibitPolicyMappingTest8EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedinhibitPolicyMappingTest8EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..3eaa74deb815d6b99d26aa2edab2602507f91c1c Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedinhibitPolicyMappingTest8EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedinhibitPolicyMappingTest9EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedinhibitPolicyMappingTest9EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..1a1da9fe7a00073b510775d7f09abd840bf333c5 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedinhibitPolicyMappingTest9EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedpathLenConstraintTest16EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedpathLenConstraintTest16EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..2ff84b8b7d3467706360acd3ad4a7ee4e15b9d33 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedpathLenConstraintTest16EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedrequireExplicitPolicyTest7EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedrequireExplicitPolicyTest7EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..d4050e6f4f04742b459745405aa43aaec4be9acf Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedrequireExplicitPolicyTest7EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedrequireExplicitPolicyTest8EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedrequireExplicitPolicyTest8EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..77b6a3c1472506bd34f9922e5a5bd84720dd3705 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSelfIssuedrequireExplicitPolicyTest8EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSeparateCertificateandCRLKeysTest20EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSeparateCertificateandCRLKeysTest20EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..2cbab480b15658e146597a5ba91db56583ea2942 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSeparateCertificateandCRLKeysTest20EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSeparateCertificateandCRLKeysTest21EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSeparateCertificateandCRLKeysTest21EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..e703d679051ee41644b792eb30c0422831b403e8 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidSeparateCertificateandCRLKeysTest21EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidURInameConstraintsTest35EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidURInameConstraintsTest35EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..65096685fe2b3782da76068cf8ae5657d106d142 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidURInameConstraintsTest35EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidURInameConstraintsTest37EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidURInameConstraintsTest37EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..e64db473af5f954231c13a9fbd8d72bf11a7ce2f Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidURInameConstraintsTest37EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidUnknownCRLEntryExtensionTest8EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidUnknownCRLEntryExtensionTest8EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..8630e99cb240db1beee14ca11d97b9de02f75624 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidUnknownCRLEntryExtensionTest8EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidUnknownCRLExtensionTest10EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidUnknownCRLExtensionTest10EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..42fda8fc122d290ed37e5a8e26a3dca7bddd31a5 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidUnknownCRLExtensionTest10EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidUnknownCRLExtensionTest9EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidUnknownCRLExtensionTest9EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..c3f93b5bd7c6544629f9e90b5efbdd654146df56 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidUnknownCRLExtensionTest9EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidUnknownCriticalCertificateExtensionTest2EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidUnknownCriticalCertificateExtensionTest2EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..9200cccb39a7cbfafb3eb1d101cc859ed36263b4 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidUnknownCriticalCertificateExtensionTest2EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidWrongCRLTest6EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidWrongCRLTest6EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..148f9fb23aba366169f5d012191e13b030930b1c Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidWrongCRLTest6EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidcAFalseTest2EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidcAFalseTest2EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..3d5b82946bc87591dc321ae70a0c53584c6a79ed Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidcAFalseTest2EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidcAFalseTest3EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidcAFalseTest3EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..f791140cedab3a687f15ad38f9a2a3f8d71e8c90 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidcAFalseTest3EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidcRLIssuerTest27EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidcRLIssuerTest27EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..2433e3b95e129d8e3367b133ef101bf6302f72c4 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidcRLIssuerTest27EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidcRLIssuerTest31EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidcRLIssuerTest31EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..210bb41fef9900be775e9999caef5da89e770d5f Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidcRLIssuerTest31EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidcRLIssuerTest32EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidcRLIssuerTest32EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..5509dda847de042404a61098a8762e3ea6114472 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidcRLIssuerTest32EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidcRLIssuerTest34EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidcRLIssuerTest34EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..8b9041f5ba49f59d530a7507b5eef3d75679160f Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidcRLIssuerTest34EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidcRLIssuerTest35EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidcRLIssuerTest35EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..32e72a225ec311950742f5759017e6d250f10292 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidcRLIssuerTest35EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddeltaCRLIndicatorNoBaseTest1EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddeltaCRLIndicatorNoBaseTest1EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..10da321247087ff41d7254d275ab8a9182513d62 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddeltaCRLIndicatorNoBaseTest1EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddeltaCRLTest10EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddeltaCRLTest10EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..d60812c6a416207a0793a59133ab1231d17142a6 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddeltaCRLTest10EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddeltaCRLTest3EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddeltaCRLTest3EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..6b3c374331d8ded6af9043666fcc7dbbe6c88d87 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddeltaCRLTest3EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddeltaCRLTest4EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddeltaCRLTest4EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..b959414934419d97faf3187566ad618e100ec919 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddeltaCRLTest4EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddeltaCRLTest6EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddeltaCRLTest6EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..ea141b173af1ac275554fdcc8b1605f95b75ed05 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddeltaCRLTest6EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddeltaCRLTest9EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddeltaCRLTest9EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..de4da9d69b05c15760888de2b9e1d8fe535f0bdb Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddeltaCRLTest9EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddistributionPointTest2EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddistributionPointTest2EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..a60b030e9e00877557516c5686e834f7e06291d0 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddistributionPointTest2EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddistributionPointTest3EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddistributionPointTest3EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..bbb8271d6bb33a011eb331916b9856fcc7d18891 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddistributionPointTest3EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddistributionPointTest6EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddistributionPointTest6EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..a47f7b208569dc79eef9376e6566d6640d90f3b5 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddistributionPointTest6EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddistributionPointTest8EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddistributionPointTest8EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..af3a366dd74f38d69a81d527f6a2c61576493800 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddistributionPointTest8EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddistributionPointTest9EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddistributionPointTest9EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..3456831e0b94209de85a52b6373284fe3293de6e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvaliddistributionPointTest9EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitAnyPolicyTest1EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitAnyPolicyTest1EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..828203b11c7db73eacc6a2718d59b1d8cd40ca47 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitAnyPolicyTest1EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitAnyPolicyTest4EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitAnyPolicyTest4EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..2ffd9dd8ce521841682dbaacf4dcd436d13c85b8 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitAnyPolicyTest4EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitAnyPolicyTest5EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitAnyPolicyTest5EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..2fc212d33ed9861b28f4d231358c99a4c5fe6897 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitAnyPolicyTest5EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitAnyPolicyTest6EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitAnyPolicyTest6EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..9aafebfc25f67c64c9d4b2f12ae6144e23830302 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitAnyPolicyTest6EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitPolicyMappingTest1EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitPolicyMappingTest1EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..65ca6340ea6e3a706e2f767597c7c92d362a734e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitPolicyMappingTest1EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitPolicyMappingTest3EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitPolicyMappingTest3EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..c8b06f07e40055a97af55ce08ae5c43faaa1f530 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitPolicyMappingTest3EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitPolicyMappingTest5EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitPolicyMappingTest5EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..f3526efb69fb232df87f46012b797102811817b5 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitPolicyMappingTest5EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitPolicyMappingTest6EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitPolicyMappingTest6EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..733c152685dd340ff3020482e9fd611ee93edb13 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidinhibitPolicyMappingTest6EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidkeyUsageCriticalcRLSignFalseTest4EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidkeyUsageCriticalcRLSignFalseTest4EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..cfddd3a4359dc1a7353f3f26d3440b14355c9206 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidkeyUsageCriticalcRLSignFalseTest4EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidkeyUsageCriticalkeyCertSignFalseTest1EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidkeyUsageCriticalkeyCertSignFalseTest1EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..16c103f7446fea365a2a9b11fd3cff873ff93a1e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidkeyUsageCriticalkeyCertSignFalseTest1EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidkeyUsageNotCriticalcRLSignFalseTest5EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidkeyUsageNotCriticalcRLSignFalseTest5EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..5583f19690c7c83a5403e68ed46b9ee7c0e23c71 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidkeyUsageNotCriticalcRLSignFalseTest5EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidkeyUsageNotCriticalkeyCertSignFalseTest2EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidkeyUsageNotCriticalkeyCertSignFalseTest2EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..f3062e9e4803a52b6171e860e177ba1ea89be7b5 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidkeyUsageNotCriticalkeyCertSignFalseTest2EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlyContainsAttributeCertsTest14EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlyContainsAttributeCertsTest14EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..279306ed188999946349868615fc5330f78a79e8 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlyContainsAttributeCertsTest14EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlyContainsCACertsTest12EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlyContainsCACertsTest12EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..f206348963c0c5963b07796860d87586801ed035 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlyContainsCACertsTest12EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlyContainsUserCertsTest11EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlyContainsUserCertsTest11EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..ecf51285fa49fbb3a50db4bffc73271a5d0f4e43 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlyContainsUserCertsTest11EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlySomeReasonsTest15EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlySomeReasonsTest15EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..f536fc6d2bdab1c3c3e1afb2d80cd2fa32a75984 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlySomeReasonsTest15EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlySomeReasonsTest16EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlySomeReasonsTest16EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..af5aa4b0d4123d842b2bda5d0bfe627c159820a2 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlySomeReasonsTest16EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlySomeReasonsTest17EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlySomeReasonsTest17EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..59722f96227983015b5b6e438c9b72a017fc689d Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlySomeReasonsTest17EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlySomeReasonsTest20EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlySomeReasonsTest20EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..4a0f1916509cf731ab5ab50dbe3d559edf41e2c5 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlySomeReasonsTest20EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlySomeReasonsTest21EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlySomeReasonsTest21EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..59a02de9d7807fddb20803b2880dad3e0f826ef3 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidonlySomeReasonsTest21EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidpathLenConstraintTest10EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidpathLenConstraintTest10EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..447115e63684e6d0c4decc3a23c7facf86c829c8 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidpathLenConstraintTest10EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidpathLenConstraintTest11EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidpathLenConstraintTest11EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..c28c455abbec7238869de6fe616d60e0ee8fb4f7 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidpathLenConstraintTest11EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidpathLenConstraintTest12EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidpathLenConstraintTest12EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..dc6d0dda96abdd606821e34a0bb530edfe508d6d Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidpathLenConstraintTest12EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidpathLenConstraintTest5EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidpathLenConstraintTest5EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..b8830a2405533a0bda0b7229832ca714cb379870 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidpathLenConstraintTest5EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidpathLenConstraintTest6EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidpathLenConstraintTest6EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..b96d3c626fdb7b9f6a6d2badd6d1c450dd4a7968 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidpathLenConstraintTest6EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidpathLenConstraintTest9EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidpathLenConstraintTest9EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..c339f6fae75b31aa96e4da4bbeec6444378e3057 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidpathLenConstraintTest9EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/Invalidpre2000CRLnextUpdateTest12EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/Invalidpre2000CRLnextUpdateTest12EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..3e1ba073e1338a36347ac1bfc007f7d533a06701 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/Invalidpre2000CRLnextUpdateTest12EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/Invalidpre2000UTCEEnotAfterDateTest7EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/Invalidpre2000UTCEEnotAfterDateTest7EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..4a7e31caf02fa84e04869fb54f73b5dfb8afbf50 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/Invalidpre2000UTCEEnotAfterDateTest7EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidrequireExplicitPolicyTest3EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidrequireExplicitPolicyTest3EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..e9b7cf2510f60e8e77970b35924220ddb67fe9f1 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidrequireExplicitPolicyTest3EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidrequireExplicitPolicyTest5EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidrequireExplicitPolicyTest5EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..971d0a5de61b21859b64d4de8a9ca424eb48ee11 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/InvalidrequireExplicitPolicyTest5EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/LongSerialNumberCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/LongSerialNumberCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..12830d906973643017b9e55a2cc2b438271bd6e7 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/LongSerialNumberCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/Mapping1to2CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/Mapping1to2CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..4b70c9a4fc00fdc74f469f344c92b933a13eecc4 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/Mapping1to2CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/MappingFromanyPolicyCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/MappingFromanyPolicyCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..0a8f1e9811441b6537d94ce6b0bd61f17515bff8 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/MappingFromanyPolicyCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/MappingToanyPolicyCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/MappingToanyPolicyCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..d93d8c79c98875e033ec06c46d409e879fee890b Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/MappingToanyPolicyCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/MissingbasicConstraintsCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/MissingbasicConstraintsCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..e6f41a446b322a07fe4a61bfe02c13e460ae9f3d Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/MissingbasicConstraintsCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/NameOrderingCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/NameOrderingCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..f1c4a55fbf53a95eef94eaf74b8d5ee766f2dfdb Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/NameOrderingCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/NegativeSerialNumberCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/NegativeSerialNumberCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..1a4d9ba374cebe457fef04d3bfff295e38d6a4ad Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/NegativeSerialNumberCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/NoCRLCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/NoCRLCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..71c607dac44de79899150581cabd4b1bca00de5c Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/NoCRLCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/NoPoliciesCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/NoPoliciesCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..3a94cb157d27abe58c60fa22731bd2717b23015c Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/NoPoliciesCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/NoissuingDistributionPointCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/NoissuingDistributionPointCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..c4f182ad7f9771eec58373f4320d23f4db7e3ef1 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/NoissuingDistributionPointCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/OldCRLnextUpdateCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/OldCRLnextUpdateCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..2666670afb5e8eaf3032e9ede9a7768e2f17dfa5 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/OldCRLnextUpdateCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/OverlappingPoliciesTest6EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/OverlappingPoliciesTest6EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..82b5b5e0ee1c7ee1199b09105fa1fcd3bca8fb3c Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/OverlappingPoliciesTest6EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/P12Mapping1to3CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/P12Mapping1to3CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..9139bd730d33737a00a5d7f9b9fc5a75ebc9a249 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/P12Mapping1to3CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/P12Mapping1to3subCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/P12Mapping1to3subCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..3b9c2a751c4a849c0ad268029503af6afea3c38b Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/P12Mapping1to3subCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/P12Mapping1to3subsubCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/P12Mapping1to3subsubCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..91fc36a7273717ff4e09012fc0052f4d0e81351e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/P12Mapping1to3subsubCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/P1Mapping1to234CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/P1Mapping1to234CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..3500737ab8e8ede4abbef3afc4fb43cefc3f9d93 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/P1Mapping1to234CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/P1Mapping1to234subCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/P1Mapping1to234subCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..eb900ebc1cbeb6dd3050c8fe95d87aececad1adc Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/P1Mapping1to234subCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/P1anyPolicyMapping1to2CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/P1anyPolicyMapping1to2CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..3818b6a7f5193ef14738d6989e2c355159b95d7d Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/P1anyPolicyMapping1to2CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/PanyPolicyMapping1to2CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/PanyPolicyMapping1to2CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..db220487cc05a1fb94077b7a3943f3693b342098 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/PanyPolicyMapping1to2CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP1234CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP1234CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..36cf4ce24ea9f01fb8f333080559a460cf69a341 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP1234CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP1234subCAP123Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP1234subCAP123Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..1ab7ab104f656479536dad0124973f23ede123e1 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP1234subCAP123Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP1234subsubCAP123P12Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP1234subsubCAP123P12Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..df834464bbad670ff2ad805f1f60e742a0388525 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP1234subsubCAP123P12Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP123CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP123CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..26262a3d72f10de8a47c54d5a29d0c6a9127b5e5 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP123CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP123subCAP12Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP123subCAP12Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..cef6abeb29c68059e2243a732654bbc06de29b02 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP123subCAP12Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP123subsubCAP12P1Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP123subsubCAP12P1Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..49e66b5be012d09560ec14d6c82ff6d7236962f6 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP123subsubCAP12P1Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP123subsubCAP12P2Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP123subsubCAP12P2Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..d7b5a42353b55774d4ef33068ca657a0a4d222e9 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP123subsubCAP12P2Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP123subsubsubCAP12P2P1Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP123subsubsubCAP12P2P1Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..3a79422477f813e063c66628d01065260ad20c31 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP123subsubsubCAP12P2P1Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP12CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP12CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..dc1b60de0e85926c5f12a4279ca12d9841517ac7 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP12CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP12subCAP1Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP12subCAP1Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..081f951b80d946602710464608e74347c20d5215 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP12subCAP1Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP12subsubCAP1P2Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP12subsubCAP1P2Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..e8d0bb8ba8df7afcbc10f400388b5bf1418a2ba0 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP12subsubCAP1P2Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP2subCA2Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP2subCA2Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..c734009d050a16df7d6c8242d37decabbe8cfeb6 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP2subCA2Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP2subCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP2subCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..0f3fbbb01a192281454dcfd134ec032ea8a04e88 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP2subCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP3CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP3CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..9740b309d40f4078a3a46de8168792863fc0135e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/PoliciesP3CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/RFC3280MandatoryAttributeTypesCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/RFC3280MandatoryAttributeTypesCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..9c648a30be041dfd3e995e0d272db04c3576a297 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/RFC3280MandatoryAttributeTypesCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/RFC3280OptionalAttributeTypesCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/RFC3280OptionalAttributeTypesCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..306303a8465ec7597e5eea5f2ab7cd80cab36493 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/RFC3280OptionalAttributeTypesCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/RevokedsubCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/RevokedsubCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..25705b2f670f8e8e02f070d7d84040db712eb189 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/RevokedsubCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/RolloverfromPrintableStringtoUTF8StringCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/RolloverfromPrintableStringtoUTF8StringCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..32ddfe3e3152533d593e864cf9e96bc475a59f0c Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/RolloverfromPrintableStringtoUTF8StringCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/SeparateCertificateandCRLKeysCA2CRLSigningCert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/SeparateCertificateandCRLKeysCA2CRLSigningCert.crt new file mode 100644 index 0000000000000000000000000000000000000000..17b3cbba30f0225f8689ffa914ecb7e964618818 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/SeparateCertificateandCRLKeysCA2CRLSigningCert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/SeparateCertificateandCRLKeysCA2CertificateSigningCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/SeparateCertificateandCRLKeysCA2CertificateSigningCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..d747ea1fe5127cd7d6a7095cb11f985e532fc0cc Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/SeparateCertificateandCRLKeysCA2CertificateSigningCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/SeparateCertificateandCRLKeysCRLSigningCert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/SeparateCertificateandCRLKeysCRLSigningCert.crt new file mode 100644 index 0000000000000000000000000000000000000000..3c1730f41ab288d013ce177500700713bceb08cf Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/SeparateCertificateandCRLKeysCRLSigningCert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/SeparateCertificateandCRLKeysCertificateSigningCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/SeparateCertificateandCRLKeysCertificateSigningCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..e75eb4cd707fb21af5418a9c50746af77d37cad0 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/SeparateCertificateandCRLKeysCertificateSigningCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/TrustAnchorRootCertificate.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/TrustAnchorRootCertificate.crt new file mode 100644 index 0000000000000000000000000000000000000000..04efaa0659ba5a46a9131e8283db71b06ccf8b25 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/TrustAnchorRootCertificate.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/TwoCRLsCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/TwoCRLsCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..28eb60a0713091407e817db77094bfc1ca4787fa Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/TwoCRLsCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/UIDCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/UIDCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..ec04d7445577067c6176d2b20e4eca2dd540e380 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/UIDCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/UTF8StringCaseInsensitiveMatchCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/UTF8StringCaseInsensitiveMatchCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..2d653ef65b16141e574f4d3d97a9f41f935e581d Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/UTF8StringCaseInsensitiveMatchCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/UTF8StringEncodedNamesCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/UTF8StringEncodedNamesCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..ae2ce8a7b49e84c1ecdb18c515713d8ee17ef09e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/UTF8StringEncodedNamesCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/UnknownCRLEntryExtensionCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/UnknownCRLEntryExtensionCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..69128811ba375190c43d5f707d12cc8fbf8186bf Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/UnknownCRLEntryExtensionCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/UnknownCRLExtensionCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/UnknownCRLExtensionCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..2e2c3ef3d694ebd55ba4805c5a601d337cc7ab05 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/UnknownCRLExtensionCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/UserNoticeQualifierTest15EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/UserNoticeQualifierTest15EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..afb3455e36b7c3c1c5a0406de63dd5b2b72a47da Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/UserNoticeQualifierTest15EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/UserNoticeQualifierTest16EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/UserNoticeQualifierTest16EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..7d3bcc5d0bc7aee4a015fa880b405957257824ab Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/UserNoticeQualifierTest16EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/UserNoticeQualifierTest17EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/UserNoticeQualifierTest17EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..5fefe19944457f517d6214bd7418958626564d1f Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/UserNoticeQualifierTest17EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/UserNoticeQualifierTest18EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/UserNoticeQualifierTest18EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..1168b580e8c60c937fce1cf6bfd49fd6eb5cb7ea Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/UserNoticeQualifierTest18EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/UserNoticeQualifierTest19EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/UserNoticeQualifierTest19EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..3cb86cd1ce612a789334692feca12cc08da4ceac Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/UserNoticeQualifierTest19EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidBasicSelfIssuedCRLSigningKeyTest6EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidBasicSelfIssuedCRLSigningKeyTest6EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..c91b9f3665cddf75d381aa6d0d16be80d6b54add Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidBasicSelfIssuedCRLSigningKeyTest6EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidBasicSelfIssuedNewWithOldTest3EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidBasicSelfIssuedNewWithOldTest3EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..34197f036016d13e4aba0e5cee865c8737cb95cd Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidBasicSelfIssuedNewWithOldTest3EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidBasicSelfIssuedNewWithOldTest4EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidBasicSelfIssuedNewWithOldTest4EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..9a7919b00acb49d393bfbdfbfdb6ca353e2ad9ae Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidBasicSelfIssuedNewWithOldTest4EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidBasicSelfIssuedOldWithNewTest1EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidBasicSelfIssuedOldWithNewTest1EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..038e4d7a80a7434a14deb1eda6bf448908e4c7ff Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidBasicSelfIssuedOldWithNewTest1EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidCertificatePathTest1EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidCertificatePathTest1EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..69ba3019d4b6bfd8b1fd4289b7b21bbd5efd3e8e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidCertificatePathTest1EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNSnameConstraintsTest30EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNSnameConstraintsTest30EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..e5235c7ff251f29bc6d9ae78703ab5275a7140b1 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNSnameConstraintsTest30EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNSnameConstraintsTest32EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNSnameConstraintsTest32EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..8bc3e87b9fc4a186c0856c941e317c78db671ceb Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNSnameConstraintsTest32EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNandRFC822nameConstraintsTest27EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNandRFC822nameConstraintsTest27EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..2332d4c189a11880ac5f6ce099def94d6b90061b Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNandRFC822nameConstraintsTest27EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest11EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest11EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..f8fe1223249f3321656ed8569cbdb0e13af4aec1 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest11EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest14EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest14EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..4364e1bcbf58b2ef518d5e3b9233c05f64e173b9 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest14EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest18EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest18EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..3b5ac8be530528ff89cf455c7bd7a2f5eba846a4 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest18EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest19EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest19EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..20fa140e19dd01b73b0fefe1439fe0cb65f48970 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest19EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest1EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest1EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..c59e921bac7e06ee840adb390855f292217ab158 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest1EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest4EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest4EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..c6cfcbb77862b16f94836a88129cf39eeb098d6d Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest4EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest5EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest5EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..f2c4dfc553fdd1223f6217afe40942fd73e0b2fe Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest5EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest6EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest6EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..675711970cea2dfa07aab5abd588f08868f6acf4 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDNnameConstraintsTest6EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDSAParameterInheritanceTest5EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDSAParameterInheritanceTest5EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..d8b6ce36d0de3b3e2936a752c5700c036674070e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDSAParameterInheritanceTest5EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDSASignaturesTest4EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDSASignaturesTest4EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..2fc40a6c2f3978a6673087151eb975cb28114f97 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidDSASignaturesTest4EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidGeneralizedTimeCRLnextUpdateTest13EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidGeneralizedTimeCRLnextUpdateTest13EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..7f77ee81965fe44b572889aae9ab09f41ae5d55d Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidGeneralizedTimeCRLnextUpdateTest13EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidGeneralizedTimenotAfterDateTest8EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidGeneralizedTimenotAfterDateTest8EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..f97ed0a3e958fba32d059c05f1510bc25b706bbf Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidGeneralizedTimenotAfterDateTest8EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidGeneralizedTimenotBeforeDateTest4EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidGeneralizedTimenotBeforeDateTest4EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..2ef73e1f69732d6767c5adaab6c9da08330f3e4c Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidGeneralizedTimenotBeforeDateTest4EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidIDPwithindirectCRLTest22EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidIDPwithindirectCRLTest22EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..66296ac7e75436772e5b8a4f6f8c39a7c1e10f8b Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidIDPwithindirectCRLTest22EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidIDPwithindirectCRLTest24EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidIDPwithindirectCRLTest24EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..0a1b85dc68062b841567516aaee37b7deebca480 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidIDPwithindirectCRLTest24EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidIDPwithindirectCRLTest25EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidIDPwithindirectCRLTest25EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..6f69c0c8bca864b23b8ec3fac90b7d060b022bef Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidIDPwithindirectCRLTest25EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidLongSerialNumberTest16EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidLongSerialNumberTest16EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..44e890546d547296af0db9fd16559d77e2293632 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidLongSerialNumberTest16EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidLongSerialNumberTest17EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidLongSerialNumberTest17EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..96186587225d25f35abd8be7b50210b726c18da2 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidLongSerialNumberTest17EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidNameChainingCapitalizationTest5EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidNameChainingCapitalizationTest5EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..c0a6b3d03ecf196fe871905e892cfe9b0153fa92 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidNameChainingCapitalizationTest5EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidNameChainingWhitespaceTest3EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidNameChainingWhitespaceTest3EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..fc0f65d0796a9fd82dbcecc735aa9588a3f277ff Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidNameChainingWhitespaceTest3EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidNameChainingWhitespaceTest4EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidNameChainingWhitespaceTest4EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..a8ffc872cae3fcb86bf3917a93d68206152a7d09 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidNameChainingWhitespaceTest4EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidNameUIDsTest6EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidNameUIDsTest6EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..7d0b70611374532bab250dea312061181daa4ef0 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidNameUIDsTest6EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidNegativeSerialNumberTest14EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidNegativeSerialNumberTest14EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..ab39228409f9d5ee68b862d4a21747b0f604314c Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidNegativeSerialNumberTest14EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidNoissuingDistributionPointTest10EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidNoissuingDistributionPointTest10EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..89eac753f30a25f86e1cdaf7205892c355025fb3 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidNoissuingDistributionPointTest10EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest11EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest11EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..865c97542eecbae607874bf26cee1212e9e74a2b Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest11EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest12EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest12EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..eb4306ab5a6e26e661e77b6814da98ea87730dda Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest12EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest13EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest13EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..2d1b18c33f4194b5cf566fee2876161f2e986639 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest13EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest14EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest14EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..2487d626f7f9d9f3fdcf942ec67f36b7c743519e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest14EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest1EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest1EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..f2bd7d381de216b71bf3568e5ed53a89ae8bfc4e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest1EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest3EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest3EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..e941bbbad003d68411128fbb155653113d03a8a5 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest3EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest5EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest5EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..d084fc7215863e33f2c18b8ba9da9b9ba8f96030 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest5EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest6EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest6EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..97dd2e72c11b23225a0dd30e764770eeeb2d1b8a Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest6EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest9EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest9EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..ef1ac897e08a3bb4831ce3972b28f6a785f8ae75 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidPolicyMappingTest9EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidRFC3280MandatoryAttributeTypesTest7EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidRFC3280MandatoryAttributeTypesTest7EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..15825d7eb3b99b4dade42147864e3f2a6e359d94 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidRFC3280MandatoryAttributeTypesTest7EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidRFC3280OptionalAttributeTypesTest8EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidRFC3280OptionalAttributeTypesTest8EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..60a20316813bbcb0fbcad39e79b5c5538e0dad23 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidRFC3280OptionalAttributeTypesTest8EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidRFC822nameConstraintsTest21EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidRFC822nameConstraintsTest21EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..576a1b81716124a048d3486659d8348acdb18fb9 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidRFC822nameConstraintsTest21EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidRFC822nameConstraintsTest23EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidRFC822nameConstraintsTest23EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..c0ff7596a0929f68213eed737a9017a17d1ce8ab Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidRFC822nameConstraintsTest23EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidRFC822nameConstraintsTest25EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidRFC822nameConstraintsTest25EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..75f67b73c86c16f86442ae88d3769adff60017d8 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidRFC822nameConstraintsTest25EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidRolloverfromPrintableStringtoUTF8StringTest10EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidRolloverfromPrintableStringtoUTF8StringTest10EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..0a4e150700fa7c754cca75eaf6a32664a1be50f2 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidRolloverfromPrintableStringtoUTF8StringTest10EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidSelfIssuedinhibitAnyPolicyTest7EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidSelfIssuedinhibitAnyPolicyTest7EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..16968ab59b17dcdfcefe4c9fc7bb1f7546f092bc Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidSelfIssuedinhibitAnyPolicyTest7EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidSelfIssuedinhibitAnyPolicyTest9EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidSelfIssuedinhibitAnyPolicyTest9EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..1516f1ee703deb808b4090602849b568994e0187 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidSelfIssuedinhibitAnyPolicyTest9EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidSelfIssuedinhibitPolicyMappingTest7EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidSelfIssuedinhibitPolicyMappingTest7EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..a4385c1d959fb0db9d56ebcdaf99f6e63bdee257 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidSelfIssuedinhibitPolicyMappingTest7EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidSelfIssuedpathLenConstraintTest15EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidSelfIssuedpathLenConstraintTest15EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..1cb0924ec360a2d3efc42ec0f1c89cd75497950f Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidSelfIssuedpathLenConstraintTest15EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidSelfIssuedpathLenConstraintTest17EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidSelfIssuedpathLenConstraintTest17EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..ed346760878c83be35ac86cafdb712f0b6890a87 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidSelfIssuedpathLenConstraintTest17EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidSelfIssuedrequireExplicitPolicyTest6EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidSelfIssuedrequireExplicitPolicyTest6EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..44e5c1e25329a02e2df3503fbcd12389e4f5db1c Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidSelfIssuedrequireExplicitPolicyTest6EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidSeparateCertificateandCRLKeysTest19EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidSeparateCertificateandCRLKeysTest19EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..08260919768f0c6c18cf3c0695298bba9545968f Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidSeparateCertificateandCRLKeysTest19EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidTwoCRLsTest7EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidTwoCRLsTest7EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..c42779d70ce10628a6329f369784af3ff6d42d49 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidTwoCRLsTest7EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidURInameConstraintsTest34EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidURInameConstraintsTest34EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..be8ef42f19a6dee9e656112ba1eb9aacce842772 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidURInameConstraintsTest34EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidURInameConstraintsTest36EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidURInameConstraintsTest36EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..6a24838f5dcf25022717fba4359fd45fd995e2f9 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidURInameConstraintsTest36EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidUTF8StringCaseInsensitiveMatchTest11EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidUTF8StringCaseInsensitiveMatchTest11EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..d1f80a74a4bd831ce7d8f68bc753167dcd9e4cee Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidUTF8StringCaseInsensitiveMatchTest11EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidUTF8StringEncodedNamesTest9EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidUTF8StringEncodedNamesTest9EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..b14d789b5dc1666a530f10a0b886505bf1b452b4 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidUTF8StringEncodedNamesTest9EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidUnknownNotCriticalCertificateExtensionTest1EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidUnknownNotCriticalCertificateExtensionTest1EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..d55dcb1a6f493b8e53aefccd0cce7ce05125f072 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidUnknownNotCriticalCertificateExtensionTest1EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidbasicConstraintsNotCriticalTest4EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidbasicConstraintsNotCriticalTest4EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..4059c017a744057b8083a7834941abc563b98b98 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidbasicConstraintsNotCriticalTest4EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidcRLIssuerTest28EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidcRLIssuerTest28EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..9145515308cc3553a94a3a6b7d72324b3150f3c7 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidcRLIssuerTest28EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidcRLIssuerTest29EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidcRLIssuerTest29EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..b10632b2093202d3c7f20951127be77e600a6f50 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidcRLIssuerTest29EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidcRLIssuerTest30EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidcRLIssuerTest30EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..593ef98e3508a0ead415308724ce1d0e45e4f010 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidcRLIssuerTest30EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidcRLIssuerTest33EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidcRLIssuerTest33EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..2ae810abf9d9921c4f6b0766a07288a82dd30912 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidcRLIssuerTest33EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddeltaCRLTest2EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddeltaCRLTest2EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..a2eb9a7dc42e66e2f8a8a9213daff833a2350eb8 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddeltaCRLTest2EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddeltaCRLTest5EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddeltaCRLTest5EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..1a3f7f51427177e38c7c70f0744a55fc8d0249f2 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddeltaCRLTest5EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddeltaCRLTest7EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddeltaCRLTest7EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..43b44bc5d892f132ce185b259ccdfd123bb40ba4 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddeltaCRLTest7EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddeltaCRLTest8EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddeltaCRLTest8EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..8be24581eb99dcf4aee80acc097c2b2ab68964b0 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddeltaCRLTest8EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddistributionPointTest1EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddistributionPointTest1EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..b2c832fa41d7ce8b4fc656d0d8b9efeb855a490d Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddistributionPointTest1EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddistributionPointTest4EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddistributionPointTest4EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..47feb00fd036670a2baad28b9d36b106f9aa6924 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddistributionPointTest4EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddistributionPointTest5EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddistributionPointTest5EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..a93d666384140850ebdc012e838fef322246838c Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddistributionPointTest5EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddistributionPointTest7EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddistributionPointTest7EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..107f102c98d4592cf3828ab04ebcd51051388068 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValiddistributionPointTest7EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidinhibitAnyPolicyTest2EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidinhibitAnyPolicyTest2EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..df4ba444504e657ec4e81273b54f88c18e8b3332 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidinhibitAnyPolicyTest2EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidinhibitPolicyMappingTest2EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidinhibitPolicyMappingTest2EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..f13524a0dce9bcce2e6535b5b88b107abf5cc16e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidinhibitPolicyMappingTest2EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidinhibitPolicyMappingTest4EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidinhibitPolicyMappingTest4EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..75daa870284699a2fe11cf97455de1633fdfd3e2 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidinhibitPolicyMappingTest4EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidkeyUsageNotCriticalTest3EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidkeyUsageNotCriticalTest3EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..6da79065ea1d448cfce6652d78426a593899969b Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidkeyUsageNotCriticalTest3EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidonlyContainsCACertsTest13EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidonlyContainsCACertsTest13EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..3eec5cc6fe8aefb9fa4b857c5b709979c0152ad4 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidonlyContainsCACertsTest13EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidonlySomeReasonsTest18EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidonlySomeReasonsTest18EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..f255d3ad71181d2dcea9d5ab889f9ead75b1d801 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidonlySomeReasonsTest18EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidonlySomeReasonsTest19EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidonlySomeReasonsTest19EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..912968e9502997f5bede84fb17247000e69e2257 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidonlySomeReasonsTest19EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidpathLenConstraintTest13EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidpathLenConstraintTest13EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..1ad52efdb6ce887c43c590d03c7af0c13dd2e750 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidpathLenConstraintTest13EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidpathLenConstraintTest14EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidpathLenConstraintTest14EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..76800f5159cec3c9101a09521d7de3507684935e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidpathLenConstraintTest14EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidpathLenConstraintTest7EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidpathLenConstraintTest7EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..f3368edd5d1d17be0d8adece1a2fcf376d15bd33 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidpathLenConstraintTest7EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidpathLenConstraintTest8EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidpathLenConstraintTest8EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..8ff0a131e7c063b818358ea76f3c1a568dcd1713 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidpathLenConstraintTest8EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/Validpre2000UTCnotBeforeDateTest3EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/Validpre2000UTCnotBeforeDateTest3EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..15b2928401a98eb97ca5c5df99017b45acabc797 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/Validpre2000UTCnotBeforeDateTest3EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidrequireExplicitPolicyTest1EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidrequireExplicitPolicyTest1EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..7cf888e16ad1989713b2325eea52e7ca3794da5f Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidrequireExplicitPolicyTest1EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidrequireExplicitPolicyTest2EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidrequireExplicitPolicyTest2EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..23889360cc222fee606b87b3972c8d6b0d1f05c5 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidrequireExplicitPolicyTest2EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/ValidrequireExplicitPolicyTest4EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidrequireExplicitPolicyTest4EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..e93a0e1fe91fed010b8098517ebb537f53a59cc0 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/ValidrequireExplicitPolicyTest4EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/WrongCRLCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/WrongCRLCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..3a96d87cfc52f44cf202a90676fd2f1487ae8cee Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/WrongCRLCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/anyPolicyCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/anyPolicyCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..df54668adbd2773cf297e6cf6709611da8b9c9c2 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/anyPolicyCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/basicConstraintsCriticalcAFalseCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/basicConstraintsCriticalcAFalseCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..4b678fee0c56878812687ebca4ca5681126a2901 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/basicConstraintsCriticalcAFalseCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/basicConstraintsNotCriticalCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/basicConstraintsNotCriticalCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..d6c7fb805fa6a7d9d7a4f057a863df9d2aaaca01 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/basicConstraintsNotCriticalCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/basicConstraintsNotCriticalcAFalseCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/basicConstraintsNotCriticalcAFalseCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..27e670ec162ba97bd78c99b01fe34566db49cd76 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/basicConstraintsNotCriticalcAFalseCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/deltaCRLCA1Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/deltaCRLCA1Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..6815e4f888f14686ac1ae266de7da251a1c53d43 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/deltaCRLCA1Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/deltaCRLCA2Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/deltaCRLCA2Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..2f64a74e135563594b0d369d826403970bbcd314 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/deltaCRLCA2Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/deltaCRLCA3Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/deltaCRLCA3Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..31e6b33a463e9a7b62559b67e7ef9d7aa8d0c597 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/deltaCRLCA3Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/deltaCRLIndicatorNoBaseCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/deltaCRLIndicatorNoBaseCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..7cd82a4363c5af9eab44debf5723fdd9f6cb0487 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/deltaCRLIndicatorNoBaseCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/distributionPoint1CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/distributionPoint1CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..23250812d93bea78c4fb47d628c1e0fb35f43120 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/distributionPoint1CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/distributionPoint2CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/distributionPoint2CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..205b62ad165f2e77f5d8f3cf5c337c5e908734ba Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/distributionPoint2CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA1Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA1Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..046deefaec87e8b260943886eaf9a534281e0e1f Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA1Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA2Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA2Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..de9a0be510efb643e22d5d712171375f8abc485d Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA2Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA3Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA3Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..03bb3eb2da91023c0267415b2c20535445090165 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA3Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA3cRLIssuerCert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA3cRLIssuerCert.crt new file mode 100644 index 0000000000000000000000000000000000000000..20e8267eeef085f19872d4c3615c0b9bf671644a Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA3cRLIssuerCert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA4Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA4Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..f1cb26b375bc0be054f41653d15200436ccfbee7 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA4Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA4cRLIssuerCert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA4cRLIssuerCert.crt new file mode 100644 index 0000000000000000000000000000000000000000..ff1203df3ad2883985bb2af3dd0516f45600cad8 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA4cRLIssuerCert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA5Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA5Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..c4f9f17874606dc83d1c86f797e561aa76519dd8 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA5Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA6Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA6Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..46443aab941682033e3bf50d0b6c603aa967d238 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/indirectCRLCA6Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy0CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy0CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..cf3611025edc9692e7b233366569673d91e347c1 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy0CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy1CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy1CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..0494c8fe5bbbb3fcc13ccd5ef1b50f35f16baa1c Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy1CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy1SelfIssuedCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy1SelfIssuedCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..6512e9d2e9c981f0473f264cd2240a2ebe5d41bf Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy1SelfIssuedCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy1SelfIssuedsubCA2Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy1SelfIssuedsubCA2Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..42e00344afc25505e87ba1d008b04711c0356ab3 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy1SelfIssuedsubCA2Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy1subCA1Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy1subCA1Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..633536c33ae9c0f86aa7f3f448b1fa56cd768761 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy1subCA1Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy1subCA2Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy1subCA2Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..319e8098786ab446279bbd6121fa2737fd123bd0 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy1subCA2Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy1subCAIAP5Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy1subCAIAP5Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..a3c4f2134e940bfb1d344320435ce46b1feed958 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy1subCAIAP5Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy1subsubCA2Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy1subsubCA2Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..3c4512ac28a2314788cc3aa4ed8b6e59437f96af Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy1subsubCA2Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy5CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy5CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..fc9b42329920c2e51f653146aee2994c1527470a Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy5CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy5subCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy5subCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..11ceeb78cc9c157ba47f1850ea675598dcb13ca1 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy5subCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy5subsubCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy5subsubCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..32bbffeb446c7c6eb58b1392e8f8aeae15dc0c4c Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicy5subsubCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicyTest3EE.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicyTest3EE.crt new file mode 100644 index 0000000000000000000000000000000000000000..2c8fd4f6d125298052ef3a02be336a70f2f4deb0 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitAnyPolicyTest3EE.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping0CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping0CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..16808f7c50adce5c54c8f28a4fdbabf56ad9559a Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping0CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping0subCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping0subCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..846abc924da146f1e6ad7b9175076ee625ef02f8 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping0subCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P12CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P12CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..5baaf35e0f1f8c36b2d683ea1310e8f67751c60d Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P12CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P12subCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P12subCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..b2f0979ccee95131c24742ba0452821a45fb0018 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P12subCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P12subCAIPM5Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P12subCAIPM5Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..4ad9f1e174dd639b81beacd13ca3ab855cbdc92a Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P12subCAIPM5Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P12subsubCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P12subsubCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..f514e5d88b7f697f145a8d4c3d4fab3f7a7e20c8 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P12subsubCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P12subsubCAIPM5Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P12subsubCAIPM5Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..b1e9ff8d06883a9c034880c4da3054cbb0fd4d2e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P12subsubCAIPM5Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P1CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P1CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..ec47ee63731771fa666d9e23e8bc2306ee677f0e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P1CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P1SelfIssuedCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P1SelfIssuedCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..65155c7b5a037643975bf327eb5af00cff66486d Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P1SelfIssuedCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P1SelfIssuedsubCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P1SelfIssuedsubCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..ae1891624b9422d3bad407133bba7072186abd67 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P1SelfIssuedsubCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P1subCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P1subCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..80135df869524a593f79b125e2a0d20e6e5aca59 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P1subCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P1subsubCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P1subsubCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..3a72ec12fb8bebaece28b7d617ddb9f715e1744d Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping1P1subsubCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping5CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping5CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..fd092230fbdd0c12484d462d6317ef5a8aac343f Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping5CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping5subCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping5subCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..93857ab656577dab046109c44f79b411adbcfd19 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping5subCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping5subsubCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping5subsubCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..134b7f8cb186c381c2bc376d7f5b845b75f83e4f Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping5subsubCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping5subsubsubCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping5subsubsubCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..dfb268d1d33d1692801e094b18a4cddbfb4c1c41 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/inhibitPolicyMapping5subsubsubCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/keyUsageCriticalcRLSignFalseCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/keyUsageCriticalcRLSignFalseCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..2467c945add087449d1d45dd05e8440fb01b121a Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/keyUsageCriticalcRLSignFalseCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/keyUsageCriticalkeyCertSignFalseCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/keyUsageCriticalkeyCertSignFalseCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..aa19cec73d2a0d7d5023b1cd681dc0df7835f855 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/keyUsageCriticalkeyCertSignFalseCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/keyUsageNotCriticalCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/keyUsageNotCriticalCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..bab8307e33090b6af0528075dc045f51b760290c Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/keyUsageNotCriticalCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/keyUsageNotCriticalcRLSignFalseCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/keyUsageNotCriticalcRLSignFalseCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..a6d878c8dff5008c174150662c1ac9d2d647716a Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/keyUsageNotCriticalcRLSignFalseCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/keyUsageNotCriticalkeyCertSignFalseCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/keyUsageNotCriticalkeyCertSignFalseCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..ef1056f1c39c7f1e1a3f6067c4d270ccc07cc69d Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/keyUsageNotCriticalkeyCertSignFalseCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN1CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN1CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..206359f9131673cd677a1e1ad9d9390d8a562e95 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN1CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN1SelfIssuedCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN1SelfIssuedCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..452ea547524e5f02670cc4dd679ae512bc3a154d Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN1SelfIssuedCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN1subCA1Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN1subCA1Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..645f0ae7c4b41d1a613f823715fc47b3b3294b6a Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN1subCA1Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN1subCA2Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN1subCA2Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..6cfc5926a505818cb241274bb2cd45db5b422524 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN1subCA2Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN1subCA3Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN1subCA3Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..840d073f6b53fa278b1d7d0987aaf3b50e0201f7 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN1subCA3Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN2CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN2CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..c68d496e6521b3f65ad87c555723e785db395105 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN2CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN3CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN3CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..87ba14d13a64bbe1fa889a798e69d9de51ab6732 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN3CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN3subCA1Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN3subCA1Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..7eed575fb4806c8efb91446898073a4ab52fd240 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN3subCA1Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN3subCA2Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN3subCA2Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..08f2245ef6cde76df2b473062101201986e19d39 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN3subCA2Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN4CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN4CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..3b11463186944707a91f6c695581e17986b2eb74 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN4CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN5CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN5CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..c190f7a7f24c17354b884a708e66a20dca5d260e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDN5CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDNS1CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDNS1CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..a7ec3bd1ebb5da702bd6b791dcd4673787bcc93d Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDNS1CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDNS2CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDNS2CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..c70846206c561c6d2ccdaf29eb85a1025117f273 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsDNS2CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsRFC822CA1Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsRFC822CA1Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..1be8e993355f7fc6c5aa67d0024840fd47491299 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsRFC822CA1Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsRFC822CA2Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsRFC822CA2Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..58308f8939d67eabfe05f5b8da73d1802b750587 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsRFC822CA2Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsRFC822CA3Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsRFC822CA3Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..ff6ba166ba488ac41f7fb2bd281cc74dbe228ea4 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsRFC822CA3Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsURI1CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsURI1CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..5f638c093c03d1ccd3e5692b760e894f969df9b4 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsURI1CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsURI2CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsURI2CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..e06b6377a9b356246b866e244342061b2ca61dfb Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/nameConstraintsURI2CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/onlyContainsAttributeCertsCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/onlyContainsAttributeCertsCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..e8d2b7224a82bb589492df7708e3daa4ffebcdb7 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/onlyContainsAttributeCertsCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/onlyContainsCACertsCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/onlyContainsCACertsCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..d75988ad008877568f5910c63ec4cfba4686870e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/onlyContainsCACertsCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/onlyContainsUserCertsCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/onlyContainsUserCertsCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..0d0b95030b17b3cbf7e8e987f766118d0b5ce2ed Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/onlyContainsUserCertsCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/onlySomeReasonsCA1Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/onlySomeReasonsCA1Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..ca247b06b402a65037fa98a127ed5dc40b2ece86 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/onlySomeReasonsCA1Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/onlySomeReasonsCA2Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/onlySomeReasonsCA2Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..c1cce6e0cecefd5a5b3bff0ae2332efca4c6066c Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/onlySomeReasonsCA2Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/onlySomeReasonsCA3Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/onlySomeReasonsCA3Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..cd65a820e42b664826c73e78beb14945e24c7cf2 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/onlySomeReasonsCA3Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/onlySomeReasonsCA4Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/onlySomeReasonsCA4Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..f205db0a3bef4d2628d7c0e2ac48e6ace3610ff1 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/onlySomeReasonsCA4Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint0CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint0CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..ce9b90d28445d0f3462471c249ff027ca656bd63 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint0CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint0SelfIssuedCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint0SelfIssuedCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..6e8f97c2035ca23229aee64f24964c3fb9476954 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint0SelfIssuedCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint0subCA2Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint0subCA2Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..2fc8fb590f88b18b7c7e9a2100eea93c835b530b Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint0subCA2Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint0subCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint0subCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..b156179e3a730a4f5072fe175202723f9b19566b Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint0subCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint1CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint1CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..a424261672868de229f240d691ce44485a41faf3 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint1CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint1SelfIssuedCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint1SelfIssuedCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..87590c3d2620218727dccd8680c9f1c23c3a486b Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint1SelfIssuedCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint1SelfIssuedsubCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint1SelfIssuedsubCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..f2c43ea893635284de5337e92202a2ed3f539b11 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint1SelfIssuedsubCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint1subCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint1subCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..05a2bac1da8277d987f78747196c54d7b74e3766 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint1subCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..c254a2376d3db5e7a1fb83ca4251b57b9604c625 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subCA0Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subCA0Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..0a8c99dd3e41c40c284ab4595a8de2f0cf0cf85a Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subCA0Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subCA1Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subCA1Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..bd686290efec31105e4734066354faa98f27aa87 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subCA1Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subCA4Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subCA4Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..822a383d053b2686967e23ea69a089b63c32f777 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subCA4Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subsubCA00Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subsubCA00Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..e2fd7ae3cd6556128bde8234d193165328f07dd7 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subsubCA00Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subsubCA11Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subsubCA11Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..44c0162e945b26d1fbb1158b27d624f228c5d7f7 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subsubCA11Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subsubCA41Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subsubCA41Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..284f4a9e4830501c6734e7c24756b38343e6a54c Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subsubCA41Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subsubsubCA11XCert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subsubsubCA11XCert.crt new file mode 100644 index 0000000000000000000000000000000000000000..9766cf01596982582ec6f65d0047d97e1bfead66 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subsubsubCA11XCert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subsubsubCA41XCert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subsubsubCA41XCert.crt new file mode 100644 index 0000000000000000000000000000000000000000..e14753174b412891f3217bb38d462dded15b81ac Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/pathLenConstraint6subsubsubCA41XCert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/pre2000CRLnextUpdateCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/pre2000CRLnextUpdateCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..30aff16129db1b6ad06f689ffdb132782a2f0cf6 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/pre2000CRLnextUpdateCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy0CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy0CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..16594b9e970fddd2ebf504033f8b1718579b549a Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy0CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy0subCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy0subCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..b7a1518eb86a3f7b9cafebdf5ba73a4d16541b68 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy0subCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy0subsubCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy0subsubCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..db57e9b337f313eda09e3d954c93feca961de871 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy0subsubCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy0subsubsubCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy0subsubsubCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..4952094eef3e7f9ccccd5ee22c85c7695880aa8e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy0subsubsubCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy10CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy10CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..3a54e7f2b82d31a19135360321e675935ff682f4 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy10CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy10subCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy10subCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..650a53f4c2e4d892d736fce3c4ca82ff0f87fd55 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy10subCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy10subsubCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy10subsubCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..139be532a59c8708aaf75ef310b0c773224a7f85 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy10subsubCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy10subsubsubCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy10subsubsubCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..a7c216c1640d0889a8c3ce4a6c733ce3447a472b Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy10subsubsubCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy2CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy2CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..f7ca7ae7e2a271af99274c581a8fd476b092d2bf Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy2CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy2SelfIssuedCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy2SelfIssuedCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..9d1626909055a69fe657c6b1fa487487c954d4f2 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy2SelfIssuedCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy2SelfIssuedsubCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy2SelfIssuedsubCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..b53bec1560d18fef7ff01047f704ef91cbcefb98 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy2SelfIssuedsubCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy2subCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy2subCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..36fc0d8df48dfedacc6a41638c29145a468b87fa Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy2subCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy4CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy4CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..723ae42a47c9ec978230d8db25fe4859f606c445 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy4CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy4subCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy4subCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..1bd237f766cb0bbb27e23e839b5eee72eb026944 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy4subCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy4subsubCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy4subsubCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..1a37158581b428fd827767b79c3a13775d87c636 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy4subsubCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy4subsubsubCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy4subsubsubCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..3047d74341e9a0d5a1472b8c814f93a21a4c6886 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy4subsubsubCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy5CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy5CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..c6b69ad95d551dd0fd025e11616f18820758a4c7 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy5CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy5subCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy5subCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..16958532f00d75e104be1dd1f6992219ddff5f7a Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy5subCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy5subsubCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy5subsubCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..093963aeca5a65ea853aa93e8a6292afb6f2a55a Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy5subsubCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy5subsubsubCACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy5subsubsubCACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..58da176c46551762236de081b98466d220136e2e Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy5subsubsubCACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy7CACert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy7CACert.crt new file mode 100644 index 0000000000000000000000000000000000000000..aba4a7fde45e7528f6af36bde839407f0944bbab Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy7CACert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy7subCARE2Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy7subCARE2Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..c57e9e4a5bdd40e5fc9aab879d69e001a40f52b5 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy7subCARE2Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy7subsubCARE2RE4Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy7subsubCARE2RE4Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..343efa5ec2d0aa5aa4d9410cd6c1f5467b54a0b6 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy7subsubCARE2RE4Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy7subsubsubCARE2RE4Cert.crt b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy7subsubsubCARE2RE4Cert.crt new file mode 100644 index 0000000000000000000000000000000000000000..9a8e72a1ce3b914b75127f5e40298154b0e5f6d8 Binary files /dev/null and b/go/src/crypto/x509/testdata/nist-pkits/certs/requireExplicitPolicy7subsubsubCARE2RE4Cert.crt differ diff --git a/go/src/crypto/x509/testdata/nist-pkits/vectors.json b/go/src/crypto/x509/testdata/nist-pkits/vectors.json new file mode 100644 index 0000000000000000000000000000000000000000..5842b4326df33d4b57a2d3ba67d291ba8bd8190b --- /dev/null +++ b/go/src/crypto/x509/testdata/nist-pkits/vectors.json @@ -0,0 +1,5010 @@ +[ + { + "Name": "4.1.1 Valid Signatures Test1", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "ValidCertificatePathTest1EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.1.2 Invalid CA Signature Test2", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "BadSignedCACert.crt", + "InvalidCASignatureTest2EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "BadSignedCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.1.3 Invalid EE Signature Test3", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "InvalidEESignatureTest3EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.1.4 Valid DSA Signatures Test4", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "DSACACert.crt", + "ValidDSASignaturesTest4EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "DSACACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.1.5 Valid DSA Parameter Inheritance Test5", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "DSACACert.crt", + "DSAParametersInheritedCACert.crt", + "ValidDSAParameterInheritanceTest5EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "DSACACRL.crl", + "DSAParametersInheritedCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.1.6 Invalid DSA Signature Test6", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "DSACACert.crt", + "InvalidDSASignatureTest6EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "DSACACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.2.1 Invalid CA notBefore Date Test1", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "BadnotBeforeDateCACert.crt", + "InvalidCAnotBeforeDateTest1EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "BadnotBeforeDateCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.2.2 Invalid EE notBefore Date Test2", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "InvalidEEnotBeforeDateTest2EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.2.3 Valid pre2000 UTC notBefore Date Test3", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "Validpre2000UTCnotBeforeDateTest3EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.2.4 Valid GeneralizedTime notBefore Date Test4", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "ValidGeneralizedTimenotBeforeDateTest4EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.2.5 Invalid CA notAfter Date Test5", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "BadnotAfterDateCACert.crt", + "InvalidCAnotAfterDateTest5EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "BadnotAfterDateCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.2.6 Invalid EE notAfter Date Test6", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "InvalidEEnotAfterDateTest6EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.2.7 Invalid pre2000 UTC EE notAfter Date Test7", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "Invalidpre2000UTCEEnotAfterDateTest7EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.2.8 Valid GeneralizedTime notAfter Date Test8", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "ValidGeneralizedTimenotAfterDateTest8EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.3.1 Invalid Name Chaining EE Test1", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "InvalidNameChainingTest1EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.3.2 Invalid Name Chaining Order Test2", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "NameOrderingCACert.crt", + "InvalidNameChainingOrderTest2EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "NameOrderCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.3.3 Valid Name Chaining Whitespace Test3", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "ValidNameChainingWhitespaceTest3EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.3.4 Valid Name Chaining Whitespace Test4", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "ValidNameChainingWhitespaceTest4EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.3.5 Valid Name Chaining Capitalization Test5", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "ValidNameChainingCapitalizationTest5EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.3.6 Valid Name Chaining UIDs Test6", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "UIDCACert.crt", + "ValidNameUIDsTest6EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "UIDCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.3.7 Valid RFC3280 Mandatory Attribute Types Test7", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "RFC3280MandatoryAttributeTypesCACert.crt", + "ValidRFC3280MandatoryAttributeTypesTest7EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "RFC3280MandatoryAttributeTypesCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.3.8 Valid RFC3280 Optional Attribute Types Test8", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "RFC3280OptionalAttributeTypesCACert.crt", + "ValidRFC3280OptionalAttributeTypesTest8EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "RFC3280OptionalAttributeTypesCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.3.9 Valid UTF8String Encoded Names Test9", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "UTF8StringEncodedNamesCACert.crt", + "ValidUTF8StringEncodedNamesTest9EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "UTF8StringEncodedNamesCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.3.10 Valid Rollover from PrintableString to UTF8String Test10", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "RolloverfromPrintableStringtoUTF8StringCACert.crt", + "ValidRolloverfromPrintableStringtoUTF8StringTest10EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "RolloverfromPrintableStringtoUTF8StringCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.3.11 Valid UTF8String Case Insensitive Match Test11", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "UTF8StringCaseInsensitiveMatchCACert.crt", + "ValidUTF8StringCaseInsensitiveMatchTest11EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "UTF8StringCaseInsensitiveMatchCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.4.1 Missing CRL Test1", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "NoCRLCACert.crt", + "InvalidMissingCRLTest1EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.4.2 Invalid Revoked CA Test2", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "RevokedsubCACert.crt", + "InvalidRevokedCATest2EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl", + "RevokedsubCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.4.3 Invalid Revoked EE Test3", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "InvalidRevokedEETest3EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.4.4 Invalid Bad CRL Signature Test4", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "BadCRLSignatureCACert.crt", + "InvalidBadCRLSignatureTest4EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "BadCRLSignatureCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.4.5 Invalid Bad CRL Issuer Name Test5", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "BadCRLIssuerNameCACert.crt", + "InvalidBadCRLIssuerNameTest5EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "BadCRLIssuerNameCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.4.6 Invalid Wrong CRL Test6", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "WrongCRLCACert.crt", + "InvalidWrongCRLTest6EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "WrongCRLCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.4.7 Valid Two CRLs Test7", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "TwoCRLsCACert.crt", + "ValidTwoCRLsTest7EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "TwoCRLsCAGoodCRL.crl", + "TwoCRLsCABadCRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.4.8 Invalid Unknown CRL Entry Extension Test8", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "UnknownCRLEntryExtensionCACert.crt", + "InvalidUnknownCRLEntryExtensionTest8EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "UnknownCRLEntryExtensionCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.4.9 Invalid Unknown CRL Extension Test9", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "UnknownCRLExtensionCACert.crt", + "InvalidUnknownCRLExtensionTest9EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "UnknownCRLExtensionCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.4.10 Invalid Unknown CRL Extension Test10", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "UnknownCRLExtensionCACert.crt", + "InvalidUnknownCRLExtensionTest10EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "UnknownCRLExtensionCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.4.11 Invalid Old CRL nextUpdate Test11", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "OldCRLnextUpdateCACert.crt", + "InvalidOldCRLnextUpdateTest11EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "OldCRLnextUpdateCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.4.12 Invalid pre2000 CRL nextUpdate Test12", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "pre2000CRLnextUpdateCACert.crt", + "Invalidpre2000CRLnextUpdateTest12EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "pre2000CRLnextUpdateCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.4.13 Valid GeneralizedTime CRL nextUpdate Test13", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GeneralizedTimeCRLnextUpdateCACert.crt", + "ValidGeneralizedTimeCRLnextUpdateTest13EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GeneralizedTimeCRLnextUpdateCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.4.14 Valid Negative Serial Number Test14", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "NegativeSerialNumberCACert.crt", + "ValidNegativeSerialNumberTest14EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "NegativeSerialNumberCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.4.15 Invalid Negative Serial Number Test15", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "NegativeSerialNumberCACert.crt", + "InvalidNegativeSerialNumberTest15EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "NegativeSerialNumberCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.4.16 Valid Long Serial Number Test16", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "LongSerialNumberCACert.crt", + "ValidLongSerialNumberTest16EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "LongSerialNumberCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.4.17 Valid Long Serial Number Test17", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "LongSerialNumberCACert.crt", + "ValidLongSerialNumberTest17EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "LongSerialNumberCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.4.18 Invalid Long Serial Number Test18", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "LongSerialNumberCACert.crt", + "InvalidLongSerialNumberTest18EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "LongSerialNumberCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.4.19 Valid Separate Certificate and CRL Keys Test19", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "SeparateCertificateandCRLKeysCertificateSigningCACert.crt", + "SeparateCertificateandCRLKeysCRLSigningCert.crt", + "ValidSeparateCertificateandCRLKeysTest19EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "SeparateCertificateandCRLKeysCRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.4.20 Invalid Separate Certificate and CRL Keys Test20", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "SeparateCertificateandCRLKeysCertificateSigningCACert.crt", + "SeparateCertificateandCRLKeysCRLSigningCert.crt", + "InvalidSeparateCertificateandCRLKeysTest20EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "SeparateCertificateandCRLKeysCRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.4.21 Invalid Separate Certificate and CRL Keys Test21", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "SeparateCertificateandCRLKeysCA2CertificateSigningCACert.crt", + "SeparateCertificateandCRLKeysCA2CRLSigningCert.crt", + "InvalidSeparateCertificateandCRLKeysTest21EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "SeparateCertificateandCRLKeysCA2CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.5.1 Valid Basic Self-Issued Old With New Test1", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "BasicSelfIssuedNewKeyCACert.crt", + "BasicSelfIssuedNewKeyOldWithNewCACert.crt", + "ValidBasicSelfIssuedOldWithNewTest1EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "BasicSelfIssuedNewKeyCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.5.2 Invalid Basic Self-Issued Old With New Test2", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "BasicSelfIssuedNewKeyCACert.crt", + "BasicSelfIssuedNewKeyOldWithNewCACert.crt", + "InvalidBasicSelfIssuedOldWithNewTest2EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "BasicSelfIssuedNewKeyCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.5.3 Valid Basic Self-Issued New With Old Test3", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "BasicSelfIssuedOldKeyCACert.crt", + "BasicSelfIssuedOldKeyNewWithOldCACert.crt", + "ValidBasicSelfIssuedNewWithOldTest3EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "BasicSelfIssuedOldKeySelfIssuedCertCRL.crl", + "BasicSelfIssuedOldKeyCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.5.4 Valid Basic Self-Issued New With Old Test4", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "BasicSelfIssuedOldKeyCACert.crt", + "BasicSelfIssuedOldKeyNewWithOldCACert.crt", + "ValidBasicSelfIssuedNewWithOldTest4EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "BasicSelfIssuedOldKeySelfIssuedCertCRL.crl", + "BasicSelfIssuedOldKeyCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.5.5 Invalid Basic Self-Issued New With Old Test5", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "BasicSelfIssuedOldKeyCACert.crt", + "BasicSelfIssuedOldKeyNewWithOldCACert.crt", + "InvalidBasicSelfIssuedNewWithOldTest5EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "BasicSelfIssuedOldKeySelfIssuedCertCRL.crl", + "BasicSelfIssuedOldKeyCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.5.6 Valid Basic Self-Issued CRL Signing Key Test6", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "BasicSelfIssuedCRLSigningKeyCACert.crt", + "BasicSelfIssuedCRLSigningKeyCRLCert.crt", + "ValidBasicSelfIssuedCRLSigningKeyTest6EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "BasicSelfIssuedCRLSigningKeyCRLCertCRL.crl", + "BasicSelfIssuedCRLSigningKeyCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.5.7 Invalid Basic Self-Issued CRL Signing Key Test7", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "BasicSelfIssuedCRLSigningKeyCACert.crt", + "BasicSelfIssuedCRLSigningKeyCRLCert.crt", + "InvalidBasicSelfIssuedCRLSigningKeyTest7EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "BasicSelfIssuedCRLSigningKeyCRLCertCRL.crl", + "BasicSelfIssuedCRLSigningKeyCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.5.8 Invalid Basic Self-Issued CRL Signing Key Test8", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "BasicSelfIssuedCRLSigningKeyCACert.crt", + "BasicSelfIssuedCRLSigningKeyCRLCert.crt", + "InvalidBasicSelfIssuedCRLSigningKeyTest8EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "BasicSelfIssuedCRLSigningKeyCRLCertCRL.crl", + "BasicSelfIssuedCRLSigningKeyCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.6.1 Invalid Missing basicConstraints Test1", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "MissingbasicConstraintsCACert.crt", + "InvalidMissingbasicConstraintsTest1EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "MissingbasicConstraintsCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.6.2 Invalid cA False Test2", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "basicConstraintsCriticalcAFalseCACert.crt", + "InvalidcAFalseTest2EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "basicConstraintsCriticalcAFalseCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.6.3 Invalid cA False Test3", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "basicConstraintsNotCriticalcAFalseCACert.crt", + "InvalidcAFalseTest3EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "basicConstraintsNotCriticalcAFalseCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.6.4 Valid basicConstraints Not Critical Test4", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "basicConstraintsNotCriticalCACert.crt", + "ValidbasicConstraintsNotCriticalTest4EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "basicConstraintsNotCriticalCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.6.5 Invalid pathLenConstraint Test5", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "pathLenConstraint0CACert.crt", + "pathLenConstraint0subCACert.crt", + "InvalidpathLenConstraintTest5EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "pathLenConstraint0CACRL.crl", + "pathLenConstraint0subCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.6.6 Invalid pathLenConstraint Test6", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "pathLenConstraint0CACert.crt", + "pathLenConstraint0subCACert.crt", + "InvalidpathLenConstraintTest6EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "pathLenConstraint0CACRL.crl", + "pathLenConstraint0subCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.6.7 Valid pathLenConstraint Test7", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "pathLenConstraint0CACert.crt", + "ValidpathLenConstraintTest7EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "pathLenConstraint0CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.6.8 Valid pathLenConstraint Test8", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "pathLenConstraint0CACert.crt", + "ValidpathLenConstraintTest8EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "pathLenConstraint0CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.6.9 Invalid pathLenConstraint Test9", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "pathLenConstraint6CACert.crt", + "pathLenConstraint6subCA0Cert.crt", + "pathLenConstraint6subsubCA00Cert.crt", + "InvalidpathLenConstraintTest9EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "pathLenConstraint6CACRL.crl", + "pathLenConstraint6subCA0CRL.crl", + "pathLenConstraint6subsubCA00CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.6.10 Invalid pathLenConstraint Test10", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "pathLenConstraint6CACert.crt", + "pathLenConstraint6subCA0Cert.crt", + "pathLenConstraint6subsubCA00Cert.crt", + "InvalidpathLenConstraintTest10EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "pathLenConstraint6CACRL.crl", + "pathLenConstraint6subCA0CRL.crl", + "pathLenConstraint6subsubCA00CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.6.11 Invalid pathLenConstraint Test11", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "pathLenConstraint6CACert.crt", + "pathLenConstraint6subCA1Cert.crt", + "pathLenConstraint6subsubCA11Cert.crt", + "pathLenConstraint6subsubsubCA11XCert.crt", + "InvalidpathLenConstraintTest11EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "pathLenConstraint6CACRL.crl", + "pathLenConstraint6subCA1CRL.crl", + "pathLenConstraint6subsubCA11CRL.crl", + "pathLenConstraint6subsubsubCA11XCRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.6.12 Invalid pathLenConstraint Test12", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "pathLenConstraint6CACert.crt", + "pathLenConstraint6subCA1Cert.crt", + "pathLenConstraint6subsubCA11Cert.crt", + "pathLenConstraint6subsubsubCA11XCert.crt", + "InvalidpathLenConstraintTest12EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "pathLenConstraint6CACRL.crl", + "pathLenConstraint6subCA1CRL.crl", + "pathLenConstraint6subsubCA11CRL.crl", + "pathLenConstraint6subsubsubCA11XCRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.6.13 Valid pathLenConstraint Test13", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "pathLenConstraint6CACert.crt", + "pathLenConstraint6subCA4Cert.crt", + "pathLenConstraint6subsubCA41Cert.crt", + "pathLenConstraint6subsubsubCA41XCert.crt", + "ValidpathLenConstraintTest13EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "pathLenConstraint6CACRL.crl", + "pathLenConstraint6subCA4CRL.crl", + "pathLenConstraint6subsubCA41CRL.crl", + "pathLenConstraint6subsubsubCA41XCRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.6.14 Valid pathLenConstraint Test14", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "pathLenConstraint6CACert.crt", + "pathLenConstraint6subCA4Cert.crt", + "pathLenConstraint6subsubCA41Cert.crt", + "pathLenConstraint6subsubsubCA41XCert.crt", + "ValidpathLenConstraintTest14EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "pathLenConstraint6CACRL.crl", + "pathLenConstraint6subCA4CRL.crl", + "pathLenConstraint6subsubCA41CRL.crl", + "pathLenConstraint6subsubsubCA41XCRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.6.15 Valid Self-Issued pathLenConstraint Test15", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "pathLenConstraint0CACert.crt", + "pathLenConstraint0SelfIssuedCACert.crt", + "ValidSelfIssuedpathLenConstraintTest15EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "pathLenConstraint0CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.6.16 Invalid Self-Issued pathLenConstraint Test16", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "pathLenConstraint0CACert.crt", + "pathLenConstraint0SelfIssuedCACert.crt", + "pathLenConstraint0subCA2Cert.crt", + "InvalidSelfIssuedpathLenConstraintTest16EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "pathLenConstraint0CACRL.crl", + "pathLenConstraint0subCA2CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.6.17 Valid Self-Issued pathLenConstraint Test17", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "pathLenConstraint1CACert.crt", + "pathLenConstraint1SelfIssuedCACert.crt", + "pathLenConstraint1subCACert.crt", + "pathLenConstraint1SelfIssuedsubCACert.crt", + "ValidSelfIssuedpathLenConstraintTest17EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "pathLenConstraint1CACRL.crl", + "pathLenConstraint1subCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.7.1 Invalid keyUsage Critical keyCertSign False Test1", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "keyUsageCriticalkeyCertSignFalseCACert.crt", + "InvalidkeyUsageCriticalkeyCertSignFalseTest1EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "keyUsageCriticalkeyCertSignFalseCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.7.2 Invalid keyUsage Not Critical keyCertSign False Test2", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "keyUsageNotCriticalkeyCertSignFalseCACert.crt", + "InvalidkeyUsageNotCriticalkeyCertSignFalseTest2EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "keyUsageNotCriticalkeyCertSignFalseCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.7.3 Valid keyUsage Not Critical Test3", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "keyUsageNotCriticalCACert.crt", + "ValidkeyUsageNotCriticalTest3EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "keyUsageNotCriticalCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.7.4 Invalid keyUsage Critical cRLSign False Test4", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "keyUsageCriticalcRLSignFalseCACert.crt", + "InvalidkeyUsageCriticalcRLSignFalseTest4EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "keyUsageCriticalcRLSignFalseCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.7.5 Invalid keyUsage Not Critical cRLSign False Test5", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "keyUsageNotCriticalcRLSignFalseCACert.crt", + "InvalidkeyUsageNotCriticalcRLSignFalseTest5EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "keyUsageNotCriticalcRLSignFalseCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.1 All Certificates Same Policy Test1 (Subpart 1)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "ValidCertificatePathTest1EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": true, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.1 All Certificates Same Policy Test1 (Subpart 2)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "ValidCertificatePathTest1EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "NIST-test-policy-1" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": true, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.1 All Certificates Same Policy Test1 (Subpart 3)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "ValidCertificatePathTest1EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "NIST-test-policy-2" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": true, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.1 All Certificates Same Policy Test1 (Subpart 4)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "ValidCertificatePathTest1EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "NIST-test-policy-1", + "NIST-test-policy-2" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": true, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.2 All Certificates No Policies Test2 (Subpart 1)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "NoPoliciesCACert.crt", + "AllCertificatesNoPoliciesTest2EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "NoPoliciesCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.2 All Certificates No Policies Test2 (Subpart 2)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "NoPoliciesCACert.crt", + "AllCertificatesNoPoliciesTest2EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "NoPoliciesCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": true, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.3 Different Policies Test3 (Subpart 1)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "PoliciesP2subCACert.crt", + "DifferentPoliciesTest3EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl", + "PoliciesP2subCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.3 Different Policies Test3 (Subpart 2)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "PoliciesP2subCACert.crt", + "DifferentPoliciesTest3EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl", + "PoliciesP2subCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": true, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.3 Different Policies Test3 (Subpart 3)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "PoliciesP2subCACert.crt", + "DifferentPoliciesTest3EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl", + "PoliciesP2subCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "NIST-test-policy-1", + "NIST-test-policy-2" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": true, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.4 Different Policies Test4", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "GoodsubCACert.crt", + "DifferentPoliciesTest4EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl", + "GoodsubCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.5 Different Policies Test5", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "PoliciesP2subCA2Cert.crt", + "DifferentPoliciesTest5EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl", + "PoliciesP2subCA2CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.6 Overlapping Policies Test6 (Subpart 1)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "PoliciesP1234CACert.crt", + "PoliciesP1234subCAP123Cert.crt", + "PoliciesP1234subsubCAP123P12Cert.crt", + "OverlappingPoliciesTest6EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "PoliciesP1234CACRL.crl", + "PoliciesP1234subCAP123CRL.crl", + "PoliciesP1234subsubCAP123P12CRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.6 Overlapping Policies Test6 (Subpart 2)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "PoliciesP1234CACert.crt", + "PoliciesP1234subCAP123Cert.crt", + "PoliciesP1234subsubCAP123P12Cert.crt", + "OverlappingPoliciesTest6EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "PoliciesP1234CACRL.crl", + "PoliciesP1234subCAP123CRL.crl", + "PoliciesP1234subsubCAP123P12CRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "NIST-test-policy-1" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.6 Overlapping Policies Test6 (Subpart 3)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "PoliciesP1234CACert.crt", + "PoliciesP1234subCAP123Cert.crt", + "PoliciesP1234subsubCAP123P12Cert.crt", + "OverlappingPoliciesTest6EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "PoliciesP1234CACRL.crl", + "PoliciesP1234subCAP123CRL.crl", + "PoliciesP1234subsubCAP123P12CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "NIST-test-policy-2" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.7 Different Policies Test7", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "PoliciesP123CACert.crt", + "PoliciesP123subCAP12Cert.crt", + "PoliciesP123subsubCAP12P1Cert.crt", + "DifferentPoliciesTest7EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "PoliciesP123CACRL.crl", + "PoliciesP123subCAP12CRL.crl", + "PoliciesP123subsubCAP12P1CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.8 Different Policies Test8", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "PoliciesP12CACert.crt", + "PoliciesP12subCAP1Cert.crt", + "PoliciesP12subsubCAP1P2Cert.crt", + "DifferentPoliciesTest8EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "PoliciesP12CACRL.crl", + "PoliciesP12subCAP1CRL.crl", + "PoliciesP12subsubCAP1P2CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.9 Different Policies Test9", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "PoliciesP123CACert.crt", + "PoliciesP123subCAP12Cert.crt", + "PoliciesP123subsubCAP12P2Cert.crt", + "PoliciesP123subsubsubCAP12P2P1Cert.crt", + "DifferentPoliciesTest9EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "PoliciesP123CACRL.crl", + "PoliciesP123subCAP12CRL.crl", + "PoliciesP123subsubCAP2P2CRL.crl", + "PoliciesP123subsubsubCAP12P2P1CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.10 All Certificates Same Policies Test10 (Subpart 1)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "PoliciesP12CACert.crt", + "AllCertificatesSamePoliciesTest10EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "PoliciesP12CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.10 All Certificates Same Policies Test10 (Subpart 2)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "PoliciesP12CACert.crt", + "AllCertificatesSamePoliciesTest10EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "PoliciesP12CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "NIST-test-policy-1" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.10 All Certificates Same Policies Test10 (Subpart 3)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "PoliciesP12CACert.crt", + "AllCertificatesSamePoliciesTest10EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "PoliciesP12CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "NIST-test-policy-2" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.11 All Certificates AnyPolicy Test11 (Subpart 1)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "anyPolicyCACert.crt", + "AllCertificatesanyPolicyTest11EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "anyPolicyCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.11 All Certificates AnyPolicy Test11 (Subpart 2)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "anyPolicyCACert.crt", + "AllCertificatesanyPolicyTest11EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "anyPolicyCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "NIST-test-policy-1" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.12 Different Policies Test12", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "PoliciesP3CACert.crt", + "DifferentPoliciesTest12EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "PoliciesP3CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.13 All Certificates Same Policies Test13 (Subpart 1)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "PoliciesP123CACert.crt", + "AllCertificatesSamePoliciesTest13EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "PoliciesP123CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "NIST-test-policy-1" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.13 All Certificates Same Policies Test13 (Subpart 2)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "PoliciesP123CACert.crt", + "AllCertificatesSamePoliciesTest13EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "PoliciesP123CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "NIST-test-policy-2" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.13 All Certificates Same Policies Test13 (Subpart 3)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "PoliciesP123CACert.crt", + "AllCertificatesSamePoliciesTest13EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "PoliciesP123CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "NIST-test-policy-3" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.14 AnyPolicy Test14 (Subpart 1)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "anyPolicyCACert.crt", + "AnyPolicyTest14EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "anyPolicyCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "NIST-test-policy-1" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.14 AnyPolicy Test14 (Subpart 2)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "anyPolicyCACert.crt", + "AnyPolicyTest14EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "anyPolicyCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "NIST-test-policy-2" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.15 User Notice Qualifier Test15", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "UserNoticeQualifierTest15EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.16 User Notice Qualifier Test16", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "UserNoticeQualifierTest16EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.17 User Notice Qualifier Test17", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "UserNoticeQualifierTest17EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.18 User Notice Qualifier Test18 (Subpart 1)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "PoliciesP12CACert.crt", + "UserNoticeQualifierTest18EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "PoliciesP12CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "NIST-test-policy-1" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.18 User Notice Qualifier Test18 (Subpart 2)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "PoliciesP12CACert.crt", + "UserNoticeQualifierTest18EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "PoliciesP12CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "NIST-test-policy-2" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.19 User Notice Qualifier Test19", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "UserNoticeQualifierTest19EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.8.20 CPS Pointer Qualifier Test20", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "CPSPointerQualifierTest20EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "NIST-test-policy-1" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": true, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.9.1 Valid RequireExplicitPolicy Test1", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "requireExplicitPolicy10CACert.crt", + "requireExplicitPolicy10subCACert.crt", + "requireExplicitPolicy10subsubCACert.crt", + "requireExplicitPolicy10subsubsubCACert.crt", + "ValidrequireExplicitPolicyTest1EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "requireExplicitPolicy10CACRL.crl", + "requireExplicitPolicy10subCACRL.crl", + "requireExplicitPolicy10subsubCACRL.crl", + "requireExplicitPolicy10subsubsubCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.9.2 Valid RequireExplicitPolicy Test2", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "requireExplicitPolicy5CACert.crt", + "requireExplicitPolicy5subCACert.crt", + "requireExplicitPolicy5subsubCACert.crt", + "requireExplicitPolicy5subsubsubCACert.crt", + "ValidrequireExplicitPolicyTest2EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "requireExplicitPolicy5CACRL.crl", + "requireExplicitPolicy5subCACRL.crl", + "requireExplicitPolicy5subsubCACRL.crl", + "requireExplicitPolicy5subsubsubCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.9.3 Invalid RequireExplicitPolicy Test3", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "requireExplicitPolicy4CACert.crt", + "requireExplicitPolicy4subCACert.crt", + "requireExplicitPolicy4subsubCACert.crt", + "requireExplicitPolicy4subsubsubCACert.crt", + "InvalidrequireExplicitPolicyTest3EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "requireExplicitPolicy4CACRL.crl", + "requireExplicitPolicy4subCACRL.crl", + "requireExplicitPolicy4subsubCACRL.crl", + "requireExplicitPolicy4subsubsubCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.9.4 Valid RequireExplicitPolicy Test4", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "requireExplicitPolicy0CACert.crt", + "requireExplicitPolicy0subCACert.crt", + "requireExplicitPolicy0subsubCACert.crt", + "requireExplicitPolicy0subsubsubCACert.crt", + "ValidrequireExplicitPolicyTest4EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "requireExplicitPolicy0CACRL.crl", + "requireExplicitPolicy0subCACRL.crl", + "requireExplicitPolicy0subsubCACRL.crl", + "requireExplicitPolicy0subsubsubCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.9.5 Invalid RequireExplicitPolicy Test5", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "requireExplicitPolicy7CACert.crt", + "requireExplicitPolicy7subCARE2Cert.crt", + "requireExplicitPolicy7subsubCARE2RE4Cert.crt", + "requireExplicitPolicy7subsubsubCARE2RE4Cert.crt", + "InvalidrequireExplicitPolicyTest5EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "requireExplicitPolicy7CACRL.crl", + "requireExplicitPolicy7subCARE2CRL.crl", + "requireExplicitPolicy7subsubCARE2RE4CRL.crl", + "requireExplicitPolicy7subsubsubCARE2RE4CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.9.6 Valid Self-Issued requireExplicitPolicy Test6", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "requireExplicitPolicy2CACert.crt", + "requireExplicitPolicy2SelfIssuedCACert.crt", + "ValidSelfIssuedrequireExplicitPolicyTest6EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "requireExplicitPolicy2CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.9.7 Invalid Self-Issued requireExplicitPolicy Test7", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "requireExplicitPolicy2CACert.crt", + "requireExplicitPolicy2SelfIssuedCACert.crt", + "requireExplicitPolicy2subCACert.crt", + "InvalidSelfIssuedrequireExplicitPolicyTest7EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "requireExplicitPolicy2CACRL.crl", + "requireExplicitPolicy2subCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.9.8 Invalid Self-Issued requireExplicitPolicy Test8", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "requireExplicitPolicy2CACert.crt", + "requireExplicitPolicy2SelfIssuedCACert.crt", + "requireExplicitPolicy2subCACert.crt", + "requireExplicitPolicy2SelfIssuedsubCACert.crt", + "InvalidSelfIssuedrequireExplicitPolicyTest8EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "requireExplicitPolicy2CACRL.crl", + "requireExplicitPolicy2subCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.1.1 Valid Policy Mapping Test1 (Subpart 1)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "Mapping1to2CACert.crt", + "ValidPolicyMappingTest1EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "Mapping1to2CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "NIST-test-policy-1" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.1.2 Valid Policy Mapping Test1 (Subpart 2)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "Mapping1to2CACert.crt", + "ValidPolicyMappingTest1EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "Mapping1to2CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "NIST-test-policy-2" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.1.3 Valid Policy Mapping Test1 (Subpart 3)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "Mapping1to2CACert.crt", + "ValidPolicyMappingTest1EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "Mapping1to2CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": true, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.2 Invalid Policy Mapping Test2 (Subpart 1)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "Mapping1to2CACert.crt", + "InvalidPolicyMappingTest2EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "Mapping1to2CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.2 Invalid Policy Mapping Test2 (Subpart 2)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "Mapping1to2CACert.crt", + "InvalidPolicyMappingTest2EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "Mapping1to2CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": true, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.3 Valid Policy Mapping Test3 (Subpart 1)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "P12Mapping1to3CACert.crt", + "P12Mapping1to3subCACert.crt", + "P12Mapping1to3subsubCACert.crt", + "ValidPolicyMappingTest3EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "P12Mapping1to3CACRL.crl", + "P12Mapping1to3subCACRL.crl", + "P12Mapping1to3subsubCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "NIST-test-policy-1" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.3 Valid Policy Mapping Test3 (Subpart 2)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "P12Mapping1to3CACert.crt", + "P12Mapping1to3subCACert.crt", + "P12Mapping1to3subsubCACert.crt", + "ValidPolicyMappingTest3EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "P12Mapping1to3CACRL.crl", + "P12Mapping1to3subCACRL.crl", + "P12Mapping1to3subsubCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "NIST-test-policy-2" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.4 Invalid Policy Mapping Test4", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "P12Mapping1to3CACert.crt", + "P12Mapping1to3subCACert.crt", + "P12Mapping1to3subsubCACert.crt", + "InvalidPolicyMappingTest4EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "P12Mapping1to3CACRL.crl", + "P12Mapping1to3subCACRL.crl", + "P12Mapping1to3subsubCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.5 Valid Policy Mapping Test5 (Subpart 1)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "P1Mapping1to234CACert.crt", + "P1Mapping1to234subCACert.crt", + "ValidPolicyMappingTest5EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "P1Mapping1to234CACRL.crl", + "P1Mapping1to234subCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "NIST-test-policy-1" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.5 Valid Policy Mapping Test5 (Subpart 2)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "P1Mapping1to234CACert.crt", + "P1Mapping1to234subCACert.crt", + "ValidPolicyMappingTest5EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "P1Mapping1to234CACRL.crl", + "P1Mapping1to234subCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "NIST-test-policy-6" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.6 Valid Policy Mapping Test6 (Subpart 1)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "P1Mapping1to234CACert.crt", + "P1Mapping1to234subCACert.crt", + "ValidPolicyMappingTest6EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "P1Mapping1to234CACRL.crl", + "P1Mapping1to234subCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "NIST-test-policy-1" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.6 Valid Policy Mapping Test6 (Subpart 2)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "P1Mapping1to234CACert.crt", + "P1Mapping1to234subCACert.crt", + "ValidPolicyMappingTest6EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "P1Mapping1to234CACRL.crl", + "P1Mapping1to234subCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "NIST-test-policy-6" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.7 Invalid Mapping From anyPolicy Test7", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "MappingFromanyPolicyCACert.crt", + "InvalidMappingFromanyPolicyTest7EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "MappingFromanyPolicyCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.8 Invalid Mapping To anyPolicy Test8", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "MappingToanyPolicyCACert.crt", + "InvalidMappingToanyPolicyTest8EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "MappingToanyPolicyCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.9 Valid Policy Mapping Test9", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "PanyPolicyMapping1to2CACert.crt", + "ValidPolicyMappingTest9EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "PanyPolicyMapping1to2CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.10 Invalid Policy Mapping Test10", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "GoodsubCAPanyPolicyMapping1to2CACert.crt", + "InvalidPolicyMappingTest10EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl", + "GoodsubCAPanyPolicyMapping1to2CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.11 Valid Policy Mapping Test11", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "GoodCACert.crt", + "GoodsubCAPanyPolicyMapping1to2CACert.crt", + "ValidPolicyMappingTest11EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl", + "GoodsubCAPanyPolicyMapping1to2CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.12 Valid Policy Mapping Test12 (Subpart 1)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "P12Mapping1to3CACert.crt", + "ValidPolicyMappingTest12EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "P12Mapping1to3CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "NIST-test-policy-1" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.12 Valid Policy Mapping Test12 (Subpart 2)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "P12Mapping1to3CACert.crt", + "ValidPolicyMappingTest12EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "P12Mapping1to3CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "NIST-test-policy-2" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.13 Valid Policy Mapping Test13 (Subpart 1)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "P1anyPolicyMapping1to2CACert.crt", + "ValidPolicyMappingTest13EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "P1anyPolicyMapping1to2CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.13 Valid Policy Mapping Test13 (Subpart 2)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "P1anyPolicyMapping1to2CACert.crt", + "ValidPolicyMappingTest13EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "P1anyPolicyMapping1to2CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "NIST-test-policy-1", + "NIST-test-policy-2" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.13 Valid Policy Mapping Test13 (Subpart 3)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "P1anyPolicyMapping1to2CACert.crt", + "ValidPolicyMappingTest13EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "P1anyPolicyMapping1to2CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "NIST-test-policy-2" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.10.14 Valid Policy Mapping Test14", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "P1anyPolicyMapping1to2CACert.crt", + "ValidPolicyMappingTest14EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "P1anyPolicyMapping1to2CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.11.1 Invalid inhibitPolicyMapping Test1", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitPolicyMapping0CACert.crt", + "inhibitPolicyMapping0subCACert.crt", + "InvalidinhibitPolicyMappingTest1EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitPolicyMapping0CACRL.crl", + "inhibitPolicyMapping0subCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.11.2 Valid inhibitPolicyMapping Test2", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitPolicyMapping1P12CACert.crt", + "inhibitPolicyMapping1P12subCACert.crt", + "ValidinhibitPolicyMappingTest2EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitPolicyMapping1P12CACRL.crl", + "inhibitPolicyMapping1P12subCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.11.3 Invalid inhibitPolicyMapping Test3", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitPolicyMapping1P12CACert.crt", + "inhibitPolicyMapping1P12subCACert.crt", + "inhibitPolicyMapping1P12subsubCACert.crt", + "InvalidinhibitPolicyMappingTest3EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitPolicyMapping1P12CACRL.crl", + "inhibitPolicyMapping1P12subCACRL.crl", + "inhibitPolicyMapping1P12subsubCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.11.4 Valid inhibitPolicyMapping Test4", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitPolicyMapping1P12CACert.crt", + "inhibitPolicyMapping1P12subCACert.crt", + "inhibitPolicyMapping1P12subsubCACert.crt", + "ValidinhibitPolicyMappingTest4EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitPolicyMapping1P12CACRL.crl", + "inhibitPolicyMapping1P12subCACRL.crl", + "inhibitPolicyMapping1P12subsubCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.11.5 Invalid inhibitPolicyMapping Test5", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitPolicyMapping5CACert.crt", + "inhibitPolicyMapping5subCACert.crt", + "inhibitPolicyMapping5subsubCACert.crt", + "inhibitPolicyMapping5subsubsubCACert.crt", + "InvalidinhibitPolicyMappingTest5EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitPolicyMapping5CACRL.crl", + "inhibitPolicyMapping5subCACRL.crl", + "inhibitPolicyMapping5subsubCACRL.crl", + "inhibitPolicyMapping5subsubsubCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.11.6 Invalid inhibitPolicyMapping Test6", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitPolicyMapping1P12CACert.crt", + "inhibitPolicyMapping1P12subCAIPM5Cert.crt", + "inhibitPolicyMapping1P12subsubCAIPM5Cert.crt", + "InvalidinhibitPolicyMappingTest6EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitPolicyMapping1P12CACRL.crl", + "inhibitPolicyMapping1P12subCAIPM5CRL.crl", + "inhibitPolicyMapping1P12subsubCAIPM5CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.11.7 Valid Self-Issued inhibitPolicyMapping Test7", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitPolicyMapping1P1CACert.crt", + "inhibitPolicyMapping1P1SelfIssuedCACert.crt", + "inhibitPolicyMapping1P1subCACert.crt", + "ValidSelfIssuedinhibitPolicyMappingTest7EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitPolicyMapping1P1CACRL.crl", + "inhibitPolicyMapping1P1subCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.11.8 Invalid Self-Issued inhibitPolicyMapping Test8", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitPolicyMapping1P1CACert.crt", + "inhibitPolicyMapping1P1SelfIssuedCACert.crt", + "inhibitPolicyMapping1P1subCACert.crt", + "inhibitPolicyMapping1P1subsubCACert.crt", + "InvalidSelfIssuedinhibitPolicyMappingTest8EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitPolicyMapping1P1CACRL.crl", + "inhibitPolicyMapping1P1subCACRL.crl", + "inhibitPolicyMapping1P1subsubCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.11.9 Invalid Self-Issued inhibitPolicyMapping Test9", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitPolicyMapping1P1CACert.crt", + "inhibitPolicyMapping1P1SelfIssuedCACert.crt", + "inhibitPolicyMapping1P1subCACert.crt", + "inhibitPolicyMapping1P1subsubCACert.crt", + "InvalidSelfIssuedinhibitPolicyMappingTest9EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitPolicyMapping1P1CACRL.crl", + "inhibitPolicyMapping1P1subCACRL.crl", + "inhibitPolicyMapping1P1subsubCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.11.10 Invalid Self-Issued inhibitPolicyMapping Test10", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitPolicyMapping1P1CACert.crt", + "inhibitPolicyMapping1P1SelfIssuedCACert.crt", + "inhibitPolicyMapping1P1subCACert.crt", + "inhibitPolicyMapping1P1SelfIssuedsubCACert.crt", + "InvalidSelfIssuedinhibitPolicyMappingTest10EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitPolicyMapping1P1CACRL.crl", + "inhibitPolicyMapping1P1subCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.11.11 Invalid Self-Issued inhibitPolicyMapping Test11", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitPolicyMapping1P1CACert.crt", + "inhibitPolicyMapping1P1SelfIssuedCACert.crt", + "inhibitPolicyMapping1P1subCACert.crt", + "inhibitPolicyMapping1P1SelfIssuedsubCACert.crt", + "InvalidSelfIssuedinhibitPolicyMappingTest11EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitPolicyMapping1P1CACRL.crl", + "inhibitPolicyMapping1P1subCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.12.1 Invalid inhibitAnyPolicy Test1", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitAnyPolicy0CACert.crt", + "InvalidinhibitAnyPolicyTest1EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitAnyPolicy0CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.12.2 Valid inhibitAnyPolicy Test2", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitAnyPolicy0CACert.crt", + "ValidinhibitAnyPolicyTest2EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitAnyPolicy0CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.12.3 inhibitAnyPolicy Test3 (Subpart 1)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitAnyPolicy1CACert.crt", + "inhibitAnyPolicy1subCA1Cert.crt", + "inhibitAnyPolicyTest3EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitAnyPolicy1CACRL.crl", + "inhibitAnyPolicy1subCA1CRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.12.3 inhibitAnyPolicy Test3 (Subpart 2)", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitAnyPolicy1CACert.crt", + "inhibitAnyPolicy1subCA1Cert.crt", + "inhibitAnyPolicyTest3EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitAnyPolicy1CACRL.crl", + "inhibitAnyPolicy1subCA1CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": true + }, + { + "Name": "4.12.4 Invalid inhibitAnyPolicy Test4", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitAnyPolicy1CACert.crt", + "inhibitAnyPolicy1subCA1Cert.crt", + "InvalidinhibitAnyPolicyTest4EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitAnyPolicy1CACRL.crl", + "inhibitAnyPolicy1subCA1CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.12.5 Invalid inhibitAnyPolicy Test5", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitAnyPolicy5CACert.crt", + "inhibitAnyPolicy5subCACert.crt", + "inhibitAnyPolicy5subsubCACert.crt", + "InvalidinhibitAnyPolicyTest5EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitAnyPolicy5CACRL.crl", + "inhibitAnyPolicy5subCACRL.crl", + "inhibitAnyPolicy5subsubCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.12.6 Invalid inhibitAnyPolicy Test6", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitAnyPolicy1CACert.crt", + "inhibitAnyPolicy1subCAIAP5Cert.crt", + "InvalidinhibitAnyPolicyTest6EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitAnyPolicy1CACRL.crl", + "inhibitAnyPolicy1subCAIAP5CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.12.7 Valid Self-Issued inhibitAnyPolicy Test7", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitAnyPolicy1CACert.crt", + "inhibitAnyPolicy1SelfIssuedCACert.crt", + "inhibitAnyPolicy1subCA2Cert.crt", + "ValidSelfIssuedinhibitAnyPolicyTest7EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitAnyPolicy1CACRL.crl", + "inhibitAnyPolicy1subCA2CRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.12.8 Invalid Self-Issued inhibitAnyPolicy Test8", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitAnyPolicy1CACert.crt", + "inhibitAnyPolicy1SelfIssuedCACert.crt", + "inhibitAnyPolicy1subCA2Cert.crt", + "inhibitAnyPolicy1subsubCA2Cert.crt", + "InvalidSelfIssuedinhibitAnyPolicyTest8EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitAnyPolicy1CACRL.crl", + "inhibitAnyPolicy1subCA2CRL.crl", + "inhibitAnyPolicy1subsubCA2CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.12.9 Valid Self-Issued inhibitAnyPolicy Test9", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitAnyPolicy1CACert.crt", + "inhibitAnyPolicy1SelfIssuedCACert.crt", + "inhibitAnyPolicy1subCA2Cert.crt", + "inhibitAnyPolicy1SelfIssuedsubCA2Cert.crt", + "ValidSelfIssuedinhibitAnyPolicyTest9EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitAnyPolicy1CACRL.crl", + "inhibitAnyPolicy1subCA2CRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.12.10 Invalid Self-Issued inhibitAnyPolicy Test10", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "inhibitAnyPolicy1CACert.crt", + "inhibitAnyPolicy1SelfIssuedCACert.crt", + "inhibitAnyPolicy1subCA2Cert.crt", + "InvalidSelfIssuedinhibitAnyPolicyTest10EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "inhibitAnyPolicy1CACRL.crl", + "inhibitAnyPolicy1subCA2CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.1 Valid DN nameConstraints Test1", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN1CACert.crt", + "ValidDNnameConstraintsTest1EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN1CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.2 Invalid DN nameConstraints Test2", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN1CACert.crt", + "InvalidDNnameConstraintsTest2EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN1CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.3 Invalid DN nameConstraints Test3", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN1CACert.crt", + "InvalidDNnameConstraintsTest3EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN1CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.4 Valid DN nameConstraints Test4", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN1CACert.crt", + "ValidDNnameConstraintsTest4EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN1CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.5 Valid DN nameConstraints Test5", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN2CACert.crt", + "ValidDNnameConstraintsTest5EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN2CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.6 Valid DN nameConstraints Test6", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN3CACert.crt", + "ValidDNnameConstraintsTest6EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN3CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.7 Invalid DN nameConstraints Test7", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN3CACert.crt", + "InvalidDNnameConstraintsTest7EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN3CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.8 Invalid DN nameConstraints Test8", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN4CACert.crt", + "InvalidDNnameConstraintsTest8EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN4CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.9 Invalid DN nameConstraints Test9", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN4CACert.crt", + "InvalidDNnameConstraintsTest9EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN4CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.10 Invalid DN nameConstraints Test10", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN5CACert.crt", + "InvalidDNnameConstraintsTest10EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN5CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.11 Valid DN nameConstraints Test11", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN5CACert.crt", + "ValidDNnameConstraintsTest11EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN5CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.12 Invalid DN nameConstraints Test12", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN1CACert.crt", + "nameConstraintsDN1subCA1Cert.crt", + "InvalidDNnameConstraintsTest12EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN1CACRL.crl", + "nameConstraintsDN1subCA1CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.13 Invalid DN nameConstraints Test13", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN1CACert.crt", + "nameConstraintsDN1subCA2Cert.crt", + "InvalidDNnameConstraintsTest13EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN1CACRL.crl", + "nameConstraintsDN1subCA2CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.14 Valid DN nameConstraints Test14", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN1CACert.crt", + "nameConstraintsDN1subCA2Cert.crt", + "ValidDNnameConstraintsTest14EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN1CACRL.crl", + "nameConstraintsDN1subCA2CRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.15 Invalid DN nameConstraints Test15", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN3CACert.crt", + "nameConstraintsDN3subCA1Cert.crt", + "InvalidDNnameConstraintsTest15EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN3CACRL.crl", + "nameConstraintsDN3subCA1CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.16 Invalid DN nameConstraints Test16", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN3CACert.crt", + "nameConstraintsDN3subCA1Cert.crt", + "InvalidDNnameConstraintsTest16EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN3CACRL.crl", + "nameConstraintsDN3subCA1CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.17 Invalid DN nameConstraints Test17", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN3CACert.crt", + "nameConstraintsDN3subCA2Cert.crt", + "InvalidDNnameConstraintsTest17EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN3CACRL.crl", + "nameConstraintsDN3subCA2CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.18 Valid DN nameConstraints Test18", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN3CACert.crt", + "nameConstraintsDN3subCA2Cert.crt", + "ValidDNnameConstraintsTest18EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN3CACRL.crl", + "nameConstraintsDN3subCA2CRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.19 Valid Self-Issued DN nameConstraints Test19", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN1CACert.crt", + "nameConstraintsDN1SelfIssuedCACert.crt", + "ValidDNnameConstraintsTest19EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN1CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.20 Invalid Self-Issued DN nameConstraints Test20", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN1CACert.crt", + "InvalidDNnameConstraintsTest20EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN1CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.21 Valid RFC822 nameConstraints Test21", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsRFC822CA1Cert.crt", + "ValidRFC822nameConstraintsTest21EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsRFC822CA1CRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.22 Invalid RFC822 nameConstraints Test22", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsRFC822CA1Cert.crt", + "InvalidRFC822nameConstraintsTest22EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsRFC822CA1CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.23 Valid RFC822 nameConstraints Test23", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsRFC822CA2Cert.crt", + "ValidRFC822nameConstraintsTest23EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsRFC822CA2CRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.24 Invalid RFC822 nameConstraints Test24", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsRFC822CA2Cert.crt", + "InvalidRFC822nameConstraintsTest24EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsRFC822CA2CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.25 Valid RFC822 nameConstraints Test25", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsRFC822CA3Cert.crt", + "ValidRFC822nameConstraintsTest25EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsRFC822CA3CRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.26 Invalid RFC822 nameConstraints Test26", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsRFC822CA3Cert.crt", + "InvalidRFC822nameConstraintsTest26EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsRFC822CA3CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.27 Valid DN and RFC822 nameConstraints Test27", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN1CACert.crt", + "nameConstraintsDN1subCA3Cert.crt", + "ValidDNandRFC822nameConstraintsTest27EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN1CACRL.crl", + "nameConstraintsDN1subCA3CRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.28 Invalid DN and RFC822 nameConstraints Test28", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN1CACert.crt", + "nameConstraintsDN1subCA3Cert.crt", + "InvalidDNandRFC822nameConstraintsTest28EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN1CACRL.crl", + "nameConstraintsDN1subCA3CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.29 Invalid DN and RFC822 nameConstraints Test29", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDN1CACert.crt", + "nameConstraintsDN1subCA3Cert.crt", + "InvalidDNandRFC822nameConstraintsTest29EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDN1CACRL.crl", + "nameConstraintsDN1subCA3CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.30 Valid DNS nameConstraints Test30", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDNS1CACert.crt", + "ValidDNSnameConstraintsTest30EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDNS1CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.31 Invalid DNS nameConstraints Test31", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDNS1CACert.crt", + "InvalidDNSnameConstraintsTest31EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDNS1CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.32 Valid DNS nameConstraints Test32", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDNS2CACert.crt", + "ValidDNSnameConstraintsTest32EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDNS2CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.33 Invalid DNS nameConstraints Test33", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDNS2CACert.crt", + "InvalidDNSnameConstraintsTest33EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDNS2CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.34 Valid URI nameConstraints Test34", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsURI1CACert.crt", + "ValidURInameConstraintsTest34EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsURI1CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.35 Invalid URI nameConstraints Test35", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsURI1CACert.crt", + "InvalidURInameConstraintsTest35EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsURI1CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.36 Valid URI nameConstraints Test36", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsURI2CACert.crt", + "ValidURInameConstraintsTest36EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsURI2CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.37 Invalid URI nameConstraints Test37", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsURI2CACert.crt", + "InvalidURInameConstraintsTest37EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsURI2CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.13.38 Invalid DNS nameConstraints Test38", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "nameConstraintsDNS1CACert.crt", + "InvalidDNSnameConstraintsTest38EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "nameConstraintsDNS1CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.1 Valid distributionPoint Test1", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "distributionPoint1CACert.crt", + "ValiddistributionPointTest1EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "distributionPoint1CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.2 Invalid distributionPoint Test2", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "distributionPoint1CACert.crt", + "InvaliddistributionPointTest2EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "distributionPoint1CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.3 Invalid distributionPoint Test3", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "distributionPoint1CACert.crt", + "InvaliddistributionPointTest3EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "distributionPoint1CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.4 Valid distributionPoint Test4", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "distributionPoint1CACert.crt", + "ValiddistributionPointTest4EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "distributionPoint1CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.5 Valid distributionPoint Test5", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "distributionPoint2CACert.crt", + "ValiddistributionPointTest5EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "distributionPoint2CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.6 Invalid distributionPoint Test6", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "distributionPoint2CACert.crt", + "InvaliddistributionPointTest6EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "distributionPoint2CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.7 Valid distributionPoint Test7", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "distributionPoint2CACert.crt", + "ValiddistributionPointTest7EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "distributionPoint2CACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.8 Invalid distributionPoint Test8", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "distributionPoint2CACert.crt", + "InvaliddistributionPointTest8EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "distributionPoint2CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.9 Invalid distributionPoint Test9", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "distributionPoint2CACert.crt", + "InvaliddistributionPointTest9EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "distributionPoint2CACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.10 Valid No issuingDistributionPoint Test10", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "NoissuingDistributionPointCACert.crt", + "ValidNoissuingDistributionPointTest10EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "NoissuingDistributionPointCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.11 Invalid onlyContainsUserCerts CRL Test11", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "onlyContainsUserCertsCACert.crt", + "InvalidonlyContainsUserCertsTest11EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "onlyContainsUserCertsCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.12 Invalid onlyContainsCACerts CRL Test12", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "onlyContainsCACertsCACert.crt", + "InvalidonlyContainsCACertsTest12EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "onlyContainsCACertsCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.13 Valid onlyContainsCACerts CRL Test13", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "onlyContainsCACertsCACert.crt", + "ValidonlyContainsCACertsTest13EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "onlyContainsCACertsCACRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.14 Invalid onlyContainsAttributeCerts Test14", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "onlyContainsAttributeCertsCACert.crt", + "InvalidonlyContainsAttributeCertsTest14EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "onlyContainsAttributeCertsCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.15 Invalid onlySomeReasons Test15", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "onlySomeReasonsCA1Cert.crt", + "InvalidonlySomeReasonsTest15EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "onlySomeReasonsCA1compromiseCRL.crl", + "onlySomeReasonsCA1otherreasonsCRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.16 Invalid onlySomeReasons Test16", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "onlySomeReasonsCA1Cert.crt", + "InvalidonlySomeReasonsTest16EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "onlySomeReasonsCA1compromiseCRL.crl", + "onlySomeReasonsCA1otherreasonsCRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.17 Invalid onlySomeReasons Test17", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "onlySomeReasonsCA2Cert.crt", + "InvalidonlySomeReasonsTest17EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "onlySomeReasonsCA2CRL1.crl", + "onlySomeReasonsCA2CRL2.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.18 Valid onlySomeReasons Test18", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "onlySomeReasonsCA3Cert.crt", + "ValidonlySomeReasonsTest18EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "onlySomeReasonsCA3compromiseCRL.crl", + "onlySomeReasonsCA3otherreasonsCRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.19 Valid onlySomeReasons Test19", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "onlySomeReasonsCA4Cert.crt", + "ValidonlySomeReasonsTest19EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "onlySomeReasonsCA4compromiseCRL.crl", + "onlySomeReasonsCA4otherreasonsCRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.20 Invalid onlySomeReasons Test20", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "onlySomeReasonsCA4Cert.crt", + "InvalidonlySomeReasonsTest20EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "onlySomeReasonsCA4compromiseCRL.crl", + "onlySomeReasonsCA4otherreasonsCRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.21 Invalid onlySomeReasons Test21", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "onlySomeReasonsCA4Cert.crt", + "InvalidonlySomeReasonsTest21EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "onlySomeReasonsCA4compromiseCRL.crl", + "onlySomeReasonsCA4otherreasonsCRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.22 Valid IDP with indirectCRL Test22", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "indirectCRLCA1Cert.crt", + "ValidIDPwithindirectCRLTest22EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "indirectCRLCA1CRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.23 Invalid IDP with indirectCRL Test23", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "indirectCRLCA1Cert.crt", + "InvalidIDPwithindirectCRLTest23EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "indirectCRLCA1CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.24 Valid IDP with indirectCRL Test24", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "indirectCRLCA2Cert.crt", + "indirectCRLCA1Cert.crt", + "ValidIDPwithindirectCRLTest24EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "indirectCRLCA1CRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.25 Valid IDP with indirectCRL Test25", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "indirectCRLCA2Cert.crt", + "indirectCRLCA1Cert.crt", + "ValidIDPwithindirectCRLTest25EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "indirectCRLCA1CRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.26 Invalid IDP with indirectCRL Test26", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "indirectCRLCA2Cert.crt", + "indirectCRLCA1Cert.crt", + "InvalidIDPwithindirectCRLTest26EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "indirectCRLCA1CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.27 Invalid cRLIssuer Test27", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "indirectCRLCA2Cert.crt", + "GoodCACert.crt", + "InvalidcRLIssuerTest27EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "GoodCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.28 Valid cRLIssuer Test28", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "indirectCRLCA3Cert.crt", + "indirectCRLCA3cRLIssuerCert.crt", + "ValidcRLIssuerTest28EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "indirectCRLCA3CRL.crl", + "indirectCRLCA3cRLIssuerCRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.29 Valid cRLIssuer Test29", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "indirectCRLCA3Cert.crt", + "indirectCRLCA3cRLIssuerCert.crt", + "ValidcRLIssuerTest29EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "indirectCRLCA3CRL.crl", + "indirectCRLCA3cRLIssuerCRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.30 Valid cRLIssuer Test30", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "indirectCRLCA4Cert.crt", + "indirectCRLCA4cRLIssuerCert.crt", + "ValidcRLIssuerTest30EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "indirectCRLCA4cRLIssuerCRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.31 Invalid cRLIssuer Test31", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "indirectCRLCA5Cert.crt", + "indirectCRLCA6Cert.crt", + "InvalidcRLIssuerTest31EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "indirectCRLCA5CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.32 Invalid cRLIssuer Test32", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "indirectCRLCA5Cert.crt", + "indirectCRLCA6Cert.crt", + "InvalidcRLIssuerTest32EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "indirectCRLCA5CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.33 Valid cRLIssuer Test33", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "indirectCRLCA5Cert.crt", + "indirectCRLCA6Cert.crt", + "ValidcRLIssuerTest33EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "indirectCRLCA5CRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.34 Invalid cRLIssuer Test34", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "indirectCRLCA5Cert.crt", + "InvalidcRLIssuerTest34EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "indirectCRLCA5CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.14.35 Invalid cRLIssuer Test35", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "indirectCRLCA5Cert.crt", + "InvalidcRLIssuerTest35EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "indirectCRLCA5CRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.15.1 Invalid deltaCRLIndicator No Base Test1", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "deltaCRLIndicatorNoBaseCACert.crt", + "InvaliddeltaCRLIndicatorNoBaseTest1EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "deltaCRLIndicatorNoBaseCACRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.15.2 Valid delta-CRL Test2", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "deltaCRLCA1Cert.crt", + "ValiddeltaCRLTest2EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "deltaCRLCA1CRL.crl", + "deltaCRLCA1deltaCRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.15.3 Invalid delta-CRL Test3", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "deltaCRLCA1Cert.crt", + "InvaliddeltaCRLTest3EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "deltaCRLCA1CRL.crl", + "deltaCRLCA1deltaCRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.15.4 Invalid delta-CRL Test4", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "deltaCRLCA1Cert.crt", + "InvaliddeltaCRLTest4EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "deltaCRLCA1CRL.crl", + "deltaCRLCA1deltaCRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.15.5 Valid delta-CRL Test5", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "deltaCRLCA1Cert.crt", + "ValiddeltaCRLTest5EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "deltaCRLCA1CRL.crl", + "deltaCRLCA1deltaCRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.15.6 Invalid delta-CRL Test6", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "deltaCRLCA1Cert.crt", + "InvaliddeltaCRLTest6EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "deltaCRLCA1CRL.crl", + "deltaCRLCA1deltaCRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.15.7 Valid delta-CRL Test7", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "deltaCRLCA1Cert.crt", + "ValiddeltaCRLTest7EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "deltaCRLCA1CRL.crl", + "deltaCRLCA1deltaCRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.15.8 Valid delta-CRL Test8", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "deltaCRLCA2Cert.crt", + "ValiddeltaCRLTest8EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "deltaCRLCA2CRL.crl", + "deltaCRLCA2deltaCRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.15.9 Invalid delta-CRL Test9", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "deltaCRLCA2Cert.crt", + "InvaliddeltaCRLTest9EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "deltaCRLCA2CRL.crl", + "deltaCRLCA2deltaCRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.15.10 Invalid delta-CRL Test10", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "deltaCRLCA3Cert.crt", + "InvaliddeltaCRLTest10EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl", + "deltaCRLCA3CRL.crl", + "deltaCRLCA3deltaCRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.16.1 Valid Unknown Not Critical Certificate Extension Test1", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "ValidUnknownNotCriticalCertificateExtensionTest1EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl" + ], + "ShouldValidate": true, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + }, + { + "Name": "4.16.2 Invalid Unknown Critical Certificate Extension Test2", + "CertPath": [ + "TrustAnchorRootCertificate.crt", + "InvalidUnknownCriticalCertificateExtensionTest2EE.crt" + ], + "CRLPath": [ + "TrustAnchorRootCRL.crl" + ], + "ShouldValidate": false, + "InitialPolicySet": [ + "anyPolicy" + ], + "InitialPolicyMappingInhibit": false, + "InitialExplicitPolicy": false, + "InitialAnyPolicyInhibit": false + } +] \ No newline at end of file diff --git a/go/src/crypto/x509/testdata/policy_intermediate.pem b/go/src/crypto/x509/testdata/policy_intermediate.pem new file mode 100644 index 0000000000000000000000000000000000000000..759deb4c43a6467525371d406a1483567238f8fb --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_intermediate.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBqjCCAVGgAwIBAgIBAjAKBggqhkjOPQQDAjAWMRQwEgYDVQQDEwtQb2xpY3kg +Um9vdDAgFw0wMDAxMDEwMDAwMDBaGA8yMTAwMDEwMTAwMDAwMFowHjEcMBoGA1UE +AxMTUG9saWN5IEludGVybWVkaWF0ZTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA +BOI6fKiM3jFLkLyAn88cvlw4SwxuygRjopP3FFBKHyUQvh3VVvfqSpSCSmp50Qia +jQ6Dg7CTpVZVVH+bguT7JTCjgYUwgYIwDgYDVR0PAQH/BAQDAgIEMBMGA1UdJQQM +MAoGCCsGAQUFBwMBMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJDS9/4O7qhr +CIRhwsXrPVBagG2uMCsGA1UdIAQkMCIwDwYNKoZIhvcSBAGEtwkCATAPBg0qhkiG +9xIEAYS3CQICMAoGCCqGSM49BAMCA0cAMEQCIFN2ZtknXQ9vz23qD1ecprC9iIo7 +j/SI42Ub64qZQaraAiA+CRCWJz/l+NQ1+TPWYDDWY6Wh2L9Wbddh1Nj5KJEkhQ== +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_intermediate_any.pem b/go/src/crypto/x509/testdata/policy_intermediate_any.pem new file mode 100644 index 0000000000000000000000000000000000000000..0931964f520b89ef66b011181258db85f1870b7b --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_intermediate_any.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBkDCCATWgAwIBAgIBAjAKBggqhkjOPQQDAjAWMRQwEgYDVQQDEwtQb2xpY3kg +Um9vdDAgFw0wMDAxMDEwMDAwMDBaGA8yMTAwMDEwMTAwMDAwMFowHjEcMBoGA1UE +AxMTUG9saWN5IEludGVybWVkaWF0ZTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA +BOI6fKiM3jFLkLyAn88cvlw4SwxuygRjopP3FFBKHyUQvh3VVvfqSpSCSmp50Qia +jQ6Dg7CTpVZVVH+bguT7JTCjajBoMA4GA1UdDwEB/wQEAwICBDATBgNVHSUEDDAK +BggrBgEFBQcDATAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSQ0vf+Du6oawiE +YcLF6z1QWoBtrjARBgNVHSAECjAIMAYGBFUdIAAwCgYIKoZIzj0EAwIDSQAwRgIh +AJbyXshUwjsFCiqrJkg91GzJdhZZ+3WXOekCJgi8uEESAiEAhv4sEE0wRRqgHDjl +vIt26IELfFE2Z/FBF3ihGmi6NoI= +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_intermediate_duplicate.pem b/go/src/crypto/x509/testdata/policy_intermediate_duplicate.pem new file mode 100644 index 0000000000000000000000000000000000000000..0eafe8d86a8804bab190c3564fb91dbafb3ade72 --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_intermediate_duplicate.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvDCCAWKgAwIBAgIBAjAKBggqhkjOPQQDAjAWMRQwEgYDVQQDEwtQb2xpY3kg +Um9vdDAgFw0wMDAxMDEwMDAwMDBaGA8yMTAwMDEwMTAwMDAwMFowHjEcMBoGA1UE +AxMTUG9saWN5IEludGVybWVkaWF0ZTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA +BOI6fKiM3jFLkLyAn88cvlw4SwxuygRjopP3FFBKHyUQvh3VVvfqSpSCSmp50Qia +jQ6Dg7CTpVZVVH+bguT7JTCjgZYwgZMwDgYDVR0PAQH/BAQDAgIEMBMGA1UdJQQM +MAoGCCsGAQUFBwMBMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJDS9/4O7qhr +CIRhwsXrPVBagG2uMDwGA1UdIAQ1MDMwDwYNKoZIhvcSBAGEtwkCATAPBg0qhkiG +9xIEAYS3CQICMA8GDSqGSIb3EgQBhLcJAgIwCgYIKoZIzj0EAwIDSAAwRQIgUpG6 +FUeWrC62BtTPHiSlWBdnLWUYH0llS6uYUkpJFJECIQCWfhoZYXvHdMhgBDSI/vzY +Sw4uNdcMxrC2kP6lIioUSw== +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_intermediate_invalid.pem b/go/src/crypto/x509/testdata/policy_intermediate_invalid.pem new file mode 100644 index 0000000000000000000000000000000000000000..11c95afcea48dfe2d7c42caf8c759370336c7c40 --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_intermediate_invalid.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBjDCCATKgAwIBAgIBAjAKBggqhkjOPQQDAjAWMRQwEgYDVQQDEwtQb2xpY3kg +Um9vdDAgFw0wMDAxMDEwMDAwMDBaGA8yMTAwMDEwMTAwMDAwMFowHjEcMBoGA1UE +AxMTUG9saWN5IEludGVybWVkaWF0ZTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA +BOI6fKiM3jFLkLyAn88cvlw4SwxuygRjopP3FFBKHyUQvh3VVvfqSpSCSmp50Qia +jQ6Dg7CTpVZVVH+bguT7JTCjZzBlMA4GA1UdDwEB/wQEAwICBDATBgNVHSUEDDAK +BggrBgEFBQcDATAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSQ0vf+Du6oawiE +YcLF6z1QWoBtrjAOBgNVHSAEB0lOVkFMSUQwCgYIKoZIzj0EAwIDSAAwRQIgS2uK +cYlZ1bxeqgMy3X0Sfi0arAnqpePsAqAeEf+HJHQCIQDwfCnXrWyHET9lM/gJSkfN +j/JRJvJELDrAMVewCxZWKA== +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_intermediate_mapped.pem b/go/src/crypto/x509/testdata/policy_intermediate_mapped.pem new file mode 100644 index 0000000000000000000000000000000000000000..fa45e604b43af15ff15030c68f2b1c0509ce2e10 --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_intermediate_mapped.pem @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE----- +MIICrjCCAlSgAwIBAgIBAjAKBggqhkjOPQQDAjAWMRQwEgYDVQQDEwtQb2xpY3kg +Um9vdDAgFw0wMDAxMDEwMDAwMDBaGA8yMTAwMDEwMTAwMDAwMFowHjEcMBoGA1UE +AxMTUG9saWN5IEludGVybWVkaWF0ZTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA +BOI6fKiM3jFLkLyAn88cvlw4SwxuygRjopP3FFBKHyUQvh3VVvfqSpSCSmp50Qia +jQ6Dg7CTpVZVVH+bguT7JTCjggGHMIIBgzAOBgNVHQ8BAf8EBAMCAgQwEwYDVR0l +BAwwCgYIKwYBBQUHAwEwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUkNL3/g7u +qGsIhGHCxes9UFqAba4wXgYDVR0gBFcwVTAPBg0qhkiG9xIEAYS3CQIBMA8GDSqG +SIb3EgQBhLcJAgIwDwYNKoZIhvcSBAGEtwkCAzAPBg0qhkiG9xIEAYS3CQIEMA8G +DSqGSIb3EgQBhLcJAgUwgcsGA1UdIQSBwzCBwDAeBg0qhkiG9xIEAYS3CQIDBg0q +hkiG9xIEAYS3CQIBMB4GDSqGSIb3EgQBhLcJAgMGDSqGSIb3EgQBhLcJAgIwHgYN +KoZIhvcSBAGEtwkCBAYNKoZIhvcSBAGEtwkCBDAeBg0qhkiG9xIEAYS3CQIEBg0q +hkiG9xIEAYS3CQIFMB4GDSqGSIb3EgQBhLcJAgUGDSqGSIb3EgQBhLcJAgQwHgYN +KoZIhvcSBAGEtwkCBQYNKoZIhvcSBAGEtwkCBTAKBggqhkjOPQQDAgNIADBFAiAe +Ah2vJMZsW/RV35mM7b7/NjsjScjPEIxfDJu49inNXQIhANmGBqyWUogh/gXyVB0/ +IfDro27pANW3R02A+zH34q5k +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_intermediate_mapped_any.pem b/go/src/crypto/x509/testdata/policy_intermediate_mapped_any.pem new file mode 100644 index 0000000000000000000000000000000000000000..ae47bf45ceae6aec46654243d19d7911a2f69bf2 --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_intermediate_mapped_any.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICYjCCAgegAwIBAgIBAjAKBggqhkjOPQQDAjAWMRQwEgYDVQQDEwtQb2xpY3kg +Um9vdDAgFw0wMDAxMDEwMDAwMDBaGA8yMTAwMDEwMTAwMDAwMFowHjEcMBoGA1UE +AxMTUG9saWN5IEludGVybWVkaWF0ZTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA +BOI6fKiM3jFLkLyAn88cvlw4SwxuygRjopP3FFBKHyUQvh3VVvfqSpSCSmp50Qia +jQ6Dg7CTpVZVVH+bguT7JTCjggE6MIIBNjAOBgNVHQ8BAf8EBAMCAgQwEwYDVR0l +BAwwCgYIKwYBBQUHAwEwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUkNL3/g7u +qGsIhGHCxes9UFqAba4wEQYDVR0gBAowCDAGBgRVHSAAMIHLBgNVHSEEgcMwgcAw +HgYNKoZIhvcSBAGEtwkCAwYNKoZIhvcSBAGEtwkCATAeBg0qhkiG9xIEAYS3CQID +Bg0qhkiG9xIEAYS3CQICMB4GDSqGSIb3EgQBhLcJAgQGDSqGSIb3EgQBhLcJAgQw +HgYNKoZIhvcSBAGEtwkCBAYNKoZIhvcSBAGEtwkCBTAeBg0qhkiG9xIEAYS3CQIF +Bg0qhkiG9xIEAYS3CQIEMB4GDSqGSIb3EgQBhLcJAgUGDSqGSIb3EgQBhLcJAgUw +CgYIKoZIzj0EAwIDSQAwRgIhAIOx3GL5xlldQGdTLIvTTAvczm8wiYHzZDAif2yj +wAjEAiEAg4K02kTYX9x7PC/u1PYdwvo+LVbnGbO6AN6U3K2d7gs= +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_intermediate_mapped_oid3.pem b/go/src/crypto/x509/testdata/policy_intermediate_mapped_oid3.pem new file mode 100644 index 0000000000000000000000000000000000000000..c04a38a48f129870977dd0bacc5603f8498a4b52 --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_intermediate_mapped_oid3.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICajCCAhCgAwIBAgIBAjAKBggqhkjOPQQDAjAWMRQwEgYDVQQDEwtQb2xpY3kg +Um9vdDAgFw0wMDAxMDEwMDAwMDBaGA8yMTAwMDEwMTAwMDAwMFowHjEcMBoGA1UE +AxMTUG9saWN5IEludGVybWVkaWF0ZTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA +BOI6fKiM3jFLkLyAn88cvlw4SwxuygRjopP3FFBKHyUQvh3VVvfqSpSCSmp50Qia +jQ6Dg7CTpVZVVH+bguT7JTCjggFDMIIBPzAOBgNVHQ8BAf8EBAMCAgQwEwYDVR0l +BAwwCgYIKwYBBQUHAwEwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUkNL3/g7u +qGsIhGHCxes9UFqAba4wGgYDVR0gBBMwETAPBg0qhkiG9xIEAYS3CQIDMIHLBgNV +HSEEgcMwgcAwHgYNKoZIhvcSBAGEtwkCAwYNKoZIhvcSBAGEtwkCATAeBg0qhkiG +9xIEAYS3CQIDBg0qhkiG9xIEAYS3CQICMB4GDSqGSIb3EgQBhLcJAgQGDSqGSIb3 +EgQBhLcJAgQwHgYNKoZIhvcSBAGEtwkCBAYNKoZIhvcSBAGEtwkCBTAeBg0qhkiG +9xIEAYS3CQIFBg0qhkiG9xIEAYS3CQIEMB4GDSqGSIb3EgQBhLcJAgUGDSqGSIb3 +EgQBhLcJAgUwCgYIKoZIzj0EAwIDSAAwRQIhAK0bRaGgd5qQlX+zTw3IUynFHxfk +zRbZagnTzjYtkNNmAiBJ2kOnvRdW930eHAwZPGpc1Hn5hMSOQdUhNZ3XZDASkQ== +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_intermediate_require.pem b/go/src/crypto/x509/testdata/policy_intermediate_require.pem new file mode 100644 index 0000000000000000000000000000000000000000..5cf5d5bfe623315ca6664530c346ea6c93065109 --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_intermediate_require.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBuDCCAV+gAwIBAgIBAjAKBggqhkjOPQQDAjAWMRQwEgYDVQQDEwtQb2xpY3kg +Um9vdDAgFw0wMDAxMDEwMDAwMDBaGA8yMTAwMDEwMTAwMDAwMFowHjEcMBoGA1UE +AxMTUG9saWN5IEludGVybWVkaWF0ZTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA +BOI6fKiM3jFLkLyAn88cvlw4SwxuygRjopP3FFBKHyUQvh3VVvfqSpSCSmp50Qia +jQ6Dg7CTpVZVVH+bguT7JTCjgZMwgZAwDgYDVR0PAQH/BAQDAgIEMBMGA1UdJQQM +MAoGCCsGAQUFBwMBMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJDS9/4O7qhr +CIRhwsXrPVBagG2uMCsGA1UdIAQkMCIwDwYNKoZIhvcSBAGEtwkCATAPBg0qhkiG +9xIEAYS3CQICMAwGA1UdJAQFMAOAAQAwCgYIKoZIzj0EAwIDRwAwRAIgbPUZ9ezH +SgTqom7VLPOvrQQXwy3b/ijSobs7+SOouKMCIDaqcb9143BG005etqeTvlgUyOGF +GQDWhiW8bizH+KEl +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_intermediate_require1.pem b/go/src/crypto/x509/testdata/policy_intermediate_require1.pem new file mode 100644 index 0000000000000000000000000000000000000000..7087404b3f1165e647fe7e7e1381b85145b7c672 --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_intermediate_require1.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBujCCAV+gAwIBAgIBAjAKBggqhkjOPQQDAjAWMRQwEgYDVQQDEwtQb2xpY3kg +Um9vdDAgFw0wMDAxMDEwMDAwMDBaGA8yMTAwMDEwMTAwMDAwMFowHjEcMBoGA1UE +AxMTUG9saWN5IEludGVybWVkaWF0ZTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA +BOI6fKiM3jFLkLyAn88cvlw4SwxuygRjopP3FFBKHyUQvh3VVvfqSpSCSmp50Qia +jQ6Dg7CTpVZVVH+bguT7JTCjgZMwgZAwDgYDVR0PAQH/BAQDAgIEMBMGA1UdJQQM +MAoGCCsGAQUFBwMBMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJDS9/4O7qhr +CIRhwsXrPVBagG2uMCsGA1UdIAQkMCIwDwYNKoZIhvcSBAGEtwkCATAPBg0qhkiG +9xIEAYS3CQICMAwGA1UdJAQFMAOAAQEwCgYIKoZIzj0EAwIDSQAwRgIhAIAwvhHB +GQDN5YXlidd+n3OT/SqoeXfp7RiEonBnCkW4AiEA+iFc47EOBchHb+Gy0gg8F9Po +RnlpoulWDfbDwx9r4lc= +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_intermediate_require2.pem b/go/src/crypto/x509/testdata/policy_intermediate_require2.pem new file mode 100644 index 0000000000000000000000000000000000000000..350f41919879a3221f2ff8a23b62106a5fd0699d --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_intermediate_require2.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBuTCCAV+gAwIBAgIBAjAKBggqhkjOPQQDAjAWMRQwEgYDVQQDEwtQb2xpY3kg +Um9vdDAgFw0wMDAxMDEwMDAwMDBaGA8yMTAwMDEwMTAwMDAwMFowHjEcMBoGA1UE +AxMTUG9saWN5IEludGVybWVkaWF0ZTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA +BOI6fKiM3jFLkLyAn88cvlw4SwxuygRjopP3FFBKHyUQvh3VVvfqSpSCSmp50Qia +jQ6Dg7CTpVZVVH+bguT7JTCjgZMwgZAwDgYDVR0PAQH/BAQDAgIEMBMGA1UdJQQM +MAoGCCsGAQUFBwMBMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJDS9/4O7qhr +CIRhwsXrPVBagG2uMCsGA1UdIAQkMCIwDwYNKoZIhvcSBAGEtwkCATAPBg0qhkiG +9xIEAYS3CQICMAwGA1UdJAQFMAOAAQIwCgYIKoZIzj0EAwIDSAAwRQIgOpliSKKA ++wy/auQnKKl+wwtn/hGw6eZXgIOtFgDmyMYCIQC84zoJL87AE64gsrdX4XSHq6lb +WhZQp9ZnDaNu88SQLQ== +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_intermediate_require_duplicate.pem b/go/src/crypto/x509/testdata/policy_intermediate_require_duplicate.pem new file mode 100644 index 0000000000000000000000000000000000000000..733087af91c17c5ec8bc4ce208942a21759dba5a --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_intermediate_require_duplicate.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIByjCCAXCgAwIBAgIBAjAKBggqhkjOPQQDAjAWMRQwEgYDVQQDEwtQb2xpY3kg +Um9vdDAgFw0wMDAxMDEwMDAwMDBaGA8yMTAwMDEwMTAwMDAwMFowHjEcMBoGA1UE +AxMTUG9saWN5IEludGVybWVkaWF0ZTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA +BOI6fKiM3jFLkLyAn88cvlw4SwxuygRjopP3FFBKHyUQvh3VVvfqSpSCSmp50Qia +jQ6Dg7CTpVZVVH+bguT7JTCjgaQwgaEwDgYDVR0PAQH/BAQDAgIEMBMGA1UdJQQM +MAoGCCsGAQUFBwMBMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJDS9/4O7qhr +CIRhwsXrPVBagG2uMDwGA1UdIAQ1MDMwDwYNKoZIhvcSBAGEtwkCATAPBg0qhkiG +9xIEAYS3CQICMA8GDSqGSIb3EgQBhLcJAgIwDAYDVR0kBAUwA4ABADAKBggqhkjO +PQQDAgNIADBFAiA2GxzMRYYo7NNq8u/ZvffXkCj/phqXQ8I64tEDd0X8pgIhAOJJ +e+dzzf4vbWfMlYkOQ4kf6ei5Zf+J2PL6VrqVrHQa +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_intermediate_require_no_policies.pem b/go/src/crypto/x509/testdata/policy_intermediate_require_no_policies.pem new file mode 100644 index 0000000000000000000000000000000000000000..1e81e0c1165d8f9b84a554e8b240cf8fe49f639a --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_intermediate_require_no_policies.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBizCCATCgAwIBAgIBAjAKBggqhkjOPQQDAjAWMRQwEgYDVQQDEwtQb2xpY3kg +Um9vdDAgFw0wMDAxMDEwMDAwMDBaGA8yMTAwMDEwMTAwMDAwMFowHjEcMBoGA1UE +AxMTUG9saWN5IEludGVybWVkaWF0ZTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA +BOI6fKiM3jFLkLyAn88cvlw4SwxuygRjopP3FFBKHyUQvh3VVvfqSpSCSmp50Qia +jQ6Dg7CTpVZVVH+bguT7JTCjZTBjMA4GA1UdDwEB/wQEAwICBDATBgNVHSUEDDAK +BggrBgEFBQcDATAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSQ0vf+Du6oawiE +YcLF6z1QWoBtrjAMBgNVHSQEBTADgAEAMAoGCCqGSM49BAMCA0kAMEYCIQDJYPgf +50fFDVho5TFeqkNVONx0ArVNgULPB27yPDHLrwIhAN+eua6oM4Q/O0jUESQ4VAKt +ts7ZCquTZbvgRgyqtjuT +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_leaf.pem b/go/src/crypto/x509/testdata/policy_leaf.pem new file mode 100644 index 0000000000000000000000000000000000000000..fb70306c8a610fd3b231eb5ed6445d37366e62c5 --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_leaf.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBpzCCAU2gAwIBAgIBAzAKBggqhkjOPQQDAjAeMRwwGgYDVQQDExNQb2xpY3kg +SW50ZXJtZWRpYXRlMCAXDTAwMDEwMTAwMDAwMFoYDzIxMDAwMTAxMDAwMDAwWjAa +MRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMB +BwNCAASRKti8VW2Rkma+Kt9jQkMNitlCs0l5w8u3SSwm7HZREvmcBCJBjVIREacR +qI0umhzR2V5NLzBBP9yPD/A+Ch5Xo34wfDAOBgNVHQ8BAf8EBAMCAgQwEwYDVR0l +BAwwCgYIKwYBBQUHAwEwDAYDVR0TAQH/BAIwADAaBgNVHREEEzARgg93d3cuZXhh +bXBsZS5jb20wKwYDVR0gBCQwIjAPBg0qhkiG9xIEAYS3CQIBMA8GDSqGSIb3EgQB +hLcJAgIwCgYIKoZIzj0EAwIDSAAwRQIgBEOriD1N3/cqoAofxEtf73M7Wi4UfjFK +jiU9nQhwnnoCIQD1v/XDp2BkWNHxNq7TaPnil3xXTvMX97yUbkUg8IRo0w== +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_leaf_any.pem b/go/src/crypto/x509/testdata/policy_leaf_any.pem new file mode 100644 index 0000000000000000000000000000000000000000..d2c1b9e9555d16f873b63390697024d8e1a8d382 --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_leaf_any.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBjTCCATOgAwIBAgIBAzAKBggqhkjOPQQDAjAeMRwwGgYDVQQDExNQb2xpY3kg +SW50ZXJtZWRpYXRlMCAXDTAwMDEwMTAwMDAwMFoYDzIxMDAwMTAxMDAwMDAwWjAa +MRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMB +BwNCAASRKti8VW2Rkma+Kt9jQkMNitlCs0l5w8u3SSwm7HZREvmcBCJBjVIREacR +qI0umhzR2V5NLzBBP9yPD/A+Ch5Xo2QwYjAOBgNVHQ8BAf8EBAMCAgQwEwYDVR0l +BAwwCgYIKwYBBQUHAwEwDAYDVR0TAQH/BAIwADAaBgNVHREEEzARgg93d3cuZXhh +bXBsZS5jb20wEQYDVR0gBAowCDAGBgRVHSAAMAoGCCqGSM49BAMCA0gAMEUCIQC4 +UwAf1R4HefSzyO8lyQ3fmMjkptVEhFBee0a7N12IvwIgJMYZgQ52VTbqXyXqraJ8 +V+y+o7eHds7NewqnyuLbc78= +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_leaf_duplicate.pem b/go/src/crypto/x509/testdata/policy_leaf_duplicate.pem new file mode 100644 index 0000000000000000000000000000000000000000..bdeb13cbd68ec00a20eaeab8bc9413b729a2b69b --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_leaf_duplicate.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBsTCCAVigAwIBAgIBAzAKBggqhkjOPQQDAjAWMRQwEgYDVQQDEwtQb2xpY3kg +Um9vdDAgFw0wMDAxMDEwMDAwMDBaGA8yMTAwMDEwMTAwMDAwMFowGjEYMBYGA1UE +AxMPd3d3LmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEkSrY +vFVtkZJmvirfY0JDDYrZQrNJecPLt0ksJux2URL5nAQiQY1SERGnEaiNLpoc0dle +TS8wQT/cjw/wPgoeV6OBkDCBjTAOBgNVHQ8BAf8EBAMCAgQwEwYDVR0lBAwwCgYI +KwYBBQUHAwEwDAYDVR0TAQH/BAIwADAaBgNVHREEEzARgg93d3cuZXhhbXBsZS5j +b20wPAYDVR0gBDUwMzAPBg0qhkiG9xIEAYS3CQIBMA8GDSqGSIb3EgQBhLcJAgIw +DwYNKoZIhvcSBAGEtwkCAjAKBggqhkjOPQQDAgNHADBEAiBjYDwsWcs35hU/wPqa +5gf0QUMvV/8z5LPX14fB2y4RGQIgMw0ekrt9K5UcgkvFupV/XXIjLRFQvc8URA3C +/+w+2/4= +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_leaf_invalid.pem b/go/src/crypto/x509/testdata/policy_leaf_invalid.pem new file mode 100644 index 0000000000000000000000000000000000000000..de7a5e9b20f7be9eac016b2c8d3f24512520f127 --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_leaf_invalid.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBgjCCASigAwIBAgIBAzAKBggqhkjOPQQDAjAWMRQwEgYDVQQDEwtQb2xpY3kg +Um9vdDAgFw0wMDAxMDEwMDAwMDBaGA8yMTAwMDEwMTAwMDAwMFowGjEYMBYGA1UE +AxMPd3d3LmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEkSrY +vFVtkZJmvirfY0JDDYrZQrNJecPLt0ksJux2URL5nAQiQY1SERGnEaiNLpoc0dle +TS8wQT/cjw/wPgoeV6NhMF8wDgYDVR0PAQH/BAQDAgIEMBMGA1UdJQQMMAoGCCsG +AQUFBwMBMAwGA1UdEwEB/wQCMAAwGgYDVR0RBBMwEYIPd3d3LmV4YW1wbGUuY29t +MA4GA1UdIAQHSU5WQUxJRDAKBggqhkjOPQQDAgNIADBFAiAgfcDIeqmV+u5YtUe4 +aBnj13tZAJAQh6ttum1xZ+xHEgIhAJqvGX5c0/d1qYelBlm/jE3UuivijdEjVsLX +GVH+X1VA +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_leaf_none.pem b/go/src/crypto/x509/testdata/policy_leaf_none.pem new file mode 100644 index 0000000000000000000000000000000000000000..13ad7cec0175d97952b7a3f6342a755b23d387d5 --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_leaf_none.pem @@ -0,0 +1,10 @@ +-----BEGIN CERTIFICATE----- +MIIBezCCASCgAwIBAgIBAzAKBggqhkjOPQQDAjAeMRwwGgYDVQQDExNQb2xpY3kg +SW50ZXJtZWRpYXRlMCAXDTAwMDEwMTAwMDAwMFoYDzIxMDAwMTAxMDAwMDAwWjAa +MRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMB +BwNCAASRKti8VW2Rkma+Kt9jQkMNitlCs0l5w8u3SSwm7HZREvmcBCJBjVIREacR +qI0umhzR2V5NLzBBP9yPD/A+Ch5Xo1EwTzAOBgNVHQ8BAf8EBAMCAgQwEwYDVR0l +BAwwCgYIKwYBBQUHAwEwDAYDVR0TAQH/BAIwADAaBgNVHREEEzARgg93d3cuZXhh +bXBsZS5jb20wCgYIKoZIzj0EAwIDSQAwRgIhAIDFeeYJ8nmYo09OnJFpNS3A6fYO +ZliHkAqOsg193DTnAiEA3OSHLCczcvRjMG+qd/FI61u2sKU1hhHh7uHtD/YO/dA= +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_leaf_oid1.pem b/go/src/crypto/x509/testdata/policy_leaf_oid1.pem new file mode 100644 index 0000000000000000000000000000000000000000..94cd1a77b45ff8d535ed8a1b74d2bfc4817e699e --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_leaf_oid1.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBlTCCATygAwIBAgIBAzAKBggqhkjOPQQDAjAeMRwwGgYDVQQDExNQb2xpY3kg +SW50ZXJtZWRpYXRlMCAXDTAwMDEwMTAwMDAwMFoYDzIxMDAwMTAxMDAwMDAwWjAa +MRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMB +BwNCAASRKti8VW2Rkma+Kt9jQkMNitlCs0l5w8u3SSwm7HZREvmcBCJBjVIREacR +qI0umhzR2V5NLzBBP9yPD/A+Ch5Xo20wazAOBgNVHQ8BAf8EBAMCAgQwEwYDVR0l +BAwwCgYIKwYBBQUHAwEwDAYDVR0TAQH/BAIwADAaBgNVHREEEzARgg93d3cuZXhh +bXBsZS5jb20wGgYDVR0gBBMwETAPBg0qhkiG9xIEAYS3CQIBMAoGCCqGSM49BAMC +A0cAMEQCIHh4Bo8l/HVJhLMWcYusPOE0arqoDrJ5E0M6nEi3nRhgAiAArK8bBohG +fZ3DmVMq/2BJtQZwRRj+50VKWuf9mBSflQ== +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_leaf_oid2.pem b/go/src/crypto/x509/testdata/policy_leaf_oid2.pem new file mode 100644 index 0000000000000000000000000000000000000000..10adf86c5213fa00f35a05f38fb65ae26464aad6 --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_leaf_oid2.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBlzCCATygAwIBAgIBAzAKBggqhkjOPQQDAjAeMRwwGgYDVQQDExNQb2xpY3kg +SW50ZXJtZWRpYXRlMCAXDTAwMDEwMTAwMDAwMFoYDzIxMDAwMTAxMDAwMDAwWjAa +MRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMB +BwNCAASRKti8VW2Rkma+Kt9jQkMNitlCs0l5w8u3SSwm7HZREvmcBCJBjVIREacR +qI0umhzR2V5NLzBBP9yPD/A+Ch5Xo20wazAOBgNVHQ8BAf8EBAMCAgQwEwYDVR0l +BAwwCgYIKwYBBQUHAwEwDAYDVR0TAQH/BAIwADAaBgNVHREEEzARgg93d3cuZXhh +bXBsZS5jb20wGgYDVR0gBBMwETAPBg0qhkiG9xIEAYS3CQICMAoGCCqGSM49BAMC +A0kAMEYCIQDvW7rdL6MSW/0BPNET4hEeECO6LWmZZHKCHIu6o33dsAIhAPwgm6lD +KV2hMOxkE6rBDQzlCr+zAkQrxSzQZqJp5p+W +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_leaf_oid3.pem b/go/src/crypto/x509/testdata/policy_leaf_oid3.pem new file mode 100644 index 0000000000000000000000000000000000000000..e5c103151bd83620a6d8a7a32742ad4cb1c07501 --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_leaf_oid3.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBlzCCATygAwIBAgIBAzAKBggqhkjOPQQDAjAeMRwwGgYDVQQDExNQb2xpY3kg +SW50ZXJtZWRpYXRlMCAXDTAwMDEwMTAwMDAwMFoYDzIxMDAwMTAxMDAwMDAwWjAa +MRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMB +BwNCAASRKti8VW2Rkma+Kt9jQkMNitlCs0l5w8u3SSwm7HZREvmcBCJBjVIREacR +qI0umhzR2V5NLzBBP9yPD/A+Ch5Xo20wazAOBgNVHQ8BAf8EBAMCAgQwEwYDVR0l +BAwwCgYIKwYBBQUHAwEwDAYDVR0TAQH/BAIwADAaBgNVHREEEzARgg93d3cuZXhh +bXBsZS5jb20wGgYDVR0gBBMwETAPBg0qhkiG9xIEAYS3CQIDMAoGCCqGSM49BAMC +A0kAMEYCIQDBPnPpRsOH20ncg8TKUdlONfbO62WafQj9SKgyi/nGBQIhAMhT8J7f +fTEou6jlAilaIQwlAgZzVKRqgghIHezFY86T +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_leaf_oid4.pem b/go/src/crypto/x509/testdata/policy_leaf_oid4.pem new file mode 100644 index 0000000000000000000000000000000000000000..7dd7a547af20d14b1a0c3db01585a387f871e48b --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_leaf_oid4.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBlzCCATygAwIBAgIBAzAKBggqhkjOPQQDAjAeMRwwGgYDVQQDExNQb2xpY3kg +SW50ZXJtZWRpYXRlMCAXDTAwMDEwMTAwMDAwMFoYDzIxMDAwMTAxMDAwMDAwWjAa +MRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMB +BwNCAASRKti8VW2Rkma+Kt9jQkMNitlCs0l5w8u3SSwm7HZREvmcBCJBjVIREacR +qI0umhzR2V5NLzBBP9yPD/A+Ch5Xo20wazAOBgNVHQ8BAf8EBAMCAgQwEwYDVR0l +BAwwCgYIKwYBBQUHAwEwDAYDVR0TAQH/BAIwADAaBgNVHREEEzARgg93d3cuZXhh +bXBsZS5jb20wGgYDVR0gBBMwETAPBg0qhkiG9xIEAYS3CQIEMAoGCCqGSM49BAMC +A0kAMEYCIQD2gnpCTMxUalCtEV52eXzqeJgsKMYvEpJTuU/VqH5KwQIhAPEavAkt +cSJsgMgJcJnbBzAdSrbOgHXF2etDHmFbg0hz +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_leaf_oid5.pem b/go/src/crypto/x509/testdata/policy_leaf_oid5.pem new file mode 100644 index 0000000000000000000000000000000000000000..2a9aee73b59ff55b64d80b9f875f206dd885c7b4 --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_leaf_oid5.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBlzCCATygAwIBAgIBAzAKBggqhkjOPQQDAjAeMRwwGgYDVQQDExNQb2xpY3kg +SW50ZXJtZWRpYXRlMCAXDTAwMDEwMTAwMDAwMFoYDzIxMDAwMTAxMDAwMDAwWjAa +MRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMB +BwNCAASRKti8VW2Rkma+Kt9jQkMNitlCs0l5w8u3SSwm7HZREvmcBCJBjVIREacR +qI0umhzR2V5NLzBBP9yPD/A+Ch5Xo20wazAOBgNVHQ8BAf8EBAMCAgQwEwYDVR0l +BAwwCgYIKwYBBQUHAwEwDAYDVR0TAQH/BAIwADAaBgNVHREEEzARgg93d3cuZXhh +bXBsZS5jb20wGgYDVR0gBBMwETAPBg0qhkiG9xIEAYS3CQIFMAoGCCqGSM49BAMC +A0kAMEYCIQDDFVjhlQ1Wu0KITcRX8kELpVDeYSKSlvEbZc3rn1QjkQIhAMPthqBi +I0acz8DPQcdFmHXV0xR2xyC1yuen0gES5WLR +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_leaf_require.pem b/go/src/crypto/x509/testdata/policy_leaf_require.pem new file mode 100644 index 0000000000000000000000000000000000000000..169b8444199ee803fc11a384e2b2a4ee4f6f25b5 --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_leaf_require.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBuDCCAV2gAwIBAgIBAzAKBggqhkjOPQQDAjAeMRwwGgYDVQQDExNQb2xpY3kg +SW50ZXJtZWRpYXRlMCAXDTAwMDEwMTAwMDAwMFoYDzIxMDAwMTAxMDAwMDAwWjAa +MRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMB +BwNCAASRKti8VW2Rkma+Kt9jQkMNitlCs0l5w8u3SSwm7HZREvmcBCJBjVIREacR +qI0umhzR2V5NLzBBP9yPD/A+Ch5Xo4GNMIGKMA4GA1UdDwEB/wQEAwICBDATBgNV +HSUEDDAKBggrBgEFBQcDATAMBgNVHRMBAf8EAjAAMBoGA1UdEQQTMBGCD3d3dy5l +eGFtcGxlLmNvbTArBgNVHSAEJDAiMA8GDSqGSIb3EgQBhLcJAgEwDwYNKoZIhvcS +BAGEtwkCAjAMBgNVHSQEBTADgAEAMAoGCCqGSM49BAMCA0kAMEYCIQDrNQPi/mdK +l7Nd/YmMXWYTHJBWWin1zA64Ohkd7z4jGgIhAJpw/umk5MxS1MwSi+YTkkcSQKpl +YROQH6+T53DauoW6 +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_leaf_require1.pem b/go/src/crypto/x509/testdata/policy_leaf_require1.pem new file mode 100644 index 0000000000000000000000000000000000000000..261ef954f12ae7470a0fd6012e6db538171ebb56 --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_leaf_require1.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBuDCCAV2gAwIBAgIBAzAKBggqhkjOPQQDAjAeMRwwGgYDVQQDExNQb2xpY3kg +SW50ZXJtZWRpYXRlMCAXDTAwMDEwMTAwMDAwMFoYDzIxMDAwMTAxMDAwMDAwWjAa +MRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMB +BwNCAASRKti8VW2Rkma+Kt9jQkMNitlCs0l5w8u3SSwm7HZREvmcBCJBjVIREacR +qI0umhzR2V5NLzBBP9yPD/A+Ch5Xo4GNMIGKMA4GA1UdDwEB/wQEAwICBDATBgNV +HSUEDDAKBggrBgEFBQcDATAMBgNVHRMBAf8EAjAAMBoGA1UdEQQTMBGCD3d3dy5l +eGFtcGxlLmNvbTArBgNVHSAEJDAiMA8GDSqGSIb3EgQBhLcJAgEwDwYNKoZIhvcS +BAGEtwkCAjAMBgNVHSQEBTADgAEBMAoGCCqGSM49BAMCA0kAMEYCIQCtXENGJrKv +IOeLHO/3Nu/SMRXc69Vb3q+4b/uHBFbuqwIhAK22Wfh/ZIHKu3FwbjL+sN0Z39pf +Dsak6fp1y4tqNuvK +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_root.pem b/go/src/crypto/x509/testdata/policy_root.pem new file mode 100644 index 0000000000000000000000000000000000000000..595f8a132a50cfe3a48dd96f743b433472a882cf --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_root.pem @@ -0,0 +1,10 @@ +-----BEGIN CERTIFICATE----- +MIIBdTCCARqgAwIBAgIBATAKBggqhkjOPQQDAjAWMRQwEgYDVQQDEwtQb2xpY3kg +Um9vdDAgFw0wMDAxMDEwMDAwMDBaGA8yMTAwMDEwMTAwMDAwMFowFjEUMBIGA1UE +AxMLUG9saWN5IFJvb3QwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQmdqXYl1Gv +Y7y3jcTTK6MVXIQr44TqChRYI6IeV9tIB6jIsOY+Qol1bk8x/7A5FGOnUWFVLEAP +EPSJwPndjolto1cwVTAOBgNVHQ8BAf8EBAMCAgQwEwYDVR0lBAwwCgYIKwYBBQUH +AwEwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU0GnnoB+yeN63WMthnh6Uh1HH +dRIwCgYIKoZIzj0EAwIDSQAwRgIhAKVxVAaJnmvt+q4SqegGS23QSzKPM9Yakw9e +bOUU9+52AiEAjXPRBdd90YDey4VFu4f/78yVe0cxMK30lll7lLl7TTA= +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_root2.pem b/go/src/crypto/x509/testdata/policy_root2.pem new file mode 100644 index 0000000000000000000000000000000000000000..1350035fd4628217759ff82f66a0c5e534d34326 --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_root2.pem @@ -0,0 +1,10 @@ +-----BEGIN CERTIFICATE----- +MIIBeDCCAR6gAwIBAgIBATAKBggqhkjOPQQDAjAYMRYwFAYDVQQDEw1Qb2xpY3kg +Um9vdCAyMCAXDTAwMDEwMTAwMDAwMFoYDzIxMDAwMTAxMDAwMDAwWjAYMRYwFAYD +VQQDEw1Qb2xpY3kgUm9vdCAyMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEJnal +2JdRr2O8t43E0yujFVyEK+OE6goUWCOiHlfbSAeoyLDmPkKJdW5PMf+wORRjp1Fh +VSxADxD0icD53Y6JbaNXMFUwDgYDVR0PAQH/BAQDAgIEMBMGA1UdJQQMMAoGCCsG +AQUFBwMBMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNBp56Afsnjet1jLYZ4e +lIdRx3USMAoGCCqGSM49BAMCA0gAMEUCIQDm9rw9ODVtJUPBn2lWoK8s7ElbyY4/ +Gc2thHR50UUzbgIgKRenEDhKiBR6cGC77RaIiaaafW8b7HMd7obuZdDU/58= +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/policy_root_cross_inhibit_mapping.pem b/go/src/crypto/x509/testdata/policy_root_cross_inhibit_mapping.pem new file mode 100644 index 0000000000000000000000000000000000000000..9273a53086f015cdbc8da98879cd588566aff41c --- /dev/null +++ b/go/src/crypto/x509/testdata/policy_root_cross_inhibit_mapping.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBljCCAT2gAwIBAgIBATAKBggqhkjOPQQDAjAYMRYwFAYDVQQDEw1Qb2xpY3kg +Um9vdCAyMCAXDTAwMDEwMTAwMDAwMFoYDzIxMDAwMTAxMDAwMDAwWjAWMRQwEgYD +VQQDEwtQb2xpY3kgUm9vdDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCZ2pdiX +Ua9jvLeNxNMroxVchCvjhOoKFFgjoh5X20gHqMiw5j5CiXVuTzH/sDkUY6dRYVUs +QA8Q9InA+d2OiW2jeDB2MA4GA1UdDwEB/wQEAwICBDATBgNVHSUEDDAKBggrBgEF +BQcDATAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTQaeegH7J43rdYy2GeHpSH +Ucd1EjARBgNVHSAECjAIMAYGBFUdIAAwDAYDVR0kBAUwA4EBADAKBggqhkjOPQQD +AgNHADBEAiBzR3JGEf9PITYuiXTx+vx9gXji5idGsVog9wRUbY98wwIgVVeYNQQb +x+RN2wYp3kmm8iswUOrqiI6J4PSzT8CYP8Q= +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/testdata/test-dir.crt b/go/src/crypto/x509/testdata/test-dir.crt new file mode 100644 index 0000000000000000000000000000000000000000..b7fc9c51861961feb4dbcc7e8f35309fd4a2e155 --- /dev/null +++ b/go/src/crypto/x509/testdata/test-dir.crt @@ -0,0 +1,31 @@ +-----BEGIN CERTIFICATE----- +MIIFazCCA1OgAwIBAgIJAL8a/lsnspOqMA0GCSqGSIb3DQEBCwUAMEwxCzAJBgNV +BAYTAlVLMRMwEQYDVQQIDApUZXN0LVN0YXRlMRUwEwYDVQQKDAxHb2xhbmcgVGVz +dHMxETAPBgNVBAMMCHRlc3QtZGlyMB4XDTE3MDIwMTIzNTAyN1oXDTI3MDEzMDIz +NTAyN1owTDELMAkGA1UEBhMCVUsxEzARBgNVBAgMClRlc3QtU3RhdGUxFTATBgNV +BAoMDEdvbGFuZyBUZXN0czERMA8GA1UEAwwIdGVzdC1kaXIwggIiMA0GCSqGSIb3 +DQEBAQUAA4ICDwAwggIKAoICAQDzBoi43Yn30KN13PKFHu8LA4UmgCRToTukLItM +WK2Je45grs/axg9n3YJOXC6hmsyrkOnyBcx1xVN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c/qijM8set/nOqp7hVd5J0uG6qdwLRILUddZ6OpXd7ZNi1EXg+Bpc7ehzGsDt +3UFGzYXDjxYnK2frQfjLS8stOQIqSrGthW6x0fdkVx0y8BByvd5J6+JmZl4UZfzA +m99VxXSt4B9x6BvnY7ktzcFDOjtuLc4B/7yg9fv1eQuStA4cHGGAttsCg1X/Kx8W +PvkkeH0UWDZ9vhH9K36703z89da6MWF+bz92B0+4HoOmlVaXRkvblsNaynJnL0LC +Ayry7QBxuh5cMnDdRwJB3AVJIiJ1GVpb7aGvBOnx+s2lwRv9HWtghb+cbwwktx1M +JHyBf3GZNSWTpKY7cD8V+NnBv3UuioOVVo+XAU4LF/bYUjdRpxWADJizNtZrtFo= +-----END CERTIFICATE----- diff --git a/go/src/crypto/x509/verify.go b/go/src/crypto/x509/verify.go new file mode 100644 index 0000000000000000000000000000000000000000..8151a731253c67dd8a48c723f7bc4b23761f1de1 --- /dev/null +++ b/go/src/crypto/x509/verify.go @@ -0,0 +1,1396 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "bytes" + "crypto" + "crypto/x509/pkix" + "errors" + "fmt" + "iter" + "maps" + "net" + "runtime" + "slices" + "strings" + "time" + "unicode/utf8" +) + +type InvalidReason int + +const ( + // NotAuthorizedToSign results when a certificate is signed by another + // which isn't marked as a CA certificate. + NotAuthorizedToSign InvalidReason = iota + // Expired results when a certificate has expired, based on the time + // given in the VerifyOptions. + Expired + // CANotAuthorizedForThisName results when an intermediate or root + // certificate has a name constraint which doesn't permit a DNS or + // other name (including IP address) in the leaf certificate. + CANotAuthorizedForThisName + // TooManyIntermediates results when a path length constraint is + // violated. + TooManyIntermediates + // IncompatibleUsage results when the certificate's key usage indicates + // that it may only be used for a different purpose. + IncompatibleUsage + // NameMismatch results when the subject name of a parent certificate + // does not match the issuer name in the child. + NameMismatch + // NameConstraintsWithoutSANs is a legacy error and is no longer returned. + NameConstraintsWithoutSANs + // UnconstrainedName results when a CA certificate contains permitted + // name constraints, but leaf certificate contains a name of an + // unsupported or unconstrained type. + UnconstrainedName + // TooManyConstraints results when the number of comparison operations + // needed to check a certificate exceeds the limit set by + // VerifyOptions.MaxConstraintComparisions. This limit exists to + // prevent pathological certificates can consuming excessive amounts of + // CPU time to verify. + TooManyConstraints + // CANotAuthorizedForExtKeyUsage results when an intermediate or root + // certificate does not permit a requested extended key usage. + CANotAuthorizedForExtKeyUsage + // NoValidChains results when there are no valid chains to return. + NoValidChains +) + +// CertificateInvalidError results when an odd error occurs. Users of this +// library probably want to handle all these errors uniformly. +type CertificateInvalidError struct { + Cert *Certificate + Reason InvalidReason + Detail string +} + +func (e CertificateInvalidError) Error() string { + switch e.Reason { + case NotAuthorizedToSign: + return "x509: certificate is not authorized to sign other certificates" + case Expired: + return "x509: certificate has expired or is not yet valid: " + e.Detail + case CANotAuthorizedForThisName: + return "x509: a root or intermediate certificate is not authorized to sign for this name: " + e.Detail + case CANotAuthorizedForExtKeyUsage: + return "x509: a root or intermediate certificate is not authorized for an extended key usage: " + e.Detail + case TooManyIntermediates: + return "x509: too many intermediates for path length constraint" + case IncompatibleUsage: + return "x509: certificate specifies an incompatible key usage" + case NameMismatch: + return "x509: issuer name does not match subject from issuing certificate" + case NameConstraintsWithoutSANs: + return "x509: issuer has name constraints but leaf doesn't have a SAN extension" + case UnconstrainedName: + return "x509: issuer has name constraints but leaf contains unknown or unconstrained name: " + e.Detail + case NoValidChains: + s := "x509: no valid chains built" + if e.Detail != "" { + s = fmt.Sprintf("%s: %s", s, e.Detail) + } + return s + } + return "x509: unknown error" +} + +// HostnameError results when the set of authorized names doesn't match the +// requested name. +type HostnameError struct { + Certificate *Certificate + Host string +} + +func (h HostnameError) Error() string { + c := h.Certificate + maxNamesIncluded := 100 + + if !c.hasSANExtension() && matchHostnames(c.Subject.CommonName, h.Host) { + return "x509: certificate relies on legacy Common Name field, use SANs instead" + } + + var valid strings.Builder + if ip := net.ParseIP(h.Host); ip != nil { + // Trying to validate an IP + if len(c.IPAddresses) == 0 { + return "x509: cannot validate certificate for " + h.Host + " because it doesn't contain any IP SANs" + } + if len(c.IPAddresses) >= maxNamesIncluded { + return fmt.Sprintf("x509: certificate is valid for %d IP SANs, but none matched %s", len(c.IPAddresses), h.Host) + } + for _, san := range c.IPAddresses { + if valid.Len() > 0 { + valid.WriteString(", ") + } + valid.WriteString(san.String()) + } + } else { + if len(c.DNSNames) >= maxNamesIncluded { + return fmt.Sprintf("x509: certificate is valid for %d names, but none matched %s", len(c.DNSNames), h.Host) + } + valid.WriteString(strings.Join(c.DNSNames, ", ")) + } + + if valid.Len() == 0 { + return "x509: certificate is not valid for any names, but wanted to match " + h.Host + } + return "x509: certificate is valid for " + valid.String() + ", not " + h.Host +} + +// UnknownAuthorityError results when the certificate issuer is unknown +type UnknownAuthorityError struct { + Cert *Certificate + // hintErr contains an error that may be helpful in determining why an + // authority wasn't found. + hintErr error + // hintCert contains a possible authority certificate that was rejected + // because of the error in hintErr. + hintCert *Certificate +} + +func (e UnknownAuthorityError) Error() string { + s := "x509: certificate signed by unknown authority" + if e.hintErr != nil { + certName := e.hintCert.Subject.CommonName + if len(certName) == 0 { + if len(e.hintCert.Subject.Organization) > 0 { + certName = e.hintCert.Subject.Organization[0] + } else { + certName = "serial:" + e.hintCert.SerialNumber.String() + } + } + s += fmt.Sprintf(" (possibly because of %q while trying to verify candidate authority certificate %q)", e.hintErr, certName) + } + return s +} + +// SystemRootsError results when we fail to load the system root certificates. +type SystemRootsError struct { + Err error +} + +func (se SystemRootsError) Error() string { + msg := "x509: failed to load system roots and no roots provided" + if se.Err != nil { + return msg + "; " + se.Err.Error() + } + return msg +} + +func (se SystemRootsError) Unwrap() error { return se.Err } + +// errNotParsed is returned when a certificate without ASN.1 contents is +// verified. Platform-specific verification needs the ASN.1 contents. +var errNotParsed = errors.New("x509: missing ASN.1 contents; use ParseCertificate") + +// VerifyOptions contains parameters for Certificate.Verify. +type VerifyOptions struct { + // DNSName, if set, is checked against the leaf certificate with + // Certificate.VerifyHostname or the platform verifier. + DNSName string + + // Intermediates is an optional pool of certificates that are not trust + // anchors, but can be used to form a chain from the leaf certificate to a + // root certificate. + Intermediates *CertPool + // Roots is the set of trusted root certificates the leaf certificate needs + // to chain up to. If nil, the system roots or the platform verifier are used. + Roots *CertPool + + // CurrentTime is used to check the validity of all certificates in the + // chain. If zero, the current time is used. + CurrentTime time.Time + + // KeyUsages specifies which Extended Key Usage values are acceptable. A + // chain is accepted if it allows any of the listed values. An empty list + // means ExtKeyUsageServerAuth. To accept any key usage, include ExtKeyUsageAny. + KeyUsages []ExtKeyUsage + + // MaxConstraintComparisions is the maximum number of comparisons to + // perform when checking a given certificate's name constraints. If + // zero, a sensible default is used. This limit prevents pathological + // certificates from consuming excessive amounts of CPU time when + // validating. It does not apply to the platform verifier. + MaxConstraintComparisions int + + // CertificatePolicies specifies which certificate policy OIDs are + // acceptable during policy validation. An empty CertificatePolices + // field implies any valid policy is acceptable. + CertificatePolicies []OID + + // The following policy fields are unexported, because we do not expect + // users to actually need to use them, but are useful for testing the + // policy validation code. + + // inhibitPolicyMapping indicates if policy mapping should be allowed + // during path validation. + inhibitPolicyMapping bool + + // requireExplicitPolicy indidicates if explicit policies must be present + // for each certificate being validated. + requireExplicitPolicy bool + + // inhibitAnyPolicy indicates if the anyPolicy policy should be + // processed if present in a certificate being validated. + inhibitAnyPolicy bool +} + +const ( + leafCertificate = iota + intermediateCertificate + rootCertificate +) + +// rfc2821Mailbox represents a “mailbox” (which is an email address to most +// people) by breaking it into the “local” (i.e. before the '@') and “domain” +// parts. +type rfc2821Mailbox struct { + local, domain string +} + +func (s rfc2821Mailbox) String() string { + return fmt.Sprintf("%s@%s", s.local, s.domain) +} + +// parseRFC2821Mailbox parses an email address into local and domain parts, +// based on the ABNF for a “Mailbox” from RFC 2821. According to RFC 5280, +// Section 4.2.1.6 that's correct for an rfc822Name from a certificate: “The +// format of an rfc822Name is a "Mailbox" as defined in RFC 2821, Section 4.1.2”. +func parseRFC2821Mailbox(in string) (mailbox rfc2821Mailbox, ok bool) { + if len(in) == 0 { + return mailbox, false + } + + localPartBytes := make([]byte, 0, len(in)/2) + + if in[0] == '"' { + // Quoted-string = DQUOTE *qcontent DQUOTE + // non-whitespace-control = %d1-8 / %d11 / %d12 / %d14-31 / %d127 + // qcontent = qtext / quoted-pair + // qtext = non-whitespace-control / + // %d33 / %d35-91 / %d93-126 + // quoted-pair = ("\" text) / obs-qp + // text = %d1-9 / %d11 / %d12 / %d14-127 / obs-text + // + // (Names beginning with “obs-” are the obsolete syntax from RFC 2822, + // Section 4. Since it has been 16 years, we no longer accept that.) + in = in[1:] + QuotedString: + for { + if len(in) == 0 { + return mailbox, false + } + c := in[0] + in = in[1:] + + switch { + case c == '"': + break QuotedString + + case c == '\\': + // quoted-pair + if len(in) == 0 { + return mailbox, false + } + if in[0] == 11 || + in[0] == 12 || + (1 <= in[0] && in[0] <= 9) || + (14 <= in[0] && in[0] <= 127) { + localPartBytes = append(localPartBytes, in[0]) + in = in[1:] + } else { + return mailbox, false + } + + case c == 11 || + c == 12 || + // Space (char 32) is not allowed based on the + // BNF, but RFC 3696 gives an example that + // assumes that it is. Several “verified” + // errata continue to argue about this point. + // We choose to accept it. + c == 32 || + c == 33 || + c == 127 || + (1 <= c && c <= 8) || + (14 <= c && c <= 31) || + (35 <= c && c <= 91) || + (93 <= c && c <= 126): + // qtext + localPartBytes = append(localPartBytes, c) + + default: + return mailbox, false + } + } + } else { + // Atom ("." Atom)* + NextChar: + for len(in) > 0 { + // atext from RFC 2822, Section 3.2.4 + c := in[0] + + switch { + case c == '\\': + // Examples given in RFC 3696 suggest that + // escaped characters can appear outside of a + // quoted string. Several “verified” errata + // continue to argue the point. We choose to + // accept it. + in = in[1:] + if len(in) == 0 { + return mailbox, false + } + fallthrough + + case ('0' <= c && c <= '9') || + ('a' <= c && c <= 'z') || + ('A' <= c && c <= 'Z') || + c == '!' || c == '#' || c == '$' || c == '%' || + c == '&' || c == '\'' || c == '*' || c == '+' || + c == '-' || c == '/' || c == '=' || c == '?' || + c == '^' || c == '_' || c == '`' || c == '{' || + c == '|' || c == '}' || c == '~' || c == '.': + localPartBytes = append(localPartBytes, in[0]) + in = in[1:] + + default: + break NextChar + } + } + + if len(localPartBytes) == 0 { + return mailbox, false + } + + // From RFC 3696, Section 3: + // “period (".") may also appear, but may not be used to start + // or end the local part, nor may two or more consecutive + // periods appear.” + twoDots := []byte{'.', '.'} + if localPartBytes[0] == '.' || + localPartBytes[len(localPartBytes)-1] == '.' || + bytes.Contains(localPartBytes, twoDots) { + return mailbox, false + } + } + + if len(in) == 0 || in[0] != '@' { + return mailbox, false + } + in = in[1:] + + // The RFC species a format for domains, but that's known to be + // violated in practice so we accept that anything after an '@' is the + // domain part. + if _, ok := domainToReverseLabels(in); !ok { + return mailbox, false + } + + mailbox.local = string(localPartBytes) + mailbox.domain = in + return mailbox, true +} + +// domainToReverseLabels converts a textual domain name like foo.example.com to +// the list of labels in reverse order, e.g. ["com", "example", "foo"]. +func domainToReverseLabels(domain string) (reverseLabels []string, ok bool) { + reverseLabels = make([]string, 0, strings.Count(domain, ".")+1) + for len(domain) > 0 { + if i := strings.LastIndexByte(domain, '.'); i == -1 { + reverseLabels = append(reverseLabels, domain) + domain = "" + } else { + reverseLabels = append(reverseLabels, domain[i+1:]) + domain = domain[:i] + if i == 0 { // domain == "" + // domain is prefixed with an empty label, append an empty + // string to reverseLabels to indicate this. + reverseLabels = append(reverseLabels, "") + } + } + } + + if len(reverseLabels) > 0 && len(reverseLabels[0]) == 0 { + // An empty label at the end indicates an absolute value. + return nil, false + } + + for _, label := range reverseLabels { + if len(label) == 0 { + // Empty labels are otherwise invalid. + return nil, false + } + + for _, c := range label { + if c < 33 || c > 126 { + // Invalid character. + return nil, false + } + } + } + + return reverseLabels, true +} + +// isValid performs validity checks on c given that it is a candidate to append +// to the chain in currentChain. +func (c *Certificate) isValid(certType int, currentChain []*Certificate, opts *VerifyOptions) error { + if len(c.UnhandledCriticalExtensions) > 0 { + return UnhandledCriticalExtension{} + } + + if len(currentChain) > 0 { + child := currentChain[len(currentChain)-1] + if !bytes.Equal(child.RawIssuer, c.RawSubject) { + return CertificateInvalidError{c, NameMismatch, ""} + } + } + + now := opts.CurrentTime + if now.IsZero() { + now = time.Now() + } + if now.Before(c.NotBefore) { + return CertificateInvalidError{ + Cert: c, + Reason: Expired, + Detail: fmt.Sprintf("current time %s is before %s", now.Format(time.RFC3339), c.NotBefore.Format(time.RFC3339)), + } + } else if now.After(c.NotAfter) { + return CertificateInvalidError{ + Cert: c, + Reason: Expired, + Detail: fmt.Sprintf("current time %s is after %s", now.Format(time.RFC3339), c.NotAfter.Format(time.RFC3339)), + } + } + + if certType == intermediateCertificate || certType == rootCertificate { + if len(currentChain) == 0 { + return errors.New("x509: internal error: empty chain when appending CA cert") + } + } + + // KeyUsage status flags are ignored. From Engineering Security, Peter + // Gutmann: A European government CA marked its signing certificates as + // being valid for encryption only, but no-one noticed. Another + // European CA marked its signature keys as not being valid for + // signatures. A different CA marked its own trusted root certificate + // as being invalid for certificate signing. Another national CA + // distributed a certificate to be used to encrypt data for the + // country’s tax authority that was marked as only being usable for + // digital signatures but not for encryption. Yet another CA reversed + // the order of the bit flags in the keyUsage due to confusion over + // encoding endianness, essentially setting a random keyUsage in + // certificates that it issued. Another CA created a self-invalidating + // certificate by adding a certificate policy statement stipulating + // that the certificate had to be used strictly as specified in the + // keyUsage, and a keyUsage containing a flag indicating that the RSA + // encryption key could only be used for Diffie-Hellman key agreement. + + if certType == intermediateCertificate && (!c.BasicConstraintsValid || !c.IsCA) { + return CertificateInvalidError{c, NotAuthorizedToSign, ""} + } + + if c.BasicConstraintsValid && c.MaxPathLen >= 0 { + numIntermediates := len(currentChain) - 1 + if numIntermediates > c.MaxPathLen { + return CertificateInvalidError{c, TooManyIntermediates, ""} + } + } + + return nil +} + +// Verify attempts to verify c by building one or more chains from c to a +// certificate in opts.Roots, using certificates in opts.Intermediates if +// needed. If successful, it returns one or more chains where the first +// element of the chain is c and the last element is from opts.Roots. +// +// If opts.Roots is nil, the platform verifier might be used, and +// verification details might differ from what is described below. If system +// roots are unavailable the returned error will be of type SystemRootsError. +// +// Name constraints in the intermediates will be applied to all names claimed +// in the chain, not just opts.DNSName. Thus it is invalid for a leaf to claim +// example.com if an intermediate doesn't permit it, even if example.com is not +// the name being validated. Note that DirectoryName constraints are not +// supported. +// +// Name constraint validation follows the rules from RFC 5280, with the +// addition that DNS name constraints may use the leading period format +// defined for emails and URIs. When a constraint has a leading period +// it indicates that at least one additional label must be prepended to +// the constrained name to be considered valid. +// +// Extended Key Usage values are enforced nested down a chain, so an intermediate +// or root that enumerates EKUs prevents a leaf from asserting an EKU not in that +// list. (While this is not specified, it is common practice in order to limit +// the types of certificates a CA can issue.) +// +// Certificates that use SHA1WithRSA and ECDSAWithSHA1 signatures are not supported, +// and will not be used to build chains. +// +// Certificates other than c in the returned chains should not be modified. +// +// WARNING: this function doesn't do any revocation checking. +func (c *Certificate) Verify(opts VerifyOptions) ([][]*Certificate, error) { + // Platform-specific verification needs the ASN.1 contents so + // this makes the behavior consistent across platforms. + if len(c.Raw) == 0 { + return nil, errNotParsed + } + for i := 0; i < opts.Intermediates.len(); i++ { + c, _, err := opts.Intermediates.cert(i) + if err != nil { + return nil, fmt.Errorf("crypto/x509: error fetching intermediate: %w", err) + } + if len(c.Raw) == 0 { + return nil, errNotParsed + } + } + + // Use platform verifiers, where available, if Roots is from SystemCertPool. + if runtime.GOOS == "windows" || runtime.GOOS == "darwin" || runtime.GOOS == "ios" { + // Don't use the system verifier if the system pool was replaced with a non-system pool, + // i.e. if SetFallbackRoots was called with x509usefallbackroots=1. + systemPool := systemRootsPool() + if opts.Roots == nil && (systemPool == nil || systemPool.systemPool) { + return c.systemVerify(&opts) + } + if opts.Roots != nil && opts.Roots.systemPool { + platformChains, err := c.systemVerify(&opts) + // If the platform verifier succeeded, or there are no additional + // roots, return the platform verifier result. Otherwise, continue + // with the Go verifier. + if err == nil || opts.Roots.len() == 0 { + return platformChains, err + } + } + } + + if opts.Roots == nil { + opts.Roots = systemRootsPool() + if opts.Roots == nil { + return nil, SystemRootsError{systemRootsErr} + } + } + + err := c.isValid(leafCertificate, nil, &opts) + if err != nil { + return nil, err + } + + if len(opts.DNSName) > 0 { + err = c.VerifyHostname(opts.DNSName) + if err != nil { + return nil, err + } + } + + var candidateChains [][]*Certificate + if opts.Roots.contains(c) { + candidateChains = [][]*Certificate{{c}} + } else { + candidateChains, err = c.buildChains([]*Certificate{c}, nil, &opts) + if err != nil { + return nil, err + } + } + + anyKeyUsage := false + for _, eku := range opts.KeyUsages { + if eku == ExtKeyUsageAny { + // The presence of anyExtendedKeyUsage overrides any other key usage. + anyKeyUsage = true + break + } + } + + if len(opts.KeyUsages) == 0 { + opts.KeyUsages = []ExtKeyUsage{ExtKeyUsageServerAuth} + } + + var invalidPoliciesChains int + var incompatibleKeyUsageChains int + var constraintsHintErr error + candidateChains = slices.DeleteFunc(candidateChains, func(chain []*Certificate) bool { + if !policiesValid(chain, opts) { + invalidPoliciesChains++ + return true + } + // If any key usage is acceptable, no need to check the chain for + // key usages. + if !anyKeyUsage && !checkChainForKeyUsage(chain, opts.KeyUsages) { + incompatibleKeyUsageChains++ + return true + } + if err := checkChainConstraints(chain); err != nil { + if constraintsHintErr == nil { + constraintsHintErr = CertificateInvalidError{c, CANotAuthorizedForThisName, err.Error()} + } + return true + } + return false + }) + + if len(candidateChains) == 0 { + if constraintsHintErr != nil { + return nil, constraintsHintErr // Preserve previous constraint behavior + } + var details []string + if incompatibleKeyUsageChains > 0 { + if invalidPoliciesChains == 0 { + return nil, CertificateInvalidError{c, IncompatibleUsage, ""} + } + details = append(details, fmt.Sprintf("%d candidate chains with incompatible key usage", incompatibleKeyUsageChains)) + } + if invalidPoliciesChains > 0 { + details = append(details, fmt.Sprintf("%d candidate chains with invalid policies", invalidPoliciesChains)) + } + err = CertificateInvalidError{c, NoValidChains, strings.Join(details, ", ")} + return nil, err + } + + return candidateChains, nil +} + +func appendToFreshChain(chain []*Certificate, cert *Certificate) []*Certificate { + n := make([]*Certificate, len(chain)+1) + copy(n, chain) + n[len(chain)] = cert + return n +} + +// alreadyInChain checks whether a candidate certificate is present in a chain. +// Rather than doing a direct byte for byte equivalency check, we check if the +// subject, public key, and SAN, if present, are equal. This prevents loops that +// are created by mutual cross-signatures, or other cross-signature bridge +// oddities. +func alreadyInChain(candidate *Certificate, chain []*Certificate) bool { + type pubKeyEqual interface { + Equal(crypto.PublicKey) bool + } + + var candidateSAN *pkix.Extension + for _, ext := range candidate.Extensions { + if ext.Id.Equal(oidExtensionSubjectAltName) { + candidateSAN = &ext + break + } + } + + for _, cert := range chain { + if !bytes.Equal(candidate.RawSubject, cert.RawSubject) { + continue + } + // We enforce the canonical encoding of SPKI (by only allowing the + // correct AI paremeter encodings in parseCertificate), so it's safe to + // directly compare the raw bytes. + if !bytes.Equal(candidate.RawSubjectPublicKeyInfo, cert.RawSubjectPublicKeyInfo) { + continue + } + var certSAN *pkix.Extension + for _, ext := range cert.Extensions { + if ext.Id.Equal(oidExtensionSubjectAltName) { + certSAN = &ext + break + } + } + if candidateSAN == nil && certSAN == nil { + return true + } else if candidateSAN == nil || certSAN == nil { + return false + } + if bytes.Equal(candidateSAN.Value, certSAN.Value) { + return true + } + } + return false +} + +// maxChainSignatureChecks is the maximum number of CheckSignatureFrom calls +// that an invocation of buildChains will (transitively) make. Most chains are +// less than 15 certificates long, so this leaves space for multiple chains and +// for failed checks due to different intermediates having the same Subject. +const maxChainSignatureChecks = 100 + +var errSignatureLimit = errors.New("x509: signature check attempts limit reached while verifying certificate chain") + +func (c *Certificate) buildChains(currentChain []*Certificate, sigChecks *int, opts *VerifyOptions) (chains [][]*Certificate, err error) { + var ( + hintErr error + hintCert *Certificate + ) + + considerCandidate := func(certType int, candidate potentialParent) { + if sigChecks == nil { + sigChecks = new(int) + } + *sigChecks++ + if *sigChecks > maxChainSignatureChecks { + err = errSignatureLimit + return + } + + if candidate.cert.PublicKey == nil || alreadyInChain(candidate.cert, currentChain) { + return + } + + if err := c.CheckSignatureFrom(candidate.cert); err != nil { + if hintErr == nil { + hintErr = err + hintCert = candidate.cert + } + return + } + + err = candidate.cert.isValid(certType, currentChain, opts) + if err != nil { + if hintErr == nil { + hintErr = err + hintCert = candidate.cert + } + return + } + + if candidate.constraint != nil { + if err := candidate.constraint(currentChain); err != nil { + if hintErr == nil { + hintErr = err + hintCert = candidate.cert + } + return + } + } + + switch certType { + case rootCertificate: + chains = append(chains, appendToFreshChain(currentChain, candidate.cert)) + case intermediateCertificate: + var childChains [][]*Certificate + childChains, err = candidate.cert.buildChains(appendToFreshChain(currentChain, candidate.cert), sigChecks, opts) + chains = append(chains, childChains...) + } + } + +candidateLoop: + for _, parents := range []struct { + certType int + potentials []potentialParent + }{ + {rootCertificate, opts.Roots.findPotentialParents(c)}, + {intermediateCertificate, opts.Intermediates.findPotentialParents(c)}, + } { + for _, parent := range parents.potentials { + considerCandidate(parents.certType, parent) + if err == errSignatureLimit { + break candidateLoop + } + } + } + + if len(chains) > 0 { + err = nil + } + if len(chains) == 0 && err == nil { + err = UnknownAuthorityError{c, hintErr, hintCert} + } + + return +} + +func validHostnamePattern(host string) bool { return validHostname(host, true) } +func validHostnameInput(host string) bool { return validHostname(host, false) } + +// validHostname reports whether host is a valid hostname that can be matched or +// matched against according to RFC 6125 2.2, with some leniency to accommodate +// legacy values. +func validHostname(host string, isPattern bool) bool { + if !isPattern { + host = strings.TrimSuffix(host, ".") + } + if len(host) == 0 { + return false + } + if host == "*" { + // Bare wildcards are not allowed, they are not valid DNS names, + // nor are they allowed per RFC 6125. + return false + } + + for i, part := range strings.Split(host, ".") { + if part == "" { + // Empty label. + return false + } + if isPattern && i == 0 && part == "*" { + // Only allow full left-most wildcards, as those are the only ones + // we match, and matching literal '*' characters is probably never + // the expected behavior. + continue + } + for j, c := range part { + if 'a' <= c && c <= 'z' { + continue + } + if '0' <= c && c <= '9' { + continue + } + if 'A' <= c && c <= 'Z' { + continue + } + if c == '-' && j != 0 { + continue + } + if c == '_' { + // Not a valid character in hostnames, but commonly + // found in deployments outside the WebPKI. + continue + } + return false + } + } + + return true +} + +func matchExactly(hostA, hostB string) bool { + if hostA == "" || hostA == "." || hostB == "" || hostB == "." { + return false + } + return toLowerCaseASCII(hostA) == toLowerCaseASCII(hostB) +} + +func matchHostnames(pattern, host string) bool { + pattern = toLowerCaseASCII(pattern) + host = toLowerCaseASCII(strings.TrimSuffix(host, ".")) + + if len(pattern) == 0 || len(host) == 0 { + return false + } + + patternParts := strings.Split(pattern, ".") + hostParts := strings.Split(host, ".") + + if len(patternParts) != len(hostParts) { + return false + } + + for i, patternPart := range patternParts { + if i == 0 && patternPart == "*" { + continue + } + if patternPart != hostParts[i] { + return false + } + } + + return true +} + +// toLowerCaseASCII returns a lower-case version of in. See RFC 6125 6.4.1. We use +// an explicitly ASCII function to avoid any sharp corners resulting from +// performing Unicode operations on DNS labels. +func toLowerCaseASCII(in string) string { + // If the string is already lower-case then there's nothing to do. + isAlreadyLowerCase := true + for _, c := range in { + if c == utf8.RuneError { + // If we get a UTF-8 error then there might be + // upper-case ASCII bytes in the invalid sequence. + isAlreadyLowerCase = false + break + } + if 'A' <= c && c <= 'Z' { + isAlreadyLowerCase = false + break + } + } + + if isAlreadyLowerCase { + return in + } + + out := []byte(in) + for i, c := range out { + if 'A' <= c && c <= 'Z' { + out[i] += 'a' - 'A' + } + } + return string(out) +} + +// VerifyHostname returns nil if c is a valid certificate for the named host. +// Otherwise it returns an error describing the mismatch. +// +// IP addresses can be optionally enclosed in square brackets and are checked +// against the IPAddresses field. Other names are checked case insensitively +// against the DNSNames field. If the names are valid hostnames, the certificate +// fields can have a wildcard as the complete left-most label (e.g. *.example.com). +// +// Note that the legacy Common Name field is ignored. +func (c *Certificate) VerifyHostname(h string) error { + // IP addresses may be written in [ ]. + candidateIP := h + if len(h) >= 3 && h[0] == '[' && h[len(h)-1] == ']' { + candidateIP = h[1 : len(h)-1] + } + if ip := net.ParseIP(candidateIP); ip != nil { + // We only match IP addresses against IP SANs. + // See RFC 6125, Appendix B.2. + for _, candidate := range c.IPAddresses { + if ip.Equal(candidate) { + return nil + } + } + return HostnameError{c, candidateIP} + } + + candidateName := toLowerCaseASCII(h) // Save allocations inside the loop. + validCandidateName := validHostnameInput(candidateName) + + for _, match := range c.DNSNames { + // Ideally, we'd only match valid hostnames according to RFC 6125 like + // browsers (more or less) do, but in practice Go is used in a wider + // array of contexts and can't even assume DNS resolution. Instead, + // always allow perfect matches, and only apply wildcard and trailing + // dot processing to valid hostnames. + if validCandidateName && validHostnamePattern(match) { + if matchHostnames(match, candidateName) { + return nil + } + } else { + if matchExactly(match, candidateName) { + return nil + } + } + } + + return HostnameError{c, h} +} + +func checkChainForKeyUsage(chain []*Certificate, keyUsages []ExtKeyUsage) bool { + usages := make([]ExtKeyUsage, len(keyUsages)) + copy(usages, keyUsages) + + if len(chain) == 0 { + return false + } + + usagesRemaining := len(usages) + + // We walk down the list and cross out any usages that aren't supported + // by each certificate. If we cross out all the usages, then the chain + // is unacceptable. + +NextCert: + for i := len(chain) - 1; i >= 0; i-- { + cert := chain[i] + if len(cert.ExtKeyUsage) == 0 && len(cert.UnknownExtKeyUsage) == 0 { + // The certificate doesn't have any extended key usage specified. + continue + } + + for _, usage := range cert.ExtKeyUsage { + if usage == ExtKeyUsageAny { + // The certificate is explicitly good for any usage. + continue NextCert + } + } + + const invalidUsage = -1 + + NextRequestedUsage: + for i, requestedUsage := range usages { + if requestedUsage == invalidUsage { + continue + } + + for _, usage := range cert.ExtKeyUsage { + if requestedUsage == usage { + continue NextRequestedUsage + } + } + + usages[i] = invalidUsage + usagesRemaining-- + if usagesRemaining == 0 { + return false + } + } + } + + return true +} + +func mustNewOIDFromInts(ints []uint64) OID { + oid, err := OIDFromInts(ints) + if err != nil { + panic(fmt.Sprintf("OIDFromInts(%v) unexpected error: %v", ints, err)) + } + return oid +} + +type policyGraphNode struct { + validPolicy OID + expectedPolicySet []OID + // we do not implement qualifiers, so we don't track qualifier_set + + parents map[*policyGraphNode]bool + children map[*policyGraphNode]bool +} + +func newPolicyGraphNode(valid OID, parents []*policyGraphNode) *policyGraphNode { + n := &policyGraphNode{ + validPolicy: valid, + expectedPolicySet: []OID{valid}, + children: map[*policyGraphNode]bool{}, + parents: map[*policyGraphNode]bool{}, + } + for _, p := range parents { + p.children[n] = true + n.parents[p] = true + } + return n +} + +type policyGraph struct { + strata []map[string]*policyGraphNode + // map of OID -> nodes at strata[depth-1] with OID in their expectedPolicySet + parentIndex map[string][]*policyGraphNode + depth int +} + +var anyPolicyOID = mustNewOIDFromInts([]uint64{2, 5, 29, 32, 0}) + +func newPolicyGraph() *policyGraph { + root := policyGraphNode{ + validPolicy: anyPolicyOID, + expectedPolicySet: []OID{anyPolicyOID}, + children: map[*policyGraphNode]bool{}, + parents: map[*policyGraphNode]bool{}, + } + return &policyGraph{ + depth: 0, + strata: []map[string]*policyGraphNode{{string(anyPolicyOID.der): &root}}, + } +} + +func (pg *policyGraph) insert(n *policyGraphNode) { + pg.strata[pg.depth][string(n.validPolicy.der)] = n +} + +func (pg *policyGraph) parentsWithExpected(expected OID) []*policyGraphNode { + if pg.depth == 0 { + return nil + } + return pg.parentIndex[string(expected.der)] +} + +func (pg *policyGraph) parentWithAnyPolicy() *policyGraphNode { + if pg.depth == 0 { + return nil + } + return pg.strata[pg.depth-1][string(anyPolicyOID.der)] +} + +func (pg *policyGraph) parents() iter.Seq[*policyGraphNode] { + if pg.depth == 0 { + return nil + } + return maps.Values(pg.strata[pg.depth-1]) +} + +func (pg *policyGraph) leaves() map[string]*policyGraphNode { + return pg.strata[pg.depth] +} + +func (pg *policyGraph) leafWithPolicy(policy OID) *policyGraphNode { + return pg.strata[pg.depth][string(policy.der)] +} + +func (pg *policyGraph) deleteLeaf(policy OID) { + n := pg.strata[pg.depth][string(policy.der)] + if n == nil { + return + } + for p := range n.parents { + delete(p.children, n) + } + for c := range n.children { + delete(c.parents, n) + } + delete(pg.strata[pg.depth], string(policy.der)) +} + +func (pg *policyGraph) validPolicyNodes() []*policyGraphNode { + var validNodes []*policyGraphNode + for i := pg.depth; i >= 0; i-- { + for _, n := range pg.strata[i] { + if n.validPolicy.Equal(anyPolicyOID) { + continue + } + + if len(n.parents) == 1 { + for p := range n.parents { + if p.validPolicy.Equal(anyPolicyOID) { + validNodes = append(validNodes, n) + } + } + } + } + } + return validNodes +} + +func (pg *policyGraph) prune() { + for i := pg.depth - 1; i > 0; i-- { + for _, n := range pg.strata[i] { + if len(n.children) == 0 { + for p := range n.parents { + delete(p.children, n) + } + delete(pg.strata[i], string(n.validPolicy.der)) + } + } + } +} + +func (pg *policyGraph) incrDepth() { + pg.parentIndex = map[string][]*policyGraphNode{} + for _, n := range pg.strata[pg.depth] { + for _, e := range n.expectedPolicySet { + pg.parentIndex[string(e.der)] = append(pg.parentIndex[string(e.der)], n) + } + } + + pg.depth++ + pg.strata = append(pg.strata, map[string]*policyGraphNode{}) +} + +func policiesValid(chain []*Certificate, opts VerifyOptions) bool { + // The following code implements the policy verification algorithm as + // specified in RFC 5280 and updated by RFC 9618. In particular the + // following sections are replaced by RFC 9618: + // * 6.1.2 (a) + // * 6.1.3 (d) + // * 6.1.3 (e) + // * 6.1.3 (f) + // * 6.1.4 (b) + // * 6.1.5 (g) + + if len(chain) == 1 { + return true + } + + // n is the length of the chain minus the trust anchor + n := len(chain) - 1 + + pg := newPolicyGraph() + var inhibitAnyPolicy, explicitPolicy, policyMapping int + if !opts.inhibitAnyPolicy { + inhibitAnyPolicy = n + 1 + } + if !opts.requireExplicitPolicy { + explicitPolicy = n + 1 + } + if !opts.inhibitPolicyMapping { + policyMapping = n + 1 + } + + initialUserPolicySet := map[string]bool{} + for _, p := range opts.CertificatePolicies { + initialUserPolicySet[string(p.der)] = true + } + // If the user does not pass any policies, we consider + // that equivalent to passing anyPolicyOID. + if len(initialUserPolicySet) == 0 { + initialUserPolicySet[string(anyPolicyOID.der)] = true + } + + for i := n - 1; i >= 0; i-- { + cert := chain[i] + + isSelfSigned := bytes.Equal(cert.RawIssuer, cert.RawSubject) + + // 6.1.3 (e) -- as updated by RFC 9618 + if len(cert.Policies) == 0 { + pg = nil + } + + // 6.1.3 (f) -- as updated by RFC 9618 + if explicitPolicy == 0 && pg == nil { + return false + } + + if pg != nil { + pg.incrDepth() + + policies := map[string]bool{} + + // 6.1.3 (d) (1) -- as updated by RFC 9618 + for _, policy := range cert.Policies { + policies[string(policy.der)] = true + + if policy.Equal(anyPolicyOID) { + continue + } + + // 6.1.3 (d) (1) (i) -- as updated by RFC 9618 + parents := pg.parentsWithExpected(policy) + if len(parents) == 0 { + // 6.1.3 (d) (1) (ii) -- as updated by RFC 9618 + if anyParent := pg.parentWithAnyPolicy(); anyParent != nil { + parents = []*policyGraphNode{anyParent} + } + } + if len(parents) > 0 { + pg.insert(newPolicyGraphNode(policy, parents)) + } + } + + // 6.1.3 (d) (2) -- as updated by RFC 9618 + // NOTE: in the check "n-i < n" our i is different from the i in the specification. + // In the specification chains go from the trust anchor to the leaf, whereas our + // chains go from the leaf to the trust anchor, so our i's our inverted. Our + // check here matches the check "i < n" in the specification. + if policies[string(anyPolicyOID.der)] && (inhibitAnyPolicy > 0 || (n-i < n && isSelfSigned)) { + missing := map[string][]*policyGraphNode{} + leaves := pg.leaves() + for p := range pg.parents() { + for _, expected := range p.expectedPolicySet { + if leaves[string(expected.der)] == nil { + missing[string(expected.der)] = append(missing[string(expected.der)], p) + } + } + } + + for oidStr, parents := range missing { + pg.insert(newPolicyGraphNode(OID{der: []byte(oidStr)}, parents)) + } + } + + // 6.1.3 (d) (3) -- as updated by RFC 9618 + pg.prune() + + if i != 0 { + // 6.1.4 (b) -- as updated by RFC 9618 + if len(cert.PolicyMappings) > 0 { + // collect map of issuer -> []subject + mappings := map[string][]OID{} + + for _, mapping := range cert.PolicyMappings { + if policyMapping > 0 { + if mapping.IssuerDomainPolicy.Equal(anyPolicyOID) || mapping.SubjectDomainPolicy.Equal(anyPolicyOID) { + // Invalid mapping + return false + } + mappings[string(mapping.IssuerDomainPolicy.der)] = append(mappings[string(mapping.IssuerDomainPolicy.der)], mapping.SubjectDomainPolicy) + } else { + // 6.1.4 (b) (3) (i) -- as updated by RFC 9618 + pg.deleteLeaf(mapping.IssuerDomainPolicy) + } + } + + // 6.1.4 (b) (3) (ii) -- as updated by RFC 9618 + pg.prune() + + for issuerStr, subjectPolicies := range mappings { + // 6.1.4 (b) (1) -- as updated by RFC 9618 + if matching := pg.leafWithPolicy(OID{der: []byte(issuerStr)}); matching != nil { + matching.expectedPolicySet = subjectPolicies + } else if matching := pg.leafWithPolicy(anyPolicyOID); matching != nil { + // 6.1.4 (b) (2) -- as updated by RFC 9618 + n := newPolicyGraphNode(OID{der: []byte(issuerStr)}, []*policyGraphNode{matching}) + n.expectedPolicySet = subjectPolicies + pg.insert(n) + } + } + } + } + } + + if i != 0 { + // 6.1.4 (h) + if !isSelfSigned { + if explicitPolicy > 0 { + explicitPolicy-- + } + if policyMapping > 0 { + policyMapping-- + } + if inhibitAnyPolicy > 0 { + inhibitAnyPolicy-- + } + } + + // 6.1.4 (i) + if (cert.RequireExplicitPolicy > 0 || cert.RequireExplicitPolicyZero) && cert.RequireExplicitPolicy < explicitPolicy { + explicitPolicy = cert.RequireExplicitPolicy + } + if (cert.InhibitPolicyMapping > 0 || cert.InhibitPolicyMappingZero) && cert.InhibitPolicyMapping < policyMapping { + policyMapping = cert.InhibitPolicyMapping + } + // 6.1.4 (j) + if (cert.InhibitAnyPolicy > 0 || cert.InhibitAnyPolicyZero) && cert.InhibitAnyPolicy < inhibitAnyPolicy { + inhibitAnyPolicy = cert.InhibitAnyPolicy + } + } + } + + // 6.1.5 (a) + if explicitPolicy > 0 { + explicitPolicy-- + } + + // 6.1.5 (b) + if chain[0].RequireExplicitPolicyZero { + explicitPolicy = 0 + } + + // 6.1.5 (g) (1) -- as updated by RFC 9618 + var validPolicyNodeSet []*policyGraphNode + // 6.1.5 (g) (2) -- as updated by RFC 9618 + if pg != nil { + validPolicyNodeSet = pg.validPolicyNodes() + // 6.1.5 (g) (3) -- as updated by RFC 9618 + if currentAny := pg.leafWithPolicy(anyPolicyOID); currentAny != nil { + validPolicyNodeSet = append(validPolicyNodeSet, currentAny) + } + } + + // 6.1.5 (g) (4) -- as updated by RFC 9618 + authorityConstrainedPolicySet := map[string]bool{} + for _, n := range validPolicyNodeSet { + authorityConstrainedPolicySet[string(n.validPolicy.der)] = true + } + // 6.1.5 (g) (5) -- as updated by RFC 9618 + userConstrainedPolicySet := maps.Clone(authorityConstrainedPolicySet) + // 6.1.5 (g) (6) -- as updated by RFC 9618 + if len(initialUserPolicySet) != 1 || !initialUserPolicySet[string(anyPolicyOID.der)] { + // 6.1.5 (g) (6) (i) -- as updated by RFC 9618 + for p := range userConstrainedPolicySet { + if !initialUserPolicySet[p] { + delete(userConstrainedPolicySet, p) + } + } + // 6.1.5 (g) (6) (ii) -- as updated by RFC 9618 + if authorityConstrainedPolicySet[string(anyPolicyOID.der)] { + for policy := range initialUserPolicySet { + userConstrainedPolicySet[policy] = true + } + } + } + + if explicitPolicy == 0 && len(userConstrainedPolicySet) == 0 { + return false + } + + return true +} diff --git a/go/src/crypto/x509/verify_test.go b/go/src/crypto/x509/verify_test.go new file mode 100644 index 0000000000000000000000000000000000000000..1d3e845d0f0a9cf8886786a7b8b3b4e3a537c995 --- /dev/null +++ b/go/src/crypto/x509/verify_test.go @@ -0,0 +1,3185 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "crypto" + "crypto/dsa" + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "crypto/rsa" + "crypto/x509/pkix" + "encoding/asn1" + "encoding/pem" + "errors" + "fmt" + "internal/testenv" + "log" + "math/big" + "net" + "os" + "os/exec" + "runtime" + "slices" + "strconv" + "strings" + "testing" + "time" +) + +type verifyTest struct { + name string + leaf string + intermediates []string + roots []string + currentTime int64 + dnsName string + systemSkip bool + systemLax bool + keyUsages []ExtKeyUsage + + errorCallback func(*testing.T, error) + expectedChains [][]string +} + +var verifyTests = []verifyTest{ + { + name: "Valid", + leaf: googleLeaf, + intermediates: []string{gtsIntermediate}, + roots: []string{gtsRoot}, + currentTime: 1677615892, + dnsName: "www.google.com", + + expectedChains: [][]string{ + {"www.google.com", "GTS CA 1C3", "GTS Root R1"}, + }, + }, + { + name: "Valid (fqdn)", + leaf: googleLeaf, + intermediates: []string{gtsIntermediate}, + roots: []string{gtsRoot}, + currentTime: 1677615892, + dnsName: "www.google.com.", + + expectedChains: [][]string{ + {"www.google.com", "GTS CA 1C3", "GTS Root R1"}, + }, + }, + { + name: "MixedCase", + leaf: googleLeaf, + intermediates: []string{gtsIntermediate}, + roots: []string{gtsRoot}, + currentTime: 1677615892, + dnsName: "WwW.GooGLE.coM", + + expectedChains: [][]string{ + {"www.google.com", "GTS CA 1C3", "GTS Root R1"}, + }, + }, + { + name: "HostnameMismatch", + leaf: googleLeaf, + intermediates: []string{gtsIntermediate}, + roots: []string{gtsRoot}, + currentTime: 1677615892, + dnsName: "www.example.com", + + errorCallback: expectHostnameError("certificate is valid for"), + }, + { + name: "TooManyDNS", + leaf: generatePEMCertWithRepeatSAN(1677615892, 200, "fake.dns"), + roots: []string{generatePEMCertWithRepeatSAN(1677615892, 200, "fake.dns")}, + currentTime: 1677615892, + dnsName: "www.example.com", + systemSkip: true, // does not chain to a system root + + errorCallback: expectHostnameError("certificate is valid for 200 names, but none matched"), + }, + { + name: "TooManyIPs", + leaf: generatePEMCertWithRepeatSAN(1677615892, 150, "4.3.2.1"), + roots: []string{generatePEMCertWithRepeatSAN(1677615892, 150, "4.3.2.1")}, + currentTime: 1677615892, + dnsName: "1.2.3.4", + systemSkip: true, // does not chain to a system root + + errorCallback: expectHostnameError("certificate is valid for 150 IP SANs, but none matched"), + }, + { + name: "IPMissing", + leaf: googleLeaf, + intermediates: []string{gtsIntermediate}, + roots: []string{gtsRoot}, + currentTime: 1677615892, + dnsName: "1.2.3.4", + + errorCallback: expectHostnameError("doesn't contain any IP SANs"), + }, + { + name: "Expired", + leaf: googleLeaf, + intermediates: []string{gtsIntermediate}, + roots: []string{gtsRoot}, + currentTime: 1, + dnsName: "www.example.com", + + errorCallback: expectExpired, + }, + { + name: "MissingIntermediate", + leaf: googleLeaf, + roots: []string{gtsRoot}, + currentTime: 1677615892, + dnsName: "www.google.com", + + // Skip when using systemVerify, since Windows + // *will* find the missing intermediate cert. + systemSkip: true, + errorCallback: expectAuthorityUnknown, + }, + { + name: "RootInIntermediates", + leaf: googleLeaf, + intermediates: []string{gtsRoot, gtsIntermediate}, + roots: []string{gtsRoot}, + currentTime: 1677615892, + dnsName: "www.google.com", + + expectedChains: [][]string{ + {"www.google.com", "GTS CA 1C3", "GTS Root R1"}, + }, + // CAPI doesn't build the chain with the duplicated GeoTrust + // entry so the results don't match. + systemLax: true, + }, + { + name: "InvalidHash", + leaf: googleLeafWithInvalidHash, + intermediates: []string{gtsIntermediate}, + roots: []string{gtsRoot}, + currentTime: 1677615892, + dnsName: "www.google.com", + + // The specific error message may not occur when using system + // verification. + systemLax: true, + errorCallback: expectHashError, + }, + // EKULeaf tests use an unconstrained chain leading to a leaf certificate + // with an E-mail Protection EKU but not a Server Auth one, checking that + // the EKUs on the leaf are enforced. + { + name: "EKULeaf", + leaf: smimeLeaf, + intermediates: []string{smimeIntermediate}, + roots: []string{smimeRoot}, + currentTime: 1594673418, + + errorCallback: expectUsageError, + }, + { + name: "EKULeafExplicit", + leaf: smimeLeaf, + intermediates: []string{smimeIntermediate}, + roots: []string{smimeRoot}, + currentTime: 1594673418, + keyUsages: []ExtKeyUsage{ExtKeyUsageServerAuth}, + + errorCallback: expectUsageError, + }, + { + name: "EKULeafValid", + leaf: smimeLeaf, + intermediates: []string{smimeIntermediate}, + roots: []string{smimeRoot}, + currentTime: 1594673418, + keyUsages: []ExtKeyUsage{ExtKeyUsageEmailProtection}, + + expectedChains: [][]string{ + {"CORPORATIVO FICTICIO ACTIVO", "EAEko Herri Administrazioen CA - CA AAPP Vascas (2)", "IZENPE S.A."}, + }, + }, + { + // Check that a name constrained intermediate works even when + // it lists multiple constraints. + name: "MultipleConstraints", + leaf: nameConstraintsLeaf, + intermediates: []string{nameConstraintsIntermediate1, nameConstraintsIntermediate2}, + roots: []string{globalSignRoot}, + currentTime: 1524771953, + dnsName: "udctest.ads.vt.edu", + + expectedChains: [][]string{ + { + "udctest.ads.vt.edu", + "Virginia Tech Global Qualified Server CA", + "Trusted Root CA SHA256 G2", + "GlobalSign", + }, + }, + }, + { + // Check that SHA-384 intermediates (which are popping up) + // work. + name: "SHA-384", + leaf: trustAsiaLeaf, + intermediates: []string{trustAsiaSHA384Intermediate}, + roots: []string{digicertRoot}, + currentTime: 1558051200, + dnsName: "tm.cn", + + // CryptoAPI can find alternative validation paths. + systemLax: true, + + expectedChains: [][]string{ + { + "tm.cn", + "TrustAsia ECC OV TLS Pro CA", + "DigiCert Global Root CA", + }, + }, + }, + { + // Putting a certificate as a root directly should work as a + // way of saying “exactly this”. + name: "LeafInRoots", + leaf: selfSigned, + roots: []string{selfSigned}, + currentTime: 1471624472, + dnsName: "foo.example", + systemSkip: true, // does not chain to a system root + + expectedChains: [][]string{ + {"Acme Co"}, + }, + }, + { + // Putting a certificate as a root directly should not skip + // other checks however. + name: "LeafInRootsInvalid", + leaf: selfSigned, + roots: []string{selfSigned}, + currentTime: 1471624472, + dnsName: "notfoo.example", + systemSkip: true, // does not chain to a system root + + errorCallback: expectHostnameError("certificate is valid for"), + }, + { + // An X.509 v1 certificate should not be accepted as an + // intermediate. + name: "X509v1Intermediate", + leaf: x509v1TestLeaf, + intermediates: []string{x509v1TestIntermediate}, + roots: []string{x509v1TestRoot}, + currentTime: 1481753183, + systemSkip: true, // does not chain to a system root + + errorCallback: expectNotAuthorizedError, + }, + { + name: "IgnoreCNWithSANs", + leaf: ignoreCNWithSANLeaf, + dnsName: "foo.example.com", + roots: []string{ignoreCNWithSANRoot}, + currentTime: 1486684488, + systemSkip: true, // does not chain to a system root + + errorCallback: expectHostnameError("certificate is not valid for any names"), + }, + { + // Test that excluded names are respected. + name: "ExcludedNames", + leaf: excludedNamesLeaf, + dnsName: "bender.local", + intermediates: []string{excludedNamesIntermediate}, + roots: []string{excludedNamesRoot}, + currentTime: 1486684488, + systemSkip: true, // does not chain to a system root + + errorCallback: expectNameConstraintsError, + }, + { + // Test that unknown critical extensions in a leaf cause a + // verify error. + name: "CriticalExtLeaf", + leaf: criticalExtLeafWithExt, + intermediates: []string{criticalExtIntermediate}, + roots: []string{criticalExtRoot}, + currentTime: 1486684488, + systemSkip: true, // does not chain to a system root + + errorCallback: expectUnhandledCriticalExtension, + }, + { + // Test that unknown critical extensions in an intermediate + // cause a verify error. + name: "CriticalExtIntermediate", + leaf: criticalExtLeaf, + intermediates: []string{criticalExtIntermediateWithExt}, + roots: []string{criticalExtRoot}, + currentTime: 1486684488, + systemSkip: true, // does not chain to a system root + + errorCallback: expectUnhandledCriticalExtension, + }, + { + name: "ValidCN", + leaf: validCNWithoutSAN, + dnsName: "foo.example.com", + roots: []string{invalidCNRoot}, + currentTime: 1540000000, + systemSkip: true, // does not chain to a system root + + errorCallback: expectHostnameError("certificate relies on legacy Common Name field"), + }, + { + // A certificate with an AKID should still chain to a parent without SKID. + // See Issue 30079. + name: "AKIDNoSKID", + leaf: leafWithAKID, + roots: []string{rootWithoutSKID}, + currentTime: 1550000000, + dnsName: "example", + systemSkip: true, // does not chain to a system root + + expectedChains: [][]string{ + {"Acme LLC", "Acme Co"}, + }, + }, + { + // When there are two parents, one with an incorrect subject but matching SKID + // and one with a correct subject but missing SKID, the latter should be + // considered as a possible parent. + leaf: leafMatchingAKIDMatchingIssuer, + roots: []string{rootMatchingSKIDMismatchingSubject, rootMismatchingSKIDMatchingSubject}, + currentTime: 1550000000, + dnsName: "example", + systemSkip: true, + + expectedChains: [][]string{ + {"Leaf", "Root B"}, + }, + }, +} + +func expectHostnameError(msg string) func(*testing.T, error) { + return func(t *testing.T, err error) { + if _, ok := err.(HostnameError); !ok { + t.Fatalf("error was not a HostnameError: %v", err) + } + if !strings.Contains(err.Error(), msg) { + t.Fatalf("HostnameError did not contain %q: %v", msg, err) + } + } +} + +func expectExpired(t *testing.T, err error) { + if inval, ok := err.(CertificateInvalidError); !ok || inval.Reason != Expired { + t.Fatalf("error was not Expired: %v", err) + } +} + +func expectUsageError(t *testing.T, err error) { + if inval, ok := err.(CertificateInvalidError); !ok || inval.Reason != IncompatibleUsage { + t.Fatalf("error was not IncompatibleUsage: %v", err) + } +} + +func expectAuthorityUnknown(t *testing.T, err error) { + e, ok := err.(UnknownAuthorityError) + if !ok { + t.Fatalf("error was not UnknownAuthorityError: %v", err) + } + if e.Cert == nil { + t.Fatalf("error was UnknownAuthorityError, but missing Cert: %v", err) + } +} + +func expectHashError(t *testing.T, err error) { + if err == nil { + t.Fatalf("no error resulted from invalid hash") + } + if expected := "algorithm unimplemented"; !strings.Contains(err.Error(), expected) { + t.Fatalf("error resulting from invalid hash didn't contain '%s', rather it was: %v", expected, err) + } +} + +func expectNameConstraintsError(t *testing.T, err error) { + if inval, ok := err.(CertificateInvalidError); !ok || inval.Reason != CANotAuthorizedForThisName { + t.Fatalf("error was not a CANotAuthorizedForThisName: %v", err) + } +} + +func expectNotAuthorizedError(t *testing.T, err error) { + if inval, ok := err.(CertificateInvalidError); !ok || inval.Reason != NotAuthorizedToSign { + t.Fatalf("error was not a NotAuthorizedToSign: %v", err) + } +} + +func expectUnhandledCriticalExtension(t *testing.T, err error) { + if _, ok := err.(UnhandledCriticalExtension); !ok { + t.Fatalf("error was not an UnhandledCriticalExtension: %v", err) + } +} + +func certificateFromPEM(pemBytes string) (*Certificate, error) { + block, _ := pem.Decode([]byte(pemBytes)) + if block == nil { + return nil, errors.New("failed to decode PEM") + } + return ParseCertificate(block.Bytes) +} + +func testVerify(t *testing.T, test verifyTest, useSystemRoots bool) { + opts := VerifyOptions{ + Intermediates: NewCertPool(), + DNSName: test.dnsName, + CurrentTime: time.Unix(test.currentTime, 0), + KeyUsages: test.keyUsages, + } + + if !useSystemRoots { + opts.Roots = NewCertPool() + for j, root := range test.roots { + ok := opts.Roots.AppendCertsFromPEM([]byte(root)) + if !ok { + t.Fatalf("failed to parse root #%d", j) + } + } + } + + for j, intermediate := range test.intermediates { + ok := opts.Intermediates.AppendCertsFromPEM([]byte(intermediate)) + if !ok { + t.Fatalf("failed to parse intermediate #%d", j) + } + } + + leaf, err := certificateFromPEM(test.leaf) + if err != nil { + t.Fatalf("failed to parse leaf: %v", err) + } + + chains, err := leaf.Verify(opts) + + if test.errorCallback == nil && err != nil { + if runtime.GOOS == "windows" && strings.HasSuffix(testenv.Builder(), "-2008") && err.Error() == "x509: certificate signed by unknown authority" { + testenv.SkipFlaky(t, 19564) + } + t.Fatalf("unexpected error: %v", err) + } + if test.errorCallback != nil { + if useSystemRoots && test.systemLax { + if err == nil { + t.Fatalf("expected error") + } + } else { + test.errorCallback(t, err) + } + } + + doesMatch := func(expectedChain []string, chain []*Certificate) bool { + if len(chain) != len(expectedChain) { + return false + } + + for k, cert := range chain { + if !strings.Contains(nameToKey(&cert.Subject), expectedChain[k]) { + return false + } + } + return true + } + + // Every expected chain should match one (or more) returned chain. We tolerate multiple + // matches, as due to root store semantics it is plausible that (at least on the system + // verifiers) multiple identical (looking) chains may be returned when two roots with the + // same subject are present. + for _, expectedChain := range test.expectedChains { + var match bool + for _, chain := range chains { + if doesMatch(expectedChain, chain) { + match = true + break + } + } + + if !match { + t.Errorf("No match found for %v", expectedChain) + } + } + + // Every returned chain should match 1 expected chain (or <2 if testing against the system) + for _, chain := range chains { + nMatched := 0 + for _, expectedChain := range test.expectedChains { + if doesMatch(expectedChain, chain) { + nMatched++ + } + } + // Allow additional unknown chains if systemLax is set + if nMatched == 0 && test.systemLax == false || nMatched > 1 { + t.Errorf("Got %v matches for chain %v", nMatched, chainToDebugString(chain)) + for _, expectedChain := range test.expectedChains { + if doesMatch(expectedChain, chain) { + t.Errorf("\t matched %v", expectedChain) + } + } + } + } +} + +func TestGoVerify(t *testing.T) { + for _, test := range verifyTests { + t.Run(test.name, func(t *testing.T) { + testVerify(t, test, false) + }) + } +} + +func TestSystemVerify(t *testing.T) { + if runtime.GOOS != "windows" { + t.Skipf("skipping verify test using system APIs on %q", runtime.GOOS) + } + + for _, test := range verifyTests { + t.Run(test.name, func(t *testing.T) { + if test.systemSkip { + t.SkipNow() + } + testVerify(t, test, true) + }) + } +} + +func chainToDebugString(chain []*Certificate) string { + var chainStr string + for _, cert := range chain { + if len(chainStr) > 0 { + chainStr += " -> " + } + chainStr += nameToKey(&cert.Subject) + } + return chainStr +} + +func nameToKey(name *pkix.Name) string { + return strings.Join(name.Country, ",") + "/" + strings.Join(name.Organization, ",") + "/" + strings.Join(name.OrganizationalUnit, ",") + "/" + name.CommonName +} + +func generatePEMCertWithRepeatSAN(currentTime int64, count int, san string) string { + cert := Certificate{ + NotBefore: time.Unix(currentTime, 0), + NotAfter: time.Unix(currentTime, 0), + } + if ip := net.ParseIP(san); ip != nil { + cert.IPAddresses = slices.Repeat([]net.IP{ip}, count) + } else { + cert.DNSNames = slices.Repeat([]string{san}, count) + } + privKey, err := rsa.GenerateKey(rand.Reader, 4096) + if err != nil { + log.Fatal(err) + } + certBytes, err := CreateCertificate(rand.Reader, &cert, &cert, &privKey.PublicKey, privKey) + if err != nil { + log.Fatal(err) + } + return string(pem.EncodeToMemory(&pem.Block{ + Type: "CERTIFICATE", + Bytes: certBytes, + })) +} + +const gtsIntermediate = `-----BEGIN CERTIFICATE----- +MIIFljCCA36gAwIBAgINAgO8U1lrNMcY9QFQZjANBgkqhkiG9w0BAQsFADBHMQsw +CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU +MBIGA1UEAxMLR1RTIFJvb3QgUjEwHhcNMjAwODEzMDAwMDQyWhcNMjcwOT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RAhpuo+9K4l/3wV3s6MJT/KYnAK9y8J +ZgfIPxz88NtFMN9iiMG1D53Dn0reWVlHxYciNuaCp+0KueIHoI17eko8cdLiA6Ef +MgfdG+RCzgwARWGAtQsgWSl4vflVy2PFPEz0tv/bal8xa5meLMFrUKTX5hgUvYU/ +Z6tGn6D/Qqc6f1zLXbBwHSs09dR2CQzreExZBfMzQsNhFRAbd03OIozUhfJFfbdT +6u9AWpQKXCBfTkBdYiJ23//OYb2MI3jSNwLgjt7RETeJ9r/tSQdirpLsQBqvFAnZ +0E6yove+7u7Y/9waLd64NnHi/Hm3lCXRSHNboTXns5lndcEZOitHTtNCjv0xyBZm +2tIMPNuzjsmhDYAPexZ3FL//2wmUspO8IFgV6dtxQ/PeEMMA3KgqlbbC1j+Qa3bb +bP6MvPJwNQzcmRk13NfIRmPVNnGuV/u3gm3c +-----END CERTIFICATE-----` + +const googleLeaf = `-----BEGIN CERTIFICATE----- +MIIFUjCCBDqgAwIBAgIQERmRWTzVoz0SMeozw2RM3DANBgkqhkiG9w0BAQsFADBG +MQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExM +QzETMBEGA1UEAxMKR1RTIENBIDFDMzAeFw0yMzAxMDIwODE5MTlaFw0yMzAzMjcw +ODE5MThaMBkxFzAVBgNVBAMTDnd3dy5nb29nbGUuY29tMIIBIjANBgkqhkiG9w0B +AQEFAAOCAQ8AMIIBCgKCAQEAq30odrKMT54TJikMKL8S+lwoCMT5geP0u9pWjk6a +wdB6i3kO+UE4ijCAmhbcZKeKaLnGJ38weZNwB1ayabCYyX7hDiC/nRcZU49LX5+o +55kDVaNn14YKkg2kCeX25HDxSwaOsNAIXKPTqiQL5LPvc4Twhl8HY51hhNWQrTEr +N775eYbixEULvyVLq5BLbCOpPo8n0/MTjQ32ku1jQq3GIYMJC/Rf2VW5doF6t9zs +KleflAN8OdKp0ME9OHg0T1P3yyb67T7n0SpisHbeG06AmQcKJF9g/9V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AO0Ljd9y9oXaXnyPyHmUJNI5YXAcxE+XXiOZhcZuMYyWmoEKJQ/XlSga +zWfTn1IcKhA3IC7A1n/5bkkWD1Xi1mdWFQ6DQDMp//667zz7pKOgFMlB93aPDjvI +c78zEqNswn6xGKXpWF5xVwdFcsx9HKhJ6UAi2bQ/KQ1yb7LPUOR6wXXWrG1cLnNP +i8eNLnKL9PXQ+5SwJFCzfEhcIZuhzg== +-----END CERTIFICATE-----` + +// googleLeafWithInvalidHash is the same as googleLeaf, but the signature +// algorithm in the certificate contains a nonsense OID. +const googleLeafWithInvalidHash = `-----BEGIN CERTIFICATE----- +MIIFUjCCBDqgAwIBAgIQERmRWTzVoz0SMeozw2RM3DANBgkqhkiG9w0BAQ4FADBG +MQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExM +QzETMBEGA1UEAxMKR1RTIENBIDFDMzAeFw0yMzAxMDIwODE5MTlaFw0yMzAzMjcw +ODE5MThaMBkxFzAVBgNVBAMTDnd3dy5nb29nbGUuY29tMIIBIjANBgkqhkiG9w0B +AQEFAAOCAQ8AMIIBCgKCAQEAq30odrKMT54TJikMKL8S+lwoCMT5geP0u9pWjk6a +wdB6i3kO+UE4ijCAmhbcZKeKaLnGJ38weZNwB1ayabCYyX7hDiC/nRcZU49LX5+o +55kDVaNn14YKkg2kCeX25HDxSwaOsNAIXKPTqiQL5LPvc4Twhl8HY51hhNWQrTEr +N775eYbixEULvyVLq5BLbCOpPo8n0/MTjQ32ku1jQq3GIYMJC/Rf2VW5doF6t9zs +KleflAN8OdKp0ME9OHg0T1P3yyb67T7n0SpisHbeG06AmQcKJF9g/9VPJtRf4l1Q +WRPDC+6JUqzXCxAGmIRGZ7TNMxPMBW/7DRX6w8oLKVNb0wIDAQABo4ICZzCCAmMw +DgYDVR0PAQH/BAQDAgWgMBMGA1UdJQQMMAoGCCsGAQUFBwMBMAwGA1UdEwEB/wQC +MAAwHQYDVR0OBBYEFBnboj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c7QIoRy06DdU/U38BxW3uyJMY60zwHvS +FlKAn0OvYp4niKhAJwaBVN3kowmJuOU5Rid+TUnfyxbJ9cttSgzaF3hP/N4zgMEM +5tikXUskeckt8LUK96EH0QyssavAMECUEb/xrupyRdYWwjQGvNLq6T5+fViDGyOw +k+lzD44wofy8paAy9uC9Owae0zMEzhcsyRm7 +-----END CERTIFICATE-----` + +const smimeRoot = `-----BEGIN CERTIFICATE----- +MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4 +MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6 +ZW5wZS5jb20wHhcNMDcxMjEzMTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYD +VQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5j +b20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ03rKDx6sp4boFmVq +scIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAKClaO +xdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6H +LmYRY2xU+zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFX +uaOKmMPsOzTFlUFpfnXCPCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQD +yCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxTOTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+ +JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbKF7jJeodWLBoBHmy+E60Q +rLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK0GqfvEyN +BjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAu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PC3eQyaKl7hLOllsB +CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97 +nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt +43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P +T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4 +gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO +BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR +TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw +DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr +hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg +06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF +PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls +YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk +CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4= +-----END CERTIFICATE-----` + +const trustAsiaSHA384Intermediate = `-----BEGIN CERTIFICATE----- +MIID9zCCAt+gAwIBAgIQC965p4OR4AKrGlsyW0XrDzANBgkqhkiG9w0BAQwFADBh +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBH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YQnC0zdN/WyYB +/1JmacUUofl+HusHuLkDxmadogI= +-----END CERTIFICATE-----` + +const x509v1TestIntermediate = `-----BEGIN CERTIFICATE----- +MIIByjCCATMCCQCCdEMsT8ykqTANBgkqhkiG9w0BAQsFADAjMQ8wDQYDVQQKEwZH +b2xhbmcxEDAOBgNVBAMTB1Jvb3QgQ0EwHhcNMTUwMTAxMDAwMDAwWhcNMjUwMTAx +MDAwMDAwWjAwMQ8wDQYDVQQKEwZHb2xhbmcxHTAbBgNVBAMTFFguNTA5djEgaW50 +ZXJtZWRpYXRlMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJ2QyniAOT+5YL +jeinEBJr3NsC/Q2QJ/VKmgvp+xRxuKTHJiVmxVijmp0vWg8AWfkmuE4p3hXQbbqM +k5yxrk1n60ONhim2L4VXriEvCE7X2OXhTmBls5Ufr7aqIgPMikwjScCXwz8E8qI8 +UxyAhnjeJwMYBU8TuwBImSd4LBHoQQIDAQABMA0GCSqGSIb3DQEBCwUAA4GBAIab +DRG6FbF9kL9jb/TDHkbVBk+sl/Pxi4/XjuFyIALlARgAkeZcPmL5tNW1ImHkwsHR +zWE77kJDibzd141u21ZbLsKvEdUJXjla43bdyMmEqf5VGpC3D4sFt3QVH7lGeRur +x5Wlq1u3YDL/j6s1nU2dQ3ySB/oP7J+vQ9V4QeM+ +-----END CERTIFICATE-----` + +const x509v1TestLeaf = `-----BEGIN CERTIFICATE----- +MIICMzCCAZygAwIBAgIJAPo99mqJJrpJMA0GCSqGSIb3DQEBCwUAMDAxDzANBgNV +BAoTBkdvbGFuZzEdMBsGA1UEAxMUWC41MDl2MSBpbnRlcm1lZGlhdGUwHhcNMTUw +MTAxMDAwMDAwWhcNMjUwMTAxMDAwMDAwWjArMQ8wDQYDVQQKEwZHb2xhbmcxGDAW +BgNVBAMTD2Zvby5leGFtcGxlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC +gYEApUh60Z+a5/oKJxG//Dn8CihSo2CJHNIIO3zEJZ1EeNSMZCynaIR6D3IPZEIR ++RG2oGt+f5EEukAPYxwasp6VeZEezoQWJ+97nPCT6DpwLlWp3i2MF8piK2R9vxkG +Z5n0+HzYk1VM8epIrZFUXSMGTX8w1y041PX/yYLxbdEifdcCAwEAAaNaMFgwDgYD +VR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAMBgNV +HRMBAf8EAjAAMBkGA1UdDgQSBBBFozXe0SnzAmjy+1U6M/cvMA0GCSqGSIb3DQEB +CwUAA4GBADYzYUvaToO/ucBskPdqXV16AaakIhhSENswYVSl97/sODaxsjishKq9 +5R7siu+JnIFotA7IbBe633p75xEnLN88X626N/XRFG9iScLzpj0o0PWXBUiB+fxL +/jt8qszOXCv2vYdUTPNuPqufXLWMoirpuXrr1liJDmedCcAHepY/ +-----END CERTIFICATE-----` + +const ignoreCNWithSANRoot = `-----BEGIN CERTIFICATE----- +MIIDPzCCAiegAwIBAgIIJkzCwkNrPHMwDQYJKoZIhvcNAQELBQAwMDEQMA4GA1UE +ChMHVEVTVElORzEcMBoGA1UEAxMTKipUZXN0aW5nKiogUm9vdCBDQTAeFw0xNTAx +MDEwMDAwMDBaFw0yNTAxMDEwMDAwMDBaMDAxEDAOBgNVBAoTB1RFU1RJTkcxHDAa +BgNVBAMTEyoqVGVzdGluZyoqIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IB +DwAwggEKAoIBAQC4YAf5YqlXGcikvbMWtVrNICt+V/NNWljwfvSKdg4Inm7k6BwW +P6y4Y+n4qSYIWNU4iRkdpajufzctxQCO6ty13iw3qVktzcC5XBIiS6ymiRhhDgnY +VQqyakVGw9MxrPwdRZVlssUv3Hmy6tU+v5Ok31SLY5z3wKgYWvSyYs0b8bKNU8kf +2FmSHnBN16lxGdjhe3ji58F/zFMr0ds+HakrLIvVdFcQFAnQopM8FTHpoWNNzGU3 +KaiO0jBbMFkd6uVjVnuRJ+xj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iY2nraUheRUD1vRRneq7GeXOVNn7uXONg +oCGMjNwwCgYIKoZIzj0EAwIDRwAwRAIgDSiwgIn8g1lpruYH0QD1GYeoWVunfmrI +XzZZl0eW/ugCICgOfXeZ2GGy3wIC0352BaC3a8r5AAb2XSGNe+e9wNN6 +-----END CERTIFICATE-----` + +const validCNWithoutSAN = `-----BEGIN CERTIFICATE----- +MIIBJzCBzwIUB7q8t9mrDAL+UB1OFaMN5BEWFKQwCgYIKoZIzj0EAwIwFDESMBAG +A1UECwwJVGVzdCByb290MB4XDTE4MDcxMTE4NDcyNFoXDTI4MDcwODE4NDcyNFow +GjEYMBYGA1UEAwwPZm9vLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0D +AQcDQgAEp6Z8IjOnR38Iky1fYTUu2kVndvKXcxiwARJKGtW3b0E8uwVp9AZd/+sr +p4ULTPdFToFAeqnGHbu62bkms8pQkDAKBggqhkjOPQQDAgNHADBEAiBTbNe3WWFR +cqUYo0sNUuoV+tCTMDJUS+0PWIW4qBqCOwIgFHdLDn5PCk9kJpfc0O2qZx03hdq0 +h7olHCpY9yMRiz0= +-----END CERTIFICATE-----` + +const rootWithoutSKID = `-----BEGIN CERTIFICATE----- +MIIBbzCCARSgAwIBAgIQeCkq3C8SOX/JM5PqYTl9cDAKBggqhkjOPQQDAjASMRAw +DgYDVQQKEwdBY21lIENvMB4XDTE5MDIwNDIyNTYzNFoXDTI5MDIwMTIyNTYzNFow +EjEQMA4GA1UEChMHQWNtZSBDbzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABISm +jGlTr4dLOWT+BCTm2PzWRjk1DpLcSAh+Al8eB1Nc2eBWxYIH9qPirfatvqBOA4c5 +ZwycRpFoaw6O+EmXnVujTDBKMA4GA1UdDwEB/wQEAwICpDATBgNVHSUEDDAKBggr +BgEFBQcDATAPBgNVHRMBAf8EBTADAQH/MBIGA1UdEQQLMAmCB2V4YW1wbGUwCgYI +KoZIzj0EAwIDSQAwRgIhAMaBYWFCjTfn0MNyQ0QXvYT/iIFompkIqzw6wB7qjLrA +AiEA3sn65V7G4tsjZEOpN0Jykn9uiTjqniqn/S/qmv8gIec= +-----END CERTIFICATE-----` + +const leafWithAKID = `-----BEGIN CERTIFICATE----- +MIIBjTCCATSgAwIBAgIRAPCKYvADhKLPaWOtcTu2XYwwCgYIKoZIzj0EAwIwEjEQ +MA4GA1UEChMHQWNtZSBDbzAeFw0xOTAyMDQyMzA2NTJaFw0yOTAyMDEyMzA2NTJa +MBMxETAPBgNVBAoTCEFjbWUgTExDMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE +Wk5N+/8X97YT6ClFNIE5/4yc2YwKn921l0wrIJEcT2u+Uydm7EqtCJNtZjYMAnBd +Acp/wynpTwC6tBTsxcM0s6NqMGgwDgYDVR0PAQH/BAQDAgWgMBMGA1UdJQQMMAoG +CCsGAQUFBwMBMAwGA1UdEwEB/wQCMAAwHwYDVR0jBBgwFoAUwitfkXg0JglCjW9R +ssWvTAveakIwEgYDVR0RBAswCYIHZXhhbXBsZTAKBggqhkjOPQQDAgNHADBEAiBk +4LpWiWPOIl5PIhX9PDVkmjpre5oyoH/3aYwG8ABYuAIgCeSfbYueOOG2AdXuMqSU +ZZMqeJS7JldLx91sPUArY5A= +-----END CERTIFICATE-----` + +const rootMatchingSKIDMismatchingSubject = `-----BEGIN CERTIFICATE----- +MIIBQjCB6aADAgECAgEAMAoGCCqGSM49BAMCMBExDzANBgNVBAMTBlJvb3QgQTAe +Fw0wOTExMTAyMzAwMDBaFw0xOTExMDgyMzAwMDBaMBExDzANBgNVBAMTBlJvb3Qg +QTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABPK4p1uXq2aAeDtKDHIokg2rTcPM +2gq3N9Y96wiW6/7puBK1+INEW//cO9x6FpzkcsHw/TriAqy4sck/iDAvf9WjMjAw +MA8GA1UdJQQIMAYGBFUdJQAwDwYDVR0TAQH/BAUwAwEB/zAMBgNVHQ4EBQQDAQID +MAoGCCqGSM49BAMCA0gAMEUCIQDgtAp7iVHxMnKxZPaLQPC+Tv2r7+DJc88k2SKH +MPs/wQIgFjjNvBoQEl7vSHTcRGCCcFMdlN4l0Dqc9YwGa9fyrQs= +-----END CERTIFICATE-----` + +const rootMismatchingSKIDMatchingSubject = `-----BEGIN CERTIFICATE----- +MIIBNDCB26ADAgECAgEAMAoGCCqGSM49BAMCMBExDzANBgNVBAMTBlJvb3QgQjAe +Fw0wOTExMTAyMzAwMDBaFw0xOTExMDgyMzAwMDBaMBExDzANBgNVBAMTBlJvb3Qg +QjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABI1YRFcIlkWzm9BdEVrIsEQJ2dT6 +qiW8/WV9GoIhmDtX9SEDHospc0Cgm+TeD2QYW2iMrS5mvNe4GSw0Jezg/bOjJDAi +MA8GA1UdJQQIMAYGBFUdJQAwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAgNI +ADBFAiEAukWOiuellx8bugRiwCS5XQ6IOJ1SZcjuZxj76WojwxkCIHqa71qNw8FM +DtA5yoL9M2pDFF6ovFWnaCe+KlzSwAW/ +-----END CERTIFICATE-----` + +const leafMatchingAKIDMatchingIssuer = `-----BEGIN CERTIFICATE----- +MIIBNTCB26ADAgECAgEAMAoGCCqGSM49BAMCMBExDzANBgNVBAMTBlJvb3QgQjAe +Fw0wOTExMTAyMzAwMDBaFw0xOTExMDgyMzAwMDBaMA8xDTALBgNVBAMTBExlYWYw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAASNWERXCJZFs5vQXRFayLBECdnU+qol +vP1lfRqCIZg7V/UhAx6LKXNAoJvk3g9kGFtojK0uZrzXuBksNCXs4P2zoyYwJDAO +BgNVHSMEBzAFgAMBAgMwEgYDVR0RBAswCYIHZXhhbXBsZTAKBggqhkjOPQQDAgNJ +ADBGAiEAnV9XV7a4h0nfJB8pWv+pBUXRlRFA2uZz3mXEpee8NYACIQCWa+wL70GL +ePBQCV1F9sE2q4ZrnsT9TZoNrSe/bMDjzA== +-----END CERTIFICATE-----` + +var unknownAuthorityErrorTests = []struct { + name string + cert string + expected string +}{ + {"self-signed, cn", selfSignedWithCommonName, "x509: certificate signed by unknown authority (possibly because of \"empty\" while trying to verify candidate authority certificate \"test\")"}, + {"self-signed, no cn, org", selfSignedNoCommonNameWithOrgName, "x509: certificate signed by unknown authority (possibly because of \"empty\" while trying to verify candidate authority certificate \"ca\")"}, + {"self-signed, no cn, no org", selfSignedNoCommonNameNoOrgName, "x509: certificate signed by unknown authority (possibly because of \"empty\" while trying to verify candidate authority certificate \"serial:0\")"}, +} + +func TestUnknownAuthorityError(t *testing.T) { + for i, tt := range unknownAuthorityErrorTests { + t.Run(tt.name, func(t *testing.T) { + der, _ := pem.Decode([]byte(tt.cert)) + if der == nil { + t.Fatalf("#%d: Unable to decode PEM block", i) + } + c, err := ParseCertificate(der.Bytes) + if err != nil { + t.Fatalf("#%d: Unable to parse certificate -> %v", i, err) + } + uae := &UnknownAuthorityError{ + Cert: c, + hintErr: fmt.Errorf("empty"), + hintCert: c, + } + actual := uae.Error() + if actual != tt.expected { + t.Errorf("#%d: UnknownAuthorityError.Error() response invalid actual: %s expected: %s", i, actual, tt.expected) + } + }) + } +} + +const selfSignedWithCommonName = `-----BEGIN CERTIFICATE----- +MIIDCjCCAfKgAwIBAgIBADANBgkqhkiG9w0BAQsFADAaMQswCQYDVQQKEwJjYTEL +MAkGA1UEAxMCY2EwHhcNMTYwODI4MTcwOTE4WhcNMjEwODI3MTcwOTE4WjAcMQsw +CQYDVQQKEwJjYTENMAsGA1UEAxMEdGVzdDCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBAOH55PfRsbvmcabfLLko1w/yuapY/hk13Cgmc3WE/Z1ZStxGiVxY +gQVH9n4W/TbUsrep/TmcC4MV7xEm5252ArcgaH6BeQ4QOTFj/6Jx0RT7U/ix+79x +8RRysf7OlzNpGIctwZEM7i/G+0ZfqX9ULxL/EW9tppSxMX1jlX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LC+2jejB4MA4GA1UdDwEB/wQEAwIC +BDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDwYDVR0TAQH/BAUwAwEB +/zAZBgNVHQ4EEgQQQDfXAftAL7gcflQEJ4xZATAbBgNVHSMEFDASgBBAN9cB+0Av +uBx+VAQnjFkBMAoGCCqGSM49BAMCA0gAMEUCIFeSV00fABFceWR52K+CfIgOHotY +FizzGiLB47hGwjMuAiEA8e0um2Kr8FPQ4wmFKaTRKHMaZizCGl3m+RG5QsE1KWo= +-----END CERTIFICATE-----` + +const criticalExtIntermediate = `-----BEGIN CERTIFICATE----- +MIIBszCCAVmgAwIBAgIJAL2kcGZKpzVqMAoGCCqGSM49BAMCMB0xDDAKBgNVBAoT +A09yZzENMAsGA1UEAxMEUm9vdDAeFw0xNTAxMDEwMDAwMDBaFw0yNTAxMDEwMDAw +MDBaMCUxDDAKBgNVBAoTA09yZzEVMBMGA1UEAxMMSW50ZXJtZWRpYXRlMFkwEwYH +KoZIzj0CAQYIKoZIzj0DAQcDQgAESqVq92iPEq01cL4o99WiXDc5GZjpjNlzMS1n +rk8oHcVDp4tQRRQG3F4A6dF1rn/L923ha3b0fhDLlAvXZB+7EKN6MHgwDgYDVR0P +AQH/BAQDAgIEMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAPBgNVHRMB +Af8EBTADAQH/MBkGA1UdDgQSBBCMGmiotXbbXVd7H40UsgajMBsGA1UdIwQUMBKA +EEA31wH7QC+4HH5UBCeMWQEwCgYIKoZIzj0EAwIDSAAwRQIhAOhhNRb6KV7h3wbE +cdap8bojzvUcPD78fbsQPCNw1jPxAiBOeAJhlTwpKn9KHpeJphYSzydj9NqcS26Y +xXbdbm27KQ== +-----END CERTIFICATE-----` + +const criticalExtLeafWithExt = `-----BEGIN CERTIFICATE----- +MIIBxTCCAWugAwIBAgIJAJZAUtw5ccb1MAoGCCqGSM49BAMCMCUxDDAKBgNVBAoT +A09yZzEVMBMGA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vBsxgNZ3zAbBgNVHSMEFDASgBBAN9cB+0AvuBx+VAQnjFkBMAoGA1ED +BAEB/wQAMAoGCCqGSM49BAMCA0kAMEYCIQCQzTPd6XKex+OAPsKT/1DsoMsg8vcG +c2qZ4Q0apT/kvgIhAKu2TnNQMIUdcO0BYQIl+Uhxc78dc9h4lO+YJB47pHGx +-----END CERTIFICATE-----` + +const criticalExtLeaf = `-----BEGIN CERTIFICATE----- +MIIBzzCCAXWgAwIBAgIJANoWFIlhCI9MMAoGCCqGSM49BAMCMD0xDDAKBgNVBAoT +A09yZzEtMCsGA1UEAxMkSW50ZXJtZWRpYXRlIHdpdGggQ3JpdGljYWwgRXh0ZW5z +aW9uMB4XDTE1MDEwMTAwMDAwMFoXDTI1MDEwMTAwMDAwMFowJDEMMAoGA1UEChMD +T3JnMRQwEgYDVQQDEwtleGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABG1Lfh8A0Ho2UvZN5H0+ONil9c8jwtC0y0xIZftyQE+Fwr9XwqG3rV2g4M1h +GnJa9lV9MPHg8+b85Hixm0ZSw7SjdzB1MA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUE +FjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIwADAZBgNVHQ4EEgQQ +UNhY4JhezH9gQYqvDMWrWDAbBgNVHSMEFDASgBArF29S5Bnqw7de8GzGA1nfMAoG +CCqGSM49BAMCA0gAMEUCIQClA3d4tdrDu9Eb5ZBpgyC+fU1xTZB0dKQHz6M5fPZA +2AIgN96lM+CPGicwhN24uQI6flOsO3H0TJ5lNzBYLtnQtlc= +-----END CERTIFICATE-----` + +func TestValidHostname(t *testing.T) { + tests := []struct { + host string + validInput, validPattern bool + }{ + {host: "example.com", validInput: true, validPattern: true}, + {host: "eXample123-.com", validInput: true, validPattern: true}, + {host: "-eXample123-.com"}, + {host: ""}, + {host: "."}, + {host: "example..com"}, + {host: ".example.com"}, + {host: "example.com.", validInput: true}, + {host: "*.example.com."}, + {host: "*.example.com", validPattern: true}, + {host: "*foo.example.com"}, + {host: "foo.*.example.com"}, + {host: "exa_mple.com", validInput: true, validPattern: true}, + {host: "foo,bar"}, + {host: "project-dev:us-central1:main"}, + } + for _, tt := range tests { + if got := validHostnamePattern(tt.host); got != tt.validPattern { + t.Errorf("validHostnamePattern(%q) = %v, want %v", tt.host, got, tt.validPattern) + } + if got := validHostnameInput(tt.host); got != tt.validInput { + t.Errorf("validHostnameInput(%q) = %v, want %v", tt.host, got, tt.validInput) + } + } +} + +func generateCert(cn string, isCA bool, issuer *Certificate, issuerKey crypto.PrivateKey, priv crypto.PrivateKey) (*Certificate, crypto.PrivateKey, error) { + if priv == nil { + var err error + priv, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + return nil, nil, err + } + } + + serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) + serialNumber, _ := rand.Int(rand.Reader, serialNumberLimit) + + template := &Certificate{ + SerialNumber: serialNumber, + Subject: pkix.Name{CommonName: cn}, + NotBefore: time.Now().Add(-1 * time.Hour), + NotAfter: time.Now().Add(24 * time.Hour), + DNSNames: []string{rand.Text()}, + + KeyUsage: KeyUsageKeyEncipherment | KeyUsageDigitalSignature | KeyUsageCertSign, + ExtKeyUsage: []ExtKeyUsage{ExtKeyUsageServerAuth}, + BasicConstraintsValid: true, + IsCA: isCA, + } + if issuer == nil { + issuer = template + issuerKey = priv + } + + derBytes, err := CreateCertificate(rand.Reader, template, issuer, priv.(crypto.Signer).Public(), issuerKey) + if err != nil { + return nil, nil, err + } + cert, err := ParseCertificate(derBytes) + if err != nil { + return nil, nil, err + } + + return cert, priv, nil +} + +func TestPathologicalChains(t *testing.T) { + if testing.Short() { + t.Skip("skipping generation of a long chains of certificates in short mode") + } + + // Test four pathological cases, where the intermediates in the chain have + // the same/different subjects and the same/different keys. This covers a + // number of cases where the chain building algorithm might be inefficient, + // such as when there are many intermediates with the same subject but + // different keys, many intermediates with the same key but different + // subjects, many intermediates with the same subject and key, or many + // intermediates with different subjects and keys. + // + // The worst case for our algorithm is when all of the intermediates share + // both subject and key, in which case all of the intermediates appear to + // have signed each other, causing us to see a large number of potential + // parents for each intermediate. + // + // All of these cases, Certificate.Verify should return errSignatureLimit. + // + // In all cases, don't have a root in the pool, so a valid chain cannot actually be built. + + for _, test := range []struct { + sameSubject bool + sameKey bool + }{ + {sameSubject: false, sameKey: false}, + {sameSubject: true, sameKey: false}, + {sameSubject: false, sameKey: true}, + {sameSubject: true, sameKey: true}, + } { + t.Run(fmt.Sprintf("sameSubject=%t,sameKey=%t", test.sameSubject, test.sameKey), func(t *testing.T) { + intermediates := NewCertPool() + + var intermediateKey crypto.PrivateKey + if test.sameKey { + var err error + intermediateKey, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatal(err) + } + } + + var leafSigner crypto.PrivateKey + var intermediate *Certificate + for i := range 100 { + cn := "Intermediate CA" + if !test.sameSubject { + cn += fmt.Sprintf(" #%d", i) + } + var err error + intermediate, leafSigner, err = generateCert(cn, true, intermediate, leafSigner, intermediateKey) + if err != nil { + t.Fatal(err) + } + intermediates.AddCert(intermediate) + } + + leaf, _, err := generateCert("Leaf", false, intermediate, leafSigner, nil) + if err != nil { + t.Fatal(err) + } + + start := time.Now() + _, err = leaf.Verify(VerifyOptions{ + Roots: NewCertPool(), + Intermediates: intermediates, + }) + t.Logf("verification took %v", time.Since(start)) + }) + } +} + +func TestSystemRootsError(t *testing.T) { + if runtime.GOOS == "windows" || runtime.GOOS == "darwin" || runtime.GOOS == "ios" { + t.Skip("Windows and darwin do not use (or support) systemRoots") + } + + defer func(oldSystemRoots *CertPool) { systemRoots = oldSystemRoots }(systemRootsPool()) + + opts := VerifyOptions{ + Intermediates: NewCertPool(), + DNSName: "www.google.com", + CurrentTime: time.Unix(1677615892, 0), + } + + if ok := opts.Intermediates.AppendCertsFromPEM([]byte(gtsIntermediate)); !ok { + t.Fatalf("failed to parse intermediate") + } + + leaf, err := certificateFromPEM(googleLeaf) + if err != nil { + t.Fatalf("failed to parse leaf: %v", err) + } + + systemRoots = nil + + _, err = leaf.Verify(opts) + if _, ok := err.(SystemRootsError); !ok { + t.Errorf("error was not SystemRootsError: %v", err) + } +} + +func TestSystemRootsErrorUnwrap(t *testing.T) { + var err1 = errors.New("err1") + err := SystemRootsError{Err: err1} + if !errors.Is(err, err1) { + t.Error("errors.Is failed, wanted success") + } +} + +func macosMajorVersion(t *testing.T) (int, error) { + cmd := testenv.Command(t, "sw_vers", "-productVersion") + out, err := cmd.Output() + if err != nil { + if ee, ok := err.(*exec.ExitError); ok && len(ee.Stderr) > 0 { + return 0, fmt.Errorf("%v: %v\n%s", cmd, err, ee.Stderr) + } + return 0, fmt.Errorf("%v: %v", cmd, err) + } + before, _, ok := strings.Cut(string(out), ".") + major, err := strconv.Atoi(before) + if !ok || err != nil { + return 0, fmt.Errorf("%v: unexpected output: %q", cmd, out) + } + + return major, nil +} + +func TestIssue51759(t *testing.T) { + if runtime.GOOS != "darwin" { + t.Skip("only affects darwin") + } + + testenv.MustHaveExecPath(t, "sw_vers") + if vers, err := macosMajorVersion(t); err != nil { + if builder := testenv.Builder(); builder != "" { + t.Fatalf("unable to determine macOS version: %s", err) + } else { + t.Skip("unable to determine macOS version") + } + } else if vers < 11 { + t.Skip("behavior only enforced in macOS 11 and after") + } + + // badCertData contains a cert that we parse as valid + // but that macOS SecCertificateCreateWithData rejects. + const badCertData = "0\x82\x01U0\x82\x01\a\xa0\x03\x02\x01\x02\x02\x01\x020\x05\x06\x03+ep0R1P0N\x06\x03U\x04\x03\x13Gderpkey8dc58100b2493614ee1692831a461f3f4dd3f9b3b088e244f887f81b4906ac260\x1e\x17\r220112235755Z\x17\r220313235755Z0R1P0N\x06\x03U\x04\x03\x13Gderpkey8dc58100b2493614ee1692831a461f3f4dd3f9b3b088e244f887f81b4906ac260*0\x05\x06\x03+ep\x03!\x00bA\xd8e\xadW\xcb\xefZ\x89\xb5\"\x1eR\x9d\xba\x0e:\x1042Q@\u007f\xbd\xfb{ks\x04\xd1£\x020\x000\x05\x06\x03+ep\x03A\x00[\xa7\x06y\x86(\x94\x97\x9eLwA\x00\x01x\xaa\xbc\xbd Ê]\n(΅!ف0\xf5\x9a%I\x19<\xffo\xf1\xeaaf@\xb1\xa7\xaf\xfd\xe9R\xc7\x0f\x8d&\xd5\xfc\x0f;Ϙ\x82\x84a\xbc\r" + badCert, err := ParseCertificate([]byte(badCertData)) + if err != nil { + t.Fatal(err) + } + + t.Run("leaf", func(t *testing.T) { + opts := VerifyOptions{} + expectedErr := "invalid leaf certificate" + _, err = badCert.Verify(opts) + if err == nil || err.Error() != expectedErr { + t.Fatalf("unexpected error: want %q, got %q", expectedErr, err) + } + }) + + goodCert, err := certificateFromPEM(googleLeaf) + if err != nil { + t.Fatal(err) + } + + t.Run("intermediate", func(t *testing.T) { + opts := VerifyOptions{ + Intermediates: NewCertPool(), + } + opts.Intermediates.AddCert(badCert) + expectedErr := "SecCertificateCreateWithData: invalid certificate" + _, err = goodCert.Verify(opts) + if err == nil || err.Error() != expectedErr { + t.Fatalf("unexpected error: want %q, got %q", expectedErr, err) + } + }) +} + +type trustGraphEdge struct { + Issuer string + Subject string + Type int + MutateTemplate func(*Certificate) + Constraint func([]*Certificate) error +} + +type rootDescription struct { + Subject string + MutateTemplate func(*Certificate) + Constraint func([]*Certificate) error +} + +type trustGraphDescription struct { + Roots []rootDescription + Leaf string + Graph []trustGraphEdge +} + +func genCertEdge(t *testing.T, subject string, key crypto.Signer, mutateTmpl func(*Certificate), certType int, issuer *Certificate, signer crypto.Signer) *Certificate { + t.Helper() + + serial, err := rand.Int(rand.Reader, big.NewInt(100)) + if err != nil { + t.Fatalf("failed to generate test serial: %s", err) + } + tmpl := &Certificate{ + SerialNumber: serial, + Subject: pkix.Name{CommonName: subject}, + NotBefore: time.Now().Add(-time.Hour), + NotAfter: time.Now().Add(time.Hour), + } + if certType == rootCertificate || certType == intermediateCertificate { + tmpl.IsCA, tmpl.BasicConstraintsValid = true, true + tmpl.KeyUsage = KeyUsageCertSign + } else if certType == leafCertificate { + tmpl.DNSNames = []string{"localhost"} + } + if mutateTmpl != nil { + mutateTmpl(tmpl) + } + + if certType == rootCertificate { + issuer = tmpl + signer = key + } + + d, err := CreateCertificate(rand.Reader, tmpl, issuer, key.Public(), signer) + if err != nil { + t.Fatalf("failed to generate test cert: %s", err) + } + c, err := ParseCertificate(d) + if err != nil { + t.Fatalf("failed to parse test cert: %s", err) + } + return c +} + +func buildTrustGraph(t *testing.T, d trustGraphDescription) (*CertPool, *CertPool, *Certificate) { + t.Helper() + + certs := map[string]*Certificate{} + keys := map[string]crypto.Signer{} + rootPool := NewCertPool() + for _, r := range d.Roots { + k, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatalf("failed to generate test key: %s", err) + } + root := genCertEdge(t, r.Subject, k, r.MutateTemplate, rootCertificate, nil, nil) + if r.Constraint != nil { + rootPool.AddCertWithConstraint(root, r.Constraint) + } else { + rootPool.AddCert(root) + } + certs[r.Subject] = root + keys[r.Subject] = k + } + + intermediatePool := NewCertPool() + var leaf *Certificate + for _, e := range d.Graph { + issuerCert, ok := certs[e.Issuer] + if !ok { + t.Fatalf("unknown issuer %s", e.Issuer) + } + issuerKey, ok := keys[e.Issuer] + if !ok { + t.Fatalf("unknown issuer %s", e.Issuer) + } + + k, ok := keys[e.Subject] + if !ok { + var err error + k, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatalf("failed to generate test key: %s", err) + } + keys[e.Subject] = k + } + cert := genCertEdge(t, e.Subject, k, e.MutateTemplate, e.Type, issuerCert, issuerKey) + certs[e.Subject] = cert + if e.Subject == d.Leaf { + leaf = cert + } else { + if e.Constraint != nil { + intermediatePool.AddCertWithConstraint(cert, e.Constraint) + } else { + intermediatePool.AddCert(cert) + } + } + } + + return rootPool, intermediatePool, leaf +} + +func chainsToStrings(chains [][]*Certificate) []string { + chainStrings := []string{} + for _, chain := range chains { + names := []string{} + for _, c := range chain { + names = append(names, c.Subject.String()) + } + chainStrings = append(chainStrings, strings.Join(names, " -> ")) + } + slices.Sort(chainStrings) + return chainStrings +} + +func TestPathBuilding(t *testing.T) { + tests := []struct { + name string + graph trustGraphDescription + expectedChains []string + expectedErr string + }{ + { + // Build the following graph from RFC 4158, figure 7 (note that in this graph edges represent + // certificates where the parent is the issuer and the child is the subject.) For the certificate + // C->B, use an unsupported ExtKeyUsage (in this case ExtKeyUsageCodeSigning) which invalidates + // the path Trust Anchor -> C -> B -> EE. The remaining valid paths should be: + // * Trust Anchor -> A -> B -> EE + // * Trust Anchor -> C -> A -> B -> EE + // + // +---------+ + // | Trust | + // | Anchor | + // +---------+ + // | | + // v v + // +---+ +---+ + // | A |<-->| C | + // +---+ +---+ + // | | + // | +---+ | + // +->| B |<-+ + // +---+ + // | + // v + // +----+ + // | EE | + // +----+ + name: "bad EKU", + graph: trustGraphDescription{ + Roots: []rootDescription{{Subject: "root"}}, + Leaf: "leaf", + Graph: []trustGraphEdge{ + { + Issuer: "root", + Subject: "inter a", + Type: intermediateCertificate, + }, + { + Issuer: "root", + Subject: "inter c", + Type: intermediateCertificate, + }, + { + Issuer: "inter c", + Subject: "inter a", + Type: intermediateCertificate, + }, + { + Issuer: "inter a", + Subject: "inter c", + Type: intermediateCertificate, + }, + { + Issuer: "inter c", + Subject: "inter b", + Type: intermediateCertificate, + MutateTemplate: func(t *Certificate) { + t.ExtKeyUsage = []ExtKeyUsage{ExtKeyUsageCodeSigning} + }, + }, + { + Issuer: "inter a", + Subject: "inter b", + Type: intermediateCertificate, + }, + { + Issuer: "inter b", + Subject: "leaf", + Type: leafCertificate, + }, + }, + }, + expectedChains: []string{ + "CN=leaf -> CN=inter b -> CN=inter a -> CN=inter c -> CN=root", + "CN=leaf -> CN=inter b -> CN=inter a -> CN=root", + }, + }, + { + // Build the following graph from RFC 4158, figure 7 (note that in this graph edges represent + // certificates where the parent is the issuer and the child is the subject.) For the certificate + // C->B, use a unconstrained SAN which invalidates the path Trust Anchor -> C -> B -> EE. The + // remaining valid paths should be: + // * Trust Anchor -> A -> B -> EE + // * Trust Anchor -> C -> A -> B -> EE + // + // +---------+ + // | Trust | + // | Anchor | + // +---------+ + // | | + // v v + // +---+ +---+ + // | A |<-->| C | + // +---+ +---+ + // | | + // | +---+ | + // +->| B |<-+ + // +---+ + // | + // v + // +----+ + // | EE | + // +----+ + name: "bad EKU", + graph: trustGraphDescription{ + Roots: []rootDescription{{Subject: "root"}}, + Leaf: "leaf", + Graph: []trustGraphEdge{ + { + Issuer: "root", + Subject: "inter a", + Type: intermediateCertificate, + }, + { + Issuer: "root", + Subject: "inter c", + Type: intermediateCertificate, + }, + { + Issuer: "inter c", + Subject: "inter a", + Type: intermediateCertificate, + }, + { + Issuer: "inter a", + Subject: "inter c", + Type: intermediateCertificate, + }, + { + Issuer: "inter c", + Subject: "inter b", + Type: intermediateCertificate, + MutateTemplate: func(t *Certificate) { + t.PermittedDNSDomains = []string{"good"} + t.DNSNames = []string{"bad"} + }, + }, + { + Issuer: "inter a", + Subject: "inter b", + Type: intermediateCertificate, + }, + { + Issuer: "inter b", + Subject: "leaf", + Type: leafCertificate, + }, + }, + }, + expectedChains: []string{ + "CN=leaf -> CN=inter b -> CN=inter a -> CN=inter c -> CN=root", + "CN=leaf -> CN=inter b -> CN=inter a -> CN=root", + }, + }, + { + // Build the following graph, we should find both paths: + // * Trust Anchor -> A -> C -> EE + // * Trust Anchor -> A -> B -> C -> EE + // + // +---------+ + // | Trust | + // | Anchor | + // +---------+ + // | + // v + // +---+ + // | A | + // +---+ + // | | + // | +----+ + // | v + // | +---+ + // | | B | + // | +---+ + // | | + // | +---v + // v v + // +---+ + // | C | + // +---+ + // | + // v + // +----+ + // | EE | + // +----+ + name: "all paths", + graph: trustGraphDescription{ + Roots: []rootDescription{{Subject: "root"}}, + Leaf: "leaf", + Graph: []trustGraphEdge{ + { + Issuer: "root", + Subject: "inter a", + Type: intermediateCertificate, + }, + { + Issuer: "inter a", + Subject: "inter b", + Type: intermediateCertificate, + }, + { + Issuer: "inter a", + Subject: "inter c", + Type: intermediateCertificate, + }, + { + Issuer: "inter b", + Subject: "inter c", + Type: intermediateCertificate, + }, + { + Issuer: "inter c", + Subject: "leaf", + Type: leafCertificate, + }, + }, + }, + expectedChains: []string{ + "CN=leaf -> CN=inter c -> CN=inter a -> CN=root", + "CN=leaf -> CN=inter c -> CN=inter b -> CN=inter a -> CN=root", + }, + }, + { + // Build the following graph, which contains a cross-signature loop + // (A and C cross sign each other). Paths that include the A -> C -> A + // (and vice versa) loop should be ignored, resulting in the paths: + // * Trust Anchor -> A -> B -> EE + // * Trust Anchor -> C -> B -> EE + // * Trust Anchor -> A -> C -> B -> EE + // * Trust Anchor -> C -> A -> B -> EE + // + // +---------+ + // | Trust | + // | Anchor | + // +---------+ + // | | + // v v + // +---+ +---+ + // | A |<-->| C | + // +---+ +---+ + // | | + // | +---+ | + // +->| B |<-+ + // +---+ + // | + // v + // +----+ + // | EE | + // +----+ + name: "ignore cross-sig loops", + graph: trustGraphDescription{ + Roots: []rootDescription{{Subject: "root"}}, + Leaf: "leaf", + Graph: []trustGraphEdge{ + { + Issuer: "root", + Subject: "inter a", + Type: intermediateCertificate, + }, + { + Issuer: "root", + Subject: "inter c", + Type: intermediateCertificate, + }, + { + Issuer: "inter c", + Subject: "inter a", + Type: intermediateCertificate, + }, + { + Issuer: "inter a", + Subject: "inter c", + Type: intermediateCertificate, + }, + { + Issuer: "inter c", + Subject: "inter b", + Type: intermediateCertificate, + }, + { + Issuer: "inter a", + Subject: "inter b", + Type: intermediateCertificate, + }, + { + Issuer: "inter b", + Subject: "leaf", + Type: leafCertificate, + }, + }, + }, + expectedChains: []string{ + "CN=leaf -> CN=inter b -> CN=inter a -> CN=inter c -> CN=root", + "CN=leaf -> CN=inter b -> CN=inter a -> CN=root", + "CN=leaf -> CN=inter b -> CN=inter c -> CN=inter a -> CN=root", + "CN=leaf -> CN=inter b -> CN=inter c -> CN=root", + }, + }, + { + // Build a simple two node graph, where the leaf is directly issued from + // the root and both certificates have matching subject and public key, but + // the leaf has SANs. + name: "leaf with same subject, key, as parent but with SAN", + graph: trustGraphDescription{ + Roots: []rootDescription{{Subject: "root"}}, + Leaf: "root", + Graph: []trustGraphEdge{ + { + Issuer: "root", + Subject: "root", + Type: leafCertificate, + MutateTemplate: func(c *Certificate) { + c.DNSNames = []string{"localhost"} + }, + }, + }, + }, + expectedChains: []string{ + "CN=root -> CN=root", + }, + }, + { + // Build a basic graph with two paths from leaf to root, but the path passing + // through C should be ignored, because it has invalid EKU nesting. + name: "ignore invalid EKU path", + graph: trustGraphDescription{ + Roots: []rootDescription{{Subject: "root"}}, + Leaf: "leaf", + Graph: []trustGraphEdge{ + { + Issuer: "root", + Subject: "inter a", + Type: intermediateCertificate, + }, + { + Issuer: "root", + Subject: "inter c", + Type: intermediateCertificate, + }, + { + Issuer: "inter c", + Subject: "inter b", + Type: intermediateCertificate, + MutateTemplate: func(t *Certificate) { + t.ExtKeyUsage = []ExtKeyUsage{ExtKeyUsageCodeSigning} + }, + }, + { + Issuer: "inter a", + Subject: "inter b", + Type: intermediateCertificate, + MutateTemplate: func(t *Certificate) { + t.ExtKeyUsage = []ExtKeyUsage{ExtKeyUsageServerAuth} + }, + }, + { + Issuer: "inter b", + Subject: "leaf", + Type: leafCertificate, + MutateTemplate: func(t *Certificate) { + t.ExtKeyUsage = []ExtKeyUsage{ExtKeyUsageServerAuth} + }, + }, + }, + }, + expectedChains: []string{ + "CN=leaf -> CN=inter b -> CN=inter a -> CN=root", + }, + }, + { + // A name constraint on the root should apply to any names that appear + // on the intermediate, meaning there is no valid chain. + name: "constrained root, invalid intermediate", + graph: trustGraphDescription{ + Roots: []rootDescription{ + { + Subject: "root", + MutateTemplate: func(t *Certificate) { + t.PermittedDNSDomains = []string{"example.com"} + }, + }, + }, + Leaf: "leaf", + Graph: []trustGraphEdge{ + { + Issuer: "root", + Subject: "inter", + Type: intermediateCertificate, + MutateTemplate: func(t *Certificate) { + t.DNSNames = []string{"beep.com"} + }, + }, + { + Issuer: "inter", + Subject: "leaf", + Type: leafCertificate, + MutateTemplate: func(t *Certificate) { + t.DNSNames = []string{"www.example.com"} + }, + }, + }, + }, + expectedErr: "x509: a root or intermediate certificate is not authorized to sign for this name: DNS name \"beep.com\" is not permitted by any constraint", + }, + { + // A name constraint on the intermediate does not apply to the intermediate + // itself, so this is a valid chain. + name: "constrained intermediate, non-matching SAN", + graph: trustGraphDescription{ + Roots: []rootDescription{{Subject: "root"}}, + Leaf: "leaf", + Graph: []trustGraphEdge{ + { + Issuer: "root", + Subject: "inter", + Type: intermediateCertificate, + MutateTemplate: func(t *Certificate) { + t.DNSNames = []string{"beep.com"} + t.PermittedDNSDomains = []string{"example.com"} + }, + }, + { + Issuer: "inter", + Subject: "leaf", + Type: leafCertificate, + MutateTemplate: func(t *Certificate) { + t.DNSNames = []string{"www.example.com"} + }, + }, + }, + }, + expectedChains: []string{"CN=leaf -> CN=inter -> CN=root"}, + }, + { + // A code constraint on the root, applying to one of two intermediates in the graph, should + // result in only one valid chain. + name: "code constrained root, two paths, one valid", + graph: trustGraphDescription{ + Roots: []rootDescription{{Subject: "root", Constraint: func(chain []*Certificate) error { + for _, c := range chain { + if c.Subject.CommonName == "inter a" { + return errors.New("bad") + } + } + return nil + }}}, + Leaf: "leaf", + Graph: []trustGraphEdge{ + { + Issuer: "root", + Subject: "inter a", + Type: intermediateCertificate, + }, + { + Issuer: "root", + Subject: "inter b", + Type: intermediateCertificate, + }, + { + Issuer: "inter a", + Subject: "inter c", + Type: intermediateCertificate, + }, + { + Issuer: "inter b", + Subject: "inter c", + Type: intermediateCertificate, + }, + { + Issuer: "inter c", + Subject: "leaf", + Type: leafCertificate, + }, + }, + }, + expectedChains: []string{"CN=leaf -> CN=inter c -> CN=inter b -> CN=root"}, + }, + { + // A code constraint on the root, applying to the only path, should result in an error. + name: "code constrained root, one invalid path", + graph: trustGraphDescription{ + Roots: []rootDescription{{Subject: "root", Constraint: func(chain []*Certificate) error { + for _, c := range chain { + if c.Subject.CommonName == "leaf" { + return errors.New("bad") + } + } + return nil + }}}, + Leaf: "leaf", + Graph: []trustGraphEdge{ + { + Issuer: "root", + Subject: "inter", + Type: intermediateCertificate, + }, + { + Issuer: "inter", + Subject: "leaf", + Type: leafCertificate, + }, + }, + }, + expectedErr: "x509: certificate signed by unknown authority (possibly because of \"bad\" while trying to verify candidate authority certificate \"root\")", + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + roots, intermediates, leaf := buildTrustGraph(t, tc.graph) + chains, err := leaf.Verify(VerifyOptions{ + Roots: roots, + Intermediates: intermediates, + }) + if err != nil && err.Error() != tc.expectedErr { + t.Fatalf("unexpected error: got %q, want %q", err, tc.expectedErr) + } + if len(tc.expectedChains) == 0 { + return + } + gotChains := chainsToStrings(chains) + if !slices.Equal(gotChains, tc.expectedChains) { + t.Errorf("unexpected chains returned:\ngot:\n\t%s\nwant:\n\t%s", strings.Join(gotChains, "\n\t"), strings.Join(tc.expectedChains, "\n\t")) + } + }) + } +} + +func TestEKUEnforcement(t *testing.T) { + type ekuDescs struct { + EKUs []ExtKeyUsage + Unknown []asn1.ObjectIdentifier + } + tests := []struct { + name string + root ekuDescs + inters []ekuDescs + leaf ekuDescs + verifyEKUs []ExtKeyUsage + err string + }{ + { + name: "valid, full chain", + root: ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}}, + inters: []ekuDescs{ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}}}, + leaf: ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}}, + verifyEKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}, + }, + { + name: "valid, only leaf has EKU", + root: ekuDescs{}, + inters: []ekuDescs{ekuDescs{}}, + leaf: ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}}, + verifyEKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}, + }, + { + name: "invalid, serverAuth not nested", + root: ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageClientAuth}}, + inters: []ekuDescs{ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageServerAuth, ExtKeyUsageClientAuth}}}, + leaf: ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageServerAuth, ExtKeyUsageClientAuth}}, + verifyEKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}, + err: "x509: certificate specifies an incompatible key usage", + }, + { + name: "valid, two EKUs, one path", + root: ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}}, + inters: []ekuDescs{ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageServerAuth, ExtKeyUsageClientAuth}}}, + leaf: ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageServerAuth, ExtKeyUsageClientAuth}}, + verifyEKUs: []ExtKeyUsage{ExtKeyUsageServerAuth, ExtKeyUsageClientAuth}, + }, + { + name: "invalid, ladder", + root: ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}}, + inters: []ekuDescs{ + ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageServerAuth, ExtKeyUsageClientAuth}}, + ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageClientAuth}}, + ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageServerAuth, ExtKeyUsageClientAuth}}, + ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}}, + }, + leaf: ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}}, + verifyEKUs: []ExtKeyUsage{ExtKeyUsageServerAuth, ExtKeyUsageClientAuth}, + err: "x509: certificate specifies an incompatible key usage", + }, + { + name: "valid, intermediate has no EKU", + root: ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}}, + inters: []ekuDescs{ekuDescs{}}, + leaf: ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}}, + verifyEKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}, + }, + { + name: "invalid, intermediate has no EKU and no nested path", + root: ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageClientAuth}}, + inters: []ekuDescs{ekuDescs{}}, + leaf: ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}}, + verifyEKUs: []ExtKeyUsage{ExtKeyUsageServerAuth, ExtKeyUsageClientAuth}, + err: "x509: certificate specifies an incompatible key usage", + }, + { + name: "invalid, intermediate has unknown EKU", + root: ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}}, + inters: []ekuDescs{ekuDescs{Unknown: []asn1.ObjectIdentifier{{1, 2, 3}}}}, + leaf: ekuDescs{EKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}}, + verifyEKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}, + err: "x509: certificate specifies an incompatible key usage", + }, + } + + k, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatalf("failed to generate test key: %s", err) + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + rootPool := NewCertPool() + root := genCertEdge(t, "root", k, func(c *Certificate) { + c.ExtKeyUsage = tc.root.EKUs + c.UnknownExtKeyUsage = tc.root.Unknown + }, rootCertificate, nil, k) + rootPool.AddCert(root) + + parent := root + interPool := NewCertPool() + for i, interEKUs := range tc.inters { + inter := genCertEdge(t, fmt.Sprintf("inter %d", i), k, func(c *Certificate) { + c.ExtKeyUsage = interEKUs.EKUs + c.UnknownExtKeyUsage = interEKUs.Unknown + }, intermediateCertificate, parent, k) + interPool.AddCert(inter) + parent = inter + } + + leaf := genCertEdge(t, "leaf", k, func(c *Certificate) { + c.ExtKeyUsage = tc.leaf.EKUs + c.UnknownExtKeyUsage = tc.leaf.Unknown + }, intermediateCertificate, parent, k) + + _, err := leaf.Verify(VerifyOptions{Roots: rootPool, Intermediates: interPool, KeyUsages: tc.verifyEKUs}) + if err == nil && tc.err != "" { + t.Errorf("expected error") + } else if err != nil && err.Error() != tc.err { + t.Errorf("unexpected error: got %q, want %q", err.Error(), tc.err) + } + }) + } +} + +func TestVerifyEKURootAsLeaf(t *testing.T) { + k, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatalf("failed to generate key: %s", err) + } + + for _, tc := range []struct { + rootEKUs []ExtKeyUsage + verifyEKUs []ExtKeyUsage + succeed bool + }{ + { + verifyEKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}, + succeed: true, + }, + { + rootEKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}, + succeed: true, + }, + { + rootEKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}, + verifyEKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}, + succeed: true, + }, + { + rootEKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}, + verifyEKUs: []ExtKeyUsage{ExtKeyUsageAny}, + succeed: true, + }, + { + rootEKUs: []ExtKeyUsage{ExtKeyUsageAny}, + verifyEKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}, + succeed: true, + }, + { + rootEKUs: []ExtKeyUsage{ExtKeyUsageClientAuth}, + verifyEKUs: []ExtKeyUsage{ExtKeyUsageServerAuth}, + succeed: false, + }, + } { + t.Run(fmt.Sprintf("root EKUs %#v, verify EKUs %#v", tc.rootEKUs, tc.verifyEKUs), func(t *testing.T) { + tmpl := &Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{CommonName: "root"}, + NotBefore: time.Now().Add(-time.Hour), + NotAfter: time.Now().Add(time.Hour), + DNSNames: []string{"localhost"}, + ExtKeyUsage: tc.rootEKUs, + } + rootDER, err := CreateCertificate(rand.Reader, tmpl, tmpl, k.Public(), k) + if err != nil { + t.Fatalf("failed to create certificate: %s", err) + } + root, err := ParseCertificate(rootDER) + if err != nil { + t.Fatalf("failed to parse certificate: %s", err) + } + roots := NewCertPool() + roots.AddCert(root) + + _, err = root.Verify(VerifyOptions{Roots: roots, KeyUsages: tc.verifyEKUs}) + if err == nil && !tc.succeed { + t.Error("verification succeed") + } else if err != nil && tc.succeed { + t.Errorf("verification failed: %q", err) + } + }) + } + +} + +func TestVerifyNilPubKey(t *testing.T) { + c := &Certificate{ + RawIssuer: []byte{1, 2, 3}, + AuthorityKeyId: []byte{1, 2, 3}, + } + opts := &VerifyOptions{} + opts.Roots = NewCertPool() + r := &Certificate{ + RawSubject: []byte{1, 2, 3}, + SubjectKeyId: []byte{1, 2, 3}, + } + opts.Roots.AddCert(r) + + _, err := c.buildChains([]*Certificate{r}, nil, opts) + if _, ok := err.(UnknownAuthorityError); !ok { + t.Fatalf("buildChains returned unexpected error, got: %v, want %v", err, UnknownAuthorityError{}) + } +} + +func TestVerifyBareWildcard(t *testing.T) { + k, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatalf("failed to generate key: %s", err) + } + tmpl := &Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{CommonName: "test"}, + NotBefore: time.Now().Add(-time.Hour), + NotAfter: time.Now().Add(time.Hour), + DNSNames: []string{"*"}, + } + cDER, err := CreateCertificate(rand.Reader, tmpl, tmpl, k.Public(), k) + if err != nil { + t.Fatalf("failed to create certificate: %s", err) + } + c, err := ParseCertificate(cDER) + if err != nil { + t.Fatalf("failed to parse certificate: %s", err) + } + + if err := c.VerifyHostname("label"); err == nil { + t.Fatalf("VerifyHostname unexpected success with bare wildcard SAN") + } +} + +func TestPoliciesValid(t *testing.T) { + // These test cases, the comments, and the certificates they rely on, are + // stolen from BoringSSL [0]. We skip the tests which involve certificate + // parsing as part of the verification process. Those tests are in + // TestParsePolicies. + // + // [0] https://boringssl.googlesource.com/boringssl/+/264f4f7a958af6c4ccb04662e302a99dfa7c5b85/crypto/x509/x509_test.cc#5913 + + testOID1 := mustNewOIDFromInts([]uint64{1, 2, 840, 113554, 4, 1, 72585, 2, 1}) + testOID2 := mustNewOIDFromInts([]uint64{1, 2, 840, 113554, 4, 1, 72585, 2, 2}) + testOID3 := mustNewOIDFromInts([]uint64{1, 2, 840, 113554, 4, 1, 72585, 2, 3}) + testOID4 := mustNewOIDFromInts([]uint64{1, 2, 840, 113554, 4, 1, 72585, 2, 4}) + testOID5 := mustNewOIDFromInts([]uint64{1, 2, 840, 113554, 4, 1, 72585, 2, 5}) + + loadTestCert := func(t *testing.T, path string) *Certificate { + b, err := os.ReadFile(path) + if err != nil { + t.Fatal(err) + } + p, _ := pem.Decode(b) + c, err := ParseCertificate(p.Bytes) + if err != nil { + t.Fatal(err) + } + return c + } + + root := loadTestCert(t, "testdata/policy_root.pem") + root_cross_inhibit_mapping := loadTestCert(t, "testdata/policy_root_cross_inhibit_mapping.pem") + root2 := loadTestCert(t, "testdata/policy_root2.pem") + intermediate := loadTestCert(t, "testdata/policy_intermediate.pem") + intermediate_any := loadTestCert(t, "testdata/policy_intermediate_any.pem") + intermediate_mapped := loadTestCert(t, "testdata/policy_intermediate_mapped.pem") + intermediate_mapped_any := loadTestCert(t, "testdata/policy_intermediate_mapped_any.pem") + intermediate_mapped_oid3 := loadTestCert(t, "testdata/policy_intermediate_mapped_oid3.pem") + intermediate_require := loadTestCert(t, "testdata/policy_intermediate_require.pem") + intermediate_require1 := loadTestCert(t, "testdata/policy_intermediate_require1.pem") + intermediate_require2 := loadTestCert(t, "testdata/policy_intermediate_require2.pem") + intermediate_require_no_policies := loadTestCert(t, "testdata/policy_intermediate_require_no_policies.pem") + leaf := loadTestCert(t, "testdata/policy_leaf.pem") + leaf_any := loadTestCert(t, "testdata/policy_leaf_any.pem") + leaf_none := loadTestCert(t, "testdata/policy_leaf_none.pem") + leaf_oid1 := loadTestCert(t, "testdata/policy_leaf_oid1.pem") + leaf_oid2 := loadTestCert(t, "testdata/policy_leaf_oid2.pem") + leaf_oid3 := loadTestCert(t, "testdata/policy_leaf_oid3.pem") + leaf_oid4 := loadTestCert(t, "testdata/policy_leaf_oid4.pem") + leaf_oid5 := loadTestCert(t, "testdata/policy_leaf_oid5.pem") + leaf_require := loadTestCert(t, "testdata/policy_leaf_require.pem") + leaf_require1 := loadTestCert(t, "testdata/policy_leaf_require1.pem") + + type testCase struct { + chain []*Certificate + policies []OID + requireExplicitPolicy bool + inhibitPolicyMapping bool + inhibitAnyPolicy bool + valid bool + } + + tests := []testCase{ + // The chain is good for |oid1| and |oid2|, but not |oid3|. + { + chain: []*Certificate{leaf, intermediate, root}, + requireExplicitPolicy: true, + valid: true, + }, + { + chain: []*Certificate{leaf, intermediate, root}, + policies: []OID{testOID1}, + requireExplicitPolicy: true, + valid: true, + }, + { + chain: []*Certificate{leaf, intermediate, root}, + policies: []OID{testOID2}, + requireExplicitPolicy: true, + valid: true, + }, + { + chain: []*Certificate{leaf, intermediate, root}, + policies: []OID{testOID3}, + requireExplicitPolicy: true, + valid: false, + }, + { + chain: []*Certificate{leaf, intermediate, root}, + policies: []OID{testOID1, testOID2}, + requireExplicitPolicy: true, + valid: true, + }, + { + chain: []*Certificate{leaf, intermediate, root}, + policies: []OID{testOID1, testOID3}, + requireExplicitPolicy: true, + valid: true, + }, + // Without |X509_V_FLAG_EXPLICIT_POLICY|, the policy tree is built and + // intersected with user-specified policies, but it is not required to result + // in any valid policies. + { + chain: []*Certificate{leaf, intermediate, root}, + policies: []OID{testOID1}, + valid: true, + }, + { + chain: []*Certificate{leaf, intermediate, root}, + policies: []OID{testOID3}, + valid: true, + }, + // However, a CA with policy constraints can require an explicit policy. + { + chain: []*Certificate{leaf, intermediate_require, root}, + policies: []OID{testOID1}, + valid: true, + }, + { + chain: []*Certificate{leaf, intermediate_require, root}, + policies: []OID{testOID3}, + valid: false, + }, + // requireExplicitPolicy applies even if the application does not configure a + // user-initial-policy-set. If the validation results in no policies, the + // chain is invalid. + { + chain: []*Certificate{leaf_none, intermediate_require, root}, + requireExplicitPolicy: true, + valid: false, + }, + // A leaf can also set requireExplicitPolicy. + { + chain: []*Certificate{leaf_require, intermediate, root}, + valid: true, + }, + { + chain: []*Certificate{leaf_require, intermediate, root}, + policies: []OID{testOID1}, + valid: true, + }, + { + chain: []*Certificate{leaf_require, intermediate, root}, + policies: []OID{testOID3}, + valid: false, + }, + // requireExplicitPolicy is a count of certificates to skip. If the value is + // not zero by the end of the chain, it doesn't count. + { + chain: []*Certificate{leaf, intermediate_require1, root}, + policies: []OID{testOID3}, + valid: false, + }, + { + chain: []*Certificate{leaf, intermediate_require2, root}, + policies: []OID{testOID3}, + valid: true, + }, + { + chain: []*Certificate{leaf_require1, intermediate, root}, + policies: []OID{testOID3}, + valid: true, + }, + // If multiple certificates specify the constraint, the more constrained value + // wins. + { + chain: []*Certificate{leaf_require1, intermediate_require1, root}, + policies: []OID{testOID3}, + valid: false, + }, + { + chain: []*Certificate{leaf_require, intermediate_require2, root}, + policies: []OID{testOID3}, + valid: false, + }, + // An intermediate that requires an explicit policy, but then specifies no + // policies should fail verification as a result. + { + chain: []*Certificate{leaf, intermediate_require_no_policies, root}, + policies: []OID{testOID1}, + valid: false, + }, + // A constrained intermediate's policy extension has a duplicate policy, which + // is invalid. + // { + // chain: []*Certificate{leaf, intermediate_require_duplicate, root}, + // policies: []OID{testOID1}, + // valid: false, + // }, + // The leaf asserts anyPolicy, but the intermediate does not. The resulting + // valid policies are the intersection. + { + chain: []*Certificate{leaf_any, intermediate, root}, + policies: []OID{testOID1}, + requireExplicitPolicy: true, + valid: true, + }, + { + chain: []*Certificate{leaf_any, intermediate, root}, + policies: []OID{testOID3}, + requireExplicitPolicy: true, + valid: false, + }, + // The intermediate asserts anyPolicy, but the leaf does not. The resulting + // valid policies are the intersection. + { + chain: []*Certificate{leaf, intermediate_any, root}, + policies: []OID{testOID1}, + requireExplicitPolicy: true, + valid: true, + }, + { + chain: []*Certificate{leaf, intermediate_any, root}, + policies: []OID{testOID3}, + requireExplicitPolicy: true, + valid: false, + }, + // Both assert anyPolicy. All policies are valid. + { + chain: []*Certificate{leaf_any, intermediate_any, root}, + policies: []OID{testOID1}, + requireExplicitPolicy: true, + valid: true, + }, + { + chain: []*Certificate{leaf_any, intermediate_any, root}, + policies: []OID{testOID3}, + requireExplicitPolicy: true, + valid: true, + }, + // With just a trust anchor, policy checking silently succeeds. + { + chain: []*Certificate{root}, + policies: []OID{testOID1}, + requireExplicitPolicy: true, + valid: true, + }, + // Although |intermediate_mapped_oid3| contains many mappings, it only accepts + // OID3. Nodes should not be created for the other mappings. + { + chain: []*Certificate{leaf_oid1, intermediate_mapped_oid3, root}, + policies: []OID{testOID3}, + requireExplicitPolicy: true, + valid: true, + }, + { + chain: []*Certificate{leaf_oid4, intermediate_mapped_oid3, root}, + policies: []OID{testOID4}, + requireExplicitPolicy: true, + valid: false, + }, + // Policy mapping can be inhibited, either by the caller or a certificate in + // the chain, in which case mapped policies are unassertable (apart from some + // anyPolicy edge cases). + { + chain: []*Certificate{leaf_oid1, intermediate_mapped_oid3, root}, + policies: []OID{testOID3}, + requireExplicitPolicy: true, + inhibitPolicyMapping: true, + valid: false, + }, + { + chain: []*Certificate{leaf_oid1, intermediate_mapped_oid3, root_cross_inhibit_mapping, root2}, + policies: []OID{testOID3}, + requireExplicitPolicy: true, + valid: false, + }, + } + + for _, useAny := range []bool{false, true} { + var intermediate *Certificate + if useAny { + intermediate = intermediate_mapped_any + } else { + intermediate = intermediate_mapped + } + extraTests := []testCase{ + // OID3 is mapped to {OID1, OID2}, which means OID1 and OID2 (or both) are + // acceptable for OID3. + { + chain: []*Certificate{leaf, intermediate, root}, + policies: []OID{testOID3}, + requireExplicitPolicy: true, + valid: true, + }, + { + chain: []*Certificate{leaf_oid1, intermediate, root}, + policies: []OID{testOID3}, + requireExplicitPolicy: true, + valid: true, + }, + { + chain: []*Certificate{leaf_oid2, intermediate, root}, + policies: []OID{testOID3}, + requireExplicitPolicy: true, + valid: true, + }, + // If the intermediate's policies were anyPolicy, OID3 at the leaf, despite + // being mapped, is still acceptable as OID3 at the root. Despite the OID3 + // having expected_policy_set = {OID1, OID2}, it can match the anyPolicy + // node instead. + // + // If the intermediate's policies listed OIDs explicitly, OID3 at the leaf + // is not acceptable as OID3 at the root. OID3 has expected_polciy_set = + // {OID1, OID2} and no other node allows OID3. + { + chain: []*Certificate{leaf_oid3, intermediate, root}, + policies: []OID{testOID3}, + requireExplicitPolicy: true, + valid: useAny, + }, + // If the intermediate's policies were anyPolicy, OID1 at the leaf is no + // longer acceptable as OID1 at the root because policies only match + // anyPolicy when they match no other policy. + // + // If the intermediate's policies listed OIDs explicitly, OID1 at the leaf + // is acceptable as OID1 at the root because it will match both OID1 and + // OID3 (mapped) policies. + { + chain: []*Certificate{leaf_oid1, intermediate, root}, + policies: []OID{testOID1}, + requireExplicitPolicy: true, + valid: !useAny, + }, + // All pairs of OID4 and OID5 are mapped together, so either can stand for + // the other. + { + chain: []*Certificate{leaf_oid4, intermediate, root}, + policies: []OID{testOID4}, + requireExplicitPolicy: true, + valid: true, + }, + { + chain: []*Certificate{leaf_oid4, intermediate, root}, + policies: []OID{testOID5}, + requireExplicitPolicy: true, + valid: true, + }, + { + chain: []*Certificate{leaf_oid5, intermediate, root}, + policies: []OID{testOID4}, + requireExplicitPolicy: true, + valid: true, + }, + { + chain: []*Certificate{leaf_oid5, intermediate, root}, + policies: []OID{testOID5}, + requireExplicitPolicy: true, + valid: true, + }, + { + chain: []*Certificate{leaf_oid4, intermediate, root}, + policies: []OID{testOID4, testOID5}, + requireExplicitPolicy: true, + valid: true, + }, + } + tests = append(tests, extraTests...) + } + + for i, tc := range tests { + t.Run(fmt.Sprint(i), func(t *testing.T) { + valid := policiesValid(tc.chain, VerifyOptions{ + CertificatePolicies: tc.policies, + requireExplicitPolicy: tc.requireExplicitPolicy, + inhibitPolicyMapping: tc.inhibitPolicyMapping, + inhibitAnyPolicy: tc.inhibitAnyPolicy, + }) + if valid != tc.valid { + t.Errorf("policiesValid: got %t, want %t", valid, tc.valid) + } + }) + } +} + +func TestInvalidPolicyWithAnyKeyUsage(t *testing.T) { + loadTestCert := func(t *testing.T, path string) *Certificate { + b, err := os.ReadFile(path) + if err != nil { + t.Fatal(err) + } + p, _ := pem.Decode(b) + c, err := ParseCertificate(p.Bytes) + if err != nil { + t.Fatal(err) + } + return c + } + + testOID3 := mustNewOIDFromInts([]uint64{1, 2, 840, 113554, 4, 1, 72585, 2, 3}) + root, intermediate, leaf := loadTestCert(t, "testdata/policy_root.pem"), loadTestCert(t, "testdata/policy_intermediate_require.pem"), loadTestCert(t, "testdata/policy_leaf.pem") + + expectedErr := "x509: no valid chains built: 1 candidate chains with invalid policies" + + roots, intermediates := NewCertPool(), NewCertPool() + roots.AddCert(root) + intermediates.AddCert(intermediate) + + _, err := leaf.Verify(VerifyOptions{ + Roots: roots, + Intermediates: intermediates, + KeyUsages: []ExtKeyUsage{ExtKeyUsageAny}, + CertificatePolicies: []OID{testOID3}, + }) + if err == nil { + t.Fatal("unexpected success, invalid policy shouldn't be bypassed by passing VerifyOptions.KeyUsages with ExtKeyUsageAny") + } else if err.Error() != expectedErr { + t.Fatalf("unexpected error, got %q, want %q", err, expectedErr) + } +} + +func TestCertificateChainSignedByECDSA(t *testing.T) { + caKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatal(err) + } + root := &Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{CommonName: "X"}, + NotBefore: time.Now().Add(-time.Hour), + NotAfter: time.Now().Add(365 * 24 * time.Hour), + IsCA: true, + KeyUsage: KeyUsageCertSign | KeyUsageCRLSign, + BasicConstraintsValid: true, + } + caDER, err := CreateCertificate(rand.Reader, root, root, &caKey.PublicKey, caKey) + if err != nil { + t.Fatal(err) + } + root, err = ParseCertificate(caDER) + if err != nil { + t.Fatal(err) + } + + leafKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + leaf := &Certificate{ + SerialNumber: big.NewInt(42), + Subject: pkix.Name{CommonName: "leaf"}, + NotBefore: time.Now().Add(-10 * time.Minute), + NotAfter: time.Now().Add(24 * time.Hour), + KeyUsage: KeyUsageDigitalSignature, + ExtKeyUsage: []ExtKeyUsage{ExtKeyUsageServerAuth}, + BasicConstraintsValid: true, + } + leafDER, err := CreateCertificate(rand.Reader, leaf, root, &leafKey.PublicKey, caKey) + if err != nil { + t.Fatal(err) + } + leaf, err = ParseCertificate(leafDER) + if err != nil { + t.Fatal(err) + } + + inter, err := ParseCertificate(dsaSelfSignedCNX(t)) + if err != nil { + t.Fatal(err) + } + + inters := NewCertPool() + inters.AddCert(root) + inters.AddCert(inter) + + wantErr := "certificate signed by unknown authority" + _, err = leaf.Verify(VerifyOptions{Intermediates: inters, Roots: NewCertPool()}) + if !strings.Contains(err.Error(), wantErr) { + t.Errorf("got %v, want %q", err, wantErr) + } +} + +// dsaSelfSignedCNX produces DER-encoded +// certificate with the properties: +// +// Subject=Issuer=CN=X +// DSA SPKI +// Matching inner/outer signature OIDs +// Dummy ECDSA signature +func dsaSelfSignedCNX(t *testing.T) []byte { + t.Helper() + var params dsa.Parameters + if err := dsa.GenerateParameters(¶ms, rand.Reader, dsa.L1024N160); err != nil { + t.Fatal(err) + } + + var dsaPriv dsa.PrivateKey + dsaPriv.Parameters = params + if err := dsa.GenerateKey(&dsaPriv, rand.Reader); err != nil { + t.Fatal(err) + } + dsaPub := &dsaPriv.PublicKey + + type dsaParams struct{ P, Q, G *big.Int } + paramDER, err := asn1.Marshal(dsaParams{dsaPub.P, dsaPub.Q, dsaPub.G}) + if err != nil { + t.Fatal(err) + } + yDER, err := asn1.Marshal(dsaPub.Y) + if err != nil { + t.Fatal(err) + } + + spki := publicKeyInfo{ + Algorithm: pkix.AlgorithmIdentifier{ + Algorithm: oidPublicKeyDSA, + Parameters: asn1.RawValue{FullBytes: paramDER}, + }, + PublicKey: asn1.BitString{Bytes: yDER, BitLength: 8 * len(yDER)}, + } + + rdn := pkix.Name{CommonName: "X"}.ToRDNSequence() + b, err := asn1.Marshal(rdn) + if err != nil { + t.Fatal(err) + } + rawName := asn1.RawValue{FullBytes: b} + + algoIdent := pkix.AlgorithmIdentifier{Algorithm: oidSignatureDSAWithSHA256} + tbs := tbsCertificate{ + Version: 0, + SerialNumber: big.NewInt(1002), + SignatureAlgorithm: algoIdent, + Issuer: rawName, + Validity: validity{NotBefore: time.Now().Add(-time.Hour), NotAfter: time.Now().Add(24 * time.Hour)}, + Subject: rawName, + PublicKey: spki, + } + c := certificate{ + TBSCertificate: tbs, + SignatureAlgorithm: algoIdent, + SignatureValue: asn1.BitString{Bytes: []byte{0}, BitLength: 8}, + } + dsaDER, err := asn1.Marshal(c) + if err != nil { + t.Fatal(err) + } + return dsaDER +} diff --git a/go/src/crypto/x509/x509.go b/go/src/crypto/x509/x509.go new file mode 100644 index 0000000000000000000000000000000000000000..7953b615f50d564cfbcd029afc7606eeff6355a1 --- /dev/null +++ b/go/src/crypto/x509/x509.go @@ -0,0 +1,2582 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package x509 implements a subset of the X.509 standard. +// +// It allows parsing and generating certificates, certificate signing +// requests, certificate revocation lists, and encoded public and private keys. +// It provides a certificate verifier, complete with a chain builder. +// +// The package targets the X.509 technical profile defined by the IETF (RFC +// 2459/3280/5280), and as further restricted by the CA/Browser Forum Baseline +// Requirements. There is minimal support for features outside of these +// profiles, as the primary goal of the package is to provide compatibility +// with the publicly trusted TLS certificate ecosystem and its policies and +// constraints. +// +// On macOS and Windows, certificate verification is handled by system APIs, but +// the package aims to apply consistent validation rules across operating +// systems. +package x509 + +import ( + "bytes" + "crypto" + "crypto/ecdh" + "crypto/ecdsa" + "crypto/ed25519" + "crypto/elliptic" + "crypto/rsa" + "crypto/sha1" + "crypto/sha256" + "crypto/x509/pkix" + "encoding/asn1" + "encoding/pem" + "errors" + "fmt" + "internal/godebug" + "io" + "math/big" + "net" + "net/url" + "strconv" + "time" + "unicode" + + // Explicitly import these for their crypto.RegisterHash init side-effects. + // Keep these as blank imports, even if they're imported above. + _ "crypto/sha1" + _ "crypto/sha256" + _ "crypto/sha512" + + "golang.org/x/crypto/cryptobyte" + cryptobyte_asn1 "golang.org/x/crypto/cryptobyte/asn1" +) + +// pkixPublicKey reflects a PKIX public key structure. See SubjectPublicKeyInfo +// in RFC 3280. +type pkixPublicKey struct { + Algo pkix.AlgorithmIdentifier + BitString asn1.BitString +} + +// ParsePKIXPublicKey parses a public key in PKIX, ASN.1 DER form. The encoded +// public key is a SubjectPublicKeyInfo structure (see RFC 5280, Section 4.1). +// +// It returns a *[rsa.PublicKey], *[dsa.PublicKey], *[ecdsa.PublicKey], +// [ed25519.PublicKey] (not a pointer), or *[ecdh.PublicKey] (for X25519). +// More types might be supported in the future. +// +// This kind of key is commonly encoded in PEM blocks of type "PUBLIC KEY". +func ParsePKIXPublicKey(derBytes []byte) (pub any, err error) { + var pki publicKeyInfo + if rest, err := asn1.Unmarshal(derBytes, &pki); err != nil { + if _, err := asn1.Unmarshal(derBytes, &pkcs1PublicKey{}); err == nil { + return nil, errors.New("x509: failed to parse public key (use ParsePKCS1PublicKey instead for this key format)") + } + return nil, err + } else if len(rest) != 0 { + return nil, errors.New("x509: trailing data after ASN.1 of public-key") + } + return parsePublicKey(&pki) +} + +func marshalPublicKey(pub any) (publicKeyBytes []byte, publicKeyAlgorithm pkix.AlgorithmIdentifier, err error) { + switch pub := pub.(type) { + case *rsa.PublicKey: + publicKeyBytes, err = asn1.Marshal(pkcs1PublicKey{ + N: pub.N, + E: pub.E, + }) + if err != nil { + return nil, pkix.AlgorithmIdentifier{}, err + } + publicKeyAlgorithm.Algorithm = oidPublicKeyRSA + // This is a NULL parameters value which is required by + // RFC 3279, Section 2.3.1. + publicKeyAlgorithm.Parameters = asn1.NullRawValue + case *ecdsa.PublicKey: + oid, ok := oidFromNamedCurve(pub.Curve) + if !ok { + return nil, pkix.AlgorithmIdentifier{}, errors.New("x509: unsupported elliptic curve") + } + publicKeyBytes, err = pub.Bytes() + if err != nil { + return nil, pkix.AlgorithmIdentifier{}, err + } + publicKeyAlgorithm.Algorithm = oidPublicKeyECDSA + var paramBytes []byte + paramBytes, err = asn1.Marshal(oid) + if err != nil { + return + } + publicKeyAlgorithm.Parameters.FullBytes = paramBytes + case ed25519.PublicKey: + publicKeyBytes = pub + publicKeyAlgorithm.Algorithm = oidPublicKeyEd25519 + case *ecdh.PublicKey: + publicKeyBytes = pub.Bytes() + if pub.Curve() == ecdh.X25519() { + publicKeyAlgorithm.Algorithm = oidPublicKeyX25519 + } else { + oid, ok := oidFromECDHCurve(pub.Curve()) + if !ok { + return nil, pkix.AlgorithmIdentifier{}, errors.New("x509: unsupported elliptic curve") + } + publicKeyAlgorithm.Algorithm = oidPublicKeyECDSA + var paramBytes []byte + paramBytes, err = asn1.Marshal(oid) + if err != nil { + return + } + publicKeyAlgorithm.Parameters.FullBytes = paramBytes + } + default: + return nil, pkix.AlgorithmIdentifier{}, fmt.Errorf("x509: unsupported public key type: %T", pub) + } + + return publicKeyBytes, publicKeyAlgorithm, nil +} + +// MarshalPKIXPublicKey converts a public key to PKIX, ASN.1 DER form. +// The encoded public key is a SubjectPublicKeyInfo structure +// (see RFC 5280, Section 4.1). +// +// The following key types are currently supported: *[rsa.PublicKey], +// *[ecdsa.PublicKey], [ed25519.PublicKey] (not a pointer), and *[ecdh.PublicKey]. +// Unsupported key types result in an error. +// +// This kind of key is commonly encoded in PEM blocks of type "PUBLIC KEY". +func MarshalPKIXPublicKey(pub any) ([]byte, error) { + var publicKeyBytes []byte + var publicKeyAlgorithm pkix.AlgorithmIdentifier + var err error + + if publicKeyBytes, publicKeyAlgorithm, err = marshalPublicKey(pub); err != nil { + return nil, err + } + + pkix := pkixPublicKey{ + Algo: publicKeyAlgorithm, + BitString: asn1.BitString{ + Bytes: publicKeyBytes, + BitLength: 8 * len(publicKeyBytes), + }, + } + + ret, _ := asn1.Marshal(pkix) + return ret, nil +} + +// These structures reflect the ASN.1 structure of X.509 certificates.: + +type certificate struct { + TBSCertificate tbsCertificate + SignatureAlgorithm pkix.AlgorithmIdentifier + SignatureValue asn1.BitString +} + +type tbsCertificate struct { + Raw asn1.RawContent + Version int `asn1:"optional,explicit,default:0,tag:0"` + SerialNumber *big.Int + SignatureAlgorithm pkix.AlgorithmIdentifier + Issuer asn1.RawValue + Validity validity + Subject asn1.RawValue + PublicKey publicKeyInfo + UniqueId asn1.BitString `asn1:"optional,tag:1"` + SubjectUniqueId asn1.BitString `asn1:"optional,tag:2"` + Extensions []pkix.Extension `asn1:"omitempty,optional,explicit,tag:3"` +} + +type dsaAlgorithmParameters struct { + P, Q, G *big.Int +} + +type validity struct { + NotBefore, NotAfter time.Time +} + +type publicKeyInfo struct { + Raw asn1.RawContent + Algorithm pkix.AlgorithmIdentifier + PublicKey asn1.BitString +} + +// RFC 5280, 4.2.1.1 +type authKeyId struct { + Id []byte `asn1:"optional,tag:0"` +} + +type SignatureAlgorithm int + +const ( + UnknownSignatureAlgorithm SignatureAlgorithm = iota + + MD2WithRSA // Unsupported. + MD5WithRSA // Only supported for signing, not verification. + SHA1WithRSA // Only supported for signing, and verification of CRLs, CSRs, and OCSP responses. + SHA256WithRSA + SHA384WithRSA + SHA512WithRSA + DSAWithSHA1 // Unsupported. + DSAWithSHA256 // Unsupported. + ECDSAWithSHA1 // Only supported for signing, and verification of CRLs, CSRs, and OCSP responses. + ECDSAWithSHA256 + ECDSAWithSHA384 + ECDSAWithSHA512 + SHA256WithRSAPSS + SHA384WithRSAPSS + SHA512WithRSAPSS + PureEd25519 +) + +func (algo SignatureAlgorithm) isRSAPSS() bool { + for _, details := range signatureAlgorithmDetails { + if details.algo == algo { + return details.isRSAPSS + } + } + return false +} + +func (algo SignatureAlgorithm) hashFunc() crypto.Hash { + for _, details := range signatureAlgorithmDetails { + if details.algo == algo { + return details.hash + } + } + return crypto.Hash(0) +} + +func (algo SignatureAlgorithm) String() string { + for _, details := range signatureAlgorithmDetails { + if details.algo == algo { + return details.name + } + } + return strconv.Itoa(int(algo)) +} + +type PublicKeyAlgorithm int + +const ( + UnknownPublicKeyAlgorithm PublicKeyAlgorithm = iota + RSA + DSA // Only supported for parsing. + ECDSA + Ed25519 +) + +var publicKeyAlgoName = [...]string{ + RSA: "RSA", + DSA: "DSA", + ECDSA: "ECDSA", + Ed25519: "Ed25519", +} + +func (algo PublicKeyAlgorithm) String() string { + if 0 < algo && int(algo) < len(publicKeyAlgoName) { + return publicKeyAlgoName[algo] + } + return strconv.Itoa(int(algo)) +} + +// OIDs for signature algorithms +// +// pkcs-1 OBJECT IDENTIFIER ::= { +// iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 1 } +// +// RFC 3279 2.2.1 RSA Signature Algorithms +// +// md5WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 4 } +// +// sha-1WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 5 } +// +// dsaWithSha1 OBJECT IDENTIFIER ::= { +// iso(1) member-body(2) us(840) x9-57(10040) x9cm(4) 3 } +// +// RFC 3279 2.2.3 ECDSA Signature Algorithm +// +// ecdsa-with-SHA1 OBJECT IDENTIFIER ::= { +// iso(1) member-body(2) us(840) ansi-x962(10045) +// signatures(4) ecdsa-with-SHA1(1)} +// +// RFC 4055 5 PKCS #1 Version 1.5 +// +// sha256WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 11 } +// +// sha384WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 12 } +// +// sha512WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 13 } +// +// RFC 5758 3.1 DSA Signature Algorithms +// +// dsaWithSha256 OBJECT IDENTIFIER ::= { +// joint-iso-ccitt(2) country(16) us(840) organization(1) gov(101) +// csor(3) algorithms(4) id-dsa-with-sha2(3) 2} +// +// RFC 5758 3.2 ECDSA Signature Algorithm +// +// ecdsa-with-SHA256 OBJECT IDENTIFIER ::= { iso(1) member-body(2) +// us(840) ansi-X9-62(10045) signatures(4) ecdsa-with-SHA2(3) 2 } +// +// ecdsa-with-SHA384 OBJECT IDENTIFIER ::= { iso(1) member-body(2) +// us(840) ansi-X9-62(10045) signatures(4) ecdsa-with-SHA2(3) 3 } +// +// ecdsa-with-SHA512 OBJECT IDENTIFIER ::= { iso(1) member-body(2) +// us(840) ansi-X9-62(10045) signatures(4) ecdsa-with-SHA2(3) 4 } +// +// RFC 8410 3 Curve25519 and Curve448 Algorithm Identifiers +// +// id-Ed25519 OBJECT IDENTIFIER ::= { 1 3 101 112 } +var ( + oidSignatureMD5WithRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 4} + oidSignatureSHA1WithRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 5} + oidSignatureSHA256WithRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 11} + oidSignatureSHA384WithRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 12} + oidSignatureSHA512WithRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 13} + oidSignatureRSAPSS = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 10} + oidSignatureDSAWithSHA1 = asn1.ObjectIdentifier{1, 2, 840, 10040, 4, 3} + oidSignatureDSAWithSHA256 = asn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 3, 2} + oidSignatureECDSAWithSHA1 = asn1.ObjectIdentifier{1, 2, 840, 10045, 4, 1} + oidSignatureECDSAWithSHA256 = asn1.ObjectIdentifier{1, 2, 840, 10045, 4, 3, 2} + oidSignatureECDSAWithSHA384 = asn1.ObjectIdentifier{1, 2, 840, 10045, 4, 3, 3} + oidSignatureECDSAWithSHA512 = asn1.ObjectIdentifier{1, 2, 840, 10045, 4, 3, 4} + oidSignatureEd25519 = asn1.ObjectIdentifier{1, 3, 101, 112} + + oidSHA256 = asn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 2, 1} + oidSHA384 = asn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 2, 2} + oidSHA512 = asn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 2, 3} + + oidMGF1 = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 8} + + // oidISOSignatureSHA1WithRSA means the same as oidSignatureSHA1WithRSA + // but it's specified by ISO. Microsoft's makecert.exe has been known + // to produce certificates with this OID. + oidISOSignatureSHA1WithRSA = asn1.ObjectIdentifier{1, 3, 14, 3, 2, 29} +) + +var signatureAlgorithmDetails = []struct { + algo SignatureAlgorithm + name string + oid asn1.ObjectIdentifier + params asn1.RawValue + pubKeyAlgo PublicKeyAlgorithm + hash crypto.Hash + isRSAPSS bool +}{ + {MD5WithRSA, "MD5-RSA", oidSignatureMD5WithRSA, asn1.NullRawValue, RSA, crypto.MD5, false}, + {SHA1WithRSA, "SHA1-RSA", oidSignatureSHA1WithRSA, asn1.NullRawValue, RSA, crypto.SHA1, false}, + {SHA1WithRSA, "SHA1-RSA", oidISOSignatureSHA1WithRSA, asn1.NullRawValue, RSA, crypto.SHA1, false}, + {SHA256WithRSA, "SHA256-RSA", oidSignatureSHA256WithRSA, asn1.NullRawValue, RSA, crypto.SHA256, false}, + {SHA384WithRSA, "SHA384-RSA", oidSignatureSHA384WithRSA, asn1.NullRawValue, RSA, crypto.SHA384, false}, + {SHA512WithRSA, "SHA512-RSA", oidSignatureSHA512WithRSA, asn1.NullRawValue, RSA, crypto.SHA512, false}, + {SHA256WithRSAPSS, "SHA256-RSAPSS", oidSignatureRSAPSS, pssParametersSHA256, RSA, crypto.SHA256, true}, + {SHA384WithRSAPSS, "SHA384-RSAPSS", oidSignatureRSAPSS, pssParametersSHA384, RSA, crypto.SHA384, true}, + {SHA512WithRSAPSS, "SHA512-RSAPSS", oidSignatureRSAPSS, pssParametersSHA512, RSA, crypto.SHA512, true}, + {DSAWithSHA1, "DSA-SHA1", oidSignatureDSAWithSHA1, emptyRawValue, DSA, crypto.SHA1, false}, + {DSAWithSHA256, "DSA-SHA256", oidSignatureDSAWithSHA256, emptyRawValue, DSA, crypto.SHA256, false}, + {ECDSAWithSHA1, "ECDSA-SHA1", oidSignatureECDSAWithSHA1, emptyRawValue, ECDSA, crypto.SHA1, false}, + {ECDSAWithSHA256, "ECDSA-SHA256", oidSignatureECDSAWithSHA256, emptyRawValue, ECDSA, crypto.SHA256, false}, + {ECDSAWithSHA384, "ECDSA-SHA384", oidSignatureECDSAWithSHA384, emptyRawValue, ECDSA, crypto.SHA384, false}, + {ECDSAWithSHA512, "ECDSA-SHA512", oidSignatureECDSAWithSHA512, emptyRawValue, ECDSA, crypto.SHA512, false}, + {PureEd25519, "Ed25519", oidSignatureEd25519, emptyRawValue, Ed25519, crypto.Hash(0) /* no pre-hashing */, false}, +} + +var emptyRawValue = asn1.RawValue{} + +// DER encoded RSA PSS parameters for the +// SHA256, SHA384, and SHA512 hashes as defined in RFC 3447, Appendix A.2.3. +// The parameters contain the following values: +// - hashAlgorithm contains the associated hash identifier with NULL parameters +// - maskGenAlgorithm always contains the default mgf1SHA1 identifier +// - saltLength contains the length of the associated hash +// - trailerField always contains the default trailerFieldBC value +var ( + pssParametersSHA256 = asn1.RawValue{FullBytes: []byte{48, 52, 160, 15, 48, 13, 6, 9, 96, 134, 72, 1, 101, 3, 4, 2, 1, 5, 0, 161, 28, 48, 26, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 8, 48, 13, 6, 9, 96, 134, 72, 1, 101, 3, 4, 2, 1, 5, 0, 162, 3, 2, 1, 32}} + pssParametersSHA384 = asn1.RawValue{FullBytes: []byte{48, 52, 160, 15, 48, 13, 6, 9, 96, 134, 72, 1, 101, 3, 4, 2, 2, 5, 0, 161, 28, 48, 26, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 8, 48, 13, 6, 9, 96, 134, 72, 1, 101, 3, 4, 2, 2, 5, 0, 162, 3, 2, 1, 48}} + pssParametersSHA512 = asn1.RawValue{FullBytes: []byte{48, 52, 160, 15, 48, 13, 6, 9, 96, 134, 72, 1, 101, 3, 4, 2, 3, 5, 0, 161, 28, 48, 26, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 8, 48, 13, 6, 9, 96, 134, 72, 1, 101, 3, 4, 2, 3, 5, 0, 162, 3, 2, 1, 64}} +) + +// pssParameters reflects the parameters in an AlgorithmIdentifier that +// specifies RSA PSS. See RFC 3447, Appendix A.2.3. +type pssParameters struct { + // The following three fields are not marked as + // optional because the default values specify SHA-1, + // which is no longer suitable for use in signatures. + Hash pkix.AlgorithmIdentifier `asn1:"explicit,tag:0"` + MGF pkix.AlgorithmIdentifier `asn1:"explicit,tag:1"` + SaltLength int `asn1:"explicit,tag:2"` + TrailerField int `asn1:"optional,explicit,tag:3,default:1"` +} + +func getSignatureAlgorithmFromAI(ai pkix.AlgorithmIdentifier) SignatureAlgorithm { + if ai.Algorithm.Equal(oidSignatureEd25519) { + // RFC 8410, Section 3 + // > For all of the OIDs, the parameters MUST be absent. + if len(ai.Parameters.FullBytes) != 0 { + return UnknownSignatureAlgorithm + } + } + + if !ai.Algorithm.Equal(oidSignatureRSAPSS) { + for _, details := range signatureAlgorithmDetails { + if ai.Algorithm.Equal(details.oid) { + return details.algo + } + } + return UnknownSignatureAlgorithm + } + + // RSA PSS is special because it encodes important parameters + // in the Parameters. + + var params pssParameters + if _, err := asn1.Unmarshal(ai.Parameters.FullBytes, ¶ms); err != nil { + return UnknownSignatureAlgorithm + } + + var mgf1HashFunc pkix.AlgorithmIdentifier + if _, err := asn1.Unmarshal(params.MGF.Parameters.FullBytes, &mgf1HashFunc); err != nil { + return UnknownSignatureAlgorithm + } + + // PSS is greatly overburdened with options. This code forces them into + // three buckets by requiring that the MGF1 hash function always match the + // message hash function (as recommended in RFC 3447, Section 8.1), that the + // salt length matches the hash length, and that the trailer field has the + // default value. + if (len(params.Hash.Parameters.FullBytes) != 0 && !bytes.Equal(params.Hash.Parameters.FullBytes, asn1.NullBytes)) || + !params.MGF.Algorithm.Equal(oidMGF1) || + !mgf1HashFunc.Algorithm.Equal(params.Hash.Algorithm) || + (len(mgf1HashFunc.Parameters.FullBytes) != 0 && !bytes.Equal(mgf1HashFunc.Parameters.FullBytes, asn1.NullBytes)) || + params.TrailerField != 1 { + return UnknownSignatureAlgorithm + } + + switch { + case params.Hash.Algorithm.Equal(oidSHA256) && params.SaltLength == 32: + return SHA256WithRSAPSS + case params.Hash.Algorithm.Equal(oidSHA384) && params.SaltLength == 48: + return SHA384WithRSAPSS + case params.Hash.Algorithm.Equal(oidSHA512) && params.SaltLength == 64: + return SHA512WithRSAPSS + } + + return UnknownSignatureAlgorithm +} + +var ( + // RFC 3279, 2.3 Public Key Algorithms + // + // pkcs-1 OBJECT IDENTIFIER ::== { iso(1) member-body(2) us(840) + // rsadsi(113549) pkcs(1) 1 } + // + // rsaEncryption OBJECT IDENTIFIER ::== { pkcs1-1 1 } + // + // id-dsa OBJECT IDENTIFIER ::== { iso(1) member-body(2) us(840) + // x9-57(10040) x9cm(4) 1 } + oidPublicKeyRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 1} + oidPublicKeyDSA = asn1.ObjectIdentifier{1, 2, 840, 10040, 4, 1} + // RFC 5480, 2.1.1 Unrestricted Algorithm Identifier and Parameters + // + // id-ecPublicKey OBJECT IDENTIFIER ::= { + // iso(1) member-body(2) us(840) ansi-X9-62(10045) keyType(2) 1 } + oidPublicKeyECDSA = asn1.ObjectIdentifier{1, 2, 840, 10045, 2, 1} + // RFC 8410, Section 3 + // + // id-X25519 OBJECT IDENTIFIER ::= { 1 3 101 110 } + // id-Ed25519 OBJECT IDENTIFIER ::= { 1 3 101 112 } + oidPublicKeyX25519 = asn1.ObjectIdentifier{1, 3, 101, 110} + oidPublicKeyEd25519 = asn1.ObjectIdentifier{1, 3, 101, 112} +) + +// getPublicKeyAlgorithmFromOID returns the exposed PublicKeyAlgorithm +// identifier for public key types supported in certificates and CSRs. Marshal +// and Parse functions may support a different set of public key types. +func getPublicKeyAlgorithmFromOID(oid asn1.ObjectIdentifier) PublicKeyAlgorithm { + switch { + case oid.Equal(oidPublicKeyRSA): + return RSA + case oid.Equal(oidPublicKeyDSA): + return DSA + case oid.Equal(oidPublicKeyECDSA): + return ECDSA + case oid.Equal(oidPublicKeyEd25519): + return Ed25519 + } + return UnknownPublicKeyAlgorithm +} + +// RFC 5480, 2.1.1.1. Named Curve +// +// secp224r1 OBJECT IDENTIFIER ::= { +// iso(1) identified-organization(3) certicom(132) curve(0) 33 } +// +// secp256r1 OBJECT IDENTIFIER ::= { +// iso(1) member-body(2) us(840) ansi-X9-62(10045) curves(3) +// prime(1) 7 } +// +// secp384r1 OBJECT IDENTIFIER ::= { +// iso(1) identified-organization(3) certicom(132) curve(0) 34 } +// +// secp521r1 OBJECT IDENTIFIER ::= { +// iso(1) identified-organization(3) certicom(132) curve(0) 35 } +// +// NB: secp256r1 is equivalent to prime256v1 +var ( + oidNamedCurveP224 = asn1.ObjectIdentifier{1, 3, 132, 0, 33} + oidNamedCurveP256 = asn1.ObjectIdentifier{1, 2, 840, 10045, 3, 1, 7} + oidNamedCurveP384 = asn1.ObjectIdentifier{1, 3, 132, 0, 34} + oidNamedCurveP521 = asn1.ObjectIdentifier{1, 3, 132, 0, 35} +) + +func namedCurveFromOID(oid asn1.ObjectIdentifier) elliptic.Curve { + switch { + case oid.Equal(oidNamedCurveP224): + return elliptic.P224() + case oid.Equal(oidNamedCurveP256): + return elliptic.P256() + case oid.Equal(oidNamedCurveP384): + return elliptic.P384() + case oid.Equal(oidNamedCurveP521): + return elliptic.P521() + } + return nil +} + +func oidFromNamedCurve(curve elliptic.Curve) (asn1.ObjectIdentifier, bool) { + switch curve { + case elliptic.P224(): + return oidNamedCurveP224, true + case elliptic.P256(): + return oidNamedCurveP256, true + case elliptic.P384(): + return oidNamedCurveP384, true + case elliptic.P521(): + return oidNamedCurveP521, true + } + + return nil, false +} + +func oidFromECDHCurve(curve ecdh.Curve) (asn1.ObjectIdentifier, bool) { + switch curve { + case ecdh.X25519(): + return oidPublicKeyX25519, true + case ecdh.P256(): + return oidNamedCurveP256, true + case ecdh.P384(): + return oidNamedCurveP384, true + case ecdh.P521(): + return oidNamedCurveP521, true + } + + return nil, false +} + +// KeyUsage represents the set of actions that are valid for a given key. It's +// a bitmap of the KeyUsage* constants. +type KeyUsage int + +//go:generate stringer -linecomment -type=KeyUsage,ExtKeyUsage -output=x509_string.go + +const ( + KeyUsageDigitalSignature KeyUsage = 1 << iota // digitalSignature + KeyUsageContentCommitment // contentCommitment + KeyUsageKeyEncipherment // keyEncipherment + KeyUsageDataEncipherment // dataEncipherment + KeyUsageKeyAgreement // keyAgreement + KeyUsageCertSign // keyCertSign + KeyUsageCRLSign // cRLSign + KeyUsageEncipherOnly // encipherOnly + KeyUsageDecipherOnly // decipherOnly +) + +// RFC 5280, 4.2.1.12 Extended Key Usage +// +// anyExtendedKeyUsage OBJECT IDENTIFIER ::= { id-ce-extKeyUsage 0 } +// +// id-kp OBJECT IDENTIFIER ::= { id-pkix 3 } +// +// id-kp-serverAuth OBJECT IDENTIFIER ::= { id-kp 1 } +// id-kp-clientAuth OBJECT IDENTIFIER ::= { id-kp 2 } +// id-kp-codeSigning OBJECT IDENTIFIER ::= { id-kp 3 } +// id-kp-emailProtection OBJECT IDENTIFIER ::= { id-kp 4 } +// id-kp-timeStamping OBJECT IDENTIFIER ::= { id-kp 8 } +// id-kp-OCSPSigning OBJECT IDENTIFIER ::= { id-kp 9 } +// +// https://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#smi-numbers-1.3.6.1.5.5.7.3 +var ( + oidExtKeyUsageAny = asn1.ObjectIdentifier{2, 5, 29, 37, 0} + oidExtKeyUsageServerAuth = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 3, 1} + oidExtKeyUsageClientAuth = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 3, 2} + oidExtKeyUsageCodeSigning = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 3, 3} + oidExtKeyUsageEmailProtection = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 3, 4} + oidExtKeyUsageIPSECEndSystem = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 3, 5} + oidExtKeyUsageIPSECTunnel = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 3, 6} + oidExtKeyUsageIPSECUser = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 3, 7} + oidExtKeyUsageTimeStamping = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 3, 8} + oidExtKeyUsageOCSPSigning = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 3, 9} + oidExtKeyUsageMicrosoftServerGatedCrypto = asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 311, 10, 3, 3} + oidExtKeyUsageNetscapeServerGatedCrypto = asn1.ObjectIdentifier{2, 16, 840, 1, 113730, 4, 1} + oidExtKeyUsageMicrosoftCommercialCodeSigning = asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 311, 2, 1, 22} + oidExtKeyUsageMicrosoftKernelCodeSigning = asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 311, 61, 1, 1} +) + +// ExtKeyUsage represents an extended set of actions that are valid for a given key. +// Each of the ExtKeyUsage* constants define a unique action. +type ExtKeyUsage int + +const ( + ExtKeyUsageAny ExtKeyUsage = iota // anyExtendedKeyUsage + ExtKeyUsageServerAuth // serverAuth + ExtKeyUsageClientAuth // clientAuth + ExtKeyUsageCodeSigning // codeSigning + ExtKeyUsageEmailProtection // emailProtection + ExtKeyUsageIPSECEndSystem // ipsecEndSystem + ExtKeyUsageIPSECTunnel // ipsecTunnel + ExtKeyUsageIPSECUser // ipsecUser + ExtKeyUsageTimeStamping // timeStamping + ExtKeyUsageOCSPSigning // OCSPSigning + ExtKeyUsageMicrosoftServerGatedCrypto // msSGC + ExtKeyUsageNetscapeServerGatedCrypto // nsSGC + ExtKeyUsageMicrosoftCommercialCodeSigning // msCodeCom + ExtKeyUsageMicrosoftKernelCodeSigning // msKernelCode +) + +// extKeyUsageOIDs contains the mapping between an ExtKeyUsage and its OID. +var extKeyUsageOIDs = []struct { + extKeyUsage ExtKeyUsage + oid asn1.ObjectIdentifier +}{ + {ExtKeyUsageAny, oidExtKeyUsageAny}, + {ExtKeyUsageServerAuth, oidExtKeyUsageServerAuth}, + {ExtKeyUsageClientAuth, oidExtKeyUsageClientAuth}, + {ExtKeyUsageCodeSigning, oidExtKeyUsageCodeSigning}, + {ExtKeyUsageEmailProtection, oidExtKeyUsageEmailProtection}, + {ExtKeyUsageIPSECEndSystem, oidExtKeyUsageIPSECEndSystem}, + {ExtKeyUsageIPSECTunnel, oidExtKeyUsageIPSECTunnel}, + {ExtKeyUsageIPSECUser, oidExtKeyUsageIPSECUser}, + {ExtKeyUsageTimeStamping, oidExtKeyUsageTimeStamping}, + {ExtKeyUsageOCSPSigning, oidExtKeyUsageOCSPSigning}, + {ExtKeyUsageMicrosoftServerGatedCrypto, oidExtKeyUsageMicrosoftServerGatedCrypto}, + {ExtKeyUsageNetscapeServerGatedCrypto, oidExtKeyUsageNetscapeServerGatedCrypto}, + {ExtKeyUsageMicrosoftCommercialCodeSigning, oidExtKeyUsageMicrosoftCommercialCodeSigning}, + {ExtKeyUsageMicrosoftKernelCodeSigning, oidExtKeyUsageMicrosoftKernelCodeSigning}, +} + +func extKeyUsageFromOID(oid asn1.ObjectIdentifier) (eku ExtKeyUsage, ok bool) { + for _, pair := range extKeyUsageOIDs { + if oid.Equal(pair.oid) { + return pair.extKeyUsage, true + } + } + return +} + +func oidFromExtKeyUsage(eku ExtKeyUsage) (oid asn1.ObjectIdentifier, ok bool) { + for _, pair := range extKeyUsageOIDs { + if eku == pair.extKeyUsage { + return pair.oid, true + } + } + return +} + +// OID returns the ASN.1 object identifier of the EKU. +func (eku ExtKeyUsage) OID() OID { + asn1OID, ok := oidFromExtKeyUsage(eku) + if !ok { + panic("x509: internal error: known ExtKeyUsage has no OID") + } + oid, err := OIDFromASN1OID(asn1OID) + if err != nil { + panic("x509: internal error: known ExtKeyUsage has invalid OID") + } + return oid +} + +// A Certificate represents an X.509 certificate. +type Certificate struct { + Raw []byte // Complete ASN.1 DER content (certificate, signature algorithm and signature). + RawTBSCertificate []byte // Certificate part of raw ASN.1 DER content. + RawSubjectPublicKeyInfo []byte // DER encoded SubjectPublicKeyInfo. + RawSubject []byte // DER encoded Subject + RawIssuer []byte // DER encoded Issuer + + Signature []byte + SignatureAlgorithm SignatureAlgorithm + + PublicKeyAlgorithm PublicKeyAlgorithm + PublicKey any + + Version int + SerialNumber *big.Int + Issuer pkix.Name + Subject pkix.Name + NotBefore, NotAfter time.Time // Validity bounds. + KeyUsage KeyUsage + + // Extensions contains raw X.509 extensions. When parsing certificates, + // this can be used to extract non-critical extensions that are not + // parsed by this package. When marshaling certificates, the Extensions + // field is ignored, see ExtraExtensions. + Extensions []pkix.Extension + + // ExtraExtensions contains extensions to be copied, raw, into any + // marshaled certificates. Values override any extensions that would + // otherwise be produced based on the other fields. The ExtraExtensions + // field is not populated when parsing certificates, see Extensions. + ExtraExtensions []pkix.Extension + + // UnhandledCriticalExtensions contains a list of extension IDs that + // were not (fully) processed when parsing. Verify will fail if this + // slice is non-empty, unless verification is delegated to an OS + // library which understands all the critical extensions. + // + // Users can access these extensions using Extensions and can remove + // elements from this slice if they believe that they have been + // handled. + UnhandledCriticalExtensions []asn1.ObjectIdentifier + + ExtKeyUsage []ExtKeyUsage // Sequence of extended key usages. + UnknownExtKeyUsage []asn1.ObjectIdentifier // Encountered extended key usages unknown to this package. + + // BasicConstraintsValid indicates whether IsCA, MaxPathLen, + // and MaxPathLenZero are valid. + BasicConstraintsValid bool + IsCA bool + + // MaxPathLen and MaxPathLenZero indicate the presence and + // value of the BasicConstraints' "pathLenConstraint". + // + // When parsing a certificate, a positive non-zero MaxPathLen + // means that the field was specified, -1 means it was unset, + // and MaxPathLenZero being true mean that the field was + // explicitly set to zero. The case of MaxPathLen==0 with MaxPathLenZero==false + // should be treated equivalent to -1 (unset). + // + // When generating a certificate, an unset pathLenConstraint + // can be requested with either MaxPathLen == -1 or using the + // zero value for both MaxPathLen and MaxPathLenZero. + MaxPathLen int + // MaxPathLenZero indicates that BasicConstraintsValid==true + // and MaxPathLen==0 should be interpreted as an actual + // maximum path length of zero. Otherwise, that combination is + // interpreted as MaxPathLen not being set. + MaxPathLenZero bool + + SubjectKeyId []byte + AuthorityKeyId []byte + + // RFC 5280, 4.2.2.1 (Authority Information Access) + OCSPServer []string + IssuingCertificateURL []string + + // Subject Alternate Name values. (Note that these values may not be valid + // if invalid values were contained within a parsed certificate. For + // example, an element of DNSNames may not be a valid DNS domain name.) + DNSNames []string + EmailAddresses []string + IPAddresses []net.IP + URIs []*url.URL + + // Name constraints + PermittedDNSDomainsCritical bool // if true then the name constraints are marked critical. + PermittedDNSDomains []string + ExcludedDNSDomains []string + PermittedIPRanges []*net.IPNet + ExcludedIPRanges []*net.IPNet + PermittedEmailAddresses []string + ExcludedEmailAddresses []string + PermittedURIDomains []string + ExcludedURIDomains []string + + // CRL Distribution Points + CRLDistributionPoints []string + + // PolicyIdentifiers contains asn1.ObjectIdentifiers, the components + // of which are limited to int32. If a certificate contains a policy which + // cannot be represented by asn1.ObjectIdentifier, it will not be included in + // PolicyIdentifiers, but will be present in Policies, which contains all parsed + // policy OIDs. + // See CreateCertificate for context about how this field and the Policies field + // interact. + PolicyIdentifiers []asn1.ObjectIdentifier + + // Policies contains all policy identifiers included in the certificate. + // See CreateCertificate for context about how this field and the PolicyIdentifiers field + // interact. + // In Go 1.22, encoding/gob cannot handle and ignores this field. + Policies []OID + + // InhibitAnyPolicy and InhibitAnyPolicyZero indicate the presence and value + // of the inhibitAnyPolicy extension. + // + // The value of InhibitAnyPolicy indicates the number of additional + // certificates in the path after this certificate that may use the + // anyPolicy policy OID to indicate a match with any other policy. + // + // When parsing a certificate, a positive non-zero InhibitAnyPolicy means + // that the field was specified, -1 means it was unset, and + // InhibitAnyPolicyZero being true mean that the field was explicitly set to + // zero. The case of InhibitAnyPolicy==0 with InhibitAnyPolicyZero==false + // should be treated equivalent to -1 (unset). + InhibitAnyPolicy int + // InhibitAnyPolicyZero indicates that InhibitAnyPolicy==0 should be + // interpreted as an actual maximum path length of zero. Otherwise, that + // combination is interpreted as InhibitAnyPolicy not being set. + InhibitAnyPolicyZero bool + + // InhibitPolicyMapping and InhibitPolicyMappingZero indicate the presence + // and value of the inhibitPolicyMapping field of the policyConstraints + // extension. + // + // The value of InhibitPolicyMapping indicates the number of additional + // certificates in the path after this certificate that may use policy + // mapping. + // + // When parsing a certificate, a positive non-zero InhibitPolicyMapping + // means that the field was specified, -1 means it was unset, and + // InhibitPolicyMappingZero being true mean that the field was explicitly + // set to zero. The case of InhibitPolicyMapping==0 with + // InhibitPolicyMappingZero==false should be treated equivalent to -1 + // (unset). + InhibitPolicyMapping int + // InhibitPolicyMappingZero indicates that InhibitPolicyMapping==0 should be + // interpreted as an actual maximum path length of zero. Otherwise, that + // combination is interpreted as InhibitAnyPolicy not being set. + InhibitPolicyMappingZero bool + + // RequireExplicitPolicy and RequireExplicitPolicyZero indicate the presence + // and value of the requireExplicitPolicy field of the policyConstraints + // extension. + // + // The value of RequireExplicitPolicy indicates the number of additional + // certificates in the path after this certificate before an explicit policy + // is required for the rest of the path. When an explicit policy is required, + // each subsequent certificate in the path must contain a required policy OID, + // or a policy OID which has been declared as equivalent through the policy + // mapping extension. + // + // When parsing a certificate, a positive non-zero RequireExplicitPolicy + // means that the field was specified, -1 means it was unset, and + // RequireExplicitPolicyZero being true mean that the field was explicitly + // set to zero. The case of RequireExplicitPolicy==0 with + // RequireExplicitPolicyZero==false should be treated equivalent to -1 + // (unset). + RequireExplicitPolicy int + // RequireExplicitPolicyZero indicates that RequireExplicitPolicy==0 should be + // interpreted as an actual maximum path length of zero. Otherwise, that + // combination is interpreted as InhibitAnyPolicy not being set. + RequireExplicitPolicyZero bool + + // PolicyMappings contains a list of policy mappings included in the certificate. + PolicyMappings []PolicyMapping +} + +// PolicyMapping represents a policy mapping entry in the policyMappings extension. +type PolicyMapping struct { + // IssuerDomainPolicy contains a policy OID the issuing certificate considers + // equivalent to SubjectDomainPolicy in the subject certificate. + IssuerDomainPolicy OID + // SubjectDomainPolicy contains a OID the issuing certificate considers + // equivalent to IssuerDomainPolicy in the subject certificate. + SubjectDomainPolicy OID +} + +// ErrUnsupportedAlgorithm results from attempting to perform an operation that +// involves algorithms that are not currently implemented. +var ErrUnsupportedAlgorithm = errors.New("x509: cannot verify signature: algorithm unimplemented") + +// An InsecureAlgorithmError indicates that the [SignatureAlgorithm] used to +// generate the signature is not secure, and the signature has been rejected. +type InsecureAlgorithmError SignatureAlgorithm + +func (e InsecureAlgorithmError) Error() string { + return fmt.Sprintf("x509: cannot verify signature: insecure algorithm %v", SignatureAlgorithm(e)) +} + +// ConstraintViolationError results when a requested usage is not permitted by +// a certificate. For example: checking a signature when the public key isn't a +// certificate signing key. +type ConstraintViolationError struct{} + +func (ConstraintViolationError) Error() string { + return "x509: invalid signature: parent certificate cannot sign this kind of certificate" +} + +func (c *Certificate) Equal(other *Certificate) bool { + if c == nil || other == nil { + return c == other + } + return bytes.Equal(c.Raw, other.Raw) +} + +func (c *Certificate) hasSANExtension() bool { + return oidInExtensions(oidExtensionSubjectAltName, c.Extensions) +} + +// CheckSignatureFrom verifies that the signature on c is a valid signature from parent. +// +// This is a low-level API that performs very limited checks, and not a full +// path verifier. Most users should use [Certificate.Verify] instead. +func (c *Certificate) CheckSignatureFrom(parent *Certificate) error { + // RFC 5280, 4.2.1.9: + // "If the basic constraints extension is not present in a version 3 + // certificate, or the extension is present but the cA boolean is not + // asserted, then the certified public key MUST NOT be used to verify + // certificate signatures." + if parent.Version == 3 && !parent.BasicConstraintsValid || + parent.BasicConstraintsValid && !parent.IsCA { + return ConstraintViolationError{} + } + + if parent.KeyUsage != 0 && parent.KeyUsage&KeyUsageCertSign == 0 { + return ConstraintViolationError{} + } + + if parent.PublicKeyAlgorithm == UnknownPublicKeyAlgorithm { + return ErrUnsupportedAlgorithm + } + + return checkSignature(c.SignatureAlgorithm, c.RawTBSCertificate, c.Signature, parent.PublicKey, false) +} + +// CheckSignature verifies that signature is a valid signature over signed from +// c's public key. +// +// This is a low-level API that performs no validity checks on the certificate. +// +// [MD5WithRSA] signatures are rejected, while [SHA1WithRSA] and [ECDSAWithSHA1] +// signatures are currently accepted. +func (c *Certificate) CheckSignature(algo SignatureAlgorithm, signed, signature []byte) error { + return checkSignature(algo, signed, signature, c.PublicKey, true) +} + +func (c *Certificate) hasNameConstraints() bool { + return oidInExtensions(oidExtensionNameConstraints, c.Extensions) +} + +func (c *Certificate) getSANExtension() []byte { + for _, e := range c.Extensions { + if e.Id.Equal(oidExtensionSubjectAltName) { + return e.Value + } + } + return nil +} + +func signaturePublicKeyAlgoMismatchError(expectedPubKeyAlgo PublicKeyAlgorithm, pubKey any) error { + return fmt.Errorf("x509: signature algorithm specifies an %s public key, but have public key of type %T", expectedPubKeyAlgo.String(), pubKey) +} + +// checkSignature verifies that signature is a valid signature over signed from +// a crypto.PublicKey. +func checkSignature(algo SignatureAlgorithm, signed, signature []byte, publicKey crypto.PublicKey, allowSHA1 bool) (err error) { + var hashType crypto.Hash + var pubKeyAlgo PublicKeyAlgorithm + + for _, details := range signatureAlgorithmDetails { + if details.algo == algo { + hashType = details.hash + pubKeyAlgo = details.pubKeyAlgo + break + } + } + + switch hashType { + case crypto.Hash(0): + if pubKeyAlgo != Ed25519 { + return ErrUnsupportedAlgorithm + } + case crypto.MD5: + return InsecureAlgorithmError(algo) + case crypto.SHA1: + // SHA-1 signatures are only allowed for CRLs and CSRs. + if !allowSHA1 { + return InsecureAlgorithmError(algo) + } + fallthrough + default: + if !hashType.Available() { + return ErrUnsupportedAlgorithm + } + h := hashType.New() + h.Write(signed) + signed = h.Sum(nil) + } + + switch pub := publicKey.(type) { + case *rsa.PublicKey: + if pubKeyAlgo != RSA { + return signaturePublicKeyAlgoMismatchError(pubKeyAlgo, pub) + } + if algo.isRSAPSS() { + return rsa.VerifyPSS(pub, hashType, signed, signature, &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash}) + } else { + return rsa.VerifyPKCS1v15(pub, hashType, signed, signature) + } + case *ecdsa.PublicKey: + if pubKeyAlgo != ECDSA { + return signaturePublicKeyAlgoMismatchError(pubKeyAlgo, pub) + } + if !ecdsa.VerifyASN1(pub, signed, signature) { + return errors.New("x509: ECDSA verification failure") + } + return + case ed25519.PublicKey: + if pubKeyAlgo != Ed25519 { + return signaturePublicKeyAlgoMismatchError(pubKeyAlgo, pub) + } + if !ed25519.Verify(pub, signed, signature) { + return errors.New("x509: Ed25519 verification failure") + } + return + } + return ErrUnsupportedAlgorithm +} + +// CheckCRLSignature checks that the signature in crl is from c. +// +// Deprecated: Use [RevocationList.CheckSignatureFrom] instead. +func (c *Certificate) CheckCRLSignature(crl *pkix.CertificateList) error { + algo := getSignatureAlgorithmFromAI(crl.SignatureAlgorithm) + return c.CheckSignature(algo, crl.TBSCertList.Raw, crl.SignatureValue.RightAlign()) +} + +type UnhandledCriticalExtension struct{} + +func (h UnhandledCriticalExtension) Error() string { + return "x509: unhandled critical extension" +} + +type basicConstraints struct { + IsCA bool `asn1:"optional"` + MaxPathLen int `asn1:"optional,default:-1"` +} + +// RFC 5280 4.2.1.4 +type policyInformation struct { + Policy asn1.ObjectIdentifier + // policyQualifiers omitted +} + +const ( + nameTypeEmail = 1 + nameTypeDNS = 2 + nameTypeURI = 6 + nameTypeIP = 7 +) + +// RFC 5280, 4.2.2.1 +type authorityInfoAccess struct { + Method asn1.ObjectIdentifier + Location asn1.RawValue +} + +// RFC 5280, 4.2.1.14 +type distributionPoint struct { + DistributionPoint distributionPointName `asn1:"optional,tag:0"` + Reason asn1.BitString `asn1:"optional,tag:1"` + CRLIssuer asn1.RawValue `asn1:"optional,tag:2"` +} + +type distributionPointName struct { + FullName []asn1.RawValue `asn1:"optional,tag:0"` + RelativeName pkix.RDNSequence `asn1:"optional,tag:1"` +} + +func reverseBitsInAByte(in byte) byte { + b1 := in>>4 | in<<4 + b2 := b1>>2&0x33 | b1<<2&0xcc + b3 := b2>>1&0x55 | b2<<1&0xaa + return b3 +} + +// asn1BitLength returns the bit-length of bitString by considering the +// most-significant bit in a byte to be the "first" bit. This convention +// matches ASN.1, but differs from almost everything else. +func asn1BitLength(bitString []byte) int { + bitLen := len(bitString) * 8 + + for i := range bitString { + b := bitString[len(bitString)-i-1] + + for bit := uint(0); bit < 8; bit++ { + if (b>>bit)&1 == 1 { + return bitLen + } + bitLen-- + } + } + + return 0 +} + +var ( + oidExtensionSubjectKeyId = []int{2, 5, 29, 14} + oidExtensionKeyUsage = []int{2, 5, 29, 15} + oidExtensionExtendedKeyUsage = []int{2, 5, 29, 37} + oidExtensionAuthorityKeyId = []int{2, 5, 29, 35} + oidExtensionBasicConstraints = []int{2, 5, 29, 19} + oidExtensionSubjectAltName = []int{2, 5, 29, 17} + oidExtensionCertificatePolicies = []int{2, 5, 29, 32} + oidExtensionNameConstraints = []int{2, 5, 29, 30} + oidExtensionCRLDistributionPoints = []int{2, 5, 29, 31} + oidExtensionAuthorityInfoAccess = []int{1, 3, 6, 1, 5, 5, 7, 1, 1} + oidExtensionCRLNumber = []int{2, 5, 29, 20} + oidExtensionReasonCode = []int{2, 5, 29, 21} +) + +var ( + oidAuthorityInfoAccessOcsp = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 48, 1} + oidAuthorityInfoAccessIssuers = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 48, 2} +) + +// oidInExtensions reports whether an extension with the given oid exists in +// extensions. +func oidInExtensions(oid asn1.ObjectIdentifier, extensions []pkix.Extension) bool { + for _, e := range extensions { + if e.Id.Equal(oid) { + return true + } + } + return false +} + +// marshalSANs marshals a list of addresses into a the contents of an X.509 +// SubjectAlternativeName extension. +func marshalSANs(dnsNames, emailAddresses []string, ipAddresses []net.IP, uris []*url.URL) (derBytes []byte, err error) { + var rawValues []asn1.RawValue + for _, name := range dnsNames { + if err := isIA5String(name); err != nil { + return nil, err + } + rawValues = append(rawValues, asn1.RawValue{Tag: nameTypeDNS, Class: 2, Bytes: []byte(name)}) + } + for _, email := range emailAddresses { + if err := isIA5String(email); err != nil { + return nil, err + } + rawValues = append(rawValues, asn1.RawValue{Tag: nameTypeEmail, Class: 2, Bytes: []byte(email)}) + } + for _, rawIP := range ipAddresses { + // If possible, we always want to encode IPv4 addresses in 4 bytes. + ip := rawIP.To4() + if ip == nil { + ip = rawIP + } + rawValues = append(rawValues, asn1.RawValue{Tag: nameTypeIP, Class: 2, Bytes: ip}) + } + for _, uri := range uris { + uriStr := uri.String() + if err := isIA5String(uriStr); err != nil { + return nil, err + } + rawValues = append(rawValues, asn1.RawValue{Tag: nameTypeURI, Class: 2, Bytes: []byte(uriStr)}) + } + return asn1.Marshal(rawValues) +} + +func isIA5String(s string) error { + for _, r := range s { + // Per RFC5280 "IA5String is limited to the set of ASCII characters" + if r > unicode.MaxASCII { + return fmt.Errorf("x509: %q cannot be encoded as an IA5String", s) + } + } + + return nil +} + +var x509usepolicies = godebug.New("x509usepolicies") + +func buildCertExtensions(template *Certificate, subjectIsEmpty bool, authorityKeyId []byte, subjectKeyId []byte) (ret []pkix.Extension, err error) { + ret = make([]pkix.Extension, 10 /* maximum number of elements. */) + n := 0 + + if template.KeyUsage != 0 && + !oidInExtensions(oidExtensionKeyUsage, template.ExtraExtensions) { + ret[n], err = marshalKeyUsage(template.KeyUsage) + if err != nil { + return nil, err + } + n++ + } + + if (len(template.ExtKeyUsage) > 0 || len(template.UnknownExtKeyUsage) > 0) && + !oidInExtensions(oidExtensionExtendedKeyUsage, template.ExtraExtensions) { + ret[n], err = marshalExtKeyUsage(template.ExtKeyUsage, template.UnknownExtKeyUsage) + if err != nil { + return nil, err + } + n++ + } + + if template.BasicConstraintsValid && !oidInExtensions(oidExtensionBasicConstraints, template.ExtraExtensions) { + ret[n], err = marshalBasicConstraints(template.IsCA, template.MaxPathLen, template.MaxPathLenZero) + if err != nil { + return nil, err + } + n++ + } + + if len(subjectKeyId) > 0 && !oidInExtensions(oidExtensionSubjectKeyId, template.ExtraExtensions) { + ret[n].Id = oidExtensionSubjectKeyId + ret[n].Value, err = asn1.Marshal(subjectKeyId) + if err != nil { + return + } + n++ + } + + if len(authorityKeyId) > 0 && !oidInExtensions(oidExtensionAuthorityKeyId, template.ExtraExtensions) { + ret[n].Id = oidExtensionAuthorityKeyId + ret[n].Value, err = asn1.Marshal(authKeyId{authorityKeyId}) + if err != nil { + return + } + n++ + } + + if (len(template.OCSPServer) > 0 || len(template.IssuingCertificateURL) > 0) && + !oidInExtensions(oidExtensionAuthorityInfoAccess, template.ExtraExtensions) { + ret[n].Id = oidExtensionAuthorityInfoAccess + var aiaValues []authorityInfoAccess + for _, name := range template.OCSPServer { + aiaValues = append(aiaValues, authorityInfoAccess{ + Method: oidAuthorityInfoAccessOcsp, + Location: asn1.RawValue{Tag: 6, Class: 2, Bytes: []byte(name)}, + }) + } + for _, name := range template.IssuingCertificateURL { + aiaValues = append(aiaValues, authorityInfoAccess{ + Method: oidAuthorityInfoAccessIssuers, + Location: asn1.RawValue{Tag: 6, Class: 2, Bytes: []byte(name)}, + }) + } + ret[n].Value, err = asn1.Marshal(aiaValues) + if err != nil { + return + } + n++ + } + + if (len(template.DNSNames) > 0 || len(template.EmailAddresses) > 0 || len(template.IPAddresses) > 0 || len(template.URIs) > 0) && + !oidInExtensions(oidExtensionSubjectAltName, template.ExtraExtensions) { + ret[n].Id = oidExtensionSubjectAltName + // From RFC 5280, Section 4.2.1.6: + // “If the subject field contains an empty sequence ... then + // subjectAltName extension ... is marked as critical” + ret[n].Critical = subjectIsEmpty + ret[n].Value, err = marshalSANs(template.DNSNames, template.EmailAddresses, template.IPAddresses, template.URIs) + if err != nil { + return + } + n++ + } + + usePolicies := x509usepolicies.Value() != "0" + if ((!usePolicies && len(template.PolicyIdentifiers) > 0) || (usePolicies && len(template.Policies) > 0)) && + !oidInExtensions(oidExtensionCertificatePolicies, template.ExtraExtensions) { + ret[n], err = marshalCertificatePolicies(template.Policies, template.PolicyIdentifiers) + if err != nil { + return nil, err + } + n++ + } + + if (len(template.PermittedDNSDomains) > 0 || len(template.ExcludedDNSDomains) > 0 || + len(template.PermittedIPRanges) > 0 || len(template.ExcludedIPRanges) > 0 || + len(template.PermittedEmailAddresses) > 0 || len(template.ExcludedEmailAddresses) > 0 || + len(template.PermittedURIDomains) > 0 || len(template.ExcludedURIDomains) > 0) && + !oidInExtensions(oidExtensionNameConstraints, template.ExtraExtensions) { + ret[n].Id = oidExtensionNameConstraints + ret[n].Critical = template.PermittedDNSDomainsCritical + + ipAndMask := func(ipNet *net.IPNet) []byte { + maskedIP := ipNet.IP.Mask(ipNet.Mask) + ipAndMask := make([]byte, 0, len(maskedIP)+len(ipNet.Mask)) + ipAndMask = append(ipAndMask, maskedIP...) + ipAndMask = append(ipAndMask, ipNet.Mask...) + return ipAndMask + } + + serialiseConstraints := func(dns []string, ips []*net.IPNet, emails []string, uriDomains []string) (der []byte, err error) { + var b cryptobyte.Builder + + for _, name := range dns { + if err = isIA5String(name); err != nil { + return nil, err + } + + b.AddASN1(cryptobyte_asn1.SEQUENCE, func(b *cryptobyte.Builder) { + b.AddASN1(cryptobyte_asn1.Tag(2).ContextSpecific(), func(b *cryptobyte.Builder) { + b.AddBytes([]byte(name)) + }) + }) + } + + for _, ipNet := range ips { + b.AddASN1(cryptobyte_asn1.SEQUENCE, func(b *cryptobyte.Builder) { + b.AddASN1(cryptobyte_asn1.Tag(7).ContextSpecific(), func(b *cryptobyte.Builder) { + b.AddBytes(ipAndMask(ipNet)) + }) + }) + } + + for _, email := range emails { + if err = isIA5String(email); err != nil { + return nil, err + } + + b.AddASN1(cryptobyte_asn1.SEQUENCE, func(b *cryptobyte.Builder) { + b.AddASN1(cryptobyte_asn1.Tag(1).ContextSpecific(), func(b *cryptobyte.Builder) { + b.AddBytes([]byte(email)) + }) + }) + } + + for _, uriDomain := range uriDomains { + if err = isIA5String(uriDomain); err != nil { + return nil, err + } + + b.AddASN1(cryptobyte_asn1.SEQUENCE, func(b *cryptobyte.Builder) { + b.AddASN1(cryptobyte_asn1.Tag(6).ContextSpecific(), func(b *cryptobyte.Builder) { + b.AddBytes([]byte(uriDomain)) + }) + }) + } + + return b.Bytes() + } + + permitted, err := serialiseConstraints(template.PermittedDNSDomains, template.PermittedIPRanges, template.PermittedEmailAddresses, template.PermittedURIDomains) + if err != nil { + return nil, err + } + + excluded, err := serialiseConstraints(template.ExcludedDNSDomains, template.ExcludedIPRanges, template.ExcludedEmailAddresses, template.ExcludedURIDomains) + if err != nil { + return nil, err + } + + var b cryptobyte.Builder + b.AddASN1(cryptobyte_asn1.SEQUENCE, func(b *cryptobyte.Builder) { + if len(permitted) > 0 { + b.AddASN1(cryptobyte_asn1.Tag(0).ContextSpecific().Constructed(), func(b *cryptobyte.Builder) { + b.AddBytes(permitted) + }) + } + + if len(excluded) > 0 { + b.AddASN1(cryptobyte_asn1.Tag(1).ContextSpecific().Constructed(), func(b *cryptobyte.Builder) { + b.AddBytes(excluded) + }) + } + }) + + ret[n].Value, err = b.Bytes() + if err != nil { + return nil, err + } + n++ + } + + if len(template.CRLDistributionPoints) > 0 && + !oidInExtensions(oidExtensionCRLDistributionPoints, template.ExtraExtensions) { + ret[n].Id = oidExtensionCRLDistributionPoints + + var crlDp []distributionPoint + for _, name := range template.CRLDistributionPoints { + dp := distributionPoint{ + DistributionPoint: distributionPointName{ + FullName: []asn1.RawValue{ + {Tag: 6, Class: 2, Bytes: []byte(name)}, + }, + }, + } + crlDp = append(crlDp, dp) + } + + ret[n].Value, err = asn1.Marshal(crlDp) + if err != nil { + return + } + n++ + } + + // Adding another extension here? Remember to update the maximum number + // of elements in the make() at the top of the function and the list of + // template fields used in CreateCertificate documentation. + + return append(ret[:n], template.ExtraExtensions...), nil +} + +func marshalKeyUsage(ku KeyUsage) (pkix.Extension, error) { + ext := pkix.Extension{Id: oidExtensionKeyUsage, Critical: true} + + var a [2]byte + a[0] = reverseBitsInAByte(byte(ku)) + a[1] = reverseBitsInAByte(byte(ku >> 8)) + + l := 1 + if a[1] != 0 { + l = 2 + } + + bitString := a[:l] + var err error + ext.Value, err = asn1.Marshal(asn1.BitString{Bytes: bitString, BitLength: asn1BitLength(bitString)}) + return ext, err +} + +func marshalExtKeyUsage(extUsages []ExtKeyUsage, unknownUsages []asn1.ObjectIdentifier) (pkix.Extension, error) { + ext := pkix.Extension{Id: oidExtensionExtendedKeyUsage} + + oids := make([]asn1.ObjectIdentifier, len(extUsages)+len(unknownUsages)) + for i, u := range extUsages { + if oid, ok := oidFromExtKeyUsage(u); ok { + oids[i] = oid + } else { + return ext, errors.New("x509: unknown extended key usage") + } + } + + copy(oids[len(extUsages):], unknownUsages) + + var err error + ext.Value, err = asn1.Marshal(oids) + return ext, err +} + +func marshalBasicConstraints(isCA bool, maxPathLen int, maxPathLenZero bool) (pkix.Extension, error) { + ext := pkix.Extension{Id: oidExtensionBasicConstraints, Critical: true} + // Leaving MaxPathLen as zero indicates that no maximum path + // length is desired, unless MaxPathLenZero is set. A value of + // -1 causes encoding/asn1 to omit the value as desired. + if maxPathLen == 0 && !maxPathLenZero { + maxPathLen = -1 + } + var err error + ext.Value, err = asn1.Marshal(basicConstraints{isCA, maxPathLen}) + return ext, err +} + +func marshalCertificatePolicies(policies []OID, policyIdentifiers []asn1.ObjectIdentifier) (pkix.Extension, error) { + ext := pkix.Extension{Id: oidExtensionCertificatePolicies} + + b := cryptobyte.NewBuilder(make([]byte, 0, 128)) + b.AddASN1(cryptobyte_asn1.SEQUENCE, func(child *cryptobyte.Builder) { + if x509usepolicies.Value() != "0" { + x509usepolicies.IncNonDefault() + for _, v := range policies { + child.AddASN1(cryptobyte_asn1.SEQUENCE, func(child *cryptobyte.Builder) { + child.AddASN1(cryptobyte_asn1.OBJECT_IDENTIFIER, func(child *cryptobyte.Builder) { + if len(v.der) == 0 { + child.SetError(errors.New("invalid policy object identifier")) + return + } + child.AddBytes(v.der) + }) + }) + } + } else { + for _, v := range policyIdentifiers { + child.AddASN1(cryptobyte_asn1.SEQUENCE, func(child *cryptobyte.Builder) { + child.AddASN1ObjectIdentifier(v) + }) + } + } + }) + + var err error + ext.Value, err = b.Bytes() + return ext, err +} + +func buildCSRExtensions(template *CertificateRequest) ([]pkix.Extension, error) { + var ret []pkix.Extension + + if (len(template.DNSNames) > 0 || len(template.EmailAddresses) > 0 || len(template.IPAddresses) > 0 || len(template.URIs) > 0) && + !oidInExtensions(oidExtensionSubjectAltName, template.ExtraExtensions) { + sanBytes, err := marshalSANs(template.DNSNames, template.EmailAddresses, template.IPAddresses, template.URIs) + if err != nil { + return nil, err + } + + ret = append(ret, pkix.Extension{ + Id: oidExtensionSubjectAltName, + Value: sanBytes, + }) + } + + return append(ret, template.ExtraExtensions...), nil +} + +func subjectBytes(cert *Certificate) ([]byte, error) { + if len(cert.RawSubject) > 0 { + return cert.RawSubject, nil + } + + return asn1.Marshal(cert.Subject.ToRDNSequence()) +} + +// signingParamsForKey returns the signature algorithm and its Algorithm +// Identifier to use for signing, based on the key type. If sigAlgo is not zero +// then it overrides the default. +func signingParamsForKey(key crypto.Signer, sigAlgo SignatureAlgorithm) (SignatureAlgorithm, pkix.AlgorithmIdentifier, error) { + var ai pkix.AlgorithmIdentifier + var pubType PublicKeyAlgorithm + var defaultAlgo SignatureAlgorithm + + switch pub := key.Public().(type) { + case *rsa.PublicKey: + pubType = RSA + defaultAlgo = SHA256WithRSA + + case *ecdsa.PublicKey: + pubType = ECDSA + switch pub.Curve { + case elliptic.P224(), elliptic.P256(): + defaultAlgo = ECDSAWithSHA256 + case elliptic.P384(): + defaultAlgo = ECDSAWithSHA384 + case elliptic.P521(): + defaultAlgo = ECDSAWithSHA512 + default: + return 0, ai, errors.New("x509: unsupported elliptic curve") + } + + case ed25519.PublicKey: + pubType = Ed25519 + defaultAlgo = PureEd25519 + + default: + return 0, ai, errors.New("x509: only RSA, ECDSA and Ed25519 keys supported") + } + + if sigAlgo == 0 { + sigAlgo = defaultAlgo + } + + for _, details := range signatureAlgorithmDetails { + if details.algo == sigAlgo { + if details.pubKeyAlgo != pubType { + return 0, ai, errors.New("x509: requested SignatureAlgorithm does not match private key type") + } + if details.hash == crypto.MD5 { + return 0, ai, errors.New("x509: signing with MD5 is not supported") + } + + return sigAlgo, pkix.AlgorithmIdentifier{ + Algorithm: details.oid, + Parameters: details.params, + }, nil + } + } + + return 0, ai, errors.New("x509: unknown SignatureAlgorithm") +} + +func signTBS(tbs []byte, key crypto.Signer, sigAlg SignatureAlgorithm, rand io.Reader) ([]byte, error) { + hashFunc := sigAlg.hashFunc() + + var signerOpts crypto.SignerOpts = hashFunc + if sigAlg.isRSAPSS() { + signerOpts = &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthEqualsHash, + Hash: hashFunc, + } + } + + signature, err := crypto.SignMessage(key, rand, tbs, signerOpts) + if err != nil { + return nil, err + } + + // Check the signature to ensure the crypto.Signer behaved correctly. + if err := checkSignature(sigAlg, tbs, signature, key.Public(), true); err != nil { + return nil, fmt.Errorf("x509: signature returned by signer is invalid: %w", err) + } + + return signature, nil +} + +// emptyASN1Subject is the ASN.1 DER encoding of an empty Subject, which is +// just an empty SEQUENCE. +var emptyASN1Subject = []byte{0x30, 0} + +// CreateCertificate creates a new X.509 v3 certificate based on a template. +// The following members of template are currently used: +// +// - AuthorityKeyId +// - BasicConstraintsValid +// - CRLDistributionPoints +// - DNSNames +// - EmailAddresses +// - ExcludedDNSDomains +// - ExcludedEmailAddresses +// - ExcludedIPRanges +// - ExcludedURIDomains +// - ExtKeyUsage +// - ExtraExtensions +// - IPAddresses +// - IsCA +// - IssuingCertificateURL +// - KeyUsage +// - MaxPathLen +// - MaxPathLenZero +// - NotAfter +// - NotBefore +// - OCSPServer +// - PermittedDNSDomains +// - PermittedDNSDomainsCritical +// - PermittedEmailAddresses +// - PermittedIPRanges +// - PermittedURIDomains +// - PolicyIdentifiers (see note below) +// - Policies (see note below) +// - SerialNumber +// - SignatureAlgorithm +// - Subject +// - SubjectKeyId +// - URIs +// - UnknownExtKeyUsage +// +// The certificate is signed by parent. If parent is equal to template then the +// certificate is self-signed. The parameter pub is the public key of the +// certificate to be generated and priv is the private key of the signer. +// +// The returned slice is the certificate in DER encoding. +// +// The currently supported key types are *rsa.PublicKey, *ecdsa.PublicKey and +// ed25519.PublicKey. pub must be a supported key type, and priv must be a +// crypto.Signer or crypto.MessageSigner with a supported public key. +// +// The AuthorityKeyId will be taken from the SubjectKeyId of parent, if any, +// unless the resulting certificate is self-signed. Otherwise the value from +// template will be used. +// +// If SubjectKeyId from template is empty and the template is a CA, SubjectKeyId +// will be generated from the hash of the public key. +// +// If template.SerialNumber is nil, a serial number will be generated which +// conforms to RFC 5280, Section 4.1.2.2 using entropy from rand. +// +// The PolicyIdentifier and Policies fields can both be used to marshal certificate +// policy OIDs. By default, only the Policies is marshaled, but if the +// GODEBUG setting "x509usepolicies" has the value "0", the PolicyIdentifiers field will +// be marshaled instead of the Policies field. This changed in Go 1.24. The Policies field can +// be used to marshal policy OIDs which have components that are larger than 31 +// bits. +func CreateCertificate(rand io.Reader, template, parent *Certificate, pub, priv any) ([]byte, error) { + key, ok := priv.(crypto.Signer) + if !ok { + return nil, errors.New("x509: certificate private key does not implement crypto.Signer") + } + + serialNumber := template.SerialNumber + if serialNumber == nil { + // Generate a serial number following RFC 5280, Section 4.1.2.2 if one + // is not provided. The serial number must be positive and at most 20 + // octets *when encoded*. + serialBytes := make([]byte, 20) + if _, err := io.ReadFull(rand, serialBytes); err != nil { + return nil, err + } + // If the top bit is set, the serial will be padded with a leading zero + // byte during encoding, so that it's not interpreted as a negative + // integer. This padding would make the serial 21 octets so we clear the + // top bit to ensure the correct length in all cases. + serialBytes[0] &= 0b0111_1111 + serialNumber = new(big.Int).SetBytes(serialBytes) + } + + // RFC 5280 Section 4.1.2.2: serial number must be positive + // + // We _should_ also restrict serials to <= 20 octets, but it turns out a lot of people + // get this wrong, in part because the encoding can itself alter the length of the + // serial. For now we accept these non-conformant serials. + if serialNumber.Sign() == -1 { + return nil, errors.New("x509: serial number must be positive") + } + + if template.BasicConstraintsValid && template.MaxPathLen < -1 { + return nil, errors.New("x509: invalid MaxPathLen, must be greater or equal to -1") + } + + if template.BasicConstraintsValid && !template.IsCA && template.MaxPathLen != -1 && (template.MaxPathLen != 0 || template.MaxPathLenZero) { + return nil, errors.New("x509: only CAs are allowed to specify MaxPathLen") + } + + signatureAlgorithm, algorithmIdentifier, err := signingParamsForKey(key, template.SignatureAlgorithm) + if err != nil { + return nil, err + } + + publicKeyBytes, publicKeyAlgorithm, err := marshalPublicKey(pub) + if err != nil { + return nil, err + } + if getPublicKeyAlgorithmFromOID(publicKeyAlgorithm.Algorithm) == UnknownPublicKeyAlgorithm { + return nil, fmt.Errorf("x509: unsupported public key type: %T", pub) + } + + asn1Issuer, err := subjectBytes(parent) + if err != nil { + return nil, err + } + + asn1Subject, err := subjectBytes(template) + if err != nil { + return nil, err + } + + authorityKeyId := template.AuthorityKeyId + if !bytes.Equal(asn1Issuer, asn1Subject) && len(parent.SubjectKeyId) > 0 { + authorityKeyId = parent.SubjectKeyId + } + + subjectKeyId := template.SubjectKeyId + if len(subjectKeyId) == 0 && template.IsCA { + if x509sha256skid.Value() == "0" { + x509sha256skid.IncNonDefault() + // SubjectKeyId generated using method 1 in RFC 5280, Section 4.2.1.2: + // (1) The keyIdentifier is composed of the 160-bit SHA-1 hash of the + // value of the BIT STRING subjectPublicKey (excluding the tag, + // length, and number of unused bits). + h := sha1.Sum(publicKeyBytes) + subjectKeyId = h[:] + } else { + // SubjectKeyId generated using method 1 in RFC 7093, Section 2: + // 1) The keyIdentifier is composed of the leftmost 160-bits of the + // SHA-256 hash of the value of the BIT STRING subjectPublicKey + // (excluding the tag, length, and number of unused bits). + h := sha256.Sum256(publicKeyBytes) + subjectKeyId = h[:20] + } + } + + // Check that the signer's public key matches the private key, if available. + type privateKey interface { + Equal(crypto.PublicKey) bool + } + if privPub, ok := key.Public().(privateKey); !ok { + return nil, errors.New("x509: internal error: supported public key does not implement Equal") + } else if parent.PublicKey != nil && !privPub.Equal(parent.PublicKey) { + return nil, errors.New("x509: provided PrivateKey doesn't match parent's PublicKey") + } + + extensions, err := buildCertExtensions(template, bytes.Equal(asn1Subject, emptyASN1Subject), authorityKeyId, subjectKeyId) + if err != nil { + return nil, err + } + + encodedPublicKey := asn1.BitString{BitLength: len(publicKeyBytes) * 8, Bytes: publicKeyBytes} + c := tbsCertificate{ + Version: 2, + SerialNumber: serialNumber, + SignatureAlgorithm: algorithmIdentifier, + Issuer: asn1.RawValue{FullBytes: asn1Issuer}, + Validity: validity{template.NotBefore.UTC(), template.NotAfter.UTC()}, + Subject: asn1.RawValue{FullBytes: asn1Subject}, + PublicKey: publicKeyInfo{nil, publicKeyAlgorithm, encodedPublicKey}, + Extensions: extensions, + } + + tbsCertContents, err := asn1.Marshal(c) + if err != nil { + return nil, err + } + c.Raw = tbsCertContents + + signature, err := signTBS(tbsCertContents, key, signatureAlgorithm, rand) + if err != nil { + return nil, err + } + + return asn1.Marshal(certificate{ + TBSCertificate: c, + SignatureAlgorithm: algorithmIdentifier, + SignatureValue: asn1.BitString{Bytes: signature, BitLength: len(signature) * 8}, + }) +} + +var x509sha256skid = godebug.New("x509sha256skid") + +// pemCRLPrefix is the magic string that indicates that we have a PEM encoded +// CRL. +var pemCRLPrefix = []byte("-----BEGIN X509 CRL") + +// pemType is the type of a PEM encoded CRL. +var pemType = "X509 CRL" + +// ParseCRL parses a CRL from the given bytes. It's often the case that PEM +// encoded CRLs will appear where they should be DER encoded, so this function +// will transparently handle PEM encoding as long as there isn't any leading +// garbage. +// +// Deprecated: Use [ParseRevocationList] instead. +func ParseCRL(crlBytes []byte) (*pkix.CertificateList, error) { + if bytes.HasPrefix(crlBytes, pemCRLPrefix) { + block, _ := pem.Decode(crlBytes) + if block != nil && block.Type == pemType { + crlBytes = block.Bytes + } + } + return ParseDERCRL(crlBytes) +} + +// ParseDERCRL parses a DER encoded CRL from the given bytes. +// +// Deprecated: Use [ParseRevocationList] instead. +func ParseDERCRL(derBytes []byte) (*pkix.CertificateList, error) { + certList := new(pkix.CertificateList) + if rest, err := asn1.Unmarshal(derBytes, certList); err != nil { + return nil, err + } else if len(rest) != 0 { + return nil, errors.New("x509: trailing data after CRL") + } + return certList, nil +} + +// CreateCRL returns a DER encoded CRL, signed by this Certificate, that +// contains the given list of revoked certificates. +// +// Deprecated: this method does not generate an RFC 5280 conformant X.509 v2 CRL. +// To generate a standards compliant CRL, use [CreateRevocationList] instead. +func (c *Certificate) CreateCRL(rand io.Reader, priv any, revokedCerts []pkix.RevokedCertificate, now, expiry time.Time) (crlBytes []byte, err error) { + key, ok := priv.(crypto.Signer) + if !ok { + return nil, errors.New("x509: certificate private key does not implement crypto.Signer") + } + + signatureAlgorithm, algorithmIdentifier, err := signingParamsForKey(key, 0) + if err != nil { + return nil, err + } + + // Force revocation times to UTC per RFC 5280. + revokedCertsUTC := make([]pkix.RevokedCertificate, len(revokedCerts)) + for i, rc := range revokedCerts { + rc.RevocationTime = rc.RevocationTime.UTC() + revokedCertsUTC[i] = rc + } + + tbsCertList := pkix.TBSCertificateList{ + Version: 1, + Signature: algorithmIdentifier, + Issuer: c.Subject.ToRDNSequence(), + ThisUpdate: now.UTC(), + NextUpdate: expiry.UTC(), + RevokedCertificates: revokedCertsUTC, + } + + // Authority Key Id + if len(c.SubjectKeyId) > 0 { + var aki pkix.Extension + aki.Id = oidExtensionAuthorityKeyId + aki.Value, err = asn1.Marshal(authKeyId{Id: c.SubjectKeyId}) + if err != nil { + return nil, err + } + tbsCertList.Extensions = append(tbsCertList.Extensions, aki) + } + + tbsCertListContents, err := asn1.Marshal(tbsCertList) + if err != nil { + return nil, err + } + tbsCertList.Raw = tbsCertListContents + + signature, err := signTBS(tbsCertListContents, key, signatureAlgorithm, rand) + if err != nil { + return nil, err + } + + return asn1.Marshal(pkix.CertificateList{ + TBSCertList: tbsCertList, + SignatureAlgorithm: algorithmIdentifier, + SignatureValue: asn1.BitString{Bytes: signature, BitLength: len(signature) * 8}, + }) +} + +// CertificateRequest represents a PKCS #10, certificate signature request. +type CertificateRequest struct { + Raw []byte // Complete ASN.1 DER content (CSR, signature algorithm and signature). + RawTBSCertificateRequest []byte // Certificate request info part of raw ASN.1 DER content. + RawSubjectPublicKeyInfo []byte // DER encoded SubjectPublicKeyInfo. + RawSubject []byte // DER encoded Subject. + + Version int + Signature []byte + SignatureAlgorithm SignatureAlgorithm + + PublicKeyAlgorithm PublicKeyAlgorithm + PublicKey any + + Subject pkix.Name + + // Attributes contains the CSR attributes that can parse as + // pkix.AttributeTypeAndValueSET. + // + // Deprecated: Use Extensions and ExtraExtensions instead for parsing and + // generating the requestedExtensions attribute. + Attributes []pkix.AttributeTypeAndValueSET + + // Extensions contains all requested extensions, in raw form. When parsing + // CSRs, this can be used to extract extensions that are not parsed by this + // package. + Extensions []pkix.Extension + + // ExtraExtensions contains extensions to be copied, raw, into any CSR + // marshaled by CreateCertificateRequest. Values override any extensions + // that would otherwise be produced based on the other fields but are + // overridden by any extensions specified in Attributes. + // + // The ExtraExtensions field is not populated by ParseCertificateRequest, + // see Extensions instead. + ExtraExtensions []pkix.Extension + + // Subject Alternate Name values. + DNSNames []string + EmailAddresses []string + IPAddresses []net.IP + URIs []*url.URL +} + +// These structures reflect the ASN.1 structure of X.509 certificate +// signature requests (see RFC 2986): + +type tbsCertificateRequest struct { + Raw asn1.RawContent + Version int + Subject asn1.RawValue + PublicKey publicKeyInfo + RawAttributes []asn1.RawValue `asn1:"tag:0"` +} + +type certificateRequest struct { + Raw asn1.RawContent + TBSCSR tbsCertificateRequest + SignatureAlgorithm pkix.AlgorithmIdentifier + SignatureValue asn1.BitString +} + +// oidExtensionRequest is a PKCS #9 OBJECT IDENTIFIER that indicates requested +// extensions in a CSR. +var oidExtensionRequest = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 14} + +// newRawAttributes converts AttributeTypeAndValueSETs from a template +// CertificateRequest's Attributes into tbsCertificateRequest RawAttributes. +func newRawAttributes(attributes []pkix.AttributeTypeAndValueSET) ([]asn1.RawValue, error) { + var rawAttributes []asn1.RawValue + b, err := asn1.Marshal(attributes) + if err != nil { + return nil, err + } + rest, err := asn1.Unmarshal(b, &rawAttributes) + if err != nil { + return nil, err + } + if len(rest) != 0 { + return nil, errors.New("x509: failed to unmarshal raw CSR Attributes") + } + return rawAttributes, nil +} + +// parseRawAttributes Unmarshals RawAttributes into AttributeTypeAndValueSETs. +func parseRawAttributes(rawAttributes []asn1.RawValue) []pkix.AttributeTypeAndValueSET { + var attributes []pkix.AttributeTypeAndValueSET + for _, rawAttr := range rawAttributes { + var attr pkix.AttributeTypeAndValueSET + rest, err := asn1.Unmarshal(rawAttr.FullBytes, &attr) + // Ignore attributes that don't parse into pkix.AttributeTypeAndValueSET + // (i.e.: challengePassword or unstructuredName). + if err == nil && len(rest) == 0 { + attributes = append(attributes, attr) + } + } + return attributes +} + +// parseCSRExtensions parses the attributes from a CSR and extracts any +// requested extensions. +func parseCSRExtensions(rawAttributes []asn1.RawValue) ([]pkix.Extension, error) { + // pkcs10Attribute reflects the Attribute structure from RFC 2986, Section 4.1. + type pkcs10Attribute struct { + Id asn1.ObjectIdentifier + Values []asn1.RawValue `asn1:"set"` + } + + var ret []pkix.Extension + requestedExts := make(map[string]bool) + for _, rawAttr := range rawAttributes { + var attr pkcs10Attribute + if rest, err := asn1.Unmarshal(rawAttr.FullBytes, &attr); err != nil || len(rest) != 0 || len(attr.Values) == 0 { + // Ignore attributes that don't parse. + continue + } + + if !attr.Id.Equal(oidExtensionRequest) { + continue + } + + var extensions []pkix.Extension + if _, err := asn1.Unmarshal(attr.Values[0].FullBytes, &extensions); err != nil { + return nil, err + } + for _, ext := range extensions { + oidStr := ext.Id.String() + if requestedExts[oidStr] { + return nil, errors.New("x509: certificate request contains duplicate requested extensions") + } + requestedExts[oidStr] = true + } + ret = append(ret, extensions...) + } + + return ret, nil +} + +// CreateCertificateRequest creates a new certificate request based on a +// template. The following members of template are used: +// +// - SignatureAlgorithm +// - Subject +// - DNSNames +// - EmailAddresses +// - IPAddresses +// - URIs +// - ExtraExtensions +// - Attributes (deprecated) +// +// priv is the private key to sign the CSR with, and the corresponding public +// key will be included in the CSR. It must implement crypto.Signer or +// crypto.MessageSigner and its Public() method must return a *rsa.PublicKey or +// a *ecdsa.PublicKey or a ed25519.PublicKey. (A *rsa.PrivateKey, +// *ecdsa.PrivateKey or ed25519.PrivateKey satisfies this.) +// +// The returned slice is the certificate request in DER encoding. +func CreateCertificateRequest(rand io.Reader, template *CertificateRequest, priv any) (csr []byte, err error) { + key, ok := priv.(crypto.Signer) + if !ok { + return nil, errors.New("x509: certificate private key does not implement crypto.Signer") + } + + signatureAlgorithm, algorithmIdentifier, err := signingParamsForKey(key, template.SignatureAlgorithm) + if err != nil { + return nil, err + } + + var publicKeyBytes []byte + var publicKeyAlgorithm pkix.AlgorithmIdentifier + publicKeyBytes, publicKeyAlgorithm, err = marshalPublicKey(key.Public()) + if err != nil { + return nil, err + } + + extensions, err := buildCSRExtensions(template) + if err != nil { + return nil, err + } + + // Make a copy of template.Attributes because we may alter it below. + attributes := make([]pkix.AttributeTypeAndValueSET, 0, len(template.Attributes)) + for _, attr := range template.Attributes { + values := make([][]pkix.AttributeTypeAndValue, len(attr.Value)) + copy(values, attr.Value) + attributes = append(attributes, pkix.AttributeTypeAndValueSET{ + Type: attr.Type, + Value: values, + }) + } + + extensionsAppended := false + if len(extensions) > 0 { + // Append the extensions to an existing attribute if possible. + for _, atvSet := range attributes { + if !atvSet.Type.Equal(oidExtensionRequest) || len(atvSet.Value) == 0 { + continue + } + + // specifiedExtensions contains all the extensions that we + // found specified via template.Attributes. + specifiedExtensions := make(map[string]bool) + + for _, atvs := range atvSet.Value { + for _, atv := range atvs { + specifiedExtensions[atv.Type.String()] = true + } + } + + newValue := make([]pkix.AttributeTypeAndValue, 0, len(atvSet.Value[0])+len(extensions)) + newValue = append(newValue, atvSet.Value[0]...) + + for _, e := range extensions { + if specifiedExtensions[e.Id.String()] { + // Attributes already contained a value for + // this extension and it takes priority. + continue + } + + newValue = append(newValue, pkix.AttributeTypeAndValue{ + // There is no place for the critical + // flag in an AttributeTypeAndValue. + Type: e.Id, + Value: e.Value, + }) + } + + atvSet.Value[0] = newValue + extensionsAppended = true + break + } + } + + rawAttributes, err := newRawAttributes(attributes) + if err != nil { + return nil, err + } + + // If not included in attributes, add a new attribute for the + // extensions. + if len(extensions) > 0 && !extensionsAppended { + attr := struct { + Type asn1.ObjectIdentifier + Value [][]pkix.Extension `asn1:"set"` + }{ + Type: oidExtensionRequest, + Value: [][]pkix.Extension{extensions}, + } + + b, err := asn1.Marshal(attr) + if err != nil { + return nil, errors.New("x509: failed to serialise extensions attribute: " + err.Error()) + } + + var rawValue asn1.RawValue + if _, err := asn1.Unmarshal(b, &rawValue); err != nil { + return nil, err + } + + rawAttributes = append(rawAttributes, rawValue) + } + + asn1Subject := template.RawSubject + if len(asn1Subject) == 0 { + asn1Subject, err = asn1.Marshal(template.Subject.ToRDNSequence()) + if err != nil { + return nil, err + } + } + + tbsCSR := tbsCertificateRequest{ + Version: 0, // PKCS #10, RFC 2986 + Subject: asn1.RawValue{FullBytes: asn1Subject}, + PublicKey: publicKeyInfo{ + Algorithm: publicKeyAlgorithm, + PublicKey: asn1.BitString{ + Bytes: publicKeyBytes, + BitLength: len(publicKeyBytes) * 8, + }, + }, + RawAttributes: rawAttributes, + } + + tbsCSRContents, err := asn1.Marshal(tbsCSR) + if err != nil { + return nil, err + } + tbsCSR.Raw = tbsCSRContents + + signature, err := signTBS(tbsCSRContents, key, signatureAlgorithm, rand) + if err != nil { + return nil, err + } + + return asn1.Marshal(certificateRequest{ + TBSCSR: tbsCSR, + SignatureAlgorithm: algorithmIdentifier, + SignatureValue: asn1.BitString{Bytes: signature, BitLength: len(signature) * 8}, + }) +} + +// ParseCertificateRequest parses a single certificate request from the +// given ASN.1 DER data. +func ParseCertificateRequest(asn1Data []byte) (*CertificateRequest, error) { + var csr certificateRequest + + rest, err := asn1.Unmarshal(asn1Data, &csr) + if err != nil { + return nil, err + } else if len(rest) != 0 { + return nil, asn1.SyntaxError{Msg: "trailing data"} + } + + return parseCertificateRequest(&csr) +} + +func parseCertificateRequest(in *certificateRequest) (*CertificateRequest, error) { + out := &CertificateRequest{ + Raw: in.Raw, + RawTBSCertificateRequest: in.TBSCSR.Raw, + RawSubjectPublicKeyInfo: in.TBSCSR.PublicKey.Raw, + RawSubject: in.TBSCSR.Subject.FullBytes, + + Signature: in.SignatureValue.RightAlign(), + SignatureAlgorithm: getSignatureAlgorithmFromAI(in.SignatureAlgorithm), + + PublicKeyAlgorithm: getPublicKeyAlgorithmFromOID(in.TBSCSR.PublicKey.Algorithm.Algorithm), + + Version: in.TBSCSR.Version, + Attributes: parseRawAttributes(in.TBSCSR.RawAttributes), + } + + var err error + if out.PublicKeyAlgorithm != UnknownPublicKeyAlgorithm { + out.PublicKey, err = parsePublicKey(&in.TBSCSR.PublicKey) + if err != nil { + return nil, err + } + } + + var subject pkix.RDNSequence + if rest, err := asn1.Unmarshal(in.TBSCSR.Subject.FullBytes, &subject); err != nil { + return nil, err + } else if len(rest) != 0 { + return nil, errors.New("x509: trailing data after X.509 Subject") + } + + out.Subject.FillFromRDNSequence(&subject) + + if out.Extensions, err = parseCSRExtensions(in.TBSCSR.RawAttributes); err != nil { + return nil, err + } + + for _, extension := range out.Extensions { + switch { + case extension.Id.Equal(oidExtensionSubjectAltName): + out.DNSNames, out.EmailAddresses, out.IPAddresses, out.URIs, err = parseSANExtension(extension.Value) + if err != nil { + return nil, err + } + } + } + + return out, nil +} + +// CheckSignature reports whether the signature on c is valid. +func (c *CertificateRequest) CheckSignature() error { + return checkSignature(c.SignatureAlgorithm, c.RawTBSCertificateRequest, c.Signature, c.PublicKey, true) +} + +// RevocationListEntry represents an entry in the revokedCertificates +// sequence of a CRL. +type RevocationListEntry struct { + // Raw contains the raw bytes of the revokedCertificates entry. It is set when + // parsing a CRL; it is ignored when generating a CRL. + Raw []byte + + // SerialNumber represents the serial number of a revoked certificate. It is + // both used when creating a CRL and populated when parsing a CRL. It must not + // be nil. + SerialNumber *big.Int + // RevocationTime represents the time at which the certificate was revoked. It + // is both used when creating a CRL and populated when parsing a CRL. It must + // not be the zero time. + RevocationTime time.Time + // ReasonCode represents the reason for revocation, using the integer enum + // values specified in RFC 5280 Section 5.3.1. When creating a CRL, the zero + // value will result in the reasonCode extension being omitted. When parsing a + // CRL, the zero value may represent either the reasonCode extension being + // absent (which implies the default revocation reason of 0/Unspecified), or + // it may represent the reasonCode extension being present and explicitly + // containing a value of 0/Unspecified (which should not happen according to + // the DER encoding rules, but can and does happen anyway). + ReasonCode int + + // Extensions contains raw X.509 extensions. When parsing CRL entries, + // this can be used to extract non-critical extensions that are not + // parsed by this package. When marshaling CRL entries, the Extensions + // field is ignored, see ExtraExtensions. + Extensions []pkix.Extension + // ExtraExtensions contains extensions to be copied, raw, into any + // marshaled CRL entries. Values override any extensions that would + // otherwise be produced based on the other fields. The ExtraExtensions + // field is not populated when parsing CRL entries, see Extensions. + ExtraExtensions []pkix.Extension +} + +// RevocationList represents a [Certificate] Revocation List (CRL) as specified +// by RFC 5280. +type RevocationList struct { + // Raw contains the complete ASN.1 DER content of the CRL (tbsCertList, + // signatureAlgorithm, and signatureValue.) + Raw []byte + // RawTBSRevocationList contains just the tbsCertList portion of the ASN.1 + // DER. + RawTBSRevocationList []byte + // RawIssuer contains the DER encoded Issuer. + RawIssuer []byte + + // Issuer contains the DN of the issuing certificate. + Issuer pkix.Name + // AuthorityKeyId is used to identify the public key associated with the + // issuing certificate. It is populated from the authorityKeyIdentifier + // extension when parsing a CRL. It is ignored when creating a CRL; the + // extension is populated from the issuing certificate itself. + AuthorityKeyId []byte + + Signature []byte + // SignatureAlgorithm is used to determine the signature algorithm to be + // used when signing the CRL. If 0 the default algorithm for the signing + // key will be used. + SignatureAlgorithm SignatureAlgorithm + + // RevokedCertificateEntries represents the revokedCertificates sequence in + // the CRL. It is used when creating a CRL and also populated when parsing a + // CRL. When creating a CRL, it may be empty or nil, in which case the + // revokedCertificates ASN.1 sequence will be omitted from the CRL entirely. + RevokedCertificateEntries []RevocationListEntry + + // RevokedCertificates is used to populate the revokedCertificates + // sequence in the CRL if RevokedCertificateEntries is empty. It may be empty + // or nil, in which case an empty CRL will be created. + // + // Deprecated: Use RevokedCertificateEntries instead. + RevokedCertificates []pkix.RevokedCertificate + + // Number is used to populate the X.509 v2 cRLNumber extension in the CRL, + // which should be a monotonically increasing sequence number for a given + // CRL scope and CRL issuer. It is also populated from the cRLNumber + // extension when parsing a CRL. + Number *big.Int + + // ThisUpdate is used to populate the thisUpdate field in the CRL, which + // indicates the issuance date of the CRL. + ThisUpdate time.Time + // NextUpdate is used to populate the nextUpdate field in the CRL, which + // indicates the date by which the next CRL will be issued. NextUpdate + // must be greater than ThisUpdate. + NextUpdate time.Time + + // Extensions contains raw X.509 extensions. When creating a CRL, + // the Extensions field is ignored, see ExtraExtensions. + Extensions []pkix.Extension + + // ExtraExtensions contains any additional extensions to add directly to + // the CRL. + ExtraExtensions []pkix.Extension +} + +// These structures reflect the ASN.1 structure of X.509 CRLs better than +// the existing crypto/x509/pkix variants do. These mirror the existing +// certificate structs in this file. +// +// Notably, we include issuer as an asn1.RawValue, mirroring the behavior of +// tbsCertificate and allowing raw (unparsed) subjects to be passed cleanly. +type certificateList struct { + TBSCertList tbsCertificateList + SignatureAlgorithm pkix.AlgorithmIdentifier + SignatureValue asn1.BitString +} + +type tbsCertificateList struct { + Raw asn1.RawContent + Version int `asn1:"optional,default:0"` + Signature pkix.AlgorithmIdentifier + Issuer asn1.RawValue + ThisUpdate time.Time + NextUpdate time.Time `asn1:"optional"` + RevokedCertificates []pkix.RevokedCertificate `asn1:"optional"` + Extensions []pkix.Extension `asn1:"tag:0,optional,explicit"` +} + +// CreateRevocationList creates a new X.509 v2 [Certificate] Revocation List, +// according to RFC 5280, based on template. +// +// The CRL is signed by priv which should be a crypto.Signer or +// crypto.MessageSigner associated with the public key in the issuer +// certificate. +// +// The issuer may not be nil, and the crlSign bit must be set in [KeyUsage] in +// order to use it as a CRL issuer. +// +// The issuer distinguished name CRL field and authority key identifier +// extension are populated using the issuer certificate. issuer must have +// SubjectKeyId set. +func CreateRevocationList(rand io.Reader, template *RevocationList, issuer *Certificate, priv crypto.Signer) ([]byte, error) { + if template == nil { + return nil, errors.New("x509: template can not be nil") + } + if issuer == nil { + return nil, errors.New("x509: issuer can not be nil") + } + if (issuer.KeyUsage & KeyUsageCRLSign) == 0 { + return nil, errors.New("x509: issuer must have the crlSign key usage bit set") + } + if len(issuer.SubjectKeyId) == 0 { + return nil, errors.New("x509: issuer certificate doesn't contain a subject key identifier") + } + if template.NextUpdate.Before(template.ThisUpdate) { + return nil, errors.New("x509: template.ThisUpdate is after template.NextUpdate") + } + if template.Number == nil { + return nil, errors.New("x509: template contains nil Number field") + } + + signatureAlgorithm, algorithmIdentifier, err := signingParamsForKey(priv, template.SignatureAlgorithm) + if err != nil { + return nil, err + } + + var revokedCerts []pkix.RevokedCertificate + // Only process the deprecated RevokedCertificates field if it is populated + // and the new RevokedCertificateEntries field is not populated. + if len(template.RevokedCertificates) > 0 && len(template.RevokedCertificateEntries) == 0 { + // Force revocation times to UTC per RFC 5280. + revokedCerts = make([]pkix.RevokedCertificate, len(template.RevokedCertificates)) + for i, rc := range template.RevokedCertificates { + rc.RevocationTime = rc.RevocationTime.UTC() + revokedCerts[i] = rc + } + } else { + // Convert the ReasonCode field to a proper extension, and force revocation + // times to UTC per RFC 5280. + revokedCerts = make([]pkix.RevokedCertificate, len(template.RevokedCertificateEntries)) + for i, rce := range template.RevokedCertificateEntries { + if rce.SerialNumber == nil { + return nil, errors.New("x509: template contains entry with nil SerialNumber field") + } + if rce.RevocationTime.IsZero() { + return nil, errors.New("x509: template contains entry with zero RevocationTime field") + } + + rc := pkix.RevokedCertificate{ + SerialNumber: rce.SerialNumber, + RevocationTime: rce.RevocationTime.UTC(), + } + + // Copy over any extra extensions, except for a Reason Code extension, + // because we'll synthesize that ourselves to ensure it is correct. + exts := make([]pkix.Extension, 0, len(rce.ExtraExtensions)) + for _, ext := range rce.ExtraExtensions { + if ext.Id.Equal(oidExtensionReasonCode) { + return nil, errors.New("x509: template contains entry with ReasonCode ExtraExtension; use ReasonCode field instead") + } + exts = append(exts, ext) + } + + // Only add a reasonCode extension if the reason is non-zero, as per + // RFC 5280 Section 5.3.1. + if rce.ReasonCode != 0 { + reasonBytes, err := asn1.Marshal(asn1.Enumerated(rce.ReasonCode)) + if err != nil { + return nil, err + } + + exts = append(exts, pkix.Extension{ + Id: oidExtensionReasonCode, + Value: reasonBytes, + }) + } + + if len(exts) > 0 { + rc.Extensions = exts + } + revokedCerts[i] = rc + } + } + + aki, err := asn1.Marshal(authKeyId{Id: issuer.SubjectKeyId}) + if err != nil { + return nil, err + } + + if numBytes := template.Number.Bytes(); len(numBytes) > 20 || (len(numBytes) == 20 && numBytes[0]&0x80 != 0) { + return nil, errors.New("x509: CRL number exceeds 20 octets") + } + crlNum, err := asn1.Marshal(template.Number) + if err != nil { + return nil, err + } + + // Correctly use the issuer's subject sequence if one is specified. + issuerSubject, err := subjectBytes(issuer) + if err != nil { + return nil, err + } + + tbsCertList := tbsCertificateList{ + Version: 1, // v2 + Signature: algorithmIdentifier, + Issuer: asn1.RawValue{FullBytes: issuerSubject}, + ThisUpdate: template.ThisUpdate.UTC(), + NextUpdate: template.NextUpdate.UTC(), + Extensions: []pkix.Extension{ + { + Id: oidExtensionAuthorityKeyId, + Value: aki, + }, + { + Id: oidExtensionCRLNumber, + Value: crlNum, + }, + }, + } + if len(revokedCerts) > 0 { + tbsCertList.RevokedCertificates = revokedCerts + } + + if len(template.ExtraExtensions) > 0 { + tbsCertList.Extensions = append(tbsCertList.Extensions, template.ExtraExtensions...) + } + + tbsCertListContents, err := asn1.Marshal(tbsCertList) + if err != nil { + return nil, err + } + + // Optimization to only marshal this struct once, when signing and + // then embedding in certificateList below. + tbsCertList.Raw = tbsCertListContents + + signature, err := signTBS(tbsCertListContents, priv, signatureAlgorithm, rand) + if err != nil { + return nil, err + } + + return asn1.Marshal(certificateList{ + TBSCertList: tbsCertList, + SignatureAlgorithm: algorithmIdentifier, + SignatureValue: asn1.BitString{Bytes: signature, BitLength: len(signature) * 8}, + }) +} + +// CheckSignatureFrom verifies that the signature on rl is a valid signature +// from issuer. +func (rl *RevocationList) CheckSignatureFrom(parent *Certificate) error { + if parent.Version == 3 && !parent.BasicConstraintsValid || + parent.BasicConstraintsValid && !parent.IsCA { + return ConstraintViolationError{} + } + + if parent.KeyUsage != 0 && parent.KeyUsage&KeyUsageCRLSign == 0 { + return ConstraintViolationError{} + } + + if parent.PublicKeyAlgorithm == UnknownPublicKeyAlgorithm { + return ErrUnsupportedAlgorithm + } + + return parent.CheckSignature(rl.SignatureAlgorithm, rl.RawTBSRevocationList, rl.Signature) +} diff --git a/go/src/crypto/x509/x509_string.go b/go/src/crypto/x509/x509_string.go new file mode 100644 index 0000000000000000000000000000000000000000..9670b25bc37dad76f79fd2048db57d5821a6a04b --- /dev/null +++ b/go/src/crypto/x509/x509_string.go @@ -0,0 +1,90 @@ +// Code generated by "stringer -linecomment -type=KeyUsage,ExtKeyUsage -output=x509_string.go"; DO NOT EDIT. + +package x509 + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[KeyUsageDigitalSignature-1] + _ = x[KeyUsageContentCommitment-2] + _ = x[KeyUsageKeyEncipherment-4] + _ = x[KeyUsageDataEncipherment-8] + _ = x[KeyUsageKeyAgreement-16] + _ = x[KeyUsageCertSign-32] + _ = x[KeyUsageCRLSign-64] + _ = x[KeyUsageEncipherOnly-128] + _ = x[KeyUsageDecipherOnly-256] +} + +const ( + _KeyUsage_name_0 = "digitalSignaturecontentCommitment" + _KeyUsage_name_1 = "keyEncipherment" + _KeyUsage_name_2 = "dataEncipherment" + _KeyUsage_name_3 = "keyAgreement" + _KeyUsage_name_4 = "keyCertSign" + _KeyUsage_name_5 = "cRLSign" + _KeyUsage_name_6 = "encipherOnly" + _KeyUsage_name_7 = "decipherOnly" +) + +var ( + _KeyUsage_index_0 = [...]uint8{0, 16, 33} +) + +func (i KeyUsage) String() string { + switch { + case 1 <= i && i <= 2: + i -= 1 + return _KeyUsage_name_0[_KeyUsage_index_0[i]:_KeyUsage_index_0[i+1]] + case i == 4: + return _KeyUsage_name_1 + case i == 8: + return _KeyUsage_name_2 + case i == 16: + return _KeyUsage_name_3 + case i == 32: + return _KeyUsage_name_4 + case i == 64: + return _KeyUsage_name_5 + case i == 128: + return _KeyUsage_name_6 + case i == 256: + return _KeyUsage_name_7 + default: + return "KeyUsage(" + strconv.FormatInt(int64(i), 10) + ")" + } +} +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[ExtKeyUsageAny-0] + _ = x[ExtKeyUsageServerAuth-1] + _ = x[ExtKeyUsageClientAuth-2] + _ = x[ExtKeyUsageCodeSigning-3] + _ = x[ExtKeyUsageEmailProtection-4] + _ = x[ExtKeyUsageIPSECEndSystem-5] + _ = x[ExtKeyUsageIPSECTunnel-6] + _ = x[ExtKeyUsageIPSECUser-7] + _ = x[ExtKeyUsageTimeStamping-8] + _ = x[ExtKeyUsageOCSPSigning-9] + _ = x[ExtKeyUsageMicrosoftServerGatedCrypto-10] + _ = x[ExtKeyUsageNetscapeServerGatedCrypto-11] + _ = x[ExtKeyUsageMicrosoftCommercialCodeSigning-12] + _ = x[ExtKeyUsageMicrosoftKernelCodeSigning-13] +} + +const _ExtKeyUsage_name = "anyExtendedKeyUsageserverAuthclientAuthcodeSigningemailProtectionipsecEndSystemipsecTunnelipsecUsertimeStampingOCSPSigningmsSGCnsSGCmsCodeCommsKernelCode" + +var _ExtKeyUsage_index = [...]uint8{0, 19, 29, 39, 50, 65, 79, 90, 99, 111, 122, 127, 132, 141, 153} + +func (i ExtKeyUsage) String() string { + idx := int(i) - 0 + if i < 0 || idx >= len(_ExtKeyUsage_index)-1 { + return "ExtKeyUsage(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _ExtKeyUsage_name[_ExtKeyUsage_index[idx]:_ExtKeyUsage_index[idx+1]] +} diff --git a/go/src/crypto/x509/x509_test.go b/go/src/crypto/x509/x509_test.go new file mode 100644 index 0000000000000000000000000000000000000000..dd53168559ad426ad979d672f106a27457a38aa0 --- /dev/null +++ b/go/src/crypto/x509/x509_test.go @@ -0,0 +1,4271 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package x509 + +import ( + "bytes" + "crypto" + "crypto/dsa" + "crypto/ecdh" + "crypto/ecdsa" + "crypto/ed25519" + "crypto/elliptic" + "crypto/rand" + "crypto/rsa" + _ "crypto/sha256" + _ "crypto/sha512" + "crypto/x509/pkix" + "encoding/asn1" + "encoding/base64" + "encoding/gob" + "encoding/hex" + "encoding/pem" + "errors" + "fmt" + "internal/testenv" + "io" + "math" + "math/big" + "net" + "net/url" + "reflect" + "runtime" + "slices" + "strings" + "testing" + "time" +) + +func TestParsePKCS1PrivateKey(t *testing.T) { + block, _ := pem.Decode([]byte(pemPrivateKey)) + priv, err := ParsePKCS1PrivateKey(block.Bytes) + if err != nil { + t.Errorf("Failed to parse private key: %s", err) + return + } + if priv.PublicKey.N.Cmp(rsaPrivateKey.PublicKey.N) != 0 || + priv.PublicKey.E != rsaPrivateKey.PublicKey.E || + priv.D.Cmp(rsaPrivateKey.D) != 0 || + priv.Primes[0].Cmp(rsaPrivateKey.Primes[0]) != 0 || + priv.Primes[1].Cmp(rsaPrivateKey.Primes[1]) != 0 { + t.Errorf("got:%+v want:%+v", priv, rsaPrivateKey) + } + + // This private key includes an invalid prime that + // rsa.PrivateKey.Validate should reject. + data := []byte("0\x16\x02\x00\x02\x02\u007f\x00\x02\x0200\x02\x0200\x02\x02\x00\x01\x02\x02\u007f\x00") + if _, err := ParsePKCS1PrivateKey(data); err == nil { + t.Errorf("parsing invalid private key did not result in an error") + } + + // A partial key without CRT values should still parse. + b, _ := asn1.Marshal(struct { + Version int + N *big.Int + E int + D *big.Int + P *big.Int + Q *big.Int + }{ + N: priv.N, + E: priv.PublicKey.E, + D: priv.D, + P: priv.Primes[0], + Q: priv.Primes[1], + }) + p2, err := ParsePKCS1PrivateKey(b) + if err != nil { + t.Fatalf("parsing partial private key resulted in an error: %v", err) + } + if !p2.Equal(priv) { + t.Errorf("partial private key did not match original key") + } + if p2.Precomputed.Dp == nil || p2.Precomputed.Dq == nil || p2.Precomputed.Qinv == nil { + t.Errorf("precomputed values not recomputed") + } +} + +func TestPKCS1MismatchPublicKeyFormat(t *testing.T) { + + const pkixPublicKey = "30820122300d06092a864886f70d01010105000382010f003082010a0282010100dd5a0f37d3ca5232852ccc0e81eebec270e2f2c6c44c6231d852971a0aad00aa7399e9b9de444611083c59ea919a9d76c20a7be131a99045ec19a7bb452d647a72429e66b87e28be9e8187ed1d2a2a01ef3eb2360706bd873b07f2d1f1a72337aab5ec94e983e39107f52c480d404915e84d75a3db2cfd601726a128cb1d7f11492d4bdb53272e652276667220795c709b8a9b4af6489cbf48bb8173b8fb607c834a71b6e8bf2d6aab82af3c8ad7ce16d8dcf58373a6edc427f7484d09744d4c08f4e19ed07adbf6cb31243bc5d0d1145e77a08a6fc5efd208eca67d6abf2d6f38f58b6fdd7c28774fb0cc03fc4935c6e074842d2e1479d3d8787249258719f90203010001" + const errorContains = "use ParsePKIXPublicKey instead" + derBytes, _ := hex.DecodeString(pkixPublicKey) + _, err := ParsePKCS1PublicKey(derBytes) + if !strings.Contains(err.Error(), errorContains) { + t.Errorf("expected error containing %q, got %s", errorContains, err) + } +} + +func TestMarshalInvalidPublicKey(t *testing.T) { + _, err := MarshalPKIXPublicKey(&ecdsa.PublicKey{}) + if err == nil { + t.Errorf("expected error, got MarshalPKIXPublicKey success") + } + _, err = MarshalPKIXPublicKey(&ecdsa.PublicKey{ + Curve: elliptic.P256(), + X: big.NewInt(1), Y: big.NewInt(2), + }) + if err == nil { + t.Errorf("expected error, got MarshalPKIXPublicKey success") + } +} + +func testParsePKIXPublicKey(t *testing.T, pemBytes string) (pub any) { + block, _ := pem.Decode([]byte(pemBytes)) + pub, err := ParsePKIXPublicKey(block.Bytes) + if err != nil { + t.Fatalf("Failed to parse public key: %s", err) + } + + pubBytes2, err := MarshalPKIXPublicKey(pub) + if err != nil { + t.Errorf("Failed to marshal public key for the second time: %s", err) + return + } + if !bytes.Equal(pubBytes2, block.Bytes) { + t.Errorf("Reserialization of public key didn't match. got %x, want %x", pubBytes2, block.Bytes) + } + return +} + +func TestParsePKIXPublicKey(t *testing.T) { + t.Run("RSA", func(t *testing.T) { + pub := testParsePKIXPublicKey(t, pemPublicKey) + _, ok := pub.(*rsa.PublicKey) + if !ok { + t.Errorf("Value returned from ParsePKIXPublicKey was not an RSA public key") + } + }) + t.Run("Ed25519", func(t *testing.T) { + pub := testParsePKIXPublicKey(t, pemEd25519Key) + _, ok := pub.(ed25519.PublicKey) + if !ok { + t.Errorf("Value returned from ParsePKIXPublicKey was not an Ed25519 public key") + } + }) + t.Run("X25519", func(t *testing.T) { + pub := testParsePKIXPublicKey(t, pemX25519Key) + k, ok := pub.(*ecdh.PublicKey) + if !ok || k.Curve() != ecdh.X25519() { + t.Errorf("Value returned from ParsePKIXPublicKey was not an X25519 public key") + } + }) +} + +var pemPublicKey = `-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3VoPN9PKUjKFLMwOge6+ +wnDi8sbETGIx2FKXGgqtAKpzmem53kRGEQg8WeqRmp12wgp74TGpkEXsGae7RS1k +enJCnma4fii+noGH7R0qKgHvPrI2Bwa9hzsH8tHxpyM3qrXslOmD45EH9SxIDUBJ +FehNdaPbLP1gFyahKMsdfxFJLUvbUycuZSJ2ZnIgeVxwm4qbSvZInL9Iu4FzuPtg +fINKcbbovy1qq4KvPIrXzhbY3PWDc6btxCf3SE0JdE1MCPThntB62/bLMSQ7xdDR +FF53oIpvxe/SCOymfWq/LW849Ytv3Xwod0+wzAP8STXG4HSELS4UedPYeHJJJYcZ ++QIDAQAB +-----END PUBLIC KEY----- +` + +var pemPrivateKey = testingKey(` +-----BEGIN RSA TESTING KEY----- +MIICXAIBAAKBgQCxoeCUW5KJxNPxMp+KmCxKLc1Zv9Ny+4CFqcUXVUYH69L3mQ7v +IWrJ9GBfcaA7BPQqUlWxWM+OCEQZH1EZNIuqRMNQVuIGCbz5UQ8w6tS0gcgdeGX7 +J7jgCQ4RK3F/PuCM38QBLaHx988qG8NMc6VKErBjctCXFHQt14lerd5KpQIDAQAB +AoGAYrf6Hbk+mT5AI33k2Jt1kcweodBP7UkExkPxeuQzRVe0KVJw0EkcFhywKpr1 +V5eLMrILWcJnpyHE5slWwtFHBG6a5fLaNtsBBtcAIfqTQ0Vfj5c6SzVaJv0Z5rOd +7gQF6isy3t3w9IF3We9wXQKzT6q5ypPGdm6fciKQ8RnzREkCQQDZwppKATqQ41/R +vhSj90fFifrGE6aVKC1hgSpxGQa4oIdsYYHwMzyhBmWW9Xv/R+fPyr8ZwPxp2c12 +33QwOLPLAkEA0NNUb+z4ebVVHyvSwF5jhfJxigim+s49KuzJ1+A2RaSApGyBZiwS +rWvWkB471POAKUYt5ykIWVZ83zcceQiNTwJBAMJUFQZX5GDqWFc/zwGoKkeR49Yi +MTXIvf7Wmv6E++eFcnT461FlGAUHRV+bQQXGsItR/opIG7mGogIkVXa3E1MCQARX +AAA7eoZ9AEHflUeuLn9QJI/r0hyQQLEtrpwv6rDT1GCWaLII5HJ6NUFVf4TTcqxo +6vdM4QGKTJoO+SaCyP0CQFdpcxSAuzpFcKv0IlJ8XzS/cy+mweCMwyJ1PFEc4FX6 +wg/HcAJWY60xZTJDFN+Qfx8ZQvBEin6c2/h+zZi5IVY= +-----END RSA TESTING KEY----- +`) + +// pemEd25519Key is the example from RFC 8410, Section 4. +var pemEd25519Key = ` +-----BEGIN PUBLIC KEY----- +MCowBQYDK2VwAyEAGb9ECWmEzf6FQbrBZ9w7lshQhqowtrbLDFw4rXAxZuE= +-----END PUBLIC KEY----- +` + +// pemX25519Key was generated from pemX25519Key with "openssl pkey -pubout". +var pemX25519Key = ` +-----BEGIN PUBLIC KEY----- +MCowBQYDK2VuAyEA5yGXrH/6OzxuWEhEWS01/f4OP+Of3Yrddy6/J1kDTVM= +-----END PUBLIC KEY----- +` + +func TestPKIXMismatchPublicKeyFormat(t *testing.T) { + + const pkcs1PublicKey = "308201080282010100817cfed98bcaa2e2a57087451c7674e0c675686dc33ff1268b0c2a6ee0202dec710858ee1c31bdf5e7783582e8ca800be45f3275c6576adc35d98e26e95bb88ca5beb186f853b8745d88bc9102c5f38753bcda519fb05948d5c77ac429255ff8aaf27d9f45d1586e95e2e9ba8a7cb771b8a09dd8c8fed3f933fd9b439bc9f30c475953418ef25f71a2b6496f53d94d39ce850aa0cc75d445b5f5b4f4ee4db78ab197a9a8d8a852f44529a007ac0ac23d895928d60ba538b16b0b087a7f903ed29770e215019b77eaecc360f35f7ab11b6d735978795b2c4a74e5bdea4dc6594cd67ed752a108e666729a753ab36d6c4f606f8760f507e1765be8cd744007e629020103" + const errorContains = "use ParsePKCS1PublicKey instead" + derBytes, _ := hex.DecodeString(pkcs1PublicKey) + _, err := ParsePKIXPublicKey(derBytes) + if !strings.Contains(err.Error(), errorContains) { + t.Errorf("expected error containing %q, got %s", errorContains, err) + } +} + +var testPrivateKey *rsa.PrivateKey + +func init() { + block, _ := pem.Decode([]byte(pemPrivateKey)) + + var err error + if testPrivateKey, err = ParsePKCS1PrivateKey(block.Bytes); err != nil { + panic("Failed to parse private key: " + err.Error()) + } +} + +func bigFromString(s string) *big.Int { + ret := new(big.Int) + ret.SetString(s, 10) + return ret +} + +func fromBase10(base10 string) *big.Int { + i := new(big.Int) + i.SetString(base10, 10) + return i +} + +func bigFromHexString(s string) *big.Int { + ret := new(big.Int) + ret.SetString(s, 16) + return ret +} + +var rsaPrivateKey = &rsa.PrivateKey{ + PublicKey: rsa.PublicKey{ + N: bigFromString("124737666279038955318614287965056875799409043964547386061640914307192830334599556034328900586693254156136128122194531292927142396093148164407300419162827624945636708870992355233833321488652786796134504707628792159725681555822420087112284637501705261187690946267527866880072856272532711620639179596808018872997"), + E: 65537, + }, + D: bigFromString("69322600686866301945688231018559005300304807960033948687567105312977055197015197977971637657636780793670599180105424702854759606794705928621125408040473426339714144598640466128488132656829419518221592374964225347786430566310906679585739468938549035854760501049443920822523780156843263434219450229353270690889"), + Primes: []*big.Int{ + bigFromString("11405025354575369741595561190164746858706645478381139288033759331174478411254205003127028642766986913445391069745480057674348716675323735886284176682955723"), + bigFromString("10937079261204603443118731009201819560867324167189758120988909645641782263430128449826989846631183550578761324239709121189827307416350485191350050332642639"), + }, +} + +func TestMarshalRSAPrivateKey(t *testing.T) { + priv := &rsa.PrivateKey{ + PublicKey: rsa.PublicKey{ + N: fromBase10("16346378922382193400538269749936049106320265317511766357599732575277382844051791096569333808598921852351577762718529818072849191122419410612033592401403764925096136759934497687765453905884149505175426053037420486697072448609022753683683718057795566811401938833367954642951433473337066311978821180526439641496973296037000052546108507805269279414789035461158073156772151892452251106173507240488993608650881929629163465099476849643165682709047462010581308719577053905787496296934240246311806555924593059995202856826239801816771116902778517096212527979497399966526283516447337775509777558018145573127308919204297111496233"), + E: 3, + }, + D: fromBase10("10897585948254795600358846499957366070880176878341177571733155050184921896034527397712889205732614568234385175145686545381899460748279607074689061600935843283397424506622998458510302603922766336783617368686090042765718290914099334449154829375179958369993407724946186243249568928237086215759259909861748642124071874879861299389874230489928271621259294894142840428407196932444474088857746123104978617098858619445675532587787023228852383149557470077802718705420275739737958953794088728369933811184572620857678792001136676902250566845618813972833750098806496641114644760255910789397593428910198080271317419213080834885003"), + Primes: []*big.Int{ + fromBase10("1025363189502892836833747188838978207017355117492483312747347695538428729137306368764177201532277413433182799108299960196606011786562992097313508180436744488171474690412562218914213688661311117337381958560443"), + fromBase10("3467903426626310123395340254094941045497208049900750380025518552334536945536837294961497712862519984786362199788654739924501424784631315081391467293694361474867825728031147665777546570788493758372218019373"), + fromBase10("4597024781409332673052708605078359346966325141767460991205742124888960305710298765592730135879076084498363772408626791576005136245060321874472727132746643162385746062759369754202494417496879741537284589047"), + }, + } + + derBytes := MarshalPKCS1PrivateKey(priv) + + priv2, err := ParsePKCS1PrivateKey(derBytes) + if err != nil { + t.Errorf("error parsing serialized key: %s", err) + return + } + if priv.PublicKey.N.Cmp(priv2.PublicKey.N) != 0 || + priv.PublicKey.E != priv2.PublicKey.E || + priv.D.Cmp(priv2.D) != 0 || + len(priv2.Primes) != 3 || + priv.Primes[0].Cmp(priv2.Primes[0]) != 0 || + priv.Primes[1].Cmp(priv2.Primes[1]) != 0 || + priv.Primes[2].Cmp(priv2.Primes[2]) != 0 { + t.Errorf("wrong priv:\ngot %+v\nwant %+v", priv2, priv) + } + + if priv.Precomputed.Dp == nil { + t.Fatalf("Precomputed.Dp is nil") + } +} + +func TestMarshalRSAPrivateKeyInvalid(t *testing.T) { + block, _ := pem.Decode([]byte(strings.ReplaceAll( + `-----BEGIN RSA TESTING KEY----- +MIIEowIBAAKCAQEAsPnoGUOnrpiSqt4XynxA+HRP7S+BSObI6qJ7fQAVSPtRkqso +tWxQYLEYzNEx5ZSHTGypibVsJylvCfuToDTfMul8b/CZjP2Ob0LdpYrNH6l5hvFE +89FU1nZQF15oVLOpUgA7wGiHuEVawrGfey92UE68mOyUVXGweJIVDdxqdMoPvNNU +l86BU02vlBiESxOuox+dWmuVV7vfYZ79Toh/LUK43YvJh+rhv4nKuF7iHjVjBd9s +B6iDjj70HFldzOQ9r8SRI+9NirupPTkF5AKNe6kUhKJ1luB7S27ZkvB3tSTT3P59 +3VVJvnzOjaA1z6Cz+4+eRvcysqhrRgFlwI9TEwIDAQABAoIBAEEYiyDP29vCzx/+ +dS3LqnI5BjUuJhXUnc6AWX/PCgVAO+8A+gZRgvct7PtZb0sM6P9ZcLrweomlGezI +FrL0/6xQaa8bBr/ve/a8155Ogc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16NjL8hIZB1CaV3WbT5oY+jp7Mzd5 +7d56RZOE+ERK2uz/7JX9VSsM/LbH9pJibd4e8mikDS9ntciqOH/3 +-----END RSA TESTING KEY-----`, "TESTING KEY", "PRIVATE KEY"))) + testRSA2048, _ := ParsePKCS1PrivateKey(block.Bytes) + + broken := *testRSA2048 + broken.Precomputed.Dp = new(big.Int).SetUint64(42) + + parsed, err := ParsePKCS1PrivateKey(MarshalPKCS1PrivateKey(&broken)) + if err == nil { + t.Errorf("expected error, got success") + } + + t.Setenv("GODEBUG", "x509rsacrt=0") + + parsed, err = ParsePKCS1PrivateKey(MarshalPKCS1PrivateKey(&broken)) + if err != nil { + t.Fatalf("expected success, got error: %v", err) + } + // Dp should have been recomputed. + if parsed.Precomputed.Dp.Cmp(testRSA2048.Precomputed.Dp) != 0 { + t.Errorf("Dp recomputation failed: got %v, want %v", parsed.Precomputed.Dp, testRSA2048.Precomputed.Dp) + } +} + +func TestMarshalRSAPublicKey(t *testing.T) { + pub := &rsa.PublicKey{ + N: fromBase10("16346378922382193400538269749936049106320265317511766357599732575277382844051791096569333808598921852351577762718529818072849191122419410612033592401403764925096136759934497687765453905884149505175426053037420486697072448609022753683683718057795566811401938833367954642951433473337066311978821180526439641496973296037000052546108507805269279414789035461158073156772151892452251106173507240488993608650881929629163465099476849643165682709047462010581308719577053905787496296934240246311806555924593059995202856826239801816771116902778517096212527979497399966526283516447337775509777558018145573127308919204297111496233"), + E: 3, + } + derBytes := MarshalPKCS1PublicKey(pub) + pub2, err := ParsePKCS1PublicKey(derBytes) + if err != nil { + t.Errorf("ParsePKCS1PublicKey: %s", err) + } + if pub.N.Cmp(pub2.N) != 0 || pub.E != pub2.E { + t.Errorf("ParsePKCS1PublicKey = %+v, want %+v", pub, pub2) + } + + // It's never been documented that asn1.Marshal/Unmarshal on rsa.PublicKey works, + // but it does, and we know of code that depends on it. + // Lock that in, even though we'd prefer that people use MarshalPKCS1PublicKey and ParsePKCS1PublicKey. + derBytes2, err := asn1.Marshal(*pub) + if err != nil { + t.Errorf("Marshal(rsa.PublicKey): %v", err) + } else if !bytes.Equal(derBytes, derBytes2) { + t.Errorf("Marshal(rsa.PublicKey) = %x, want %x", derBytes2, derBytes) + } + pub3 := new(rsa.PublicKey) + rest, err := asn1.Unmarshal(derBytes, pub3) + if err != nil { + t.Errorf("Unmarshal(rsa.PublicKey): %v", err) + } + if len(rest) != 0 || pub.N.Cmp(pub3.N) != 0 || pub.E != pub3.E { + t.Errorf("Unmarshal(rsa.PublicKey) = %+v, %q want %+v, %q", pub, rest, pub2, []byte(nil)) + } + + publicKeys := []struct { + derBytes []byte + expectedErrSubstr string + }{ + { + derBytes: []byte{ + 0x30, 6, // SEQUENCE, 6 bytes + 0x02, 1, // INTEGER, 1 byte + 17, + 0x02, 1, // INTEGER, 1 byte + 3, // 3 + }, + }, { + derBytes: []byte{ + 0x30, 6, // SEQUENCE + 0x02, 1, // INTEGER, 1 byte + 0xff, // -1 + 0x02, 1, // INTEGER, 1 byte + 3, + }, + expectedErrSubstr: "zero or negative", + }, { + derBytes: []byte{ + 0x30, 6, // SEQUENCE + 0x02, 1, // INTEGER, 1 byte + 17, + 0x02, 1, // INTEGER, 1 byte + 0xff, // -1 + }, + expectedErrSubstr: "zero or negative", + }, { + derBytes: []byte{ + 0x30, 6, // SEQUENCE + 0x02, 1, // INTEGER, 1 byte + 17, + 0x02, 1, // INTEGER, 1 byte + 3, + 1, + }, + expectedErrSubstr: "trailing data", + }, { + derBytes: []byte{ + 0x30, 9, // SEQUENCE + 0x02, 1, // INTEGER, 1 byte + 17, + 0x02, 4, // INTEGER, 4 bytes + 0x7f, 0xff, 0xff, 0xff, + }, + }, { + derBytes: []byte{ + 0x30, 10, // SEQUENCE + 0x02, 1, // INTEGER, 1 byte + 17, + 0x02, 5, // INTEGER, 5 bytes + 0x00, 0x80, 0x00, 0x00, 0x00, + }, + // On 64-bit systems, encoding/asn1 will accept the + // public exponent, but ParsePKCS1PublicKey will return + // an error. On 32-bit systems, encoding/asn1 will + // return the error. The common substring of both error + // is the word “large”. + expectedErrSubstr: "large", + }, + } + + for i, test := range publicKeys { + shouldFail := len(test.expectedErrSubstr) > 0 + pub, err := ParsePKCS1PublicKey(test.derBytes) + if shouldFail { + if err == nil { + t.Errorf("#%d: unexpected success, got %#v", i, pub) + } else if !strings.Contains(err.Error(), test.expectedErrSubstr) { + t.Errorf("#%d: expected error containing %q, got %s", i, test.expectedErrSubstr, err) + } + } else { + if err != nil { + t.Errorf("#%d: unexpected failure: %s", i, err) + continue + } + reserialized := MarshalPKCS1PublicKey(pub) + if !bytes.Equal(reserialized, test.derBytes) { + t.Errorf("#%d: failed to reserialize: got %x, expected %x", i, reserialized, test.derBytes) + } + } + } +} + +type matchHostnamesTest struct { + pattern, host string + ok bool +} + +var matchHostnamesTests = []matchHostnamesTest{ + {"a.b.c", "a.b.c", true}, + {"a.b.c", "b.b.c", false}, + {"", "b.b.c", false}, + {"a.b.c", "", false}, + {"example.com", "example.com", true}, + {"example.com", "www.example.com", false}, + {"*.example.com", "example.com", false}, + {"*.example.com", "www.example.com", true}, + {"*.example.com", "www.example.com.", true}, + {"*.example.com", "xyz.www.example.com", false}, + {"*.example.com", "https://www.example.com", false}, // Issue 27591 + {"*.example..com", "www.example..com", false}, + {"www.example..com", "www.example..com", true}, + {"*.*.example.com", "xyz.www.example.com", false}, + {"*.www.*.com", "xyz.www.example.com", false}, + {"*bar.example.com", "foobar.example.com", false}, + {"f*.example.com", "foobar.example.com", false}, + {"www.example.com", "*.example.com", false}, + {"", ".", false}, + {".", "", false}, + {".", ".", false}, + {"example.com", "example.com.", true}, + {"example.com.", "example.com", false}, + {"example.com.", "example.com.", true}, // perfect matches allow trailing dots in patterns + {"*.com.", "example.com.", false}, + {"*.com.", "example.com", false}, + {"*.com", "example.com", true}, + {"*.com", "example.com.", true}, + {"foo:bar", "foo:bar", true}, + {"*.foo:bar", "xxx.foo:bar", false}, + {"*.2.3.4", "1.2.3.4", false}, + {"*.2.3.4", "[1.2.3.4]", false}, + {"*:4860:4860::8888", "2001:4860:4860::8888", false}, + {"*:4860:4860::8888", "[2001:4860:4860::8888]", false}, + {"2001:4860:4860::8888", "2001:4860:4860::8888", false}, + {"2001:4860:4860::8888", "[2001:4860:4860::8888]", false}, + {"[2001:4860:4860::8888]", "2001:4860:4860::8888", false}, + {"[2001:4860:4860::8888]", "[2001:4860:4860::8888]", false}, +} + +func TestMatchHostnames(t *testing.T) { + for i, test := range matchHostnamesTests { + c := &Certificate{DNSNames: []string{test.pattern}} + r := c.VerifyHostname(test.host) == nil + if r != test.ok { + t.Errorf("#%d mismatch got: %t want: %t when matching '%s' against '%s'", i, r, test.ok, test.host, test.pattern) + } + } +} + +func TestMatchIP(t *testing.T) { + // Check that pattern matching is working. + c := &Certificate{ + DNSNames: []string{"*.foo.bar.baz"}, + Subject: pkix.Name{ + CommonName: "*.foo.bar.baz", + }, + } + err := c.VerifyHostname("quux.foo.bar.baz") + if err != nil { + t.Fatalf("VerifyHostname(quux.foo.bar.baz): %v", err) + } + + // But check that if we change it to be matching against an IP address, + // it is rejected. + c = &Certificate{ + DNSNames: []string{"*.2.3.4"}, + Subject: pkix.Name{ + CommonName: "*.2.3.4", + }, + } + err = c.VerifyHostname("1.2.3.4") + if err == nil { + t.Fatalf("VerifyHostname(1.2.3.4) should have failed, did not") + } + + c = &Certificate{ + IPAddresses: []net.IP{net.ParseIP("127.0.0.1"), net.ParseIP("::1")}, + } + err = c.VerifyHostname("127.0.0.1") + if err != nil { + t.Fatalf("VerifyHostname(127.0.0.1): %v", err) + } + err = c.VerifyHostname("::1") + if err != nil { + t.Fatalf("VerifyHostname(::1): %v", err) + } + err = c.VerifyHostname("[::1]") + if err != nil { + t.Fatalf("VerifyHostname([::1]): %v", err) + } +} + +func TestCertificateParse(t *testing.T) { + s, _ := base64.StdEncoding.DecodeString(certBytes) + certs, err := ParseCertificates(s) + if err != nil { + t.Error(err) + } + if len(certs) != 2 { + t.Errorf("Wrong number of certs: got %d want 2", len(certs)) + return + } + + err = certs[0].CheckSignatureFrom(certs[1]) + if err != nil { + t.Error(err) + } + + if err := certs[0].VerifyHostname("mail.google.com"); err != nil { + t.Error(err) + } + + const expectedExtensions = 10 + if n := len(certs[0].Extensions); n != expectedExtensions { + t.Errorf("want %d extensions, got %d", expectedExtensions, n) + } +} + +func TestCertificateEqualOnNil(t *testing.T) { + cNonNil := new(Certificate) + var cNil1, cNil2 *Certificate + if !cNil1.Equal(cNil2) { + t.Error("Nil certificates: cNil1 is not equal to cNil2") + } + if !cNil2.Equal(cNil1) { + t.Error("Nil certificates: cNil2 is not equal to cNil1") + } + if cNil1.Equal(cNonNil) { + t.Error("Unexpectedly cNil1 is equal to cNonNil") + } + if cNonNil.Equal(cNil1) { + t.Error("Unexpectedly cNonNil is equal to cNil1") + } +} + +func TestMismatchedSignatureAlgorithm(t *testing.T) { + der, _ := pem.Decode([]byte(rsaPSSSelfSignedPEM)) + if der == nil { + t.Fatal("Failed to find PEM block") + } + + cert, err := ParseCertificate(der.Bytes) + if err != nil { + t.Fatal(err) + } + + if err = cert.CheckSignature(ECDSAWithSHA256, nil, nil); err == nil { + t.Fatal("CheckSignature unexpectedly return no error") + } + + const expectedSubstring = " but have public key of type " + if !strings.Contains(err.Error(), expectedSubstring) { + t.Errorf("Expected error containing %q, but got %q", expectedSubstring, err) + } +} + +var certBytes = "MIIE0jCCA7qgAwIBAgIQWcvS+TTB3GwCAAAAAGEAWzANBgkqhkiG9w0BAQsFADBCMQswCQYD" + + "VQQGEwJVUzEeMBwGA1UEChMVR29vZ2xlIFRydXN0IFNlcnZpY2VzMRMwEQYDVQQDEwpHVFMg" + + "Q0EgMU8xMB4XDTIwMDQwMTEyNTg1NloXDTIwMDYyNDEyNTg1NlowaTELMAkGA1UEBhMCVVMx" + + "EzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxEzARBgNVBAoT" + + "Ckdvb2dsZSBMTEMxGDAWBgNVBAMTD21ha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wEB/wQEAwIBhjAdBgNV" + + "HSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwEgYDVR0TAQH/BAgwBgEB/wIBADAdBgNVHQ4E" + + "FgQUmNH4bhDrz5vsYJ8YkBug630J/SswHwYDVR0jBBgwFoAUm+IHV2ccHsBqBt5ZtJot39wZ" + + "hi4wNQYIKwYBBQUHAQEEKTAnMCUGCCsGAQUFBzABhhlodHRwOi8vb2NzcC5wa2kuZ29vZy9n" + + "c3IyMDIGA1UdHwQrMCkwJ6AloCOGIWh0dHA6Ly9jcmwucGtpLmdvb2cvZ3NyMi9nc3IyLmNy" + + "bDA/BgNVHSAEODA2MDQGBmeBDAECAjAqMCgGCCsGAQUFBwIBFhxodHRwczovL3BraS5nb29n" + + "L3JlcG9zaXRvcnkvMA0GCSqGSIb3DQEBCwUAA4IBAQAagD42efvzLqlGN31eVBY1rsdOCJn+" + + "vdE0aSZSZgc9CrpJy2L08RqO/BFPaJZMdCvTZ96yo6oFjYRNTCBlD6WW2g0W+Gw7228EI4hr" + + "OmzBYL1on3GO7i1YNAfw1VTphln9e14NIZT1jMmo+NjyrcwPGvOap6kEJ/mjybD/AnhrYbrH" + + "NSvoVvpPwxwM7bY8tEvq7czhPOzcDYzWPpvKQliLzBYhF0C8otZm79rEFVvNiaqbCSbnMtIN" + + "bmcgAlsQsJAJnAwfnq3YO+qh/GzoEFwIUhlRKnG7rHq13RXtK8kIKiyKtKYhq2P/11JJUNCJ" + + "t63yr/tQri/hlQ3zRq2dnPXK" + +func parseCIDR(s string) *net.IPNet { + _, net, err := net.ParseCIDR(s) + if err != nil { + panic(err) + } + return net +} + +func parseURI(s string) *url.URL { + uri, err := url.Parse(s) + if err != nil { + panic(err) + } + return uri +} + +func TestCreateSelfSignedCertificate(t *testing.T) { + random := rand.Reader + + ecdsaPriv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatalf("Failed to generate ECDSA key: %s", err) + } + + ed25519Pub, ed25519Priv, err := ed25519.GenerateKey(random) + if err != nil { + t.Fatalf("Failed to generate Ed25519 key: %s", err) + } + + tests := []struct { + name string + pub, priv any + checkSig bool + sigAlgo SignatureAlgorithm + }{ + {"RSA/RSA", &testPrivateKey.PublicKey, testPrivateKey, true, SHA384WithRSA}, + {"RSA/ECDSA", &testPrivateKey.PublicKey, ecdsaPriv, false, ECDSAWithSHA384}, + {"ECDSA/RSA", &ecdsaPriv.PublicKey, testPrivateKey, false, SHA256WithRSA}, + {"ECDSA/ECDSA", &ecdsaPriv.PublicKey, ecdsaPriv, true, ECDSAWithSHA256}, + {"RSAPSS/RSAPSS", &testPrivateKey.PublicKey, testPrivateKey, true, SHA256WithRSAPSS}, + {"ECDSA/RSAPSS", &ecdsaPriv.PublicKey, testPrivateKey, false, SHA256WithRSAPSS}, + {"RSAPSS/ECDSA", &testPrivateKey.PublicKey, ecdsaPriv, false, ECDSAWithSHA384}, + {"Ed25519", ed25519Pub, ed25519Priv, true, PureEd25519}, + } + + testExtKeyUsage := []ExtKeyUsage{ExtKeyUsageClientAuth, ExtKeyUsageServerAuth} + testUnknownExtKeyUsage := []asn1.ObjectIdentifier{[]int{1, 2, 3}, []int{2, 59, 1}} + extraExtensionData := []byte("extra extension") + + for _, test := range tests { + commonName := "test.example.com" + template := Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{ + CommonName: commonName, + Organization: []string{"Σ Acme Co"}, + Country: []string{"US"}, + ExtraNames: []pkix.AttributeTypeAndValue{ + { + Type: []int{2, 5, 4, 42}, + Value: "Gopher", + }, + // This should override the Country, above. + { + Type: []int{2, 5, 4, 6}, + Value: "NL", + }, + }, + }, + NotBefore: time.Unix(1000, 0), + NotAfter: time.Unix(100000, 0), + + SignatureAlgorithm: test.sigAlgo, + + SubjectKeyId: []byte{1, 2, 3, 4}, + KeyUsage: KeyUsageCertSign, + + ExtKeyUsage: testExtKeyUsage, + UnknownExtKeyUsage: testUnknownExtKeyUsage, + + BasicConstraintsValid: true, + IsCA: true, + + OCSPServer: []string{"http://ocsp.example.com"}, + IssuingCertificateURL: []string{"http://crt.example.com/ca1.crt"}, + + DNSNames: []string{"test.example.com"}, + EmailAddresses: []string{"gopher@golang.org"}, + IPAddresses: []net.IP{net.IPv4(127, 0, 0, 1).To4(), net.ParseIP("2001:4860:0:2001::68")}, + URIs: []*url.URL{parseURI("https://foo.com/wibble#foo")}, + + Policies: []OID{mustNewOIDFromInts([]uint64{1, 2, 3, math.MaxUint32, math.MaxUint64})}, + PermittedDNSDomains: []string{".example.com", "example.com"}, + ExcludedDNSDomains: []string{"bar.example.com"}, + PermittedIPRanges: []*net.IPNet{parseCIDR("192.168.1.1/16"), parseCIDR("1.2.3.4/8")}, + ExcludedIPRanges: []*net.IPNet{parseCIDR("2001:db8::/48")}, + PermittedEmailAddresses: []string{"foo@example.com"}, + ExcludedEmailAddresses: []string{".example.com", "example.com"}, + PermittedURIDomains: []string{".bar.com", "bar.com"}, + ExcludedURIDomains: []string{".bar2.com", "bar2.com"}, + + CRLDistributionPoints: []string{"http://crl1.example.com/ca1.crl", "http://crl2.example.com/ca1.crl"}, + + ExtraExtensions: []pkix.Extension{ + { + Id: []int{1, 2, 3, 4}, + Value: extraExtensionData, + }, + // This extension should override the SubjectKeyId, above. + { + Id: oidExtensionSubjectKeyId, + Critical: false, + Value: []byte{0x04, 0x04, 4, 3, 2, 1}, + }, + }, + } + + derBytes, err := CreateCertificate(random, &template, &template, test.pub, test.priv) + if err != nil { + t.Errorf("%s: failed to create certificate: %s", test.name, err) + continue + } + + cert, err := ParseCertificate(derBytes) + if err != nil { + t.Errorf("%s: failed to parse certificate: %s", test.name, err) + continue + } + + if len(cert.Policies) != 1 || !cert.Policies[0].Equal(template.Policies[0]) { + t.Errorf("%s: failed to parse policy identifiers: got:%#v want:%#v", test.name, cert.PolicyIdentifiers, template.Policies) + } + + if len(cert.PermittedDNSDomains) != 2 || cert.PermittedDNSDomains[0] != ".example.com" || cert.PermittedDNSDomains[1] != "example.com" { + t.Errorf("%s: failed to parse name constraints: %#v", test.name, cert.PermittedDNSDomains) + } + + if len(cert.ExcludedDNSDomains) != 1 || cert.ExcludedDNSDomains[0] != "bar.example.com" { + t.Errorf("%s: failed to parse name constraint exclusions: %#v", test.name, cert.ExcludedDNSDomains) + } + + if len(cert.PermittedIPRanges) != 2 || cert.PermittedIPRanges[0].String() != "192.168.0.0/16" || cert.PermittedIPRanges[1].String() != "1.0.0.0/8" { + t.Errorf("%s: failed to parse IP constraints: %#v", test.name, cert.PermittedIPRanges) + } + + if len(cert.ExcludedIPRanges) != 1 || cert.ExcludedIPRanges[0].String() != "2001:db8::/48" { + t.Errorf("%s: failed to parse IP constraint exclusions: %#v", test.name, cert.ExcludedIPRanges) + } + + if len(cert.PermittedEmailAddresses) != 1 || cert.PermittedEmailAddresses[0] != "foo@example.com" { + t.Errorf("%s: failed to parse permitted email addresses: %#v", test.name, cert.PermittedEmailAddresses) + } + + if len(cert.ExcludedEmailAddresses) != 2 || cert.ExcludedEmailAddresses[0] != ".example.com" || cert.ExcludedEmailAddresses[1] != "example.com" { + t.Errorf("%s: failed to parse excluded email addresses: %#v", test.name, cert.ExcludedEmailAddresses) + } + + if len(cert.PermittedURIDomains) != 2 || cert.PermittedURIDomains[0] != ".bar.com" || cert.PermittedURIDomains[1] != "bar.com" { + t.Errorf("%s: failed to parse permitted URIs: %#v", test.name, cert.PermittedURIDomains) + } + + if len(cert.ExcludedURIDomains) != 2 || cert.ExcludedURIDomains[0] != ".bar2.com" || cert.ExcludedURIDomains[1] != "bar2.com" { + t.Errorf("%s: failed to parse excluded URIs: %#v", test.name, cert.ExcludedURIDomains) + } + + if cert.Subject.CommonName != commonName { + t.Errorf("%s: subject wasn't correctly copied from the template. Got %s, want %s", test.name, cert.Subject.CommonName, commonName) + } + + if len(cert.Subject.Country) != 1 || cert.Subject.Country[0] != "NL" { + t.Errorf("%s: ExtraNames didn't override Country", test.name) + } + + for _, ext := range cert.Extensions { + if ext.Id.Equal(oidExtensionSubjectAltName) { + if ext.Critical { + t.Fatal("SAN extension is marked critical") + } + } + } + + found := false + for _, atv := range cert.Subject.Names { + if atv.Type.Equal([]int{2, 5, 4, 42}) { + found = true + break + } + } + if !found { + t.Errorf("%s: Names didn't contain oid 2.5.4.42 from ExtraNames", test.name) + } + + if cert.Issuer.CommonName != commonName { + t.Errorf("%s: issuer wasn't correctly copied from the template. Got %s, want %s", test.name, cert.Issuer.CommonName, commonName) + } + + if cert.SignatureAlgorithm != test.sigAlgo { + t.Errorf("%s: SignatureAlgorithm wasn't copied from template. Got %v, want %v", test.name, cert.SignatureAlgorithm, test.sigAlgo) + } + + if !slices.Equal(cert.ExtKeyUsage, testExtKeyUsage) { + t.Errorf("%s: extkeyusage wasn't correctly copied from the template. Got %v, want %v", test.name, cert.ExtKeyUsage, testExtKeyUsage) + } + + if !slices.EqualFunc(cert.UnknownExtKeyUsage, testUnknownExtKeyUsage, asn1.ObjectIdentifier.Equal) { + t.Errorf("%s: unknown extkeyusage wasn't correctly copied from the template. Got %v, want %v", test.name, cert.UnknownExtKeyUsage, testUnknownExtKeyUsage) + } + + if !slices.Equal(cert.OCSPServer, template.OCSPServer) { + t.Errorf("%s: OCSP servers differ from template. Got %v, want %v", test.name, cert.OCSPServer, template.OCSPServer) + } + + if !slices.Equal(cert.IssuingCertificateURL, template.IssuingCertificateURL) { + t.Errorf("%s: Issuing certificate URLs differ from template. Got %v, want %v", test.name, cert.IssuingCertificateURL, template.IssuingCertificateURL) + } + + if !slices.Equal(cert.DNSNames, template.DNSNames) { + t.Errorf("%s: SAN DNS names differ from template. Got %v, want %v", test.name, cert.DNSNames, template.DNSNames) + } + + if !slices.Equal(cert.EmailAddresses, template.EmailAddresses) { + t.Errorf("%s: SAN emails differ from template. Got %v, want %v", test.name, cert.EmailAddresses, template.EmailAddresses) + } + + if len(cert.URIs) != 1 || cert.URIs[0].String() != "https://foo.com/wibble#foo" { + t.Errorf("%s: URIs differ from template. Got %v, want %v", test.name, cert.URIs, template.URIs) + } + + if !slices.EqualFunc(cert.IPAddresses, template.IPAddresses, net.IP.Equal) { + t.Errorf("%s: SAN IPs differ from template. Got %v, want %v", test.name, cert.IPAddresses, template.IPAddresses) + } + + if !slices.Equal(cert.CRLDistributionPoints, template.CRLDistributionPoints) { + t.Errorf("%s: CRL distribution points differ from template. Got %v, want %v", test.name, cert.CRLDistributionPoints, template.CRLDistributionPoints) + } + + if !bytes.Equal(cert.SubjectKeyId, []byte{4, 3, 2, 1}) { + t.Errorf("%s: ExtraExtensions didn't override SubjectKeyId", test.name) + } + + if !bytes.Contains(derBytes, extraExtensionData) { + t.Errorf("%s: didn't find extra extension in DER output", test.name) + } + + if test.checkSig { + err = cert.CheckSignatureFrom(cert) + if err != nil { + t.Errorf("%s: signature verification failed: %s", test.name, err) + } + } + } +} + +// Self-signed certificate using ECDSA with SHA1 & secp256r1 +var ecdsaSHA1CertPem = ` +-----BEGIN CERTIFICATE----- +MIICDjCCAbUCCQDF6SfN0nsnrjAJBgcqhkjOPQQBMIGPMQswCQYDVQQGEwJVUzET +MBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEVMBMG +A1UECgwMR29vZ2xlLCBJbmMuMRcwFQYDVQQDDA53d3cuZ29vZ2xlLmNvbTEjMCEG +CSqGSIb3DQEJARYUZ29sYW5nLWRldkBnbWFpbC5jb20wHhcNMTIwNTIwMjAyMDUw +WhcNMjIwNTE4MjAyMDUwWjCBjzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlm +b3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxFTATBgNVBAoMDEdvb2dsZSwg +SW5jLjEXMBUGA1UEAwwOd3d3Lmdvb2dsZS5jb20xIzAhBgkqhkiG9w0BCQEWFGdv +bGFuZy1kZXZAZ21haWwuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE/Wgn +WQDo5+bz71T0327ERgd5SDDXFbXLpzIZDXTkjpe8QTEbsF+ezsQfrekrpDPC4Cd3 +P9LY0tG+aI8IyVKdUjAJBgcqhkjOPQQBA0gAMEUCIGlsqMcRqWVIWTD6wXwe6Jk2 +DKxL46r/FLgJYnzBEH99AiEA3fBouObsvV1R3oVkb4BQYnD4/4LeId6lAT43YvyV +a/A= +-----END CERTIFICATE----- +` + +// Self-signed certificate using ECDSA with SHA256 & secp256r1 +var ecdsaSHA256p256CertPem = ` +-----BEGIN CERTIFICATE----- +MIICDzCCAbYCCQDlsuMWvgQzhTAKBggqhkjOPQQDAjCBjzELMAkGA1UEBhMCVVMx +EzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxFTAT +BgNVBAoMDEdvb2dsZSwgSW5jLjEXMBUGA1UEAwwOd3d3Lmdvb2dsZS5jb20xIzAh +BgkqhkiG9w0BCQEWFGdvbGFuZy1kZXZAZ21haWwuY29tMB4XDTEyMDUyMTAwMTkx +NloXDTIyMDUxOTAwMTkxNlowgY8xCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxp +Zm9ybmlhMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MRUwEwYDVQQKDAxHb29nbGUs +IEluYy4xFzAVBgNVBAMMDnd3dy5nb29nbGUuY29tMSMwIQYJKoZIhvcNAQkBFhRn +b2xhbmctZGV2QGdtYWlsLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABPMt +2ErhxAty5EJRu9yM+MTy+hUXm3pdW1ensAv382KoGExSXAFWP7pjJnNtHO+XSwVm +YNtqjcAGFKpweoN//kQwCgYIKoZIzj0EAwIDRwAwRAIgIYSaUA/IB81gjbIw/hUV +70twxJr5EcgOo0hLp3Jm+EYCIFDO3NNcgmURbJ1kfoS3N/0O+irUtoPw38YoNkqJ +h5wi +-----END CERTIFICATE----- +` + +// Self-signed certificate using ECDSA with SHA256 & secp384r1 +var ecdsaSHA256p384CertPem = ` +-----BEGIN CERTIFICATE----- +MIICSjCCAdECCQDje/no7mXkVzAKBggqhkjOPQQDAjCBjjELMAkGA1UEBhMCVVMx +EzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxFDAS +BgNVBAoMC0dvb2dsZSwgSW5jMRcwFQYDVQQDDA53d3cuZ29vZ2xlLmNvbTEjMCEG +CSqGSIb3DQEJARYUZ29sYW5nLWRldkBnbWFpbC5jb20wHhcNMTIwNTIxMDYxMDM0 +WhcNMjIwNTE5MDYxMDM0WjCBjjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlm +b3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxFDASBgNVBAoMC0dvb2dsZSwg +SW5jMRcwFQYDVQQDDA53d3cuZ29vZ2xlLmNvbTEjMCEGCSqGSIb3DQEJARYUZ29s +YW5nLWRldkBnbWFpbC5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAARRuzRNIKRK +jIktEmXanNmrTR/q/FaHXLhWRZ6nHWe26Fw7Rsrbk+VjGy4vfWtNn7xSFKrOu5ze +qxKnmE0h5E480MNgrUiRkaGO2GMJJVmxx20aqkXOk59U8yGA4CghE6MwCgYIKoZI +zj0EAwIDZwAwZAIwBZEN8gvmRmfeP/9C1PRLzODIY4JqWub2PLRT4mv9GU+yw3Gr +PU9A3CHMdEcdw/MEAjBBO1lId8KOCh9UZunsSMfqXiVurpzmhWd6VYZ/32G+M+Mh +3yILeYQzllt/g0rKVRk= +-----END CERTIFICATE----- +` + +// Self-signed certificate using ECDSA with SHA384 & secp521r1 +var ecdsaSHA384p521CertPem = ` +-----BEGIN CERTIFICATE----- +MIICljCCAfcCCQDhp1AFD/ahKjAKBggqhkjOPQQDAzCBjjELMAkGA1UEBhMCVVMx +EzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxFDAS +BgNVBAoMC0dvb2dsZSwgSW5jMRcwFQYDVQQDDA53d3cuZ29vZ2xlLmNvbTEjMCEG +CSqGSIb3DQEJARYUZ29sYW5nLWRldkBnbWFpbC5jb20wHhcNMTIwNTIxMTUwNDI5 +WhcNMjIwNTE5MTUwNDI5WjCBjjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlm +b3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxFDASBgNVBAoMC0dvb2dsZSwg +SW5jMRcwFQYDVQQDDA53d3cuZ29vZ2xlLmNvbTEjMCEGCSqGSIb3DQEJARYUZ29s +YW5nLWRldkBnbWFpbC5jb20wgZswEAYHKoZIzj0CAQYFK4EEACMDgYYABACqx9Rv +IssRs1LWYcNN+WffwlHw4Tv3y8/LIAA9MF1ZScIonU9nRMxt4a2uGJVCPDw6JHpz +PaYc0E9puLoE9AfKpwFr59Jkot7dBg55SKPEFkddoip/rvmN7NPAWjMBirOwjOkm +8FPthvPhGPqsu9AvgVuHu3PosWiHGNrhh379pva8MzAKBggqhkjOPQQDAwOBjAAw +gYgCQgEHNmswkUdPpHqrVxp9PvLVl+xxPuHBkT+75z9JizyxtqykHQo9Uh6SWCYH +BF9KLolo01wMt8DjoYP5Fb3j5MH7xwJCAbWZzTOp4l4DPkIvAh4LeC4VWbwPPyqh +kBg71w/iEcSY3wUKgHGcJJrObZw7wys91I5kENljqw/Samdr3ka+jBJa +-----END CERTIFICATE----- +` + +var ecdsaTests = []struct { + sigAlgo SignatureAlgorithm + pemCert string +}{ + {ECDSAWithSHA256, ecdsaSHA256p256CertPem}, + {ECDSAWithSHA256, ecdsaSHA256p384CertPem}, + {ECDSAWithSHA384, ecdsaSHA384p521CertPem}, +} + +func TestECDSA(t *testing.T) { + for i, test := range ecdsaTests { + pemBlock, _ := pem.Decode([]byte(test.pemCert)) + cert, err := ParseCertificate(pemBlock.Bytes) + if err != nil { + t.Errorf("%d: failed to parse certificate: %s", i, err) + continue + } + if sa := cert.SignatureAlgorithm; sa != test.sigAlgo { + t.Errorf("%d: signature algorithm is %v, want %v", i, sa, test.sigAlgo) + } + if parsedKey, ok := cert.PublicKey.(*ecdsa.PublicKey); !ok { + t.Errorf("%d: wanted an ECDSA public key but found: %#v", i, parsedKey) + } + if pka := cert.PublicKeyAlgorithm; pka != ECDSA { + t.Errorf("%d: public key algorithm is %v, want ECDSA", i, pka) + } + if err = cert.CheckSignatureFrom(cert); err != nil { + t.Errorf("%d: certificate verification failed: %s", i, err) + } + } +} + +// Self-signed certificate using DSA with SHA1 +var dsaCertPem = `-----BEGIN CERTIFICATE----- +MIIEDTCCA82gAwIBAgIJALHPghaoxeDhMAkGByqGSM44BAMweTELMAkGA1UEBhMC +VVMxCzAJBgNVBAgTAk5DMQ8wDQYDVQQHEwZOZXd0b24xFDASBgNVBAoTC0dvb2ds +ZSwgSW5jMRIwEAYDVQQDEwlKb24gQWxsaWUxIjAgBgkqhkiG9w0BCQEWE2pvbmFs +bGllQGdvb2dsZS5jb20wHhcNMTEwNTE0MDMwMTQ1WhcNMTEwNjEzMDMwMTQ1WjB5 +MQswCQYDVQQGEwJVUzELMAkGA1UECBMCTkMxDzANBgNVBAcTBk5ld3RvbjEUMBIG +A1UEChMLR29vZ2xlLCBJbmMxEjAQBgNVBAMTCUpvbiBBbGxpZTEiMCAGCSqGSIb3 +DQEJARYTam9uYWxsaWVAZ29vZ2xlLmNvbTCCAbcwggEsBgcqhkjOOAQBMIIBHwKB +gQC8hLUnQ7FpFYu4WXTj6DKvXvz8QrJkNJCVMTpKAT7uBpobk32S5RrPKXocd4gN +8lyGB9ggS03EVlEwXvSmO0DH2MQtke2jl9j1HLydClMf4sbx5V6TV9IFw505U1iW +jL7awRMgxge+FsudtJK254FjMFo03ZnOQ8ZJJ9E6AEDrlwIVAJpnBn9moyP11Ox5 +Asc/5dnjb6dPAoGBAJFHd4KVv1iTVCvEG6gGiYop5DJh28hUQcN9kul+2A0yPUSC +X93oN00P8Vh3eYgSaCWZsha7zDG53MrVJ0Zf6v/X/CoZNhLldeNOepivTRAzn+Rz +kKUYy5l1sxYLHQKF0UGNCXfFKZT0PCmgU+PWhYNBBMn6/cIh44vp85ideo5CA4GE +AAKBgFmifCafzeRaohYKXJgMGSEaggCVCRq5xdyDCat+wbOkjC4mfG01/um3G8u5 +LxasjlWRKTR/tcAL7t0QuokVyQaYdVypZXNaMtx1db7YBuHjj3aP+8JOQRI9xz8c +bp5NDJ5pISiFOv4p3GZfqZPcqckDt78AtkQrmnal2txhhjF6o4HeMIHbMB0GA1Ud +DgQWBBQVyyr7hO11ZFFpWX50298Sa3V+rzCBqwYDVR0jBIGjMIGggBQVyyr7hO11 +ZFFpWX50298Sa3V+r6F9pHsweTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAk5DMQ8w +DQYDVQQHEwZOZXd0b24xFDASBgNVBAoTC0dvb2dsZSwgSW5jMRIwEAYDVQQDEwlK +b24gQWxsaWUxIjAgBgkqhkiG9w0BCQEWE2pvbmFsbGllQGdvb2dsZS5jb22CCQCx +z4IWqMXg4TAMBgNVHRMEBTADAQH/MAkGByqGSM44BAMDLwAwLAIUPtn/5j8Q1jJI +7ggOIsgrhgUdjGQCFCsmDq1H11q9+9Wp9IMeGrTSKHIM +-----END CERTIFICATE----- +` + +func TestParseCertificateWithDsaPublicKey(t *testing.T) { + expectedKey := &dsa.PublicKey{ + Parameters: dsa.Parameters{ + P: bigFromHexString("00BC84B52743B169158BB85974E3E832AF5EFCFC42B264349095313A4A013EEE069A1B937D92E51ACF297A1C77880DF25C8607D8204B4DC45651305EF4A63B40C7D8C42D91EDA397D8F51CBC9D0A531FE2C6F1E55E9357D205C39D395358968CBEDAC11320C607BE16CB9DB492B6E78163305A34DD99CE43C64927D13A0040EB97"), + Q: bigFromHexString("009A67067F66A323F5D4EC7902C73FE5D9E36FA74F"), + G: bigFromHexString("009147778295BF5893542BC41BA806898A29E43261DBC85441C37D92E97ED80D323D44825FDDE8374D0FF15877798812682599B216BBCC31B9DCCAD527465FEAFFD7FC2A193612E575E34E7A98AF4D10339FE47390A518CB9975B3160B1D0285D1418D0977C52994F43C29A053E3D685834104C9FAFDC221E38BE9F3989D7A8E42"), + }, + Y: bigFromHexString("59A27C269FCDE45AA2160A5C980C19211A820095091AB9C5DC8309AB7EC1B3A48C2E267C6D35FEE9B71BCBB92F16AC8E559129347FB5C00BEEDD10BA8915C90698755CA965735A32DC7575BED806E1E38F768FFBC24E41123DC73F1C6E9E4D0C9E692128853AFE29DC665FA993DCA9C903B7BF00B6442B9A76A5DADC6186317A"), + } + pemBlock, _ := pem.Decode([]byte(dsaCertPem)) + cert, err := ParseCertificate(pemBlock.Bytes) + if err != nil { + t.Fatalf("Failed to parse certificate: %s", err) + } + if cert.PublicKeyAlgorithm != DSA { + t.Errorf("Parsed key algorithm was not DSA") + } + parsedKey, ok := cert.PublicKey.(*dsa.PublicKey) + if !ok { + t.Fatalf("Parsed key was not a DSA key: %s", err) + } + if expectedKey.Y.Cmp(parsedKey.Y) != 0 || + expectedKey.P.Cmp(parsedKey.P) != 0 || + expectedKey.Q.Cmp(parsedKey.Q) != 0 || + expectedKey.G.Cmp(parsedKey.G) != 0 { + t.Fatal("Parsed key differs from expected key") + } +} + +func TestParseCertificateWithDSASignatureAlgorithm(t *testing.T) { + pemBlock, _ := pem.Decode([]byte(dsaCertPem)) + cert, err := ParseCertificate(pemBlock.Bytes) + if err != nil { + t.Fatalf("Failed to parse certificate: %s", err) + } + if cert.SignatureAlgorithm != DSAWithSHA1 { + t.Errorf("Parsed signature algorithm was not DSAWithSHA1") + } +} + +func TestVerifyCertificateWithDSASignature(t *testing.T) { + pemBlock, _ := pem.Decode([]byte(dsaCertPem)) + cert, err := ParseCertificate(pemBlock.Bytes) + if err != nil { + t.Fatalf("Failed to parse certificate: %s", err) + } + // test cert is self-signed + if err = cert.CheckSignatureFrom(cert); err == nil { + t.Fatalf("Expected error verifying DSA certificate") + } +} + +var rsaPSSSelfSignedPEM = `-----BEGIN CERTIFICATE----- +MIIGHjCCA9KgAwIBAgIBdjBBBgkqhkiG9w0BAQowNKAPMA0GCWCGSAFlAwQCAQUA +o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A5R+zX7BxeyFVE +qW0zh1Tkwh0S8LRe5diJh4+6FG0CAwEAAaNfMF0wHQYDVR0OBBYEFD+oahaikBTV +Urk81Uz7kRS2sx0aMA4GA1UdDwEB/wQEAwIBBjAYBgNVHSAEETAPMA0GCyqDCIaP +fgYFAQEBMBIGA1UdEwEB/wQIMAYBAf8CAQAwQQYJKoZIhvcNAQEKMDSgDzANBglg +hkgBZQMEAgEFAKEcMBoGCSqGSIb3DQEBCDANBglghkgBZQMEAgEFAKIDAgEgA4IC +AQAaxWBQn5CZuNBfyzL57mn31ukHUFd61OMROSX3PT7oCv1Dy+C2AdRlxOcbN3/n +li0yfXUUqiY3COlLAHKRlkr97mLtxEFoJ0R8nVN2IQdChNQM/XSCzSGyY8NVa1OR +TTpEWLnexJ9kvIdbFXwUqdTnAkOI0m7Rg8j+E+lRRHg1xDAA1qKttrtUj3HRQWf3 +kNTu628SiMvap6aIdncburaK56MP7gkR1Wr/ichOfjIA3Jgw2PapI31i0GqeMd66 +U1+lC9FeyMAJpuSVp/SoiYzYo+79SFcVoM2yw3yAnIKg7q9GLYYqzncdykT6C06c +15gWFI6igmReAsD9ITSvYh0jLrLHfEYcPTOD3ZXJ4EwwHtWSoO3gq1EAtOYKu/Lv +C8zfBsZcFdsHvsSiYeBU8Oioe42mguky3Ax9O7D805Ek6R68ra07MW/G4YxvV7IN +2BfSaYy8MX9IG0ZMIOcoc0FeF5xkFmJ7kdrlTaJzC0IE9PNxNaH5QnOAFB8vxHcO +FioUxb6UKdHcPLR1VZtAdTdTMjSJxUqD/35Cdfqs7oDJXz8f6TXO2Tdy6G++YUs9 +qsGZWxzFvvkXUkQSl0dQQ5jO/FtUJcAVXVVp20LxPemfatAHpW31WdJYeWSQWky2 ++f9b5TXKXVyjlUL7uHxowWrT2AtTchDH22wTEtqLEF9Z3Q== +-----END CERTIFICATE-----` + +// openssl req -newkey rsa:2048 -keyout test.key -sha256 -sigopt \ +// rsa_padding_mode:pss -sigopt rsa_pss_saltlen:32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CDALBglghkgBZQMEAgGiAwIBIAOCAQEAhJzpwxBNGKvzKWDe +WLqv6RMrl/q4GcH3b7M9wjxe0yOm4F+Tb2zJ7re4h+D39YkJf8cX1NV9UQVu6z4s +Fvo2kmlR0qZOXAg5augmCQ1xS0WHFoF6B52anNzHkZQbAIYJ3kGoFsUHzs7Sz7F/ +656FsRpHA9UzJQ3avPPMrA4Y4aoJ7ANJ6XIwTrdWrhULOVuvYRLCl4CdTVztVFX6 +wxX8nS1ISYd8jXPUMgsBKVbWufvLoIymMJW8CZbpprVZel5zFn0bmPrON8IHS30w +Gs+ITJjKEnZgXmAQ25SLKVzkZkBcGANs2GsdHNJ370Puisy0FIPD2NXR5uASAf7J ++w9fjQ== +-----END CERTIFICATE-----` + +func TestRSAPSSSelfSigned(t *testing.T) { + for i, pemBlock := range []string{rsaPSSSelfSignedPEM, rsaPSSSelfSignedOpenSSL110PEM} { + der, _ := pem.Decode([]byte(pemBlock)) + if der == nil { + t.Errorf("#%d: failed to find PEM block", i) + continue + } + + cert, err := ParseCertificate(der.Bytes) + if err != nil { + t.Errorf("#%d: failed to parse: %s", i, err) + continue + } + + if err = cert.CheckSignatureFrom(cert); err != nil { + t.Errorf("#%d: signature check failed: %s", i, err) + continue + } + } +} + +const ed25519Certificate = ` +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 0c:83:d8:21:2b:82:cb:23:98:23:63:e2:f7:97:8a:43:5b:f3:bd:92 + Signature Algorithm: ED25519 + Issuer: CN = Ed25519 test certificate + Validity + Not Before: May 6 17:27:16 2019 GMT + Not After : Jun 5 17:27:16 2019 GMT + Subject: CN = Ed25519 test certificate + Subject Public Key Info: + Public Key Algorithm: ED25519 + ED25519 Public-Key: + pub: + 36:29:c5:6c:0d:4f:14:6c:81:d0:ff:75:d3:6a:70: + 5f:69:cd:0f:4d:66:d5:da:98:7e:82:49:89:a3:8a: + 3c:fa + X509v3 extensions: + X509v3 Subject Key Identifier: + 09:3B:3A:9D:4A:29:D8:95:FF:68:BE:7B:43:54:72:E0:AD:A2:E3:AE + X509v3 Authority Key Identifier: + keyid:09:3B:3A:9D:4A:29:D8:95:FF:68:BE:7B:43:54:72:E0:AD:A2:E3:AE + + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: ED25519 + 53:a5:58:1c:2c:3b:2a:9e:ac:9d:4e:a5:1d:5f:5d:6d:a6:b5: + 08:de:12:82:f3:97:20:ae:fa:d8:98:f4:1a:83:32:6b:91:f5: + 24:1d:c4:20:7f:2c:e2:4d:da:13:3b:6d:54:1a:d2:a8:28:dc: + 60:b9:d4:f4:78:4b:3c:1c:91:00 +-----BEGIN CERTIFICATE----- +MIIBWzCCAQ2gAwIBAgIUDIPYISuCyyOYI2Pi95eKQ1vzvZIwBQYDK2VwMCMxITAf +BgNVBAMMGEVkMjU1MTkgdGVzdCBjZXJ0aWZpY2F0ZTAeFw0xOTA1MDYxNzI3MTZa +Fw0xOTA2MDUxNzI3MTZaMCMxITAfBgNVBAMMGEVkMjU1MTkgdGVzdCBjZXJ0aWZp +Y2F0ZTAqMAUGAytlcAMhADYpxWwNTxRsgdD/ddNqcF9pzQ9NZtXamH6CSYmjijz6 +o1MwUTAdBgNVHQ4EFgQUCTs6nUop2JX/aL57Q1Ry4K2i464wHwYDVR0jBBgwFoAU +CTs6nUop2JX/aL57Q1Ry4K2i464wDwYDVR0TAQH/BAUwAwEB/zAFBgMrZXADQQBT +pVgcLDsqnqydTqUdX11tprUI3hKC85cgrvrYmPQagzJrkfUkHcQgfyziTdoTO21U +GtKoKNxgudT0eEs8HJEA +-----END CERTIFICATE-----` + +func TestEd25519SelfSigned(t *testing.T) { + der, _ := pem.Decode([]byte(ed25519Certificate)) + if der == nil { + t.Fatalf("Failed to find PEM block") + } + + cert, err := ParseCertificate(der.Bytes) + if err != nil { + t.Fatalf("Failed to parse: %s", err) + } + + if cert.PublicKeyAlgorithm != Ed25519 { + t.Fatalf("Parsed key algorithm was not Ed25519") + } + parsedKey, ok := cert.PublicKey.(ed25519.PublicKey) + if !ok { + t.Fatalf("Parsed key was not an Ed25519 key: %s", err) + } + if len(parsedKey) != ed25519.PublicKeySize { + t.Fatalf("Invalid Ed25519 key") + } + + if err = cert.CheckSignatureFrom(cert); err != nil { + t.Fatalf("Signature check failed: %s", err) + } +} + +const pemCertificate = `-----BEGIN CERTIFICATE----- +MIIDATCCAemgAwIBAgIRAKQkkrFx1T/dgB/Go/xBM5swDQYJKoZIhvcNAQELBQAw +EjEQMA4GA1UEChMHQWNtZSBDbzAeFw0xNjA4MTcyMDM2MDdaFw0xNzA4MTcyMDM2 +MDdaMBIxEDAOBgNVBAoTB0FjbWUgQ28wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw +ggEKAoIBAQDAoJtjG7M6InsWwIo+l3qq9u+g2rKFXNu9/mZ24XQ8XhV6PUR+5HQ4 +jUFWC58ExYhottqK5zQtKGkw5NuhjowFUgWB/VlNGAUBHtJcWR/062wYrHBYRxJH +qVXOpYKbIWwFKoXu3hcpg/CkdOlDWGKoZKBCwQwUBhWE7MDhpVdQ+ZljUJWL+FlK +yQK5iRsJd5TGJ6VUzLzdT4fmN2DzeK6GLeyMpVpU3sWV90JJbxWQ4YrzkKzYhMmB +EcpXTG2wm+ujiHU/k2p8zlf8Sm7VBM/scmnMFt0ynNXop4FWvJzEm1G0xD2t+e2I +5Utr04dOZPCgkm++QJgYhtZvgW7ZZiGTAgMBAAGjUjBQMA4GA1UdDwEB/wQEAwIF +oDATBgNVHSUEDDAKBggrBgEFBQcDATAMBgNVHRMBAf8EAjAAMBsGA1UdEQQUMBKC +EHRlc3QuZXhhbXBsZS5jb20wDQYJKoZIhvcNAQELBQADggEBADpqKQxrthH5InC7 +X96UP0OJCu/lLEMkrjoEWYIQaFl7uLPxKH5AmQPH4lYwF7u7gksR7owVG9QU9fs6 +1fK7II9CVgCd/4tZ0zm98FmU4D0lHGtPARrrzoZaqVZcAvRnFTlPX5pFkPhVjjai +/mkxX9LpD8oK1445DFHxK5UjLMmPIIWd8EOi+v5a+hgGwnJpoW7hntSl8kHMtTmy +fnnktsblSUV4lRCit0ymC7Ojhe+gzCCwkgs5kDzVVag+tnl/0e2DloIjASwOhpbH +KVcg7fBd484ht/sS+l0dsB4KDOSpd8JzVDMF8OZqlaydizoJO0yWr9GbCN1+OKq5 +EhLrEqU= +-----END CERTIFICATE-----` + +const ed25519CRLCertificate = ` +Certificate: +Data: + Version: 3 (0x2) + Serial Number: + 7a:07:a0:9d:14:04:16:fc:1f:d8:e5:fe:d1:1d:1f:8d + Signature Algorithm: ED25519 + Issuer: CN = Ed25519 CRL Test CA + Validity + Not Before: Oct 30 01:20:20 2019 GMT + Not After : Dec 31 23:59:59 9999 GMT + Subject: CN = Ed25519 CRL Test CA + Subject Public Key Info: + Public Key Algorithm: ED25519 + ED25519 Public-Key: + pub: + 95:73:3b:b0:06:2a:31:5a:b6:a7:a6:6e:ef:71:df: + ac:6f:6b:39:03:85:5e:63:4b:f8:a6:0f:68:c6:6f: + 75:21 + X509v3 extensions: + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + X509v3 Extended Key Usage: + TLS Web Client Authentication, TLS Web Server Authentication, OCSP Signing + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + B7:17:DA:16:EA:C5:ED:1F:18:49:44:D3:D2:E3:A0:35:0A:81:93:60 + X509v3 Authority Key Identifier: + keyid:B7:17:DA:16:EA:C5:ED:1F:18:49:44:D3:D2:E3:A0:35:0A:81:93:60 + +Signature Algorithm: ED25519 + fc:3e:14:ea:bb:70:c2:6f:38:34:70:bc:c8:a7:f4:7c:0d:1e: + 28:d7:2a:9f:22:8a:45:e8:02:76:84:1e:2d:64:2d:1e:09:b5: + 29:71:1f:95:8a:4e:79:87:51:60:9a:e7:86:40:f6:60:c7:d1: + ee:68:76:17:1d:90:cc:92:93:07 +-----BEGIN CERTIFICATE----- +MIIBijCCATygAwIBAgIQegegnRQEFvwf2OX+0R0fjTAFBgMrZXAwHjEcMBoGA1UE +AxMTRWQyNTUxOSBDUkwgVGVzdCBDQTAgFw0xOTEwMzAwMTIwMjBaGA85OTk5MTIz +MTIzNTk1OVowHjEcMBoGA1UEAxMTRWQyNTUxOSBDUkwgVGVzdCBDQTAqMAUGAytl +cAMhAJVzO7AGKjFatqembu9x36xvazkDhV5jS/imD2jGb3Uho4GNMIGKMA4GA1Ud +DwEB/wQEAwIBhjAnBgNVHSUEIDAeBggrBgEFBQcDAgYIKwYBBQUHAwEGCCsGAQUF +BwMJMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFLcX2hbqxe0fGElE09LjoDUK +gZNgMB8GA1UdIwQYMBaAFLcX2hbqxe0fGElE09LjoDUKgZNgMAUGAytlcANBAPw+ +FOq7cMJvODRwvMin9HwNHijXKp8iikXoAnaEHi1kLR4JtSlxH5WKTnmHUWCa54ZA +9mDH0e5odhcdkMySkwc= +-----END CERTIFICATE-----` + +var ed25519CRLKey = testingKey(`-----BEGIN TEST KEY----- +MC4CAQAwBQYDK2VwBCIEINdKh2096vUBYu4EIFpjShsUSh3vimKya1sQ1YTT4RZG +-----END TEST KEY-----`) + +func TestCRLCreation(t *testing.T) { + block, _ := pem.Decode([]byte(pemPrivateKey)) + privRSA, _ := ParsePKCS1PrivateKey(block.Bytes) + block, _ = pem.Decode([]byte(pemCertificate)) + certRSA, _ := ParseCertificate(block.Bytes) + + block, _ = pem.Decode([]byte(ed25519CRLKey)) + privEd25519, _ := ParsePKCS8PrivateKey(block.Bytes) + block, _ = pem.Decode([]byte(ed25519CRLCertificate)) + certEd25519, _ := ParseCertificate(block.Bytes) + + tests := []struct { + name string + priv any + cert *Certificate + }{ + {"RSA CA", privRSA, certRSA}, + {"Ed25519 CA", privEd25519, certEd25519}, + } + + loc := time.FixedZone("Oz/Atlantis", int((2 * time.Hour).Seconds())) + + now := time.Unix(1000, 0).In(loc) + nowUTC := now.UTC() + expiry := time.Unix(10000, 0) + + revokedCerts := []pkix.RevokedCertificate{ + { + SerialNumber: big.NewInt(1), + RevocationTime: nowUTC, + }, + { + SerialNumber: big.NewInt(42), + // RevocationTime should be converted to UTC before marshaling. + RevocationTime: now, + }, + } + expectedCerts := []pkix.RevokedCertificate{ + { + SerialNumber: big.NewInt(1), + RevocationTime: nowUTC, + }, + { + SerialNumber: big.NewInt(42), + RevocationTime: nowUTC, + }, + } + + for _, test := range tests { + crlBytes, err := test.cert.CreateCRL(rand.Reader, test.priv, revokedCerts, now, expiry) + if err != nil { + t.Errorf("%s: error creating CRL: %s", test.name, err) + continue + } + + parsedCRL, err := ParseDERCRL(crlBytes) + if err != nil { + t.Errorf("%s: error reparsing CRL: %s", test.name, err) + continue + } + if !reflect.DeepEqual(parsedCRL.TBSCertList.RevokedCertificates, expectedCerts) { + t.Errorf("%s: RevokedCertificates mismatch: got %v; want %v.", test.name, + parsedCRL.TBSCertList.RevokedCertificates, expectedCerts) + } + } +} + +func fromBase64(in string) []byte { + out := make([]byte, base64.StdEncoding.DecodedLen(len(in))) + n, err := base64.StdEncoding.Decode(out, []byte(in)) + if err != nil { + panic("failed to base64 decode") + } + return out[:n] +} + +func TestParseDERCRL(t *testing.T) { + derBytes := fromBase64(derCRLBase64) + certList, err := ParseDERCRL(derBytes) + if err != nil { + t.Errorf("error parsing: %s", err) + return + } + numCerts := len(certList.TBSCertList.RevokedCertificates) + expected := 88 + if numCerts != expected { + t.Errorf("bad number of revoked certificates. got: %d want: %d", numCerts, expected) + } + + if certList.HasExpired(time.Unix(1302517272, 0)) { + t.Errorf("CRL has expired (but shouldn't have)") + } + + // Can't check the signature here without a package cycle. +} + +func TestCRLWithoutExpiry(t *testing.T) { + derBytes := fromBase64("MIHYMIGZMAkGByqGSM44BAMwEjEQMA4GA1UEAxMHQ2FybERTUxcNOTkwODI3MDcwMDAwWjBpMBMCAgDIFw05OTA4MjIwNzAwMDBaMBMCAgDJFw05OTA4MjIwNzAwMDBaMBMCAgDTFw05OTA4MjIwNzAwMDBaMBMCAgDSFw05OTA4MjIwNzAwMDBaMBMCAgDUFw05OTA4MjQwNzAwMDBaMAkGByqGSM44BAMDLwAwLAIUfmVSdjP+NHMX0feW+aDU2G1cfT0CFAJ6W7fVWxjBz4fvftok8yqDnDWh") + certList, err := ParseDERCRL(derBytes) + if err != nil { + t.Fatal(err) + } + if !certList.TBSCertList.NextUpdate.IsZero() { + t.Errorf("NextUpdate is not the zero value") + } +} + +func TestParsePEMCRL(t *testing.T) { + pemBytes := fromBase64(pemCRLBase64) + certList, err := ParseCRL(pemBytes) + if err != nil { + t.Errorf("error parsing: %s", err) + return + } + numCerts := len(certList.TBSCertList.RevokedCertificates) + expected := 2 + if numCerts != expected { + t.Errorf("bad number of revoked certificates. got: %d want: %d", numCerts, expected) + } + + if certList.HasExpired(time.Unix(1302517272, 0)) { + t.Errorf("CRL has expired (but shouldn't have)") + } + + // Can't check the signature here without a package cycle. +} + +func TestImports(t *testing.T) { + if testing.Short() { + t.Skip("skipping in -short mode") + } + if out, err := testenv.Command(t, testenv.GoToolPath(t), "run", "x509_test_import.go").CombinedOutput(); err != nil { + t.Errorf("failed to run x509_test_import.go: %s\n%s", err, out) + } +} + +const derCRLBase64 = "MIINqzCCDJMCAQEwDQYJKoZIhvcNAQEFBQAwVjEZMBcGA1UEAxMQUEtJIEZJTk1FQ0NBTklDQTEVMBMGA1UEChMMRklOTUVDQ0FOSUNBMRUwEwYDVQQLEwxGSU5NRUNDQU5JQ0ExCzAJBgNVBAYTAklUFw0xMTA1MDQxNjU3NDJaFw0xMTA1MDQyMDU3NDJaMIIMBzAhAg4Ze1od49Lt1qIXBydAzhcNMDkwNzE2MDg0MzIyWjAAMCECDl0HSL9bcZ1Ci/UHJ0DPFw0wOTA3MTYwODQzMTNaMAAwIQIOESB9tVAmX3cY7QcnQNAXDTA5MDcxNjA4NDUyMlowADAhAg4S1tGAQ3mHt8uVBydA1RcNMDkwODA0MTUyNTIyWjAAMCECDlQ249Y7vtC25ScHJ0DWFw0wOTA4MDQxNTI1MzdaMAAwIQ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UlCOWpDQ0FWOENBUUV3RFFZSktvWklodmNOQVFFRkJRQXdiREVhTUJnR0ExVUVDaE1SVWxOQklGTmxZM1Z5DQphWFI1SUVsdVl5NHhIakFjQmdOVkJBTVRGVkpUUVNCUWRXSnNhV01nVW05dmRDQkRRU0IyTVRFdU1Dd0dDU3FHDQpTSWIzRFFFSkFSWWZjbk5oYTJWdmJuSnZiM1J6YVdkdVFISnpZWE5sWTNWeWFYUjVMbU52YlJjTk1URXdNakl6DQpNVGt5T0RNd1doY05NVEV3T0RJeU1Ua3lPRE13V2pDQmpEQktBaEVBckRxb2g5RkhKSFhUN09QZ3V1bjQrQmNODQpNRGt4TVRBeU1UUXlOekE1V2pBbU1Bb0dBMVVkRlFRRENnRUpNQmdHQTFVZEdBUVJHQTh5TURBNU1URXdNakUwDQpNalExTlZvd1BnSVJBTEd6blowOTVQQjVhQU9MUGc1N2ZNTVhEVEF5TVRBeU16RTBOVEF4TkZvd0dqQVlCZ05WDQpIUmdFRVJnUE1qQXdNakV3TWpNeE5EVXdNVFJhb0RBd0xqQWZCZ05WSFNNRUdEQVdnQlQxVERGNlVRTS9MTmVMDQpsNWx2cUhHUXEzZzltekFMQmdOVkhSUUVCQUlDQUlRd0RRWUpLb1pJaHZjTkFRRUZCUUFEZ1lFQUZVNUFzNk16DQpxNVBSc2lmYW9iUVBHaDFhSkx5QytNczVBZ2MwYld5QTNHQWR4dXI1U3BQWmVSV0NCamlQL01FSEJXSkNsQkhQDQpHUmNxNXlJZDNFakRrYUV5eFJhK2k2N0x6dmhJNmMyOUVlNks5cFNZd2ppLzdSVWhtbW5Qclh0VHhsTDBsckxyDQptUVFKNnhoRFJhNUczUUE0Q21VZHNITnZicnpnbUNZcHZWRT0NCi0tLS0tRU5EIFg1MDkgQ1JMLS0tLS0NCg0K" + +func TestCreateCertificateRequest(t *testing.T) { + random := rand.Reader + + ecdsa256Priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatalf("Failed to generate ECDSA key: %s", err) + } + + ecdsa384Priv, err := ecdsa.GenerateKey(elliptic.P384(), rand.Reader) + if err != nil { + t.Fatalf("Failed to generate ECDSA key: %s", err) + } + + ecdsa521Priv, err := ecdsa.GenerateKey(elliptic.P521(), rand.Reader) + if err != nil { + t.Fatalf("Failed to generate ECDSA key: %s", err) + } + + _, ed25519Priv, err := ed25519.GenerateKey(random) + if err != nil { + t.Fatalf("Failed to generate Ed25519 key: %s", err) + } + + tests := []struct { + name string + priv any + sigAlgo SignatureAlgorithm + }{ + {"RSA", testPrivateKey, SHA256WithRSA}, + {"RSA-PSS-SHA256", testPrivateKey, SHA256WithRSAPSS}, + {"ECDSA-256", ecdsa256Priv, ECDSAWithSHA256}, + {"ECDSA-384", ecdsa384Priv, ECDSAWithSHA256}, + {"ECDSA-521", ecdsa521Priv, ECDSAWithSHA256}, + {"Ed25519", ed25519Priv, PureEd25519}, + } + + for _, test := range tests { + template := CertificateRequest{ + Subject: pkix.Name{ + CommonName: "test.example.com", + Organization: []string{"Σ Acme Co"}, + }, + SignatureAlgorithm: test.sigAlgo, + DNSNames: []string{"test.example.com"}, + EmailAddresses: []string{"gopher@golang.org"}, + IPAddresses: []net.IP{net.IPv4(127, 0, 0, 1).To4(), net.ParseIP("2001:4860:0:2001::68")}, + } + + derBytes, err := CreateCertificateRequest(random, &template, test.priv) + if err != nil { + t.Errorf("%s: failed to create certificate request: %s", test.name, err) + continue + } + + out, err := ParseCertificateRequest(derBytes) + if err != nil { + t.Errorf("%s: failed to create certificate request: %s", test.name, err) + continue + } + + err = out.CheckSignature() + if err != nil { + t.Errorf("%s: failed to check certificate request signature: %s", test.name, err) + continue + } + + if out.Subject.CommonName != template.Subject.CommonName { + t.Errorf("%s: output subject common name and template subject common name don't match", test.name) + } else if len(out.Subject.Organization) != len(template.Subject.Organization) { + t.Errorf("%s: output subject organisation and template subject organisation don't match", test.name) + } else if len(out.DNSNames) != len(template.DNSNames) { + t.Errorf("%s: output DNS names and template DNS names don't match", test.name) + } else if len(out.EmailAddresses) != len(template.EmailAddresses) { + t.Errorf("%s: output email addresses and template email addresses don't match", test.name) + } else if len(out.IPAddresses) != len(template.IPAddresses) { + t.Errorf("%s: output IP addresses and template IP addresses names don't match", test.name) + } + } +} + +func marshalAndParseCSR(t *testing.T, template *CertificateRequest) *CertificateRequest { + t.Helper() + derBytes, err := CreateCertificateRequest(rand.Reader, template, testPrivateKey) + if err != nil { + t.Fatal(err) + } + + csr, err := ParseCertificateRequest(derBytes) + if err != nil { + t.Fatal(err) + } + + return csr +} + +func TestCertificateRequestOverrides(t *testing.T) { + sanContents, err := marshalSANs([]string{"foo.example.com"}, nil, nil, nil) + if err != nil { + t.Fatal(err) + } + + template := CertificateRequest{ + Subject: pkix.Name{ + CommonName: "test.example.com", + Organization: []string{"Σ Acme Co"}, + }, + DNSNames: []string{"test.example.com"}, + + // An explicit extension should override the DNSNames from the + // template. + ExtraExtensions: []pkix.Extension{ + { + Id: oidExtensionSubjectAltName, + Value: sanContents, + Critical: true, + }, + }, + } + + csr := marshalAndParseCSR(t, &template) + + if len(csr.DNSNames) != 1 || csr.DNSNames[0] != "foo.example.com" { + t.Errorf("Extension did not override template. Got %v\n", csr.DNSNames) + } + + if len(csr.Extensions) != 1 || !csr.Extensions[0].Id.Equal(oidExtensionSubjectAltName) || !csr.Extensions[0].Critical { + t.Errorf("SAN extension was not faithfully copied, got %#v", csr.Extensions) + } + + // If there is already an attribute with X.509 extensions then the + // extra extensions should be added to it rather than creating a CSR + // with two extension attributes. + + template.Attributes = []pkix.AttributeTypeAndValueSET{ + { + Type: oidExtensionRequest, + Value: [][]pkix.AttributeTypeAndValue{ + { + { + Type: oidExtensionAuthorityInfoAccess, + Value: []byte("foo"), + }, + }, + }, + }, + } + + csr = marshalAndParseCSR(t, &template) + if l := len(csr.Attributes); l != 1 { + t.Errorf("incorrect number of attributes: %d\n", l) + } + + if !csr.Attributes[0].Type.Equal(oidExtensionRequest) || + len(csr.Attributes[0].Value) != 1 || + len(csr.Attributes[0].Value[0]) != 2 { + t.Errorf("bad attributes: %#v\n", csr.Attributes) + } + + sanContents2, err := marshalSANs([]string{"foo2.example.com"}, nil, nil, nil) + if err != nil { + t.Fatal(err) + } + + // Extensions in Attributes should override those in ExtraExtensions. + template.Attributes[0].Value[0] = append(template.Attributes[0].Value[0], pkix.AttributeTypeAndValue{ + Type: oidExtensionSubjectAltName, + Value: sanContents2, + }) + + csr = marshalAndParseCSR(t, &template) + + if len(csr.DNSNames) != 1 || csr.DNSNames[0] != "foo2.example.com" { + t.Errorf("Attributes did not override ExtraExtensions. Got %v\n", csr.DNSNames) + } +} + +func TestParseCertificateRequest(t *testing.T) { + for _, csrBase64 := range csrBase64Array { + csrBytes := fromBase64(csrBase64) + csr, err := ParseCertificateRequest(csrBytes) + if err != nil { + t.Fatalf("failed to parse CSR: %s", err) + } + + if len(csr.EmailAddresses) != 1 || csr.EmailAddresses[0] != "gopher@golang.org" { + t.Errorf("incorrect email addresses found: %v", csr.EmailAddresses) + } + + if len(csr.DNSNames) != 1 || csr.DNSNames[0] != "test.example.com" { + t.Errorf("incorrect DNS names found: %v", csr.DNSNames) + } + + if len(csr.Subject.Country) != 1 || csr.Subject.Country[0] != "AU" { + t.Errorf("incorrect Subject name: %v", csr.Subject) + } + + found := false + for _, e := range csr.Extensions { + if e.Id.Equal(oidExtensionBasicConstraints) { + found = true + break + } + } + if !found { + t.Errorf("basic constraints extension not found in CSR") + } + } +} + +func TestCriticalFlagInCSRRequestedExtensions(t *testing.T) { + // This CSR contains an extension request where the extensions have a + // critical flag in them. In the past we failed to handle this. + const csrBase64 = "MIICrTCCAZUCAQIwMzEgMB4GA1UEAwwXU0NFUCBDQSBmb3IgRGV2ZWxlciBTcmwxDzANBgNVBAsMBjQzNTk3MTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALFMAJ7Zy9YyfgbNlbUWAW0LalNRMPs7aXmLANsCpjhnw3lLlfDPaLeWyKh1nK5I5ojaJOW6KIOSAcJkDUe3rrE0wR0RVt3UxArqs0R/ND3u5Q+bDQY2X1HAFUHzUzcdm5JRAIA355v90teMckaWAIlkRQjDE22Lzc6NAl64KOd1rqOUNj8+PfX6fSo20jm94Pp1+a6mfk3G/RUWVuSm7owO5DZI/Fsi2ijdmb4NUar6K/bDKYTrDFkzcqAyMfP3TitUtBp19Mp3B1yAlHjlbp/r5fSSXfOGHZdgIvp0WkLuK2u5eQrX5l7HMB/5epgUs3HQxKY6ljhh5wAjDwz//LsCAwEAAaA1MDMGCSqGSIb3DQEJDjEmMCQwEgYDVR0TAQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8EBAMCAoQwDQYJKoZIhvcNAQEFBQADggEBAAMq3bxJSPQEgzLYR/yaVvgjCDrc3zUbIwdOis6Go06Q4RnjH5yRaSZAqZQTDsPurQcnz2I39VMGEiSkFJFavf4QHIZ7QFLkyXadMtALc87tm17Ej719SbHcBSSZayR9VYJUNXRLayI6HvyUrmqcMKh+iX3WY3ICr59/wlM0tYa8DYN4yzmOa2Onb29gy3YlaF5A2AKAMmk003cRT9gY26mjpv7d21czOSSeNyVIoZ04IR9ee71vWTMdv0hu/af5kSjQ+ZG5/Qgc0+mnECLz/1gtxt1srLYbtYQ/qAY8oX1DCSGFS61tN/vl+4cxGMD/VGcGzADRLRHSlVqy2Qgss6Q=" + + csrBytes := fromBase64(csrBase64) + csr, err := ParseCertificateRequest(csrBytes) + if err != nil { + t.Fatalf("failed to parse CSR: %s", err) + } + + expected := []struct { + Id asn1.ObjectIdentifier + Value []byte + }{ + {oidExtensionBasicConstraints, fromBase64("MAYBAf8CAQA=")}, + {oidExtensionKeyUsage, fromBase64("AwIChA==")}, + } + + if n := len(csr.Extensions); n != len(expected) { + t.Fatalf("expected to find %d extensions but found %d", len(expected), n) + } + + for i, extension := range csr.Extensions { + if !extension.Id.Equal(expected[i].Id) { + t.Fatalf("extension #%d has unexpected type %v (expected %v)", i, extension.Id, expected[i].Id) + } + + if !bytes.Equal(extension.Value, expected[i].Value) { + t.Fatalf("extension #%d has unexpected contents %x (expected %x)", i, extension.Value, expected[i].Value) + } + } +} + +// serialiseAndParse generates a self-signed certificate from template and +// returns a parsed version of it. +func serialiseAndParse(t *testing.T, template *Certificate) *Certificate { + t.Helper() + derBytes, err := CreateCertificate(rand.Reader, template, template, &testPrivateKey.PublicKey, testPrivateKey) + if err != nil { + t.Fatalf("failed to create certificate: %s", err) + return nil + } + + cert, err := ParseCertificate(derBytes) + if err != nil { + t.Fatalf("failed to parse certificate: %s", err) + return nil + } + + return cert +} + +func TestMaxPathLenNotCA(t *testing.T) { + template := &Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{ + CommonName: "Σ Acme Co", + }, + NotBefore: time.Unix(1000, 0), + NotAfter: time.Unix(100000, 0), + + BasicConstraintsValid: true, + IsCA: false, + } + if m := serialiseAndParse(t, template).MaxPathLen; m != -1 { + t.Errorf("MaxPathLen should be -1 when IsCa is false, got %d", m) + } + + template.MaxPathLen = -1 + if m := serialiseAndParse(t, template).MaxPathLen; m != -1 { + t.Errorf("MaxPathLen should be -1 when IsCa is false and MaxPathLen set to -1, got %d", m) + } + + template.MaxPathLen = 5 + if _, err := CreateCertificate(rand.Reader, template, template, &testPrivateKey.PublicKey, testPrivateKey); err == nil { + t.Error("specifying a MaxPathLen when IsCA is false should fail") + } + + template.MaxPathLen = 0 + template.MaxPathLenZero = true + if _, err := CreateCertificate(rand.Reader, template, template, &testPrivateKey.PublicKey, testPrivateKey); err == nil { + t.Error("setting MaxPathLenZero when IsCA is false should fail") + } + + template.BasicConstraintsValid = false + if m := serialiseAndParse(t, template).MaxPathLen; m != 0 { + t.Errorf("Bad MaxPathLen should be ignored if BasicConstraintsValid is false, got %d", m) + } +} + +func TestMaxPathLen(t *testing.T) { + template := &Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{ + CommonName: "Σ Acme Co", + }, + NotBefore: time.Unix(1000, 0), + NotAfter: time.Unix(100000, 0), + + BasicConstraintsValid: true, + IsCA: true, + } + + cert1 := serialiseAndParse(t, template) + if m := cert1.MaxPathLen; m != -1 { + t.Errorf("Omitting MaxPathLen didn't turn into -1, got %d", m) + } + if cert1.MaxPathLenZero { + t.Errorf("Omitting MaxPathLen resulted in MaxPathLenZero") + } + + template.MaxPathLen = 1 + cert2 := serialiseAndParse(t, template) + if m := cert2.MaxPathLen; m != 1 { + t.Errorf("Setting MaxPathLen didn't work. Got %d but set 1", m) + } + if cert2.MaxPathLenZero { + t.Errorf("Setting MaxPathLen resulted in MaxPathLenZero") + } + + template.MaxPathLen = 0 + template.MaxPathLenZero = true + cert3 := serialiseAndParse(t, template) + if m := cert3.MaxPathLen; m != 0 { + t.Errorf("Setting MaxPathLenZero didn't work, got %d", m) + } + if !cert3.MaxPathLenZero { + t.Errorf("Setting MaxPathLen to zero didn't result in MaxPathLenZero") + } +} + +func TestNoAuthorityKeyIdInSelfSignedCert(t *testing.T) { + template := &Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{ + CommonName: "Σ Acme Co", + }, + NotBefore: time.Unix(1000, 0), + NotAfter: time.Unix(100000, 0), + + BasicConstraintsValid: true, + IsCA: true, + SubjectKeyId: []byte{1, 2, 3, 4}, + } + + if cert := serialiseAndParse(t, template); len(cert.AuthorityKeyId) != 0 { + t.Fatalf("self-signed certificate contained default authority key id") + } + + template.AuthorityKeyId = []byte{1, 2, 3, 4} + if cert := serialiseAndParse(t, template); len(cert.AuthorityKeyId) == 0 { + t.Fatalf("self-signed certificate erased explicit authority key id") + } +} + +func TestNoSubjectKeyIdInCert(t *testing.T) { + template := &Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{ + CommonName: "Σ Acme Co", + }, + NotBefore: time.Unix(1000, 0), + NotAfter: time.Unix(100000, 0), + + BasicConstraintsValid: true, + IsCA: true, + } + if cert := serialiseAndParse(t, template); len(cert.SubjectKeyId) == 0 { + t.Fatalf("self-signed certificate did not generate subject key id using the public key") + } + + template.IsCA = false + if cert := serialiseAndParse(t, template); len(cert.SubjectKeyId) != 0 { + t.Fatalf("self-signed certificate generated subject key id when it isn't a CA") + } + + template.SubjectKeyId = []byte{1, 2, 3, 4} + if cert := serialiseAndParse(t, template); len(cert.SubjectKeyId) == 0 { + t.Fatalf("self-signed certificate erased explicit subject key id") + } +} + +func TestASN1BitLength(t *testing.T) { + tests := []struct { + bytes []byte + bitLen int + }{ + {nil, 0}, + {[]byte{0x00}, 0}, + {[]byte{0x00, 0x00}, 0}, + {[]byte{0xf0}, 4}, + {[]byte{0x88}, 5}, + {[]byte{0xff}, 8}, + {[]byte{0xff, 0x80}, 9}, + {[]byte{0xff, 0x81}, 16}, + } + + for i, test := range tests { + if got := asn1BitLength(test.bytes); got != test.bitLen { + t.Errorf("#%d: calculated bit-length of %d for %x, wanted %d", i, got, test.bytes, test.bitLen) + } + } +} + +func TestVerifyEmptyCertificate(t *testing.T) { + if _, err := new(Certificate).Verify(VerifyOptions{}); err != errNotParsed { + t.Errorf("Verifying empty certificate resulted in unexpected error: %q (wanted %q)", err, errNotParsed) + } +} + +func TestInsecureAlgorithmErrorString(t *testing.T) { + tests := []struct { + sa SignatureAlgorithm + want string + }{ + {MD5WithRSA, "x509: cannot verify signature: insecure algorithm MD5-RSA"}, + {SHA1WithRSA, "x509: cannot verify signature: insecure algorithm SHA1-RSA"}, + {ECDSAWithSHA1, "x509: cannot verify signature: insecure algorithm ECDSA-SHA1"}, + {MD2WithRSA, "x509: cannot verify signature: insecure algorithm 1"}, + {-1, "x509: cannot verify signature: insecure algorithm -1"}, + {0, "x509: cannot verify signature: insecure algorithm 0"}, + {9999, "x509: cannot verify signature: insecure algorithm 9999"}, + } + for i, tt := range tests { + if got := fmt.Sprint(InsecureAlgorithmError(tt.sa)); got != tt.want { + t.Errorf("%d. mismatch.\n got: %s\nwant: %s\n", i, got, tt.want) + } + } +} + +// These CSR was generated with OpenSSL: +// +// openssl req -out CSR.csr -new -sha256 -nodes -keyout privateKey.key -config openssl.cnf +// +// With openssl.cnf containing the following sections: +// +// [ v3_req ] +// basicConstraints = CA:FALSE +// keyUsage = nonRepudiation, digitalSignature, keyEncipherment +// subjectAltName = email:gopher@golang.org,DNS:test.example.com +// [ req_attributes ] +// challengePassword = ignored challenge +// unstructuredName = ignored unstructured name +var csrBase64Array = [...]string{ + // Just [ v3_req ] + "MIIDHDCCAgQCAQAwfjELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEUMBIGA1UEAwwLQ29tbW9uIE5hbWUxITAfBgkqhkiG9w0BCQEWEnRlc3RAZW1haWwuYWRkcmVzczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK1GY4YFx2ujlZEOJxQVYmsjUnLsd5nFVnNpLE4cV+77sgv9NPNlB8uhn3MXt5leD34rm/2BisCHOifPucYlSrszo2beuKhvwn4+2FxDmWtBEMu/QA16L5IvoOfYZm/gJTsPwKDqvaR0tTU67a9OtxwNTBMI56YKtmwd/o8d3hYv9cg+9ZGAZ/gKONcg/OWYx/XRh6bd0g8DMbCikpWgXKDsvvK1Nk+VtkDO1JxuBaj4Lz/p/MifTfnHoqHxWOWl4EaTs4Ychxsv34/rSj1KD1tJqorIv5Xv2aqv4sjxfbrYzX4kvS5SC1goIovLnhj5UjmQ3Qy8u65eow/LLWw+YFcCAwEAAaBZMFcGCSqGSIb3DQEJDjFKMEgwCQYDVR0TBAIwADALBgNVHQ8EBAMCBeAwLgYDVR0RBCcwJYERZ29waGVyQGdvbGFuZy5vcmeCEHRlc3QuZXhhbXBsZS5jb20wDQYJKoZIhvcNAQELBQADggEBAB6VPMRrchvNW61Tokyq3ZvO6/NoGIbuwUn54q6l5VZW0Ep5Nq8juhegSSnaJ0jrovmUgKDN9vEo2KxuAtwG6udS6Ami3zP+hRd4k9Q8djJPb78nrjzWiindLK5Fps9U5mMoi1ER8ViveyAOTfnZt/jsKUaRsscY2FzE9t9/o5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3sP6VXbLDW0+UWIeSccOhzUCcZ/G4qcrfhhx6gTZTeA01nP7TdTJURvWAH5iFqj9sQ0qnLq6nEcVHij3sG6M5+BxAIVClQBk6lTCzgphc835Fjj6qSLuJ20XHdL5UfUbiJxx299CHgyBRL+hBUIPfz8p+ZgamyAuDLfnj54zzcRVyLlrmMLNPZNll1Q70RxoU6uWvLH8wB8vQe3Q/guSGubLyLRTUQVPh+dw1L4t8MKFWfX/48jwRM4gIRHFHPeAAE9D9YAoqdIvj/iFm/eQ++7DP8MDwOZWsXeB6jjwHuLmkQ==", +} + +var md5cert = ` +-----BEGIN CERTIFICATE----- +MIIB4TCCAUoCCQCfmw3vMgPS5TANBgkqhkiG9w0BAQQFADA1MQswCQYDVQQGEwJB +VTETMBEGA1UECBMKU29tZS1TdGF0ZTERMA8GA1UEChMITUQ1IEluYy4wHhcNMTUx +MjAzMTkyOTMyWhcNMjkwODEyMTkyOTMyWjA1MQswCQYDVQQGEwJBVTETMBEGA1UE +CBMKU29tZS1TdGF0ZTERMA8GA1UEChMITUQ1IEluYy4wgZ8wDQYJKoZIhvcNAQEB +BQADgY0AMIGJAoGBANrq2nhLQj5mlXbpVX3QUPhfEm/vdEqPkoWtR/jRZIWm4WGf +Wpq/LKHJx2Pqwn+t117syN8l4U5unyAi1BJSXjBwPZNd7dXjcuJ+bRLV7FZ/iuvs +cfYyQQFTxan4TaJMd0x1HoNDbNbjHa02IyjjYE/r3mb/PIg+J2t5AZEh80lPAgMB +AAEwDQYJKoZIhvcNAQEEBQADgYEAjGzp3K3ey/YfKHohf33yHHWd695HQxDAP+wY +cs9/TAyLR+gJzJP7d18EcDDLJWVi7bhfa4EAD86di05azOh9kWSn4b3o9QYRGCSw +GNnI3Zk0cwNKA49hZntKKiy22DhRk7JAHF01d6Bu3KkHkmENrtJ+zj/+159WAnUa +qViorq4= +-----END CERTIFICATE----- +` + +func TestMD5(t *testing.T) { + pemBlock, _ := pem.Decode([]byte(md5cert)) + cert, err := ParseCertificate(pemBlock.Bytes) + if err != nil { + t.Fatalf("failed to parse certificate: %s", err) + } + if sa := cert.SignatureAlgorithm; sa != MD5WithRSA { + t.Errorf("signature algorithm is %v, want %v", sa, MD5WithRSA) + } + if err = cert.CheckSignatureFrom(cert); err == nil { + t.Fatalf("certificate verification succeeded incorrectly") + } + if _, ok := err.(InsecureAlgorithmError); !ok { + t.Fatalf("certificate verification returned %v (%T), wanted InsecureAlgorithmError", err, err) + } +} + +func TestSHA1(t *testing.T) { + pemBlock, _ := pem.Decode([]byte(ecdsaSHA1CertPem)) + cert, err := ParseCertificate(pemBlock.Bytes) + if err != nil { + t.Fatalf("failed to parse certificate: %s", err) + } + if sa := cert.SignatureAlgorithm; sa != ECDSAWithSHA1 { + t.Errorf("signature algorithm is %v, want %v", sa, ECDSAWithSHA1) + } + if err = cert.CheckSignatureFrom(cert); err == nil { + t.Fatalf("certificate verification succeeded incorrectly") + } + if _, ok := err.(InsecureAlgorithmError); !ok { + t.Fatalf("certificate verification returned %v (%T), wanted InsecureAlgorithmError", err, err) + } +} + +// certMissingRSANULL contains an RSA public key where the AlgorithmIdentifier +// parameters are omitted rather than being an ASN.1 NULL. +const certMissingRSANULL = ` +-----BEGIN CERTIFICATE----- +MIIB7TCCAVigAwIBAgIBADALBgkqhkiG9w0BAQUwJjEQMA4GA1UEChMHQWNtZSBD +bzESMBAGA1UEAxMJMTI3LjAuMC4xMB4XDTExMTIwODA3NTUxMloXDTEyMTIwNzA4 +MDAxMlowJjEQMA4GA1UEChMHQWNtZSBDbzESMBAGA1UEAxMJMTI3LjAuMC4xMIGc +MAsGCSqGSIb3DQEBAQOBjAAwgYgCgYBO0Hsx44Jk2VnAwoekXh6LczPHY1PfZpIG +hPZk1Y/kNqcdK+izIDZFI7Xjla7t4PUgnI2V339aEu+H5Fto5OkOdOwEin/ekyfE +ARl6vfLcPRSr0FTKIQzQTW6HLlzF0rtNS0/Otiz3fojsfNcCkXSmHgwa2uNKWi7e +E5xMQIhZkwIDAQABozIwMDAOBgNVHQ8BAf8EBAMCAKAwDQYDVR0OBAYEBAECAwQw +DwYDVR0jBAgwBoAEAQIDBDALBgkqhkiG9w0BAQUDgYEANh+zegx1yW43RmEr1b3A +p0vMRpqBWHyFeSnIyMZn3TJWRSt1tukkqVCavh9a+hoV2cxVlXIWg7nCto/9iIw4 +hB2rXZIxE0/9gzvGnfERYraL7KtnvshksBFQRlgXa5kc0x38BvEO5ZaoDPl4ILdE +GFGNEH5PlGffo05wc46QkYU= +-----END CERTIFICATE-----` + +func TestRSAMissingNULLParameters(t *testing.T) { + block, _ := pem.Decode([]byte(certMissingRSANULL)) + if _, err := ParseCertificate(block.Bytes); err == nil { + t.Error("unexpected success when parsing certificate with missing RSA NULL parameter") + } else if !strings.Contains(err.Error(), "missing NULL") { + t.Errorf("unrecognised error when parsing certificate with missing RSA NULL parameter: %s", err) + } +} + +const certISOOID = `-----BEGIN CERTIFICATE----- +MIIB5TCCAVKgAwIBAgIQNwyL3RPWV7dJQp34HwZG9DAJBgUrDgMCHQUAMBExDzAN +BgNVBAMTBm15dGVzdDAeFw0xNjA4MDkyMjExMDVaFw0zOTEyMzEyMzU5NTlaMBEx +DzANBgNVBAMTBm15dGVzdDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEArzIH +GsyDB3ohIGkkvijF2PTRUX1bvOtY1eUUpjwHyu0twpAKSuaQv2Ha+/63+aHe8O86 +BT+98wjXFX6RFSagtAujo80rIF2dSm33BGt18pDN8v6zp93dnAm0jRaSQrHJ75xw +5O+S1oEYR1LtUoFJy6qB104j6aINBAgOiLIKiMkCAwEAAaNGMEQwQgYDVR0BBDsw +OYAQVuYVQ/WDjdGSkZRlTtJDNKETMBExDzANBgNVBAMTBm15dGVzdIIQtwyL3RPW +V7dJQp34HwZG9DAJBgUrDgMCHQUAA4GBABngrSkH7vG5lY4sa4AZF59lAAXqBVJE +J4TBiKC62hCdZv18rBleP6ETfhbPg7pTs8p4ebQbpmtNxRS9Lw3MzQ8Ya5Ybwzj2 +NwBSyCtCQl7mrEg4nJqJl4A2EUhnET/oVxU0oTV/SZ3ziGXcY1oG1s6vidV7TZTu +MCRtdSdaM7g3 +-----END CERTIFICATE-----` + +func TestISOOIDInCertificate(t *testing.T) { + block, _ := pem.Decode([]byte(certISOOID)) + if cert, err := ParseCertificate(block.Bytes); err != nil { + t.Errorf("certificate with ISO OID failed to parse: %s", err) + } else if cert.SignatureAlgorithm == UnknownSignatureAlgorithm { + t.Errorf("ISO OID not recognised in certificate") + } +} + +// certMultipleRDN contains a RelativeDistinguishedName with two elements (the +// common name and serial number). This particular certificate was the first +// such certificate in the “Pilot” Certificate Transparency log. +const certMultipleRDN = ` +-----BEGIN CERTIFICATE----- +MIIFRzCCBC+gAwIBAgIEOl59NTANBgkqhkiG9w0BAQUFADA9MQswCQYDVQQGEwJz +aTEbMBkGA1UEChMSc3RhdGUtaW5zdGl0dXRpb25zMREwDwYDVQQLEwhzaWdvdi1j +YTAeFw0xMjExMTYxMDUyNTdaFw0xNzExMTYxMjQ5MDVaMIGLMQswCQYDVQQGEwJz +aTEbMBkGA1UEChMSc3RhdGUtaW5zdGl0dXRpb25zMRkwFwYDVQQLExB3ZWItY2Vy +dGlmaWNhdGVzMRAwDgYDVQQLEwdTZXJ2ZXJzMTIwFAYDVQQFEw0xMjM2NDg0MDEw +MDEwMBoGA1UEAxMTZXBvcnRhbC5tc3MuZWR1cy5zaTCCASIwDQYJKoZIhvcNAQEB +BQADggEPADCCAQoCggEBAMrNkZH9MPuBTjMGNk3sJX8V+CkFx/4ru7RTlLS6dlYM +098dtSfJ3s2w0p/1NB9UmR8j0yS0Kg6yoZ3ShsSO4DWBtcQD8820a6BYwqxxQTNf +HSRZOc+N/4TQrvmK6t4k9Aw+YEYTMrWOU4UTeyhDeCcUsBdh7HjfWsVaqNky+2sv +oic3zP5gF+2QfPkvOoHT3FLR8olNhViIE6Kk3eFIEs4dkq/ZzlYdLb8pHQoj/sGI +zFmA5AFvm1HURqOmJriFjBwa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GHIH06z3lGUVARFRJ61gtAprd +La+fgSS+LVZ+kU2TkeoWAKvGq8MAgDq4D4Xqwekg7WKFeuyusi/NI5rm40XgjBMF +DF72IUofoVt7wo0= +-----END CERTIFICATE-----` + +func TestMultipleRDN(t *testing.T) { + block, _ := pem.Decode([]byte(certMultipleRDN)) + cert, err := ParseCertificate(block.Bytes) + if err != nil { + t.Fatalf("certificate with two elements in an RDN failed to parse: %v", err) + } + + if want := "eportal.mss.edus.si"; cert.Subject.CommonName != want { + t.Errorf("got common name of %q, but want %q", cert.Subject.CommonName, want) + } + + if want := "1236484010010"; cert.Subject.SerialNumber != want { + t.Errorf("got serial number of %q, but want %q", cert.Subject.SerialNumber, want) + } +} + +func TestSystemCertPool(t *testing.T) { + if runtime.GOOS == "windows" || runtime.GOOS == "darwin" || runtime.GOOS == "ios" { + t.Skip("not implemented on Windows (Issue 16736, 18609) or darwin (Issue 46287)") + } + a, err := SystemCertPool() + if err != nil { + t.Fatal(err) + } + b, err := SystemCertPool() + if err != nil { + t.Fatal(err) + } + if !certPoolEqual(a, b) { + t.Fatal("two calls to SystemCertPool had different results") + } + if ok := b.AppendCertsFromPEM([]byte(` +-----BEGIN CERTIFICATE----- +MIIDBjCCAe6gAwIBAgIRANXM5I3gjuqDfTp/PYrs+u8wDQYJKoZIhvcNAQELBQAw +EjEQMA4GA1UEChMHQWNtZSBDbzAeFw0xODAzMjcxOTU2MjFaFw0xOTAzMjcxOTU2 +MjFaMBIxEDAOBgNVBAoTB0FjbWUgQ28wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw +ggEKAoIBAQDK+9m3rjsO2Djes6bIYQZ3eV29JF09ZrjOrEHLtaKrD6/acsoSoTsf +cQr+rzzztdB5ijWXCS64zo/0OiqBeZUNZ67jVdToa9qW5UYe2H0Y+ZNdfA5GYMFD +yk/l3/uBu3suTZPfXiW2TjEi27Q8ruNUIZ54DpTcs6y2rBRFzadPWwn/VQMlvRXM +jrzl8Y08dgnYmaAHprxVzwMXcQ/Brol+v9GvjaH1DooHqkn8O178wsPQNhdtvN01 +IXL46cYdcUwWrE/GX5u+9DaSi+0KWxAPQ+NVD5qUI0CKl4714yGGh7feXMjJdHgl +VG4QJZlJvC4FsURgCHJT6uHGIelnSwhbAgMBAAGjVzBVMA4GA1UdDwEB/wQEAwIF +oDATBgNVHSUEDDAKBggrBgEFBQcDATAMBgNVHRMBAf8EAjAAMCAGA1UdEQQZMBeC +FVRlc3RTeXN0ZW1DZXJ0UG9vbC5nbzANBgkqhkiG9w0BAQsFAAOCAQEAwuSRx/VR +BKh2ICxZjL6jBwk/7UlU1XKbhQD96RqkidDNGEc6eLZ90Z5XXTurEsXqdm5jQYPs +1cdcSW+fOSMl7MfW9e5tM66FaIPZl9rKZ1r7GkOfgn93xdLAWe8XHd19xRfDreub +YC8DVqgLASOEYFupVSl76ktPfxkU5KCvmUf3P2PrRybk1qLGFytGxfyice2gHSNI +gify3K/+H/7wCkyFW4xYvzl7WW4mXxoqPRPjQt1J423DhnnQ4G1P8V/vhUpXNXOq +N9IEPnWuihC09cyx/WMQIUlWnaQLHdfpPS04Iez3yy2PdfXJzwfPrja7rNE+skK6 +pa/O1nF0AfWOpw== +-----END CERTIFICATE----- + `)); !ok { + t.Fatal("AppendCertsFromPEM failed") + } + if reflect.DeepEqual(a, b) { + t.Fatal("changing one pool modified the other") + } +} + +const emptyNameConstraintsPEM = ` +-----BEGIN CERTIFICATE----- +MIIC1jCCAb6gAwIBAgICEjQwDQYJKoZIhvcNAQELBQAwKDEmMCQGA1UEAxMdRW1w +dHkgbmFtZSBjb25zdHJhaW50cyBpc3N1ZXIwHhcNMTMwMjAxMDAwMDAwWhcNMjAw +NTMwMTA0ODM4WjAhMR8wHQYDVQQDExZFbXB0eSBuYW1lIGNvbnN0cmFpbnRzMIIB +IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwriElUIt3LCqmJObs+yDoWPD +F5IqgWk6moIobYjPfextZiYU6I3EfvAwoNxPDkN2WowcocUZMJbEeEq5ebBksFnx +f12gBxlIViIYwZAzu7aFvhDMyPKQI3C8CG0ZSC9ABZ1E3umdA3CEueNOmP/TChNq +Cl23+BG1Qb/PJkpAO+GfpWSVhTcV53Mf/cKvFHcjGNrxzdSoq9fyW7a6gfcGEQY0 +LVkmwFWUfJ0wT8kaeLr0E0tozkIfo01KNWNzv6NcYP80QOBRDlApWu9ODmEVJHPD +blx4jzTQ3JLa+4DvBNOjVUOp+mgRmjiW0rLdrxwOxIqIOwNjweMCp/hgxX/hTQID +AQABoxEwDzANBgNVHR4EBjAEoAChADANBgkqhkiG9w0BAQsFAAOCAQEAWG+/zUMH +QhP8uNCtgSHyim/vh7wminwAvWgMKxlkLBFns6nZeQqsOV1lABY7U0Zuoqa1Z5nb +6L+iJa4ElREJOi/erLc9uLwBdDCAR0hUTKD7a6i4ooS39DTle87cUnj0MW1CUa6H +v5SsvpYW+1XleYJk/axQOOTcy4Es53dvnZsjXH0EA/QHnn7UV+JmlE3rtVxcYp6M +LYPmRhTioROA/drghicRkiu9hxdPyxkYS16M5g3Zj30jdm+k/6C6PeNtN9YmOOga +nCOSyFYfGhqOANYzpmuV+oIedAsPpIbfIzN8njYUs1zio+1IoI4o8ddM9sCbtPU8 +o+WoY6IsCKXV/g== +-----END CERTIFICATE-----` + +func TestEmptyNameConstraints(t *testing.T) { + block, _ := pem.Decode([]byte(emptyNameConstraintsPEM)) + _, err := ParseCertificate(block.Bytes) + if err == nil { + t.Fatal("unexpected success") + } + + const expected = "empty name constraints" + if str := err.Error(); !strings.Contains(str, expected) { + t.Errorf("expected %q in error but got %q", expected, str) + } +} + +func TestPKIXNameString(t *testing.T) { + der, err := base64.StdEncoding.DecodeString(certBytes) + if err != nil { + t.Fatal(err) + } + certs, err := ParseCertificates(der) + if err != nil { + t.Fatal(err) + } + + // Check that parsed non-standard attributes are printed. + rdns := pkix.Name{ + Locality: []string{"Gophertown"}, + ExtraNames: []pkix.AttributeTypeAndValue{ + {Type: asn1.ObjectIdentifier([]int{1, 2, 3, 4, 5}), Value: "golang.org"}}, + }.ToRDNSequence() + nn := pkix.Name{} + nn.FillFromRDNSequence(&rdns) + + // Check that zero-length non-nil ExtraNames hide Names. + extra := []pkix.AttributeTypeAndValue{ + {Type: asn1.ObjectIdentifier([]int{1, 2, 3, 4, 5}), Value: "backing array"}} + extraNotNil := pkix.Name{ + Locality: []string{"Gophertown"}, + ExtraNames: extra[:0], + Names: []pkix.AttributeTypeAndValue{ + {Type: asn1.ObjectIdentifier([]int{1, 2, 3, 4, 5}), Value: "golang.org"}}, + } + + tests := []struct { + dn pkix.Name + want string + }{ + {nn, "L=Gophertown,1.2.3.4.5=#130a676f6c616e672e6f7267"}, + {extraNotNil, "L=Gophertown"}, + {pkix.Name{ + CommonName: "Steve Kille", + Organization: []string{"Isode Limited"}, + OrganizationalUnit: []string{"RFCs"}, + Locality: []string{"Richmond"}, + Province: []string{"Surrey"}, + StreetAddress: []string{"The Square"}, + PostalCode: []string{"TW9 1DT"}, + SerialNumber: "RFC 2253", + Country: []string{"GB"}, + }, "SERIALNUMBER=RFC 2253,CN=Steve Kille,OU=RFCs,O=Isode Limited,POSTALCODE=TW9 1DT,STREET=The Square,L=Richmond,ST=Surrey,C=GB"}, + {certs[0].Subject, + "CN=mail.google.com,O=Google LLC,L=Mountain View,ST=California,C=US"}, + {pkix.Name{ + Organization: []string{"#Google, Inc. \n-> 'Alphabet\" "}, + Country: []string{"US"}, + }, "O=\\#Google\\, Inc. \n-\\> 'Alphabet\\\"\\ ,C=US"}, + {pkix.Name{ + CommonName: "foo.com", + Organization: []string{"Gopher Industries"}, + ExtraNames: []pkix.AttributeTypeAndValue{ + {Type: asn1.ObjectIdentifier([]int{2, 5, 4, 3}), Value: "bar.com"}}, + }, "CN=bar.com,O=Gopher Industries"}, + {pkix.Name{ + Locality: []string{"Gophertown"}, + ExtraNames: []pkix.AttributeTypeAndValue{ + {Type: asn1.ObjectIdentifier([]int{1, 2, 3, 4, 5}), Value: "golang.org"}}, + }, "1.2.3.4.5=#130a676f6c616e672e6f7267,L=Gophertown"}, + // If there are no ExtraNames, the Names are printed instead. + {pkix.Name{ + Locality: []string{"Gophertown"}, + Names: []pkix.AttributeTypeAndValue{ + {Type: asn1.ObjectIdentifier([]int{1, 2, 3, 4, 5}), Value: "golang.org"}}, + }, "L=Gophertown,1.2.3.4.5=#130a676f6c616e672e6f7267"}, + // If there are both, print only the ExtraNames. + {pkix.Name{ + Locality: []string{"Gophertown"}, + ExtraNames: []pkix.AttributeTypeAndValue{ + {Type: asn1.ObjectIdentifier([]int{1, 2, 3, 4, 5}), Value: "golang.org"}}, + Names: []pkix.AttributeTypeAndValue{ + {Type: asn1.ObjectIdentifier([]int{1, 2, 3, 4, 6}), Value: "example.com"}}, + }, "1.2.3.4.5=#130a676f6c616e672e6f7267,L=Gophertown"}, + } + + for i, test := range tests { + if got := test.dn.String(); got != test.want { + t.Errorf("#%d: String() = \n%s\n, want \n%s", i, got, test.want) + } + } + + if extra[0].Value != "backing array" { + t.Errorf("the backing array of an empty ExtraNames got modified by String") + } +} + +func TestRDNSequenceString(t *testing.T) { + // Test some extra cases that get lost in pkix.Name conversions such as + // multi-valued attributes. + + var ( + oidCountry = []int{2, 5, 4, 6} + oidOrganization = []int{2, 5, 4, 10} + oidOrganizationalUnit = []int{2, 5, 4, 11} + oidCommonName = []int{2, 5, 4, 3} + ) + + tests := []struct { + seq pkix.RDNSequence + want string + }{ + { + seq: pkix.RDNSequence{ + pkix.RelativeDistinguishedNameSET{ + pkix.AttributeTypeAndValue{Type: oidCountry, Value: "US"}, + }, + pkix.RelativeDistinguishedNameSET{ + pkix.AttributeTypeAndValue{Type: oidOrganization, Value: "Widget Inc."}, + }, + pkix.RelativeDistinguishedNameSET{ + pkix.AttributeTypeAndValue{Type: oidOrganizationalUnit, Value: "Sales"}, + pkix.AttributeTypeAndValue{Type: oidCommonName, Value: "J. Smith"}, + }, + }, + want: "OU=Sales+CN=J. Smith,O=Widget Inc.,C=US", + }, + } + + for i, test := range tests { + if got := test.seq.String(); got != test.want { + t.Errorf("#%d: String() = \n%s\n, want \n%s", i, got, test.want) + } + } +} + +const criticalNameConstraintWithUnknownTypePEM = ` +-----BEGIN CERTIFICATE----- +MIIC/TCCAeWgAwIBAgICEjQwDQYJKoZIhvcNAQELBQAwKDEmMCQGA1UEAxMdRW1w +dHkgbmFtZSBjb25zdHJhaW50cyBpc3N1ZXIwHhcNMTMwMjAxMDAwMDAwWhcNMjAw +NTMwMTA0ODM4WjAhMR8wHQYDVQQDExZFbXB0eSBuYW1lIGNvbnN0cmFpbnRzMIIB +IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwriElUIt3LCqmJObs+yDoWPD +F5IqgWk6moIobYjPfextZiYU6I3EfvAwoNxPDkN2WowcocUZMJbEeEq5ebBksFnx +f12gBxlIViIYwZAzu7aFvhDMyPKQI3C8CG0ZSC9ABZ1E3umdA3CEueNOmP/TChNq +Cl23+BG1Qb/PJkpAO+GfpWSVhTcV53Mf/cKvFHcjGNrxzdSoq9fyW7a6gfcGEQY0 +LVkmwFWUfJ0wT8kaeLr0E0tozkIfo01KNWNzv6NcYP80QOBRDlApWu9ODmEVJHPD +blx4jzTQ3JLa+4DvBNOjVUOp+mgRmjiW0rLdrxwOxIqIOwNjweMCp/hgxX/hTQID +AQABozgwNjA0BgNVHR4BAf8EKjAooCQwIokgIACrzQAAAAAAAAAAAAAAAP////8A +AAAAAAAAAAAAAAChADANBgkqhkiG9w0BAQsFAAOCAQEAWG+/zUMHQhP8uNCtgSHy +im/vh7wminwAvWgMKxlkLBFns6nZeQqsOV1lABY7U0Zuoqa1Z5nb6L+iJa4ElREJ +Oi/erLc9uLwBdDCAR0hUTKD7a6i4ooS39DTle87cUnj0MW1CUa6Hv5SsvpYW+1Xl +eYJk/axQOOTcy4Es53dvnZsjXH0EA/QHnn7UV+JmlE3rtVxcYp6MLYPmRhTioROA +/drghicRkiu9hxdPyxkYS16M5g3Zj30jdm+k/6C6PeNtN9YmOOganCOSyFYfGhqO +ANYzpmuV+oIedAsPpIbfIzN8njYUs1zio+1IoI4o8ddM9sCbtPU8o+WoY6IsCKXV +/g== +-----END CERTIFICATE-----` + +func TestCriticalNameConstraintWithUnknownType(t *testing.T) { + block, _ := pem.Decode([]byte(criticalNameConstraintWithUnknownTypePEM)) + cert, err := ParseCertificate(block.Bytes) + if err != nil { + t.Fatalf("unexpected parsing failure: %s", err) + } + + if l := len(cert.UnhandledCriticalExtensions); l != 1 { + t.Fatalf("expected one unhandled critical extension, but found %d", l) + } +} + +const badIPMaskPEM = ` +-----BEGIN CERTIFICATE----- +MIICzzCCAbegAwIBAgICEjQwDQYJKoZIhvcNAQELBQAwHTEbMBkGA1UEAxMSQmFk +IElQIG1hc2sgaXNzdWVyMB4XDTEzMDIwMTAwMDAwMFoXDTIwMDUzMDEwNDgzOFow +FjEUMBIGA1UEAxMLQmFkIElQIG1hc2swggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw +ggEKAoIBAQDCuISVQi3csKqYk5uz7IOhY8MXkiqBaTqagihtiM997G1mJhTojcR+ +8DCg3E8OQ3ZajByhxRkwlsR4Srl5sGSwWfF/XaAHGUhWIhjBkDO7toW+EMzI8pAj +cLwIbRlIL0AFnUTe6Z0DcIS5406Y/9MKE2oKXbf4EbVBv88mSkA74Z+lZJWFNxXn +cx/9wq8UdyMY2vHN1Kir1/JbtrqB9wYRBjQtWSbAVZR8nTBPyRp4uvQTS2jOQh+j +TUo1Y3O/o1xg/zRA4FEOUCla704OYRUkc8NuXHiPNNDcktr7gO8E06NVQ6n6aBGa +OJbSst2vHA7Eiog7A2PB4wKn+GDFf+FNAgMBAAGjIDAeMBwGA1UdHgEB/wQSMBCg +DDAKhwgBAgME//8BAKEAMA0GCSqGSIb3DQEBCwUAA4IBAQBYb7/NQwdCE/y40K2B +IfKKb++HvCaKfAC9aAwrGWQsEWezqdl5Cqw5XWUAFjtTRm6iprVnmdvov6IlrgSV +EQk6L96stz24vAF0MIBHSFRMoPtrqLiihLf0NOV7ztxSePQxbUJRroe/lKy+lhb7 +VeV5gmT9rFA45NzLgSznd2+dmyNcfQQD9AeeftRX4maUTeu1XFxinowtg+ZGFOKh +E4D92uCGJxGSK72HF0/LGRhLXozmDdmPfSN2b6T/oLo942031iY46BqcI5LIVh8a +Go4A1jOma5X6gh50Cw+kht8jM3yeNhSzXOKj7Uigjijx10z2wJu09Tyj5ahjoiwI +pdX+ +-----END CERTIFICATE-----` + +func TestBadIPMask(t *testing.T) { + block, _ := pem.Decode([]byte(badIPMaskPEM)) + _, err := ParseCertificate(block.Bytes) + if err == nil { + t.Fatalf("unexpected success") + } + + const expected = "contained invalid mask" + if !strings.Contains(err.Error(), expected) { + t.Fatalf("expected %q in error but got: %s", expected, err) + } +} + +const additionalGeneralSubtreePEM = ` +-----BEGIN CERTIFICATE----- +MIIG4TCCBMmgAwIBAgIRALss+4rLw2Ia7tFFhxE8g5cwDQYJKoZIhvcNAQELBQAw +bjELMAkGA1UEBhMCTkwxIDAeBgNVBAoMF01pbmlzdGVyaWUgdmFuIERlZmVuc2ll +MT0wOwYDVQQDDDRNaW5pc3RlcmllIHZhbiBEZWZlbnNpZSBDZXJ0aWZpY2F0aWUg +QXV0b3JpdGVpdCAtIEcyMB4XDTEzMDMwNjEyMDM0OVoXDTEzMTEzMDEyMDM1MFow +bDELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUNlcnRpUGF0aCBMTEMxIjAgBgNVBAsT +GUNlcnRpZmljYXRpb24gQXV0aG9yaXRpZXMxITAfBgNVBAMTGENlcnRpUGF0aCBC +cmlkZ2UgQ0EgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANLW +4kXiRqvwBhJfN9uz12FA+P2D34MPxOt7TGXljm2plJ2CLzvaH8/ymsMdSWdJBS1M +8FmwvNL1w3A6ZuzksJjPikAu8kY3dcp3mrkk9eCPORDAwGtfsXwZysLiuEaDWpbD +dHOaHnI6qWU0N6OI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Kc0d0UMA0GCSqGSIb3DQEBCwUA +A4ICAQAQXFn9jF90/DNFf15JhoGtta/0dNInb14PMu3PAjcdrXYCDPpQZOArTUng +5YT1WuzfmjnXiTsziT3my0r9Mxvz/btKK/lnVOMW4c2q/8sIsIPnnW5ZaRGrsANB +dNDZkzMYmeG2Pfgvd0AQSOrpE/TVgWfu/+MMRWwX9y6VbooBR7BLv7zMuVH0WqLn +6OMFth7fqsThlfMSzkE/RDSaU6n3wXAWT1SIqBITtccRjSUQUFm/q3xrb2cwcZA6 +8vdS4hzNd+ttS905ay31Ks4/1Wrm1bH5RhEfRSH0VSXnc0b+z+RyBbmiwtVZqzxE +u3UQg/rAmtLDclLFEzjp8YDTIRYSLwstDbEXO/0ArdGrQm79HQ8i/3ZbP2357myW +i15qd6gMJIgGHS4b8Hc7R1K8LQ9Gm1aLKBEWVNGZlPK/cpXThpVmoEyslN2DHCrc +fbMbjNZpXlTMa+/b9z7Fa4X8dY8u/ELzZuJXJv5Rmqtg29eopFFYDCl0Nkh1XAjo +QejEoHHUvYV8TThHZr6Z6Ib8CECgTehU4QvepkgDXNoNrKRZBG0JhLjkwxh2whZq +nvWBfALC2VuNOM6C0rDY+HmhMlVt0XeqnybD9MuQALMit7Z00Cw2CIjNsBI9xBqD +xKK9CjUb7gzRUWSpB9jGHsvpEMHOzIFhufvH2Bz1XJw+Cl7khw== +-----END CERTIFICATE-----` + +func TestAdditionFieldsInGeneralSubtree(t *testing.T) { + // Very rarely, certificates can include additional fields in the + // GeneralSubtree structure. This tests that such certificates can be + // parsed. + block, _ := pem.Decode([]byte(additionalGeneralSubtreePEM)) + if _, err := ParseCertificate(block.Bytes); err != nil { + t.Fatalf("failed to parse certificate: %s", err) + } +} + +func TestEmptySerialNumber(t *testing.T) { + template := Certificate{ + DNSNames: []string{"example.com"}, + } + + for range 100 { + derBytes, err := CreateCertificate(rand.Reader, &template, &template, &testPrivateKey.PublicKey, testPrivateKey) + if err != nil { + t.Fatalf("failed to create certificate: %s", err) + } + + cert, err := ParseCertificate(derBytes) + if err != nil { + t.Fatalf("failed to parse certificate: %s", err) + } + + if sign := cert.SerialNumber.Sign(); sign != 1 { + t.Fatalf("generated a non positive serial, sign: %d", sign) + } + + b, err := asn1.Marshal(cert.SerialNumber) + if err != nil { + t.Fatalf("failed to marshal generated serial number: %s", err) + } + // subtract 2 for tag and length + if l := len(b) - 2; l > 20 { + t.Fatalf("generated serial number larger than 20 octets when encoded: %d", l) + } + } +} + +func TestEmptySubject(t *testing.T) { + template := Certificate{ + SerialNumber: big.NewInt(1), + DNSNames: []string{"example.com"}, + } + + derBytes, err := CreateCertificate(rand.Reader, &template, &template, &testPrivateKey.PublicKey, testPrivateKey) + if err != nil { + t.Fatalf("failed to create certificate: %s", err) + } + + cert, err := ParseCertificate(derBytes) + if err != nil { + t.Fatalf("failed to parse certificate: %s", err) + } + + for _, ext := range cert.Extensions { + if ext.Id.Equal(oidExtensionSubjectAltName) { + if !ext.Critical { + t.Fatal("SAN extension is not critical") + } + return + } + } + + t.Fatal("SAN extension is missing") +} + +// multipleURLsInCRLDPPEM contains two URLs in a single CRL DistributionPoint +// structure. It is taken from https://crt.sh/?id=12721534. +const multipleURLsInCRLDPPEM = ` +-----BEGIN CERTIFICATE----- +MIIF4TCCBMmgAwIBAgIQc+6uFePfrahUGpXs8lhiTzANBgkqhkiG9w0BAQsFADCB +8zELMAkGA1UEBhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2Vy +dGlmaWNhY2lvIChOSUYgUS0wODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1 +YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYDVQQLEyxWZWdldSBodHRwczovL3d3 +dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UECxMsSmVyYXJxdWlh +IEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMTBkVD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vUmVndWxhY2lvMDMGCCsGAQUFBwEBBCcwJTAjBggrBgEF +BQcwAYYXaHR0cDovL29jc3AuY2F0Y2VydC5jYXQwYgYDVR0fBFswWTBXoFWgU4Yn +aHR0cDovL2Vwc2NkLmNhdGNlcnQubmV0L2NybC9lYy1hY2MuY3JshihodHRwOi8v +ZXBzY2QyLmNhdGNlcnQubmV0L2NybC9lYy1hY2MuY3JsMA0GCSqGSIb3DQEBCwUA +A4IBAQChqFTjlAH5PyIhLjLgEs68CyNNC1+vDuZXRhy22TI83JcvGmQrZosPvVIL +PsUXx+C06Pfqmh48Q9S89X9K8w1SdJxP/rZeGEoRiKpwvQzM4ArD9QxyC8jirxex +3Umg9Ai/sXQ+1lBf6xw4HfUUr1WIp7pNHj0ZWLo106urqktcdeAFWme+/klis5fu +labCSVPuT/QpwakPrtqOhRms8vgpKiXa/eLtL9ZiA28X/Mker0zlAeTA7Z7uAnp6 +oPJTlZu1Gg1ZDJueTWWsLlO+P+Wzm3MRRIbcgdRzm4mdO7ubu26SzX/aQXDhuih+ +eVxXDTCfs7GUlxnjOp5j559X/N0A +-----END CERTIFICATE----- +` + +func TestMultipleURLsInCRLDP(t *testing.T) { + block, _ := pem.Decode([]byte(multipleURLsInCRLDPPEM)) + cert, err := ParseCertificate(block.Bytes) + if err != nil { + t.Fatalf("failed to parse certificate: %s", err) + } + + want := []string{ + "http://epscd.catcert.net/crl/ec-acc.crl", + "http://epscd2.catcert.net/crl/ec-acc.crl", + } + if got := cert.CRLDistributionPoints; !slices.Equal(got, want) { + t.Errorf("CRL distribution points = %#v, want #%v", got, want) + } +} + +const hexPKCS1TestPKCS8Key = "30820278020100300d06092a864886f70d0101010500048202623082025e02010002818100cfb1b5bf9685ffa97b4f99df4ff122b70e59ac9b992f3bc2b3dde17d53c1a34928719b02e8fd17839499bfbd515bd6ef99c7a1c47a239718fe36bfd824c0d96060084b5f67f0273443007a24dfaf5634f7772c9346e10eb294c2306671a5a5e719ae24b4de467291bc571014b0e02dec04534d66a9bb171d644b66b091780e8d020301000102818100b595778383c4afdbab95d2bfed12b3f93bb0a73a7ad952f44d7185fd9ec6c34de8f03a48770f2009c8580bcd275e9632714e9a5e3f32f29dc55474b2329ff0ebc08b3ffcb35bc96e6516b483df80a4a59cceb71918cbabf91564e64a39d7e35dce21cb3031824fdbc845dba6458852ec16af5dddf51a8397a8797ae0337b1439024100ea0eb1b914158c70db39031dd8904d6f18f408c85fbbc592d7d20dee7986969efbda081fdf8bc40e1b1336d6b638110c836bfdc3f314560d2e49cd4fbde1e20b024100e32a4e793b574c9c4a94c8803db5152141e72d03de64e54ef2c8ed104988ca780cd11397bc359630d01b97ebd87067c5451ba777cf045ca23f5912f1031308c702406dfcdbbd5a57c9f85abc4edf9e9e29153507b07ce0a7ef6f52e60dcfebe1b8341babd8b789a837485da6c8d55b29bbb142ace3c24a1f5b54b454d01b51e2ad03024100bd6a2b60dee01e1b3bfcef6a2f09ed027c273cdbbaf6ba55a80f6dcc64e4509ee560f84b4f3e076bd03b11e42fe71a3fdd2dffe7e0902c8584f8cad877cdc945024100aa512fa4ada69881f1d8bb8ad6614f192b83200aef5edf4811313d5ef30a86cbd0a90f7b025c71ea06ec6b34db6306c86b1040670fd8654ad7291d066d06d031" +const hexPKCS1TestECKey = "3081a40201010430bdb9839c08ee793d1157886a7a758a3c8b2a17a4df48f17ace57c72c56b4723cf21dcda21d4e1ad57ff034f19fcfd98ea00706052b81040022a16403620004feea808b5ee2429cfcce13c32160e1c960990bd050bb0fdf7222f3decd0a55008e32a6aa3c9062051c4cba92a7a3b178b24567412d43cdd2f882fa5addddd726fe3e208d2c26d733a773a597abb749714df7256ead5105fa6e7b3650de236b50" + +var pkcs1MismatchKeyTests = []struct { + hexKey string + errorContains string +}{ + {hexKey: hexPKCS1TestPKCS8Key, errorContains: "use ParsePKCS8PrivateKey instead"}, + {hexKey: hexPKCS1TestECKey, errorContains: "use ParseECPrivateKey instead"}, +} + +func TestPKCS1MismatchKeyFormat(t *testing.T) { + for i, test := range pkcs1MismatchKeyTests { + derBytes, _ := hex.DecodeString(test.hexKey) + _, err := ParsePKCS1PrivateKey(derBytes) + if !strings.Contains(err.Error(), test.errorContains) { + t.Errorf("#%d: expected error containing %q, got %s", i, test.errorContains, err) + } + } +} + +func TestCreateRevocationList(t *testing.T) { + ec256Priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatalf("Failed to generate ECDSA P256 key: %s", err) + } + _, ed25519Priv, err := ed25519.GenerateKey(rand.Reader) + if err != nil { + t.Fatalf("Failed to generate Ed25519 key: %s", err) + } + + // Generation command: + // openssl req -x509 -newkey rsa -keyout key.pem -out cert.pem -days 365 -nodes -subj '/C=US/ST=California/L=San Francisco/O=Internet Widgets, Inc./OU=WWW/CN=Root/emailAddress=admin@example.com' -sha256 -addext basicConstraints=CA:TRUE -addext "keyUsage = digitalSignature, keyEncipherment, dataEncipherment, cRLSign, keyCertSign" -utf8 + utf8CAStr := "MIIEITCCAwmgAwIBAgIUXHXy7NdtDv+ClaHvIvlwCYiI4a4wDQYJKoZIhvcNAQELBQAwgZoxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMR8wHQYDVQQKDBZJbnRlcm5ldCBXaWRnZXRzLCBJbmMuMQwwCgYDVQQLDANXV1cxDTALBgNVBAMMBFJvb3QxIDAeBgkqhkiG9w0BCQEWEWFkbWluQGV4YW1wbGUuY29tMB4XDTIyMDcwODE1MzgyMFoXDTIzMDcwODE1MzgyMFowgZoxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMR8wHQYDVQQKDBZJbnRlcm5ldCBXaWRnZXRzLCBJbmMuMQwwCgYDVQQLDANXV1cxDTALBgNVBAMMBFJvb3QxIDAeBgkqhkiG9w0BCQEWEWFkbWluQGV4YW1wbGUuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmXvp0WNjsZzySWT7Ce5zewQNKq8ujeZGphJ44Vdrwut/b6TcC4iYENds5+7/3PYwBllp3K5TRpCcafSxdhJsvA7/zWlHHNRcJhJLNt9qsKWP6ukI2Iw6OmFMg6kJQ8f67RXkT8HR3v0UqE+lWrA0g+oRuj4erLtfOtSpnl4nsE/Rs2qxbELFWAf7F5qMqH4dUyveWKrNT8eI6YQN+wBg0MAjoKRvDJnBhuo+IvvXX8Aq1QWUcBGPK3or/Ehxy5f/gEmSUXyEU1Ht/vATt2op+eRaEEpBdGRvO+DrKjlcQV2XMN18A9LAX6hCzH43sGye87dj7RZ9yj+waOYNaM7kFQIDAQABo10wWzAdBgNVHQ4EFgQUtbSlrW4hGL2kNjviM6wcCRwvOEEwHwYDVR0jBBgwFoAUtbSlrW4hGL2kNjviM6wcCRwvOEEwDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAbYwDQYJKoZIhvcNAQELBQADggEBAAko82YNNI2n/45L3ya21vufP6nZihIOIxgcRPUMX+IDJZk16qsFdcLgH3KAP8uiVLn8sULuCj35HpViR4IcAk2d+DqfG11l8kY+e5P7nYsViRfy0AatF59/sYlWf+3RdmPXfL70x4mE9OqlMdDm0kR2obps8rng83VLDNvj3R5sBnQwdw6LKLGzaE+RiCTmkH0+P6vnbOJ33su9+9al1+HvJUg3UM1Xq5Bw7TE8DQTetMV3c2Q35RQaJB9pQ4blJOnW9hfnt8yQzU6TU1bU4mRctTm1o1f8btPqUpi+/blhi5MUJK0/myj1XD00pmyfp8QAFl1EfqmTMIBMLg633A0=" + utf8CABytes, _ := base64.StdEncoding.DecodeString(utf8CAStr) + utf8CA, _ := ParseCertificate(utf8CABytes) + + utf8KeyStr := "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCZe+nRY2OxnPJJZPsJ7nN7BA0qry6N5kamEnjhV2vC639vpNwLiJgQ12zn7v/c9jAGWWncrlNGk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IAJvUH5jOJh/am/vYca0COMIfeAJUDHLyfcwb9XyiyRVGZzvP62tUelSq8gIZvQKBgCAHeaDzzWsudCO4ngwvZ3PGwnwgoaElqrmzRJLYG3SVtGvKOJTpINnNLDGwZ6dEaw1gLyEJ38QY4oJxEULDMiXzVasXQuPkmMAqhUP7D7A1JPw8C4TQ+mOa3XUppHx/CpMl/S4SA5OnmsnvyE5Fv0IveCGVXUkFtAN5rihuXEfhAoGANUkuGU3A0Upk2mzv0JTGP4H95JFG93cqnyPNrYs30M6RkZNgTW27yyr+Nhs4/cMdrg1AYTB0+6ItQWSDmYLs7JEbBE/8L8fdD1irIcygjIHE9nJh96TgZCt61kVGLE8758lOdmoB2rZOpGwi16QIhdQb+IyozYqfX+lQUojL/W0=" + utf8KeyBytes, _ := base64.StdEncoding.DecodeString(utf8KeyStr) + utf8KeyRaw, _ := ParsePKCS8PrivateKey(utf8KeyBytes) + utf8Key := utf8KeyRaw.(crypto.Signer) + + tests := []struct { + name string + key crypto.Signer + issuer *Certificate + template *RevocationList + expectedError string + }{ + { + name: "nil template", + key: ec256Priv, + issuer: nil, + template: nil, + expectedError: "x509: template can not be nil", + }, + { + name: "nil issuer", + key: ec256Priv, + issuer: nil, + template: &RevocationList{}, + expectedError: "x509: issuer can not be nil", + }, + { + name: "issuer doesn't have crlSign key usage bit set", + key: ec256Priv, + issuer: &Certificate{ + KeyUsage: KeyUsageCertSign, + }, + template: &RevocationList{}, + expectedError: "x509: issuer must have the crlSign key usage bit set", + }, + { + name: "issuer missing SubjectKeyId", + key: ec256Priv, + issuer: &Certificate{ + KeyUsage: KeyUsageCRLSign, + }, + template: &RevocationList{}, + expectedError: "x509: issuer certificate doesn't contain a subject key identifier", + }, + { + name: "nextUpdate before thisUpdate", + key: ec256Priv, + issuer: &Certificate{ + KeyUsage: KeyUsageCRLSign, + Subject: pkix.Name{ + CommonName: "testing", + }, + SubjectKeyId: []byte{1, 2, 3}, + }, + template: &RevocationList{ + ThisUpdate: time.Time{}.Add(time.Hour), + NextUpdate: time.Time{}, + }, + expectedError: "x509: template.ThisUpdate is after template.NextUpdate", + }, + { + name: "nil Number", + key: ec256Priv, + issuer: &Certificate{ + KeyUsage: KeyUsageCRLSign, + Subject: pkix.Name{ + CommonName: "testing", + }, + SubjectKeyId: []byte{1, 2, 3}, + }, + template: &RevocationList{ + ThisUpdate: time.Time{}.Add(time.Hour * 24), + NextUpdate: time.Time{}.Add(time.Hour * 48), + }, + expectedError: "x509: template contains nil Number field", + }, + { + name: "long Number", + key: ec256Priv, + issuer: &Certificate{ + KeyUsage: KeyUsageCRLSign, + Subject: pkix.Name{ + CommonName: "testing", + }, + SubjectKeyId: []byte{1, 2, 3}, + }, + template: &RevocationList{ + ThisUpdate: time.Time{}.Add(time.Hour * 24), + NextUpdate: time.Time{}.Add(time.Hour * 48), + Number: big.NewInt(0).SetBytes(append([]byte{1}, make([]byte, 20)...)), + }, + expectedError: "x509: CRL number exceeds 20 octets", + }, + { + name: "long Number (20 bytes, MSB set)", + key: ec256Priv, + issuer: &Certificate{ + KeyUsage: KeyUsageCRLSign, + Subject: pkix.Name{ + CommonName: "testing", + }, + SubjectKeyId: []byte{1, 2, 3}, + }, + template: &RevocationList{ + ThisUpdate: time.Time{}.Add(time.Hour * 24), + NextUpdate: time.Time{}.Add(time.Hour * 48), + Number: big.NewInt(0).SetBytes(append([]byte{255}, make([]byte, 19)...)), + }, + expectedError: "x509: CRL number exceeds 20 octets", + }, + { + name: "invalid signature algorithm", + key: ec256Priv, + issuer: &Certificate{ + KeyUsage: KeyUsageCRLSign, + Subject: pkix.Name{ + CommonName: "testing", + }, + SubjectKeyId: []byte{1, 2, 3}, + }, + template: &RevocationList{ + SignatureAlgorithm: SHA256WithRSA, + RevokedCertificates: []pkix.RevokedCertificate{ + { + SerialNumber: big.NewInt(2), + RevocationTime: time.Time{}.Add(time.Hour), + }, + }, + Number: big.NewInt(5), + ThisUpdate: time.Time{}.Add(time.Hour * 24), + NextUpdate: time.Time{}.Add(time.Hour * 48), + }, + expectedError: "x509: requested SignatureAlgorithm does not match private key type", + }, + { + name: "valid", + key: ec256Priv, + issuer: &Certificate{ + KeyUsage: KeyUsageCRLSign, + Subject: pkix.Name{ + CommonName: "testing", + }, + SubjectKeyId: []byte{1, 2, 3}, + }, + template: &RevocationList{ + RevokedCertificateEntries: []RevocationListEntry{ + { + SerialNumber: big.NewInt(2), + RevocationTime: time.Time{}.Add(time.Hour), + }, + }, + Number: big.NewInt(5), + ThisUpdate: time.Time{}.Add(time.Hour * 24), + NextUpdate: time.Time{}.Add(time.Hour * 48), + }, + }, + { + name: "valid, reason code", + key: ec256Priv, + issuer: &Certificate{ + KeyUsage: KeyUsageCRLSign, + Subject: pkix.Name{ + CommonName: "testing", + }, + SubjectKeyId: []byte{1, 2, 3}, + }, + template: &RevocationList{ + RevokedCertificateEntries: []RevocationListEntry{ + { + SerialNumber: big.NewInt(2), + RevocationTime: time.Time{}.Add(time.Hour), + ReasonCode: 1, + }, + }, + Number: big.NewInt(5), + ThisUpdate: time.Time{}.Add(time.Hour * 24), + NextUpdate: time.Time{}.Add(time.Hour * 48), + }, + }, + { + name: "valid, extra entry extension", + key: ec256Priv, + issuer: &Certificate{ + KeyUsage: KeyUsageCRLSign, + Subject: pkix.Name{ + CommonName: "testing", + }, + SubjectKeyId: []byte{1, 2, 3}, + }, + template: &RevocationList{ + RevokedCertificateEntries: []RevocationListEntry{ + { + SerialNumber: big.NewInt(2), + RevocationTime: time.Time{}.Add(time.Hour), + ExtraExtensions: []pkix.Extension{ + { + Id: []int{2, 5, 29, 99}, + Value: []byte{5, 0}, + }, + }, + }, + }, + Number: big.NewInt(5), + ThisUpdate: time.Time{}.Add(time.Hour * 24), + NextUpdate: time.Time{}.Add(time.Hour * 48), + }, + }, + { + name: "valid, Ed25519 key", + key: ed25519Priv, + issuer: &Certificate{ + KeyUsage: KeyUsageCRLSign, + Subject: pkix.Name{ + CommonName: "testing", + }, + SubjectKeyId: []byte{1, 2, 3}, + }, + template: &RevocationList{ + RevokedCertificateEntries: []RevocationListEntry{ + { + SerialNumber: big.NewInt(2), + RevocationTime: time.Time{}.Add(time.Hour), + }, + }, + Number: big.NewInt(5), + ThisUpdate: time.Time{}.Add(time.Hour * 24), + NextUpdate: time.Time{}.Add(time.Hour * 48), + }, + }, + { + name: "valid, non-default signature algorithm", + key: ec256Priv, + issuer: &Certificate{ + KeyUsage: KeyUsageCRLSign, + Subject: pkix.Name{ + CommonName: "testing", + }, + SubjectKeyId: []byte{1, 2, 3}, + }, + template: &RevocationList{ + SignatureAlgorithm: ECDSAWithSHA512, + RevokedCertificateEntries: []RevocationListEntry{ + { + SerialNumber: big.NewInt(2), + RevocationTime: time.Time{}.Add(time.Hour), + }, + }, + Number: big.NewInt(5), + ThisUpdate: time.Time{}.Add(time.Hour * 24), + NextUpdate: time.Time{}.Add(time.Hour * 48), + }, + }, + { + name: "valid, extra extension", + key: ec256Priv, + issuer: &Certificate{ + KeyUsage: KeyUsageCRLSign, + Subject: pkix.Name{ + CommonName: "testing", + }, + SubjectKeyId: []byte{1, 2, 3}, + }, + template: &RevocationList{ + RevokedCertificateEntries: []RevocationListEntry{ + { + SerialNumber: big.NewInt(2), + RevocationTime: time.Time{}.Add(time.Hour), + }, + }, + Number: big.NewInt(5), + ThisUpdate: time.Time{}.Add(time.Hour * 24), + NextUpdate: time.Time{}.Add(time.Hour * 48), + ExtraExtensions: []pkix.Extension{ + { + Id: []int{2, 5, 29, 99}, + Value: []byte{5, 0}, + }, + }, + }, + }, + { + name: "valid, deprecated entries with extension", + key: ec256Priv, + issuer: &Certificate{ + KeyUsage: KeyUsageCRLSign, + Subject: pkix.Name{ + CommonName: "testing", + }, + SubjectKeyId: []byte{1, 2, 3}, + }, + template: &RevocationList{ + RevokedCertificates: []pkix.RevokedCertificate{ + { + SerialNumber: big.NewInt(2), + RevocationTime: time.Time{}.Add(time.Hour), + Extensions: []pkix.Extension{ + { + Id: []int{2, 5, 29, 99}, + Value: []byte{5, 0}, + }, + }, + }, + }, + Number: big.NewInt(5), + ThisUpdate: time.Time{}.Add(time.Hour * 24), + NextUpdate: time.Time{}.Add(time.Hour * 48), + }, + }, + { + name: "valid, empty list", + key: ec256Priv, + issuer: &Certificate{ + KeyUsage: KeyUsageCRLSign, + Subject: pkix.Name{ + CommonName: "testing", + }, + SubjectKeyId: []byte{1, 2, 3}, + }, + template: &RevocationList{ + Number: big.NewInt(5), + ThisUpdate: time.Time{}.Add(time.Hour * 24), + NextUpdate: time.Time{}.Add(time.Hour * 48), + }, + }, + { + name: "valid CA with utf8 Subject fields including Email, empty list", + key: utf8Key, + issuer: utf8CA, + template: &RevocationList{ + Number: big.NewInt(5), + ThisUpdate: time.Time{}.Add(time.Hour * 24), + NextUpdate: time.Time{}.Add(time.Hour * 48), + }, + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + crl, err := CreateRevocationList(rand.Reader, tc.template, tc.issuer, tc.key) + if err != nil && tc.expectedError == "" { + t.Fatalf("CreateRevocationList failed unexpectedly: %s", err) + } else if err != nil && tc.expectedError != err.Error() { + t.Fatalf("CreateRevocationList failed unexpectedly, wanted: %s, got: %s", tc.expectedError, err) + } else if err == nil && tc.expectedError != "" { + t.Fatalf("CreateRevocationList didn't fail, expected: %s", tc.expectedError) + } + if tc.expectedError != "" { + return + } + + parsedCRL, err := ParseRevocationList(crl) + if err != nil { + t.Fatalf("Failed to parse generated CRL: %s", err) + } + + if tc.template.SignatureAlgorithm != UnknownSignatureAlgorithm && + parsedCRL.SignatureAlgorithm != tc.template.SignatureAlgorithm { + t.Fatalf("SignatureAlgorithm mismatch: got %v; want %v.", parsedCRL.SignatureAlgorithm, + tc.template.SignatureAlgorithm) + } + + if len(tc.template.RevokedCertificates) > 0 { + if !reflect.DeepEqual(parsedCRL.RevokedCertificates, tc.template.RevokedCertificates) { + t.Fatalf("RevokedCertificates mismatch: got %v; want %v.", + parsedCRL.RevokedCertificates, tc.template.RevokedCertificates) + } + } else { + if len(parsedCRL.RevokedCertificateEntries) != len(tc.template.RevokedCertificateEntries) { + t.Fatalf("RevokedCertificateEntries length mismatch: got %d; want %d.", + len(parsedCRL.RevokedCertificateEntries), + len(tc.template.RevokedCertificateEntries)) + } + for i, rce := range parsedCRL.RevokedCertificateEntries { + expected := tc.template.RevokedCertificateEntries[i] + if rce.SerialNumber.Cmp(expected.SerialNumber) != 0 { + t.Fatalf("RevocationListEntry serial mismatch: got %d; want %d.", + rce.SerialNumber, expected.SerialNumber) + } + if !rce.RevocationTime.Equal(expected.RevocationTime) { + t.Fatalf("RevocationListEntry revocation time mismatch: got %v; want %v.", + rce.RevocationTime, expected.RevocationTime) + } + if rce.ReasonCode != expected.ReasonCode { + t.Fatalf("RevocationListEntry reason code mismatch: got %d; want %d.", + rce.ReasonCode, expected.ReasonCode) + } + } + } + + if len(parsedCRL.Extensions) != 2+len(tc.template.ExtraExtensions) { + t.Fatalf("Generated CRL has wrong number of extensions, wanted: %d, got: %d", 2+len(tc.template.ExtraExtensions), len(parsedCRL.Extensions)) + } + expectedAKI, err := asn1.Marshal(authKeyId{Id: tc.issuer.SubjectKeyId}) + if err != nil { + t.Fatalf("asn1.Marshal failed: %s", err) + } + akiExt := pkix.Extension{ + Id: oidExtensionAuthorityKeyId, + Value: expectedAKI, + } + if !reflect.DeepEqual(parsedCRL.Extensions[0], akiExt) { + t.Fatalf("Unexpected first extension: got %v, want %v", + parsedCRL.Extensions[0], akiExt) + } + expectedNum, err := asn1.Marshal(tc.template.Number) + if err != nil { + t.Fatalf("asn1.Marshal failed: %s", err) + } + crlExt := pkix.Extension{ + Id: oidExtensionCRLNumber, + Value: expectedNum, + } + if !reflect.DeepEqual(parsedCRL.Extensions[1], crlExt) { + t.Fatalf("Unexpected second extension: got %v, want %v", + parsedCRL.Extensions[1], crlExt) + } + + // With Go 1.19's updated RevocationList, we can now directly compare + // the RawSubject of the certificate to RawIssuer on the parsed CRL. + // However, this doesn't work with our hacked issuers above (that + // aren't parsed from a proper DER bundle but are instead manually + // constructed). Prefer RawSubject when it is set. + if len(tc.issuer.RawSubject) > 0 { + issuerSubj, err := subjectBytes(tc.issuer) + if err != nil { + t.Fatalf("failed to get issuer subject: %s", err) + } + if !bytes.Equal(issuerSubj, parsedCRL.RawIssuer) { + t.Fatalf("Unexpected issuer subject; wanted: %v, got: %v", hex.EncodeToString(issuerSubj), hex.EncodeToString(parsedCRL.RawIssuer)) + } + } else { + // When we hack our custom Subject in the test cases above, + // we don't set the additional fields (such as Names) in the + // hacked issuer. Round-trip a parsing of pkix.Name so that + // we add these missing fields for the comparison. + issuerRDN := tc.issuer.Subject.ToRDNSequence() + var caIssuer pkix.Name + caIssuer.FillFromRDNSequence(&issuerRDN) + if !reflect.DeepEqual(caIssuer, parsedCRL.Issuer) { + t.Fatalf("Expected issuer.Subject, parsedCRL.Issuer to be the same; wanted: %#v, got: %#v", caIssuer, parsedCRL.Issuer) + } + } + + if len(parsedCRL.Extensions[2:]) == 0 && len(tc.template.ExtraExtensions) == 0 { + // If we don't have anything to check return early so we don't + // hit a [] != nil false positive below. + return + } + if !reflect.DeepEqual(parsedCRL.Extensions[2:], tc.template.ExtraExtensions) { + t.Fatalf("Extensions mismatch: got %v; want %v.", + parsedCRL.Extensions[2:], tc.template.ExtraExtensions) + } + + if tc.template.Number != nil && parsedCRL.Number == nil { + t.Fatalf("Generated CRL missing Number: got nil, want %s", + tc.template.Number.String()) + } + if tc.template.Number != nil && tc.template.Number.Cmp(parsedCRL.Number) != 0 { + t.Fatalf("Generated CRL has wrong Number: got %s, want %s", + parsedCRL.Number.String(), tc.template.Number.String()) + } + if !bytes.Equal(parsedCRL.AuthorityKeyId, tc.issuer.SubjectKeyId) { + t.Fatalf("Generated CRL has wrong AuthorityKeyId: got %x, want %x", + parsedCRL.AuthorityKeyId, tc.issuer.SubjectKeyId) + } + }) + } +} + +func TestRSAPSAParameters(t *testing.T) { + generateParams := func(hashFunc crypto.Hash) []byte { + var hashOID asn1.ObjectIdentifier + + switch hashFunc { + case crypto.SHA256: + hashOID = oidSHA256 + case crypto.SHA384: + hashOID = oidSHA384 + case crypto.SHA512: + hashOID = oidSHA512 + } + + params := pssParameters{ + Hash: pkix.AlgorithmIdentifier{ + Algorithm: hashOID, + Parameters: asn1.NullRawValue, + }, + MGF: pkix.AlgorithmIdentifier{ + Algorithm: oidMGF1, + }, + SaltLength: hashFunc.Size(), + TrailerField: 1, + } + + mgf1Params := pkix.AlgorithmIdentifier{ + Algorithm: hashOID, + Parameters: asn1.NullRawValue, + } + + var err error + params.MGF.Parameters.FullBytes, err = asn1.Marshal(mgf1Params) + if err != nil { + t.Fatalf("failed to marshal MGF parameters: %s", err) + } + + serialized, err := asn1.Marshal(params) + if err != nil { + t.Fatalf("failed to marshal parameters: %s", err) + } + + return serialized + } + + for _, detail := range signatureAlgorithmDetails { + if !detail.isRSAPSS { + continue + } + generated := generateParams(detail.hash) + if !bytes.Equal(detail.params.FullBytes, generated) { + t.Errorf("hardcoded parameters for %s didn't match generated parameters: got (generated) %x, wanted (hardcoded) %x", detail.hash, generated, detail.params.FullBytes) + } + } +} + +func TestUnknownExtKey(t *testing.T) { + const errorContains = "unknown extended key usage" + + template := &Certificate{ + SerialNumber: big.NewInt(10), + DNSNames: []string{"foo"}, + ExtKeyUsage: []ExtKeyUsage{ExtKeyUsage(-1)}, + } + + _, err := CreateCertificate(rand.Reader, template, template, testPrivateKey.Public(), testPrivateKey) + if !strings.Contains(err.Error(), errorContains) { + t.Errorf("expected error containing %q, got %s", errorContains, err) + } +} + +func TestIA5SANEnforcement(t *testing.T) { + k, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatalf("ecdsa.GenerateKey failed: %s", err) + } + + testURL, err := url.Parse("https://example.com/") + if err != nil { + t.Fatalf("url.Parse failed: %s", err) + } + testURL.RawQuery = "∞" + + marshalTests := []struct { + name string + template *Certificate + expectedError string + }{ + { + name: "marshal: unicode dNSName", + template: &Certificate{ + SerialNumber: big.NewInt(0), + DNSNames: []string{"∞"}, + }, + expectedError: "x509: \"∞\" cannot be encoded as an IA5String", + }, + { + name: "marshal: unicode rfc822Name", + template: &Certificate{ + SerialNumber: big.NewInt(0), + EmailAddresses: []string{"∞"}, + }, + expectedError: "x509: \"∞\" cannot be encoded as an IA5String", + }, + { + name: "marshal: unicode uniformResourceIdentifier", + template: &Certificate{ + SerialNumber: big.NewInt(0), + URIs: []*url.URL{testURL}, + }, + expectedError: "x509: \"https://example.com/?∞\" cannot be encoded as an IA5String", + }, + } + + for _, tc := range marshalTests { + t.Run(tc.name, func(t *testing.T) { + _, err := CreateCertificate(rand.Reader, tc.template, tc.template, k.Public(), k) + if err == nil { + t.Errorf("expected CreateCertificate to fail with template: %v", tc.template) + } else if err.Error() != tc.expectedError { + t.Errorf("unexpected error: got %q, want %q", err.Error(), tc.expectedError) + } + }) + } + + unmarshalTests := []struct { + name string + cert string + expectedError string + }{ + { + name: "unmarshal: unicode dNSName", + cert: "308201083081aea003020102020100300a06082a8648ce3d04030230003022180f30303031303130313030303030305a180f30303031303130313030303030305a30003059301306072a8648ce3d020106082a8648ce3d0301070342000424bcc48180d8d9db794028f2575ebe3cac79f04d7b0d0151c5292e588aac3668c495f108c626168462e0668c9705e08a211dd103a659d2684e0adf8c2bfd47baa315301330110603551d110101ff040730058203e2889e300a06082a8648ce3d04030203490030460221008ac7827ac326a6ee0fa70b2afe99af575ec60b975f820f3c25f60fff43fbccd0022100bffeed93556722d43d13e461d5b3e33efc61f6349300327d3a0196cb6da501c2", + expectedError: "x509: SAN dNSName is malformed", + }, + { + name: "unmarshal: unicode rfc822Name", + cert: "308201083081aea003020102020100300a06082a8648ce3d04030230003022180f30303031303130313030303030305a180f30303031303130313030303030305a30003059301306072a8648ce3d020106082a8648ce3d0301070342000405cb4c4ba72aac980f7b11b0285191425e29e196ce7c5df1c83f56886566e517f196657cc1b73de89ab84ce503fd634e2f2af88fde24c63ca536dc3a5eed2665a315301330110603551d110101ff040730058103e2889e300a06082a8648ce3d0403020349003046022100ed1431cd4b9bb03d88d1511a0ec128a51204375764c716280dc36e2a60142c8902210088c96d25cfaf97eea851ff17d87bb6fe619d6546656e1739f35c3566051c3d0f", + expectedError: "x509: SAN rfc822Name is malformed", + }, + { + name: "unmarshal: unicode uniformResourceIdentifier", + cert: "3082011b3081c3a003020102020100300a06082a8648ce3d04030230003022180f30303031303130313030303030305a180f30303031303130313030303030305a30003059301306072a8648ce3d020106082a8648ce3d03010703420004ce0a79b511701d9188e1ea76bcc5907f1db51de6cc1a037b803f256e8588145ca409d120288bfeb4e38f3088104674d374b35bb91fc80d768d1d519dbe2b0b5aa32a302830260603551d110101ff041c301a861868747470733a2f2f6578616d706c652e636f6d2f3fe2889e300a06082a8648ce3d0403020347003044022044f4697779fd1dae1e382d2452413c5c5ca67851e267d6bc64a8d164977c172c0220505015e657637aa1945d46e7650b6f59b968fc1508ca8b152c99f782446dfc81", + expectedError: "x509: SAN uniformResourceIdentifier is malformed", + }, + } + + for _, tc := range unmarshalTests { + der, err := hex.DecodeString(tc.cert) + if err != nil { + t.Fatalf("failed to decode test cert: %s", err) + } + _, err = ParseCertificate(der) + if err == nil { + t.Error("expected CreateCertificate to fail") + } else if err.Error() != tc.expectedError { + t.Errorf("unexpected error: got %q, want %q", err.Error(), tc.expectedError) + } + } +} + +func BenchmarkCreateCertificate(b *testing.B) { + template := &Certificate{ + SerialNumber: big.NewInt(10), + DNSNames: []string{"example.com"}, + } + tests := []struct { + name string + gen func() crypto.Signer + }{ + { + name: "RSA 2048", + gen: func() crypto.Signer { + k, err := rsa.GenerateKey(rand.Reader, 2048) + if err != nil { + b.Fatalf("failed to generate test key: %s", err) + } + return k + }, + }, + { + name: "ECDSA P256", + gen: func() crypto.Signer { + k, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + b.Fatalf("failed to generate test key: %s", err) + } + return k + }, + }, + } + + for _, tc := range tests { + k := tc.gen() + b.ResetTimer() + b.Run(tc.name, func(b *testing.B) { + for i := 0; i < b.N; i++ { + _, err := CreateCertificate(rand.Reader, template, template, k.Public(), k) + if err != nil { + b.Fatalf("failed to create certificate: %s", err) + } + } + }) + } +} + +type brokenSigner struct { + pub crypto.PublicKey +} + +func (bs *brokenSigner) Public() crypto.PublicKey { + return bs.pub +} + +func (bs *brokenSigner) Sign(_ io.Reader, _ []byte, _ crypto.SignerOpts) ([]byte, error) { + return []byte{1, 2, 3}, nil +} + +func TestCreateCertificateBrokenSigner(t *testing.T) { + template := &Certificate{ + SerialNumber: big.NewInt(10), + DNSNames: []string{"example.com"}, + } + expectedErr := "signature returned by signer is invalid" + _, err := CreateCertificate(rand.Reader, template, template, testPrivateKey.Public(), &brokenSigner{testPrivateKey.Public()}) + if err == nil { + t.Fatal("expected CreateCertificate to fail with a broken signer") + } else if !strings.Contains(err.Error(), expectedErr) { + t.Fatalf("CreateCertificate returned an unexpected error: got %q, want %q", err, expectedErr) + } +} + +func TestCreateCertificateLegacy(t *testing.T) { + sigAlg := MD5WithRSA + template := &Certificate{ + SerialNumber: big.NewInt(10), + DNSNames: []string{"example.com"}, + SignatureAlgorithm: sigAlg, + } + _, err := CreateCertificate(rand.Reader, template, template, testPrivateKey.Public(), &brokenSigner{testPrivateKey.Public()}) + if err == nil { + t.Fatal("CreateCertificate didn't fail when SignatureAlgorithm = MD5WithRSA") + } +} + +func (s *CertPool) mustCert(t *testing.T, n int) *Certificate { + c, err := s.lazyCerts[n].getCert() + if err != nil { + t.Fatalf("failed to load cert %d: %v", n, err) + } + return c +} + +func allCerts(t *testing.T, p *CertPool) []*Certificate { + all := make([]*Certificate, p.len()) + for i := range all { + all[i] = p.mustCert(t, i) + } + return all +} + +// certPoolEqual reports whether a and b are equal, except for the +// function pointers. +func certPoolEqual(a, b *CertPool) bool { + if (a != nil) != (b != nil) { + return false + } + if a == nil { + return true + } + if !reflect.DeepEqual(a.byName, b.byName) || + len(a.lazyCerts) != len(b.lazyCerts) { + return false + } + for i := range a.lazyCerts { + la, lb := a.lazyCerts[i], b.lazyCerts[i] + if !bytes.Equal(la.rawSubject, lb.rawSubject) { + return false + } + ca, err := la.getCert() + if err != nil { + panic(err) + } + cb, err := la.getCert() + if err != nil { + panic(err) + } + if !ca.Equal(cb) { + return false + } + } + + return true +} + +func TestCertificateRequestRoundtripFields(t *testing.T) { + urlA, err := url.Parse("https://example.com/_") + if err != nil { + t.Fatal(err) + } + urlB, err := url.Parse("https://example.org/_") + if err != nil { + t.Fatal(err) + } + in := &CertificateRequest{ + DNSNames: []string{"example.com", "example.org"}, + EmailAddresses: []string{"a@example.com", "b@example.com"}, + IPAddresses: []net.IP{net.IPv4(192, 0, 2, 0), net.IPv6loopback}, + URIs: []*url.URL{urlA, urlB}, + } + out := marshalAndParseCSR(t, in) + + if !slices.Equal(in.DNSNames, out.DNSNames) { + t.Fatalf("Unexpected DNSNames: got %v, want %v", out.DNSNames, in.DNSNames) + } + if !slices.Equal(in.EmailAddresses, out.EmailAddresses) { + t.Fatalf("Unexpected EmailAddresses: got %v, want %v", out.EmailAddresses, in.EmailAddresses) + } + if len(in.IPAddresses) != len(out.IPAddresses) || + !in.IPAddresses[0].Equal(out.IPAddresses[0]) || + !in.IPAddresses[1].Equal(out.IPAddresses[1]) { + t.Fatalf("Unexpected IPAddresses: got %v, want %v", out.IPAddresses, in.IPAddresses) + } + if !reflect.DeepEqual(in.URIs, out.URIs) { + t.Fatalf("Unexpected URIs: got %v, want %v", out.URIs, in.URIs) + } +} + +func BenchmarkParseCertificate(b *testing.B) { + cases := []struct { + name string + pem string + }{ + { + name: "ecdsa leaf", + pem: `-----BEGIN CERTIFICATE----- +MIIINjCCBx6gAwIBAgIQHdQ6oBMoe/MJAAAAAEHzmTANBgkqhkiG9w0BAQsFADBG +MQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExM +QzETMBEGA1UEAxMKR1RTIENBIDFDMzAeFw0yMDEyMDgwOTExMzZaFw0yMTAzMDIw +OTExMzVaMBcxFTATBgNVBAMM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W9uLmNvbYIPeW91dHViZWtpZHMuY29tggV5dC5i +ZTAhBgNVHSAEGjAYMAgGBmeBDAECAjAMBgorBgEEAdZ5AgUDMDMGA1UdHwQsMCow +KKAmoCSGImh0dHA6Ly9jcmwucGtpLmdvb2cvR1RTMU8xY29yZS5jcmwwEwYKKwYB +BAHWeQIEAwEB/wQCBQAwDQYJKoZIhvcNAQELBQADggEBAHh9/ozYUGRd+W5akWlM +4WvX808TK2oUISnagbxCCFZ2trpg2oi03CJf4o4o3Je5Qzzz10s22oQY6gPHAR0B +QHzrpqAveQw9D5vd8xjgtQ/SAujPzPKNQee5511rS7/EKW9I83ccd5XhhoEyx8A1 +/65RTS+2hKpJKTMkr0yHBPJV7kUW+n/KIef5YaSOA9VYK7hyH0niDpvm9EmoqvWS +U5xAFAe/Xrrq3sxTuDJPQA8alk6h/ql5Klkw6dL53csiPka/MevDqdifWkzuT/6n +YK/ePeJzPD17FA9V+N1rcuF3Wk29AZvCOSasdIkIuE82vGr3dfNrsrn9E9lWIbCr +Qc4= +-----END CERTIFICATE-----`, + }, + } + for _, c := range cases { + b.Run(c.name, func(b *testing.B) { + pemBlock, _ := pem.Decode([]byte(c.pem)) + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + _, err := ParseCertificate(pemBlock.Bytes) + if err != nil { + b.Fatal(err) + } + } + }) + } +} + +func TestParseCertificateRawEquals(t *testing.T) { + p, _ := pem.Decode([]byte(pemCertificate)) + cert, err := ParseCertificate(p.Bytes) + if err != nil { + t.Fatalf("failed to parse certificate: %s", err) + } + if !bytes.Equal(p.Bytes, cert.Raw) { + t.Fatalf("unexpected Certificate.Raw\ngot: %x\nwant: %x\n", cert.Raw, p.Bytes) + } +} + +// mismatchingSigAlgIDPEM contains a certificate where the Certificate +// signatureAlgorithm and the TBSCertificate signature contain +// mismatching OIDs +const mismatchingSigAlgIDPEM = `-----BEGIN CERTIFICATE----- +MIIBBzCBrqADAgECAgEAMAoGCCqGSM49BAMCMAAwIhgPMDAwMTAxMDEwMDAwMDBa +GA8wMDAxMDEwMTAwMDAwMFowADBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABOqV +EDuVXxwZgIU3+dOwv1SsMu0xuV48hf7xmK8n7sAMYgllB+96DnPqBeboJj4snYnx +0AcE0PDVQ1l4Z3YXsQWjFTATMBEGA1UdEQEB/wQHMAWCA2FzZDAKBggqhkjOPQQD +AwNIADBFAiBi1jz/T2HT5nAfrD7zsgR+68qh7Erc6Q4qlxYBOgKG4QIhAOtjIn+Q +tA+bq+55P3ntxTOVRq0nv1mwnkjwt9cQR9Fn +-----END CERTIFICATE-----` + +// mismatchingSigAlgParamPEM contains a certificate where the Certificate +// signatureAlgorithm and the TBSCertificate signature contain +// mismatching parameters +const mismatchingSigAlgParamPEM = `-----BEGIN CERTIFICATE----- +MIIBCTCBrqADAgECAgEAMAoGCCqGSM49BAMCMAAwIhgPMDAwMTAxMDEwMDAwMDBa +GA8wMDAxMDEwMTAwMDAwMFowADBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABOqV +EDuVXxwZgIU3+dOwv1SsMu0xuV48hf7xmK8n7sAMYgllB+96DnPqBeboJj4snYnx +0AcE0PDVQ1l4Z3YXsQWjFTATMBEGA1UdEQEB/wQHMAWCA2FzZDAMBggqhkjOPQQD +AgUAA0gAMEUCIGLWPP9PYdPmcB+sPvOyBH7ryqHsStzpDiqXFgE6AobhAiEA62Mi +f5C0D5ur7nk/ee3FM5VGrSe/WbCeSPC31xBH0Wc= +-----END CERTIFICATE-----` + +func TestSigAlgMismatch(t *testing.T) { + for _, certPEM := range []string{mismatchingSigAlgIDPEM, mismatchingSigAlgParamPEM} { + b, _ := pem.Decode([]byte(certPEM)) + if b == nil { + t.Fatalf("couldn't decode test certificate") + } + _, err := ParseCertificate(b.Bytes) + if err == nil { + t.Fatalf("expected ParseCertificate to fail") + } + expected := "x509: inner and outer signature algorithm identifiers don't match" + if err.Error() != expected { + t.Errorf("unexpected error from ParseCertificate: got %q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WYWxpZGF0aW9uIE5ldHdvcmsxFzAVBgNVBAoTDlZhbGlD +ZXJ0LCBJbmMuMTUwMwYDVQQLEyxWYWxpQ2VydCBDbGFzcyAyIFBvbGljeSBWYWxp +ZGF0aW9uIEF1dGhvcml0eTEhMB8GA1UEAxMYaHR0cDovL3d3dy52YWxpY2VydC5j +b20vMSAwHgYJKoZIhvcNAQkBFhFpbmZvQHZhbGljZXJ0LmNvbYIBATAPBgNVHRMB +Af8EBTADAQH/MDkGCCsGAQUFBwEBBC0wKzApBggrBgEFBQcwAYYdaHR0cDovL29j +c3Auc3RhcmZpZWxkdGVjaC5jb20wSgYDVR0fBEMwQTA/oD2gO4Y5aHR0cDovL2Nl +cnRpZmljYXRlcy5zdGFyZmllbGR0ZWNoLmNvbS9yZXBvc2l0b3J5L3Jvb3QuY3Js +MFEGA1UdIARKMEgwRgYEVR0gADA+MDwGCCsGAQUFBwIBFjBodHRwOi8vY2VydGlm +aWNhdGVzLnN0YXJmaWVsZHRlY2guY29tL3JlcG9zaXRvcnkwDgYDVR0PAQH/BAQD +AgEGMA0GCSqGSIb3DQEBBQUAA4GBAKVi8afCXSWlcD284ipxs33kDTcdVWptobCr +mADkhWBKIMuh8D1195TaQ39oXCUIuNJ9MxB73HZn8bjhU3zhxoNbKXuNSm8uf0So +GkVrMgfHeMpkksK0hAzc3S1fTbvdiuo43NlmouxBulVtWmQ9twPMHOKRUJ7jCUSV +FxdzPcwl +-----END CERTIFICATE-----` + +func TestAuthKeyIdOptional(t *testing.T) { + b, _ := pem.Decode([]byte(optionalAuthKeyIDPEM)) + if b == nil { + t.Fatalf("couldn't decode test certificate") + } + _, err := ParseCertificate(b.Bytes) + if err != nil { + t.Fatalf("ParseCertificate to failed to parse certificate with optional authority key identifier fields: %s", err) + } +} + +const largeOIDPEM = ` +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + da:ba:53:19:1b:09:4b:82:b2:89:26:7d:c7:6f:a0:02 + Signature Algorithm: sha256WithRSAEncryption + Issuer: O = Acme Co + Validity + Not Before: Dec 21 16:59:27 2021 GMT + Not After : Dec 21 16:59:27 2022 GMT + Subject: O = Acme Co + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public-Key: (2048 bit) + Modulus: + 00:bf:17:16:d8:bc:29:9c:16:e5:76:b4:93:15:78: + ad:6e:45:c5:4a:63:46:a1:b2:76:71:65:51:9c:14: + c4:ea:74:13:e4:34:df:2f:2c:65:11:e8:56:52:69: + 11:f9:0e:fc:77:bb:63:a8:7c:1a:c6:a1:7b:6e:6c: + e7:18:25:25:c9:e8:fb:06:7f:a2:a9:98:fe:2a:bc: + 8a:b3:75:b6:b8:7d:b6:c9:6b:29:08:32:22:10:cb: + 8d:d6:60:c8:83:ad:f5:58:91:d6:11:e8:55:56:fb: + 8f:a3:a2:9f:48:cb:79:e4:65:4a:8c:a6:52:64:9f: + 99:38:35:d4:d5:ac:6f:cf:a0:cb:42:8c:07:eb:21: + 17:31:3a:eb:91:7b:62:43:a4:75:5f:ef:a7:2f:94: + f8:69:0b:d4:ec:09:e6:00:c0:8c:dd:07:63:0b:e4: + 77:aa:60:18:3c:a0:e0:ae:0a:ea:0e:52:3b:b4:fa: + 6a:30:1b:50:62:21:73:53:33:01:60:a1:6b:99:58: + 00:f3:77:c6:0f:46:19:ca:c2:5d:cd:f5:e2:52:4d: + 84:94:23:d3:32:2f:ae:5f:da:43:a1:19:95:d2:17: + dd:49:14:b4:d9:48:1c:08:13:93:8e:d5:09:43:21: + b6:ce:52:e8:87:bb:d2:60:0d:c6:4e:bf:c5:93:6a: + c6:bf + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: critical + Digital Signature, Key Encipherment + X509v3 Extended Key Usage: + TLS Web Server Authentication + X509v3 Basic Constraints: critical + CA:FALSE + X509v3 Subject Alternative Name: + DNS:longOID.example + X509v3 Certificate Policies: + Policy: 1.3.6.1.4.1.311.21.8.1492336001 + + Signature Algorithm: sha256WithRSAEncryption + 72:77:8b:de:48:fb:6d:9a:94:b1:be:d4:90:7d:4c:e6:d3:79: + fa:fb:fc:3e:d5:3d:e9:a0:ce:28:2b:2f:94:77:3f:87:f8:9c: + 9f:91:1c:f3:f6:58:91:15:6b:24:b9:ca:ae:9f:ee:ca:c8:31: + db:1a:3d:bb:6b:83:6d:bc:81:8b:a1:79:d5:3e:bb:dd:93:fe: + 35:3e:b7:99:e0:d6:eb:58:0c:fd:42:73:dc:49:da:e2:b7:ae: + 15:ee:e6:cc:aa:ef:91:41:9a:18:46:8d:4a:39:65:a2:85:3c: + 7f:0c:41:f8:0b:9c:e8:1f:35:36:60:8d:8c:e0:8e:18:b1:06: + 57:d0:4e:c4:c3:cd:8f:6f:e7:76:02:52:da:03:43:61:2b:b3: + bf:19:fd:73:0d:6a:0b:b4:b6:cb:a9:6f:70:4e:53:2a:54:07: + b3:74:fd:85:49:57:5b:23:8d:8c:6b:53:2b:09:e8:41:a5:80: + 3f:69:1b:11:d1:6b:13:35:2e:f9:d6:50:15:d9:91:38:42:43: + e9:17:af:67:d9:96:a4:d1:6a:4f:cc:b4:a7:8e:48:1f:00:72: + 69:de:4d:f1:73:a4:47:12:67:e9:f9:07:3e:79:75:90:42:b8: + d4:b5:fd:d1:7e:35:04:f7:00:04:cf:f1:36:be:0f:27:81:1f: + a6:ba:88:6c +-----BEGIN CERTIFICATE----- +MIIDHTCCAgWgAwIBAgIRANq6UxkbCUuCsokmfcdvoAIwDQYJKoZIhvcNAQELBQAw +EjEQMA4GA1UEChMHQWNtZSBDbzAeFw0yMTEyMjExNjU5MjdaFw0yMjEyMjExNjU5 +MjdaMBIxEDAOBgNVBAoTB0FjbWUgQ28wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw +ggEKAoIBAQC/FxbYvCmcFuV2tJMVeK1uRcVKY0ahsnZxZVGcFMTqdBPkNN8vLGUR +6FZSaRH5Dvx3u2OofBrGoXtubOcYJSXJ6PsGf6KpmP4qvIqzdba4fbbJaykIMiIQ +y43WYMiDrfVYkdYR6FVW+4+jop9Iy3nkZUqMplJkn5k4NdTVrG/PoMtCjAfrIRcx +OuuRe2JDpHVf76cvlPhpC9TsCeYAwIzdB2ML5HeqYBg8oOCuCuoOUju0+mowG1Bi +IXNTMwFgoWuZWADzd8YPRhnKwl3N9eJSTYSUI9MyL65f2kOhGZXSF91JFLTZSBwI +E5OO1QlDIbbOUuiHu9JgDcZOv8WTasa/AgMBAAGjbjBsMA4GA1UdDwEB/wQEAwIF +oDATBgNVHSUEDDAKBggrBgEFBQcDATAMBgNVHRMBAf8EAjAAMBoGA1UdEQQTMBGC +D2xvbmdPSUQuZXhhbXBsZTAbBgNVHSAEFDASMBAGDisGAQQBgjcVCIXHzPsBMA0G +CSqGSIb3DQEBCwUAA4IBAQByd4veSPttmpSxvtSQfUzm03n6+/w+1T3poM4oKy+U +dz+H+JyfkRzz9liRFWskucqun+7KyDHbGj27a4NtvIGLoXnVPrvdk/41PreZ4Nbr +WAz9QnPcSdrit64V7ubMqu+RQZoYRo1KOWWihTx/DEH4C5zoHzU2YI2M4I4YsQZX +0E7Ew82Pb+d2AlLaA0NhK7O/Gf1zDWoLtLbLqW9wTlMqVAezdP2FSVdbI42Ma1Mr +CehBpYA/aRsR0WsTNS751lAV2ZE4QkPpF69n2Zak0WpPzLSnjkgfAHJp3k3xc6RH +Emfp+Qc+eXWQQrjUtf3RfjUE9wAEz/E2vg8ngR+muohs +-----END CERTIFICATE-----` + +func TestLargeOID(t *testing.T) { + // See Issue 49678. + b, _ := pem.Decode([]byte(largeOIDPEM)) + if b == nil { + t.Fatalf("couldn't decode test certificate") + } + _, err := ParseCertificate(b.Bytes) + if err != nil { + t.Fatalf("ParseCertificate to failed to parse certificate with large OID: %s", err) + } +} + +const uniqueIDPEM = `-----BEGIN CERTIFICATE----- +MIIFsDCCBJigAwIBAgIILOyC1ydafZMwDQYJKoZIhvcNAQEFBQAwgY4xgYswgYgG +A1UEAx6BgABNAGkAYwByAG8AcwBvAGYAdAAgAEYAbwByAGUAZgBy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GAQQBgjcUAgQUHhIAVwBlAGIAUwBlAHIAdgBl +AHIwHQYDVR0OBBYEFMAC3UR4FwAdGekbhMgnd6lMejtbMAsGA1UdDwQEAwIFoDAT +BgNVHSUEDDAKBggrBgEFBQcDATAJBgNVHRMEAjAAMIG/BgNVHQEEgbcwgbSAFGfF +6xihk+gJJ5TfwvtWe1UFnHLQoYGRMIGOMYGLMIGIBgNVBAMegYAATQBpAGMAcgBv +AHMAbwBmAHQAIABGAG8AcgBlAGYAcgBvAG4AdAAgAFQATQBHACAASABUAFQAUABT +ACAASQBuAHMAcABlAGMAdABpAG8AbgAgAEMAZQByAHQAaQBmAGkAYwBhAHQAaQBv +AG4AIABBAHUAdABoAG8AcgBpAHQAeYIIcKhXEmBXr0IwDQYJKoZIhvcNAQEFBQAD +ggEBABlSxyCMr3+ANr+WmPSjyN5YCJBgnS0IFCwJAzIYP87bcTye/U8eQ2+E6PqG +Q7Huj7nfHEw9qnGo+HNyPp1ad3KORzXDb54c6xEoi+DeuPzYHPbn4c3hlH49I0aQ +eWW2w4RslSWpLvO6Y7Lboyz2/Thk/s2kd4RHxkkWpH2ltPqJuYYg3X6oM5+gIFHJ +WGnh+ojZ5clKvS5yXh3Wkj78M6sb32KfcBk0Hx6NkCYPt60ODYmWtvqwtw6r73u5 +TnTYWRNvo2svX69TriL+CkHY9O1Hkwf2It5zHl3gNiKTJVaak8AuEz/CKWZneovt +yYLwhUhg3PX5Co1VKYE+9TxloiE= +-----END CERTIFICATE-----` + +func TestParseUniqueID(t *testing.T) { + b, _ := pem.Decode([]byte(uniqueIDPEM)) + if b == nil { + t.Fatalf("couldn't decode test certificate") + } + cert, err := ParseCertificate(b.Bytes) + if err != nil { + t.Fatalf("ParseCertificate to failed to parse certificate with unique identifier id: %s", err) + } + if len(cert.Extensions) != 7 { + t.Fatalf("unexpected number of extensions (probably because the extension section was not parsed): got %d, want 7", len(cert.Extensions)) + } +} + +func TestDisableSHA1ForCertOnly(t *testing.T) { + t.Setenv("GODEBUG", "") + + tmpl := &Certificate{ + SerialNumber: big.NewInt(1), + NotBefore: time.Now().Add(-time.Hour), + NotAfter: time.Now().Add(time.Hour), + SignatureAlgorithm: SHA1WithRSA, + BasicConstraintsValid: true, + IsCA: true, + KeyUsage: KeyUsageCertSign | KeyUsageCRLSign, + } + certDER, err := CreateCertificate(rand.Reader, tmpl, tmpl, rsaPrivateKey.Public(), rsaPrivateKey) + if err != nil { + t.Fatalf("failed to generate test cert: %s", err) + } + cert, err := ParseCertificate(certDER) + if err != nil { + t.Fatalf("failed to parse test cert: %s", err) + } + + err = cert.CheckSignatureFrom(cert) + if err == nil { + t.Error("expected CheckSignatureFrom to fail") + } else if _, ok := err.(InsecureAlgorithmError); !ok { + t.Errorf("expected InsecureAlgorithmError error, got %T", err) + } + + crlDER, err := CreateRevocationList(rand.Reader, &RevocationList{ + SignatureAlgorithm: SHA1WithRSA, + Number: big.NewInt(1), + ThisUpdate: time.Now().Add(-time.Hour), + NextUpdate: time.Now().Add(time.Hour), + }, cert, rsaPrivateKey) + if err != nil { + t.Fatalf("failed to generate test CRL: %s", err) + } + crl, err := ParseRevocationList(crlDER) + if err != nil { + t.Fatalf("failed to parse test CRL: %s", err) + } + + if err = crl.CheckSignatureFrom(cert); err != nil { + t.Errorf("unexpected error: %s", err) + } + + // This is an unrelated OCSP response, which will fail signature verification + // but shouldn't return an InsecureAlgorithmError, since SHA1 should be allowed + // for OCSP. + ocspTBSHex := "30819fa2160414884451ff502a695e2d88f421bad90cf2cecbea7c180f32303133303631383037323434335a30743072304a300906052b0e03021a0500041448b60d38238df8456e4ee5843ea394111802979f0414884451ff502a695e2d88f421bad90cf2cecbea7c021100f78b13b946fc9635d8ab49de9d2148218000180f32303133303631383037323434335aa011180f32303133303632323037323434335a" + ocspTBS, err := hex.DecodeString(ocspTBSHex) + if err != nil { + t.Fatalf("failed to decode OCSP response TBS hex: %s", err) + } + + err = cert.CheckSignature(SHA1WithRSA, ocspTBS, nil) + if err != rsa.ErrVerification { + t.Errorf("unexpected error: %s", err) + } +} + +func TestParseRevocationList(t *testing.T) { + derBytes := fromBase64(derCRLBase64) + certList, err := ParseRevocationList(derBytes) + if err != nil { + t.Errorf("error parsing: %s", err) + return + } + numCerts := len(certList.RevokedCertificateEntries) + numCertsDeprecated := len(certList.RevokedCertificateEntries) + expected := 88 + if numCerts != expected || numCertsDeprecated != expected { + t.Errorf("bad number of revoked certificates. got: %d want: %d", numCerts, expected) + } +} + +func TestRevocationListCheckSignatureFrom(t *testing.T) { + goodKey, err := ecdsa.GenerateKey(elliptic.P224(), rand.Reader) + if err != nil { + t.Fatalf("failed to generate test key: %s", err) + } + badKey, err := ecdsa.GenerateKey(elliptic.P224(), rand.Reader) + if err != nil { + t.Fatalf("failed to generate test key: %s", err) + } + tests := []struct { + name string + issuer *Certificate + err string + }{ + { + name: "valid", + issuer: &Certificate{ + Version: 3, + BasicConstraintsValid: true, + IsCA: true, + PublicKeyAlgorithm: ECDSA, + PublicKey: goodKey.Public(), + }, + }, + { + name: "valid, key usage set", + issuer: &Certificate{ + Version: 3, + BasicConstraintsValid: true, + IsCA: true, + PublicKeyAlgorithm: ECDSA, + PublicKey: goodKey.Public(), + KeyUsage: KeyUsageCRLSign, + }, + }, + { + name: "invalid issuer, wrong key usage", + issuer: &Certificate{ + Version: 3, + BasicConstraintsValid: true, + IsCA: true, + PublicKeyAlgorithm: ECDSA, + PublicKey: goodKey.Public(), + KeyUsage: KeyUsageCertSign, + }, + err: "x509: invalid signature: parent certificate cannot sign this kind of certificate", + }, + { + name: "invalid issuer, no basic constraints/ca", + issuer: &Certificate{ + Version: 3, + PublicKeyAlgorithm: ECDSA, + PublicKey: goodKey.Public(), + }, + err: "x509: invalid signature: parent certificate cannot sign this kind of certificate", + }, + { + name: "invalid issuer, unsupported public key type", + issuer: &Certificate{ + Version: 3, + BasicConstraintsValid: true, + IsCA: true, + PublicKeyAlgorithm: UnknownPublicKeyAlgorithm, + PublicKey: goodKey.Public(), + }, + err: "x509: cannot verify signature: algorithm unimplemented", + }, + { + name: "wrong key", + issuer: &Certificate{ + Version: 3, + BasicConstraintsValid: true, + IsCA: true, + PublicKeyAlgorithm: ECDSA, + PublicKey: badKey.Public(), + }, + err: "x509: ECDSA verification failure", + }, + } + + crlIssuer := &Certificate{ + BasicConstraintsValid: true, + IsCA: true, + PublicKeyAlgorithm: ECDSA, + PublicKey: goodKey.Public(), + KeyUsage: KeyUsageCRLSign, + SubjectKeyId: []byte{1, 2, 3}, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + crlDER, err := CreateRevocationList(rand.Reader, &RevocationList{Number: big.NewInt(1)}, crlIssuer, goodKey) + if err != nil { + t.Fatalf("failed to generate CRL: %s", err) + } + crl, err := ParseRevocationList(crlDER) + if err != nil { + t.Fatalf("failed to parse test CRL: %s", err) + } + err = crl.CheckSignatureFrom(tc.issuer) + if err != nil && err.Error() != tc.err { + t.Errorf("unexpected error: got %s, want %s", err, tc.err) + } else if err == nil && tc.err != "" { + t.Errorf("CheckSignatureFrom did not fail: want %s", tc.err) + } + }) + } +} + +func TestOmitEmptyExtensions(t *testing.T) { + k, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatal(err) + } + tmpl := &Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{ + CommonName: ":)", + }, + NotAfter: time.Now().Add(time.Hour), + NotBefore: time.Now().Add(-time.Hour), + } + der, err := CreateCertificate(rand.Reader, tmpl, tmpl, k.Public(), k) + if err != nil { + t.Fatal(err) + } + + emptyExtSeq := []byte{0xA3, 0x02, 0x30, 0x00} + if bytes.Contains(der, emptyExtSeq) { + t.Error("DER encoding contains the an empty extensions SEQUENCE") + } +} + +var negativeSerialCert = `-----BEGIN CERTIFICATE----- +MIIBBTCBraADAgECAgH/MAoGCCqGSM49BAMCMA0xCzAJBgNVBAMTAjopMB4XDTIy +MDQxNDIzNTYwNFoXDTIyMDQxNTAxNTYwNFowDTELMAkGA1UEAxMCOikwWTATBgcq +hkjOPQIBBggqhkjOPQMBBwNCAAQ9ezsIsj+q17K87z/PXE/rfGRN72P/Wyn5d6oo +5M0ZbSatuntMvfKdX79CQxXAxN4oXk3Aov4jVSG12AcDI8ShMAoGCCqGSM49BAMC +A0cAMEQCIBzfBU5eMPT6m5lsR6cXaJILpAaiD9YxOl4v6dT3rzEjAiBHmjnHmAss +RqUAyJKFzqZxOlK2q4j2IYnuj5+LrLGbQA== +-----END CERTIFICATE-----` + +func TestParseNegativeSerial(t *testing.T) { + pemBlock, _ := pem.Decode([]byte(negativeSerialCert)) + _, err := ParseCertificate(pemBlock.Bytes) + if err == nil { + t.Fatal("parsed certificate with negative serial") + } +} + +func TestCreateNegativeSerial(t *testing.T) { + k, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatal(err) + } + tmpl := &Certificate{ + SerialNumber: big.NewInt(-1), + Subject: pkix.Name{ + CommonName: ":)", + }, + NotAfter: time.Now().Add(time.Hour), + NotBefore: time.Now().Add(-time.Hour), + } + expectedErr := "x509: serial number must be positive" + _, err = CreateCertificate(rand.Reader, tmpl, tmpl, k.Public(), k) + if err == nil || err.Error() != expectedErr { + t.Errorf("CreateCertificate returned unexpected error: want %q, got %q", expectedErr, err) + } +} + +const dupExtCert = `-----BEGIN CERTIFICATE----- +MIIBrjCCARegAwIBAgIBATANBgkqhkiG9w0BAQsFADAPMQ0wCwYDVQQDEwR0ZXN0 +MCIYDzAwMDEwMTAxMDAwMDAwWhgPMDAwMTAxMDEwMDAwMDBaMA8xDTALBgNVBAMT +BHRlc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMiFchnHms9l9NninAIz +SkY9acwl9Bk2AtmJrNCenFpiA17AcOO5q8DJYwdXi6WPKlVgcyH+ysW8XMWkq+CP +yhtF/+LMzl9odaUF2iUy3vgTC5gxGLWH5URVssx21Und2Pm2f4xyou5IVxbS9dxy +jLvV9PEY9BIb0H+zFthjhihDAgMBAAGjFjAUMAgGAioDBAIFADAIBgIqAwQCBQAw +DQYJKoZIhvcNAQELBQADgYEAlhQ4TQQKIQ8GUyzGiN/75TCtQtjhMGemxc0cNgre +d9rmm4DjydH0t7/sMCB56lQrfhJNplguzsbjFW4l245KbNKHfLiqwEGUgZjBNKur +ot6qX/skahLtt0CNOaFIge75HVKe/69OrWQGdp18dkay/KS4Glu8YMKIjOhfrUi1 +NZA= +-----END CERTIFICATE-----` + +func TestDuplicateExtensionsCert(t *testing.T) { + b, _ := pem.Decode([]byte(dupExtCert)) + if b == nil { + t.Fatalf("couldn't decode test certificate") + } + _, err := ParseCertificate(b.Bytes) + if err == nil { + t.Fatal("ParseCertificate should fail when parsing certificate with duplicate extensions") + } +} + +const dupExtCSR = `-----BEGIN CERTIFICATE REQUEST----- +MIIBczCB3QIBADAPMQ0wCwYDVQQDEwR0ZXN0MIGfMA0GCSqGSIb3DQEBAQUAA4GN +ADCBiQKBgQC5PbxMGVJ8aLF9lq/EvGObXTRMB7ieiZL9N+DJZg1n/ECCnZLIvYrr +ZmmDV7YZsClgxKGfjJB0RQFFyZElFM9EfHEs8NJdidDKCRdIhDXQWRyhXKevHvdm +CQNKzUeoxvdHpU/uscSkw6BgUzPyLyTx9A6ye2ix94z8Y9hGOBO2DQIDAQABoCUw +IwYJKoZIhvcNAQkOMRYwFDAIBgIqAwQCBQAwCAYCKgMEAgUAMA0GCSqGSIb3DQEB +CwUAA4GBAHROEsE7URk1knXmBnQtIHwoq663vlMcX3Hes58pUy020rWP8QkocA+X +VF18/phg3p5ILlS4fcbbP2bEeV0pePo2k00FDPsJEKCBAX2LKxbU7Vp2OuV2HM2+ +VLOVx0i+/Q7fikp3hbN1JwuMTU0v2KL/IKoUcZc02+5xiYrnOIt5 +-----END CERTIFICATE REQUEST-----` + +func TestDuplicateExtensionsCSR(t *testing.T) { + b, _ := pem.Decode([]byte(dupExtCSR)) + if b == nil { + t.Fatalf("couldn't decode test CSR") + } + _, err := ParseCertificateRequest(b.Bytes) + if err == nil { + t.Fatal("ParseCertificateRequest should fail when parsing CSR with duplicate extensions") + } +} + +const dupAttCSR = `-----BEGIN CERTIFICATE REQUEST----- +MIIBbDCB1gIBADAPMQ0wCwYDVQQDEwR0ZXN0MIGfMA0GCSqGSIb3DQEBAQUAA4GN +ADCBiQKBgQCj5Po3PKO/JNuxr+B+WNfMIzqqYztdlv+mTQhT0jOR5rTkUvxeeHH8 +YclryES2dOISjaUOTmOAr5GQIIdQl4Ql33Cp7ZR/VWcRn+qvTak0Yow+xVsDo0n4 +7IcvvP6CJ7FRoYBUakVczeXLxCjLwdyK16VGJM06eRzDLykPxpPwLQIDAQABoB4w +DQYCKgMxBwwFdGVzdDEwDQYCKgMxBwwFdGVzdDIwDQYJKoZIhvcNAQELBQADgYEA +UJ8hsHxtnIeqb2ufHnQFJO+wEJhx2Uxm/BTuzHOeffuQkwATez4skZ7SlX9exgb7 +6jRMRilqb4F7f8w+uDoqxRrA9zc8mwY16zPsyBhRet+ZGbj/ilgvGmtZ21qZZ/FU +0pJFJIVLM3l49Onr5uIt5+hCWKwHlgE0nGpjKLR3cMg= +-----END CERTIFICATE REQUEST-----` + +func TestDuplicateAttributesCSR(t *testing.T) { + b, _ := pem.Decode([]byte(dupAttCSR)) + if b == nil { + t.Fatalf("couldn't decode test CSR") + } + _, err := ParseCertificateRequest(b.Bytes) + if err != nil { + t.Fatal("ParseCertificateRequest should succeed when parsing CSR with duplicate attributes") + } +} + +func TestCertificateOIDPoliciesGODEBUG(t *testing.T) { + t.Setenv("GODEBUG", "x509usepolicies=0") + + template := Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{CommonName: "Cert"}, + NotBefore: time.Unix(1000, 0), + NotAfter: time.Unix(100000, 0), + PolicyIdentifiers: []asn1.ObjectIdentifier{[]int{1, 2, 3}}, + } + + var expectPolicyIdentifiers = []asn1.ObjectIdentifier{ + []int{1, 2, 3}, + } + + var expectPolicies = []OID{ + mustNewOIDFromInts([]uint64{1, 2, 3}), + } + + certDER, err := CreateCertificate(rand.Reader, &template, &template, rsaPrivateKey.Public(), rsaPrivateKey) + if err != nil { + t.Fatalf("CreateCertificate() unexpected error: %v", err) + } + + cert, err := ParseCertificate(certDER) + if err != nil { + t.Fatalf("ParseCertificate() unexpected error: %v", err) + } + + if !slices.EqualFunc(cert.PolicyIdentifiers, expectPolicyIdentifiers, slices.Equal) { + t.Errorf("cert.PolicyIdentifiers = %v, want: %v", cert.PolicyIdentifiers, expectPolicyIdentifiers) + } + + if !slices.EqualFunc(cert.Policies, expectPolicies, OID.Equal) { + t.Errorf("cert.Policies = %v, want: %v", cert.Policies, expectPolicies) + } +} + +func TestCertificatePolicies(t *testing.T) { + if x509usepolicies.Value() == "0" { + t.Skip("test relies on default x509usepolicies GODEBUG") + } + + template := Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{CommonName: "Cert"}, + NotBefore: time.Unix(1000, 0), + NotAfter: time.Unix(100000, 0), + PolicyIdentifiers: []asn1.ObjectIdentifier{[]int{1, 2, 3}}, + Policies: []OID{mustNewOIDFromInts([]uint64{1, 2, math.MaxUint32 + 1})}, + } + + expectPolicies := []OID{mustNewOIDFromInts([]uint64{1, 2, math.MaxUint32 + 1})} + certDER, err := CreateCertificate(rand.Reader, &template, &template, rsaPrivateKey.Public(), rsaPrivateKey) + if err != nil { + t.Fatalf("CreateCertificate() unexpected error: %v", err) + } + + cert, err := ParseCertificate(certDER) + if err != nil { + t.Fatalf("ParseCertificate() unexpected error: %v", err) + } + + if !slices.EqualFunc(cert.Policies, expectPolicies, OID.Equal) { + t.Errorf("cert.Policies = %v, want: %v", cert.Policies, expectPolicies) + } + + t.Setenv("GODEBUG", "x509usepolicies=1") + expectPolicies = []OID{mustNewOIDFromInts([]uint64{1, 2, math.MaxUint32 + 1})} + + certDER, err = CreateCertificate(rand.Reader, &template, &template, rsaPrivateKey.Public(), rsaPrivateKey) + if err != nil { + t.Fatalf("CreateCertificate() unexpected error: %v", err) + } + + cert, err = ParseCertificate(certDER) + if err != nil { + t.Fatalf("ParseCertificate() unexpected error: %v", err) + } + + if !slices.EqualFunc(cert.Policies, expectPolicies, OID.Equal) { + t.Errorf("cert.Policies = %v, want: %v", cert.Policies, expectPolicies) + } +} + +func TestGob(t *testing.T) { + // Test that gob does not reject Certificate. + // See go.dev/issue/65633. + cert := new(Certificate) + err := gob.NewEncoder(io.Discard).Encode(cert) + if err != nil { + t.Fatal(err) + } +} + +func TestRejectCriticalAKI(t *testing.T) { + template := Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{CommonName: "Cert"}, + NotBefore: time.Unix(1000, 0), + NotAfter: time.Unix(100000, 0), + ExtraExtensions: []pkix.Extension{ + { + Id: asn1.ObjectIdentifier{2, 5, 29, 35}, + Critical: true, + Value: []byte{1, 2, 3}, + }, + }, + } + certDER, err := CreateCertificate(rand.Reader, &template, &template, rsaPrivateKey.Public(), rsaPrivateKey) + if err != nil { + t.Fatalf("CreateCertificate() unexpected error: %v", err) + } + expectedErr := "x509: authority key identifier incorrectly marked critical" + _, err = ParseCertificate(certDER) + if err == nil || err.Error() != expectedErr { + t.Fatalf("ParseCertificate() unexpected error: %v, want: %s", err, expectedErr) + } +} + +func TestRejectCriticalAIA(t *testing.T) { + template := Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{CommonName: "Cert"}, + NotBefore: time.Unix(1000, 0), + NotAfter: time.Unix(100000, 0), + ExtraExtensions: []pkix.Extension{ + { + Id: asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 1, 1}, + Critical: true, + Value: []byte{1, 2, 3}, + }, + }, + } + certDER, err := CreateCertificate(rand.Reader, &template, &template, rsaPrivateKey.Public(), rsaPrivateKey) + if err != nil { + t.Fatalf("CreateCertificate() unexpected error: %v", err) + } + expectedErr := "x509: authority info access incorrectly marked critical" + _, err = ParseCertificate(certDER) + if err == nil || err.Error() != expectedErr { + t.Fatalf("ParseCertificate() unexpected error: %v, want: %s", err, expectedErr) + } +} + +func TestRejectCriticalSKI(t *testing.T) { + template := Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{CommonName: "Cert"}, + NotBefore: time.Unix(1000, 0), + NotAfter: time.Unix(100000, 0), + ExtraExtensions: []pkix.Extension{ + { + Id: asn1.ObjectIdentifier{2, 5, 29, 14}, + Critical: true, + Value: []byte{1, 2, 3}, + }, + }, + } + certDER, err := CreateCertificate(rand.Reader, &template, &template, rsaPrivateKey.Public(), rsaPrivateKey) + if err != nil { + t.Fatalf("CreateCertificate() unexpected error: %v", err) + } + expectedErr := "x509: subject key identifier incorrectly marked critical" + _, err = ParseCertificate(certDER) + if err == nil || err.Error() != expectedErr { + t.Fatalf("ParseCertificate() unexpected error: %v, want: %s", err, expectedErr) + } +} + +type messageSigner struct{} + +func (ms *messageSigner) Public() crypto.PublicKey { return rsaPrivateKey.Public() } + +func (ms *messageSigner) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error) { + return nil, errors.New("unimplemented") +} + +func (ms *messageSigner) SignMessage(rand io.Reader, msg []byte, opts crypto.SignerOpts) (signature []byte, err error) { + if _, ok := opts.(*rsa.PSSOptions); ok { + return nil, errors.New("PSSOptions passed instead of hash") + } + h := opts.HashFunc().New() + h.Write(msg) + tbs := h.Sum(nil) + return rsa.SignPKCS1v15(rand, rsaPrivateKey, opts.HashFunc(), tbs) +} + +func TestMessageSigner(t *testing.T) { + template := Certificate{ + SignatureAlgorithm: SHA256WithRSA, + SerialNumber: big.NewInt(1), + Subject: pkix.Name{CommonName: "Cert"}, + NotBefore: time.Unix(1000, 0), + NotAfter: time.Unix(100000, 0), + BasicConstraintsValid: true, + IsCA: true, + } + certDER, err := CreateCertificate(rand.Reader, &template, &template, rsaPrivateKey.Public(), &messageSigner{}) + if err != nil { + t.Fatalf("CreateCertificate failed: %s", err) + } + cert, err := ParseCertificate(certDER) + if err != nil { + t.Fatalf("ParseCertificate failed: %s", err) + } + if err := cert.CheckSignatureFrom(cert); err != nil { + t.Fatalf("CheckSignatureFrom failed: %s", err) + } +} + +func TestCreateCertificateNegativeMaxPathLength(t *testing.T) { + template := Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{CommonName: "TEST"}, + NotBefore: time.Unix(1000, 0), + NotAfter: time.Unix(100000, 0), + BasicConstraintsValid: true, + IsCA: true, + + // CreateCertificate treats -1 in the same way as: MaxPathLen == 0 && MaxPathLenZero == false. + MaxPathLen: -1, + } + + _, err := CreateCertificate(rand.Reader, &template, &template, rsaPrivateKey.Public(), rsaPrivateKey) + if err != nil { + t.Fatalf("CreateCertificate() unexpected error: %v", err) + } + + template.MaxPathLen = -2 + _, err = CreateCertificate(rand.Reader, &template, &template, rsaPrivateKey.Public(), rsaPrivateKey) + if err == nil || err.Error() != "x509: invalid MaxPathLen, must be greater or equal to -1" { + t.Fatalf(`CreateCertificate() = %v; want = "x509: invalid MaxPathLen, must be greater or equal to -1"`, err) + } +} + +func TestEKUOIDS(t *testing.T) { + for _, eku := range extKeyUsageOIDs { + oid := eku.extKeyUsage.OID() + if !oid.EqualASN1OID(eku.oid) { + t.Errorf("extKeyUsage %v: expected OID %v, got %v", eku.extKeyUsage, eku.oid, oid) + } + } +} diff --git a/go/src/crypto/x509/x509_test_import.go b/go/src/crypto/x509/x509_test_import.go new file mode 100644 index 0000000000000000000000000000000000000000..e68f89c91d21be2706e63b08087c31d68907cb5b --- /dev/null +++ b/go/src/crypto/x509/x509_test_import.go @@ -0,0 +1,62 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build ignore + +// This file is run by the x509 tests to ensure that a program with minimal +// imports can sign certificates without errors resulting from missing hash +// functions. +package main + +import ( + "crypto/rand" + "crypto/x509" + "crypto/x509/pkix" + "encoding/pem" + "math/big" + "strings" + "time" +) + +func main() { + block, _ := pem.Decode([]byte(pemPrivateKey)) + rsaPriv, err := x509.ParsePKCS1PrivateKey(block.Bytes) + if err != nil { + panic("Failed to parse private key: " + err.Error()) + } + + template := x509.Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{ + CommonName: "test", + Organization: []string{"Σ Acme Co"}, + }, + NotBefore: time.Unix(1000, 0), + NotAfter: time.Unix(100000, 0), + KeyUsage: x509.KeyUsageCertSign, + } + + if _, err = x509.CreateCertificate(rand.Reader, &template, &template, &rsaPriv.PublicKey, rsaPriv); err != nil { + panic("failed to create certificate with basic imports: " + err.Error()) + } +} + +var pemPrivateKey = testingKey(`-----BEGIN RSA TESTING KEY----- +MIICXQIBAAKBgQCw0YNSqI9T1VFvRsIOejZ9feiKz1SgGfbe9Xq5tEzt2yJCsbyg ++xtcuCswNhdqY5A1ZN7G60HbL4/Hh/TlLhFJ4zNHVylz9mDDx3yp4IIcK2lb566d +fTD0B5EQ9Iqub4twLUdLKQCBfyhmJJvsEqKxm4J4QWgI+Brh/Pm3d4piPwIDAQAB +AoGASC6fj6TkLfMNdYHLQqG9kOlPfys4fstarpZD7X+fUBJ/H/7y5DzeZLGCYAIU ++QeAHWv6TfZIQjReW7Qy00RFJdgwFlTFRCsKXhG5x+IB+jL0Grr08KbgPPDgy4Jm +xirRHZVtU8lGbkiZX+omDIU28EHLNWL6rFEcTWao/tERspECQQDp2G5Nw0qYWn7H +Wm9Up1zkUTnkUkCzhqtxHbeRvNmHGKE7ryGMJEk2RmgHVstQpsvuFY4lIUSZEjAc +DUFJERhFAkEAwZH6O1ULORp8sHKDdidyleYcZU8L7y9Y3OXJYqELfddfBgFUZeVQ +duRmJj7ryu0g0uurOTE+i8VnMg/ostxiswJBAOc64Dd8uLJWKa6uug+XPr91oi0n +OFtM+xHrNK2jc+WmcSg3UJDnAI3uqMc5B+pERLq0Dc6hStehqHjUko3RnZECQEGZ +eRYWciE+Cre5dzfZkomeXE0xBrhecV0bOq6EKWLSVE+yr6mAl05ThRK9DCfPSOpy +F6rgN3QiyCA9J/1FluUCQQC5nX+PTU1FXx+6Ri2ZCi6EjEKMHr7gHcABhMinZYOt +N59pra9UdVQw9jxCU9G7eMyb0jJkNACAuEwakX3gi27b +-----END RSA TESTING KEY----- +`) + +func testingKey(s string) string { return strings.ReplaceAll(s, "TESTING KEY", "PRIVATE KEY") } diff --git a/go/src/database/sql/convert.go b/go/src/database/sql/convert.go new file mode 100644 index 0000000000000000000000000000000000000000..8a0457f9f49d22aadf12e824fa79a5b7ffedca1f --- /dev/null +++ b/go/src/database/sql/convert.go @@ -0,0 +1,599 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Type conversions for Scan. + +package sql + +import ( + "bytes" + "database/sql/driver" + "errors" + "fmt" + "reflect" + "strconv" + "time" + "unicode" + "unicode/utf8" + _ "unsafe" // for linkname +) + +var errNilPtr = errors.New("destination pointer is nil") // embedded in descriptive error + +func describeNamedValue(nv *driver.NamedValue) string { + if len(nv.Name) == 0 { + return fmt.Sprintf("$%d", nv.Ordinal) + } + return fmt.Sprintf("with name %q", nv.Name) +} + +func validateNamedValueName(name string) error { + if len(name) == 0 { + return nil + } + r, _ := utf8.DecodeRuneInString(name) + if unicode.IsLetter(r) { + return nil + } + return fmt.Errorf("name %q does not begin with a letter", name) +} + +// ccChecker wraps the driver.ColumnConverter and allows it to be used +// as if it were a NamedValueChecker. If the driver ColumnConverter +// is not present then the NamedValueChecker will return driver.ErrSkip. +type ccChecker struct { + cci driver.ColumnConverter + want int +} + +func (c ccChecker) CheckNamedValue(nv *driver.NamedValue) error { + if c.cci == nil { + return driver.ErrSkip + } + // The column converter shouldn't be called on any index + // it isn't expecting. The final error will be thrown + // in the argument converter loop. + index := nv.Ordinal - 1 + if c.want >= 0 && c.want <= index { + return nil + } + + // First, see if the value itself knows how to convert + // itself to a driver type. For example, a NullString + // struct changing into a string or nil. + if vr, ok := nv.Value.(driver.Valuer); ok { + sv, err := callValuerValue(vr) + if err != nil { + return err + } + if !driver.IsValue(sv) { + return fmt.Errorf("non-subset type %T returned from Value", sv) + } + nv.Value = sv + } + + // Second, ask the column to sanity check itself. For + // example, drivers might use this to make sure that + // an int64 values being inserted into a 16-bit + // integer field is in range (before getting + // truncated), or that a nil can't go into a NOT NULL + // column before going across the network to get the + // same error. + var err error + arg := nv.Value + nv.Value, err = c.cci.ColumnConverter(index).ConvertValue(arg) + if err != nil { + return err + } + if !driver.IsValue(nv.Value) { + return fmt.Errorf("driver ColumnConverter error converted %T to unsupported type %T", arg, nv.Value) + } + return nil +} + +// defaultCheckNamedValue wraps the default ColumnConverter to have the same +// function signature as the CheckNamedValue in the driver.NamedValueChecker +// interface. +func defaultCheckNamedValue(nv *driver.NamedValue) (err error) { + nv.Value, err = driver.DefaultParameterConverter.ConvertValue(nv.Value) + return err +} + +// driverArgsConnLocked converts arguments from callers of Stmt.Exec and +// Stmt.Query into driver Values. +// +// The statement ds may be nil, if no statement is available. +// +// ci must be locked. +func driverArgsConnLocked(ci driver.Conn, ds *driverStmt, args []any) ([]driver.NamedValue, error) { + nvargs := make([]driver.NamedValue, len(args)) + + // -1 means the driver doesn't know how to count the number of + // placeholders, so we won't sanity check input here and instead let the + // driver deal with errors. + want := -1 + + var si driver.Stmt + var cc ccChecker + if ds != nil { + si = ds.si + want = ds.si.NumInput() + cc.want = want + } + + // Check all types of interfaces from the start. + // Drivers may opt to use the NamedValueChecker for special + // argument types, then return driver.ErrSkip to pass it along + // to the column converter. + nvc, ok := si.(driver.NamedValueChecker) + if !ok { + nvc, _ = ci.(driver.NamedValueChecker) + } + cci, ok := si.(driver.ColumnConverter) + if ok { + cc.cci = cci + } + + // Loop through all the arguments, checking each one. + // If no error is returned simply increment the index + // and continue. However, if driver.ErrRemoveArgument + // is returned the argument is not included in the query + // argument list. + var err error + var n int + for _, arg := range args { + nv := &nvargs[n] + if np, ok := arg.(NamedArg); ok { + if err = validateNamedValueName(np.Name); err != nil { + return nil, err + } + arg = np.Value + nv.Name = np.Name + } + nv.Ordinal = n + 1 + nv.Value = arg + + // Checking sequence has four routes: + // A: 1. Default + // B: 1. NamedValueChecker 2. Column Converter 3. Default + // C: 1. NamedValueChecker 3. Default + // D: 1. Column Converter 2. Default + // + // The only time a Column Converter is called is first + // or after NamedValueConverter. If first it is handled before + // the nextCheck label. Thus for repeats tries only when the + // NamedValueConverter is selected should the Column Converter + // be used in the retry. + checker := defaultCheckNamedValue + nextCC := false + switch { + case nvc != nil: + nextCC = cci != nil + checker = nvc.CheckNamedValue + case cci != nil: + checker = cc.CheckNamedValue + } + + nextCheck: + err = checker(nv) + switch err { + case nil: + n++ + continue + case driver.ErrRemoveArgument: + nvargs = nvargs[:len(nvargs)-1] + continue + case driver.ErrSkip: + if nextCC { + nextCC = false + checker = cc.CheckNamedValue + } else { + checker = defaultCheckNamedValue + } + goto nextCheck + default: + return nil, fmt.Errorf("sql: converting argument %s type: %w", describeNamedValue(nv), err) + } + } + + // Check the length of arguments after conversion to allow for omitted + // arguments. + if want != -1 && len(nvargs) != want { + return nil, fmt.Errorf("sql: expected %d arguments, got %d", want, len(nvargs)) + } + + return nvargs, nil +} + +// convertAssign is the same as convertAssignRows, but without the optional +// rows argument. +// +// convertAssign should be an internal detail, +// but widely used packages access it using linkname. +// Notable members of the hall of shame include: +// - ariga.io/entcache +// +// Do not remove or change the type signature. +// See go.dev/issue/67401. +// +//go:linkname convertAssign +func convertAssign(dest, src any) error { + return convertAssignRows(dest, src, nil) +} + +// convertAssignRows copies to dest the value in src, converting it if possible. +// An error is returned if the copy would result in loss of information. +// dest should be a pointer type. If rows is passed in, the rows will +// be used as the parent for any cursor values converted from a +// driver.Rows to a *Rows. +func convertAssignRows(dest, src any, rows *Rows) error { + // Common cases, without reflect. + switch s := src.(type) { + case string: + switch d := dest.(type) { + case *string: + if d == nil { + return errNilPtr + } + *d = s + return nil + case *[]byte: + if d == nil { + return errNilPtr + } + *d = []byte(s) + return nil + case *RawBytes: + if d == nil { + return errNilPtr + } + *d = rows.setrawbuf(append(rows.rawbuf(), s...)) + return nil + } + case []byte: + switch d := dest.(type) { + case *string: + if d == nil { + return errNilPtr + } + *d = string(s) + return nil + case *any: + if d == nil { + return errNilPtr + } + *d = bytes.Clone(s) + return nil + case *[]byte: + if d == nil { + return errNilPtr + } + *d = bytes.Clone(s) + return nil + case *RawBytes: + if d == nil { + return errNilPtr + } + *d = s + return nil + } + case time.Time: + switch d := dest.(type) { + case *time.Time: + *d = s + return nil + case *string: + *d = s.Format(time.RFC3339Nano) + return nil + case *[]byte: + if d == nil { + return errNilPtr + } + *d = s.AppendFormat(make([]byte, 0, len(time.RFC3339Nano)), time.RFC3339Nano) + return nil + case *RawBytes: + if d == nil { + return errNilPtr + } + *d = rows.setrawbuf(s.AppendFormat(rows.rawbuf(), time.RFC3339Nano)) + return nil + } + case decimalDecompose: + switch d := dest.(type) { + case decimalCompose: + return d.Compose(s.Decompose(nil)) + } + case nil: + switch d := dest.(type) { + case *any: + if d == nil { + return errNilPtr + } + *d = nil + return nil + case *[]byte: + if d == nil { + return errNilPtr + } + *d = nil + return nil + case *RawBytes: + if d == nil { + return errNilPtr + } + *d = nil + return nil + } + // The driver is returning a cursor the client may iterate over. + case driver.Rows: + switch d := dest.(type) { + case *Rows: + if d == nil { + return errNilPtr + } + if rows == nil { + return errors.New("invalid context to convert cursor rows, missing parent *Rows") + } + *d = Rows{ + dc: rows.dc, + releaseConn: func(error) {}, + rowsi: s, + } + // Chain the cancel function. + parentCancel := rows.cancel + rows.cancel = func() { + // When Rows.cancel is called, the closemu will be locked as well. + // So we can access rs.lasterr. + d.close(rows.lasterr) + if parentCancel != nil { + parentCancel() + } + } + return nil + } + } + + var sv reflect.Value + + switch d := dest.(type) { + case *string: + sv = reflect.ValueOf(src) + switch sv.Kind() { + case reflect.Bool, + reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, + reflect.Float32, reflect.Float64: + *d = asString(src) + return nil + } + case *[]byte: + sv = reflect.ValueOf(src) + if b, ok := asBytes(nil, sv); ok { + *d = b + return nil + } + case *RawBytes: + sv = reflect.ValueOf(src) + if b, ok := asBytes(rows.rawbuf(), sv); ok { + *d = rows.setrawbuf(b) + return nil + } + case *bool: + bv, err := driver.Bool.ConvertValue(src) + if err == nil { + *d = bv.(bool) + } + return err + case *any: + *d = src + return nil + } + + if scanner, ok := dest.(Scanner); ok { + return scanner.Scan(src) + } + + dpv := reflect.ValueOf(dest) + if dpv.Kind() != reflect.Pointer { + return errors.New("destination not a pointer") + } + if dpv.IsNil() { + return errNilPtr + } + + if !sv.IsValid() { + sv = reflect.ValueOf(src) + } + + dv := reflect.Indirect(dpv) + if sv.IsValid() && sv.Type().AssignableTo(dv.Type()) { + switch b := src.(type) { + case []byte: + dv.Set(reflect.ValueOf(bytes.Clone(b))) + default: + dv.Set(sv) + } + return nil + } + + if dv.Kind() == sv.Kind() && sv.Type().ConvertibleTo(dv.Type()) { + dv.Set(sv.Convert(dv.Type())) + return nil + } + + // The following conversions use a string value as an intermediate representation + // to convert between various numeric types. + // + // This also allows scanning into user defined types such as "type Int int64". + // For symmetry, also check for string destination types. + switch dv.Kind() { + case reflect.Pointer: + if src == nil { + dv.SetZero() + return nil + } + dv.Set(reflect.New(dv.Type().Elem())) + return convertAssignRows(dv.Interface(), src, rows) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + if src == nil { + return fmt.Errorf("converting NULL to %s is unsupported", dv.Kind()) + } + s := asString(src) + i64, err := strconv.ParseInt(s, 10, dv.Type().Bits()) + if err != nil { + err = strconvErr(err) + return fmt.Errorf("converting driver.Value type %T (%q) to a %s: %v", src, s, dv.Kind(), err) + } + dv.SetInt(i64) + return nil + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + if src == nil { + return fmt.Errorf("converting NULL to %s is unsupported", dv.Kind()) + } + s := asString(src) + u64, err := strconv.ParseUint(s, 10, dv.Type().Bits()) + if err != nil { + err = strconvErr(err) + return fmt.Errorf("converting driver.Value type %T (%q) to a %s: %v", src, s, dv.Kind(), err) + } + dv.SetUint(u64) + return nil + case reflect.Float32, reflect.Float64: + if src == nil { + return fmt.Errorf("converting NULL to %s is unsupported", dv.Kind()) + } + s := asString(src) + f64, err := strconv.ParseFloat(s, dv.Type().Bits()) + if err != nil { + err = strconvErr(err) + return fmt.Errorf("converting driver.Value type %T (%q) to a %s: %v", src, s, dv.Kind(), err) + } + dv.SetFloat(f64) + return nil + case reflect.String: + if src == nil { + return fmt.Errorf("converting NULL to %s is unsupported", dv.Kind()) + } + switch v := src.(type) { + case string: + dv.SetString(v) + return nil + case []byte: + dv.SetString(string(v)) + return nil + } + } + + return fmt.Errorf("unsupported Scan, storing driver.Value type %T into type %T", src, dest) +} + +func strconvErr(err error) error { + if ne, ok := err.(*strconv.NumError); ok { + return ne.Err + } + return err +} + +func asString(src any) string { + switch v := src.(type) { + case string: + return v + case []byte: + return string(v) + } + rv := reflect.ValueOf(src) + switch rv.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return strconv.FormatInt(rv.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + return strconv.FormatUint(rv.Uint(), 10) + case reflect.Float64: + return strconv.FormatFloat(rv.Float(), 'g', -1, 64) + case reflect.Float32: + return strconv.FormatFloat(rv.Float(), 'g', -1, 32) + case reflect.Bool: + return strconv.FormatBool(rv.Bool()) + } + return fmt.Sprintf("%v", src) +} + +func asBytes(buf []byte, rv reflect.Value) (b []byte, ok bool) { + switch rv.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return strconv.AppendInt(buf, rv.Int(), 10), true + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + return strconv.AppendUint(buf, rv.Uint(), 10), true + case reflect.Float32: + return strconv.AppendFloat(buf, rv.Float(), 'g', -1, 32), true + case reflect.Float64: + return strconv.AppendFloat(buf, rv.Float(), 'g', -1, 64), true + case reflect.Bool: + return strconv.AppendBool(buf, rv.Bool()), true + case reflect.String: + s := rv.String() + return append(buf, s...), true + } + return +} + +var valuerReflectType = reflect.TypeFor[driver.Valuer]() + +// callValuerValue returns vr.Value(), with one exception: +// If vr.Value is an auto-generated method on a pointer type and the +// pointer is nil, it would panic at runtime in the panicwrap +// method. Treat it like nil instead. +// Issue 8415. +// +// This is so people can implement driver.Value on value types and +// still use nil pointers to those types to mean nil/NULL, just like +// string/*string. +// +// This function is mirrored in the database/sql/driver package. +func callValuerValue(vr driver.Valuer) (v driver.Value, err error) { + if rv := reflect.ValueOf(vr); rv.Kind() == reflect.Pointer && + rv.IsNil() && + rv.Type().Elem().Implements(valuerReflectType) { + return nil, nil + } + return vr.Value() +} + +// decimal composes or decomposes a decimal value to and from individual parts. +// There are four parts: a boolean negative flag, a form byte with three possible states +// (finite=0, infinite=1, NaN=2), a base-2 big-endian integer +// coefficient (also known as a significand) as a []byte, and an int32 exponent. +// These are composed into a final value as "decimal = (neg) (form=finite) coefficient * 10 ^ exponent". +// A zero length coefficient is a zero value. +// The big-endian integer coefficient stores the most significant byte first (at coefficient[0]). +// If the form is not finite the coefficient and exponent should be ignored. +// The negative parameter may be set to true for any form, although implementations are not required +// to respect the negative parameter in the non-finite form. +// +// Implementations may choose to set the negative parameter to true on a zero or NaN value, +// but implementations that do not differentiate between negative and positive +// zero or NaN values should ignore the negative parameter without error. +// If an implementation does not support Infinity it may be converted into a NaN without error. +// If a value is set that is larger than what is supported by an implementation, +// an error must be returned. +// Implementations must return an error if a NaN or Infinity is attempted to be set while neither +// are supported. +// +// NOTE(kardianos): This is an experimental interface. See https://golang.org/issue/30870 +type decimal interface { + decimalDecompose + decimalCompose +} + +type decimalDecompose interface { + // Decompose returns the internal decimal state in parts. + // If the provided buf has sufficient capacity, buf may be returned as the coefficient with + // the value set and length set as appropriate. + Decompose(buf []byte) (form byte, negative bool, coefficient []byte, exponent int32) +} + +type decimalCompose interface { + // Compose sets the internal decimal value from parts. If the value cannot be + // represented then an error should be returned. + Compose(form byte, negative bool, coefficient []byte, exponent int32) error +} diff --git a/go/src/database/sql/convert_test.go b/go/src/database/sql/convert_test.go new file mode 100644 index 0000000000000000000000000000000000000000..1b2e61c143ae136e01685b1eb1f6a382c28bcc90 --- /dev/null +++ b/go/src/database/sql/convert_test.go @@ -0,0 +1,607 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sql + +import ( + "database/sql/driver" + "fmt" + "internal/asan" + "reflect" + "runtime" + "strings" + "sync" + "testing" + "time" +) + +var someTime = time.Unix(123, 0) +var answer int64 = 42 + +type ( + userDefined float64 + userDefinedSlice []int + userDefinedString string +) + +type conversionTest struct { + s, d any // source and destination + + // following are used if they're non-zero + wantint int64 + wantuint uint64 + wantstr string + wantbytes []byte + wantraw RawBytes + wantf32 float32 + wantf64 float64 + wanttime time.Time + wantbool bool // used if d is of type *bool + wanterr string + wantiface any + wantptr *int64 // if non-nil, *d's pointed value must be equal to *wantptr + wantnil bool // if true, *d must be *int64(nil) + wantusrdef userDefined + wantusrstr userDefinedString +} + +// Target variables for scanning into. +var ( + scanstr string + scanbytes []byte + scanraw RawBytes + scanint int + scanuint8 uint8 + scanuint16 uint16 + scanbool bool + scanf32 float32 + scanf64 float64 + scantime time.Time + scanptr *int64 + scaniface any +) + +func conversionTests() []conversionTest { + // Return a fresh instance to test so "go test -count 2" works correctly. + return []conversionTest{ + // Exact conversions (destination pointer type matches source type) + {s: "foo", d: &scanstr, wantstr: "foo"}, + {s: 123, d: &scanint, wantint: 123}, + {s: someTime, d: &scantime, wanttime: someTime}, + + // To strings + {s: "string", d: &scanstr, wantstr: "string"}, + {s: []byte("byteslice"), d: &scanstr, wantstr: "byteslice"}, + {s: 123, d: &scanstr, wantstr: "123"}, + {s: int8(123), d: &scanstr, wantstr: "123"}, + {s: int64(123), d: &scanstr, wantstr: "123"}, + {s: uint8(123), d: &scanstr, wantstr: "123"}, + {s: uint16(123), d: &scanstr, wantstr: "123"}, + {s: uint32(123), d: &scanstr, wantstr: "123"}, + {s: uint64(123), d: &scanstr, wantstr: "123"}, + {s: 1.5, d: &scanstr, wantstr: "1.5"}, + + // From time.Time: + {s: time.Unix(1, 0).UTC(), d: &scanstr, wantstr: "1970-01-01T00:00:01Z"}, + {s: time.Unix(1453874597, 0).In(time.FixedZone("here", -3600*8)), d: &scanstr, wantstr: "2016-01-26T22:03:17-08:00"}, + {s: time.Unix(1, 2).UTC(), d: &scanstr, wantstr: "1970-01-01T00:00:01.000000002Z"}, + {s: time.Time{}, d: &scanstr, wantstr: "0001-01-01T00:00:00Z"}, + {s: time.Unix(1, 2).UTC(), d: &scanbytes, wantbytes: []byte("1970-01-01T00:00:01.000000002Z")}, + {s: time.Unix(1, 2).UTC(), d: &scaniface, wantiface: time.Unix(1, 2).UTC()}, + + // To []byte + {s: nil, d: &scanbytes, wantbytes: nil}, + {s: "string", d: &scanbytes, wantbytes: []byte("string")}, + {s: []byte("byteslice"), d: &scanbytes, wantbytes: []byte("byteslice")}, + {s: 123, d: &scanbytes, wantbytes: []byte("123")}, + {s: int8(123), d: &scanbytes, wantbytes: []byte("123")}, + {s: int64(123), d: &scanbytes, wantbytes: []byte("123")}, + {s: uint8(123), d: &scanbytes, wantbytes: []byte("123")}, + {s: uint16(123), d: &scanbytes, wantbytes: []byte("123")}, + {s: uint32(123), d: &scanbytes, wantbytes: []byte("123")}, + {s: uint64(123), d: &scanbytes, wantbytes: []byte("123")}, + {s: 1.5, d: &scanbytes, wantbytes: []byte("1.5")}, + + // To RawBytes + {s: nil, d: &scanraw, wantraw: nil}, + {s: []byte("byteslice"), d: &scanraw, wantraw: RawBytes("byteslice")}, + {s: "string", d: &scanraw, wantraw: RawBytes("string")}, + {s: 123, d: &scanraw, wantraw: RawBytes("123")}, + {s: int8(123), d: &scanraw, wantraw: RawBytes("123")}, + {s: int64(123), d: &scanraw, wantraw: RawBytes("123")}, + {s: uint8(123), d: &scanraw, wantraw: RawBytes("123")}, + {s: uint16(123), d: &scanraw, wantraw: RawBytes("123")}, + {s: uint32(123), d: &scanraw, wantraw: RawBytes("123")}, + {s: uint64(123), d: &scanraw, wantraw: RawBytes("123")}, + {s: 1.5, d: &scanraw, wantraw: RawBytes("1.5")}, + // time.Time has been placed here to check that the RawBytes slice gets + // correctly reset when calling time.Time.AppendFormat. + {s: time.Unix(2, 5).UTC(), d: &scanraw, wantraw: RawBytes("1970-01-01T00:00:02.000000005Z")}, + + // Strings to integers + {s: "255", d: &scanuint8, wantuint: 255}, + {s: "256", d: &scanuint8, wanterr: "converting driver.Value type string (\"256\") to a uint8: value out of range"}, + {s: "256", d: &scanuint16, wantuint: 256}, + {s: "-1", d: &scanint, wantint: -1}, + {s: "foo", d: &scanint, wanterr: "converting driver.Value type string (\"foo\") to a int: invalid syntax"}, + + // int64 to smaller integers + {s: int64(5), d: &scanuint8, wantuint: 5}, + {s: int64(256), d: &scanuint8, wanterr: "converting driver.Value type int64 (\"256\") to a uint8: value out of range"}, + {s: int64(256), d: &scanuint16, wantuint: 256}, + {s: int64(65536), d: &scanuint16, wanterr: "converting driver.Value type int64 (\"65536\") to a uint16: value out of range"}, + + // True bools + {s: true, d: &scanbool, wantbool: true}, + {s: "True", d: &scanbool, wantbool: true}, + {s: "TRUE", d: &scanbool, wantbool: true}, + {s: "1", d: &scanbool, wantbool: true}, + {s: 1, d: &scanbool, wantbool: true}, + {s: int64(1), d: &scanbool, wantbool: true}, + {s: uint16(1), d: &scanbool, wantbool: true}, + + // False bools + {s: false, d: &scanbool, wantbool: false}, + {s: "false", d: &scanbool, wantbool: false}, + {s: "FALSE", d: &scanbool, wantbool: false}, + {s: "0", d: &scanbool, wantbool: false}, + {s: 0, d: &scanbool, wantbool: false}, + {s: int64(0), d: &scanbool, wantbool: false}, + {s: uint16(0), d: &scanbool, wantbool: false}, + + // Not bools + {s: "yup", d: &scanbool, wanterr: `sql/driver: couldn't convert "yup" into type bool`}, + {s: 2, d: &scanbool, wanterr: `sql/driver: couldn't convert 2 into type bool`}, + + // Floats + {s: float64(1.5), d: &scanf64, wantf64: float64(1.5)}, + {s: int64(1), d: &scanf64, wantf64: float64(1)}, + {s: float64(1.5), d: &scanf32, wantf32: float32(1.5)}, + {s: "1.5", d: &scanf32, wantf32: float32(1.5)}, + {s: "1.5", d: &scanf64, wantf64: float64(1.5)}, + + // Pointers + {s: any(nil), d: &scanptr, wantnil: true}, + {s: int64(42), d: &scanptr, wantptr: &answer}, + + // To interface{} + {s: float64(1.5), d: &scaniface, wantiface: float64(1.5)}, + {s: int64(1), d: &scaniface, wantiface: int64(1)}, + {s: "str", d: &scaniface, wantiface: "str"}, + {s: []byte("byteslice"), d: &scaniface, wantiface: []byte("byteslice")}, + {s: true, d: &scaniface, wantiface: true}, + {s: nil, d: &scaniface}, + {s: []byte(nil), d: &scaniface, wantiface: []byte(nil)}, + + // To a user-defined type + {s: 1.5, d: new(userDefined), wantusrdef: 1.5}, + {s: int64(123), d: new(userDefined), wantusrdef: 123}, + {s: "1.5", d: new(userDefined), wantusrdef: 1.5}, + {s: []byte{1, 2, 3}, d: new(userDefinedSlice), wanterr: `unsupported Scan, storing driver.Value type []uint8 into type *sql.userDefinedSlice`}, + {s: "str", d: new(userDefinedString), wantusrstr: "str"}, + + // Other errors + {s: complex(1, 2), d: &scanstr, wanterr: `unsupported Scan, storing driver.Value type complex128 into type *string`}, + } +} + +func intPtrValue(intptr any) any { + return reflect.Indirect(reflect.Indirect(reflect.ValueOf(intptr))).Int() +} + +func intValue(intptr any) int64 { + return reflect.Indirect(reflect.ValueOf(intptr)).Int() +} + +func uintValue(intptr any) uint64 { + return reflect.Indirect(reflect.ValueOf(intptr)).Uint() +} + +func float64Value(ptr any) float64 { + return *(ptr.(*float64)) +} + +func float32Value(ptr any) float32 { + return *(ptr.(*float32)) +} + +func timeValue(ptr any) time.Time { + return *(ptr.(*time.Time)) +} + +func TestConversions(t *testing.T) { + for n, ct := range conversionTests() { + err := convertAssign(ct.d, ct.s) + errstr := "" + if err != nil { + errstr = err.Error() + } + errf := func(format string, args ...any) { + base := fmt.Sprintf("convertAssign #%d: for %v (%T) -> %T, ", n, ct.s, ct.s, ct.d) + t.Errorf(base+format, args...) + } + if errstr != ct.wanterr { + errf("got error %q, want error %q", errstr, ct.wanterr) + } + if ct.wantstr != "" && ct.wantstr != scanstr { + errf("want string %q, got %q", ct.wantstr, scanstr) + } + if ct.wantbytes != nil && string(ct.wantbytes) != string(scanbytes) { + errf("want byte %q, got %q", ct.wantbytes, scanbytes) + } + if ct.wantraw != nil && string(ct.wantraw) != string(scanraw) { + errf("want RawBytes %q, got %q", ct.wantraw, scanraw) + } + if ct.wantint != 0 && ct.wantint != intValue(ct.d) { + errf("want int %d, got %d", ct.wantint, intValue(ct.d)) + } + if ct.wantuint != 0 && ct.wantuint != uintValue(ct.d) { + errf("want uint %d, got %d", ct.wantuint, uintValue(ct.d)) + } + if ct.wantf32 != 0 && ct.wantf32 != float32Value(ct.d) { + errf("want float32 %v, got %v", ct.wantf32, float32Value(ct.d)) + } + if ct.wantf64 != 0 && ct.wantf64 != float64Value(ct.d) { + errf("want float32 %v, got %v", ct.wantf64, float64Value(ct.d)) + } + if bp, boolTest := ct.d.(*bool); boolTest && *bp != ct.wantbool && ct.wanterr == "" { + errf("want bool %v, got %v", ct.wantbool, *bp) + } + if !ct.wanttime.IsZero() && !ct.wanttime.Equal(timeValue(ct.d)) { + errf("want time %v, got %v", ct.wanttime, timeValue(ct.d)) + } + if ct.wantnil && *ct.d.(**int64) != nil { + errf("want nil, got %v", intPtrValue(ct.d)) + } + if ct.wantptr != nil { + if *ct.d.(**int64) == nil { + errf("want pointer to %v, got nil", *ct.wantptr) + } else if *ct.wantptr != intPtrValue(ct.d) { + errf("want pointer to %v, got %v", *ct.wantptr, intPtrValue(ct.d)) + } + } + if ifptr, ok := ct.d.(*any); ok { + if !reflect.DeepEqual(ct.wantiface, scaniface) { + errf("want interface %#v, got %#v", ct.wantiface, scaniface) + continue + } + if srcBytes, ok := ct.s.([]byte); ok { + dstBytes := (*ifptr).([]byte) + if len(srcBytes) > 0 && &dstBytes[0] == &srcBytes[0] { + errf("copy into interface{} didn't copy []byte data") + } + } + } + if ct.wantusrdef != 0 && ct.wantusrdef != *ct.d.(*userDefined) { + errf("want userDefined %f, got %f", ct.wantusrdef, *ct.d.(*userDefined)) + } + if len(ct.wantusrstr) != 0 && ct.wantusrstr != *ct.d.(*userDefinedString) { + errf("want userDefined %q, got %q", ct.wantusrstr, *ct.d.(*userDefinedString)) + } + } +} + +func TestNullString(t *testing.T) { + var ns NullString + convertAssign(&ns, []byte("foo")) + if !ns.Valid { + t.Errorf("expecting not null") + } + if ns.String != "foo" { + t.Errorf("expecting foo; got %q", ns.String) + } + convertAssign(&ns, nil) + if ns.Valid { + t.Errorf("expecting null on nil") + } + if ns.String != "" { + t.Errorf("expecting blank on nil; got %q", ns.String) + } +} + +type valueConverterTest struct { + c driver.ValueConverter + in, out any + err string +} + +var valueConverterTests = []valueConverterTest{ + {driver.DefaultParameterConverter, NullString{"hi", true}, "hi", ""}, + {driver.DefaultParameterConverter, NullString{"", false}, nil, ""}, +} + +func TestValueConverters(t *testing.T) { + for i, tt := range valueConverterTests { + out, err := tt.c.ConvertValue(tt.in) + goterr := "" + if err != nil { + goterr = err.Error() + } + if goterr != tt.err { + t.Errorf("test %d: %T(%T(%v)) error = %q; want error = %q", + i, tt.c, tt.in, tt.in, goterr, tt.err) + } + if tt.err != "" { + continue + } + if !reflect.DeepEqual(out, tt.out) { + t.Errorf("test %d: %T(%T(%v)) = %v (%T); want %v (%T)", + i, tt.c, tt.in, tt.in, out, out, tt.out, tt.out) + } + } +} + +// Tests that assigning to RawBytes doesn't allocate (and also works). +func TestRawBytesAllocs(t *testing.T) { + var tests = []struct { + name string + in any + want string + }{ + {"uint64", uint64(12345678), "12345678"}, + {"uint32", uint32(1234), "1234"}, + {"uint16", uint16(12), "12"}, + {"uint8", uint8(1), "1"}, + {"uint", uint(123), "123"}, + {"int", int(123), "123"}, + {"int8", int8(1), "1"}, + {"int16", int16(12), "12"}, + {"int32", int32(1234), "1234"}, + {"int64", int64(12345678), "12345678"}, + {"float32", float32(1.5), "1.5"}, + {"float64", float64(64), "64"}, + {"bool", false, "false"}, + {"time", time.Unix(2, 5).UTC(), "1970-01-01T00:00:02.000000005Z"}, + } + if asan.Enabled { + t.Skip("test allocates more with -asan; see #70079") + } + + var buf RawBytes + rows := &Rows{} + test := func(name string, in any, want string) { + if err := convertAssignRows(&buf, in, rows); err != nil { + t.Fatalf("%s: convertAssign = %v", name, err) + } + match := len(buf) == len(want) + if match { + for i, b := range buf { + if want[i] != b { + match = false + break + } + } + } + if !match { + t.Fatalf("%s: got %q (len %d); want %q (len %d)", name, buf, len(buf), want, len(want)) + } + } + + n := testing.AllocsPerRun(100, func() { + for _, tt := range tests { + rows.raw = rows.raw[:0] + test(tt.name, tt.in, tt.want) + } + }) + + // The numbers below are only valid for 64-bit interface word sizes, + // and gc. With 32-bit words there are more convT2E allocs, and + // with gccgo, only pointers currently go in interface data. + // So only care on amd64 gc for now. + measureAllocs := false + switch runtime.GOARCH { + case "amd64", "arm64": + measureAllocs = runtime.Compiler == "gc" + } + + if n > 0.5 && measureAllocs { + t.Fatalf("allocs = %v; want 0", n) + } + + // This one involves a convT2E allocation, string -> interface{} + n = testing.AllocsPerRun(100, func() { + test("string", "foo", "foo") + }) + if n > 1.5 && measureAllocs { + t.Fatalf("allocs = %v; want max 1", n) + } +} + +// https://golang.org/issues/13905 +func TestUserDefinedBytes(t *testing.T) { + type userDefinedBytes []byte + var u userDefinedBytes + v := []byte("foo") + + convertAssign(&u, v) + if &u[0] == &v[0] { + t.Fatal("userDefinedBytes got potentially dirty driver memory") + } +} + +type Valuer_V string + +func (v Valuer_V) Value() (driver.Value, error) { + return strings.ToUpper(string(v)), nil +} + +type Valuer_P string + +func (p *Valuer_P) Value() (driver.Value, error) { + if p == nil { + return "nil-to-str", nil + } + return strings.ToUpper(string(*p)), nil +} + +func TestDriverArgs(t *testing.T) { + var nilValuerVPtr *Valuer_V + var nilValuerPPtr *Valuer_P + var nilStrPtr *string + tests := []struct { + args []any + want []driver.NamedValue + }{ + 0: { + args: []any{Valuer_V("foo")}, + want: []driver.NamedValue{ + { + Ordinal: 1, + Value: "FOO", + }, + }, + }, + 1: { + args: []any{nilValuerVPtr}, + want: []driver.NamedValue{ + { + Ordinal: 1, + Value: nil, + }, + }, + }, + 2: { + args: []any{nilValuerPPtr}, + want: []driver.NamedValue{ + { + Ordinal: 1, + Value: "nil-to-str", + }, + }, + }, + 3: { + args: []any{"plain-str"}, + want: []driver.NamedValue{ + { + Ordinal: 1, + Value: "plain-str", + }, + }, + }, + 4: { + args: []any{nilStrPtr}, + want: []driver.NamedValue{ + { + Ordinal: 1, + Value: nil, + }, + }, + }, + } + for i, tt := range tests { + ds := &driverStmt{Locker: &sync.Mutex{}, si: stubDriverStmt{nil}} + got, err := driverArgsConnLocked(nil, ds, tt.args) + if err != nil { + t.Errorf("test[%d]: %v", i, err) + continue + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("test[%d]: got %v, want %v", i, got, tt.want) + } + } +} + +type dec struct { + form byte + neg bool + coefficient [16]byte + exponent int32 +} + +func (d dec) Decompose(buf []byte) (form byte, negative bool, coefficient []byte, exponent int32) { + coef := make([]byte, 16) + copy(coef, d.coefficient[:]) + return d.form, d.neg, coef, d.exponent +} + +func (d *dec) Compose(form byte, negative bool, coefficient []byte, exponent int32) error { + switch form { + default: + return fmt.Errorf("unknown form %d", form) + case 1, 2: + d.form = form + d.neg = negative + return nil + case 0: + } + d.form = form + d.neg = negative + d.exponent = exponent + + // This isn't strictly correct, as the extra bytes could be all zero, + // ignore this for this test. + if len(coefficient) > 16 { + return fmt.Errorf("coefficient too large") + } + copy(d.coefficient[:], coefficient) + + return nil +} + +type decFinite struct { + neg bool + coefficient [16]byte + exponent int32 +} + +func (d decFinite) Decompose(buf []byte) (form byte, negative bool, coefficient []byte, exponent int32) { + coef := make([]byte, 16) + copy(coef, d.coefficient[:]) + return 0, d.neg, coef, d.exponent +} + +func (d *decFinite) Compose(form byte, negative bool, coefficient []byte, exponent int32) error { + switch form { + default: + return fmt.Errorf("unknown form %d", form) + case 1, 2: + return fmt.Errorf("unsupported form %d", form) + case 0: + } + d.neg = negative + d.exponent = exponent + + // This isn't strictly correct, as the extra bytes could be all zero, + // ignore this for this test. + if len(coefficient) > 16 { + return fmt.Errorf("coefficient too large") + } + copy(d.coefficient[:], coefficient) + + return nil +} + +func TestDecimal(t *testing.T) { + list := []struct { + name string + in decimalDecompose + out dec + err bool + }{ + {name: "same", in: dec{exponent: -6}, out: dec{exponent: -6}}, + + // Ensure reflection is not used to assign the value by using different types. + {name: "diff", in: decFinite{exponent: -6}, out: dec{exponent: -6}}, + + {name: "bad-form", in: dec{form: 200}, err: true}, + } + for _, item := range list { + t.Run(item.name, func(t *testing.T) { + out := dec{} + err := convertAssign(&out, item.in) + if item.err { + if err == nil { + t.Fatalf("unexpected nil error") + } + return + } + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if !reflect.DeepEqual(out, item.out) { + t.Fatalf("got %#v want %#v", out, item.out) + } + }) + } +} diff --git a/go/src/database/sql/ctxutil.go b/go/src/database/sql/ctxutil.go new file mode 100644 index 0000000000000000000000000000000000000000..4dbe6af6d2bee38112ebbf1061903d15998b6d1c --- /dev/null +++ b/go/src/database/sql/ctxutil.go @@ -0,0 +1,146 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sql + +import ( + "context" + "database/sql/driver" + "errors" +) + +func ctxDriverPrepare(ctx context.Context, ci driver.Conn, query string) (driver.Stmt, error) { + if ciCtx, is := ci.(driver.ConnPrepareContext); is { + return ciCtx.PrepareContext(ctx, query) + } + si, err := ci.Prepare(query) + if err == nil { + select { + default: + case <-ctx.Done(): + si.Close() + return nil, ctx.Err() + } + } + return si, err +} + +func ctxDriverExec(ctx context.Context, execerCtx driver.ExecerContext, execer driver.Execer, query string, nvdargs []driver.NamedValue) (driver.Result, error) { + if execerCtx != nil { + return execerCtx.ExecContext(ctx, query, nvdargs) + } + dargs, err := namedValueToValue(nvdargs) + if err != nil { + return nil, err + } + + select { + default: + case <-ctx.Done(): + return nil, ctx.Err() + } + return execer.Exec(query, dargs) +} + +func ctxDriverQuery(ctx context.Context, queryerCtx driver.QueryerContext, queryer driver.Queryer, query string, nvdargs []driver.NamedValue) (driver.Rows, error) { + if queryerCtx != nil { + return queryerCtx.QueryContext(ctx, query, nvdargs) + } + dargs, err := namedValueToValue(nvdargs) + if err != nil { + return nil, err + } + + select { + default: + case <-ctx.Done(): + return nil, ctx.Err() + } + return queryer.Query(query, dargs) +} + +func ctxDriverStmtExec(ctx context.Context, si driver.Stmt, nvdargs []driver.NamedValue) (driver.Result, error) { + if siCtx, is := si.(driver.StmtExecContext); is { + return siCtx.ExecContext(ctx, nvdargs) + } + dargs, err := namedValueToValue(nvdargs) + if err != nil { + return nil, err + } + + select { + default: + case <-ctx.Done(): + return nil, ctx.Err() + } + return si.Exec(dargs) +} + +func ctxDriverStmtQuery(ctx context.Context, si driver.Stmt, nvdargs []driver.NamedValue) (driver.Rows, error) { + if siCtx, is := si.(driver.StmtQueryContext); is { + return siCtx.QueryContext(ctx, nvdargs) + } + dargs, err := namedValueToValue(nvdargs) + if err != nil { + return nil, err + } + + select { + default: + case <-ctx.Done(): + return nil, ctx.Err() + } + return si.Query(dargs) +} + +func ctxDriverBegin(ctx context.Context, opts *TxOptions, ci driver.Conn) (driver.Tx, error) { + if ciCtx, is := ci.(driver.ConnBeginTx); is { + dopts := driver.TxOptions{} + if opts != nil { + dopts.Isolation = driver.IsolationLevel(opts.Isolation) + dopts.ReadOnly = opts.ReadOnly + } + return ciCtx.BeginTx(ctx, dopts) + } + + if opts != nil { + // Check the transaction level. If the transaction level is non-default + // then return an error here as the BeginTx driver value is not supported. + if opts.Isolation != LevelDefault { + return nil, errors.New("sql: driver does not support non-default isolation level") + } + + // If a read-only transaction is requested return an error as the + // BeginTx driver value is not supported. + if opts.ReadOnly { + return nil, errors.New("sql: driver does not support read-only transactions") + } + } + + if ctx.Done() == nil { + return ci.Begin() + } + + txi, err := ci.Begin() + if err == nil { + select { + default: + case <-ctx.Done(): + txi.Rollback() + return nil, ctx.Err() + } + } + return txi, err +} + +func namedValueToValue(named []driver.NamedValue) ([]driver.Value, error) { + dargs := make([]driver.Value, len(named)) + for n, param := range named { + if len(param.Name) > 0 { + return nil, errors.New("sql: driver does not support the use of Named Parameters") + } + dargs[n] = param.Value + } + return dargs, nil +} diff --git a/go/src/database/sql/doc.txt b/go/src/database/sql/doc.txt new file mode 100644 index 0000000000000000000000000000000000000000..9aa9b2bf4033952161f19a71e1174732ed28fd30 --- /dev/null +++ b/go/src/database/sql/doc.txt @@ -0,0 +1,46 @@ +Goals of the sql and sql/driver packages: + +* Provide a generic database API for a variety of SQL or SQL-like + databases. There currently exist Go libraries for SQLite, MySQL, + and Postgres, but all with a very different feel, and often + a non-Go-like feel. + +* Feel like Go. + +* Care mostly about the common cases. Common SQL should be portable. + SQL edge cases or db-specific extensions can be detected and + conditionally used by the application. It is a non-goal to care + about every particular db's extension or quirk. + +* Separate out the basic implementation of a database driver + (implementing the sql/driver interfaces) vs the implementation + of all the user-level types and convenience methods. + In a nutshell: + + User Code ---> sql package (concrete types) ---> sql/driver (interfaces) + Database Driver -> sql (to register) + sql/driver (implement interfaces) + +* Make type casting/conversions consistent between all drivers. To + achieve this, most of the conversions are done in the sql package, + not in each driver. The drivers then only have to deal with a + smaller set of types. + +* Be flexible with type conversions, but be paranoid about silent + truncation or other loss of precision. + +* Handle concurrency well. Users shouldn't need to care about the + database's per-connection thread safety issues (or lack thereof), + and shouldn't have to maintain their own free pools of connections. + The 'sql' package should deal with that bookkeeping as needed. Given + an *sql.DB, it should be possible to share that instance between + multiple goroutines, without any extra synchronization. + +* Push complexity, where necessary, down into the sql+driver packages, + rather than exposing it to users. Said otherwise, the sql package + should expose an ideal database that's not finicky about how it's + accessed, even if that's not true. + +* Provide optional interfaces in sql/driver for drivers to implement + for special cases or fastpaths. But the only party that knows about + those is the sql package. To user code, some stuff just might start + working or start working slightly faster. diff --git a/go/src/database/sql/driver/driver.go b/go/src/database/sql/driver/driver.go new file mode 100644 index 0000000000000000000000000000000000000000..d0892e80fc28d5e54275751e2861306f926698bd --- /dev/null +++ b/go/src/database/sql/driver/driver.go @@ -0,0 +1,553 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package driver defines interfaces to be implemented by database +// drivers as used by package sql. +// +// Most code should use the [database/sql] package. +// +// The driver interface has evolved over time. Drivers should implement +// [Connector] and [DriverContext] interfaces. +// The Connector.Connect and Driver.Open methods should never return [ErrBadConn]. +// [ErrBadConn] should only be returned from [Validator], [SessionResetter], or +// a query method if the connection is already in an invalid (e.g. closed) state. +// +// All [Conn] implementations should implement the following interfaces: +// [Pinger], [SessionResetter], and [Validator]. +// +// If named parameters or context are supported, the driver's [Conn] should implement: +// [ExecerContext], [QueryerContext], [ConnPrepareContext], and [ConnBeginTx]. +// +// To support custom data types, implement [NamedValueChecker]. [NamedValueChecker] +// also allows queries to accept per-query options as a parameter by returning +// [ErrRemoveArgument] from CheckNamedValue. +// +// If multiple result sets are supported, [Rows] should implement [RowsNextResultSet]. +// If the driver knows how to describe the types present in the returned result +// it should implement the following interfaces: [RowsColumnTypeScanType], +// [RowsColumnTypeDatabaseTypeName], [RowsColumnTypeLength], [RowsColumnTypeNullable], +// and [RowsColumnTypePrecisionScale]. A given row value may also return a [Rows] +// type, which may represent a database cursor value. +// +// If a [Conn] implements [Validator], then the IsValid method is called +// before returning the connection to the connection pool. If an entry in the +// connection pool implements [SessionResetter], then ResetSession +// is called before reusing the connection for another query. If a connection is +// never returned to the connection pool but is immediately reused, then +// ResetSession is called prior to reuse but IsValid is not called. +package driver + +import ( + "context" + "errors" + "reflect" +) + +// Value is a value that drivers must be able to handle. +// It is either nil, a type handled by a database driver's [NamedValueChecker] +// interface, or an instance of one of these types: +// +// int64 +// float64 +// bool +// []byte +// string +// time.Time +// +// If the driver supports cursors, a returned Value may also implement the [Rows] interface +// in this package. This is used, for example, when a user selects a cursor +// such as "select cursor(select * from my_table) from dual". If the [Rows] +// from the select is closed, the cursor [Rows] will also be closed. +type Value any + +// NamedValue holds both the value name and value. +type NamedValue struct { + // If the Name is not empty it should be used for the parameter identifier and + // not the ordinal position. + // + // Name will not have a symbol prefix. + Name string + + // Ordinal position of the parameter starting from one and is always set. + Ordinal int + + // Value is the parameter value. + Value Value +} + +// Driver is the interface that must be implemented by a database +// driver. +// +// Database drivers may implement [DriverContext] for access +// to contexts and to parse the name only once for a pool of connections, +// instead of once per connection. +type Driver interface { + // Open returns a new connection to the database. + // The name is a string in a driver-specific format. + // + // Open may return a cached connection (one previously + // closed), but doing so is unnecessary; the sql package + // maintains a pool of idle connections for efficient re-use. + // + // The returned connection is only used by one goroutine at a + // time. + Open(name string) (Conn, error) +} + +// If a [Driver] implements DriverContext, then [database/sql.DB] will call +// OpenConnector to obtain a [Connector] and then invoke +// that [Connector]'s Connect method to obtain each needed connection, +// instead of invoking the [Driver]'s Open method for each connection. +// The two-step sequence allows drivers to parse the name just once +// and also provides access to per-[Conn] contexts. +type DriverContext interface { + // OpenConnector must parse the name in the same format that Driver.Open + // parses the name parameter. + OpenConnector(name string) (Connector, error) +} + +// A Connector represents a driver in a fixed configuration +// and can create any number of equivalent Conns for use +// by multiple goroutines. +// +// A Connector can be passed to [database/sql.OpenDB], to allow drivers +// to implement their own [database/sql.DB] constructors, or returned by +// [DriverContext]'s OpenConnector method, to allow drivers +// access to context and to avoid repeated parsing of driver +// configuration. +// +// If a Connector implements [io.Closer], the [database/sql.DB.Close] +// method will call the Close method and return error (if any). +type Connector interface { + // Connect returns a connection to the database. + // Connect may return a cached connection (one previously + // closed), but doing so is unnecessary; the sql package + // maintains a pool of idle connections for efficient re-use. + // + // The provided context.Context is for dialing purposes only + // (see net.DialContext) and should not be stored or used for + // other purposes. A default timeout should still be used + // when dialing as a connection pool may call Connect + // asynchronously to any query. + // + // The returned connection is only used by one goroutine at a + // time. + Connect(context.Context) (Conn, error) + + // Driver returns the underlying Driver of the Connector, + // mainly to maintain compatibility with the Driver method + // on sql.DB. + Driver() Driver +} + +// ErrSkip may be returned by some optional interfaces' methods to +// indicate at runtime that the fast path is unavailable and the sql +// package should continue as if the optional interface was not +// implemented. ErrSkip is only supported where explicitly +// documented. +var ErrSkip = errors.New("driver: skip fast-path; continue as if unimplemented") + +// ErrBadConn should be returned by a driver to signal to the [database/sql] +// package that a driver.[Conn] is in a bad state (such as the server +// having earlier closed the connection) and the [database/sql] package should +// retry on a new connection. +// +// To prevent duplicate operations, ErrBadConn should NOT be returned +// if there's a possibility that the database server might have +// performed the operation. Even if the server sends back an error, +// you shouldn't return ErrBadConn. +// +// Errors will be checked using [errors.Is]. An error may +// wrap ErrBadConn or implement the Is(error) bool method. +var ErrBadConn = errors.New("driver: bad connection") + +// Pinger is an optional interface that may be implemented by a [Conn]. +// +// If a [Conn] does not implement Pinger, the [database/sql.DB.Ping] and +// [database/sql.DB.PingContext] will check if there is at least one [Conn] available. +// +// If Conn.Ping returns [ErrBadConn], [database/sql.DB.Ping] and [database/sql.DB.PingContext] will remove +// the [Conn] from pool. +type Pinger interface { + Ping(ctx context.Context) error +} + +// Execer is an optional interface that may be implemented by a [Conn]. +// +// If a [Conn] implements neither [ExecerContext] nor [Execer], +// the [database/sql.DB.Exec] will first prepare a query, execute the statement, +// and then close the statement. +// +// Exec may return [ErrSkip]. +// +// Deprecated: Drivers should implement [ExecerContext] instead. +type Execer interface { + Exec(query string, args []Value) (Result, error) +} + +// ExecerContext is an optional interface that may be implemented by a [Conn]. +// +// If a [Conn] does not implement [ExecerContext], the [database/sql.DB.Exec] +// will fall back to [Execer]; if the Conn does not implement Execer either, +// [database/sql.DB.Exec] will first prepare a query, execute the statement, and then +// close the statement. +// +// ExecContext may return [ErrSkip]. +// +// ExecContext must honor the context timeout and return when the context is canceled. +type ExecerContext interface { + ExecContext(ctx context.Context, query string, args []NamedValue) (Result, error) +} + +// Queryer is an optional interface that may be implemented by a [Conn]. +// +// If a [Conn] implements neither [QueryerContext] nor [Queryer], +// the [database/sql.DB.Query] will first prepare a query, execute the statement, +// and then close the statement. +// +// Query may return [ErrSkip]. +// +// Deprecated: Drivers should implement [QueryerContext] instead. +type Queryer interface { + Query(query string, args []Value) (Rows, error) +} + +// QueryerContext is an optional interface that may be implemented by a [Conn]. +// +// If a [Conn] does not implement QueryerContext, the [database/sql.DB.Query] +// will fall back to [Queryer]; if the [Conn] does not implement [Queryer] either, +// [database/sql.DB.Query] will first prepare a query, execute the statement, and then +// close the statement. +// +// QueryContext may return [ErrSkip]. +// +// QueryContext must honor the context timeout and return when the context is canceled. +type QueryerContext interface { + QueryContext(ctx context.Context, query string, args []NamedValue) (Rows, error) +} + +// Conn is a connection to a database. It is not used concurrently +// by multiple goroutines. +// +// Conn is assumed to be stateful. +type Conn interface { + // Prepare returns a prepared statement, bound to this connection. + Prepare(query string) (Stmt, error) + + // Close invalidates and potentially stops any current + // prepared statements and transactions, marking this + // connection as no longer in use. + // + // Because the sql package maintains a free pool of + // connections and only calls Close when there's a surplus of + // idle connections, it shouldn't be necessary for drivers to + // do their own connection caching. + // + // Drivers must ensure all network calls made by Close + // do not block indefinitely (e.g. apply a timeout). + Close() error + + // Begin starts and returns a new transaction. + // + // Deprecated: Drivers should implement ConnBeginTx instead (or additionally). + Begin() (Tx, error) +} + +// ConnPrepareContext enhances the [Conn] interface with context. +type ConnPrepareContext interface { + // PrepareContext returns a prepared statement, bound to this connection. + // context is for the preparation of the statement, + // it must not store the context within the statement itself. + PrepareContext(ctx context.Context, query string) (Stmt, error) +} + +// IsolationLevel is the transaction isolation level stored in [TxOptions]. +// +// This type should be considered identical to [database/sql.IsolationLevel] along +// with any values defined on it. +type IsolationLevel int + +// TxOptions holds the transaction options. +// +// This type should be considered identical to [database/sql.TxOptions]. +type TxOptions struct { + Isolation IsolationLevel + ReadOnly bool +} + +// ConnBeginTx enhances the [Conn] interface with context and [TxOptions]. +type ConnBeginTx interface { + // BeginTx starts and returns a new transaction. + // If the context is canceled by the user the sql package will + // call Tx.Rollback before discarding and closing the connection. + // + // This must check opts.Isolation to determine if there is a set + // isolation level. If the driver does not support a non-default + // level and one is set or if there is a non-default isolation level + // that is not supported, an error must be returned. + // + // This must also check opts.ReadOnly to determine if the read-only + // value is true to either set the read-only transaction property if supported + // or return an error if it is not supported. + BeginTx(ctx context.Context, opts TxOptions) (Tx, error) +} + +// SessionResetter may be implemented by [Conn] to allow drivers to reset the +// session state associated with the connection and to signal a bad connection. +type SessionResetter interface { + // ResetSession is called prior to executing a query on the connection + // if the connection has been used before. If the driver returns ErrBadConn + // the connection is discarded. + ResetSession(ctx context.Context) error +} + +// Validator may be implemented by [Conn] to allow drivers to +// signal if a connection is valid or if it should be discarded. +// +// If implemented, drivers may return the underlying error from queries, +// even if the connection should be discarded by the connection pool. +type Validator interface { + // IsValid is called prior to placing the connection into the + // connection pool. The connection will be discarded if false is returned. + IsValid() bool +} + +// Result is the result of a query execution. +type Result interface { + // LastInsertId returns the database's auto-generated ID + // after, for example, an INSERT into a table with primary + // key. + LastInsertId() (int64, error) + + // RowsAffected returns the number of rows affected by the + // query. + RowsAffected() (int64, error) +} + +// Stmt is a prepared statement. It is bound to a [Conn] and not +// used by multiple goroutines concurrently. +type Stmt interface { + // Close closes the statement. + // + // As of Go 1.1, a Stmt will not be closed if it's in use + // by any queries. + // + // Drivers must ensure all network calls made by Close + // do not block indefinitely (e.g. apply a timeout). + Close() error + + // NumInput returns the number of placeholder parameters. + // + // If NumInput returns >= 0, the sql package will sanity check + // argument counts from callers and return errors to the caller + // before the statement's Exec or Query methods are called. + // + // NumInput may also return -1, if the driver doesn't know + // its number of placeholders. In that case, the sql package + // will not sanity check Exec or Query argument counts. + NumInput() int + + // Exec executes a query that doesn't return rows, such + // as an INSERT or UPDATE. + // + // Deprecated: Drivers should implement StmtExecContext instead (or additionally). + Exec(args []Value) (Result, error) + + // Query executes a query that may return rows, such as a + // SELECT. + // + // Deprecated: Drivers should implement StmtQueryContext instead (or additionally). + Query(args []Value) (Rows, error) +} + +// StmtExecContext enhances the [Stmt] interface by providing Exec with context. +type StmtExecContext interface { + // ExecContext executes a query that doesn't return rows, such + // as an INSERT or UPDATE. + // + // ExecContext must honor the context timeout and return when it is canceled. + ExecContext(ctx context.Context, args []NamedValue) (Result, error) +} + +// StmtQueryContext enhances the [Stmt] interface by providing Query with context. +type StmtQueryContext interface { + // QueryContext executes a query that may return rows, such as a + // SELECT. + // + // QueryContext must honor the context timeout and return when it is canceled. + QueryContext(ctx context.Context, args []NamedValue) (Rows, error) +} + +// ErrRemoveArgument may be returned from [NamedValueChecker] to instruct the +// [database/sql] package to not pass the argument to the driver query interface. +// Return when accepting query specific options or structures that aren't +// SQL query arguments. +var ErrRemoveArgument = errors.New("driver: remove argument from query") + +// NamedValueChecker may be optionally implemented by [Conn] or [Stmt]. It provides +// the driver more control to handle Go and database types beyond the default +// [Value] types allowed. +// +// The [database/sql] package checks for value checkers in the following order, +// stopping at the first found match: Stmt.NamedValueChecker, Conn.NamedValueChecker, +// Stmt.ColumnConverter, [DefaultParameterConverter]. +// +// If CheckNamedValue returns [ErrRemoveArgument], the [NamedValue] will not be included in +// the final query arguments. This may be used to pass special options to +// the query itself. +// +// If [ErrSkip] is returned the column converter error checking +// path is used for the argument. Drivers may wish to return [ErrSkip] after +// they have exhausted their own special cases. +type NamedValueChecker interface { + // CheckNamedValue is called before passing arguments to the driver + // and is called in place of any ColumnConverter. CheckNamedValue must do type + // validation and conversion as appropriate for the driver. + CheckNamedValue(*NamedValue) error +} + +// ColumnConverter may be optionally implemented by [Stmt] if the +// statement is aware of its own columns' types and can convert from +// any type to a driver [Value]. +// +// Deprecated: Drivers should implement [NamedValueChecker]. +type ColumnConverter interface { + // ColumnConverter returns a ValueConverter for the provided + // column index. If the type of a specific column isn't known + // or shouldn't be handled specially, [DefaultParameterConverter] + // can be returned. + ColumnConverter(idx int) ValueConverter +} + +// Rows is an iterator over an executed query's results. +type Rows interface { + // Columns returns the names of the columns. The number of + // columns of the result is inferred from the length of the + // slice. If a particular column name isn't known, an empty + // string should be returned for that entry. + Columns() []string + + // Close closes the rows iterator. + Close() error + + // Next is called to populate the next row of data into + // the provided slice. The provided slice will be the same + // size as the Columns() are wide. + // + // Next should return io.EOF when there are no more rows. + // + // The dest should not be written to outside of Next. Care + // should be taken when closing Rows not to modify + // a buffer held in dest. + Next(dest []Value) error +} + +// RowsNextResultSet extends the [Rows] interface by providing a way to signal +// the driver to advance to the next result set. +type RowsNextResultSet interface { + Rows + + // HasNextResultSet is called at the end of the current result set and + // reports whether there is another result set after the current one. + HasNextResultSet() bool + + // NextResultSet advances the driver to the next result set even + // if there are remaining rows in the current result set. + // + // NextResultSet should return io.EOF when there are no more result sets. + NextResultSet() error +} + +// RowsColumnTypeScanType may be implemented by [Rows]. It should return +// the value type that can be used to scan types into. For example, the database +// column type "bigint" this should return "[reflect.TypeOf](int64(0))". +type RowsColumnTypeScanType interface { + Rows + ColumnTypeScanType(index int) reflect.Type +} + +// RowsColumnTypeDatabaseTypeName may be implemented by [Rows]. It should return the +// database system type name without the length. Type names should be uppercase. +// Examples of returned types: "VARCHAR", "NVARCHAR", "VARCHAR2", "CHAR", "TEXT", +// "DECIMAL", "SMALLINT", "INT", "BIGINT", "BOOL", "[]BIGINT", "JSONB", "XML", +// "TIMESTAMP". +type RowsColumnTypeDatabaseTypeName interface { + Rows + ColumnTypeDatabaseTypeName(index int) string +} + +// RowsColumnTypeLength may be implemented by [Rows]. It should return the length +// of the column type if the column is a variable length type. If the column is +// not a variable length type ok should return false. +// If length is not limited other than system limits, it should return [math.MaxInt64]. +// The following are examples of returned values for various types: +// +// TEXT (math.MaxInt64, true) +// varchar(10) (10, true) +// nvarchar(10) (10, true) +// decimal (0, false) +// int (0, false) +// bytea(30) (30, true) +type RowsColumnTypeLength interface { + Rows + ColumnTypeLength(index int) (length int64, ok bool) +} + +// RowsColumnTypeNullable may be implemented by [Rows]. The nullable value should +// be true if it is known the column may be null, or false if the column is known +// to be not nullable. +// If the column nullability is unknown, ok should be false. +type RowsColumnTypeNullable interface { + Rows + ColumnTypeNullable(index int) (nullable, ok bool) +} + +// RowsColumnTypePrecisionScale may be implemented by [Rows]. It should return +// the precision and scale for decimal types. If not applicable, ok should be false. +// The following are examples of returned values for various types: +// +// decimal(38, 4) (38, 4, true) +// int (0, 0, false) +// decimal (math.MaxInt64, math.MaxInt64, true) +type RowsColumnTypePrecisionScale interface { + Rows + ColumnTypePrecisionScale(index int) (precision, scale int64, ok bool) +} + +// Tx is a transaction. +type Tx interface { + Commit() error + Rollback() error +} + +// RowsAffected implements [Result] for an INSERT or UPDATE operation +// which mutates a number of rows. +type RowsAffected int64 + +var _ Result = RowsAffected(0) + +func (RowsAffected) LastInsertId() (int64, error) { + return 0, errors.New("LastInsertId is not supported by this driver") +} + +func (v RowsAffected) RowsAffected() (int64, error) { + return int64(v), nil +} + +// ResultNoRows is a pre-defined [Result] for drivers to return when a DDL +// command (such as a CREATE TABLE) succeeds. It returns an error for both +// LastInsertId and [RowsAffected]. +var ResultNoRows noRows + +type noRows struct{} + +var _ Result = noRows{} + +func (noRows) LastInsertId() (int64, error) { + return 0, errors.New("no LastInsertId available after DDL statement") +} + +func (noRows) RowsAffected() (int64, error) { + return 0, errors.New("no RowsAffected available after DDL statement") +} diff --git a/go/src/database/sql/driver/types.go b/go/src/database/sql/driver/types.go new file mode 100644 index 0000000000000000000000000000000000000000..a322f85277c6d45abefa25c69cb54bcdaa651c44 --- /dev/null +++ b/go/src/database/sql/driver/types.go @@ -0,0 +1,302 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package driver + +import ( + "fmt" + "reflect" + "strconv" + "time" +) + +// ValueConverter is the interface providing the ConvertValue method. +// +// Various implementations of ValueConverter are provided by the +// driver package to provide consistent implementations of conversions +// between drivers. The ValueConverters have several uses: +// +// - converting from the [Value] types as provided by the sql package +// into a database table's specific column type and making sure it +// fits, such as making sure a particular int64 fits in a +// table's uint16 column. +// +// - converting a value as given from the database into one of the +// driver [Value] types. +// +// - by the [database/sql] package, for converting from a driver's [Value] type +// to a user's type in a scan. +type ValueConverter interface { + // ConvertValue converts a value to a driver Value. + ConvertValue(v any) (Value, error) +} + +// Valuer is the interface providing the Value method. +// +// Errors returned by the [Value] method are wrapped by the database/sql package. +// This allows callers to use [errors.Is] for precise error handling after operations +// like [database/sql.Query], [database/sql.Exec], or [database/sql.QueryRow]. +// +// Types implementing Valuer interface are able to convert +// themselves to a driver [Value]. +type Valuer interface { + // Value returns a driver Value. + // Value must not panic. + Value() (Value, error) +} + +// Bool is a [ValueConverter] that converts input values to bool. +// +// The conversion rules are: +// - booleans are returned unchanged +// - for integer types, +// 1 is true +// 0 is false, +// other integers are an error +// - for strings and []byte, same rules as [strconv.ParseBool] +// - all other types are an error +var Bool boolType + +type boolType struct{} + +var _ ValueConverter = boolType{} + +func (boolType) String() string { return "Bool" } + +func (boolType) ConvertValue(src any) (Value, error) { + switch s := src.(type) { + case bool: + return s, nil + case string: + b, err := strconv.ParseBool(s) + if err != nil { + return nil, fmt.Errorf("sql/driver: couldn't convert %q into type bool", s) + } + return b, nil + case []byte: + b, err := strconv.ParseBool(string(s)) + if err != nil { + return nil, fmt.Errorf("sql/driver: couldn't convert %q into type bool", s) + } + return b, nil + } + + sv := reflect.ValueOf(src) + switch sv.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + iv := sv.Int() + if iv == 1 || iv == 0 { + return iv == 1, nil + } + return nil, fmt.Errorf("sql/driver: couldn't convert %d into type bool", iv) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + uv := sv.Uint() + if uv == 1 || uv == 0 { + return uv == 1, nil + } + return nil, fmt.Errorf("sql/driver: couldn't convert %d into type bool", uv) + } + + return nil, fmt.Errorf("sql/driver: couldn't convert %v (%T) into type bool", src, src) +} + +// Int32 is a [ValueConverter] that converts input values to int64, +// respecting the limits of an int32 value. +var Int32 int32Type + +type int32Type struct{} + +var _ ValueConverter = int32Type{} + +func (int32Type) ConvertValue(v any) (Value, error) { + rv := reflect.ValueOf(v) + switch rv.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + i64 := rv.Int() + if i64 > (1<<31)-1 || i64 < -(1<<31) { + return nil, fmt.Errorf("sql/driver: value %d overflows int32", v) + } + return i64, nil + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + u64 := rv.Uint() + if u64 > (1<<31)-1 { + return nil, fmt.Errorf("sql/driver: value %d overflows int32", v) + } + return int64(u64), nil + case reflect.String: + i, err := strconv.Atoi(rv.String()) + if err != nil { + return nil, fmt.Errorf("sql/driver: value %q can't be converted to int32", v) + } + return int64(i), nil + } + return nil, fmt.Errorf("sql/driver: unsupported value %v (type %T) converting to int32", v, v) +} + +// String is a [ValueConverter] that converts its input to a string. +// If the value is already a string or []byte, it's unchanged. +// If the value is of another type, conversion to string is done +// with fmt.Sprintf("%v", v). +var String stringType + +type stringType struct{} + +func (stringType) ConvertValue(v any) (Value, error) { + switch v.(type) { + case string, []byte: + return v, nil + } + return fmt.Sprintf("%v", v), nil +} + +// Null is a type that implements [ValueConverter] by allowing nil +// values but otherwise delegating to another [ValueConverter]. +type Null struct { + Converter ValueConverter +} + +func (n Null) ConvertValue(v any) (Value, error) { + if v == nil { + return nil, nil + } + return n.Converter.ConvertValue(v) +} + +// NotNull is a type that implements [ValueConverter] by disallowing nil +// values but otherwise delegating to another [ValueConverter]. +type NotNull struct { + Converter ValueConverter +} + +func (n NotNull) ConvertValue(v any) (Value, error) { + if v == nil { + return nil, fmt.Errorf("nil value not allowed") + } + return n.Converter.ConvertValue(v) +} + +// IsValue reports whether v is a valid [Value] parameter type. +func IsValue(v any) bool { + if v == nil { + return true + } + switch v.(type) { + case []byte, bool, float64, int64, string, time.Time: + return true + case decimalDecompose: + return true + } + return false +} + +// IsScanValue is equivalent to [IsValue]. +// It exists for compatibility. +func IsScanValue(v any) bool { + return IsValue(v) +} + +// DefaultParameterConverter is the default implementation of +// [ValueConverter] that's used when a [Stmt] doesn't implement +// [ColumnConverter]. +// +// DefaultParameterConverter returns its argument directly if +// IsValue(arg). Otherwise, if the argument implements [Valuer], its +// Value method is used to return a [Value]. As a fallback, the provided +// argument's underlying type is used to convert it to a [Value]: +// underlying integer types are converted to int64, floats to float64, +// bool, string, and []byte to themselves. If the argument is a nil +// pointer, defaultConverter.ConvertValue returns a nil [Value]. +// If the argument is a non-nil pointer, it is dereferenced and +// defaultConverter.ConvertValue is called recursively. Other types +// are an error. +var DefaultParameterConverter defaultConverter + +type defaultConverter struct{} + +var _ ValueConverter = defaultConverter{} + +var valuerReflectType = reflect.TypeFor[Valuer]() + +// callValuerValue returns vr.Value(), with one exception: +// If vr.Value is an auto-generated method on a pointer type and the +// pointer is nil, it would panic at runtime in the panicwrap +// method. Treat it like nil instead. +// Issue 8415. +// +// This is so people can implement driver.Value on value types and +// still use nil pointers to those types to mean nil/NULL, just like +// string/*string. +// +// This function is mirrored in the database/sql package. +func callValuerValue(vr Valuer) (v Value, err error) { + if rv := reflect.ValueOf(vr); rv.Kind() == reflect.Pointer && + rv.IsNil() && + rv.Type().Elem().Implements(valuerReflectType) { + return nil, nil + } + return vr.Value() +} + +func (defaultConverter) ConvertValue(v any) (Value, error) { + if IsValue(v) { + return v, nil + } + + switch vr := v.(type) { + case Valuer: + sv, err := callValuerValue(vr) + if err != nil { + return nil, err + } + if !IsValue(sv) { + return nil, fmt.Errorf("non-Value type %T returned from Value", sv) + } + return sv, nil + + // For now, continue to prefer the Valuer interface over the decimal decompose interface. + case decimalDecompose: + return vr, nil + } + + rv := reflect.ValueOf(v) + switch rv.Kind() { + case reflect.Pointer: + // indirect pointers + if rv.IsNil() { + return nil, nil + } else { + return defaultConverter{}.ConvertValue(rv.Elem().Interface()) + } + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return rv.Int(), nil + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32: + return int64(rv.Uint()), nil + case reflect.Uint64: + u64 := rv.Uint() + if u64 >= 1<<63 { + return nil, fmt.Errorf("uint64 values with high bit set are not supported") + } + return int64(u64), nil + case reflect.Float32, reflect.Float64: + return rv.Float(), nil + case reflect.Bool: + return rv.Bool(), nil + case reflect.Slice: + ek := rv.Type().Elem().Kind() + if ek == reflect.Uint8 { + return rv.Bytes(), nil + } + return nil, fmt.Errorf("unsupported type %T, a slice of %s", v, ek) + case reflect.String: + return rv.String(), nil + } + return nil, fmt.Errorf("unsupported type %T, a %s", v, rv.Kind()) +} + +type decimalDecompose interface { + // Decompose returns the internal decimal state into parts. + // If the provided buf has sufficient capacity, buf may be returned as the coefficient with + // the value set and length set as appropriate. + Decompose(buf []byte) (form byte, negative bool, coefficient []byte, exponent int32) +} diff --git a/go/src/database/sql/driver/types_test.go b/go/src/database/sql/driver/types_test.go new file mode 100644 index 0000000000000000000000000000000000000000..3d0cb23bc846a9a79cf6a51a277836895ff9e5ea --- /dev/null +++ b/go/src/database/sql/driver/types_test.go @@ -0,0 +1,96 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package driver + +import ( + "reflect" + "testing" + "time" +) + +type valueConverterTest struct { + c ValueConverter + in any + out any + err string +} + +var now = time.Now() +var answer int64 = 42 + +type ( + i int64 + f float64 + b bool + bs []byte + s string + t time.Time + is []int +) + +var valueConverterTests = []valueConverterTest{ + {Bool, "true", true, ""}, + {Bool, "True", true, ""}, + {Bool, []byte("t"), true, ""}, + {Bool, true, true, ""}, + {Bool, "1", true, ""}, + {Bool, 1, true, ""}, + {Bool, int64(1), true, ""}, + {Bool, uint16(1), true, ""}, + {Bool, "false", false, ""}, + {Bool, false, false, ""}, + {Bool, "0", false, ""}, + {Bool, 0, false, ""}, + {Bool, int64(0), false, ""}, + {Bool, uint16(0), false, ""}, + {c: Bool, in: "foo", err: "sql/driver: couldn't convert \"foo\" into type bool"}, + {c: Bool, in: 2, err: "sql/driver: couldn't convert 2 into type bool"}, + {DefaultParameterConverter, now, now, ""}, + {DefaultParameterConverter, (*int64)(nil), nil, ""}, + {DefaultParameterConverter, &answer, answer, ""}, + {DefaultParameterConverter, &now, now, ""}, + {DefaultParameterConverter, i(9), int64(9), ""}, + {DefaultParameterConverter, f(0.1), float64(0.1), ""}, + {DefaultParameterConverter, b(true), true, ""}, + {DefaultParameterConverter, bs{1}, []byte{1}, ""}, + {DefaultParameterConverter, s("a"), "a", ""}, + {DefaultParameterConverter, t(now), nil, "unsupported type driver.t, a struct"}, + {DefaultParameterConverter, is{1}, nil, "unsupported type driver.is, a slice of int"}, + {DefaultParameterConverter, dec{exponent: -6}, dec{exponent: -6}, ""}, +} + +func TestValueConverters(t *testing.T) { + for i, tt := range valueConverterTests { + out, err := tt.c.ConvertValue(tt.in) + goterr := "" + if err != nil { + goterr = err.Error() + } + if goterr != tt.err { + t.Errorf("test %d: %T(%T(%v)) error = %q; want error = %q", + i, tt.c, tt.in, tt.in, goterr, tt.err) + } + if tt.err != "" { + continue + } + if !reflect.DeepEqual(out, tt.out) { + t.Errorf("test %d: %T(%T(%v)) = %v (%T); want %v (%T)", + i, tt.c, tt.in, tt.in, out, out, tt.out, tt.out) + } + } +} + +type dec struct { + form byte + neg bool + coefficient [16]byte + exponent int32 +} + +func (d dec) Decompose(buf []byte) (form byte, negative bool, coefficient []byte, exponent int32) { + coef := make([]byte, 16) + copy(coef, d.coefficient[:]) + return d.form, d.neg, coef, d.exponent +} diff --git a/go/src/database/sql/example_cli_test.go b/go/src/database/sql/example_cli_test.go new file mode 100644 index 0000000000000000000000000000000000000000..1e297af02272b2e9947074f00d287ba25ad2a0c3 --- /dev/null +++ b/go/src/database/sql/example_cli_test.go @@ -0,0 +1,84 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sql_test + +import ( + "context" + "database/sql" + "flag" + "log" + "os" + "os/signal" + "time" +) + +var pool *sql.DB // Database connection pool. + +func Example_openDBCLI() { + id := flag.Int64("id", 0, "person ID to find") + dsn := flag.String("dsn", os.Getenv("DSN"), "connection data source name") + flag.Parse() + + if len(*dsn) == 0 { + log.Fatal("missing dsn flag") + } + if *id == 0 { + log.Fatal("missing person ID") + } + var err error + + // Opening a driver typically will not attempt to connect to the database. + pool, err = sql.Open("driver-name", *dsn) + if err != nil { + // This will not be a connection error, but a DSN parse error or + // another initialization error. + log.Fatal("unable to use data source name", err) + } + defer pool.Close() + + pool.SetConnMaxLifetime(0) + pool.SetMaxIdleConns(3) + pool.SetMaxOpenConns(3) + + ctx, stop := context.WithCancel(context.Background()) + defer stop() + + appSignal := make(chan os.Signal, 3) + signal.Notify(appSignal, os.Interrupt) + + go func() { + <-appSignal + stop() + }() + + Ping(ctx) + + Query(ctx, *id) +} + +// Ping the database to verify DSN provided by the user is valid and the +// server accessible. If the ping fails exit the program with an error. +func Ping(ctx context.Context) { + ctx, cancel := context.WithTimeout(ctx, 1*time.Second) + defer cancel() + + if err := pool.PingContext(ctx); err != nil { + log.Fatalf("unable to connect to database: %v", err) + } +} + +// Query the database for the information requested and prints the results. +// If the query fails exit the program with an error. +func Query(ctx context.Context, id int64) { + ctx, cancel := context.WithTimeout(ctx, 5*time.Second) + defer cancel() + + var name string + err := pool.QueryRowContext(ctx, "select p.name from people as p where p.id = :id;", sql.Named("id", id)).Scan(&name) + if err != nil { + log.Fatal("unable to execute search query", err) + } + log.Println("name=", name) +} diff --git a/go/src/database/sql/example_service_test.go b/go/src/database/sql/example_service_test.go new file mode 100644 index 0000000000000000000000000000000000000000..58b254c3e6b5da2e90c6feb9e92a9e957c02f4c1 --- /dev/null +++ b/go/src/database/sql/example_service_test.go @@ -0,0 +1,162 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sql_test + +import ( + "context" + "database/sql" + "encoding/json" + "fmt" + "io" + "log" + "net/http" + "time" +) + +func Example_openDBService() { + // Opening a driver typically will not attempt to connect to the database. + db, err := sql.Open("driver-name", "database=test1") + if err != nil { + // This will not be a connection error, but a DSN parse error or + // another initialization error. + log.Fatal(err) + } + db.SetConnMaxLifetime(0) + db.SetMaxIdleConns(50) + db.SetMaxOpenConns(50) + + s := &Service{db: db} + + http.ListenAndServe(":8080", s) +} + +type Service struct { + db *sql.DB +} + +func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request) { + db := s.db + switch r.URL.Path { + default: + http.Error(w, "not found", http.StatusNotFound) + return + case "/healthz": + ctx, cancel := context.WithTimeout(r.Context(), 1*time.Second) + defer cancel() + + err := s.db.PingContext(ctx) + if err != nil { + http.Error(w, fmt.Sprintf("db down: %v", err), http.StatusFailedDependency) + return + } + w.WriteHeader(http.StatusOK) + return + case "/quick-action": + // This is a short SELECT. Use the request context as the base of + // the context timeout. + ctx, cancel := context.WithTimeout(r.Context(), 3*time.Second) + defer cancel() + + id := 5 + org := 10 + var name string + err := db.QueryRowContext(ctx, ` +select + p.name +from + people as p + join organization as o on p.organization = o.id +where + p.id = :id + and o.id = :org +;`, + sql.Named("id", id), + sql.Named("org", org), + ).Scan(&name) + if err != nil { + if err == sql.ErrNoRows { + http.Error(w, "not found", http.StatusNotFound) + return + } + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + io.WriteString(w, name) + return + case "/long-action": + // This is a long SELECT. Use the request context as the base of + // the context timeout, but give it some time to finish. If + // the client cancels before the query is done the query will also + // be canceled. + ctx, cancel := context.WithTimeout(r.Context(), 60*time.Second) + defer cancel() + + var names []string + rows, err := db.QueryContext(ctx, "select p.name from people as p where p.active = true;") + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + + for rows.Next() { + var name string + err = rows.Scan(&name) + if err != nil { + break + } + names = append(names, name) + } + // Check for errors during rows "Close". + // This may be more important if multiple statements are executed + // in a single batch and rows were written as well as read. + if closeErr := rows.Close(); closeErr != nil { + http.Error(w, closeErr.Error(), http.StatusInternalServerError) + return + } + + // Check for row scan error. + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + + // Check for errors during row iteration. + if err = rows.Err(); err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + + json.NewEncoder(w).Encode(names) + return + case "/async-action": + // This action has side effects that we want to preserve + // even if the client cancels the HTTP request part way through. + // For this we do not use the http request context as a base for + // the timeout. + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + + var orderRef = "ABC123" + tx, err := db.BeginTx(ctx, &sql.TxOptions{Isolation: sql.LevelSerializable}) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + _, err = tx.ExecContext(ctx, "stored_proc_name", orderRef) + + if err != nil { + tx.Rollback() + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + err = tx.Commit() + if err != nil { + http.Error(w, "action in unknown state, check state before attempting again", http.StatusInternalServerError) + return + } + w.WriteHeader(http.StatusOK) + return + } +} diff --git a/go/src/database/sql/example_test.go b/go/src/database/sql/example_test.go new file mode 100644 index 0000000000000000000000000000000000000000..aafb0e3ad753c0ff0d50ae80c423c63dd8c1a851 --- /dev/null +++ b/go/src/database/sql/example_test.go @@ -0,0 +1,369 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sql_test + +import ( + "context" + "database/sql" + "fmt" + "log" + "strings" + "time" +) + +var ( + ctx context.Context + db *sql.DB +) + +func ExampleDB_QueryContext() { + age := 27 + rows, err := db.QueryContext(ctx, "SELECT name FROM users WHERE age=?", age) + if err != nil { + log.Fatal(err) + } + defer rows.Close() + names := make([]string, 0) + + for rows.Next() { + var name string + if err := rows.Scan(&name); err != nil { + // Check for a scan error. + // Query rows will be closed with defer. + log.Fatal(err) + } + names = append(names, name) + } + // If the database is being written to ensure to check for Close + // errors that may be returned from the driver. The query may + // encounter an auto-commit error and be forced to rollback changes. + rerr := rows.Close() + if rerr != nil { + log.Fatal(rerr) + } + + // Rows.Err will report the last error encountered by Rows.Scan. + if err := rows.Err(); err != nil { + log.Fatal(err) + } + fmt.Printf("%s are %d years old", strings.Join(names, ", "), age) +} + +func ExampleDB_QueryRowContext() { + id := 123 + var username string + var created time.Time + err := db.QueryRowContext(ctx, "SELECT username, created_at FROM users WHERE id=?", id).Scan(&username, &created) + switch { + case err == sql.ErrNoRows: + log.Printf("no user with id %d\n", id) + case err != nil: + log.Fatalf("query error: %v\n", err) + default: + log.Printf("username is %q, account created on %s\n", username, created) + } +} + +func ExampleDB_ExecContext() { + id := 47 + result, err := db.ExecContext(ctx, "UPDATE balances SET balance = balance + 10 WHERE user_id = ?", id) + if err != nil { + log.Fatal(err) + } + rows, err := result.RowsAffected() + if err != nil { + log.Fatal(err) + } + if rows != 1 { + log.Fatalf("expected to affect 1 row, affected %d", rows) + } +} + +func ExampleDB_Query_multipleResultSets() { + age := 27 + q := ` +create temp table uid (id bigint); -- Create temp table for queries. +insert into uid +select id from users where age < ?; -- Populate temp table. + +-- First result set. +select + users.id, name +from + users + join uid on users.id = uid.id +; + +-- Second result set. +select + ur.user, ur.role +from + user_roles as ur + join uid on uid.id = ur.user +; + ` + rows, err := db.Query(q, age) + if err != nil { + log.Fatal(err) + } + defer rows.Close() + + for rows.Next() { + var ( + id int64 + name string + ) + if err := rows.Scan(&id, &name); err != nil { + log.Fatal(err) + } + log.Printf("id %d name is %s\n", id, name) + } + if !rows.NextResultSet() { + log.Fatalf("expected more result sets: %v", rows.Err()) + } + var roleMap = map[int64]string{ + 1: "user", + 2: "admin", + 3: "gopher", + } + for rows.Next() { + var ( + id int64 + role int64 + ) + if err := rows.Scan(&id, &role); err != nil { + log.Fatal(err) + } + log.Printf("id %d has role %s\n", id, roleMap[role]) + } + if err := rows.Err(); err != nil { + log.Fatal(err) + } +} + +func ExampleDB_PingContext() { + // Ping and PingContext may be used to determine if communication with + // the database server is still possible. + // + // When used in a command line application Ping may be used to establish + // that further queries are possible; that the provided DSN is valid. + // + // When used in long running service Ping may be part of the health + // checking system. + + ctx, cancel := context.WithTimeout(ctx, 1*time.Second) + defer cancel() + + status := "up" + if err := db.PingContext(ctx); err != nil { + status = "down" + } + log.Println(status) +} + +func ExampleDB_Prepare() { + projects := []struct { + mascot string + release int + }{ + {"tux", 1991}, + {"duke", 1996}, + {"gopher", 2009}, + {"moby dock", 2013}, + } + + stmt, err := db.Prepare("INSERT INTO projects(id, mascot, release, category) VALUES( ?, ?, ?, ? )") + if err != nil { + log.Fatal(err) + } + defer stmt.Close() // Prepared statements take up server resources and should be closed after use. + + for id, project := range projects { + if _, err := stmt.Exec(id+1, project.mascot, project.release, "open source"); err != nil { + log.Fatal(err) + } + } +} + +func ExampleTx_Prepare() { + projects := []struct { + mascot string + release int + }{ + {"tux", 1991}, + {"duke", 1996}, + {"gopher", 2009}, + {"moby dock", 2013}, + } + + tx, err := db.Begin() + if err != nil { + log.Fatal(err) + } + defer tx.Rollback() // The rollback will be ignored if the tx has been committed later in the function. + + stmt, err := tx.Prepare("INSERT INTO projects(id, mascot, release, category) VALUES( ?, ?, ?, ? )") + if err != nil { + log.Fatal(err) + } + defer stmt.Close() // Prepared statements take up server resources and should be closed after use. + + for id, project := range projects { + if _, err := stmt.Exec(id+1, project.mascot, project.release, "open source"); err != nil { + log.Fatal(err) + } + } + if err := tx.Commit(); err != nil { + log.Fatal(err) + } +} + +func ExampleDB_BeginTx() { + tx, err := db.BeginTx(ctx, &sql.TxOptions{Isolation: sql.LevelSerializable}) + if err != nil { + log.Fatal(err) + } + id := 37 + _, execErr := tx.Exec(`UPDATE users SET status = ? WHERE id = ?`, "paid", id) + if execErr != nil { + _ = tx.Rollback() + log.Fatal(execErr) + } + if err := tx.Commit(); err != nil { + log.Fatal(err) + } +} + +func ExampleConn_ExecContext() { + // A *DB is a pool of connections. Call Conn to reserve a connection for + // exclusive use. + conn, err := db.Conn(ctx) + if err != nil { + log.Fatal(err) + } + defer conn.Close() // Return the connection to the pool. + id := 41 + result, err := conn.ExecContext(ctx, `UPDATE balances SET balance = balance + 10 WHERE user_id = ?;`, id) + if err != nil { + log.Fatal(err) + } + rows, err := result.RowsAffected() + if err != nil { + log.Fatal(err) + } + if rows != 1 { + log.Fatalf("expected single row affected, got %d rows affected", rows) + } +} + +func ExampleTx_ExecContext() { + tx, err := db.BeginTx(ctx, &sql.TxOptions{Isolation: sql.LevelSerializable}) + if err != nil { + log.Fatal(err) + } + id := 37 + _, execErr := tx.ExecContext(ctx, "UPDATE users SET status = ? WHERE id = ?", "paid", id) + if execErr != nil { + if rollbackErr := tx.Rollback(); rollbackErr != nil { + log.Fatalf("update failed: %v, unable to rollback: %v\n", execErr, rollbackErr) + } + log.Fatalf("update failed: %v", execErr) + } + if err := tx.Commit(); err != nil { + log.Fatal(err) + } +} + +func ExampleTx_Rollback() { + tx, err := db.BeginTx(ctx, &sql.TxOptions{Isolation: sql.LevelSerializable}) + if err != nil { + log.Fatal(err) + } + id := 53 + _, err = tx.ExecContext(ctx, "UPDATE drivers SET status = ? WHERE id = ?;", "assigned", id) + if err != nil { + if rollbackErr := tx.Rollback(); rollbackErr != nil { + log.Fatalf("update drivers: unable to rollback: %v", rollbackErr) + } + log.Fatal(err) + } + _, err = tx.ExecContext(ctx, "UPDATE pickups SET driver_id = $1;", id) + if err != nil { + if rollbackErr := tx.Rollback(); rollbackErr != nil { + log.Fatalf("update failed: %v, unable to back: %v", err, rollbackErr) + } + log.Fatal(err) + } + if err := tx.Commit(); err != nil { + log.Fatal(err) + } +} + +func ExampleStmt() { + // In normal use, create one Stmt when your process starts. + stmt, err := db.PrepareContext(ctx, "SELECT username FROM users WHERE id = ?") + if err != nil { + log.Fatal(err) + } + defer stmt.Close() + + // Then reuse it each time you need to issue the query. + id := 43 + var username string + err = stmt.QueryRowContext(ctx, id).Scan(&username) + switch { + case err == sql.ErrNoRows: + log.Fatalf("no user with id %d", id) + case err != nil: + log.Fatal(err) + default: + log.Printf("username is %s\n", username) + } +} + +func ExampleStmt_QueryRowContext() { + // In normal use, create one Stmt when your process starts. + stmt, err := db.PrepareContext(ctx, "SELECT username FROM users WHERE id = ?") + if err != nil { + log.Fatal(err) + } + defer stmt.Close() + + // Then reuse it each time you need to issue the query. + id := 43 + var username string + err = stmt.QueryRowContext(ctx, id).Scan(&username) + switch { + case err == sql.ErrNoRows: + log.Fatalf("no user with id %d", id) + case err != nil: + log.Fatal(err) + default: + log.Printf("username is %s\n", username) + } +} + +func ExampleRows() { + age := 27 + rows, err := db.QueryContext(ctx, "SELECT name FROM users WHERE age=?", age) + if err != nil { + log.Fatal(err) + } + defer rows.Close() + + names := make([]string, 0) + for rows.Next() { + var name string + if err := rows.Scan(&name); err != nil { + log.Fatal(err) + } + names = append(names, name) + } + // Check for errors from iterating over rows. + if err := rows.Err(); err != nil { + log.Fatal(err) + } + log.Printf("%s are %d years old", strings.Join(names, ", "), age) +} diff --git a/go/src/database/sql/fakedb_test.go b/go/src/database/sql/fakedb_test.go new file mode 100644 index 0000000000000000000000000000000000000000..e5f04593033779791de26f2490a57578292cfbdb --- /dev/null +++ b/go/src/database/sql/fakedb_test.go @@ -0,0 +1,1266 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sql + +import ( + "bytes" + "context" + "database/sql/driver" + "errors" + "fmt" + "io" + "reflect" + "slices" + "strconv" + "strings" + "sync" + "testing" + "time" +) + +// fakeDriver is a fake database that implements Go's driver.Driver +// interface, just for testing. +// +// It speaks a query language that's semantically similar to but +// syntactically different and simpler than SQL. The syntax is as +// follows: +// +// WIPE +// CREATE||=,=,... +// where types are: "string", [u]int{8,16,32,64}, "bool" +// INSERT||col=val,col2=val2,col3=? +// SELECT||projectcol1,projectcol2|filtercol=?,filtercol2=? +// SELECT||projectcol1,projectcol2|filtercol=?param1,filtercol2=?param2 +// +// Any of these can be preceded by PANIC||, to cause the +// named method on fakeStmt to panic. +// +// Any of these can be proceeded by WAIT||, to cause the +// named method on fakeStmt to sleep for the specified duration. +// +// Multiple of these can be combined when separated with a semicolon. +// +// When opening a fakeDriver's database, it starts empty with no +// tables. All tables and data are stored in memory only. +type fakeDriver struct { + mu sync.Mutex // guards 3 following fields + openCount int // conn opens + closeCount int // conn closes + waitCh chan struct{} + waitingCh chan struct{} + dbs map[string]*fakeDB +} + +type fakeConnector struct { + name string + + waiter func(context.Context) + closed bool +} + +func (c *fakeConnector) Connect(context.Context) (driver.Conn, error) { + conn, err := fdriver.Open(c.name) + conn.(*fakeConn).waiter = c.waiter + return conn, err +} + +func (c *fakeConnector) Driver() driver.Driver { + return fdriver +} + +func (c *fakeConnector) Close() error { + if c.closed { + return errors.New("fakedb: connector is closed") + } + c.closed = true + return nil +} + +type fakeDriverCtx struct { + fakeDriver +} + +var _ driver.DriverContext = &fakeDriverCtx{} + +func (cc *fakeDriverCtx) OpenConnector(name string) (driver.Connector, error) { + return &fakeConnector{name: name}, nil +} + +type fakeDB struct { + name string + + mu sync.Mutex + tables map[string]*table + badConn bool + allowAny bool +} + +type fakeError struct { + Message string + Wrapped error +} + +func (err fakeError) Error() string { + return err.Message +} + +func (err fakeError) Unwrap() error { + return err.Wrapped +} + +type table struct { + mu sync.Mutex + colname []string + coltype []string + rows []*row +} + +func (t *table) columnIndex(name string) int { + return slices.Index(t.colname, name) +} + +type row struct { + cols []any // must be same size as its table colname + coltype +} + +type memToucher interface { + // touchMem reads & writes some memory, to help find data races. + touchMem() +} + +type fakeConn struct { + db *fakeDB // where to return ourselves to + + currTx *fakeTx + + // Every operation writes to line to enable the race detector + // check for data races. + line int64 + + // Stats for tests: + mu sync.Mutex + stmtsMade int + stmtsClosed int + numPrepare int + + // bad connection tests; see isBad() + bad bool + stickyBad bool + + skipDirtySession bool // tests that use Conn should set this to true. + + // dirtySession tests ResetSession, true if a query has executed + // until ResetSession is called. + dirtySession bool + + // The waiter is called before each query. May be used in place of the "WAIT" + // directive. + waiter func(context.Context) +} + +func (c *fakeConn) touchMem() { + c.line++ +} + +func (c *fakeConn) incrStat(v *int) { + c.mu.Lock() + *v++ + c.mu.Unlock() +} + +type fakeTx struct { + c *fakeConn +} + +type boundCol struct { + Column string + Placeholder string + Ordinal int +} + +type fakeStmt struct { + memToucher + c *fakeConn + q string // just for debugging + + cmd string + table string + panic string + wait time.Duration + + next *fakeStmt // used for returning multiple results. + + closed bool + + colName []string // used by CREATE, INSERT, SELECT (selected columns) + colType []string // used by CREATE + colValue []any // used by INSERT (mix of strings and "?" for bound params) + placeholders int // used by INSERT/SELECT: number of ? params + + whereCol []boundCol // used by SELECT (all placeholders) + + placeholderConverter []driver.ValueConverter // used by INSERT +} + +var fdriver driver.Driver = &fakeDriver{} + +func init() { + Register("test", fdriver) +} + +type Dummy struct { + driver.Driver +} + +func TestDrivers(t *testing.T) { + unregisterAllDrivers() + Register("test", fdriver) + Register("invalid", Dummy{}) + all := Drivers() + if len(all) < 2 || !slices.IsSorted(all) || !slices.Contains(all, "test") || !slices.Contains(all, "invalid") { + t.Fatalf("Drivers = %v, want sorted list with at least [invalid, test]", all) + } +} + +// hook to simulate connection failures +var hookOpenErr struct { + sync.Mutex + fn func() error +} + +func setHookOpenErr(fn func() error) { + hookOpenErr.Lock() + defer hookOpenErr.Unlock() + hookOpenErr.fn = fn +} + +// Supports dsn forms: +// +// +// ; (only currently supported option is `badConn`, +// which causes driver.ErrBadConn to be returned on +// every other conn.Begin()) +func (d *fakeDriver) Open(dsn string) (driver.Conn, error) { + hookOpenErr.Lock() + fn := hookOpenErr.fn + hookOpenErr.Unlock() + if fn != nil { + if err := fn(); err != nil { + return nil, err + } + } + parts := strings.Split(dsn, ";") + if len(parts) < 1 { + return nil, errors.New("fakedb: no database name") + } + name := parts[0] + + db := d.getDB(name) + + d.mu.Lock() + d.openCount++ + d.mu.Unlock() + conn := &fakeConn{db: db} + + if len(parts) >= 2 && parts[1] == "badConn" { + conn.bad = true + } + if d.waitCh != nil { + d.waitingCh <- struct{}{} + <-d.waitCh + d.waitCh = nil + d.waitingCh = nil + } + return conn, nil +} + +func (d *fakeDriver) getDB(name string) *fakeDB { + d.mu.Lock() + defer d.mu.Unlock() + if d.dbs == nil { + d.dbs = make(map[string]*fakeDB) + } + db, ok := d.dbs[name] + if !ok { + db = &fakeDB{name: name} + d.dbs[name] = db + } + return db +} + +func (db *fakeDB) wipe() { + db.mu.Lock() + defer db.mu.Unlock() + db.tables = nil +} + +func (db *fakeDB) createTable(name string, columnNames, columnTypes []string) error { + db.mu.Lock() + defer db.mu.Unlock() + if db.tables == nil { + db.tables = make(map[string]*table) + } + if _, exist := db.tables[name]; exist { + return fmt.Errorf("fakedb: table %q already exists", name) + } + if len(columnNames) != len(columnTypes) { + return fmt.Errorf("fakedb: create table of %q len(names) != len(types): %d vs %d", + name, len(columnNames), len(columnTypes)) + } + db.tables[name] = &table{colname: columnNames, coltype: columnTypes} + return nil +} + +// must be called with db.mu lock held +func (db *fakeDB) table(table string) (*table, bool) { + if db.tables == nil { + return nil, false + } + t, ok := db.tables[table] + return t, ok +} + +func (db *fakeDB) columnType(table, column string) (typ string, ok bool) { + db.mu.Lock() + defer db.mu.Unlock() + t, ok := db.table(table) + if !ok { + return + } + if i := slices.Index(t.colname, column); i != -1 { + return t.coltype[i], true + } + return "", false +} + +func (c *fakeConn) isBad() bool { + if c.stickyBad { + return true + } else if c.bad { + if c.db == nil { + return false + } + // alternate between bad conn and not bad conn + c.db.badConn = !c.db.badConn + return c.db.badConn + } else { + return false + } +} + +func (c *fakeConn) isDirtyAndMark() bool { + if c.skipDirtySession { + return false + } + if c.currTx != nil { + c.dirtySession = true + return false + } + if c.dirtySession { + return true + } + c.dirtySession = true + return false +} + +func (c *fakeConn) Begin() (driver.Tx, error) { + if c.isBad() { + return nil, fakeError{Wrapped: driver.ErrBadConn} + } + if c.currTx != nil { + return nil, errors.New("fakedb: already in a transaction") + } + c.touchMem() + c.currTx = &fakeTx{c: c} + return c.currTx, nil +} + +var hookPostCloseConn struct { + sync.Mutex + fn func(*fakeConn, error) +} + +func setHookpostCloseConn(fn func(*fakeConn, error)) { + hookPostCloseConn.Lock() + defer hookPostCloseConn.Unlock() + hookPostCloseConn.fn = fn +} + +var testStrictClose *testing.T + +// setStrictFakeConnClose sets the t to Errorf on when fakeConn.Close +// fails to close. If nil, the check is disabled. +func setStrictFakeConnClose(t *testing.T) { + testStrictClose = t +} + +func (c *fakeConn) ResetSession(ctx context.Context) error { + c.dirtySession = false + c.currTx = nil + if c.isBad() { + return fakeError{Message: "Reset Session: bad conn", Wrapped: driver.ErrBadConn} + } + return nil +} + +var _ driver.Validator = (*fakeConn)(nil) + +func (c *fakeConn) IsValid() bool { + return !c.isBad() +} + +func (c *fakeConn) Close() (err error) { + drv := fdriver.(*fakeDriver) + defer func() { + if err != nil && testStrictClose != nil { + testStrictClose.Errorf("failed to close a test fakeConn: %v", err) + } + hookPostCloseConn.Lock() + fn := hookPostCloseConn.fn + hookPostCloseConn.Unlock() + if fn != nil { + fn(c, err) + } + if err == nil { + drv.mu.Lock() + drv.closeCount++ + drv.mu.Unlock() + } + }() + c.touchMem() + if c.currTx != nil { + return errors.New("fakedb: can't close fakeConn; in a Transaction") + } + if c.db == nil { + return errors.New("fakedb: can't close fakeConn; already closed") + } + if c.stmtsMade > c.stmtsClosed { + return errors.New("fakedb: can't close; dangling statement(s)") + } + c.db = nil + return nil +} + +func checkSubsetTypes(allowAny bool, args []driver.NamedValue) error { + for _, arg := range args { + switch arg.Value.(type) { + case int64, float64, bool, nil, []byte, string, time.Time: + default: + if !allowAny { + return fmt.Errorf("fakedb: invalid argument ordinal %[1]d: %[2]v, type %[2]T", arg.Ordinal, arg.Value) + } + } + } + return nil +} + +func (c *fakeConn) Exec(query string, args []driver.Value) (driver.Result, error) { + // Ensure that ExecContext is called if available. + panic("ExecContext was not called.") +} + +func (c *fakeConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) { + // This is an optional interface, but it's implemented here + // just to check that all the args are of the proper types. + // ErrSkip is returned so the caller acts as if we didn't + // implement this at all. + err := checkSubsetTypes(c.db.allowAny, args) + if err != nil { + return nil, err + } + return nil, driver.ErrSkip +} + +func (c *fakeConn) Query(query string, args []driver.Value) (driver.Rows, error) { + // Ensure that ExecContext is called if available. + panic("QueryContext was not called.") +} + +func (c *fakeConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) { + // This is an optional interface, but it's implemented here + // just to check that all the args are of the proper types. + // ErrSkip is returned so the caller acts as if we didn't + // implement this at all. + err := checkSubsetTypes(c.db.allowAny, args) + if err != nil { + return nil, err + } + return nil, driver.ErrSkip +} + +func errf(msg string, args ...any) error { + return errors.New("fakedb: " + fmt.Sprintf(msg, args...)) +} + +// parts are table|selectCol1,selectCol2|whereCol=?,whereCol2=? +// (note that where columns must always contain ? marks, +// just a limitation for fakedb) +func (c *fakeConn) prepareSelect(stmt *fakeStmt, parts []string) (*fakeStmt, error) { + if len(parts) != 3 { + stmt.Close() + return nil, errf("invalid SELECT syntax with %d parts; want 3", len(parts)) + } + stmt.table = parts[0] + + stmt.colName = strings.Split(parts[1], ",") + for n, colspec := range strings.Split(parts[2], ",") { + if colspec == "" { + continue + } + nameVal := strings.Split(colspec, "=") + if len(nameVal) != 2 { + stmt.Close() + return nil, errf("SELECT on table %q has invalid column spec of %q (index %d)", stmt.table, colspec, n) + } + column, value := nameVal[0], nameVal[1] + _, ok := c.db.columnType(stmt.table, column) + if !ok { + stmt.Close() + return nil, errf("SELECT on table %q references non-existent column %q", stmt.table, column) + } + if !strings.HasPrefix(value, "?") { + stmt.Close() + return nil, errf("SELECT on table %q has pre-bound value for where column %q; need a question mark", + stmt.table, column) + } + stmt.placeholders++ + stmt.whereCol = append(stmt.whereCol, boundCol{Column: column, Placeholder: value, Ordinal: stmt.placeholders}) + } + return stmt, nil +} + +// parts are table|col=type,col2=type2 +func (c *fakeConn) prepareCreate(stmt *fakeStmt, parts []string) (*fakeStmt, error) { + if len(parts) != 2 { + stmt.Close() + return nil, errf("invalid CREATE syntax with %d parts; want 2", len(parts)) + } + stmt.table = parts[0] + for n, colspec := range strings.Split(parts[1], ",") { + nameType := strings.Split(colspec, "=") + if len(nameType) != 2 { + stmt.Close() + return nil, errf("CREATE table %q has invalid column spec of %q (index %d)", stmt.table, colspec, n) + } + stmt.colName = append(stmt.colName, nameType[0]) + stmt.colType = append(stmt.colType, nameType[1]) + } + return stmt, nil +} + +// parts are table|col=?,col2=val +func (c *fakeConn) prepareInsert(ctx context.Context, stmt *fakeStmt, parts []string) (*fakeStmt, error) { + if len(parts) != 2 { + stmt.Close() + return nil, errf("invalid INSERT syntax with %d parts; want 2", len(parts)) + } + stmt.table = parts[0] + for n, colspec := range strings.Split(parts[1], ",") { + nameVal := strings.Split(colspec, "=") + if len(nameVal) != 2 { + stmt.Close() + return nil, errf("INSERT table %q has invalid column spec of %q (index %d)", stmt.table, colspec, n) + } + column, value := nameVal[0], nameVal[1] + ctype, ok := c.db.columnType(stmt.table, column) + if !ok { + stmt.Close() + return nil, errf("INSERT table %q references non-existent column %q", stmt.table, column) + } + stmt.colName = append(stmt.colName, column) + + if !strings.HasPrefix(value, "?") { + var subsetVal any + // Convert to driver subset type + switch ctype { + case "string": + subsetVal = []byte(value) + case "blob": + subsetVal = []byte(value) + case "int32": + i, err := strconv.Atoi(value) + if err != nil { + stmt.Close() + return nil, errf("invalid conversion to int32 from %q", value) + } + subsetVal = int64(i) // int64 is a subset type, but not int32 + case "table": // For testing cursor reads. + c.skipDirtySession = true + vparts := strings.Split(value, "!") + + substmt, err := c.PrepareContext(ctx, fmt.Sprintf("SELECT|%s|%s|", vparts[0], strings.Join(vparts[1:], ","))) + if err != nil { + return nil, err + } + cursor, err := (substmt.(driver.StmtQueryContext)).QueryContext(ctx, []driver.NamedValue{}) + substmt.Close() + if err != nil { + return nil, err + } + subsetVal = cursor + default: + stmt.Close() + return nil, errf("unsupported conversion for pre-bound parameter %q to type %q", value, ctype) + } + stmt.colValue = append(stmt.colValue, subsetVal) + } else { + stmt.placeholders++ + stmt.placeholderConverter = append(stmt.placeholderConverter, converterForType(ctype)) + stmt.colValue = append(stmt.colValue, value) + } + } + return stmt, nil +} + +// hook to simulate broken connections +var hookPrepareBadConn func() bool + +func (c *fakeConn) Prepare(query string) (driver.Stmt, error) { + panic("use PrepareContext") +} + +func (c *fakeConn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) { + c.numPrepare++ + if c.db == nil { + panic("nil c.db; conn = " + fmt.Sprintf("%#v", c)) + } + + if c.stickyBad || (hookPrepareBadConn != nil && hookPrepareBadConn()) { + return nil, fakeError{Message: "Prepare: Sticky Bad", Wrapped: driver.ErrBadConn} + } + + c.touchMem() + var firstStmt, prev *fakeStmt + for _, query := range strings.Split(query, ";") { + parts := strings.Split(query, "|") + if len(parts) < 1 { + return nil, errf("empty query") + } + stmt := &fakeStmt{q: query, c: c, memToucher: c} + if firstStmt == nil { + firstStmt = stmt + } + if len(parts) >= 3 { + switch parts[0] { + case "PANIC": + stmt.panic = parts[1] + parts = parts[2:] + case "WAIT": + wait, err := time.ParseDuration(parts[1]) + if err != nil { + return nil, errf("expected section after WAIT to be a duration, got %q %v", parts[1], err) + } + parts = parts[2:] + stmt.wait = wait + } + } + cmd := parts[0] + stmt.cmd = cmd + parts = parts[1:] + + if c.waiter != nil { + c.waiter(ctx) + if err := ctx.Err(); err != nil { + return nil, err + } + } + + if stmt.wait > 0 { + wait := time.NewTimer(stmt.wait) + select { + case <-wait.C: + case <-ctx.Done(): + wait.Stop() + return nil, ctx.Err() + } + } + + c.incrStat(&c.stmtsMade) + var err error + switch cmd { + case "WIPE": + // Nothing + case "SELECT": + stmt, err = c.prepareSelect(stmt, parts) + case "CREATE": + stmt, err = c.prepareCreate(stmt, parts) + case "INSERT": + stmt, err = c.prepareInsert(ctx, stmt, parts) + case "NOSERT": + // Do all the prep-work like for an INSERT but don't actually insert the row. + // Used for some of the concurrent tests. + stmt, err = c.prepareInsert(ctx, stmt, parts) + default: + stmt.Close() + return nil, errf("unsupported command type %q", cmd) + } + if err != nil { + return nil, err + } + if prev != nil { + prev.next = stmt + } + prev = stmt + } + return firstStmt, nil +} + +func (s *fakeStmt) ColumnConverter(idx int) driver.ValueConverter { + if s.panic == "ColumnConverter" { + panic(s.panic) + } + if len(s.placeholderConverter) == 0 { + return driver.DefaultParameterConverter + } + return s.placeholderConverter[idx] +} + +func (s *fakeStmt) Close() error { + if s.panic == "Close" { + panic(s.panic) + } + if s.c == nil { + panic("nil conn in fakeStmt.Close") + } + if s.c.db == nil { + panic("in fakeStmt.Close, conn's db is nil (already closed)") + } + s.touchMem() + if !s.closed { + s.c.incrStat(&s.c.stmtsClosed) + s.closed = true + } + if s.next != nil { + s.next.Close() + } + return nil +} + +var errClosed = errors.New("fakedb: statement has been closed") + +// hook to simulate broken connections +var hookExecBadConn func() bool + +func (s *fakeStmt) Exec(args []driver.Value) (driver.Result, error) { + panic("Using ExecContext") +} + +var errFakeConnSessionDirty = errors.New("fakedb: session is dirty") + +func (s *fakeStmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error) { + if s.panic == "Exec" { + panic(s.panic) + } + if s.closed { + return nil, errClosed + } + + if s.c.stickyBad || (hookExecBadConn != nil && hookExecBadConn()) { + return nil, fakeError{Message: "Exec: Sticky Bad", Wrapped: driver.ErrBadConn} + } + if s.c.isDirtyAndMark() { + return nil, errFakeConnSessionDirty + } + + err := checkSubsetTypes(s.c.db.allowAny, args) + if err != nil { + return nil, err + } + s.touchMem() + + if s.wait > 0 { + time.Sleep(s.wait) + } + + select { + default: + case <-ctx.Done(): + return nil, ctx.Err() + } + + db := s.c.db + switch s.cmd { + case "WIPE": + db.wipe() + return driver.ResultNoRows, nil + case "CREATE": + if err := db.createTable(s.table, s.colName, s.colType); err != nil { + return nil, err + } + return driver.ResultNoRows, nil + case "INSERT": + return s.execInsert(args, true) + case "NOSERT": + // Do all the prep-work like for an INSERT but don't actually insert the row. + // Used for some of the concurrent tests. + return s.execInsert(args, false) + } + return nil, fmt.Errorf("fakedb: unimplemented statement Exec command type of %q", s.cmd) +} + +func valueFromPlaceholderName(args []driver.NamedValue, name string) driver.Value { + for i := range args { + if args[i].Name == name { + return args[i].Value + } + } + return nil +} + +// When doInsert is true, add the row to the table. +// When doInsert is false do prep-work and error checking, but don't +// actually add the row to the table. +func (s *fakeStmt) execInsert(args []driver.NamedValue, doInsert bool) (driver.Result, error) { + db := s.c.db + if len(args) != s.placeholders { + panic("error in pkg db; should only get here if size is correct") + } + db.mu.Lock() + t, ok := db.table(s.table) + db.mu.Unlock() + if !ok { + return nil, fmt.Errorf("fakedb: table %q doesn't exist", s.table) + } + + t.mu.Lock() + defer t.mu.Unlock() + + var cols []any + if doInsert { + cols = make([]any, len(t.colname)) + } + argPos := 0 + for n, colname := range s.colName { + colidx := t.columnIndex(colname) + if colidx == -1 { + return nil, fmt.Errorf("fakedb: column %q doesn't exist or dropped since prepared statement was created", colname) + } + var val any + if strvalue, ok := s.colValue[n].(string); ok && strings.HasPrefix(strvalue, "?") { + if strvalue == "?" { + val = args[argPos].Value + } else { + // Assign value from argument placeholder name. + if v := valueFromPlaceholderName(args, strvalue[1:]); v != nil { + val = v + } + } + argPos++ + } else { + val = s.colValue[n] + } + if doInsert { + cols[colidx] = val + } + } + + if doInsert { + t.rows = append(t.rows, &row{cols: cols}) + } + return driver.RowsAffected(1), nil +} + +// hook to simulate broken connections +var hookQueryBadConn func() bool + +func (s *fakeStmt) Query(args []driver.Value) (driver.Rows, error) { + panic("Use QueryContext") +} + +func (s *fakeStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) { + if s.panic == "Query" { + panic(s.panic) + } + if s.closed { + return nil, errClosed + } + + if s.c.stickyBad || (hookQueryBadConn != nil && hookQueryBadConn()) { + return nil, fakeError{Message: "Query: Sticky Bad", Wrapped: driver.ErrBadConn} + } + if s.c.isDirtyAndMark() { + return nil, errFakeConnSessionDirty + } + + err := checkSubsetTypes(s.c.db.allowAny, args) + if err != nil { + return nil, err + } + + s.touchMem() + db := s.c.db + if len(args) != s.placeholders { + panic("error in pkg db; should only get here if size is correct") + } + + setMRows := make([][]*row, 0, 1) + setColumns := make([][]string, 0, 1) + setColType := make([][]string, 0, 1) + + for { + db.mu.Lock() + t, ok := db.table(s.table) + db.mu.Unlock() + if !ok { + return nil, fmt.Errorf("fakedb: table %q doesn't exist", s.table) + } + + if s.table == "magicquery" { + if len(s.whereCol) == 2 && s.whereCol[0].Column == "op" && s.whereCol[1].Column == "millis" { + if args[0].Value == "sleep" { + time.Sleep(time.Duration(args[1].Value.(int64)) * time.Millisecond) + } + } + } + if s.table == "tx_status" && s.colName[0] == "tx_status" { + txStatus := "autocommit" + if s.c.currTx != nil { + txStatus = "transaction" + } + cursor := &rowsCursor{ + db: s.c.db, + parentMem: s.c, + posRow: -1, + rows: [][]*row{ + { + { + cols: []any{ + txStatus, + }, + }, + }, + }, + cols: [][]string{ + { + "tx_status", + }, + }, + colType: [][]string{ + { + "string", + }, + }, + errPos: -1, + } + return cursor, nil + } + + t.mu.Lock() + + colIdx := make(map[string]int) // select column name -> column index in table + for _, name := range s.colName { + idx := t.columnIndex(name) + if idx == -1 { + t.mu.Unlock() + return nil, fmt.Errorf("fakedb: unknown column name %q", name) + } + colIdx[name] = idx + } + + mrows := []*row{} + rows: + for _, trow := range t.rows { + // Process the where clause, skipping non-match rows. This is lazy + // and just uses fmt.Sprintf("%v") to test equality. Good enough + // for test code. + for _, wcol := range s.whereCol { + idx := t.columnIndex(wcol.Column) + if idx == -1 { + t.mu.Unlock() + return nil, fmt.Errorf("fakedb: invalid where clause column %v", wcol) + } + tcol := trow.cols[idx] + if bs, ok := tcol.([]byte); ok { + // lazy hack to avoid sprintf %v on a []byte + tcol = string(bs) + } + var argValue any + if wcol.Placeholder == "?" { + argValue = args[wcol.Ordinal-1].Value + } else { + if v := valueFromPlaceholderName(args, wcol.Placeholder[1:]); v != nil { + argValue = v + } + } + if fmt.Sprintf("%v", tcol) != fmt.Sprintf("%v", argValue) { + continue rows + } + } + mrow := &row{cols: make([]any, len(s.colName))} + for seli, name := range s.colName { + mrow.cols[seli] = trow.cols[colIdx[name]] + } + mrows = append(mrows, mrow) + } + + var colType []string + for _, column := range s.colName { + colType = append(colType, t.coltype[t.columnIndex(column)]) + } + + t.mu.Unlock() + + setMRows = append(setMRows, mrows) + setColumns = append(setColumns, s.colName) + setColType = append(setColType, colType) + + if s.next == nil { + break + } + s = s.next + } + + cursor := &rowsCursor{ + db: s.c.db, + parentMem: s.c, + posRow: -1, + rows: setMRows, + cols: setColumns, + colType: setColType, + errPos: -1, + } + return cursor, nil +} + +func (s *fakeStmt) NumInput() int { + if s.panic == "NumInput" { + panic(s.panic) + } + return s.placeholders +} + +// hook to simulate broken connections +var hookCommitBadConn func() bool + +func (tx *fakeTx) Commit() error { + tx.c.currTx = nil + if hookCommitBadConn != nil && hookCommitBadConn() { + return fakeError{Message: "Commit: Hook Bad Conn", Wrapped: driver.ErrBadConn} + } + tx.c.touchMem() + return nil +} + +// hook to simulate broken connections +var hookRollbackBadConn func() bool + +func (tx *fakeTx) Rollback() error { + tx.c.currTx = nil + if hookRollbackBadConn != nil && hookRollbackBadConn() { + return fakeError{Message: "Rollback: Hook Bad Conn", Wrapped: driver.ErrBadConn} + } + tx.c.touchMem() + return nil +} + +type rowsCursor struct { + db *fakeDB + parentMem memToucher + cols [][]string + colType [][]string + posSet int + posRow int + rows [][]*row + closed bool + + // errPos and err are for making Next return early with error. + errPos int + err error + + // Data returned to clients. + // We clone and stash it here so it can be invalidated by Close and Next. + driverOwnedMemory [][]byte + + // Every operation writes to line to enable the race detector + // check for data races. + // This is separate from the fakeConn.line to allow for drivers that + // can start multiple queries on the same transaction at the same time. + line int64 + + // closeErr is returned when rowsCursor.Close + closeErr error +} + +func (rc *rowsCursor) touchMem() { + rc.parentMem.touchMem() + rc.line++ +} + +func (rc *rowsCursor) invalidateDriverOwnedMemory() { + for _, buf := range rc.driverOwnedMemory { + for i := range buf { + buf[i] = 'x' + } + } + rc.driverOwnedMemory = nil +} + +func (rc *rowsCursor) Close() error { + rc.touchMem() + rc.parentMem.touchMem() + rc.invalidateDriverOwnedMemory() + rc.closed = true + return rc.closeErr +} + +func (rc *rowsCursor) Columns() []string { + return rc.cols[rc.posSet] +} + +func (rc *rowsCursor) ColumnTypeScanType(index int) reflect.Type { + return colTypeToReflectType(rc.colType[rc.posSet][index]) +} + +var rowsCursorNextHook func(dest []driver.Value) error + +func (rc *rowsCursor) Next(dest []driver.Value) error { + if rowsCursorNextHook != nil { + return rowsCursorNextHook(dest) + } + + if rc.closed { + return errors.New("fakedb: cursor is closed") + } + rc.touchMem() + rc.posRow++ + if rc.posRow == rc.errPos { + return rc.err + } + if rc.posRow >= len(rc.rows[rc.posSet]) { + return io.EOF // per interface spec + } + // Corrupt any previously returned bytes. + rc.invalidateDriverOwnedMemory() + for i, v := range rc.rows[rc.posSet][rc.posRow].cols { + // TODO(bradfitz): convert to subset types? naah, I + // think the subset types should only be input to + // driver, but the sql package should be able to handle + // a wider range of types coming out of drivers. all + // for ease of drivers, and to prevent drivers from + // messing up conversions or doing them differently. + if bs, ok := v.([]byte); ok { + // Clone []bytes and stash for later invalidation. + bs = bytes.Clone(bs) + rc.driverOwnedMemory = append(rc.driverOwnedMemory, bs) + v = bs + } + dest[i] = v + } + return nil +} + +func (rc *rowsCursor) HasNextResultSet() bool { + rc.touchMem() + return rc.posSet < len(rc.rows)-1 +} + +func (rc *rowsCursor) NextResultSet() error { + rc.touchMem() + if rc.HasNextResultSet() { + rc.posSet++ + rc.posRow = -1 + return nil + } + return io.EOF // Per interface spec. +} + +// fakeDriverString is like driver.String, but indirects pointers like +// DefaultValueConverter. +// +// This could be surprising behavior to retroactively apply to +// driver.String now that Go1 is out, but this is convenient for +// our TestPointerParamsAndScans. +type fakeDriverString struct{} + +func (fakeDriverString) ConvertValue(v any) (driver.Value, error) { + switch c := v.(type) { + case string, []byte: + return v, nil + case *string: + if c == nil { + return nil, nil + } + return *c, nil + } + return fmt.Sprintf("%v", v), nil +} + +type anyTypeConverter struct{} + +func (anyTypeConverter) ConvertValue(v any) (driver.Value, error) { + return v, nil +} + +func converterForType(typ string) driver.ValueConverter { + switch typ { + case "bool": + return driver.Bool + case "nullbool": + return driver.Null{Converter: driver.Bool} + case "byte", "int16": + return driver.NotNull{Converter: driver.DefaultParameterConverter} + case "int32": + return driver.Int32 + case "nullbyte", "nullint32", "nullint16": + return driver.Null{Converter: driver.DefaultParameterConverter} + case "string": + return driver.NotNull{Converter: fakeDriverString{}} + case "nullstring": + return driver.Null{Converter: fakeDriverString{}} + case "int64": + // TODO(coopernurse): add type-specific converter + return driver.NotNull{Converter: driver.DefaultParameterConverter} + case "nullint64": + // TODO(coopernurse): add type-specific converter + return driver.Null{Converter: driver.DefaultParameterConverter} + case "float64": + // TODO(coopernurse): add type-specific converter + return driver.NotNull{Converter: driver.DefaultParameterConverter} + case "nullfloat64": + // TODO(coopernurse): add type-specific converter + return driver.Null{Converter: driver.DefaultParameterConverter} + case "datetime": + return driver.NotNull{Converter: driver.DefaultParameterConverter} + case "nulldatetime": + return driver.Null{Converter: driver.DefaultParameterConverter} + case "any": + return anyTypeConverter{} + } + panic("invalid fakedb column type of " + typ) +} + +func colTypeToReflectType(typ string) reflect.Type { + switch typ { + case "bool": + return reflect.TypeFor[bool]() + case "nullbool": + return reflect.TypeFor[NullBool]() + case "int16": + return reflect.TypeFor[int16]() + case "nullint16": + return reflect.TypeFor[NullInt16]() + case "int32": + return reflect.TypeFor[int32]() + case "nullint32": + return reflect.TypeFor[NullInt32]() + case "string": + return reflect.TypeFor[string]() + case "nullstring": + return reflect.TypeFor[NullString]() + case "int64": + return reflect.TypeFor[int64]() + case "nullint64": + return reflect.TypeFor[NullInt64]() + case "float64": + return reflect.TypeFor[float64]() + case "nullfloat64": + return reflect.TypeFor[NullFloat64]() + case "datetime": + return reflect.TypeFor[time.Time]() + case "any": + return reflect.TypeFor[any]() + } + panic("invalid fakedb column type of " + typ) +} diff --git a/go/src/database/sql/sql.go b/go/src/database/sql/sql.go new file mode 100644 index 0000000000000000000000000000000000000000..4be450ca87687728797bafdb10e976adc5a71f58 --- /dev/null +++ b/go/src/database/sql/sql.go @@ -0,0 +1,3675 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package sql provides a generic interface around SQL (or SQL-like) +// databases. +// +// The sql package must be used in conjunction with a database driver. +// See https://golang.org/s/sqldrivers for a list of drivers. +// +// Drivers that do not support context cancellation will not return until +// after the query is completed. +// +// For usage examples, see the wiki page at +// https://golang.org/s/sqlwiki. +package sql + +import ( + "context" + "database/sql/driver" + "errors" + "fmt" + "io" + "maps" + "math/rand/v2" + "reflect" + "runtime" + "slices" + "strconv" + "sync" + "sync/atomic" + "time" + _ "unsafe" +) + +var driversMu sync.RWMutex + +// drivers should be an internal detail, +// but widely used packages access it using linkname. +// (It is extra wrong that they linkname drivers but not driversMu.) +// Notable members of the hall of shame include: +// - github.com/instana/go-sensor +// +// Do not remove or change the type signature. +// See go.dev/issue/67401. +// +//go:linkname drivers +var drivers = make(map[string]driver.Driver) + +// nowFunc returns the current time; it's overridden in tests. +var nowFunc = time.Now + +// Register makes a database driver available by the provided name. +// If Register is called twice with the same name or if driver is nil, +// it panics. +func Register(name string, driver driver.Driver) { + driversMu.Lock() + defer driversMu.Unlock() + if driver == nil { + panic("sql: Register driver is nil") + } + if _, dup := drivers[name]; dup { + panic("sql: Register called twice for driver " + name) + } + drivers[name] = driver +} + +func unregisterAllDrivers() { + driversMu.Lock() + defer driversMu.Unlock() + // For tests. + drivers = make(map[string]driver.Driver) +} + +// Drivers returns a sorted list of the names of the registered drivers. +func Drivers() []string { + driversMu.RLock() + defer driversMu.RUnlock() + return slices.Sorted(maps.Keys(drivers)) +} + +// A NamedArg is a named argument. NamedArg values may be used as +// arguments to [DB.Query] or [DB.Exec] and bind to the corresponding named +// parameter in the SQL statement. +// +// For a more concise way to create NamedArg values, see +// the [Named] function. +type NamedArg struct { + _NamedFieldsRequired struct{} + + // Name is the name of the parameter placeholder. + // + // If empty, the ordinal position in the argument list will be + // used. + // + // Name must omit any symbol prefix. + Name string + + // Value is the value of the parameter. + // It may be assigned the same value types as the query + // arguments. + Value any +} + +// Named provides a more concise way to create [NamedArg] values. +// +// Example usage: +// +// db.ExecContext(ctx, ` +// delete from Invoice +// where +// TimeCreated < @end +// and TimeCreated >= @start;`, +// sql.Named("start", startTime), +// sql.Named("end", endTime), +// ) +func Named(name string, value any) NamedArg { + // This method exists because the go1compat promise + // doesn't guarantee that structs don't grow more fields, + // so unkeyed struct literals are a vet error. Thus, we don't + // want to allow sql.NamedArg{name, value}. + return NamedArg{Name: name, Value: value} +} + +// IsolationLevel is the transaction isolation level used in [TxOptions]. +type IsolationLevel int + +// Various isolation levels that drivers may support in [DB.BeginTx]. +// If a driver does not support a given isolation level an error may be returned. +// +// See https://en.wikipedia.org/wiki/Isolation_(database_systems)#Isolation_levels. +const ( + LevelDefault IsolationLevel = iota + LevelReadUncommitted + LevelReadCommitted + LevelWriteCommitted + LevelRepeatableRead + LevelSnapshot + LevelSerializable + LevelLinearizable +) + +// String returns the name of the transaction isolation level. +func (i IsolationLevel) String() string { + switch i { + case LevelDefault: + return "Default" + case LevelReadUncommitted: + return "Read Uncommitted" + case LevelReadCommitted: + return "Read Committed" + case LevelWriteCommitted: + return "Write Committed" + case LevelRepeatableRead: + return "Repeatable Read" + case LevelSnapshot: + return "Snapshot" + case LevelSerializable: + return "Serializable" + case LevelLinearizable: + return "Linearizable" + default: + return "IsolationLevel(" + strconv.Itoa(int(i)) + ")" + } +} + +var _ fmt.Stringer = LevelDefault + +// TxOptions holds the transaction options to be used in [DB.BeginTx]. +type TxOptions struct { + // Isolation is the transaction isolation level. + // If zero, the driver or database's default level is used. + Isolation IsolationLevel + ReadOnly bool +} + +// RawBytes is a byte slice that holds a reference to memory owned by +// the database itself. After a [Rows.Scan] into a RawBytes, the slice is only +// valid until the next call to [Rows.Next], [Rows.Scan], or [Rows.Close]. +type RawBytes []byte + +// NullString represents a string that may be null. +// NullString implements the [Scanner] interface so +// it can be used as a scan destination: +// +// var s NullString +// err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&s) +// ... +// if s.Valid { +// // use s.String +// } else { +// // NULL value +// } +type NullString struct { + String string + Valid bool // Valid is true if String is not NULL +} + +// Scan implements the [Scanner] interface. +func (ns *NullString) Scan(value any) error { + if value == nil { + ns.String, ns.Valid = "", false + return nil + } + ns.Valid = true + return convertAssign(&ns.String, value) +} + +// Value implements the [driver.Valuer] interface. +func (ns NullString) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return ns.String, nil +} + +// NullInt64 represents an int64 that may be null. +// NullInt64 implements the [Scanner] interface so +// it can be used as a scan destination, similar to [NullString]. +type NullInt64 struct { + Int64 int64 + Valid bool // Valid is true if Int64 is not NULL +} + +// Scan implements the [Scanner] interface. +func (n *NullInt64) Scan(value any) error { + if value == nil { + n.Int64, n.Valid = 0, false + return nil + } + n.Valid = true + return convertAssign(&n.Int64, value) +} + +// Value implements the [driver.Valuer] interface. +func (n NullInt64) Value() (driver.Value, error) { + if !n.Valid { + return nil, nil + } + return n.Int64, nil +} + +// NullInt32 represents an int32 that may be null. +// NullInt32 implements the [Scanner] interface so +// it can be used as a scan destination, similar to [NullString]. +type NullInt32 struct { + Int32 int32 + Valid bool // Valid is true if Int32 is not NULL +} + +// Scan implements the [Scanner] interface. +func (n *NullInt32) Scan(value any) error { + if value == nil { + n.Int32, n.Valid = 0, false + return nil + } + n.Valid = true + return convertAssign(&n.Int32, value) +} + +// Value implements the [driver.Valuer] interface. +func (n NullInt32) Value() (driver.Value, error) { + if !n.Valid { + return nil, nil + } + return int64(n.Int32), nil +} + +// NullInt16 represents an int16 that may be null. +// NullInt16 implements the [Scanner] interface so +// it can be used as a scan destination, similar to [NullString]. +type NullInt16 struct { + Int16 int16 + Valid bool // Valid is true if Int16 is not NULL +} + +// Scan implements the [Scanner] interface. +func (n *NullInt16) Scan(value any) error { + if value == nil { + n.Int16, n.Valid = 0, false + return nil + } + err := convertAssign(&n.Int16, value) + n.Valid = err == nil + return err +} + +// Value implements the [driver.Valuer] interface. +func (n NullInt16) Value() (driver.Value, error) { + if !n.Valid { + return nil, nil + } + return int64(n.Int16), nil +} + +// NullByte represents a byte that may be null. +// NullByte implements the [Scanner] interface so +// it can be used as a scan destination, similar to [NullString]. +type NullByte struct { + Byte byte + Valid bool // Valid is true if Byte is not NULL +} + +// Scan implements the [Scanner] interface. +func (n *NullByte) Scan(value any) error { + if value == nil { + n.Byte, n.Valid = 0, false + return nil + } + err := convertAssign(&n.Byte, value) + n.Valid = err == nil + return err +} + +// Value implements the [driver.Valuer] interface. +func (n NullByte) Value() (driver.Value, error) { + if !n.Valid { + return nil, nil + } + return int64(n.Byte), nil +} + +// NullFloat64 represents a float64 that may be null. +// NullFloat64 implements the [Scanner] interface so +// it can be used as a scan destination, similar to [NullString]. +type NullFloat64 struct { + Float64 float64 + Valid bool // Valid is true if Float64 is not NULL +} + +// Scan implements the [Scanner] interface. +func (n *NullFloat64) Scan(value any) error { + if value == nil { + n.Float64, n.Valid = 0, false + return nil + } + n.Valid = true + return convertAssign(&n.Float64, value) +} + +// Value implements the [driver.Valuer] interface. +func (n NullFloat64) Value() (driver.Value, error) { + if !n.Valid { + return nil, nil + } + return n.Float64, nil +} + +// NullBool represents a bool that may be null. +// NullBool implements the [Scanner] interface so +// it can be used as a scan destination, similar to [NullString]. +type NullBool struct { + Bool bool + Valid bool // Valid is true if Bool is not NULL +} + +// Scan implements the [Scanner] interface. +func (n *NullBool) Scan(value any) error { + if value == nil { + n.Bool, n.Valid = false, false + return nil + } + n.Valid = true + return convertAssign(&n.Bool, value) +} + +// Value implements the [driver.Valuer] interface. +func (n NullBool) Value() (driver.Value, error) { + if !n.Valid { + return nil, nil + } + return n.Bool, nil +} + +// NullTime represents a [time.Time] that may be null. +// NullTime implements the [Scanner] interface so +// it can be used as a scan destination, similar to [NullString]. +type NullTime struct { + Time time.Time + Valid bool // Valid is true if Time is not NULL +} + +// Scan implements the [Scanner] interface. +func (n *NullTime) Scan(value any) error { + if value == nil { + n.Time, n.Valid = time.Time{}, false + return nil + } + n.Valid = true + return convertAssign(&n.Time, value) +} + +// Value implements the [driver.Valuer] interface. +func (n NullTime) Value() (driver.Value, error) { + if !n.Valid { + return nil, nil + } + return n.Time, nil +} + +// Null represents a value that may be null. +// Null implements the [Scanner] interface so +// it can be used as a scan destination: +// +// var s Null[string] +// err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&s) +// ... +// if s.Valid { +// // use s.V +// } else { +// // NULL value +// } +// +// T should be one of the types accepted by [driver.Value]. +type Null[T any] struct { + V T + Valid bool +} + +func (n *Null[T]) Scan(value any) error { + if value == nil { + n.V, n.Valid = *new(T), false + return nil + } + n.Valid = true + return convertAssign(&n.V, value) +} + +func (n Null[T]) Value() (driver.Value, error) { + if !n.Valid { + return nil, nil + } + v := any(n.V) + // See issue 69728. + if valuer, ok := v.(driver.Valuer); ok { + val, err := callValuerValue(valuer) + if err != nil { + return val, err + } + v = val + } + // See issue 69837. + return driver.DefaultParameterConverter.ConvertValue(v) +} + +// Scanner is an interface used by [Rows.Scan]. +type Scanner interface { + // Scan assigns a value from a database driver. + // + // The src value will be of one of the following types: + // + // int64 + // float64 + // bool + // []byte + // string + // time.Time + // nil - for NULL values + // + // An error should be returned if the value cannot be stored + // without loss of information. + // + // Reference types such as []byte are only valid until the next call to Scan + // and should not be retained. Their underlying memory is owned by the driver. + // If retention is necessary, copy their values before the next call to Scan. + Scan(src any) error +} + +// Out may be used to retrieve OUTPUT value parameters from stored procedures. +// +// Not all drivers and databases support OUTPUT value parameters. +// +// Example usage: +// +// var outArg string +// _, err := db.ExecContext(ctx, "ProcName", sql.Named("Arg1", sql.Out{Dest: &outArg})) +type Out struct { + _NamedFieldsRequired struct{} + + // Dest is a pointer to the value that will be set to the result of the + // stored procedure's OUTPUT parameter. + Dest any + + // In is whether the parameter is an INOUT parameter. If so, the input value to the stored + // procedure is the dereferenced value of Dest's pointer, which is then replaced with + // the output value. + In bool +} + +// ErrNoRows is returned by [Row.Scan] when [DB.QueryRow] doesn't return a +// row. In such a case, QueryRow returns a placeholder [*Row] value that +// defers this error until a Scan. +var ErrNoRows = errors.New("sql: no rows in result set") + +// DB is a database handle representing a pool of zero or more +// underlying connections. It's safe for concurrent use by multiple +// goroutines. +// +// The sql package creates and frees connections automatically; it +// also maintains a free pool of idle connections. If the database has +// a concept of per-connection state, such state can be reliably observed +// within a transaction ([Tx]) or connection ([Conn]). Once [DB.Begin] is called, the +// returned [Tx] is bound to a single connection. Once [Tx.Commit] or +// [Tx.Rollback] is called on the transaction, that transaction's +// connection is returned to [DB]'s idle connection pool. The pool size +// can be controlled with [DB.SetMaxIdleConns]. +type DB struct { + // Total time waited for new connections. + waitDuration atomic.Int64 + + connector driver.Connector + // numClosed is an atomic counter which represents a total number of + // closed connections. Stmt.openStmt checks it before cleaning closed + // connections in Stmt.css. + numClosed atomic.Uint64 + + mu sync.Mutex // protects following fields + freeConn []*driverConn // free connections ordered by returnedAt oldest to newest + connRequests connRequestSet + numOpen int // number of opened and pending open connections + // Used to signal the need for new connections + // a goroutine running connectionOpener() reads on this chan and + // maybeOpenNewConnections sends on the chan (one send per needed connection) + // It is closed during db.Close(). The close tells the connectionOpener + // goroutine to exit. + openerCh chan struct{} + closed bool + dep map[finalCloser]depSet + lastPut map[*driverConn]string // stacktrace of last conn's put; debug only + maxIdleCount int // zero means defaultMaxIdleConns; negative means 0 + maxOpen int // <= 0 means unlimited + maxLifetime time.Duration // maximum amount of time a connection may be reused + maxIdleTime time.Duration // maximum amount of time a connection may be idle before being closed + cleanerCh chan struct{} + waitCount int64 // Total number of connections waited for. + maxIdleClosed int64 // Total number of connections closed due to idle count. + maxIdleTimeClosed int64 // Total number of connections closed due to idle time. + maxLifetimeClosed int64 // Total number of connections closed due to max connection lifetime limit. + + stop func() // stop cancels the connection opener. +} + +// connReuseStrategy determines how (*DB).conn returns database connections. +type connReuseStrategy uint8 + +const ( + // alwaysNewConn forces a new connection to the database. + alwaysNewConn connReuseStrategy = iota + // cachedOrNewConn returns a cached connection, if available, else waits + // for one to become available (if MaxOpenConns has been reached) or + // creates a new database connection. + cachedOrNewConn +) + +// driverConn wraps a driver.Conn with a mutex, to +// be held during all calls into the Conn. (including any calls onto +// interfaces returned via that Conn, such as calls on Tx, Stmt, +// Result, Rows) +type driverConn struct { + db *DB + createdAt time.Time + + sync.Mutex // guards following + ci driver.Conn + needReset bool // The connection session should be reset before use if true. + closed bool + finalClosed bool // ci.Close has been called + openStmt map[*driverStmt]bool + + // guarded by db.mu + inUse bool + dbmuClosed bool // same as closed, but guarded by db.mu, for removeClosedStmtLocked + returnedAt time.Time // Time the connection was created or returned. + onPut []func() // code (with db.mu held) run when conn is next returned +} + +func (dc *driverConn) releaseConn(err error) { + dc.db.putConn(dc, err, true) +} + +func (dc *driverConn) removeOpenStmt(ds *driverStmt) { + dc.Lock() + defer dc.Unlock() + delete(dc.openStmt, ds) +} + +func (dc *driverConn) expired(timeout time.Duration) bool { + if timeout <= 0 { + return false + } + return dc.createdAt.Add(timeout).Before(nowFunc()) +} + +// resetSession checks if the driver connection needs the +// session to be reset and if required, resets it. +func (dc *driverConn) resetSession(ctx context.Context) error { + dc.Lock() + defer dc.Unlock() + + if !dc.needReset { + return nil + } + if cr, ok := dc.ci.(driver.SessionResetter); ok { + return cr.ResetSession(ctx) + } + return nil +} + +// validateConnection checks if the connection is valid and can +// still be used. It also marks the session for reset if required. +func (dc *driverConn) validateConnection(needsReset bool) bool { + dc.Lock() + defer dc.Unlock() + + if needsReset { + dc.needReset = true + } + if cv, ok := dc.ci.(driver.Validator); ok { + return cv.IsValid() + } + return true +} + +// prepareLocked prepares the query on dc. When cg == nil the dc must keep track of +// the prepared statements in a pool. +func (dc *driverConn) prepareLocked(ctx context.Context, cg stmtConnGrabber, query string) (*driverStmt, error) { + si, err := ctxDriverPrepare(ctx, dc.ci, query) + if err != nil { + return nil, err + } + ds := &driverStmt{Locker: dc, si: si} + + // No need to manage open statements if there is a single connection grabber. + if cg != nil { + return ds, nil + } + + // Track each driverConn's open statements, so we can close them + // before closing the conn. + // + // Wrap all driver.Stmt is *driverStmt to ensure they are only closed once. + if dc.openStmt == nil { + dc.openStmt = make(map[*driverStmt]bool) + } + dc.openStmt[ds] = true + return ds, nil +} + +// the dc.db's Mutex is held. +func (dc *driverConn) closeDBLocked() func() error { + dc.Lock() + defer dc.Unlock() + if dc.closed { + return func() error { return errors.New("sql: duplicate driverConn close") } + } + dc.closed = true + return dc.db.removeDepLocked(dc, dc) +} + +func (dc *driverConn) Close() error { + dc.Lock() + if dc.closed { + dc.Unlock() + return errors.New("sql: duplicate driverConn close") + } + dc.closed = true + dc.Unlock() // not defer; removeDep finalClose calls may need to lock + + // And now updates that require holding dc.mu.Lock. + dc.db.mu.Lock() + dc.dbmuClosed = true + fn := dc.db.removeDepLocked(dc, dc) + dc.db.mu.Unlock() + return fn() +} + +func (dc *driverConn) finalClose() error { + var err error + + // Each *driverStmt has a lock to the dc. Copy the list out of the dc + // before calling close on each stmt. + var openStmt []*driverStmt + withLock(dc, func() { + openStmt = make([]*driverStmt, 0, len(dc.openStmt)) + for ds := range dc.openStmt { + openStmt = append(openStmt, ds) + } + dc.openStmt = nil + }) + for _, ds := range openStmt { + ds.Close() + } + withLock(dc, func() { + dc.finalClosed = true + err = dc.ci.Close() + dc.ci = nil + }) + + dc.db.mu.Lock() + dc.db.numOpen-- + dc.db.maybeOpenNewConnections() + dc.db.mu.Unlock() + + dc.db.numClosed.Add(1) + return err +} + +// driverStmt associates a driver.Stmt with the +// *driverConn from which it came, so the driverConn's lock can be +// held during calls. +type driverStmt struct { + sync.Locker // the *driverConn + si driver.Stmt + closed bool + closeErr error // return value of previous Close call +} + +// Close ensures driver.Stmt is only closed once and always returns the same +// result. +func (ds *driverStmt) Close() error { + ds.Lock() + defer ds.Unlock() + if ds.closed { + return ds.closeErr + } + ds.closed = true + ds.closeErr = ds.si.Close() + return ds.closeErr +} + +// depSet is a finalCloser's outstanding dependencies +type depSet map[any]bool // set of true bools + +// The finalCloser interface is used by (*DB).addDep and related +// dependency reference counting. +type finalCloser interface { + // finalClose is called when the reference count of an object + // goes to zero. (*DB).mu is not held while calling it. + finalClose() error +} + +// addDep notes that x now depends on dep, and x's finalClose won't be +// called until all of x's dependencies are removed with removeDep. +func (db *DB) addDep(x finalCloser, dep any) { + db.mu.Lock() + defer db.mu.Unlock() + db.addDepLocked(x, dep) +} + +func (db *DB) addDepLocked(x finalCloser, dep any) { + if db.dep == nil { + db.dep = make(map[finalCloser]depSet) + } + xdep := db.dep[x] + if xdep == nil { + xdep = make(depSet) + db.dep[x] = xdep + } + xdep[dep] = true +} + +// removeDep notes that x no longer depends on dep. +// If x still has dependencies, nil is returned. +// If x no longer has any dependencies, its finalClose method will be +// called and its error value will be returned. +func (db *DB) removeDep(x finalCloser, dep any) error { + db.mu.Lock() + fn := db.removeDepLocked(x, dep) + db.mu.Unlock() + return fn() +} + +func (db *DB) removeDepLocked(x finalCloser, dep any) func() error { + xdep, ok := db.dep[x] + if !ok { + panic(fmt.Sprintf("unpaired removeDep: no deps for %T", x)) + } + + l0 := len(xdep) + delete(xdep, dep) + + switch len(xdep) { + case l0: + // Nothing removed. Shouldn't happen. + panic(fmt.Sprintf("unpaired removeDep: no %T dep on %T", dep, x)) + case 0: + // No more dependencies. + delete(db.dep, x) + return x.finalClose + default: + // Dependencies remain. + return func() error { return nil } + } +} + +// This is the size of the connectionOpener request chan (DB.openerCh). +// This value should be larger than the maximum typical value +// used for DB.maxOpen. If maxOpen is significantly larger than +// connectionRequestQueueSize then it is possible for ALL calls into the *DB +// to block until the connectionOpener can satisfy the backlog of requests. +var connectionRequestQueueSize = 1000000 + +type dsnConnector struct { + dsn string + driver driver.Driver +} + +func (t dsnConnector) Connect(_ context.Context) (driver.Conn, error) { + return t.driver.Open(t.dsn) +} + +func (t dsnConnector) Driver() driver.Driver { + return t.driver +} + +// OpenDB opens a database using a [driver.Connector], allowing drivers to +// bypass a string based data source name. +// +// Most users will open a database via a driver-specific connection +// helper function that returns a [*DB]. No database drivers are included +// in the Go standard library. See https://golang.org/s/sqldrivers for +// a list of third-party drivers. +// +// OpenDB may just validate its arguments without creating a connection +// to the database. To verify that the data source name is valid, call +// [DB.Ping]. +// +// The returned [DB] is safe for concurrent use by multiple goroutines +// and maintains its own pool of idle connections. Thus, the OpenDB +// function should be called just once. It is rarely necessary to +// close a [DB]. +func OpenDB(c driver.Connector) *DB { + ctx, cancel := context.WithCancel(context.Background()) + db := &DB{ + connector: c, + openerCh: make(chan struct{}, connectionRequestQueueSize), + lastPut: make(map[*driverConn]string), + stop: cancel, + } + + go db.connectionOpener(ctx) + + return db +} + +// Open opens a database specified by its database driver name and a +// driver-specific data source name, usually consisting of at least a +// database name and connection information. +// +// Most users will open a database via a driver-specific connection +// helper function that returns a [*DB]. No database drivers are included +// in the Go standard library. See https://golang.org/s/sqldrivers for +// a list of third-party drivers. +// +// Open may just validate its arguments without creating a connection +// to the database. To verify that the data source name is valid, call +// [DB.Ping]. +// +// The returned [DB] is safe for concurrent use by multiple goroutines +// and maintains its own pool of idle connections. Thus, the Open +// function should be called just once. It is rarely necessary to +// close a [DB]. +func Open(driverName, dataSourceName string) (*DB, error) { + driversMu.RLock() + driveri, ok := drivers[driverName] + driversMu.RUnlock() + if !ok { + return nil, fmt.Errorf("sql: unknown driver %q (forgotten import?)", driverName) + } + + if driverCtx, ok := driveri.(driver.DriverContext); ok { + connector, err := driverCtx.OpenConnector(dataSourceName) + if err != nil { + return nil, err + } + return OpenDB(connector), nil + } + + return OpenDB(dsnConnector{dsn: dataSourceName, driver: driveri}), nil +} + +func (db *DB) pingDC(ctx context.Context, dc *driverConn, release func(error)) error { + var err error + if pinger, ok := dc.ci.(driver.Pinger); ok { + withLock(dc, func() { + err = pinger.Ping(ctx) + }) + } + release(err) + return err +} + +// PingContext verifies a connection to the database is still alive, +// establishing a connection if necessary. +func (db *DB) PingContext(ctx context.Context) error { + var dc *driverConn + var err error + + err = db.retry(func(strategy connReuseStrategy) error { + dc, err = db.conn(ctx, strategy) + return err + }) + + if err != nil { + return err + } + + return db.pingDC(ctx, dc, dc.releaseConn) +} + +// Ping verifies a connection to the database is still alive, +// establishing a connection if necessary. +// +// Ping uses [context.Background] internally; to specify the context, use +// [DB.PingContext]. +func (db *DB) Ping() error { + return db.PingContext(context.Background()) +} + +// Close closes the database and prevents new queries from starting. +// Close then waits for all queries that have started processing on the server +// to finish. +// +// It is rare to Close a [DB], as the [DB] handle is meant to be +// long-lived and shared between many goroutines. +func (db *DB) Close() error { + db.mu.Lock() + if db.closed { // Make DB.Close idempotent + db.mu.Unlock() + return nil + } + if db.cleanerCh != nil { + close(db.cleanerCh) + } + var err error + fns := make([]func() error, 0, len(db.freeConn)) + for _, dc := range db.freeConn { + fns = append(fns, dc.closeDBLocked()) + } + db.freeConn = nil + db.closed = true + db.connRequests.CloseAndRemoveAll() + db.mu.Unlock() + for _, fn := range fns { + err1 := fn() + if err1 != nil { + err = err1 + } + } + db.stop() + if c, ok := db.connector.(io.Closer); ok { + err1 := c.Close() + if err1 != nil { + err = err1 + } + } + return err +} + +const defaultMaxIdleConns = 2 + +func (db *DB) maxIdleConnsLocked() int { + n := db.maxIdleCount + switch { + case n == 0: + // TODO(bradfitz): ask driver, if supported, for its default preference + return defaultMaxIdleConns + case n < 0: + return 0 + default: + return n + } +} + +func (db *DB) shortestIdleTimeLocked() time.Duration { + if db.maxIdleTime <= 0 { + return db.maxLifetime + } + if db.maxLifetime <= 0 { + return db.maxIdleTime + } + return min(db.maxIdleTime, db.maxLifetime) +} + +// SetMaxIdleConns sets the maximum number of connections in the idle +// connection pool. +// +// If MaxOpenConns is greater than 0 but less than the new MaxIdleConns, +// then the new MaxIdleConns will be reduced to match the MaxOpenConns limit. +// +// If n <= 0, no idle connections are retained. +// +// The default max idle connections is currently 2. This may change in +// a future release. +func (db *DB) SetMaxIdleConns(n int) { + db.mu.Lock() + if n > 0 { + db.maxIdleCount = n + } else { + // No idle connections. + db.maxIdleCount = -1 + } + // Make sure maxIdle doesn't exceed maxOpen + if db.maxOpen > 0 && db.maxIdleConnsLocked() > db.maxOpen { + db.maxIdleCount = db.maxOpen + } + var closing []*driverConn + idleCount := len(db.freeConn) + maxIdle := db.maxIdleConnsLocked() + if idleCount > maxIdle { + closing = db.freeConn[maxIdle:] + db.freeConn = db.freeConn[:maxIdle] + } + db.maxIdleClosed += int64(len(closing)) + db.mu.Unlock() + for _, c := range closing { + c.Close() + } +} + +// SetMaxOpenConns sets the maximum number of open connections to the database. +// +// If MaxIdleConns is greater than 0 and the new MaxOpenConns is less than +// MaxIdleConns, then MaxIdleConns will be reduced to match the new +// MaxOpenConns limit. +// +// If n <= 0, then there is no limit on the number of open connections. +// The default is 0 (unlimited). +func (db *DB) SetMaxOpenConns(n int) { + db.mu.Lock() + db.maxOpen = n + if n < 0 { + db.maxOpen = 0 + } + syncMaxIdle := db.maxOpen > 0 && db.maxIdleConnsLocked() > db.maxOpen + db.mu.Unlock() + if syncMaxIdle { + db.SetMaxIdleConns(n) + } +} + +// SetConnMaxLifetime sets the maximum amount of time a connection may be reused. +// +// Expired connections may be closed lazily before reuse. +// +// If d <= 0, connections are not closed due to a connection's age. +func (db *DB) SetConnMaxLifetime(d time.Duration) { + if d < 0 { + d = 0 + } + db.mu.Lock() + // Wake cleaner up when lifetime is shortened. + if d > 0 && d < db.shortestIdleTimeLocked() && db.cleanerCh != nil { + select { + case db.cleanerCh <- struct{}{}: + default: + } + } + db.maxLifetime = d + db.startCleanerLocked() + db.mu.Unlock() +} + +// SetConnMaxIdleTime sets the maximum amount of time a connection may be idle. +// +// Expired connections may be closed lazily before reuse. +// +// If d <= 0, connections are not closed due to a connection's idle time. +func (db *DB) SetConnMaxIdleTime(d time.Duration) { + if d < 0 { + d = 0 + } + db.mu.Lock() + defer db.mu.Unlock() + + // Wake cleaner up when idle time is shortened. + if d > 0 && d < db.shortestIdleTimeLocked() && db.cleanerCh != nil { + select { + case db.cleanerCh <- struct{}{}: + default: + } + } + db.maxIdleTime = d + db.startCleanerLocked() +} + +// startCleanerLocked starts connectionCleaner if needed. +func (db *DB) startCleanerLocked() { + if (db.maxLifetime > 0 || db.maxIdleTime > 0) && db.numOpen > 0 && db.cleanerCh == nil { + db.cleanerCh = make(chan struct{}, 1) + go db.connectionCleaner(db.shortestIdleTimeLocked()) + } +} + +func (db *DB) connectionCleaner(d time.Duration) { + const minInterval = time.Second + + if d < minInterval { + d = minInterval + } + t := time.NewTimer(d) + + for { + select { + case <-t.C: + case <-db.cleanerCh: // maxLifetime was changed or db was closed. + } + + db.mu.Lock() + + d = db.shortestIdleTimeLocked() + if db.closed || db.numOpen == 0 || d <= 0 { + db.cleanerCh = nil + db.mu.Unlock() + return + } + + d, closing := db.connectionCleanerRunLocked(d) + db.mu.Unlock() + for _, c := range closing { + c.Close() + } + + if d < minInterval { + d = minInterval + } + + if !t.Stop() { + select { + case <-t.C: + default: + } + } + t.Reset(d) + } +} + +// connectionCleanerRunLocked removes connections that should be closed from +// freeConn and returns them along side an updated duration to the next check +// if a quicker check is required to ensure connections are checked appropriately. +func (db *DB) connectionCleanerRunLocked(d time.Duration) (time.Duration, []*driverConn) { + var idleClosing int64 + var closing []*driverConn + if db.maxIdleTime > 0 { + // As freeConn is ordered by returnedAt process + // in reverse order to minimise the work needed. + idleSince := nowFunc().Add(-db.maxIdleTime) + last := len(db.freeConn) - 1 + for i := last; i >= 0; i-- { + c := db.freeConn[i] + if c.returnedAt.Before(idleSince) { + i++ + closing = db.freeConn[:i:i] + db.freeConn = db.freeConn[i:] + idleClosing = int64(len(closing)) + db.maxIdleTimeClosed += idleClosing + break + } + } + + if len(db.freeConn) > 0 { + c := db.freeConn[0] + if d2 := c.returnedAt.Sub(idleSince); d2 < d { + // Ensure idle connections are cleaned up as soon as + // possible. + d = d2 + } + } + } + + if db.maxLifetime > 0 { + expiredSince := nowFunc().Add(-db.maxLifetime) + for i := 0; i < len(db.freeConn); i++ { + c := db.freeConn[i] + if c.createdAt.Before(expiredSince) { + closing = append(closing, c) + + last := len(db.freeConn) - 1 + // Use slow delete as order is required to ensure + // connections are reused least idle time first. + copy(db.freeConn[i:], db.freeConn[i+1:]) + db.freeConn[last] = nil + db.freeConn = db.freeConn[:last] + i-- + } else if d2 := c.createdAt.Sub(expiredSince); d2 < d { + // Prevent connections sitting the freeConn when they + // have expired by updating our next deadline d. + d = d2 + } + } + db.maxLifetimeClosed += int64(len(closing)) - idleClosing + } + + return d, closing +} + +// DBStats contains database statistics. +type DBStats struct { + MaxOpenConnections int // Maximum number of open connections to the database. + + // Pool Status + OpenConnections int // The number of established connections both in use and idle. + InUse int // The number of connections currently in use. + Idle int // The number of idle connections. + + // Counters + WaitCount int64 // The total number of connections waited for. + WaitDuration time.Duration // The total time blocked waiting for a new connection. + MaxIdleClosed int64 // The total number of connections closed due to SetMaxIdleConns. + MaxIdleTimeClosed int64 // The total number of connections closed due to SetConnMaxIdleTime. + MaxLifetimeClosed int64 // The total number of connections closed due to SetConnMaxLifetime. +} + +// Stats returns database statistics. +func (db *DB) Stats() DBStats { + wait := db.waitDuration.Load() + + db.mu.Lock() + defer db.mu.Unlock() + + stats := DBStats{ + MaxOpenConnections: db.maxOpen, + + Idle: len(db.freeConn), + OpenConnections: db.numOpen, + InUse: db.numOpen - len(db.freeConn), + + WaitCount: db.waitCount, + WaitDuration: time.Duration(wait), + MaxIdleClosed: db.maxIdleClosed, + MaxIdleTimeClosed: db.maxIdleTimeClosed, + MaxLifetimeClosed: db.maxLifetimeClosed, + } + return stats +} + +// Assumes db.mu is locked. +// If there are connRequests and the connection limit hasn't been reached, +// then tell the connectionOpener to open new connections. +func (db *DB) maybeOpenNewConnections() { + numRequests := db.connRequests.Len() + if db.maxOpen > 0 { + numCanOpen := db.maxOpen - db.numOpen + if numRequests > numCanOpen { + numRequests = numCanOpen + } + } + for numRequests > 0 { + db.numOpen++ // optimistically + numRequests-- + if db.closed { + return + } + db.openerCh <- struct{}{} + } +} + +// Runs in a separate goroutine, opens new connections when requested. +func (db *DB) connectionOpener(ctx context.Context) { + for { + select { + case <-ctx.Done(): + return + case <-db.openerCh: + db.openNewConnection(ctx) + } + } +} + +// Open one new connection +func (db *DB) openNewConnection(ctx context.Context) { + // maybeOpenNewConnections has already executed db.numOpen++ before it sent + // on db.openerCh. This function must execute db.numOpen-- if the + // connection fails or is closed before returning. + ci, err := db.connector.Connect(ctx) + db.mu.Lock() + defer db.mu.Unlock() + if db.closed { + if err == nil { + ci.Close() + } + db.numOpen-- + return + } + if err != nil { + db.numOpen-- + db.putConnDBLocked(nil, err) + db.maybeOpenNewConnections() + return + } + dc := &driverConn{ + db: db, + createdAt: nowFunc(), + returnedAt: nowFunc(), + ci: ci, + } + if db.putConnDBLocked(dc, err) { + db.addDepLocked(dc, dc) + } else { + db.numOpen-- + ci.Close() + } +} + +// connRequest represents one request for a new connection +// When there are no idle connections available, DB.conn will create +// a new connRequest and put it on the db.connRequests list. +type connRequest struct { + conn *driverConn + err error +} + +var errDBClosed = errors.New("sql: database is closed") + +// conn returns a newly-opened or cached *driverConn. +func (db *DB) conn(ctx context.Context, strategy connReuseStrategy) (*driverConn, error) { + db.mu.Lock() + if db.closed { + db.mu.Unlock() + return nil, errDBClosed + } + // Check if the context is expired. + select { + default: + case <-ctx.Done(): + db.mu.Unlock() + return nil, ctx.Err() + } + lifetime := db.maxLifetime + + // Prefer a free connection, if possible. + last := len(db.freeConn) - 1 + if strategy == cachedOrNewConn && last >= 0 { + // Reuse the lowest idle time connection so we can close + // connections which remain idle as soon as possible. + conn := db.freeConn[last] + db.freeConn = db.freeConn[:last] + conn.inUse = true + if conn.expired(lifetime) { + db.maxLifetimeClosed++ + db.mu.Unlock() + conn.Close() + return nil, driver.ErrBadConn + } + db.mu.Unlock() + + // Reset the session if required. + if err := conn.resetSession(ctx); errors.Is(err, driver.ErrBadConn) { + conn.Close() + return nil, err + } + + return conn, nil + } + + // Out of free connections or we were asked not to use one. If we're not + // allowed to open any more connections, make a request and wait. + if db.maxOpen > 0 && db.numOpen >= db.maxOpen { + // Make the connRequest channel. It's buffered so that the + // connectionOpener doesn't block while waiting for the req to be read. + req := make(chan connRequest, 1) + delHandle := db.connRequests.Add(req) + db.waitCount++ + db.mu.Unlock() + + waitStart := nowFunc() + + // Timeout the connection request with the context. + select { + case <-ctx.Done(): + // Remove the connection request and ensure no value has been sent + // on it after removing. + db.mu.Lock() + deleted := db.connRequests.Delete(delHandle) + db.mu.Unlock() + + db.waitDuration.Add(int64(time.Since(waitStart))) + + // If we failed to delete it, that means either the DB was closed or + // something else grabbed it and is about to send on it. + if !deleted { + // TODO(bradfitz): rather than this best effort select, we + // should probably start a goroutine to read from req. This best + // effort select existed before the change to check 'deleted'. + // But if we know for sure it wasn't deleted and a sender is + // outstanding, we should probably block on req (in a new + // goroutine) to get the connection back. + select { + default: + case ret, ok := <-req: + if ok && ret.conn != nil { + db.putConn(ret.conn, ret.err, false) + } + } + } + return nil, ctx.Err() + case ret, ok := <-req: + db.waitDuration.Add(int64(time.Since(waitStart))) + + if !ok { + return nil, errDBClosed + } + // Only check if the connection is expired if the strategy is cachedOrNewConns. + // If we require a new connection, just re-use the connection without looking + // at the expiry time. If it is expired, it will be checked when it is placed + // back into the connection pool. + // This prioritizes giving a valid connection to a client over the exact connection + // lifetime, which could expire exactly after this point anyway. + if strategy == cachedOrNewConn && ret.err == nil && ret.conn.expired(lifetime) { + db.mu.Lock() + db.maxLifetimeClosed++ + db.mu.Unlock() + ret.conn.Close() + return nil, driver.ErrBadConn + } + if ret.conn == nil { + return nil, ret.err + } + + // Reset the session if required. + if err := ret.conn.resetSession(ctx); errors.Is(err, driver.ErrBadConn) { + ret.conn.Close() + return nil, err + } + return ret.conn, ret.err + } + } + + db.numOpen++ // optimistically + db.mu.Unlock() + ci, err := db.connector.Connect(ctx) + if err != nil { + db.mu.Lock() + db.numOpen-- // correct for earlier optimism + db.maybeOpenNewConnections() + db.mu.Unlock() + return nil, err + } + db.mu.Lock() + dc := &driverConn{ + db: db, + createdAt: nowFunc(), + returnedAt: nowFunc(), + ci: ci, + inUse: true, + } + db.addDepLocked(dc, dc) + db.mu.Unlock() + return dc, nil +} + +// putConnHook is a hook for testing. +var putConnHook func(*DB, *driverConn) + +// noteUnusedDriverStatement notes that ds is no longer used and should +// be closed whenever possible (when c is next not in use), unless c is +// already closed. +func (db *DB) noteUnusedDriverStatement(c *driverConn, ds *driverStmt) { + db.mu.Lock() + defer db.mu.Unlock() + if c.inUse { + c.onPut = append(c.onPut, func() { + ds.Close() + }) + } else { + c.Lock() + fc := c.finalClosed + c.Unlock() + if !fc { + ds.Close() + } + } +} + +// debugGetPut determines whether getConn & putConn calls' stack traces +// are returned for more verbose crashes. +const debugGetPut = false + +// putConn adds a connection to the db's free pool. +// err is optionally the last error that occurred on this connection. +func (db *DB) putConn(dc *driverConn, err error, resetSession bool) { + if !errors.Is(err, driver.ErrBadConn) { + if !dc.validateConnection(resetSession) { + err = driver.ErrBadConn + } + } + db.mu.Lock() + if !dc.inUse { + db.mu.Unlock() + if debugGetPut { + fmt.Printf("putConn(%v) DUPLICATE was: %s\n\nPREVIOUS was: %s", dc, stack(), db.lastPut[dc]) + } + panic("sql: connection returned that was never out") + } + + if !errors.Is(err, driver.ErrBadConn) && dc.expired(db.maxLifetime) { + db.maxLifetimeClosed++ + err = driver.ErrBadConn + } + if debugGetPut { + db.lastPut[dc] = stack() + } + dc.inUse = false + dc.returnedAt = nowFunc() + + for _, fn := range dc.onPut { + fn() + } + dc.onPut = nil + + if errors.Is(err, driver.ErrBadConn) { + // Don't reuse bad connections. + // Since the conn is considered bad and is being discarded, treat it + // as closed. Don't decrement the open count here, finalClose will + // take care of that. + db.maybeOpenNewConnections() + db.mu.Unlock() + dc.Close() + return + } + if putConnHook != nil { + putConnHook(db, dc) + } + added := db.putConnDBLocked(dc, nil) + db.mu.Unlock() + + if !added { + dc.Close() + return + } +} + +// Satisfy a connRequest or put the driverConn in the idle pool and return true +// or return false. +// putConnDBLocked will satisfy a connRequest if there is one, or it will +// return the *driverConn to the freeConn list if err == nil and the idle +// connection limit will not be exceeded. +// If err != nil, the value of dc is ignored. +// If err == nil, then dc must not equal nil. +// If a connRequest was fulfilled or the *driverConn was placed in the +// freeConn list, then true is returned, otherwise false is returned. +func (db *DB) putConnDBLocked(dc *driverConn, err error) bool { + if db.closed { + return false + } + if db.maxOpen > 0 && db.numOpen > db.maxOpen { + return false + } + if req, ok := db.connRequests.TakeRandom(); ok { + if err == nil { + dc.inUse = true + } + req <- connRequest{ + conn: dc, + err: err, + } + return true + } else if err == nil && !db.closed { + if db.maxIdleConnsLocked() > len(db.freeConn) { + db.freeConn = append(db.freeConn, dc) + db.startCleanerLocked() + return true + } + db.maxIdleClosed++ + } + return false +} + +// maxBadConnRetries is the number of maximum retries if the driver returns +// driver.ErrBadConn to signal a broken connection before forcing a new +// connection to be opened. +const maxBadConnRetries = 2 + +func (db *DB) retry(fn func(strategy connReuseStrategy) error) error { + for i := int64(0); i < maxBadConnRetries; i++ { + err := fn(cachedOrNewConn) + // retry if err is driver.ErrBadConn + if err == nil || !errors.Is(err, driver.ErrBadConn) { + return err + } + } + + return fn(alwaysNewConn) +} + +// PrepareContext creates a prepared statement for later queries or executions. +// Multiple queries or executions may be run concurrently from the +// returned statement. +// The caller must call the statement's [*Stmt.Close] method +// when the statement is no longer needed. +// +// The provided context is used for the preparation of the statement, not for the +// execution of the statement. +func (db *DB) PrepareContext(ctx context.Context, query string) (*Stmt, error) { + var stmt *Stmt + var err error + + err = db.retry(func(strategy connReuseStrategy) error { + stmt, err = db.prepare(ctx, query, strategy) + return err + }) + + return stmt, err +} + +// Prepare creates a prepared statement for later queries or executions. +// Multiple queries or executions may be run concurrently from the +// returned statement. +// The caller must call the statement's [*Stmt.Close] method +// when the statement is no longer needed. +// +// Prepare uses [context.Background] internally; to specify the context, use +// [DB.PrepareContext]. +func (db *DB) Prepare(query string) (*Stmt, error) { + return db.PrepareContext(context.Background(), query) +} + +func (db *DB) prepare(ctx context.Context, query string, strategy connReuseStrategy) (*Stmt, error) { + // TODO: check if db.driver supports an optional + // driver.Preparer interface and call that instead, if so, + // otherwise we make a prepared statement that's bound + // to a connection, and to execute this prepared statement + // we either need to use this connection (if it's free), else + // get a new connection + re-prepare + execute on that one. + dc, err := db.conn(ctx, strategy) + if err != nil { + return nil, err + } + return db.prepareDC(ctx, dc, dc.releaseConn, nil, query) +} + +// prepareDC prepares a query on the driverConn and calls release before +// returning. When cg == nil it implies that a connection pool is used, and +// when cg != nil only a single driver connection is used. +func (db *DB) prepareDC(ctx context.Context, dc *driverConn, release func(error), cg stmtConnGrabber, query string) (*Stmt, error) { + var ds *driverStmt + var err error + defer func() { + release(err) + }() + withLock(dc, func() { + ds, err = dc.prepareLocked(ctx, cg, query) + }) + if err != nil { + return nil, err + } + stmt := &Stmt{ + db: db, + query: query, + cg: cg, + cgds: ds, + } + + // When cg == nil this statement will need to keep track of various + // connections they are prepared on and record the stmt dependency on + // the DB. + if cg == nil { + stmt.css = []connStmt{{dc, ds}} + stmt.lastNumClosed = db.numClosed.Load() + db.addDep(stmt, stmt) + } + return stmt, nil +} + +// ExecContext executes a query without returning any rows. +// The args are for any placeholder parameters in the query. +func (db *DB) ExecContext(ctx context.Context, query string, args ...any) (Result, error) { + var res Result + var err error + + err = db.retry(func(strategy connReuseStrategy) error { + res, err = db.exec(ctx, query, args, strategy) + return err + }) + + return res, err +} + +// Exec executes a query without returning any rows. +// The args are for any placeholder parameters in the query. +// +// Exec uses [context.Background] internally; to specify the context, use +// [DB.ExecContext]. +func (db *DB) Exec(query string, args ...any) (Result, error) { + return db.ExecContext(context.Background(), query, args...) +} + +func (db *DB) exec(ctx context.Context, query string, args []any, strategy connReuseStrategy) (Result, error) { + dc, err := db.conn(ctx, strategy) + if err != nil { + return nil, err + } + return db.execDC(ctx, dc, dc.releaseConn, query, args) +} + +func (db *DB) execDC(ctx context.Context, dc *driverConn, release func(error), query string, args []any) (res Result, err error) { + defer func() { + release(err) + }() + execerCtx, ok := dc.ci.(driver.ExecerContext) + var execer driver.Execer + if !ok { + execer, ok = dc.ci.(driver.Execer) + } + if ok { + var nvdargs []driver.NamedValue + var resi driver.Result + withLock(dc, func() { + nvdargs, err = driverArgsConnLocked(dc.ci, nil, args) + if err != nil { + return + } + resi, err = ctxDriverExec(ctx, execerCtx, execer, query, nvdargs) + }) + if err != driver.ErrSkip { + if err != nil { + return nil, err + } + return driverResult{dc, resi}, nil + } + } + + var si driver.Stmt + withLock(dc, func() { + si, err = ctxDriverPrepare(ctx, dc.ci, query) + }) + if err != nil { + return nil, err + } + ds := &driverStmt{Locker: dc, si: si} + defer ds.Close() + return resultFromStatement(ctx, dc.ci, ds, args...) +} + +// QueryContext executes a query that returns rows, typically a SELECT. +// The args are for any placeholder parameters in the query. +func (db *DB) QueryContext(ctx context.Context, query string, args ...any) (*Rows, error) { + var rows *Rows + var err error + + err = db.retry(func(strategy connReuseStrategy) error { + rows, err = db.query(ctx, query, args, strategy) + return err + }) + + return rows, err +} + +// Query executes a query that returns rows, typically a SELECT. +// The args are for any placeholder parameters in the query. +// +// Query uses [context.Background] internally; to specify the context, use +// [DB.QueryContext]. +func (db *DB) Query(query string, args ...any) (*Rows, error) { + return db.QueryContext(context.Background(), query, args...) +} + +func (db *DB) query(ctx context.Context, query string, args []any, strategy connReuseStrategy) (*Rows, error) { + dc, err := db.conn(ctx, strategy) + if err != nil { + return nil, err + } + + return db.queryDC(ctx, nil, dc, dc.releaseConn, query, args) +} + +// queryDC executes a query on the given connection. +// The connection gets released by the releaseConn function. +// The ctx context is from a query method and the txctx context is from an +// optional transaction context. +func (db *DB) queryDC(ctx, txctx context.Context, dc *driverConn, releaseConn func(error), query string, args []any) (*Rows, error) { + queryerCtx, ok := dc.ci.(driver.QueryerContext) + var queryer driver.Queryer + if !ok { + queryer, ok = dc.ci.(driver.Queryer) + } + if ok { + var nvdargs []driver.NamedValue + var rowsi driver.Rows + var err error + withLock(dc, func() { + nvdargs, err = driverArgsConnLocked(dc.ci, nil, args) + if err != nil { + return + } + rowsi, err = ctxDriverQuery(ctx, queryerCtx, queryer, query, nvdargs) + }) + if err != driver.ErrSkip { + if err != nil { + releaseConn(err) + return nil, err + } + // Note: ownership of dc passes to the *Rows, to be freed + // with releaseConn. + rows := &Rows{ + dc: dc, + releaseConn: releaseConn, + rowsi: rowsi, + } + rows.initContextClose(ctx, txctx) + return rows, nil + } + } + + var si driver.Stmt + var err error + withLock(dc, func() { + si, err = ctxDriverPrepare(ctx, dc.ci, query) + }) + if err != nil { + releaseConn(err) + return nil, err + } + + ds := &driverStmt{Locker: dc, si: si} + rowsi, err := rowsiFromStatement(ctx, dc.ci, ds, args...) + if err != nil { + ds.Close() + releaseConn(err) + return nil, err + } + + // Note: ownership of ci passes to the *Rows, to be freed + // with releaseConn. + rows := &Rows{ + dc: dc, + releaseConn: releaseConn, + rowsi: rowsi, + closeStmt: ds, + } + rows.initContextClose(ctx, txctx) + return rows, nil +} + +// QueryRowContext executes a query that is expected to return at most one row. +// QueryRowContext always returns a non-nil value. Errors are deferred until +// [Row]'s Scan method is called. +// If the query selects no rows, the [*Row.Scan] will return [ErrNoRows]. +// Otherwise, [*Row.Scan] scans the first selected row and discards +// the rest. +func (db *DB) QueryRowContext(ctx context.Context, query string, args ...any) *Row { + rows, err := db.QueryContext(ctx, query, args...) + return &Row{rows: rows, err: err} +} + +// QueryRow executes a query that is expected to return at most one row. +// QueryRow always returns a non-nil value. Errors are deferred until +// [Row]'s Scan method is called. +// If the query selects no rows, the [*Row.Scan] will return [ErrNoRows]. +// Otherwise, [*Row.Scan] scans the first selected row and discards +// the rest. +// +// QueryRow uses [context.Background] internally; to specify the context, use +// [DB.QueryRowContext]. +func (db *DB) QueryRow(query string, args ...any) *Row { + return db.QueryRowContext(context.Background(), query, args...) +} + +// BeginTx starts a transaction. +// +// The provided context is used until the transaction is committed or rolled back. +// If the context is canceled, the sql package will roll back +// the transaction. [Tx.Commit] will return an error if the context provided to +// BeginTx is canceled. +// +// The provided [TxOptions] is optional and may be nil if defaults should be used. +// If a non-default isolation level is used that the driver doesn't support, +// an error will be returned. +func (db *DB) BeginTx(ctx context.Context, opts *TxOptions) (*Tx, error) { + var tx *Tx + var err error + + err = db.retry(func(strategy connReuseStrategy) error { + tx, err = db.begin(ctx, opts, strategy) + return err + }) + + return tx, err +} + +// Begin starts a transaction. The default isolation level is dependent on +// the driver. +// +// Begin uses [context.Background] internally; to specify the context, use +// [DB.BeginTx]. +func (db *DB) Begin() (*Tx, error) { + return db.BeginTx(context.Background(), nil) +} + +func (db *DB) begin(ctx context.Context, opts *TxOptions, strategy connReuseStrategy) (tx *Tx, err error) { + dc, err := db.conn(ctx, strategy) + if err != nil { + return nil, err + } + return db.beginDC(ctx, dc, dc.releaseConn, opts) +} + +// beginDC starts a transaction. The provided dc must be valid and ready to use. +func (db *DB) beginDC(ctx context.Context, dc *driverConn, release func(error), opts *TxOptions) (tx *Tx, err error) { + var txi driver.Tx + keepConnOnRollback := false + withLock(dc, func() { + _, hasSessionResetter := dc.ci.(driver.SessionResetter) + _, hasConnectionValidator := dc.ci.(driver.Validator) + keepConnOnRollback = hasSessionResetter && hasConnectionValidator + txi, err = ctxDriverBegin(ctx, opts, dc.ci) + }) + if err != nil { + release(err) + return nil, err + } + + // Schedule the transaction to rollback when the context is canceled. + // The cancel function in Tx will be called after done is set to true. + ctx, cancel := context.WithCancel(ctx) + tx = &Tx{ + db: db, + dc: dc, + releaseConn: release, + txi: txi, + cancel: cancel, + keepConnOnRollback: keepConnOnRollback, + ctx: ctx, + } + go tx.awaitDone() + return tx, nil +} + +// Driver returns the database's underlying driver. +func (db *DB) Driver() driver.Driver { + return db.connector.Driver() +} + +// ErrConnDone is returned by any operation that is performed on a connection +// that has already been returned to the connection pool. +var ErrConnDone = errors.New("sql: connection is already closed") + +// Conn returns a single connection by either opening a new connection +// or returning an existing connection from the connection pool. Conn will +// block until either a connection is returned or ctx is canceled. +// Queries run on the same Conn will be run in the same database session. +// +// Every Conn must be returned to the database pool after use by +// calling [Conn.Close]. +func (db *DB) Conn(ctx context.Context) (*Conn, error) { + var dc *driverConn + var err error + + err = db.retry(func(strategy connReuseStrategy) error { + dc, err = db.conn(ctx, strategy) + return err + }) + + if err != nil { + return nil, err + } + + conn := &Conn{ + db: db, + dc: dc, + } + return conn, nil +} + +type releaseConn func(error) + +// Conn represents a single database connection rather than a pool of database +// connections. Prefer running queries from [DB] unless there is a specific +// need for a continuous single database connection. +// +// A Conn must call [Conn.Close] to return the connection to the database pool +// and may do so concurrently with a running query. +// +// After a call to [Conn.Close], all operations on the +// connection fail with [ErrConnDone]. +type Conn struct { + db *DB + + // closemu prevents the connection from closing while there + // is an active query. It is held for read during queries + // and exclusively during close. + closemu sync.RWMutex + + // dc is owned until close, at which point + // it's returned to the connection pool. + dc *driverConn + + // done transitions from false to true exactly once, on close. + // Once done, all operations fail with ErrConnDone. + done atomic.Bool + + releaseConnOnce sync.Once + // releaseConnCache is a cache of c.closemuRUnlockCondReleaseConn + // to save allocations in a call to grabConn. + releaseConnCache releaseConn +} + +// grabConn takes a context to implement stmtConnGrabber +// but the context is not used. +func (c *Conn) grabConn(context.Context) (*driverConn, releaseConn, error) { + if c.done.Load() { + return nil, nil, ErrConnDone + } + c.releaseConnOnce.Do(func() { + c.releaseConnCache = c.closemuRUnlockCondReleaseConn + }) + c.closemu.RLock() + return c.dc, c.releaseConnCache, nil +} + +// PingContext verifies the connection to the database is still alive. +func (c *Conn) PingContext(ctx context.Context) error { + dc, release, err := c.grabConn(ctx) + if err != nil { + return err + } + return c.db.pingDC(ctx, dc, release) +} + +// ExecContext executes a query without returning any rows. +// The args are for any placeholder parameters in the query. +func (c *Conn) ExecContext(ctx context.Context, query string, args ...any) (Result, error) { + dc, release, err := c.grabConn(ctx) + if err != nil { + return nil, err + } + return c.db.execDC(ctx, dc, release, query, args) +} + +// QueryContext executes a query that returns rows, typically a SELECT. +// The args are for any placeholder parameters in the query. +func (c *Conn) QueryContext(ctx context.Context, query string, args ...any) (*Rows, error) { + dc, release, err := c.grabConn(ctx) + if err != nil { + return nil, err + } + return c.db.queryDC(ctx, nil, dc, release, query, args) +} + +// QueryRowContext executes a query that is expected to return at most one row. +// QueryRowContext always returns a non-nil value. Errors are deferred until +// the [*Row.Scan] method is called. +// If the query selects no rows, the [*Row.Scan] will return [ErrNoRows]. +// Otherwise, the [*Row.Scan] scans the first selected row and discards +// the rest. +func (c *Conn) QueryRowContext(ctx context.Context, query string, args ...any) *Row { + rows, err := c.QueryContext(ctx, query, args...) + return &Row{rows: rows, err: err} +} + +// PrepareContext creates a prepared statement for later queries or executions. +// Multiple queries or executions may be run concurrently from the +// returned statement. +// The caller must call the statement's [*Stmt.Close] method +// when the statement is no longer needed. +// +// The provided context is used for the preparation of the statement, not for the +// execution of the statement. +func (c *Conn) PrepareContext(ctx context.Context, query string) (*Stmt, error) { + dc, release, err := c.grabConn(ctx) + if err != nil { + return nil, err + } + return c.db.prepareDC(ctx, dc, release, c, query) +} + +// Raw executes f exposing the underlying driver connection for the +// duration of f. The driverConn must not be used outside of f. +// +// Once f returns and err is not [driver.ErrBadConn], the [Conn] will continue to be usable +// until [Conn.Close] is called. +func (c *Conn) Raw(f func(driverConn any) error) (err error) { + var dc *driverConn + var release releaseConn + + // grabConn takes a context to implement stmtConnGrabber, but the context is not used. + dc, release, err = c.grabConn(nil) + if err != nil { + return + } + fPanic := true + dc.Mutex.Lock() + defer func() { + dc.Mutex.Unlock() + + // If f panics fPanic will remain true. + // Ensure an error is passed to release so the connection + // may be discarded. + if fPanic { + err = driver.ErrBadConn + } + release(err) + }() + err = f(dc.ci) + fPanic = false + + return +} + +// BeginTx starts a transaction. +// +// The provided context is used until the transaction is committed or rolled back. +// If the context is canceled, the sql package will roll back +// the transaction. [Tx.Commit] will return an error if the context provided to +// BeginTx is canceled. +// +// The provided [TxOptions] is optional and may be nil if defaults should be used. +// If a non-default isolation level is used that the driver doesn't support, +// an error will be returned. +func (c *Conn) BeginTx(ctx context.Context, opts *TxOptions) (*Tx, error) { + dc, release, err := c.grabConn(ctx) + if err != nil { + return nil, err + } + return c.db.beginDC(ctx, dc, release, opts) +} + +// closemuRUnlockCondReleaseConn read unlocks closemu +// as the sql operation is done with the dc. +func (c *Conn) closemuRUnlockCondReleaseConn(err error) { + c.closemu.RUnlock() + if errors.Is(err, driver.ErrBadConn) { + c.close(err) + } +} + +func (c *Conn) txCtx() context.Context { + return nil +} + +func (c *Conn) close(err error) error { + if !c.done.CompareAndSwap(false, true) { + return ErrConnDone + } + + // Lock around releasing the driver connection + // to ensure all queries have been stopped before doing so. + c.closemu.Lock() + defer c.closemu.Unlock() + + c.dc.releaseConn(err) + c.dc = nil + c.db = nil + return err +} + +// Close returns the connection to the connection pool. +// All operations after a Close will return with [ErrConnDone]. +// Close is safe to call concurrently with other operations and will +// block until all other operations finish. It may be useful to first +// cancel any used context and then call close directly after. +func (c *Conn) Close() error { + return c.close(nil) +} + +// Tx is an in-progress database transaction. +// +// A transaction must end with a call to [Tx.Commit] or [Tx.Rollback]. +// +// After a call to [Tx.Commit] or [Tx.Rollback], all operations on the +// transaction fail with [ErrTxDone]. +// +// The statements prepared for a transaction by calling +// the transaction's [Tx.Prepare] or [Tx.Stmt] methods are closed +// by the call to [Tx.Commit] or [Tx.Rollback]. +type Tx struct { + db *DB + + // closemu prevents the transaction from closing while there + // is an active query. It is held for read during queries + // and exclusively during close. + closemu sync.RWMutex + + // dc is owned exclusively until Commit or Rollback, at which point + // it's returned with putConn. + dc *driverConn + txi driver.Tx + + // releaseConn is called once the Tx is closed to release + // any held driverConn back to the pool. + releaseConn func(error) + + // done transitions from false to true exactly once, on Commit + // or Rollback. once done, all operations fail with + // ErrTxDone. + done atomic.Bool + + // keepConnOnRollback is true if the driver knows + // how to reset the connection's session and if need be discard + // the connection. + keepConnOnRollback bool + + // All Stmts prepared for this transaction. These will be closed after the + // transaction has been committed or rolled back. + stmts struct { + sync.Mutex + v []*Stmt + } + + // cancel is called after done transitions from 0 to 1. + cancel func() + + // ctx lives for the life of the transaction. + ctx context.Context +} + +// awaitDone blocks until the context in Tx is canceled and rolls back +// the transaction if it's not already done. +func (tx *Tx) awaitDone() { + // Wait for either the transaction to be committed or rolled + // back, or for the associated context to be closed. + <-tx.ctx.Done() + + // Discard and close the connection used to ensure the + // transaction is closed and the resources are released. This + // rollback does nothing if the transaction has already been + // committed or rolled back. + // Do not discard the connection if the connection knows + // how to reset the session. + discardConnection := !tx.keepConnOnRollback + tx.rollback(discardConnection) +} + +func (tx *Tx) isDone() bool { + return tx.done.Load() +} + +// ErrTxDone is returned by any operation that is performed on a transaction +// that has already been committed or rolled back. +var ErrTxDone = errors.New("sql: transaction has already been committed or rolled back") + +// close returns the connection to the pool and +// must only be called by Tx.rollback or Tx.Commit while +// tx is already canceled and won't be executed concurrently. +func (tx *Tx) close(err error) { + tx.releaseConn(err) + tx.dc = nil + tx.txi = nil +} + +// hookTxGrabConn specifies an optional hook to be called on +// a successful call to (*Tx).grabConn. For tests. +var hookTxGrabConn func() + +func (tx *Tx) grabConn(ctx context.Context) (*driverConn, releaseConn, error) { + select { + default: + case <-ctx.Done(): + return nil, nil, ctx.Err() + } + + // closemu.RLock must come before the check for isDone to prevent the Tx from + // closing while a query is executing. + tx.closemu.RLock() + if tx.isDone() { + tx.closemu.RUnlock() + return nil, nil, ErrTxDone + } + if hookTxGrabConn != nil { // test hook + hookTxGrabConn() + } + return tx.dc, tx.closemuRUnlockRelease, nil +} + +func (tx *Tx) txCtx() context.Context { + return tx.ctx +} + +// closemuRUnlockRelease is used as a func(error) method value in +// [DB.ExecContext] and [DB.QueryContext]. Unlocking in the releaseConn keeps +// the driver conn from being returned to the connection pool until +// the Rows has been closed. +func (tx *Tx) closemuRUnlockRelease(error) { + tx.closemu.RUnlock() +} + +// Closes all Stmts prepared for this transaction. +func (tx *Tx) closePrepared() { + tx.stmts.Lock() + defer tx.stmts.Unlock() + for _, stmt := range tx.stmts.v { + stmt.Close() + } +} + +// Commit commits the transaction. +func (tx *Tx) Commit() error { + // Check context first to avoid transaction leak. + // If put it behind tx.done CompareAndSwap statement, we can't ensure + // the consistency between tx.done and the real COMMIT operation. + select { + default: + case <-tx.ctx.Done(): + if tx.done.Load() { + return ErrTxDone + } + return tx.ctx.Err() + } + if !tx.done.CompareAndSwap(false, true) { + return ErrTxDone + } + + // Cancel the Tx to release any active R-closemu locks. + // This is safe to do because tx.done has already transitioned + // from 0 to 1. Hold the W-closemu lock prior to rollback + // to ensure no other connection has an active query. + tx.cancel() + tx.closemu.Lock() + tx.closemu.Unlock() + + var err error + withLock(tx.dc, func() { + err = tx.txi.Commit() + }) + if !errors.Is(err, driver.ErrBadConn) { + tx.closePrepared() + } + tx.close(err) + return err +} + +var rollbackHook func() + +// rollback aborts the transaction and optionally forces the pool to discard +// the connection. +func (tx *Tx) rollback(discardConn bool) error { + if !tx.done.CompareAndSwap(false, true) { + return ErrTxDone + } + + if rollbackHook != nil { + rollbackHook() + } + + // Cancel the Tx to release any active R-closemu locks. + // This is safe to do because tx.done has already transitioned + // from 0 to 1. Hold the W-closemu lock prior to rollback + // to ensure no other connection has an active query. + tx.cancel() + tx.closemu.Lock() + tx.closemu.Unlock() + + var err error + withLock(tx.dc, func() { + err = tx.txi.Rollback() + }) + if !errors.Is(err, driver.ErrBadConn) { + tx.closePrepared() + } + if discardConn { + err = driver.ErrBadConn + } + tx.close(err) + return err +} + +// Rollback aborts the transaction. +func (tx *Tx) Rollback() error { + return tx.rollback(false) +} + +// PrepareContext creates a prepared statement for use within a transaction. +// +// The returned statement operates within the transaction and will be closed +// when the transaction has been committed or rolled back. +// +// To use an existing prepared statement on this transaction, see [Tx.Stmt]. +// +// The provided context will be used for the preparation of the context, not +// for the execution of the returned statement. The returned statement +// will run in the transaction context. +func (tx *Tx) PrepareContext(ctx context.Context, query string) (*Stmt, error) { + dc, release, err := tx.grabConn(ctx) + if err != nil { + return nil, err + } + + stmt, err := tx.db.prepareDC(ctx, dc, release, tx, query) + if err != nil { + return nil, err + } + tx.stmts.Lock() + tx.stmts.v = append(tx.stmts.v, stmt) + tx.stmts.Unlock() + return stmt, nil +} + +// Prepare creates a prepared statement for use within a transaction. +// +// The returned statement operates within the transaction and will be closed +// when the transaction has been committed or rolled back. +// +// To use an existing prepared statement on this transaction, see [Tx.Stmt]. +// +// Prepare uses [context.Background] internally; to specify the context, use +// [Tx.PrepareContext]. +func (tx *Tx) Prepare(query string) (*Stmt, error) { + return tx.PrepareContext(context.Background(), query) +} + +// StmtContext returns a transaction-specific prepared statement from +// an existing statement. +// +// Example: +// +// updateMoney, err := db.Prepare("UPDATE balance SET money=money+? WHERE id=?") +// ... +// tx, err := db.Begin() +// ... +// res, err := tx.StmtContext(ctx, updateMoney).Exec(123.45, 98293203) +// +// The provided context is used for the preparation of the statement, not for the +// execution of the statement. +// +// The returned statement operates within the transaction and will be closed +// when the transaction has been committed or rolled back. +func (tx *Tx) StmtContext(ctx context.Context, stmt *Stmt) *Stmt { + dc, release, err := tx.grabConn(ctx) + if err != nil { + return &Stmt{stickyErr: err} + } + defer release(nil) + + if tx.db != stmt.db { + return &Stmt{stickyErr: errors.New("sql: Tx.Stmt: statement from different database used")} + } + var si driver.Stmt + var parentStmt *Stmt + stmt.mu.Lock() + if stmt.closed || stmt.cg != nil { + // If the statement has been closed or already belongs to a + // transaction, we can't reuse it in this connection. + // Since tx.StmtContext should never need to be called with a + // Stmt already belonging to tx, we ignore this edge case and + // re-prepare the statement in this case. No need to add + // code-complexity for this. + stmt.mu.Unlock() + withLock(dc, func() { + si, err = ctxDriverPrepare(ctx, dc.ci, stmt.query) + }) + if err != nil { + return &Stmt{stickyErr: err} + } + } else { + stmt.removeClosedStmtLocked() + // See if the statement has already been prepared on this connection, + // and reuse it if possible. + for _, v := range stmt.css { + if v.dc == dc { + si = v.ds.si + break + } + } + + stmt.mu.Unlock() + + if si == nil { + var ds *driverStmt + withLock(dc, func() { + ds, err = stmt.prepareOnConnLocked(ctx, dc) + }) + if err != nil { + return &Stmt{stickyErr: err} + } + si = ds.si + } + parentStmt = stmt + } + + txs := &Stmt{ + db: tx.db, + cg: tx, + cgds: &driverStmt{ + Locker: dc, + si: si, + }, + parentStmt: parentStmt, + query: stmt.query, + } + if parentStmt != nil { + tx.db.addDep(parentStmt, txs) + } + tx.stmts.Lock() + tx.stmts.v = append(tx.stmts.v, txs) + tx.stmts.Unlock() + return txs +} + +// Stmt returns a transaction-specific prepared statement from +// an existing statement. +// +// Example: +// +// updateMoney, err := db.Prepare("UPDATE balance SET money=money+? WHERE id=?") +// ... +// tx, err := db.Begin() +// ... +// res, err := tx.Stmt(updateMoney).Exec(123.45, 98293203) +// +// The returned statement operates within the transaction and will be closed +// when the transaction has been committed or rolled back. +// +// Stmt uses [context.Background] internally; to specify the context, use +// [Tx.StmtContext]. +func (tx *Tx) Stmt(stmt *Stmt) *Stmt { + return tx.StmtContext(context.Background(), stmt) +} + +// ExecContext executes a query that doesn't return rows. +// For example: an INSERT and UPDATE. +func (tx *Tx) ExecContext(ctx context.Context, query string, args ...any) (Result, error) { + dc, release, err := tx.grabConn(ctx) + if err != nil { + return nil, err + } + return tx.db.execDC(ctx, dc, release, query, args) +} + +// Exec executes a query that doesn't return rows. +// For example: an INSERT and UPDATE. +// +// Exec uses [context.Background] internally; to specify the context, use +// [Tx.ExecContext]. +func (tx *Tx) Exec(query string, args ...any) (Result, error) { + return tx.ExecContext(context.Background(), query, args...) +} + +// QueryContext executes a query that returns rows, typically a SELECT. +func (tx *Tx) QueryContext(ctx context.Context, query string, args ...any) (*Rows, error) { + dc, release, err := tx.grabConn(ctx) + if err != nil { + return nil, err + } + + return tx.db.queryDC(ctx, tx.ctx, dc, release, query, args) +} + +// Query executes a query that returns rows, typically a SELECT. +// +// Query uses [context.Background] internally; to specify the context, use +// [Tx.QueryContext]. +func (tx *Tx) Query(query string, args ...any) (*Rows, error) { + return tx.QueryContext(context.Background(), query, args...) +} + +// QueryRowContext executes a query that is expected to return at most one row. +// QueryRowContext always returns a non-nil value. Errors are deferred until +// [Row]'s Scan method is called. +// If the query selects no rows, the [*Row.Scan] will return [ErrNoRows]. +// Otherwise, the [*Row.Scan] scans the first selected row and discards +// the rest. +func (tx *Tx) QueryRowContext(ctx context.Context, query string, args ...any) *Row { + rows, err := tx.QueryContext(ctx, query, args...) + return &Row{rows: rows, err: err} +} + +// QueryRow executes a query that is expected to return at most one row. +// QueryRow always returns a non-nil value. Errors are deferred until +// [Row]'s Scan method is called. +// If the query selects no rows, the [*Row.Scan] will return [ErrNoRows]. +// Otherwise, the [*Row.Scan] scans the first selected row and discards +// the rest. +// +// QueryRow uses [context.Background] internally; to specify the context, use +// [Tx.QueryRowContext]. +func (tx *Tx) QueryRow(query string, args ...any) *Row { + return tx.QueryRowContext(context.Background(), query, args...) +} + +// connStmt is a prepared statement on a particular connection. +type connStmt struct { + dc *driverConn + ds *driverStmt +} + +// stmtConnGrabber represents a Tx or Conn that will return the underlying +// driverConn and release function. +type stmtConnGrabber interface { + // grabConn returns the driverConn and the associated release function + // that must be called when the operation completes. + grabConn(context.Context) (*driverConn, releaseConn, error) + + // txCtx returns the transaction context if available. + // The returned context should be selected on along with + // any query context when awaiting a cancel. + txCtx() context.Context +} + +var ( + _ stmtConnGrabber = &Tx{} + _ stmtConnGrabber = &Conn{} +) + +// Stmt is a prepared statement. +// A Stmt is safe for concurrent use by multiple goroutines. +// +// If a Stmt is prepared on a [Tx] or [Conn], it will be bound to a single +// underlying connection forever. If the [Tx] or [Conn] closes, the Stmt will +// become unusable and all operations will return an error. +// If a Stmt is prepared on a [DB], it will remain usable for the lifetime of the +// [DB]. When the Stmt needs to execute on a new underlying connection, it will +// prepare itself on the new connection automatically. +type Stmt struct { + // Immutable: + db *DB // where we came from + query string // that created the Stmt + stickyErr error // if non-nil, this error is returned for all operations + + closemu sync.RWMutex // held exclusively during close, for read otherwise. + + // If Stmt is prepared on a Tx or Conn then cg is present and will + // only ever grab a connection from cg. + // If cg is nil then the Stmt must grab an arbitrary connection + // from db and determine if it must prepare the stmt again by + // inspecting css. + cg stmtConnGrabber + cgds *driverStmt + + // parentStmt is set when a transaction-specific statement + // is requested from an identical statement prepared on the same + // conn. parentStmt is used to track the dependency of this statement + // on its originating ("parent") statement so that parentStmt may + // be closed by the user without them having to know whether or not + // any transactions are still using it. + parentStmt *Stmt + + mu sync.Mutex // protects the rest of the fields + closed bool + + // css is a list of underlying driver statement interfaces + // that are valid on particular connections. This is only + // used if cg == nil and one is found that has idle + // connections. If cg != nil, cgds is always used. + css []connStmt + + // lastNumClosed is copied from db.numClosed when Stmt is created + // without tx and closed connections in css are removed. + lastNumClosed uint64 +} + +// ExecContext executes a prepared statement with the given arguments and +// returns a [Result] summarizing the effect of the statement. +func (s *Stmt) ExecContext(ctx context.Context, args ...any) (Result, error) { + s.closemu.RLock() + defer s.closemu.RUnlock() + + var res Result + err := s.db.retry(func(strategy connReuseStrategy) error { + dc, releaseConn, ds, err := s.connStmt(ctx, strategy) + if err != nil { + return err + } + + res, err = resultFromStatement(ctx, dc.ci, ds, args...) + releaseConn(err) + return err + }) + + return res, err +} + +// Exec executes a prepared statement with the given arguments and +// returns a [Result] summarizing the effect of the statement. +// +// Exec uses [context.Background] internally; to specify the context, use +// [Stmt.ExecContext]. +func (s *Stmt) Exec(args ...any) (Result, error) { + return s.ExecContext(context.Background(), args...) +} + +func resultFromStatement(ctx context.Context, ci driver.Conn, ds *driverStmt, args ...any) (Result, error) { + ds.Lock() + defer ds.Unlock() + + dargs, err := driverArgsConnLocked(ci, ds, args) + if err != nil { + return nil, err + } + + resi, err := ctxDriverStmtExec(ctx, ds.si, dargs) + if err != nil { + return nil, err + } + return driverResult{ds.Locker, resi}, nil +} + +// removeClosedStmtLocked removes closed conns in s.css. +// +// To avoid lock contention on DB.mu, we do it only when +// s.db.numClosed - s.lastNum is large enough. +func (s *Stmt) removeClosedStmtLocked() { + t := len(s.css)/2 + 1 + if t > 10 { + t = 10 + } + dbClosed := s.db.numClosed.Load() + if dbClosed-s.lastNumClosed < uint64(t) { + return + } + + s.db.mu.Lock() + for i := 0; i < len(s.css); i++ { + if s.css[i].dc.dbmuClosed { + s.css[i] = s.css[len(s.css)-1] + // Zero out the last element (for GC) before shrinking the slice. + s.css[len(s.css)-1] = connStmt{} + s.css = s.css[:len(s.css)-1] + i-- + } + } + s.db.mu.Unlock() + s.lastNumClosed = dbClosed +} + +// connStmt returns a free driver connection on which to execute the +// statement, a function to call to release the connection, and a +// statement bound to that connection. +func (s *Stmt) connStmt(ctx context.Context, strategy connReuseStrategy) (dc *driverConn, releaseConn func(error), ds *driverStmt, err error) { + if err = s.stickyErr; err != nil { + return + } + s.mu.Lock() + if s.closed { + s.mu.Unlock() + err = errors.New("sql: statement is closed") + return + } + + // In a transaction or connection, we always use the connection that the + // stmt was created on. + if s.cg != nil { + s.mu.Unlock() + dc, releaseConn, err = s.cg.grabConn(ctx) // blocks, waiting for the connection. + if err != nil { + return + } + return dc, releaseConn, s.cgds, nil + } + + s.removeClosedStmtLocked() + s.mu.Unlock() + + dc, err = s.db.conn(ctx, strategy) + if err != nil { + return nil, nil, nil, err + } + + s.mu.Lock() + for _, v := range s.css { + if v.dc == dc { + s.mu.Unlock() + return dc, dc.releaseConn, v.ds, nil + } + } + s.mu.Unlock() + + // No luck; we need to prepare the statement on this connection + withLock(dc, func() { + ds, err = s.prepareOnConnLocked(ctx, dc) + }) + if err != nil { + dc.releaseConn(err) + return nil, nil, nil, err + } + + return dc, dc.releaseConn, ds, nil +} + +// prepareOnConnLocked prepares the query in Stmt s on dc and adds it to the list of +// open connStmt on the statement. It assumes the caller is holding the lock on dc. +func (s *Stmt) prepareOnConnLocked(ctx context.Context, dc *driverConn) (*driverStmt, error) { + si, err := dc.prepareLocked(ctx, s.cg, s.query) + if err != nil { + return nil, err + } + cs := connStmt{dc, si} + s.mu.Lock() + s.css = append(s.css, cs) + s.mu.Unlock() + return cs.ds, nil +} + +// QueryContext executes a prepared query statement with the given arguments +// and returns the query results as a [*Rows]. +func (s *Stmt) QueryContext(ctx context.Context, args ...any) (*Rows, error) { + s.closemu.RLock() + defer s.closemu.RUnlock() + + var rowsi driver.Rows + var rows *Rows + + err := s.db.retry(func(strategy connReuseStrategy) error { + dc, releaseConn, ds, err := s.connStmt(ctx, strategy) + if err != nil { + return err + } + + rowsi, err = rowsiFromStatement(ctx, dc.ci, ds, args...) + if err == nil { + // Note: ownership of ci passes to the *Rows, to be freed + // with releaseConn. + rows = &Rows{ + dc: dc, + rowsi: rowsi, + // releaseConn set below + } + // addDep must be added before initContextClose or it could attempt + // to removeDep before it has been added. + s.db.addDep(s, rows) + + // releaseConn must be set before initContextClose or it could + // release the connection before it is set. + rows.releaseConn = func(err error) { + releaseConn(err) + s.db.removeDep(s, rows) + } + var txctx context.Context + if s.cg != nil { + txctx = s.cg.txCtx() + } + rows.initContextClose(ctx, txctx) + return nil + } + + releaseConn(err) + return err + }) + + return rows, err +} + +// Query executes a prepared query statement with the given arguments +// and returns the query results as a *Rows. +// +// Query uses [context.Background] internally; to specify the context, use +// [Stmt.QueryContext]. +func (s *Stmt) Query(args ...any) (*Rows, error) { + return s.QueryContext(context.Background(), args...) +} + +func rowsiFromStatement(ctx context.Context, ci driver.Conn, ds *driverStmt, args ...any) (driver.Rows, error) { + ds.Lock() + defer ds.Unlock() + dargs, err := driverArgsConnLocked(ci, ds, args) + if err != nil { + return nil, err + } + return ctxDriverStmtQuery(ctx, ds.si, dargs) +} + +// QueryRowContext executes a prepared query statement with the given arguments. +// If an error occurs during the execution of the statement, that error will +// be returned by a call to Scan on the returned [*Row], which is always non-nil. +// If the query selects no rows, the [*Row.Scan] will return [ErrNoRows]. +// Otherwise, the [*Row.Scan] scans the first selected row and discards +// the rest. +func (s *Stmt) QueryRowContext(ctx context.Context, args ...any) *Row { + rows, err := s.QueryContext(ctx, args...) + if err != nil { + return &Row{err: err} + } + return &Row{rows: rows} +} + +// QueryRow executes a prepared query statement with the given arguments. +// If an error occurs during the execution of the statement, that error will +// be returned by a call to Scan on the returned [*Row], which is always non-nil. +// If the query selects no rows, the [*Row.Scan] will return [ErrNoRows]. +// Otherwise, the [*Row.Scan] scans the first selected row and discards +// the rest. +// +// Example usage: +// +// var name string +// err := nameByUseridStmt.QueryRow(id).Scan(&name) +// +// QueryRow uses [context.Background] internally; to specify the context, use +// [Stmt.QueryRowContext]. +func (s *Stmt) QueryRow(args ...any) *Row { + return s.QueryRowContext(context.Background(), args...) +} + +// Close closes the statement. +func (s *Stmt) Close() error { + s.closemu.Lock() + defer s.closemu.Unlock() + + if s.stickyErr != nil { + return s.stickyErr + } + s.mu.Lock() + if s.closed { + s.mu.Unlock() + return nil + } + s.closed = true + txds := s.cgds + s.cgds = nil + + s.mu.Unlock() + + if s.cg == nil { + return s.db.removeDep(s, s) + } + + if s.parentStmt != nil { + // If parentStmt is set, we must not close s.txds since it's stored + // in the css array of the parentStmt. + return s.db.removeDep(s.parentStmt, s) + } + return txds.Close() +} + +func (s *Stmt) finalClose() error { + s.mu.Lock() + defer s.mu.Unlock() + if s.css != nil { + for _, v := range s.css { + s.db.noteUnusedDriverStatement(v.dc, v.ds) + v.dc.removeOpenStmt(v.ds) + } + s.css = nil + } + return nil +} + +// Rows is the result of a query. Its cursor starts before the first row +// of the result set. Use [Rows.Next] to advance from row to row. +type Rows struct { + dc *driverConn // owned; must call releaseConn when closed to release + releaseConn func(error) + rowsi driver.Rows + cancel func() // called when Rows is closed, may be nil. + closeStmt *driverStmt // if non-nil, statement to Close on close + + contextDone atomic.Pointer[error] // error that awaitDone saw; set before close attempt + + // closemu prevents Rows from closing while there + // is an active streaming result. It is held for read during non-close operations + // and exclusively during close. + // + // closemu guards lasterr and closed. + closemu sync.RWMutex + lasterr error // non-nil only if closed is true + closed bool + + // closemuScanHold is whether the previous call to Scan kept closemu RLock'ed + // without unlocking it. It does that when the user passes a *RawBytes scan + // target. In that case, we need to prevent awaitDone from closing the Rows + // while the user's still using the memory. See go.dev/issue/60304. + // + // It is only used by Scan, Next, and NextResultSet which are expected + // not to be called concurrently. + closemuScanHold bool + + // hitEOF is whether Next hit the end of the rows without + // encountering an error. It's set in Next before + // returning. It's only used by Next and Err which are + // expected not to be called concurrently. + hitEOF bool + + // lastcols is only used in Scan, Next, and NextResultSet which are expected + // not to be called concurrently. + lastcols []driver.Value + + // raw is a buffer for RawBytes that persists between Scan calls. + // This is used when the driver returns a mismatched type that requires + // a cloning allocation. For example, if the driver returns a *string and + // the user is scanning into a *RawBytes, we need to copy the string. + // The raw buffer here lets us reuse the memory for that copy across Scan calls. + raw []byte +} + +// lasterrOrErrLocked returns either lasterr or the provided err. +// rs.closemu must be read-locked. +func (rs *Rows) lasterrOrErrLocked(err error) error { + if rs.lasterr != nil && rs.lasterr != io.EOF { + return rs.lasterr + } + return err +} + +// bypassRowsAwaitDone is only used for testing. +// If true, it will not close the Rows automatically from the context. +var bypassRowsAwaitDone = false + +func (rs *Rows) initContextClose(ctx, txctx context.Context) { + if ctx.Done() == nil && (txctx == nil || txctx.Done() == nil) { + return + } + if bypassRowsAwaitDone { + return + } + closectx, cancel := context.WithCancel(ctx) + rs.cancel = cancel + go rs.awaitDone(ctx, txctx, closectx) +} + +// awaitDone blocks until ctx, txctx, or closectx is canceled. +// The ctx is provided from the query context. +// If the query was issued in a transaction, the transaction's context +// is also provided in txctx, to ensure Rows is closed if the Tx is closed. +// The closectx is closed by an explicit call to rs.Close. +func (rs *Rows) awaitDone(ctx, txctx, closectx context.Context) { + var txctxDone <-chan struct{} + if txctx != nil { + txctxDone = txctx.Done() + } + select { + case <-ctx.Done(): + err := ctx.Err() + rs.contextDone.Store(&err) + case <-txctxDone: + err := txctx.Err() + rs.contextDone.Store(&err) + case <-closectx.Done(): + // rs.cancel was called via Close(); don't store this into contextDone + // to ensure Err() is unaffected. + } + rs.close(ctx.Err()) +} + +// Next prepares the next result row for reading with the [Rows.Scan] method. It +// returns true on success, or false if there is no next result row or an error +// happened while preparing it. [Rows.Err] should be consulted to distinguish between +// the two cases. +// +// Every call to [Rows.Scan], even the first one, must be preceded by a call to [Rows.Next]. +func (rs *Rows) Next() bool { + // If the user's calling Next, they're done with their previous row's Scan + // results (any RawBytes memory), so we can release the read lock that would + // be preventing awaitDone from calling close. + rs.closemuRUnlockIfHeldByScan() + + if rs.contextDone.Load() != nil { + return false + } + + var doClose, ok bool + withLock(rs.closemu.RLocker(), func() { + doClose, ok = rs.nextLocked() + }) + if doClose { + rs.Close() + } + if doClose && !ok { + rs.hitEOF = true + } + return ok +} + +func (rs *Rows) nextLocked() (doClose, ok bool) { + if rs.closed { + return false, false + } + + // Lock the driver connection before calling the driver interface + // rowsi to prevent a Tx from rolling back the connection at the same time. + rs.dc.Lock() + defer rs.dc.Unlock() + + if rs.lastcols == nil { + rs.lastcols = make([]driver.Value, len(rs.rowsi.Columns())) + } + + rs.lasterr = rs.rowsi.Next(rs.lastcols) + if rs.lasterr != nil { + // Close the connection if there is a driver error. + if rs.lasterr != io.EOF { + return true, false + } + nextResultSet, ok := rs.rowsi.(driver.RowsNextResultSet) + if !ok { + return true, false + } + // The driver is at the end of the current result set. + // Test to see if there is another result set after the current one. + // Only close Rows if there is no further result sets to read. + if !nextResultSet.HasNextResultSet() { + doClose = true + } + return doClose, false + } + return false, true +} + +// NextResultSet prepares the next result set for reading. It reports whether +// there is further result sets, or false if there is no further result set +// or if there is an error advancing to it. The [Rows.Err] method should be consulted +// to distinguish between the two cases. +// +// After calling NextResultSet, the [Rows.Next] method should always be called before +// scanning. If there are further result sets they may not have rows in the result +// set. +func (rs *Rows) NextResultSet() bool { + // If the user's calling NextResultSet, they're done with their previous + // row's Scan results (any RawBytes memory), so we can release the read lock + // that would be preventing awaitDone from calling close. + rs.closemuRUnlockIfHeldByScan() + + var doClose bool + defer func() { + if doClose { + rs.Close() + } + }() + rs.closemu.RLock() + defer rs.closemu.RUnlock() + + if rs.closed { + return false + } + + rs.lastcols = nil + nextResultSet, ok := rs.rowsi.(driver.RowsNextResultSet) + if !ok { + doClose = true + return false + } + + // Lock the driver connection before calling the driver interface + // rowsi to prevent a Tx from rolling back the connection at the same time. + rs.dc.Lock() + defer rs.dc.Unlock() + + rs.lasterr = nextResultSet.NextResultSet() + if rs.lasterr != nil { + doClose = true + return false + } + return true +} + +// Err returns the error, if any, that was encountered during iteration. +// Err may be called after an explicit or implicit [Rows.Close]. +func (rs *Rows) Err() error { + // Return any context error that might've happened during row iteration, + // but only if we haven't reported the final Next() = false after rows + // are done, in which case the user might've canceled their own context + // before calling Rows.Err. + if !rs.hitEOF { + if errp := rs.contextDone.Load(); errp != nil { + return *errp + } + } + + rs.closemu.RLock() + defer rs.closemu.RUnlock() + return rs.lasterrOrErrLocked(nil) +} + +// rawbuf returns the buffer to append RawBytes values to. +// This buffer is reused across calls to Rows.Scan. +// +// Usage: +// +// rawBytes = rows.setrawbuf(append(rows.rawbuf(), value...)) +func (rs *Rows) rawbuf() []byte { + if rs == nil { + // convertAssignRows can take a nil *Rows; for simplicity handle it here + return nil + } + return rs.raw +} + +// setrawbuf updates the RawBytes buffer with the result of appending a new value to it. +// It returns the new value. +func (rs *Rows) setrawbuf(b []byte) RawBytes { + if rs == nil { + // convertAssignRows can take a nil *Rows; for simplicity handle it here + return RawBytes(b) + } + off := len(rs.raw) + rs.raw = b + return RawBytes(rs.raw[off:]) +} + +var errRowsClosed = errors.New("sql: Rows are closed") +var errNoRows = errors.New("sql: no Rows available") + +// Columns returns the column names. +// Columns returns an error if the rows are closed. +func (rs *Rows) Columns() ([]string, error) { + rs.closemu.RLock() + defer rs.closemu.RUnlock() + if rs.closed { + return nil, rs.lasterrOrErrLocked(errRowsClosed) + } + if rs.rowsi == nil { + return nil, rs.lasterrOrErrLocked(errNoRows) + } + rs.dc.Lock() + defer rs.dc.Unlock() + + return rs.rowsi.Columns(), nil +} + +// ColumnTypes returns column information such as column type, length, +// and nullable. Some information may not be available from some drivers. +func (rs *Rows) ColumnTypes() ([]*ColumnType, error) { + rs.closemu.RLock() + defer rs.closemu.RUnlock() + if rs.closed { + return nil, rs.lasterrOrErrLocked(errRowsClosed) + } + if rs.rowsi == nil { + return nil, rs.lasterrOrErrLocked(errNoRows) + } + rs.dc.Lock() + defer rs.dc.Unlock() + + return rowsColumnInfoSetupConnLocked(rs.rowsi), nil +} + +// ColumnType contains the name and type of a column. +type ColumnType struct { + name string + + hasNullable bool + hasLength bool + hasPrecisionScale bool + + nullable bool + length int64 + databaseType string + precision int64 + scale int64 + scanType reflect.Type +} + +// Name returns the name or alias of the column. +func (ci *ColumnType) Name() string { + return ci.name +} + +// Length returns the column type length for variable length column types such +// as text and binary field types. If the type length is unbounded the value will +// be [math.MaxInt64] (any database limits will still apply). +// If the column type is not variable length, such as an int, or if not supported +// by the driver ok is false. +func (ci *ColumnType) Length() (length int64, ok bool) { + return ci.length, ci.hasLength +} + +// DecimalSize returns the scale and precision of a decimal type. +// If not applicable or if not supported ok is false. +func (ci *ColumnType) DecimalSize() (precision, scale int64, ok bool) { + return ci.precision, ci.scale, ci.hasPrecisionScale +} + +// ScanType returns a Go type suitable for scanning into using [Rows.Scan]. +// If a driver does not support this property ScanType will return +// the type of an empty interface. +func (ci *ColumnType) ScanType() reflect.Type { + return ci.scanType +} + +// Nullable reports whether the column may be null. +// If a driver does not support this property ok will be false. +func (ci *ColumnType) Nullable() (nullable, ok bool) { + return ci.nullable, ci.hasNullable +} + +// DatabaseTypeName returns the database system name of the column type. If an empty +// string is returned, then the driver type name is not supported. +// Consult your driver documentation for a list of driver data types. [ColumnType.Length] specifiers +// are not included. +// Common type names include "VARCHAR", "TEXT", "NVARCHAR", "DECIMAL", "BOOL", +// "INT", and "BIGINT". +func (ci *ColumnType) DatabaseTypeName() string { + return ci.databaseType +} + +func rowsColumnInfoSetupConnLocked(rowsi driver.Rows) []*ColumnType { + names := rowsi.Columns() + + list := make([]*ColumnType, len(names)) + for i := range list { + ci := &ColumnType{ + name: names[i], + } + list[i] = ci + + if prop, ok := rowsi.(driver.RowsColumnTypeScanType); ok { + ci.scanType = prop.ColumnTypeScanType(i) + } else { + ci.scanType = reflect.TypeFor[any]() + } + if prop, ok := rowsi.(driver.RowsColumnTypeDatabaseTypeName); ok { + ci.databaseType = prop.ColumnTypeDatabaseTypeName(i) + } + if prop, ok := rowsi.(driver.RowsColumnTypeLength); ok { + ci.length, ci.hasLength = prop.ColumnTypeLength(i) + } + if prop, ok := rowsi.(driver.RowsColumnTypeNullable); ok { + ci.nullable, ci.hasNullable = prop.ColumnTypeNullable(i) + } + if prop, ok := rowsi.(driver.RowsColumnTypePrecisionScale); ok { + ci.precision, ci.scale, ci.hasPrecisionScale = prop.ColumnTypePrecisionScale(i) + } + } + return list +} + +// Scan copies the columns in the current row into the values pointed +// at by dest. The number of values in dest must be the same as the +// number of columns in [Rows]. +// +// Scan converts columns read from the database into the following +// common Go types and special types provided by the sql package: +// +// *string +// *[]byte +// *int, *int8, *int16, *int32, *int64 +// *uint, *uint8, *uint16, *uint32, *uint64 +// *bool +// *float32, *float64 +// *interface{} +// *RawBytes +// *Rows (cursor value) +// any type implementing Scanner (see Scanner docs) +// +// In the most simple case, if the type of the value from the source +// column is an integer, bool or string type T and dest is of type *T, +// Scan simply assigns the value through the pointer. +// +// Scan also converts between string and numeric types, as long as no +// information would be lost. While Scan stringifies all numbers +// scanned from numeric database columns into *string, scans into +// numeric types are checked for overflow. For example, a float64 with +// value 300 or a string with value "300" can scan into a uint16, but +// not into a uint8, though float64(255) or "255" can scan into a +// uint8. One exception is that scans of some float64 numbers to +// strings may lose information when stringifying. In general, scan +// floating point columns into *float64. +// +// If a dest argument has type *[]byte, Scan saves in that argument a +// copy of the corresponding data. The copy is owned by the caller and +// can be modified and held indefinitely. The copy can be avoided by +// using an argument of type [*RawBytes] instead; see the documentation +// for [RawBytes] for restrictions on its use. +// +// If an argument has type *interface{}, Scan copies the value +// provided by the underlying driver without conversion. When scanning +// from a source value of type []byte to *interface{}, a copy of the +// slice is made and the caller owns the result. +// +// Source values of type [time.Time] may be scanned into values of type +// *time.Time, *interface{}, *string, or *[]byte. When converting to +// the latter two, [time.RFC3339Nano] is used. +// +// Source values of type bool may be scanned into types *bool, +// *interface{}, *string, *[]byte, or [*RawBytes]. +// +// For scanning into *bool, the source may be true, false, 1, 0, or +// string inputs parseable by [strconv.ParseBool]. +// +// Scan can also convert a cursor returned from a query, such as +// "select cursor(select * from my_table) from dual", into a +// [*Rows] value that can itself be scanned from. The parent +// select query will close any cursor [*Rows] if the parent [*Rows] is closed. +// +// If any of the first arguments implementing [Scanner] returns an error, +// that error will be wrapped in the returned error. +func (rs *Rows) Scan(dest ...any) error { + if rs.closemuScanHold { + // This should only be possible if the user calls Scan twice in a row + // without calling Next. + return fmt.Errorf("sql: Scan called without calling Next (closemuScanHold)") + } + + rs.closemu.RLock() + rs.raw = rs.raw[:0] + err := rs.scanLocked(dest...) + if err == nil && scanArgsContainRawBytes(dest) { + rs.closemuScanHold = true + } else { + rs.closemu.RUnlock() + } + return err +} + +func (rs *Rows) scanLocked(dest ...any) error { + if rs.lasterr != nil && rs.lasterr != io.EOF { + return rs.lasterr + } + if rs.closed { + return rs.lasterrOrErrLocked(errRowsClosed) + } + + if rs.lastcols == nil { + return errors.New("sql: Scan called without calling Next") + } + if len(dest) != len(rs.lastcols) { + return fmt.Errorf("sql: expected %d destination arguments in Scan, not %d", len(rs.lastcols), len(dest)) + } + + for i, sv := range rs.lastcols { + err := convertAssignRows(dest[i], sv, rs) + if err != nil { + return fmt.Errorf(`sql: Scan error on column index %d, name %q: %w`, i, rs.rowsi.Columns()[i], err) + } + } + return nil +} + +// closemuRUnlockIfHeldByScan releases any closemu.RLock held open by a previous +// call to Scan with *RawBytes. +func (rs *Rows) closemuRUnlockIfHeldByScan() { + if rs.closemuScanHold { + rs.closemuScanHold = false + rs.closemu.RUnlock() + } +} + +func scanArgsContainRawBytes(args []any) bool { + for _, a := range args { + if _, ok := a.(*RawBytes); ok { + return true + } + } + return false +} + +// rowsCloseHook returns a function so tests may install the +// hook through a test only mutex. +var rowsCloseHook = func() func(*Rows, *error) { return nil } + +// Close closes the [Rows], preventing further enumeration. If [Rows.Next] is called +// and returns false and there are no further result sets, +// the [Rows] are closed automatically and it will suffice to check the +// result of [Rows.Err]. Close is idempotent and does not affect the result of [Rows.Err]. +func (rs *Rows) Close() error { + // If the user's calling Close, they're done with their previous row's Scan + // results (any RawBytes memory), so we can release the read lock that would + // be preventing awaitDone from calling the unexported close before we do so. + rs.closemuRUnlockIfHeldByScan() + + return rs.close(nil) +} + +func (rs *Rows) close(err error) error { + rs.closemu.Lock() + defer rs.closemu.Unlock() + + if rs.closed { + return nil + } + rs.closed = true + + if rs.lasterr == nil { + rs.lasterr = err + } + + withLock(rs.dc, func() { + err = rs.rowsi.Close() + }) + if fn := rowsCloseHook(); fn != nil { + fn(rs, &err) + } + if rs.cancel != nil { + rs.cancel() + } + + if rs.closeStmt != nil { + rs.closeStmt.Close() + } + rs.releaseConn(err) + + rs.lasterr = rs.lasterrOrErrLocked(err) + return err +} + +// Row is the result of calling [DB.QueryRow] to select a single row. +type Row struct { + // One of these two will be non-nil: + err error // deferred error for easy chaining + rows *Rows +} + +// Scan copies the columns from the matched row into the values +// pointed at by dest. See the documentation on [Rows.Scan] for details. +// If more than one row matches the query, +// Scan uses the first row and discards the rest. If no row matches +// the query, Scan returns [ErrNoRows]. +func (r *Row) Scan(dest ...any) error { + if r.err != nil { + return r.err + } + + // TODO(bradfitz): for now we need to defensively clone all + // []byte that the driver returned (not permitting + // *RawBytes in Rows.Scan), since we're about to close + // the Rows in our defer, when we return from this function. + // the contract with the driver.Next(...) interface is that it + // can return slices into read-only temporary memory that's + // only valid until the next Scan/Close. But the TODO is that + // for a lot of drivers, this copy will be unnecessary. We + // should provide an optional interface for drivers to + // implement to say, "don't worry, the []bytes that I return + // from Next will not be modified again." (for instance, if + // they were obtained from the network anyway) But for now we + // don't care. + defer r.rows.Close() + if scanArgsContainRawBytes(dest) { + return errors.New("sql: RawBytes isn't allowed on Row.Scan") + } + + if !r.rows.Next() { + if err := r.rows.Err(); err != nil { + return err + } + return ErrNoRows + } + err := r.rows.Scan(dest...) + if err != nil { + return err + } + // Make sure the query can be processed to completion with no errors. + return r.rows.Close() +} + +// Err provides a way for wrapping packages to check for +// query errors without calling [Row.Scan]. +// Err returns the error, if any, that was encountered while running the query. +// If this error is not nil, this error will also be returned from [Row.Scan]. +func (r *Row) Err() error { + return r.err +} + +// A Result summarizes an executed SQL command. +type Result interface { + // LastInsertId returns the integer generated by the database + // in response to a command. Typically this will be from an + // "auto increment" column when inserting a new row. Not all + // databases support this feature, and the syntax of such + // statements varies. + LastInsertId() (int64, error) + + // RowsAffected returns the number of rows affected by an + // update, insert, or delete. Not every database or database + // driver may support this. + RowsAffected() (int64, error) +} + +type driverResult struct { + sync.Locker // the *driverConn + resi driver.Result +} + +func (dr driverResult) LastInsertId() (int64, error) { + dr.Lock() + defer dr.Unlock() + return dr.resi.LastInsertId() +} + +func (dr driverResult) RowsAffected() (int64, error) { + dr.Lock() + defer dr.Unlock() + return dr.resi.RowsAffected() +} + +func stack() string { + var buf [2 << 10]byte + return string(buf[:runtime.Stack(buf[:], false)]) +} + +// withLock runs while holding lk. +func withLock(lk sync.Locker, fn func()) { + lk.Lock() + defer lk.Unlock() // in case fn panics + fn() +} + +// connRequestSet is a set of chan connRequest that's +// optimized for: +// +// - adding an element +// - removing an element (only by the caller who added it) +// - taking (get + delete) a random element +// +// We previously used a map for this but the take of a random element +// was expensive, making mapiters. This type avoids a map entirely +// and just uses a slice. +type connRequestSet struct { + // s are the elements in the set. + s []connRequestAndIndex +} + +type connRequestAndIndex struct { + // req is the element in the set. + req chan connRequest + + // curIdx points to the current location of this element in + // connRequestSet.s. It gets set to -1 upon removal. + curIdx *int +} + +// CloseAndRemoveAll closes all channels in the set +// and clears the set. +func (s *connRequestSet) CloseAndRemoveAll() { + for _, v := range s.s { + *v.curIdx = -1 + close(v.req) + } + s.s = nil +} + +// Len returns the length of the set. +func (s *connRequestSet) Len() int { return len(s.s) } + +// connRequestDelHandle is an opaque handle to delete an +// item from calling Add. +type connRequestDelHandle struct { + idx *int // pointer to index; or -1 if not in slice +} + +// Add adds v to the set of waiting requests. +// The returned connRequestDelHandle can be used to remove the item from +// the set. +func (s *connRequestSet) Add(v chan connRequest) connRequestDelHandle { + idx := len(s.s) + // TODO(bradfitz): for simplicity, this always allocates a new int-sized + // allocation to store the index. But generally the set will be small and + // under a scannable-threshold. As an optimization, we could permit the *int + // to be nil when the set is small and should be scanned. This works even if + // the set grows over the threshold with delete handles outstanding because + // an element can only move to a lower index. So if it starts with a nil + // position, it'll always be in a low index and thus scannable. But that + // can be done in a follow-up change. + idxPtr := &idx + s.s = append(s.s, connRequestAndIndex{v, idxPtr}) + return connRequestDelHandle{idxPtr} +} + +// Delete removes an element from the set. +// +// It reports whether the element was deleted. (It can return false if a caller +// of TakeRandom took it meanwhile, or upon the second call to Delete) +func (s *connRequestSet) Delete(h connRequestDelHandle) bool { + idx := *h.idx + if idx < 0 { + return false + } + s.deleteIndex(idx) + return true +} + +func (s *connRequestSet) deleteIndex(idx int) { + // Mark item as deleted. + *(s.s[idx].curIdx) = -1 + // Copy last element, updating its position + // to its new home. + if idx < len(s.s)-1 { + last := s.s[len(s.s)-1] + *last.curIdx = idx + s.s[idx] = last + } + // Zero out last element (for GC) before shrinking the slice. + s.s[len(s.s)-1] = connRequestAndIndex{} + s.s = s.s[:len(s.s)-1] +} + +// TakeRandom returns and removes a random element from s +// and reports whether there was one to take. (It returns ok=false +// if the set is empty.) +func (s *connRequestSet) TakeRandom() (v chan connRequest, ok bool) { + if len(s.s) == 0 { + return nil, false + } + pick := rand.IntN(len(s.s)) + e := s.s[pick] + s.deleteIndex(pick) + return e.req, true +} diff --git a/go/src/database/sql/sql_test.go b/go/src/database/sql/sql_test.go new file mode 100644 index 0000000000000000000000000000000000000000..e8a65600973ba72b3960bb2a193999f414f3f2fa --- /dev/null +++ b/go/src/database/sql/sql_test.go @@ -0,0 +1,5088 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sql + +import ( + "bytes" + "context" + "database/sql/driver" + "errors" + "fmt" + "internal/race" + "internal/testenv" + "math/rand" + "reflect" + "runtime" + "slices" + "strings" + "sync" + "sync/atomic" + "testing" + "time" +) + +func init() { + type dbConn struct { + db *DB + c *driverConn + } + freedFrom := make(map[dbConn]string) + var mu sync.Mutex + getFreedFrom := func(c dbConn) string { + mu.Lock() + defer mu.Unlock() + return freedFrom[c] + } + setFreedFrom := func(c dbConn, s string) { + mu.Lock() + defer mu.Unlock() + freedFrom[c] = s + } + putConnHook = func(db *DB, c *driverConn) { + if slices.Contains(db.freeConn, c) { + // print before panic, as panic may get lost due to conflicting panic + // (all goroutines asleep) elsewhere, since we might not unlock + // the mutex in freeConn here. + println("double free of conn. conflicts are:\nA) " + getFreedFrom(dbConn{db, c}) + "\n\nand\nB) " + stack()) + panic("double free of conn.") + } + setFreedFrom(dbConn{db, c}, stack()) + } +} + +// pollDuration is an arbitrary interval to wait between checks when polling for +// a condition to occur. +const pollDuration = 5 * time.Millisecond + +const fakeDBName = "foo" + +var chrisBirthday = time.Unix(123456789, 0) + +func newTestDB(t testing.TB, name string) *DB { + return newTestDBConnector(t, &fakeConnector{name: fakeDBName}, name) +} + +func newTestDBConnector(t testing.TB, fc *fakeConnector, name string) *DB { + fc.name = fakeDBName + db := OpenDB(fc) + if _, err := db.Exec("WIPE"); err != nil { + t.Fatalf("exec wipe: %v", err) + } + if name == "people" { + exec(t, db, "CREATE|people|name=string,age=int32,photo=blob,dead=bool,bdate=datetime") + exec(t, db, "INSERT|people|name=Alice,age=?,photo=APHOTO", 1) + exec(t, db, "INSERT|people|name=Bob,age=?,photo=BPHOTO", 2) + exec(t, db, "INSERT|people|name=Chris,age=?,photo=CPHOTO,bdate=?", 3, chrisBirthday) + } + if name == "magicquery" { + // Magic table name and column, known by fakedb_test.go. + exec(t, db, "CREATE|magicquery|op=string,millis=int32") + exec(t, db, "INSERT|magicquery|op=sleep,millis=10") + } + if name == "tx_status" { + // Magic table name and column, known by fakedb_test.go. + exec(t, db, "CREATE|tx_status|tx_status=string") + exec(t, db, "INSERT|tx_status|tx_status=invalid") + } + return db +} + +func TestOpenDB(t *testing.T) { + db := OpenDB(dsnConnector{dsn: fakeDBName, driver: fdriver}) + if db.Driver() != fdriver { + t.Fatalf("OpenDB should return the driver of the Connector") + } +} + +func TestDriverPanic(t *testing.T) { + // Test that if driver panics, database/sql does not deadlock. + db, err := Open("test", fakeDBName) + if err != nil { + t.Fatalf("Open: %v", err) + } + expectPanic := func(name string, f func()) { + defer func() { + err := recover() + if err == nil { + t.Fatalf("%s did not panic", name) + } + }() + f() + } + + expectPanic("Exec Exec", func() { db.Exec("PANIC|Exec|WIPE") }) + exec(t, db, "WIPE") // check not deadlocked + expectPanic("Exec NumInput", func() { db.Exec("PANIC|NumInput|WIPE") }) + exec(t, db, "WIPE") // check not deadlocked + expectPanic("Exec Close", func() { db.Exec("PANIC|Close|WIPE") }) + exec(t, db, "WIPE") // check not deadlocked + exec(t, db, "PANIC|Query|WIPE") // should run successfully: Exec does not call Query + exec(t, db, "WIPE") // check not deadlocked + + exec(t, db, "CREATE|people|name=string,age=int32,photo=blob,dead=bool,bdate=datetime") + + expectPanic("Query Query", func() { db.Query("PANIC|Query|SELECT|people|age,name|") }) + expectPanic("Query NumInput", func() { db.Query("PANIC|NumInput|SELECT|people|age,name|") }) + expectPanic("Query Close", func() { + rows, err := db.Query("PANIC|Close|SELECT|people|age,name|") + if err != nil { + t.Fatal(err) + } + rows.Close() + }) + db.Query("PANIC|Exec|SELECT|people|age,name|") // should run successfully: Query does not call Exec + exec(t, db, "WIPE") // check not deadlocked +} + +func exec(t testing.TB, db *DB, query string, args ...any) { + t.Helper() + _, err := db.Exec(query, args...) + if err != nil { + t.Fatalf("Exec of %q: %v", query, err) + } +} + +func closeDB(t testing.TB, db *DB) { + if e := recover(); e != nil { + fmt.Printf("Panic: %v\n", e) + panic(e) + } + defer setHookpostCloseConn(nil) + setHookpostCloseConn(func(_ *fakeConn, err error) { + if err != nil { + t.Errorf("Error closing fakeConn: %v", err) + } + }) + db.mu.Lock() + for i, dc := range db.freeConn { + if n := len(dc.openStmt); n > 0 { + // Just a sanity check. This is legal in + // general, but if we make the tests clean up + // their statements first, then we can safely + // verify this is always zero here, and any + // other value is a leak. + t.Errorf("while closing db, freeConn %d/%d had %d open stmts; want 0", i, len(db.freeConn), n) + } + } + db.mu.Unlock() + + err := db.Close() + if err != nil { + t.Fatalf("error closing DB: %v", err) + } + + var numOpen int + if !waitCondition(t, func() bool { + numOpen = db.numOpenConns() + return numOpen == 0 + }) { + t.Fatalf("%d connections still open after closing DB", numOpen) + } +} + +// numPrepares assumes that db has exactly 1 idle conn and returns +// its count of calls to Prepare +func numPrepares(t *testing.T, db *DB) int { + if n := len(db.freeConn); n != 1 { + t.Fatalf("free conns = %d; want 1", n) + } + return db.freeConn[0].ci.(*fakeConn).numPrepare +} + +func (db *DB) numDeps() int { + db.mu.Lock() + defer db.mu.Unlock() + return len(db.dep) +} + +// Dependencies are closed via a goroutine, so this polls waiting for +// numDeps to fall to want, waiting up to nearly the test's deadline. +func (db *DB) numDepsPoll(t *testing.T, want int) int { + var n int + waitCondition(t, func() bool { + n = db.numDeps() + return n <= want + }) + return n +} + +func (db *DB) numFreeConns() int { + db.mu.Lock() + defer db.mu.Unlock() + return len(db.freeConn) +} + +func (db *DB) numOpenConns() int { + db.mu.Lock() + defer db.mu.Unlock() + return db.numOpen +} + +// clearAllConns closes all connections in db. +func (db *DB) clearAllConns(t *testing.T) { + db.SetMaxIdleConns(0) + + if g, w := db.numFreeConns(), 0; g != w { + t.Errorf("free conns = %d; want %d", g, w) + } + + if n := db.numDepsPoll(t, 0); n > 0 { + t.Errorf("number of dependencies = %d; expected 0", n) + db.dumpDeps(t) + } +} + +func (db *DB) dumpDeps(t *testing.T) { + for fc := range db.dep { + db.dumpDep(t, 0, fc, map[finalCloser]bool{}) + } +} + +func (db *DB) dumpDep(t *testing.T, depth int, dep finalCloser, seen map[finalCloser]bool) { + seen[dep] = true + indent := strings.Repeat(" ", depth) + ds := db.dep[dep] + for k := range ds { + t.Logf("%s%T (%p) waiting for -> %T (%p)", indent, dep, dep, k, k) + if fc, ok := k.(finalCloser); ok { + if !seen[fc] { + db.dumpDep(t, depth+1, fc, seen) + } + } + } +} + +func TestQuery(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + prepares0 := numPrepares(t, db) + rows, err := db.Query("SELECT|people|age,name|") + if err != nil { + t.Fatalf("Query: %v", err) + } + defer rows.Close() + type row struct { + age int + name string + } + got := []row{} + for rows.Next() { + var r row + err = rows.Scan(&r.age, &r.name) + if err != nil { + t.Fatalf("Scan: %v", err) + } + got = append(got, r) + } + err = rows.Err() + if err != nil { + t.Fatalf("Err: %v", err) + } + want := []row{ + {age: 1, name: "Alice"}, + {age: 2, name: "Bob"}, + {age: 3, name: "Chris"}, + } + if !slices.Equal(got, want) { + t.Errorf("mismatch.\n got: %#v\nwant: %#v", got, want) + } + + // And verify that the final rows.Next() call, which hit EOF, + // also closed the rows connection. + if n := db.numFreeConns(); n != 1 { + t.Fatalf("free conns after query hitting EOF = %d; want 1", n) + } + if prepares := numPrepares(t, db) - prepares0; prepares != 1 { + t.Errorf("executed %d Prepare statements; want 1", prepares) + } +} + +// TestQueryContext tests canceling the context while scanning the rows. +func TestQueryContext(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + prepares0 := numPrepares(t, db) + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + rows, err := db.QueryContext(ctx, "SELECT|people|age,name|") + if err != nil { + t.Fatalf("Query: %v", err) + } + type row struct { + age int + name string + } + got := []row{} + index := 0 + for rows.Next() { + if index == 2 { + cancel() + waitForRowsClose(t, rows) + } + var r row + err = rows.Scan(&r.age, &r.name) + if err != nil { + if index == 2 { + break + } + t.Fatalf("Scan: %v", err) + } + if index == 2 && err != context.Canceled { + t.Fatalf("Scan: %v; want context.Canceled", err) + } + got = append(got, r) + index++ + } + select { + case <-ctx.Done(): + if err := ctx.Err(); err != context.Canceled { + t.Fatalf("context err = %v; want context.Canceled", err) + } + default: + t.Fatalf("context err = nil; want context.Canceled") + } + want := []row{ + {age: 1, name: "Alice"}, + {age: 2, name: "Bob"}, + } + if !slices.Equal(got, want) { + t.Errorf("mismatch.\n got: %#v\nwant: %#v", got, want) + } + + // And verify that the final rows.Next() call, which hit EOF, + // also closed the rows connection. + waitForRowsClose(t, rows) + waitForFree(t, db, 1) + if prepares := numPrepares(t, db) - prepares0; prepares != 1 { + t.Errorf("executed %d Prepare statements; want 1", prepares) + } +} + +func waitCondition(t testing.TB, fn func() bool) bool { + timeout := 5 * time.Second + + type deadliner interface { + Deadline() (time.Time, bool) + } + if td, ok := t.(deadliner); ok { + if deadline, ok := td.Deadline(); ok { + timeout = time.Until(deadline) + timeout = timeout * 19 / 20 // Give 5% headroom for cleanup and error-reporting. + } + } + + deadline := time.Now().Add(timeout) + for { + if fn() { + return true + } + if time.Until(deadline) < pollDuration { + return false + } + time.Sleep(pollDuration) + } +} + +// waitForFree checks db.numFreeConns until either it equals want or +// the maxWait time elapses. +func waitForFree(t *testing.T, db *DB, want int) { + var numFree int + if !waitCondition(t, func() bool { + numFree = db.numFreeConns() + return numFree == want + }) { + t.Fatalf("free conns after hitting EOF = %d; want %d", numFree, want) + } +} + +func waitForRowsClose(t *testing.T, rows *Rows) { + if !waitCondition(t, func() bool { + rows.closemu.RLock() + defer rows.closemu.RUnlock() + return rows.closed + }) { + t.Fatal("failed to close rows") + } +} + +// TestQueryContextWait ensures that rows and all internal statements are closed when +// a query context is closed during execution. +func TestQueryContextWait(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + prepares0 := numPrepares(t, db) + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + // This will trigger the *fakeConn.Prepare method which will take time + // performing the query. The ctxDriverPrepare func will check the context + // after this and close the rows and return an error. + c, err := db.Conn(ctx) + if err != nil { + t.Fatal(err) + } + + c.dc.ci.(*fakeConn).waiter = func(c context.Context) { + cancel() + <-ctx.Done() + } + _, err = c.QueryContext(ctx, "SELECT|people|age,name|") + c.Close() + if err != context.Canceled { + t.Fatalf("expected QueryContext to error with context deadline exceeded but returned %v", err) + } + + // Verify closed rows connection after error condition. + waitForFree(t, db, 1) + if prepares := numPrepares(t, db) - prepares0; prepares != 1 { + t.Fatalf("executed %d Prepare statements; want 1", prepares) + } +} + +// TestTxContextWait tests the transaction behavior when the tx context is canceled +// during execution of the query. +func TestTxContextWait(t *testing.T) { + testContextWait(t, false) +} + +// TestTxContextWaitNoDiscard is the same as TestTxContextWait, but should not discard +// the final connection. +func TestTxContextWaitNoDiscard(t *testing.T) { + testContextWait(t, true) +} + +func testContextWait(t *testing.T, keepConnOnRollback bool) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + ctx, cancel := context.WithCancel(context.Background()) + + tx, err := db.BeginTx(ctx, nil) + if err != nil { + t.Fatal(err) + } + tx.keepConnOnRollback = keepConnOnRollback + + tx.dc.ci.(*fakeConn).waiter = func(c context.Context) { + cancel() + <-ctx.Done() + } + // This will trigger the *fakeConn.Prepare method which will take time + // performing the query. The ctxDriverPrepare func will check the context + // after this and close the rows and return an error. + _, err = tx.QueryContext(ctx, "SELECT|people|age,name|") + if err != context.Canceled { + t.Fatalf("expected QueryContext to error with context canceled but returned %v", err) + } + + if keepConnOnRollback { + waitForFree(t, db, 1) + } else { + waitForFree(t, db, 0) + } +} + +// TestUnsupportedOptions checks that the database fails when a driver that +// doesn't implement ConnBeginTx is used with non-default options and an +// un-cancellable context. +func TestUnsupportedOptions(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + _, err := db.BeginTx(context.Background(), &TxOptions{ + Isolation: LevelSerializable, ReadOnly: true, + }) + if err == nil { + t.Fatal("expected error when using unsupported options, got nil") + } +} + +func TestMultiResultSetQuery(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + prepares0 := numPrepares(t, db) + rows, err := db.Query("SELECT|people|age,name|;SELECT|people|name|") + if err != nil { + t.Fatalf("Query: %v", err) + } + type row1 struct { + age int + name string + } + type row2 struct { + name string + } + got1 := []row1{} + for rows.Next() { + var r row1 + err = rows.Scan(&r.age, &r.name) + if err != nil { + t.Fatalf("Scan: %v", err) + } + got1 = append(got1, r) + } + err = rows.Err() + if err != nil { + t.Fatalf("Err: %v", err) + } + want1 := []row1{ + {age: 1, name: "Alice"}, + {age: 2, name: "Bob"}, + {age: 3, name: "Chris"}, + } + if !slices.Equal(got1, want1) { + t.Errorf("mismatch.\n got1: %#v\nwant: %#v", got1, want1) + } + + if !rows.NextResultSet() { + t.Errorf("expected another result set") + } + + got2 := []row2{} + for rows.Next() { + var r row2 + err = rows.Scan(&r.name) + if err != nil { + t.Fatalf("Scan: %v", err) + } + got2 = append(got2, r) + } + err = rows.Err() + if err != nil { + t.Fatalf("Err: %v", err) + } + want2 := []row2{ + {name: "Alice"}, + {name: "Bob"}, + {name: "Chris"}, + } + if !slices.Equal(got2, want2) { + t.Errorf("mismatch.\n got: %#v\nwant: %#v", got2, want2) + } + if rows.NextResultSet() { + t.Errorf("expected no more result sets") + } + + // And verify that the final rows.Next() call, which hit EOF, + // also closed the rows connection. + waitForFree(t, db, 1) + if prepares := numPrepares(t, db) - prepares0; prepares != 1 { + t.Errorf("executed %d Prepare statements; want 1", prepares) + } +} + +func TestQueryNamedArg(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + prepares0 := numPrepares(t, db) + rows, err := db.Query( + // Ensure the name and age parameters only match on placeholder name, not position. + "SELECT|people|age,name|name=?name,age=?age", + Named("age", 2), + Named("name", "Bob"), + ) + if err != nil { + t.Fatalf("Query: %v", err) + } + type row struct { + age int + name string + } + got := []row{} + for rows.Next() { + var r row + err = rows.Scan(&r.age, &r.name) + if err != nil { + t.Fatalf("Scan: %v", err) + } + got = append(got, r) + } + err = rows.Err() + if err != nil { + t.Fatalf("Err: %v", err) + } + want := []row{ + {age: 2, name: "Bob"}, + } + if !slices.Equal(got, want) { + t.Errorf("mismatch.\n got: %#v\nwant: %#v", got, want) + } + + // And verify that the final rows.Next() call, which hit EOF, + // also closed the rows connection. + if n := db.numFreeConns(); n != 1 { + t.Fatalf("free conns after query hitting EOF = %d; want 1", n) + } + if prepares := numPrepares(t, db) - prepares0; prepares != 1 { + t.Errorf("executed %d Prepare statements; want 1", prepares) + } +} + +func TestPoolExhaustOnCancel(t *testing.T) { + if testing.Short() { + t.Skip("long test") + } + + max := 3 + var saturate, saturateDone sync.WaitGroup + saturate.Add(max) + saturateDone.Add(max) + + donePing := make(chan bool) + state := 0 + + // waiter will be called for all queries, including + // initial setup queries. The state is only assigned when + // no queries are made. + // + // Only allow the first batch of queries to finish once the + // second batch of Ping queries have finished. + waiter := func(ctx context.Context) { + switch state { + case 0: + // Nothing. Initial database setup. + case 1: + saturate.Done() + select { + case <-ctx.Done(): + case <-donePing: + } + case 2: + } + } + db := newTestDBConnector(t, &fakeConnector{waiter: waiter}, "people") + defer closeDB(t, db) + + db.SetMaxOpenConns(max) + + // First saturate the connection pool. + // Then start new requests for a connection that is canceled after it is requested. + + state = 1 + for i := 0; i < max; i++ { + go func() { + rows, err := db.Query("SELECT|people|name,photo|") + if err != nil { + t.Errorf("Query: %v", err) + return + } + rows.Close() + saturateDone.Done() + }() + } + + saturate.Wait() + if t.Failed() { + t.FailNow() + } + state = 2 + + // Now cancel the request while it is waiting. + ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) + defer cancel() + + for i := 0; i < max; i++ { + ctxReq, cancelReq := context.WithCancel(ctx) + go func() { + time.Sleep(100 * time.Millisecond) + cancelReq() + }() + err := db.PingContext(ctxReq) + if err != context.Canceled { + t.Fatalf("PingContext (Exhaust): %v", err) + } + } + close(donePing) + saturateDone.Wait() + + // Now try to open a normal connection. + err := db.PingContext(ctx) + if err != nil { + t.Fatalf("PingContext (Normal): %v", err) + } +} + +func TestRowsColumns(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + rows, err := db.Query("SELECT|people|age,name|") + if err != nil { + t.Fatalf("Query: %v", err) + } + cols, err := rows.Columns() + if err != nil { + t.Fatalf("Columns: %v", err) + } + want := []string{"age", "name"} + if !slices.Equal(cols, want) { + t.Errorf("got %#v; want %#v", cols, want) + } + if err := rows.Close(); err != nil { + t.Errorf("error closing rows: %s", err) + } +} + +func TestRowsColumnTypes(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + rows, err := db.Query("SELECT|people|age,name|") + if err != nil { + t.Fatalf("Query: %v", err) + } + tt, err := rows.ColumnTypes() + if err != nil { + t.Fatalf("ColumnTypes: %v", err) + } + + types := make([]reflect.Type, len(tt)) + for i, tp := range tt { + st := tp.ScanType() + if st == nil { + t.Errorf("scantype is null for column %q", tp.Name()) + continue + } + types[i] = st + } + values := make([]any, len(tt)) + for i := range values { + values[i] = reflect.New(types[i]).Interface() + } + ct := 0 + for rows.Next() { + err = rows.Scan(values...) + if err != nil { + t.Fatalf("failed to scan values in %v", err) + } + if ct == 1 { + if age := *values[0].(*int32); age != 2 { + t.Errorf("Expected 2, got %v", age) + } + if name := *values[1].(*string); name != "Bob" { + t.Errorf("Expected Bob, got %v", name) + } + } + ct++ + } + if ct != 3 { + t.Errorf("expected 3 rows, got %d", ct) + } + + if err := rows.Close(); err != nil { + t.Errorf("error closing rows: %s", err) + } +} + +func TestQueryRow(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + var name string + var age int + var birthday time.Time + + err := db.QueryRow("SELECT|people|age,name|age=?", 3).Scan(&age) + if err == nil || !strings.Contains(err.Error(), "expected 2 destination arguments") { + t.Errorf("expected error from wrong number of arguments; actually got: %v", err) + } + + err = db.QueryRow("SELECT|people|bdate|age=?", 3).Scan(&birthday) + if err != nil || !birthday.Equal(chrisBirthday) { + t.Errorf("chris birthday = %v, err = %v; want %v", birthday, err, chrisBirthday) + } + + err = db.QueryRow("SELECT|people|age,name|age=?", 2).Scan(&age, &name) + if err != nil { + t.Fatalf("age QueryRow+Scan: %v", err) + } + if name != "Bob" { + t.Errorf("expected name Bob, got %q", name) + } + if age != 2 { + t.Errorf("expected age 2, got %d", age) + } + + err = db.QueryRow("SELECT|people|age,name|name=?", "Alice").Scan(&age, &name) + if err != nil { + t.Fatalf("name QueryRow+Scan: %v", err) + } + if name != "Alice" { + t.Errorf("expected name Alice, got %q", name) + } + if age != 1 { + t.Errorf("expected age 1, got %d", age) + } + + var photo []byte + err = db.QueryRow("SELECT|people|photo|name=?", "Alice").Scan(&photo) + if err != nil { + t.Fatalf("photo QueryRow+Scan: %v", err) + } + want := []byte("APHOTO") + if !slices.Equal(photo, want) { + t.Errorf("photo = %q; want %q", photo, want) + } +} + +func TestRowErr(t *testing.T) { + db := newTestDB(t, "people") + + err := db.QueryRowContext(context.Background(), "SELECT|people|bdate|age=?", 3).Err() + if err != nil { + t.Errorf("Unexpected err = %v; want %v", err, nil) + } + + ctx, cancel := context.WithCancel(context.Background()) + cancel() + + err = db.QueryRowContext(ctx, "SELECT|people|bdate|age=?", 3).Err() + exp := "context canceled" + if err == nil || !strings.Contains(err.Error(), exp) { + t.Errorf("Expected err = %v; got %v", exp, err) + } +} + +func TestTxRollbackCommitErr(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + tx, err := db.Begin() + if err != nil { + t.Fatal(err) + } + err = tx.Rollback() + if err != nil { + t.Errorf("expected nil error from Rollback; got %v", err) + } + err = tx.Commit() + if err != ErrTxDone { + t.Errorf("expected %q from Commit; got %q", ErrTxDone, err) + } + + tx, err = db.Begin() + if err != nil { + t.Fatal(err) + } + err = tx.Commit() + if err != nil { + t.Errorf("expected nil error from Commit; got %v", err) + } + err = tx.Rollback() + if err != ErrTxDone { + t.Errorf("expected %q from Rollback; got %q", ErrTxDone, err) + } +} + +func TestStatementErrorAfterClose(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + stmt, err := db.Prepare("SELECT|people|age|name=?") + if err != nil { + t.Fatalf("Prepare: %v", err) + } + err = stmt.Close() + if err != nil { + t.Fatalf("Close: %v", err) + } + var name string + err = stmt.QueryRow("foo").Scan(&name) + if err == nil { + t.Errorf("expected error from QueryRow.Scan after Stmt.Close") + } +} + +func TestStatementQueryRow(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + stmt, err := db.Prepare("SELECT|people|age|name=?") + if err != nil { + t.Fatalf("Prepare: %v", err) + } + defer stmt.Close() + var age int + for n, tt := range []struct { + name string + want int + }{ + {"Alice", 1}, + {"Bob", 2}, + {"Chris", 3}, + } { + if err := stmt.QueryRow(tt.name).Scan(&age); err != nil { + t.Errorf("%d: on %q, QueryRow/Scan: %v", n, tt.name, err) + } else if age != tt.want { + t.Errorf("%d: age=%d, want %d", n, age, tt.want) + } + } +} + +type stubDriverStmt struct { + err error +} + +func (s stubDriverStmt) Close() error { + return s.err +} + +func (s stubDriverStmt) NumInput() int { + return -1 +} + +func (s stubDriverStmt) Exec(args []driver.Value) (driver.Result, error) { + return nil, nil +} + +func (s stubDriverStmt) Query(args []driver.Value) (driver.Rows, error) { + return nil, nil +} + +// golang.org/issue/12798 +func TestStatementClose(t *testing.T) { + want := errors.New("STMT ERROR") + + tests := []struct { + stmt *Stmt + msg string + }{ + {&Stmt{stickyErr: want}, "stickyErr not propagated"}, + {&Stmt{cg: &Tx{}, cgds: &driverStmt{Locker: &sync.Mutex{}, si: stubDriverStmt{want}}}, "driverStmt.Close() error not propagated"}, + } + for _, test := range tests { + if err := test.stmt.Close(); err != want { + t.Errorf("%s. Got stmt.Close() = %v, want = %v", test.msg, err, want) + } + } +} + +// golang.org/issue/3734 +func TestStatementQueryRowConcurrent(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + stmt, err := db.Prepare("SELECT|people|age|name=?") + if err != nil { + t.Fatalf("Prepare: %v", err) + } + defer stmt.Close() + + const n = 10 + ch := make(chan error, n) + for i := 0; i < n; i++ { + go func() { + var age int + err := stmt.QueryRow("Alice").Scan(&age) + if err == nil && age != 1 { + err = fmt.Errorf("unexpected age %d", age) + } + ch <- err + }() + } + for i := 0; i < n; i++ { + if err := <-ch; err != nil { + t.Error(err) + } + } +} + +// just a test of fakedb itself +func TestBogusPreboundParameters(t *testing.T) { + db := newTestDB(t, "foo") + defer closeDB(t, db) + exec(t, db, "CREATE|t1|name=string,age=int32,dead=bool") + _, err := db.Prepare("INSERT|t1|name=?,age=bogusconversion") + if err == nil { + t.Fatalf("expected error") + } + if err.Error() != `fakedb: invalid conversion to int32 from "bogusconversion"` { + t.Errorf("unexpected error: %v", err) + } +} + +func TestExec(t *testing.T) { + db := newTestDB(t, "foo") + defer closeDB(t, db) + exec(t, db, "CREATE|t1|name=string,age=int32,dead=bool") + stmt, err := db.Prepare("INSERT|t1|name=?,age=?") + if err != nil { + t.Errorf("Stmt, err = %v, %v", stmt, err) + } + defer stmt.Close() + + type execTest struct { + args []any + wantErr string + } + execTests := []execTest{ + // Okay: + {[]any{"Brad", 31}, ""}, + {[]any{"Brad", int64(31)}, ""}, + {[]any{"Bob", "32"}, ""}, + {[]any{7, 9}, ""}, + + // Invalid conversions: + {[]any{"Brad", int64(0xFFFFFFFF)}, "sql: converting argument $2 type: sql/driver: value 4294967295 overflows int32"}, + {[]any{"Brad", "strconv fail"}, `sql: converting argument $2 type: sql/driver: value "strconv fail" can't be converted to int32`}, + + // Wrong number of args: + {[]any{}, "sql: expected 2 arguments, got 0"}, + {[]any{1, 2, 3}, "sql: expected 2 arguments, got 3"}, + } + for n, et := range execTests { + _, err := stmt.Exec(et.args...) + errStr := "" + if err != nil { + errStr = err.Error() + } + if errStr != et.wantErr { + t.Errorf("stmt.Execute #%d: for %v, got error %q, want error %q", + n, et.args, errStr, et.wantErr) + } + } +} + +func TestTxPrepare(t *testing.T) { + db := newTestDB(t, "") + defer closeDB(t, db) + exec(t, db, "CREATE|t1|name=string,age=int32,dead=bool") + tx, err := db.Begin() + if err != nil { + t.Fatalf("Begin = %v", err) + } + stmt, err := tx.Prepare("INSERT|t1|name=?,age=?") + if err != nil { + t.Fatalf("Stmt, err = %v, %v", stmt, err) + } + defer stmt.Close() + _, err = stmt.Exec("Bobby", 7) + if err != nil { + t.Fatalf("Exec = %v", err) + } + err = tx.Commit() + if err != nil { + t.Fatalf("Commit = %v", err) + } + // Commit() should have closed the statement + if !stmt.closed { + t.Fatal("Stmt not closed after Commit") + } +} + +func TestTxStmt(t *testing.T) { + db := newTestDB(t, "") + defer closeDB(t, db) + exec(t, db, "CREATE|t1|name=string,age=int32,dead=bool") + stmt, err := db.Prepare("INSERT|t1|name=?,age=?") + if err != nil { + t.Fatalf("Stmt, err = %v, %v", stmt, err) + } + defer stmt.Close() + tx, err := db.Begin() + if err != nil { + t.Fatalf("Begin = %v", err) + } + txs := tx.Stmt(stmt) + defer txs.Close() + _, err = txs.Exec("Bobby", 7) + if err != nil { + t.Fatalf("Exec = %v", err) + } + err = tx.Commit() + if err != nil { + t.Fatalf("Commit = %v", err) + } + // Commit() should have closed the statement + if !txs.closed { + t.Fatal("Stmt not closed after Commit") + } +} + +func TestTxStmtPreparedOnce(t *testing.T) { + db := newTestDB(t, "") + defer closeDB(t, db) + exec(t, db, "CREATE|t1|name=string,age=int32") + + prepares0 := numPrepares(t, db) + + // db.Prepare increments numPrepares. + stmt, err := db.Prepare("INSERT|t1|name=?,age=?") + if err != nil { + t.Fatalf("Stmt, err = %v, %v", stmt, err) + } + defer stmt.Close() + + tx, err := db.Begin() + if err != nil { + t.Fatalf("Begin = %v", err) + } + + txs1 := tx.Stmt(stmt) + txs2 := tx.Stmt(stmt) + + _, err = txs1.Exec("Go", 7) + if err != nil { + t.Fatalf("Exec = %v", err) + } + txs1.Close() + + _, err = txs2.Exec("Gopher", 8) + if err != nil { + t.Fatalf("Exec = %v", err) + } + txs2.Close() + + err = tx.Commit() + if err != nil { + t.Fatalf("Commit = %v", err) + } + + if prepares := numPrepares(t, db) - prepares0; prepares != 1 { + t.Errorf("executed %d Prepare statements; want 1", prepares) + } +} + +func TestTxStmtClosedRePrepares(t *testing.T) { + db := newTestDB(t, "") + defer closeDB(t, db) + exec(t, db, "CREATE|t1|name=string,age=int32") + + prepares0 := numPrepares(t, db) + + // db.Prepare increments numPrepares. + stmt, err := db.Prepare("INSERT|t1|name=?,age=?") + if err != nil { + t.Fatalf("Stmt, err = %v, %v", stmt, err) + } + tx, err := db.Begin() + if err != nil { + t.Fatalf("Begin = %v", err) + } + err = stmt.Close() + if err != nil { + t.Fatalf("stmt.Close() = %v", err) + } + // tx.Stmt increments numPrepares because stmt is closed. + txs := tx.Stmt(stmt) + if txs.stickyErr != nil { + t.Fatal(txs.stickyErr) + } + if txs.parentStmt != nil { + t.Fatal("expected nil parentStmt") + } + _, err = txs.Exec(`Eric`, 82) + if err != nil { + t.Fatalf("txs.Exec = %v", err) + } + + err = txs.Close() + if err != nil { + t.Fatalf("txs.Close = %v", err) + } + + tx.Rollback() + + if prepares := numPrepares(t, db) - prepares0; prepares != 2 { + t.Errorf("executed %d Prepare statements; want 2", prepares) + } +} + +func TestParentStmtOutlivesTxStmt(t *testing.T) { + db := newTestDB(t, "") + defer closeDB(t, db) + exec(t, db, "CREATE|t1|name=string,age=int32") + + // Make sure everything happens on the same connection. + db.SetMaxOpenConns(1) + + prepares0 := numPrepares(t, db) + + // db.Prepare increments numPrepares. + stmt, err := db.Prepare("INSERT|t1|name=?,age=?") + if err != nil { + t.Fatalf("Stmt, err = %v, %v", stmt, err) + } + defer stmt.Close() + tx, err := db.Begin() + if err != nil { + t.Fatalf("Begin = %v", err) + } + txs := tx.Stmt(stmt) + if len(stmt.css) != 1 { + t.Fatalf("len(stmt.css) = %v; want 1", len(stmt.css)) + } + err = txs.Close() + if err != nil { + t.Fatalf("txs.Close() = %v", err) + } + err = tx.Rollback() + if err != nil { + t.Fatalf("tx.Rollback() = %v", err) + } + // txs must not be valid. + _, err = txs.Exec("Suzan", 30) + if err == nil { + t.Fatalf("txs.Exec(), expected err") + } + // Stmt must still be valid. + _, err = stmt.Exec("Janina", 25) + if err != nil { + t.Fatalf("stmt.Exec() = %v", err) + } + + if prepares := numPrepares(t, db) - prepares0; prepares != 1 { + t.Errorf("executed %d Prepare statements; want 1", prepares) + } +} + +// Test that tx.Stmt called with a statement already +// associated with tx as argument re-prepares the same +// statement again. +func TestTxStmtFromTxStmtRePrepares(t *testing.T) { + db := newTestDB(t, "") + defer closeDB(t, db) + exec(t, db, "CREATE|t1|name=string,age=int32") + prepares0 := numPrepares(t, db) + // db.Prepare increments numPrepares. + stmt, err := db.Prepare("INSERT|t1|name=?,age=?") + if err != nil { + t.Fatalf("Stmt, err = %v, %v", stmt, err) + } + defer stmt.Close() + + tx, err := db.Begin() + if err != nil { + t.Fatalf("Begin = %v", err) + } + txs1 := tx.Stmt(stmt) + + // tx.Stmt(txs1) increments numPrepares because txs1 already + // belongs to a transaction (albeit the same transaction). + txs2 := tx.Stmt(txs1) + if txs2.stickyErr != nil { + t.Fatal(txs2.stickyErr) + } + if txs2.parentStmt != nil { + t.Fatal("expected nil parentStmt") + } + _, err = txs2.Exec(`Eric`, 82) + if err != nil { + t.Fatal(err) + } + + err = txs1.Close() + if err != nil { + t.Fatalf("txs1.Close = %v", err) + } + err = txs2.Close() + if err != nil { + t.Fatalf("txs1.Close = %v", err) + } + err = tx.Rollback() + if err != nil { + t.Fatalf("tx.Rollback = %v", err) + } + + if prepares := numPrepares(t, db) - prepares0; prepares != 2 { + t.Errorf("executed %d Prepare statements; want 2", prepares) + } +} + +// Issue: https://golang.org/issue/2784 +// This test didn't fail before because we got lucky with the fakedb driver. +// It was failing, and now not, in github.com/bradfitz/go-sql-test +func TestTxQuery(t *testing.T) { + db := newTestDB(t, "") + defer closeDB(t, db) + exec(t, db, "CREATE|t1|name=string,age=int32,dead=bool") + exec(t, db, "INSERT|t1|name=Alice") + + tx, err := db.Begin() + if err != nil { + t.Fatal(err) + } + defer tx.Rollback() + + r, err := tx.Query("SELECT|t1|name|") + if err != nil { + t.Fatal(err) + } + defer r.Close() + + if !r.Next() { + if r.Err() != nil { + t.Fatal(r.Err()) + } + t.Fatal("expected one row") + } + + var x string + err = r.Scan(&x) + if err != nil { + t.Fatal(err) + } +} + +func TestTxQueryInvalid(t *testing.T) { + db := newTestDB(t, "") + defer closeDB(t, db) + + tx, err := db.Begin() + if err != nil { + t.Fatal(err) + } + defer tx.Rollback() + + _, err = tx.Query("SELECT|t1|name|") + if err == nil { + t.Fatal("Error expected") + } +} + +// Tests fix for issue 4433, that retries in Begin happen when +// conn.Begin() returns ErrBadConn +func TestTxErrBadConn(t *testing.T) { + db, err := Open("test", fakeDBName+";badConn") + if err != nil { + t.Fatalf("Open: %v", err) + } + if _, err := db.Exec("WIPE"); err != nil { + t.Fatalf("exec wipe: %v", err) + } + defer closeDB(t, db) + exec(t, db, "CREATE|t1|name=string,age=int32,dead=bool") + stmt, err := db.Prepare("INSERT|t1|name=?,age=?") + if err != nil { + t.Fatalf("Stmt, err = %v, %v", stmt, err) + } + defer stmt.Close() + tx, err := db.Begin() + if err != nil { + t.Fatalf("Begin = %v", err) + } + txs := tx.Stmt(stmt) + defer txs.Close() + _, err = txs.Exec("Bobby", 7) + if err != nil { + t.Fatalf("Exec = %v", err) + } + err = tx.Commit() + if err != nil { + t.Fatalf("Commit = %v", err) + } +} + +func TestConnQuery(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + ctx := t.Context() + conn, err := db.Conn(ctx) + if err != nil { + t.Fatal(err) + } + conn.dc.ci.(*fakeConn).skipDirtySession = true + defer conn.Close() + + var name string + err = conn.QueryRowContext(ctx, "SELECT|people|name|age=?", 3).Scan(&name) + if err != nil { + t.Fatal(err) + } + if name != "Chris" { + t.Fatalf("unexpected result, got %q want Chris", name) + } + + err = conn.PingContext(ctx) + if err != nil { + t.Fatal(err) + } +} + +func TestConnRaw(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + ctx := t.Context() + conn, err := db.Conn(ctx) + if err != nil { + t.Fatal(err) + } + conn.dc.ci.(*fakeConn).skipDirtySession = true + defer conn.Close() + + sawFunc := false + err = conn.Raw(func(dc any) error { + sawFunc = true + if _, ok := dc.(*fakeConn); !ok { + return fmt.Errorf("got %T want *fakeConn", dc) + } + return nil + }) + if err != nil { + t.Fatal(err) + } + if !sawFunc { + t.Fatal("Raw func not called") + } + + func() { + defer func() { + x := recover() + if x == nil { + t.Fatal("expected panic") + } + conn.closemu.Lock() + closed := conn.dc == nil + conn.closemu.Unlock() + if !closed { + t.Fatal("expected connection to be closed after panic") + } + }() + err = conn.Raw(func(dc any) error { + panic("Conn.Raw panic should return an error") + }) + t.Fatal("expected panic from Raw func") + }() +} + +func TestCursorFake(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + ctx, cancel := context.WithTimeout(context.Background(), time.Second*30) + defer cancel() + + exec(t, db, "CREATE|peoplecursor|list=table") + exec(t, db, "INSERT|peoplecursor|list=people!name!age") + + rows, err := db.QueryContext(ctx, `SELECT|peoplecursor|list|`) + if err != nil { + t.Fatal(err) + } + defer rows.Close() + + if !rows.Next() { + t.Fatal("no rows") + } + var cursor = &Rows{} + err = rows.Scan(cursor) + if err != nil { + t.Fatal(err) + } + defer cursor.Close() + + const expectedRows = 3 + var currentRow int64 + + var n int64 + var s string + for cursor.Next() { + currentRow++ + err = cursor.Scan(&s, &n) + if err != nil { + t.Fatal(err) + } + if n != currentRow { + t.Errorf("expected number(Age)=%d, got %d", currentRow, n) + } + } + if currentRow != expectedRows { + t.Errorf("expected %d rows, got %d rows", expectedRows, currentRow) + } +} + +func TestInvalidNilValues(t *testing.T) { + var date1 time.Time + var date2 int + + tests := []struct { + name string + input any + expectedError string + }{ + { + name: "time.Time", + input: &date1, + expectedError: `sql: Scan error on column index 0, name "bdate": unsupported Scan, storing driver.Value type into type *time.Time`, + }, + { + name: "int", + input: &date2, + expectedError: `sql: Scan error on column index 0, name "bdate": converting NULL to int is unsupported`, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + ctx := t.Context() + conn, err := db.Conn(ctx) + if err != nil { + t.Fatal(err) + } + conn.dc.ci.(*fakeConn).skipDirtySession = true + defer conn.Close() + + err = conn.QueryRowContext(ctx, "SELECT|people|bdate|age=?", 1).Scan(tt.input) + if err == nil { + t.Fatal("expected error when querying nil column, but succeeded") + } + if err.Error() != tt.expectedError { + t.Fatalf("Expected error: %s\nReceived: %s", tt.expectedError, err.Error()) + } + + err = conn.PingContext(ctx) + if err != nil { + t.Fatal(err) + } + }) + } +} + +func TestConnTx(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + ctx := t.Context() + conn, err := db.Conn(ctx) + if err != nil { + t.Fatal(err) + } + conn.dc.ci.(*fakeConn).skipDirtySession = true + defer conn.Close() + + tx, err := conn.BeginTx(ctx, nil) + if err != nil { + t.Fatal(err) + } + insertName, insertAge := "Nancy", 33 + _, err = tx.ExecContext(ctx, "INSERT|people|name=?,age=?,photo=APHOTO", insertName, insertAge) + if err != nil { + t.Fatal(err) + } + err = tx.Commit() + if err != nil { + t.Fatal(err) + } + + var selectName string + err = conn.QueryRowContext(ctx, "SELECT|people|name|age=?", insertAge).Scan(&selectName) + if err != nil { + t.Fatal(err) + } + if selectName != insertName { + t.Fatalf("got %q want %q", selectName, insertName) + } +} + +// TestConnIsValid verifies that a database connection that should be discarded, +// is actually discarded and does not re-enter the connection pool. +// If the IsValid method from *fakeConn is removed, this test will fail. +func TestConnIsValid(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + db.SetMaxOpenConns(1) + + ctx := context.Background() + + c, err := db.Conn(ctx) + if err != nil { + t.Fatal(err) + } + + err = c.Raw(func(raw any) error { + dc := raw.(*fakeConn) + dc.stickyBad = true + return nil + }) + if err != nil { + t.Fatal(err) + } + c.Close() + + if len(db.freeConn) > 0 && db.freeConn[0].ci.(*fakeConn).stickyBad { + t.Fatal("bad connection returned to pool; expected bad connection to be discarded") + } +} + +// Tests fix for issue 2542, that we release a lock when querying on +// a closed connection. +func TestIssue2542Deadlock(t *testing.T) { + db := newTestDB(t, "people") + closeDB(t, db) + for i := 0; i < 2; i++ { + _, err := db.Query("SELECT|people|age,name|") + if err == nil { + t.Fatalf("expected error") + } + } +} + +// From golang.org/issue/3865 +func TestCloseStmtBeforeRows(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + s, err := db.Prepare("SELECT|people|name|") + if err != nil { + t.Fatal(err) + } + + r, err := s.Query() + if err != nil { + s.Close() + t.Fatal(err) + } + + err = s.Close() + if err != nil { + t.Fatal(err) + } + + r.Close() +} + +// Tests fix for issue 2788, that we bind nil to a []byte if the +// value in the column is sql null +func TestNullByteSlice(t *testing.T) { + db := newTestDB(t, "") + defer closeDB(t, db) + exec(t, db, "CREATE|t|id=int32,name=nullstring") + exec(t, db, "INSERT|t|id=10,name=?", nil) + + var name []byte + + err := db.QueryRow("SELECT|t|name|id=?", 10).Scan(&name) + if err != nil { + t.Fatal(err) + } + if name != nil { + t.Fatalf("name []byte should be nil for null column value, got: %#v", name) + } + + exec(t, db, "INSERT|t|id=11,name=?", "bob") + err = db.QueryRow("SELECT|t|name|id=?", 11).Scan(&name) + if err != nil { + t.Fatal(err) + } + if string(name) != "bob" { + t.Fatalf("name []byte should be bob, got: %q", string(name)) + } +} + +func TestPointerParamsAndScans(t *testing.T) { + db := newTestDB(t, "") + defer closeDB(t, db) + exec(t, db, "CREATE|t|id=int32,name=nullstring") + + bob := "bob" + var name *string + + name = &bob + exec(t, db, "INSERT|t|id=10,name=?", name) + name = nil + exec(t, db, "INSERT|t|id=20,name=?", name) + + err := db.QueryRow("SELECT|t|name|id=?", 10).Scan(&name) + if err != nil { + t.Fatalf("querying id 10: %v", err) + } + if name == nil { + t.Errorf("id 10's name = nil; want bob") + } else if *name != "bob" { + t.Errorf("id 10's name = %q; want bob", *name) + } + + err = db.QueryRow("SELECT|t|name|id=?", 20).Scan(&name) + if err != nil { + t.Fatalf("querying id 20: %v", err) + } + if name != nil { + t.Errorf("id 20 = %q; want nil", *name) + } +} + +func TestQueryRowClosingStmt(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + var name string + var age int + err := db.QueryRow("SELECT|people|age,name|age=?", 3).Scan(&age, &name) + if err != nil { + t.Fatal(err) + } + if len(db.freeConn) != 1 { + t.Fatalf("expected 1 free conn") + } + fakeConn := db.freeConn[0].ci.(*fakeConn) + if made, closed := fakeConn.stmtsMade, fakeConn.stmtsClosed; made != closed { + t.Errorf("statement close mismatch: made %d, closed %d", made, closed) + } +} + +var atomicRowsCloseHook atomic.Value // of func(*Rows, *error) + +func init() { + rowsCloseHook = func() func(*Rows, *error) { + fn, _ := atomicRowsCloseHook.Load().(func(*Rows, *error)) + return fn + } +} + +func setRowsCloseHook(fn func(*Rows, *error)) { + if fn == nil { + // Can't change an atomic.Value back to nil, so set it to this + // no-op func instead. + fn = func(*Rows, *error) {} + } + atomicRowsCloseHook.Store(fn) +} + +// Test issue 6651 +func TestIssue6651(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + var v string + + want := "error in rows.Next" + rowsCursorNextHook = func(dest []driver.Value) error { + return errors.New(want) + } + defer func() { rowsCursorNextHook = nil }() + + err := db.QueryRow("SELECT|people|name|").Scan(&v) + if err == nil || err.Error() != want { + t.Errorf("error = %q; want %q", err, want) + } + rowsCursorNextHook = nil + + want = "error in rows.Close" + setRowsCloseHook(func(rows *Rows, err *error) { + *err = errors.New(want) + }) + defer setRowsCloseHook(nil) + err = db.QueryRow("SELECT|people|name|").Scan(&v) + if err == nil || err.Error() != want { + t.Errorf("error = %q; want %q", err, want) + } +} + +type nullTestRow struct { + nullParam any + notNullParam any + scanNullVal any +} + +type nullTestSpec struct { + nullType string + notNullType string + rows [6]nullTestRow +} + +func TestNullStringParam(t *testing.T) { + spec := nullTestSpec{"nullstring", "string", [6]nullTestRow{ + {NullString{"aqua", true}, "", NullString{"aqua", true}}, + {NullString{"brown", false}, "", NullString{"", false}}, + {"chartreuse", "", NullString{"chartreuse", true}}, + {NullString{"darkred", true}, "", NullString{"darkred", true}}, + {NullString{"eel", false}, "", NullString{"", false}}, + {"foo", NullString{"black", false}, nil}, + }} + nullTestRun(t, spec) +} + +func TestGenericNullStringParam(t *testing.T) { + spec := nullTestSpec{"nullstring", "string", [6]nullTestRow{ + {Null[string]{"aqua", true}, "", Null[string]{"aqua", true}}, + {Null[string]{"brown", false}, "", Null[string]{"", false}}, + {"chartreuse", "", Null[string]{"chartreuse", true}}, + {Null[string]{"darkred", true}, "", Null[string]{"darkred", true}}, + {Null[string]{"eel", false}, "", Null[string]{"", false}}, + {"foo", Null[string]{"black", false}, nil}, + }} + nullTestRun(t, spec) +} + +func TestNullInt64Param(t *testing.T) { + spec := nullTestSpec{"nullint64", "int64", [6]nullTestRow{ + {NullInt64{31, true}, 1, NullInt64{31, true}}, + {NullInt64{-22, false}, 1, NullInt64{0, false}}, + {22, 1, NullInt64{22, true}}, + {NullInt64{33, true}, 1, NullInt64{33, true}}, + {NullInt64{222, false}, 1, NullInt64{0, false}}, + {0, NullInt64{31, false}, nil}, + }} + nullTestRun(t, spec) +} + +func TestNullInt32Param(t *testing.T) { + spec := nullTestSpec{"nullint32", "int32", [6]nullTestRow{ + {NullInt32{31, true}, 1, NullInt32{31, true}}, + {NullInt32{-22, false}, 1, NullInt32{0, false}}, + {22, 1, NullInt32{22, true}}, + {NullInt32{33, true}, 1, NullInt32{33, true}}, + {NullInt32{222, false}, 1, NullInt32{0, false}}, + {0, NullInt32{31, false}, nil}, + }} + nullTestRun(t, spec) +} + +func TestNullInt16Param(t *testing.T) { + spec := nullTestSpec{"nullint16", "int16", [6]nullTestRow{ + {NullInt16{31, true}, 1, NullInt16{31, true}}, + {NullInt16{-22, false}, 1, NullInt16{0, false}}, + {22, 1, NullInt16{22, true}}, + {NullInt16{33, true}, 1, NullInt16{33, true}}, + {NullInt16{222, false}, 1, NullInt16{0, false}}, + {0, NullInt16{31, false}, nil}, + }} + nullTestRun(t, spec) +} + +func TestNullByteParam(t *testing.T) { + spec := nullTestSpec{"nullbyte", "byte", [6]nullTestRow{ + {NullByte{31, true}, 1, NullByte{31, true}}, + {NullByte{0, false}, 1, NullByte{0, false}}, + {22, 1, NullByte{22, true}}, + {NullByte{33, true}, 1, NullByte{33, true}}, + {NullByte{222, false}, 1, NullByte{0, false}}, + {0, NullByte{31, false}, nil}, + }} + nullTestRun(t, spec) +} + +func TestNullFloat64Param(t *testing.T) { + spec := nullTestSpec{"nullfloat64", "float64", [6]nullTestRow{ + {NullFloat64{31.2, true}, 1, NullFloat64{31.2, true}}, + {NullFloat64{13.1, false}, 1, NullFloat64{0, false}}, + {-22.9, 1, NullFloat64{-22.9, true}}, + {NullFloat64{33.81, true}, 1, NullFloat64{33.81, true}}, + {NullFloat64{222, false}, 1, NullFloat64{0, false}}, + {10, NullFloat64{31.2, false}, nil}, + }} + nullTestRun(t, spec) +} + +func TestNullBoolParam(t *testing.T) { + spec := nullTestSpec{"nullbool", "bool", [6]nullTestRow{ + {NullBool{false, true}, true, NullBool{false, true}}, + {NullBool{true, false}, false, NullBool{false, false}}, + {true, true, NullBool{true, true}}, + {NullBool{true, true}, false, NullBool{true, true}}, + {NullBool{true, false}, true, NullBool{false, false}}, + {true, NullBool{true, false}, nil}, + }} + nullTestRun(t, spec) +} + +func TestNullTimeParam(t *testing.T) { + t0 := time.Time{} + t1 := time.Date(2000, 1, 1, 8, 9, 10, 11, time.UTC) + t2 := time.Date(2010, 1, 1, 8, 9, 10, 11, time.UTC) + spec := nullTestSpec{"nulldatetime", "datetime", [6]nullTestRow{ + {NullTime{t1, true}, t2, NullTime{t1, true}}, + {NullTime{t1, false}, t2, NullTime{t0, false}}, + {t1, t2, NullTime{t1, true}}, + {NullTime{t1, true}, t2, NullTime{t1, true}}, + {NullTime{t1, false}, t2, NullTime{t0, false}}, + {t2, NullTime{t1, false}, nil}, + }} + nullTestRun(t, spec) +} + +func nullTestRun(t *testing.T, spec nullTestSpec) { + db := newTestDB(t, "") + defer closeDB(t, db) + exec(t, db, fmt.Sprintf("CREATE|t|id=int32,name=string,nullf=%s,notnullf=%s", spec.nullType, spec.notNullType)) + + // Inserts with db.Exec: + exec(t, db, "INSERT|t|id=?,name=?,nullf=?,notnullf=?", 1, "alice", spec.rows[0].nullParam, spec.rows[0].notNullParam) + exec(t, db, "INSERT|t|id=?,name=?,nullf=?,notnullf=?", 2, "bob", spec.rows[1].nullParam, spec.rows[1].notNullParam) + + // Inserts with a prepared statement: + stmt, err := db.Prepare("INSERT|t|id=?,name=?,nullf=?,notnullf=?") + if err != nil { + t.Fatalf("prepare: %v", err) + } + defer stmt.Close() + if _, err := stmt.Exec(3, "chris", spec.rows[2].nullParam, spec.rows[2].notNullParam); err != nil { + t.Errorf("exec insert chris: %v", err) + } + if _, err := stmt.Exec(4, "dave", spec.rows[3].nullParam, spec.rows[3].notNullParam); err != nil { + t.Errorf("exec insert dave: %v", err) + } + if _, err := stmt.Exec(5, "eleanor", spec.rows[4].nullParam, spec.rows[4].notNullParam); err != nil { + t.Errorf("exec insert eleanor: %v", err) + } + + // Can't put null val into non-null col + row5 := spec.rows[5] + if _, err := stmt.Exec(6, "bob", row5.nullParam, row5.notNullParam); err == nil { + t.Errorf("expected error inserting nil val with prepared statement Exec: NULL=%#v, NOT-NULL=%#v", row5.nullParam, row5.notNullParam) + } + + _, err = db.Exec("INSERT|t|id=?,name=?,nullf=?", 999, nil, nil) + if err == nil { + // TODO: this test fails, but it's just because + // fakeConn implements the optional Execer interface, + // so arguably this is the correct behavior. But + // maybe I should flesh out the fakeConn.Exec + // implementation so this properly fails. + // t.Errorf("expected error inserting nil name with Exec") + } + + paramtype := reflect.TypeOf(spec.rows[0].nullParam) + bindVal := reflect.New(paramtype).Interface() + + for i := 0; i < 5; i++ { + id := i + 1 + if err := db.QueryRow("SELECT|t|nullf|id=?", id).Scan(bindVal); err != nil { + t.Errorf("id=%d Scan: %v", id, err) + } + bindValDeref := reflect.ValueOf(bindVal).Elem().Interface() + if !reflect.DeepEqual(bindValDeref, spec.rows[i].scanNullVal) { + t.Errorf("id=%d got %#v, want %#v", id, bindValDeref, spec.rows[i].scanNullVal) + } + } +} + +// golang.org/issue/4859 +func TestQueryRowNilScanDest(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + var name *string // nil pointer + err := db.QueryRow("SELECT|people|name|").Scan(name) + want := `sql: Scan error on column index 0, name "name": destination pointer is nil` + if err == nil || err.Error() != want { + t.Errorf("error = %q; want %q", err.Error(), want) + } +} + +func TestIssue4902(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + driver := db.Driver().(*fakeDriver) + opens0 := driver.openCount + + var stmt *Stmt + var err error + for i := 0; i < 10; i++ { + stmt, err = db.Prepare("SELECT|people|name|") + if err != nil { + t.Fatal(err) + } + err = stmt.Close() + if err != nil { + t.Fatal(err) + } + } + + opens := driver.openCount - opens0 + if opens > 1 { + t.Errorf("opens = %d; want <= 1", opens) + t.Logf("db = %#v", db) + t.Logf("driver = %#v", driver) + t.Logf("stmt = %#v", stmt) + } +} + +// Issue 3857 +// This used to deadlock. +func TestSimultaneousQueries(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + tx, err := db.Begin() + if err != nil { + t.Fatal(err) + } + defer tx.Rollback() + + r1, err := tx.Query("SELECT|people|name|") + if err != nil { + t.Fatal(err) + } + defer r1.Close() + + r2, err := tx.Query("SELECT|people|name|") + if err != nil { + t.Fatal(err) + } + defer r2.Close() +} + +func TestMaxIdleConns(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + tx, err := db.Begin() + if err != nil { + t.Fatal(err) + } + tx.Commit() + if got := len(db.freeConn); got != 1 { + t.Errorf("freeConns = %d; want 1", got) + } + + db.SetMaxIdleConns(0) + + if got := len(db.freeConn); got != 0 { + t.Errorf("freeConns after set to zero = %d; want 0", got) + } + + tx, err = db.Begin() + if err != nil { + t.Fatal(err) + } + tx.Commit() + if got := len(db.freeConn); got != 0 { + t.Errorf("freeConns = %d; want 0", got) + } +} + +func TestMaxOpenConns(t *testing.T) { + if testing.Short() { + t.Skip("skipping in short mode") + } + defer setHookpostCloseConn(nil) + setHookpostCloseConn(func(_ *fakeConn, err error) { + if err != nil { + t.Errorf("Error closing fakeConn: %v", err) + } + }) + + db := newTestDB(t, "magicquery") + defer closeDB(t, db) + + driver := db.Driver().(*fakeDriver) + + // Force the number of open connections to 0 so we can get an accurate + // count for the test + db.clearAllConns(t) + + driver.mu.Lock() + opens0 := driver.openCount + closes0 := driver.closeCount + driver.mu.Unlock() + + db.SetMaxIdleConns(10) + db.SetMaxOpenConns(10) + + stmt, err := db.Prepare("SELECT|magicquery|op|op=?,millis=?") + if err != nil { + t.Fatal(err) + } + + // Start 50 parallel slow queries. + const ( + nquery = 50 + sleepMillis = 25 + nbatch = 2 + ) + var wg sync.WaitGroup + for batch := 0; batch < nbatch; batch++ { + for i := 0; i < nquery; i++ { + wg.Add(1) + go func() { + defer wg.Done() + var op string + if err := stmt.QueryRow("sleep", sleepMillis).Scan(&op); err != nil && err != ErrNoRows { + t.Error(err) + } + }() + } + // Wait for the batch of queries above to finish before starting the next round. + wg.Wait() + } + + if g, w := db.numFreeConns(), 10; g != w { + t.Errorf("free conns = %d; want %d", g, w) + } + + if n := db.numDepsPoll(t, 20); n > 20 { + t.Errorf("number of dependencies = %d; expected <= 20", n) + db.dumpDeps(t) + } + + driver.mu.Lock() + opens := driver.openCount - opens0 + closes := driver.closeCount - closes0 + driver.mu.Unlock() + + if opens > 10 { + t.Logf("open calls = %d", opens) + t.Logf("close calls = %d", closes) + t.Errorf("db connections opened = %d; want <= 10", opens) + db.dumpDeps(t) + } + + if err := stmt.Close(); err != nil { + t.Fatal(err) + } + + if g, w := db.numFreeConns(), 10; g != w { + t.Errorf("free conns = %d; want %d", g, w) + } + + if n := db.numDepsPoll(t, 10); n > 10 { + t.Errorf("number of dependencies = %d; expected <= 10", n) + db.dumpDeps(t) + } + + db.SetMaxOpenConns(5) + + if g, w := db.numFreeConns(), 5; g != w { + t.Errorf("free conns = %d; want %d", g, w) + } + + if n := db.numDepsPoll(t, 5); n > 5 { + t.Errorf("number of dependencies = %d; expected 0", n) + db.dumpDeps(t) + } + + db.SetMaxOpenConns(0) + + if g, w := db.numFreeConns(), 5; g != w { + t.Errorf("free conns = %d; want %d", g, w) + } + + if n := db.numDepsPoll(t, 5); n > 5 { + t.Errorf("number of dependencies = %d; expected 0", n) + db.dumpDeps(t) + } + + db.clearAllConns(t) +} + +// Issue 9453: tests that SetMaxOpenConns can be lowered at runtime +// and affects the subsequent release of connections. +func TestMaxOpenConnsOnBusy(t *testing.T) { + defer setHookpostCloseConn(nil) + setHookpostCloseConn(func(_ *fakeConn, err error) { + if err != nil { + t.Errorf("Error closing fakeConn: %v", err) + } + }) + + db := newTestDB(t, "magicquery") + defer closeDB(t, db) + + db.SetMaxOpenConns(3) + + ctx := context.Background() + + conn0, err := db.conn(ctx, cachedOrNewConn) + if err != nil { + t.Fatalf("db open conn fail: %v", err) + } + + conn1, err := db.conn(ctx, cachedOrNewConn) + if err != nil { + t.Fatalf("db open conn fail: %v", err) + } + + conn2, err := db.conn(ctx, cachedOrNewConn) + if err != nil { + t.Fatalf("db open conn fail: %v", err) + } + + if g, w := db.numOpen, 3; g != w { + t.Errorf("free conns = %d; want %d", g, w) + } + + db.SetMaxOpenConns(2) + if g, w := db.numOpen, 3; g != w { + t.Errorf("free conns = %d; want %d", g, w) + } + + conn0.releaseConn(nil) + conn1.releaseConn(nil) + if g, w := db.numOpen, 2; g != w { + t.Errorf("free conns = %d; want %d", g, w) + } + + conn2.releaseConn(nil) + if g, w := db.numOpen, 2; g != w { + t.Errorf("free conns = %d; want %d", g, w) + } +} + +// Issue 10886: tests that all connection attempts return when more than +// DB.maxOpen connections are in flight and the first DB.maxOpen fail. +func TestPendingConnsAfterErr(t *testing.T) { + const ( + maxOpen = 2 + tryOpen = maxOpen*2 + 2 + ) + + // No queries will be run. + db, err := Open("test", fakeDBName) + if err != nil { + t.Fatalf("Open: %v", err) + } + defer closeDB(t, db) + defer func() { + for k, v := range db.lastPut { + t.Logf("%p: %v", k, v) + } + }() + + db.SetMaxOpenConns(maxOpen) + db.SetMaxIdleConns(0) + + errOffline := errors.New("db offline") + + defer func() { setHookOpenErr(nil) }() + + errs := make(chan error, tryOpen) + + var opening sync.WaitGroup + opening.Add(tryOpen) + + setHookOpenErr(func() error { + // Wait for all connections to enqueue. + opening.Wait() + return errOffline + }) + + for i := 0; i < tryOpen; i++ { + go func() { + opening.Done() // signal one connection is in flight + _, err := db.Exec("will never run") + errs <- err + }() + } + + opening.Wait() // wait for all workers to begin running + + const timeout = 5 * time.Second + to := time.NewTimer(timeout) + defer to.Stop() + + // check that all connections fail without deadlock + for i := 0; i < tryOpen; i++ { + select { + case err := <-errs: + if got, want := err, errOffline; got != want { + t.Errorf("unexpected err: got %v, want %v", got, want) + } + case <-to.C: + t.Fatalf("orphaned connection request(s), still waiting after %v", timeout) + } + } + + // Wait a reasonable time for the database to close all connections. + tick := time.NewTicker(3 * time.Millisecond) + defer tick.Stop() + for { + select { + case <-tick.C: + db.mu.Lock() + if db.numOpen == 0 { + db.mu.Unlock() + return + } + db.mu.Unlock() + case <-to.C: + // Closing the database will check for numOpen and fail the test. + return + } + } +} + +func TestSingleOpenConn(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + db.SetMaxOpenConns(1) + + rows, err := db.Query("SELECT|people|name|") + if err != nil { + t.Fatal(err) + } + if err = rows.Close(); err != nil { + t.Fatal(err) + } + // shouldn't deadlock + rows, err = db.Query("SELECT|people|name|") + if err != nil { + t.Fatal(err) + } + if err = rows.Close(); err != nil { + t.Fatal(err) + } +} + +func TestStats(t *testing.T) { + db := newTestDB(t, "people") + stats := db.Stats() + if got := stats.OpenConnections; got != 1 { + t.Errorf("stats.OpenConnections = %d; want 1", got) + } + + tx, err := db.Begin() + if err != nil { + t.Fatal(err) + } + tx.Commit() + + closeDB(t, db) + stats = db.Stats() + if got := stats.OpenConnections; got != 0 { + t.Errorf("stats.OpenConnections = %d; want 0", got) + } +} + +func TestConnMaxLifetime(t *testing.T) { + t0 := time.Unix(1000000, 0) + offset := time.Duration(0) + + nowFunc = func() time.Time { return t0.Add(offset) } + defer func() { nowFunc = time.Now }() + + db := newTestDB(t, "magicquery") + defer closeDB(t, db) + + driver := db.Driver().(*fakeDriver) + + // Force the number of open connections to 0 so we can get an accurate + // count for the test + db.clearAllConns(t) + + driver.mu.Lock() + opens0 := driver.openCount + closes0 := driver.closeCount + driver.mu.Unlock() + + db.SetMaxIdleConns(10) + db.SetMaxOpenConns(10) + + tx, err := db.Begin() + if err != nil { + t.Fatal(err) + } + + offset = time.Second + tx2, err := db.Begin() + if err != nil { + t.Fatal(err) + } + + tx.Commit() + tx2.Commit() + + driver.mu.Lock() + opens := driver.openCount - opens0 + closes := driver.closeCount - closes0 + driver.mu.Unlock() + + if opens != 2 { + t.Errorf("opens = %d; want 2", opens) + } + if closes != 0 { + t.Errorf("closes = %d; want 0", closes) + } + if g, w := db.numFreeConns(), 2; g != w { + t.Errorf("free conns = %d; want %d", g, w) + } + + // Expire first conn + offset = 11 * time.Second + db.SetConnMaxLifetime(10 * time.Second) + + tx, err = db.Begin() + if err != nil { + t.Fatal(err) + } + tx2, err = db.Begin() + if err != nil { + t.Fatal(err) + } + tx.Commit() + tx2.Commit() + + // Give connectionCleaner chance to run. + waitCondition(t, func() bool { + driver.mu.Lock() + opens = driver.openCount - opens0 + closes = driver.closeCount - closes0 + driver.mu.Unlock() + + return closes == 1 + }) + + if opens != 3 { + t.Errorf("opens = %d; want 3", opens) + } + if closes != 1 { + t.Errorf("closes = %d; want 1", closes) + } + + if s := db.Stats(); s.MaxLifetimeClosed != 1 { + t.Errorf("MaxLifetimeClosed = %d; want 1 %#v", s.MaxLifetimeClosed, s) + } +} + +// golang.org/issue/5323 +func TestStmtCloseDeps(t *testing.T) { + if testing.Short() { + t.Skip("skipping in short mode") + } + defer setHookpostCloseConn(nil) + setHookpostCloseConn(func(_ *fakeConn, err error) { + if err != nil { + t.Errorf("Error closing fakeConn: %v", err) + } + }) + + db := newTestDB(t, "magicquery") + defer closeDB(t, db) + + driver := db.Driver().(*fakeDriver) + + driver.mu.Lock() + opens0 := driver.openCount + closes0 := driver.closeCount + driver.mu.Unlock() + openDelta0 := opens0 - closes0 + + stmt, err := db.Prepare("SELECT|magicquery|op|op=?,millis=?") + if err != nil { + t.Fatal(err) + } + + // Start 50 parallel slow queries. + const ( + nquery = 50 + sleepMillis = 25 + nbatch = 2 + ) + var wg sync.WaitGroup + for batch := 0; batch < nbatch; batch++ { + for i := 0; i < nquery; i++ { + wg.Add(1) + go func() { + defer wg.Done() + var op string + if err := stmt.QueryRow("sleep", sleepMillis).Scan(&op); err != nil && err != ErrNoRows { + t.Error(err) + } + }() + } + // Wait for the batch of queries above to finish before starting the next round. + wg.Wait() + } + + if g, w := db.numFreeConns(), 2; g != w { + t.Errorf("free conns = %d; want %d", g, w) + } + + if n := db.numDepsPoll(t, 4); n > 4 { + t.Errorf("number of dependencies = %d; expected <= 4", n) + db.dumpDeps(t) + } + + driver.mu.Lock() + opens := driver.openCount - opens0 + closes := driver.closeCount - closes0 + openDelta := (driver.openCount - driver.closeCount) - openDelta0 + driver.mu.Unlock() + + if openDelta > 2 { + t.Logf("open calls = %d", opens) + t.Logf("close calls = %d", closes) + t.Logf("open delta = %d", openDelta) + t.Errorf("db connections opened = %d; want <= 2", openDelta) + db.dumpDeps(t) + } + + if !waitCondition(t, func() bool { + return len(stmt.css) <= nquery + }) { + t.Errorf("len(stmt.css) = %d; want <= %d", len(stmt.css), nquery) + } + + if err := stmt.Close(); err != nil { + t.Fatal(err) + } + + if g, w := db.numFreeConns(), 2; g != w { + t.Errorf("free conns = %d; want %d", g, w) + } + + if n := db.numDepsPoll(t, 2); n > 2 { + t.Errorf("number of dependencies = %d; expected <= 2", n) + db.dumpDeps(t) + } + + db.clearAllConns(t) +} + +// golang.org/issue/5046 +func TestCloseConnBeforeStmts(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + defer setHookpostCloseConn(nil) + setHookpostCloseConn(func(_ *fakeConn, err error) { + if err != nil { + t.Errorf("Error closing fakeConn: %v; from %s", err, stack()) + db.dumpDeps(t) + t.Errorf("DB = %#v", db) + } + }) + + stmt, err := db.Prepare("SELECT|people|name|") + if err != nil { + t.Fatal(err) + } + + if len(db.freeConn) != 1 { + t.Fatalf("expected 1 freeConn; got %d", len(db.freeConn)) + } + dc := db.freeConn[0] + if dc.closed { + t.Errorf("conn shouldn't be closed") + } + + if n := len(dc.openStmt); n != 1 { + t.Errorf("driverConn num openStmt = %d; want 1", n) + } + err = db.Close() + if err != nil { + t.Errorf("db Close = %v", err) + } + if !dc.closed { + t.Errorf("after db.Close, driverConn should be closed") + } + if n := len(dc.openStmt); n != 0 { + t.Errorf("driverConn num openStmt = %d; want 0", n) + } + + err = stmt.Close() + if err != nil { + t.Errorf("Stmt close = %v", err) + } + + if !dc.closed { + t.Errorf("conn should be closed") + } + if dc.ci != nil { + t.Errorf("after Stmt Close, driverConn's Conn interface should be nil") + } +} + +// golang.org/issue/5283: don't release the Rows' connection in Close +// before calling Stmt.Close. +func TestRowsCloseOrder(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + db.SetMaxIdleConns(0) + setStrictFakeConnClose(t) + defer setStrictFakeConnClose(nil) + + rows, err := db.Query("SELECT|people|age,name|") + if err != nil { + t.Fatal(err) + } + err = rows.Close() + if err != nil { + t.Fatal(err) + } +} + +func TestRowsImplicitClose(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + rows, err := db.Query("SELECT|people|age,name|") + if err != nil { + t.Fatal(err) + } + + want, fail := 2, errors.New("fail") + r := rows.rowsi.(*rowsCursor) + r.errPos, r.err = want, fail + + got := 0 + for rows.Next() { + got++ + } + if got != want { + t.Errorf("got %d rows, want %d", got, want) + } + if err := rows.Err(); err != fail { + t.Errorf("got error %v, want %v", err, fail) + } + if !r.closed { + t.Errorf("r.closed is false, want true") + } +} + +func TestRowsCloseError(t *testing.T) { + db := newTestDB(t, "people") + defer db.Close() + rows, err := db.Query("SELECT|people|age,name|") + if err != nil { + t.Fatalf("Query: %v", err) + } + type row struct { + age int + name string + } + got := []row{} + + rc, ok := rows.rowsi.(*rowsCursor) + if !ok { + t.Fatal("not using *rowsCursor") + } + rc.closeErr = errors.New("rowsCursor: failed to close") + + for rows.Next() { + var r row + err = rows.Scan(&r.age, &r.name) + if err != nil { + t.Fatalf("Scan: %v", err) + } + got = append(got, r) + } + err = rows.Err() + if err != rc.closeErr { + t.Fatalf("unexpected err: got %v, want %v", err, rc.closeErr) + } +} + +func TestStmtCloseOrder(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + db.SetMaxIdleConns(0) + setStrictFakeConnClose(t) + defer setStrictFakeConnClose(nil) + + _, err := db.Query("SELECT|non_existent|name|") + if err == nil { + t.Fatal("Querying non-existent table should fail") + } +} + +// Test cases where there's more than maxBadConnRetries bad connections in the +// pool (issue 8834) +func TestManyErrBadConn(t *testing.T) { + manyErrBadConnSetup := func(first ...func(db *DB)) *DB { + db := newTestDB(t, "people") + + for _, f := range first { + f(db) + } + + nconn := maxBadConnRetries + 1 + db.SetMaxIdleConns(nconn) + db.SetMaxOpenConns(nconn) + // open enough connections + func() { + for i := 0; i < nconn; i++ { + rows, err := db.Query("SELECT|people|age,name|") + if err != nil { + t.Fatal(err) + } + defer rows.Close() + } + }() + + db.mu.Lock() + defer db.mu.Unlock() + if db.numOpen != nconn { + t.Fatalf("unexpected numOpen %d (was expecting %d)", db.numOpen, nconn) + } else if len(db.freeConn) != nconn { + t.Fatalf("unexpected len(db.freeConn) %d (was expecting %d)", len(db.freeConn), nconn) + } + for _, conn := range db.freeConn { + conn.Lock() + conn.ci.(*fakeConn).stickyBad = true + conn.Unlock() + } + return db + } + + // Query + db := manyErrBadConnSetup() + defer closeDB(t, db) + rows, err := db.Query("SELECT|people|age,name|") + if err != nil { + t.Fatal(err) + } + if err = rows.Close(); err != nil { + t.Fatal(err) + } + + // Exec + db = manyErrBadConnSetup() + defer closeDB(t, db) + _, err = db.Exec("INSERT|people|name=Julia,age=19") + if err != nil { + t.Fatal(err) + } + + // Begin + db = manyErrBadConnSetup() + defer closeDB(t, db) + tx, err := db.Begin() + if err != nil { + t.Fatal(err) + } + if err = tx.Rollback(); err != nil { + t.Fatal(err) + } + + // Prepare + db = manyErrBadConnSetup() + defer closeDB(t, db) + stmt, err := db.Prepare("SELECT|people|age,name|") + if err != nil { + t.Fatal(err) + } + if err = stmt.Close(); err != nil { + t.Fatal(err) + } + + // Stmt.Exec + db = manyErrBadConnSetup(func(db *DB) { + stmt, err = db.Prepare("INSERT|people|name=Julia,age=19") + if err != nil { + t.Fatal(err) + } + }) + defer closeDB(t, db) + _, err = stmt.Exec() + if err != nil { + t.Fatal(err) + } + if err = stmt.Close(); err != nil { + t.Fatal(err) + } + + // Stmt.Query + db = manyErrBadConnSetup(func(db *DB) { + stmt, err = db.Prepare("SELECT|people|age,name|") + if err != nil { + t.Fatal(err) + } + }) + defer closeDB(t, db) + rows, err = stmt.Query() + if err != nil { + t.Fatal(err) + } + if err = rows.Close(); err != nil { + t.Fatal(err) + } + if err = stmt.Close(); err != nil { + t.Fatal(err) + } + + // Conn + db = manyErrBadConnSetup() + defer closeDB(t, db) + ctx := t.Context() + conn, err := db.Conn(ctx) + if err != nil { + t.Fatal(err) + } + conn.dc.ci.(*fakeConn).skipDirtySession = true + err = conn.Close() + if err != nil { + t.Fatal(err) + } + + // Ping + db = manyErrBadConnSetup() + defer closeDB(t, db) + err = db.PingContext(ctx) + if err != nil { + t.Fatal(err) + } +} + +// Issue 34775: Ensure that a Tx cannot commit after a rollback. +func TestTxCannotCommitAfterRollback(t *testing.T) { + db := newTestDB(t, "tx_status") + defer closeDB(t, db) + + // First check query reporting is correct. + var txStatus string + err := db.QueryRow("SELECT|tx_status|tx_status|").Scan(&txStatus) + if err != nil { + t.Fatal(err) + } + if g, w := txStatus, "autocommit"; g != w { + t.Fatalf("tx_status=%q, wanted %q", g, w) + } + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + tx, err := db.BeginTx(ctx, nil) + if err != nil { + t.Fatal(err) + } + + // Ignore dirty session for this test. + // A failing test should trigger the dirty session flag as well, + // but that isn't exactly what this should test for. + tx.txi.(*fakeTx).c.skipDirtySession = true + + defer tx.Rollback() + + err = tx.QueryRow("SELECT|tx_status|tx_status|").Scan(&txStatus) + if err != nil { + t.Fatal(err) + } + if g, w := txStatus, "transaction"; g != w { + t.Fatalf("tx_status=%q, wanted %q", g, w) + } + + // 1. Begin a transaction. + // 2. (A) Start a query, (B) begin Tx rollback through a ctx cancel. + // 3. Check if 2.A has committed in Tx (pass) or outside of Tx (fail). + sendQuery := make(chan struct{}) + // The Tx status is returned through the row results, ensure + // that the rows results are not canceled. + bypassRowsAwaitDone = true + hookTxGrabConn = func() { + cancel() + <-sendQuery + } + rollbackHook = func() { + close(sendQuery) + } + defer func() { + hookTxGrabConn = nil + rollbackHook = nil + bypassRowsAwaitDone = false + }() + + err = tx.QueryRow("SELECT|tx_status|tx_status|").Scan(&txStatus) + if err != nil { + // A failure here would be expected if skipDirtySession was not set to true above. + t.Fatal(err) + } + if g, w := txStatus, "transaction"; g != w { + t.Fatalf("tx_status=%q, wanted %q", g, w) + } +} + +// Issue 40985 transaction statement deadlock while context cancel. +func TestTxStmtDeadlock(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + tx, err := db.BeginTx(ctx, nil) + if err != nil { + t.Fatal(err) + } + + stmt, err := tx.Prepare("SELECT|people|name,age|age=?") + if err != nil { + t.Fatal(err) + } + cancel() + // Run number of stmt queries to reproduce deadlock from context cancel + for i := 0; i < 1e3; i++ { + // Encounter any close related errors (e.g. ErrTxDone, stmt is closed) + // is expected due to context cancel. + _, err = stmt.Query(1) + if err != nil { + break + } + } + _ = tx.Rollback() +} + +// Issue32530 encounters an issue where a connection may +// expire right after it comes out of a used connection pool +// even when a new connection is requested. +func TestConnExpiresFreshOutOfPool(t *testing.T) { + execCases := []struct { + expired bool + badReset bool + }{ + {false, false}, + {true, false}, + {false, true}, + } + + t0 := time.Unix(1000000, 0) + offset := time.Duration(0) + offsetMu := sync.RWMutex{} + + nowFunc = func() time.Time { + offsetMu.RLock() + defer offsetMu.RUnlock() + return t0.Add(offset) + } + defer func() { nowFunc = time.Now }() + + ctx := t.Context() + + db := newTestDB(t, "magicquery") + defer closeDB(t, db) + + db.SetMaxOpenConns(1) + + for _, ec := range execCases { + name := fmt.Sprintf("expired=%t,badReset=%t", ec.expired, ec.badReset) + t.Run(name, func(t *testing.T) { + db.clearAllConns(t) + + db.SetMaxIdleConns(1) + db.SetConnMaxLifetime(10 * time.Second) + + conn, err := db.conn(ctx, alwaysNewConn) + if err != nil { + t.Fatal(err) + } + + afterPutConn := make(chan struct{}) + waitingForConn := make(chan struct{}) + + go func() { + defer close(afterPutConn) + + conn, err := db.conn(ctx, alwaysNewConn) + if err == nil { + db.putConn(conn, err, false) + } else { + t.Errorf("db.conn: %v", err) + } + }() + go func() { + defer close(waitingForConn) + + for { + if t.Failed() { + return + } + db.mu.Lock() + ct := db.connRequests.Len() + db.mu.Unlock() + if ct > 0 { + return + } + time.Sleep(pollDuration) + } + }() + + <-waitingForConn + + if t.Failed() { + return + } + + offsetMu.Lock() + if ec.expired { + offset = 11 * time.Second + } else { + offset = time.Duration(0) + } + offsetMu.Unlock() + + conn.ci.(*fakeConn).stickyBad = ec.badReset + + db.putConn(conn, err, true) + + <-afterPutConn + }) + } +} + +// TestIssue20575 ensures the Rows from query does not block +// closing a transaction. Ensure Rows is closed while closing a transaction. +func TestIssue20575(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + tx, err := db.Begin() + if err != nil { + t.Fatal(err) + } + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + defer cancel() + _, err = tx.QueryContext(ctx, "SELECT|people|age,name|") + if err != nil { + t.Fatal(err) + } + // Do not close Rows from QueryContext. + err = tx.Rollback() + if err != nil { + t.Fatal(err) + } + select { + default: + case <-ctx.Done(): + t.Fatal("timeout: failed to rollback query without closing rows:", ctx.Err()) + } +} + +// TestIssue20622 tests closing the transaction before rows is closed, requires +// the race detector to fail. +func TestIssue20622(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + tx, err := db.BeginTx(ctx, nil) + if err != nil { + t.Fatal(err) + } + + rows, err := tx.Query("SELECT|people|age,name|") + if err != nil { + t.Fatal(err) + } + + count := 0 + for rows.Next() { + count++ + var age int + var name string + if err := rows.Scan(&age, &name); err != nil { + t.Fatal("scan failed", err) + } + + if count == 1 { + cancel() + } + time.Sleep(100 * time.Millisecond) + } + rows.Close() + tx.Commit() +} + +// golang.org/issue/5718 +func TestErrBadConnReconnect(t *testing.T) { + db := newTestDB(t, "foo") + defer closeDB(t, db) + exec(t, db, "CREATE|t1|name=string,age=int32,dead=bool") + + simulateBadConn := func(name string, hook *func() bool, op func() error) { + broken, retried := false, false + numOpen := db.numOpen + + // simulate a broken connection on the first try + *hook = func() bool { + if !broken { + broken = true + return true + } + retried = true + return false + } + + if err := op(); err != nil { + t.Errorf(name+": %v", err) + return + } + + if !broken || !retried { + t.Error(name + ": Failed to simulate broken connection") + } + *hook = nil + + if numOpen != db.numOpen { + t.Errorf(name+": leaked %d connection(s)!", db.numOpen-numOpen) + numOpen = db.numOpen + } + } + + // db.Exec + dbExec := func() error { + _, err := db.Exec("INSERT|t1|name=?,age=?,dead=?", "Gordon", 3, true) + return err + } + simulateBadConn("db.Exec prepare", &hookPrepareBadConn, dbExec) + simulateBadConn("db.Exec exec", &hookExecBadConn, dbExec) + + // db.Query + dbQuery := func() error { + rows, err := db.Query("SELECT|t1|age,name|") + if err == nil { + err = rows.Close() + } + return err + } + simulateBadConn("db.Query prepare", &hookPrepareBadConn, dbQuery) + simulateBadConn("db.Query query", &hookQueryBadConn, dbQuery) + + // db.Prepare + simulateBadConn("db.Prepare", &hookPrepareBadConn, func() error { + stmt, err := db.Prepare("INSERT|t1|name=?,age=?,dead=?") + if err != nil { + return err + } + stmt.Close() + return nil + }) + + // Provide a way to force a re-prepare of a statement on next execution + forcePrepare := func(stmt *Stmt) { + stmt.css = nil + } + + // stmt.Exec + stmt1, err := db.Prepare("INSERT|t1|name=?,age=?,dead=?") + if err != nil { + t.Fatalf("prepare: %v", err) + } + defer stmt1.Close() + // make sure we must prepare the stmt first + forcePrepare(stmt1) + + stmtExec := func() error { + _, err := stmt1.Exec("Gopher", 3, false) + return err + } + simulateBadConn("stmt.Exec prepare", &hookPrepareBadConn, stmtExec) + simulateBadConn("stmt.Exec exec", &hookExecBadConn, stmtExec) + + // stmt.Query + stmt2, err := db.Prepare("SELECT|t1|age,name|") + if err != nil { + t.Fatalf("prepare: %v", err) + } + defer stmt2.Close() + // make sure we must prepare the stmt first + forcePrepare(stmt2) + + stmtQuery := func() error { + rows, err := stmt2.Query() + if err == nil { + err = rows.Close() + } + return err + } + simulateBadConn("stmt.Query prepare", &hookPrepareBadConn, stmtQuery) + simulateBadConn("stmt.Query exec", &hookQueryBadConn, stmtQuery) +} + +// golang.org/issue/11264 +func TestTxEndBadConn(t *testing.T) { + db := newTestDB(t, "foo") + defer closeDB(t, db) + db.SetMaxIdleConns(0) + exec(t, db, "CREATE|t1|name=string,age=int32,dead=bool") + db.SetMaxIdleConns(1) + + simulateBadConn := func(name string, hook *func() bool, op func() error) { + broken := false + numOpen := db.numOpen + + *hook = func() bool { + if !broken { + broken = true + } + return broken + } + + if err := op(); !errors.Is(err, driver.ErrBadConn) { + t.Errorf(name+": %v", err) + return + } + + if !broken { + t.Error(name + ": Failed to simulate broken connection") + } + *hook = nil + + if numOpen != db.numOpen { + t.Errorf(name+": leaked %d connection(s)!", db.numOpen-numOpen) + } + } + + // db.Exec + dbExec := func(endTx func(tx *Tx) error) func() error { + return func() error { + tx, err := db.Begin() + if err != nil { + return err + } + _, err = tx.Exec("INSERT|t1|name=?,age=?,dead=?", "Gordon", 3, true) + if err != nil { + return err + } + return endTx(tx) + } + } + simulateBadConn("db.Tx.Exec commit", &hookCommitBadConn, dbExec((*Tx).Commit)) + simulateBadConn("db.Tx.Exec rollback", &hookRollbackBadConn, dbExec((*Tx).Rollback)) + + // db.Query + dbQuery := func(endTx func(tx *Tx) error) func() error { + return func() error { + tx, err := db.Begin() + if err != nil { + return err + } + rows, err := tx.Query("SELECT|t1|age,name|") + if err == nil { + err = rows.Close() + } else { + return err + } + return endTx(tx) + } + } + simulateBadConn("db.Tx.Query commit", &hookCommitBadConn, dbQuery((*Tx).Commit)) + simulateBadConn("db.Tx.Query rollback", &hookRollbackBadConn, dbQuery((*Tx).Rollback)) +} + +type concurrentTest interface { + init(t testing.TB, db *DB) + finish(t testing.TB) + test(t testing.TB) error +} + +type concurrentDBQueryTest struct { + db *DB +} + +func (c *concurrentDBQueryTest) init(t testing.TB, db *DB) { + c.db = db +} + +func (c *concurrentDBQueryTest) finish(t testing.TB) { + c.db = nil +} + +func (c *concurrentDBQueryTest) test(t testing.TB) error { + rows, err := c.db.Query("SELECT|people|name|") + if err != nil { + t.Error(err) + return err + } + var name string + for rows.Next() { + rows.Scan(&name) + } + rows.Close() + return nil +} + +type concurrentDBExecTest struct { + db *DB +} + +func (c *concurrentDBExecTest) init(t testing.TB, db *DB) { + c.db = db +} + +func (c *concurrentDBExecTest) finish(t testing.TB) { + c.db = nil +} + +func (c *concurrentDBExecTest) test(t testing.TB) error { + _, err := c.db.Exec("NOSERT|people|name=Chris,age=?,photo=CPHOTO,bdate=?", 3, chrisBirthday) + if err != nil { + t.Error(err) + return err + } + return nil +} + +type concurrentStmtQueryTest struct { + db *DB + stmt *Stmt +} + +func (c *concurrentStmtQueryTest) init(t testing.TB, db *DB) { + c.db = db + var err error + c.stmt, err = db.Prepare("SELECT|people|name|") + if err != nil { + t.Fatal(err) + } +} + +func (c *concurrentStmtQueryTest) finish(t testing.TB) { + if c.stmt != nil { + c.stmt.Close() + c.stmt = nil + } + c.db = nil +} + +func (c *concurrentStmtQueryTest) test(t testing.TB) error { + rows, err := c.stmt.Query() + if err != nil { + t.Errorf("error on query: %v", err) + return err + } + + var name string + for rows.Next() { + rows.Scan(&name) + } + rows.Close() + return nil +} + +type concurrentStmtExecTest struct { + db *DB + stmt *Stmt +} + +func (c *concurrentStmtExecTest) init(t testing.TB, db *DB) { + c.db = db + var err error + c.stmt, err = db.Prepare("NOSERT|people|name=Chris,age=?,photo=CPHOTO,bdate=?") + if err != nil { + t.Fatal(err) + } +} + +func (c *concurrentStmtExecTest) finish(t testing.TB) { + if c.stmt != nil { + c.stmt.Close() + c.stmt = nil + } + c.db = nil +} + +func (c *concurrentStmtExecTest) test(t testing.TB) error { + _, err := c.stmt.Exec(3, chrisBirthday) + if err != nil { + t.Errorf("error on exec: %v", err) + return err + } + return nil +} + +type concurrentTxQueryTest struct { + db *DB + tx *Tx +} + +func (c *concurrentTxQueryTest) init(t testing.TB, db *DB) { + c.db = db + var err error + c.tx, err = c.db.Begin() + if err != nil { + t.Fatal(err) + } +} + +func (c *concurrentTxQueryTest) finish(t testing.TB) { + if c.tx != nil { + c.tx.Rollback() + c.tx = nil + } + c.db = nil +} + +func (c *concurrentTxQueryTest) test(t testing.TB) error { + rows, err := c.db.Query("SELECT|people|name|") + if err != nil { + t.Error(err) + return err + } + var name string + for rows.Next() { + rows.Scan(&name) + } + rows.Close() + return nil +} + +type concurrentTxExecTest struct { + db *DB + tx *Tx +} + +func (c *concurrentTxExecTest) init(t testing.TB, db *DB) { + c.db = db + var err error + c.tx, err = c.db.Begin() + if err != nil { + t.Fatal(err) + } +} + +func (c *concurrentTxExecTest) finish(t testing.TB) { + if c.tx != nil { + c.tx.Rollback() + c.tx = nil + } + c.db = nil +} + +func (c *concurrentTxExecTest) test(t testing.TB) error { + _, err := c.tx.Exec("NOSERT|people|name=Chris,age=?,photo=CPHOTO,bdate=?", 3, chrisBirthday) + if err != nil { + t.Error(err) + return err + } + return nil +} + +type concurrentTxStmtQueryTest struct { + db *DB + tx *Tx + stmt *Stmt +} + +func (c *concurrentTxStmtQueryTest) init(t testing.TB, db *DB) { + c.db = db + var err error + c.tx, err = c.db.Begin() + if err != nil { + t.Fatal(err) + } + c.stmt, err = c.tx.Prepare("SELECT|people|name|") + if err != nil { + t.Fatal(err) + } +} + +func (c *concurrentTxStmtQueryTest) finish(t testing.TB) { + if c.stmt != nil { + c.stmt.Close() + c.stmt = nil + } + if c.tx != nil { + c.tx.Rollback() + c.tx = nil + } + c.db = nil +} + +func (c *concurrentTxStmtQueryTest) test(t testing.TB) error { + rows, err := c.stmt.Query() + if err != nil { + t.Errorf("error on query: %v", err) + return err + } + + var name string + for rows.Next() { + rows.Scan(&name) + } + rows.Close() + return nil +} + +type concurrentTxStmtExecTest struct { + db *DB + tx *Tx + stmt *Stmt +} + +func (c *concurrentTxStmtExecTest) init(t testing.TB, db *DB) { + c.db = db + var err error + c.tx, err = c.db.Begin() + if err != nil { + t.Fatal(err) + } + c.stmt, err = c.tx.Prepare("NOSERT|people|name=Chris,age=?,photo=CPHOTO,bdate=?") + if err != nil { + t.Fatal(err) + } +} + +func (c *concurrentTxStmtExecTest) finish(t testing.TB) { + if c.stmt != nil { + c.stmt.Close() + c.stmt = nil + } + if c.tx != nil { + c.tx.Rollback() + c.tx = nil + } + c.db = nil +} + +func (c *concurrentTxStmtExecTest) test(t testing.TB) error { + _, err := c.stmt.Exec(3, chrisBirthday) + if err != nil { + t.Errorf("error on exec: %v", err) + return err + } + return nil +} + +type concurrentRandomTest struct { + tests []concurrentTest +} + +func (c *concurrentRandomTest) init(t testing.TB, db *DB) { + c.tests = []concurrentTest{ + new(concurrentDBQueryTest), + new(concurrentDBExecTest), + new(concurrentStmtQueryTest), + new(concurrentStmtExecTest), + new(concurrentTxQueryTest), + new(concurrentTxExecTest), + new(concurrentTxStmtQueryTest), + new(concurrentTxStmtExecTest), + } + for _, ct := range c.tests { + ct.init(t, db) + } +} + +func (c *concurrentRandomTest) finish(t testing.TB) { + for _, ct := range c.tests { + ct.finish(t) + } +} + +func (c *concurrentRandomTest) test(t testing.TB) error { + ct := c.tests[rand.Intn(len(c.tests))] + return ct.test(t) +} + +func doConcurrentTest(t testing.TB, ct concurrentTest) { + maxProcs, numReqs := 1, 500 + if testing.Short() { + maxProcs, numReqs = 4, 50 + } + defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(maxProcs)) + + db := newTestDB(t, "people") + defer closeDB(t, db) + + ct.init(t, db) + defer ct.finish(t) + + var wg sync.WaitGroup + wg.Add(numReqs) + + reqs := make(chan bool) + defer close(reqs) + + for i := 0; i < maxProcs*2; i++ { + go func() { + for range reqs { + err := ct.test(t) + if err != nil { + wg.Done() + continue + } + wg.Done() + } + }() + } + + for i := 0; i < numReqs; i++ { + reqs <- true + } + + wg.Wait() +} + +func TestIssue6081(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + drv := db.Driver().(*fakeDriver) + drv.mu.Lock() + opens0 := drv.openCount + closes0 := drv.closeCount + drv.mu.Unlock() + + stmt, err := db.Prepare("SELECT|people|name|") + if err != nil { + t.Fatal(err) + } + setRowsCloseHook(func(rows *Rows, err *error) { + *err = driver.ErrBadConn + }) + defer setRowsCloseHook(nil) + for i := 0; i < 10; i++ { + rows, err := stmt.Query() + if err != nil { + t.Fatal(err) + } + rows.Close() + } + if n := len(stmt.css); n > 1 { + t.Errorf("len(css slice) = %d; want <= 1", n) + } + stmt.Close() + if n := len(stmt.css); n != 0 { + t.Errorf("len(css slice) after Close = %d; want 0", n) + } + + drv.mu.Lock() + opens := drv.openCount - opens0 + closes := drv.closeCount - closes0 + drv.mu.Unlock() + if opens < 9 { + t.Errorf("opens = %d; want >= 9", opens) + } + if closes < 9 { + t.Errorf("closes = %d; want >= 9", closes) + } +} + +// TestIssue18429 attempts to stress rolling back the transaction from a +// context cancel while simultaneously calling Tx.Rollback. Rolling back from a +// context happens concurrently so tx.rollback and tx.Commit must guard against +// double entry. +// +// In the test, a context is canceled while the query is in process so +// the internal rollback will run concurrently with the explicitly called +// Tx.Rollback. +// +// The addition of calling rows.Next also tests +// Issue 21117. +func TestIssue18429(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + ctx := context.Background() + sem := make(chan bool, 20) + var wg sync.WaitGroup + + const milliWait = 30 + + for i := 0; i < 100; i++ { + sem <- true + wg.Add(1) + go func() { + defer func() { + <-sem + wg.Done() + }() + qwait := (time.Duration(rand.Intn(milliWait)) * time.Millisecond).String() + + ctx, cancel := context.WithTimeout(ctx, time.Duration(rand.Intn(milliWait))*time.Millisecond) + defer cancel() + + tx, err := db.BeginTx(ctx, nil) + if err != nil { + return + } + // This is expected to give a cancel error most, but not all the time. + // Test failure will happen with a panic or other race condition being + // reported. + rows, _ := tx.QueryContext(ctx, "WAIT|"+qwait+"|SELECT|people|name|") + if rows != nil { + var name string + // Call Next to test Issue 21117 and check for races. + for rows.Next() { + // Scan the buffer so it is read and checked for races. + rows.Scan(&name) + } + rows.Close() + } + // This call will race with the context cancel rollback to complete + // if the rollback itself isn't guarded. + tx.Rollback() + }() + } + wg.Wait() +} + +// TestIssue20160 attempts to test a short context life on a stmt Query. +func TestIssue20160(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + ctx := context.Background() + sem := make(chan bool, 20) + var wg sync.WaitGroup + + const milliWait = 30 + + stmt, err := db.PrepareContext(ctx, "SELECT|people|name|") + if err != nil { + t.Fatal(err) + } + defer stmt.Close() + + for i := 0; i < 100; i++ { + sem <- true + wg.Add(1) + go func() { + defer func() { + <-sem + wg.Done() + }() + ctx, cancel := context.WithTimeout(ctx, time.Duration(rand.Intn(milliWait))*time.Millisecond) + defer cancel() + + // This is expected to give a cancel error most, but not all the time. + // Test failure will happen with a panic or other race condition being + // reported. + rows, _ := stmt.QueryContext(ctx) + if rows != nil { + rows.Close() + } + }() + } + wg.Wait() +} + +// TestIssue18719 closes the context right before use. The sql.driverConn +// will nil out the ci on close in a lock, but if another process uses it right after +// it will panic with on the nil ref. +// +// See https://golang.org/cl/35550 . +func TestIssue18719(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + tx, err := db.BeginTx(ctx, nil) + if err != nil { + t.Fatal(err) + } + + hookTxGrabConn = func() { + cancel() + + // Wait for the context to cancel and tx to rollback. + for !tx.isDone() { + time.Sleep(pollDuration) + } + } + defer func() { hookTxGrabConn = nil }() + + // This call will grab the connection and cancel the context + // after it has done so. Code after must deal with the canceled state. + _, err = tx.QueryContext(ctx, "SELECT|people|name|") + if err != nil { + t.Fatalf("expected error %v but got %v", nil, err) + } + + // Rows may be ignored because it will be closed when the context is canceled. + + // Do not explicitly rollback. The rollback will happen from the + // canceled context. + + cancel() +} + +func TestIssue20647(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + ctx := t.Context() + + conn, err := db.Conn(ctx) + if err != nil { + t.Fatal(err) + } + conn.dc.ci.(*fakeConn).skipDirtySession = true + defer conn.Close() + + stmt, err := conn.PrepareContext(ctx, "SELECT|people|name|") + if err != nil { + t.Fatal(err) + } + defer stmt.Close() + + rows1, err := stmt.QueryContext(ctx) + if err != nil { + t.Fatal("rows1", err) + } + defer rows1.Close() + + rows2, err := stmt.QueryContext(ctx) + if err != nil { + t.Fatal("rows2", err) + } + defer rows2.Close() + + if rows1.dc != rows2.dc { + t.Fatal("stmt prepared on Conn does not use same connection") + } +} + +func TestConcurrency(t *testing.T) { + list := []struct { + name string + ct concurrentTest + }{ + {"Query", new(concurrentDBQueryTest)}, + {"Exec", new(concurrentDBExecTest)}, + {"StmtQuery", new(concurrentStmtQueryTest)}, + {"StmtExec", new(concurrentStmtExecTest)}, + {"TxQuery", new(concurrentTxQueryTest)}, + {"TxExec", new(concurrentTxExecTest)}, + {"TxStmtQuery", new(concurrentTxStmtQueryTest)}, + {"TxStmtExec", new(concurrentTxStmtExecTest)}, + {"Random", new(concurrentRandomTest)}, + } + for _, item := range list { + t.Run(item.name, func(t *testing.T) { + doConcurrentTest(t, item.ct) + }) + } +} + +func TestConnectionLeak(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + // Start by opening defaultMaxIdleConns + rows := make([]*Rows, defaultMaxIdleConns) + // We need to SetMaxOpenConns > MaxIdleConns, so the DB can open + // a new connection and we can fill the idle queue with the released + // connections. + db.SetMaxOpenConns(len(rows) + 1) + for ii := range rows { + r, err := db.Query("SELECT|people|name|") + if err != nil { + t.Fatal(err) + } + r.Next() + if err := r.Err(); err != nil { + t.Fatal(err) + } + rows[ii] = r + } + // Now we have defaultMaxIdleConns busy connections. Open + // a new one, but wait until the busy connections are released + // before returning control to DB. + drv := db.Driver().(*fakeDriver) + drv.waitCh = make(chan struct{}, 1) + drv.waitingCh = make(chan struct{}, 1) + var wg sync.WaitGroup + wg.Add(1) + go func() { + r, err := db.Query("SELECT|people|name|") + if err != nil { + t.Error(err) + return + } + r.Close() + wg.Done() + }() + // Wait until the goroutine we've just created has started waiting. + <-drv.waitingCh + // Now close the busy connections. This provides a connection for + // the blocked goroutine and then fills up the idle queue. + for _, v := range rows { + v.Close() + } + // At this point we give the new connection to DB. This connection is + // now useless, since the idle queue is full and there are no pending + // requests. DB should deal with this situation without leaking the + // connection. + drv.waitCh <- struct{}{} + wg.Wait() +} + +func TestStatsMaxIdleClosedZero(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + db.SetMaxOpenConns(1) + db.SetMaxIdleConns(1) + db.SetConnMaxLifetime(0) + + preMaxIdleClosed := db.Stats().MaxIdleClosed + + for i := 0; i < 10; i++ { + rows, err := db.Query("SELECT|people|name|") + if err != nil { + t.Fatal(err) + } + rows.Close() + } + + st := db.Stats() + maxIdleClosed := st.MaxIdleClosed - preMaxIdleClosed + t.Logf("MaxIdleClosed: %d", maxIdleClosed) + if maxIdleClosed != 0 { + t.Fatal("expected 0 max idle closed conns, got: ", maxIdleClosed) + } +} + +func TestStatsMaxIdleClosedTen(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + db.SetMaxOpenConns(1) + db.SetMaxIdleConns(0) + db.SetConnMaxLifetime(0) + + preMaxIdleClosed := db.Stats().MaxIdleClosed + + for i := 0; i < 10; i++ { + rows, err := db.Query("SELECT|people|name|") + if err != nil { + t.Fatal(err) + } + rows.Close() + } + + st := db.Stats() + maxIdleClosed := st.MaxIdleClosed - preMaxIdleClosed + t.Logf("MaxIdleClosed: %d", maxIdleClosed) + if maxIdleClosed != 10 { + t.Fatal("expected 0 max idle closed conns, got: ", maxIdleClosed) + } +} + +// testUseConns uses count concurrent connections with 1 nanosecond apart. +// Returns the returnedAt time of the final connection. +func testUseConns(t *testing.T, count int, tm time.Time, db *DB) time.Time { + conns := make([]*Conn, count) + ctx := context.Background() + for i := range conns { + tm = tm.Add(time.Nanosecond) + nowFunc = func() time.Time { + return tm + } + c, err := db.Conn(ctx) + if err != nil { + t.Error(err) + } + conns[i] = c + } + + for i := len(conns) - 1; i >= 0; i-- { + tm = tm.Add(time.Nanosecond) + nowFunc = func() time.Time { + return tm + } + if err := conns[i].Close(); err != nil { + t.Error(err) + } + } + + return tm +} + +func TestMaxIdleTime(t *testing.T) { + usedConns := 5 + reusedConns := 2 + list := []struct { + wantMaxIdleTime time.Duration + wantMaxLifetime time.Duration + wantNextCheck time.Duration + wantIdleClosed int64 + wantMaxIdleClosed int64 + timeOffset time.Duration + secondTimeOffset time.Duration + }{ + { + time.Millisecond, + 0, + time.Millisecond - time.Nanosecond, + int64(usedConns - reusedConns), + int64(usedConns - reusedConns), + 10 * time.Millisecond, + 0, + }, + { + // Want to close some connections via max idle time and one by max lifetime. + time.Millisecond, + // nowFunc() - MaxLifetime should be 1 * time.Nanosecond in connectionCleanerRunLocked. + // This guarantees that first opened connection is to be closed. + // Thus it is timeOffset + secondTimeOffset + 3 (+2 for Close while reusing conns and +1 for Conn). + 10*time.Millisecond + 100*time.Nanosecond + 3*time.Nanosecond, + time.Nanosecond, + // Closed all not reused connections and extra one by max lifetime. + int64(usedConns - reusedConns + 1), + int64(usedConns - reusedConns), + 10 * time.Millisecond, + // Add second offset because otherwise connections are expired via max lifetime in Close. + 100 * time.Nanosecond, + }, + { + time.Hour, + 0, + time.Second, + 0, + 0, + 10 * time.Millisecond, + 0}, + } + baseTime := time.Unix(0, 0) + defer func() { + nowFunc = time.Now + }() + for _, item := range list { + nowFunc = func() time.Time { + return baseTime + } + t.Run(fmt.Sprintf("%v", item.wantMaxIdleTime), func(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + db.SetMaxOpenConns(usedConns) + db.SetMaxIdleConns(usedConns) + db.SetConnMaxIdleTime(item.wantMaxIdleTime) + db.SetConnMaxLifetime(item.wantMaxLifetime) + + preMaxIdleClosed := db.Stats().MaxIdleTimeClosed + + // Busy usedConns. + testUseConns(t, usedConns, baseTime, db) + + tm := baseTime.Add(item.timeOffset) + + // Reuse connections which should never be considered idle + // and exercises the sorting for issue 39471. + tm = testUseConns(t, reusedConns, tm, db) + + tm = tm.Add(item.secondTimeOffset) + nowFunc = func() time.Time { + return tm + } + + db.mu.Lock() + nc, closing := db.connectionCleanerRunLocked(time.Second) + if nc != item.wantNextCheck { + t.Errorf("got %v; want %v next check duration", nc, item.wantNextCheck) + } + + // Validate freeConn order. + var last time.Time + for _, c := range db.freeConn { + if last.After(c.returnedAt) { + t.Error("freeConn is not ordered by returnedAt") + break + } + last = c.returnedAt + } + + db.mu.Unlock() + for _, c := range closing { + c.Close() + } + if g, w := int64(len(closing)), item.wantIdleClosed; g != w { + t.Errorf("got: %d; want %d closed conns", g, w) + } + + st := db.Stats() + maxIdleClosed := st.MaxIdleTimeClosed - preMaxIdleClosed + if g, w := maxIdleClosed, item.wantMaxIdleClosed; g != w { + t.Errorf("got: %d; want %d max idle closed conns", g, w) + } + }) + } +} + +type nvcDriver struct { + fakeDriver + skipNamedValueCheck bool +} + +func (d *nvcDriver) Open(dsn string) (driver.Conn, error) { + c, err := d.fakeDriver.Open(dsn) + fc := c.(*fakeConn) + fc.db.allowAny = true + return &nvcConn{fc, d.skipNamedValueCheck}, err +} + +type nvcConn struct { + *fakeConn + skipNamedValueCheck bool +} + +type decimalInt struct { + value int +} + +type doNotInclude struct{} + +var _ driver.NamedValueChecker = &nvcConn{} + +func (c *nvcConn) CheckNamedValue(nv *driver.NamedValue) error { + if c.skipNamedValueCheck { + return driver.ErrSkip + } + switch v := nv.Value.(type) { + default: + return driver.ErrSkip + case Out: + switch ov := v.Dest.(type) { + default: + return errors.New("unknown NameValueCheck OUTPUT type") + case *string: + *ov = "from-server" + nv.Value = "OUT:*string" + } + return nil + case decimalInt, []int64: + return nil + case doNotInclude: + return driver.ErrRemoveArgument + } +} + +func TestNamedValueChecker(t *testing.T) { + Register("NamedValueCheck", &nvcDriver{}) + db, err := Open("NamedValueCheck", "") + if err != nil { + t.Fatal(err) + } + defer db.Close() + + ctx := t.Context() + _, err = db.ExecContext(ctx, "WIPE") + if err != nil { + t.Fatal("exec wipe", err) + } + + _, err = db.ExecContext(ctx, "CREATE|keys|dec1=any,str1=string,out1=string,array1=any") + if err != nil { + t.Fatal("exec create", err) + } + + o1 := "" + _, err = db.ExecContext(ctx, "INSERT|keys|dec1=?A,str1=?,out1=?O1,array1=?", Named("A", decimalInt{123}), "hello", Named("O1", Out{Dest: &o1}), []int64{42, 128, 707}, doNotInclude{}) + if err != nil { + t.Fatal("exec insert", err) + } + var ( + str1 string + dec1 decimalInt + arr1 []int64 + ) + err = db.QueryRowContext(ctx, "SELECT|keys|dec1,str1,array1|").Scan(&dec1, &str1, &arr1) + if err != nil { + t.Fatal("select", err) + } + + list := []struct{ got, want any }{ + {o1, "from-server"}, + {dec1, decimalInt{123}}, + {str1, "hello"}, + {arr1, []int64{42, 128, 707}}, + } + + for index, item := range list { + if !reflect.DeepEqual(item.got, item.want) { + t.Errorf("got %#v wanted %#v for index %d", item.got, item.want, index) + } + } +} + +func TestNamedValueCheckerSkip(t *testing.T) { + Register("NamedValueCheckSkip", &nvcDriver{skipNamedValueCheck: true}) + db, err := Open("NamedValueCheckSkip", "") + if err != nil { + t.Fatal(err) + } + defer db.Close() + + ctx := t.Context() + _, err = db.ExecContext(ctx, "WIPE") + if err != nil { + t.Fatal("exec wipe", err) + } + + _, err = db.ExecContext(ctx, "CREATE|keys|dec1=any") + if err != nil { + t.Fatal("exec create", err) + } + + _, err = db.ExecContext(ctx, "INSERT|keys|dec1=?A", Named("A", decimalInt{123})) + if err == nil { + t.Fatalf("expected error with bad argument, got %v", err) + } +} + +func TestOpenConnector(t *testing.T) { + Register("testctx", &fakeDriverCtx{}) + db, err := Open("testctx", "people") + if err != nil { + t.Fatal(err) + } + defer db.Close() + + c, ok := db.connector.(*fakeConnector) + if !ok { + t.Fatal("not using *fakeConnector") + } + + if err := db.Close(); err != nil { + t.Fatal(err) + } + + if !c.closed { + t.Fatal("connector is not closed") + } +} + +type ctxOnlyDriver struct { + fakeDriver +} + +func (d *ctxOnlyDriver) Open(dsn string) (driver.Conn, error) { + conn, err := d.fakeDriver.Open(dsn) + if err != nil { + return nil, err + } + return &ctxOnlyConn{fc: conn.(*fakeConn)}, nil +} + +var ( + _ driver.Conn = &ctxOnlyConn{} + _ driver.QueryerContext = &ctxOnlyConn{} + _ driver.ExecerContext = &ctxOnlyConn{} +) + +type ctxOnlyConn struct { + fc *fakeConn + + queryCtxCalled bool + execCtxCalled bool +} + +func (c *ctxOnlyConn) Begin() (driver.Tx, error) { + return c.fc.Begin() +} + +func (c *ctxOnlyConn) Close() error { + return c.fc.Close() +} + +// Prepare is still part of the Conn interface, so while it isn't used +// must be defined for compatibility. +func (c *ctxOnlyConn) Prepare(q string) (driver.Stmt, error) { + panic("not used") +} + +func (c *ctxOnlyConn) PrepareContext(ctx context.Context, q string) (driver.Stmt, error) { + return c.fc.PrepareContext(ctx, q) +} + +func (c *ctxOnlyConn) QueryContext(ctx context.Context, q string, args []driver.NamedValue) (driver.Rows, error) { + c.queryCtxCalled = true + return c.fc.QueryContext(ctx, q, args) +} + +func (c *ctxOnlyConn) ExecContext(ctx context.Context, q string, args []driver.NamedValue) (driver.Result, error) { + c.execCtxCalled = true + return c.fc.ExecContext(ctx, q, args) +} + +// TestQueryExecContextOnly ensures drivers only need to implement QueryContext +// and ExecContext methods. +func TestQueryExecContextOnly(t *testing.T) { + // Ensure connection does not implement non-context interfaces. + var connType driver.Conn = &ctxOnlyConn{} + if _, ok := connType.(driver.Execer); ok { + t.Fatalf("%T must not implement driver.Execer", connType) + } + if _, ok := connType.(driver.Queryer); ok { + t.Fatalf("%T must not implement driver.Queryer", connType) + } + + Register("ContextOnly", &ctxOnlyDriver{}) + db, err := Open("ContextOnly", "") + if err != nil { + t.Fatal(err) + } + defer db.Close() + + ctx := t.Context() + + conn, err := db.Conn(ctx) + if err != nil { + t.Fatal("db.Conn", err) + } + defer conn.Close() + coc := conn.dc.ci.(*ctxOnlyConn) + coc.fc.skipDirtySession = true + + _, err = conn.ExecContext(ctx, "WIPE") + if err != nil { + t.Fatal("exec wipe", err) + } + + _, err = conn.ExecContext(ctx, "CREATE|keys|v1=string") + if err != nil { + t.Fatal("exec create", err) + } + expectedValue := "value1" + _, err = conn.ExecContext(ctx, "INSERT|keys|v1=?", expectedValue) + if err != nil { + t.Fatal("exec insert", err) + } + rows, err := conn.QueryContext(ctx, "SELECT|keys|v1|") + if err != nil { + t.Fatal("query select", err) + } + v1 := "" + for rows.Next() { + err = rows.Scan(&v1) + if err != nil { + t.Fatal("rows scan", err) + } + } + rows.Close() + + if v1 != expectedValue { + t.Fatalf("expected %q, got %q", expectedValue, v1) + } + + if !coc.execCtxCalled { + t.Error("ExecContext not called") + } + if !coc.queryCtxCalled { + t.Error("QueryContext not called") + } +} + +type alwaysErrScanner struct{} + +var errTestScanWrap = errors.New("errTestScanWrap") + +func (alwaysErrScanner) Scan(any) error { + return errTestScanWrap +} + +// Issue 38099: Ensure that Rows.Scan properly wraps underlying errors. +func TestRowsScanProperlyWrapsErrors(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + rows, err := db.Query("SELECT|people|age|") + if err != nil { + t.Fatalf("Query: %v", err) + } + + var res alwaysErrScanner + + for rows.Next() { + err = rows.Scan(&res) + if err == nil { + t.Fatal("expecting back an error") + } + if !errors.Is(err, errTestScanWrap) { + t.Fatalf("errors.Is mismatch\n%v\nWant: %v", err, errTestScanWrap) + } + // Ensure that error substring matching still correctly works. + if !strings.Contains(err.Error(), errTestScanWrap.Error()) { + t.Fatalf("Error %v does not contain %v", err, errTestScanWrap) + } + } +} + +type alwaysErrValuer struct{} + +// errEmpty is returned when an empty value is found +var errEmpty = errors.New("empty value") + +func (v alwaysErrValuer) Value() (driver.Value, error) { + return nil, errEmpty +} + +// Issue 64707: Ensure that Stmt.Exec and Stmt.Query properly wraps underlying errors. +func TestDriverArgsWrapsErrors(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + t.Run("exec", func(t *testing.T) { + _, err := db.Exec("INSERT|keys|dec1=?", alwaysErrValuer{}) + if err == nil { + t.Fatal("expecting back an error") + } + if !errors.Is(err, errEmpty) { + t.Fatalf("errors.Is mismatch\n%v\nWant: %v", err, errEmpty) + } + // Ensure that error substring matching still correctly works. + if !strings.Contains(err.Error(), errEmpty.Error()) { + t.Fatalf("Error %v does not contain %v", err, errEmpty) + } + }) + + t.Run("query", func(t *testing.T) { + _, err := db.Query("INSERT|keys|dec1=?", alwaysErrValuer{}) + if err == nil { + t.Fatal("expecting back an error") + } + if !errors.Is(err, errEmpty) { + t.Fatalf("errors.Is mismatch\n%v\nWant: %v", err, errEmpty) + } + // Ensure that error substring matching still correctly works. + if !strings.Contains(err.Error(), errEmpty.Error()) { + t.Fatalf("Error %v does not contain %v", err, errEmpty) + } + }) +} + +func TestContextCancelDuringRawBytesScan(t *testing.T) { + for _, mode := range []string{"nocancel", "top", "bottom", "go"} { + t.Run(mode, func(t *testing.T) { + testContextCancelDuringRawBytesScan(t, mode) + }) + } +} + +// From go.dev/issue/60304 +func testContextCancelDuringRawBytesScan(t *testing.T, mode string) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + // cancel used to call close asynchronously. + // This test checks that it waits so as not to interfere with RawBytes. + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + r, err := db.QueryContext(ctx, "SELECT|people|name|") + if err != nil { + t.Fatal(err) + } + numRows := 0 + var sink byte + for r.Next() { + if mode == "top" && numRows == 2 { + // cancel between Next and Scan is observed by Scan as err = context.Canceled. + // The sleep here is only to make it more likely that the cancel will be observed. + // If not, the test should still pass, like in "go" mode. + cancel() + time.Sleep(100 * time.Millisecond) + } + numRows++ + var s RawBytes + err = r.Scan(&s) + if numRows == 3 && err == context.Canceled { + if r.closemuScanHold { + t.Errorf("expected closemu NOT to be held") + } + break + } + if !r.closemuScanHold { + t.Errorf("expected closemu to be held") + } + if err != nil { + t.Fatal(err) + } + t.Logf("read %q", s) + if mode == "bottom" && numRows == 2 { + // cancel before Next should be observed by Next, exiting the loop. + // The sleep here is only to make it more likely that the cancel will be observed. + // If not, the test should still pass, like in "go" mode. + cancel() + time.Sleep(100 * time.Millisecond) + } + if mode == "go" && numRows == 2 { + // cancel at any future time, to catch other cases + go cancel() + } + for _, b := range s { // some operation reading from the raw memory + sink += b + } + } + if r.closemuScanHold { + t.Errorf("closemu held; should not be") + } + + // There are 3 rows. We canceled after reading 2 so we expect either + // 2 or 3 depending on how the awaitDone goroutine schedules. + switch numRows { + case 0, 1: + t.Errorf("got %d rows; want 2+", numRows) + case 2: + if err := r.Err(); err != context.Canceled { + t.Errorf("unexpected error: %v (%T)", err, err) + } + default: + // Made it to the end. This is rare, but fine. Permit it. + } + + if err := r.Close(); err != nil { + t.Fatal(err) + } +} + +func TestContextCancelBetweenNextAndErr(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + r, err := db.QueryContext(ctx, "SELECT|people|name|") + if err != nil { + t.Fatal(err) + } + for r.Next() { + } + cancel() // wake up the awaitDone goroutine + time.Sleep(10 * time.Millisecond) // increase odds of seeing failure + if err := r.Err(); err != nil { + t.Fatal(err) + } +} + +type testScanner struct { + scanf func(src any) error +} + +func (ts testScanner) Scan(src any) error { return ts.scanf(src) } + +func TestContextCancelDuringScan(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + scanStart := make(chan any) + scanEnd := make(chan error) + scanner := &testScanner{ + scanf: func(src any) error { + scanStart <- src + return <-scanEnd + }, + } + + // Start a query, and pause it mid-scan. + want := []byte("Alice") + r, err := db.QueryContext(ctx, "SELECT|people|name|name=?", string(want)) + if err != nil { + t.Fatal(err) + } + if !r.Next() { + t.Fatalf("r.Next() = false, want true") + } + go func() { + r.Scan(scanner) + }() + got := <-scanStart + defer close(scanEnd) + gotBytes, ok := got.([]byte) + if !ok { + t.Fatalf("r.Scan returned %T, want []byte", got) + } + if !bytes.Equal(gotBytes, want) { + t.Fatalf("before cancel: r.Scan returned %q, want %q", gotBytes, want) + } + + // Cancel the query. + // Sleep to give it a chance to finish canceling. + cancel() + time.Sleep(10 * time.Millisecond) + + // Cancelling the query should not have changed the result. + if !bytes.Equal(gotBytes, want) { + t.Fatalf("after cancel: r.Scan result is now %q, want %q", gotBytes, want) + } +} + +func TestNilErrorAfterClose(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + // This WithCancel is important; Rows contains an optimization to avoid + // spawning a goroutine when the query/transaction context cannot be + // canceled, but this test tests a bug which is caused by said goroutine. + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + r, err := db.QueryContext(ctx, "SELECT|people|name|") + if err != nil { + t.Fatal(err) + } + + if err := r.Close(); err != nil { + t.Fatal(err) + } + + time.Sleep(10 * time.Millisecond) // increase odds of seeing failure + if err := r.Err(); err != nil { + t.Fatal(err) + } +} + +// Issue #65201. +// +// If a RawBytes is reused across multiple queries, +// subsequent queries shouldn't overwrite driver-owned memory from previous queries. +func TestRawBytesReuse(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + var raw RawBytes + + // The RawBytes in this query aliases driver-owned memory. + rows, err := db.Query("SELECT|people|name|") + if err != nil { + t.Fatal(err) + } + rows.Next() + rows.Scan(&raw) // now raw is pointing to driver-owned memory + name1 := string(raw) + rows.Close() + + // The RawBytes in this query does not alias driver-owned memory. + rows, err = db.Query("SELECT|people|age|") + if err != nil { + t.Fatal(err) + } + rows.Next() + rows.Scan(&raw) // this must not write to the driver-owned memory in raw + rows.Close() + + // Repeat the first query. Nothing should have changed. + rows, err = db.Query("SELECT|people|name|") + if err != nil { + t.Fatal(err) + } + rows.Next() + rows.Scan(&raw) // raw points to driver-owned memory again + name2 := string(raw) + rows.Close() + if name1 != name2 { + t.Fatalf("Scan read name %q, want %q", name2, name1) + } +} + +// badConn implements a bad driver.Conn, for TestBadDriver. +// The Exec method panics. +type badConn struct{} + +func (bc badConn) Prepare(query string) (driver.Stmt, error) { + return nil, errors.New("badConn Prepare") +} + +func (bc badConn) Close() error { + return nil +} + +func (bc badConn) Begin() (driver.Tx, error) { + return nil, errors.New("badConn Begin") +} + +func (bc badConn) Exec(query string, args []driver.Value) (driver.Result, error) { + panic("badConn.Exec") +} + +// badDriver is a driver.Driver that uses badConn. +type badDriver struct{} + +func (bd badDriver) Open(name string) (driver.Conn, error) { + return badConn{}, nil +} + +// Issue 15901. +func TestBadDriver(t *testing.T) { + Register("bad", badDriver{}) + db, err := Open("bad", "ignored") + if err != nil { + t.Fatal(err) + } + defer func() { + if r := recover(); r == nil { + t.Error("expected panic") + } else { + if want := "badConn.Exec"; r.(string) != want { + t.Errorf("panic was %v, expected %v", r, want) + } + } + }() + defer db.Close() + db.Exec("ignored") +} + +type pingDriver struct { + fails bool +} + +type pingConn struct { + badConn + driver *pingDriver +} + +var pingError = errors.New("Ping failed") + +func (pc pingConn) Ping(ctx context.Context) error { + if pc.driver.fails { + return pingError + } + return nil +} + +var _ driver.Pinger = pingConn{} + +func (pd *pingDriver) Open(name string) (driver.Conn, error) { + return pingConn{driver: pd}, nil +} + +func TestPing(t *testing.T) { + driver := &pingDriver{} + Register("ping", driver) + + db, err := Open("ping", "ignored") + if err != nil { + t.Fatal(err) + } + + if err := db.Ping(); err != nil { + t.Errorf("err was %#v, expected nil", err) + return + } + + driver.fails = true + if err := db.Ping(); err != pingError { + t.Errorf("err was %#v, expected pingError", err) + } +} + +// Issue 18101. +func TestTypedString(t *testing.T) { + db := newTestDB(t, "people") + defer closeDB(t, db) + + type Str string + var scanned Str + + err := db.QueryRow("SELECT|people|name|name=?", "Alice").Scan(&scanned) + if err != nil { + t.Fatal(err) + } + expected := Str("Alice") + if scanned != expected { + t.Errorf("expected %+v, got %+v", expected, scanned) + } +} + +func BenchmarkConcurrentDBExec(b *testing.B) { + b.ReportAllocs() + ct := new(concurrentDBExecTest) + for i := 0; i < b.N; i++ { + doConcurrentTest(b, ct) + } +} + +func BenchmarkConcurrentStmtQuery(b *testing.B) { + b.ReportAllocs() + ct := new(concurrentStmtQueryTest) + for i := 0; i < b.N; i++ { + doConcurrentTest(b, ct) + } +} + +func BenchmarkConcurrentStmtExec(b *testing.B) { + b.ReportAllocs() + ct := new(concurrentStmtExecTest) + for i := 0; i < b.N; i++ { + doConcurrentTest(b, ct) + } +} + +func BenchmarkConcurrentTxQuery(b *testing.B) { + b.ReportAllocs() + ct := new(concurrentTxQueryTest) + for i := 0; i < b.N; i++ { + doConcurrentTest(b, ct) + } +} + +func BenchmarkConcurrentTxExec(b *testing.B) { + b.ReportAllocs() + ct := new(concurrentTxExecTest) + for i := 0; i < b.N; i++ { + doConcurrentTest(b, ct) + } +} + +func BenchmarkConcurrentTxStmtQuery(b *testing.B) { + b.ReportAllocs() + ct := new(concurrentTxStmtQueryTest) + for i := 0; i < b.N; i++ { + doConcurrentTest(b, ct) + } +} + +func BenchmarkConcurrentTxStmtExec(b *testing.B) { + b.ReportAllocs() + ct := new(concurrentTxStmtExecTest) + for i := 0; i < b.N; i++ { + doConcurrentTest(b, ct) + } +} + +func BenchmarkConcurrentRandom(b *testing.B) { + b.ReportAllocs() + ct := new(concurrentRandomTest) + for i := 0; i < b.N; i++ { + doConcurrentTest(b, ct) + } +} + +func BenchmarkManyConcurrentQueries(b *testing.B) { + b.ReportAllocs() + // To see lock contention in Go 1.4, 16~ cores and 128~ goroutines are required. + const parallelism = 16 + + db := newTestDB(b, "magicquery") + defer closeDB(b, db) + db.SetMaxIdleConns(runtime.GOMAXPROCS(0) * parallelism) + + stmt, err := db.Prepare("SELECT|magicquery|op|op=?,millis=?") + if err != nil { + b.Fatal(err) + } + defer stmt.Close() + + b.SetParallelism(parallelism) + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + rows, err := stmt.Query("sleep", 1) + if err != nil { + b.Error(err) + return + } + rows.Close() + } + }) +} + +func TestGrabConnAllocs(t *testing.T) { + testenv.SkipIfOptimizationOff(t) + if race.Enabled { + t.Skip("skipping allocation test when using race detector") + } + c := new(Conn) + ctx := context.Background() + n := int(testing.AllocsPerRun(1000, func() { + _, release, err := c.grabConn(ctx) + if err != nil { + t.Fatal(err) + } + release(nil) + })) + if n > 0 { + t.Fatalf("Conn.grabConn allocated %v objects; want 0", n) + } +} + +func BenchmarkGrabConn(b *testing.B) { + b.ReportAllocs() + c := new(Conn) + ctx := context.Background() + for i := 0; i < b.N; i++ { + _, release, err := c.grabConn(ctx) + if err != nil { + b.Fatal(err) + } + release(nil) + } +} + +func TestConnRequestSet(t *testing.T) { + var s connRequestSet + wantLen := func(want int) { + t.Helper() + if got := s.Len(); got != want { + t.Errorf("Len = %d; want %d", got, want) + } + if want == 0 && !t.Failed() { + if _, ok := s.TakeRandom(); ok { + t.Fatalf("TakeRandom returned result when empty") + } + } + } + reset := func() { s = connRequestSet{} } + + t.Run("add-delete", func(t *testing.T) { + reset() + wantLen(0) + dh := s.Add(nil) + wantLen(1) + if !s.Delete(dh) { + t.Fatal("failed to delete") + } + wantLen(0) + if s.Delete(dh) { + t.Error("delete worked twice") + } + wantLen(0) + }) + t.Run("take-before-delete", func(t *testing.T) { + reset() + ch1 := make(chan connRequest) + dh := s.Add(ch1) + wantLen(1) + if got, ok := s.TakeRandom(); !ok || got != ch1 { + t.Fatalf("wrong take; ok=%v", ok) + } + wantLen(0) + if s.Delete(dh) { + t.Error("unexpected delete after take") + } + }) + t.Run("get-take-many", func(t *testing.T) { + reset() + m := map[chan connRequest]bool{} + const N = 100 + var inOrder, backOut []chan connRequest + for range N { + c := make(chan connRequest) + m[c] = true + s.Add(c) + inOrder = append(inOrder, c) + } + if s.Len() != N { + t.Fatalf("Len = %v; want %v", s.Len(), N) + } + for s.Len() > 0 { + c, ok := s.TakeRandom() + if !ok { + t.Fatal("failed to take when non-empty") + } + if !m[c] { + t.Fatal("returned item not in remaining set") + } + delete(m, c) + backOut = append(backOut, c) + } + if len(m) > 0 { + t.Error("items remain in expected map") + } + if slices.Equal(inOrder, backOut) { // N! chance of flaking; N=100 is fine + t.Error("wasn't random") + } + }) + t.Run("close-delete", func(t *testing.T) { + reset() + ch := make(chan connRequest) + dh := s.Add(ch) + wantLen(1) + s.CloseAndRemoveAll() + wantLen(0) + if s.Delete(dh) { + t.Error("unexpected delete after CloseAndRemoveAll") + } + }) +} + +func BenchmarkConnRequestSet(b *testing.B) { + var s connRequestSet + for range b.N { + for range 16 { + s.Add(nil) + } + for range 8 { + if _, ok := s.TakeRandom(); !ok { + b.Fatal("want ok") + } + } + for range 8 { + s.Add(nil) + } + for range 16 { + if _, ok := s.TakeRandom(); !ok { + b.Fatal("want ok") + } + } + if _, ok := s.TakeRandom(); ok { + b.Fatal("unexpected ok") + } + } +} + +func TestIssue69837(t *testing.T) { + u := Null[uint]{V: 1, Valid: true} + val, err := driver.DefaultParameterConverter.ConvertValue(u) + if err != nil { + t.Errorf("ConvertValue() error = %v, want nil", err) + } + + if v, ok := val.(int64); !ok { + t.Errorf("val.(type): got %T, expected int64", val) + } else if v != 1 { + t.Errorf("val: got %d, expected 1", v) + } +} + +type issue69728Type struct { + ID int + Name string +} + +func (t issue69728Type) Value() (driver.Value, error) { + return []byte(fmt.Sprintf("%d, %s", t.ID, t.Name)), nil +} + +func TestIssue69728(t *testing.T) { + forValue := Null[issue69728Type]{ + Valid: true, + V: issue69728Type{ + ID: 42, + Name: "foobar", + }, + } + + v1, err := forValue.Value() + if err != nil { + t.Errorf("forValue.Value() error = %v, want nil", err) + } + + v2, err := forValue.V.Value() + if err != nil { + t.Errorf("forValue.V.Value() error = %v, want nil", err) + } + + if !reflect.DeepEqual(v1, v2) { + t.Errorf("not equal; v1 = %v, v2 = %v", v1, v2) + } +} + +func TestColumnConverterWithUnknownInputCount(t *testing.T) { + db := OpenDB(&unknownInputsConnector{}) + stmt, err := db.Prepare("SELECT ?") + if err != nil { + t.Fatal(err) + } + _, err = stmt.Exec(1) + if err != nil { + t.Fatal(err) + } +} + +type unknownInputsConnector struct{} + +func (unknownInputsConnector) Connect(context.Context) (driver.Conn, error) { + return unknownInputsConn{}, nil +} + +func (unknownInputsConnector) Driver() driver.Driver { return nil } + +type unknownInputsConn struct{} + +func (unknownInputsConn) Prepare(string) (driver.Stmt, error) { return unknownInputsStmt{}, nil } +func (unknownInputsConn) Close() error { return nil } +func (unknownInputsConn) Begin() (driver.Tx, error) { return nil, nil } + +type unknownInputsStmt struct{} + +func (unknownInputsStmt) Close() error { return nil } +func (unknownInputsStmt) NumInput() int { return -1 } +func (unknownInputsStmt) Exec(args []driver.Value) (driver.Result, error) { + if _, ok := args[0].(string); !ok { + return nil, fmt.Errorf("Expected string, got %T", args[0]) + } + return nil, nil +} +func (unknownInputsStmt) Query([]driver.Value) (driver.Rows, error) { return nil, nil } +func (unknownInputsStmt) ColumnConverter(idx int) driver.ValueConverter { + return unknownInputsValueConverter{} +} + +type unknownInputsValueConverter struct{} + +func (unknownInputsValueConverter) ConvertValue(v any) (driver.Value, error) { + return "string", nil +} diff --git a/go/src/debug/buildinfo/buildinfo.go b/go/src/debug/buildinfo/buildinfo.go new file mode 100644 index 0000000000000000000000000000000000000000..d202d5050a2786df6a6e3672d12fb962dc3af98b --- /dev/null +++ b/go/src/debug/buildinfo/buildinfo.go @@ -0,0 +1,599 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package buildinfo provides access to information embedded in a Go binary +// about how it was built. This includes the Go toolchain version, and the +// set of modules used (for binaries built in module mode). +// +// Build information is available for the currently running binary in +// runtime/debug.ReadBuildInfo. +package buildinfo + +import ( + "bytes" + "debug/elf" + "debug/macho" + "debug/pe" + "debug/plan9obj" + "encoding/binary" + "errors" + "fmt" + "internal/saferio" + "internal/xcoff" + "io" + "io/fs" + "os" + "runtime/debug" + _ "unsafe" // for linkname +) + +// Type alias for build info. We cannot move the types here, since +// runtime/debug would need to import this package, which would make it +// a much larger dependency. +type BuildInfo = debug.BuildInfo + +// errUnrecognizedFormat is returned when a given executable file doesn't +// appear to be in a known format, or it breaks the rules of that format, +// or when there are I/O errors reading the file. +var errUnrecognizedFormat = errors.New("unrecognized file format") + +// errNotGoExe is returned when a given executable file is valid but does +// not contain Go build information. +// +// errNotGoExe should be an internal detail, +// but widely used packages access it using linkname. +// Notable members of the hall of shame include: +// - github.com/quay/claircore +// +// Do not remove or change the type signature. +// See go.dev/issue/67401. +// +//go:linkname errNotGoExe +var errNotGoExe = errors.New("not a Go executable") + +// The build info blob left by the linker is identified by a 32-byte header, +// consisting of buildInfoMagic (14 bytes), followed by version-dependent +// fields. +var buildInfoMagic = []byte("\xff Go buildinf:") + +const ( + buildInfoAlign = 16 + buildInfoHeaderSize = 32 +) + +// ReadFile returns build information embedded in a Go binary +// file at the given path. Most information is only available for binaries built +// with module support. +func ReadFile(name string) (info *BuildInfo, err error) { + defer func() { + if _, ok := errors.AsType[*fs.PathError](err); ok { + err = fmt.Errorf("could not read Go build info: %w", err) + } else if err != nil { + err = fmt.Errorf("could not read Go build info from %s: %w", name, err) + } + }() + + f, err := os.Open(name) + if err != nil { + return nil, err + } + defer f.Close() + return Read(f) +} + +// Read returns build information embedded in a Go binary file +// accessed through the given ReaderAt. Most information is only available for +// binaries built with module support. +func Read(r io.ReaderAt) (*BuildInfo, error) { + vers, mod, err := readRawBuildInfo(r) + if err != nil { + return nil, err + } + bi, err := debug.ParseBuildInfo(mod) + if err != nil { + return nil, err + } + bi.GoVersion = vers + return bi, nil +} + +type exe interface { + // DataStart returns the virtual address and size of the segment or section that + // should contain build information. This is either a specially named section + // or the first writable non-zero data segment. + DataStart() (uint64, uint64) + + // DataReader returns an io.ReaderAt that reads from addr until the end + // of segment or section that contains addr. + DataReader(addr uint64) (io.ReaderAt, error) +} + +// readRawBuildInfo extracts the Go toolchain version and module information +// strings from a Go binary. On success, vers should be non-empty. mod +// is empty if the binary was not built with modules enabled. +func readRawBuildInfo(r io.ReaderAt) (vers, mod string, err error) { + // Read the first bytes of the file to identify the format, then delegate to + // a format-specific function to load segment and section headers. + ident := make([]byte, 16) + if n, err := r.ReadAt(ident, 0); n < len(ident) || err != nil { + return "", "", errUnrecognizedFormat + } + + var x exe + switch { + case bytes.HasPrefix(ident, []byte("\x7FELF")): + f, err := elf.NewFile(r) + if err != nil { + return "", "", errUnrecognizedFormat + } + x = &elfExe{f} + case bytes.HasPrefix(ident, []byte("MZ")): + f, err := pe.NewFile(r) + if err != nil { + return "", "", errUnrecognizedFormat + } + x = &peExe{f} + case bytes.HasPrefix(ident, []byte("\xFE\xED\xFA")) || bytes.HasPrefix(ident[1:], []byte("\xFA\xED\xFE")): + f, err := macho.NewFile(r) + if err != nil { + return "", "", errUnrecognizedFormat + } + x = &machoExe{f} + case bytes.HasPrefix(ident, []byte("\xCA\xFE\xBA\xBE")) || bytes.HasPrefix(ident, []byte("\xCA\xFE\xBA\xBF")): + f, err := macho.NewFatFile(r) + if err != nil || len(f.Arches) == 0 { + return "", "", errUnrecognizedFormat + } + x = &machoExe{f.Arches[0].File} + case bytes.HasPrefix(ident, []byte{0x01, 0xDF}) || bytes.HasPrefix(ident, []byte{0x01, 0xF7}): + f, err := xcoff.NewFile(r) + if err != nil { + return "", "", errUnrecognizedFormat + } + x = &xcoffExe{f} + case hasPlan9Magic(ident): + f, err := plan9obj.NewFile(r) + if err != nil { + return "", "", errUnrecognizedFormat + } + x = &plan9objExe{f} + default: + return "", "", errUnrecognizedFormat + } + + // Read segment or section to find the build info blob. + // On some platforms, the blob will be in its own section, and DataStart + // returns the address of that section. On others, it's somewhere in the + // data segment; the linker puts it near the beginning. + // See cmd/link/internal/ld.Link.buildinfo. + dataAddr, dataSize := x.DataStart() + if dataSize == 0 { + return "", "", errNotGoExe + } + + addr, err := searchMagic(x, dataAddr, dataSize) + if err != nil { + return "", "", err + } + + // Read in the full header first. + header, err := readData(x, addr, buildInfoHeaderSize) + if err == io.EOF { + return "", "", errNotGoExe + } else if err != nil { + return "", "", err + } + if len(header) < buildInfoHeaderSize { + return "", "", errNotGoExe + } + + const ( + ptrSizeOffset = 14 + flagsOffset = 15 + versPtrOffset = 16 + + flagsEndianMask = 0x1 + flagsEndianLittle = 0x0 + flagsEndianBig = 0x1 + + flagsVersionMask = 0x2 + flagsVersionPtr = 0x0 + flagsVersionInl = 0x2 + ) + + // Decode the blob. The blob is a 32-byte header, optionally followed + // by 2 varint-prefixed string contents. + // + // type buildInfoHeader struct { + // magic [14]byte + // ptrSize uint8 // used if flagsVersionPtr + // flags uint8 + // versPtr targetUintptr // used if flagsVersionPtr + // modPtr targetUintptr // used if flagsVersionPtr + // } + // + // The version bit of the flags field determines the details of the format. + // + // Prior to 1.18, the flags version bit is flagsVersionPtr. In this + // case, the header includes pointers to the version and modinfo Go + // strings in the header. The ptrSize field indicates the size of the + // pointers and the endian bit of the flag indicates the pointer + // endianness. + // + // Since 1.18, the flags version bit is flagsVersionInl. In this case, + // the header is followed by the string contents inline as + // length-prefixed (as varint) string contents. First is the version + // string, followed immediately by the modinfo string. + flags := header[flagsOffset] + if flags&flagsVersionMask == flagsVersionInl { + vers, addr, err = decodeString(x, addr+buildInfoHeaderSize) + if err != nil { + return "", "", err + } + mod, _, err = decodeString(x, addr) + if err != nil { + return "", "", err + } + } else { + // flagsVersionPtr (<1.18) + ptrSize := int(header[ptrSizeOffset]) + bigEndian := flags&flagsEndianMask == flagsEndianBig + var bo binary.ByteOrder + if bigEndian { + bo = binary.BigEndian + } else { + bo = binary.LittleEndian + } + var readPtr func([]byte) uint64 + if ptrSize == 4 { + readPtr = func(b []byte) uint64 { return uint64(bo.Uint32(b)) } + } else if ptrSize == 8 { + readPtr = bo.Uint64 + } else { + return "", "", errNotGoExe + } + vers = readString(x, ptrSize, readPtr, readPtr(header[versPtrOffset:])) + mod = readString(x, ptrSize, readPtr, readPtr(header[versPtrOffset+ptrSize:])) + } + if vers == "" { + return "", "", errNotGoExe + } + if len(mod) >= 33 && mod[len(mod)-17] == '\n' { + // Strip module framing: sentinel strings delimiting the module info. + // These are cmd/go/internal/modload.infoStart and infoEnd. + mod = mod[16 : len(mod)-16] + } else { + mod = "" + } + + return vers, mod, nil +} + +func hasPlan9Magic(magic []byte) bool { + if len(magic) >= 4 { + m := binary.BigEndian.Uint32(magic) + switch m { + case plan9obj.Magic386, plan9obj.MagicAMD64, plan9obj.MagicARM: + return true + } + } + return false +} + +func decodeString(x exe, addr uint64) (string, uint64, error) { + // varint length followed by length bytes of data. + + // N.B. ReadData reads _up to_ size bytes from the section containing + // addr. So we don't need to check that size doesn't overflow the + // section. + b, err := readData(x, addr, binary.MaxVarintLen64) + if err == io.EOF { + return "", 0, errNotGoExe + } else if err != nil { + return "", 0, err + } + + length, n := binary.Uvarint(b) + if n <= 0 { + return "", 0, errNotGoExe + } + addr += uint64(n) + + b, err = readData(x, addr, length) + if err == io.EOF { + return "", 0, errNotGoExe + } else if err == io.ErrUnexpectedEOF { + // Length too large to allocate. Clearly bogus value. + return "", 0, errNotGoExe + } else if err != nil { + return "", 0, err + } + if uint64(len(b)) < length { + // Section ended before we could read the full string. + return "", 0, errNotGoExe + } + + return string(b), addr + length, nil +} + +// readString returns the string at address addr in the executable x. +func readString(x exe, ptrSize int, readPtr func([]byte) uint64, addr uint64) string { + hdr, err := readData(x, addr, uint64(2*ptrSize)) + if err != nil || len(hdr) < 2*ptrSize { + return "" + } + dataAddr := readPtr(hdr) + dataLen := readPtr(hdr[ptrSize:]) + data, err := readData(x, dataAddr, dataLen) + if err != nil || uint64(len(data)) < dataLen { + return "" + } + return string(data) +} + +const searchChunkSize = 1 << 20 // 1 MB + +// searchMagic returns the aligned first instance of buildInfoMagic in the data +// range [addr, addr+size). Returns false if not found. +func searchMagic(x exe, start, size uint64) (uint64, error) { + end := start + size + if end < start { + // Overflow. + return 0, errUnrecognizedFormat + } + + // Round up start; magic can't occur in the initial unaligned portion. + start = (start + buildInfoAlign - 1) &^ (buildInfoAlign - 1) + if start >= end { + return 0, errNotGoExe + } + + var buf []byte + for start < end { + // Read in chunks to avoid consuming too much memory if data is large. + // + // Normally it would be somewhat painful to handle the magic crossing a + // chunk boundary, but since it must be 16-byte aligned we know it will + // fall within a single chunk. + remaining := end - start + chunkSize := uint64(searchChunkSize) + if chunkSize > remaining { + chunkSize = remaining + } + + if buf == nil { + buf = make([]byte, chunkSize) + } else { + // N.B. chunkSize can only decrease, and only on the + // last chunk. + buf = buf[:chunkSize] + clear(buf) + } + + n, err := readDataInto(x, start, buf) + if err == io.EOF { + // EOF before finding the magic; must not be a Go executable. + return 0, errNotGoExe + } else if err != nil { + return 0, err + } + + data := buf[:n] + for len(data) > 0 { + i := bytes.Index(data, buildInfoMagic) + if i < 0 { + break + } + if remaining-uint64(i) < buildInfoHeaderSize { + // Found magic, but not enough space left for the full header. + return 0, errNotGoExe + } + if i%buildInfoAlign != 0 { + // Found magic, but misaligned. Keep searching. + next := (i + buildInfoAlign - 1) &^ (buildInfoAlign - 1) + if next > len(data) { + // Corrupt object file: the remaining + // count says there is more data, + // but we didn't read it. + return 0, errNotGoExe + } + data = data[next:] + continue + } + // Good match! + return start + uint64(i), nil + } + + start += chunkSize + } + + return 0, errNotGoExe +} + +func readData(x exe, addr, size uint64) ([]byte, error) { + r, err := x.DataReader(addr) + if err != nil { + return nil, err + } + + b, err := saferio.ReadDataAt(r, size, 0) + if len(b) > 0 && err == io.EOF { + err = nil + } + return b, err +} + +func readDataInto(x exe, addr uint64, b []byte) (int, error) { + r, err := x.DataReader(addr) + if err != nil { + return 0, err + } + + n, err := r.ReadAt(b, 0) + if n > 0 && err == io.EOF { + err = nil + } + return n, err +} + +// elfExe is the ELF implementation of the exe interface. +type elfExe struct { + f *elf.File +} + +func (x *elfExe) DataReader(addr uint64) (io.ReaderAt, error) { + for _, prog := range x.f.Progs { + if prog.Vaddr <= addr && addr <= prog.Vaddr+prog.Filesz-1 { + remaining := prog.Vaddr + prog.Filesz - addr + return io.NewSectionReader(prog, int64(addr-prog.Vaddr), int64(remaining)), nil + } + } + return nil, errUnrecognizedFormat +} + +func (x *elfExe) DataStart() (uint64, uint64) { + for _, s := range x.f.Sections { + if s.Name == ".go.buildinfo" { + return s.Addr, s.Size + } + } + for _, p := range x.f.Progs { + if p.Type == elf.PT_LOAD && p.Flags&(elf.PF_X|elf.PF_W) == elf.PF_W { + return p.Vaddr, p.Memsz + } + } + return 0, 0 +} + +// peExe is the PE (Windows Portable Executable) implementation of the exe interface. +type peExe struct { + f *pe.File +} + +func (x *peExe) imageBase() uint64 { + switch oh := x.f.OptionalHeader.(type) { + case *pe.OptionalHeader32: + return uint64(oh.ImageBase) + case *pe.OptionalHeader64: + return oh.ImageBase + } + return 0 +} + +func (x *peExe) DataReader(addr uint64) (io.ReaderAt, error) { + addr -= x.imageBase() + for _, sect := range x.f.Sections { + if uint64(sect.VirtualAddress) <= addr && addr <= uint64(sect.VirtualAddress+sect.Size-1) { + remaining := uint64(sect.VirtualAddress+sect.Size) - addr + return io.NewSectionReader(sect, int64(addr-uint64(sect.VirtualAddress)), int64(remaining)), nil + } + } + return nil, errUnrecognizedFormat +} + +func (x *peExe) DataStart() (uint64, uint64) { + // Assume data is first writable section. + const ( + IMAGE_SCN_CNT_CODE = 0x00000020 + IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040 + IMAGE_SCN_CNT_UNINITIALIZED_DATA = 0x00000080 + IMAGE_SCN_MEM_EXECUTE = 0x20000000 + IMAGE_SCN_MEM_READ = 0x40000000 + IMAGE_SCN_MEM_WRITE = 0x80000000 + IMAGE_SCN_MEM_DISCARDABLE = 0x2000000 + IMAGE_SCN_LNK_NRELOC_OVFL = 0x1000000 + IMAGE_SCN_ALIGN_32BYTES = 0x600000 + ) + for _, sect := range x.f.Sections { + if sect.VirtualAddress != 0 && sect.Size != 0 && + sect.Characteristics&^IMAGE_SCN_ALIGN_32BYTES == IMAGE_SCN_CNT_INITIALIZED_DATA|IMAGE_SCN_MEM_READ|IMAGE_SCN_MEM_WRITE { + return uint64(sect.VirtualAddress) + x.imageBase(), uint64(sect.VirtualSize) + } + } + return 0, 0 +} + +// machoExe is the Mach-O (Apple macOS/iOS) implementation of the exe interface. +type machoExe struct { + f *macho.File +} + +func (x *machoExe) DataReader(addr uint64) (io.ReaderAt, error) { + for _, load := range x.f.Loads { + seg, ok := load.(*macho.Segment) + if !ok { + continue + } + if seg.Addr <= addr && addr <= seg.Addr+seg.Filesz-1 { + if seg.Name == "__PAGEZERO" { + continue + } + remaining := seg.Addr + seg.Filesz - addr + return io.NewSectionReader(seg, int64(addr-seg.Addr), int64(remaining)), nil + } + } + return nil, errUnrecognizedFormat +} + +func (x *machoExe) DataStart() (uint64, uint64) { + // Look for section named "__go_buildinfo". + for _, sec := range x.f.Sections { + if sec.Name == "__go_buildinfo" { + return sec.Addr, sec.Size + } + } + // Try the first non-empty writable segment. + const RW = 3 + for _, load := range x.f.Loads { + seg, ok := load.(*macho.Segment) + if ok && seg.Addr != 0 && seg.Filesz != 0 && seg.Prot == RW && seg.Maxprot == RW { + return seg.Addr, seg.Memsz + } + } + return 0, 0 +} + +// xcoffExe is the XCOFF (AIX eXtended COFF) implementation of the exe interface. +type xcoffExe struct { + f *xcoff.File +} + +func (x *xcoffExe) DataReader(addr uint64) (io.ReaderAt, error) { + for _, sect := range x.f.Sections { + if sect.VirtualAddress <= addr && addr <= sect.VirtualAddress+sect.Size-1 { + remaining := sect.VirtualAddress + sect.Size - addr + return io.NewSectionReader(sect, int64(addr-sect.VirtualAddress), int64(remaining)), nil + } + } + return nil, errors.New("address not mapped") +} + +func (x *xcoffExe) DataStart() (uint64, uint64) { + if s := x.f.SectionByType(xcoff.STYP_DATA); s != nil { + return s.VirtualAddress, s.Size + } + return 0, 0 +} + +// plan9objExe is the Plan 9 a.out implementation of the exe interface. +type plan9objExe struct { + f *plan9obj.File +} + +func (x *plan9objExe) DataStart() (uint64, uint64) { + if s := x.f.Section("data"); s != nil { + return uint64(s.Offset), uint64(s.Size) + } + return 0, 0 +} + +func (x *plan9objExe) DataReader(addr uint64) (io.ReaderAt, error) { + for _, sect := range x.f.Sections { + if uint64(sect.Offset) <= addr && addr <= uint64(sect.Offset+sect.Size-1) { + remaining := uint64(sect.Offset+sect.Size) - addr + return io.NewSectionReader(sect, int64(addr-uint64(sect.Offset)), int64(remaining)), nil + } + } + return nil, errors.New("address not mapped") +} diff --git a/go/src/debug/buildinfo/buildinfo_test.go b/go/src/debug/buildinfo/buildinfo_test.go new file mode 100644 index 0000000000000000000000000000000000000000..ceab14e8bff6221c1371806ebf5e5ef2caf6cbbe --- /dev/null +++ b/go/src/debug/buildinfo/buildinfo_test.go @@ -0,0 +1,412 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package buildinfo_test + +import ( + "bytes" + "debug/buildinfo" + "debug/pe" + "encoding/binary" + "flag" + "fmt" + "internal/obscuretestdata" + "internal/testenv" + "os" + "os/exec" + "path" + "path/filepath" + "regexp" + "runtime" + "strings" + "testing" +) + +var flagAll = flag.Bool("all", false, "test all supported GOOS/GOARCH platforms, instead of only the current platform") + +// TestReadFile confirms that ReadFile can read build information from binaries +// on supported target platforms. It builds a trivial binary on the current +// platforms (or all platforms if -all is set) in various configurations and +// checks that build information can or cannot be read. +func TestReadFile(t *testing.T) { + if testing.Short() { + t.Skip("test requires compiling and linking, which may be slow") + } + testenv.MustHaveGoBuild(t) + + type platform struct{ goos, goarch string } + platforms := []platform{ + {"aix", "ppc64"}, + {"darwin", "amd64"}, + {"darwin", "arm64"}, + {"linux", "386"}, + {"linux", "amd64"}, + {"windows", "386"}, + {"windows", "amd64"}, + } + runtimePlatform := platform{runtime.GOOS, runtime.GOARCH} + haveRuntimePlatform := false + for _, p := range platforms { + if p == runtimePlatform { + haveRuntimePlatform = true + break + } + } + if !haveRuntimePlatform { + platforms = append(platforms, runtimePlatform) + } + + buildModes := []string{"pie", "exe"} + if testenv.HasCGO() { + buildModes = append(buildModes, "c-shared") + } + + // Keep in sync with src/cmd/go/internal/work/init.go:buildModeInit. + badmode := func(goos, goarch, buildmode string) string { + return fmt.Sprintf("-buildmode=%s not supported on %s/%s", buildmode, goos, goarch) + } + + buildWithModules := func(t *testing.T, goos, goarch, buildmode string) string { + dir := t.TempDir() + gomodPath := filepath.Join(dir, "go.mod") + gomodData := []byte("module example.com/m\ngo 1.18\n") + if err := os.WriteFile(gomodPath, gomodData, 0666); err != nil { + t.Fatal(err) + } + helloPath := filepath.Join(dir, "hello.go") + helloData := []byte("package main\nfunc main() {}\n") + if err := os.WriteFile(helloPath, helloData, 0666); err != nil { + t.Fatal(err) + } + outPath := filepath.Join(dir, path.Base(t.Name())) + cmd := exec.Command(testenv.GoToolPath(t), "build", "-o="+outPath, "-buildmode="+buildmode) + cmd.Dir = dir + cmd.Env = append(os.Environ(), "GO111MODULE=on", "GOOS="+goos, "GOARCH="+goarch) + stderr := &strings.Builder{} + cmd.Stderr = stderr + if err := cmd.Run(); err != nil { + if badmodeMsg := badmode(goos, goarch, buildmode); strings.Contains(stderr.String(), badmodeMsg) { + t.Skip(badmodeMsg) + } + t.Fatalf("failed building test file: %v\n%s", err, stderr.String()) + } + return outPath + } + + buildWithGOPATH := func(t *testing.T, goos, goarch, buildmode string) string { + gopathDir := t.TempDir() + pkgDir := filepath.Join(gopathDir, "src/example.com/m") + if err := os.MkdirAll(pkgDir, 0777); err != nil { + t.Fatal(err) + } + helloPath := filepath.Join(pkgDir, "hello.go") + helloData := []byte("package main\nfunc main() {}\n") + if err := os.WriteFile(helloPath, helloData, 0666); err != nil { + t.Fatal(err) + } + outPath := filepath.Join(gopathDir, path.Base(t.Name())) + cmd := exec.Command(testenv.GoToolPath(t), "build", "-o="+outPath, "-buildmode="+buildmode) + cmd.Dir = pkgDir + cmd.Env = append(os.Environ(), "GO111MODULE=off", "GOPATH="+gopathDir, "GOOS="+goos, "GOARCH="+goarch) + stderr := &strings.Builder{} + cmd.Stderr = stderr + if err := cmd.Run(); err != nil { + if badmodeMsg := badmode(goos, goarch, buildmode); strings.Contains(stderr.String(), badmodeMsg) { + t.Skip(badmodeMsg) + } + t.Fatalf("failed building test file: %v\n%s", err, stderr.String()) + } + return outPath + } + + damageBuildInfo := func(t *testing.T, name string) { + data, err := os.ReadFile(name) + if err != nil { + t.Fatal(err) + } + i := bytes.Index(data, []byte("\xff Go buildinf:")) + if i < 0 { + t.Fatal("Go buildinf not found") + } + data[i+2] = 'N' + if err := os.WriteFile(name, data, 0666); err != nil { + t.Fatal(err) + } + } + + damageStringLen := func(t *testing.T, name string) { + data, err := os.ReadFile(name) + if err != nil { + t.Fatal(err) + } + i := bytes.Index(data, []byte("\xff Go buildinf:")) + if i < 0 { + t.Fatal("Go buildinf not found") + } + verLen := data[i+32:] + binary.PutUvarint(verLen, 16<<40) // 16TB ought to be enough for anyone. + if err := os.WriteFile(name, data, 0666); err != nil { + t.Fatal(err) + } + } + + goVersionRe := regexp.MustCompile("(?m)^go\t.*\n") + buildRe := regexp.MustCompile("(?m)^build\t.*\n") + cleanOutputForComparison := func(got string) string { + // Remove or replace anything that might depend on the test's environment + // so we can check the output afterward with a string comparison. + // We'll remove all build lines except the compiler, just to make sure + // build lines are included. + got = goVersionRe.ReplaceAllString(got, "go\tGOVERSION\n") + got = buildRe.ReplaceAllStringFunc(got, func(match string) string { + if strings.HasPrefix(match, "build\t-compiler=") { + return match + } + return "" + }) + return got + } + + cases := []struct { + name string + build func(t *testing.T, goos, goarch, buildmode string) string + want string + wantErr string + }{ + { + name: "doesnotexist", + build: func(t *testing.T, goos, goarch, buildmode string) string { + return "doesnotexist.txt" + }, + wantErr: "doesnotexist", + }, + { + name: "empty", + build: func(t *testing.T, _, _, _ string) string { + dir := t.TempDir() + name := filepath.Join(dir, "empty") + if err := os.WriteFile(name, nil, 0666); err != nil { + t.Fatal(err) + } + return name + }, + wantErr: "unrecognized file format", + }, + { + name: "valid_modules", + build: buildWithModules, + want: "go\tGOVERSION\n" + + "path\texample.com/m\n" + + "mod\texample.com/m\t(devel)\t\n" + + "build\t-compiler=gc\n", + }, + { + name: "invalid_modules", + build: func(t *testing.T, goos, goarch, buildmode string) string { + name := buildWithModules(t, goos, goarch, buildmode) + damageBuildInfo(t, name) + return name + }, + wantErr: "not a Go executable", + }, + { + name: "invalid_str_len", + build: func(t *testing.T, goos, goarch, buildmode string) string { + name := buildWithModules(t, goos, goarch, buildmode) + damageStringLen(t, name) + return name + }, + wantErr: "not a Go executable", + }, + { + name: "valid_gopath", + build: buildWithGOPATH, + want: "go\tGOVERSION\n" + + "path\texample.com/m\n" + + "build\t-compiler=gc\n", + }, + { + name: "invalid_gopath", + build: func(t *testing.T, goos, goarch, buildmode string) string { + name := buildWithGOPATH(t, goos, goarch, buildmode) + damageBuildInfo(t, name) + return name + }, + wantErr: "not a Go executable", + }, + } + + for _, p := range platforms { + t.Run(p.goos+"_"+p.goarch, func(t *testing.T) { + if p != runtimePlatform && !*flagAll { + t.Skipf("skipping platforms other than %s_%s because -all was not set", runtimePlatform.goos, runtimePlatform.goarch) + } + for _, mode := range buildModes { + t.Run(mode, func(t *testing.T) { + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + name := tc.build(t, p.goos, p.goarch, mode) + if info, err := buildinfo.ReadFile(name); err != nil { + if tc.wantErr == "" { + t.Fatalf("unexpected error: %v", err) + } else if errMsg := err.Error(); !strings.Contains(errMsg, tc.wantErr) { + t.Fatalf("got error %q; want error containing %q", errMsg, tc.wantErr) + } + } else { + if tc.wantErr != "" { + t.Fatalf("unexpected success; want error containing %q", tc.wantErr) + } + got := info.String() + if clean := cleanOutputForComparison(got); got != tc.want && clean != tc.want { + t.Fatalf("got:\n%s\nwant:\n%s", got, tc.want) + } + } + }) + } + }) + } + }) + } +} + +// Test117 verifies that parsing of the old, pre-1.18 format works. +func Test117(t *testing.T) { + b, err := obscuretestdata.ReadFile("testdata/go117/go117.base64") + if err != nil { + t.Fatalf("ReadFile got err %v, want nil", err) + } + + info, err := buildinfo.Read(bytes.NewReader(b)) + if err != nil { + t.Fatalf("Read got err %v, want nil", err) + } + + if info.GoVersion != "go1.17" { + t.Errorf("GoVersion got %s want go1.17", info.GoVersion) + } + if info.Path != "example.com/go117" { + t.Errorf("Path got %s want example.com/go117", info.Path) + } + if info.Main.Path != "example.com/go117" { + t.Errorf("Main.Path got %s want example.com/go117", info.Main.Path) + } +} + +// TestNotGo verifies that parsing of a non-Go binary returns the proper error. +func TestNotGo(t *testing.T) { + b, err := obscuretestdata.ReadFile("testdata/notgo/notgo.base64") + if err != nil { + t.Fatalf("ReadFile got err %v, want nil", err) + } + + _, err = buildinfo.Read(bytes.NewReader(b)) + if err == nil { + t.Fatalf("Read got nil err, want non-nil") + } + + // The precise error text here isn't critical, but we want something + // like errNotGoExe rather than e.g., a file read error. + if !strings.Contains(err.Error(), "not a Go executable") { + t.Errorf("ReadFile got err %v want not a Go executable", err) + } +} + +// FuzzIssue57002 is a regression test for golang.org/issue/57002. +// +// The cause of issue 57002 is when pointerSize is not being checked, +// the read can panic with slice bounds out of range +func FuzzIssue57002(f *testing.F) { + // input from issue + f.Add([]byte{0x4d, 0x5a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x45, 0x0, 0x0, 0x0, 0x0, 0x5, 0x0, 0x20, 0x20, 0x20, 0x20, 0x0, 0x0, 0x0, 0x0, 0x20, 0x3f, 0x0, 0x20, 0x0, 0x0, 0x20, 0x20, 0x20, 0x20, 0x20, 0xff, 0x20, 0x20, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb, 0x20, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x9, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x20, 0x20, 0x20, 0x20, 0x20, 0xef, 0x20, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf, 0x0, 0x2, 0x0, 0x20, 0x0, 0x0, 0x9, 0x0, 0x4, 0x0, 0x20, 0xf6, 0x0, 0xd3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20, 0x1, 0x0, 0x0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa, 0x20, 0xa, 0x20, 0x20, 0x20, 0xff, 0x20, 0x20, 0xff, 0x20, 0x47, 0x6f, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x69, 0x6e, 0x66, 0x3a, 0xde, 0xb5, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6, 0x7f, 0x7f, 0x7f, 0x20, 0xf4, 0xb2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0xb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20, 0x20, 0x0, 0x0, 0x0, 0x0, 0x5, 0x0, 0x20, 0x20, 0x20, 0x20, 0x0, 0x0, 0x0, 0x0, 0x20, 0x3f, 0x27, 0x20, 0x0, 0xd, 0x0, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0xff, 0x20, 0x20, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0, 0x20, 0x20, 0x0, 0x0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x5c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}) + f.Fuzz(func(t *testing.T, input []byte) { + buildinfo.Read(bytes.NewReader(input)) + }) +} + +// TestIssue54968 is a regression test for golang.org/issue/54968. +// +// The cause of issue 54968 is when the first buildInfoMagic is invalid, it +// enters an infinite loop. +func TestIssue54968(t *testing.T) { + t.Parallel() + + const ( + paddingSize = 200 + buildInfoAlign = 16 + ) + buildInfoMagic := []byte("\xff Go buildinf:") + + // Construct a valid PE header. + var buf bytes.Buffer + + buf.Write([]byte{'M', 'Z'}) + buf.Write(bytes.Repeat([]byte{0}, 0x3c-2)) + // At location 0x3c, the stub has the file offset to the PE signature. + binary.Write(&buf, binary.LittleEndian, int32(0x3c+4)) + + buf.Write([]byte{'P', 'E', 0, 0}) + + binary.Write(&buf, binary.LittleEndian, pe.FileHeader{NumberOfSections: 1}) + + sh := pe.SectionHeader32{ + Name: [8]uint8{'t', 0}, + SizeOfRawData: uint32(paddingSize + len(buildInfoMagic)), + PointerToRawData: uint32(buf.Len()), + } + sh.PointerToRawData = uint32(buf.Len() + binary.Size(sh)) + + binary.Write(&buf, binary.LittleEndian, sh) + + start := buf.Len() + buf.Write(bytes.Repeat([]byte{0}, paddingSize+len(buildInfoMagic))) + data := buf.Bytes() + + if _, err := pe.NewFile(bytes.NewReader(data)); err != nil { + t.Fatalf("need a valid PE header for the misaligned buildInfoMagic test: %s", err) + } + + // Place buildInfoMagic after the header. + for i := 1; i < paddingSize-len(buildInfoMagic); i++ { + // Test only misaligned buildInfoMagic. + if i%buildInfoAlign == 0 { + continue + } + + t.Run(fmt.Sprintf("start_at_%d", i), func(t *testing.T) { + d := data[:start] + // Construct intentionally-misaligned buildInfoMagic. + d = append(d, bytes.Repeat([]byte{0}, i)...) + d = append(d, buildInfoMagic...) + d = append(d, bytes.Repeat([]byte{0}, paddingSize-i)...) + + _, err := buildinfo.Read(bytes.NewReader(d)) + + wantErr := "not a Go executable" + if err == nil { + t.Errorf("got error nil; want error containing %q", wantErr) + } else if errMsg := err.Error(); !strings.Contains(errMsg, wantErr) { + t.Errorf("got error %q; want error containing %q", errMsg, wantErr) + } + }) + } +} + +func FuzzRead(f *testing.F) { + go117, err := obscuretestdata.ReadFile("testdata/go117/go117.base64") + if err != nil { + f.Errorf("Error reading go117: %v", err) + } + f.Add(go117) + + notgo, err := obscuretestdata.ReadFile("testdata/notgo/notgo.base64") + if err != nil { + f.Errorf("Error reading notgo: %v", err) + } + f.Add(notgo) + + f.Fuzz(func(t *testing.T, in []byte) { + buildinfo.Read(bytes.NewReader(in)) + }) +} diff --git a/go/src/debug/buildinfo/search_test.go b/go/src/debug/buildinfo/search_test.go new file mode 100644 index 0000000000000000000000000000000000000000..c598dcdf8d5dd546a471e2f238af0b0940e22b45 --- /dev/null +++ b/go/src/debug/buildinfo/search_test.go @@ -0,0 +1,146 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package buildinfo + +import ( + "bytes" + "fmt" + "io" + "testing" +) + +type byteExe struct { + b []byte +} + +func (x *byteExe) DataReader(addr uint64) (io.ReaderAt, error) { + if addr >= uint64(len(x.b)) { + return nil, fmt.Errorf("ReadData(%d) out of bounds of %d-byte slice", addr, len(x.b)) + } + return bytes.NewReader(x.b[addr:]), nil +} + +func (x *byteExe) DataStart() (uint64, uint64) { + return 0, uint64(len(x.b)) +} + +func TestSearchMagic(t *testing.T) { + tests := []struct { + name string + data []byte + want uint64 + wantErr error + }{ + { + name: "beginning", + data: func() []byte { + b := make([]byte, buildInfoHeaderSize) + copy(b, buildInfoMagic) + return b + }(), + want: 0, + }, + { + name: "offset", + data: func() []byte { + b := make([]byte, 512) + copy(b[4*buildInfoAlign:], buildInfoMagic) + return b + }(), + want: 4 * buildInfoAlign, + }, + { + name: "second_chunk", + data: func() []byte { + b := make([]byte, 4*searchChunkSize) + copy(b[searchChunkSize+4*buildInfoAlign:], buildInfoMagic) + return b + }(), + want: searchChunkSize + 4*buildInfoAlign, + }, + { + name: "second_chunk_short", + data: func() []byte { + // Magic is 64-bytes into the second chunk, + // which is short; only exactly long enough to + // hold the header. + b := make([]byte, searchChunkSize+4*buildInfoAlign+buildInfoHeaderSize) + copy(b[searchChunkSize+4*buildInfoAlign:], buildInfoMagic) + return b + }(), + want: searchChunkSize + 4*buildInfoAlign, + }, + { + name: "missing", + data: func() []byte { + b := make([]byte, buildInfoHeaderSize) + return b + }(), + wantErr: errNotGoExe, + }, + { + name: "too_short", + data: func() []byte { + // There needs to be space for the entire + // header, not just the magic. + b := make([]byte, len(buildInfoMagic)) + copy(b, buildInfoMagic) + return b + }(), + wantErr: errNotGoExe, + }, + { + name: "misaligned", + data: func() []byte { + b := make([]byte, 512) + copy(b[7:], buildInfoMagic) + return b + }(), + wantErr: errNotGoExe, + }, + { + name: "misaligned_across_chunk", + data: func() []byte { + // Magic crosses chunk boundary. By definition, + // it has to be misaligned. + b := make([]byte, 2*searchChunkSize) + copy(b[searchChunkSize-8:], buildInfoMagic) + return b + }(), + wantErr: errNotGoExe, + }, + { + name: "header_across_chunk", + data: func() []byte { + // The magic is aligned within the first chunk, + // but the rest of the 32-byte header crosses + // the chunk boundary. + b := make([]byte, 2*searchChunkSize) + copy(b[searchChunkSize-buildInfoAlign:], buildInfoMagic) + return b + }(), + want: searchChunkSize - buildInfoAlign, + }, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + x := &byteExe{tc.data} + dataAddr, dataSize := x.DataStart() + addr, err := searchMagic(x, dataAddr, dataSize) + if tc.wantErr == nil { + if err != nil { + t.Errorf("searchMagic got err %v want nil", err) + } + if addr != tc.want { + t.Errorf("searchMagic got addr %d want %d", addr, tc.want) + } + } else { + if err != tc.wantErr { + t.Errorf("searchMagic got err %v want %v", err, tc.wantErr) + } + } + }) + } +} diff --git a/go/src/debug/buildinfo/testdata/fuzz/FuzzRead/36aeb674e3454016 b/go/src/debug/buildinfo/testdata/fuzz/FuzzRead/36aeb674e3454016 new file mode 100644 index 0000000000000000000000000000000000000000..85d3bebd1f459c7fea7bfbaf8d50e6af0609461f --- /dev/null +++ b/go/src/debug/buildinfo/testdata/fuzz/FuzzRead/36aeb674e3454016 @@ -0,0 +1,2 @@ +go test fuzz v1 +[]byte("\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00>\x00\x01\x00\x00\x00@\x10\x00\x00\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00X6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00@\x008\x00\r\x00@\x00\x1e\x00\x1d\x00\x06\x00\x00\x00\x04\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\xd8\x02\x00\x00\x00\x00\x00\x00\xd8\x02\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x04\x00\x00\x00\x18\x03\x00\x00\x00\x00\x00\x00\x18\x03\x00\x00\x00\x00\x00\x00\x18\x03\x00\x00\x00\x00\x00\x00\x1c\x00\x00\x00\x00\x00\x00\x00\x1c\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe0\x05\x00\x00\x00\x00\x00\x00\xe0\x05\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x05\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00=\x01\x00\x00\x00\x00\x00\x00=\x01\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x04\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\xdc\x00\x00\x00\x00\x00\x00\x00\xdc\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x06\x00\x00\x00\x00.\x00\x00\x00\x00\x00\x00\x00>\x00\x00\x00\x00\x00\x00\x00>\x00\x00\x00\x00\x00\x00\x10\x02\x00\x00\x00\x00\x00\x00~~~~~~~\x00\x00\x10\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x06\x00\x00\x00\x10.\x00\x00\x00\x00\x00\x00\x10>\x00\x00\x00\x00\x00\x00\x10>\x00\x00\x00\x00\x00\x00\xb0\x01\x00\x00\x00\x00\x00\x00\xb0\x01\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x04\x00\x00\x008\x03\x00\x00\x00\x00\x00\x008\x03\x00\x00\x00\x00\x00\x008\x03\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x04\x00\x00\x00X\x03\x00\x00\x00\x00\x00\x00X\x03\x00\x00\x00\x00\x00\x00X\x03\x00\x00\x00\x00\x00\x00D\x00\x00\x00\x00\x00\x00\x00D\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00S\xe5td\x04\x00\x00\x008\x03\x00\x00\x00\x00\x00\x008\x03\x00\x00\x00\x00\x00\x008\x03\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00P\xe5td\x04\x00\x00\x00\x04 \x00\x00\x00\x00\x00\x00\x04 \x00\x00\x00\x00\x00\x00\x04 \x00\x00\x00\x00\x00\x00,\x00\x00\x00\x00\x00\x00\x00,\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00Q\xe5td\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00R\xe5td\x04\x00\x00\x00\x00.\x00\x00\x00\x00\x00\x00\x00>\x00\x00\x00\x00\x00\x00\x00>\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00/lib64/ld-linux-x86-64.so.2\x00\x00\x00\x00\x00\x04\x00\x00\x00\x10\x00\x00\x00\x05\x00\x00\x00GNU\x00\x02\x80\x00\xc0\x04\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x14\x00\x00\x00\x03\x00\x00\x00GNU\x00ɳ>\vWT\xe4N\x97\x1e\x8f\xe4\x13\xe2\xa8\xd5\xe8Fm\xcd\x04\x00\x00\x00\x10\x00\x00\x00\x01\x00\x00\x00GNU\x00\x00\x00\x00\x00\x03\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x05\x00\x00\x00\x01\x00\x00\x00\x06\x00\x00\x00\x00\x00\x81\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\xd1e\xcem\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00C\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00_\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00n\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00__cxa_finalize\x00__libc_start_main\x00libc.so.6\x00GLIBC_2.2.5\x00GLIBC_2.34\x00_ITM_deregisterTMCloneTable\x00__gmon_start__\x00_ITM_registerTMCloneTable\x00\x00\x00\x02\x00\x01\x00\x01\x00\x01\x00\x03\x00\x00\x00\x00\x00\x01\x00\x02\x00\"\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00u\x1ai\t\x00\x00\x03\x00,\x00\x00\x00\x10\x00\x00\x00\xb4\x91\x96\x06\x00\x00\x02\x008\x00\x00\x00\x00\x00\x00\x00\x00>\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00 \x11\x00\x00\x00\x00\x00\x00\b>\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\xe0\x10\x00\x00\x00\x00\x00\x00\b@\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\b@\x00\x00\x00\x00\x00\x00\xc0?\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc8?\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd0?\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd8?\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe0?\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00$\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00H\x83\xec\bH\x8b\x05\xc5/\x00\x00H\x85\xc0t\x02\xff\xd0H\x83\xc4\b\xc3\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff5\xca/\x00\x00\xff%\xcc/\x00\x00\x0f\x1f@\x00\xff%\xaa/\x00\x00f\x90\x00\x00\x00\x00\x00\x00\x00\x001\xedI\x89\xd1^H\x89\xe2H\x83\xe4\xf0PTE1\xc01\xc9H\x8d=\xce\x00\x00\x00\xff\x15_/\x00\x00\xf4f.\x0f\x1f\x84\x00\x00\x00\x00\x00\x0f\x1f@\x00H\x8d=\x99/\x00\x00H\x8d\x05\x92/\x00\x00H9\xf8t\x15H\x8b\x05>/\x00\x00H\x85\xc0t\t\xff\xe0\x0f\x1f\x80\x00\x00\x00\x00\xc3\x0f\x1f\x80\x00\x00\x00\x00H\x8d=i/\x00\x00H\x8d5b/\x00\x00H)\xfeH\x89\xf0H\xc1\xee?H\xc1\xf8\x03H\x01\xc6H\xd1\xfet\x14H\x8b\x05\r/\x00\x00H\x85\xc0t\b\xff\xe0f\x0f\x1fD\x00\x00\xc3\x0f\x1f\x80\x00\x00\x00\x00\xf3\x0f\x1e\xfa\x80=%/\x00\x00\x00u+UH\x83=\xea.\x00\x00\x00H\x89\xe5t\fH\x8b=\x06/\x00\x00\xe8)\xff\xff\xff\xe8d\xff\xff\xff\xc6\x05\xfd.\x00\x00\x01]\xc3\x0f\x1f\x00\xc3\x0f\x1f\x80\x00\x00\x00\x00\xf3\x0f\x1e\xfa\xe9w\xff\xff\xffUH\x89\xe5\xb8\x00\x00\x00\x00]\xc3H\x83\xec\bH\x83\xc4\b\xc3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x02\x00\x01\x1b\x03;(\x00\x00\x00\x04\x00\x00\x00\x1c\xf0\xff\xfft\x00\x00\x00,\xf0\xff\xff\x9c\x00\x00\x00<\xf0\xff\xffD\x00\x00\x00%\xf1\xff\xff\xb4\x00\x00\x00\x14\x00\x00\x00\x00\x00\x00\x00\x01zR\x00\x01x\x10\x01\x1b\f\a\b\x90\x01\a\x10\x14\x00\x00\x00\x1c\x00\x00\x00\xf0\xef\xff\xff\"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x14\x00\x00\x00\x00\x00\x00\x00\x01zR\x00\x01x\x10\x01\x1b\f\a\b\x90\x01\x00\x00$\x00\x00\x00\x1c\x00\x00\x00\xa0\xef\xff\xff\x10\x00\x00\x00\x00\x0e\x10F\x0e\x18J\x0f\vw\b\x80\x00?\x1a;*3$\"\x00\x00\x00\x00\x14\x00\x00\x00D\x00\x00\x00\x88\xef\xff\xff\b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c\x00\x00\x00\\\x00\x00\x00i\xf0\xff\xff\v\x00\x00\x00\x00A\x0e\x10\x86\x02C\r\x06F\f\a\b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x11\x00\x00\x00\x00\x00\x00\xe0\x10\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\"\x00\x00\x00\x00\x00\x00\x00\f\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\r\x00\x00\x00\x00\x00\x00\x004\x11\x00\x00\x00\x00\x00\x00\x19\x00\x00\x00\x00\x00\x00\x00\x00>\x00\x00\x00\x00\x00\x00\x1b\x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x00\x00\b>\x00\x00\x00\x00\x00\x00\x1c\x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\xf5\xfe\xffo\x00\x00\x00\x00\xa0\x03\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00X\x04\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\xc8\x03\x00\x00\x00\x00\x00\x00\n\x00\x00\x00\x00\x00\x00\x00\x88\x00\x00\x00\x00\x00\x00\x00\v\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x00\x00\x00\x00\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\xe8?\x00\x00\x00\x00\x00\x00\a\x00\x00\x00\x00\x00\x00\x00 \x05\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00\x00\t\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x00\x00\x00\x00\xfb\xff\xffo\x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\xfe\xff\xffo\x00\x00\x00\x00\xf0\x04\x00\x00\x00\x00\x00\x00\xff\xff\xffo\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\xf0\xff\xffo\x00\x00\x00\x00\xe0\x04\x00\x00\x00\x00\x00\x00\xf9\xff\xffo\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\b@\x00\x00\x00\x00\x00\x00GCC: (Debian 13.2.0-13) 13.2.0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x04\x00\xf1\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\x00\x00\x00\x01\x00\x04\x00|\x03\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x13\x00\x00\x00\x04\x00\xf1\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1e\x00\x00\x00\x02\x00\x0e\x00p\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x02\x00\x0e\x00\xa0\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x003\x00\x00\x00\x02\x00\x0e\x00\xe0\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00I\x00\x00\x00\x01\x00\x19\x00\x10@\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00U\x00\x00\x00\x01\x00\x14\x00\b>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|\x00\x00\x00\x02\x00\x0e\x00 \x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x88\x00\x00\x00\x01\x00\x13\x00\x00>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa7\x00\x00\x00\x04\x00\xf1\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x13\x00\x00\x00\x04\x00\xf1\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xae\x00\x00\x00\x01\x00\x12\x00\xd8 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\xf1\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xbc\x00\x00\x00\x01\x00\x15\x00\x10>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc5\x00\x00\x00\x00\x00\x11\x00\x04 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd8\x00\x00\x00\x01\x00\x17\x00\xe8?\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xee\x00\x00\x00\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\v\x01\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x006\x01\x00\x00 \x00\x18\x00\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'\x01\x00\x00\x10\x00\x18\x00\x10@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00.\x01\x00\x00\x12\x02\x0f\x004\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x004\x01\x00\x00\x10\x00\x18\x00\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00A\x01\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00P\x01\x00\x00\x11\x02\x18\x00\b@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00]\x01\x00\x00\x11\x00\x10\x00\x00 \x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00l\x01\x00\x00\x10\x00\x19\x00\x18@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00:\x01\x00\x00\x12\x00\x0e\x00@\x10\x00\x00\x00\x00\x00\x00\"\x00\x00\x00\x00\x00\x00\x00q\x01\x00\x00\x10\x00\x19\x00\x10@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}\x01\x00\x00\x12\x00\x0e\x00)\x11\x00\x00\x00\x00\x00\x00\v\x00\x00\x00\x00\x00\x00\x00\x82\x01\x00\x00\x11\x02\x18\x00\x10@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8e\x01\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa8\x01\x00\x00\"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc3\x01\x00\x00\x12\x02\v\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Scrt1.o\x00__abi_tag\x00crtstuff.c\x00deregister_tm_clones\x00__do_global_dtors_aux\x00completed.0\x00__do_global_dtors_aux_fini_array_entry\x00frame_dummy\x00__frame_dummy_init_array_entry\x00main.c\x00__FRAME_END__\x00_DYNAMIC\x00__GNU_EH_FRAME_HDR\x00_GLOBAL_OFFSET_TABLE_\x00__libc_start_main@GLIBC_2.34\x00_ITM_deregisterTMCloneTable\x00_edata\x00_fini\x00__data_start\x00__gmon_start__\x00__dso_handle\x00_IO_stdin_used\x00_end\x00__bss_start\x00main\x00__TMC_END__\x00_ITM_registerTMCloneTable\x00__cxa_finalize@GLIBC_2.2.5\x00_init\x00\x00.symtab\x00.strtab\x00.shstrtab\x00.interp\x00.note.gnu.property\x00.note.gnu.build-id\x00.note.ABI-tag\x00.gnu.hash\x00.dynsym\x00.dynstr\x00.gnu.version\x00.gnu.version_r\x00.rela.dyn\x00.init\x00.plt.got\x00.text\x00.fini\x00.rodata\x00.eh_frame_hdr\x00.eh_frame\x00.init_array\x00.fini_array\x00.dynamic\x00.got.plt\x00.data\x00.bss\x00.comment\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1b\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x18\x03\x00\x00\x00\x00\x00\x00\x18\x03\x00\x00\x00\x00\x00\x00\x1c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00#\x00\x00\x00\a\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x008\x03\x00\x00\x00\x00\x00\x008\x03\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x006\x00\x00\x00\a\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00X\x03\x00\x00\x00\x00\x00\x00X\x03\x00\x00\x00\x00\x00\x00$\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00I\x00\x00\x00\a\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00|\x03\x00\x00\x00\x00\x00\x00|\x03\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00W\x00\x00\x00\xf6\xff\xffo\x02\x00\x00\x00\x00\x00\x00\x00\xa0\x03\x00\x00\x00\x00\x00\x00\xa0\x03\x00\x00\x00\x00\x00\x00$\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00a\x00\x00\x00\v\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\xc8\x03\x00\x00\x00\x00\x00\x00\xc8\x03\x00\x00\x00\x00\x00\x00\x90\x00\x00\x00\x00\x00\x00\x00\a\x00\x00\x00\x01\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x00\x00\x00\x00i\x00\x00\x00\x03\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00X\x04\x00\x00\x00\x00\x00\x00X\x04\x00\x00\x00\x00\x00\x00\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00q\x00\x00\x00\xff\xff\xffo\x02\x00\x00\x00\x00\x00\x00\x00\xe0\x04\x00\x00\x00\x00\x00\x00\xe0\x04\x00\x00\x00\x00\x00\x00\f\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00~\x00\x00\x00\xfe\xff\xffo\x02\x00\x00\x00\x00\x00\x00\x00\xf0\x04\x00\x00\x00\x00\x00\x00\xf0\x04\x00\x00\x00\x00\x00\x000\x00\x00\x00\x00\x00\x00\x00\a\x00\x00\x00\x01\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8d\x00\x00\x00\x04\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00 \x05\x00\x00\x00\x00\x00\x00 \x05\x00\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x00\x00\x00\x00\x97\x00\x00\x00\x01\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf7\x00\x00\x00\x01\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00 \x10\x00\x00\x00\x00\x00\x00 \x10\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x9d\x00\x00\x00\x01\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x000\x10\x00\x00\x00\x00\x00\x000\x10\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\xa6\x00\x00\x00\x01\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00@\x10\x00\x00\x00\x00\x00\x00@\x10\x00\x00\x00\x00\x00\x00\xf4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xac\x00\x00\x00\x01\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x004\x11\x00\x00\x00\x00\x00\x004\x11\x00\x00\x00\x00\x00\x00\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb2\x00\x00\x00\x01\x00\x00\x00\x12\x00\x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\xba\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x04 \x00\x00\x00\x00\x00\x00\x04 \x00\x00\x00\x00\x00\x00,\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc8\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x000 \x00\x00\x00\x00\x00\x000 \x00\x00\x00\x00\x00\x00\xac\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd2\x00\x00\x00\x0e\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00>\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\xde\x00\x00\x00\x0f\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\b>\x00\x00\x00\x00\x00\x00\b.\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\xea\x00\x00\x00\x06\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x10>\x00\x00\x00\x00\x00\x00\x10.\x00\x00\x00\x00\x00\x00\xb0\x01\x00\x00\x00\x00\x00\x00\a\x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\xa1\x00\x00\x00\x01\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\xc0?\x00\x00\x00\x00\x00\x00\xc0/\x00\x00\x00\x00\x00\x00(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\xf3\x00\x00\x00\x01\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\xe8?\x00\x00\x00\x00\x00\x00\xe8/\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\xfc\x00\x00\x00\x01\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x000\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x01\x00\x00\b\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x10@\x00\x00\x00\x00\x00\x00\x100\x00\x00\x00\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\a\x01\x00\x00\x01\x00\x00\x000\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x100\x00\x00\x00\x00\x00\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0000\x00\x00\x00\x00\x00\x00H\x03\x00\x00\x00\x00\x00\x00\x1c\x00\x00\x00\x12\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x00\x00\x00\x00\t\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00x3\x00\x00\x00\x00\x00\x00\xc9\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00A5\x00\x00\x00\x00\x00\x00\x10\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00") diff --git a/go/src/debug/buildinfo/testdata/go117/README.md b/go/src/debug/buildinfo/testdata/go117/README.md new file mode 100644 index 0000000000000000000000000000000000000000..a36c1f4fcf42c030880ff6c8542422bbf37e835e --- /dev/null +++ b/go/src/debug/buildinfo/testdata/go117/README.md @@ -0,0 +1,15 @@ +go117.base64 is a base64-encoded Go 1.17 hello world binary used to test +debug/buildinfo of pre-1.18 buildinfo encoding. + +The binary is base64 encoded to hide it from security scanners that believe a +Go 1.17 is inherently insecure. + +Generate go117.base64 with: + +$ GOTOOLCHAIN=go1.17 GOOS=linux GOARCH=amd64 go build -trimpath +$ base64 go117 > go117.base64 +$ rm go117 + +TODO(prattmic): Ideally this would be built on the fly to better cover all +executable formats, but then we need a network connection to download an old Go +toolchain. diff --git a/go/src/debug/buildinfo/testdata/go117/go.mod b/go/src/debug/buildinfo/testdata/go117/go.mod new file mode 100644 index 0000000000000000000000000000000000000000..4497b1c655d036339ed8c4e4b648999250c1b7b1 --- /dev/null +++ b/go/src/debug/buildinfo/testdata/go117/go.mod @@ -0,0 +1,3 @@ +module example.com/go117 + +go 1.17 diff --git a/go/src/debug/buildinfo/testdata/go117/go117.base64 b/go/src/debug/buildinfo/testdata/go117/go117.base64 new file mode 100644 index 0000000000000000000000000000000000000000..f714ba6dd089d4398af4a23731fd0f56f79f5495 --- /dev/null +++ b/go/src/debug/buildinfo/testdata/go117/go117.base64 @@ -0,0 +1,20314 @@ +f0VMRgIBAQAAAAAAAAAAAAIAPgABAAAAADtFAAAAAABAAAAAAAAAAMgBAAAAAAAAAAAAAEAAOAAH +AEAAFwADAAYAAAAEAAAAQAAAAAAAAABAAEAAAAAAAEAAQAAAAAAAiAEAAAAAAACIAQAAAAAAAAAQ +AAAAAAAABAAAAAQAAACcDwAAAAAAAJwPQAAAAAAAnA9AAAAAAABkAAAAAAAAAGQAAAAAAAAABAAA +AAAAAAABAAAABQAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAJBTBQAAAAAAkFMFAAAAAAAAEAAA +AAAAAAEAAAAEAAAAAGAFAAAAAAAAYEUAAAAAAABgRQAAAAAACBYGAAAAA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S6GkBAEwrkrhpAQBMiZLoaQEATIuS0GkB +AE2JEUyJitBpAQBMiehMi4rAAQEATYXJD4QBAQAATIlMJFBJiwFFD7ZRCEmJw0gp2E2F0kwPRdhO +jRQbTTnTdg5JvP//////fwAAMcDrcEm8//////9/AABPjSwUScHtGkmB/QAAQAByBDHA61FMiVwk +OEyJVCRgTInYMcm/IgAAAL7/////RTHA6AOM//8PHwBIhdt0AjHASIuUJJgAAABIi1wkIEyLTCRQ +TItUJGBMi1wkOEm8//////9/AABJicVMOdh0RE2F7Q+ECf///0yJrCSAAAAATInoMcnosIEAAEiL +lCSYAAAASItcJCBMi0wkUEm8//////9/AABMi6wkgAAAAOnO/v//QQ+2cQhIhfZND0XTTYkRSInY +6xNJvP//////fwAASYnFSInYMduQSIXbD4WwAAAASInDuQAAAAQxwOgoAgAADx+EAAAAAABIhcAP +hCsBAABIiYQkgAAAAEiJXCRgSIuMJJgAAABIjYG4aQEASIlEJHDoEYUAAEiLjCSAAAAASIkIxkAI +AUiLDZuYDQBIiUgQSIkFkJgNAEiLRCRw6OaEAABMi6wkgAAAAEyJ6UiLXCRgSY1UHQBIiRBIixVn +mA0ASIlQEEiJBVyYDQBIi5QkmAAAAEm8//////9/AABJic1Mie5OjQQrTTnFdhlJuQAAAAAAgAAA +QbocAAAATI0dDKMFAOtaSbkAAAAAAIAAAE+NFClJweoaSYH6AABAAHIPQbohAAAATI0d36wFAOsw +T40UBEnB6hpJgfoAAEAAQboAAAAAQbsgAAAATQ9D00G7AAAAAEyNPU2qBQBND0PfTYXSdTwPHwBJ +98X///8DdR9IifBIidnpyPr//zHAMdtIi6wkiAAAAEiBxJAAAADDSI0FPK0FALshAAAA6OcYAgBM +iWwkQEyJRCRgTIlcJGhMiVQkSOguMQIASI0Ft60FALshAAAAZpDoOzoCAEiLRCRA6JE4AgBIjQXL +dQUAuwIAAAAPH0QAAOgbOgIASItEJGDocTgCAEiNBRynBQC7HwAAAA8fRAAA6Ps5AgBIi0QkaEiL +XCR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9E+UiJ+UjT7kgPvP5JD0T5SIn5SNPuSQHITI1mAUyF5nWj6V3///9I +Kc5I0eFIhfZ2vA8fAEg58XOZSYn7SNPvTAnfTI1fAUyF33Xb6Sn////MzMzMSTtmEHZ5SIPsIEiJ +bCQYSI1sJBhIg/sBdQiEAEjB6QbrJ0iD+0B3D+iTAAAASItsJBhIg8Qgw+iEAQAASItsJBhIg8Qg +w0j/wUiD+QhzGUiLFMhI99JIhdJ060gPvNJIweEGSAHR6wdIx8H/////SInISInDSItsJBhIg8Qg +w0iJRCQISIlcJBBIiUwkGOit3QIASItEJAhIi1wkEEiLTCQY6Vn////MzMzMzMzMzMzMzMzMzMzM +zMzMzMzMzMzMSMHpBkjHwv////8x9usESY1KAUiD+QgPg50AAACEAEiLPMhJifhI99dIhf91B0mJ +yjH269pIg/r/dRFMD7zPSYnKSMHhBkqNFAnrA0mJyk0PvMhBu0AAAABND0TLSQHxTDnLdkdIjXP/ +uQEAAADrXr5AAAAA6xRIifFIif5I0+9IIfdID7z3SQ9E80iD/kByV0kPvfBIx8f/////SA9E90iD +xsFI997pY////0nB4gZJKfJMidBIidPDSMfA/////0iJ08NIKc5I0eFMic9IhfZ2sEg58XOfSYn5 +SNPvSSH5TYXJdd/riEnB4gZKjQQWSInTw8zMzMzMzMzMzMzMzEjB6QYx0kjHxv////9Ix8f///// +6wpI/8EPH4AAAAAASIP5CA+D4wAAAIQATIsEyEmD+P91CjHS69xmDx9EAABIg/7/dSFNicFJ99BN +D7zAQbpAAAAATQ9EwkmJykjB4QZKjTQB6wZNicFJicpIhdJ1NEkPvclIx8L/////SA9EypBMidJJ +weIGSY08CkiNfwFIg8HBSPfZSYnISInRTInC6XD///9JD7zJQbhAAAAASQ9EyEyNBBFMOcN2SQ8f +AEiD+UBzMUkPvdFJx8D/////SQ9E0JBNidBJweIGSY08EkiNfwFIjUrBSPfZSInKTInB6R////9I +jUpASInKTInR6RD///9IifhIifPDSDnTdgtIx8D/////SInzw0iJ+EiJ88PMzM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gBFD1f/ZEyLNCX4////SItE +JAhI/8BIg/gFfSZIiUQkCMcFZMYIAP///3+4AQAAAEiNDVTGCACHAehNmQAAhMB1s8cEJOgDAABm +kOjbQwIARQ9X/2RMizQl+P///+gpmQAAxwQk6AMAAGaQ6LtDAgBFD1f/ZEyLNCX4////SItsJBBI +g8QYww8fQADoWykCAOk2////zMzMzMzMzMzMzMzMzMzMzMzMzMzMzEk7ZhAPhoIDAABIg+xASIls +JDhIjWwkOIlcJFCJTCRUSIlEJEiNk//v//+D+gN2DIH7CRAAAA+FrwEAAInaD7rzDDnZdSBIicOJ +0PAPsYuQAAAAQA+UxkCE9nQKSItsJDhIg8RAw+gV1///SI0FjVsDALsnAAAA6CTg//9Ii0QkSOia +3///SI0FGSEDALsJAAAA6Ang//+LRCRQicAPHwDoW97//0iNBfEgAwC7CQAAAOjq3///i0QkVInA +Dx9AAOg73v//6DbZ///oMdf//5BMiXQkKEiLRCRIi4iQAAAAiUwkHEiLkJgAAABIiVQkIOiL1v// +SI0FEi4DALsQAAAA6Jrf//9Ii0QkSOgQ3///SI0F4R0DALsHAAAADx9AAOh73///SItEJCDocd3/ +/0iNBa8xAwC7EwAAAA8fRAAA6Fvf//+LRCQcicDoUNz//+ir2P//6KbW//9Ii0QkKIuIkAAAAIlM +JBRIi5CYAAAASIlUJCDoBtb//0iNBV0tAwC7EAAAAOgV3///SItEJCjoi97//0iNBVwdAwC7BwAA +AOj63v//SItEJCDo8Nz//0iNBRsxAwC7EwAAAA8fQADo297//4tEJBSJwOjQ2///6CvY///oJtb/ +/0iNBZNmAwC7NAAAAOg1vf//6JDV//9IjQXZXgMAuysAAAAPH0AA6Jve//9Ii0QkSOgR3v//SI0F +kB8DALsJAAAADx9EAADoe97//4tEJFCJwOjQ3P//SI0FZh8DALsJAAAADx9AAOhb3v//i0QkVInA +6LDc///oq9f//+im1f//kEyJdCQwSItEJEiLiJAAAACJTCQYSIuQmAAAAEiJVCQgDx9EAADo+9T/ +/0iNBYIsAwC7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C//+LRCQUi0wkHCnI +6Ds///9IjQV0hQIAuwoAAADoKkL//0iLhCSQAAAAZpDoG0D//0iNBUyHAgC7CwAAAOgKQv//SItE +JFAPH0QAAOj7P///6FY7///oUTn//0iLTCRA6Ur+///owjj//2aQ6Ps6///oNjn//0iLRCRASIXA +dRvopzj//0iNBU19AgC7AQAAAOi2Qf//6BE5///ojDj//4tEJBSLTCQcKchmkOibPv//6PY4//9I +iwVnHQgASP/ISItMJEAPH4AAAAAASDnBD4Xa/f//6FI4//9IjQUcfQIAuwIAAADoYUH//5Douzj/ +/0iLTCRA6bT9//+EyXQMSIsN5hsIAOkhAgAASI0FkiUIAOg19/z/SIusJLAAAABIgcS4AAAAw0iJ +jCSYAAAASIlcJChIi4HoAAAASImEJJAAAABIY5HwAAAASIlUJHhIY7H0AAAASIl0JHBIi7n4AAAA +SIm8JKAAAABMi4EAAQAATIlEJGBMY4kIAQAATIlMJGhMY5EMAQAATIlUJEhED7aZFAEAAESIXCQT +RA+2oRUBAABEiGQkEg8fQADoezf//0iNBVB8AgC7AwAAAOiKQP//SIuEJJAAAABmkOh7Pv//SI0F +rHwCALsEAAAA6GpA//+LRCQYSGPADx8A6Fs+//9IjQXifQIAuwYAAADoSkD//0iLRCQwDx9EAADo +Oz7//0iNBR+FAgC7CwAAAOgqQP//SItEJHgPH0QAAOgbPv//SI0FwoMCALsKAAAA6ApA//9Ii0Qk +cA8fRAAA6Ps9//9IjQW4hgIAuwwAAADo6j///0iLhCSgAAAASItcJGDo2D///0iNBQZ+AgC7BwAA +AOjHP///SItEJGhmkOi7Pf//SI0F4n0CALsHAAAA6Ko///9Ii0QkSA8fRAAA6Js9//9IjQUQgwIA +uwoAAADoij///w+2RCQTDx9EAADoGzn//0iNBc9/AgC7CQAAAOhqP///D7ZEJBIPH0QAAOj7OP// +SI0Fyn8CALsJAAAA6Eo///9Ii0QkKA8fRAAA6Ds9///oljj//+iRNv//SIuEJJgAAABIi4hYAQAA +ZpBIhcl0YEiLgdAAA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ONzSZg843NtmDzjc5GYPONztZg843PZmDzjc//NED28A80QPb0gQ80QPb1Ag80QPb1gw80QP +b2QIwPNED29sCNDzRA9vdAjg80QPb3wI8GZED+/AZkQP78lmRA/v0mZED+/bZkQP7+RmRA/v7WZE +D+/2ZkQP7/9mRQ843MBmRQ843MlmRQ843NJmRQ843NtmRQ843ORmRQ843O1mRQ843PZmRQ843P9m +RQ843MBmRQ843MlmRQ843NJmRQ843NtmRQ843ORmRQ843O1mRQ843PZmRQ843P9mRQ843MBmRQ84 +3MlmRQ843NJmRQ843NtmRQ843ORmRQ843O1mRQ843PZmRQ843P9mRQ/vxGZFD+/NZkUP79ZmRQ/v +32ZFD+/CZkUP78tmRQ/vwWZFD+//ZkwPfsDDZg9v0WYPb9lmD2/hZg9v6WYPb/FmD2/5Zg/vDcSM +CQBmD+8VzIwJAGYP7x3UjAkAZg/vJdyMCQBmD+8t5IwJAGYP7zXsjAkAZg/vPfSMCQBmDzjcyWYP +ONzSZg843NtmDzjc5GYPONztZg843PZmDzjc//NED29ECIDzRA9vTAiQ80QPb1QIoPNED29cCLDz +RA9vZAjA80QPb2wI0PNED290CODzRA9vfAjwZkQP78BmRA/vyWZED+/SZkQP79tmRA/v5GZED+/t +ZkQP7/ZmRA/v/0j/yUjB6QdmRQ843MBmRQ843MlmRQ843NJmRQ843NtmRQ843ORmRQ843O1mRQ84 +3PZmRQ843P/zD28A8w9vSBDzD29QIPMPb1gwZkQPONzAZkQPONzJZkQPONzSZkQPONzb8w9vYEDz +D29oUPMPb3Bg8w9veHBmRA843ORmRA843O1mRA843PZmRA843P9IBYAAAABI/8kPhWr///9mRQ84 +3MBmRQ843MlmRQ843NJmRQ843NtmRQ843ORmRQ843O1mRQ843PZmRQ843P9mRQ843MBmRQ843Mlm +RQ843NJmRQ843NtmRQ843ORmRQ843O1mRQ843PZmRQ843P9mRQ843MBmRQ843MlmRQ843NJmRQ84 +3NtmRQ843ORmRQ843O1mRQ843PZmRQ843P9mRQ/vxGZFD+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D29mQPMPb25Q8w9vdmDzD29+cPNED29EHoDzRA9vTB6Q80QPb1QeoPNED29c +HrDzRA9vZB7A80QPb2we0PNED290HuDzRA9vfB7w8w9/B/MPf08Q8w9/VyDzD39fMPMPf2dA8w9/ +b1DzD393YPMPf39w80QPf0QfgPNED39MH5DzRA9/VB+g80QPf1wfsPNED39kH8DzRA9/bB/Q80QP +f3Qf4PNED398H/BmRQ/v/8NIgesAAQAA8w9vBvMPb04Q8w9vViDzD29eMPMPb2ZA8w9vblDzD292 +YPMPb35w80QPb4aAAAAA80QPb46QAAAA80QPb5agAAAA80QPb56wAAAA80QPb6bAAAAA80QPb67Q +AAAA80QPb7bgAAAA80QPb77wAAAA8w9/B/MPf08Q8w9/VyDzD39fMPMPf2dA8w9/b1DzD393YPMP +f39w80QPf4eAAAAA80QPf4+QAAAA80QPf5egAAAA80QPf5+wAAAA80QPf6fAAAAA80QPf6/QAAAA +80QPf7fgAAAA80QPf7/wAAAASIH7AAEAAEiNtgABAABIjb8AAQAAD40A////ZkUP7//pY/z//0iJ ++Ugp8Ug52Q+CrAEAAEiB+wAAEAAPg8MAAABIjQweSYn68w9vaYDzD29xkEjHwIAAAABIg+fgSIPH +IPMPb3mg80QPb0GwSYn7TSnT80QPb0nA80QPb1HQTCnb80QPb1ng80QPb2Hwxf5vJkwB3kgpw8X+ +bwbF/m9OIMX+b1ZAxf5vXmBIAcbF/X8Hxf1/TyDF/X9XQMX9f19gSAHHSCnDd89IAcNIAfvEwX5/ +IsX4d/MPf2uA8w9/c5DzD397oPNED39DsPNED39LwPNED39T0PNED39b4PNED39j8MNIjQwe8w9v +bB6A8w9vcZDzD295oPNED29BsPNED29JwPNED29R0PNED29Z4PNED29h8MX+byZJifhIg+fgSIPH +IEmJ+k0pwkwp00wB1kiNDB9IgeuAAAAADxiGwAEAAA8YhoACAADF/m8Gxf5vTiDF/m9WQMX+b15g +SIHGgAAAAMX95wfF/edPIMX951dAxf3nX2BIgceAAAAASIHrgAAAAHe1D674x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Lmd1aW50cHRyABEqcnVudGltZS5sb2Nr +UmFuawARKnJ1bnRpbWUubWFwZXh0cmEAESpydW50aW1lLm11aW50cHRyABEqcnVudGltZS5wY0hl +YWRlcgARKnJ1bnRpbWUucG9sbERlc2MAESpydW50aW1lLnB1aW50cHRyABEqcnVudGltZS5zdHJp +bmdlcgARKnJ1bnRpbWUudGV4dHNlY3QAEWFsbG9jQml0c0ZvckluZGV4ABIqWzhdKnJ1bnRpbWUu +X3R5cGUAEipbOF11bnNhZmUuUG9pbnRlcgASKls5XXVuc2FmZS5Qb2ludGVyABIqW10qcnVudGlt +ZS5fZGVmZXIAEipbXXJ1bnRpbWUuZnVuY3RhYgASKltdcnVudGltZS5pbWV0aG9kABIqW11ydW50 +aW1lLnR5cGVPZmYAEipydW50aW1lLl90eXBlUGFpcgASKnJ1bnRpbWUuYml0dmVjdG9yABIqcnVu +dGltZS5nY2xpbmtwdHIAEipydW50aW1lLm1TcGFuTGlzdAASKnJ1bnRpbWUubm90SW5IZWFwABIq +cnVudGltZS5wYWdlQ2FjaGUAEipydW50aW1lLnB0YWJFbnRyeQASKnJ1bnRpbWUuc3BhbkNsYXNz +ABMqWzhdcnVudGltZS50eXBlT2ZmABMqW11bXSpydW50aW1lLl90eXBlABMqW11ydW50aW1lLmd1 +aW50cHRyABMqW11ydW50aW1lLnRleHRzZWN0ABMqcnVudGltZS5jZ29DYWxsZXJzABMqcnVudGlt +ZS5tU3BhblN0YXRlABMqcnVudGltZS5tb2R1bGVkYXRhABMqcnVudGltZS5tb2R1bGVoYXNoABMq +cnVudGltZS5wbGFpbkVycm9yABMqcnVudGltZS5zeXNtb250aWNrABMqcnVudGltZS53YWl0UmVh +c29uABMqcnVudGltZS53b3JrYnVmaGRyABQqWzEyOF0qcnVudGltZS5tc3BhbgAUKlsxMjhdKnJ1 +bnRpbWUuc3Vkb2cAFCpbMTM2XSpydW50aW1lLm1zcGFuABQqWzMyXSpydW50aW1lLl9kZWZlcgAU +Kls4XVtdKnJ1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ICiRQAAAAAAGAYAAAAAAAAQ +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAACAAAAAAAAAC0EEGSAggIMwAA +AAAAAAAA+GdGAAAAAABYIAAAAAAAAAIAAQAAAAAAgIdFAAAAAAAAo0UAAAAAAECbRQAAAAAAAAAA +AAAAAAAAAAAAAAAAAAgAAAAAAAAACAAAAAAAAABycxZ1AggIMwAAAAAAAAAA+GdGAAAAAACsIAAA +AAAAAAIAAQAAAAAAAKNFAAAAAAAAo0UAAAAAAECbRQAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAA +AAAAEAAAAAAAAADnV6AYAggIFFBqRgAAAAAACGhGAAAAAADkEQAAAAAAAAAAAAAAAAAAsLBFAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAACoZcUaDwgI +DCBqRgAAAAAALF9HAAAAAABgGQAAIFQAABgGAAABAAAAEAAAAAAAAADqAAAA//////////////// +AAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAACM9DF4DwgIDCBqRgAAAAAALF9HAAAAAADu +FwAAoGQAABgGAAABAAAAEAAAAAAAAADqAAAA////////////////AAAAAAAAAAAAAAAAAAAAAAgA +AAAAAAAAAAAAAAAAAAB9mbImDwgIAiBqRgAAAAAALF9HAAAAAAABGAAA4FQAABgGAAABAAEAEAAA +AAAAAADYBAAAAD0AAOBABQAAhQAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAB86fQt +DwgIDCBqRgAAAAAALF9HAAAAAAAnGAAAIF8AABgGAAABAAAAEAAAAAAAAADqAAAA//////////// +////AAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAB0lLlbDwgIDCBqRgAAAAAALF9HAAAA +AABgGAAAoGAAABgGAAABAAAAEAAAAAAAAADqAAAA////////////////AAAAAAAAAAAAAAAAAAAA +AAgAAAAAAAA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AAAAAAAAAAAAAAAAAADFciHL +DwEBGQBqRgAAAAAALF9HAAAAAADbFwAAwCYAAAAAAAAAAAAAYLlFAAAAAAAAAAAAAAAAAAAAAAAA +AAAAGAYAAAAAAAAQAAAAAAAAABAAAAAAAAAACAAAAAAAAACZXwxMBwgIGNBqRgAAAAAA+GdGAAAA +AACwGwAAIF0AABgGAAACAAIAEAAAAAAAAACHAgAAAD0AAMA5BQBAVAAA1hAAAAA7AAD///////// +/wAAAAAAAAAAAAAAAAAAAACjW3qZDwEBGQBqRgAAAAAALF9HAAAAAACLHQAAACoAAAAAAAAAAAAA +ILpFAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAYAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACq +kUoUDwEBGQBqRgAAAAAALF9HAAAAAADIEAAAgCoAAAAAAAAAAAAAgLpFAAAAAAAAAAAAAAAAAAAA +AAAAAAAAGAYAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABfyuBODwEBGQBqRgAAAAAALF9H +AAAAAACIGQAAQFUAAAAAAAAAAAAA4LpFAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAYAAAAAAAAQAAAA +AAAAABAAAAAAAAAACAAAAAAAAAARn0T1BwgIGNBqRgAAAAAA+GdGAAAAAACAGgAAIGAAABgGAAAC +AAIAEAAAAAAAAACHAgAAAD0AACBDBQAgVQAA1hAAAAA7AAD//////////wEAAAAAAAAAAAAAAAAA +AABNnA0/DwEBCChqRgAAAAAALF9HAAAAAADEGQAAIGEAABgGAAACAAAAEAAAAAAAAAB4BQAA//// +////////////AQwAAP///////////////wgAAAAAAAAACAAAAAAAAAAL6ApDCQgINiBqRgAAAAAA ++GdGAAAAAACEGwAAAAAAAGC2RQAAAAAAghAAAAIAAgAQAAAAAAAAAIEAAAD///////////////+G +AAAA////////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAIAAAAAAAAAMPq +5NIJCAg2IGpGAAAAAAD4Z0YAAAAAAJgeAAAAAAAAYORFAAAAAAAYBgAAAgACABAAAAAAAAAAhwIA +AAA9AACAUAAAgFAAANYQAAAAOwAA//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAA +AAAAAAgAAAAAAAAA905zDQkICDYgakYAAAAAAPhnRgAAAAAAmhsAAAAAAADg6kUAAAAAABgGAAAC +AAIAEAAAAAAAAACHAgAAAD0AAGA9BQBgPQUA1hAAAAA7AAD//////////wAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAgAAAAAAAAACAAAAAAAAABEWsxwCQgINiBqRgAAAAAA+GdGAAAAAACwGwAAAAAA +AGC5RQAAAAAAGAYAAAIAAgAQAAAAAAAAAIcCAAAAPQAAwDkFAMA5BQDWEAAAADsAAP////////// +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAB14FgYJCAgWIGpGAAAAAAAs +X0cAAAAAANMVAAAAAAAAwJ5FAAAAAAAYBgAAAgAAABAAAAAAAAAAWAEAAP///////////////6MC +AAD///////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAAAAAAZ6c+ +mAkICDYgakYAAAAAAPhnRgAAAAAAkBQAAAAAAABA9kUAAAAAABgGAAACAAAAEAAAAAAAAAB4CQAA +////////////////rQcAAP///////////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAA +AAAACAAAAAAAAADKUlePCQgINiBqRgAAAAAA+GdGAAAAAAAQHQAAAAAAACDHRQAAAAAAGAYAAAIA +AAAQAAAAAAAAAL0AAAD////////////////+AAAA////////////////AAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAACAAAAAAAAAAIAAAAAAAAAId/OTYJCAg2IGpGAAAAAAD4Z0YAAAAAACcYAAAAAAAA +4LFFAAAAAAAYBgAAAgAAABAAAAAAAAAA6gAAAP////////////////4AAAD///////////////8A +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAAAAAAwkzTRQkICDYgakYAAAAAAPhn +RgAAAAAAuAwAAAAAAADABEYAAAAAABgGAAACAAAAEAAAAAAAAACfBgAAADsAAEBnAwBAZwMApgEA +AP////9gZQMAYGUDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAACAAAAAAAAAAD6Ri8 +CQgINiBqRgAAAAAA+GdGAAAAAACAGgAAAAAAAOC6RQAAAAAAGAYAAAIAAgAQAAAAAAAAAIcCAAAA +PQAAIEMFACBDBQDWEAAAADsAAP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAA +AAAIAAAAAAAAALkifswJCAg2IGpGAAAAAAD4Z0YAAAAAAGAYAAAAAAAAQLJFAAAAAAAYBgAAAgAA +ABAAAAAAAAAA6gAAAP////////////////4AAAD///////////////8AAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAIAAAAAAAAAAgAAAAAAAAA8+aSmgkICDYgakYAAAAAAPhnRgAAAAAAxBkAAAAAAABA +u0UAAAAAABgGAAACAAAAEAAAAAAAAAB4BQAA////////////////AQwAAP///////////////wAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAACAAAAAAAAAC24U5RCQgINiBqRgAAAAAA+GdG +AAAAAADGGwAAAAAAAKCyRQAAAAAAGAYAAAIAAAAQAAAAAAAAAOoAAAD////////////////+AAAA +////////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAADvaKNEJ +CAgWIGpGAAAAAAAsX0cAAAAAABAXAAAAAAAAYNRFAAAAAAAYBgAAAgAAABAAAAAAAAAADA0AAAA7 +AAD/////4MgBAE0SAAAAOwAA/////4DIAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAA +ABAAAAAAAAAAy14QDgcICBTgaUYAAAAAAAhoRgAAAAAAoAQAAIAiAAAAAAAAAAAAAADDRQAAAAAA +AQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAGAAAAAAAAACHAgAAAD0AAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAABAAAAAAAAAAEAAAAAAAAACn07N5BwgIFOBpRgAAAAAACGhGAAAAAABzGAAAwC4AABhm +RQAAAAAAgMNFAAAAAAABAAAAAAAAAAEAAAAAAAAAGAYAAAAAAAAYAAAAAAAAANgEAAAAPQAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAIAAAAAAAAAMIZzoQJCAg2IGpGAAAAAAD4Z0YA +AAAAAPMRAAAAAAAAoMVFAAAAAAAYBgAAAwAAABAAAAAAAAAAsgEAAP///////////////1oJAAD/ +//////////////8AEAAA////////////////AAAAAAAAAAAIAAAAAAAAAAgAAAAAAAAAaGvD6QkI +CDYgakYAAAAAAPhnRgAAAAAAtR4AAAAAAAAg5UUAAAAAABgGAAADAAMAEAAAAAAAAAAoAQAA//// +////////////hwIAAAA9AACgQgUAoEIFANYQAAAAOwAA//////////8AAAAAAAAAAAgAAAAAAAAA +CAAAAAAAAADSoiO/CQgINiBqRgAAAAAA+GdGAAAAAADuFwAAAAAAACCxRQAAAAAAGAYAAAMAAAAQ +AAAAAAAAAKQAAAD////////////////qAAAA/////////////////gAAAP///////////////wAA +AAAAAAAACAAAAAAAAAAIAAAAAAAAAHkRDF4JCAg2IGpGAAAAAAD4Z0YAAAAAAAAVAAAAAAAAwNNF +AAAAAAAYBgAAAwAAABAAAAAAAAAAlgYAAP///////////////wARAAD///////////////+6BgAA +////////////////AAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAxd59Sg8BARkgakYAAAAAACxfRwAA +AAAA8xEAAKBjAAAYZkUAAAAAAADGRQAAAAAAAQAAAAAAAAABAAAAAAAAABgGAAAAAAAAKAAAAAAA +AAD1Z0UAAAAAAGCqRQAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAADFfZuFDwgI +GSBqRgAAAAAALF9HAAAAAACkFgAAQCcAAB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AAAGAYAAAQAAAAQAAAAAAAAANsCAAD////////////////lAAAA////////////////HgIAAP// +/////////////24HAAD///////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAA +AAgAAAAAAAAAfLFRsgkICDYgakYAAAAAAPhnRgAAAAAAnBkAAAAAAABg20UAAAAAABgGAAAEAAAA +EAAAAAAAAACcAgAA/////yAmAgAgJgIA8AQAAP/////gJgIA4CYCANsCAAD///////////////8T +AwAA/////yAoAgAgKAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAIAAAAAAAAACAD +vLkJCAg2IGpGAAAAAAD4Z0YAAAAAABAVAAAAAAAAoN1FAAAAAAAYBgAABAAAABAAAAAAAAAAqAYA +AAA7AAD//////////9sCAAD///////////////+ABwAA////////////////mAMAAAA7AAAgXwIA +IF8CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAACAAAAAAAAAB3vU9zCQgINiBqRgAA +AAAA+GdGAAAAAADkHwAAAAAAACDIRQAAAAAAAAAAAAQAAAAQAAAAAAAAAMoLAAD///////////// +//+bBwAA////////////////lgkAAP///////////////+YPAAD///////////////8AAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAgNWcRA8ICBkIakYAAAAAABhoRgAAAAAA +OBkAAIAlAAAYZkUAAAAAAADMRQAAAAAAAgAAAAAAAAACAAAAAAAAABgGAAAAAAAAQAAAAAAAAABo +YEUAAAAAAGDhRQAAAAAAAAAAAAAAAABsYEUAAAAAAGDhRQAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAEAAAAAAAAAAQAAAAAAAAABWXefsHCAgZMGRFAAAAAAAIaEYAAAAAAEwZAADAUwAAGGZF +AAAAAACgzEUAAAAAAAIAAAAAAAAAAgAAAAAAAAAYBgAAAAAAAEAAAAAAAAAAFGBFAAAAAADAnUUA +AAAAAAAAAAAAAAAAamhFAAAAAADAkkUAAAAAABAAAA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P//////////wPgAADIJAAD//////////wCR +AABKFgAAADsAAP////8g/QAAyAUAAP//////////IPYAAAgOAAAAOwAA/////0D7AAAAAAAAAAAA +ABgAAAAAAAAAGAAAAAAAAABmTEkdAggIGQAAAAAAAAAAQGhGAAAAAABAQwAAAAAAABhmRQAAAAAA +kNZFAAAAAAADAAAAAAAAAAMAAAAAAAAA0GFFAAAAAACg0EUAAAAAAAAAAAAAAAAAVGJFAAAAAAAA +okUAAAAAABAAAAAAAAAALGBFAAAAAACAq0UAAAAAACAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAA +AAAAAAAAbE5LsgkICBYgakYAAAAAACxfRwAAAAAAdBkAAAAAAAAA0EUAAAAAABgGAAAGAAAAEAAA +AAAAAACmAQAAADsAAP//////////MAUAAP//////////4PIBAGwNAAD///////////////8CBwAA +////////////////0AUAAP//////////YPEBANoHAAD///////////////8AAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAoAAAAAAAAAAgAAAAAAAAANlLJmAcICBkAAAAAAAAAAPhnRgAAAAAANxwAAMAl +AAAYZkUAAAAAAADYRQAAAAAAAwAAAAAAAAADAAAAAAAAABgGAAAAAAAAWAAAAAAAAADgYEUAAAAA +AICaRQAAAAAAAAAAAAAAAACIYUUAAAAAAACeRQAAAAAAMAAAAAAAAACOYUUAAAAAAMCiRQAAAAAA +QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAd+dJ8A8ICBnQ +c0UAAAAAACxfRwAAAAAA0h4AAMAnAAAYZkUAAAAAAMDYRQAAAAAAAwAAAAAAAAADAAAAAAAAABgG +AAAAAAAAWAAAAAAAAAD0YUUAAAAAAGDPRQAAAAAAAAAAAAAAAAA0YEUAAAAAACCxRQAAAAAAIAAA +AAAAAAARYEUAAAAAAOCxRQAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAA +AAAAAEAAAAAAAAAApkDEhgcICBkAAA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fRQAAAAAA +BAAAAAAAAAAEAAAAAAAAAOxnRQAAAAAAYKpFAAAAAAAAAAAAAAAAALJhRQAAAAAAYK1FAAAAAAAQ +AAAAAAAAANRiRQAAAAAAIK5FAAAAAAAQAQAAAAAAAFppRQAAAAAAAKNFAAAAAAAQAQAAAAAAAAAA +AAAAAAAAAAAAAAAAAABwAAAAAAAAAHAAAAAAAAAAb7gvUQIICBkAAAAAAAAAAEpfRwAAAAAA2CAA +AAAAAAAAYEUAAAAAADDgRQAAAAAABAAAAAAAAAAEAAAAAAAAAOxnRQAAAAAAYKpFAAAAAAAAAAAA +AAAAALJhRQAAAAAAwK1FAAAAAAAQAAAAAAAAANRiRQAAAAAAQKxFAAAAAABQAAAAAAAAAFppRQAA +AAAAAKNFAAAAAADQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADwAAAAAAAAAPAAAAAAAAAAgOI9/AII +CBkAAAAAAAAAAGBfRwAAAAAACCAAAAAAAAAAYEUAAAAAAPDgRQAAAAAABAAAAAAAAAAEAAAAAAAA +AOxnRQAAAAAAYKpFAAAAAAAAAAAAAAAAALJhRQAAAAAAgK5FAAAAAAAQAAAAAAAAANRiRQAAAAAA +oKxFAAAAAABQAAAAAAAAAFppRQAAAAAAAKNFAAAAAADQAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAI +AAAAAAAAAAgAAAAAAAAABShogwkICDYgakYAAAAAAPhnRgAAAAAAYBQAAAAAAADA9EUAAAAAABgG +AAAHAAAAEAAAAAAAAADcAQAAAD0AAP//////////OAcAAP///////////////0oHAAAAPQAAIMUE +ACDFBADoBQAAAD0AAADEBAAAxAQA4wcAAP////9AywQAQMsEAP4HAAD///////////////8iCgAA +/////6DEBACgxAQAAAAAAAAAAAAIAAAAAAAAAAgAAAAAAAAAxmmpwwkICDYgakYAAAAAAPhnRgAA +AAAAAhIAAAAAAACA80UAAAAAABgGAAAHAAAAEAAAAAAAAAAwFQAAADsAAP//////////3gYAAP// +/////////////4kSAAAAOwAAQKUAAEClAACLDwAA/////8ClAADApQAAmA8AAP////////////// +/7YSAAD///////////////9+EQAA////////////////AAAAAAAAAAAIAAAAAAAAAAgAAAAAAAAA +xWetNQkICDYgakYAAAAAAPhnRgAAAAAAIBIAAAAAAADA60UAAAAAABgGAAAHAAAAEAAAAAAAAABw +AQAA////////////////+QYAAP///////////////3gNAAD////////////////cAQAAAD0AAP// +////////QQcAAAA9AAD///////////wNAAD///////////////8SAQAAAD0AAP//////////AAAA +AAAAAAAQAQAAAAAAAAgBAAAAAAAAoB+BkQcICBkIZEUAAAAAAGhfRwAAAAAAuhAAAIAkAAAAAAAA +AAAAAADkRQAAAAAABAAAAAAAAAAEAAAAAAAAAIIQAAAAAAAAcAAAAAAAAAAuYUUAAAAAAMCqRQAA +AAAAAAAAAAAAAADQZEUAAAAAAIClRQAAAAAAkAAAAAAAAAA6YUUAAAAAACCrRQAAAAAAgAEAAAAA +AAAWb0UAAAAAAGC2RQAAAAAAEAIAAAAAAAAoAAAAAAAAACAAAAAAAAAAlRTzBAcICBkYZEUAAAAA +AC1fRwAAAAAAmB4AACBcAAAYZkUAAAAAAMDkRQAAAAAABAAAAAAAAAAEAAAAAAAAABgGAAAAAAAA +cAAAAAAAAADQbEUAAAAAAGDhRQAAAAAAAAAAAAAAAAB+aEUAAAAAAGDhRQAAAAAAEAAAAAAAAABW +aEUAAAAAAGDhRQAAAAAAIAAAAAAAAACYckUAAAAAAEChRQAAAAAAMAAAAAAAAAAYAAAAAAAAAAgA +AAAAAAAAOMknogcICBlAZEUAAAAAAPhnRgAAAAAAtR4AACBkAAAYZkUAAAAAAIDlRQAAAAAAAgAA +AAAAAAACAAAAAAAAABgGAAADAAMAQAAAAAAAAADRYEUAAAAAAEChRQAAAAAAAAAAAAAAAABAYUUA +AAAAAMCiRQAAAAAAIAAAAAAAAAAoAQAA////////////////hwIAAAA9AACgQgUAoFQAANYQAAAA +OwAA//////////8oAAAAAAAAAAAAAAAAAAAAPIegfg8ICBngc0UAAAAAACxf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ACZGAAA////////////////UgEAAP///////////////xgNAAD///////////////80FwAA//// +////////////Sg8AAAA7AAD/////oK4BACgFAAD///////////////+mAQAA//////////////// +OAUAAP///////////////0gFAAD///////////////85FgAA////////////////WBcAAP////// +/////////6cSAAD//////////8DJAABQCQAA////////////////ahcAAP//////////oMkAAOMS +AAAAOwAA/////wC+AQAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAB37NeaDwgIGRB0RQAAAAAA5BRG +AAAAAAACEgAAIIIAABhmRQAAAAAA4PNFAAAAAAAJAAAAAAAAAAkAAAAAAAAAGAYAAAAAAADoAAAA +AAAAALhiRQAAAAAAQJ1FAAAAAAAAAAAAAAAAAAxjRQAAAAAAgKJFAAAAAAAQAAAAAAAAAAJgRQAA +AAAAgKJFAAAAAAASAAAAAAAAAGdrRQAAAAAAwKFFAAAAAAAUAAAAAAAAAC9jRQAAAAAAAKJFAAAA +AAAYAAAAAAAAAHtmRQAAAAAAAKNFAAAAAAAgAAAAAAAAALRtRQAAAAAAAKNFAAAAAAAwAAAAAAAA +AEZrRQAAAAAAwKJFAAAAAABAAAAAAAAAAP5iRQAAAAAAAItFAAAAAABQAAAAAAAAAAAAAAAAAAAA +MAAAAAAAAAAoAAAAAAAAAELBTqEHCAgZAAAAAAAAAAAxX0cAAAAAAGAUAABggQAAGGZFAAAAAAAg +9UUAAAAAAAsAAAAAAAAACwAAAAAAAAAYBgAAAAAAABgBAAAAAAAAQmJFAAAAAADAokUAAAAAAAAA +AAAAAAAAZWdFAAAAAADAokUAAAAAABAAAAAAAAAAlGFFAAAAAAAAokUAAAAAACAAAAAAAAAAyWNF +AAAAAAAAoEUAAAAAACgAAAAAAAAAlWJFAAAAAACAokUAAAAAACoAAAAAAAAAMG1FAAAAAACAokUA +AAAAACwAAAAAAAAAuGFFAAAAAACAokUAAAAAAC4AAAAAAAAA6WJFAAAAAAAAsEUAAAAAADAAAAAA +AAAAGGVFAAAAAADAkkUAAAAAAEAAAAAAAAAADWFFAAAAAACAn0UA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AAYAAAACAAAABQAAAAABAAACAAAABAAAAAAI +AAACAAAABAAAAAABAAACAAAAAgAAAAMAAAACAAAAAgAAAAADAAACAAAABAAAAAsAAAADAAAABQAA +ABwUAAADAAAAAwAAAAABAgADAAAAAgAAAAMAAAADAAAAAwAAAAUBAAADAAAAAgAAAAABAgADAAAA +AQAAAAEAAQADAAAABAAAAAAJCAADAAAAAwAAAAcFAAADAAAAAQAAAAEAAAADAAAAAgAAAAMBAAAD +AAAABQAAAAADAAADAAAABgAAAAABAAADAAAABwAAAAAKAAADAAAABAAAAAkBAAADAAAABQAAABgQ +AAADAAAABAAAAAANAgADAAAAAwAAAAABAAADAAAACAAAAAADAQADAAAABAAAAAsKAAADAAAAAgAA +AAMAAwADAAAAAwAAAAcGAAADAAAAAgAAAAMDAAADAAAAAgAAAAADAgADAAAAAQAAAAABAAADAAAA +AwAAAAUAAAADAAAABAAAAAAPAAADAAAAAgAAAAADAQADAAAAAwAAAAAABwADAAAABAAAAAkAAAAD +AAAABAAAAAgAAAADAAAABAAAAAADAQADAAAABAAAAAAODwADAAAAAwAAAAABBwADAAAAAQAAAAAA +AQADAAAAAgAAAAACAQADAAAABwAAAEtBAAADAAAAAgAAAAIAAgADAAAACAAAAIUAAAADAAAAAwAA +AAAHAwADAAAAAgAAAAIAAAADAAAAAgAAAAABAwADAAAAAQAAAAEBAAADAAAAAgAAAAADAAADAAAA +AwAAAAcAAAADAAAABQAAABAAAAADAAAAAwAAAAAAAgADAAAAAwAAAAAGAAADAAAAAwAAAAcDAAAD +AAAABQAAAAAYAAADAAAAAgAAAAMCAAADAAAAAwAAAAAHBAD+/gAI/f4ICP39/wAACAgIEAgYARkB +/wD+AAgICBABEQH9/wD+AAgICBAI/RgI/wAACAgIEAgYCCAI/wD+/gAICAj9EAj9/wD+AAgICP0Q +CBgB/wD+AAgICP0QCBgI/wAACAgIEAERARgI/wD+AAgIBAwEEAj9/wAACAgIEAQYCCAI/wD+AAgI +CP0QBBgI/wAACAgBEAgYC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BAQEBAAAAAAAACwAAAAIAAAADAQEBAAAAAAABAAD+AAgICBAI/f4YCCAIKAj9MAj/AP//AAAB +AAAA+wAAAL0CAAAuAAAA//8AAAEAAAAMAQAAvQIAADIAAAD//wAAAQAAAD0BAADzAgAANAAAAP// +AAACAAAAFwAAABcDAAAOAAAA//8AAAgAAAAxAAAAIAQAAFQAAAD//wAACAAAAGMAAACPBAAAkAAA +AP//AAAPAAAAcwAAAL8HAAAdAAAA//8AABIAAAAtAAAAUQgAADUAAAD//wAAEgAAAM8AAADmBgAA +UwAAAP//AAAWAAAAEgAAAA4JAAA5AAAA//8AAB8AAACUAAAAMAMAALkAAAD//wAAJQAAAL0EAACJ +DgAAeAAAAP//AAAmAAAA8AAAAP8OAABZAAAA//8AACsAAACVAAAA0BMAAAAAAAD//wAAKwAAAAED +AAAlBQAA4gAAAP//AAAsAAAAXwAAANgOAACJAAAA//8AACwAAAAKAQAAvhYAAI0AAAD//wAAMwAA +ABIBAAC/BwAAHQAAAP//AAAzAAAA1QIAAPkaAABQAAAA//8AADMAAABeAwAARRsAAHAAAAD//wAA +MwAAAGcEAADsGwAAOAAAAP//AAA0AAAAiQAAAGcdAABSAAAA//8AADQAAADTAAAAZx0AACsAAAD/ +/wAANAAAAAUBAACPBAAATAAAAP//AAA0AAAAZAMAAFEIAAAYAAAA//8AADQAAAAIBAAAnyAAAEEB +AAD//wAANAAAAFsEAACfIAAAsQAAAP//AAA1AAAAUAEAADIeAABSAQAA//8AADUAAABMAwAAKiQA +AFYAAAD//wAANwAAACoBAADWHwAAFwEAAP//AAA6AAAAmQMAADgOAAChAAAA//8AADoAAACOAwAA +2yMAAEIAAAD//wAAOgAAANQDAADOBAAARwAAAP//AAA6AAAALQQAAAgVAAAaAAAA//8AADsAAAAm +AgAAzgQAABoAAAD//wAAPQAAADsAAADLMwAAGAAAAP//AAA+AAAAIgAAAHY0AACQAAAA//8AAD4A +AABGAAAAljIAAJYAAAD//wAAPgAAAOUAAABANQAAZgAAAP//AAA+AAAAogEAAL81AAAjAAAA//8A +AD4AAACqAQAA/zUAABkAAAD//wAAPwAAAL8AAACPBAAAGwAAAP//AAA/AAAAyAAAAI8EAAAmAAAA +//8AAD8AAAA5AQAA2DYAAFcAAAD//wAAPwAAAHgDAACcNwAAIAAAAP//AAA/AAAAjAMAAJw3AAAg +AAAA//8AAEMAAABZAQAA0DkAADkAAAD//wAASAAAAFYAAAA0PAAAQgAAAP//AABJAAAAMQAAAGU8 +AABTAAAA//8AAE4AAAAiAAAACT4AACIAAAD//wAATgAAABYEAAAnQQAAVwIAAP//AABOAAAAEgUA +APNBAACCAAAA//8AAE4AAADWBQAAUQgAABYAAAD//wAAUgAAAPcAAAA/RAAAGQAAAP//AABSAAAA +/QAAAAFEAACKAAAA//8AAFIAAAAnAQAAUQgAAEgBAAD//wAAUwAAAPQBAAA0PAAADgAAAP//AABT +AAAA/QEAADQ8AAAOAAAA//8AAFMAAAD2AgAA6jwAABgAAAD//wAAUwAAANwHAAC5SAAANgAAAP// +AABTAAAAgAoAALBKAADsAAAA//8AAFMAAADlDQAAMk0AACYAAAD//wAAUwAAACsOAAB/TQAAHQAA +AP//AABTAAAA5A4AANNHAAChAQAA//8AAFMAAABBDwAAl04AAB0AAAD//wAAUwAAAH4QAABwTwAA +MAAAAP//AABTAAAAOREAAHg3AAATAQAA//8AAFMAAAAdEgAAd1AAAFIAAAD//wAAUwAAAM4SAAAO +CAAANQAAAP//AABTAAAAPBQAAAgVAAA2AAAA//8AAFMAAACEFAAAZx0AADEAAAD//wAAUwAAANwV +AACjQgAAWwAAAP//AABTAAAAYBYAAH4IAAAgAAAA//8AAFMAAAC4FwAAglMAACkAAAD//wAAUwAA +ABMYAACCUwAAwwAAAP//AABUAAAAnAEAAExVAAA2AAAA//8AAFoAAACFAQAAKiQAAJECAAD//wAA +WwAAAJ4DAAC/BwAAHQAAAP//AABcAAAAJgAAALUNAAAYAAAA//8AAF4AAAAsAQAA/w4AANACAAD/ +/wAAYQAAALADAAA0P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+AADrBAAAxg0AAEsAAAD//wAAJQAAAO8EAADYDgAASQAAAP//AAAmAAAABwQAAGgQAAAYAAAAAAAA +ACYAAAAvBAAAfxAAACIAAAD//wAAKwAAAGEBAAAaFAAAaQAAAP//AAArAAAAZwEAADgOAACVAAAA +//8AACsAAAAPBgAAaAUAAPMAAAD//wAAKwAAAA4GAABoBQAA6wAAAP//AAAsAAAAsgAAAL4WAADn +AAAA//8AACwAAADGAAAA2hYAAJ0BAAD//wAALQAAAOMAAACgFwAAbgAAAP//AAAtAAAA5wAAAA4X +AACIAAAA//8AAC4AAABAAAAA9hgAABQAAAAAAAAAMwAAAD4FAAASGQAAIwAAAP//AAAuAAAASgAA +AEAZAAAdAAAA//8AAC4AAABZAAAAzgQAADIAAAD//wAALwAAAEkAAAB9GQAARwAAAP//AAAvAAAA +TQAAAH0ZAABXAAAA//8AAC8AAACGAAAAMw0AACUAAAD//wAALwAAAIgAAAB9GQAAJgAAAP//AAAz +AAAAeAUAAEUbAABIAQAA//8AADMAAAClBQAA2hYAAMkBAAD//wAAMwAAAFIGAACLGwAAnAAAAP// +AAAzAAAARQYAAIsbAAAfAAAA//8AADUAAAC6AQAAIQ8AANMAAAD//wAANQAAALsBAAAhDwAA4wAA +AP//AAA1AAAA2gEAAMgiAADYAAAA//8AADUAAADcAQAAvwcAADUBAAD//wAANQAAACQCAAAkIwAA +gQAAAAAAAABqAAAAjgAAAP8OAADHAAAA//8AADUAAADDAgAA2yMAAC4BAAD//wAANQAAAOoCAADb +IwAAyAEAAP//AAA2AAAAlAAAAFEkAADNAAAAAAAAADYAAABnAAAAZiQAANUAAAD//wAANgAAAMwB +AABAJQAAXgAAAP//AAA2AAAA4gEAADMNAACTAAAA//8AADgAAACQAAAAwRcAAGMAAAD//wAAOAAA +AJEAAABvGAAAhQAAAP//AAA5AAAApQEAAGgjAAAUAAAAAAAAACAAAAAvAAAAOwwAADAAAAD//wAA +OgAAALwDAADOBAAAGQAAAP//AAA6AAAAwQMAAM4EAABxAAAA//8AADwAAABOAAAAMw0AAIUAAAD/ +/wAAPAAAAE8AAABcDQAAswAAAP//AAA+AAAAGwEAAMszAAB1AAAA//8AAD4AAAAfAQAA5ycAAKcA +AAD//wAAPgAAADwBAADnJwAAgQAAAP//AAA+AAAARgEAAOcnAADVAAAA//8AAD8AAACTAQAATDcA +ACIAAAAAAAAAPwAAAJsBAAD/DgAAKwAAAP//AABAAAAASwAAABAyAAAUAAAA//8AAEAAAABOAAAA +EDIAADEAAAD//wAAQwAAABsBAABoIwAAFAAAAAAAAAAgAAAALwAAADsMAAAwAAAA//8AAEQAAAAj +AwAA6gUAAEcAAAAAAAAAIgAAADAAAAD3BQAAUAAAAP//AABEAAAAOgMAACUGAAA/AAAAAAAAACIA +AABwAAAANAYAAEcAAAD//wAARQAAAMEAAAB/OwAANwAAAP//AABFAAAAtwAAAH87AACDAAAA//8A +AEkAAADIAAAACT0AACwAAAD//wAASQAAANAAAACPBAAAPgAAAP//AABOAAAAqAEAAGA/AAAXAAAA +//8AAE4AAACrAQAACBUAAEoAAAD//wAATgAAAN0BAABgPwAASwAAAP//AABOAAAA4QEAAAgVAABq +AAAA//8AAE4AAAC+BQAAUQgAABkAAAD//wAATgAAAMMFAABRCAAAJgAAAP//AABQAAAAPgEAAA4I +AAAYAAAA//8AAFAAAABAAQAADggAAEYAAAD//wAAUgAAAEcAAADqBQAANwAAAAAAAAAiAAAAMAAA +APcFAAA4AAAA//8AAFIAAABQAAAAJQYAAC0AAAAAAAAAIgAAAHAAAAA0BgAALgAAAP//AABSAAAA +YgAAAGJDAADdAAAAAAAAAH4AAAANAAAANDwAAN4AAAD//wAAUwAAAE4CAADhRQAAGQAAAP//AABT +AAAAUAIAAPRFAAA6AAAA//8AAFMAAAC/CAAA5gYAAEYAAAD//wAAUwAAAMEIAAAOCAAAagAAAP// +AABTAAAAOwoAAMtJAAAfAAAA//8AAFMAAABFCgAA00cAAEUAAAD//wAAUwAAACgMAAB3SwAAQgAA +AP//AABTAAAAKQwAAD9KAABlAAAA//8AAFMAAAChDQAAJQYAABUAAAAAAAAAIgAAAHAAAAA0BgAA +FAAAAP//AABTAAAA2Q0AABZDAAAdAAAA//8AAFMAAADeDQAACU0AAHYAAAD//wAAUwAAABwTAAB1 +UQAAEgEAAP//AABTAAAAHxMAAIdRAABZAQAA//8AAFMAAAAwFAAA00cAADoAAAD//wAAUwAAADEU +AAB+CAAARQAAAP//AABTAAAAGBcAAHVRAAAeAAAA//8AAFMAAAAZFwAAh1EAAHAAAAD//wAAUwAA +AFcXAADmBgAAIQAAAP//AABTAAAASRcAAIJTAACEAAAA//8AAFoAAADRAAAA71UAAEYAAAD//wAA +WgAAABwBAABwTwAAcAIAAP//AABhAAAAPQMAAE5bAABlAAAA//8AAGEAAABOAwAADggAAOMAAAD/ +/wAAYQAAACsEAADWPAAAEgAAAP//AABhAAAALgQAANY8AABTAAAA//8AAGEAAAA5BAAA4FwAABcA +AAD//wAAYQAAADoEAADWPAAARQAAAP//AABmAAAAOQAAAI8EAACdAAAA//8AAGYAAAAqAAAAnl0A +ABQBAAD//wAAZgAAAF0AAACeXQAAZAAAAP//AABmAAAAXwAAAMpdAACMAAAA//8AAGgAAACtAAAA +HV4AAAQAAAD//wAAaAAAALEAAAAdXgAAMgAAAP//AABvAAAA1QIAAFFhAAAOAAAA//8AAG8AAADf +AgAAjwQAAF0AAAD//wAAbwAAAH4DAACiYQAAIgAAAP//AABvAAAAfgMAAKFVAAAiAAAA//8AAG8A +AACZAwAA5GEAACAAAAD//wAAbwAAAJkDAAChVQAAIAAAAP//AABvAAAA3wMAAHRiAABFAAAAAAAA +AG8AAADYAwAAjwQAADQAAAD//wAAbwAAAPEDAAB0YgAARwAAAAAAAABvAAAA2AMAAI8EAAA2AAAA +//8AAG8AAAAMBAAAqmIAAEIAAAD//wAAbwAAABQEAACqYgAAmgAAAP//AAB3AAAAWgIAAI8EAAAU +AAAA//8AAHcAAABaAgAANwoAABQAAAD//wAAdwAAAPADAABRQgAAHQAAAP//AAB3AAAA9wMAAJw3 +AAB5AAAA//8AAHcAAABOBAAAUQgAACsAAAD//wAAdwAAAF4EAAAJPgAAdQAAAP//AAB3AAAAVwUA +AKFVAACVAAAA//8AAHcAAABdBQAAoVUAACMBAAD//wAAfAAAAMsAAACPBAAAOQAAAP//AAB8AAAA +wwAAAKFVAABPAAAA//8AAFMAAAAtFgAAZx0AAE0AAAD//wAAUwAAAC0WAAArVgAATQAAAAIAAACB +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGQAAAAoAAABQA0ABAAEAAQAA +QAFAAUABQAFAAUABQAFAAQAAQAFAAUABQAFAAUABQAFAAUABQAEAAAAA//8AAAYAAABcAgAA2gMA +ADcAAAD//wAABgAAAF0CAADwAwAAcAAAAP//AAAGAAAAXQIAAPADAABwAAAA//8AAAgAAACuAAAA +aAUAABwAAAD//wAACAAAAK8AAACPBAAAHQAAAP//AAAIAAAAtgAAAGgFAABTAAAA//8AABIAAACL +AAAA5gYAAPMAAAD//wAAEgAAAIwAAAB+CAAA/gAAAP//AAASAAAAmAAAAOYGAAAdAQAA//8AACUA +AAAhBQAA/w4AAF8AAAD//wAAJQAAACIFAAAQDwAAZwAAAAEAAAAZAAAAEgAAACEPAABvAAAA//8A +ACUAAADIBQAAMw0AABgAAAD//wAAJQAAAM0FAAAzDQAANgAAAP//AAAlAAAA0QUAALoPAAB3AAAA +//8AACYAAAA+AQAAaBAAAEoAAAD//wAAJgAAADkBAAD/DgAAZQAAAAAAAAAmAAAALwQAAH8QAABb +AAAA//8AACYAAADrBAAAqhIAACwAAAAAAAAAJgAAAGUEAACPBAAARQAAAAAAAAAmAAAAZgQAAAIR +AABOAAAA//8AACsAAADRAgAACBUAAEkAAAD//wAAKwAAANYCAABoBQAAkAAAAP//AAArAAAA3QIA +ABcDAACrAAAA//8AACsAAABTBwAA/g0AABoAAAD//wAAKwAAAFUHAAD+DQAAGQAAAP//AAArAAAA +VwcAAGgFAABKAAAA//8AADQAAACgAAAA2gMAAEwAAAD//wAANAAAAKUAAADaAwAAjAAAAP//AAA0 +AAAAxgAAAGcdAAATAQAA//8AADYAAAAYAgAAKSUAADcAAAAAAAAAQAAAACoAAABAJQAALgAAAAAA +AABAAAAALwAAAFklAAAwAAAA//8AADsAAADPAwAA5TIAABMAAAD//wAAOwAAANIDAADlMgAAxQAA +AP//AAA7AAAA8QMAAP4yAAAiAQAA//8AAD4AAACHAAAA5ycAAFQAAAD//wAAPgAAAJ4AAAD+MgAA +kwAAAP//AAA+AAAA1wAAAP4yAAAnAQAA//8AAEAAAADjAAAAkTgAAFsAAAAAAAAAQAAAADQAAAAQ +MgAAlgAAAAAAAABAAAAANAAAAEAlAACWAAAA//8AAEkAAAA+AQAAUz0AADUAAAD//wAASQAAAD8B +AABTPQAARgAAAP//AABJAAAAQAEAAFM9AABYAAAA//8AAFMAAABhAQAAtQ0AABwAAAD//wAAUwAA +AGMBAABnHQAANAAAAP//AABTAAAAbAEAANgNAACiAAAA//8AAFMAAABpCAAAKEkAAE0AAAD//wAA +UwAAAG8IAAA8SQAAiwAAAP//AABTAAAAXggAADxJAACoAAAA//8AAFMAAADaCAAAtQ0AABwAAAD/ +/wAAUwAAANwIAADYDQAARQAAAP//AABTAAAA4AgAANgNAACQAAAA//8AAFMAAAC1CwAAHEoAAGMA +AAD//wAAUwAAALgLAAC9RwAAbQAAAP//AABTAAAAuQsAAP4GAACOAAAA//8AAFMAAACtFgAASh8A +AHYAAAAAAAAAUwAAAHEYAABpHAAAdwAAAP//AABTAAAAsBYAAEofAADfAAAA//8AAFMAAAACFwAA +HEoAABgAAAD//wAAUwAAAAYXAAB1UQAAUwAAAP//AABTAAAACBcAANNHAAC4AAAA//8AAFoAAABJ +AAAACT0AAK8AAAAAAAAAWgAAADoAAACPBAAAfAAAAP//AABaAAAASQAAAKFVAACvAAAA//8AAGEA +AADjAQAAClsAAKkAAAD//wAAYQAAAPMBAAAiWwAAmgEAAP//AABhAAAA9AEAAApbAAClAQAA//8A +AGEAAABmBAAAOF0AAHYAAAD//wAAYQAAAGcEAABTPQAApgAAAP//AABhAAAAagQAANY8AACoAAAA +//8AAGgAAADcAAAATl4AAKUAAAD//wAAaAAAANUAAAA4DgAA/AAAAP//AABoAAAA1gAAAE5eAAAC +AQAA//8AAGgAAADqAAAAtgQAACEAAAAAAAAAOgAAAJoCAADOBAAAIgAAAP//AABoAAAA8gAAAE5e +AADAAAAA//8AAGgAAABdAgAAaAUAAGIAAAD//wAAaAAAAGECAACPBAAAngAAAP//AABoAAAAZAIA +AFEIAADYAAAA//8AAGgAAAB9BAAAZx0AACwAAAD//wAAaAAAAIYEAAByHwAAgQAAAP//AABoAAAA +lAQAAFEIAADMAAAA//8AAHYAAABmAgAAtQ0AABgAAAD//wAAdgAAAGoCAADqBQAATAAAAAEAAAAi +AAAAMAAAAPcFAABNAAAA//8AAHYAAABxAgAAJQYAABkAAAAAAAAAIgAAAHAAAAA0BgAAGgAAAP// +AAB2AAAAcwIAANgNAAAnAAAA//8AAHYAAACvAwAAMw0AABgAAAD//wAAdgAAALgDAAD3ZQAAbQAA +AP//AAB2AAAAuQMAAPdlAAB4AAAA//8AAHYAAADXAwAAtQ0AABwAAAD//wAAdgAAANkDAADTRwAA +PgAAAP//AAB2AAAA3AMAANgNAABvAAAA//8AAHYAAAByBAAAtQ0AABwAAAD//wAAdgAAAHQEAADT +RwAAPgAAAP//AAB2AAAAdwQAANgNAABvAAAA//8AAHcAAADaAwAAK1YAAHUAAAD//wAAdwAAAMsD +AABnHQAAGAAAAP//AAB3AAAA4AMAAL8HAADNAAAA//8AAHcAAAACBAAAZx0AACQAAAD//wAAdwAA +AAsEAABnHQAAiQAAAP//AAB3AAAADwQAAJw3AADRAAAA//8AAHwAAADYAAAA92sAADwAAAD//wAA +fAAAANkAAAAMbAAASAAAAP//AAB8AAAA3gAAAKFVAACaAAAADgAAAB0AAAAAAAAABQgAAIUAAAAF +AAAABAAAAAUABACHAAQAhQAEAEUABAA9AAAAHQ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AAAAAmAAAAVgQAAD8SAAA/AAAAAQAAACYAAABOBAAA5RAAACQAAAABAAAA +JgAAAFEEAAB/EAAARgAAAP//AAAnAAAAcAEAAJcRAABWAAAA//8AACsAAACUAgAACBUAAB0AAAD/ +/wAAKwAAAJECAABoBQAANgAAAP//AAArAAAAlwIAAGgFAABYAAAA//8AACsAAACiAgAAFwMAALQA +AAD//wAAKwAAAKcCAAAXAwAAJwEAAP//AAAsAAAAcwAAAOoFAAAvAAAAAAAAACIAAAAwAAAA9wUA +ADAAAAD//wAALAAAAHQAAABDDQAAPQAAAP//AAAsAAAAdQAAACUGAABpAAAAAwAAACIAAABwAAAA +NAYAAGoAAAD//wAALQAAAO4AAAC+FgAAGAAAAP//AAAtAAAA+AAAAHMUAABuAAAA//8AAC0AAAD6 +AAAA4QQAAOUAAAD//wAALQAAAPoAAAA4DgAA5QAAAAIAAAArAAAAPwEAAM4EAAChAAAA//8AADQA +AABDAgAA6gUAABUAAAAAAAAAIgAAADAAAAD3BQAAFAAAAP//AAA0AAAARAIAANMeAAA0AAAA//8A +ADQAAABGAgAAJQYAAEUAAAADAAAAIgAAAHAAAAA0BgAARgAAAP//AAA0AAAAsQUAAEoUAAAzAAAA +AAAAADoAAAB8AgAAzgQAADIAAAD//wAANAAAALcFAAA4DgAAyQAAAP//AAA0AAAAuAUAABoUAACS +AQAA//8AADQAAADABQAAGhQAACsCAAD//wAANgAAALEBAABRJAAAMQAAAAAAAAA2AAAAZwAAAGYk +AAA/AAAA//8AADYAAAC3AQAAmxsAACMBAAACAAAAUgAAAFAAAAAlBgAAOQEAAAMAAAAiAAAAcAAA +ADQGAAA6AQAA//8AADYAAADJAgAAQSYAADgAAAAAAAAAOwAAAFgBAABeJgAAIQAAAAAAAAA7AAAA +WAEAAHImAAAhAAAA//8AADYAAADMAgAAnSYAAGoAAAD//wAANgAAAM8CAABAJQAApgAAAP//AAA6 +AAAAOAUAADMNAAAtAAAA//8AADoAAAA+BQAAMw0AADwAAAD//wAAOgA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AD//wAAeAAAAN0BAADf +agAAGAAAAAAAAAB4AAAA0QEAAPdqAABDAAAAAQAAAHgAAADHAQAAjwQAAE4AAAD//wAAeAAAAOIB +AAD3agAAlwAAAAMAAAB4AAAAxwEAAI8EAACOAAAA//8AAAMAAABXAAAAXwAAAFMDAAD//wAAAwAA +AF0AAABfAAAAYAMAAP//AAADAAAAZAAAAF8AAACPAwAA//8AAAMAAABkAAAAXwAAAI8DAAD//wAA +AwAAAGcAAABfAAAAqQMAAP//AAADAAAAbwAAAF8AAACcAwAA//8AACsAAACBAQAAShQAAA8AAAAA +AAAAOgAAAHwCAADOBAAADgAAAP//AAArAAAAkQEAABoUAABtAAAA//8AACsAAACRAQAAOA4AAG0A +AAD//wAAKwAAAJ4BAABZFAAAzwAAAAQAAAArAAAA9wAAAHMUAADUAAAA//8AADQAAABEAAAA2gMA +ADEAAAD//wAANAAAAEUAAAARHQAASQAAAAEAAAA0AAAAPQAAAP4NAABXAAAA//8AADQAAABLAAAA +2gMAAIwAAAD//wAANAAAAEwAAAARHQAAogAAAAQAAAA0AAAAPQAAAP4NAACwAAAA//8AADQAAABm +AQAA6gUAAJcBAAAAAAAAIgAAADAAAAD3BQAAoAEAAP//AAA0AAAAeQEAACUGAAC0AQAAAgAAACIA +AABwAAAANAYAAOkBAAD//wAANAAAAG8BAAA4DgAA/AEAAP//AAA0AAAAWQEAABoUAABVAQAA//8A +ADQAAACSAQAAMh4AAEMAAAD//wAANAAAAJMBAAAyHgAAagAAAP//AAA0AAAAuwEAAEoeAAArAQAA +//8AADQAAADUAQAA0xoAAPIBAAD//wAANAAAALMBAABpHgAALgIAAP//AAA0AAAA6QEAAGkeAABa +AgAA//8AADYAAAAAAQAA6gUAAD0AAAAAAAAAIgAAADAAAAD3BQAAPgAAAP//AAA2AAAACQEAAB0f +AACqAAAA//8AADYAAAA4AQAA6gUAAFACAAADAAAAIgAAADAAAAD3BQAAUQIAAP//AAA2AAAAOgEA +AB0fAABlAgAA//8AADYAAACYAQAAKSUAAJwAAAAAAAAAQAAAACoAAABAJQAAkwAAAAAAAABAAAAA +LwAAAFklAACVAAAA//8AADYAAACZAQAAKSUAAKgAAAADAAAAQAAAACoAAABAJQAAwwAAAAMAAABA +AAAALwAAAFklAADFAAAA//8AADYAAAB+AgAAJCcAAEAAAAD//wAANgAAAH4CAAAYJgAAQAAAAP// +AAA2AAAAfgIAABgmAABAAAAA//8AADYAAACGAgAAKyYAAGkAAAD//wAANgAAAJACAABeJgAAqQAA +AP//AAA2AAAAkQIAAHImAADAAAAA//8AADYAAAAJAwAAdicAAE8AAAD//wAANgAAAAsDAAB2JwAA +gQAAAP//AAA2AAAADQMAAHYnAADAAAAA//8AADYAAAAPAwAAdicAAPIAAAD//wAANgAAABEDAAB2 +JwAAHQEAAP//AAA2AAAAEwMAAHYnAAAmAQAA//8AADYAAABnAwAAMw0AAEoAAAD//wAANgAAAHwD +AADnJwAA/gAAAP//AAA2AAAAgQMAAOcnAABkAQAA//8AADYAAACJAwAA5ycAALIBAAD//wAANgAA +AKYDAAAzDQAANgIAAP//AAA2AAAArAMAAH0ZAABKAgAA//8AADoAAADtAgAAtQ0AADkAAAD//wAA +OgAAACIDAADYDQAA3QEAAP//AAA6AAAADQMAAOoFAAAqAQAAAgAAACIAAAAwAAAA9wUAACsBAAD/ +/wAAOgAAABwDAAAlBgAAvAEAAAQAAAAiAAAAcAAAADQGAAC9AQAA//8AAEAAAAA8AAAAEDIAABgA +AAD//wAAQAAAADwAAAAQMgAAGAAAAP//AABAAAAAPgAAAEAlAABRAAAA//8AAEAAAABAAAAAQCUA +AG8AAAD//wAAQAAAAEAAAABAJQAAbwAAAP//AABAAAAAQgAAAEAlAACFAAAA//8AAEMAAADoAAAA +tDkAABgAAAAAAAAAQwAAAD0BAADQOQAAHAAAAP//AABDAAAA9AAAAI8EAAA1AAAA//8AAEMAAAAJ +AQAAQDoAAF4AAAD//wAAQwAAAAwBAAB7OgAAdQAAAP//AABDAAAA6AAAAOs5AAAYAAAA//8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AAAAvwcAACoAAAD/ +/wAANgAAAO0AAAC8JAAAPQAAAAMAAAByAAAA5QAAAMwkAABWAAAA//8AADYAAADxAAAAHR8AAHoA +AAD//wAANgAAAPQAAAC/BwAAtgAAAP//AAA4AAAACgEAAIkXAAA3AAAA//8AADgAAAAVAQAAGhQA +AHUAAAD//wAAOAAAAB8BAADkFwAAowAAAAIAAAA4AAAA2QAAAAYYAAClAAAA//8AADgAAAAxAQAA +LRgAAEoBAAAEAAAAOAAAAPIAAABMGAAAiAEAAP//AAA4AAAASwEAADQpAACVAgAA//8AADgAAABq +AQAAiRcAAEAAAAD//wAAOAAAAGwBAADkFwAAWwAAAAEAAAA4AAAA2QAAAAYYAABdAAAA//8AADgA +AABxAQAALRgAALcAAAADAAAAOAAAAPIAAABMGAAA+wAAAP//AAA4AAAAbgEAAC0YAADxAQAABQAA +ADgAAADyAAAATBgAAC8CAAD//wAAOAAAAJQCAAA/KgAAxwAAAP//AAA4AAAAlQIAAGAqAADeAAAA +//8AADgAAACxAgAAsCoAAKcCAAD//wAAOAAAAJkCAABAGQAAPwEAAP//AAA4AAAAnwIAAEAZAACr +AQAA//8AADgAAACkAgAAQBkAAPsBAAD//wAAOAAAALACAACwKgAAhQIAAP//AAA5AAAAvwEAAOoF +AAAZAAAAAAAAACIAAAAwAAAA9wUAABgAAAD//wAAOQAAAMcBAAB1LAAA1QAAAAIAAAA6AAAAZAYA +AJIsAABIAAAA//8AADkAAADIAQAAJQYAAEoAAAAEAAAAIgAAAHAAAAA0BgAASwAAAAIAAAA6AAAA +bgYAAJIsAACDAAAA//8AADoAAADAAgAAMy0AABoAAAD//wAAOgAAAMECAAAzLQAAtQAAAP//AAA6 +AAAAwgIAADMtAABDAQAA//8AADoAAADDAgAAMy0AAM4BAAD//wAAOgAAAMQCAAAzLQAATAIAAP// +AAA6AAAAxQIAADMtAADMAgAA//8AADoAAADTAgAATC0AAFcDAAD//wAAOwAAAIECAAAQMgAAHAAA +AP//AAA7AAAAgQIAANwxA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QAAAP//AABTAAAA/xAAAMlP +AAA+AQAAAQAAAGgAAABfBAAA308AAEcBAAD//wAAUwAAAM4QAAAIFQAAawAAAP//AABTAAAA2RAA +AGcdAADFAAAA//8AAFMAAAAKEQAA/w4AAFgCAAD//wAAUwAAACARAADYDQAA7gIAAP//AABTAAAA +WRkAAL8HAACfAAAA//8AAFMAAABeGQAAjwQAAMcAAAD//wAAUwAAAGAZAACPBAAAGAEAAP//AABT +AAAAahkAAA4IAAC2AQAA//8AAFMAAABmGQAAvwcAAGYBAAD//wAAUwAAAHAZAADJCQAAxAAAAP// +AABTAAAAcRkAAMkJAAA+AQAA//8AAFwAAAAqAAAA9wUAACEAAAD//wAAXAAAAC4AAAAlBgAAOQAA +AAEAAAAiAAAAcAAAADQGAAA6AAAA//8AAFwAAAA0AAAAfggAAFsAAAD//wAAXAAAADUAAAAlBgAA +YAAAAAQAAAAiAAAAcAAAADQGAABhAAAA//8AAFwAAAA3AAAA7BsAAHgAAAD//wAAaAAAAOsCAAAo +XwAAGAAAAP//AABoAAAA7QIAAChfAABJAAAA//8AAGgAAADuAgAAKF8AAGQAAAD//wAAaAAAAO8C +AAAoXwAAfwAAAP//AABoAAAA8AIAAChfAACaAAAA//8AAGgAAADxAgAAKF8AALYAAAD//wAAaAAA +APICAAAoXwAA1gAAAP//AABoAAAAtwMAAGkcAAAtAAAA//8AAGgAAADwAwAAFkMAAOkAAAD//wAA +aAAAACkEAABRCAAA2QMAAP//AABoAAAABgQAAGcdAABABgAA//8AAGgAAADKAwAAUQgAAKMHAAD/ +/wAAaAAAANQDAACcNwAA7gkAAP//AABoAAAAvQMAAJw3AABaCwAA//8AAHYAAAAXAwAA6gUAAHQA +AAAAAAAAIgAAADAAAAD3BQAAewAAAP//AAB2AAAAIgMAAHtlAADYAAAA//8AAHYAAAAZAwAAJQYA +APoAAAADAAAAIgAAAHAAAAA0BgAA+wAAAP//AAB2AAAAKQMAACUGAABlAQAABQAAACIAAABwAAAA +NAYAAGYBAAD//wA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8AACwAAAD4AAAADhcAAC4BAAD//wAALAAA +APkAAAA4DgAAfAEAAP//AAAsAAAA+gAAAOEEAADZAQAA//8AACwAAAD6AAAAOA4AANkBAAAFAAAA +KwAAAD8BAADOBAAAlQEAAP//AAAzAAAAFQYAAOoFAAAqAAAAAAAAACIAAAAwAAAA9wUAACsAAAD/ +/wAAMwAAABwGAAAlBgAAkwAAAAIAAAAiAAAAcAAAADQGAACUAAAA//8AADMAAAAgBgAA6gUAAKUA +AAAEAAAAIgAAADAAAAD3BQAAtAAAAP//AAAzAAAAKwYAACUGAADsAAAABgAAACIAAABwAAAANAYA +AO0AAAD//wAANQAAADkCAAD2GAAAUQAAAAAAAAAzAAAAOwUAAEUbAAAmAAAAAAAAADMAAAA+BQAA +EhkAAF0AAAD//wAANQAAAEICAABoIwAAUAEAAAMAAAAgAAAALwAAADsMAACwAAAA//8AADUAAABf +AgAAfyMAAJIAAAD//wAANQAAAGwCAAC/BwAAawEAAP//AAA1AAAAdwIAAGkcAADYAQAA//8AADkA +AADPAQAA6gUAAB0AAAAAAAAAIgAAADAAAAD3BQAAHAAAAP//AAA5AAAA0AEAAJIsAAApAAAA//8A +ADkAAADRAQAAJQYAADwAAAADAAAAIgAAAHAAAAA0BgAAPQAAAP//AAA5AAAA4AEAACUGAACUAAAA +//8AADkAAADfAQAAkiwAALYAAAAFAAAAIgAAAHAAAAA0BgAAlQAAAP//AAA7AAAAZAEAADMNAAAn +AAAA//8AADsAAABlAQAAfRkAACgAAAD//wAAOwAAAG8BAAAYJgAAYAAAAP//AAA7AAAAbwEAABgm +AABhAAAA//8AADsAAAB+AQAAQCUAAOUAAAD//wAAOwAAAJMBAABBJgAAOQEAAAUAAAA7AAAAWAEA +AHImAAAnAQAA//8AADsAAACIAQAAXiYAAGMBAAD//wAAQwAAAF8AAAAlBgAATQAAAAAAAAAiAAAA +cAAAADQGAABOAAAA//8AAEMAAABaAAAA6gUAAHAAAAACAAAAIgAAADAAAAD3BQAAcQAAAP//AABD +A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wAAAHgAAADRAQAA92oAAN8A +AAAGAAAAeAAAAMcBAACPBAAA9gAAAP//AAA0AAAAugQAAOEEAAB6AAAAAAAAACsAAAA/AQAAzgQA +AC8AAAD//wAANAAAALsEAAC2BAAAogAAAP//AAA0AAAAxAQAADgOAADNAAAA//8AADQAAADKBAAA +8iAAANMAAAD//wAANAAAAOgEAAD5BAAAcAEAAP//AAA0AAAA5gQAAA8FAAAaAQAABgAAACsAAACt +AQAAJQUAAPkBAAD//wAANAAAANYEAAALIQAAmwIAAP//AAA6AAAA5gUAAHovAAD6AQAA//8AADoA +AADCBQAAyyEAAGUAAAD//wAAOgAAAMIFAAA4DgAAZgAAAAEAAAA6AAAAtAIAAM4EAABrAAAA//8A +ADoAAADiBQAAOA4AAJgBAAD//wAAOgAAALUFAAAaFAAAHwAAAP//AAA6AAAA5QUAALQuAAC8AQAA +AAAAADoAAABWBAAAQw0AAPwBAAD//wAAOgAAALwFAAA4DgAAawIAAP//AAA7AAAAKwMAABgmAAAa +AAAA//8AADsAAAAyAwAAhiYAAGIAAAD//wAAOwAAADUDAAArJgAAdQAAAP//AAA7AAAANgMAAEEm +AADZAAAAAwAAADsAAABYAQAAXiYAALAAAAADAAAAOwAAAFgBAAByJgAAsAAAAP//AAA7AAAAPAMA +AJ0mAADvAAAA//8AADsAAABWAwAAQCUAAFUBAAD//wAAOwAAADkDAACGJgAADwIAAP//AABDAAAA +kgAAALQ5AAAcAAAAAAAAAEMAAAA9AQAA0DkAAB0AAAD//wAAQwAAAKsAAADrOQAAWgAAAP//AABD +AAAArAAAALQ5AABfAAAAAwAAAEMAAAA9AQAA0DkAAGAAAAD//wAAQwAAAKgAAAAJOgAAPAAAAP// +AABDAAAAqAAAACY6AAA8AAAA//8AAEMAAAC4AAAAjwQAAKAAAAD//wAAQwAAANsAAABAOgAA8gAA +AP//AABFAAAACgEAAI4hAAACAQAAAAAAACsAAAABAQAAViEAAB4BAAABAAAAOgAAAJgHAADQEwAA +AwEAAP//AABFAAAACw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mBgAALAEAAP//AABUAAAAOAEA +AL9UAABrAAAA//8AAFQAAAA8AQAA3lQAAE8EAAD//wAAVAAAAEUBAAD+VAAAOgEAAP//AABUAAAA +SwEAADlUAABPAQAA//8AAFQAAABMAQAAOVQAAFMBAAD//wAAVAAAAF4BAABUVAAAWAEAAP//AABU +AAAAfgEAADlUAAAvAwAA//8AAFQAAAB/AQAAI1UAABMCAAD//wAAVAAAAIABAABMVQAAZAMAAP// +AABhAAAAzgIAAMdbAAA0AAAA//8AAGEAAADZAgAA2FsAAG8AAAD//wAAYQAAANUCAADtWwAAJQEA +AP//AABhAAAA7AIAAP5bAAByAQAA//8AAGEAAADuAgAAFFwAAKUBAAD//wAAYQAAAOoCAAA1PwAA +1gEAAP//AABhAAAA4wIAANhbAABDAgAA//8AAGEAAADfAgAA7VsAAPYCAAAAAAAATgAAAJ0FAABn +HQAAywMAAP//AAB2AAAAIQIAAGtkAABCAAAA//8AAHYAAAAlAgAAa2QAAGkAAAD//wAAdgAAACYC +AACvZAAAcAAAAP//AAB2AAAANgIAAMpkAADhAAAA//8AAHYAAAA6AgAA42QAACYBAAD//wAAdgAA +AD0CAADjZAAALwEAAP//AAB2AAAAPwIAAONkAACpAQAA//8AAHYAAABCAgAA42QAAPcCAAD//wAA +dgAAAEQCAADjZAAALQAAAP//AAB4AAAA6AEAAPdqAAATAAAA//8AAHgAAADrAQAA32oAABsAAAAB +AAAAeAAAANEBAAD3agAARwAAAAIAAAB4AAAAxwEAAI8EAABSAAAA//8AAHgAAADsAQAA32oAAH4A +AAAEAAAAeAAAANEBAAD3agAAiwAAAAUAAAB4AAAAxwEAAI8EAACiAAAA//8AAHgAAADuAQAA92oA +ANMAAAAHAAAAeAAAAMcBAACPBAAAygAAAP//AAAmAAAAWQEAAH8QAAAYAAAA//8AACYAAABhAQAA +fxAAADIAAAD//wAAJgAAAGMBAACrEAAAoAAAAAIAAABCAAAAEAAAAP4NAABxAAAAAgAAAEIAAAAS +AAAA/g0AAK0AAAACAAAAQgAAABgAAAAzDQAA7wAAAP//AAAmAAAAfwEAAI8EAACmAQAA//8AACYA +AACAAQAAHRAAAL4BAAAHAAAAJgAAANQAAACPBAAAuAEAAP//AAAmAAAAfgEAAI8EAAB1AQAA//8A +ADMAAAAIAwAAVRoAABgAAAD//wAAMwAAAGsDAAB9GgAASQAAAP//AAAzAAAAEQMAAPYYAAAqAAAA +AgAAADMAAAA+BQAAEhkAAIMAAAD//wAAMwAAABgDAABVGgAAqwAAAP//AAAzAAAAPQMAAH0aAADu +AAAA//8AADMAAABFAwAAvwcAAAUBAAD//wAAMwAAAEoDAACQGgAAbgEAAP//AAAzAAAAegMAAH0a +AABKAgAA//8AADMAAAASAwAAfRoAAIcCAAD//wAANAAAAIUCAADqBQAAMwAAAAAAAAAiAAAAMAAA +APcFAAA0AAAA//8AADQAAACGAgAA7h0AAGUAAAD//wAANAAAAIcCAABKHwAArwAAAP//AAA0AAAA +nQIAAAIfAADsAAAABAAAAFMAAABYGAAA5gYAAAgBAAAEAAAAUwAAAFoYAADmBgAAEQEAAAQAAABT +AAAAXBgAAOYGAAAfAQAA//8AADQAAACoAgAAJQYAAFcBAAAIAAAAIgAAAHAAAAA0BgAAWAEAAP// +AAA2AAAAJQEAAOoFAAAqAAAAAAAAACIAAAAwAAAA9wUAACsAAAD//wAANgAAACgBAABRJAAARgAA +AAIAAAA2AAAAZwAAAGYkAAA/AAAA//8AADYAAAAqAQAAJQYAAFUAAAAEAAAAIgAAAHAAAAA0BgAA +VgAAAP//AAA2AAAALwEAAL8HAABvAAAA//8AADYAAAAyAQAAvwcAAMoAAAD//wAANgAAADQBAAAl +BgAA4wAAAAgAAAAiAAAAcAAAADQGAADkAAAA//8AADgAAABiAAAArCgAAC8AAAD//wAAOAAAAGMA +AADHKAAATQAAAP//AAA4AAAAZwAAAG8YAAClAAAA//8AADgAAABpAAAAwRcAANIAAAD//wAAOAAA +AG4AAADgKAAA6QAAAAQAAAA4AAAARgAAAKwoAADqAAAA//8AADgAAAB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KwAAAD//wAAOAAAALYAAAAdHwAAtQAAAP//AAA4AAAAsgAAACUGAADa +AAAABwAAACIAAABwAAAANAYAANsAAAD//wAAOAAAAKgAAADTGgAA8AAAAP//AAA4AAAAqwAAANMa +AAANAQAA//8AADkAAABfAQAAaCMAANUBAAD//wAAOQAAAGwBAADqBQAASgAAAAEAAAAiAAAAMAAA +APcFAABLAAAA//8AADkAAAByAQAAJQYAAIYAAAADAAAAIgAAAHAAAAA0BgAAhwAAAP//AAA5AAAA +fAEAAOoFAADmAAAABQAAACIAAAAwAAAA9wUAAOcAAAD//wAAOQAAAH4BAAAlBgAABQEAAAcAAAAi +AAAAcAAAADQGAAAGAQAA//8AADkAAACDAQAAOA4AABgBAAAAAAAAIAAAAC8AAAA7DAAAtQEAAP// +AABQAAAAdgEAABZDAAAtAAAA//8AAFAAAACBAQAAUQgAAKoAAAD//wAAUAAAAJcBAADjQAAA7gAA +AP//AABQAAAApQEAAONAAACgAQAAAwAAAG8AAAD4AwAAjwQAAKIBAAACAAAAbwAAAPgDAACPBAAA +8AAAAAIAAABvAAAA/QMAAI8EAABSAQAAAwAAAG8AAAD9AwAAjwQAABECAAD//wAAUAAAAKwBAAAJ +PgAAhgEAAP//AABQAAAArQEAAAk+AADgAgAA//8AAFAAAACuAQAACT4AAAYDAAD//wAAUwAAAK8C +AAAuRgAAJwAAAP//AABTAAAAsgIAAEdGAABVAAAA//8AAFMAAAC6AgAAXEYAAJ4AAAACAAAAYQAA +AAwEAADWPAAAqQAAAP//AABTAAAAwwIAAGxGAAD5AAAA//8AAFMAAADHAgAA6gUAAAoBAAAFAAAA +IgAAADAAAAD3BQAACwEAAP//AABTAAAAyAIAAL8HAAAuAQAA//8AAFMAAADKAgAAKiQAAD8BAAD/ +/wAAUwAAANACAAAlBgAAiQEAAAkAAAAiAAAAcAAAADQGAACKAQAA//8AAFMAAADcBAAAtQ0AACAA +AAD//wAAUwAAAN0EAAC9RwAAOAAAAP//AABTAAAA4QQAAOoFAABUAAAAAgAAACIAAAAwAAAA9wUA +AFUAAAD//wAAUwAAAO4EAAAlBgAAuQAAAAQAAAAiAAAAcAAAADQGAAC6AAAA//8AAFMAAAD0BAAA +CBUAANgAAAD//wAAUwAAAPsEAADTRwAABgEAAP//AABTAAAABAUAAL8HAAAvAQAA//8AAFMAAAAG +BQAA60cAAFQBAAD//wAAUwAAAA4FAADYDQAAcgEAAP//AABTAAAAOBYAAOoFAAAdAAAAAAAAACIA +AAAwAAAA9wUAABwAAAD//wAAUwAAAEEWAAAyHAAAWQAAAAIAAABTAAAAkhYAAEscAABaAAAAAwAA +AFMAAABlGAAAaRwAAHAAAAD//wAAUwAAAEIWAAAlBgAAsAAAAAUAAAAiAAAAcAAAADQGAAC9AAAA +//8AAFMAAABHFgAAJQYAAMMAAAAHAAAAIgAAAHAAAAA0BgAAxAAAAP//AABTAAAAOhYAACUGAADT +AAAACQAAACIAAABwAAAANAYAANQAAAD//wAAUwAAAJUXAADmBgAAKAAAAP//AABTAAAAkxcAAO4d +AAAmAAAA//8AAFMAAACUFwAASh8AAFIAAAD//wAAUwAAAKYXAADuHQAAgwAAAP//AABTAAAApxcA +AOoFAACPAAAABAAAACIAAAAwAAAA9wUAAJAAAAD//wAAUwAAAKgXAAAyHAAAnQAAAAYAAABTAAAA +khYAAEscAACeAAAABwAAAFMAAABlGAAAaRwAALIAAAD//wAAUwAAAKkXAAAlBgAA7wAAAAkAAAAi +AAAAcAAAADQGAADwAAAA//8AAAgAAAB7AAAA2gMAAD0AAAD//wAACAAAAHwAAADwAwAAfgAAAP// +AAAIAAAAgQAAAPADAACZAAAA//8AAAgAAAB+AAAAjwQAALkAAAD//wAACAAAAIMAAACPBAAA4gAA +AP//AAAIAAAAiAAAALYEAAAOAQAABQAAADoAAACaAgAAzgQAABEBAAD//wAACAAAAJkAAADhBAAA +XAEAAAcAAAArAAAAPwEAAM4EAABfAQAA//8AAAgAAACbAAAA+QQAAEMCAAD//wAACAAAAKIAAAAP +BQAAaAIAAAoAAAArAAAArQEAACUFAACrAgAA//8AACcAAAAdAAAA0hAAAHYAAAAAAAAAJgAAAL4A +AAB/EAAAjAAAAP//AAAnAAAAHgAAAI8EAACQAAAA//8AACcAAAAgAAAA5RAAALgAAAD//wAAJwAA +ACQAAACPBAAAvQAAAP//AAAnAAAAJQAAAAIRAADTAAAA//8AACcAAAAqAAAABBAAANUAAAAGAAAA +JgAAANAAAACPBAAA2AAAAP//AAAnAAAAKwAAANwSAAAMAQAACAAAACYAAADYAAAAjwQAAAUBAAD/ +/wAAJwAAACsAAACPBAAADAEAAP//AAAnAAAALQAAAI8EAAA+AQAA//8AACcAAABFAAAA0hAAAHYA +AAAAAAAAJgAAAL4AAAB/EAAAjAAAAP//AAAnAAAARgAAAI8EAACQAAAA//8AACcAAABIAAAA5RAA +ALgAAAD//wAAJwAAAEwAAACPBAAAvQAAAP//AAAnAAAATQAAAAIRAADUAAAA//8AACcAAABSAAAA +BBAAANYAAAAGAAAAJgAAANAAAACPBAAA2QAAAP//AAAnAAAAUwAAANwSAAAOAQAACAAAACYAAADY +AAAAjwQAAAcBAAD//wAAJwAAAFMAAACPBAAADgEAAP//AAAnAAAAVQAAAI8EAABGAQAA//8AADMA +AACYBAAA5gYAAKIAAAD//wAAMwAAAJoEAAC1DQAAqwAAAP//AAAzAAAAmgQAAH4IAACyAAAA//8A +ADMAAADTBAAAtQ0AAOkAAAD//wAAMwAAANMEAAB+CAAA8AAAAP//AAAzAAAA1AQAAAgVAAD+AAAA +//8AADMAAADfBAAAvwcAADEBAAD//wAAMwAAAA4FAAC/BwAA1gEAAP//AAAzAAAAKwUAAPYYAAB0 +AgAACAAAADMAAAA+BQAAEhkAAIYCAAD//wAAMwAAAC8FAADYDQAAtgIAAP//AAAzAAAAMAUAAH4I +AADlAgAA//8AADQAAAAVAQAA6gUAABkAAAAAAAAAIgAAADAAAAD3BQAAGAAAAP//AAA0AAAAGAEA +ACUGAAA8AAAAAgAAACIAAABwAAAANAYAAD0AAAD//wAANAAAABkBA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AAAiAAAAMAAAAPcFAABMAAAAAAAAAHYAAADpAQAAa2QAAHAAAAD/ +/wAAdgAAAIICAABrZAAAqwAAAP//AAB2AAAAiQIAAGtkAADRAAAA//8AAHYAAACKAgAAr2QAAN0A +AAD//wAAdgAAAJACAADKZAAACwEAAP//AAB2AAAAkQIAAONkAABjAAAA//8AAHYAAACSAgAA42QA +AIkBAAD//wAAdgAAAJUCAAAlBgAA1gEAAAoAAAAiAAAAcAAAADQGAADXAQAA//8AAAkAAAC/AAAA +3QUAACsAAAD//wAACQAAAMgAAADqBQAAmwAAAAEAAAAiAAAAMAAAAPcFAACxAAAA//8AAAkAAADP +AAAADAYAAOABAAD//wAACQAAAOcAAAAlBgAABAIAAAQAAAAiAAAAcAAAADQGAAAFAgAA//8AAAkA +AAD7AAAASwYAABEDAAD//wAACQAAANgAAABkBgAA+QQAAAcAAAAJAAAAegAAAI8EAAABBQAA//8A +AAkAAADiAAAAJQYAAD4FAAAJAAAAIgAAAHAAAAA0BgAAPwUAAP//AAAJAAAAywAAACUGAADfBQAA +CwAAACIAAABwAAAANAYAAOAFAAD//wAAMwAAALYFAADqBQAAKwAAAAAAAAAiAAAAMAAAAPcFAAAs +AAAA//8AADMAAAC9BQAAJQYAAJ8AAAACAAAAIgAAAHAAAAA0BgAAoAAAAP//AAAzAAAAvwUAAJ0c +AACtAAAA//8AADMAAADEBQAA6gUAAMYAAAAFAAAAIgAAADAAAAD3BQAAxwAAAP//AAAzAAAAxgUA +ACUGAADfAAAABwAAACIAAABwAAAANAYAAOAAAAD//wAAMwAAANgFAADqBQAA7wAAAAkAAAAiAAAA +MAAAAPcFAADwAAAA//8AADMAAADdBQAAJQYAACUBAAALAAAAIgAAAHAAAAA0BgAAJgEAAP//AAA0 +AAAAvAIAAGcdAABMAAAA//8AADQAAADNAgAAch8AAKAAAAD//wAANAAAAL4CAABnHQAA5gEAAP// +AAA0AAAAEQMAAIwfAABaAwAA//8AADQAAAAXAwAAsR8AANMDAAD//wAANAAAACAD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AAI8EAAAZDQAACAAAAG8AAAD9AwAA +jwQAAOANAAD//wAAdwAAAIABAABwZwAAfBcAAP//AAB3AAAAjwEAAHBnAAAuDAAA//8AAAkAAABo +AQAA6gUAAC4AAAAAAAAAIgAAADAAAAD3BQAANwAAAP//AAAJAAAAiwEAANAGAABqAAAAAgAAAFMA +AACQGAAA5gYAAHcAAAD//wAACQAAAHoBAAAMBgAAlgAAAP//AAAJAAAAngEAANAGAAASAgAABQAA +AFMAAACQGAAA5gYAAB8CAAD//wAACQAAAJABAAAMBgAAWgIAAP//AAAJAAAAoAEAACUGAABtAwAA +CAAAACIAAABwAAAANAYAAG4DAAD//wAACQAAAKMBAAD+BgAAeQMAAP//AAAJAAAApAEAABUHAACa +AwAA//8AAAkAAABqAQAAJQYAAL0DAAAMAAAAIgAAAHAAAAA0BgAAvgMAAP//AAAJAAAA1wEAAE0H +AAAxAAAA//8AAAkAAADrAQAATQcAAG8AAAD//wAACQAAAPwBAADqBQAA+QAAAAIAAAAiAAAAMAAA +APcFAAAPAQAA//8AAAkAAAACAgAAJQYAACwBAAAEAAAAIgAAAHAAAAA0BgAALQEAAP//AAAJAAAA +CQIAAAwGAACQAgAA//8AAAkAAAAUAgAAZAYAAKYCAAAHAAAACQAAAHoAAACPBAAAqgIAAP//AAAJ +AAAAIQIAACUGAAAWAwAACQAAACIAAABwAAAANAYAABcDAAD//wAACQAAACYCAAAlBgAASAMAAAsA +AAAiAAAAcAAAADQGAABJAwAA//8AAAkAAAA6AgAASwYAAF8EAAD//wAAJgAAANgBAADSEAAAawAA +AAAAAAAmAAAAvgAAAH8QAACBAAAA//8AACYAAADZAQAAjwQAAIUAAAD//wAAJgAAANsBAADlEAAA +rwAAAP//AAAmAAAA3wEAAI8EAAC0AAAA//8AACYAAADgAQAAAhEAAMwAAAD//wAAJgAAAOQBAAAU +EQAA3AAAAP//AAAmAAAAzwEAACQRAADpAAAA//8AACYAAADmAQAABBAAAM4AAAAIAAAAJgAAANAA +AACPBAAADAEAAP//AAAmAAAA7gEAAI8EAABfAQAA//8AACYAAADvAQAARhEAAHYBAAD//wAAJgAA +APMBAACPBAAAqgEAAP//AAAmAAAA9AEAAGURAADYAQAA//8AAFMAAAA9DAAA9hgAAE0AAAAAAAAA +MwAAAD4FAAASGQAAMgAAAP//AABTAAAAUgwAAOoFAABcAAAAAgAAACIAAAAwAAAA9wUAAF0AAAD/ +/wAAUwAAAGEMAABoIwAAIQEAAP//AABTAAAAXQwAACUGAACFAAAABQAAACIAAABwAAAANAYAAIYA +AAD//wAAUwAAAFUMAAAlBgAAoQAAAAcAAAAiAAAAcAAAADQGAACiAAAABAAAACAAAAAvAAAAOwwA +APMAAAD//wAAUwAAAGgMAAAlBgAAJgEAAAoAAAAiAAAAcAAAADQGAAAnAQAA//8AAFMAAABkDAAA +JQYAAFQBAAAMAAAAIgAAAHAAAAA0BgAAVQEAAP//AABfAAAAQwAAAEtYAAArAAAA//8AAF8AAABC +AAAAGFkAACoAAAABAAAAYAAAACoAAACpVwAALwAAAP//AABfAAAASQAAAA4IAABuAAAA//8AAF8A +AABJAAAAq1kAAG0AAAAEAAAAXwAAAFIAAABLWAAAdgAAAAUAAABgAAAAHgAAAKlXAABdAAAABAAA +AF8AAABVAAAAx1kAAIMAAAAHAAAAYAAAADQAAACpVwAAhAAAAAQAAABfAAAAVgAAAOJZAACQAAAA +CQAAAGAAAAAzAAAAqVcAAJEAAAD//wAAXwAAAEwAAAAOCAAArgAAAP//AABfAAAATAAAAOJZAACt +AAAADAAAAGAAAAAzAAAAqVcAALYAAAD//wAAaAAAAIsBAADZXgAA0AAAAP//AABoAAAAYQEAADMN +AABiAAAA//8AAGgAAACOAQAA6gUAANUAAAACAAAAIgAAADAAAAD3BQAA1gAAAP//AABoAAAAjwEA +AJIsAADlAAAA//8AAGgAAACTAQAAJQYAACMBAAAFAAAAIgAAAHAAAAA0BgAAJAEAAP//AABoAAAA +oAEAADgOAABfAQAA//8AAGgAAAB6AQAA6gUAAL0BAAAIAAAAIgAAADAAAAD3BQAA4QEAAP//AABo +AAAAfAEAACUGAAD2AQAACgAAACIAAABwAAAANAYAAA4CAAD//wAAaAAAAIABAABOXgAALgIAAP// +AABoAAAAhAEAAE5eAABXAgAA//8AAGgAAADkAQAAtgQAAG4AAAAAAAAAOgAAAJoCAADOBAAAbwAA +AP//AABoAAAA9AEAANleAAC8AAAA//8AAGgAAADFAQAAgyoAANcAAAD//wAAaAAAAPUBAADqBQAA +FwEAAAQAAAAiAAAAMAAAAPcFAAAYAQAA//8AAGgAAAD3AQAAJQYAAEgBAAAGAAAAIgAAAHAAAAA0 +BgAASQEAAP//AABoAAAA5gEAADgOAABzAQAA//8AAGgAAADXAQAA6gUAAO8BAAAJAAAAIgAAADAA +AAD3BQAAEwIAAP//AABoAAAA2QEAACUGAAAoAgAACwAAACIAAABwAAAANAYAACkCAAD//wAAaAAA +AN8BAABOXgAAgAIAAP//AABoAAAA+QQAAONAAADoAAAA//8AAGgAAAAaBQAA40AAAEACAAAAAAAA +bwAAAPgDAACPBAAA8QAAAAAAAABvAAAA/QMAAI8EAAB8AQAA//8AAGgAAAAFBQAAHGAAALsBAAAE +AAAAbwAAADgEAABoBQAAvAEAAP//AABoAAAAMgUAAONAAACKAwAAAQAAAG8AAAD4AwAAjwQAAEkC +AAABAAAAbwAAAP0DAACPBAAA0wIAAP//AABoAAAAJQUAABxgAAAxAwAACQAAAG8AAAA4BAAAaAUA +ABoDAAAGAAAAbwAAAPgDAACPBAAAlgMAAAYAAABvAAAA/QMAAI8EAAARBAAA//8AAGgAAAA1BQAA +jwQAACIEAAD//wAAcgAAAM0BAAC1DQAAgAAAAP//AAByAAAA0wEAANgNAACoAAAA//8AAHIAAADA +AQAAtQ0AAO0AAAD//wAAcgAAAMkBAADYDQAAFQEAAP//AAByAAAAtwEAALUNAABeAQAA//8AAHIA +AAC8AQAA2A0AAIgBAAD//wAAcgAAAAECAAAyYwAAKQMAAP//AAByAAAA6AEAAAgVAAAzAwAA//8A +AHIAAADpAQAA6gUAAEMDAAAIAAAAIgAAADAAAAD3BQAAUQMAAP//AAByAAAA6wEAACUGAABmAwAA +CgAAACIAAABwAAAANAYAAGcDAAD//wAAcgAAAO8BAADYDQAAkgMAAP//AAByAAAACAIAANgNAAD2 +AgAA//8AACUAAADEAwAAtQ0AAEoBAAD//wAAJQAAAM8DAADGDQAAxAEAAP//AAAlAAAA+wMAADMN +AAAHAgAA//8AACUAAAAFBAAAMw0AABkCAAD//wAAJQAAAAcEAAAzDQAAIgIAAP//AAAlAAAADwQA +ANgNAABTAgAA//8AACUAAAAUBAAA6Q0AANQCAAD//wAAJQAAACYEAAD+DQAAogMAAP//AAAlAAAA +KAQAAP4NAADIAwAA//8AACUAAAArBAAAEQ4AAPcDAAAJAAAAOgAAABsCAAAnDgAA+AMAAP//AAAl +AAAALQQAAOkNAABxBAAA//8AACUAAAA9BAAAOA4AANcFAAD//wAAJQAAAHsEAADYDQAAQAcAAP// +AAAlAAAAlQQAAE4OAAAqCAAA//8AADsAAACpAQAAGCYAADgAAAD//wAAOwAAAKkBAAAYJgAAOQAA +AP//AAA7AAAAuwEAAEEmAAD0AAAAAgAAADsAAABYAQAAXiYAAMAAAAACAAAAOwAAAFgBAAByJgAA +wAAAAP//AAA7AAAAzAEAAEEmAACdAQAABQAAADsAAABYAQAAciYAAKoBAAD//wAAOwAAALABAABB +JgAABAIAAAcAAAA7AAAAWAEAAF4mAADgAQAABwAAADsAAABYAQAAciYAAOABAAD//wAAOwAAAOUB +AAD8MAAAvQIAAAUAAAA7AAAAWAEAAF4mAACqAQAA//8AADsAAADVAQAAQSYAAPIEAAAMAAAAOwAA +AFgBAABeJgAANQUAAAwAAAA7AAAAWAEAAHImAAA1BQAA//8AAFMAAAA7CQAA6gUAABkAAAAAAAAA +IgAAADAAAAD3BQAAGAAAAP//AABTAAAAPgkAACUGAAAwAAAAAgAAACIAAABwAAAANAYAADEAAAD/ +/wAAUwAAAE8JAADsGwAASQAAAP//AABTAAAAUAkAACUGAABVAAA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AAAP//AABhAAAASgEAAH1aAABeAAAAAgAAAF8AAAAqAAAAGFkAAGcAAAADAAAAYAAAACoAAACp +VwAAaAAAAP//AABhAAAASgEAAJZaAABeAAAABQAAAF8AAAAsAAAAS1gAAHAAAAD//wAAYQAAAEwB +AAAOCAAArAAAAP//AABhAAAATAEAAKtZAACrAAAACAAAAF8AAABSAAAAS1gAALQAAAAJAAAAYAAA +AB4AAACpVwAAmwAAAAgAAABfAAAAVQAAAMdZAAC8AAAACwAAAGAAAAA0AAAAqVcAAL0AAAAIAAAA +XwAAAFYAAADiWQAAyQAAAA0AAABgAAAAMwAAAKlXAADKAAAA//8AACcAAABtAAAAoA4AAG8AAAD/ +/wAAJwAAAHEAAADSEAAApwAAAAEAAAAmAAAAvgAAAH8QAADeAAAA//8AACcAAAByAAAAlxEAAOoA +AAD//wAAJwAAAKUAAAAUEQAAKAEAAP//AAAnAAAAdQAAAI8EAADNAAAA//8AACcAAACbAAAAlxEA +ADABAAD//wAAJwAAAJsAAABoEAAAMAEAAAcAAAAmAAAALwQAAH8QAABAAQAA//8AACcAAACbAAAA +rxEAADABAAD//wAAJwAAAJAAAAAEEAAAlgEAAAoAAAAmAAAA0AAAAI8EAACpAQAA//8AACcAAAB+ +AAAAzhEAAMABAAD//wAAJwAAAIgAAACPBAAA/wEAAP//AAAnAAAApwAAAI8EAABuAgAA//8AACcA +AACuAAAAjwQAABcCAAD//wAALQAAAFEAAAC+FgAAGAAAAP//AAAtAAAAaQAAAIkXAABaAAAA//8A +AC0AAABtAAAAoBcAAIYAAAD//wAALQAAAHMAAADBFwAAWwEAAP//AAAtAAAAdwAAAOQXAACAAQAA +BAAAADgAAADZAAAABhgAAIIBAAD//wAALQAAAHoAAAAtGAAA7gEAAAYAAAA4AAAA8gAAAEwYAAAs +AgAA//8AAC0AAACHAAAAbxgAAGkDAAD//wAALQAAAIsAAADkFwAAjAMAAAkAAAA4AAAA2QAAAAYY +AACOAwAA//8AAC0AAACWAAAADhcAACMEAAD//wA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AAACGJgAAYAEAAP//AAA9AAAAhwAAAB80AADVAQAADgAAAD4AAABvAQAAPTQA +AI8BAAD//wAAPQAAAIYAAAB9GQAArgEAAP//AAA9AAAAhgAAAJ0mAACuAQAA//8AAD0AAACIAAAA +PTQAANgBAAD//wAAUwAAAAEUAAD2UQAAlQYAAP//AABTAAAAixMAABNSAABQAAAA//8AAFMAAACP +EwAAvwcAAHwAAAD//wAAUwAAAJsTAADqBQAACQEAAAMAAAAiAAAAMAAAAPcFAAAKAQAA//8AAFMA +AACzEwAAJQYAALACAAAFAAAAIgAAAHAAAAA0BgAAsQIAAP//AABTAAAAvRMAADADAABlAwAA//8A +AFMAAADBEwAACBUAAMQDAAD//wAAUwAAANATAAAJTQAA9wMAAP//AABTAAAA6xMAAOoFAAA+BQAA +CgAAACIAAAAwAAAA9wUAAD8FAAD//wAAUwAAAO8TAAAlBgAAsAUAAAwAAAAiAAAAcAAAADQGAACx +BQAA//8AAFMAAAD5EwAAHEoAADcGAAD//wAAUwAAAPwTAAAPSgAAZQYAAP//AABTAAAA/BMAAH4I +AACGBgAA//8AAFMAAAD9EwAA00cAAIsGAAAAAAAAUwAAAAcZAAArUgAAxQYAAP//AAAzAAAAjQMA +AKgaAAApAAAA//8AADMAAACQAwAAvwcAAIcAAAD//wAAMwAAAJIDAAC1DQAAngAAAP//AAAzAAAA +wwMAAHcbAADVAQAA//8AADMAAADVAwAAvwcAAGUCAAD//wAAMwAAANoDAAD5GgAAxgIAAP//AAAz +AAAA9wMAAOoFAACPBAAABgAAACIAAAAwAAAA9wUAAJAEAAD//wAAMwAAAPoDAAAlBgAArwQAAAgA +AAAiAAAAcAAAADQGAACwBAAA//8AADMAAAAFBAAAiRcAAMsEAAD//wAAMwAAAAYEAAAGGAAA1AQA +AP//AAAzAAAAIQQAAC0YAABSBQAADAAAADgAAADyAAAATBgAAJAFAAD//wAAMwAAACwEAACLGwAA +yQYAAP//AAAzAAAASwQAAH0aAACJDAAA//8AADMAAABMBAAAfRoAAA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AA//8AACcAAADEAQAAjwQAAIQBAAD//wAAJwAAAI8BAACPBAAAYgEAAP//AAAnAAAA +jwEAAI8EAABiAQAA//8AACcAAACRAQAAzhEAAN0BAAD//wAAJwAAAJkBAADlEAAADQIAAP//AAAn +AAAAqAEAAI8EAADIAgAA//8AACcAAACpAQAAjwQAANECAAD//wAANgAAADcCAAApJQAARgAAAAAA +AABAAAAAKgAAAEAlAAA9AAAAAAAAAEAAAAAvAAAAWSUAAD8AAAD//wAANgAAAGYCAAAYJgAAnAAA +AP//AAA2AAAAZwIAACsmAAB8AAAA//8AADYAAABqAgAAQSYAAFYBAAAFAAAAOwAAAFgBAABeJgAA +IAEAAAUAAAA7AAAAWAEAAHImAAAgAQAA//8AADYAAABqAgAAhiYAAFYBAAD//wAANgAAAJsCAAAp +JQAAFAIAAAkAAABAAAAALwAAAFklAAB6AgAACQAAAEAAAAAqAAAAQCUAAEMCAAD//wAANgAAAHUC +AACdJgAA2wEAAP//AAA2AAAAtwIAAJ0mAAArAgAA//8AADYAAACcAgAAryYAAJICAAAOAAAANgAA +AFwCAAAlBgAAVQIAAA8AAAAiAAAAcAAAADQGAACkAgAA//8AADYAAACkAgAA1iYAAM4CAAARAAAA +NgAAAFcCAADqBQAA3wIAABIAAAAiAAAAMAAAAPcFAADuAgAA//8AADYAAACtAgAAQSYAAA4DAAAU +AAAAOwAAAFgBAABeJgAAIAMAABQAAAA7AAAAWAEAAHImAAAgAwAA//8AADoAAAB8BAAAZC4AAFgA +AAD//wAAOgAAAHcEAAAIFQAANQAAAP//AAA6AAAAfQQAAOoFAABfAAAAAgAAACIAAAAwAAAA9wUA +AGEAAAD//wAAOgAAAH8EAAAlBgAAhgAAAAQAAAAiAAAAcAAAADQGAACHAAAA//8AADoAAACFBAAA +fy4AAOYAAAD//wAAOgAAAJAEAADqBQAA/QAAAAcAAAAiAAAAMAAAAPcFAAAcAQAA//8AADoAAACc +BAAAJQYAAGkBAAAJAAAAIgAAAHAAAAA0BgAAagEAAP//AAA6AAAAuwQAACUGAAC/AQAACwAAACIA +AABwAAAANAYAAMABAAD//wAAOgAAAMAEAACeLgAAtwEAAA0AAAA6AAAAFwYAALQuAAAqAgAA//8A +ADoAAADFBAAA0S4AAHkCAAD//wAAOgAAAMkEAAC0LgAApwIAAP//AAA6AAAAzgQAAL4WAADAAgAA +//8AADoAAADtBAAAtC4AAGoDAAD//wAAOgAAABYFAAA4DgAAdwMAAP//AAA6AAAA9AQAALoPAACb +AwAA//8AADoAAAAeBQAAyyEAALsEAAD//wAAOgAAAB4FAAA4DgAAvAQAABUAAAA6AAAAtAIAAM4E +AADGBAAA//8AACsAAABWBgAAJQUAADcAAAD//wAAKwAAAKYGAAANFgAAlQAAAP//AAArAAAArgYA +AA0WAACqAAAA//8AACsAAAAGBwAAHxYAAMgAAAD//wAAKwAAAAkHAAAlBQAACQEAAP//AAArAAAA +HQcAAB8WAAAmAQAA//8AACsAAAAgBwAAJQUAAGsBAAD//wAAKwAAAEYGAAAlBQAA6QEAAP//AAAr +AAAATwYAACUFAAAbAgAA//8AACsAAACOBgAAJQUAAHkCAAD//wAAKwAAACgHAAAlBQAAuwIAAP// +AAArAAAAKgcAACUFAADRAgAA//8AACsAAAARBwAAJQUAAAcDAAD//wAAKwAAABMHAAAlBQAADwMA +AP//AAArAAAAsgYAAA0WAAB1AwAA//8AACsAAADwBgAAJQUAAH8EAAD//wAAKwAAAOkGAAAlBQAA +nAQAAP//AAArAAAAqgYAAA0WAAAqBQAA//8AACsAAACCBgAAJQUAAFEFAAD//wAAKwAAAGYGAAAl +BQAAnAUAAP//AAArAAAAaQYAACUFAACqBQAA//8AACsAAAByBgAAJQUAAN0FAAD//wAAKwAAAHgG +AAAlBQAAAQYAAP//AAArAAAARQcAACUFAAAxBgAA//8AACsAAAA8BwAAJQUAAFkGAAD//wAAJgAA +AFICAACgDgAAfAAAAP//AAAmAAAAVgIAANIQAAC9AAAAAQAAACYAAAC+AAAAfxAAAAABAAD//wAA +JgAAAFcCAACXEQAADAEAAP//AAAmAAAAWwIAABQRAABPAQAA//8AACYAAABaAgAAjwQAAOwAAAD/ +/wAAJgAAAIcCAACXEQAAbQEAAP//AAAmAAAAhwIAAGgQAABtAQAABwAAACYAAAAvBAAAfxAAAIAB +AAD//wAAJgAAAIcCAACvEQAAbQEAAP//AAAmAAAAfAIAAAQQAACGAQAACgAAACYAAADQAAAAjwQA +AOoBAAD//wAAJgAAAGQCAADOEQAAKQIAAP//AAAmAAAAZgIAAI8EAAAwAgAA//8AACYAAABnAgAA +jwQAAD8CAAD//wAAJgAAAG4CAACPBAAAiAIAAP//AAAmAAAAbwIAAEYRAACiAgAA//8AACYAAAB2 +AgAA3hEAAA0DAAD//wAAJgAAAHkCAACPBAAAJQMAAP//AAAmAAAAkAIAAI8EAABsAwAA//8AACYA +AACRAgAAjwQAAG0DAAD//wAAJgAAAJUCAABGEQAAqQMAAP//AAAmAAAAlgIAAKAOAACwAwAA//8A +ACYAAACaAgAAZREAAAgEAAD//wAAJgAAAJsCAACgDgAADwQAAP//AAAmAAAApwIAAGURAAChBAAA +//8AAE4AAABRAwAA9EAAABwAAAAAAAAATgAAADwDAACPBAAAKAAAAP//AABOAAAAUgMAAPRAAABU +AAAAAgAAAE4AAAA8AwAAjwQAAGIAAAD//wAATgAAAFMDAAD0QAAApQAAAAQAAABOAAAAPAMAAI8E +AAC9AAAA//8AAE4AAABZAwAA9EAAADUBAAD//wAATgAAAFoDAAD0QAAAYgEAAP//AABOAAAAWwMA +APRAAACFAQAA//8AAE4AAABpAwAAQUAAACACAAAJAAAATgAAAIYBAACPBAAAIgIAAP//AABOAAAA +eQMAACdBAABzAgAABgAAAE4AAAA8AwAAjwQAAA4DAAAHAAAATgAAADwDAACPBAAAVwMAAAgAAABO +AAAAPAMAAI8EAAChAwAA//8AAE4AAABwAwAA9EAAALAEAAAPAAAATgAAADwDAACPBAAAvwUAAP// +AABOAAAAbgMAAPRAAABMAgAA//8AAE4AAABvAwAA9EAAAIQEAAARAAAATgAAADwDAACPBAAAEgUA +ABIAAABOAAAAPAMAAI8EAABqBQAA//8AAE4AAABhAwAA9EAAAF8GAAD//wAATgAAAGIDAAD0QAAA +dAYAAP//AABOAAAAYwMAAPRAAACJBgAAFQAAAE4AAAA8AwAAjwQAAKsGAAAWAAAATgAAADwDAACP +BAAA0AYAABcAAABOAAAAPAMAAI8EAAD0BgAA//8AACYAAABzBAAAPxIAACYAAAAAAAAAJgAAAE4E +AADlEAAARAAAAAAAAAAmAAAAUQQAAH8QAAAOAQAA//8AACYAAAB0BAAAAhEAAGQAAAD//wAAJgAA +AHsEAACPBAAAlAAAAP//AAAmAAAAfAQAAI8EAACqAAAA//8AACYAAAB9BAAAjwQAAK8AAAD//wAA +JgAAAH8EAADlEAAAzQAAAP//AAAmAAAAgwQAAI8EAADPAAAA//8AACYAAACEBAAAjwQAAOwAAAD/ +/wAAJgAAAIUEAACPBAAA9AAAAP//AAAmAAAAiAQAAAQQAABlAQAACwAAACYAAADQAAAAjwQAAFUB +AAD//wAAJgAAAIkEAACPBAAAbwEAAP//AAAmAAAAigQAAI8EAABwAQAA//8AACYAAADVBAAAjwQA +AJoBAAD//wAAJgAAANgEAACPBAAApQEAAP//AAAmAAAAiwQAAI8EAACDAQAA//8AACYAAACLBAAA +jwQAAIMBAAD//wAAJgAAAI0EAADOEQAABAIAAP//AAAmAAAAlQQAAEYRAAAgAgAA//8AACYAAACZ +BAAA5RAAAEcCAAD//wAAJgAAAJ0EAABsEgAAaAIAAP//AAAmAAAAwAQAAEYRAAAXBAAA//8AACYA +AACqBAAAFBEAAOYCAAD//wAAJgAAALwEAACPBAAAnAMAAP//AAAmAAAAvQQAAI8EAAChAwAA//8A +ACYAAADFBAAAZREAAKEEAAD//wAAUwAAAJwMAAD+BgAAGAAAAP//AABTAAAApwwAAGkcAABFAAAA +//8AAFMAAACyDAAA5gYAAJ4AAAD//wAAUwAAALMMAADmBgAApAAAAP//AABTAAAAvgwAAOoFAADa +AAAABAAAACIAAAAwAAAA9wUA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hUAAL8HAABaAgAA//8AAFMAAAAaFQAA +vUcAAKkCAAD//wAAUwAAAB0VAAD+BgAA8gIAAP//AABTAAAASxUAAE4OAAByAwAA//8AAFMAAABM +FQAA6gUAAL8DAAAWAAAAIgAAADAAAAD3BQAAwAMAAP//AABTAAAATxUAANAGAADgAwAAGAAAAFMA +AACQGAAA5gYAAPIDAAD//wAAUwAAAFEVAAAlBgAABQQAABoAAAAiAAAAcAAAADQGAAAGBAAA//8A +ADsAAABnAwAAQCUAABoAAAD//wAAOwAAAGwDAABAJQAAUQAAAP//AAA7AAAAdgMAABgmAACNAAAA +//8AADsAAAB2AwAAGCYAAI4AAAD//wAAOwAAAHcDAACGJgAAjwAAAP//AAA7AAAAdwMAAIYmAACQ +AAAA//8AADsAAAB+AwAAQSYAAPMAAAAGAAAAOwAAAFgBAABeJgAAwAAAAAYAAAA7AAAAWAEAAHIm +AADAAAAA//8AADsAAAB+AwAAXzIAAPMAAAD//wAAOwAAAHsDAABBJgAAQgEAAAoAAAA7AAAAWAEA +AF4mAAAjAQAACgAAADsAAABYAQAAciYAACMBAAD//wAAOwAAAHsDAABfMgAAQgEAAP//AAA7AAAA +cwMAAEEmAACBAQAADgAAADsAAABYAQAAXiYAAGEBAAD//wAAOwAAAHIDAAAYJgAAWQEAAA4AAAA7 +AAAAWAEAAHImAABhAQAA//8AADsAAABzAwAAhiYAAIEBAAD//wAAOwAAAHMDAAB6MgAAgQEAABMA +AAA+AAAAXgEAAJYyAACOAQAA//8AADsAAACAAwAAQSYAAB4CAAAVAAAAOwAAAFgBAAByJgAADAIA +AP//AAA7AAAAgAMAALAyAAAeAgAAFQAAADsAAABYAQAAXiYAAAwCAAD//wAAOwAAAIIDAABBJgAA +egIAABkAAAA7AAAAWAEAAF4mAABgAgAAGQAAADsAAABYAQAAciYAAGACAAD//wAAOwAAAIIDAABf +MgAAegIAAP//AAArAAAAWAMAAOEEAACLAAAAAAAAACsAAAA/AQAAzgQAADwAAAD//wAAKwAAAC0F +AADhBAAAMAQAAP//AAArAAAA0AMAAM4EAAC5AAAA//8AACsAAABaBAAAaAUAAHcBAAD//wAAKwAA +APMDAABoBQAA+gAAAP//AAArAAAAuQMAAA8FAADEAgAA//8AACsAAAC5AwAADwUAAMQCAAAHAAAA +KwAAAK0BAAAlBQAArgIAAP//AAArAAAAwQMAAA8FAAAKAwAACQAAACsAAACtAQAAJQUAAAUDAAD/ +/wAAKwAAAEEFAAAPBQAAuwQAAP//AAArAAAAQQUAAA8FAAC7BAAADAAAACsAAACtAQAAJQUAAIsE +AAD//wAAKwAAAEMFAABoBQAA1gQAAP//AAArAAAAUgUAAGgFAABoBQAA//8AACsAAABcBQAADwUA +AP4FAAAQAAAAKwAAAK0BAAAlBQAA4wUAAP//AAArAAAAWwUAAGgFAADMBQAA//8AACsAAABcBQAA +DwUAAP4FAAD//wAAKwAAAGAEAAAlBQAAYAYAAP//AAArAAAAkwQAACUFAAAIBwAA//8AACsAAACx +BAAAJQUAAF4HAAD//wAAKwAAAP8EAAAlBQAAqgcAAP//AAArAAAA2gQAACUFAAA4CAAA//8AACsA +AADxBAAAJQUAAIIIAAD//wAAKwAAAM8EAAAlBQAA+wcAAP//AAArAAAAFAUAACUFAABbCQAA//8A +ACsAAAAYBQAAJQUAAJUJAAD//wAAKwAAADkEAAAlBQAAdwoAAP//AABTAAAAmQoAAAgVAAAuAAAA +//8AAFMAAAC0CgAA6gUAAAMBAAABAAAAIgAAADAAAAD3BQAABAEAAP//AABTAAAAtgoAACUGAAAt +AQAAAwAAACIAAABwAAAANAYAAC4BAAD//wAAUwAAAMMKAAC9RwAAVAEAAP//AABTAAAAxAoAAP4G +AAB9AQAA//8AAFMAAADxCgAA9hgAANwBAAAHAAAAMwAAADsFAABFGwAAbgIAAAcAAAAzAAAAPgUA +ABIZAACDAgAA//8AAFMAAADyCgAAaCMAAL0CAAD//wAAUwAAABkLAADqBQAAQAMAAAsAAAAiAAAA +MAAAAPcFAABBAwAA//8AAFMAAAAbCwAAJQYAAG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AwAAEwAA +ACsAAAAPAwAA/g0AAGwDAAD//wAAOAAAACsCAAAaFAAAwgAAAP//AAA4AAAAWAIAAA4XAABSBQAA +//8AADgAAABaAgAAoBcAAMAFAAD//wAAOAAAAHICAAA4DgAAVAYAAP//AAA4AAAAfgIAAA4XAADF +BgAA//8AADgAAAAKAgAA/g0AADoDAAD//wAAOAAAAPoBAACwKgAA6wkAAP//AAA4AAAA6gEAAEAZ +AAAKCQAA//8AADgAAADqAQAAQBkAAAoJAAD//wAAOAAAAPABAADMKgAAoAkAAP//AAA4AAAA+QEA +ALAqAACyCQAA//8AADgAAADFAQAAoCkAAA0CAAD//wAAOAAAAMkBAAA4DgAAmgoAAP//AAA4AAAA +0QEAAL4pAACnCgAA//8AADgAAADLAQAA2ykAAL0KAAD//wAAYQAAADYCAABOWwAAzQAAAP//AABh +AAAAOwIAAH1aAABxAQAAAQAAAF8AAAAqAAAAGFkAAGgBAAACAAAAYAAAACoAAACpVwAAaQEAAP// +AABhAAAAQAIAAE5bAACgAQAA//8AAGEAAABKAgAATlsAAOkBAAD//wAAYQAAAEsCAABpWwAA/QEA +AAYAAABfAAAALgAAAIJbAAD4AQAA//8AAGEAAABMAgAAfVoAABUCAAAIAAAAXwAAACoAAAAYWQAA +DAIAAAkAAABgAAAAKgAAAKlXAAANAgAA//8AAGEAAABYAgAATlsAAGACAAD//wAAYQAAAFgCAACd +WwAAYAIAAP//AABhAAAAaQIAAOYGAADfAgAA//8AAGEAAAB1AgAAfVoAABIDAAAOAAAAXwAAACoA +AAAYWQAAygMAAA8AAABgAAAAKgAAAKlXAADLAwAA//8AAGEAAAB1AgAATlsAABIDAAD//wAAYQAA +AIcCAAB9WgAA3wQAABIAAABfAAAAKgAAABhZAADnBAAAEwAAAGAAAAAqAAAAqVcAAOgEAAD//wAA +YQAAAB4CAAB9WgAATgAAABUAAABfAAAAKgAAABhZAABuBQAAFgAAAGAAAAAqAAAAqVcAAG8FAAD/ +/wAAYQAAAB4CAACWWgAATgAAAB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QAA//8AABwAAAA2AAAALAoAAFsBAAAdAAAAHAAAAFwAAAA3CgAAyAEAAP//AAAcAAAANgAA +ACwKAABbAQAAHwAAABwAAABcAAAANwoAAMkBAAD//wAAHAAAADYAAAByCgAAWwEAAP//AAAcAAAA +NwAAACwKAAA/AAAAIgAAABwAAABcAAAANwoAAM0BAAD//wAAHAAAADcAAAAsCgAAPwAAACQAAAAc +AAAAXAAAADcKAADOAQAA//8AABwAAAA3AAAAcgoAAD8AAAD//wAAHAAAADgAAAAsCgAAQgAAACcA +AAAcAAAAXAAAADcKAADSAQAA//8AABwAAAA4AAAALAoAAEIAAAApAAAAHAAAAFwAAAA3CgAA0wEA +AP//AAAcAAAAOAAAAHIKAABCAAAA//8AABwAAAA5AAAAjwQAAMcBAAAIDxAVFhgcHiImMlV42N3/ +AwQoATgxSRJVBY8HlAfgP/8B//8ACqAASZIkAFVVAQD+/wMAIEmSJP////8AAAD/AQBwBAKAQGYA +AAAAVVVVVVVVVQWTJAEAIElKoQUAAAARBICBAAkAAAAAIwH///////////////////////////// +//////////////////8AIEny/////////////////////////w8AAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAOT///////////////////8fAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABB/ +////f0VQRIRERMAiCgAAAG7+A45AABDIDCIIAAMBEoEjCiMBgT4P/SCB2wUCAYHtB38BAQEBAQEB +AQEBAQEBAQEBfwICAgICAgICAgICAgICAgJ/BAQEBAQEBAQEBAQEBAQEBH8ICAgICAgICAgICAgI +CAgIfxAQEBAQEBAQEBAQEBAQEBB/ICAgICAgICAgICAgICAgIH9AQEBAQEBAQEBAQEBAQEBAf4CA +gICAgICAgICAgICAgAB/AQEBAQEBAQEBAQEBAQEBAX8CAgICAgICAgICAgICAgICfwQEBAQEBAQE +BAQEBAQEBAR/CAgICAgICAgICAgICAgICH8QEBAQEBAQEBAQEBAQEBAQfyAgICAgICAgICAgICAg +ICB/QEBAQEBAQEBAQEBAQEBAQGmAgICAgICAgICAgICAAIGQQH8BJEn+//////////////9/f/// +/////////////////39/////////////////////f3////////////////////9/f/////////// +/////////39/////////////////////f3////////////////////9/f/////////////////// +/39/////////////////////f3////////////////////9/f////////////////////39///// +////////////////f3////////////////////9/f////////////////////39///////////// +////////f3////////////////////9/f////////////////////39///////////////////// +f3////////////////////9/f////////////////////39/////////////////////f3////// +//////////////9/f////////////////////39/////////////////////f3////////////// +//////9/f////////////////////39/////////////////////f3////////////////////9/ +f////////////////////39/////////////////////f3////////////////////9/f/////// +/////////////39/////////////////////f3////////////////////9/f/////////////// +/////39/////////////////////f3////////////////////9/f////////////////////39/ +////////////////////f3////////////////////9/f////////////////////39///////// +////////////f3////////////////////9/f////////////////////39///////////////// +////f3////////////////////9/f////////////////////39/////////////////////f3// +//////////////////9/f////////////////////39/////////////////////f3////////// +//////////9/f////////////////////39/////////////////////f3////////////////// +//9/f////////////////////39/////////////////////f3////////////////////9/f/// +/////////////////39/////////////////////f3////////////////////9/f/////////// +/////////39/////////////////////f3////////////////////9/f///////////////ESMY +ARB/gCQghBAghBAghBAghBAgBH8hQAghQAghQAghQAghQAghf4AQQoAQQoAQQoAQQoAQQgB/IYQA +IYQAIYQAIYQAIYQAIX8IAUIIAUIIAUIIAUIIAUIIfwKEEAKEEAKEEAKEEAKEEAJ/CCEECCEECCEE +CCEECCEECH9CCBBCCBBCCBBCCBBCCBBCfxAghBAghBAghBAghBAghBB/QAghQAghQAghQAghQAgh +QH8QQoAQQoAQQoAQQoAQQoAQf4QAIYQAIYQAIYQAIYQAIQR/AUIIAUIIAUIIAUIIAUIIAX+EEAKE +EAKEEAKEEAKEEAIEfyEECCEECCEECCEECCEECCF/CBBCCBBCCBBCCBBCCBBCCH8ghBAghBAghBAg +hBAghBAgfwghQAghQAghQAghQAghQAh/QoAQQoAQQoAQQoAQQoAQQn8AIYQAIYQAIYQAIYQAIYQA +f0IIAUIIAUIIAUIIAUIIAUJ/EAKEEAKEEAKEEAKEEAKEEH8ECCEECCEECCEECCEECCEEfxBCCBBC +CBBCCBBCCBBCCBB/hBAghBAghBAghBAghBAgBH8hQAghQAghQAghQAghYMgQJUOGDDEEAH9WlVWp +qapGRERERFCVWVVVf6oqqqqqbdu2bdu2paqqqip/VVVFVVVVVVVVVVVVVVVVSX8kSZIkSZIkSZIk +SZIkSZIkf5IkSZIkSZIk/P///////39/////////////////////f3////////////////////9/ +f////////////////////39G//////////8/AGdvMS4xNwAAAAAAAAAAsD78qfHSTWJQP3sUrkfh +eoQ/AAAAAAAA0D8zMzMzMzPTPwAAAAAAAOA/MzMzMzMz4z8AAAAAAADsP2ZmZmZmZu4/AAAAAAAA +8D+amZmZmZnxPzMzMzMzM/M/AAAAAAAAFEAAAAAAAAAkQAAAAAAAADpAAAAAAAAAWUAAAAAAAIjD +QAAAAAAAAPBAAAAAANASY0EAAAAAAADgQwAAAAAAAPB/AAAAAAAAAIAzMzMzMzPTv+85+v5CLua/ +AN1CAAAAAAACAAAAAAAAAAEAAAAAAAAAAQAAAAYAAAAAAAAAAAAAAAIAAAAIAAAAAQEAAAAAAAAC +AAAABgAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAIAAAAGAAAAAwMAAAAAAAACAAAAAgAAAAAA +AAAAAAAAAgAAAAIAAAAAAAAAAAAAAIwkRgAAAAAADgAAAAAAAAClPUYAAAAAABsAAAAAAAAAij1G +AAAAAAAbAAAAAAAAAB49RgAAAAAAGwAAAAAAAABvPUYAAAAAABsAAAAAAAAAqjNGAAAAAAAWAAAA +AAAAAKcuRgAAAAAAFAAAAAAAAADlNEYAAAAAABcAAAAAAAAAhlJGAAAAAAAlAAAAAAAAAChFRgAA +AAAAHgAAAAAAAADnV0YAAAAAACoAAAAAAAAANh1GAAAAAAAKAAAAAAAAAGNhbGwgZnJhbWUgdG9v +IGxhcmdlAAAAAAA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AAAAAAAQAAAAAAAADA////QAAAAEAAAAAA +AAAAOl9HAAAAAAABAAAAAAAAAMD///9AAAAAQAAAAAAAAAA6X0cAAAAAAAEAAAAAAAAA4P///yAA +AAAgAAAAAAAAAChoRgAAAAAAAQAAAAAAAADw////EAAAABAAAAAAAAAACGhGAAAAAAABAAAAAAAA +AND///8wAAAAMAAAAAAAAAA1X0cAAAAAAAEAAAAAAAAA4P///yAAAAAQAAAAAAAAAAhoRgAAAAAA +AQAAAAAAAADw////EAAAAAgAAAAAAAAA+GdGAAAAAAABAAAAAAAAAOj///8YAAAAEAAAAAAAAAAI +aEYAAAAAAAEAAAAAAAAA8P///xAAAAAIAAAAAAAAAPhnRgAAAAAAAQAAAAAAAADw////EAAAAAgA +AAAAAAAA+GdGAAAAAAABAAAAAAAAAPD///8QAAAACAAAAAAAAAD4Z0YAAAAAAAEAAAAAAAAA6P// +/xgAAAAQAAAAAAAAAAhoRgAAAAAAAQAAAAAAAADo////GAAAABAAAAAAAAAACGhGAAAAAAABAAAA +AAAAAOj///8YAAAAGAAAAAAAAAAwaEYAAAAAAAEAAAAAAAAA8P///xAAAAAQAAAAAAAAAAhoRgAA +AAAAAQAAAAAAAADw////EAAAABAAAAAAAAAACGhGAAAAAAABAAAAAAAAAPD///8QAAAAEAAAAAAA +AAAIaEYAAAAAAAEAAAAAAAAAqP///1gAAABYAAAAAAAAADxfRwAAAAAAAQAAAAAAAADo////GAAA +AAgAAAAAAAAA+GdGAAAAAAABAAAAAAAAAPD///8QAAAAEAAAAAAAAAAIaEYAAAAAAAEAAAAAAAAA +8P///xAAAAAQAAAAAAAAAAhoRgAAAAAAAQAAAAAAAADw////EAAAAAgAAAAAAAAA+GdGAAAAAAAB +AAAAAAAAAMj///84AAAAMAAAAAAAAADlFEYAAAAAAAEAAAAAAAAA6P///xgAAAAQAAAAAAAAAAho +RgAAAAAAAQAAAAAAAADw////EAAAABAAAAAAAAAACGhGAAAAAAABAAAAAAAAAPD///8QAAAAEAAA +AAA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AA +AAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAD/////AAAAAAAAAAAAAAAA//////8AAAAAAAAAAAAA +AP///////wAAAAAAAAAAAAD/////////AAAAAAAAAAAA//////////8AAAAAAAAAAP////////// +/wAAAAAAAAD/////////////AAAAAAAA//////////////8AAAAAAP///////////////wAAAAD/ +////////////////AAAA//////////////////8AAP///////////////////wAAAAAAAAAAAAAA +AAAAAAAAD////////////////////w4P//////////////////8NDg//////////////////DA0O +D////////////////wsMDQ4P//////////////8KCwwNDg//////////////CQoLDA0OD/////// +/////wgJCgsMDQ4P//////////8HCAkKCwwNDg//////////BgcICQoLDA0OD////////wUGBwgJ +CgsMDQ4P//////8EBQYHCAkKCwwNDg//////AwQFBgcICQoLDA0OD////wIDBAUGBwgJCgsMDQ4P +//8BAgMEBQYHCAkKCwwNDg//QxVGAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGFUYAAAAA +AAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEkVRgAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +uBVGAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAFUYAAAAAAAQAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAMQVRgAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA5BVGAAAAAAAEAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAABSFUYAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEbRgAAAAAACQAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAVBdGAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFkYA +AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALIWRgAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAtxZGAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC8FkYAAAAAAAUAAAAAAAAAAAAAAAAA +AAAAAAAAAA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F0YWxwYW5p +Yy5mdW5jMQBydW50aW1lLnN0YXJ0cGFuaWNfbQBydW50aW1lLmRvcGFuaWNfbQBydW50aW1lLnNp +Z25hbWUAcnVudGltZS5nb3RyYWNlYmFjawBydW50aW1lLnNob3VsZFB1c2hTaWdwYW5pYwBydW50 +aW1lLmlzQWJvcnRQQwBydW50aW1lLnN1c3BlbmRHAHJ1bnRpbWUucHJlZW1wdE0AcnVudGltZS5k +dW1wZ3N0YXR1cwBydW50aW1lLnJlc3VtZUcAcnVudGltZS5hc3luY1ByZWVtcHQyAHJ1bnRpbWUu +aW5pdC42AHJ1bnRpbWUuaXNBc3luY1NhZmVQb2ludABydW50aW1lLmNhblByZWVtcHRNAHJ1bnRp +bWUucmVjb3JkRm9yUGFuaWMAcnVudGltZS5wcmludGxvY2sAcnVudGltZS5nd3JpdGUAcnVudGlt +ZS53cml0ZUVycgBydW50aW1lLnByaW50c3AAcnVudGltZS5wcmludG5sAHJ1bnRpbWUucHJpbnRi +b29sAHJ1bnRpbWUucHJpbnRmbG9hdABydW50aW1lLnByaW50Y29tcGxleABydW50aW1lLnByaW50 +dWludABydW50aW1lLnByaW50aW50AHJ1bnRpbWUucHJpbnRoZXgAcnVudGltZS5wcmludHBvaW50 +ZXIAcnVudGltZS5wcmludHVpbnRwdHIAcnVudGltZS5wcmludHN0cmluZwBydW50aW1lLmJ5dGVz +AHJ1bnRpbWUucHJpbnRzbGljZQBydW50aW1lLmhleGR1bXBXb3JkcwBydW50aW1lLm1haW4AcnVu +dGltZS5sb2NrT1NUaHJlYWQAcnVudGltZS5kb2xvY2tPU1RocmVhZABydW50aW1lLm1haW4uZnVu +YzIAcnVudGltZS5pbml0LjcAcnVudGltZS5mb3JjZWdjaGVscGVyAHJ1bnRpbWUuZ29wYXJrAHJ1 +bnRpbWUuZ29yZWFkeQBydW50aW1lLmdvcmVhZHkuZnVuYzEAcnVudGltZS5hY3F1aXJlU3Vkb2cA +cnVudGltZS5yZWxlYXNlU3Vkb2cAcn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vcmsAcnVudGltZS4oKmxvY2tSYW5rKS5TdHJpbmcAcnVudGltZS4oKndh +aXRSZWFzb24pLlN0cmluZwB0eXBlLi5lcS5ydW50aW1lLmVycm9yQWRkcmVzc1N0cmluZwBydW50 +aW1lLigqZXJyb3JBZGRyZXNzU3RyaW5nKS5FcnJvcgBydW50aW1lLigqcGxhaW5FcnJvcikuRXJy +b3IAbWFpbi5tYWluAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQwAAAAAAAAD/////FAAAACwA +AABDAAAA////////////////UwAAAEMAAAD//////////////////////////30AAACdAAAAvgAA +AN0AAABDAAAAQwAAAAABAAAjAQAA/////08BAABjAQAAfAEAAP////+hAQAA/AEAAP////////// +//////////9eAgAAeAIAAP//////////ogIAAP//////////TwYAALcCAADMAgAA/////68DAAD/ +////wwMAAN0CAAD/////jwQAAO8CAAAQAwAAIwMAAAwCAAA8AwAAIgIAALUBAADUAwAA9AMAAP// +////////CgQAANgBAAB6AwAALwQAAFcEAABQAwAA/////20EAABlAwAAjAMAAMgEAAAABQAAJgUA +ANsEAABDBAAApAQAAOsBAAByBQAAtQUAAIgFAACeBQAA0QUAAF8FAAD/////4wMAAPcFAAA9BQAA +PQEAAAsGAAAjBgAANgYAAGsGAAB/BgAA////////////////mwYAAP/////DBgAA/////7cEAAA6 +AgAAEAcAAP//////////////////////////mwMAAEoCAAAjBwAApwcAAH8EAAA2BwAATgcAAKwG +AABsBwAA////////////////gAcAAP/////vBAAAFAUAAMcBAADrBgAA////////////////jwEA +AP/////9BgAATwUAAIsCAAD//////////x4EAADiBQAAAAMAAA8BAAD//////////5EHAAD///// +1gYAAP////8AAAAA//////////8UAAAA/////////////////////////////////////1MAAAC5 +BwAAzQcAAOIHAAD5BwAAEQgAACkIAABDCAAAXQgAAEMAAAB4CAAAAAAAAAAAAAAAAAAAAAAAAAAA +AABpbnRlcm5hbC9jcHUvY3B1LmdvAGludGVybmFsL2NwdS9jcHVfeDg2LmdvAGludGVybmFsL2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UAAAAAAHEAAAAAAAAAOVsAABIAAQAAUEUAAAAAAHEAAAAAAAAAUFsAABIAAQCAUEUA +AAAAAEMAAAAAAAAAaFsAABIAAQDgUEUAAAAAALMAAAAAAAAAg1sAABIAAQCgUUUAAAAAAG8AAAAA +AAAAoFsAABIAAQAgUkUAAAAAAGQAAAAAAAAAxFsAABIAAQCgUkUAAAAAAHcAAAAAAAAA6FsAABIA +AQAgU0UAAAAAAEwAAAAAAAAABFwAABIAAQCAU0UAAAAAAAEAAAAAAAAADlwAABEACQDAgEsAAAAA +ABgAAAAAAAAAHVwAABEACQCggksAAAAAAGAAAAAAAAAAL1wAABEADADynk4AAAAAAAEAAAAAAAAA +QlwAABEADABAo04AAAAAAIAAAAAAAAAAVlwAABEADABAoU4AAAAAACAAAAAAAAAAZlwAABEADADs +nk4AAAAAAAEAAAAAAAAAdFwAABEADADknk4AAAAAAAEAAAAAAAAAiVwAABEACgCokUsAAAAAAAgA +AAAAAAAAm1wAABEADABIoE4AAAAAAAgAAAAAAAAArFwAABEADAD1nk4AAAAAAAEAAAAAAAAAwVwA +ABEADAD2nk4AAAAAAAEAAAAAAAAA1VwAABEADAD0nk4AAAAAAAEAAAAAAAAA51wAABEADADjnk4A +AAAAAAEAAAAAAAAA+1wAABEADADink4AAAAAAAEAAAAAAAAAE10AABEADADxnk4AAAAAAAEAAAAA +AAAAKV0AABEACwCg1UsAAAAAAHAfAAAAAAAAOV0AABEACwDgs0sAAAAAAAgAAAAAAAAATV0AABEA +CwDos0sAAAAAAAgAAAAAAAAAY10AABEACgCAlUsAAAAAAJAAAAAAAAAAe10AABEACgAAlUsAAAAA +AIAAAAAAAAAAll0AABEACgBgkksAAAAAABAAAAAAAAAAq10AABEACQBAhUsAAAAAAAgBAAAAAAAA +wV0AABEADAAIoE4AAAAAAAgAAAAAAAAAzV0AABEADAAYoE4AAAAAAAgAAAAAAAAA3l0AABEACgCw +kUsAAAAAAAgAAAAAAAAA8F0AABEACgCAo0sAAAAAABAQAAAAAAAABl4AABEACgAAk0sAAAAAABAA +AAAAAAAAGl4AABEACgAQk0sAAAAAABAAAAAAAAAALl4AABEACgAgk0sAAAAAABAAAAAAAAAAQl4A +ABEACgDwkksAAAAAABAAAAAAAAAAVl4AABEACgDgkksAAAAAABAAAAAAAAAAaV4AABEACwCAtEsA +AAAAAAgAAAAAAAAAfF4AABEACwCItEsAAAAAAAgAAAAAAAAAj14AABEACwCQtEsAAAAAAAgAAAAA +AAAAol4AABEACwBotEsAAAAAAAgAAAAAAAAAtV4AABEACwBgtEsAAAAAAAgAAAAAAAAAx14AABEA +CQCgiUsAAAAAAAAIAAAAAAAA3V4AABEACgBwk0sAAAAAABgAAAAAAAAA714AABEADACIoE4AAAAA +AAgAAAAAAAAABF8AABEADACAoE4AAAAAAAgAAAAAAAAAHV8AABEADAB4oE4AAAAAAAgAAAAAAAAA +N18AABEADADwoE4AAAAAAAgAAAAAAAAASF8AABEADAAQoU4AAAAAABgAAAAAAAAAXF8AABEADABw +oE4AAAAAAAgAAAAAAAAAdV8AABEADABAsk4AAAAAAAAEAAAAAAAAhV8AABEADABgpE4AAAAAAIgA +AAAAAAAAmF8AABEADADznk4AAAAAAAEAAAAAAAAArV8AABEACQAkgEsAAAAAAAQAAAAAAAAAwl8A +ABEADADwn04AAAAAAAgAAAAAAAAA0l8AABEACwAwtEsAAAAAAAgAAAAAAAAA318AABEADAD4n04A +AAAAAAgAAAAAAAAA7F8AABEADADon04AAAAAAAgAAAAAAAAA+V8AABEADABAok4AAAAAAEAAAAAA +AAAADGAAABEADADnnk4AAAAAAAEAAAAAAAAAHWAAABEADADonk4AAAAAAAEAAAAAAAAALmAAABEA +DAB4n04AAAAAAAgAAAAAAAAAPWAAABEACQA4gEsAAAAAAAUAAAAAAAAAUGAAABEADADmnk4AAAAA +AAEAAAAAAAAAZGAAABEACwA4tEsAAAAAAAgAAAAAAAAAe2AAABEADAAkn04AAAAAAAQAAAAAAAAA +i2AAABEADAAAoU4AAAAAABAAAAAAAAAAoGAAABEADAAcn04AAAAAAAQAAAAAAAAAuWAAABEADABA +qk4AAAAAAKABAAAAAAAAxmAAABEADAAgn04AAAAAAAQAAAAAAAAA4GAAABEACwBYtEsAAAAAAAgA +AAAAAAAA9GAAABEACQAggEsAAAAAAAEAAAAAAAAAB2EAABEADABApk4AAAAAAOAAAAAAAAAAHGEA +ABEACwCgtksAAAAAACgAAAAAAAAALWEAABEACwCAtksAAAAAACAAAAAAAAAAO2EAABEACwDANE0A +AAAAAAhqAQAAAAAASmEAABEACgCQk0sAAAAAABgAAAAAAAAAYmEAABEADACAoU4AAAAAACgAAAAA +AAAAd2EAABEACQBogEsAAAAAAAgAAAAAAAAAjWEAABEACQAAgUsAAAAAACgAAAAAAAAAn2EAABEA +CQCAgUsAAAAAACgAAAAAAAAAsmEAABEACQBAgUsAAAAAACgAAAAAAAAAyGEAABEADACgoE4AAAAA +AAgAAAAAAAAA2WEAABEADAAooE4AAAAAAAgAAAAAAAAA6mEAABEADACYn04AAAAAAAgAAAAAAAAA ++2EAABEADADooE4AAAAAAAgAAAAAAAAADGIAABEACwAQtEsAAAAAAAgAAAAAAAAAHWIAABEADACo +n04AAAAAAAgAAAAAAAAAL2IAABEADAAgoE4AAAAAAAgAAAAAAAAAPWIAABEADACgn04AAAAAAAgA +AAAAAAAAVmIAABEADABAoE4AAAAAAAgAAAAAAAAAb2IAABEADABwn04AAAAAAAgAAAAAAAAAhmIA +ABEACgCgkUsAAAAAAAEAAAAAAAAApWIAABEADADQoE4AAAAAAAgAAAAAAAAAt2IAABEACQCAgEsA +AAAAAAgAAAAAAAAAymIAABEACQBggEsAAAAAAAgAAAAAAAAA3WIAABEADACwoE4AAAAAAAgAAAAA +AAAA9mIAABEADABAtk4AAAAAAMA7AAAAAAAAB2MAABEADABgoE4AAAAAAAgAAAAAAAAAH2MAABEA +DAAwn04AAAAAAAQAAAAAAAAANWMAABEADAA0n04AAAAAAAQAAAAAAAAATGMAABEACgDAkksAAAAA +ABAAAAAAAAAAXGMAABEACwBQtEsAAAAAAAgAAAAAAAAAa2MAABEACQAogEsAAAAAAAQAAAAAAAAA +eGMAABEADABQoE4AAAAAAAgAAAAAAAAAj2MAABEADABYoE4AAAAAAAgAAAAAAAAApmMAABEADAA4 +n04AAAAAAAQAAAAAAAAAvWMAABEACgDQk0sAAAAAABgAAAAAAAAAzmMAABEADADhnk4AAAAAAAEA +AAAAAAAA5GMAABEACwDwtUsAAAAAABgAAAAAAAAA/mMAABEACgDwk0sAAAAAABgAAAAAAAAAFWQA +ABEACgAQlEsAAAAAABgAAAAAAAAAKWQAABEACQCQgEsAAAAAAAgAAAAAAAAAPGQAABEACgDQkksA +AAAAABAAAAAAAAAAT2QAABEACgBwkksAAAAAABAAAAAAAAAAY2QAABEACgCwkksAAAAAABAAAAAA +AAAAeWQAABEACgCAkksAAAAAABAAAAAAAAAAjGQAABEACgCQkksAAAAAABAAAAAAAAAAoGQAABEA +CwAotEsAAAAAAAgAAAAAAAAAsmQAABEADABIn04AAAAAAAQAAAAAAAAAzWQAABEADABAn04AAAAA +AAQAAAAAAAAA32QAABEADABooE4AAAAAAAgAAAAAAAAA72QAABEADADlnk4AAAAAAAEAAAAAAAAA +AWUAABEADADAn04AAAAAAAgAAAAAAAAAEmUAABEACQBIgEsAAAAAAAgAAAAAAAAALGUAABEAAgAQ +aUcAAAAAAAgAAAAAAAAASWUAABEADADgq04AAAAAAAACAAAAAAAAXmUAABEADACQoE4AAAAAAAgA +AAAAAAAAeGUAABEADADIn04AAAAAAAgAAAAAAAAAimUAABEADAA4oE4AAAAAAAgAAAAAAAAAn2UA +ABEACgCgkksAAAAAABAAAAAAAAAAr2UAABEACwCguUsAAAAAAAAEAAAAAAAAumUAABEACwAAuEsA +AAAAAIgBAAAAAAAAxWUAABEADAAwoE4AAAAAAAgAAAAAAAAA1WUAABEACwBAtEsAAAAAAAgAAAAA +AAAA7GUAABEADADvnk4AAAAAAAEAAAAAAAAAAGYAABEADACooE4AAAAAAAgAAAAAAAAAGGYAABEA +DAAQoE4AAAAAAAgAAAAAAAAALGYAABEACgAwkksAAAAAABAAAAAAAAAARmYAABEACgBAkksAAAAA +ABAAAAAAAAAAZWYAABEADACIn04AAAAAAAgAAAAAAAAAdmYAABEACwAQtUsAAAAAABgAAAAAAAAA +hGYAABEADACAn04AAAAAAAgAAAAAAAAAlGYAABEACwD4s0sAAAAAAAgAAAAAAAAApGYAABEADADg +n04AAAAAAAgAAAAAAAAAuWYAABEADAAUn04AAAAAAAQAAAAAAAAAymYAABEACQA0gEsAAAAAAAQA +AAAAAAAA3GYAABEACQAsgEsAAAAAAAQAAAAAAAAA62YAABEACgBQk0sAAAAAABgAAAAAAAAABGcA +ABEADADQn04AAAAAAAgAAAAAAAAAE2cAABEADAAMn04AAAAAAAQAAAAAAAAAJ2cAABEADAAQn04A +AAAAAAQAAAAAAAAAPWcAABEADAAAok4AAAAAADAAAAAAAAAATmcAABEADADAoU4AAAAAACgAAAAA +AAAAYmcAABEADADpnk4AAAAAAAEAAAAAAAAAeGcAABEADACYoE4AAAAAAAgAAAAAAAAAhWcAABEA +DAAgp04AAAAAAAABAAAAAAAAnGcAABEADABMn04AAAAAAAQAAAAAAAAAtmcAABEACQBQgEsAAAAA +AAgAAAAAAAAAzGcAABEADAC4oE4AAAAAAAgAAAAAAAAA3mcAABEACwBgtksAAAAAACAAAAAAAAAA +8WcAABEADABgoU4AAAAAACAAAAAAAAAAA2gAABEACwBwtUsAAAAAABgAAAAAAAAAEGgAABEACwBQ +tUsAAAAAABgAAAAAAAAAIWgAABEACQAwgEsAAAAAAAQAAAAAAAAAOWgAABEADABQn04AAAAAAAQA +AAAAAAAAT2gAABEADAAEn04AAAAAAAQAAAAAAAAAXGgAABEACwAItEsAAAAAAAgAAAAAAAAAaWgA +ABEADADIoE4AAAAAAAgAAAAAAAAAemgAABEADADAoE4AAAAAAAgAAAAAAAAAi2gAABEADADgok4A +AAAAAEwAAAAAAAAAmWgAABEACgAwk0sAAAAAABgAAAAAAAAAqWgAABEACgCAmEsAAAAAALABAAAA +AAAAw2gAABEACwAAtEsAAAAAAAgAAAAAAAAA0GgAABEADAAon04AAAAAAAQAAAAAAAAA42gAABEA +DAAsn04AAAAAAAQAAAAAAAAA8GgAABEACwCQtUsAAAAAABgAAAAAAAAAAGkAABEACwCgvUsAAAAA +APAXAAAAAAAADmkAABEADAA8n04AAAAAAAQAAAAAAAAAH2kAABEADACQn04AAAAAAAgAAAAAAAAA +MGkAABEACwAwtUsAAAAAABgAAAAAAAAAPWkAABEACwCwtUsAAAAAABgAAAAAAAAAT2kAABEACwAQ +tksAAAAAABgAAAAAAAAAYmkAABEADAAAoE4AAAAAAAgAAAAAAAAAfWkAABEADAAYn04AAAAAAAQA +AAAAAAAAmWkAABEADABEn04AAAAAAAQAAAAAAAAAtmkAABEADADqnk4AAAAAAAEAAAAAAAAAxmkA +ABEADADunk4AAAAAAAEAAAAAAAAA4GkAABEADADtnk4AAAAAAAEAAAAAAAAA8mkAABEADADrnk4A +AAAAAAEAAAAAAAAABGoAABEADAC4n04AAAAAAAgAAAAAAAAAF2oAABEADACwn04AAAAAAAgAAAAA +AAAAKmoAABEACwAg9UsAAAAAAMA+AAAAAAAAO2oAABEADADgrU4AAAAAAAgCAAAAAAAASmoAABEA +DAAgqU4AAAAAAAQBAAAAAAAAXmoAABEADADwnk4AAAAAAAEAAAAAAAAAcGoAABEADAAIn04AAAAA +AAQAAAAAAAAAgWoAABEACwBwtEsAAAAAAAgAAAAAAAAAlWoAABEACwB4tEsAAAAAAAgAAAAAAAAA +qWoAABEACgAgkksAAAAAABAAAAAAAAAAwWoAABEACQCIgEsAAAAAAAgAAAAAAAAA2moAABEADACA +ok4AAAAAAEgAAAAAAAAA5moAABEACgBgnUsAAAAAABgGAAAAAAAA92oAABEACQCgg0sAAAAAAIgA +AAAAAAAADWsAABEACQBAgksAAAAAAEQAAAAAAAAAKmsAABEACQBghksAAAAAABABAAAAAAAARGsA +ABEACQAAg0sAAAAAAIEAAAAAAAAAW2sAABEACQBAhEsAAAAAAPkAAAAAAAAAdGsAABEADAAgqE4A +AAAAAAABAAAAAAAAhmsAABEADAAAsE4AAAAAADgCAAAAAAAAmWsAABEACQB4gEsAAAAAAAgAAAAA +AAAArmsAABEACQBwgEsAAAAAAAgAAAAAAAAAxmsAABEACgAQkksAAAAAABAAAAAAAAAA3msAABEA +CwDws0sAAAAAAAgAAAAAAAAA9WsAABEACgCwk0sAAAAAABgAAAAAAAAAFmwAABEACgBQkksAAAAA +ABAAAAAAAAAAMGwAABEACwDQtUsAAAAAABgAAAAAAAAAR2wAABEACQCAh0sAAAAAABgCAAAAAAAA +X2wAABEACQBYgEsAAAAAAAgAAAAAAAAAd2wAABEACwBItEsAAAAAAAgAAAAAAAAAjGwAABEADADY +n04AAAAAAAgAAAAAAAAAnWwAABEACwDgM0wAAAAAANgAAQAAAAAAq2wAABEACgAglksAAAAAAKAA +AAAAAAAAwmwAABEACwAgtEsAAAAAAAgAAAAAAAAA12wAABEACwAYtEsAAAAAAAgAAAAAAAAA7WwA +ABEACwBAtksAAAAAACAAAAAAAAAAAW0AABEACgAwlEsAAAAAABgAAAAAAAAAGm0AABEACgBQlEsA +AAAAABgAAAAAAAAAMW0AABEADADgoE4AAAAAAAgAAAAAAAAATW0AABEADADYoE4AAAAAAAgAAAAA +AAAAaW0AABEADADgnk4AAAAAAAEAAAAAAAAAg20AABEACQBAgEsAAAAAAAgAAAAAAAAAnm0AABEA +DACgpU4AAAAAAJAAAAAAAAAAr20AABEADADAo04AAAAAAIIAAAAAAAAAwG0AABEADAAApU4AAAAA +AIkAAAAAAAAA020AABEACwCwtEsAAAAAABgAAAAAAAAA6G0AABEADAD8nk4AAAAAAAQAAAAAAAAA +FG4AABEACQDggEsAAAAAACAAAAAAAAAAL24AABEADABYn04AAAAAAAgAAAAAAAAAR24AABEAAgCI +akcAAAAAACAAAAAAAAAAaW4AABEACwCos0sAAAAAAAgAAAAAAAAAc24AABEACwDQs0sAAAAAAAgA +AAAAAAAAhW4AAB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cgB0 +eXBlLioAcnVudGltZS50ZXh0c2VjdGlvbm1hcAA= diff --git a/go/src/debug/buildinfo/testdata/go117/main.go b/go/src/debug/buildinfo/testdata/go117/main.go new file mode 100644 index 0000000000000000000000000000000000000000..78cd9120d5cc5fd853e339a92c2588096e6fcc14 --- /dev/null +++ b/go/src/debug/buildinfo/testdata/go117/main.go @@ -0,0 +1,7 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +func main() {} diff --git a/go/src/debug/buildinfo/testdata/notgo/README.md b/go/src/debug/buildinfo/testdata/notgo/README.md new file mode 100644 index 0000000000000000000000000000000000000000..ebbe104beda0b3d226892c053193a80c16fc6d22 --- /dev/null +++ b/go/src/debug/buildinfo/testdata/notgo/README.md @@ -0,0 +1,17 @@ +notgo.base64 is a base64-encoded C hello world binary used to test +debug/buildinfo errors on non-Go binaries. + +The binary is base64 encoded to hide it from security scanners that might not +like it. + +Generate notgo.base64 on linux-amd64 with: + +$ cc -o notgo main.c +$ base64 notgo > notgo.base64 +$ rm notgo + +The current binary was built with "gcc version 14.2.0 (Debian 14.2.0-3+build4)". + +TODO(prattmic): Ideally this would be built on the fly to better cover all +executable formats, but then we need to encode the intricacies of calling each +platform's C compiler. diff --git a/go/src/debug/buildinfo/testdata/notgo/main.c b/go/src/debug/buildinfo/testdata/notgo/main.c new file mode 100644 index 0000000000000000000000000000000000000000..d554d4a4ce3187fb1408b6c52cde24679929eb62 --- /dev/null +++ b/go/src/debug/buildinfo/testdata/notgo/main.c @@ -0,0 +1,7 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +int main(void) { + return 0; +} diff --git a/go/src/debug/buildinfo/testdata/notgo/notgo.base64 b/go/src/debug/buildinfo/testdata/notgo/notgo.base64 new file mode 100644 index 0000000000000000000000000000000000000000..74a7fe1d02e9887aa2a8e2a721470c62b10c2c34 --- /dev/null +++ b/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wAAAAAAAMAvAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAACAAAAAAA +AADzAAAAAQAAAAMAAAAAAAAA6D8AAAAAAADoLwAAAAAAABgAAAAAAAAAAAAAAAAAAAAIAAAAAAAA +AAgAAAAAAAAA/AAAAAEAAAADAAAAAAAAAABAAAAAAAAAADAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA +CAAAAAAAAAAAAAAAAAAAAAIBAAAIAAAAAwAAAAAAAAAQQAAAAAAAABAwAAAAAAAACAAAAAAAAAAA +AAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAHAQAAAQAAADAAAAAAAAAAAAAAAAAAAAAQMAAAAAAAACUA +AAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAODAA +AAAAAABIAwAAAAAAABwAAAASAAAACAAAAAAAAAAYAAAAAAAAAAkAAAADAAAAAAAAAAAAAAAAAAAA +AAAAAIAzAAAAAAAAyQEAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAwAAAAAAAAAA +AAAAAAAAAAAAAABJNQAAAAAAABABAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAA diff --git a/go/src/debug/dwarf/attr_string.go b/go/src/debug/dwarf/attr_string.go new file mode 100644 index 0000000000000000000000000000000000000000..8a4fff85a408dfcac7e382d50a118d97adaba43b --- /dev/null +++ b/go/src/debug/dwarf/attr_string.go @@ -0,0 +1,265 @@ +// Code generated by "stringer -type Attr -trimprefix=Attr"; DO NOT EDIT. + +package dwarf + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[AttrSibling-1] + _ = x[AttrLocation-2] + _ = x[AttrName-3] + _ = x[AttrOrdering-9] + _ = x[AttrByteSize-11] + _ = x[AttrBitOffset-12] + _ = x[AttrBitSize-13] + _ = x[AttrStmtList-16] + _ = x[AttrLowpc-17] + _ = x[AttrHighpc-18] + _ = x[AttrLanguage-19] + _ = x[AttrDiscr-21] + _ = x[AttrDiscrValue-22] + _ = x[AttrVisibility-23] + _ = x[AttrImport-24] + _ = x[AttrStringLength-25] + _ = x[AttrCommonRef-26] + _ = x[AttrCompDir-27] + _ = x[AttrConstValue-28] + _ = x[AttrContainingType-29] + _ = x[AttrDefaultValue-30] + _ = x[AttrInline-32] + _ = x[AttrIsOptional-33] + _ = x[AttrLowerBound-34] + _ = x[AttrProducer-37] + _ = x[AttrPrototyped-39] + _ = x[AttrReturnAddr-42] + _ = x[AttrStartScope-44] + _ = x[AttrStrideSize-46] + _ = x[AttrUpperBound-47] + _ = x[AttrAbstractOrigin-49] + _ = x[AttrAccessibility-50] + _ = x[AttrAddrClass-51] + _ = x[AttrArtificial-52] + _ = x[AttrBaseTypes-53] + _ = x[AttrCalling-54] + _ = x[AttrCount-55] + _ = x[AttrDataMemberLoc-56] + _ = x[AttrDeclColumn-57] + _ = x[AttrDeclFile-58] + _ = x[AttrDeclLine-59] + _ = x[AttrDeclaration-60] + _ = x[AttrDiscrList-61] + _ = x[AttrEncoding-62] + _ = x[AttrExternal-63] + _ = x[AttrFrameBase-64] + _ = x[AttrFriend-65] + _ = x[AttrIdentifierCase-66] + _ = x[AttrMacroInfo-67] + _ = x[AttrNamelistItem-68] + _ = x[AttrPriority-69] + _ = x[AttrSegment-70] + _ = x[AttrSpecification-71] + _ = x[AttrStaticLink-72] + _ = x[AttrType-73] + _ = x[AttrUseLocation-74] + _ = x[AttrVarParam-75] + _ = x[AttrVirtuality-76] + _ = x[AttrVtableElemLoc-77] + _ = x[AttrAllocated-78] + _ = x[AttrAssociated-79] + _ = x[AttrDataLocation-80] + _ = x[AttrStride-81] + _ = x[AttrEntrypc-82] + _ = x[AttrUseUTF8-83] + _ = x[AttrExtension-84] + _ = x[AttrRanges-85] + _ = x[AttrTrampoline-86] + _ = x[AttrCallColumn-87] + _ = x[AttrCallFile-88] + _ = x[AttrCallLine-89] + _ = x[AttrDescription-90] + _ = x[AttrBinaryScale-91] + _ = x[AttrDecimalScale-92] + _ = x[AttrSmall-93] + _ = x[AttrDecimalSign-94] + _ = x[AttrDigitCount-95] + _ = x[AttrPictureString-96] + _ = x[AttrMutable-97] + _ = x[AttrThreadsScaled-98] + _ = x[AttrExplicit-99] + _ = x[AttrObjectPointer-100] + _ = x[AttrEndianity-101] + _ = x[AttrElemental-102] + _ = x[AttrPure-103] + _ = x[AttrRecursive-104] + _ = x[AttrSignature-105] + _ = x[AttrMainSubprogram-106] + _ = x[AttrDataBitOffset-107] + _ = x[AttrConstExpr-108] + _ = x[AttrEnumClass-109] + _ = x[AttrLinkageName-110] + _ = x[AttrStringLengthBitSize-111] + _ = x[AttrStringLengthByteSize-112] + _ = x[AttrRank-113] + _ = x[AttrStrOffsetsBase-114] + _ = x[AttrAddrBase-115] + _ = x[AttrRnglistsBase-116] + _ = x[AttrDwoName-118] + _ = x[AttrReference-119] + _ = x[AttrRvalueReference-120] + _ = x[AttrMacros-121] + _ = x[AttrCallAllCalls-122] + _ = x[AttrCallAllSourceCalls-123] + _ = x[AttrCallAllTailCalls-124] + _ = x[AttrCallReturnPC-125] + _ = x[AttrCallValue-126] + _ = x[AttrCallOrigin-127] + _ = x[AttrCallParameter-128] + _ = x[AttrCallPC-129] + _ = x[AttrCallTailCall-130] + _ = x[AttrCallTarget-131] + _ = x[AttrCallTargetClobbered-132] + _ = x[AttrCallDataLocation-133] + _ = x[AttrCallDataValue-134] + _ = x[AttrNoreturn-135] + _ = x[AttrAlignment-136] + _ = x[AttrExportSymbols-137] + _ = x[AttrDeleted-138] + _ = x[AttrDefaulted-139] + _ = x[AttrLoclistsBase-140] +} + +const _Attr_name = "SiblingLocationNameOrderingByteSizeBitOffsetBitSizeStmtListLowpcHighpcLanguageDiscrDiscrValueVisibilityImportStringLengthCommonRefCompDirConstValueContainingTypeDefaultValueInlineIsOptionalLowerBoundProducerPrototypedReturnAddrStartScopeStrideSizeUpperBoundAbstractOriginAccessibilityAddrClassArtificialBaseTypesCallingCountDataMemberLocDeclColumnDeclFileDeclLineDeclarationDiscrListEncodingExternalFrameBaseFriendIdentifierCaseMacroInfoNamelistItemPrioritySegmentSpecificationStaticLinkTypeUseLocationVarParamVirtualityVtableElemLocAllocatedAssociatedDataLocationStrideEntrypcUseUTF8ExtensionRangesTrampolineCallColumnCallFileCallLineDescriptionBinaryScaleDecimalScaleSmallDecimalSignDigitCountPictureStringMutableThreadsScaledExplicitObjectPointerEndianityElementalPureRecursiveSignatureMainSubprogramDataBitOffsetConstExprEnumClassLinkageNameStringLengthBitSizeStringLengthByteSizeRankStrOffsetsBaseAddrBaseRnglistsBaseDwoNameReferenceRvalueReferenceMacrosCallAllCallsCallAllSourceCallsCallAllTailCallsCallReturnPCCallValueCallOriginCallParameterCallPCCallTailCallCallTargetCallTargetClobberedCallDataLocationCallDataValueNoreturnAlignmentExportSymbolsDeletedDefaultedLoclistsBase" + +var _Attr_map = map[Attr]string{ + 1: _Attr_name[0:7], + 2: _Attr_name[7:15], + 3: _Attr_name[15:19], + 9: _Attr_name[19:27], + 11: _Attr_name[27:35], + 12: _Attr_name[35:44], + 13: _Attr_name[44:51], + 16: _Attr_name[51:59], + 17: _Attr_name[59:64], + 18: _Attr_name[64:70], + 19: _Attr_name[70:78], + 21: _Attr_name[78:83], + 22: _Attr_name[83:93], + 23: _Attr_name[93:103], + 24: _Attr_name[103:109], + 25: _Attr_name[109:121], + 26: _Attr_name[121:130], + 27: _Attr_name[130:137], + 28: _Attr_name[137:147], + 29: _Attr_name[147:161], + 30: _Attr_name[161:173], + 32: _Attr_name[173:179], + 33: _Attr_name[179:189], + 34: _Attr_name[189:199], + 37: _Attr_name[199:207], + 39: _Attr_name[207:217], + 42: _Attr_name[217:227], + 44: _Attr_name[227:237], + 46: _Attr_name[237:247], + 47: _Attr_name[247:257], + 49: _Attr_name[257:271], + 50: _Attr_name[271:284], + 51: _Attr_name[284:293], + 52: _Attr_name[293:303], + 53: _Attr_name[303:312], + 54: _Attr_name[312:319], + 55: _Attr_name[319:324], + 56: _Attr_name[324:337], + 57: _Attr_name[337:347], + 58: _Attr_name[347:355], + 59: _Attr_name[355:363], + 60: _Attr_name[363:374], + 61: _Attr_name[374:383], + 62: _Attr_name[383:391], + 63: _Attr_name[391:399], + 64: _Attr_name[399:408], + 65: _Attr_name[408:414], + 66: _Attr_name[414:428], + 67: _Attr_name[428:437], + 68: _Attr_name[437:449], + 69: _Attr_name[449:457], + 70: _Attr_name[457:464], + 71: _Attr_name[464:477], + 72: _Attr_name[477:487], + 73: _Attr_name[487:491], + 74: _Attr_name[491:502], + 75: _Attr_name[502:510], + 76: _Attr_name[510:520], + 77: _Attr_name[520:533], + 78: _Attr_name[533:542], + 79: _Attr_name[542:552], + 80: _Attr_name[552:564], + 81: _Attr_name[564:570], + 82: _Attr_name[570:577], + 83: _Attr_name[577:584], + 84: _Attr_name[584:593], + 85: _Attr_name[593:599], + 86: _Attr_name[599:609], + 87: _Attr_name[609:619], + 88: _Attr_name[619:627], + 89: _Attr_name[627:635], + 90: _Attr_name[635:646], + 91: _Attr_name[646:657], + 92: _Attr_name[657:669], + 93: _Attr_name[669:674], + 94: _Attr_name[674:685], + 95: _Attr_name[685:695], + 96: _Attr_name[695:708], + 97: _Attr_name[708:715], + 98: _Attr_name[715:728], + 99: _Attr_name[728:736], + 100: _Attr_name[736:749], + 101: _Attr_name[749:758], + 102: _Attr_name[758:767], + 103: _Attr_name[767:771], + 104: _Attr_name[771:780], + 105: _Attr_name[780:789], + 106: _Attr_name[789:803], + 107: _Attr_name[803:816], + 108: _Attr_name[816:825], + 109: _Attr_name[825:834], + 110: _Attr_name[834:845], + 111: _Attr_name[845:864], + 112: _Attr_name[864:884], + 113: _Attr_name[884:888], + 114: _Attr_name[888:902], + 115: _Attr_name[902:910], + 116: _Attr_name[910:922], + 118: _Attr_name[922:929], + 119: _Attr_name[929:938], + 120: _Attr_name[938:953], + 121: _Attr_name[953:959], + 122: _Attr_name[959:971], + 123: _Attr_name[971:989], + 124: _Attr_name[989:1005], + 125: _Attr_name[1005:1017], + 126: _Attr_name[1017:1026], + 127: _Attr_name[1026:1036], + 128: _Attr_name[1036:1049], + 129: _Attr_name[1049:1055], + 130: _Attr_name[1055:1067], + 131: _Attr_name[1067:1077], + 132: _Attr_name[1077:1096], + 133: _Attr_name[1096:1112], + 134: _Attr_name[1112:1125], + 135: _Attr_name[1125:1133], + 136: _Attr_name[1133:1142], + 137: _Attr_name[1142:1155], + 138: _Attr_name[1155:1162], + 139: _Attr_name[1162:1171], + 140: _Attr_name[1171:1183], +} + +func (i Attr) String() string { + if str, ok := _Attr_map[i]; ok { + return str + } + return "Attr(" + strconv.FormatInt(int64(i), 10) + ")" +} diff --git a/go/src/debug/dwarf/buf.go b/go/src/debug/dwarf/buf.go new file mode 100644 index 0000000000000000000000000000000000000000..7ac53efcb6bbe06caa386a85335c39fb8d34521d --- /dev/null +++ b/go/src/debug/dwarf/buf.go @@ -0,0 +1,205 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Buffered reading and decoding of DWARF data streams. + +package dwarf + +import ( + "bytes" + "encoding/binary" + "strconv" +) + +// Data buffer being decoded. +type buf struct { + dwarf *Data + order binary.ByteOrder + format dataFormat + name string + off Offset + data []byte + err error +} + +// Data format, other than byte order. This affects the handling of +// certain field formats. +type dataFormat interface { + // DWARF version number. Zero means unknown. + version() int + + // 64-bit DWARF format? + dwarf64() (dwarf64 bool, isKnown bool) + + // Size of an address, in bytes. Zero means unknown. + addrsize() int +} + +// Some parts of DWARF have no data format, e.g., abbrevs. +type unknownFormat struct{} + +func (u unknownFormat) version() int { + return 0 +} + +func (u unknownFormat) dwarf64() (bool, bool) { + return false, false +} + +func (u unknownFormat) addrsize() int { + return 0 +} + +func makeBuf(d *Data, format dataFormat, name string, off Offset, data []byte) buf { + return buf{d, d.order, format, name, off, data, nil} +} + +func (b *buf) uint8() uint8 { + if len(b.data) < 1 { + b.error("underflow") + return 0 + } + val := b.data[0] + b.data = b.data[1:] + b.off++ + return val +} + +func (b *buf) bytes(n int) []byte { + if n < 0 || len(b.data) < n { + b.error("underflow") + return nil + } + data := b.data[0:n] + b.data = b.data[n:] + b.off += Offset(n) + return data +} + +func (b *buf) skip(n int) { b.bytes(n) } + +func (b *buf) string() string { + i := bytes.IndexByte(b.data, 0) + if i < 0 { + b.error("underflow") + return "" + } + + s := string(b.data[0:i]) + b.data = b.data[i+1:] + b.off += Offset(i + 1) + return s +} + +func (b *buf) uint16() uint16 { + a := b.bytes(2) + if a == nil { + return 0 + } + return b.order.Uint16(a) +} + +func (b *buf) uint24() uint32 { + a := b.bytes(3) + if a == nil { + return 0 + } + if b.dwarf.bigEndian { + return uint32(a[2]) | uint32(a[1])<<8 | uint32(a[0])<<16 + } else { + return uint32(a[0]) | uint32(a[1])<<8 | uint32(a[2])<<16 + } +} + +func (b *buf) uint32() uint32 { + a := b.bytes(4) + if a == nil { + return 0 + } + return b.order.Uint32(a) +} + +func (b *buf) uint64() uint64 { + a := b.bytes(8) + if a == nil { + return 0 + } + return b.order.Uint64(a) +} + +// Read a varint, which is 7 bits per byte, little endian. +// the 0x80 bit means read another byte. +func (b *buf) varint() (c uint64, bits uint) { + for i := 0; i < len(b.data); i++ { + byte := b.data[i] + c |= uint64(byte&0x7F) << bits + bits += 7 + if byte&0x80 == 0 { + b.off += Offset(i + 1) + b.data = b.data[i+1:] + return c, bits + } + } + return 0, 0 +} + +// Unsigned int is just a varint. +func (b *buf) uint() uint64 { + x, _ := b.varint() + return x +} + +// Signed int is a sign-extended varint. +func (b *buf) int() int64 { + ux, bits := b.varint() + x := int64(ux) + if x&(1<<(bits-1)) != 0 { + x |= -1 << bits + } + return x +} + +// Address-sized uint. +func (b *buf) addr() uint64 { + switch b.format.addrsize() { + case 1: + return uint64(b.uint8()) + case 2: + return uint64(b.uint16()) + case 4: + return uint64(b.uint32()) + case 8: + return b.uint64() + } + b.error("unknown address size") + return 0 +} + +func (b *buf) unitLength() (length Offset, dwarf64 bool) { + length = Offset(b.uint32()) + if length == 0xffffffff { + dwarf64 = true + length = Offset(b.uint64()) + } else if length >= 0xfffffff0 { + b.error("unit length has reserved value") + } + return +} + +func (b *buf) error(s string) { + if b.err == nil { + b.data = nil + b.err = DecodeError{b.name, b.off, s} + } +} + +type DecodeError struct { + Name string + Offset Offset + Err string +} + +func (e DecodeError) Error() string { + return "decoding dwarf section " + e.Name + " at offset 0x" + strconv.FormatInt(int64(e.Offset), 16) + ": " + e.Err +} diff --git a/go/src/debug/dwarf/class_string.go b/go/src/debug/dwarf/class_string.go new file mode 100644 index 0000000000000000000000000000000000000000..163bed712a7e0497621b14f77c85ca843be38016 --- /dev/null +++ b/go/src/debug/dwarf/class_string.go @@ -0,0 +1,42 @@ +// Code generated by "stringer -type=Class"; DO NOT EDIT. + +package dwarf + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[ClassUnknown-0] + _ = x[ClassAddress-1] + _ = x[ClassBlock-2] + _ = x[ClassConstant-3] + _ = x[ClassExprLoc-4] + _ = x[ClassFlag-5] + _ = x[ClassLinePtr-6] + _ = x[ClassLocListPtr-7] + _ = x[ClassMacPtr-8] + _ = x[ClassRangeListPtr-9] + _ = x[ClassReference-10] + _ = x[ClassReferenceSig-11] + _ = x[ClassString-12] + _ = x[ClassReferenceAlt-13] + _ = x[ClassStringAlt-14] + _ = x[ClassAddrPtr-15] + _ = x[ClassLocList-16] + _ = x[ClassRngList-17] + _ = x[ClassRngListsPtr-18] + _ = x[ClassStrOffsetsPtr-19] +} + +const _Class_name = "ClassUnknownClassAddressClassBlockClassConstantClassExprLocClassFlagClassLinePtrClassLocListPtrClassMacPtrClassRangeListPtrClassReferenceClassReferenceSigClassStringClassReferenceAltClassStringAltClassAddrPtrClassLocListClassRngListClassRngListsPtrClassStrOffsetsPtr" + +var _Class_index = [...]uint16{0, 12, 24, 34, 47, 59, 68, 80, 95, 106, 123, 137, 154, 165, 182, 196, 208, 220, 232, 248, 266} + +func (i Class) String() string { + if i < 0 || i >= Class(len(_Class_index)-1) { + return "Class(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _Class_name[_Class_index[i]:_Class_index[i+1]] +} diff --git a/go/src/debug/dwarf/const.go b/go/src/debug/dwarf/const.go new file mode 100644 index 0000000000000000000000000000000000000000..ea52460927753b29a7646e2986801ed128626164 --- /dev/null +++ b/go/src/debug/dwarf/const.go @@ -0,0 +1,475 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Constants + +package dwarf + +//go:generate stringer -type Attr -trimprefix=Attr + +// An Attr identifies the attribute type in a DWARF [Entry.Field]. +type Attr uint32 + +const ( + AttrSibling Attr = 0x01 + AttrLocation Attr = 0x02 + AttrName Attr = 0x03 + AttrOrdering Attr = 0x09 + AttrByteSize Attr = 0x0B + AttrBitOffset Attr = 0x0C + AttrBitSize Attr = 0x0D + AttrStmtList Attr = 0x10 + AttrLowpc Attr = 0x11 + AttrHighpc Attr = 0x12 + AttrLanguage Attr = 0x13 + AttrDiscr Attr = 0x15 + AttrDiscrValue Attr = 0x16 + AttrVisibility Attr = 0x17 + AttrImport Attr = 0x18 + AttrStringLength Attr = 0x19 + AttrCommonRef Attr = 0x1A + AttrCompDir Attr = 0x1B + AttrConstValue Attr = 0x1C + AttrContainingType Attr = 0x1D + AttrDefaultValue Attr = 0x1E + AttrInline Attr = 0x20 + AttrIsOptional Attr = 0x21 + AttrLowerBound Attr = 0x22 + AttrProducer Attr = 0x25 + AttrPrototyped Attr = 0x27 + AttrReturnAddr Attr = 0x2A + AttrStartScope Attr = 0x2C + AttrStrideSize Attr = 0x2E + AttrUpperBound Attr = 0x2F + AttrAbstractOrigin Attr = 0x31 + AttrAccessibility Attr = 0x32 + AttrAddrClass Attr = 0x33 + AttrArtificial Attr = 0x34 + AttrBaseTypes Attr = 0x35 + AttrCalling Attr = 0x36 + AttrCount Attr = 0x37 + AttrDataMemberLoc Attr = 0x38 + AttrDeclColumn Attr = 0x39 + AttrDeclFile Attr = 0x3A + AttrDeclLine Attr = 0x3B + AttrDeclaration Attr = 0x3C + AttrDiscrList Attr = 0x3D + AttrEncoding Attr = 0x3E + AttrExternal Attr = 0x3F + AttrFrameBase Attr = 0x40 + AttrFriend Attr = 0x41 + AttrIdentifierCase Attr = 0x42 + AttrMacroInfo Attr = 0x43 + AttrNamelistItem Attr = 0x44 + AttrPriority Attr = 0x45 + AttrSegment Attr = 0x46 + AttrSpecification Attr = 0x47 + AttrStaticLink Attr = 0x48 + AttrType Attr = 0x49 + AttrUseLocation Attr = 0x4A + AttrVarParam Attr = 0x4B + AttrVirtuality Attr = 0x4C + AttrVtableElemLoc Attr = 0x4D + // The following are new in DWARF 3. + AttrAllocated Attr = 0x4E + AttrAssociated Attr = 0x4F + AttrDataLocation Attr = 0x50 + AttrStride Attr = 0x51 + AttrEntrypc Attr = 0x52 + AttrUseUTF8 Attr = 0x53 + AttrExtension Attr = 0x54 + AttrRanges Attr = 0x55 + AttrTrampoline Attr = 0x56 + AttrCallColumn Attr = 0x57 + AttrCallFile Attr = 0x58 + AttrCallLine Attr = 0x59 + AttrDescription Attr = 0x5A + AttrBinaryScale Attr = 0x5B + AttrDecimalScale Attr = 0x5C + AttrSmall Attr = 0x5D + AttrDecimalSign Attr = 0x5E + AttrDigitCount Attr = 0x5F + AttrPictureString Attr = 0x60 + AttrMutable Attr = 0x61 + AttrThreadsScaled Attr = 0x62 + AttrExplicit Attr = 0x63 + AttrObjectPointer Attr = 0x64 + AttrEndianity Attr = 0x65 + AttrElemental Attr = 0x66 + AttrPure Attr = 0x67 + AttrRecursive Attr = 0x68 + // The following are new in DWARF 4. + AttrSignature Attr = 0x69 + AttrMainSubprogram Attr = 0x6A + AttrDataBitOffset Attr = 0x6B + AttrConstExpr Attr = 0x6C + AttrEnumClass Attr = 0x6D + AttrLinkageName Attr = 0x6E + // The following are new in DWARF 5. + AttrStringLengthBitSize Attr = 0x6F + AttrStringLengthByteSize Attr = 0x70 + AttrRank Attr = 0x71 + AttrStrOffsetsBase Attr = 0x72 + AttrAddrBase Attr = 0x73 + AttrRnglistsBase Attr = 0x74 + AttrDwoName Attr = 0x76 + AttrReference Attr = 0x77 + AttrRvalueReference Attr = 0x78 + AttrMacros Attr = 0x79 + AttrCallAllCalls Attr = 0x7A + AttrCallAllSourceCalls Attr = 0x7B + AttrCallAllTailCalls Attr = 0x7C + AttrCallReturnPC Attr = 0x7D + AttrCallValue Attr = 0x7E + AttrCallOrigin Attr = 0x7F + AttrCallParameter Attr = 0x80 + AttrCallPC Attr = 0x81 + AttrCallTailCall Attr = 0x82 + AttrCallTarget Attr = 0x83 + AttrCallTargetClobbered Attr = 0x84 + AttrCallDataLocation Attr = 0x85 + AttrCallDataValue Attr = 0x86 + AttrNoreturn Attr = 0x87 + AttrAlignment Attr = 0x88 + AttrExportSymbols Attr = 0x89 + AttrDeleted Attr = 0x8A + AttrDefaulted Attr = 0x8B + AttrLoclistsBase Attr = 0x8C +) + +func (a Attr) GoString() string { + if str, ok := _Attr_map[a]; ok { + return "dwarf.Attr" + str + } + return "dwarf." + a.String() +} + +// A format is a DWARF data encoding format. +type format uint32 + +const ( + // value formats + formAddr format = 0x01 + formDwarfBlock2 format = 0x03 + formDwarfBlock4 format = 0x04 + formData2 format = 0x05 + formData4 format = 0x06 + formData8 format = 0x07 + formString format = 0x08 + formDwarfBlock format = 0x09 + formDwarfBlock1 format = 0x0A + formData1 format = 0x0B + formFlag format = 0x0C + formSdata format = 0x0D + formStrp format = 0x0E + formUdata format = 0x0F + formRefAddr format = 0x10 + formRef1 format = 0x11 + formRef2 format = 0x12 + formRef4 format = 0x13 + formRef8 format = 0x14 + formRefUdata format = 0x15 + formIndirect format = 0x16 + // The following are new in DWARF 4. + formSecOffset format = 0x17 + formExprloc format = 0x18 + formFlagPresent format = 0x19 + formRefSig8 format = 0x20 + // The following are new in DWARF 5. + formStrx format = 0x1A + formAddrx format = 0x1B + formRefSup4 format = 0x1C + formStrpSup format = 0x1D + formData16 format = 0x1E + formLineStrp format = 0x1F + formImplicitConst format = 0x21 + formLoclistx format = 0x22 + formRnglistx format = 0x23 + formRefSup8 format = 0x24 + formStrx1 format = 0x25 + formStrx2 format = 0x26 + formStrx3 format = 0x27 + formStrx4 format = 0x28 + formAddrx1 format = 0x29 + formAddrx2 format = 0x2A + formAddrx3 format = 0x2B + formAddrx4 format = 0x2C + // Extensions for multi-file compression (.dwz) + // http://www.dwarfstd.org/ShowIssue.php?issue=120604.1 + formGnuRefAlt format = 0x1f20 + formGnuStrpAlt format = 0x1f21 +) + +//go:generate stringer -type Tag -trimprefix=Tag + +// A Tag is the classification (the type) of an [Entry]. +type Tag uint32 + +const ( + TagArrayType Tag = 0x01 + TagClassType Tag = 0x02 + TagEntryPoint Tag = 0x03 + TagEnumerationType Tag = 0x04 + TagFormalParameter Tag = 0x05 + TagImportedDeclaration Tag = 0x08 + TagLabel Tag = 0x0A + TagLexDwarfBlock Tag = 0x0B + TagMember Tag = 0x0D + TagPointerType Tag = 0x0F + TagReferenceType Tag = 0x10 + TagCompileUnit Tag = 0x11 + TagStringType Tag = 0x12 + TagStructType Tag = 0x13 + TagSubroutineType Tag = 0x15 + TagTypedef Tag = 0x16 + TagUnionType Tag = 0x17 + TagUnspecifiedParameters Tag = 0x18 + TagVariant Tag = 0x19 + TagCommonDwarfBlock Tag = 0x1A + TagCommonInclusion Tag = 0x1B + TagInheritance Tag = 0x1C + TagInlinedSubroutine Tag = 0x1D + TagModule Tag = 0x1E + TagPtrToMemberType Tag = 0x1F + TagSetType Tag = 0x20 + TagSubrangeType Tag = 0x21 + TagWithStmt Tag = 0x22 + TagAccessDeclaration Tag = 0x23 + TagBaseType Tag = 0x24 + TagCatchDwarfBlock Tag = 0x25 + TagConstType Tag = 0x26 + TagConstant Tag = 0x27 + TagEnumerator Tag = 0x28 + TagFileType Tag = 0x29 + TagFriend Tag = 0x2A + TagNamelist Tag = 0x2B + TagNamelistItem Tag = 0x2C + TagPackedType Tag = 0x2D + TagSubprogram Tag = 0x2E + TagTemplateTypeParameter Tag = 0x2F + TagTemplateValueParameter Tag = 0x30 + TagThrownType Tag = 0x31 + TagTryDwarfBlock Tag = 0x32 + TagVariantPart Tag = 0x33 + TagVariable Tag = 0x34 + TagVolatileType Tag = 0x35 + // The following are new in DWARF 3. + TagDwarfProcedure Tag = 0x36 + TagRestrictType Tag = 0x37 + TagInterfaceType Tag = 0x38 + TagNamespace Tag = 0x39 + TagImportedModule Tag = 0x3A + TagUnspecifiedType Tag = 0x3B + TagPartialUnit Tag = 0x3C + TagImportedUnit Tag = 0x3D + TagMutableType Tag = 0x3E // Later removed from DWARF. + TagCondition Tag = 0x3F + TagSharedType Tag = 0x40 + // The following are new in DWARF 4. + TagTypeUnit Tag = 0x41 + TagRvalueReferenceType Tag = 0x42 + TagTemplateAlias Tag = 0x43 + // The following are new in DWARF 5. + TagCoarrayType Tag = 0x44 + TagGenericSubrange Tag = 0x45 + TagDynamicType Tag = 0x46 + TagAtomicType Tag = 0x47 + TagCallSite Tag = 0x48 + TagCallSiteParameter Tag = 0x49 + TagSkeletonUnit Tag = 0x4A + TagImmutableType Tag = 0x4B +) + +func (t Tag) GoString() string { + if t <= TagTemplateAlias { + return "dwarf.Tag" + t.String() + } + return "dwarf." + t.String() +} + +// Location expression operators. +// The debug info encodes value locations like 8(R3) +// as a sequence of these op codes. +// This package does not implement full expressions; +// the opPlusUconst operator is expected by the type parser. +const ( + opAddr = 0x03 /* 1 op, const addr */ + opDeref = 0x06 + opConst1u = 0x08 /* 1 op, 1 byte const */ + opConst1s = 0x09 /* " signed */ + opConst2u = 0x0A /* 1 op, 2 byte const */ + opConst2s = 0x0B /* " signed */ + opConst4u = 0x0C /* 1 op, 4 byte const */ + opConst4s = 0x0D /* " signed */ + opConst8u = 0x0E /* 1 op, 8 byte const */ + opConst8s = 0x0F /* " signed */ + opConstu = 0x10 /* 1 op, LEB128 const */ + opConsts = 0x11 /* " signed */ + opDup = 0x12 + opDrop = 0x13 + opOver = 0x14 + opPick = 0x15 /* 1 op, 1 byte stack index */ + opSwap = 0x16 + opRot = 0x17 + opXderef = 0x18 + opAbs = 0x19 + opAnd = 0x1A + opDiv = 0x1B + opMinus = 0x1C + opMod = 0x1D + opMul = 0x1E + opNeg = 0x1F + opNot = 0x20 + opOr = 0x21 + opPlus = 0x22 + opPlusUconst = 0x23 /* 1 op, ULEB128 addend */ + opShl = 0x24 + opShr = 0x25 + opShra = 0x26 + opXor = 0x27 + opSkip = 0x2F /* 1 op, signed 2-byte constant */ + opBra = 0x28 /* 1 op, signed 2-byte constant */ + opEq = 0x29 + opGe = 0x2A + opGt = 0x2B + opLe = 0x2C + opLt = 0x2D + opNe = 0x2E + opLit0 = 0x30 + /* OpLitN = OpLit0 + N for N = 0..31 */ + opReg0 = 0x50 + /* OpRegN = OpReg0 + N for N = 0..31 */ + opBreg0 = 0x70 /* 1 op, signed LEB128 constant */ + /* OpBregN = OpBreg0 + N for N = 0..31 */ + opRegx = 0x90 /* 1 op, ULEB128 register */ + opFbreg = 0x91 /* 1 op, SLEB128 offset */ + opBregx = 0x92 /* 2 op, ULEB128 reg; SLEB128 off */ + opPiece = 0x93 /* 1 op, ULEB128 size of piece */ + opDerefSize = 0x94 /* 1-byte size of data retrieved */ + opXderefSize = 0x95 /* 1-byte size of data retrieved */ + opNop = 0x96 + // The following are new in DWARF 3. + opPushObjAddr = 0x97 + opCall2 = 0x98 /* 2-byte offset of DIE */ + opCall4 = 0x99 /* 4-byte offset of DIE */ + opCallRef = 0x9A /* 4- or 8- byte offset of DIE */ + opFormTLSAddress = 0x9B + opCallFrameCFA = 0x9C + opBitPiece = 0x9D + // The following are new in DWARF 4. + opImplicitValue = 0x9E + opStackValue = 0x9F + // The following a new in DWARF 5. + opImplicitPointer = 0xA0 + opAddrx = 0xA1 + opConstx = 0xA2 + opEntryValue = 0xA3 + opConstType = 0xA4 + opRegvalType = 0xA5 + opDerefType = 0xA6 + opXderefType = 0xA7 + opConvert = 0xA8 + opReinterpret = 0xA9 + /* 0xE0-0xFF reserved for user-specific */ +) + +// Basic type encodings -- the value for AttrEncoding in a TagBaseType Entry. +const ( + encAddress = 0x01 + encBoolean = 0x02 + encComplexFloat = 0x03 + encFloat = 0x04 + encSigned = 0x05 + encSignedChar = 0x06 + encUnsigned = 0x07 + encUnsignedChar = 0x08 + // The following are new in DWARF 3. + encImaginaryFloat = 0x09 + encPackedDecimal = 0x0A + encNumericString = 0x0B + encEdited = 0x0C + encSignedFixed = 0x0D + encUnsignedFixed = 0x0E + encDecimalFloat = 0x0F + // The following are new in DWARF 4. + encUTF = 0x10 + // The following are new in DWARF 5. + encUCS = 0x11 + encASCII = 0x12 +) + +// Statement program standard opcode encodings. +const ( + lnsCopy = 1 + lnsAdvancePC = 2 + lnsAdvanceLine = 3 + lnsSetFile = 4 + lnsSetColumn = 5 + lnsNegateStmt = 6 + lnsSetBasicBlock = 7 + lnsConstAddPC = 8 + lnsFixedAdvancePC = 9 + + // DWARF 3 + lnsSetPrologueEnd = 10 + lnsSetEpilogueBegin = 11 + lnsSetISA = 12 +) + +// Statement program extended opcode encodings. +const ( + lneEndSequence = 1 + lneSetAddress = 2 + lneDefineFile = 3 + + // DWARF 4 + lneSetDiscriminator = 4 +) + +// Line table directory and file name entry formats. +// These are new in DWARF 5. +const ( + lnctPath = 0x01 + lnctDirectoryIndex = 0x02 + lnctTimestamp = 0x03 + lnctSize = 0x04 + lnctMD5 = 0x05 +) + +// Location list entry codes. +// These are new in DWARF 5. +const ( + lleEndOfList = 0x00 + lleBaseAddressx = 0x01 + lleStartxEndx = 0x02 + lleStartxLength = 0x03 + lleOffsetPair = 0x04 + lleDefaultLocation = 0x05 + lleBaseAddress = 0x06 + lleStartEnd = 0x07 + lleStartLength = 0x08 +) + +// Unit header unit type encodings. +// These are new in DWARF 5. +const ( + utCompile = 0x01 + utType = 0x02 + utPartial = 0x03 + utSkeleton = 0x04 + utSplitCompile = 0x05 + utSplitType = 0x06 +) + +// Opcodes for DWARFv5 debug_rnglists section. +const ( + rleEndOfList = 0x0 + rleBaseAddressx = 0x1 + rleStartxEndx = 0x2 + rleStartxLength = 0x3 + rleOffsetPair = 0x4 + rleBaseAddress = 0x5 + rleStartEnd = 0x6 + rleStartLength = 0x7 +) diff --git a/go/src/debug/dwarf/dwarf5ranges_test.go b/go/src/debug/dwarf/dwarf5ranges_test.go new file mode 100644 index 0000000000000000000000000000000000000000..8bc50bcab699a3167b2ecc0127f820a9965051e1 --- /dev/null +++ b/go/src/debug/dwarf/dwarf5ranges_test.go @@ -0,0 +1,41 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package dwarf + +import ( + "encoding/binary" + "os" + "reflect" + "testing" +) + +func TestDwarf5Ranges(t *testing.T) { + rngLists, err := os.ReadFile("testdata/debug_rnglists") + if err != nil { + t.Fatalf("could not read test data: %v", err) + } + + d := &Data{} + d.order = binary.LittleEndian + if err := d.AddSection(".debug_rnglists", rngLists); err != nil { + t.Fatal(err) + } + u := &unit{ + asize: 8, + vers: 5, + is64: true, + } + ret, err := d.dwarf5Ranges(u, nil, 0x5fbd, 0xc, [][2]uint64{}) + if err != nil { + t.Fatalf("could not read rnglist: %v", err) + } + t.Logf("%#v", ret) + + tgt := [][2]uint64{{0x0000000000006712, 0x000000000000679f}, {0x00000000000067af}, {0x00000000000067b3}} + + if reflect.DeepEqual(ret, tgt) { + t.Errorf("expected %#v got %#x", tgt, ret) + } +} diff --git a/go/src/debug/dwarf/entry.go b/go/src/debug/dwarf/entry.go new file mode 100644 index 0000000000000000000000000000000000000000..30fad93e7937d2e308575d67cb74e4e64ed0d443 --- /dev/null +++ b/go/src/debug/dwarf/entry.go @@ -0,0 +1,1167 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// DWARF debug information entry parser. +// An entry is a sequence of data items of a given format. +// The first word in the entry is an index into what DWARF +// calls the ``abbreviation table.'' An abbreviation is really +// just a type descriptor: it's an array of attribute tag/value format pairs. + +package dwarf + +import ( + "encoding/binary" + "errors" + "fmt" + "strconv" +) + +// a single entry's description: a sequence of attributes +type abbrev struct { + tag Tag + children bool + field []afield +} + +type afield struct { + attr Attr + fmt format + class Class + val int64 // for formImplicitConst +} + +// a map from entry format ids to their descriptions +type abbrevTable map[uint32]abbrev + +// parseAbbrev returns the abbreviation table that starts at byte off +// in the .debug_abbrev section. +func (d *Data) parseAbbrev(off uint64, vers int) (abbrevTable, error) { + if m, ok := d.abbrevCache[off]; ok { + return m, nil + } + + data := d.abbrev + if off > uint64(len(data)) { + data = nil + } else { + data = data[off:] + } + b := makeBuf(d, unknownFormat{}, "abbrev", 0, data) + + // Error handling is simplified by the buf getters + // returning an endless stream of 0s after an error. + m := make(abbrevTable) + for { + // Table ends with id == 0. + id := uint32(b.uint()) + if id == 0 { + break + } + + // Walk over attributes, counting. + n := 0 + b1 := b // Read from copy of b. + b1.uint() + b1.uint8() + for { + tag := b1.uint() + fmt := b1.uint() + if tag == 0 && fmt == 0 { + break + } + if format(fmt) == formImplicitConst { + b1.int() + } + n++ + } + if b1.err != nil { + return nil, b1.err + } + + // Walk over attributes again, this time writing them down. + var a abbrev + a.tag = Tag(b.uint()) + a.children = b.uint8() != 0 + a.field = make([]afield, n) + for i := range a.field { + a.field[i].attr = Attr(b.uint()) + a.field[i].fmt = format(b.uint()) + a.field[i].class = formToClass(a.field[i].fmt, a.field[i].attr, vers, &b) + if a.field[i].fmt == formImplicitConst { + a.field[i].val = b.int() + } + } + b.uint() + b.uint() + + m[id] = a + } + if b.err != nil { + return nil, b.err + } + d.abbrevCache[off] = m + return m, nil +} + +// attrIsExprloc indicates attributes that allow exprloc values that +// are encoded as block values in DWARF 2 and 3. See DWARF 4, Figure +// 20. +var attrIsExprloc = map[Attr]bool{ + AttrLocation: true, + AttrByteSize: true, + AttrBitOffset: true, + AttrBitSize: true, + AttrStringLength: true, + AttrLowerBound: true, + AttrReturnAddr: true, + AttrStrideSize: true, + AttrUpperBound: true, + AttrCount: true, + AttrDataMemberLoc: true, + AttrFrameBase: true, + AttrSegment: true, + AttrStaticLink: true, + AttrUseLocation: true, + AttrVtableElemLoc: true, + AttrAllocated: true, + AttrAssociated: true, + AttrDataLocation: true, + AttrStride: true, +} + +// attrPtrClass indicates the *ptr class of attributes that have +// encoding formSecOffset in DWARF 4 or formData* in DWARF 2 and 3. +var attrPtrClass = map[Attr]Class{ + AttrLocation: ClassLocListPtr, + AttrStmtList: ClassLinePtr, + AttrStringLength: ClassLocListPtr, + AttrReturnAddr: ClassLocListPtr, + AttrStartScope: ClassRangeListPtr, + AttrDataMemberLoc: ClassLocListPtr, + AttrFrameBase: ClassLocListPtr, + AttrMacroInfo: ClassMacPtr, + AttrSegment: ClassLocListPtr, + AttrStaticLink: ClassLocListPtr, + AttrUseLocation: ClassLocListPtr, + AttrVtableElemLoc: ClassLocListPtr, + AttrRanges: ClassRangeListPtr, + // The following are new in DWARF 5. + AttrStrOffsetsBase: ClassStrOffsetsPtr, + AttrAddrBase: ClassAddrPtr, + AttrRnglistsBase: ClassRngListsPtr, + AttrLoclistsBase: ClassLocListPtr, +} + +// formToClass returns the DWARF 4 Class for the given form. If the +// DWARF version is less then 4, it will disambiguate some forms +// depending on the attribute. +func formToClass(form format, attr Attr, vers int, b *buf) Class { + switch form { + default: + b.error("cannot determine class of unknown attribute form") + return 0 + + case formIndirect: + return ClassUnknown + + case formAddr, formAddrx, formAddrx1, formAddrx2, formAddrx3, formAddrx4: + return ClassAddress + + case formDwarfBlock1, formDwarfBlock2, formDwarfBlock4, formDwarfBlock: + // In DWARF 2 and 3, ClassExprLoc was encoded as a + // block. DWARF 4 distinguishes ClassBlock and + // ClassExprLoc, but there are no attributes that can + // be both, so we also promote ClassBlock values in + // DWARF 4 that should be ClassExprLoc in case + // producers get this wrong. + if attrIsExprloc[attr] { + return ClassExprLoc + } + return ClassBlock + + case formData1, formData2, formData4, formData8, formSdata, formUdata, formData16, formImplicitConst: + // In DWARF 2 and 3, ClassPtr was encoded as a + // constant. Unlike ClassExprLoc/ClassBlock, some + // DWARF 4 attributes need to distinguish Class*Ptr + // from ClassConstant, so we only do this promotion + // for versions 2 and 3. + if class, ok := attrPtrClass[attr]; vers < 4 && ok { + return class + } + return ClassConstant + + case formFlag, formFlagPresent: + return ClassFlag + + case formRefAddr, formRef1, formRef2, formRef4, formRef8, formRefUdata, formRefSup4, formRefSup8: + return ClassReference + + case formRefSig8: + return ClassReferenceSig + + case formString, formStrp, formStrx, formStrpSup, formLineStrp, formStrx1, formStrx2, formStrx3, formStrx4: + return ClassString + + case formSecOffset: + // DWARF 4 defines four *ptr classes, but doesn't + // distinguish them in the encoding. Disambiguate + // these classes using the attribute. + if class, ok := attrPtrClass[attr]; ok { + return class + } + return ClassUnknown + + case formExprloc: + return ClassExprLoc + + case formGnuRefAlt: + return ClassReferenceAlt + + case formGnuStrpAlt: + return ClassStringAlt + + case formLoclistx: + return ClassLocList + + case formRnglistx: + return ClassRngList + } +} + +// An Entry is a sequence of attribute/value pairs. +type Entry struct { + Offset Offset // offset of Entry in DWARF info + Tag Tag // tag (kind of Entry) + Children bool // whether Entry is followed by children + Field []Field +} + +// A Field is a single attribute/value pair in an [Entry]. +// +// A value can be one of several "attribute classes" defined by DWARF. +// The Go types corresponding to each class are: +// +// DWARF class Go type Class +// ----------- ------- ----- +// address uint64 ClassAddress +// block []byte ClassBlock +// constant int64 ClassConstant +// flag bool ClassFlag +// reference +// to info dwarf.Offset ClassReference +// to type unit uint64 ClassReferenceSig +// string string ClassString +// exprloc []byte ClassExprLoc +// lineptr int64 ClassLinePtr +// loclistptr int64 ClassLocListPtr +// macptr int64 ClassMacPtr +// rangelistptr int64 ClassRangeListPtr +// +// For unrecognized or vendor-defined attributes, [Class] may be +// [ClassUnknown]. +type Field struct { + Attr Attr + Val any + Class Class +} + +// A Class is the DWARF 4 class of an attribute value. +// +// In general, a given attribute's value may take on one of several +// possible classes defined by DWARF, each of which leads to a +// slightly different interpretation of the attribute. +// +// DWARF version 4 distinguishes attribute value classes more finely +// than previous versions of DWARF. The reader will disambiguate +// coarser classes from earlier versions of DWARF into the appropriate +// DWARF 4 class. For example, DWARF 2 uses "constant" for constants +// as well as all types of section offsets, but the reader will +// canonicalize attributes in DWARF 2 files that refer to section +// offsets to one of the Class*Ptr classes, even though these classes +// were only defined in DWARF 3. +type Class int + +const ( + // ClassUnknown represents values of unknown DWARF class. + ClassUnknown Class = iota + + // ClassAddress represents values of type uint64 that are + // addresses on the target machine. + ClassAddress + + // ClassBlock represents values of type []byte whose + // interpretation depends on the attribute. + ClassBlock + + // ClassConstant represents values of type int64 that are + // constants. The interpretation of this constant depends on + // the attribute. + ClassConstant + + // ClassExprLoc represents values of type []byte that contain + // an encoded DWARF expression or location description. + ClassExprLoc + + // ClassFlag represents values of type bool. + ClassFlag + + // ClassLinePtr represents values that are an int64 offset + // into the "line" section. + ClassLinePtr + + // ClassLocListPtr represents values that are an int64 offset + // into the "loclist" section. + ClassLocListPtr + + // ClassMacPtr represents values that are an int64 offset into + // the "mac" section. + ClassMacPtr + + // ClassRangeListPtr represents values that are an int64 offset into + // the "rangelist" section. + ClassRangeListPtr + + // ClassReference represents values that are an Offset offset + // of an Entry in the info section (for use with Reader.Seek). + // The DWARF specification combines ClassReference and + // ClassReferenceSig into class "reference". + ClassReference + + // ClassReferenceSig represents values that are a uint64 type + // signature referencing a type Entry. + ClassReferenceSig + + // ClassString represents values that are strings. If the + // compilation unit specifies the AttrUseUTF8 flag (strongly + // recommended), the string value will be encoded in UTF-8. + // Otherwise, the encoding is unspecified. + ClassString + + // ClassReferenceAlt represents values of type int64 that are + // an offset into the DWARF "info" section of an alternate + // object file. + ClassReferenceAlt + + // ClassStringAlt represents values of type int64 that are an + // offset into the DWARF string section of an alternate object + // file. + ClassStringAlt + + // ClassAddrPtr represents values that are an int64 offset + // into the "addr" section. + ClassAddrPtr + + // ClassLocList represents values that are an int64 offset + // into the "loclists" section. + ClassLocList + + // ClassRngList represents values that are a uint64 offset + // from the base of the "rnglists" section. + ClassRngList + + // ClassRngListsPtr represents values that are an int64 offset + // into the "rnglists" section. These are used as the base for + // ClassRngList values. + ClassRngListsPtr + + // ClassStrOffsetsPtr represents values that are an int64 + // offset into the "str_offsets" section. + ClassStrOffsetsPtr +) + +//go:generate stringer -type=Class + +func (i Class) GoString() string { + return "dwarf." + i.String() +} + +// Val returns the value associated with attribute [Attr] in [Entry], +// or nil if there is no such attribute. +// +// A common idiom is to merge the check for nil return with +// the check that the value has the expected dynamic type, as in: +// +// v, ok := e.Val(AttrSibling).(int64) +func (e *Entry) Val(a Attr) any { + if f := e.AttrField(a); f != nil { + return f.Val + } + return nil +} + +// AttrField returns the [Field] associated with attribute [Attr] in +// [Entry], or nil if there is no such attribute. +func (e *Entry) AttrField(a Attr) *Field { + for i, f := range e.Field { + if f.Attr == a { + return &e.Field[i] + } + } + return nil +} + +// An Offset represents the location of an [Entry] within the DWARF info. +// (See [Reader.Seek].) +type Offset uint32 + +// Entry reads a single entry from buf, decoding +// according to the given abbreviation table. +func (b *buf) entry(cu *Entry, u *unit) *Entry { + atab, ubase, vers := u.atable, u.base, u.vers + off := b.off + id := uint32(b.uint()) + if id == 0 { + return &Entry{} + } + a, ok := atab[id] + if !ok { + b.error("unknown abbreviation table index") + return nil + } + e := &Entry{ + Offset: off, + Tag: a.tag, + Children: a.children, + Field: make([]Field, len(a.field)), + } + + resolveStrx := func(strBase, off uint64) string { + off += strBase + if uint64(int(off)) != off { + b.error("DW_FORM_strx offset out of range") + } + + b1 := makeBuf(b.dwarf, b.format, "str_offsets", 0, b.dwarf.strOffsets) + b1.skip(int(off)) + is64, _ := b.format.dwarf64() + if is64 { + off = b1.uint64() + } else { + off = uint64(b1.uint32()) + } + if b1.err != nil { + b.err = b1.err + return "" + } + if uint64(int(off)) != off { + b.error("DW_FORM_strx indirect offset out of range") + } + b1 = makeBuf(b.dwarf, b.format, "str", 0, b.dwarf.str) + b1.skip(int(off)) + val := b1.string() + if b1.err != nil { + b.err = b1.err + } + return val + } + + resolveRnglistx := func(rnglistsBase, off uint64) uint64 { + is64, _ := b.format.dwarf64() + if is64 { + off *= 8 + } else { + off *= 4 + } + off += rnglistsBase + if uint64(int(off)) != off { + b.error("DW_FORM_rnglistx offset out of range") + } + + b1 := makeBuf(b.dwarf, b.format, "rnglists", 0, b.dwarf.rngLists) + b1.skip(int(off)) + if is64 { + off = b1.uint64() + } else { + off = uint64(b1.uint32()) + } + if b1.err != nil { + b.err = b1.err + return 0 + } + if uint64(int(off)) != off { + b.error("DW_FORM_rnglistx indirect offset out of range") + } + return rnglistsBase + off + } + + for i := range e.Field { + e.Field[i].Attr = a.field[i].attr + e.Field[i].Class = a.field[i].class + fmt := a.field[i].fmt + if fmt == formIndirect { + fmt = format(b.uint()) + e.Field[i].Class = formToClass(fmt, a.field[i].attr, vers, b) + } + var val any + switch fmt { + default: + b.error("unknown entry attr format 0x" + strconv.FormatInt(int64(fmt), 16)) + + // address + case formAddr: + val = b.addr() + case formAddrx, formAddrx1, formAddrx2, formAddrx3, formAddrx4: + var off uint64 + switch fmt { + case formAddrx: + off = b.uint() + case formAddrx1: + off = uint64(b.uint8()) + case formAddrx2: + off = uint64(b.uint16()) + case formAddrx3: + off = uint64(b.uint24()) + case formAddrx4: + off = uint64(b.uint32()) + } + if b.dwarf.addr == nil { + b.error("DW_FORM_addrx with no .debug_addr section") + } + if b.err != nil { + return nil + } + + addrBase := int64(u.addrBase()) + var err error + val, err = b.dwarf.debugAddr(b.format, uint64(addrBase), off) + if err != nil { + if b.err == nil { + b.err = err + } + return nil + } + + // block + case formDwarfBlock1: + val = b.bytes(int(b.uint8())) + case formDwarfBlock2: + val = b.bytes(int(b.uint16())) + case formDwarfBlock4: + val = b.bytes(int(b.uint32())) + case formDwarfBlock: + val = b.bytes(int(b.uint())) + + // constant + case formData1: + val = int64(b.uint8()) + case formData2: + val = int64(b.uint16()) + case formData4: + val = int64(b.uint32()) + case formData8: + val = int64(b.uint64()) + case formData16: + val = b.bytes(16) + case formSdata: + val = b.int() + case formUdata: + val = int64(b.uint()) + case formImplicitConst: + val = a.field[i].val + + // flag + case formFlag: + val = b.uint8() == 1 + // New in DWARF 4. + case formFlagPresent: + // The attribute is implicitly indicated as present, and no value is + // encoded in the debugging information entry itself. + val = true + + // reference to other entry + case formRefAddr: + vers := b.format.version() + if vers == 0 { + b.error("unknown version for DW_FORM_ref_addr") + } else if vers == 2 { + val = Offset(b.addr()) + } else { + is64, known := b.format.dwarf64() + if !known { + b.error("unknown size for DW_FORM_ref_addr") + } else if is64 { + val = Offset(b.uint64()) + } else { + val = Offset(b.uint32()) + } + } + case formRef1: + val = Offset(b.uint8()) + ubase + case formRef2: + val = Offset(b.uint16()) + ubase + case formRef4: + val = Offset(b.uint32()) + ubase + case formRef8: + val = Offset(b.uint64()) + ubase + case formRefUdata: + val = Offset(b.uint()) + ubase + + // string + case formString: + val = b.string() + case formStrp, formLineStrp: + var off uint64 // offset into .debug_str + is64, known := b.format.dwarf64() + if !known { + b.error("unknown size for DW_FORM_strp/line_strp") + } else if is64 { + off = b.uint64() + } else { + off = uint64(b.uint32()) + } + if uint64(int(off)) != off { + b.error("DW_FORM_strp/line_strp offset out of range") + } + if b.err != nil { + return nil + } + var b1 buf + if fmt == formStrp { + b1 = makeBuf(b.dwarf, b.format, "str", 0, b.dwarf.str) + } else { + if len(b.dwarf.lineStr) == 0 { + b.error("DW_FORM_line_strp with no .debug_line_str section") + return nil + } + b1 = makeBuf(b.dwarf, b.format, "line_str", 0, b.dwarf.lineStr) + } + b1.skip(int(off)) + val = b1.string() + if b1.err != nil { + b.err = b1.err + return nil + } + case formStrx, formStrx1, formStrx2, formStrx3, formStrx4: + var off uint64 + switch fmt { + case formStrx: + off = b.uint() + case formStrx1: + off = uint64(b.uint8()) + case formStrx2: + off = uint64(b.uint16()) + case formStrx3: + off = uint64(b.uint24()) + case formStrx4: + off = uint64(b.uint32()) + } + if len(b.dwarf.strOffsets) == 0 { + b.error("DW_FORM_strx with no .debug_str_offsets section") + } + is64, known := b.format.dwarf64() + if !known { + b.error("unknown offset size for DW_FORM_strx") + } + if b.err != nil { + return nil + } + if is64 { + off *= 8 + } else { + off *= 4 + } + + strBase := int64(u.strOffsetsBase()) + val = resolveStrx(uint64(strBase), off) + + case formStrpSup: + is64, known := b.format.dwarf64() + if !known { + b.error("unknown size for DW_FORM_strp_sup") + } else if is64 { + val = b.uint64() + } else { + val = b.uint32() + } + + // lineptr, loclistptr, macptr, rangelistptr + // New in DWARF 4, but clang can generate them with -gdwarf-2. + // Section reference, replacing use of formData4 and formData8. + case formSecOffset, formGnuRefAlt, formGnuStrpAlt: + is64, known := b.format.dwarf64() + if !known { + b.error("unknown size for form 0x" + strconv.FormatInt(int64(fmt), 16)) + } else if is64 { + val = int64(b.uint64()) + } else { + val = int64(b.uint32()) + } + + // exprloc + // New in DWARF 4. + case formExprloc: + val = b.bytes(int(b.uint())) + + // reference + // New in DWARF 4. + case formRefSig8: + // 64-bit type signature. + val = b.uint64() + case formRefSup4: + val = b.uint32() + case formRefSup8: + val = b.uint64() + + // loclist + case formLoclistx: + val = b.uint() + + // rnglist + case formRnglistx: + off := b.uint() + + rnglistsBase := int64(u.rngListsBase()) + val = resolveRnglistx(uint64(rnglistsBase), off) + } + + e.Field[i].Val = val + } + if b.err != nil { + return nil + } + return e +} + +// A Reader allows reading [Entry] structures from a DWARF “info” section. +// The [Entry] structures are arranged in a tree. The [Reader.Next] function +// return successive entries from a pre-order traversal of the tree. +// If an entry has children, its Children field will be true, and the children +// follow, terminated by an [Entry] with [Tag] 0. +type Reader struct { + b buf + d *Data + err error + unit int + lastUnit bool // set if last entry returned by Next is TagCompileUnit/TagPartialUnit + lastChildren bool // .Children of last entry returned by Next + lastSibling Offset // .Val(AttrSibling) of last entry returned by Next + cu *Entry // current compilation unit +} + +// Reader returns a new Reader for [Data]. +// The reader is positioned at byte offset 0 in the DWARF “info” section. +func (d *Data) Reader() *Reader { + r := &Reader{d: d} + r.Seek(0) + return r +} + +// AddressSize returns the size in bytes of addresses in the current compilation +// unit. +func (r *Reader) AddressSize() int { + return r.d.unit[r.unit].asize +} + +// ByteOrder returns the byte order in the current compilation unit. +func (r *Reader) ByteOrder() binary.ByteOrder { + return r.b.order +} + +// Seek positions the [Reader] at offset off in the encoded entry stream. +// Offset 0 can be used to denote the first entry. +func (r *Reader) Seek(off Offset) { + d := r.d + r.err = nil + r.lastChildren = false + if off == 0 { + if len(d.unit) == 0 { + return + } + u := &d.unit[0] + r.unit = 0 + r.b = makeBuf(r.d, u, "info", u.off, u.data) + r.collectDwarf5BaseOffsets(u) + r.cu = nil + return + } + + i := d.offsetToUnit(off) + if i == -1 { + r.err = errors.New("offset out of range") + return + } + if i != r.unit { + r.cu = nil + } + u := &d.unit[i] + r.unit = i + r.b = makeBuf(r.d, u, "info", off, u.data[off-u.off:]) + r.collectDwarf5BaseOffsets(u) +} + +// maybeNextUnit advances to the next unit if this one is finished. +func (r *Reader) maybeNextUnit() { + for len(r.b.data) == 0 && r.unit+1 < len(r.d.unit) { + r.nextUnit() + } +} + +// nextUnit advances to the next unit. +func (r *Reader) nextUnit() { + r.unit++ + u := &r.d.unit[r.unit] + r.b = makeBuf(r.d, u, "info", u.off, u.data) + r.cu = nil + r.collectDwarf5BaseOffsets(u) +} + +func (r *Reader) collectDwarf5BaseOffsets(u *unit) { + if u.vers < 5 || u.unit5 != nil { + return + } + u.unit5 = new(unit5) + if err := r.d.collectDwarf5BaseOffsets(u); err != nil { + r.err = err + } +} + +// Next reads the next entry from the encoded entry stream. +// It returns nil, nil when it reaches the end of the section. +// It returns an error if the current offset is invalid or the data at the +// offset cannot be decoded as a valid [Entry]. +func (r *Reader) Next() (*Entry, error) { + if r.err != nil { + return nil, r.err + } + r.maybeNextUnit() + if len(r.b.data) == 0 { + return nil, nil + } + u := &r.d.unit[r.unit] + e := r.b.entry(r.cu, u) + if r.b.err != nil { + r.err = r.b.err + return nil, r.err + } + r.lastUnit = false + if e != nil { + r.lastChildren = e.Children + if r.lastChildren { + r.lastSibling, _ = e.Val(AttrSibling).(Offset) + } + if e.Tag == TagCompileUnit || e.Tag == TagPartialUnit { + r.lastUnit = true + r.cu = e + } + } else { + r.lastChildren = false + } + return e, nil +} + +// SkipChildren skips over the child entries associated with +// the last [Entry] returned by [Reader.Next]. If that [Entry] did not have +// children or [Reader.Next] has not been called, SkipChildren is a no-op. +func (r *Reader) SkipChildren() { + if r.err != nil || !r.lastChildren { + return + } + + // If the last entry had a sibling attribute, + // that attribute gives the offset of the next + // sibling, so we can avoid decoding the + // child subtrees. + if r.lastSibling >= r.b.off { + r.Seek(r.lastSibling) + return + } + + if r.lastUnit && r.unit+1 < len(r.d.unit) { + r.nextUnit() + return + } + + for { + e, err := r.Next() + if err != nil || e == nil || e.Tag == 0 { + break + } + if e.Children { + r.SkipChildren() + } + } +} + +// clone returns a copy of the reader. This is used by the typeReader +// interface. +func (r *Reader) clone() typeReader { + return r.d.Reader() +} + +// offset returns the current buffer offset. This is used by the +// typeReader interface. +func (r *Reader) offset() Offset { + return r.b.off +} + +// SeekPC returns the [Entry] for the compilation unit that includes pc, +// and positions the reader to read the children of that unit. If pc +// is not covered by any unit, SeekPC returns [ErrUnknownPC] and the +// position of the reader is undefined. +// +// Because compilation units can describe multiple regions of the +// executable, in the worst case SeekPC must search through all the +// ranges in all the compilation units. Each call to SeekPC starts the +// search at the compilation unit of the last call, so in general +// looking up a series of PCs will be faster if they are sorted. If +// the caller wishes to do repeated fast PC lookups, it should build +// an appropriate index using the Ranges method. +func (r *Reader) SeekPC(pc uint64) (*Entry, error) { + unit := r.unit + for i := 0; i < len(r.d.unit); i++ { + if unit >= len(r.d.unit) { + unit = 0 + } + r.err = nil + r.lastChildren = false + r.unit = unit + r.cu = nil + u := &r.d.unit[unit] + r.b = makeBuf(r.d, u, "info", u.off, u.data) + r.collectDwarf5BaseOffsets(u) + e, err := r.Next() + if err != nil { + return nil, err + } + if e == nil || e.Tag == 0 { + return nil, ErrUnknownPC + } + ranges, err := r.d.Ranges(e) + if err != nil { + return nil, err + } + for _, pcs := range ranges { + if pcs[0] <= pc && pc < pcs[1] { + return e, nil + } + } + unit++ + } + return nil, ErrUnknownPC +} + +// Ranges returns the PC ranges covered by e, a slice of [low,high) pairs. +// Only some entry types, such as [TagCompileUnit] or [TagSubprogram], have PC +// ranges; for others, this will return nil with no error. +func (d *Data) Ranges(e *Entry) ([][2]uint64, error) { + var ret [][2]uint64 + + low, lowOK := e.Val(AttrLowpc).(uint64) + + var high uint64 + var highOK bool + highField := e.AttrField(AttrHighpc) + if highField != nil { + switch highField.Class { + case ClassAddress: + high, highOK = highField.Val.(uint64) + case ClassConstant: + off, ok := highField.Val.(int64) + if ok { + high = low + uint64(off) + highOK = true + } + } + } + + if lowOK && highOK { + ret = append(ret, [2]uint64{low, high}) + } + + var u *unit + if uidx := d.offsetToUnit(e.Offset); uidx >= 0 && uidx < len(d.unit) { + u = &d.unit[uidx] + } + + if u != nil && u.vers >= 5 && d.rngLists != nil { + // DWARF version 5 and later + field := e.AttrField(AttrRanges) + if field == nil { + return ret, nil + } + switch field.Class { + case ClassRangeListPtr: + ranges, rangesOK := field.Val.(int64) + if !rangesOK { + return ret, nil + } + cu, base, err := d.baseAddressForEntry(e) + if err != nil { + return nil, err + } + return d.dwarf5Ranges(u, cu, base, ranges, ret) + + case ClassRngList: + rnglist, ok := field.Val.(uint64) + if !ok { + return ret, nil + } + cu, base, err := d.baseAddressForEntry(e) + if err != nil { + return nil, err + } + return d.dwarf5Ranges(u, cu, base, int64(rnglist), ret) + + default: + return ret, nil + } + } + + // DWARF version 2 through 4 + ranges, rangesOK := e.Val(AttrRanges).(int64) + if rangesOK && d.ranges != nil { + _, base, err := d.baseAddressForEntry(e) + if err != nil { + return nil, err + } + return d.dwarf2Ranges(u, base, ranges, ret) + } + + return ret, nil +} + +// baseAddressForEntry returns the initial base address to be used when +// looking up the range list of entry e. +// DWARF specifies that this should be the lowpc attribute of the enclosing +// compilation unit, however comments in gdb/dwarf2read.c say that some +// versions of GCC use the entrypc attribute, so we check that too. +func (d *Data) baseAddressForEntry(e *Entry) (*Entry, uint64, error) { + var cu *Entry + if e.Tag == TagCompileUnit { + cu = e + } else { + i := d.offsetToUnit(e.Offset) + if i == -1 { + return nil, 0, errors.New("no unit for entry") + } + u := &d.unit[i] + b := makeBuf(d, u, "info", u.off, u.data) + cu = b.entry(nil, u) + if b.err != nil { + return nil, 0, b.err + } + } + + if cuEntry, cuEntryOK := cu.Val(AttrEntrypc).(uint64); cuEntryOK { + return cu, cuEntry, nil + } else if cuLow, cuLowOK := cu.Val(AttrLowpc).(uint64); cuLowOK { + return cu, cuLow, nil + } + + return cu, 0, nil +} + +func (d *Data) dwarf2Ranges(u *unit, base uint64, ranges int64, ret [][2]uint64) ([][2]uint64, error) { + if ranges < 0 || ranges > int64(len(d.ranges)) { + return nil, fmt.Errorf("invalid range offset %d (max %d)", ranges, len(d.ranges)) + } + buf := makeBuf(d, u, "ranges", Offset(ranges), d.ranges[ranges:]) + for len(buf.data) > 0 { + low := buf.addr() + high := buf.addr() + + if low == 0 && high == 0 { + break + } + + if low == ^uint64(0)>>uint((8-u.addrsize())*8) { + base = high + } else { + ret = append(ret, [2]uint64{base + low, base + high}) + } + } + + return ret, nil +} + +// dwarf5Ranges interprets a debug_rnglists sequence, see DWARFv5 section +// 2.17.3 (page 53). +func (d *Data) dwarf5Ranges(u *unit, cu *Entry, base uint64, ranges int64, ret [][2]uint64) ([][2]uint64, error) { + if ranges < 0 || ranges > int64(len(d.rngLists)) { + return nil, fmt.Errorf("invalid rnglist offset %d (max %d)", ranges, len(d.ranges)) + } + var addrBase int64 + if cu != nil { + addrBase, _ = cu.Val(AttrAddrBase).(int64) + } + + buf := makeBuf(d, u, "rnglists", 0, d.rngLists) + buf.skip(int(ranges)) + for { + opcode := buf.uint8() + switch opcode { + case rleEndOfList: + if buf.err != nil { + return nil, buf.err + } + return ret, nil + + case rleBaseAddressx: + baseIdx := buf.uint() + var err error + base, err = d.debugAddr(u, uint64(addrBase), baseIdx) + if err != nil { + return nil, err + } + + case rleStartxEndx: + startIdx := buf.uint() + endIdx := buf.uint() + + start, err := d.debugAddr(u, uint64(addrBase), startIdx) + if err != nil { + return nil, err + } + end, err := d.debugAddr(u, uint64(addrBase), endIdx) + if err != nil { + return nil, err + } + ret = append(ret, [2]uint64{start, end}) + + case rleStartxLength: + startIdx := buf.uint() + len := buf.uint() + start, err := d.debugAddr(u, uint64(addrBase), startIdx) + if err != nil { + return nil, err + } + ret = append(ret, [2]uint64{start, start + len}) + + case rleOffsetPair: + off1 := buf.uint() + off2 := buf.uint() + ret = append(ret, [2]uint64{base + off1, base + off2}) + + case rleBaseAddress: + base = buf.addr() + + case rleStartEnd: + start := buf.addr() + end := buf.addr() + ret = append(ret, [2]uint64{start, end}) + + case rleStartLength: + start := buf.addr() + len := buf.uint() + ret = append(ret, [2]uint64{start, start + len}) + } + } +} + +// debugAddr returns the address at idx in debug_addr +func (d *Data) debugAddr(format dataFormat, addrBase, idx uint64) (uint64, error) { + off := idx*uint64(format.addrsize()) + addrBase + + if uint64(int(off)) != off { + return 0, errors.New("offset out of range") + } + + b := makeBuf(d, format, "addr", 0, d.addr) + b.skip(int(off)) + val := b.addr() + if b.err != nil { + return 0, b.err + } + return val, nil +} diff --git a/go/src/debug/dwarf/entry_test.go b/go/src/debug/dwarf/entry_test.go new file mode 100644 index 0000000000000000000000000000000000000000..ee0c80a5038abf41dda960b9ef5b9d5568af0d5e --- /dev/null +++ b/go/src/debug/dwarf/entry_test.go @@ -0,0 +1,519 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package dwarf_test + +import ( + . "debug/dwarf" + "debug/elf" + "encoding/binary" + "path/filepath" + "reflect" + "testing" +) + +func TestSplit(t *testing.T) { + // debug/dwarf doesn't (currently) support split DWARF, but + // the attributes that pointed to the split DWARF used to + // cause loading the DWARF data to fail entirely (issue + // #12592). Test that we can at least read the DWARF data. + d := elfData(t, "testdata/split.elf") + r := d.Reader() + e, err := r.Next() + if err != nil { + t.Fatal(err) + } + if e.Tag != TagCompileUnit { + t.Fatalf("bad tag: have %s, want %s", e.Tag, TagCompileUnit) + } + // Check that we were able to parse the unknown section offset + // field, even if we can't figure out its DWARF class. + const AttrGNUAddrBase Attr = 0x2133 + f := e.AttrField(AttrGNUAddrBase) + if _, ok := f.Val.(int64); !ok { + t.Fatalf("bad attribute value type: have %T, want int64", f.Val) + } + if f.Class != ClassUnknown { + t.Fatalf("bad class: have %s, want %s", f.Class, ClassUnknown) + } +} + +// wantRange maps from a PC to the ranges of the compilation unit +// containing that PC. +type wantRange struct { + pc uint64 + ranges [][2]uint64 +} + +func TestReaderSeek(t *testing.T) { + want := []wantRange{ + {0x40059d, [][2]uint64{{0x40059d, 0x400601}}}, + {0x400600, [][2]uint64{{0x40059d, 0x400601}}}, + {0x400601, [][2]uint64{{0x400601, 0x400611}}}, + {0x4005f0, [][2]uint64{{0x40059d, 0x400601}}}, // loop test + {0x10, nil}, + {0x400611, nil}, + } + testRanges(t, "testdata/line-gcc.elf", want) + + want = []wantRange{ + {0x401122, [][2]uint64{{0x401122, 0x401166}}}, + {0x401165, [][2]uint64{{0x401122, 0x401166}}}, + {0x401166, [][2]uint64{{0x401166, 0x401179}}}, + } + testRanges(t, "testdata/line-gcc-dwarf5.elf", want) + + want = []wantRange{ + {0x401130, [][2]uint64{{0x401130, 0x40117e}}}, + {0x40117d, [][2]uint64{{0x401130, 0x40117e}}}, + {0x40117e, nil}, + } + testRanges(t, "testdata/line-clang-dwarf5.elf", want) + + want = []wantRange{ + {0x401126, [][2]uint64{{0x401126, 0x40116a}}}, + {0x40116a, [][2]uint64{{0x40116a, 0x401180}}}, + } + testRanges(t, "testdata/line-gcc-zstd.elf", want) +} + +func TestRangesSection(t *testing.T) { + want := []wantRange{ + {0x400500, [][2]uint64{{0x400500, 0x400549}, {0x400400, 0x400408}}}, + {0x400400, [][2]uint64{{0x400500, 0x400549}, {0x400400, 0x400408}}}, + {0x400548, [][2]uint64{{0x400500, 0x400549}, {0x400400, 0x400408}}}, + {0x400407, [][2]uint64{{0x400500, 0x400549}, {0x400400, 0x400408}}}, + {0x400408, nil}, + {0x400449, nil}, + {0x4003ff, nil}, + } + testRanges(t, "testdata/ranges.elf", want) +} + +func TestRangesRnglistx(t *testing.T) { + want := []wantRange{ + {0x401000, [][2]uint64{{0x401020, 0x40102c}, {0x401000, 0x40101d}}}, + {0x40101c, [][2]uint64{{0x401020, 0x40102c}, {0x401000, 0x40101d}}}, + {0x40101d, nil}, + {0x40101f, nil}, + {0x401020, [][2]uint64{{0x401020, 0x40102c}, {0x401000, 0x40101d}}}, + {0x40102b, [][2]uint64{{0x401020, 0x40102c}, {0x401000, 0x40101d}}}, + {0x40102c, nil}, + } + testRanges(t, "testdata/rnglistx.elf", want) +} + +func testRanges(t *testing.T, name string, want []wantRange) { + d := elfData(t, name) + r := d.Reader() + for _, w := range want { + entry, err := r.SeekPC(w.pc) + if err != nil { + if w.ranges != nil { + t.Errorf("%s: missing Entry for %#x", name, w.pc) + } + if err != ErrUnknownPC { + t.Errorf("%s: expected ErrUnknownPC for %#x, got %v", name, w.pc, err) + } + continue + } + + ranges, err := d.Ranges(entry) + if err != nil { + t.Errorf("%s: %v", name, err) + continue + } + if !reflect.DeepEqual(ranges, w.ranges) { + t.Errorf("%s: for %#x got %x, expected %x", name, w.pc, ranges, w.ranges) + } + } +} + +func TestReaderRanges(t *testing.T) { + type subprograms []struct { + name string + ranges [][2]uint64 + } + tests := []struct { + filename string + subprograms subprograms + }{ + { + "testdata/line-gcc.elf", + subprograms{ + {"f1", [][2]uint64{{0x40059d, 0x4005e7}}}, + {"main", [][2]uint64{{0x4005e7, 0x400601}}}, + {"f2", [][2]uint64{{0x400601, 0x400611}}}, + }, + }, + { + "testdata/line-gcc-dwarf5.elf", + subprograms{ + {"main", [][2]uint64{{0x401147, 0x401166}}}, + {"f1", [][2]uint64{{0x401122, 0x401147}}}, + {"f2", [][2]uint64{{0x401166, 0x401179}}}, + }, + }, + { + "testdata/line-clang-dwarf5.elf", + subprograms{ + {"main", [][2]uint64{{0x401130, 0x401144}}}, + {"f1", [][2]uint64{{0x401150, 0x40117e}}}, + {"f2", [][2]uint64{{0x401180, 0x401197}}}, + }, + }, + { + "testdata/line-gcc-zstd.elf", + subprograms{ + {"f2", nil}, + {"main", [][2]uint64{{0x40114b, 0x40116a}}}, + {"f1", [][2]uint64{{0x401126, 0x40114b}}}, + {"f2", [][2]uint64{{0x40116a, 0x401180}}}, + }, + }, + } + + for _, test := range tests { + d := elfData(t, test.filename) + subprograms := test.subprograms + + r := d.Reader() + i := 0 + for entry, err := r.Next(); entry != nil && err == nil; entry, err = r.Next() { + if entry.Tag != TagSubprogram { + continue + } + + if i > len(subprograms) { + t.Fatalf("%s: too many subprograms (expected at most %d)", test.filename, i) + } + + if got := entry.Val(AttrName).(string); got != subprograms[i].name { + t.Errorf("%s: subprogram %d name is %s, expected %s", test.filename, i, got, subprograms[i].name) + } + ranges, err := d.Ranges(entry) + if err != nil { + t.Errorf("%s: subprogram %d: %v", test.filename, i, err) + continue + } + if !reflect.DeepEqual(ranges, subprograms[i].ranges) { + t.Errorf("%s: subprogram %d ranges are %x, expected %x", test.filename, i, ranges, subprograms[i].ranges) + } + i++ + } + + if i < len(subprograms) { + t.Errorf("%s: saw only %d subprograms, expected %d", test.filename, i, len(subprograms)) + } + } +} + +func Test64Bit(t *testing.T) { + // I don't know how to generate a 64-bit DWARF debug + // compilation unit except by using XCOFF, so this is + // hand-written. + tests := []struct { + name string + info []byte + addrSize int + byteOrder binary.ByteOrder + }{ + { + "32-bit little", + []byte{0x30, 0, 0, 0, // comp unit length + 4, 0, // DWARF version 4 + 0, 0, 0, 0, // abbrev offset + 8, // address size + 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + }, + 8, binary.LittleEndian, + }, + { + "64-bit little", + []byte{0xff, 0xff, 0xff, 0xff, // 64-bit DWARF + 0x30, 0, 0, 0, 0, 0, 0, 0, // comp unit length + 4, 0, // DWARF version 4 + 0, 0, 0, 0, 0, 0, 0, 0, // abbrev offset + 8, // address size + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + }, + 8, binary.LittleEndian, + }, + { + "64-bit big", + []byte{0xff, 0xff, 0xff, 0xff, // 64-bit DWARF + 0, 0, 0, 0, 0, 0, 0, 0x30, // comp unit length + 0, 4, // DWARF version 4 + 0, 0, 0, 0, 0, 0, 0, 0, // abbrev offset + 8, // address size + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + }, + 8, binary.BigEndian, + }, + } + + for _, test := range tests { + data, err := New(nil, nil, nil, test.info, nil, nil, nil, nil) + if err != nil { + t.Errorf("%s: %v", test.name, err) + } + + r := data.Reader() + if r.AddressSize() != test.addrSize { + t.Errorf("%s: got address size %d, want %d", test.name, r.AddressSize(), test.addrSize) + } + if r.ByteOrder() != test.byteOrder { + t.Errorf("%s: got byte order %s, want %s", test.name, r.ByteOrder(), test.byteOrder) + } + } +} + +func TestUnitIteration(t *testing.T) { + // Iterate over all ELF test files we have and ensure that + // we get the same set of compilation units skipping (method 0) + // and not skipping (method 1) CU children. + files, err := filepath.Glob(filepath.Join("testdata", "*.elf")) + if err != nil { + t.Fatal(err) + } + for _, file := range files { + t.Run(file, func(t *testing.T) { + d := elfData(t, file) + var units [2][]any + for method := range units { + for r := d.Reader(); ; { + ent, err := r.Next() + if err != nil { + t.Fatal(err) + } + if ent == nil { + break + } + if ent.Tag == TagCompileUnit { + units[method] = append(units[method], ent.Val(AttrName)) + } + if method == 0 { + if ent.Tag != TagCompileUnit { + t.Fatalf("found unexpected tag %v on top level", ent.Tag) + } + r.SkipChildren() + } + } + } + t.Logf("skipping CUs: %v", units[0]) + t.Logf("not-skipping CUs: %v", units[1]) + if !reflect.DeepEqual(units[0], units[1]) { + t.Fatal("set of CUs differ") + } + }) + } +} + +func TestIssue51758(t *testing.T) { + abbrev := []byte{0x21, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x5c, + 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, + 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, + 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, + 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, + 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, + 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, + 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, + 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, + 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, + 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, + 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, + 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, + 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, + 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, + 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, + 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, + 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x22, 0x5c, + 0x6e, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6e, 0x66, 0x6f, 0x3a, 0x20, + 0x5c, 0x22, 0x5c, 0x5c, 0x30, 0x30, 0x35, 0x5c, 0x5c, 0x30, 0x30, + 0x30, 0x5c, 0x5c, 0x30, 0x30, 0x30, 0x5c, 0x5c, 0x30, 0x30, 0x30, + 0x5c, 0x5c, 0x30, 0x30, 0x34, 0x5c, 0x5c, 0x30, 0x30, 0x30, 0x5c, + 0x5c, 0x30, 0x30, 0x30, 0x2d, 0x5c, 0x5c, 0x30, 0x30, 0x30, 0x5c, + 0x22, 0x5c, 0x6e, 0x20, 0x20, 0x7d, 0x5c, 0x6e, 0x7d, 0x5c, 0x6e, + 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x72, 0x61, 0x6d, 0x65, + 0x3a, 0x20, 0x22, 0x21, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, + 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, + 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, + 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, + 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, + 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, + 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, + 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, + 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, + 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, + 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, + 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, + 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, + 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, + 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, + 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, + 0x5c, 0x33, 0x37, 0x37, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, + 0x6e, 0x66, 0x6f, 0x3a, 0x20, 0x22, 0x5c, 0x30, 0x30, 0x35, 0x5c, + 0x30, 0x30, 0x30, 0x5c, 0x30, 0x30, 0x30, 0x5c, 0x30, 0x30, 0x30, + 0x5c, 0x30, 0x30, 0x34, 0x5c, 0x30, 0x30, 0x30, 0x5c, 0x30, 0x30, + 0x30, 0x2d, 0x5c, 0x30, 0x30, 0x30, 0x22, 0x0a, 0x20, 0x20, 0x7d, + 0x0a, 0x7d, 0x0a, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x7b, 0x0a, 0x7d, + 0x0a, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x7b, 0x0a, 0x7d, 0x0a, 0x6c, + 0x69, 0x73, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x4e, 0x65, 0x77, + 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x61, 0x62, 0x62, 0x72, + 0x65, 0x76, 0x3a, 0x20, 0x22, 0x5c, 0x30, 0x30, 0x35, 0x5c, 0x30, + 0x30, 0x30, 0x5c, 0x30, 0x30, 0x30, 0x5c, 0x30, 0x30, 0x30, 0x5c, + 0x30, 0x30, 0x34, 0x5c, 0x30, 0x30, 0x30, 0x5c, 0x30, 0x30, 0x30, + 0x2d, 0x5c, 0x30, 0x30, 0x30, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x7b, + 0x5c, 0x6e, 0x20, 0x20, 0x4e, 0x65, 0x77, 0x20, 0x7b, 0x5c, 0x6e, + 0x20, 0x20, 0x20, 0x20, 0x61, 0x62, 0x62, 0x72, 0x65, 0x76, 0x3a, + 0x20, 0x5c, 0x22, 0x21, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, + 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, + 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, + 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, + 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, + 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, + 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, + 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, + 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, + 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, + 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, + 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, + 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, + 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, + 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, + 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, + 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, + 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, + 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, + 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x5c, 0x33, 0x37, 0x37, 0x5c, + 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x22, 0x5c, 0x6e, 0x20, 0x20, 0x20, + 0x20, 0x69, 0x6e, 0x66, 0x6f, 0x3a, 0x20, 0x5c, 0x22, 0x5c, 0x5c, + 0x30, 0x30, 0x35, 0x5c, 0x5c, 0x30, 0x30, 0x30, 0x5c, 0x5c, 0x30, + 0x30, 0x30, 0x5c, 0x5c, 0x30, 0x30, 0x30, 0x5c, 0x5c, 0x30, 0x30, + 0x34, 0x5c, 0x5c, 0x30, 0x30, 0x30, 0x5c, 0x5c, 0x30, 0x30, 0x30, + 0x2d, 0x5c, 0x5c, 0x30, 0x30, 0x30, 0x5c, 0x22, 0x5c, 0x6e, 0x20, + 0x20, 0x7d, 0x5c, 0x6e, 0x7d, 0x5c, 0x6e, 0x22, 0x0a, 0x20, 0x20, + 0x20, 0x20, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x3a, 0x20, 0x22, 0x21, + 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, + 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, + 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, + 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, + 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, + 0x37, 0x5c, 0x33, 0x37, 0x37, 0x5c, 0x33, 0x37, 0x37, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff} + aranges := []byte{0x2c} + frame := []byte{} + info := []byte{0x5, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x2d, 0x0, 0x5, + 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x2d, 0x0} + + // The input above is malformed; the goal here it just to make sure + // that we don't get a panic or other bad behavior while trying to + // construct a dwarf.Data object from the input. For good measure, + // test to make sure we can handle the case where the input is + // truncated as well. + for i := 0; i <= len(info); i++ { + truncated := info[:i] + dw, err := New(abbrev, aranges, frame, truncated, nil, nil, nil, nil) + if err == nil { + t.Errorf("expected error") + } else { + if dw != nil { + t.Errorf("got non-nil dw, wanted nil") + } + } + } +} + +func TestIssue52045(t *testing.T) { + var abbrev, aranges, frame, line, pubnames, ranges, str []byte + info := []byte{0x7, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0} + + // A hand-crafted input corresponding to a minimal-size + // .debug_info (header only, no DIEs) and an empty abbrev table. + data0, _ := New(abbrev, aranges, frame, info, line, pubnames, ranges, str) + reader0 := data0.Reader() + entry0, _ := reader0.SeekPC(0x0) + // main goal is to make sure we can get here without crashing + if entry0 != nil { + t.Errorf("got non-nil entry0, wanted nil") + } +} + +func TestIssue57046(t *testing.T) { + f, err := elf.Open("testdata/issue57046-clang.elf5") + if err != nil { + t.Fatalf("elf.Open returns err: %v", err) + } + d, err := f.DWARF() + if err != nil { + t.Fatalf("f.DWARF returns err: %v", err) + } + // Write down all the subprogram DIEs. + spdies := []Offset{} + lopcs := []uint64{} + r := d.Reader() + for { + e, err := r.Next() + if err != nil { + t.Fatalf("r.Next() returns err: %v", err) + } + if e == nil { + break + } + if e.Tag != TagSubprogram { + continue + } + var name string + var lopc uint64 + if n, ok := e.Val(AttrName).(string); ok { + name = n + } + if lo, ok := e.Val(AttrLowpc).(uint64); ok { + lopc = lo + } + if name == "" || lopc == 0 { + continue + } + spdies = append(spdies, e.Offset) + lopcs = append(lopcs, lopc) + } + + // Seek to the second entry in spdies (corresponding to mom() in + // issue57046_part2.c) and take a look at it. + r2 := d.Reader() + r2.Seek(spdies[1]) + e, err := r2.Next() + if err != nil { + t.Fatalf("r2.Next() returns err: %v", err) + } + if e == nil { + t.Fatalf("r2.Next() returned nil") + } + + // Verify that the lopc we see matches what we saw before. + got := e.Val(AttrLowpc).(uint64) + if got != lopcs[1] { + t.Errorf("bad lopc for fn2 following seek: want %x got %x\n", + lopcs[1], got) + } +} diff --git a/go/src/debug/dwarf/export_test.go b/go/src/debug/dwarf/export_test.go new file mode 100644 index 0000000000000000000000000000000000000000..b8a25ff531de97a51f84e1a9bc7c6f4a13aab39e --- /dev/null +++ b/go/src/debug/dwarf/export_test.go @@ -0,0 +1,7 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package dwarf + +var PathJoin = pathJoin diff --git a/go/src/debug/dwarf/line.go b/go/src/debug/dwarf/line.go new file mode 100644 index 0000000000000000000000000000000000000000..3811416b921a43e051ccb125ce7de55288542d60 --- /dev/null +++ b/go/src/debug/dwarf/line.go @@ -0,0 +1,852 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package dwarf + +import ( + "errors" + "fmt" + "io" + "path" + "strings" +) + +// A LineReader reads a sequence of [LineEntry] structures from a DWARF +// "line" section for a single compilation unit. LineEntries occur in +// order of increasing PC and each [LineEntry] gives metadata for the +// instructions from that [LineEntry]'s PC to just before the next +// [LineEntry]'s PC. The last entry will have the [LineEntry.EndSequence] field set. +type LineReader struct { + buf buf + + // Original .debug_line section data. Used by Seek. + section []byte + + str []byte // .debug_str + lineStr []byte // .debug_line_str + + // Header information + version uint16 + addrsize int + segmentSelectorSize int + minInstructionLength int + maxOpsPerInstruction int + defaultIsStmt bool + lineBase int + lineRange int + opcodeBase int + opcodeLengths []int + directories []string + fileEntries []*LineFile + + programOffset Offset // section offset of line number program + endOffset Offset // section offset of byte following program + + initialFileEntries int // initial length of fileEntries + + // Current line number program state machine registers + state LineEntry // public state + fileIndex int // private state +} + +// A LineEntry is a row in a DWARF line table. +type LineEntry struct { + // Address is the program-counter value of a machine + // instruction generated by the compiler. This LineEntry + // applies to each instruction from Address to just before the + // Address of the next LineEntry. + Address uint64 + + // OpIndex is the index of an operation within a VLIW + // instruction. The index of the first operation is 0. For + // non-VLIW architectures, it will always be 0. Address and + // OpIndex together form an operation pointer that can + // reference any individual operation within the instruction + // stream. + OpIndex int + + // File is the source file corresponding to these + // instructions. + File *LineFile + + // Line is the source code line number corresponding to these + // instructions. Lines are numbered beginning at 1. It may be + // 0 if these instructions cannot be attributed to any source + // line. + Line int + + // Column is the column number within the source line of these + // instructions. Columns are numbered beginning at 1. It may + // be 0 to indicate the "left edge" of the line. + Column int + + // IsStmt indicates that Address is a recommended breakpoint + // location, such as the beginning of a line, statement, or a + // distinct subpart of a statement. + IsStmt bool + + // BasicBlock indicates that Address is the beginning of a + // basic block. + BasicBlock bool + + // PrologueEnd indicates that Address is one (of possibly + // many) PCs where execution should be suspended for a + // breakpoint on entry to the containing function. + // + // Added in DWARF 3. + PrologueEnd bool + + // EpilogueBegin indicates that Address is one (of possibly + // many) PCs where execution should be suspended for a + // breakpoint on exit from this function. + // + // Added in DWARF 3. + EpilogueBegin bool + + // ISA is the instruction set architecture for these + // instructions. Possible ISA values should be defined by the + // applicable ABI specification. + // + // Added in DWARF 3. + ISA int + + // Discriminator is an arbitrary integer indicating the block + // to which these instructions belong. It serves to + // distinguish among multiple blocks that may all have with + // the same source file, line, and column. Where only one + // block exists for a given source position, it should be 0. + // + // Added in DWARF 3. + Discriminator int + + // EndSequence indicates that Address is the first byte after + // the end of a sequence of target machine instructions. If it + // is set, only this and the Address field are meaningful. A + // line number table may contain information for multiple + // potentially disjoint instruction sequences. The last entry + // in a line table should always have EndSequence set. + EndSequence bool +} + +// A LineFile is a source file referenced by a DWARF line table entry. +type LineFile struct { + Name string + Mtime uint64 // Implementation defined modification time, or 0 if unknown + Length int // File length, or 0 if unknown +} + +// LineReader returns a new reader for the line table of compilation +// unit cu, which must be an [Entry] with tag [TagCompileUnit]. +// +// If this compilation unit has no line table, it returns nil, nil. +func (d *Data) LineReader(cu *Entry) (*LineReader, error) { + if d.line == nil { + // No line tables available. + return nil, nil + } + + // Get line table information from cu. + off, ok := cu.Val(AttrStmtList).(int64) + if !ok { + // cu has no line table. + return nil, nil + } + if off < 0 || off > int64(len(d.line)) { + return nil, errors.New("AttrStmtList value out of range") + } + // AttrCompDir is optional if all file names are absolute. Use + // the empty string if it's not present. + compDir, _ := cu.Val(AttrCompDir).(string) + + // Create the LineReader. + u := &d.unit[d.offsetToUnit(cu.Offset)] + buf := makeBuf(d, u, "line", Offset(off), d.line[off:]) + // The compilation directory is implicitly directories[0]. + r := LineReader{ + buf: buf, + section: d.line, + str: d.str, + lineStr: d.lineStr, + } + + // Read the header. + if err := r.readHeader(compDir); err != nil { + return nil, err + } + + // Initialize line reader state. + r.Reset() + + return &r, nil +} + +// readHeader reads the line number program header from r.buf and sets +// all of the header fields in r. +func (r *LineReader) readHeader(compDir string) error { + buf := &r.buf + + // Read basic header fields [DWARF2 6.2.4]. + hdrOffset := buf.off + unitLength, dwarf64 := buf.unitLength() + r.endOffset = buf.off + unitLength + if r.endOffset > buf.off+Offset(len(buf.data)) { + return DecodeError{"line", hdrOffset, fmt.Sprintf("line table end %d exceeds section size %d", r.endOffset, buf.off+Offset(len(buf.data)))} + } + r.version = buf.uint16() + if buf.err == nil && (r.version < 2 || r.version > 5) { + // DWARF goes to all this effort to make new opcodes + // backward-compatible, and then adds fields right in + // the middle of the header in new versions, so we're + // picky about only supporting known line table + // versions. + return DecodeError{"line", hdrOffset, fmt.Sprintf("unknown line table version %d", r.version)} + } + if r.version >= 5 { + r.addrsize = int(buf.uint8()) + r.segmentSelectorSize = int(buf.uint8()) + } else { + r.addrsize = buf.format.addrsize() + r.segmentSelectorSize = 0 + } + var headerLength Offset + if dwarf64 { + headerLength = Offset(buf.uint64()) + } else { + headerLength = Offset(buf.uint32()) + } + programOffset := buf.off + headerLength + if programOffset > r.endOffset { + return DecodeError{"line", hdrOffset, fmt.Sprintf("malformed line table: program offset %d exceeds end offset %d", programOffset, r.endOffset)} + } + r.programOffset = programOffset + r.minInstructionLength = int(buf.uint8()) + if r.version >= 4 { + // [DWARF4 6.2.4] + r.maxOpsPerInstruction = int(buf.uint8()) + } else { + r.maxOpsPerInstruction = 1 + } + r.defaultIsStmt = buf.uint8() != 0 + r.lineBase = int(int8(buf.uint8())) + r.lineRange = int(buf.uint8()) + + // Validate header. + if buf.err != nil { + return buf.err + } + if r.maxOpsPerInstruction == 0 { + return DecodeError{"line", hdrOffset, "invalid maximum operations per instruction: 0"} + } + if r.lineRange == 0 { + return DecodeError{"line", hdrOffset, "invalid line range: 0"} + } + + // Read standard opcode length table. This table starts with opcode 1. + r.opcodeBase = int(buf.uint8()) + r.opcodeLengths = make([]int, r.opcodeBase) + for i := 1; i < r.opcodeBase; i++ { + r.opcodeLengths[i] = int(buf.uint8()) + } + + // Validate opcode lengths. + if buf.err != nil { + return buf.err + } + for i, length := range r.opcodeLengths { + if known, ok := knownOpcodeLengths[i]; ok && known != length { + return DecodeError{"line", hdrOffset, fmt.Sprintf("opcode %d expected to have length %d, but has length %d", i, known, length)} + } + } + + if r.version < 5 { + // Read include directories table. + r.directories = []string{compDir} + for { + directory := buf.string() + if buf.err != nil { + return buf.err + } + if len(directory) == 0 { + break + } + if !pathIsAbs(directory) { + // Relative paths are implicitly relative to + // the compilation directory. + directory = pathJoin(compDir, directory) + } + r.directories = append(r.directories, directory) + } + + // Read file name list. File numbering starts with 1, + // so leave the first entry nil. + r.fileEntries = make([]*LineFile, 1) + for { + if done, err := r.readFileEntry(); err != nil { + return err + } else if done { + break + } + } + } else { + dirFormat := r.readLNCTFormat() + c := buf.uint() + r.directories = make([]string, c) + for i := range r.directories { + dir, _, _, err := r.readLNCT(dirFormat, dwarf64) + if err != nil { + return err + } + r.directories[i] = dir + } + fileFormat := r.readLNCTFormat() + c = buf.uint() + r.fileEntries = make([]*LineFile, c) + for i := range r.fileEntries { + name, mtime, size, err := r.readLNCT(fileFormat, dwarf64) + if err != nil { + return err + } + r.fileEntries[i] = &LineFile{name, mtime, int(size)} + } + } + + r.initialFileEntries = len(r.fileEntries) + + return buf.err +} + +// lnctForm is a pair of an LNCT code and a form. This represents an +// entry in the directory name or file name description in the DWARF 5 +// line number program header. +type lnctForm struct { + lnct int + form format +} + +// readLNCTFormat reads an LNCT format description. +func (r *LineReader) readLNCTFormat() []lnctForm { + c := r.buf.uint8() + ret := make([]lnctForm, c) + for i := range ret { + ret[i].lnct = int(r.buf.uint()) + ret[i].form = format(r.buf.uint()) + } + return ret +} + +// readLNCT reads a sequence of LNCT entries and returns path information. +func (r *LineReader) readLNCT(s []lnctForm, dwarf64 bool) (path string, mtime uint64, size uint64, err error) { + var dir string + for _, lf := range s { + var str string + var val uint64 + switch lf.form { + case formString: + str = r.buf.string() + case formStrp, formLineStrp: + var off uint64 + if dwarf64 { + off = r.buf.uint64() + } else { + off = uint64(r.buf.uint32()) + } + if uint64(int(off)) != off { + return "", 0, 0, DecodeError{"line", r.buf.off, "strp/line_strp offset out of range"} + } + var b1 buf + if lf.form == formStrp { + b1 = makeBuf(r.buf.dwarf, r.buf.format, "str", 0, r.str) + } else { + b1 = makeBuf(r.buf.dwarf, r.buf.format, "line_str", 0, r.lineStr) + } + b1.skip(int(off)) + str = b1.string() + if b1.err != nil { + return "", 0, 0, DecodeError{"line", r.buf.off, b1.err.Error()} + } + case formStrpSup: + // Supplemental sections not yet supported. + if dwarf64 { + r.buf.uint64() + } else { + r.buf.uint32() + } + case formStrx: + // .debug_line.dwo sections not yet supported. + r.buf.uint() + case formStrx1: + r.buf.uint8() + case formStrx2: + r.buf.uint16() + case formStrx3: + r.buf.uint24() + case formStrx4: + r.buf.uint32() + case formData1: + val = uint64(r.buf.uint8()) + case formData2: + val = uint64(r.buf.uint16()) + case formData4: + val = uint64(r.buf.uint32()) + case formData8: + val = r.buf.uint64() + case formData16: + r.buf.bytes(16) + case formDwarfBlock: + r.buf.bytes(int(r.buf.uint())) + case formUdata: + val = r.buf.uint() + } + + switch lf.lnct { + case lnctPath: + path = str + case lnctDirectoryIndex: + if val >= uint64(len(r.directories)) { + return "", 0, 0, DecodeError{"line", r.buf.off, "directory index out of range"} + } + dir = r.directories[val] + case lnctTimestamp: + mtime = val + case lnctSize: + size = val + case lnctMD5: + // Ignored. + } + } + + if dir != "" && path != "" { + path = pathJoin(dir, path) + } + + return path, mtime, size, nil +} + +// readFileEntry reads a file entry from either the header or a +// DW_LNE_define_file extended opcode and adds it to r.fileEntries. A +// true return value indicates that there are no more entries to read. +func (r *LineReader) readFileEntry() (bool, error) { + name := r.buf.string() + if r.buf.err != nil { + return false, r.buf.err + } + if len(name) == 0 { + return true, nil + } + off := r.buf.off + dirIndex := int(r.buf.uint()) + if !pathIsAbs(name) { + if dirIndex >= len(r.directories) { + return false, DecodeError{"line", off, "directory index too large"} + } + name = pathJoin(r.directories[dirIndex], name) + } + mtime := r.buf.uint() + length := int(r.buf.uint()) + + // If this is a dynamically added path and the cursor was + // backed up, we may have already added this entry. Avoid + // updating existing line table entries in this case. This + // avoids an allocation and potential racy access to the slice + // backing store if the user called Files. + if len(r.fileEntries) < cap(r.fileEntries) { + fe := r.fileEntries[:len(r.fileEntries)+1] + if fe[len(fe)-1] != nil { + // We already processed this addition. + r.fileEntries = fe + return false, nil + } + } + r.fileEntries = append(r.fileEntries, &LineFile{name, mtime, length}) + return false, nil +} + +// updateFile updates r.state.File after r.fileIndex has +// changed or r.fileEntries has changed. +func (r *LineReader) updateFile() { + if r.fileIndex < len(r.fileEntries) { + r.state.File = r.fileEntries[r.fileIndex] + } else { + r.state.File = nil + } +} + +// Next sets *entry to the next row in this line table and moves to +// the next row. If there are no more entries and the line table is +// properly terminated, it returns [io.EOF]. +// +// Rows are always in order of increasing entry.Address, but +// entry.Line may go forward or backward. +func (r *LineReader) Next(entry *LineEntry) error { + if r.buf.err != nil { + return r.buf.err + } + + // Execute opcodes until we reach an opcode that emits a line + // table entry. + for { + if len(r.buf.data) == 0 { + return io.EOF + } + emit := r.step(entry) + if r.buf.err != nil { + return r.buf.err + } + if emit { + return nil + } + } +} + +// knownOpcodeLengths gives the opcode lengths (in varint arguments) +// of known standard opcodes. +var knownOpcodeLengths = map[int]int{ + lnsCopy: 0, + lnsAdvancePC: 1, + lnsAdvanceLine: 1, + lnsSetFile: 1, + lnsNegateStmt: 0, + lnsSetBasicBlock: 0, + lnsConstAddPC: 0, + lnsSetPrologueEnd: 0, + lnsSetEpilogueBegin: 0, + lnsSetISA: 1, + // lnsFixedAdvancePC takes a uint8 rather than a varint; it's + // unclear what length the header is supposed to claim, so + // ignore it. +} + +// step processes the next opcode and updates r.state. If the opcode +// emits a row in the line table, this updates *entry and returns +// true. +func (r *LineReader) step(entry *LineEntry) bool { + opcode := int(r.buf.uint8()) + + if opcode >= r.opcodeBase { + // Special opcode [DWARF2 6.2.5.1, DWARF4 6.2.5.1] + adjustedOpcode := opcode - r.opcodeBase + r.advancePC(adjustedOpcode / r.lineRange) + lineDelta := r.lineBase + adjustedOpcode%r.lineRange + r.state.Line += lineDelta + goto emit + } + + switch opcode { + case 0: + // Extended opcode [DWARF2 6.2.5.3] + length := Offset(r.buf.uint()) + startOff := r.buf.off + opcode := r.buf.uint8() + + switch opcode { + case lneEndSequence: + r.state.EndSequence = true + *entry = r.state + r.resetState() + + case lneSetAddress: + switch r.addrsize { + case 1: + r.state.Address = uint64(r.buf.uint8()) + case 2: + r.state.Address = uint64(r.buf.uint16()) + case 4: + r.state.Address = uint64(r.buf.uint32()) + case 8: + r.state.Address = r.buf.uint64() + default: + r.buf.error("unknown address size") + } + + case lneDefineFile: + if done, err := r.readFileEntry(); err != nil { + r.buf.err = err + return false + } else if done { + r.buf.err = DecodeError{"line", startOff, "malformed DW_LNE_define_file operation"} + return false + } + r.updateFile() + + case lneSetDiscriminator: + // [DWARF4 6.2.5.3] + r.state.Discriminator = int(r.buf.uint()) + } + + r.buf.skip(int(startOff + length - r.buf.off)) + + if opcode == lneEndSequence { + return true + } + + // Standard opcodes [DWARF2 6.2.5.2] + case lnsCopy: + goto emit + + case lnsAdvancePC: + r.advancePC(int(r.buf.uint())) + + case lnsAdvanceLine: + r.state.Line += int(r.buf.int()) + + case lnsSetFile: + r.fileIndex = int(r.buf.uint()) + r.updateFile() + + case lnsSetColumn: + r.state.Column = int(r.buf.uint()) + + case lnsNegateStmt: + r.state.IsStmt = !r.state.IsStmt + + case lnsSetBasicBlock: + r.state.BasicBlock = true + + case lnsConstAddPC: + r.advancePC((255 - r.opcodeBase) / r.lineRange) + + case lnsFixedAdvancePC: + r.state.Address += uint64(r.buf.uint16()) + + // DWARF3 standard opcodes [DWARF3 6.2.5.2] + case lnsSetPrologueEnd: + r.state.PrologueEnd = true + + case lnsSetEpilogueBegin: + r.state.EpilogueBegin = true + + case lnsSetISA: + r.state.ISA = int(r.buf.uint()) + + default: + // Unhandled standard opcode. Skip the number of + // arguments that the prologue says this opcode has. + for i := 0; i < r.opcodeLengths[opcode]; i++ { + r.buf.uint() + } + } + return false + +emit: + *entry = r.state + r.state.BasicBlock = false + r.state.PrologueEnd = false + r.state.EpilogueBegin = false + r.state.Discriminator = 0 + return true +} + +// advancePC advances "operation pointer" (the combination of Address +// and OpIndex) in r.state by opAdvance steps. +func (r *LineReader) advancePC(opAdvance int) { + opIndex := r.state.OpIndex + opAdvance + r.state.Address += uint64(r.minInstructionLength * (opIndex / r.maxOpsPerInstruction)) + r.state.OpIndex = opIndex % r.maxOpsPerInstruction +} + +// A LineReaderPos represents a position in a line table. +type LineReaderPos struct { + // off is the current offset in the DWARF line section. + off Offset + // numFileEntries is the length of fileEntries. + numFileEntries int + // state and fileIndex are the statement machine state at + // offset off. + state LineEntry + fileIndex int +} + +// Tell returns the current position in the line table. +func (r *LineReader) Tell() LineReaderPos { + return LineReaderPos{r.buf.off, len(r.fileEntries), r.state, r.fileIndex} +} + +// Seek restores the line table reader to a position returned by [LineReader.Tell]. +// +// The argument pos must have been returned by a call to [LineReader.Tell] on this +// line table. +func (r *LineReader) Seek(pos LineReaderPos) { + r.buf.off = pos.off + r.buf.data = r.section[r.buf.off:r.endOffset] + r.fileEntries = r.fileEntries[:pos.numFileEntries] + r.state = pos.state + r.fileIndex = pos.fileIndex +} + +// Reset repositions the line table reader at the beginning of the +// line table. +func (r *LineReader) Reset() { + // Reset buffer to the line number program offset. + r.buf.off = r.programOffset + r.buf.data = r.section[r.buf.off:r.endOffset] + + // Reset file entries list. + r.fileEntries = r.fileEntries[:r.initialFileEntries] + + // Reset line number program state. + r.resetState() +} + +// resetState resets r.state to its default values +func (r *LineReader) resetState() { + // Reset the state machine registers to the defaults given in + // [DWARF4 6.2.2]. + r.state = LineEntry{ + Address: 0, + OpIndex: 0, + File: nil, + Line: 1, + Column: 0, + IsStmt: r.defaultIsStmt, + BasicBlock: false, + PrologueEnd: false, + EpilogueBegin: false, + ISA: 0, + Discriminator: 0, + } + r.fileIndex = 1 + r.updateFile() +} + +// Files returns the file name table of this compilation unit as of +// the current position in the line table. The file name table may be +// referenced from attributes in this compilation unit such as +// [AttrDeclFile]. +// +// Entry 0 is always nil, since file index 0 represents "no file". +// +// The file name table of a compilation unit is not fixed. Files +// returns the file table as of the current position in the line +// table. This may contain more entries than the file table at an +// earlier position in the line table, though existing entries never +// change. +func (r *LineReader) Files() []*LineFile { + return r.fileEntries +} + +// ErrUnknownPC is the error returned by LineReader.ScanPC when the +// seek PC is not covered by any entry in the line table. +var ErrUnknownPC = errors.New("ErrUnknownPC") + +// SeekPC sets *entry to the [LineEntry] that includes pc and positions +// the reader on the next entry in the line table. If necessary, this +// will seek backwards to find pc. +// +// If pc is not covered by any entry in this line table, SeekPC +// returns [ErrUnknownPC]. In this case, *entry and the final seek +// position are unspecified. +// +// Note that DWARF line tables only permit sequential, forward scans. +// Hence, in the worst case, this takes time linear in the size of the +// line table. If the caller wishes to do repeated fast PC lookups, it +// should build an appropriate index of the line table. +func (r *LineReader) SeekPC(pc uint64, entry *LineEntry) error { + if err := r.Next(entry); err != nil { + return err + } + if entry.Address > pc { + // We're too far. Start at the beginning of the table. + r.Reset() + if err := r.Next(entry); err != nil { + return err + } + if entry.Address > pc { + // The whole table starts after pc. + r.Reset() + return ErrUnknownPC + } + } + + // Scan until we pass pc, then back up one. + for { + var next LineEntry + pos := r.Tell() + if err := r.Next(&next); err != nil { + if err == io.EOF { + return ErrUnknownPC + } + return err + } + if next.Address > pc { + if entry.EndSequence { + // pc is in a hole in the table. + return ErrUnknownPC + } + // entry is the desired entry. Back up the + // cursor to "next" and return success. + r.Seek(pos) + return nil + } + *entry = next + } +} + +// pathIsAbs reports whether path is an absolute path (or "full path +// name" in DWARF parlance). This is in "whatever form makes sense for +// the host system", so this accepts both UNIX-style and DOS-style +// absolute paths. We avoid the filepath package because we want this +// to behave the same regardless of our host system and because we +// don't know what system the paths came from. +func pathIsAbs(path string) bool { + _, path = splitDrive(path) + return len(path) > 0 && (path[0] == '/' || path[0] == '\\') +} + +// pathJoin joins dirname and filename. filename must be relative. +// DWARF paths can be UNIX-style or DOS-style, so this handles both. +func pathJoin(dirname, filename string) string { + if len(dirname) == 0 { + return filename + } + // dirname should be absolute, which means we can determine + // whether it's a DOS path reasonably reliably by looking for + // a drive letter or UNC path. + drive, dirname := splitDrive(dirname) + if drive == "" { + // UNIX-style path. + return path.Join(dirname, filename) + } + // DOS-style path. + drive2, filename := splitDrive(filename) + if drive2 != "" { + if !strings.EqualFold(drive, drive2) { + // Different drives. There's not much we can + // do here, so just ignore the directory. + return drive2 + filename + } + // Drives are the same. Ignore drive on filename. + } + if !(strings.HasSuffix(dirname, "/") || strings.HasSuffix(dirname, `\`)) && dirname != "" { + sep := `\` + if strings.HasPrefix(dirname, "/") { + sep = `/` + } + dirname += sep + } + return drive + dirname + filename +} + +// splitDrive splits the DOS drive letter or UNC share point from +// path, if any. path == drive + rest +func splitDrive(path string) (drive, rest string) { + if len(path) >= 2 && path[1] == ':' { + if c := path[0]; 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' { + return path[:2], path[2:] + } + } + if len(path) > 3 && (path[0] == '\\' || path[0] == '/') && (path[1] == '\\' || path[1] == '/') { + // Normalize the path so we can search for just \ below. + npath := strings.ReplaceAll(path, "/", `\`) + // Get the host part, which must be non-empty. + slash1 := strings.IndexByte(npath[2:], '\\') + 2 + if slash1 > 2 { + // Get the mount-point part, which must be non-empty. + slash2 := strings.IndexByte(npath[slash1+1:], '\\') + slash1 + 1 + if slash2 > slash1 { + return path[:slash2], path[slash2:] + } + } + } + return "", path +} diff --git a/go/src/debug/dwarf/line_test.go b/go/src/debug/dwarf/line_test.go new file mode 100644 index 0000000000000000000000000000000000000000..0a7ade934af15eb895b90fd7d838865ae17ca245 --- /dev/null +++ b/go/src/debug/dwarf/line_test.go @@ -0,0 +1,462 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package dwarf_test + +import ( + . "debug/dwarf" + "io" + "strings" + "testing" +) + +var ( + file1C = &LineFile{Name: "/home/austin/go.dev/src/debug/dwarf/testdata/line1.c"} + file1H = &LineFile{Name: "/home/austin/go.dev/src/debug/dwarf/testdata/line1.h"} + file2C = &LineFile{Name: "/home/austin/go.dev/src/debug/dwarf/testdata/line2.c"} +) + +func TestLineELFGCC(t *testing.T) { + // Generated by: + // # gcc --version | head -n1 + // gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2 + // # gcc -g -o line-gcc.elf line*.c + + // Line table based on readelf --debug-dump=rawline,decodedline + want := []LineEntry{ + {Address: 0x40059d, File: file1H, Line: 2, IsStmt: true}, + {Address: 0x4005a5, File: file1H, Line: 2, IsStmt: true}, + {Address: 0x4005b4, File: file1H, Line: 5, IsStmt: true}, + {Address: 0x4005bd, File: file1H, Line: 6, IsStmt: true, Discriminator: 2}, + {Address: 0x4005c7, File: file1H, Line: 5, IsStmt: true, Discriminator: 2}, + {Address: 0x4005cb, File: file1H, Line: 5, IsStmt: false, Discriminator: 1}, + {Address: 0x4005d1, File: file1H, Line: 7, IsStmt: true}, + {Address: 0x4005e7, File: file1C, Line: 6, IsStmt: true}, + {Address: 0x4005eb, File: file1C, Line: 7, IsStmt: true}, + {Address: 0x4005f5, File: file1C, Line: 8, IsStmt: true}, + {Address: 0x4005ff, File: file1C, Line: 9, IsStmt: true}, + {Address: 0x400601, EndSequence: true}, + + {Address: 0x400601, File: file2C, Line: 4, IsStmt: true}, + {Address: 0x400605, File: file2C, Line: 5, IsStmt: true}, + {Address: 0x40060f, File: file2C, Line: 6, IsStmt: true}, + {Address: 0x400611, EndSequence: true}, + } + files := [][]*LineFile{{nil, file1H, file1C}, {nil, file2C}} + + testLineTable(t, want, files, elfData(t, "testdata/line-gcc.elf")) +} + +func TestLineELFGCCZstd(t *testing.T) { + // Generated by: + // # gcc --version | head -n1 + // gcc (Debian 12.2.0-10) 12.2.0 + // # gcc -g -no-pie -Wl,--compress-debug-sections=zstd line*.c + + zfile1H := &LineFile{Name: "/home/iant/go/src/debug/dwarf/testdata/line1.h"} + zfile1C := &LineFile{Name: "/home/iant/go/src/debug/dwarf/testdata/line1.c"} + zfile2C := &LineFile{Name: "/home/iant/go/src/debug/dwarf/testdata/line2.c"} + + // Line table based on readelf --debug-dump=rawline,decodedline + want := []LineEntry{ + {Address: 0x401126, File: zfile1H, Line: 2, Column: 1, IsStmt: true}, + {Address: 0x40112a, File: zfile1H, Line: 5, Column: 8, IsStmt: true}, + {Address: 0x401131, File: zfile1H, Line: 5, Column: 2, IsStmt: true}, + {Address: 0x401133, File: zfile1H, Line: 6, Column: 10, IsStmt: true, Discriminator: 3}, + {Address: 0x40113d, File: zfile1H, Line: 5, Column: 22, IsStmt: true, Discriminator: 3}, + {Address: 0x401141, File: zfile1H, Line: 5, Column: 15, IsStmt: true, Discriminator: 1}, + {Address: 0x401147, File: zfile1H, Line: 7, Column: 1, IsStmt: true}, + {Address: 0x40114b, File: zfile1C, Line: 6, Column: 1, IsStmt: true}, + {Address: 0x40114f, File: zfile1C, Line: 7, Column: 2, IsStmt: true}, + {Address: 0x401159, File: zfile1C, Line: 8, Column: 2, IsStmt: true}, + {Address: 0x401168, File: zfile1C, Line: 9, Column: 1, IsStmt: true}, + {Address: 0x40116a, EndSequence: true}, + + {Address: 0x40116a, File: zfile2C, Line: 4, Column: 1, IsStmt: true}, + {Address: 0x40116e, File: zfile2C, Line: 5, Column: 2, IsStmt: true}, + {Address: 0x40117d, File: zfile2C, Line: 6, Column: 1, IsStmt: true}, + {Address: 0x401180, EndSequence: true}, + } + files := [][]*LineFile{ + {zfile1C, zfile1H, zfile1C}, + {zfile2C, zfile2C}, + } + + testLineTable(t, want, files, elfData(t, "testdata/line-gcc-zstd.elf")) +} + +func TestLineGCCWindows(t *testing.T) { + // Generated by: + // > gcc --version + // gcc (tdm64-1) 4.9.2 + // > gcc -g -o line-gcc-win.bin line1.c C:\workdir\go\src\debug\dwarf\testdata\line2.c + + toWindows := func(lf *LineFile) *LineFile { + lf2 := *lf + lf2.Name = strings.ReplaceAll(lf2.Name, "/home/austin/go.dev/", "C:\\workdir\\go\\") + lf2.Name = strings.ReplaceAll(lf2.Name, "/", "\\") + return &lf2 + } + file1C := toWindows(file1C) + file1H := toWindows(file1H) + file2C := toWindows(file2C) + + // Line table based on objdump --dwarf=rawline,decodedline + want := []LineEntry{ + {Address: 0x401530, File: file1H, Line: 2, IsStmt: true}, + {Address: 0x401538, File: file1H, Line: 5, IsStmt: true}, + {Address: 0x401541, File: file1H, Line: 6, IsStmt: true, Discriminator: 3}, + {Address: 0x40154b, File: file1H, Line: 5, IsStmt: true, Discriminator: 3}, + {Address: 0x40154f, File: file1H, Line: 5, IsStmt: false, Discriminator: 1}, + {Address: 0x401555, File: file1H, Line: 7, IsStmt: true}, + {Address: 0x40155b, File: file1C, Line: 6, IsStmt: true}, + {Address: 0x401563, File: file1C, Line: 6, IsStmt: true}, + {Address: 0x401568, File: file1C, Line: 7, IsStmt: true}, + {Address: 0x40156d, File: file1C, Line: 8, IsStmt: true}, + {Address: 0x401572, File: file1C, Line: 9, IsStmt: true}, + {Address: 0x401578, EndSequence: true}, + + {Address: 0x401580, File: file2C, Line: 4, IsStmt: true}, + {Address: 0x401588, File: file2C, Line: 5, IsStmt: true}, + {Address: 0x401595, File: file2C, Line: 6, IsStmt: true}, + {Address: 0x40159b, EndSequence: true}, + } + files := [][]*LineFile{{nil, file1H, file1C}, {nil, file2C}} + + testLineTable(t, want, files, peData(t, "testdata/line-gcc-win.bin")) +} + +func TestLineELFClang(t *testing.T) { + // Generated by: + // # clang --version | head -n1 + // Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4) + // # clang -g -o line-clang.elf line*. + + want := []LineEntry{ + {Address: 0x400530, File: file1C, Line: 6, IsStmt: true}, + {Address: 0x400534, File: file1C, Line: 7, IsStmt: true, PrologueEnd: true}, + {Address: 0x400539, File: file1C, Line: 8, IsStmt: true}, + {Address: 0x400545, File: file1C, Line: 9, IsStmt: true}, + {Address: 0x400550, File: file1H, Line: 2, IsStmt: true}, + {Address: 0x400554, File: file1H, Line: 5, IsStmt: true, PrologueEnd: true}, + {Address: 0x400568, File: file1H, Line: 6, IsStmt: true}, + {Address: 0x400571, File: file1H, Line: 5, IsStmt: true}, + {Address: 0x400581, File: file1H, Line: 7, IsStmt: true}, + {Address: 0x400583, EndSequence: true}, + + {Address: 0x400590, File: file2C, Line: 4, IsStmt: true}, + {Address: 0x4005a0, File: file2C, Line: 5, IsStmt: true, PrologueEnd: true}, + {Address: 0x4005a7, File: file2C, Line: 6, IsStmt: true}, + {Address: 0x4005b0, EndSequence: true}, + } + files := [][]*LineFile{{nil, file1C, file1H}, {nil, file2C}} + + testLineTable(t, want, files, elfData(t, "testdata/line-clang.elf")) +} + +func TestLineRnglists(t *testing.T) { + // Test a newer file, generated by clang. + file := &LineFile{Name: "/usr/local/google/home/iant/foo.c"} + want := []LineEntry{ + {Address: 0x401020, File: file, Line: 12, IsStmt: true}, + {Address: 0x401020, File: file, Line: 13, Column: 12, IsStmt: true, PrologueEnd: true}, + {Address: 0x401022, File: file, Line: 13, Column: 7}, + {Address: 0x401024, File: file, Line: 17, Column: 1, IsStmt: true}, + {Address: 0x401027, File: file, Line: 16, Column: 10, IsStmt: true}, + {Address: 0x40102c, EndSequence: true}, + {Address: 0x401000, File: file, Line: 2, IsStmt: true}, + {Address: 0x401000, File: file, Line: 6, Column: 17, IsStmt: true, PrologueEnd: true}, + {Address: 0x401002, File: file, Line: 6, Column: 3}, + {Address: 0x401019, File: file, Line: 9, Column: 3, IsStmt: true}, + {Address: 0x40101a, File: file, Line: 0, Column: 3}, + {Address: 0x40101c, File: file, Line: 9, Column: 3}, + {Address: 0x40101d, EndSequence: true}, + } + files := [][]*LineFile{{file}} + + testLineTable(t, want, files, elfData(t, "testdata/rnglistx.elf")) +} + +func TestLineSeek(t *testing.T) { + d := elfData(t, "testdata/line-gcc.elf") + + // Get the line table for the first CU. + cu, err := d.Reader().Next() + if err != nil { + t.Fatal("d.Reader().Next:", err) + } + lr, err := d.LineReader(cu) + if err != nil { + t.Fatal("d.LineReader:", err) + } + + // Read entries forward. + var line LineEntry + var posTable []LineReaderPos + var table []LineEntry + for { + posTable = append(posTable, lr.Tell()) + + err := lr.Next(&line) + if err != nil { + if err == io.EOF { + break + } + t.Fatal("lr.Next:", err) + } + table = append(table, line) + } + + // Test that Reset returns to the first line. + lr.Reset() + if err := lr.Next(&line); err != nil { + t.Fatal("lr.Next after Reset failed:", err) + } else if line != table[0] { + t.Fatal("lr.Next after Reset returned", line, "instead of", table[0]) + } + + // Check that entries match when seeking backward. + for i := len(posTable) - 1; i >= 0; i-- { + lr.Seek(posTable[i]) + err := lr.Next(&line) + if i == len(posTable)-1 { + if err != io.EOF { + t.Fatal("expected io.EOF after seek to end, got", err) + } + } else if err != nil { + t.Fatal("lr.Next after seek to", posTable[i], "failed:", err) + } else if line != table[i] { + t.Fatal("lr.Next after seek to", posTable[i], "returned", line, "instead of", table[i]) + } + } + + // Check that seeking to a PC returns the right line. + if err := lr.SeekPC(table[0].Address-1, &line); err != ErrUnknownPC { + t.Fatalf("lr.SeekPC to %#x returned %v instead of ErrUnknownPC", table[0].Address-1, err) + } + for i, testLine := range table { + if testLine.EndSequence { + if err := lr.SeekPC(testLine.Address, &line); err != ErrUnknownPC { + t.Fatalf("lr.SeekPC to %#x returned %v instead of ErrUnknownPC", testLine.Address, err) + } + continue + } + + nextPC := table[i+1].Address + for pc := testLine.Address; pc < nextPC; pc++ { + if err := lr.SeekPC(pc, &line); err != nil { + t.Fatalf("lr.SeekPC to %#x failed: %v", pc, err) + } else if line != testLine { + t.Fatalf("lr.SeekPC to %#x returned %v instead of %v", pc, line, testLine) + } + } + } +} + +func testLineTable(t *testing.T, want []LineEntry, files [][]*LineFile, d *Data) { + // Get line table from d. + var got []LineEntry + dr := d.Reader() + for { + ent, err := dr.Next() + if err != nil { + t.Fatal("dr.Next:", err) + } else if ent == nil { + break + } + + if ent.Tag != TagCompileUnit { + dr.SkipChildren() + continue + } + + // Ignore system compilation units (this happens in + // the Windows binary). We'll still decode the line + // table, but won't check it. + name := ent.Val(AttrName).(string) + ignore := strings.HasPrefix(name, "C:/crossdev/") || strings.HasPrefix(name, "../../") + + // Decode CU's line table. + lr, err := d.LineReader(ent) + if err != nil { + t.Fatal("d.LineReader:", err) + } else if lr == nil { + continue + } + + for { + var line LineEntry + err := lr.Next(&line) + if err != nil { + if err == io.EOF { + break + } + t.Fatal("lr.Next:", err) + } + // Ignore sources from the Windows build environment. + if ignore { + continue + } + got = append(got, line) + } + + // Check file table. + if !ignore { + if !compareFiles(files[0], lr.Files()) { + t.Log("File tables do not match. Got:") + dumpFiles(t, lr.Files()) + t.Log("Want:") + dumpFiles(t, files[0]) + t.Fail() + } + files = files[1:] + } + } + + // Compare line tables. + if !compareLines(t, got, want) { + t.Log("Line tables do not match. Got:") + dumpLines(t, got) + t.Log("Want:") + dumpLines(t, want) + t.FailNow() + } +} + +func compareFiles(a, b []*LineFile) bool { + if len(a) != len(b) { + return false + } + for i := range a { + if a[i] == nil && b[i] == nil { + continue + } + if a[i] != nil && b[i] != nil && a[i].Name == b[i].Name { + continue + } + return false + } + return true +} + +func dumpFiles(t *testing.T, files []*LineFile) { + for i, f := range files { + name := "" + if f != nil { + name = f.Name + } + t.Logf(" %d %s", i, name) + } +} + +func compareLines(t *testing.T, a, b []LineEntry) bool { + t.Helper() + if len(a) != len(b) { + t.Errorf("len(a) == %d, len(b) == %d", len(a), len(b)) + return false + } + + for i := range a { + al, bl := a[i], b[i] + // If both are EndSequence, then the only other valid + // field is Address. Otherwise, test equality of all + // fields. + if al.EndSequence && bl.EndSequence && al.Address == bl.Address { + continue + } + if al.File.Name != bl.File.Name { + t.Errorf("%d: name %v != name %v", i, al.File.Name, bl.File.Name) + return false + } + al.File = nil + bl.File = nil + if al != bl { + t.Errorf("%d: %#v != %#v", i, al, bl) + return false + } + } + return true +} + +func dumpLines(t *testing.T, lines []LineEntry) { + for _, l := range lines { + t.Logf(" %+v File:%+v", l, l.File) + } +} + +type joinTest struct { + dirname, filename string + path string +} + +var joinTests = []joinTest{ + {"a", "b", "a/b"}, + {"a", "", "a"}, + {"", "b", "b"}, + {"/a", "b", "/a/b"}, + {"/a/", "b", "/a/b"}, + + {`C:\Windows\`, `System32`, `C:\Windows\System32`}, + {`C:\Windows\`, ``, `C:\Windows\`}, + {`C:\`, `Windows`, `C:\Windows`}, + {`C:\Windows\`, `C:System32`, `C:\Windows\System32`}, + {`C:\Windows`, `a/b`, `C:\Windows\a/b`}, + {`\\host\share\`, `foo`, `\\host\share\foo`}, + {`\\host\share\`, `foo\bar`, `\\host\share\foo\bar`}, + {`//host/share/`, `foo/bar`, `//host/share/foo/bar`}, + + // Note: the Go compiler currently emits DWARF line table paths + // with '/' instead of '\' (see issues #19784, #36495). These + // tests are to cover cases that might come up for Windows Go + // binaries. + {`c:/workdir/go/src/x`, `y.go`, `c:/workdir/go/src/x/y.go`}, + {`d:/some/thing/`, `b.go`, `d:/some/thing/b.go`}, + {`e:\blah\`, `foo.c`, `e:\blah\foo.c`}, + + // The following are "best effort". We shouldn't see relative + // base directories in DWARF, but these test that pathJoin + // doesn't fail miserably if it sees one. + {`C:`, `a`, `C:a`}, + {`C:`, `a\b`, `C:a\b`}, + {`C:.`, `a`, `C:.\a`}, + {`C:a`, `b`, `C:a\b`}, +} + +func TestPathJoin(t *testing.T) { + for _, test := range joinTests { + got := PathJoin(test.dirname, test.filename) + if test.path != got { + t.Errorf("pathJoin(%q, %q) = %q, want %q", test.dirname, test.filename, got, test.path) + } + } +} + +func TestPathLineReaderMalformed(t *testing.T) { + // This test case drawn from issue #52354. What's happening + // here is that the stmtList attribute in the compilation + // unit is malformed (negative). + var aranges, frame, pubnames, ranges, str []byte + abbrev := []byte{0x10, 0x20, 0x20, 0x20, 0x21, 0x20, 0x10, 0x21, 0x61, + 0x0, 0x0, 0xff, 0x20, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20} + info := []byte{0x0, 0x0, 0x0, 0x9, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, + 0x20, 0x10, 0x10} + line := []byte{0x20} + Data0, err := New(abbrev, aranges, frame, info, line, pubnames, ranges, str) + if err != nil { + t.Fatalf("error unexpected: %v", err) + } + Reader0 := Data0.Reader() + Entry0, err := Reader0.Next() + if err != nil { + t.Fatalf("error unexpected: %v", err) + } + LineReader0, err := Data0.LineReader(Entry0) + if err == nil { + t.Fatalf("expected error") + } + if LineReader0 != nil { + t.Fatalf("expected nil line reader") + } +} diff --git a/go/src/debug/dwarf/open.go b/go/src/debug/dwarf/open.go new file mode 100644 index 0000000000000000000000000000000000000000..0901341cc4f5b0c2e18feaea4e7f78b9b9cb2eb3 --- /dev/null +++ b/go/src/debug/dwarf/open.go @@ -0,0 +1,140 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/* +Package dwarf provides access to DWARF debugging information loaded from +executable files, as defined in the DWARF 2.0 Standard at +http://dwarfstd.org/doc/dwarf-2.0.0.pdf. + +# Security + +This package is not designed to be hardened against adversarial inputs, and is +outside the scope of https://go.dev/security/policy. In particular, only basic +validation is done when parsing object files. As such, care should be taken when +parsing untrusted inputs, as parsing malformed files may consume significant +resources, or cause panics. +*/ +package dwarf + +import ( + "encoding/binary" + "errors" +) + +// Data represents the DWARF debugging information +// loaded from an executable file (for example, an ELF or Mach-O executable). +type Data struct { + // raw data + abbrev []byte + aranges []byte + frame []byte + info []byte + line []byte + pubnames []byte + ranges []byte + str []byte + + // New sections added in DWARF 5. + addr []byte + lineStr []byte + strOffsets []byte + rngLists []byte + + // parsed data + abbrevCache map[uint64]abbrevTable + bigEndian bool + order binary.ByteOrder + typeCache map[Offset]Type + typeSigs map[uint64]*typeUnit + unit []unit +} + +var errSegmentSelector = errors.New("non-zero segment_selector size not supported") + +// New returns a new [Data] object initialized from the given parameters. +// Rather than calling this function directly, clients should typically use +// the DWARF method of the File type of the appropriate package [debug/elf], +// [debug/macho], or [debug/pe]. +// +// The []byte arguments are the data from the corresponding debug section +// in the object file; for example, for an ELF object, abbrev is the contents of +// the ".debug_abbrev" section. +func New(abbrev, aranges, frame, info, line, pubnames, ranges, str []byte) (*Data, error) { + d := &Data{ + abbrev: abbrev, + aranges: aranges, + frame: frame, + info: info, + line: line, + pubnames: pubnames, + ranges: ranges, + str: str, + abbrevCache: make(map[uint64]abbrevTable), + typeCache: make(map[Offset]Type), + typeSigs: make(map[uint64]*typeUnit), + } + + // Sniff .debug_info to figure out byte order. + // 32-bit DWARF: 4 byte length, 2 byte version. + // 64-bit DWARf: 4 bytes of 0xff, 8 byte length, 2 byte version. + if len(d.info) < 6 { + return nil, DecodeError{"info", Offset(len(d.info)), "too short"} + } + offset := 4 + if d.info[0] == 0xff && d.info[1] == 0xff && d.info[2] == 0xff && d.info[3] == 0xff { + if len(d.info) < 14 { + return nil, DecodeError{"info", Offset(len(d.info)), "too short"} + } + offset = 12 + } + // Fetch the version, a tiny 16-bit number (1, 2, 3, 4, 5). + x, y := d.info[offset], d.info[offset+1] + switch { + case x == 0 && y == 0: + return nil, DecodeError{"info", 4, "unsupported version 0"} + case x == 0: + d.bigEndian = true + d.order = binary.BigEndian + case y == 0: + d.bigEndian = false + d.order = binary.LittleEndian + default: + return nil, DecodeError{"info", 4, "cannot determine byte order"} + } + + u, err := d.parseUnits() + if err != nil { + return nil, err + } + d.unit = u + return d, nil +} + +// AddTypes will add one .debug_types section to the DWARF data. A +// typical object with DWARF version 4 debug info will have multiple +// .debug_types sections. The name is used for error reporting only, +// and serves to distinguish one .debug_types section from another. +func (d *Data) AddTypes(name string, types []byte) error { + return d.parseTypes(name, types) +} + +// AddSection adds another DWARF section by name. The name should be a +// DWARF section name such as ".debug_addr", ".debug_str_offsets", and +// so forth. This approach is used for new DWARF sections added in +// DWARF 5 and later. +func (d *Data) AddSection(name string, contents []byte) error { + var err error + switch name { + case ".debug_addr": + d.addr = contents + case ".debug_line_str": + d.lineStr = contents + case ".debug_str_offsets": + d.strOffsets = contents + case ".debug_rnglists": + d.rngLists = contents + } + // Just ignore names that we don't yet support. + return err +} diff --git a/go/src/debug/dwarf/tag_string.go b/go/src/debug/dwarf/tag_string.go new file mode 100644 index 0000000000000000000000000000000000000000..b79ea175b06ffa4984485f7cf84dc461967064e9 --- /dev/null +++ b/go/src/debug/dwarf/tag_string.go @@ -0,0 +1,119 @@ +// Code generated by "stringer -type Tag -trimprefix=Tag"; DO NOT EDIT. + +package dwarf + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[TagArrayType-1] + _ = x[TagClassType-2] + _ = x[TagEntryPoint-3] + _ = x[TagEnumerationType-4] + _ = x[TagFormalParameter-5] + _ = x[TagImportedDeclaration-8] + _ = x[TagLabel-10] + _ = x[TagLexDwarfBlock-11] + _ = x[TagMember-13] + _ = x[TagPointerType-15] + _ = x[TagReferenceType-16] + _ = x[TagCompileUnit-17] + _ = x[TagStringType-18] + _ = x[TagStructType-19] + _ = x[TagSubroutineType-21] + _ = x[TagTypedef-22] + _ = x[TagUnionType-23] + _ = x[TagUnspecifiedParameters-24] + _ = x[TagVariant-25] + _ = x[TagCommonDwarfBlock-26] + _ = x[TagCommonInclusion-27] + _ = x[TagInheritance-28] + _ = x[TagInlinedSubroutine-29] + _ = x[TagModule-30] + _ = x[TagPtrToMemberType-31] + _ = x[TagSetType-32] + _ = x[TagSubrangeType-33] + _ = x[TagWithStmt-34] + _ = x[TagAccessDeclaration-35] + _ = x[TagBaseType-36] + _ = x[TagCatchDwarfBlock-37] + _ = x[TagConstType-38] + _ = x[TagConstant-39] + _ = x[TagEnumerator-40] + _ = x[TagFileType-41] + _ = x[TagFriend-42] + _ = x[TagNamelist-43] + _ = x[TagNamelistItem-44] + _ = x[TagPackedType-45] + _ = x[TagSubprogram-46] + _ = x[TagTemplateTypeParameter-47] + _ = x[TagTemplateValueParameter-48] + _ = x[TagThrownType-49] + _ = x[TagTryDwarfBlock-50] + _ = x[TagVariantPart-51] + _ = x[TagVariable-52] + _ = x[TagVolatileType-53] + _ = x[TagDwarfProcedure-54] + _ = x[TagRestrictType-55] + _ = x[TagInterfaceType-56] + _ = x[TagNamespace-57] + _ = x[TagImportedModule-58] + _ = x[TagUnspecifiedType-59] + _ = x[TagPartialUnit-60] + _ = x[TagImportedUnit-61] + _ = x[TagMutableType-62] + _ = x[TagCondition-63] + _ = x[TagSharedType-64] + _ = x[TagTypeUnit-65] + _ = x[TagRvalueReferenceType-66] + _ = x[TagTemplateAlias-67] + _ = x[TagCoarrayType-68] + _ = x[TagGenericSubrange-69] + _ = x[TagDynamicType-70] + _ = x[TagAtomicType-71] + _ = x[TagCallSite-72] + _ = x[TagCallSiteParameter-73] + _ = x[TagSkeletonUnit-74] + _ = x[TagImmutableType-75] +} + +const ( + _Tag_name_0 = "ArrayTypeClassTypeEntryPointEnumerationTypeFormalParameter" + _Tag_name_1 = "ImportedDeclaration" + _Tag_name_2 = "LabelLexDwarfBlock" + _Tag_name_3 = "Member" + _Tag_name_4 = "PointerTypeReferenceTypeCompileUnitStringTypeStructType" + _Tag_name_5 = "SubroutineTypeTypedefUnionTypeUnspecifiedParametersVariantCommonDwarfBlockCommonInclusionInheritanceInlinedSubroutineModulePtrToMemberTypeSetTypeSubrangeTypeWithStmtAccessDeclarationBaseTypeCatchDwarfBlockConstTypeConstantEnumeratorFileTypeFriendNamelistNamelistItemPackedTypeSubprogramTemplateTypeParameterTemplateValueParameterThrownTypeTryDwarfBlockVariantPartVariableVolatileTypeDwarfProcedureRestrictTypeInterfaceTypeNamespaceImportedModuleUnspecifiedTypePartialUnitImportedUnitMutableTypeConditionSharedTypeTypeUnitRvalueReferenceTypeTemplateAliasCoarrayTypeGenericSubrangeDynamicTypeAtomicTypeCallSiteCallSiteParameterSkeletonUnitImmutableType" +) + +var ( + _Tag_index_0 = [...]uint8{0, 9, 18, 28, 43, 58} + _Tag_index_2 = [...]uint8{0, 5, 18} + _Tag_index_4 = [...]uint8{0, 11, 24, 35, 45, 55} + _Tag_index_5 = [...]uint16{0, 14, 21, 30, 51, 58, 74, 89, 100, 117, 123, 138, 145, 157, 165, 182, 190, 205, 214, 222, 232, 240, 246, 254, 266, 276, 286, 307, 329, 339, 352, 363, 371, 383, 397, 409, 422, 431, 445, 460, 471, 483, 494, 503, 513, 521, 540, 553, 564, 579, 590, 600, 608, 625, 637, 650} +) + +func (i Tag) String() string { + switch { + case 1 <= i && i <= 5: + i -= 1 + return _Tag_name_0[_Tag_index_0[i]:_Tag_index_0[i+1]] + case i == 8: + return _Tag_name_1 + case 10 <= i && i <= 11: + i -= 10 + return _Tag_name_2[_Tag_index_2[i]:_Tag_index_2[i+1]] + case i == 13: + return _Tag_name_3 + case 15 <= i && i <= 19: + i -= 15 + return _Tag_name_4[_Tag_index_4[i]:_Tag_index_4[i+1]] + case 21 <= i && i <= 75: + i -= 21 + return _Tag_name_5[_Tag_index_5[i]:_Tag_index_5[i+1]] + default: + return "Tag(" + strconv.FormatInt(int64(i), 10) + ")" + } +} diff --git a/go/src/debug/dwarf/testdata/bitfields.c b/go/src/debug/dwarf/testdata/bitfields.c new file mode 100644 index 0000000000000000000000000000000000000000..05833336c91810d21dca113ebc0c413bd0bbc78c --- /dev/null +++ b/go/src/debug/dwarf/testdata/bitfields.c @@ -0,0 +1,17 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/* +Linux ELF: +gcc -gdwarf-4 -m64 -c bitfields.c -o bitfields.elf4 +*/ + +typedef struct another_struct { + unsigned short quix; + int xyz[0]; + unsigned x:1; + long long array[40]; +} t_another_struct; +t_another_struct q2; + diff --git a/go/src/debug/dwarf/testdata/bitfields.elf4 b/go/src/debug/dwarf/testdata/bitfields.elf4 new file mode 100644 index 0000000000000000000000000000000000000000..2e06e68ce9dded2509e1dae216322d9409cbd070 Binary files /dev/null and b/go/src/debug/dwarf/testdata/bitfields.elf4 differ diff --git a/go/src/debug/dwarf/testdata/cppunsuptypes.cc b/go/src/debug/dwarf/testdata/cppunsuptypes.cc new file mode 100644 index 0000000000000000000000000000000000000000..e9281c7dec7d3ac3bd725d502bdafc49a3fc0976 --- /dev/null +++ b/go/src/debug/dwarf/testdata/cppunsuptypes.cc @@ -0,0 +1,34 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// cppunsuptypes.elf built with g++ 7.3 +// g++ -g -c -o cppunsuptypes.elf cppunsuptypes.cc + +int i = 3; +double d = 3; + +// anonymous reference type +int &culprit = i; + +// named reference type +typedef double &dref; +dref dr = d; + +// incorporated into another type +typedef struct { + dref q; + int &r; +} hasrefs; + +hasrefs hr = { d, i }; + +// This code is intended to trigger a DWARF "pointer to member" type DIE +struct CS { int dm; }; + +int foo() +{ + int CS::* pdm = &CS::dm; + CS cs = {42}; + return cs.*pdm; +} diff --git a/go/src/debug/dwarf/testdata/cppunsuptypes.elf b/go/src/debug/dwarf/testdata/cppunsuptypes.elf new file mode 100644 index 0000000000000000000000000000000000000000..e955512ecd0227f5564ab4d1a29c054d636742d9 Binary files /dev/null and b/go/src/debug/dwarf/testdata/cppunsuptypes.elf differ diff --git a/go/src/debug/dwarf/testdata/cycle.c b/go/src/debug/dwarf/testdata/cycle.c new file mode 100644 index 0000000000000000000000000000000000000000..a0b53dfe74733d8400fb10b70357649c8201ba04 --- /dev/null +++ b/go/src/debug/dwarf/testdata/cycle.c @@ -0,0 +1,7 @@ +typedef struct aaa *AAA; +typedef AAA BBB; +struct aaa { BBB val; }; + +AAA x(void) { + return (AAA)0; +} diff --git a/go/src/debug/dwarf/testdata/cycle.elf b/go/src/debug/dwarf/testdata/cycle.elf new file mode 100644 index 0000000000000000000000000000000000000000..e0b66caa638c61c954d32c60c76d4bc261ccc3b3 Binary files /dev/null and b/go/src/debug/dwarf/testdata/cycle.elf differ diff --git a/go/src/debug/dwarf/testdata/debug_rnglists b/go/src/debug/dwarf/testdata/debug_rnglists new file mode 100644 index 0000000000000000000000000000000000000000..985ec6c9f283def17ebab9f5b6049794c04c011a Binary files /dev/null and b/go/src/debug/dwarf/testdata/debug_rnglists differ diff --git a/go/src/debug/dwarf/testdata/issue57046-clang.elf5 b/go/src/debug/dwarf/testdata/issue57046-clang.elf5 new file mode 100644 index 0000000000000000000000000000000000000000..009af83135a100b61f38496b973b84171c829757 Binary files /dev/null and b/go/src/debug/dwarf/testdata/issue57046-clang.elf5 differ diff --git a/go/src/debug/dwarf/testdata/issue57046_part1.c b/go/src/debug/dwarf/testdata/issue57046_part1.c new file mode 100644 index 0000000000000000000000000000000000000000..8866ca66e141b1baf988e8456ef1bf32dba2b994 --- /dev/null +++ b/go/src/debug/dwarf/testdata/issue57046_part1.c @@ -0,0 +1,42 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Part 1 of the sources for issue 57046 test case. + +// Build instructions: +// +// clang-16 -O -g -gdwarf-5 -c issue57046_part1.c +// clang-16 -O -g -gdwarf-5 -c issue57046_part2.c +// clang-16 -o issue57046-clang.elf5 issue57046_part1.o issue57046_part2.o + +#include +#include +#include + +extern const char *mom(); + +int gadgety() { + const char *ev = getenv("PATH"); + int n = strlen(ev); + int s1 = (int)ev[0]; + int s2 = (int)ev[1]; + int s3 = (int)ev[2]; + for (int i = 0; i < strlen(ev); i++) { + if (s1 == 101) { + int t = s1; + s1 = s3; + s3 = t; + } + if (ev[i] == 99) { + printf("%d\n", i); + } + } + s2 *= 2; + return n + s1 + s2; +} + +int main(int argc, char **argv) { + printf("Hi %s %d\n", mom(), gadgety()); + return 0; +} diff --git a/go/src/debug/dwarf/testdata/issue57046_part2.c b/go/src/debug/dwarf/testdata/issue57046_part2.c new file mode 100644 index 0000000000000000000000000000000000000000..2f4e9f0d2469125de9351016698db9c79f599145 --- /dev/null +++ b/go/src/debug/dwarf/testdata/issue57046_part2.c @@ -0,0 +1,10 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Part 2 of the sources for issue 57046 test case. +// See part 1 for build instructions. + +const char *mom() { + return "mom"; +} diff --git a/go/src/debug/dwarf/testdata/line-clang-dwarf5.elf b/go/src/debug/dwarf/testdata/line-clang-dwarf5.elf new file mode 100644 index 0000000000000000000000000000000000000000..7b80c9c5dad459bfc283da9cdda1629494169c30 Binary files /dev/null and b/go/src/debug/dwarf/testdata/line-clang-dwarf5.elf differ diff --git a/go/src/debug/dwarf/testdata/line-clang.elf b/go/src/debug/dwarf/testdata/line-clang.elf new file mode 100644 index 0000000000000000000000000000000000000000..b63cc781c410a53840c001af944e6292935ce3ff Binary files /dev/null and b/go/src/debug/dwarf/testdata/line-clang.elf differ diff --git a/go/src/debug/dwarf/testdata/line-gcc-dwarf5.elf b/go/src/debug/dwarf/testdata/line-gcc-dwarf5.elf new file mode 100644 index 0000000000000000000000000000000000000000..34ce17cc426b5b552404c8055136f5797e887603 Binary files /dev/null and b/go/src/debug/dwarf/testdata/line-gcc-dwarf5.elf differ diff --git a/go/src/debug/dwarf/testdata/line-gcc-zstd.elf b/go/src/debug/dwarf/testdata/line-gcc-zstd.elf new file mode 100644 index 0000000000000000000000000000000000000000..45cbe720397419fe11d47b1ae811b4d84f317d60 Binary files /dev/null and b/go/src/debug/dwarf/testdata/line-gcc-zstd.elf differ diff --git a/go/src/debug/dwarf/testdata/line-gcc.elf b/go/src/debug/dwarf/testdata/line-gcc.elf new file mode 100644 index 0000000000000000000000000000000000000000..50500a8eecd95ee18ac78e130e12eef10c4aaf55 Binary files /dev/null and b/go/src/debug/dwarf/testdata/line-gcc.elf differ diff --git a/go/src/debug/dwarf/testdata/line1.c b/go/src/debug/dwarf/testdata/line1.c new file mode 100644 index 0000000000000000000000000000000000000000..f35864776caf0bbf7b971b69f72cfef08dba91ee --- /dev/null +++ b/go/src/debug/dwarf/testdata/line1.c @@ -0,0 +1,9 @@ +#include "line1.h" + +void f2(); + +int main() +{ + f1(); + f2(); +} diff --git a/go/src/debug/dwarf/testdata/line1.h b/go/src/debug/dwarf/testdata/line1.h new file mode 100644 index 0000000000000000000000000000000000000000..974d4c881778482a760d68b2f197c7a91b565126 --- /dev/null +++ b/go/src/debug/dwarf/testdata/line1.h @@ -0,0 +1,7 @@ +static void f1() +{ + char buf[10]; + int i; + for(i = 0; i < 10; i++) + buf[i] = 1; +} diff --git a/go/src/debug/dwarf/testdata/line2.c b/go/src/debug/dwarf/testdata/line2.c new file mode 100644 index 0000000000000000000000000000000000000000..38d89983cbb2433f398e26b09aae09b24961988b --- /dev/null +++ b/go/src/debug/dwarf/testdata/line2.c @@ -0,0 +1,6 @@ +#include + +void f2() +{ + printf("hello\n"); +} diff --git a/go/src/debug/dwarf/testdata/ranges.c b/go/src/debug/dwarf/testdata/ranges.c new file mode 100644 index 0000000000000000000000000000000000000000..2f208e591c70cd12478e27665840eda936d183f1 --- /dev/null +++ b/go/src/debug/dwarf/testdata/ranges.c @@ -0,0 +1,25 @@ +// gcc -g -O2 -freorder-blocks-and-partition + +const char *arr[10000]; +const char *hot = "hot"; +const char *cold = "cold"; + +__attribute__((noinline)) +void fn(int path) { + int i; + + if (path) { + for (i = 0; i < sizeof arr / sizeof arr[0]; i++) { + arr[i] = hot; + } + } else { + for (i = 0; i < sizeof arr / sizeof arr[0]; i++) { + arr[i] = cold; + } + } +} + +int main(int argc, char *argv[]) { + fn(argc); + return 0; +} diff --git a/go/src/debug/dwarf/testdata/ranges.elf b/go/src/debug/dwarf/testdata/ranges.elf new file mode 100644 index 0000000000000000000000000000000000000000..7f54138cffb3bc61a8e537a5becdfc913a41da3a Binary files /dev/null and b/go/src/debug/dwarf/testdata/ranges.elf differ diff --git a/go/src/debug/dwarf/testdata/rnglistx.c b/go/src/debug/dwarf/testdata/rnglistx.c new file mode 100644 index 0000000000000000000000000000000000000000..877043584d6bb48d8166b1ee6cddb5eb722285db --- /dev/null +++ b/go/src/debug/dwarf/testdata/rnglistx.c @@ -0,0 +1,19 @@ +// clang -gdwarf-5 -O2 -nostdlib + +__attribute__((noinline, cold)) +static int sum(int i) { + int j, s; + + s = 0; + for (j = 0; j < i; j++) { + s += j * i; + } + return s; +} + +int main(int argc, char** argv) { + if (argc == 0) { + return 0; + } + return sum(argc); +} diff --git a/go/src/debug/dwarf/testdata/rnglistx.elf b/go/src/debug/dwarf/testdata/rnglistx.elf new file mode 100644 index 0000000000000000000000000000000000000000..c2d7f55479125b2bde8d3889945737fb58c49896 Binary files /dev/null and b/go/src/debug/dwarf/testdata/rnglistx.elf differ diff --git a/go/src/debug/dwarf/testdata/split.c b/go/src/debug/dwarf/testdata/split.c new file mode 100644 index 0000000000000000000000000000000000000000..0ef3427d2eb5fb144b4d8a155465cd0296ba4e00 --- /dev/null +++ b/go/src/debug/dwarf/testdata/split.c @@ -0,0 +1,5 @@ +// gcc -gsplit-dwarf split.c -o split.elf + +int main() +{ +} diff --git a/go/src/debug/dwarf/testdata/split.elf b/go/src/debug/dwarf/testdata/split.elf new file mode 100644 index 0000000000000000000000000000000000000000..99ee2c2f0bb739307cf13bc85abd3421166c0167 Binary files /dev/null and b/go/src/debug/dwarf/testdata/split.elf differ diff --git a/go/src/debug/dwarf/testdata/typedef.c b/go/src/debug/dwarf/testdata/typedef.c new file mode 100644 index 0000000000000000000000000000000000000000..3e7e008621e832d81af45f1e77f8d1fcdc645d44 --- /dev/null +++ b/go/src/debug/dwarf/testdata/typedef.c @@ -0,0 +1,86 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/* +Linux ELF: +gcc -gdwarf-2 -m64 -c typedef.c && gcc -gdwarf-2 -m64 -o typedef.elf typedef.o + +OS X Mach-O: +gcc -gdwarf-2 -m64 -c typedef.c -o typedef.macho +gcc -gdwarf-4 -m64 -c typedef.c -o typedef.macho4 +*/ +#include + +typedef volatile int* t_ptr_volatile_int; +typedef const char *t_ptr_const_char; +typedef long t_long; +typedef unsigned short t_ushort; +typedef int t_func_int_of_float_double(float, double); +typedef int (*t_ptr_func_int_of_float_double)(float, double); +typedef int (*t_ptr_func_int_of_float_complex)(float complex); +typedef int (*t_ptr_func_int_of_double_complex)(double complex); +typedef int (*t_ptr_func_int_of_long_double_complex)(long double complex); +typedef int *t_func_ptr_int_of_char_schar_uchar(char, signed char, unsigned char); +typedef void t_func_void_of_char(char); +typedef void t_func_void_of_void(void); +typedef void t_func_void_of_ptr_char_dots(char*, ...); +typedef struct my_struct { + volatile int vi; + char x : 1; + int y : 4; + int z[0]; + long long array[40]; + int zz[0]; +} t_my_struct; +typedef struct my_struct1 { + int zz [1]; +} t_my_struct1; +typedef union my_union { + volatile int vi; + char x : 1; + int y : 4; + long long array[40]; +} t_my_union; +typedef enum my_enum { + e1 = 1, + e2 = 2, + e3 = -5, + e4 = 1000000000000000LL, +} t_my_enum; + +typedef struct list t_my_list; +struct list { + short val; + t_my_list *next; +}; + +typedef struct tree { + struct tree *left, *right; + unsigned long long val; +} t_my_tree; + +t_ptr_volatile_int *a2; +t_ptr_const_char **a3a; +t_long *a4; +t_ushort *a5; +t_func_int_of_float_double *a6; +t_ptr_func_int_of_float_double *a7; +t_func_ptr_int_of_char_schar_uchar *a8; +t_func_void_of_char *a9; +t_func_void_of_void *a10; +t_func_void_of_ptr_char_dots *a11; +t_my_struct *a12; +t_my_struct1 *a12a; +t_my_union *a12b; +t_my_enum *a13; +t_my_list *a14; +t_my_tree *a15; +t_ptr_func_int_of_float_complex *a16; +t_ptr_func_int_of_double_complex *a17; +t_ptr_func_int_of_long_double_complex *a18; + +int main() +{ + return 0; +} diff --git a/go/src/debug/dwarf/testdata/typedef.elf b/go/src/debug/dwarf/testdata/typedef.elf new file mode 100644 index 0000000000000000000000000000000000000000..b2062d2c4bb828dcb229f12869f77fd5d9522278 Binary files /dev/null and b/go/src/debug/dwarf/testdata/typedef.elf differ diff --git a/go/src/debug/dwarf/testdata/typedef.elf4 b/go/src/debug/dwarf/testdata/typedef.elf4 new file mode 100644 index 0000000000000000000000000000000000000000..3d5a5a1b1620badce20ec4ea8c630f3bfd58c4d2 Binary files /dev/null and b/go/src/debug/dwarf/testdata/typedef.elf4 differ diff --git a/go/src/debug/dwarf/testdata/typedef.elf5 b/go/src/debug/dwarf/testdata/typedef.elf5 new file mode 100644 index 0000000000000000000000000000000000000000..aec48f64522f651a2b5c341c4b6c0badf92c2801 Binary files /dev/null and b/go/src/debug/dwarf/testdata/typedef.elf5 differ diff --git a/go/src/debug/dwarf/testdata/typedef.macho b/go/src/debug/dwarf/testdata/typedef.macho new file mode 100644 index 0000000000000000000000000000000000000000..f75afcccbfc852d284a33c01a49eb1035b6dae9c Binary files /dev/null and b/go/src/debug/dwarf/testdata/typedef.macho differ diff --git a/go/src/debug/dwarf/testdata/typedef.macho4 b/go/src/debug/dwarf/testdata/typedef.macho4 new file mode 100644 index 0000000000000000000000000000000000000000..093ff37ea1802b31805e711e5acf4c3eb8d3f7b5 Binary files /dev/null and b/go/src/debug/dwarf/testdata/typedef.macho4 differ diff --git a/go/src/debug/dwarf/type.go b/go/src/debug/dwarf/type.go new file mode 100644 index 0000000000000000000000000000000000000000..627d3a13b75c5b4e98a1c72cf8fde721fb08c437 --- /dev/null +++ b/go/src/debug/dwarf/type.go @@ -0,0 +1,870 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// DWARF type information structures. +// The format is heavily biased toward C, but for simplicity +// the String methods use a pseudo-Go syntax. + +package dwarf + +import "strconv" + +// A Type conventionally represents a pointer to any of the +// specific Type structures ([CharType], [StructType], etc.). +type Type interface { + Common() *CommonType + String() string + Size() int64 +} + +// A CommonType holds fields common to multiple types. +// If a field is not known or not applicable for a given type, +// the zero value is used. +type CommonType struct { + ByteSize int64 // size of value of this type, in bytes + Name string // name that can be used to refer to type +} + +func (c *CommonType) Common() *CommonType { return c } + +func (c *CommonType) Size() int64 { return c.ByteSize } + +// Basic types + +// A BasicType holds fields common to all basic types. +// +// See the documentation for [StructField] for more info on the interpretation of +// the BitSize/BitOffset/DataBitOffset fields. +type BasicType struct { + CommonType + BitSize int64 + BitOffset int64 + DataBitOffset int64 +} + +func (b *BasicType) Basic() *BasicType { return b } + +func (t *BasicType) String() string { + if t.Name != "" { + return t.Name + } + return "?" +} + +// A CharType represents a signed character type. +type CharType struct { + BasicType +} + +// A UcharType represents an unsigned character type. +type UcharType struct { + BasicType +} + +// An IntType represents a signed integer type. +type IntType struct { + BasicType +} + +// A UintType represents an unsigned integer type. +type UintType struct { + BasicType +} + +// A FloatType represents a floating point type. +type FloatType struct { + BasicType +} + +// A ComplexType represents a complex floating point type. +type ComplexType struct { + BasicType +} + +// A BoolType represents a boolean type. +type BoolType struct { + BasicType +} + +// An AddrType represents a machine address type. +type AddrType struct { + BasicType +} + +// An UnspecifiedType represents an implicit, unknown, ambiguous or nonexistent type. +type UnspecifiedType struct { + BasicType +} + +// qualifiers + +// A QualType represents a type that has the C/C++ "const", "restrict", or "volatile" qualifier. +type QualType struct { + CommonType + Qual string + Type Type +} + +func (t *QualType) String() string { return t.Qual + " " + t.Type.String() } + +func (t *QualType) Size() int64 { return t.Type.Size() } + +// An ArrayType represents a fixed size array type. +type ArrayType struct { + CommonType + Type Type + StrideBitSize int64 // if > 0, number of bits to hold each element + Count int64 // if == -1, an incomplete array, like char x[]. +} + +func (t *ArrayType) String() string { + return "[" + strconv.FormatInt(t.Count, 10) + "]" + t.Type.String() +} + +func (t *ArrayType) Size() int64 { + if t.Count == -1 { + return 0 + } + return t.Count * t.Type.Size() +} + +// A VoidType represents the C void type. +type VoidType struct { + CommonType +} + +func (t *VoidType) String() string { return "void" } + +// A PtrType represents a pointer type. +type PtrType struct { + CommonType + Type Type +} + +func (t *PtrType) String() string { return "*" + t.Type.String() } + +// A StructType represents a struct, union, or C++ class type. +type StructType struct { + CommonType + StructName string + Kind string // "struct", "union", or "class". + Field []*StructField + Incomplete bool // if true, struct, union, class is declared but not defined +} + +// A StructField represents a field in a struct, union, or C++ class type. +// +// # Bit Fields +// +// The BitSize, BitOffset, and DataBitOffset fields describe the bit +// size and offset of data members declared as bit fields in C/C++ +// struct/union/class types. +// +// BitSize is the number of bits in the bit field. +// +// DataBitOffset, if non-zero, is the number of bits from the start of +// the enclosing entity (e.g. containing struct/class/union) to the +// start of the bit field. This corresponds to the DW_AT_data_bit_offset +// DWARF attribute that was introduced in DWARF 4. +// +// BitOffset, if non-zero, is the number of bits between the most +// significant bit of the storage unit holding the bit field to the +// most significant bit of the bit field. Here "storage unit" is the +// type name before the bit field (for a field "unsigned x:17", the +// storage unit is "unsigned"). BitOffset values can vary depending on +// the endianness of the system. BitOffset corresponds to the +// DW_AT_bit_offset DWARF attribute that was deprecated in DWARF 4 and +// removed in DWARF 5. +// +// At most one of DataBitOffset and BitOffset will be non-zero; +// DataBitOffset/BitOffset will only be non-zero if BitSize is +// non-zero. Whether a C compiler uses one or the other +// will depend on compiler vintage and command line options. +// +// Here is an example of C/C++ bit field use, along with what to +// expect in terms of DWARF bit offset info. Consider this code: +// +// struct S { +// int q; +// int j:5; +// int k:6; +// int m:5; +// int n:8; +// } s; +// +// For the code above, one would expect to see the following for +// DW_AT_bit_offset values (using GCC 8): +// +// Little | Big +// Endian | Endian +// | +// "j": 27 | 0 +// "k": 21 | 5 +// "m": 16 | 11 +// "n": 8 | 16 +// +// Note that in the above the offsets are purely with respect to the +// containing storage unit for j/k/m/n -- these values won't vary based +// on the size of prior data members in the containing struct. +// +// If the compiler emits DW_AT_data_bit_offset, the expected values +// would be: +// +// "j": 32 +// "k": 37 +// "m": 43 +// "n": 48 +// +// Here the value 32 for "j" reflects the fact that the bit field is +// preceded by other data members (recall that DW_AT_data_bit_offset +// values are relative to the start of the containing struct). Hence +// DW_AT_data_bit_offset values can be quite large for structs with +// many fields. +// +// DWARF also allow for the possibility of base types that have +// non-zero bit size and bit offset, so this information is also +// captured for base types, but it is worth noting that it is not +// possible to trigger this behavior using mainstream languages. +type StructField struct { + Name string + Type Type + ByteOffset int64 + ByteSize int64 // usually zero; use Type.Size() for normal fields + BitOffset int64 + DataBitOffset int64 + BitSize int64 // zero if not a bit field +} + +func (t *StructType) String() string { + if t.StructName != "" { + return t.Kind + " " + t.StructName + } + return t.Defn() +} + +func (f *StructField) bitOffset() int64 { + if f.BitOffset != 0 { + return f.BitOffset + } + return f.DataBitOffset +} + +func (t *StructType) Defn() string { + s := t.Kind + if t.StructName != "" { + s += " " + t.StructName + } + if t.Incomplete { + s += " /*incomplete*/" + return s + } + s += " {" + for i, f := range t.Field { + if i > 0 { + s += "; " + } + s += f.Name + " " + f.Type.String() + s += "@" + strconv.FormatInt(f.ByteOffset, 10) + if f.BitSize > 0 { + s += " : " + strconv.FormatInt(f.BitSize, 10) + s += "@" + strconv.FormatInt(f.bitOffset(), 10) + } + } + s += "}" + return s +} + +// An EnumType represents an enumerated type. +// The only indication of its native integer type is its ByteSize +// (inside [CommonType]). +type EnumType struct { + CommonType + EnumName string + Val []*EnumValue +} + +// An EnumValue represents a single enumeration value. +type EnumValue struct { + Name string + Val int64 +} + +func (t *EnumType) String() string { + s := "enum" + if t.EnumName != "" { + s += " " + t.EnumName + } + s += " {" + for i, v := range t.Val { + if i > 0 { + s += "; " + } + s += v.Name + "=" + strconv.FormatInt(v.Val, 10) + } + s += "}" + return s +} + +// A FuncType represents a function type. +type FuncType struct { + CommonType + ReturnType Type + ParamType []Type +} + +func (t *FuncType) String() string { + s := "func(" + for i, t := range t.ParamType { + if i > 0 { + s += ", " + } + s += t.String() + } + s += ")" + if t.ReturnType != nil { + s += " " + t.ReturnType.String() + } + return s +} + +// A DotDotDotType represents the variadic ... function parameter. +type DotDotDotType struct { + CommonType +} + +func (t *DotDotDotType) String() string { return "..." } + +// A TypedefType represents a named type. +type TypedefType struct { + CommonType + Type Type +} + +func (t *TypedefType) String() string { return t.Name } + +func (t *TypedefType) Size() int64 { return t.Type.Size() } + +// An UnsupportedType is a placeholder returned in situations where we +// encounter a type that isn't supported. +type UnsupportedType struct { + CommonType + Tag Tag +} + +func (t *UnsupportedType) String() string { + if t.Name != "" { + return t.Name + } + return t.Name + "(unsupported type " + t.Tag.String() + ")" +} + +// typeReader is used to read from either the info section or the +// types section. +type typeReader interface { + Seek(Offset) + Next() (*Entry, error) + clone() typeReader + offset() Offset + // AddressSize returns the size in bytes of addresses in the current + // compilation unit. + AddressSize() int +} + +// Type reads the type at off in the DWARF “info” section. +func (d *Data) Type(off Offset) (Type, error) { + return d.readType("info", d.Reader(), off, d.typeCache, nil) +} + +type typeFixer struct { + typedefs []*TypedefType + arraytypes []*Type +} + +func (tf *typeFixer) recordArrayType(t *Type) { + if t == nil { + return + } + _, ok := (*t).(*ArrayType) + if ok { + tf.arraytypes = append(tf.arraytypes, t) + } +} + +func (tf *typeFixer) apply() { + for _, t := range tf.typedefs { + t.Common().ByteSize = t.Type.Size() + } + for _, t := range tf.arraytypes { + zeroArray(t) + } +} + +// readType reads a type from r at off of name. It adds types to the +// type cache, appends new typedef types to typedefs, and computes the +// sizes of types. Callers should pass nil for typedefs; this is used +// for internal recursion. +func (d *Data) readType(name string, r typeReader, off Offset, typeCache map[Offset]Type, fixups *typeFixer) (Type, error) { + if t, ok := typeCache[off]; ok { + return t, nil + } + r.Seek(off) + e, err := r.Next() + if err != nil { + return nil, err + } + addressSize := r.AddressSize() + if e == nil || e.Offset != off { + return nil, DecodeError{name, off, "no type at offset"} + } + + // If this is the root of the recursion, prepare to resolve + // typedef sizes and perform other fixups once the recursion is + // done. This must be done after the type graph is constructed + // because it may need to resolve cycles in a different order than + // readType encounters them. + if fixups == nil { + var fixer typeFixer + defer func() { + fixer.apply() + }() + fixups = &fixer + } + + // Parse type from Entry. + // Must always set typeCache[off] before calling + // d.readType recursively, to handle circular types correctly. + var typ Type + + nextDepth := 0 + + // Get next child; set err if error happens. + next := func() *Entry { + if !e.Children { + return nil + } + // Only return direct children. + // Skip over composite entries that happen to be nested + // inside this one. Most DWARF generators wouldn't generate + // such a thing, but clang does. + // See golang.org/issue/6472. + for { + kid, err1 := r.Next() + if err1 != nil { + err = err1 + return nil + } + if kid == nil { + err = DecodeError{name, r.offset(), "unexpected end of DWARF entries"} + return nil + } + if kid.Tag == 0 { + if nextDepth > 0 { + nextDepth-- + continue + } + return nil + } + if kid.Children { + nextDepth++ + } + if nextDepth > 0 { + continue + } + return kid + } + } + + // Get Type referred to by Entry's AttrType field. + // Set err if error happens. Not having a type is an error. + typeOf := func(e *Entry) Type { + tval := e.Val(AttrType) + var t Type + switch toff := tval.(type) { + case Offset: + if t, err = d.readType(name, r.clone(), toff, typeCache, fixups); err != nil { + return nil + } + case uint64: + if t, err = d.sigToType(toff); err != nil { + return nil + } + default: + // It appears that no Type means "void". + return new(VoidType) + } + return t + } + + switch e.Tag { + case TagArrayType: + // Multi-dimensional array. (DWARF v2 §5.4) + // Attributes: + // AttrType:subtype [required] + // AttrStrideSize: size in bits of each element of the array + // AttrByteSize: size of entire array + // Children: + // TagSubrangeType or TagEnumerationType giving one dimension. + // dimensions are in left to right order. + t := new(ArrayType) + typ = t + typeCache[off] = t + if t.Type = typeOf(e); err != nil { + goto Error + } + t.StrideBitSize, _ = e.Val(AttrStrideSize).(int64) + + // Accumulate dimensions, + var dims []int64 + for kid := next(); kid != nil; kid = next() { + // TODO(rsc): Can also be TagEnumerationType + // but haven't seen that in the wild yet. + switch kid.Tag { + case TagSubrangeType: + count, ok := kid.Val(AttrCount).(int64) + if !ok { + // Old binaries may have an upper bound instead. + count, ok = kid.Val(AttrUpperBound).(int64) + if ok { + count++ // Length is one more than upper bound. + } else if len(dims) == 0 { + count = -1 // As in x[]. + } + } + dims = append(dims, count) + case TagEnumerationType: + err = DecodeError{name, kid.Offset, "cannot handle enumeration type as array bound"} + goto Error + } + } + if len(dims) == 0 { + // LLVM generates this for x[]. + dims = []int64{-1} + } + + t.Count = dims[0] + for i := len(dims) - 1; i >= 1; i-- { + t.Type = &ArrayType{Type: t.Type, Count: dims[i]} + } + + case TagBaseType: + // Basic type. (DWARF v2 §5.1) + // Attributes: + // AttrName: name of base type in programming language of the compilation unit [required] + // AttrEncoding: encoding value for type (encFloat etc) [required] + // AttrByteSize: size of type in bytes [required] + // AttrBitOffset: bit offset of value within containing storage unit + // AttrDataBitOffset: bit offset of value within containing storage unit + // AttrBitSize: size in bits + // + // For most languages BitOffset/DataBitOffset/BitSize will not be present + // for base types. + name, _ := e.Val(AttrName).(string) + enc, ok := e.Val(AttrEncoding).(int64) + if !ok { + err = DecodeError{name, e.Offset, "missing encoding attribute for " + name} + goto Error + } + switch enc { + default: + err = DecodeError{name, e.Offset, "unrecognized encoding attribute value"} + goto Error + + case encAddress: + typ = new(AddrType) + case encBoolean: + typ = new(BoolType) + case encComplexFloat: + typ = new(ComplexType) + if name == "complex" { + // clang writes out 'complex' instead of 'complex float' or 'complex double'. + // clang also writes out a byte size that we can use to distinguish. + // See issue 8694. + switch byteSize, _ := e.Val(AttrByteSize).(int64); byteSize { + case 8: + name = "complex float" + case 16: + name = "complex double" + } + } + case encFloat: + typ = new(FloatType) + case encSigned: + typ = new(IntType) + case encUnsigned: + typ = new(UintType) + case encSignedChar: + typ = new(CharType) + case encUnsignedChar: + typ = new(UcharType) + } + typeCache[off] = typ + t := typ.(interface { + Basic() *BasicType + }).Basic() + t.Name = name + t.BitSize, _ = e.Val(AttrBitSize).(int64) + haveBitOffset := false + haveDataBitOffset := false + t.BitOffset, haveBitOffset = e.Val(AttrBitOffset).(int64) + t.DataBitOffset, haveDataBitOffset = e.Val(AttrDataBitOffset).(int64) + if haveBitOffset && haveDataBitOffset { + err = DecodeError{name, e.Offset, "duplicate bit offset attributes"} + goto Error + } + + case TagClassType, TagStructType, TagUnionType: + // Structure, union, or class type. (DWARF v2 §5.5) + // Attributes: + // AttrName: name of struct, union, or class + // AttrByteSize: byte size [required] + // AttrDeclaration: if true, struct/union/class is incomplete + // Children: + // TagMember to describe one member. + // AttrName: name of member [required] + // AttrType: type of member [required] + // AttrByteSize: size in bytes + // AttrBitOffset: bit offset within bytes for bit fields + // AttrDataBitOffset: field bit offset relative to struct start + // AttrBitSize: bit size for bit fields + // AttrDataMemberLoc: location within struct [required for struct, class] + // There is much more to handle C++, all ignored for now. + t := new(StructType) + typ = t + typeCache[off] = t + switch e.Tag { + case TagClassType: + t.Kind = "class" + case TagStructType: + t.Kind = "struct" + case TagUnionType: + t.Kind = "union" + } + t.StructName, _ = e.Val(AttrName).(string) + t.Incomplete = e.Val(AttrDeclaration) != nil + t.Field = make([]*StructField, 0, 8) + var lastFieldType *Type + var lastFieldBitSize int64 + var lastFieldByteOffset int64 + for kid := next(); kid != nil; kid = next() { + if kid.Tag != TagMember { + continue + } + f := new(StructField) + if f.Type = typeOf(kid); err != nil { + goto Error + } + switch loc := kid.Val(AttrDataMemberLoc).(type) { + case []byte: + // TODO: Should have original compilation + // unit here, not unknownFormat. + b := makeBuf(d, unknownFormat{}, "location", 0, loc) + if b.uint8() != opPlusUconst { + err = DecodeError{name, kid.Offset, "unexpected opcode"} + goto Error + } + f.ByteOffset = int64(b.uint()) + if b.err != nil { + err = b.err + goto Error + } + case int64: + f.ByteOffset = loc + } + + f.Name, _ = kid.Val(AttrName).(string) + f.ByteSize, _ = kid.Val(AttrByteSize).(int64) + haveBitOffset := false + haveDataBitOffset := false + f.BitOffset, haveBitOffset = kid.Val(AttrBitOffset).(int64) + f.DataBitOffset, haveDataBitOffset = kid.Val(AttrDataBitOffset).(int64) + if haveBitOffset && haveDataBitOffset { + err = DecodeError{name, e.Offset, "duplicate bit offset attributes"} + goto Error + } + f.BitSize, _ = kid.Val(AttrBitSize).(int64) + t.Field = append(t.Field, f) + + if lastFieldBitSize == 0 && lastFieldByteOffset == f.ByteOffset && t.Kind != "union" { + // Last field was zero width. Fix array length. + // (DWARF writes out 0-length arrays as if they were 1-length arrays.) + fixups.recordArrayType(lastFieldType) + } + lastFieldType = &f.Type + lastFieldByteOffset = f.ByteOffset + lastFieldBitSize = f.BitSize + } + if t.Kind != "union" { + b, ok := e.Val(AttrByteSize).(int64) + if ok && b == lastFieldByteOffset { + // Final field must be zero width. Fix array length. + fixups.recordArrayType(lastFieldType) + } + } + + case TagConstType, TagVolatileType, TagRestrictType: + // Type modifier (DWARF v2 §5.2) + // Attributes: + // AttrType: subtype + t := new(QualType) + typ = t + typeCache[off] = t + if t.Type = typeOf(e); err != nil { + goto Error + } + switch e.Tag { + case TagConstType: + t.Qual = "const" + case TagRestrictType: + t.Qual = "restrict" + case TagVolatileType: + t.Qual = "volatile" + } + + case TagEnumerationType: + // Enumeration type (DWARF v2 §5.6) + // Attributes: + // AttrName: enum name if any + // AttrByteSize: bytes required to represent largest value + // Children: + // TagEnumerator: + // AttrName: name of constant + // AttrConstValue: value of constant + t := new(EnumType) + typ = t + typeCache[off] = t + t.EnumName, _ = e.Val(AttrName).(string) + t.Val = make([]*EnumValue, 0, 8) + for kid := next(); kid != nil; kid = next() { + if kid.Tag == TagEnumerator { + f := new(EnumValue) + f.Name, _ = kid.Val(AttrName).(string) + f.Val, _ = kid.Val(AttrConstValue).(int64) + n := len(t.Val) + if n >= cap(t.Val) { + val := make([]*EnumValue, n, n*2) + copy(val, t.Val) + t.Val = val + } + t.Val = t.Val[0 : n+1] + t.Val[n] = f + } + } + + case TagPointerType: + // Type modifier (DWARF v2 §5.2) + // Attributes: + // AttrType: subtype [not required! void* has no AttrType] + // AttrAddrClass: address class [ignored] + t := new(PtrType) + typ = t + typeCache[off] = t + if e.Val(AttrType) == nil { + t.Type = &VoidType{} + break + } + t.Type = typeOf(e) + + case TagSubroutineType: + // Subroutine type. (DWARF v2 §5.7) + // Attributes: + // AttrType: type of return value if any + // AttrName: possible name of type [ignored] + // AttrPrototyped: whether used ANSI C prototype [ignored] + // Children: + // TagFormalParameter: typed parameter + // AttrType: type of parameter + // TagUnspecifiedParameter: final ... + t := new(FuncType) + typ = t + typeCache[off] = t + if t.ReturnType = typeOf(e); err != nil { + goto Error + } + t.ParamType = make([]Type, 0, 8) + for kid := next(); kid != nil; kid = next() { + var tkid Type + switch kid.Tag { + default: + continue + case TagFormalParameter: + if tkid = typeOf(kid); err != nil { + goto Error + } + case TagUnspecifiedParameters: + tkid = &DotDotDotType{} + } + t.ParamType = append(t.ParamType, tkid) + } + + case TagTypedef: + // Typedef (DWARF v2 §5.3) + // Attributes: + // AttrName: name [required] + // AttrType: type definition [required] + t := new(TypedefType) + typ = t + typeCache[off] = t + t.Name, _ = e.Val(AttrName).(string) + t.Type = typeOf(e) + + case TagUnspecifiedType: + // Unspecified type (DWARF v3 §5.2) + // Attributes: + // AttrName: name + t := new(UnspecifiedType) + typ = t + typeCache[off] = t + t.Name, _ = e.Val(AttrName).(string) + + default: + // This is some other type DIE that we're currently not + // equipped to handle. Return an abstract "unsupported type" + // object in such cases. + t := new(UnsupportedType) + typ = t + typeCache[off] = t + t.Tag = e.Tag + t.Name, _ = e.Val(AttrName).(string) + } + + if err != nil { + goto Error + } + + { + b, ok := e.Val(AttrByteSize).(int64) + if !ok { + b = -1 + switch t := typ.(type) { + case *TypedefType: + // Record that we need to resolve this + // type's size once the type graph is + // constructed. + fixups.typedefs = append(fixups.typedefs, t) + case *PtrType: + b = int64(addressSize) + } + } + typ.Common().ByteSize = b + } + return typ, nil + +Error: + // If the parse fails, take the type out of the cache + // so that the next call with this offset doesn't hit + // the cache and return success. + delete(typeCache, off) + return nil, err +} + +func zeroArray(t *Type) { + at := (*t).(*ArrayType) + if at.Type.Size() == 0 { + return + } + // Make a copy to avoid invalidating typeCache. + tt := *at + tt.Count = 0 + *t = &tt +} diff --git a/go/src/debug/dwarf/type_test.go b/go/src/debug/dwarf/type_test.go new file mode 100644 index 0000000000000000000000000000000000000000..5858ef5d2455dd42732b166e02dd09e15f0f6a3e --- /dev/null +++ b/go/src/debug/dwarf/type_test.go @@ -0,0 +1,335 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package dwarf_test + +import ( + . "debug/dwarf" + "debug/elf" + "debug/macho" + "debug/pe" + "fmt" + "strconv" + "testing" +) + +var typedefTests = map[string]string{ + "t_ptr_volatile_int": "*volatile int", + "t_ptr_const_char": "*const char", + "t_long": "long int", + "t_ushort": "short unsigned int", + "t_func_int_of_float_double": "func(float, double) int", + "t_ptr_func_int_of_float_double": "*func(float, double) int", + "t_ptr_func_int_of_float_complex": "*func(complex float) int", + "t_ptr_func_int_of_double_complex": "*func(complex double) int", + "t_ptr_func_int_of_long_double_complex": "*func(complex long double) int", + "t_func_ptr_int_of_char_schar_uchar": "func(char, signed char, unsigned char) *int", + "t_func_void_of_char": "func(char) void", + "t_func_void_of_void": "func() void", + "t_func_void_of_ptr_char_dots": "func(*char, ...) void", + "t_my_struct": "struct my_struct {vi volatile int@0; x char@4 : 1@7; y int@4 : 4@27; z [0]int@8; array [40]long long int@8; zz [0]int@328}", + "t_my_struct1": "struct my_struct1 {zz [1]int@0}", + "t_my_union": "union my_union {vi volatile int@0; x char@0 : 1@7; y int@0 : 4@28; array [40]long long int@0}", + "t_my_enum": "enum my_enum {e1=1; e2=2; e3=-5; e4=1000000000000000}", + "t_my_list": "struct list {val short int@0; next *t_my_list@8}", + "t_my_tree": "struct tree {left *struct tree@0; right *struct tree@8; val long long unsigned int@16}", +} + +// As Apple converts gcc to a clang-based front end +// they keep breaking the DWARF output. This map lists the +// conversion from real answer to Apple answer. +var machoBug = map[string]string{ + "func(*char, ...) void": "func(*char) void", + "enum my_enum {e1=1; e2=2; e3=-5; e4=1000000000000000}": "enum my_enum {e1=1; e2=2; e3=-5; e4=-1530494976}", +} + +func elfData(t *testing.T, name string) *Data { + f, err := elf.Open(name) + if err != nil { + t.Fatal(err) + } + + d, err := f.DWARF() + if err != nil { + t.Fatal(err) + } + return d +} + +func machoData(t *testing.T, name string) *Data { + f, err := macho.Open(name) + if err != nil { + t.Fatal(err) + } + + d, err := f.DWARF() + if err != nil { + t.Fatal(err) + } + return d +} + +func peData(t *testing.T, name string) *Data { + f, err := pe.Open(name) + if err != nil { + t.Fatal(err) + } + + d, err := f.DWARF() + if err != nil { + t.Fatal(err) + } + return d +} + +func TestTypedefsELF(t *testing.T) { + testTypedefs(t, elfData(t, "testdata/typedef.elf"), "elf", typedefTests) +} + +func TestTypedefsMachO(t *testing.T) { + testTypedefs(t, machoData(t, "testdata/typedef.macho"), "macho", typedefTests) +} + +func TestTypedefsELFDwarf4(t *testing.T) { + testTypedefs(t, elfData(t, "testdata/typedef.elf4"), "elf", typedefTests) +} + +func testTypedefs(t *testing.T, d *Data, kind string, testcases map[string]string) { + r := d.Reader() + seen := make(map[string]bool) + for { + e, err := r.Next() + if err != nil { + t.Fatal("r.Next:", err) + } + if e == nil { + break + } + if e.Tag == TagTypedef { + typ, err := d.Type(e.Offset) + if err != nil { + t.Fatal("d.Type:", err) + } + t1 := typ.(*TypedefType) + var typstr string + if ts, ok := t1.Type.(*StructType); ok { + typstr = ts.Defn() + } else { + typstr = t1.Type.String() + } + + if want, ok := testcases[t1.Name]; ok { + if seen[t1.Name] { + t.Errorf("multiple definitions for %s", t1.Name) + } + seen[t1.Name] = true + if typstr != want && (kind != "macho" || typstr != machoBug[want]) { + t.Errorf("%s:\n\thave %s\n\twant %s", t1.Name, typstr, want) + } + } + } + if e.Tag != TagCompileUnit { + r.SkipChildren() + } + } + + for k := range testcases { + if !seen[k] { + t.Errorf("missing %s", k) + } + } +} + +func TestTypedefCycle(t *testing.T) { + // See issue #13039: reading a typedef cycle starting from a + // different place than the size needed to be computed from + // used to crash. + // + // cycle.elf built with GCC 4.8.4: + // gcc -g -c -o cycle.elf cycle.c + d := elfData(t, "testdata/cycle.elf") + r := d.Reader() + offsets := []Offset{} + for { + e, err := r.Next() + if err != nil { + t.Fatal("r.Next:", err) + } + if e == nil { + break + } + switch e.Tag { + case TagBaseType, TagTypedef, TagPointerType, TagStructType: + offsets = append(offsets, e.Offset) + } + } + + // Parse each type with a fresh type cache. + for _, offset := range offsets { + d := elfData(t, "testdata/cycle.elf") + _, err := d.Type(offset) + if err != nil { + t.Fatalf("d.Type(0x%x): %s", offset, err) + } + } +} + +var unsupportedTypeTests = []string{ + // varname:typename:string:size + "culprit::(unsupported type ReferenceType):8", + "pdm::(unsupported type PtrToMemberType):-1", +} + +func TestUnsupportedTypes(t *testing.T) { + // Issue 29601: + // When reading DWARF from C++ load modules, we can encounter + // oddball type DIEs. These will be returned as "UnsupportedType" + // objects; check to make sure this works properly. + d := elfData(t, "testdata/cppunsuptypes.elf") + r := d.Reader() + seen := make(map[string]bool) + for { + e, err := r.Next() + if err != nil { + t.Fatal("r.Next:", err) + } + if e == nil { + break + } + if e.Tag == TagVariable { + vname, _ := e.Val(AttrName).(string) + tAttr := e.Val(AttrType) + typOff, ok := tAttr.(Offset) + if !ok { + t.Errorf("variable at offset %v has no type", e.Offset) + continue + } + typ, err := d.Type(typOff) + if err != nil { + t.Errorf("err in type decode: %v\n", err) + continue + } + unsup, isok := typ.(*UnsupportedType) + if !isok { + continue + } + tag := vname + ":" + unsup.Name + ":" + unsup.String() + + ":" + strconv.FormatInt(unsup.Size(), 10) + seen[tag] = true + } + } + dumpseen := false + for _, v := range unsupportedTypeTests { + if !seen[v] { + t.Errorf("missing %s", v) + dumpseen = true + } + } + if dumpseen { + for k := range seen { + fmt.Printf("seen: %s\n", k) + } + } +} + +var expectedBitOffsets1 = map[string]string{ + "x": "S:1 DBO:32", + "y": "S:4 DBO:33", +} + +var expectedBitOffsets2 = map[string]string{ + "x": "S:1 BO:7", + "y": "S:4 BO:27", +} + +func TestBitOffsetsELF(t *testing.T) { + f := "testdata/typedef.elf" + testBitOffsets(t, elfData(t, f), f, expectedBitOffsets2) +} + +func TestBitOffsetsMachO(t *testing.T) { + f := "testdata/typedef.macho" + testBitOffsets(t, machoData(t, f), f, expectedBitOffsets2) +} + +func TestBitOffsetsMachO4(t *testing.T) { + f := "testdata/typedef.macho4" + testBitOffsets(t, machoData(t, f), f, expectedBitOffsets1) +} + +func TestBitOffsetsELFDwarf4(t *testing.T) { + f := "testdata/typedef.elf4" + testBitOffsets(t, elfData(t, f), f, expectedBitOffsets1) +} + +func TestBitOffsetsELFDwarf5(t *testing.T) { + f := "testdata/typedef.elf5" + testBitOffsets(t, elfData(t, f), f, expectedBitOffsets1) +} + +func testBitOffsets(t *testing.T, d *Data, tag string, expectedBitOffsets map[string]string) { + r := d.Reader() + for { + e, err := r.Next() + if err != nil { + t.Fatal("r.Next:", err) + } + if e == nil { + break + } + + if e.Tag == TagStructType { + typ, err := d.Type(e.Offset) + if err != nil { + t.Fatal("d.Type:", err) + } + + t1 := typ.(*StructType) + + bitInfoDump := func(f *StructField) string { + res := fmt.Sprintf("S:%d", f.BitSize) + if f.BitOffset != 0 { + res += fmt.Sprintf(" BO:%d", f.BitOffset) + } + if f.DataBitOffset != 0 { + res += fmt.Sprintf(" DBO:%d", f.DataBitOffset) + } + return res + } + + for _, field := range t1.Field { + // We're only testing for bitfields + if field.BitSize == 0 { + continue + } + got := bitInfoDump(field) + want := expectedBitOffsets[field.Name] + if got != want { + t.Errorf("%s: field %s in %s: got info %q want %q", tag, field.Name, t1.StructName, got, want) + } + } + } + if e.Tag != TagCompileUnit { + r.SkipChildren() + } + } +} + +var bitfieldTests = map[string]string{ + "t_another_struct": "struct another_struct {quix short unsigned int@0; xyz [0]int@4; x unsigned int@4 : 1@31; array [40]long long int@8}", +} + +// TestBitFieldZeroArrayIssue50685 checks to make sure that the DWARF +// type reading code doesn't get confused by the presence of a +// specifically-sized bitfield member immediately following a field +// whose type is a zero-length array. Prior to the fix for issue +// 50685, we would get this type for the case in testdata/bitfields.c: +// +// another_struct {quix short unsigned int@0; xyz [-1]int@4; x unsigned int@4 : 1@31; array [40]long long int@8} +// +// Note the "-1" for the xyz field, which should be zero. +func TestBitFieldZeroArrayIssue50685(t *testing.T) { + f := "testdata/bitfields.elf4" + testTypedefs(t, elfData(t, f), "elf", bitfieldTests) +} diff --git a/go/src/debug/dwarf/typeunit.go b/go/src/debug/dwarf/typeunit.go new file mode 100644 index 0000000000000000000000000000000000000000..e5b8973ac9c4f2e7cb35cf97eca84bfb3594c5b2 --- /dev/null +++ b/go/src/debug/dwarf/typeunit.go @@ -0,0 +1,160 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package dwarf + +import ( + "fmt" + "strconv" +) + +// Parse the type units stored in a DWARF4 .debug_types section. Each +// type unit defines a single primary type and an 8-byte signature. +// Other sections may then use formRefSig8 to refer to the type. + +// The typeUnit format is a single type with a signature. It holds +// the same data as a compilation unit. +type typeUnit struct { + unit + toff Offset // Offset to signature type within data. + name string // Name of .debug_type section. + cache Type // Cache the type, nil to start. +} + +// Parse a .debug_types section. +func (d *Data) parseTypes(name string, types []byte) error { + b := makeBuf(d, unknownFormat{}, name, 0, types) + for len(b.data) > 0 { + base := b.off + n, dwarf64 := b.unitLength() + if n != Offset(uint32(n)) { + b.error("type unit length overflow") + return b.err + } + hdroff := b.off + vers := int(b.uint16()) + if vers != 4 { + b.error("unsupported DWARF version " + strconv.Itoa(vers)) + return b.err + } + var ao uint64 + if !dwarf64 { + ao = uint64(b.uint32()) + } else { + ao = b.uint64() + } + atable, err := d.parseAbbrev(ao, vers) + if err != nil { + return err + } + asize := b.uint8() + sig := b.uint64() + + var toff uint32 + if !dwarf64 { + toff = b.uint32() + } else { + to64 := b.uint64() + if to64 != uint64(uint32(to64)) { + b.error("type unit type offset overflow") + return b.err + } + toff = uint32(to64) + } + + boff := b.off + d.typeSigs[sig] = &typeUnit{ + unit: unit{ + base: base, + off: boff, + data: b.bytes(int(n - (b.off - hdroff))), + atable: atable, + asize: int(asize), + vers: vers, + is64: dwarf64, + }, + toff: Offset(toff), + name: name, + } + if b.err != nil { + return b.err + } + } + return nil +} + +// Return the type for a type signature. +func (d *Data) sigToType(sig uint64) (Type, error) { + tu := d.typeSigs[sig] + if tu == nil { + return nil, fmt.Errorf("no type unit with signature %v", sig) + } + if tu.cache != nil { + return tu.cache, nil + } + + b := makeBuf(d, tu, tu.name, tu.off, tu.data) + r := &typeUnitReader{d: d, tu: tu, b: b} + t, err := d.readType(tu.name, r, tu.toff, make(map[Offset]Type), nil) + if err != nil { + return nil, err + } + + tu.cache = t + return t, nil +} + +// typeUnitReader is a typeReader for a tagTypeUnit. +type typeUnitReader struct { + d *Data + tu *typeUnit + b buf + err error +} + +// Seek to a new position in the type unit. +func (tur *typeUnitReader) Seek(off Offset) { + tur.err = nil + doff := off - tur.tu.off + if doff < 0 || doff >= Offset(len(tur.tu.data)) { + tur.err = fmt.Errorf("%s: offset %d out of range; max %d", tur.tu.name, doff, len(tur.tu.data)) + return + } + tur.b = makeBuf(tur.d, tur.tu, tur.tu.name, off, tur.tu.data[doff:]) +} + +// AddressSize returns the size in bytes of addresses in the current type unit. +func (tur *typeUnitReader) AddressSize() int { + return tur.tu.unit.asize +} + +// Next reads the next [Entry] from the type unit. +func (tur *typeUnitReader) Next() (*Entry, error) { + if tur.err != nil { + return nil, tur.err + } + if len(tur.tu.data) == 0 { + return nil, nil + } + e := tur.b.entry(nil, &tur.tu.unit) + if tur.b.err != nil { + tur.err = tur.b.err + return nil, tur.err + } + return e, nil +} + +// clone returns a new reader for the type unit. +func (tur *typeUnitReader) clone() typeReader { + return &typeUnitReader{ + d: tur.d, + tu: tur.tu, + b: makeBuf(tur.d, tur.tu, tur.tu.name, tur.tu.off, tur.tu.data), + } +} + +// offset returns the current offset. +func (tur *typeUnitReader) offset() Offset { + return tur.b.off +} diff --git a/go/src/debug/dwarf/unit.go b/go/src/debug/dwarf/unit.go new file mode 100644 index 0000000000000000000000000000000000000000..7a384f32c3f3a3e83223c3888df925217b8f143e --- /dev/null +++ b/go/src/debug/dwarf/unit.go @@ -0,0 +1,200 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package dwarf + +import ( + "sort" + "strconv" +) + +// DWARF debug info is split into a sequence of compilation units. +// Each unit has its own abbreviation table and address size. + +type unit struct { + base Offset // byte offset of header within the aggregate info + off Offset // byte offset of data within the aggregate info + data []byte + atable abbrevTable + *unit5 // info specific to DWARF 5 units + asize int + vers int + is64 bool // True for 64-bit DWARF format + utype uint8 // DWARF 5 unit type +} + +type unit5 struct { + addrBase uint64 + strOffsetsBase uint64 + rngListsBase uint64 + locListsBase uint64 +} + +// Implement the dataFormat interface. + +func (u *unit) version() int { + return u.vers +} + +func (u *unit) dwarf64() (bool, bool) { + return u.is64, true +} + +func (u *unit) addrsize() int { + return u.asize +} + +func (u *unit) addrBase() uint64 { + if u.unit5 != nil { + return u.unit5.addrBase + } + return 0 +} + +func (u *unit) strOffsetsBase() uint64 { + if u.unit5 != nil { + return u.unit5.strOffsetsBase + } + return 0 +} + +func (u *unit) rngListsBase() uint64 { + if u.unit5 != nil { + return u.unit5.rngListsBase + } + return 0 +} + +func (u *unit) locListsBase() uint64 { + if u.unit5 != nil { + return u.unit5.locListsBase + } + return 0 +} + +func (d *Data) parseUnits() ([]unit, error) { + // Count units. + nunit := 0 + b := makeBuf(d, unknownFormat{}, "info", 0, d.info) + for len(b.data) > 0 { + len, _ := b.unitLength() + if len != Offset(uint32(len)) { + b.error("unit length overflow") + break + } + b.skip(int(len)) + if len > 0 { + nunit++ + } + } + if b.err != nil { + return nil, b.err + } + + // Again, this time writing them down. + b = makeBuf(d, unknownFormat{}, "info", 0, d.info) + units := make([]unit, nunit) + for i := range units { + u := &units[i] + u.base = b.off + var n Offset + if b.err != nil { + return nil, b.err + } + for n == 0 { + n, u.is64 = b.unitLength() + } + dataOff := b.off + vers := b.uint16() + if vers < 2 || vers > 5 { + b.error("unsupported DWARF version " + strconv.Itoa(int(vers))) + break + } + u.vers = int(vers) + if vers >= 5 { + u.utype = b.uint8() + u.asize = int(b.uint8()) + } + var abbrevOff uint64 + if u.is64 { + abbrevOff = b.uint64() + } else { + abbrevOff = uint64(b.uint32()) + } + atable, err := d.parseAbbrev(abbrevOff, u.vers) + if err != nil { + if b.err == nil { + b.err = err + } + break + } + u.atable = atable + if vers < 5 { + u.asize = int(b.uint8()) + } + + switch u.utype { + case utSkeleton, utSplitCompile: + b.uint64() // unit ID + case utType, utSplitType: + b.uint64() // type signature + if u.is64 { // type offset + b.uint64() + } else { + b.uint32() + } + } + + u.off = b.off + u.data = b.bytes(int(n - (b.off - dataOff))) + } + if b.err != nil { + return nil, b.err + } + return units, nil +} + +// offsetToUnit returns the index of the unit containing offset off. +// It returns -1 if no unit contains this offset. +func (d *Data) offsetToUnit(off Offset) int { + // Find the unit after off + next := sort.Search(len(d.unit), func(i int) bool { + return d.unit[i].off > off + }) + if next == 0 { + return -1 + } + u := &d.unit[next-1] + if u.off <= off && off < u.off+Offset(len(u.data)) { + return next - 1 + } + return -1 +} + +func (d *Data) collectDwarf5BaseOffsets(u *unit) error { + if u.unit5 == nil { + panic("expected unit5 to be set up already") + } + b := makeBuf(d, u, "info", u.off, u.data) + cu := b.entry(nil, u) + if cu == nil { + // Unknown abbreviation table entry or some other fatal + // problem; bail early on the assumption that this will be + // detected at some later point. + return b.err + } + if iAddrBase, ok := cu.Val(AttrAddrBase).(int64); ok { + u.unit5.addrBase = uint64(iAddrBase) + } + if iStrOffsetsBase, ok := cu.Val(AttrStrOffsetsBase).(int64); ok { + u.unit5.strOffsetsBase = uint64(iStrOffsetsBase) + } + if iRngListsBase, ok := cu.Val(AttrRnglistsBase).(int64); ok { + u.unit5.rngListsBase = uint64(iRngListsBase) + } + if iLocListsBase, ok := cu.Val(AttrLoclistsBase).(int64); ok { + u.unit5.locListsBase = uint64(iLocListsBase) + } + return nil +} diff --git a/go/src/debug/elf/elf.go b/go/src/debug/elf/elf.go new file mode 100644 index 0000000000000000000000000000000000000000..557648ece9b03d24e324231341044c5a8e089a50 --- /dev/null +++ b/go/src/debug/elf/elf.go @@ -0,0 +1,3681 @@ +/* + * ELF constants and data structures + * + * Derived from: + * $FreeBSD: src/sys/sys/elf32.h,v 1.8.14.1 2005/12/30 22:13:58 marcel Exp $ + * $FreeBSD: src/sys/sys/elf64.h,v 1.10.14.1 2005/12/30 22:13:58 marcel Exp $ + * $FreeBSD: src/sys/sys/elf_common.h,v 1.15.8.1 2005/12/30 22:13:58 marcel Exp $ + * $FreeBSD: src/sys/alpha/include/elf.h,v 1.14 2003/09/25 01:10:22 peter Exp $ + * $FreeBSD: src/sys/amd64/include/elf.h,v 1.18 2004/08/03 08:21:48 dfr Exp $ + * $FreeBSD: src/sys/arm/include/elf.h,v 1.5.2.1 2006/06/30 21:42:52 cognet Exp $ + * $FreeBSD: src/sys/i386/include/elf.h,v 1.16 2004/08/02 19:12:17 dfr Exp $ + * $FreeBSD: src/sys/powerpc/include/elf.h,v 1.7 2004/11/02 09:47:01 ssouhlal Exp $ + * $FreeBSD: src/sys/sparc64/include/elf.h,v 1.12 2003/09/25 01:10:26 peter Exp $ + * "System V ABI" (http://www.sco.com/developers/gabi/latest/ch4.eheader.html) + * "ELF for the ARM® 64-bit Architecture (AArch64)" (ARM IHI 0056B) + * "RISC-V ELF psABI specification" (https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc) + * llvm/BinaryFormat/ELF.h - ELF constants and structures + * + * Copyright (c) 1996-1998 John D. Polstra. All rights reserved. + * Copyright (c) 2001 David E. O'Brien + * Portions Copyright 2009 The Go Authors. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +package elf + +import "strconv" + +/* + * Constants + */ + +// Indexes into the Header.Ident array. +const ( + EI_CLASS = 4 /* Class of machine. */ + EI_DATA = 5 /* Data format. */ + EI_VERSION = 6 /* ELF format version. */ + EI_OSABI = 7 /* Operating system / ABI identification */ + EI_ABIVERSION = 8 /* ABI version */ + EI_PAD = 9 /* Start of padding (per SVR4 ABI). */ + EI_NIDENT = 16 /* Size of e_ident array. */ +) + +// Initial magic number for ELF files. +const ELFMAG = "\177ELF" + +// Version is found in Header.Ident[EI_VERSION] and Header.Version. +type Version byte + +const ( + EV_NONE Version = 0 + EV_CURRENT Version = 1 +) + +var versionStrings = []intName{ + {0, "EV_NONE"}, + {1, "EV_CURRENT"}, +} + +func (i Version) String() string { return stringName(uint32(i), versionStrings, false) } +func (i Version) GoString() string { return stringName(uint32(i), versionStrings, true) } + +// Class is found in Header.Ident[EI_CLASS] and Header.Class. +type Class byte + +const ( + ELFCLASSNONE Class = 0 /* Unknown class. */ + ELFCLASS32 Class = 1 /* 32-bit architecture. */ + ELFCLASS64 Class = 2 /* 64-bit architecture. */ +) + +var classStrings = []intName{ + {0, "ELFCLASSNONE"}, + {1, "ELFCLASS32"}, + {2, "ELFCLASS64"}, +} + +func (i Class) String() string { return stringName(uint32(i), classStrings, false) } +func (i Class) GoString() string { return stringName(uint32(i), classStrings, true) } + +// Data is found in Header.Ident[EI_DATA] and Header.Data. +type Data byte + +const ( + ELFDATANONE Data = 0 /* Unknown data format. */ + ELFDATA2LSB Data = 1 /* 2's complement little-endian. */ + ELFDATA2MSB Data = 2 /* 2's complement big-endian. */ +) + +var dataStrings = []intName{ + {0, "ELFDATANONE"}, + {1, "ELFDATA2LSB"}, + {2, "ELFDATA2MSB"}, +} + +func (i Data) String() string { return stringName(uint32(i), dataStrings, false) } +func (i Data) GoString() string { return stringName(uint32(i), dataStrings, true) } + +// OSABI is found in Header.Ident[EI_OSABI] and Header.OSABI. +type OSABI byte + +const ( + ELFOSABI_NONE OSABI = 0 /* UNIX System V ABI */ + ELFOSABI_HPUX OSABI = 1 /* HP-UX operating system */ + ELFOSABI_NETBSD OSABI = 2 /* NetBSD */ + ELFOSABI_LINUX OSABI = 3 /* Linux */ + ELFOSABI_HURD OSABI = 4 /* Hurd */ + ELFOSABI_86OPEN OSABI = 5 /* 86Open common IA32 ABI */ + ELFOSABI_SOLARIS OSABI = 6 /* Solaris */ + ELFOSABI_AIX OSABI = 7 /* AIX */ + ELFOSABI_IRIX OSABI = 8 /* IRIX */ + ELFOSABI_FREEBSD OSABI = 9 /* FreeBSD */ + ELFOSABI_TRU64 OSABI = 10 /* TRU64 UNIX */ + ELFOSABI_MODESTO OSABI = 11 /* Novell Modesto */ + ELFOSABI_OPENBSD OSABI = 12 /* OpenBSD */ + ELFOSABI_OPENVMS OSABI = 13 /* Open VMS */ + ELFOSABI_NSK OSABI = 14 /* HP Non-Stop Kernel */ + ELFOSABI_AROS OSABI = 15 /* Amiga Research OS */ + ELFOSABI_FENIXOS OSABI = 16 /* The FenixOS highly scalable multi-core OS */ + ELFOSABI_CLOUDABI OSABI = 17 /* Nuxi CloudABI */ + ELFOSABI_ARM OSABI = 97 /* ARM */ + ELFOSABI_STANDALONE OSABI = 255 /* Standalone (embedded) application */ +) + +var osabiStrings = []intName{ + {0, "ELFOSABI_NONE"}, + {1, "ELFOSABI_HPUX"}, + {2, "ELFOSABI_NETBSD"}, + {3, "ELFOSABI_LINUX"}, + {4, "ELFOSABI_HURD"}, + {5, "ELFOSABI_86OPEN"}, + {6, "ELFOSABI_SOLARIS"}, + {7, "ELFOSABI_AIX"}, + {8, "ELFOSABI_IRIX"}, + {9, "ELFOSABI_FREEBSD"}, + {10, "ELFOSABI_TRU64"}, + {11, "ELFOSABI_MODESTO"}, + {12, "ELFOSABI_OPENBSD"}, + {13, "ELFOSABI_OPENVMS"}, + {14, "ELFOSABI_NSK"}, + {15, "ELFOSABI_AROS"}, + {16, "ELFOSABI_FENIXOS"}, + {17, "ELFOSABI_CLOUDABI"}, + {97, "ELFOSABI_ARM"}, + {255, "ELFOSABI_STANDALONE"}, +} + +func (i OSABI) String() string { return stringName(uint32(i), osabiStrings, false) } +func (i OSABI) GoString() string { return stringName(uint32(i), osabiStrings, true) } + +// Type is found in Header.Type. +type Type uint16 + +const ( + ET_NONE Type = 0 /* Unknown type. */ + ET_REL Type = 1 /* Relocatable. */ + ET_EXEC Type = 2 /* Executable. */ + ET_DYN Type = 3 /* Shared object. */ + ET_CORE Type = 4 /* Core file. */ + ET_LOOS Type = 0xfe00 /* First operating system specific. */ + ET_HIOS Type = 0xfeff /* Last operating system-specific. */ + ET_LOPROC Type = 0xff00 /* First processor-specific. */ + ET_HIPROC Type = 0xffff /* Last processor-specific. */ +) + +var typeStrings = []intName{ + {0, "ET_NONE"}, + {1, "ET_REL"}, + {2, "ET_EXEC"}, + {3, "ET_DYN"}, + {4, "ET_CORE"}, + {0xfe00, "ET_LOOS"}, + {0xfeff, "ET_HIOS"}, + {0xff00, "ET_LOPROC"}, + {0xffff, "ET_HIPROC"}, +} + +func (i Type) String() string { return stringName(uint32(i), typeStrings, false) } +func (i Type) GoString() string { return stringName(uint32(i), typeStrings, true) } + +// Machine is found in Header.Machine. +type Machine uint16 + +const ( + EM_NONE Machine = 0 /* Unknown machine. */ + EM_M32 Machine = 1 /* AT&T WE32100. */ + EM_SPARC Machine = 2 /* Sun SPARC. */ + EM_386 Machine = 3 /* Intel i386. */ + EM_68K Machine = 4 /* Motorola 68000. */ + EM_88K Machine = 5 /* Motorola 88000. */ + EM_860 Machine = 7 /* Intel i860. */ + EM_MIPS Machine = 8 /* MIPS R3000 Big-Endian only. */ + EM_S370 Machine = 9 /* IBM System/370. */ + EM_MIPS_RS3_LE Machine = 10 /* MIPS R3000 Little-Endian. */ + EM_PARISC Machine = 15 /* HP PA-RISC. */ + EM_VPP500 Machine = 17 /* Fujitsu VPP500. */ + EM_SPARC32PLUS Machine = 18 /* SPARC v8plus. */ + EM_960 Machine = 19 /* Intel 80960. */ + EM_PPC Machine = 20 /* PowerPC 32-bit. */ + EM_PPC64 Machine = 21 /* PowerPC 64-bit. */ + EM_S390 Machine = 22 /* IBM System/390. */ + EM_V800 Machine = 36 /* NEC V800. */ + EM_FR20 Machine = 37 /* Fujitsu FR20. */ + EM_RH32 Machine = 38 /* TRW RH-32. */ + EM_RCE Machine = 39 /* Motorola RCE. */ + EM_ARM Machine = 40 /* ARM. */ + EM_SH Machine = 42 /* Hitachi SH. */ + EM_SPARCV9 Machine = 43 /* SPARC v9 64-bit. */ + EM_TRICORE Machine = 44 /* Siemens TriCore embedded processor. */ + EM_ARC Machine = 45 /* Argonaut RISC Core. */ + EM_H8_300 Machine = 46 /* Hitachi H8/300. */ + EM_H8_300H Machine = 47 /* Hitachi H8/300H. */ + EM_H8S Machine = 48 /* Hitachi H8S. */ + EM_H8_500 Machine = 49 /* Hitachi H8/500. */ + EM_IA_64 Machine = 50 /* Intel IA-64 Processor. */ + EM_MIPS_X Machine = 51 /* Stanford MIPS-X. */ + EM_COLDFIRE Machine = 52 /* Motorola ColdFire. */ + EM_68HC12 Machine = 53 /* Motorola M68HC12. */ + EM_MMA Machine = 54 /* Fujitsu MMA. */ + EM_PCP Machine = 55 /* Siemens PCP. */ + EM_NCPU Machine = 56 /* Sony nCPU. */ + EM_NDR1 Machine = 57 /* Denso NDR1 microprocessor. */ + EM_STARCORE Machine = 58 /* Motorola Star*Core processor. */ + EM_ME16 Machine = 59 /* Toyota ME16 processor. */ + EM_ST100 Machine = 60 /* STMicroelectronics ST100 processor. */ + EM_TINYJ Machine = 61 /* Advanced Logic Corp. TinyJ processor. */ + EM_X86_64 Machine = 62 /* Advanced Micro Devices x86-64 */ + EM_PDSP Machine = 63 /* Sony DSP Processor */ + EM_PDP10 Machine = 64 /* Digital Equipment Corp. PDP-10 */ + EM_PDP11 Machine = 65 /* Digital Equipment Corp. PDP-11 */ + EM_FX66 Machine = 66 /* Siemens FX66 microcontroller */ + EM_ST9PLUS Machine = 67 /* STMicroelectronics ST9+ 8/16 bit microcontroller */ + EM_ST7 Machine = 68 /* STMicroelectronics ST7 8-bit microcontroller */ + EM_68HC16 Machine = 69 /* Motorola MC68HC16 Microcontroller */ + EM_68HC11 Machine = 70 /* Motorola MC68HC11 Microcontroller */ + EM_68HC08 Machine = 71 /* Motorola MC68HC08 Microcontroller */ + EM_68HC05 Machine = 72 /* Motorola MC68HC05 Microcontroller */ + EM_SVX Machine = 73 /* Silicon Graphics SVx */ + EM_ST19 Machine = 74 /* STMicroelectronics ST19 8-bit microcontroller */ + EM_VAX Machine = 75 /* Digital VAX */ + EM_CRIS Machine = 76 /* Axis Communications 32-bit embedded processor */ + EM_JAVELIN Machine = 77 /* Infineon Technologies 32-bit embedded processor */ + EM_FIREPATH Machine = 78 /* Element 14 64-bit DSP Processor */ + EM_ZSP Machine = 79 /* LSI Logic 16-bit DSP Processor */ + EM_MMIX Machine = 80 /* Donald Knuth's educational 64-bit processor */ + EM_HUANY Machine = 81 /* Harvard University machine-independent object files */ + EM_PRISM Machine = 82 /* SiTera Prism */ + EM_AVR Machine = 83 /* Atmel AVR 8-bit microcontroller */ + EM_FR30 Machine = 84 /* Fujitsu FR30 */ + EM_D10V Machine = 85 /* Mitsubishi D10V */ + EM_D30V Machine = 86 /* Mitsubishi D30V */ + EM_V850 Machine = 87 /* NEC v850 */ + EM_M32R Machine = 88 /* Mitsubishi M32R */ + EM_MN10300 Machine = 89 /* Matsushita MN10300 */ + EM_MN10200 Machine = 90 /* Matsushita MN10200 */ + EM_PJ Machine = 91 /* picoJava */ + EM_OPENRISC Machine = 92 /* OpenRISC 32-bit embedded processor */ + EM_ARC_COMPACT Machine = 93 /* ARC International ARCompact processor (old spelling/synonym: EM_ARC_A5) */ + EM_XTENSA Machine = 94 /* Tensilica Xtensa Architecture */ + EM_VIDEOCORE Machine = 95 /* Alphamosaic VideoCore processor */ + EM_TMM_GPP Machine = 96 /* Thompson Multimedia General Purpose Processor */ + EM_NS32K Machine = 97 /* National Semiconductor 32000 series */ + EM_TPC Machine = 98 /* Tenor Network TPC processor */ + EM_SNP1K Machine = 99 /* Trebia SNP 1000 processor */ + EM_ST200 Machine = 100 /* STMicroelectronics (www.st.com) ST200 microcontroller */ + EM_IP2K Machine = 101 /* Ubicom IP2xxx microcontroller family */ + EM_MAX Machine = 102 /* MAX Processor */ + EM_CR Machine = 103 /* National Semiconductor CompactRISC microprocessor */ + EM_F2MC16 Machine = 104 /* Fujitsu F2MC16 */ + EM_MSP430 Machine = 105 /* Texas Instruments embedded microcontroller msp430 */ + EM_BLACKFIN Machine = 106 /* Analog Devices Blackfin (DSP) processor */ + EM_SE_C33 Machine = 107 /* S1C33 Family of Seiko Epson processors */ + EM_SEP Machine = 108 /* Sharp embedded microprocessor */ + EM_ARCA Machine = 109 /* Arca RISC Microprocessor */ + EM_UNICORE Machine = 110 /* Microprocessor series from PKU-Unity Ltd. and MPRC of Peking University */ + EM_EXCESS Machine = 111 /* eXcess: 16/32/64-bit configurable embedded CPU */ + EM_DXP Machine = 112 /* Icera Semiconductor Inc. Deep Execution Processor */ + EM_ALTERA_NIOS2 Machine = 113 /* Altera Nios II soft-core processor */ + EM_CRX Machine = 114 /* National Semiconductor CompactRISC CRX microprocessor */ + EM_XGATE Machine = 115 /* Motorola XGATE embedded processor */ + EM_C166 Machine = 116 /* Infineon C16x/XC16x processor */ + EM_M16C Machine = 117 /* Renesas M16C series microprocessors */ + EM_DSPIC30F Machine = 118 /* Microchip Technology dsPIC30F Digital Signal Controller */ + EM_CE Machine = 119 /* Freescale Communication Engine RISC core */ + EM_M32C Machine = 120 /* Renesas M32C series microprocessors */ + EM_TSK3000 Machine = 131 /* Altium TSK3000 core */ + EM_RS08 Machine = 132 /* Freescale RS08 embedded processor */ + EM_SHARC Machine = 133 /* Analog Devices SHARC family of 32-bit DSP processors */ + EM_ECOG2 Machine = 134 /* Cyan Technology eCOG2 microprocessor */ + EM_SCORE7 Machine = 135 /* Sunplus S+core7 RISC processor */ + EM_DSP24 Machine = 136 /* New Japan Radio (NJR) 24-bit DSP Processor */ + EM_VIDEOCORE3 Machine = 137 /* Broadcom VideoCore III processor */ + EM_LATTICEMICO32 Machine = 138 /* RISC processor for Lattice FPGA architecture */ + EM_SE_C17 Machine = 139 /* Seiko Epson C17 family */ + EM_TI_C6000 Machine = 140 /* The Texas Instruments TMS320C6000 DSP family */ + EM_TI_C2000 Machine = 141 /* The Texas Instruments TMS320C2000 DSP family */ + EM_TI_C5500 Machine = 142 /* The Texas Instruments TMS320C55x DSP family */ + EM_TI_ARP32 Machine = 143 /* Texas Instruments Application Specific RISC Processor, 32bit fetch */ + EM_TI_PRU Machine = 144 /* Texas Instruments Programmable Realtime Unit */ + EM_MMDSP_PLUS Machine = 160 /* STMicroelectronics 64bit VLIW Data Signal Processor */ + EM_CYPRESS_M8C Machine = 161 /* Cypress M8C microprocessor */ + EM_R32C Machine = 162 /* Renesas R32C series microprocessors */ + EM_TRIMEDIA Machine = 163 /* NXP Semiconductors TriMedia architecture family */ + EM_QDSP6 Machine = 164 /* QUALCOMM DSP6 Processor */ + EM_8051 Machine = 165 /* Intel 8051 and variants */ + EM_STXP7X Machine = 166 /* STMicroelectronics STxP7x family of configurable and extensible RISC processors */ + EM_NDS32 Machine = 167 /* Andes Technology compact code size embedded RISC processor family */ + EM_ECOG1 Machine = 168 /* Cyan Technology eCOG1X family */ + EM_ECOG1X Machine = 168 /* Cyan Technology eCOG1X family */ + EM_MAXQ30 Machine = 169 /* Dallas Semiconductor MAXQ30 Core Micro-controllers */ + EM_XIMO16 Machine = 170 /* New Japan Radio (NJR) 16-bit DSP Processor */ + EM_MANIK Machine = 171 /* M2000 Reconfigurable RISC Microprocessor */ + EM_CRAYNV2 Machine = 172 /* Cray Inc. NV2 vector architecture */ + EM_RX Machine = 173 /* Renesas RX family */ + EM_METAG Machine = 174 /* Imagination Technologies META processor architecture */ + EM_MCST_ELBRUS Machine = 175 /* MCST Elbrus general purpose hardware architecture */ + EM_ECOG16 Machine = 176 /* Cyan Technology eCOG16 family */ + EM_CR16 Machine = 177 /* National Semiconductor CompactRISC CR16 16-bit microprocessor */ + EM_ETPU Machine = 178 /* Freescale Extended Time Processing Unit */ + EM_SLE9X Machine = 179 /* Infineon Technologies SLE9X core */ + EM_L10M Machine = 180 /* Intel L10M */ + EM_K10M Machine = 181 /* Intel K10M */ + EM_AARCH64 Machine = 183 /* ARM 64-bit Architecture (AArch64) */ + EM_AVR32 Machine = 185 /* Atmel Corporation 32-bit microprocessor family */ + EM_STM8 Machine = 186 /* STMicroeletronics STM8 8-bit microcontroller */ + EM_TILE64 Machine = 187 /* Tilera TILE64 multicore architecture family */ + EM_TILEPRO Machine = 188 /* Tilera TILEPro multicore architecture family */ + EM_MICROBLAZE Machine = 189 /* Xilinx MicroBlaze 32-bit RISC soft processor core */ + EM_CUDA Machine = 190 /* NVIDIA CUDA architecture */ + EM_TILEGX Machine = 191 /* Tilera TILE-Gx multicore architecture family */ + EM_CLOUDSHIELD Machine = 192 /* CloudShield architecture family */ + EM_COREA_1ST Machine = 193 /* KIPO-KAIST Core-A 1st generation processor family */ + EM_COREA_2ND Machine = 194 /* KIPO-KAIST Core-A 2nd generation processor family */ + EM_ARC_COMPACT2 Machine = 195 /* Synopsys ARCompact V2 */ + EM_OPEN8 Machine = 196 /* Open8 8-bit RISC soft processor core */ + EM_RL78 Machine = 197 /* Renesas RL78 family */ + EM_VIDEOCORE5 Machine = 198 /* Broadcom VideoCore V processor */ + EM_78KOR Machine = 199 /* Renesas 78KOR family */ + EM_56800EX Machine = 200 /* Freescale 56800EX Digital Signal Controller (DSC) */ + EM_BA1 Machine = 201 /* Beyond BA1 CPU architecture */ + EM_BA2 Machine = 202 /* Beyond BA2 CPU architecture */ + EM_XCORE Machine = 203 /* XMOS xCORE processor family */ + EM_MCHP_PIC Machine = 204 /* Microchip 8-bit PIC(r) family */ + EM_INTEL205 Machine = 205 /* Reserved by Intel */ + EM_INTEL206 Machine = 206 /* Reserved by Intel */ + EM_INTEL207 Machine = 207 /* Reserved by Intel */ + EM_INTEL208 Machine = 208 /* Reserved by Intel */ + EM_INTEL209 Machine = 209 /* Reserved by Intel */ + EM_KM32 Machine = 210 /* KM211 KM32 32-bit processor */ + EM_KMX32 Machine = 211 /* KM211 KMX32 32-bit processor */ + EM_KMX16 Machine = 212 /* KM211 KMX16 16-bit processor */ + EM_KMX8 Machine = 213 /* KM211 KMX8 8-bit processor */ + EM_KVARC Machine = 214 /* KM211 KVARC processor */ + EM_CDP Machine = 215 /* Paneve CDP architecture family */ + EM_COGE Machine = 216 /* Cognitive Smart Memory Processor */ + EM_COOL Machine = 217 /* Bluechip Systems CoolEngine */ + EM_NORC Machine = 218 /* Nanoradio Optimized RISC */ + EM_CSR_KALIMBA Machine = 219 /* CSR Kalimba architecture family */ + EM_Z80 Machine = 220 /* Zilog Z80 */ + EM_VISIUM Machine = 221 /* Controls and Data Services VISIUMcore processor */ + EM_FT32 Machine = 222 /* FTDI Chip FT32 high performance 32-bit RISC architecture */ + EM_MOXIE Machine = 223 /* Moxie processor family */ + EM_AMDGPU Machine = 224 /* AMD GPU architecture */ + EM_RISCV Machine = 243 /* RISC-V */ + EM_LANAI Machine = 244 /* Lanai 32-bit processor */ + EM_BPF Machine = 247 /* Linux BPF – in-kernel virtual machine */ + EM_LOONGARCH Machine = 258 /* LoongArch */ + + /* Non-standard or deprecated. */ + EM_486 Machine = 6 /* Intel i486. */ + EM_MIPS_RS4_BE Machine = 10 /* MIPS R4000 Big-Endian */ + EM_ALPHA_STD Machine = 41 /* Digital Alpha (standard value). */ + EM_ALPHA Machine = 0x9026 /* Alpha (written in the absence of an ABI) */ +) + +var machineStrings = []intName{ + {0, "EM_NONE"}, + {1, "EM_M32"}, + {2, "EM_SPARC"}, + {3, "EM_386"}, + {4, "EM_68K"}, + {5, "EM_88K"}, + {7, "EM_860"}, + {8, "EM_MIPS"}, + {9, "EM_S370"}, + {10, "EM_MIPS_RS3_LE"}, + {15, "EM_PARISC"}, + {17, "EM_VPP500"}, + {18, "EM_SPARC32PLUS"}, + {19, "EM_960"}, + {20, "EM_PPC"}, + {21, "EM_PPC64"}, + {22, "EM_S390"}, + {36, "EM_V800"}, + {37, "EM_FR20"}, + {38, "EM_RH32"}, + {39, "EM_RCE"}, + {40, "EM_ARM"}, + {42, "EM_SH"}, + {43, "EM_SPARCV9"}, + {44, "EM_TRICORE"}, + {45, "EM_ARC"}, + {46, "EM_H8_300"}, + {47, "EM_H8_300H"}, + {48, "EM_H8S"}, + {49, "EM_H8_500"}, + {50, "EM_IA_64"}, + {51, "EM_MIPS_X"}, + {52, "EM_COLDFIRE"}, + {53, "EM_68HC12"}, + {54, "EM_MMA"}, + {55, "EM_PCP"}, + {56, "EM_NCPU"}, + {57, "EM_NDR1"}, + {58, "EM_STARCORE"}, + {59, "EM_ME16"}, + {60, "EM_ST100"}, + {61, "EM_TINYJ"}, + {62, "EM_X86_64"}, + {63, "EM_PDSP"}, + {64, "EM_PDP10"}, + {65, "EM_PDP11"}, + {66, "EM_FX66"}, + {67, "EM_ST9PLUS"}, + {68, "EM_ST7"}, + {69, "EM_68HC16"}, + {70, "EM_68HC11"}, + {71, "EM_68HC08"}, + {72, "EM_68HC05"}, + {73, "EM_SVX"}, + {74, "EM_ST19"}, + {75, "EM_VAX"}, + {76, "EM_CRIS"}, + {77, "EM_JAVELIN"}, + {78, "EM_FIREPATH"}, + {79, "EM_ZSP"}, + {80, "EM_MMIX"}, + {81, "EM_HUANY"}, + {82, "EM_PRISM"}, + {83, "EM_AVR"}, + {84, "EM_FR30"}, + {85, "EM_D10V"}, + {86, "EM_D30V"}, + {87, "EM_V850"}, + {88, "EM_M32R"}, + {89, "EM_MN10300"}, + {90, "EM_MN10200"}, + {91, "EM_PJ"}, + {92, "EM_OPENRISC"}, + {93, "EM_ARC_COMPACT"}, + {94, "EM_XTENSA"}, + {95, "EM_VIDEOCORE"}, + {96, "EM_TMM_GPP"}, + {97, "EM_NS32K"}, + {98, "EM_TPC"}, + {99, "EM_SNP1K"}, + {100, "EM_ST200"}, + {101, "EM_IP2K"}, + {102, "EM_MAX"}, + {103, "EM_CR"}, + {104, "EM_F2MC16"}, + {105, "EM_MSP430"}, + {106, "EM_BLACKFIN"}, + {107, "EM_SE_C33"}, + {108, "EM_SEP"}, + {109, "EM_ARCA"}, + {110, "EM_UNICORE"}, + {111, "EM_EXCESS"}, + {112, "EM_DXP"}, + {113, "EM_ALTERA_NIOS2"}, + {114, "EM_CRX"}, + {115, "EM_XGATE"}, + {116, "EM_C166"}, + {117, "EM_M16C"}, + {118, "EM_DSPIC30F"}, + {119, "EM_CE"}, + {120, "EM_M32C"}, + {131, "EM_TSK3000"}, + {132, "EM_RS08"}, + {133, "EM_SHARC"}, + {134, "EM_ECOG2"}, + {135, "EM_SCORE7"}, + {136, "EM_DSP24"}, + {137, "EM_VIDEOCORE3"}, + {138, "EM_LATTICEMICO32"}, + {139, "EM_SE_C17"}, + {140, "EM_TI_C6000"}, + {141, "EM_TI_C2000"}, + {142, "EM_TI_C5500"}, + {143, "EM_TI_ARP32"}, + {144, "EM_TI_PRU"}, + {160, "EM_MMDSP_PLUS"}, + {161, "EM_CYPRESS_M8C"}, + {162, "EM_R32C"}, + {163, "EM_TRIMEDIA"}, + {164, "EM_QDSP6"}, + {165, "EM_8051"}, + {166, "EM_STXP7X"}, + {167, "EM_NDS32"}, + {168, "EM_ECOG1"}, + {168, "EM_ECOG1X"}, + {169, "EM_MAXQ30"}, + {170, "EM_XIMO16"}, + {171, "EM_MANIK"}, + {172, "EM_CRAYNV2"}, + {173, "EM_RX"}, + {174, "EM_METAG"}, + {175, "EM_MCST_ELBRUS"}, + {176, "EM_ECOG16"}, + {177, "EM_CR16"}, + {178, "EM_ETPU"}, + {179, "EM_SLE9X"}, + {180, "EM_L10M"}, + {181, "EM_K10M"}, + {183, "EM_AARCH64"}, + {185, "EM_AVR32"}, + {186, "EM_STM8"}, + {187, "EM_TILE64"}, + {188, "EM_TILEPRO"}, + {189, "EM_MICROBLAZE"}, + {190, "EM_CUDA"}, + {191, "EM_TILEGX"}, + {192, "EM_CLOUDSHIELD"}, + {193, "EM_COREA_1ST"}, + {194, "EM_COREA_2ND"}, + {195, "EM_ARC_COMPACT2"}, + {196, "EM_OPEN8"}, + {197, "EM_RL78"}, + {198, "EM_VIDEOCORE5"}, + {199, "EM_78KOR"}, + {200, "EM_56800EX"}, + {201, "EM_BA1"}, + {202, "EM_BA2"}, + {203, "EM_XCORE"}, + {204, "EM_MCHP_PIC"}, + {205, "EM_INTEL205"}, + {206, "EM_INTEL206"}, + {207, "EM_INTEL207"}, + {208, "EM_INTEL208"}, + {209, "EM_INTEL209"}, + {210, "EM_KM32"}, + {211, "EM_KMX32"}, + {212, "EM_KMX16"}, + {213, "EM_KMX8"}, + {214, "EM_KVARC"}, + {215, "EM_CDP"}, + {216, "EM_COGE"}, + {217, "EM_COOL"}, + {218, "EM_NORC"}, + {219, "EM_CSR_KALIMBA "}, + {220, "EM_Z80 "}, + {221, "EM_VISIUM "}, + {222, "EM_FT32 "}, + {223, "EM_MOXIE"}, + {224, "EM_AMDGPU"}, + {243, "EM_RISCV"}, + {244, "EM_LANAI"}, + {247, "EM_BPF"}, + {258, "EM_LOONGARCH"}, + + /* Non-standard or deprecated. */ + {6, "EM_486"}, + {10, "EM_MIPS_RS4_BE"}, + {41, "EM_ALPHA_STD"}, + {0x9026, "EM_ALPHA"}, +} + +func (i Machine) String() string { return stringName(uint32(i), machineStrings, false) } +func (i Machine) GoString() string { return stringName(uint32(i), machineStrings, true) } + +// Special section indices. +type SectionIndex int + +const ( + SHN_UNDEF SectionIndex = 0 /* Undefined, missing, irrelevant. */ + SHN_LORESERVE SectionIndex = 0xff00 /* First of reserved range. */ + SHN_LOPROC SectionIndex = 0xff00 /* First processor-specific. */ + SHN_HIPROC SectionIndex = 0xff1f /* Last processor-specific. */ + SHN_LOOS SectionIndex = 0xff20 /* First operating system-specific. */ + SHN_HIOS SectionIndex = 0xff3f /* Last operating system-specific. */ + SHN_ABS SectionIndex = 0xfff1 /* Absolute values. */ + SHN_COMMON SectionIndex = 0xfff2 /* Common data. */ + SHN_XINDEX SectionIndex = 0xffff /* Escape; index stored elsewhere. */ + SHN_HIRESERVE SectionIndex = 0xffff /* Last of reserved range. */ +) + +var shnStrings = []intName{ + {0, "SHN_UNDEF"}, + {0xff00, "SHN_LOPROC"}, + {0xff20, "SHN_LOOS"}, + {0xfff1, "SHN_ABS"}, + {0xfff2, "SHN_COMMON"}, + {0xffff, "SHN_XINDEX"}, +} + +func (i SectionIndex) String() string { return stringName(uint32(i), shnStrings, false) } +func (i SectionIndex) GoString() string { return stringName(uint32(i), shnStrings, true) } + +// Section type. +type SectionType uint32 + +const ( + SHT_NULL SectionType = 0 /* inactive */ + SHT_PROGBITS SectionType = 1 /* program defined information */ + SHT_SYMTAB SectionType = 2 /* symbol table section */ + SHT_STRTAB SectionType = 3 /* string table section */ + SHT_RELA SectionType = 4 /* relocation section with addends */ + SHT_HASH SectionType = 5 /* symbol hash table section */ + SHT_DYNAMIC SectionType = 6 /* dynamic section */ + SHT_NOTE SectionType = 7 /* note section */ + SHT_NOBITS SectionType = 8 /* no space section */ + SHT_REL SectionType = 9 /* relocation section - no addends */ + SHT_SHLIB SectionType = 10 /* reserved - purpose unknown */ + SHT_DYNSYM SectionType = 11 /* dynamic symbol table section */ + SHT_INIT_ARRAY SectionType = 14 /* Initialization function pointers. */ + SHT_FINI_ARRAY SectionType = 15 /* Termination function pointers. */ + SHT_PREINIT_ARRAY SectionType = 16 /* Pre-initialization function ptrs. */ + SHT_GROUP SectionType = 17 /* Section group. */ + SHT_SYMTAB_SHNDX SectionType = 18 /* Section indexes (see SHN_XINDEX). */ + SHT_LOOS SectionType = 0x60000000 /* First of OS specific semantics */ + SHT_GNU_ATTRIBUTES SectionType = 0x6ffffff5 /* GNU object attributes */ + SHT_GNU_HASH SectionType = 0x6ffffff6 /* GNU hash table */ + SHT_GNU_LIBLIST SectionType = 0x6ffffff7 /* GNU prelink library list */ + SHT_GNU_VERDEF SectionType = 0x6ffffffd /* GNU version definition section */ + SHT_GNU_VERNEED SectionType = 0x6ffffffe /* GNU version needs section */ + SHT_GNU_VERSYM SectionType = 0x6fffffff /* GNU version symbol table */ + SHT_HIOS SectionType = 0x6fffffff /* Last of OS specific semantics */ + SHT_LOPROC SectionType = 0x70000000 /* reserved range for processor */ + SHT_RISCV_ATTRIBUTES SectionType = 0x70000003 /* RISCV object attributes */ + SHT_MIPS_ABIFLAGS SectionType = 0x7000002a /* .MIPS.abiflags */ + SHT_HIPROC SectionType = 0x7fffffff /* specific section header types */ + SHT_LOUSER SectionType = 0x80000000 /* reserved range for application */ + SHT_HIUSER SectionType = 0xffffffff /* specific indexes */ +) + +var shtStrings = []intName{ + {0, "SHT_NULL"}, + {1, "SHT_PROGBITS"}, + {2, "SHT_SYMTAB"}, + {3, "SHT_STRTAB"}, + {4, "SHT_RELA"}, + {5, "SHT_HASH"}, + {6, "SHT_DYNAMIC"}, + {7, "SHT_NOTE"}, + {8, "SHT_NOBITS"}, + {9, "SHT_REL"}, + {10, "SHT_SHLIB"}, + {11, "SHT_DYNSYM"}, + {14, "SHT_INIT_ARRAY"}, + {15, "SHT_FINI_ARRAY"}, + {16, "SHT_PREINIT_ARRAY"}, + {17, "SHT_GROUP"}, + {18, "SHT_SYMTAB_SHNDX"}, + {0x60000000, "SHT_LOOS"}, + {0x6ffffff5, "SHT_GNU_ATTRIBUTES"}, + {0x6ffffff6, "SHT_GNU_HASH"}, + {0x6ffffff7, "SHT_GNU_LIBLIST"}, + {0x6ffffffd, "SHT_GNU_VERDEF"}, + {0x6ffffffe, "SHT_GNU_VERNEED"}, + {0x6fffffff, "SHT_GNU_VERSYM"}, + {0x70000000, "SHT_LOPROC"}, + // We don't list the processor-dependent SectionType, + // as the values overlap. + {0x7000002a, "SHT_MIPS_ABIFLAGS"}, + {0x7fffffff, "SHT_HIPROC"}, + {0x80000000, "SHT_LOUSER"}, + {0xffffffff, "SHT_HIUSER"}, +} + +func (i SectionType) String() string { return stringName(uint32(i), shtStrings, false) } +func (i SectionType) GoString() string { return stringName(uint32(i), shtStrings, true) } + +// Section flags. +type SectionFlag uint32 + +const ( + SHF_WRITE SectionFlag = 0x1 /* Section contains writable data. */ + SHF_ALLOC SectionFlag = 0x2 /* Section occupies memory. */ + SHF_EXECINSTR SectionFlag = 0x4 /* Section contains instructions. */ + SHF_MERGE SectionFlag = 0x10 /* Section may be merged. */ + SHF_STRINGS SectionFlag = 0x20 /* Section contains strings. */ + SHF_INFO_LINK SectionFlag = 0x40 /* sh_info holds section index. */ + SHF_LINK_ORDER SectionFlag = 0x80 /* Special ordering requirements. */ + SHF_OS_NONCONFORMING SectionFlag = 0x100 /* OS-specific processing required. */ + SHF_GROUP SectionFlag = 0x200 /* Member of section group. */ + SHF_TLS SectionFlag = 0x400 /* Section contains TLS data. */ + SHF_COMPRESSED SectionFlag = 0x800 /* Section is compressed. */ + SHF_MASKOS SectionFlag = 0x0ff00000 /* OS-specific semantics. */ + SHF_MASKPROC SectionFlag = 0xf0000000 /* Processor-specific semantics. */ +) + +var shfStrings = []intName{ + {0x1, "SHF_WRITE"}, + {0x2, "SHF_ALLOC"}, + {0x4, "SHF_EXECINSTR"}, + {0x10, "SHF_MERGE"}, + {0x20, "SHF_STRINGS"}, + {0x40, "SHF_INFO_LINK"}, + {0x80, "SHF_LINK_ORDER"}, + {0x100, "SHF_OS_NONCONFORMING"}, + {0x200, "SHF_GROUP"}, + {0x400, "SHF_TLS"}, + {0x800, "SHF_COMPRESSED"}, +} + +func (i SectionFlag) String() string { return flagName(uint32(i), shfStrings, false) } +func (i SectionFlag) GoString() string { return flagName(uint32(i), shfStrings, true) } + +// Section compression type. +type CompressionType int + +const ( + COMPRESS_ZLIB CompressionType = 1 /* ZLIB compression. */ + COMPRESS_ZSTD CompressionType = 2 /* ZSTD compression. */ + COMPRESS_LOOS CompressionType = 0x60000000 /* First OS-specific. */ + COMPRESS_HIOS CompressionType = 0x6fffffff /* Last OS-specific. */ + COMPRESS_LOPROC CompressionType = 0x70000000 /* First processor-specific type. */ + COMPRESS_HIPROC CompressionType = 0x7fffffff /* Last processor-specific type. */ +) + +var compressionStrings = []intName{ + {1, "COMPRESS_ZLIB"}, + {2, "COMPRESS_ZSTD"}, + {0x60000000, "COMPRESS_LOOS"}, + {0x6fffffff, "COMPRESS_HIOS"}, + {0x70000000, "COMPRESS_LOPROC"}, + {0x7fffffff, "COMPRESS_HIPROC"}, +} + +func (i CompressionType) String() string { return stringName(uint32(i), compressionStrings, false) } +func (i CompressionType) GoString() string { return stringName(uint32(i), compressionStrings, true) } + +// Prog.Type +type ProgType int + +const ( + PT_NULL ProgType = 0 /* Unused entry. */ + PT_LOAD ProgType = 1 /* Loadable segment. */ + PT_DYNAMIC ProgType = 2 /* Dynamic linking information segment. */ + PT_INTERP ProgType = 3 /* Pathname of interpreter. */ + PT_NOTE ProgType = 4 /* Auxiliary information. */ + PT_SHLIB ProgType = 5 /* Reserved (not used). */ + PT_PHDR ProgType = 6 /* Location of program header itself. */ + PT_TLS ProgType = 7 /* Thread local storage segment */ + + PT_LOOS ProgType = 0x60000000 /* First OS-specific. */ + + PT_GNU_EH_FRAME ProgType = 0x6474e550 /* Frame unwind information */ + PT_GNU_STACK ProgType = 0x6474e551 /* Stack flags */ + PT_GNU_RELRO ProgType = 0x6474e552 /* Read only after relocs */ + PT_GNU_PROPERTY ProgType = 0x6474e553 /* GNU property */ + PT_GNU_MBIND_LO ProgType = 0x6474e555 /* Mbind segments start */ + PT_GNU_MBIND_HI ProgType = 0x6474f554 /* Mbind segments finish */ + + PT_PAX_FLAGS ProgType = 0x65041580 /* PAX flags */ + + PT_OPENBSD_RANDOMIZE ProgType = 0x65a3dbe6 /* Random data */ + PT_OPENBSD_WXNEEDED ProgType = 0x65a3dbe7 /* W^X violations */ + PT_OPENBSD_NOBTCFI ProgType = 0x65a3dbe8 /* No branch target CFI */ + PT_OPENBSD_BOOTDATA ProgType = 0x65a41be6 /* Boot arguments */ + + PT_SUNW_EH_FRAME ProgType = 0x6474e550 /* Frame unwind information */ + PT_SUNWSTACK ProgType = 0x6ffffffb /* Stack segment */ + + PT_HIOS ProgType = 0x6fffffff /* Last OS-specific. */ + + PT_LOPROC ProgType = 0x70000000 /* First processor-specific type. */ + + PT_ARM_ARCHEXT ProgType = 0x70000000 /* Architecture compatibility */ + PT_ARM_EXIDX ProgType = 0x70000001 /* Exception unwind tables */ + + PT_AARCH64_ARCHEXT ProgType = 0x70000000 /* Architecture compatibility */ + PT_AARCH64_UNWIND ProgType = 0x70000001 /* Exception unwind tables */ + + PT_MIPS_REGINFO ProgType = 0x70000000 /* Register usage */ + PT_MIPS_RTPROC ProgType = 0x70000001 /* Runtime procedures */ + PT_MIPS_OPTIONS ProgType = 0x70000002 /* Options */ + PT_MIPS_ABIFLAGS ProgType = 0x70000003 /* ABI flags */ + + PT_RISCV_ATTRIBUTES ProgType = 0x70000003 /* RISC-V ELF attribute section. */ + + PT_S390_PGSTE ProgType = 0x70000000 /* 4k page table size */ + + PT_HIPROC ProgType = 0x7fffffff /* Last processor-specific type. */ +) + +var ptStrings = []intName{ + {0, "PT_NULL"}, + {1, "PT_LOAD"}, + {2, "PT_DYNAMIC"}, + {3, "PT_INTERP"}, + {4, "PT_NOTE"}, + {5, "PT_SHLIB"}, + {6, "PT_PHDR"}, + {7, "PT_TLS"}, + {0x60000000, "PT_LOOS"}, + {0x6474e550, "PT_GNU_EH_FRAME"}, + {0x6474e551, "PT_GNU_STACK"}, + {0x6474e552, "PT_GNU_RELRO"}, + {0x6474e553, "PT_GNU_PROPERTY"}, + {0x65041580, "PT_PAX_FLAGS"}, + {0x65a3dbe6, "PT_OPENBSD_RANDOMIZE"}, + {0x65a3dbe7, "PT_OPENBSD_WXNEEDED"}, + {0x65a41be6, "PT_OPENBSD_BOOTDATA"}, + {0x6ffffffb, "PT_SUNWSTACK"}, + {0x6fffffff, "PT_HIOS"}, + {0x70000000, "PT_LOPROC"}, + // We don't list the processor-dependent ProgTypes, + // as the values overlap. + {0x7fffffff, "PT_HIPROC"}, +} + +func (i ProgType) String() string { return stringName(uint32(i), ptStrings, false) } +func (i ProgType) GoString() string { return stringName(uint32(i), ptStrings, true) } + +// Prog.Flag +type ProgFlag uint32 + +const ( + PF_X ProgFlag = 0x1 /* Executable. */ + PF_W ProgFlag = 0x2 /* Writable. */ + PF_R ProgFlag = 0x4 /* Readable. */ + PF_MASKOS ProgFlag = 0x0ff00000 /* Operating system-specific. */ + PF_MASKPROC ProgFlag = 0xf0000000 /* Processor-specific. */ +) + +var pfStrings = []intName{ + {0x1, "PF_X"}, + {0x2, "PF_W"}, + {0x4, "PF_R"}, +} + +func (i ProgFlag) String() string { return flagName(uint32(i), pfStrings, false) } +func (i ProgFlag) GoString() string { return flagName(uint32(i), pfStrings, true) } + +// Dyn.Tag +type DynTag int + +const ( + DT_NULL DynTag = 0 /* Terminating entry. */ + DT_NEEDED DynTag = 1 /* String table offset of a needed shared library. */ + DT_PLTRELSZ DynTag = 2 /* Total size in bytes of PLT relocations. */ + DT_PLTGOT DynTag = 3 /* Processor-dependent address. */ + DT_HASH DynTag = 4 /* Address of symbol hash table. */ + DT_STRTAB DynTag = 5 /* Address of string table. */ + DT_SYMTAB DynTag = 6 /* Address of symbol table. */ + DT_RELA DynTag = 7 /* Address of ElfNN_Rela relocations. */ + DT_RELASZ DynTag = 8 /* Total size of ElfNN_Rela relocations. */ + DT_RELAENT DynTag = 9 /* Size of each ElfNN_Rela relocation entry. */ + DT_STRSZ DynTag = 10 /* Size of string table. */ + DT_SYMENT DynTag = 11 /* Size of each symbol table entry. */ + DT_INIT DynTag = 12 /* Address of initialization function. */ + DT_FINI DynTag = 13 /* Address of finalization function. */ + DT_SONAME DynTag = 14 /* String table offset of shared object name. */ + DT_RPATH DynTag = 15 /* String table offset of library path. [sup] */ + DT_SYMBOLIC DynTag = 16 /* Indicates "symbolic" linking. [sup] */ + DT_REL DynTag = 17 /* Address of ElfNN_Rel relocations. */ + DT_RELSZ DynTag = 18 /* Total size of ElfNN_Rel relocations. */ + DT_RELENT DynTag = 19 /* Size of each ElfNN_Rel relocation. */ + DT_PLTREL DynTag = 20 /* Type of relocation used for PLT. */ + DT_DEBUG DynTag = 21 /* Reserved (not used). */ + DT_TEXTREL DynTag = 22 /* Indicates there may be relocations in non-writable segments. [sup] */ + DT_JMPREL DynTag = 23 /* Address of PLT relocations. */ + DT_BIND_NOW DynTag = 24 /* [sup] */ + DT_INIT_ARRAY DynTag = 25 /* Address of the array of pointers to initialization functions */ + DT_FINI_ARRAY DynTag = 26 /* Address of the array of pointers to termination functions */ + DT_INIT_ARRAYSZ DynTag = 27 /* Size in bytes of the array of initialization functions. */ + DT_FINI_ARRAYSZ DynTag = 28 /* Size in bytes of the array of termination functions. */ + DT_RUNPATH DynTag = 29 /* String table offset of a null-terminated library search path string. */ + DT_FLAGS DynTag = 30 /* Object specific flag values. */ + DT_ENCODING DynTag = 32 /* Values greater than or equal to DT_ENCODING + and less than DT_LOOS follow the rules for + the interpretation of the d_un union + as follows: even == 'd_ptr', even == 'd_val' + or none */ + DT_PREINIT_ARRAY DynTag = 32 /* Address of the array of pointers to pre-initialization functions. */ + DT_PREINIT_ARRAYSZ DynTag = 33 /* Size in bytes of the array of pre-initialization functions. */ + DT_SYMTAB_SHNDX DynTag = 34 /* Address of SHT_SYMTAB_SHNDX section. */ + + DT_LOOS DynTag = 0x6000000d /* First OS-specific */ + DT_HIOS DynTag = 0x6ffff000 /* Last OS-specific */ + + DT_VALRNGLO DynTag = 0x6ffffd00 + DT_GNU_PRELINKED DynTag = 0x6ffffdf5 + DT_GNU_CONFLICTSZ DynTag = 0x6ffffdf6 + DT_GNU_LIBLISTSZ DynTag = 0x6ffffdf7 + DT_CHECKSUM DynTag = 0x6ffffdf8 + DT_PLTPADSZ DynTag = 0x6ffffdf9 + DT_MOVEENT DynTag = 0x6ffffdfa + DT_MOVESZ DynTag = 0x6ffffdfb + DT_FEATURE DynTag = 0x6ffffdfc + DT_POSFLAG_1 DynTag = 0x6ffffdfd + DT_SYMINSZ DynTag = 0x6ffffdfe + DT_SYMINENT DynTag = 0x6ffffdff + DT_VALRNGHI DynTag = 0x6ffffdff + + DT_ADDRRNGLO DynTag = 0x6ffffe00 + DT_GNU_HASH DynTag = 0x6ffffef5 + DT_TLSDESC_PLT DynTag = 0x6ffffef6 + DT_TLSDESC_GOT DynTag = 0x6ffffef7 + DT_GNU_CONFLICT DynTag = 0x6ffffef8 + DT_GNU_LIBLIST DynTag = 0x6ffffef9 + DT_CONFIG DynTag = 0x6ffffefa + DT_DEPAUDIT DynTag = 0x6ffffefb + DT_AUDIT DynTag = 0x6ffffefc + DT_PLTPAD DynTag = 0x6ffffefd + DT_MOVETAB DynTag = 0x6ffffefe + DT_SYMINFO DynTag = 0x6ffffeff + DT_ADDRRNGHI DynTag = 0x6ffffeff + + DT_VERSYM DynTag = 0x6ffffff0 + DT_RELACOUNT DynTag = 0x6ffffff9 + DT_RELCOUNT DynTag = 0x6ffffffa + DT_FLAGS_1 DynTag = 0x6ffffffb + DT_VERDEF DynTag = 0x6ffffffc + DT_VERDEFNUM DynTag = 0x6ffffffd + DT_VERNEED DynTag = 0x6ffffffe + DT_VERNEEDNUM DynTag = 0x6fffffff + + DT_LOPROC DynTag = 0x70000000 /* First processor-specific type. */ + + DT_MIPS_RLD_VERSION DynTag = 0x70000001 + DT_MIPS_TIME_STAMP DynTag = 0x70000002 + DT_MIPS_ICHECKSUM DynTag = 0x70000003 + DT_MIPS_IVERSION DynTag = 0x70000004 + DT_MIPS_FLAGS DynTag = 0x70000005 + DT_MIPS_BASE_ADDRESS DynTag = 0x70000006 + DT_MIPS_MSYM DynTag = 0x70000007 + DT_MIPS_CONFLICT DynTag = 0x70000008 + DT_MIPS_LIBLIST DynTag = 0x70000009 + DT_MIPS_LOCAL_GOTNO DynTag = 0x7000000a + DT_MIPS_CONFLICTNO DynTag = 0x7000000b + DT_MIPS_LIBLISTNO DynTag = 0x70000010 + DT_MIPS_SYMTABNO DynTag = 0x70000011 + DT_MIPS_UNREFEXTNO DynTag = 0x70000012 + DT_MIPS_GOTSYM DynTag = 0x70000013 + DT_MIPS_HIPAGENO DynTag = 0x70000014 + DT_MIPS_RLD_MAP DynTag = 0x70000016 + DT_MIPS_DELTA_CLASS DynTag = 0x70000017 + DT_MIPS_DELTA_CLASS_NO DynTag = 0x70000018 + DT_MIPS_DELTA_INSTANCE DynTag = 0x70000019 + DT_MIPS_DELTA_INSTANCE_NO DynTag = 0x7000001a + DT_MIPS_DELTA_RELOC DynTag = 0x7000001b + DT_MIPS_DELTA_RELOC_NO DynTag = 0x7000001c + DT_MIPS_DELTA_SYM DynTag = 0x7000001d + DT_MIPS_DELTA_SYM_NO DynTag = 0x7000001e + DT_MIPS_DELTA_CLASSSYM DynTag = 0x70000020 + DT_MIPS_DELTA_CLASSSYM_NO DynTag = 0x70000021 + DT_MIPS_CXX_FLAGS DynTag = 0x70000022 + DT_MIPS_PIXIE_INIT DynTag = 0x70000023 + DT_MIPS_SYMBOL_LIB DynTag = 0x70000024 + DT_MIPS_LOCALPAGE_GOTIDX DynTag = 0x70000025 + DT_MIPS_LOCAL_GOTIDX DynTag = 0x70000026 + DT_MIPS_HIDDEN_GOTIDX DynTag = 0x70000027 + DT_MIPS_PROTECTED_GOTIDX DynTag = 0x70000028 + DT_MIPS_OPTIONS DynTag = 0x70000029 + DT_MIPS_INTERFACE DynTag = 0x7000002a + DT_MIPS_DYNSTR_ALIGN DynTag = 0x7000002b + DT_MIPS_INTERFACE_SIZE DynTag = 0x7000002c + DT_MIPS_RLD_TEXT_RESOLVE_ADDR DynTag = 0x7000002d + DT_MIPS_PERF_SUFFIX DynTag = 0x7000002e + DT_MIPS_COMPACT_SIZE DynTag = 0x7000002f + DT_MIPS_GP_VALUE DynTag = 0x70000030 + DT_MIPS_AUX_DYNAMIC DynTag = 0x70000031 + DT_MIPS_PLTGOT DynTag = 0x70000032 + DT_MIPS_RWPLT DynTag = 0x70000034 + DT_MIPS_RLD_MAP_REL DynTag = 0x70000035 + + DT_PPC_GOT DynTag = 0x70000000 + DT_PPC_OPT DynTag = 0x70000001 + + DT_PPC64_GLINK DynTag = 0x70000000 + DT_PPC64_OPD DynTag = 0x70000001 + DT_PPC64_OPDSZ DynTag = 0x70000002 + DT_PPC64_OPT DynTag = 0x70000003 + + DT_SPARC_REGISTER DynTag = 0x70000001 + + DT_AUXILIARY DynTag = 0x7ffffffd + DT_USED DynTag = 0x7ffffffe + DT_FILTER DynTag = 0x7fffffff + + DT_HIPROC DynTag = 0x7fffffff /* Last processor-specific type. */ +) + +var dtStrings = []intName{ + {0, "DT_NULL"}, + {1, "DT_NEEDED"}, + {2, "DT_PLTRELSZ"}, + {3, "DT_PLTGOT"}, + {4, "DT_HASH"}, + {5, "DT_STRTAB"}, + {6, "DT_SYMTAB"}, + {7, "DT_RELA"}, + {8, "DT_RELASZ"}, + {9, "DT_RELAENT"}, + {10, "DT_STRSZ"}, + {11, "DT_SYMENT"}, + {12, "DT_INIT"}, + {13, "DT_FINI"}, + {14, "DT_SONAME"}, + {15, "DT_RPATH"}, + {16, "DT_SYMBOLIC"}, + {17, "DT_REL"}, + {18, "DT_RELSZ"}, + {19, "DT_RELENT"}, + {20, "DT_PLTREL"}, + {21, "DT_DEBUG"}, + {22, "DT_TEXTREL"}, + {23, "DT_JMPREL"}, + {24, "DT_BIND_NOW"}, + {25, "DT_INIT_ARRAY"}, + {26, "DT_FINI_ARRAY"}, + {27, "DT_INIT_ARRAYSZ"}, + {28, "DT_FINI_ARRAYSZ"}, + {29, "DT_RUNPATH"}, + {30, "DT_FLAGS"}, + {32, "DT_ENCODING"}, + {32, "DT_PREINIT_ARRAY"}, + {33, "DT_PREINIT_ARRAYSZ"}, + {34, "DT_SYMTAB_SHNDX"}, + {0x6000000d, "DT_LOOS"}, + {0x6ffff000, "DT_HIOS"}, + {0x6ffffd00, "DT_VALRNGLO"}, + {0x6ffffdf5, "DT_GNU_PRELINKED"}, + {0x6ffffdf6, "DT_GNU_CONFLICTSZ"}, + {0x6ffffdf7, "DT_GNU_LIBLISTSZ"}, + {0x6ffffdf8, "DT_CHECKSUM"}, + {0x6ffffdf9, "DT_PLTPADSZ"}, + {0x6ffffdfa, "DT_MOVEENT"}, + {0x6ffffdfb, "DT_MOVESZ"}, + {0x6ffffdfc, "DT_FEATURE"}, + {0x6ffffdfd, "DT_POSFLAG_1"}, + {0x6ffffdfe, "DT_SYMINSZ"}, + {0x6ffffdff, "DT_SYMINENT"}, + {0x6ffffdff, "DT_VALRNGHI"}, + {0x6ffffe00, "DT_ADDRRNGLO"}, + {0x6ffffef5, "DT_GNU_HASH"}, + {0x6ffffef6, "DT_TLSDESC_PLT"}, + {0x6ffffef7, "DT_TLSDESC_GOT"}, + {0x6ffffef8, "DT_GNU_CONFLICT"}, + {0x6ffffef9, "DT_GNU_LIBLIST"}, + {0x6ffffefa, "DT_CONFIG"}, + {0x6ffffefb, "DT_DEPAUDIT"}, + {0x6ffffefc, "DT_AUDIT"}, + {0x6ffffefd, "DT_PLTPAD"}, + {0x6ffffefe, "DT_MOVETAB"}, + {0x6ffffeff, "DT_SYMINFO"}, + {0x6ffffeff, "DT_ADDRRNGHI"}, + {0x6ffffff0, "DT_VERSYM"}, + {0x6ffffff9, "DT_RELACOUNT"}, + {0x6ffffffa, "DT_RELCOUNT"}, + {0x6ffffffb, "DT_FLAGS_1"}, + {0x6ffffffc, "DT_VERDEF"}, + {0x6ffffffd, "DT_VERDEFNUM"}, + {0x6ffffffe, "DT_VERNEED"}, + {0x6fffffff, "DT_VERNEEDNUM"}, + {0x70000000, "DT_LOPROC"}, + // We don't list the processor-dependent DynTags, + // as the values overlap. + {0x7ffffffd, "DT_AUXILIARY"}, + {0x7ffffffe, "DT_USED"}, + {0x7fffffff, "DT_FILTER"}, +} + +func (i DynTag) String() string { return stringName(uint32(i), dtStrings, false) } +func (i DynTag) GoString() string { return stringName(uint32(i), dtStrings, true) } + +// DT_FLAGS values. +type DynFlag int + +const ( + DF_ORIGIN DynFlag = 0x0001 /* Indicates that the object being loaded may + make reference to the + $ORIGIN substitution string */ + DF_SYMBOLIC DynFlag = 0x0002 /* Indicates "symbolic" linking. */ + DF_TEXTREL DynFlag = 0x0004 /* Indicates there may be relocations in non-writable segments. */ + DF_BIND_NOW DynFlag = 0x0008 /* Indicates that the dynamic linker should + process all relocations for the object + containing this entry before transferring + control to the program. */ + DF_STATIC_TLS DynFlag = 0x0010 /* Indicates that the shared object or + executable contains code using a static + thread-local storage scheme. */ +) + +var dflagStrings = []intName{ + {0x0001, "DF_ORIGIN"}, + {0x0002, "DF_SYMBOLIC"}, + {0x0004, "DF_TEXTREL"}, + {0x0008, "DF_BIND_NOW"}, + {0x0010, "DF_STATIC_TLS"}, +} + +func (i DynFlag) String() string { return flagName(uint32(i), dflagStrings, false) } +func (i DynFlag) GoString() string { return flagName(uint32(i), dflagStrings, true) } + +// DT_FLAGS_1 values. +type DynFlag1 uint32 + +const ( + // Indicates that all relocations for this object must be processed before + // returning control to the program. + DF_1_NOW DynFlag1 = 0x00000001 + // Unused. + DF_1_GLOBAL DynFlag1 = 0x00000002 + // Indicates that the object is a member of a group. + DF_1_GROUP DynFlag1 = 0x00000004 + // Indicates that the object cannot be deleted from a process. + DF_1_NODELETE DynFlag1 = 0x00000008 + // Meaningful only for filters. Indicates that all associated filtees be + // processed immediately. + DF_1_LOADFLTR DynFlag1 = 0x00000010 + // Indicates that this object's initialization section be run before any other + // objects loaded. + DF_1_INITFIRST DynFlag1 = 0x00000020 + // Indicates that the object cannot be added to a running process with dlopen. + DF_1_NOOPEN DynFlag1 = 0x00000040 + // Indicates the object requires $ORIGIN processing. + DF_1_ORIGIN DynFlag1 = 0x00000080 + // Indicates that the object should use direct binding information. + DF_1_DIRECT DynFlag1 = 0x00000100 + // Unused. + DF_1_TRANS DynFlag1 = 0x00000200 + // Indicates that the objects symbol table is to interpose before all symbols + // except the primary load object, which is typically the executable. + DF_1_INTERPOSE DynFlag1 = 0x00000400 + // Indicates that the search for dependencies of this object ignores any + // default library search paths. + DF_1_NODEFLIB DynFlag1 = 0x00000800 + // Indicates that this object is not dumped by dldump. Candidates are objects + // with no relocations that might get included when generating alternative + // objects using. + DF_1_NODUMP DynFlag1 = 0x00001000 + // Identifies this object as a configuration alternative object generated by + // crle. Triggers the runtime linker to search for a configuration file $ORIGIN/ld.config.app-name. + DF_1_CONFALT DynFlag1 = 0x00002000 + // Meaningful only for filtees. Terminates a filters search for any + // further filtees. + DF_1_ENDFILTEE DynFlag1 = 0x00004000 + // Indicates that this object has displacement relocations applied. + DF_1_DISPRELDNE DynFlag1 = 0x00008000 + // Indicates that this object has displacement relocations pending. + DF_1_DISPRELPND DynFlag1 = 0x00010000 + // Indicates that this object contains symbols that cannot be directly + // bound to. + DF_1_NODIRECT DynFlag1 = 0x00020000 + // Reserved for internal use by the kernel runtime-linker. + DF_1_IGNMULDEF DynFlag1 = 0x00040000 + // Reserved for internal use by the kernel runtime-linker. + DF_1_NOKSYMS DynFlag1 = 0x00080000 + // Reserved for internal use by the kernel runtime-linker. + DF_1_NOHDR DynFlag1 = 0x00100000 + // Indicates that this object has been edited or has been modified since the + // objects original construction by the link-editor. + DF_1_EDITED DynFlag1 = 0x00200000 + // Reserved for internal use by the kernel runtime-linker. + DF_1_NORELOC DynFlag1 = 0x00400000 + // Indicates that the object contains individual symbols that should interpose + // before all symbols except the primary load object, which is typically the + // executable. + DF_1_SYMINTPOSE DynFlag1 = 0x00800000 + // Indicates that the executable requires global auditing. + DF_1_GLOBAUDIT DynFlag1 = 0x01000000 + // Indicates that the object defines, or makes reference to singleton symbols. + DF_1_SINGLETON DynFlag1 = 0x02000000 + // Indicates that the object is a stub. + DF_1_STUB DynFlag1 = 0x04000000 + // Indicates that the object is a position-independent executable. + DF_1_PIE DynFlag1 = 0x08000000 + // Indicates that the object is a kernel module. + DF_1_KMOD DynFlag1 = 0x10000000 + // Indicates that the object is a weak standard filter. + DF_1_WEAKFILTER DynFlag1 = 0x20000000 + // Unused. + DF_1_NOCOMMON DynFlag1 = 0x40000000 +) + +var dflag1Strings = []intName{ + {0x00000001, "DF_1_NOW"}, + {0x00000002, "DF_1_GLOBAL"}, + {0x00000004, "DF_1_GROUP"}, + {0x00000008, "DF_1_NODELETE"}, + {0x00000010, "DF_1_LOADFLTR"}, + {0x00000020, "DF_1_INITFIRST"}, + {0x00000040, "DF_1_NOOPEN"}, + {0x00000080, "DF_1_ORIGIN"}, + {0x00000100, "DF_1_DIRECT"}, + {0x00000200, "DF_1_TRANS"}, + {0x00000400, "DF_1_INTERPOSE"}, + {0x00000800, "DF_1_NODEFLIB"}, + {0x00001000, "DF_1_NODUMP"}, + {0x00002000, "DF_1_CONFALT"}, + {0x00004000, "DF_1_ENDFILTEE"}, + {0x00008000, "DF_1_DISPRELDNE"}, + {0x00010000, "DF_1_DISPRELPND"}, + {0x00020000, "DF_1_NODIRECT"}, + {0x00040000, "DF_1_IGNMULDEF"}, + {0x00080000, "DF_1_NOKSYMS"}, + {0x00100000, "DF_1_NOHDR"}, + {0x00200000, "DF_1_EDITED"}, + {0x00400000, "DF_1_NORELOC"}, + {0x00800000, "DF_1_SYMINTPOSE"}, + {0x01000000, "DF_1_GLOBAUDIT"}, + {0x02000000, "DF_1_SINGLETON"}, + {0x04000000, "DF_1_STUB"}, + {0x08000000, "DF_1_PIE"}, + {0x10000000, "DF_1_KMOD"}, + {0x20000000, "DF_1_WEAKFILTER"}, + {0x40000000, "DF_1_NOCOMMON"}, +} + +func (i DynFlag1) String() string { return flagName(uint32(i), dflag1Strings, false) } +func (i DynFlag1) GoString() string { return flagName(uint32(i), dflag1Strings, true) } + +// NType values; used in core files. +type NType int + +const ( + NT_PRSTATUS NType = 1 /* Process status. */ + NT_FPREGSET NType = 2 /* Floating point registers. */ + NT_PRPSINFO NType = 3 /* Process state info. */ +) + +var ntypeStrings = []intName{ + {1, "NT_PRSTATUS"}, + {2, "NT_FPREGSET"}, + {3, "NT_PRPSINFO"}, +} + +func (i NType) String() string { return stringName(uint32(i), ntypeStrings, false) } +func (i NType) GoString() string { return stringName(uint32(i), ntypeStrings, true) } + +/* Symbol Binding - ELFNN_ST_BIND - st_info */ +type SymBind int + +const ( + STB_LOCAL SymBind = 0 /* Local symbol */ + STB_GLOBAL SymBind = 1 /* Global symbol */ + STB_WEAK SymBind = 2 /* like global - lower precedence */ + STB_LOOS SymBind = 10 /* Reserved range for operating system */ + STB_HIOS SymBind = 12 /* specific semantics. */ + STB_LOPROC SymBind = 13 /* reserved range for processor */ + STB_HIPROC SymBind = 15 /* specific semantics. */ +) + +var stbStrings = []intName{ + {0, "STB_LOCAL"}, + {1, "STB_GLOBAL"}, + {2, "STB_WEAK"}, + {10, "STB_LOOS"}, + {12, "STB_HIOS"}, + {13, "STB_LOPROC"}, + {15, "STB_HIPROC"}, +} + +func (i SymBind) String() string { return stringName(uint32(i), stbStrings, false) } +func (i SymBind) GoString() string { return stringName(uint32(i), stbStrings, true) } + +/* Symbol type - ELFNN_ST_TYPE - st_info */ +type SymType int + +const ( + STT_NOTYPE SymType = 0 /* Unspecified type. */ + STT_OBJECT SymType = 1 /* Data object. */ + STT_FUNC SymType = 2 /* Function. */ + STT_SECTION SymType = 3 /* Section. */ + STT_FILE SymType = 4 /* Source file. */ + STT_COMMON SymType = 5 /* Uninitialized common block. */ + STT_TLS SymType = 6 /* TLS object. */ + STT_LOOS SymType = 10 /* Reserved range for operating system */ + STT_HIOS SymType = 12 /* specific semantics. */ + STT_LOPROC SymType = 13 /* reserved range for processor */ + STT_HIPROC SymType = 15 /* specific semantics. */ + + /* Non-standard symbol types. */ + STT_RELC SymType = 8 /* Complex relocation expression. */ + STT_SRELC SymType = 9 /* Signed complex relocation expression. */ + STT_GNU_IFUNC SymType = 10 /* Indirect code object. */ +) + +var sttStrings = []intName{ + {0, "STT_NOTYPE"}, + {1, "STT_OBJECT"}, + {2, "STT_FUNC"}, + {3, "STT_SECTION"}, + {4, "STT_FILE"}, + {5, "STT_COMMON"}, + {6, "STT_TLS"}, + {8, "STT_RELC"}, + {9, "STT_SRELC"}, + {10, "STT_LOOS"}, + {12, "STT_HIOS"}, + {13, "STT_LOPROC"}, + {15, "STT_HIPROC"}, +} + +func (i SymType) String() string { return stringName(uint32(i), sttStrings, false) } +func (i SymType) GoString() string { return stringName(uint32(i), sttStrings, true) } + +/* Symbol visibility - ELFNN_ST_VISIBILITY - st_other */ +type SymVis int + +const ( + STV_DEFAULT SymVis = 0x0 /* Default visibility (see binding). */ + STV_INTERNAL SymVis = 0x1 /* Special meaning in relocatable objects. */ + STV_HIDDEN SymVis = 0x2 /* Not visible. */ + STV_PROTECTED SymVis = 0x3 /* Visible but not preemptible. */ +) + +var stvStrings = []intName{ + {0x0, "STV_DEFAULT"}, + {0x1, "STV_INTERNAL"}, + {0x2, "STV_HIDDEN"}, + {0x3, "STV_PROTECTED"}, +} + +func (i SymVis) String() string { return stringName(uint32(i), stvStrings, false) } +func (i SymVis) GoString() string { return stringName(uint32(i), stvStrings, true) } + +/* + * Relocation types. + */ + +// Relocation types for x86-64. +type R_X86_64 int + +const ( + R_X86_64_NONE R_X86_64 = 0 /* No relocation. */ + R_X86_64_64 R_X86_64 = 1 /* Add 64 bit symbol value. */ + R_X86_64_PC32 R_X86_64 = 2 /* PC-relative 32 bit signed sym value. */ + R_X86_64_GOT32 R_X86_64 = 3 /* PC-relative 32 bit GOT offset. */ + R_X86_64_PLT32 R_X86_64 = 4 /* PC-relative 32 bit PLT offset. */ + R_X86_64_COPY R_X86_64 = 5 /* Copy data from shared object. */ + R_X86_64_GLOB_DAT R_X86_64 = 6 /* Set GOT entry to data address. */ + R_X86_64_JMP_SLOT R_X86_64 = 7 /* Set GOT entry to code address. */ + R_X86_64_RELATIVE R_X86_64 = 8 /* Add load address of shared object. */ + R_X86_64_GOTPCREL R_X86_64 = 9 /* Add 32 bit signed pcrel offset to GOT. */ + R_X86_64_32 R_X86_64 = 10 /* Add 32 bit zero extended symbol value */ + R_X86_64_32S R_X86_64 = 11 /* Add 32 bit sign extended symbol value */ + R_X86_64_16 R_X86_64 = 12 /* Add 16 bit zero extended symbol value */ + R_X86_64_PC16 R_X86_64 = 13 /* Add 16 bit signed extended pc relative symbol value */ + R_X86_64_8 R_X86_64 = 14 /* Add 8 bit zero extended symbol value */ + R_X86_64_PC8 R_X86_64 = 15 /* Add 8 bit signed extended pc relative symbol value */ + R_X86_64_DTPMOD64 R_X86_64 = 16 /* ID of module containing symbol */ + R_X86_64_DTPOFF64 R_X86_64 = 17 /* Offset in TLS block */ + R_X86_64_TPOFF64 R_X86_64 = 18 /* Offset in static TLS block */ + R_X86_64_TLSGD R_X86_64 = 19 /* PC relative offset to GD GOT entry */ + R_X86_64_TLSLD R_X86_64 = 20 /* PC relative offset to LD GOT entry */ + R_X86_64_DTPOFF32 R_X86_64 = 21 /* Offset in TLS block */ + R_X86_64_GOTTPOFF R_X86_64 = 22 /* PC relative offset to IE GOT entry */ + R_X86_64_TPOFF32 R_X86_64 = 23 /* Offset in static TLS block */ + R_X86_64_PC64 R_X86_64 = 24 /* PC relative 64-bit sign extended symbol value. */ + R_X86_64_GOTOFF64 R_X86_64 = 25 + R_X86_64_GOTPC32 R_X86_64 = 26 + R_X86_64_GOT64 R_X86_64 = 27 + R_X86_64_GOTPCREL64 R_X86_64 = 28 + R_X86_64_GOTPC64 R_X86_64 = 29 + R_X86_64_GOTPLT64 R_X86_64 = 30 + R_X86_64_PLTOFF64 R_X86_64 = 31 + R_X86_64_SIZE32 R_X86_64 = 32 + R_X86_64_SIZE64 R_X86_64 = 33 + R_X86_64_GOTPC32_TLSDESC R_X86_64 = 34 + R_X86_64_TLSDESC_CALL R_X86_64 = 35 + R_X86_64_TLSDESC R_X86_64 = 36 + R_X86_64_IRELATIVE R_X86_64 = 37 + R_X86_64_RELATIVE64 R_X86_64 = 38 + R_X86_64_PC32_BND R_X86_64 = 39 + R_X86_64_PLT32_BND R_X86_64 = 40 + R_X86_64_GOTPCRELX R_X86_64 = 41 + R_X86_64_REX_GOTPCRELX R_X86_64 = 42 +) + +var rx86_64Strings = []intName{ + {0, "R_X86_64_NONE"}, + {1, "R_X86_64_64"}, + {2, "R_X86_64_PC32"}, + {3, "R_X86_64_GOT32"}, + {4, "R_X86_64_PLT32"}, + {5, "R_X86_64_COPY"}, + {6, "R_X86_64_GLOB_DAT"}, + {7, "R_X86_64_JMP_SLOT"}, + {8, "R_X86_64_RELATIVE"}, + {9, "R_X86_64_GOTPCREL"}, + {10, "R_X86_64_32"}, + {11, "R_X86_64_32S"}, + {12, "R_X86_64_16"}, + {13, "R_X86_64_PC16"}, + {14, "R_X86_64_8"}, + {15, "R_X86_64_PC8"}, + {16, "R_X86_64_DTPMOD64"}, + {17, "R_X86_64_DTPOFF64"}, + {18, "R_X86_64_TPOFF64"}, + {19, "R_X86_64_TLSGD"}, + {20, "R_X86_64_TLSLD"}, + {21, "R_X86_64_DTPOFF32"}, + {22, "R_X86_64_GOTTPOFF"}, + {23, "R_X86_64_TPOFF32"}, + {24, "R_X86_64_PC64"}, + {25, "R_X86_64_GOTOFF64"}, + {26, "R_X86_64_GOTPC32"}, + {27, "R_X86_64_GOT64"}, + {28, "R_X86_64_GOTPCREL64"}, + {29, "R_X86_64_GOTPC64"}, + {30, "R_X86_64_GOTPLT64"}, + {31, "R_X86_64_PLTOFF64"}, + {32, "R_X86_64_SIZE32"}, + {33, "R_X86_64_SIZE64"}, + {34, "R_X86_64_GOTPC32_TLSDESC"}, + {35, "R_X86_64_TLSDESC_CALL"}, + {36, "R_X86_64_TLSDESC"}, + {37, "R_X86_64_IRELATIVE"}, + {38, "R_X86_64_RELATIVE64"}, + {39, "R_X86_64_PC32_BND"}, + {40, "R_X86_64_PLT32_BND"}, + {41, "R_X86_64_GOTPCRELX"}, + {42, "R_X86_64_REX_GOTPCRELX"}, +} + +func (i R_X86_64) String() string { return stringName(uint32(i), rx86_64Strings, false) } +func (i R_X86_64) GoString() string { return stringName(uint32(i), rx86_64Strings, true) } + +// Relocation types for AArch64 (aka arm64) +type R_AARCH64 int + +const ( + R_AARCH64_NONE R_AARCH64 = 0 + R_AARCH64_P32_ABS32 R_AARCH64 = 1 + R_AARCH64_P32_ABS16 R_AARCH64 = 2 + R_AARCH64_P32_PREL32 R_AARCH64 = 3 + R_AARCH64_P32_PREL16 R_AARCH64 = 4 + R_AARCH64_P32_MOVW_UABS_G0 R_AARCH64 = 5 + R_AARCH64_P32_MOVW_UABS_G0_NC R_AARCH64 = 6 + R_AARCH64_P32_MOVW_UABS_G1 R_AARCH64 = 7 + R_AARCH64_P32_MOVW_SABS_G0 R_AARCH64 = 8 + R_AARCH64_P32_LD_PREL_LO19 R_AARCH64 = 9 + R_AARCH64_P32_ADR_PREL_LO21 R_AARCH64 = 10 + R_AARCH64_P32_ADR_PREL_PG_HI21 R_AARCH64 = 11 + R_AARCH64_P32_ADD_ABS_LO12_NC R_AARCH64 = 12 + R_AARCH64_P32_LDST8_ABS_LO12_NC R_AARCH64 = 13 + R_AARCH64_P32_LDST16_ABS_LO12_NC R_AARCH64 = 14 + R_AARCH64_P32_LDST32_ABS_LO12_NC R_AARCH64 = 15 + R_AARCH64_P32_LDST64_ABS_LO12_NC R_AARCH64 = 16 + R_AARCH64_P32_LDST128_ABS_LO12_NC R_AARCH64 = 17 + R_AARCH64_P32_TSTBR14 R_AARCH64 = 18 + R_AARCH64_P32_CONDBR19 R_AARCH64 = 19 + R_AARCH64_P32_JUMP26 R_AARCH64 = 20 + R_AARCH64_P32_CALL26 R_AARCH64 = 21 + R_AARCH64_P32_GOT_LD_PREL19 R_AARCH64 = 25 + R_AARCH64_P32_ADR_GOT_PAGE R_AARCH64 = 26 + R_AARCH64_P32_LD32_GOT_LO12_NC R_AARCH64 = 27 + R_AARCH64_P32_TLSGD_ADR_PAGE21 R_AARCH64 = 81 + R_AARCH64_P32_TLSGD_ADD_LO12_NC R_AARCH64 = 82 + R_AARCH64_P32_TLSIE_ADR_GOTTPREL_PAGE21 R_AARCH64 = 103 + R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC R_AARCH64 = 104 + R_AARCH64_P32_TLSIE_LD_GOTTPREL_PREL19 R_AARCH64 = 105 + R_AARCH64_P32_TLSLE_MOVW_TPREL_G1 R_AARCH64 = 106 + R_AARCH64_P32_TLSLE_MOVW_TPREL_G0 R_AARCH64 = 107 + R_AARCH64_P32_TLSLE_MOVW_TPREL_G0_NC R_AARCH64 = 108 + R_AARCH64_P32_TLSLE_ADD_TPREL_HI12 R_AARCH64 = 109 + R_AARCH64_P32_TLSLE_ADD_TPREL_LO12 R_AARCH64 = 110 + R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC R_AARCH64 = 111 + R_AARCH64_P32_TLSDESC_LD_PREL19 R_AARCH64 = 122 + R_AARCH64_P32_TLSDESC_ADR_PREL21 R_AARCH64 = 123 + R_AARCH64_P32_TLSDESC_ADR_PAGE21 R_AARCH64 = 124 + R_AARCH64_P32_TLSDESC_LD32_LO12_NC R_AARCH64 = 125 + R_AARCH64_P32_TLSDESC_ADD_LO12_NC R_AARCH64 = 126 + R_AARCH64_P32_TLSDESC_CALL R_AARCH64 = 127 + R_AARCH64_P32_COPY R_AARCH64 = 180 + R_AARCH64_P32_GLOB_DAT R_AARCH64 = 181 + R_AARCH64_P32_JUMP_SLOT R_AARCH64 = 182 + R_AARCH64_P32_RELATIVE R_AARCH64 = 183 + R_AARCH64_P32_TLS_DTPMOD R_AARCH64 = 184 + R_AARCH64_P32_TLS_DTPREL R_AARCH64 = 185 + R_AARCH64_P32_TLS_TPREL R_AARCH64 = 186 + R_AARCH64_P32_TLSDESC R_AARCH64 = 187 + R_AARCH64_P32_IRELATIVE R_AARCH64 = 188 + R_AARCH64_NULL R_AARCH64 = 256 + R_AARCH64_ABS64 R_AARCH64 = 257 + R_AARCH64_ABS32 R_AARCH64 = 258 + R_AARCH64_ABS16 R_AARCH64 = 259 + R_AARCH64_PREL64 R_AARCH64 = 260 + R_AARCH64_PREL32 R_AARCH64 = 261 + R_AARCH64_PREL16 R_AARCH64 = 262 + R_AARCH64_MOVW_UABS_G0 R_AARCH64 = 263 + R_AARCH64_MOVW_UABS_G0_NC R_AARCH64 = 264 + R_AARCH64_MOVW_UABS_G1 R_AARCH64 = 265 + R_AARCH64_MOVW_UABS_G1_NC R_AARCH64 = 266 + R_AARCH64_MOVW_UABS_G2 R_AARCH64 = 267 + R_AARCH64_MOVW_UABS_G2_NC R_AARCH64 = 268 + R_AARCH64_MOVW_UABS_G3 R_AARCH64 = 269 + R_AARCH64_MOVW_SABS_G0 R_AARCH64 = 270 + R_AARCH64_MOVW_SABS_G1 R_AARCH64 = 271 + R_AARCH64_MOVW_SABS_G2 R_AARCH64 = 272 + R_AARCH64_LD_PREL_LO19 R_AARCH64 = 273 + R_AARCH64_ADR_PREL_LO21 R_AARCH64 = 274 + R_AARCH64_ADR_PREL_PG_HI21 R_AARCH64 = 275 + R_AARCH64_ADR_PREL_PG_HI21_NC R_AARCH64 = 276 + R_AARCH64_ADD_ABS_LO12_NC R_AARCH64 = 277 + R_AARCH64_LDST8_ABS_LO12_NC R_AARCH64 = 278 + R_AARCH64_TSTBR14 R_AARCH64 = 279 + R_AARCH64_CONDBR19 R_AARCH64 = 280 + R_AARCH64_JUMP26 R_AARCH64 = 282 + R_AARCH64_CALL26 R_AARCH64 = 283 + R_AARCH64_LDST16_ABS_LO12_NC R_AARCH64 = 284 + R_AARCH64_LDST32_ABS_LO12_NC R_AARCH64 = 285 + R_AARCH64_LDST64_ABS_LO12_NC R_AARCH64 = 286 + R_AARCH64_LDST128_ABS_LO12_NC R_AARCH64 = 299 + R_AARCH64_GOT_LD_PREL19 R_AARCH64 = 309 + R_AARCH64_LD64_GOTOFF_LO15 R_AARCH64 = 310 + R_AARCH64_ADR_GOT_PAGE R_AARCH64 = 311 + R_AARCH64_LD64_GOT_LO12_NC R_AARCH64 = 312 + R_AARCH64_LD64_GOTPAGE_LO15 R_AARCH64 = 313 + R_AARCH64_TLSGD_ADR_PREL21 R_AARCH64 = 512 + R_AARCH64_TLSGD_ADR_PAGE21 R_AARCH64 = 513 + R_AARCH64_TLSGD_ADD_LO12_NC R_AARCH64 = 514 + R_AARCH64_TLSGD_MOVW_G1 R_AARCH64 = 515 + R_AARCH64_TLSGD_MOVW_G0_NC R_AARCH64 = 516 + R_AARCH64_TLSLD_ADR_PREL21 R_AARCH64 = 517 + R_AARCH64_TLSLD_ADR_PAGE21 R_AARCH64 = 518 + R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 R_AARCH64 = 539 + R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC R_AARCH64 = 540 + R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 R_AARCH64 = 541 + R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC R_AARCH64 = 542 + R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 R_AARCH64 = 543 + R_AARCH64_TLSLE_MOVW_TPREL_G2 R_AARCH64 = 544 + R_AARCH64_TLSLE_MOVW_TPREL_G1 R_AARCH64 = 545 + R_AARCH64_TLSLE_MOVW_TPREL_G1_NC R_AARCH64 = 546 + R_AARCH64_TLSLE_MOVW_TPREL_G0 R_AARCH64 = 547 + R_AARCH64_TLSLE_MOVW_TPREL_G0_NC R_AARCH64 = 548 + R_AARCH64_TLSLE_ADD_TPREL_HI12 R_AARCH64 = 549 + R_AARCH64_TLSLE_ADD_TPREL_LO12 R_AARCH64 = 550 + R_AARCH64_TLSLE_ADD_TPREL_LO12_NC R_AARCH64 = 551 + R_AARCH64_TLSDESC_LD_PREL19 R_AARCH64 = 560 + R_AARCH64_TLSDESC_ADR_PREL21 R_AARCH64 = 561 + R_AARCH64_TLSDESC_ADR_PAGE21 R_AARCH64 = 562 + R_AARCH64_TLSDESC_LD64_LO12_NC R_AARCH64 = 563 + R_AARCH64_TLSDESC_ADD_LO12_NC R_AARCH64 = 564 + R_AARCH64_TLSDESC_OFF_G1 R_AARCH64 = 565 + R_AARCH64_TLSDESC_OFF_G0_NC R_AARCH64 = 566 + R_AARCH64_TLSDESC_LDR R_AARCH64 = 567 + R_AARCH64_TLSDESC_ADD R_AARCH64 = 568 + R_AARCH64_TLSDESC_CALL R_AARCH64 = 569 + R_AARCH64_TLSLE_LDST128_TPREL_LO12 R_AARCH64 = 570 + R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC R_AARCH64 = 571 + R_AARCH64_TLSLD_LDST128_DTPREL_LO12 R_AARCH64 = 572 + R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC R_AARCH64 = 573 + R_AARCH64_COPY R_AARCH64 = 1024 + R_AARCH64_GLOB_DAT R_AARCH64 = 1025 + R_AARCH64_JUMP_SLOT R_AARCH64 = 1026 + R_AARCH64_RELATIVE R_AARCH64 = 1027 + R_AARCH64_TLS_DTPMOD64 R_AARCH64 = 1028 + R_AARCH64_TLS_DTPREL64 R_AARCH64 = 1029 + R_AARCH64_TLS_TPREL64 R_AARCH64 = 1030 + R_AARCH64_TLSDESC R_AARCH64 = 1031 + R_AARCH64_IRELATIVE R_AARCH64 = 1032 +) + +var raarch64Strings = []intName{ + {0, "R_AARCH64_NONE"}, + {1, "R_AARCH64_P32_ABS32"}, + {2, "R_AARCH64_P32_ABS16"}, + {3, "R_AARCH64_P32_PREL32"}, + {4, "R_AARCH64_P32_PREL16"}, + {5, "R_AARCH64_P32_MOVW_UABS_G0"}, + {6, "R_AARCH64_P32_MOVW_UABS_G0_NC"}, + {7, "R_AARCH64_P32_MOVW_UABS_G1"}, + {8, "R_AARCH64_P32_MOVW_SABS_G0"}, + {9, "R_AARCH64_P32_LD_PREL_LO19"}, + {10, "R_AARCH64_P32_ADR_PREL_LO21"}, + {11, "R_AARCH64_P32_ADR_PREL_PG_HI21"}, + {12, "R_AARCH64_P32_ADD_ABS_LO12_NC"}, + {13, "R_AARCH64_P32_LDST8_ABS_LO12_NC"}, + {14, "R_AARCH64_P32_LDST16_ABS_LO12_NC"}, + {15, "R_AARCH64_P32_LDST32_ABS_LO12_NC"}, + {16, "R_AARCH64_P32_LDST64_ABS_LO12_NC"}, + {17, "R_AARCH64_P32_LDST128_ABS_LO12_NC"}, + {18, "R_AARCH64_P32_TSTBR14"}, + {19, "R_AARCH64_P32_CONDBR19"}, + {20, "R_AARCH64_P32_JUMP26"}, + {21, "R_AARCH64_P32_CALL26"}, + {25, "R_AARCH64_P32_GOT_LD_PREL19"}, + {26, "R_AARCH64_P32_ADR_GOT_PAGE"}, + {27, "R_AARCH64_P32_LD32_GOT_LO12_NC"}, + {81, "R_AARCH64_P32_TLSGD_ADR_PAGE21"}, + {82, "R_AARCH64_P32_TLSGD_ADD_LO12_NC"}, + {103, "R_AARCH64_P32_TLSIE_ADR_GOTTPREL_PAGE21"}, + {104, "R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC"}, + {105, "R_AARCH64_P32_TLSIE_LD_GOTTPREL_PREL19"}, + {106, "R_AARCH64_P32_TLSLE_MOVW_TPREL_G1"}, + {107, "R_AARCH64_P32_TLSLE_MOVW_TPREL_G0"}, + {108, "R_AARCH64_P32_TLSLE_MOVW_TPREL_G0_NC"}, + {109, "R_AARCH64_P32_TLSLE_ADD_TPREL_HI12"}, + {110, "R_AARCH64_P32_TLSLE_ADD_TPREL_LO12"}, + {111, "R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC"}, + {122, "R_AARCH64_P32_TLSDESC_LD_PREL19"}, + {123, "R_AARCH64_P32_TLSDESC_ADR_PREL21"}, + {124, "R_AARCH64_P32_TLSDESC_ADR_PAGE21"}, + {125, "R_AARCH64_P32_TLSDESC_LD32_LO12_NC"}, + {126, "R_AARCH64_P32_TLSDESC_ADD_LO12_NC"}, + {127, "R_AARCH64_P32_TLSDESC_CALL"}, + {180, "R_AARCH64_P32_COPY"}, + {181, "R_AARCH64_P32_GLOB_DAT"}, + {182, "R_AARCH64_P32_JUMP_SLOT"}, + {183, "R_AARCH64_P32_RELATIVE"}, + {184, "R_AARCH64_P32_TLS_DTPMOD"}, + {185, "R_AARCH64_P32_TLS_DTPREL"}, + {186, "R_AARCH64_P32_TLS_TPREL"}, + {187, "R_AARCH64_P32_TLSDESC"}, + {188, "R_AARCH64_P32_IRELATIVE"}, + {256, "R_AARCH64_NULL"}, + {257, "R_AARCH64_ABS64"}, + {258, "R_AARCH64_ABS32"}, + {259, "R_AARCH64_ABS16"}, + {260, "R_AARCH64_PREL64"}, + {261, "R_AARCH64_PREL32"}, + {262, "R_AARCH64_PREL16"}, + {263, "R_AARCH64_MOVW_UABS_G0"}, + {264, "R_AARCH64_MOVW_UABS_G0_NC"}, + {265, "R_AARCH64_MOVW_UABS_G1"}, + {266, "R_AARCH64_MOVW_UABS_G1_NC"}, + {267, "R_AARCH64_MOVW_UABS_G2"}, + {268, "R_AARCH64_MOVW_UABS_G2_NC"}, + {269, "R_AARCH64_MOVW_UABS_G3"}, + {270, "R_AARCH64_MOVW_SABS_G0"}, + {271, "R_AARCH64_MOVW_SABS_G1"}, + {272, "R_AARCH64_MOVW_SABS_G2"}, + {273, "R_AARCH64_LD_PREL_LO19"}, + {274, "R_AARCH64_ADR_PREL_LO21"}, + {275, "R_AARCH64_ADR_PREL_PG_HI21"}, + {276, "R_AARCH64_ADR_PREL_PG_HI21_NC"}, + {277, "R_AARCH64_ADD_ABS_LO12_NC"}, + {278, "R_AARCH64_LDST8_ABS_LO12_NC"}, + {279, "R_AARCH64_TSTBR14"}, + {280, "R_AARCH64_CONDBR19"}, + {282, "R_AARCH64_JUMP26"}, + {283, "R_AARCH64_CALL26"}, + {284, "R_AARCH64_LDST16_ABS_LO12_NC"}, + {285, "R_AARCH64_LDST32_ABS_LO12_NC"}, + {286, "R_AARCH64_LDST64_ABS_LO12_NC"}, + {299, "R_AARCH64_LDST128_ABS_LO12_NC"}, + {309, "R_AARCH64_GOT_LD_PREL19"}, + {310, "R_AARCH64_LD64_GOTOFF_LO15"}, + {311, "R_AARCH64_ADR_GOT_PAGE"}, + {312, "R_AARCH64_LD64_GOT_LO12_NC"}, + {313, "R_AARCH64_LD64_GOTPAGE_LO15"}, + {512, "R_AARCH64_TLSGD_ADR_PREL21"}, + {513, "R_AARCH64_TLSGD_ADR_PAGE21"}, + {514, "R_AARCH64_TLSGD_ADD_LO12_NC"}, + {515, "R_AARCH64_TLSGD_MOVW_G1"}, + {516, "R_AARCH64_TLSGD_MOVW_G0_NC"}, + {517, "R_AARCH64_TLSLD_ADR_PREL21"}, + {518, "R_AARCH64_TLSLD_ADR_PAGE21"}, + {539, "R_AARCH64_TLSIE_MOVW_GOTTPREL_G1"}, + {540, "R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC"}, + {541, "R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21"}, + {542, "R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC"}, + {543, "R_AARCH64_TLSIE_LD_GOTTPREL_PREL19"}, + {544, "R_AARCH64_TLSLE_MOVW_TPREL_G2"}, + {545, "R_AARCH64_TLSLE_MOVW_TPREL_G1"}, + {546, "R_AARCH64_TLSLE_MOVW_TPREL_G1_NC"}, + {547, "R_AARCH64_TLSLE_MOVW_TPREL_G0"}, + {548, "R_AARCH64_TLSLE_MOVW_TPREL_G0_NC"}, + {549, "R_AARCH64_TLSLE_ADD_TPREL_HI12"}, + {550, "R_AARCH64_TLSLE_ADD_TPREL_LO12"}, + {551, "R_AARCH64_TLSLE_ADD_TPREL_LO12_NC"}, + {560, "R_AARCH64_TLSDESC_LD_PREL19"}, + {561, "R_AARCH64_TLSDESC_ADR_PREL21"}, + {562, "R_AARCH64_TLSDESC_ADR_PAGE21"}, + {563, "R_AARCH64_TLSDESC_LD64_LO12_NC"}, + {564, "R_AARCH64_TLSDESC_ADD_LO12_NC"}, + {565, "R_AARCH64_TLSDESC_OFF_G1"}, + {566, "R_AARCH64_TLSDESC_OFF_G0_NC"}, + {567, "R_AARCH64_TLSDESC_LDR"}, + {568, "R_AARCH64_TLSDESC_ADD"}, + {569, "R_AARCH64_TLSDESC_CALL"}, + {570, "R_AARCH64_TLSLE_LDST128_TPREL_LO12"}, + {571, "R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC"}, + {572, "R_AARCH64_TLSLD_LDST128_DTPREL_LO12"}, + {573, "R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC"}, + {1024, "R_AARCH64_COPY"}, + {1025, "R_AARCH64_GLOB_DAT"}, + {1026, "R_AARCH64_JUMP_SLOT"}, + {1027, "R_AARCH64_RELATIVE"}, + {1028, "R_AARCH64_TLS_DTPMOD64"}, + {1029, "R_AARCH64_TLS_DTPREL64"}, + {1030, "R_AARCH64_TLS_TPREL64"}, + {1031, "R_AARCH64_TLSDESC"}, + {1032, "R_AARCH64_IRELATIVE"}, +} + +func (i R_AARCH64) String() string { return stringName(uint32(i), raarch64Strings, false) } +func (i R_AARCH64) GoString() string { return stringName(uint32(i), raarch64Strings, true) } + +// Relocation types for Alpha. +type R_ALPHA int + +const ( + R_ALPHA_NONE R_ALPHA = 0 /* No reloc */ + R_ALPHA_REFLONG R_ALPHA = 1 /* Direct 32 bit */ + R_ALPHA_REFQUAD R_ALPHA = 2 /* Direct 64 bit */ + R_ALPHA_GPREL32 R_ALPHA = 3 /* GP relative 32 bit */ + R_ALPHA_LITERAL R_ALPHA = 4 /* GP relative 16 bit w/optimization */ + R_ALPHA_LITUSE R_ALPHA = 5 /* Optimization hint for LITERAL */ + R_ALPHA_GPDISP R_ALPHA = 6 /* Add displacement to GP */ + R_ALPHA_BRADDR R_ALPHA = 7 /* PC+4 relative 23 bit shifted */ + R_ALPHA_HINT R_ALPHA = 8 /* PC+4 relative 16 bit shifted */ + R_ALPHA_SREL16 R_ALPHA = 9 /* PC relative 16 bit */ + R_ALPHA_SREL32 R_ALPHA = 10 /* PC relative 32 bit */ + R_ALPHA_SREL64 R_ALPHA = 11 /* PC relative 64 bit */ + R_ALPHA_OP_PUSH R_ALPHA = 12 /* OP stack push */ + R_ALPHA_OP_STORE R_ALPHA = 13 /* OP stack pop and store */ + R_ALPHA_OP_PSUB R_ALPHA = 14 /* OP stack subtract */ + R_ALPHA_OP_PRSHIFT R_ALPHA = 15 /* OP stack right shift */ + R_ALPHA_GPVALUE R_ALPHA = 16 + R_ALPHA_GPRELHIGH R_ALPHA = 17 + R_ALPHA_GPRELLOW R_ALPHA = 18 + R_ALPHA_IMMED_GP_16 R_ALPHA = 19 + R_ALPHA_IMMED_GP_HI32 R_ALPHA = 20 + R_ALPHA_IMMED_SCN_HI32 R_ALPHA = 21 + R_ALPHA_IMMED_BR_HI32 R_ALPHA = 22 + R_ALPHA_IMMED_LO32 R_ALPHA = 23 + R_ALPHA_COPY R_ALPHA = 24 /* Copy symbol at runtime */ + R_ALPHA_GLOB_DAT R_ALPHA = 25 /* Create GOT entry */ + R_ALPHA_JMP_SLOT R_ALPHA = 26 /* Create PLT entry */ + R_ALPHA_RELATIVE R_ALPHA = 27 /* Adjust by program base */ +) + +var ralphaStrings = []intName{ + {0, "R_ALPHA_NONE"}, + {1, "R_ALPHA_REFLONG"}, + {2, "R_ALPHA_REFQUAD"}, + {3, "R_ALPHA_GPREL32"}, + {4, "R_ALPHA_LITERAL"}, + {5, "R_ALPHA_LITUSE"}, + {6, "R_ALPHA_GPDISP"}, + {7, "R_ALPHA_BRADDR"}, + {8, "R_ALPHA_HINT"}, + {9, "R_ALPHA_SREL16"}, + {10, "R_ALPHA_SREL32"}, + {11, "R_ALPHA_SREL64"}, + {12, "R_ALPHA_OP_PUSH"}, + {13, "R_ALPHA_OP_STORE"}, + {14, "R_ALPHA_OP_PSUB"}, + {15, "R_ALPHA_OP_PRSHIFT"}, + {16, "R_ALPHA_GPVALUE"}, + {17, "R_ALPHA_GPRELHIGH"}, + {18, "R_ALPHA_GPRELLOW"}, + {19, "R_ALPHA_IMMED_GP_16"}, + {20, "R_ALPHA_IMMED_GP_HI32"}, + {21, "R_ALPHA_IMMED_SCN_HI32"}, + {22, "R_ALPHA_IMMED_BR_HI32"}, + {23, "R_ALPHA_IMMED_LO32"}, + {24, "R_ALPHA_COPY"}, + {25, "R_ALPHA_GLOB_DAT"}, + {26, "R_ALPHA_JMP_SLOT"}, + {27, "R_ALPHA_RELATIVE"}, +} + +func (i R_ALPHA) String() string { return stringName(uint32(i), ralphaStrings, false) } +func (i R_ALPHA) GoString() string { return stringName(uint32(i), ralphaStrings, true) } + +// Relocation types for ARM. +type R_ARM int + +const ( + R_ARM_NONE R_ARM = 0 /* No relocation. */ + R_ARM_PC24 R_ARM = 1 + R_ARM_ABS32 R_ARM = 2 + R_ARM_REL32 R_ARM = 3 + R_ARM_PC13 R_ARM = 4 + R_ARM_ABS16 R_ARM = 5 + R_ARM_ABS12 R_ARM = 6 + R_ARM_THM_ABS5 R_ARM = 7 + R_ARM_ABS8 R_ARM = 8 + R_ARM_SBREL32 R_ARM = 9 + R_ARM_THM_PC22 R_ARM = 10 + R_ARM_THM_PC8 R_ARM = 11 + R_ARM_AMP_VCALL9 R_ARM = 12 + R_ARM_SWI24 R_ARM = 13 + R_ARM_THM_SWI8 R_ARM = 14 + R_ARM_XPC25 R_ARM = 15 + R_ARM_THM_XPC22 R_ARM = 16 + R_ARM_TLS_DTPMOD32 R_ARM = 17 + R_ARM_TLS_DTPOFF32 R_ARM = 18 + R_ARM_TLS_TPOFF32 R_ARM = 19 + R_ARM_COPY R_ARM = 20 /* Copy data from shared object. */ + R_ARM_GLOB_DAT R_ARM = 21 /* Set GOT entry to data address. */ + R_ARM_JUMP_SLOT R_ARM = 22 /* Set GOT entry to code address. */ + R_ARM_RELATIVE R_ARM = 23 /* Add load address of shared object. */ + R_ARM_GOTOFF R_ARM = 24 /* Add GOT-relative symbol address. */ + R_ARM_GOTPC R_ARM = 25 /* Add PC-relative GOT table address. */ + R_ARM_GOT32 R_ARM = 26 /* Add PC-relative GOT offset. */ + R_ARM_PLT32 R_ARM = 27 /* Add PC-relative PLT offset. */ + R_ARM_CALL R_ARM = 28 + R_ARM_JUMP24 R_ARM = 29 + R_ARM_THM_JUMP24 R_ARM = 30 + R_ARM_BASE_ABS R_ARM = 31 + R_ARM_ALU_PCREL_7_0 R_ARM = 32 + R_ARM_ALU_PCREL_15_8 R_ARM = 33 + R_ARM_ALU_PCREL_23_15 R_ARM = 34 + R_ARM_LDR_SBREL_11_10_NC R_ARM = 35 + R_ARM_ALU_SBREL_19_12_NC R_ARM = 36 + R_ARM_ALU_SBREL_27_20_CK R_ARM = 37 + R_ARM_TARGET1 R_ARM = 38 + R_ARM_SBREL31 R_ARM = 39 + R_ARM_V4BX R_ARM = 40 + R_ARM_TARGET2 R_ARM = 41 + R_ARM_PREL31 R_ARM = 42 + R_ARM_MOVW_ABS_NC R_ARM = 43 + R_ARM_MOVT_ABS R_ARM = 44 + R_ARM_MOVW_PREL_NC R_ARM = 45 + R_ARM_MOVT_PREL R_ARM = 46 + R_ARM_THM_MOVW_ABS_NC R_ARM = 47 + R_ARM_THM_MOVT_ABS R_ARM = 48 + R_ARM_THM_MOVW_PREL_NC R_ARM = 49 + R_ARM_THM_MOVT_PREL R_ARM = 50 + R_ARM_THM_JUMP19 R_ARM = 51 + R_ARM_THM_JUMP6 R_ARM = 52 + R_ARM_THM_ALU_PREL_11_0 R_ARM = 53 + R_ARM_THM_PC12 R_ARM = 54 + R_ARM_ABS32_NOI R_ARM = 55 + R_ARM_REL32_NOI R_ARM = 56 + R_ARM_ALU_PC_G0_NC R_ARM = 57 + R_ARM_ALU_PC_G0 R_ARM = 58 + R_ARM_ALU_PC_G1_NC R_ARM = 59 + R_ARM_ALU_PC_G1 R_ARM = 60 + R_ARM_ALU_PC_G2 R_ARM = 61 + R_ARM_LDR_PC_G1 R_ARM = 62 + R_ARM_LDR_PC_G2 R_ARM = 63 + R_ARM_LDRS_PC_G0 R_ARM = 64 + R_ARM_LDRS_PC_G1 R_ARM = 65 + R_ARM_LDRS_PC_G2 R_ARM = 66 + R_ARM_LDC_PC_G0 R_ARM = 67 + R_ARM_LDC_PC_G1 R_ARM = 68 + R_ARM_LDC_PC_G2 R_ARM = 69 + R_ARM_ALU_SB_G0_NC R_ARM = 70 + R_ARM_ALU_SB_G0 R_ARM = 71 + R_ARM_ALU_SB_G1_NC R_ARM = 72 + R_ARM_ALU_SB_G1 R_ARM = 73 + R_ARM_ALU_SB_G2 R_ARM = 74 + R_ARM_LDR_SB_G0 R_ARM = 75 + R_ARM_LDR_SB_G1 R_ARM = 76 + R_ARM_LDR_SB_G2 R_ARM = 77 + R_ARM_LDRS_SB_G0 R_ARM = 78 + R_ARM_LDRS_SB_G1 R_ARM = 79 + R_ARM_LDRS_SB_G2 R_ARM = 80 + R_ARM_LDC_SB_G0 R_ARM = 81 + R_ARM_LDC_SB_G1 R_ARM = 82 + R_ARM_LDC_SB_G2 R_ARM = 83 + R_ARM_MOVW_BREL_NC R_ARM = 84 + R_ARM_MOVT_BREL R_ARM = 85 + R_ARM_MOVW_BREL R_ARM = 86 + R_ARM_THM_MOVW_BREL_NC R_ARM = 87 + R_ARM_THM_MOVT_BREL R_ARM = 88 + R_ARM_THM_MOVW_BREL R_ARM = 89 + R_ARM_TLS_GOTDESC R_ARM = 90 + R_ARM_TLS_CALL R_ARM = 91 + R_ARM_TLS_DESCSEQ R_ARM = 92 + R_ARM_THM_TLS_CALL R_ARM = 93 + R_ARM_PLT32_ABS R_ARM = 94 + R_ARM_GOT_ABS R_ARM = 95 + R_ARM_GOT_PREL R_ARM = 96 + R_ARM_GOT_BREL12 R_ARM = 97 + R_ARM_GOTOFF12 R_ARM = 98 + R_ARM_GOTRELAX R_ARM = 99 + R_ARM_GNU_VTENTRY R_ARM = 100 + R_ARM_GNU_VTINHERIT R_ARM = 101 + R_ARM_THM_JUMP11 R_ARM = 102 + R_ARM_THM_JUMP8 R_ARM = 103 + R_ARM_TLS_GD32 R_ARM = 104 + R_ARM_TLS_LDM32 R_ARM = 105 + R_ARM_TLS_LDO32 R_ARM = 106 + R_ARM_TLS_IE32 R_ARM = 107 + R_ARM_TLS_LE32 R_ARM = 108 + R_ARM_TLS_LDO12 R_ARM = 109 + R_ARM_TLS_LE12 R_ARM = 110 + R_ARM_TLS_IE12GP R_ARM = 111 + R_ARM_PRIVATE_0 R_ARM = 112 + R_ARM_PRIVATE_1 R_ARM = 113 + R_ARM_PRIVATE_2 R_ARM = 114 + R_ARM_PRIVATE_3 R_ARM = 115 + R_ARM_PRIVATE_4 R_ARM = 116 + R_ARM_PRIVATE_5 R_ARM = 117 + R_ARM_PRIVATE_6 R_ARM = 118 + R_ARM_PRIVATE_7 R_ARM = 119 + R_ARM_PRIVATE_8 R_ARM = 120 + R_ARM_PRIVATE_9 R_ARM = 121 + R_ARM_PRIVATE_10 R_ARM = 122 + R_ARM_PRIVATE_11 R_ARM = 123 + R_ARM_PRIVATE_12 R_ARM = 124 + R_ARM_PRIVATE_13 R_ARM = 125 + R_ARM_PRIVATE_14 R_ARM = 126 + R_ARM_PRIVATE_15 R_ARM = 127 + R_ARM_ME_TOO R_ARM = 128 + R_ARM_THM_TLS_DESCSEQ16 R_ARM = 129 + R_ARM_THM_TLS_DESCSEQ32 R_ARM = 130 + R_ARM_THM_GOT_BREL12 R_ARM = 131 + R_ARM_THM_ALU_ABS_G0_NC R_ARM = 132 + R_ARM_THM_ALU_ABS_G1_NC R_ARM = 133 + R_ARM_THM_ALU_ABS_G2_NC R_ARM = 134 + R_ARM_THM_ALU_ABS_G3 R_ARM = 135 + R_ARM_IRELATIVE R_ARM = 160 + R_ARM_RXPC25 R_ARM = 249 + R_ARM_RSBREL32 R_ARM = 250 + R_ARM_THM_RPC22 R_ARM = 251 + R_ARM_RREL32 R_ARM = 252 + R_ARM_RABS32 R_ARM = 253 + R_ARM_RPC24 R_ARM = 254 + R_ARM_RBASE R_ARM = 255 +) + +var rarmStrings = []intName{ + {0, "R_ARM_NONE"}, + {1, "R_ARM_PC24"}, + {2, "R_ARM_ABS32"}, + {3, "R_ARM_REL32"}, + {4, "R_ARM_PC13"}, + {5, "R_ARM_ABS16"}, + {6, "R_ARM_ABS12"}, + {7, "R_ARM_THM_ABS5"}, + {8, "R_ARM_ABS8"}, + {9, "R_ARM_SBREL32"}, + {10, "R_ARM_THM_PC22"}, + {11, "R_ARM_THM_PC8"}, + {12, "R_ARM_AMP_VCALL9"}, + {13, "R_ARM_SWI24"}, + {14, "R_ARM_THM_SWI8"}, + {15, "R_ARM_XPC25"}, + {16, "R_ARM_THM_XPC22"}, + {17, "R_ARM_TLS_DTPMOD32"}, + {18, "R_ARM_TLS_DTPOFF32"}, + {19, "R_ARM_TLS_TPOFF32"}, + {20, "R_ARM_COPY"}, + {21, "R_ARM_GLOB_DAT"}, + {22, "R_ARM_JUMP_SLOT"}, + {23, "R_ARM_RELATIVE"}, + {24, "R_ARM_GOTOFF"}, + {25, "R_ARM_GOTPC"}, + {26, "R_ARM_GOT32"}, + {27, "R_ARM_PLT32"}, + {28, "R_ARM_CALL"}, + {29, "R_ARM_JUMP24"}, + {30, "R_ARM_THM_JUMP24"}, + {31, "R_ARM_BASE_ABS"}, + {32, "R_ARM_ALU_PCREL_7_0"}, + {33, "R_ARM_ALU_PCREL_15_8"}, + {34, "R_ARM_ALU_PCREL_23_15"}, + {35, "R_ARM_LDR_SBREL_11_10_NC"}, + {36, "R_ARM_ALU_SBREL_19_12_NC"}, + {37, "R_ARM_ALU_SBREL_27_20_CK"}, + {38, "R_ARM_TARGET1"}, + {39, "R_ARM_SBREL31"}, + {40, "R_ARM_V4BX"}, + {41, "R_ARM_TARGET2"}, + {42, "R_ARM_PREL31"}, + {43, "R_ARM_MOVW_ABS_NC"}, + {44, "R_ARM_MOVT_ABS"}, + {45, "R_ARM_MOVW_PREL_NC"}, + {46, "R_ARM_MOVT_PREL"}, + {47, "R_ARM_THM_MOVW_ABS_NC"}, + {48, "R_ARM_THM_MOVT_ABS"}, + {49, "R_ARM_THM_MOVW_PREL_NC"}, + {50, "R_ARM_THM_MOVT_PREL"}, + {51, "R_ARM_THM_JUMP19"}, + {52, "R_ARM_THM_JUMP6"}, + {53, "R_ARM_THM_ALU_PREL_11_0"}, + {54, "R_ARM_THM_PC12"}, + {55, "R_ARM_ABS32_NOI"}, + {56, "R_ARM_REL32_NOI"}, + {57, "R_ARM_ALU_PC_G0_NC"}, + {58, "R_ARM_ALU_PC_G0"}, + {59, "R_ARM_ALU_PC_G1_NC"}, + {60, "R_ARM_ALU_PC_G1"}, + {61, "R_ARM_ALU_PC_G2"}, + {62, "R_ARM_LDR_PC_G1"}, + {63, "R_ARM_LDR_PC_G2"}, + {64, "R_ARM_LDRS_PC_G0"}, + {65, "R_ARM_LDRS_PC_G1"}, + {66, "R_ARM_LDRS_PC_G2"}, + {67, "R_ARM_LDC_PC_G0"}, + {68, "R_ARM_LDC_PC_G1"}, + {69, "R_ARM_LDC_PC_G2"}, + {70, "R_ARM_ALU_SB_G0_NC"}, + {71, "R_ARM_ALU_SB_G0"}, + {72, "R_ARM_ALU_SB_G1_NC"}, + {73, "R_ARM_ALU_SB_G1"}, + {74, "R_ARM_ALU_SB_G2"}, + {75, "R_ARM_LDR_SB_G0"}, + {76, "R_ARM_LDR_SB_G1"}, + {77, "R_ARM_LDR_SB_G2"}, + {78, "R_ARM_LDRS_SB_G0"}, + {79, "R_ARM_LDRS_SB_G1"}, + {80, "R_ARM_LDRS_SB_G2"}, + {81, "R_ARM_LDC_SB_G0"}, + {82, "R_ARM_LDC_SB_G1"}, + {83, "R_ARM_LDC_SB_G2"}, + {84, "R_ARM_MOVW_BREL_NC"}, + {85, "R_ARM_MOVT_BREL"}, + {86, "R_ARM_MOVW_BREL"}, + {87, "R_ARM_THM_MOVW_BREL_NC"}, + {88, "R_ARM_THM_MOVT_BREL"}, + {89, "R_ARM_THM_MOVW_BREL"}, + {90, "R_ARM_TLS_GOTDESC"}, + {91, "R_ARM_TLS_CALL"}, + {92, "R_ARM_TLS_DESCSEQ"}, + {93, "R_ARM_THM_TLS_CALL"}, + {94, "R_ARM_PLT32_ABS"}, + {95, "R_ARM_GOT_ABS"}, + {96, "R_ARM_GOT_PREL"}, + {97, "R_ARM_GOT_BREL12"}, + {98, "R_ARM_GOTOFF12"}, + {99, "R_ARM_GOTRELAX"}, + {100, "R_ARM_GNU_VTENTRY"}, + {101, "R_ARM_GNU_VTINHERIT"}, + {102, "R_ARM_THM_JUMP11"}, + {103, "R_ARM_THM_JUMP8"}, + {104, "R_ARM_TLS_GD32"}, + {105, "R_ARM_TLS_LDM32"}, + {106, "R_ARM_TLS_LDO32"}, + {107, "R_ARM_TLS_IE32"}, + {108, "R_ARM_TLS_LE32"}, + {109, "R_ARM_TLS_LDO12"}, + {110, "R_ARM_TLS_LE12"}, + {111, "R_ARM_TLS_IE12GP"}, + {112, "R_ARM_PRIVATE_0"}, + {113, "R_ARM_PRIVATE_1"}, + {114, "R_ARM_PRIVATE_2"}, + {115, "R_ARM_PRIVATE_3"}, + {116, "R_ARM_PRIVATE_4"}, + {117, "R_ARM_PRIVATE_5"}, + {118, "R_ARM_PRIVATE_6"}, + {119, "R_ARM_PRIVATE_7"}, + {120, "R_ARM_PRIVATE_8"}, + {121, "R_ARM_PRIVATE_9"}, + {122, "R_ARM_PRIVATE_10"}, + {123, "R_ARM_PRIVATE_11"}, + {124, "R_ARM_PRIVATE_12"}, + {125, "R_ARM_PRIVATE_13"}, + {126, "R_ARM_PRIVATE_14"}, + {127, "R_ARM_PRIVATE_15"}, + {128, "R_ARM_ME_TOO"}, + {129, "R_ARM_THM_TLS_DESCSEQ16"}, + {130, "R_ARM_THM_TLS_DESCSEQ32"}, + {131, "R_ARM_THM_GOT_BREL12"}, + {132, "R_ARM_THM_ALU_ABS_G0_NC"}, + {133, "R_ARM_THM_ALU_ABS_G1_NC"}, + {134, "R_ARM_THM_ALU_ABS_G2_NC"}, + {135, "R_ARM_THM_ALU_ABS_G3"}, + {160, "R_ARM_IRELATIVE"}, + {249, "R_ARM_RXPC25"}, + {250, "R_ARM_RSBREL32"}, + {251, "R_ARM_THM_RPC22"}, + {252, "R_ARM_RREL32"}, + {253, "R_ARM_RABS32"}, + {254, "R_ARM_RPC24"}, + {255, "R_ARM_RBASE"}, +} + +func (i R_ARM) String() string { return stringName(uint32(i), rarmStrings, false) } +func (i R_ARM) GoString() string { return stringName(uint32(i), rarmStrings, true) } + +// Relocation types for 386. +type R_386 int + +const ( + R_386_NONE R_386 = 0 /* No relocation. */ + R_386_32 R_386 = 1 /* Add symbol value. */ + R_386_PC32 R_386 = 2 /* Add PC-relative symbol value. */ + R_386_GOT32 R_386 = 3 /* Add PC-relative GOT offset. */ + R_386_PLT32 R_386 = 4 /* Add PC-relative PLT offset. */ + R_386_COPY R_386 = 5 /* Copy data from shared object. */ + R_386_GLOB_DAT R_386 = 6 /* Set GOT entry to data address. */ + R_386_JMP_SLOT R_386 = 7 /* Set GOT entry to code address. */ + R_386_RELATIVE R_386 = 8 /* Add load address of shared object. */ + R_386_GOTOFF R_386 = 9 /* Add GOT-relative symbol address. */ + R_386_GOTPC R_386 = 10 /* Add PC-relative GOT table address. */ + R_386_32PLT R_386 = 11 + R_386_TLS_TPOFF R_386 = 14 /* Negative offset in static TLS block */ + R_386_TLS_IE R_386 = 15 /* Absolute address of GOT for -ve static TLS */ + R_386_TLS_GOTIE R_386 = 16 /* GOT entry for negative static TLS block */ + R_386_TLS_LE R_386 = 17 /* Negative offset relative to static TLS */ + R_386_TLS_GD R_386 = 18 /* 32 bit offset to GOT (index,off) pair */ + R_386_TLS_LDM R_386 = 19 /* 32 bit offset to GOT (index,zero) pair */ + R_386_16 R_386 = 20 + R_386_PC16 R_386 = 21 + R_386_8 R_386 = 22 + R_386_PC8 R_386 = 23 + R_386_TLS_GD_32 R_386 = 24 /* 32 bit offset to GOT (index,off) pair */ + R_386_TLS_GD_PUSH R_386 = 25 /* pushl instruction for Sun ABI GD sequence */ + R_386_TLS_GD_CALL R_386 = 26 /* call instruction for Sun ABI GD sequence */ + R_386_TLS_GD_POP R_386 = 27 /* popl instruction for Sun ABI GD sequence */ + R_386_TLS_LDM_32 R_386 = 28 /* 32 bit offset to GOT (index,zero) pair */ + R_386_TLS_LDM_PUSH R_386 = 29 /* pushl instruction for Sun ABI LD sequence */ + R_386_TLS_LDM_CALL R_386 = 30 /* call instruction for Sun ABI LD sequence */ + R_386_TLS_LDM_POP R_386 = 31 /* popl instruction for Sun ABI LD sequence */ + R_386_TLS_LDO_32 R_386 = 32 /* 32 bit offset from start of TLS block */ + R_386_TLS_IE_32 R_386 = 33 /* 32 bit offset to GOT static TLS offset entry */ + R_386_TLS_LE_32 R_386 = 34 /* 32 bit offset within static TLS block */ + R_386_TLS_DTPMOD32 R_386 = 35 /* GOT entry containing TLS index */ + R_386_TLS_DTPOFF32 R_386 = 36 /* GOT entry containing TLS offset */ + R_386_TLS_TPOFF32 R_386 = 37 /* GOT entry of -ve static TLS offset */ + R_386_SIZE32 R_386 = 38 + R_386_TLS_GOTDESC R_386 = 39 + R_386_TLS_DESC_CALL R_386 = 40 + R_386_TLS_DESC R_386 = 41 + R_386_IRELATIVE R_386 = 42 + R_386_GOT32X R_386 = 43 +) + +var r386Strings = []intName{ + {0, "R_386_NONE"}, + {1, "R_386_32"}, + {2, "R_386_PC32"}, + {3, "R_386_GOT32"}, + {4, "R_386_PLT32"}, + {5, "R_386_COPY"}, + {6, "R_386_GLOB_DAT"}, + {7, "R_386_JMP_SLOT"}, + {8, "R_386_RELATIVE"}, + {9, "R_386_GOTOFF"}, + {10, "R_386_GOTPC"}, + {11, "R_386_32PLT"}, + {14, "R_386_TLS_TPOFF"}, + {15, "R_386_TLS_IE"}, + {16, "R_386_TLS_GOTIE"}, + {17, "R_386_TLS_LE"}, + {18, "R_386_TLS_GD"}, + {19, "R_386_TLS_LDM"}, + {20, "R_386_16"}, + {21, "R_386_PC16"}, + {22, "R_386_8"}, + {23, "R_386_PC8"}, + {24, "R_386_TLS_GD_32"}, + {25, "R_386_TLS_GD_PUSH"}, + {26, "R_386_TLS_GD_CALL"}, + {27, "R_386_TLS_GD_POP"}, + {28, "R_386_TLS_LDM_32"}, + {29, "R_386_TLS_LDM_PUSH"}, + {30, "R_386_TLS_LDM_CALL"}, + {31, "R_386_TLS_LDM_POP"}, + {32, "R_386_TLS_LDO_32"}, + {33, "R_386_TLS_IE_32"}, + {34, "R_386_TLS_LE_32"}, + {35, "R_386_TLS_DTPMOD32"}, + {36, "R_386_TLS_DTPOFF32"}, + {37, "R_386_TLS_TPOFF32"}, + {38, "R_386_SIZE32"}, + {39, "R_386_TLS_GOTDESC"}, + {40, "R_386_TLS_DESC_CALL"}, + {41, "R_386_TLS_DESC"}, + {42, "R_386_IRELATIVE"}, + {43, "R_386_GOT32X"}, +} + +func (i R_386) String() string { return stringName(uint32(i), r386Strings, false) } +func (i R_386) GoString() string { return stringName(uint32(i), r386Strings, true) } + +// Relocation types for MIPS. +type R_MIPS int + +const ( + R_MIPS_NONE R_MIPS = 0 + R_MIPS_16 R_MIPS = 1 + R_MIPS_32 R_MIPS = 2 + R_MIPS_REL32 R_MIPS = 3 + R_MIPS_26 R_MIPS = 4 + R_MIPS_HI16 R_MIPS = 5 /* high 16 bits of symbol value */ + R_MIPS_LO16 R_MIPS = 6 /* low 16 bits of symbol value */ + R_MIPS_GPREL16 R_MIPS = 7 /* GP-relative reference */ + R_MIPS_LITERAL R_MIPS = 8 /* Reference to literal section */ + R_MIPS_GOT16 R_MIPS = 9 /* Reference to global offset table */ + R_MIPS_PC16 R_MIPS = 10 /* 16 bit PC relative reference */ + R_MIPS_CALL16 R_MIPS = 11 /* 16 bit call through glbl offset tbl */ + R_MIPS_GPREL32 R_MIPS = 12 + R_MIPS_SHIFT5 R_MIPS = 16 + R_MIPS_SHIFT6 R_MIPS = 17 + R_MIPS_64 R_MIPS = 18 + R_MIPS_GOT_DISP R_MIPS = 19 + R_MIPS_GOT_PAGE R_MIPS = 20 + R_MIPS_GOT_OFST R_MIPS = 21 + R_MIPS_GOT_HI16 R_MIPS = 22 + R_MIPS_GOT_LO16 R_MIPS = 23 + R_MIPS_SUB R_MIPS = 24 + R_MIPS_INSERT_A R_MIPS = 25 + R_MIPS_INSERT_B R_MIPS = 26 + R_MIPS_DELETE R_MIPS = 27 + R_MIPS_HIGHER R_MIPS = 28 + R_MIPS_HIGHEST R_MIPS = 29 + R_MIPS_CALL_HI16 R_MIPS = 30 + R_MIPS_CALL_LO16 R_MIPS = 31 + R_MIPS_SCN_DISP R_MIPS = 32 + R_MIPS_REL16 R_MIPS = 33 + R_MIPS_ADD_IMMEDIATE R_MIPS = 34 + R_MIPS_PJUMP R_MIPS = 35 + R_MIPS_RELGOT R_MIPS = 36 + R_MIPS_JALR R_MIPS = 37 + + R_MIPS_TLS_DTPMOD32 R_MIPS = 38 /* Module number 32 bit */ + R_MIPS_TLS_DTPREL32 R_MIPS = 39 /* Module-relative offset 32 bit */ + R_MIPS_TLS_DTPMOD64 R_MIPS = 40 /* Module number 64 bit */ + R_MIPS_TLS_DTPREL64 R_MIPS = 41 /* Module-relative offset 64 bit */ + R_MIPS_TLS_GD R_MIPS = 42 /* 16 bit GOT offset for GD */ + R_MIPS_TLS_LDM R_MIPS = 43 /* 16 bit GOT offset for LDM */ + R_MIPS_TLS_DTPREL_HI16 R_MIPS = 44 /* Module-relative offset, high 16 bits */ + R_MIPS_TLS_DTPREL_LO16 R_MIPS = 45 /* Module-relative offset, low 16 bits */ + R_MIPS_TLS_GOTTPREL R_MIPS = 46 /* 16 bit GOT offset for IE */ + R_MIPS_TLS_TPREL32 R_MIPS = 47 /* TP-relative offset, 32 bit */ + R_MIPS_TLS_TPREL64 R_MIPS = 48 /* TP-relative offset, 64 bit */ + R_MIPS_TLS_TPREL_HI16 R_MIPS = 49 /* TP-relative offset, high 16 bits */ + R_MIPS_TLS_TPREL_LO16 R_MIPS = 50 /* TP-relative offset, low 16 bits */ + + R_MIPS_PC32 R_MIPS = 248 /* 32 bit PC relative reference */ +) + +var rmipsStrings = []intName{ + {0, "R_MIPS_NONE"}, + {1, "R_MIPS_16"}, + {2, "R_MIPS_32"}, + {3, "R_MIPS_REL32"}, + {4, "R_MIPS_26"}, + {5, "R_MIPS_HI16"}, + {6, "R_MIPS_LO16"}, + {7, "R_MIPS_GPREL16"}, + {8, "R_MIPS_LITERAL"}, + {9, "R_MIPS_GOT16"}, + {10, "R_MIPS_PC16"}, + {11, "R_MIPS_CALL16"}, + {12, "R_MIPS_GPREL32"}, + {16, "R_MIPS_SHIFT5"}, + {17, "R_MIPS_SHIFT6"}, + {18, "R_MIPS_64"}, + {19, "R_MIPS_GOT_DISP"}, + {20, "R_MIPS_GOT_PAGE"}, + {21, "R_MIPS_GOT_OFST"}, + {22, "R_MIPS_GOT_HI16"}, + {23, "R_MIPS_GOT_LO16"}, + {24, "R_MIPS_SUB"}, + {25, "R_MIPS_INSERT_A"}, + {26, "R_MIPS_INSERT_B"}, + {27, "R_MIPS_DELETE"}, + {28, "R_MIPS_HIGHER"}, + {29, "R_MIPS_HIGHEST"}, + {30, "R_MIPS_CALL_HI16"}, + {31, "R_MIPS_CALL_LO16"}, + {32, "R_MIPS_SCN_DISP"}, + {33, "R_MIPS_REL16"}, + {34, "R_MIPS_ADD_IMMEDIATE"}, + {35, "R_MIPS_PJUMP"}, + {36, "R_MIPS_RELGOT"}, + {37, "R_MIPS_JALR"}, + {38, "R_MIPS_TLS_DTPMOD32"}, + {39, "R_MIPS_TLS_DTPREL32"}, + {40, "R_MIPS_TLS_DTPMOD64"}, + {41, "R_MIPS_TLS_DTPREL64"}, + {42, "R_MIPS_TLS_GD"}, + {43, "R_MIPS_TLS_LDM"}, + {44, "R_MIPS_TLS_DTPREL_HI16"}, + {45, "R_MIPS_TLS_DTPREL_LO16"}, + {46, "R_MIPS_TLS_GOTTPREL"}, + {47, "R_MIPS_TLS_TPREL32"}, + {48, "R_MIPS_TLS_TPREL64"}, + {49, "R_MIPS_TLS_TPREL_HI16"}, + {50, "R_MIPS_TLS_TPREL_LO16"}, + {248, "R_MIPS_PC32"}, +} + +func (i R_MIPS) String() string { return stringName(uint32(i), rmipsStrings, false) } +func (i R_MIPS) GoString() string { return stringName(uint32(i), rmipsStrings, true) } + +// Relocation types for LoongArch. +type R_LARCH int + +const ( + R_LARCH_NONE R_LARCH = 0 + R_LARCH_32 R_LARCH = 1 + R_LARCH_64 R_LARCH = 2 + R_LARCH_RELATIVE R_LARCH = 3 + R_LARCH_COPY R_LARCH = 4 + R_LARCH_JUMP_SLOT R_LARCH = 5 + R_LARCH_TLS_DTPMOD32 R_LARCH = 6 + R_LARCH_TLS_DTPMOD64 R_LARCH = 7 + R_LARCH_TLS_DTPREL32 R_LARCH = 8 + R_LARCH_TLS_DTPREL64 R_LARCH = 9 + R_LARCH_TLS_TPREL32 R_LARCH = 10 + R_LARCH_TLS_TPREL64 R_LARCH = 11 + R_LARCH_IRELATIVE R_LARCH = 12 + R_LARCH_TLS_DESC32 R_LARCH = 13 + R_LARCH_TLS_DESC64 R_LARCH = 14 + R_LARCH_MARK_LA R_LARCH = 20 + R_LARCH_MARK_PCREL R_LARCH = 21 + R_LARCH_SOP_PUSH_PCREL R_LARCH = 22 + R_LARCH_SOP_PUSH_ABSOLUTE R_LARCH = 23 + R_LARCH_SOP_PUSH_DUP R_LARCH = 24 + R_LARCH_SOP_PUSH_GPREL R_LARCH = 25 + R_LARCH_SOP_PUSH_TLS_TPREL R_LARCH = 26 + R_LARCH_SOP_PUSH_TLS_GOT R_LARCH = 27 + R_LARCH_SOP_PUSH_TLS_GD R_LARCH = 28 + R_LARCH_SOP_PUSH_PLT_PCREL R_LARCH = 29 + R_LARCH_SOP_ASSERT R_LARCH = 30 + R_LARCH_SOP_NOT R_LARCH = 31 + R_LARCH_SOP_SUB R_LARCH = 32 + R_LARCH_SOP_SL R_LARCH = 33 + R_LARCH_SOP_SR R_LARCH = 34 + R_LARCH_SOP_ADD R_LARCH = 35 + R_LARCH_SOP_AND R_LARCH = 36 + R_LARCH_SOP_IF_ELSE R_LARCH = 37 + R_LARCH_SOP_POP_32_S_10_5 R_LARCH = 38 + R_LARCH_SOP_POP_32_U_10_12 R_LARCH = 39 + R_LARCH_SOP_POP_32_S_10_12 R_LARCH = 40 + R_LARCH_SOP_POP_32_S_10_16 R_LARCH = 41 + R_LARCH_SOP_POP_32_S_10_16_S2 R_LARCH = 42 + R_LARCH_SOP_POP_32_S_5_20 R_LARCH = 43 + R_LARCH_SOP_POP_32_S_0_5_10_16_S2 R_LARCH = 44 + R_LARCH_SOP_POP_32_S_0_10_10_16_S2 R_LARCH = 45 + R_LARCH_SOP_POP_32_U R_LARCH = 46 + R_LARCH_ADD8 R_LARCH = 47 + R_LARCH_ADD16 R_LARCH = 48 + R_LARCH_ADD24 R_LARCH = 49 + R_LARCH_ADD32 R_LARCH = 50 + R_LARCH_ADD64 R_LARCH = 51 + R_LARCH_SUB8 R_LARCH = 52 + R_LARCH_SUB16 R_LARCH = 53 + R_LARCH_SUB24 R_LARCH = 54 + R_LARCH_SUB32 R_LARCH = 55 + R_LARCH_SUB64 R_LARCH = 56 + R_LARCH_GNU_VTINHERIT R_LARCH = 57 + R_LARCH_GNU_VTENTRY R_LARCH = 58 + R_LARCH_B16 R_LARCH = 64 + R_LARCH_B21 R_LARCH = 65 + R_LARCH_B26 R_LARCH = 66 + R_LARCH_ABS_HI20 R_LARCH = 67 + R_LARCH_ABS_LO12 R_LARCH = 68 + R_LARCH_ABS64_LO20 R_LARCH = 69 + R_LARCH_ABS64_HI12 R_LARCH = 70 + R_LARCH_PCALA_HI20 R_LARCH = 71 + R_LARCH_PCALA_LO12 R_LARCH = 72 + R_LARCH_PCALA64_LO20 R_LARCH = 73 + R_LARCH_PCALA64_HI12 R_LARCH = 74 + R_LARCH_GOT_PC_HI20 R_LARCH = 75 + R_LARCH_GOT_PC_LO12 R_LARCH = 76 + R_LARCH_GOT64_PC_LO20 R_LARCH = 77 + R_LARCH_GOT64_PC_HI12 R_LARCH = 78 + R_LARCH_GOT_HI20 R_LARCH = 79 + R_LARCH_GOT_LO12 R_LARCH = 80 + R_LARCH_GOT64_LO20 R_LARCH = 81 + R_LARCH_GOT64_HI12 R_LARCH = 82 + R_LARCH_TLS_LE_HI20 R_LARCH = 83 + R_LARCH_TLS_LE_LO12 R_LARCH = 84 + R_LARCH_TLS_LE64_LO20 R_LARCH = 85 + R_LARCH_TLS_LE64_HI12 R_LARCH = 86 + R_LARCH_TLS_IE_PC_HI20 R_LARCH = 87 + R_LARCH_TLS_IE_PC_LO12 R_LARCH = 88 + R_LARCH_TLS_IE64_PC_LO20 R_LARCH = 89 + R_LARCH_TLS_IE64_PC_HI12 R_LARCH = 90 + R_LARCH_TLS_IE_HI20 R_LARCH = 91 + R_LARCH_TLS_IE_LO12 R_LARCH = 92 + R_LARCH_TLS_IE64_LO20 R_LARCH = 93 + R_LARCH_TLS_IE64_HI12 R_LARCH = 94 + R_LARCH_TLS_LD_PC_HI20 R_LARCH = 95 + R_LARCH_TLS_LD_HI20 R_LARCH = 96 + R_LARCH_TLS_GD_PC_HI20 R_LARCH = 97 + R_LARCH_TLS_GD_HI20 R_LARCH = 98 + R_LARCH_32_PCREL R_LARCH = 99 + R_LARCH_RELAX R_LARCH = 100 + R_LARCH_DELETE R_LARCH = 101 + R_LARCH_ALIGN R_LARCH = 102 + R_LARCH_PCREL20_S2 R_LARCH = 103 + R_LARCH_CFA R_LARCH = 104 + R_LARCH_ADD6 R_LARCH = 105 + R_LARCH_SUB6 R_LARCH = 106 + R_LARCH_ADD_ULEB128 R_LARCH = 107 + R_LARCH_SUB_ULEB128 R_LARCH = 108 + R_LARCH_64_PCREL R_LARCH = 109 + R_LARCH_CALL36 R_LARCH = 110 + R_LARCH_TLS_DESC_PC_HI20 R_LARCH = 111 + R_LARCH_TLS_DESC_PC_LO12 R_LARCH = 112 + R_LARCH_TLS_DESC64_PC_LO20 R_LARCH = 113 + R_LARCH_TLS_DESC64_PC_HI12 R_LARCH = 114 + R_LARCH_TLS_DESC_HI20 R_LARCH = 115 + R_LARCH_TLS_DESC_LO12 R_LARCH = 116 + R_LARCH_TLS_DESC64_LO20 R_LARCH = 117 + R_LARCH_TLS_DESC64_HI12 R_LARCH = 118 + R_LARCH_TLS_DESC_LD R_LARCH = 119 + R_LARCH_TLS_DESC_CALL R_LARCH = 120 + R_LARCH_TLS_LE_HI20_R R_LARCH = 121 + R_LARCH_TLS_LE_ADD_R R_LARCH = 122 + R_LARCH_TLS_LE_LO12_R R_LARCH = 123 + R_LARCH_TLS_LD_PCREL20_S2 R_LARCH = 124 + R_LARCH_TLS_GD_PCREL20_S2 R_LARCH = 125 + R_LARCH_TLS_DESC_PCREL20_S2 R_LARCH = 126 +) + +var rlarchStrings = []intName{ + {0, "R_LARCH_NONE"}, + {1, "R_LARCH_32"}, + {2, "R_LARCH_64"}, + {3, "R_LARCH_RELATIVE"}, + {4, "R_LARCH_COPY"}, + {5, "R_LARCH_JUMP_SLOT"}, + {6, "R_LARCH_TLS_DTPMOD32"}, + {7, "R_LARCH_TLS_DTPMOD64"}, + {8, "R_LARCH_TLS_DTPREL32"}, + {9, "R_LARCH_TLS_DTPREL64"}, + {10, "R_LARCH_TLS_TPREL32"}, + {11, "R_LARCH_TLS_TPREL64"}, + {12, "R_LARCH_IRELATIVE"}, + {13, "R_LARCH_TLS_DESC32"}, + {14, "R_LARCH_TLS_DESC64"}, + {20, "R_LARCH_MARK_LA"}, + {21, "R_LARCH_MARK_PCREL"}, + {22, "R_LARCH_SOP_PUSH_PCREL"}, + {23, "R_LARCH_SOP_PUSH_ABSOLUTE"}, + {24, "R_LARCH_SOP_PUSH_DUP"}, + {25, "R_LARCH_SOP_PUSH_GPREL"}, + {26, "R_LARCH_SOP_PUSH_TLS_TPREL"}, + {27, "R_LARCH_SOP_PUSH_TLS_GOT"}, + {28, "R_LARCH_SOP_PUSH_TLS_GD"}, + {29, "R_LARCH_SOP_PUSH_PLT_PCREL"}, + {30, "R_LARCH_SOP_ASSERT"}, + {31, "R_LARCH_SOP_NOT"}, + {32, "R_LARCH_SOP_SUB"}, + {33, "R_LARCH_SOP_SL"}, + {34, "R_LARCH_SOP_SR"}, + {35, "R_LARCH_SOP_ADD"}, + {36, "R_LARCH_SOP_AND"}, + {37, "R_LARCH_SOP_IF_ELSE"}, + {38, "R_LARCH_SOP_POP_32_S_10_5"}, + {39, "R_LARCH_SOP_POP_32_U_10_12"}, + {40, "R_LARCH_SOP_POP_32_S_10_12"}, + {41, "R_LARCH_SOP_POP_32_S_10_16"}, + {42, "R_LARCH_SOP_POP_32_S_10_16_S2"}, + {43, "R_LARCH_SOP_POP_32_S_5_20"}, + {44, "R_LARCH_SOP_POP_32_S_0_5_10_16_S2"}, + {45, "R_LARCH_SOP_POP_32_S_0_10_10_16_S2"}, + {46, "R_LARCH_SOP_POP_32_U"}, + {47, "R_LARCH_ADD8"}, + {48, "R_LARCH_ADD16"}, + {49, "R_LARCH_ADD24"}, + {50, "R_LARCH_ADD32"}, + {51, "R_LARCH_ADD64"}, + {52, "R_LARCH_SUB8"}, + {53, "R_LARCH_SUB16"}, + {54, "R_LARCH_SUB24"}, + {55, "R_LARCH_SUB32"}, + {56, "R_LARCH_SUB64"}, + {57, "R_LARCH_GNU_VTINHERIT"}, + {58, "R_LARCH_GNU_VTENTRY"}, + {64, "R_LARCH_B16"}, + {65, "R_LARCH_B21"}, + {66, "R_LARCH_B26"}, + {67, "R_LARCH_ABS_HI20"}, + {68, "R_LARCH_ABS_LO12"}, + {69, "R_LARCH_ABS64_LO20"}, + {70, "R_LARCH_ABS64_HI12"}, + {71, "R_LARCH_PCALA_HI20"}, + {72, "R_LARCH_PCALA_LO12"}, + {73, "R_LARCH_PCALA64_LO20"}, + {74, "R_LARCH_PCALA64_HI12"}, + {75, "R_LARCH_GOT_PC_HI20"}, + {76, "R_LARCH_GOT_PC_LO12"}, + {77, "R_LARCH_GOT64_PC_LO20"}, + {78, "R_LARCH_GOT64_PC_HI12"}, + {79, "R_LARCH_GOT_HI20"}, + {80, "R_LARCH_GOT_LO12"}, + {81, "R_LARCH_GOT64_LO20"}, + {82, "R_LARCH_GOT64_HI12"}, + {83, "R_LARCH_TLS_LE_HI20"}, + {84, "R_LARCH_TLS_LE_LO12"}, + {85, "R_LARCH_TLS_LE64_LO20"}, + {86, "R_LARCH_TLS_LE64_HI12"}, + {87, "R_LARCH_TLS_IE_PC_HI20"}, + {88, "R_LARCH_TLS_IE_PC_LO12"}, + {89, "R_LARCH_TLS_IE64_PC_LO20"}, + {90, "R_LARCH_TLS_IE64_PC_HI12"}, + {91, "R_LARCH_TLS_IE_HI20"}, + {92, "R_LARCH_TLS_IE_LO12"}, + {93, "R_LARCH_TLS_IE64_LO20"}, + {94, "R_LARCH_TLS_IE64_HI12"}, + {95, "R_LARCH_TLS_LD_PC_HI20"}, + {96, "R_LARCH_TLS_LD_HI20"}, + {97, "R_LARCH_TLS_GD_PC_HI20"}, + {98, "R_LARCH_TLS_GD_HI20"}, + {99, "R_LARCH_32_PCREL"}, + {100, "R_LARCH_RELAX"}, + {101, "R_LARCH_DELETE"}, + {102, "R_LARCH_ALIGN"}, + {103, "R_LARCH_PCREL20_S2"}, + {104, "R_LARCH_CFA"}, + {105, "R_LARCH_ADD6"}, + {106, "R_LARCH_SUB6"}, + {107, "R_LARCH_ADD_ULEB128"}, + {108, "R_LARCH_SUB_ULEB128"}, + {109, "R_LARCH_64_PCREL"}, + {110, "R_LARCH_CALL36"}, + {111, "R_LARCH_TLS_DESC_PC_HI20"}, + {112, "R_LARCH_TLS_DESC_PC_LO12"}, + {113, "R_LARCH_TLS_DESC64_PC_LO20"}, + {114, "R_LARCH_TLS_DESC64_PC_HI12"}, + {115, "R_LARCH_TLS_DESC_HI20"}, + {116, "R_LARCH_TLS_DESC_LO12"}, + {117, "R_LARCH_TLS_DESC64_LO20"}, + {118, "R_LARCH_TLS_DESC64_HI12"}, + {119, "R_LARCH_TLS_DESC_LD"}, + {120, "R_LARCH_TLS_DESC_CALL"}, + {121, "R_LARCH_TLS_LE_HI20_R"}, + {122, "R_LARCH_TLS_LE_ADD_R"}, + {123, "R_LARCH_TLS_LE_LO12_R"}, + {124, "R_LARCH_TLS_LD_PCREL20_S2"}, + {125, "R_LARCH_TLS_GD_PCREL20_S2"}, + {126, "R_LARCH_TLS_DESC_PCREL20_S2"}, +} + +func (i R_LARCH) String() string { return stringName(uint32(i), rlarchStrings, false) } +func (i R_LARCH) GoString() string { return stringName(uint32(i), rlarchStrings, true) } + +// Relocation types for PowerPC. +// +// Values that are shared by both R_PPC and R_PPC64 are prefixed with +// R_POWERPC_ in the ELF standard. For the R_PPC type, the relevant +// shared relocations have been renamed with the prefix R_PPC_. +// The original name follows the value in a comment. +type R_PPC int + +const ( + R_PPC_NONE R_PPC = 0 // R_POWERPC_NONE + R_PPC_ADDR32 R_PPC = 1 // R_POWERPC_ADDR32 + R_PPC_ADDR24 R_PPC = 2 // R_POWERPC_ADDR24 + R_PPC_ADDR16 R_PPC = 3 // R_POWERPC_ADDR16 + R_PPC_ADDR16_LO R_PPC = 4 // R_POWERPC_ADDR16_LO + R_PPC_ADDR16_HI R_PPC = 5 // R_POWERPC_ADDR16_HI + R_PPC_ADDR16_HA R_PPC = 6 // R_POWERPC_ADDR16_HA + R_PPC_ADDR14 R_PPC = 7 // R_POWERPC_ADDR14 + R_PPC_ADDR14_BRTAKEN R_PPC = 8 // R_POWERPC_ADDR14_BRTAKEN + R_PPC_ADDR14_BRNTAKEN R_PPC = 9 // R_POWERPC_ADDR14_BRNTAKEN + R_PPC_REL24 R_PPC = 10 // R_POWERPC_REL24 + R_PPC_REL14 R_PPC = 11 // R_POWERPC_REL14 + R_PPC_REL14_BRTAKEN R_PPC = 12 // R_POWERPC_REL14_BRTAKEN + R_PPC_REL14_BRNTAKEN R_PPC = 13 // R_POWERPC_REL14_BRNTAKEN + R_PPC_GOT16 R_PPC = 14 // R_POWERPC_GOT16 + R_PPC_GOT16_LO R_PPC = 15 // R_POWERPC_GOT16_LO + R_PPC_GOT16_HI R_PPC = 16 // R_POWERPC_GOT16_HI + R_PPC_GOT16_HA R_PPC = 17 // R_POWERPC_GOT16_HA + R_PPC_PLTREL24 R_PPC = 18 + R_PPC_COPY R_PPC = 19 // R_POWERPC_COPY + R_PPC_GLOB_DAT R_PPC = 20 // R_POWERPC_GLOB_DAT + R_PPC_JMP_SLOT R_PPC = 21 // R_POWERPC_JMP_SLOT + R_PPC_RELATIVE R_PPC = 22 // R_POWERPC_RELATIVE + R_PPC_LOCAL24PC R_PPC = 23 + R_PPC_UADDR32 R_PPC = 24 // R_POWERPC_UADDR32 + R_PPC_UADDR16 R_PPC = 25 // R_POWERPC_UADDR16 + R_PPC_REL32 R_PPC = 26 // R_POWERPC_REL32 + R_PPC_PLT32 R_PPC = 27 // R_POWERPC_PLT32 + R_PPC_PLTREL32 R_PPC = 28 // R_POWERPC_PLTREL32 + R_PPC_PLT16_LO R_PPC = 29 // R_POWERPC_PLT16_LO + R_PPC_PLT16_HI R_PPC = 30 // R_POWERPC_PLT16_HI + R_PPC_PLT16_HA R_PPC = 31 // R_POWERPC_PLT16_HA + R_PPC_SDAREL16 R_PPC = 32 + R_PPC_SECTOFF R_PPC = 33 // R_POWERPC_SECTOFF + R_PPC_SECTOFF_LO R_PPC = 34 // R_POWERPC_SECTOFF_LO + R_PPC_SECTOFF_HI R_PPC = 35 // R_POWERPC_SECTOFF_HI + R_PPC_SECTOFF_HA R_PPC = 36 // R_POWERPC_SECTOFF_HA + R_PPC_TLS R_PPC = 67 // R_POWERPC_TLS + R_PPC_DTPMOD32 R_PPC = 68 // R_POWERPC_DTPMOD32 + R_PPC_TPREL16 R_PPC = 69 // R_POWERPC_TPREL16 + R_PPC_TPREL16_LO R_PPC = 70 // R_POWERPC_TPREL16_LO + R_PPC_TPREL16_HI R_PPC = 71 // R_POWERPC_TPREL16_HI + R_PPC_TPREL16_HA R_PPC = 72 // R_POWERPC_TPREL16_HA + R_PPC_TPREL32 R_PPC = 73 // R_POWERPC_TPREL32 + R_PPC_DTPREL16 R_PPC = 74 // R_POWERPC_DTPREL16 + R_PPC_DTPREL16_LO R_PPC = 75 // R_POWERPC_DTPREL16_LO + R_PPC_DTPREL16_HI R_PPC = 76 // R_POWERPC_DTPREL16_HI + R_PPC_DTPREL16_HA R_PPC = 77 // R_POWERPC_DTPREL16_HA + R_PPC_DTPREL32 R_PPC = 78 // R_POWERPC_DTPREL32 + R_PPC_GOT_TLSGD16 R_PPC = 79 // R_POWERPC_GOT_TLSGD16 + R_PPC_GOT_TLSGD16_LO R_PPC = 80 // R_POWERPC_GOT_TLSGD16_LO + R_PPC_GOT_TLSGD16_HI R_PPC = 81 // R_POWERPC_GOT_TLSGD16_HI + R_PPC_GOT_TLSGD16_HA R_PPC = 82 // R_POWERPC_GOT_TLSGD16_HA + R_PPC_GOT_TLSLD16 R_PPC = 83 // R_POWERPC_GOT_TLSLD16 + R_PPC_GOT_TLSLD16_LO R_PPC = 84 // R_POWERPC_GOT_TLSLD16_LO + R_PPC_GOT_TLSLD16_HI R_PPC = 85 // R_POWERPC_GOT_TLSLD16_HI + R_PPC_GOT_TLSLD16_HA R_PPC = 86 // R_POWERPC_GOT_TLSLD16_HA + R_PPC_GOT_TPREL16 R_PPC = 87 // R_POWERPC_GOT_TPREL16 + R_PPC_GOT_TPREL16_LO R_PPC = 88 // R_POWERPC_GOT_TPREL16_LO + R_PPC_GOT_TPREL16_HI R_PPC = 89 // R_POWERPC_GOT_TPREL16_HI + R_PPC_GOT_TPREL16_HA R_PPC = 90 // R_POWERPC_GOT_TPREL16_HA + R_PPC_EMB_NADDR32 R_PPC = 101 + R_PPC_EMB_NADDR16 R_PPC = 102 + R_PPC_EMB_NADDR16_LO R_PPC = 103 + R_PPC_EMB_NADDR16_HI R_PPC = 104 + R_PPC_EMB_NADDR16_HA R_PPC = 105 + R_PPC_EMB_SDAI16 R_PPC = 106 + R_PPC_EMB_SDA2I16 R_PPC = 107 + R_PPC_EMB_SDA2REL R_PPC = 108 + R_PPC_EMB_SDA21 R_PPC = 109 + R_PPC_EMB_MRKREF R_PPC = 110 + R_PPC_EMB_RELSEC16 R_PPC = 111 + R_PPC_EMB_RELST_LO R_PPC = 112 + R_PPC_EMB_RELST_HI R_PPC = 113 + R_PPC_EMB_RELST_HA R_PPC = 114 + R_PPC_EMB_BIT_FLD R_PPC = 115 + R_PPC_EMB_RELSDA R_PPC = 116 +) + +var rppcStrings = []intName{ + {0, "R_PPC_NONE"}, + {1, "R_PPC_ADDR32"}, + {2, "R_PPC_ADDR24"}, + {3, "R_PPC_ADDR16"}, + {4, "R_PPC_ADDR16_LO"}, + {5, "R_PPC_ADDR16_HI"}, + {6, "R_PPC_ADDR16_HA"}, + {7, "R_PPC_ADDR14"}, + {8, "R_PPC_ADDR14_BRTAKEN"}, + {9, "R_PPC_ADDR14_BRNTAKEN"}, + {10, "R_PPC_REL24"}, + {11, "R_PPC_REL14"}, + {12, "R_PPC_REL14_BRTAKEN"}, + {13, "R_PPC_REL14_BRNTAKEN"}, + {14, "R_PPC_GOT16"}, + {15, "R_PPC_GOT16_LO"}, + {16, "R_PPC_GOT16_HI"}, + {17, "R_PPC_GOT16_HA"}, + {18, "R_PPC_PLTREL24"}, + {19, "R_PPC_COPY"}, + {20, "R_PPC_GLOB_DAT"}, + {21, "R_PPC_JMP_SLOT"}, + {22, "R_PPC_RELATIVE"}, + {23, "R_PPC_LOCAL24PC"}, + {24, "R_PPC_UADDR32"}, + {25, "R_PPC_UADDR16"}, + {26, "R_PPC_REL32"}, + {27, "R_PPC_PLT32"}, + {28, "R_PPC_PLTREL32"}, + {29, "R_PPC_PLT16_LO"}, + {30, "R_PPC_PLT16_HI"}, + {31, "R_PPC_PLT16_HA"}, + {32, "R_PPC_SDAREL16"}, + {33, "R_PPC_SECTOFF"}, + {34, "R_PPC_SECTOFF_LO"}, + {35, "R_PPC_SECTOFF_HI"}, + {36, "R_PPC_SECTOFF_HA"}, + {67, "R_PPC_TLS"}, + {68, "R_PPC_DTPMOD32"}, + {69, "R_PPC_TPREL16"}, + {70, "R_PPC_TPREL16_LO"}, + {71, "R_PPC_TPREL16_HI"}, + {72, "R_PPC_TPREL16_HA"}, + {73, "R_PPC_TPREL32"}, + {74, "R_PPC_DTPREL16"}, + {75, "R_PPC_DTPREL16_LO"}, + {76, "R_PPC_DTPREL16_HI"}, + {77, "R_PPC_DTPREL16_HA"}, + {78, "R_PPC_DTPREL32"}, + {79, "R_PPC_GOT_TLSGD16"}, + {80, "R_PPC_GOT_TLSGD16_LO"}, + {81, "R_PPC_GOT_TLSGD16_HI"}, + {82, "R_PPC_GOT_TLSGD16_HA"}, + {83, "R_PPC_GOT_TLSLD16"}, + {84, "R_PPC_GOT_TLSLD16_LO"}, + {85, "R_PPC_GOT_TLSLD16_HI"}, + {86, "R_PPC_GOT_TLSLD16_HA"}, + {87, "R_PPC_GOT_TPREL16"}, + {88, "R_PPC_GOT_TPREL16_LO"}, + {89, "R_PPC_GOT_TPREL16_HI"}, + {90, "R_PPC_GOT_TPREL16_HA"}, + {101, "R_PPC_EMB_NADDR32"}, + {102, "R_PPC_EMB_NADDR16"}, + {103, "R_PPC_EMB_NADDR16_LO"}, + {104, "R_PPC_EMB_NADDR16_HI"}, + {105, "R_PPC_EMB_NADDR16_HA"}, + {106, "R_PPC_EMB_SDAI16"}, + {107, "R_PPC_EMB_SDA2I16"}, + {108, "R_PPC_EMB_SDA2REL"}, + {109, "R_PPC_EMB_SDA21"}, + {110, "R_PPC_EMB_MRKREF"}, + {111, "R_PPC_EMB_RELSEC16"}, + {112, "R_PPC_EMB_RELST_LO"}, + {113, "R_PPC_EMB_RELST_HI"}, + {114, "R_PPC_EMB_RELST_HA"}, + {115, "R_PPC_EMB_BIT_FLD"}, + {116, "R_PPC_EMB_RELSDA"}, +} + +func (i R_PPC) String() string { return stringName(uint32(i), rppcStrings, false) } +func (i R_PPC) GoString() string { return stringName(uint32(i), rppcStrings, true) } + +// Relocation types for 64-bit PowerPC or Power Architecture processors. +// +// Values that are shared by both R_PPC and R_PPC64 are prefixed with +// R_POWERPC_ in the ELF standard. For the R_PPC64 type, the relevant +// shared relocations have been renamed with the prefix R_PPC64_. +// The original name follows the value in a comment. +type R_PPC64 int + +const ( + R_PPC64_NONE R_PPC64 = 0 // R_POWERPC_NONE + R_PPC64_ADDR32 R_PPC64 = 1 // R_POWERPC_ADDR32 + R_PPC64_ADDR24 R_PPC64 = 2 // R_POWERPC_ADDR24 + R_PPC64_ADDR16 R_PPC64 = 3 // R_POWERPC_ADDR16 + R_PPC64_ADDR16_LO R_PPC64 = 4 // R_POWERPC_ADDR16_LO + R_PPC64_ADDR16_HI R_PPC64 = 5 // R_POWERPC_ADDR16_HI + R_PPC64_ADDR16_HA R_PPC64 = 6 // R_POWERPC_ADDR16_HA + R_PPC64_ADDR14 R_PPC64 = 7 // R_POWERPC_ADDR14 + R_PPC64_ADDR14_BRTAKEN R_PPC64 = 8 // R_POWERPC_ADDR14_BRTAKEN + R_PPC64_ADDR14_BRNTAKEN R_PPC64 = 9 // R_POWERPC_ADDR14_BRNTAKEN + R_PPC64_REL24 R_PPC64 = 10 // R_POWERPC_REL24 + R_PPC64_REL14 R_PPC64 = 11 // R_POWERPC_REL14 + R_PPC64_REL14_BRTAKEN R_PPC64 = 12 // R_POWERPC_REL14_BRTAKEN + R_PPC64_REL14_BRNTAKEN R_PPC64 = 13 // R_POWERPC_REL14_BRNTAKEN + R_PPC64_GOT16 R_PPC64 = 14 // R_POWERPC_GOT16 + R_PPC64_GOT16_LO R_PPC64 = 15 // R_POWERPC_GOT16_LO + R_PPC64_GOT16_HI R_PPC64 = 16 // R_POWERPC_GOT16_HI + R_PPC64_GOT16_HA R_PPC64 = 17 // R_POWERPC_GOT16_HA + R_PPC64_COPY R_PPC64 = 19 // R_POWERPC_COPY + R_PPC64_GLOB_DAT R_PPC64 = 20 // R_POWERPC_GLOB_DAT + R_PPC64_JMP_SLOT R_PPC64 = 21 // R_POWERPC_JMP_SLOT + R_PPC64_RELATIVE R_PPC64 = 22 // R_POWERPC_RELATIVE + R_PPC64_UADDR32 R_PPC64 = 24 // R_POWERPC_UADDR32 + R_PPC64_UADDR16 R_PPC64 = 25 // R_POWERPC_UADDR16 + R_PPC64_REL32 R_PPC64 = 26 // R_POWERPC_REL32 + R_PPC64_PLT32 R_PPC64 = 27 // R_POWERPC_PLT32 + R_PPC64_PLTREL32 R_PPC64 = 28 // R_POWERPC_PLTREL32 + R_PPC64_PLT16_LO R_PPC64 = 29 // R_POWERPC_PLT16_LO + R_PPC64_PLT16_HI R_PPC64 = 30 // R_POWERPC_PLT16_HI + R_PPC64_PLT16_HA R_PPC64 = 31 // R_POWERPC_PLT16_HA + R_PPC64_SECTOFF R_PPC64 = 33 // R_POWERPC_SECTOFF + R_PPC64_SECTOFF_LO R_PPC64 = 34 // R_POWERPC_SECTOFF_LO + R_PPC64_SECTOFF_HI R_PPC64 = 35 // R_POWERPC_SECTOFF_HI + R_PPC64_SECTOFF_HA R_PPC64 = 36 // R_POWERPC_SECTOFF_HA + R_PPC64_REL30 R_PPC64 = 37 // R_POWERPC_ADDR30 + R_PPC64_ADDR64 R_PPC64 = 38 + R_PPC64_ADDR16_HIGHER R_PPC64 = 39 + R_PPC64_ADDR16_HIGHERA R_PPC64 = 40 + R_PPC64_ADDR16_HIGHEST R_PPC64 = 41 + R_PPC64_ADDR16_HIGHESTA R_PPC64 = 42 + R_PPC64_UADDR64 R_PPC64 = 43 + R_PPC64_REL64 R_PPC64 = 44 + R_PPC64_PLT64 R_PPC64 = 45 + R_PPC64_PLTREL64 R_PPC64 = 46 + R_PPC64_TOC16 R_PPC64 = 47 + R_PPC64_TOC16_LO R_PPC64 = 48 + R_PPC64_TOC16_HI R_PPC64 = 49 + R_PPC64_TOC16_HA R_PPC64 = 50 + R_PPC64_TOC R_PPC64 = 51 + R_PPC64_PLTGOT16 R_PPC64 = 52 + R_PPC64_PLTGOT16_LO R_PPC64 = 53 + R_PPC64_PLTGOT16_HI R_PPC64 = 54 + R_PPC64_PLTGOT16_HA R_PPC64 = 55 + R_PPC64_ADDR16_DS R_PPC64 = 56 + R_PPC64_ADDR16_LO_DS R_PPC64 = 57 + R_PPC64_GOT16_DS R_PPC64 = 58 + R_PPC64_GOT16_LO_DS R_PPC64 = 59 + R_PPC64_PLT16_LO_DS R_PPC64 = 60 + R_PPC64_SECTOFF_DS R_PPC64 = 61 + R_PPC64_SECTOFF_LO_DS R_PPC64 = 62 + R_PPC64_TOC16_DS R_PPC64 = 63 + R_PPC64_TOC16_LO_DS R_PPC64 = 64 + R_PPC64_PLTGOT16_DS R_PPC64 = 65 + R_PPC64_PLTGOT_LO_DS R_PPC64 = 66 + R_PPC64_TLS R_PPC64 = 67 // R_POWERPC_TLS + R_PPC64_DTPMOD64 R_PPC64 = 68 // R_POWERPC_DTPMOD64 + R_PPC64_TPREL16 R_PPC64 = 69 // R_POWERPC_TPREL16 + R_PPC64_TPREL16_LO R_PPC64 = 70 // R_POWERPC_TPREL16_LO + R_PPC64_TPREL16_HI R_PPC64 = 71 // R_POWERPC_TPREL16_HI + R_PPC64_TPREL16_HA R_PPC64 = 72 // R_POWERPC_TPREL16_HA + R_PPC64_TPREL64 R_PPC64 = 73 // R_POWERPC_TPREL64 + R_PPC64_DTPREL16 R_PPC64 = 74 // R_POWERPC_DTPREL16 + R_PPC64_DTPREL16_LO R_PPC64 = 75 // R_POWERPC_DTPREL16_LO + R_PPC64_DTPREL16_HI R_PPC64 = 76 // R_POWERPC_DTPREL16_HI + R_PPC64_DTPREL16_HA R_PPC64 = 77 // R_POWERPC_DTPREL16_HA + R_PPC64_DTPREL64 R_PPC64 = 78 // R_POWERPC_DTPREL64 + R_PPC64_GOT_TLSGD16 R_PPC64 = 79 // R_POWERPC_GOT_TLSGD16 + R_PPC64_GOT_TLSGD16_LO R_PPC64 = 80 // R_POWERPC_GOT_TLSGD16_LO + R_PPC64_GOT_TLSGD16_HI R_PPC64 = 81 // R_POWERPC_GOT_TLSGD16_HI + R_PPC64_GOT_TLSGD16_HA R_PPC64 = 82 // R_POWERPC_GOT_TLSGD16_HA + R_PPC64_GOT_TLSLD16 R_PPC64 = 83 // R_POWERPC_GOT_TLSLD16 + R_PPC64_GOT_TLSLD16_LO R_PPC64 = 84 // R_POWERPC_GOT_TLSLD16_LO + R_PPC64_GOT_TLSLD16_HI R_PPC64 = 85 // R_POWERPC_GOT_TLSLD16_HI + R_PPC64_GOT_TLSLD16_HA R_PPC64 = 86 // R_POWERPC_GOT_TLSLD16_HA + R_PPC64_GOT_TPREL16_DS R_PPC64 = 87 // R_POWERPC_GOT_TPREL16_DS + R_PPC64_GOT_TPREL16_LO_DS R_PPC64 = 88 // R_POWERPC_GOT_TPREL16_LO_DS + R_PPC64_GOT_TPREL16_HI R_PPC64 = 89 // R_POWERPC_GOT_TPREL16_HI + R_PPC64_GOT_TPREL16_HA R_PPC64 = 90 // R_POWERPC_GOT_TPREL16_HA + R_PPC64_GOT_DTPREL16_DS R_PPC64 = 91 // R_POWERPC_GOT_DTPREL16_DS + R_PPC64_GOT_DTPREL16_LO_DS R_PPC64 = 92 // R_POWERPC_GOT_DTPREL16_LO_DS + R_PPC64_GOT_DTPREL16_HI R_PPC64 = 93 // R_POWERPC_GOT_DTPREL16_HI + R_PPC64_GOT_DTPREL16_HA R_PPC64 = 94 // R_POWERPC_GOT_DTPREL16_HA + R_PPC64_TPREL16_DS R_PPC64 = 95 + R_PPC64_TPREL16_LO_DS R_PPC64 = 96 + R_PPC64_TPREL16_HIGHER R_PPC64 = 97 + R_PPC64_TPREL16_HIGHERA R_PPC64 = 98 + R_PPC64_TPREL16_HIGHEST R_PPC64 = 99 + R_PPC64_TPREL16_HIGHESTA R_PPC64 = 100 + R_PPC64_DTPREL16_DS R_PPC64 = 101 + R_PPC64_DTPREL16_LO_DS R_PPC64 = 102 + R_PPC64_DTPREL16_HIGHER R_PPC64 = 103 + R_PPC64_DTPREL16_HIGHERA R_PPC64 = 104 + R_PPC64_DTPREL16_HIGHEST R_PPC64 = 105 + R_PPC64_DTPREL16_HIGHESTA R_PPC64 = 106 + R_PPC64_TLSGD R_PPC64 = 107 + R_PPC64_TLSLD R_PPC64 = 108 + R_PPC64_TOCSAVE R_PPC64 = 109 + R_PPC64_ADDR16_HIGH R_PPC64 = 110 + R_PPC64_ADDR16_HIGHA R_PPC64 = 111 + R_PPC64_TPREL16_HIGH R_PPC64 = 112 + R_PPC64_TPREL16_HIGHA R_PPC64 = 113 + R_PPC64_DTPREL16_HIGH R_PPC64 = 114 + R_PPC64_DTPREL16_HIGHA R_PPC64 = 115 + R_PPC64_REL24_NOTOC R_PPC64 = 116 + R_PPC64_ADDR64_LOCAL R_PPC64 = 117 + R_PPC64_ENTRY R_PPC64 = 118 + R_PPC64_PLTSEQ R_PPC64 = 119 + R_PPC64_PLTCALL R_PPC64 = 120 + R_PPC64_PLTSEQ_NOTOC R_PPC64 = 121 + R_PPC64_PLTCALL_NOTOC R_PPC64 = 122 + R_PPC64_PCREL_OPT R_PPC64 = 123 + R_PPC64_REL24_P9NOTOC R_PPC64 = 124 + R_PPC64_D34 R_PPC64 = 128 + R_PPC64_D34_LO R_PPC64 = 129 + R_PPC64_D34_HI30 R_PPC64 = 130 + R_PPC64_D34_HA30 R_PPC64 = 131 + R_PPC64_PCREL34 R_PPC64 = 132 + R_PPC64_GOT_PCREL34 R_PPC64 = 133 + R_PPC64_PLT_PCREL34 R_PPC64 = 134 + R_PPC64_PLT_PCREL34_NOTOC R_PPC64 = 135 + R_PPC64_ADDR16_HIGHER34 R_PPC64 = 136 + R_PPC64_ADDR16_HIGHERA34 R_PPC64 = 137 + R_PPC64_ADDR16_HIGHEST34 R_PPC64 = 138 + R_PPC64_ADDR16_HIGHESTA34 R_PPC64 = 139 + R_PPC64_REL16_HIGHER34 R_PPC64 = 140 + R_PPC64_REL16_HIGHERA34 R_PPC64 = 141 + R_PPC64_REL16_HIGHEST34 R_PPC64 = 142 + R_PPC64_REL16_HIGHESTA34 R_PPC64 = 143 + R_PPC64_D28 R_PPC64 = 144 + R_PPC64_PCREL28 R_PPC64 = 145 + R_PPC64_TPREL34 R_PPC64 = 146 + R_PPC64_DTPREL34 R_PPC64 = 147 + R_PPC64_GOT_TLSGD_PCREL34 R_PPC64 = 148 + R_PPC64_GOT_TLSLD_PCREL34 R_PPC64 = 149 + R_PPC64_GOT_TPREL_PCREL34 R_PPC64 = 150 + R_PPC64_GOT_DTPREL_PCREL34 R_PPC64 = 151 + R_PPC64_REL16_HIGH R_PPC64 = 240 + R_PPC64_REL16_HIGHA R_PPC64 = 241 + R_PPC64_REL16_HIGHER R_PPC64 = 242 + R_PPC64_REL16_HIGHERA R_PPC64 = 243 + R_PPC64_REL16_HIGHEST R_PPC64 = 244 + R_PPC64_REL16_HIGHESTA R_PPC64 = 245 + R_PPC64_REL16DX_HA R_PPC64 = 246 // R_POWERPC_REL16DX_HA + R_PPC64_JMP_IREL R_PPC64 = 247 + R_PPC64_IRELATIVE R_PPC64 = 248 // R_POWERPC_IRELATIVE + R_PPC64_REL16 R_PPC64 = 249 // R_POWERPC_REL16 + R_PPC64_REL16_LO R_PPC64 = 250 // R_POWERPC_REL16_LO + R_PPC64_REL16_HI R_PPC64 = 251 // R_POWERPC_REL16_HI + R_PPC64_REL16_HA R_PPC64 = 252 // R_POWERPC_REL16_HA + R_PPC64_GNU_VTINHERIT R_PPC64 = 253 + R_PPC64_GNU_VTENTRY R_PPC64 = 254 +) + +var rppc64Strings = []intName{ + {0, "R_PPC64_NONE"}, + {1, "R_PPC64_ADDR32"}, + {2, "R_PPC64_ADDR24"}, + {3, "R_PPC64_ADDR16"}, + {4, "R_PPC64_ADDR16_LO"}, + {5, "R_PPC64_ADDR16_HI"}, + {6, "R_PPC64_ADDR16_HA"}, + {7, "R_PPC64_ADDR14"}, + {8, "R_PPC64_ADDR14_BRTAKEN"}, + {9, "R_PPC64_ADDR14_BRNTAKEN"}, + {10, "R_PPC64_REL24"}, + {11, "R_PPC64_REL14"}, + {12, "R_PPC64_REL14_BRTAKEN"}, + {13, "R_PPC64_REL14_BRNTAKEN"}, + {14, "R_PPC64_GOT16"}, + {15, "R_PPC64_GOT16_LO"}, + {16, "R_PPC64_GOT16_HI"}, + {17, "R_PPC64_GOT16_HA"}, + {19, "R_PPC64_COPY"}, + {20, "R_PPC64_GLOB_DAT"}, + {21, "R_PPC64_JMP_SLOT"}, + {22, "R_PPC64_RELATIVE"}, + {24, "R_PPC64_UADDR32"}, + {25, "R_PPC64_UADDR16"}, + {26, "R_PPC64_REL32"}, + {27, "R_PPC64_PLT32"}, + {28, "R_PPC64_PLTREL32"}, + {29, "R_PPC64_PLT16_LO"}, + {30, "R_PPC64_PLT16_HI"}, + {31, "R_PPC64_PLT16_HA"}, + {33, "R_PPC64_SECTOFF"}, + {34, "R_PPC64_SECTOFF_LO"}, + {35, "R_PPC64_SECTOFF_HI"}, + {36, "R_PPC64_SECTOFF_HA"}, + {37, "R_PPC64_REL30"}, + {38, "R_PPC64_ADDR64"}, + {39, "R_PPC64_ADDR16_HIGHER"}, + {40, "R_PPC64_ADDR16_HIGHERA"}, + {41, "R_PPC64_ADDR16_HIGHEST"}, + {42, "R_PPC64_ADDR16_HIGHESTA"}, + {43, "R_PPC64_UADDR64"}, + {44, "R_PPC64_REL64"}, + {45, "R_PPC64_PLT64"}, + {46, "R_PPC64_PLTREL64"}, + {47, "R_PPC64_TOC16"}, + {48, "R_PPC64_TOC16_LO"}, + {49, "R_PPC64_TOC16_HI"}, + {50, "R_PPC64_TOC16_HA"}, + {51, "R_PPC64_TOC"}, + {52, "R_PPC64_PLTGOT16"}, + {53, "R_PPC64_PLTGOT16_LO"}, + {54, "R_PPC64_PLTGOT16_HI"}, + {55, "R_PPC64_PLTGOT16_HA"}, + {56, "R_PPC64_ADDR16_DS"}, + {57, "R_PPC64_ADDR16_LO_DS"}, + {58, "R_PPC64_GOT16_DS"}, + {59, "R_PPC64_GOT16_LO_DS"}, + {60, "R_PPC64_PLT16_LO_DS"}, + {61, "R_PPC64_SECTOFF_DS"}, + {62, "R_PPC64_SECTOFF_LO_DS"}, + {63, "R_PPC64_TOC16_DS"}, + {64, "R_PPC64_TOC16_LO_DS"}, + {65, "R_PPC64_PLTGOT16_DS"}, + {66, "R_PPC64_PLTGOT_LO_DS"}, + {67, "R_PPC64_TLS"}, + {68, "R_PPC64_DTPMOD64"}, + {69, "R_PPC64_TPREL16"}, + {70, "R_PPC64_TPREL16_LO"}, + {71, "R_PPC64_TPREL16_HI"}, + {72, "R_PPC64_TPREL16_HA"}, + {73, "R_PPC64_TPREL64"}, + {74, "R_PPC64_DTPREL16"}, + {75, "R_PPC64_DTPREL16_LO"}, + {76, "R_PPC64_DTPREL16_HI"}, + {77, "R_PPC64_DTPREL16_HA"}, + {78, "R_PPC64_DTPREL64"}, + {79, "R_PPC64_GOT_TLSGD16"}, + {80, "R_PPC64_GOT_TLSGD16_LO"}, + {81, "R_PPC64_GOT_TLSGD16_HI"}, + {82, "R_PPC64_GOT_TLSGD16_HA"}, + {83, "R_PPC64_GOT_TLSLD16"}, + {84, "R_PPC64_GOT_TLSLD16_LO"}, + {85, "R_PPC64_GOT_TLSLD16_HI"}, + {86, "R_PPC64_GOT_TLSLD16_HA"}, + {87, "R_PPC64_GOT_TPREL16_DS"}, + {88, "R_PPC64_GOT_TPREL16_LO_DS"}, + {89, "R_PPC64_GOT_TPREL16_HI"}, + {90, "R_PPC64_GOT_TPREL16_HA"}, + {91, "R_PPC64_GOT_DTPREL16_DS"}, + {92, "R_PPC64_GOT_DTPREL16_LO_DS"}, + {93, "R_PPC64_GOT_DTPREL16_HI"}, + {94, "R_PPC64_GOT_DTPREL16_HA"}, + {95, "R_PPC64_TPREL16_DS"}, + {96, "R_PPC64_TPREL16_LO_DS"}, + {97, "R_PPC64_TPREL16_HIGHER"}, + {98, "R_PPC64_TPREL16_HIGHERA"}, + {99, "R_PPC64_TPREL16_HIGHEST"}, + {100, "R_PPC64_TPREL16_HIGHESTA"}, + {101, "R_PPC64_DTPREL16_DS"}, + {102, "R_PPC64_DTPREL16_LO_DS"}, + {103, "R_PPC64_DTPREL16_HIGHER"}, + {104, "R_PPC64_DTPREL16_HIGHERA"}, + {105, "R_PPC64_DTPREL16_HIGHEST"}, + {106, "R_PPC64_DTPREL16_HIGHESTA"}, + {107, "R_PPC64_TLSGD"}, + {108, "R_PPC64_TLSLD"}, + {109, "R_PPC64_TOCSAVE"}, + {110, "R_PPC64_ADDR16_HIGH"}, + {111, "R_PPC64_ADDR16_HIGHA"}, + {112, "R_PPC64_TPREL16_HIGH"}, + {113, "R_PPC64_TPREL16_HIGHA"}, + {114, "R_PPC64_DTPREL16_HIGH"}, + {115, "R_PPC64_DTPREL16_HIGHA"}, + {116, "R_PPC64_REL24_NOTOC"}, + {117, "R_PPC64_ADDR64_LOCAL"}, + {118, "R_PPC64_ENTRY"}, + {119, "R_PPC64_PLTSEQ"}, + {120, "R_PPC64_PLTCALL"}, + {121, "R_PPC64_PLTSEQ_NOTOC"}, + {122, "R_PPC64_PLTCALL_NOTOC"}, + {123, "R_PPC64_PCREL_OPT"}, + {124, "R_PPC64_REL24_P9NOTOC"}, + {128, "R_PPC64_D34"}, + {129, "R_PPC64_D34_LO"}, + {130, "R_PPC64_D34_HI30"}, + {131, "R_PPC64_D34_HA30"}, + {132, "R_PPC64_PCREL34"}, + {133, "R_PPC64_GOT_PCREL34"}, + {134, "R_PPC64_PLT_PCREL34"}, + {135, "R_PPC64_PLT_PCREL34_NOTOC"}, + {136, "R_PPC64_ADDR16_HIGHER34"}, + {137, "R_PPC64_ADDR16_HIGHERA34"}, + {138, "R_PPC64_ADDR16_HIGHEST34"}, + {139, "R_PPC64_ADDR16_HIGHESTA34"}, + {140, "R_PPC64_REL16_HIGHER34"}, + {141, "R_PPC64_REL16_HIGHERA34"}, + {142, "R_PPC64_REL16_HIGHEST34"}, + {143, "R_PPC64_REL16_HIGHESTA34"}, + {144, "R_PPC64_D28"}, + {145, "R_PPC64_PCREL28"}, + {146, "R_PPC64_TPREL34"}, + {147, "R_PPC64_DTPREL34"}, + {148, "R_PPC64_GOT_TLSGD_PCREL34"}, + {149, "R_PPC64_GOT_TLSLD_PCREL34"}, + {150, "R_PPC64_GOT_TPREL_PCREL34"}, + {151, "R_PPC64_GOT_DTPREL_PCREL34"}, + {240, "R_PPC64_REL16_HIGH"}, + {241, "R_PPC64_REL16_HIGHA"}, + {242, "R_PPC64_REL16_HIGHER"}, + {243, "R_PPC64_REL16_HIGHERA"}, + {244, "R_PPC64_REL16_HIGHEST"}, + {245, "R_PPC64_REL16_HIGHESTA"}, + {246, "R_PPC64_REL16DX_HA"}, + {247, "R_PPC64_JMP_IREL"}, + {248, "R_PPC64_IRELATIVE"}, + {249, "R_PPC64_REL16"}, + {250, "R_PPC64_REL16_LO"}, + {251, "R_PPC64_REL16_HI"}, + {252, "R_PPC64_REL16_HA"}, + {253, "R_PPC64_GNU_VTINHERIT"}, + {254, "R_PPC64_GNU_VTENTRY"}, +} + +func (i R_PPC64) String() string { return stringName(uint32(i), rppc64Strings, false) } +func (i R_PPC64) GoString() string { return stringName(uint32(i), rppc64Strings, true) } + +// Relocation types for RISC-V processors. +type R_RISCV int + +const ( + R_RISCV_NONE R_RISCV = 0 /* No relocation. */ + R_RISCV_32 R_RISCV = 1 /* Add 32 bit zero extended symbol value */ + R_RISCV_64 R_RISCV = 2 /* Add 64 bit symbol value. */ + R_RISCV_RELATIVE R_RISCV = 3 /* Add load address of shared object. */ + R_RISCV_COPY R_RISCV = 4 /* Copy data from shared object. */ + R_RISCV_JUMP_SLOT R_RISCV = 5 /* Set GOT entry to code address. */ + R_RISCV_TLS_DTPMOD32 R_RISCV = 6 /* 32 bit ID of module containing symbol */ + R_RISCV_TLS_DTPMOD64 R_RISCV = 7 /* ID of module containing symbol */ + R_RISCV_TLS_DTPREL32 R_RISCV = 8 /* 32 bit relative offset in TLS block */ + R_RISCV_TLS_DTPREL64 R_RISCV = 9 /* Relative offset in TLS block */ + R_RISCV_TLS_TPREL32 R_RISCV = 10 /* 32 bit relative offset in static TLS block */ + R_RISCV_TLS_TPREL64 R_RISCV = 11 /* Relative offset in static TLS block */ + R_RISCV_BRANCH R_RISCV = 16 /* PC-relative branch */ + R_RISCV_JAL R_RISCV = 17 /* PC-relative jump */ + R_RISCV_CALL R_RISCV = 18 /* PC-relative call */ + R_RISCV_CALL_PLT R_RISCV = 19 /* PC-relative call (PLT) */ + R_RISCV_GOT_HI20 R_RISCV = 20 /* PC-relative GOT reference */ + R_RISCV_TLS_GOT_HI20 R_RISCV = 21 /* PC-relative TLS IE GOT offset */ + R_RISCV_TLS_GD_HI20 R_RISCV = 22 /* PC-relative TLS GD reference */ + R_RISCV_PCREL_HI20 R_RISCV = 23 /* PC-relative reference */ + R_RISCV_PCREL_LO12_I R_RISCV = 24 /* PC-relative reference */ + R_RISCV_PCREL_LO12_S R_RISCV = 25 /* PC-relative reference */ + R_RISCV_HI20 R_RISCV = 26 /* Absolute address */ + R_RISCV_LO12_I R_RISCV = 27 /* Absolute address */ + R_RISCV_LO12_S R_RISCV = 28 /* Absolute address */ + R_RISCV_TPREL_HI20 R_RISCV = 29 /* TLS LE thread offset */ + R_RISCV_TPREL_LO12_I R_RISCV = 30 /* TLS LE thread offset */ + R_RISCV_TPREL_LO12_S R_RISCV = 31 /* TLS LE thread offset */ + R_RISCV_TPREL_ADD R_RISCV = 32 /* TLS LE thread usage */ + R_RISCV_ADD8 R_RISCV = 33 /* 8-bit label addition */ + R_RISCV_ADD16 R_RISCV = 34 /* 16-bit label addition */ + R_RISCV_ADD32 R_RISCV = 35 /* 32-bit label addition */ + R_RISCV_ADD64 R_RISCV = 36 /* 64-bit label addition */ + R_RISCV_SUB8 R_RISCV = 37 /* 8-bit label subtraction */ + R_RISCV_SUB16 R_RISCV = 38 /* 16-bit label subtraction */ + R_RISCV_SUB32 R_RISCV = 39 /* 32-bit label subtraction */ + R_RISCV_SUB64 R_RISCV = 40 /* 64-bit label subtraction */ + R_RISCV_GNU_VTINHERIT R_RISCV = 41 /* GNU C++ vtable hierarchy */ + R_RISCV_GNU_VTENTRY R_RISCV = 42 /* GNU C++ vtable member usage */ + R_RISCV_ALIGN R_RISCV = 43 /* Alignment statement */ + R_RISCV_RVC_BRANCH R_RISCV = 44 /* PC-relative branch offset */ + R_RISCV_RVC_JUMP R_RISCV = 45 /* PC-relative jump offset */ + R_RISCV_RVC_LUI R_RISCV = 46 /* Absolute address */ + R_RISCV_GPREL_I R_RISCV = 47 /* GP-relative reference */ + R_RISCV_GPREL_S R_RISCV = 48 /* GP-relative reference */ + R_RISCV_TPREL_I R_RISCV = 49 /* TP-relative TLS LE load */ + R_RISCV_TPREL_S R_RISCV = 50 /* TP-relative TLS LE store */ + R_RISCV_RELAX R_RISCV = 51 /* Instruction pair can be relaxed */ + R_RISCV_SUB6 R_RISCV = 52 /* Local label subtraction */ + R_RISCV_SET6 R_RISCV = 53 /* Local label subtraction */ + R_RISCV_SET8 R_RISCV = 54 /* Local label subtraction */ + R_RISCV_SET16 R_RISCV = 55 /* Local label subtraction */ + R_RISCV_SET32 R_RISCV = 56 /* Local label subtraction */ + R_RISCV_32_PCREL R_RISCV = 57 /* 32-bit PC relative */ +) + +var rriscvStrings = []intName{ + {0, "R_RISCV_NONE"}, + {1, "R_RISCV_32"}, + {2, "R_RISCV_64"}, + {3, "R_RISCV_RELATIVE"}, + {4, "R_RISCV_COPY"}, + {5, "R_RISCV_JUMP_SLOT"}, + {6, "R_RISCV_TLS_DTPMOD32"}, + {7, "R_RISCV_TLS_DTPMOD64"}, + {8, "R_RISCV_TLS_DTPREL32"}, + {9, "R_RISCV_TLS_DTPREL64"}, + {10, "R_RISCV_TLS_TPREL32"}, + {11, "R_RISCV_TLS_TPREL64"}, + {16, "R_RISCV_BRANCH"}, + {17, "R_RISCV_JAL"}, + {18, "R_RISCV_CALL"}, + {19, "R_RISCV_CALL_PLT"}, + {20, "R_RISCV_GOT_HI20"}, + {21, "R_RISCV_TLS_GOT_HI20"}, + {22, "R_RISCV_TLS_GD_HI20"}, + {23, "R_RISCV_PCREL_HI20"}, + {24, "R_RISCV_PCREL_LO12_I"}, + {25, "R_RISCV_PCREL_LO12_S"}, + {26, "R_RISCV_HI20"}, + {27, "R_RISCV_LO12_I"}, + {28, "R_RISCV_LO12_S"}, + {29, "R_RISCV_TPREL_HI20"}, + {30, "R_RISCV_TPREL_LO12_I"}, + {31, "R_RISCV_TPREL_LO12_S"}, + {32, "R_RISCV_TPREL_ADD"}, + {33, "R_RISCV_ADD8"}, + {34, "R_RISCV_ADD16"}, + {35, "R_RISCV_ADD32"}, + {36, "R_RISCV_ADD64"}, + {37, "R_RISCV_SUB8"}, + {38, "R_RISCV_SUB16"}, + {39, "R_RISCV_SUB32"}, + {40, "R_RISCV_SUB64"}, + {41, "R_RISCV_GNU_VTINHERIT"}, + {42, "R_RISCV_GNU_VTENTRY"}, + {43, "R_RISCV_ALIGN"}, + {44, "R_RISCV_RVC_BRANCH"}, + {45, "R_RISCV_RVC_JUMP"}, + {46, "R_RISCV_RVC_LUI"}, + {47, "R_RISCV_GPREL_I"}, + {48, "R_RISCV_GPREL_S"}, + {49, "R_RISCV_TPREL_I"}, + {50, "R_RISCV_TPREL_S"}, + {51, "R_RISCV_RELAX"}, + {52, "R_RISCV_SUB6"}, + {53, "R_RISCV_SET6"}, + {54, "R_RISCV_SET8"}, + {55, "R_RISCV_SET16"}, + {56, "R_RISCV_SET32"}, + {57, "R_RISCV_32_PCREL"}, +} + +func (i R_RISCV) String() string { return stringName(uint32(i), rriscvStrings, false) } +func (i R_RISCV) GoString() string { return stringName(uint32(i), rriscvStrings, true) } + +// Relocation types for s390x processors. +type R_390 int + +const ( + R_390_NONE R_390 = 0 + R_390_8 R_390 = 1 + R_390_12 R_390 = 2 + R_390_16 R_390 = 3 + R_390_32 R_390 = 4 + R_390_PC32 R_390 = 5 + R_390_GOT12 R_390 = 6 + R_390_GOT32 R_390 = 7 + R_390_PLT32 R_390 = 8 + R_390_COPY R_390 = 9 + R_390_GLOB_DAT R_390 = 10 + R_390_JMP_SLOT R_390 = 11 + R_390_RELATIVE R_390 = 12 + R_390_GOTOFF R_390 = 13 + R_390_GOTPC R_390 = 14 + R_390_GOT16 R_390 = 15 + R_390_PC16 R_390 = 16 + R_390_PC16DBL R_390 = 17 + R_390_PLT16DBL R_390 = 18 + R_390_PC32DBL R_390 = 19 + R_390_PLT32DBL R_390 = 20 + R_390_GOTPCDBL R_390 = 21 + R_390_64 R_390 = 22 + R_390_PC64 R_390 = 23 + R_390_GOT64 R_390 = 24 + R_390_PLT64 R_390 = 25 + R_390_GOTENT R_390 = 26 + R_390_GOTOFF16 R_390 = 27 + R_390_GOTOFF64 R_390 = 28 + R_390_GOTPLT12 R_390 = 29 + R_390_GOTPLT16 R_390 = 30 + R_390_GOTPLT32 R_390 = 31 + R_390_GOTPLT64 R_390 = 32 + R_390_GOTPLTENT R_390 = 33 + R_390_GOTPLTOFF16 R_390 = 34 + R_390_GOTPLTOFF32 R_390 = 35 + R_390_GOTPLTOFF64 R_390 = 36 + R_390_TLS_LOAD R_390 = 37 + R_390_TLS_GDCALL R_390 = 38 + R_390_TLS_LDCALL R_390 = 39 + R_390_TLS_GD32 R_390 = 40 + R_390_TLS_GD64 R_390 = 41 + R_390_TLS_GOTIE12 R_390 = 42 + R_390_TLS_GOTIE32 R_390 = 43 + R_390_TLS_GOTIE64 R_390 = 44 + R_390_TLS_LDM32 R_390 = 45 + R_390_TLS_LDM64 R_390 = 46 + R_390_TLS_IE32 R_390 = 47 + R_390_TLS_IE64 R_390 = 48 + R_390_TLS_IEENT R_390 = 49 + R_390_TLS_LE32 R_390 = 50 + R_390_TLS_LE64 R_390 = 51 + R_390_TLS_LDO32 R_390 = 52 + R_390_TLS_LDO64 R_390 = 53 + R_390_TLS_DTPMOD R_390 = 54 + R_390_TLS_DTPOFF R_390 = 55 + R_390_TLS_TPOFF R_390 = 56 + R_390_20 R_390 = 57 + R_390_GOT20 R_390 = 58 + R_390_GOTPLT20 R_390 = 59 + R_390_TLS_GOTIE20 R_390 = 60 +) + +var r390Strings = []intName{ + {0, "R_390_NONE"}, + {1, "R_390_8"}, + {2, "R_390_12"}, + {3, "R_390_16"}, + {4, "R_390_32"}, + {5, "R_390_PC32"}, + {6, "R_390_GOT12"}, + {7, "R_390_GOT32"}, + {8, "R_390_PLT32"}, + {9, "R_390_COPY"}, + {10, "R_390_GLOB_DAT"}, + {11, "R_390_JMP_SLOT"}, + {12, "R_390_RELATIVE"}, + {13, "R_390_GOTOFF"}, + {14, "R_390_GOTPC"}, + {15, "R_390_GOT16"}, + {16, "R_390_PC16"}, + {17, "R_390_PC16DBL"}, + {18, "R_390_PLT16DBL"}, + {19, "R_390_PC32DBL"}, + {20, "R_390_PLT32DBL"}, + {21, "R_390_GOTPCDBL"}, + {22, "R_390_64"}, + {23, "R_390_PC64"}, + {24, "R_390_GOT64"}, + {25, "R_390_PLT64"}, + {26, "R_390_GOTENT"}, + {27, "R_390_GOTOFF16"}, + {28, "R_390_GOTOFF64"}, + {29, "R_390_GOTPLT12"}, + {30, "R_390_GOTPLT16"}, + {31, "R_390_GOTPLT32"}, + {32, "R_390_GOTPLT64"}, + {33, "R_390_GOTPLTENT"}, + {34, "R_390_GOTPLTOFF16"}, + {35, "R_390_GOTPLTOFF32"}, + {36, "R_390_GOTPLTOFF64"}, + {37, "R_390_TLS_LOAD"}, + {38, "R_390_TLS_GDCALL"}, + {39, "R_390_TLS_LDCALL"}, + {40, "R_390_TLS_GD32"}, + {41, "R_390_TLS_GD64"}, + {42, "R_390_TLS_GOTIE12"}, + {43, "R_390_TLS_GOTIE32"}, + {44, "R_390_TLS_GOTIE64"}, + {45, "R_390_TLS_LDM32"}, + {46, "R_390_TLS_LDM64"}, + {47, "R_390_TLS_IE32"}, + {48, "R_390_TLS_IE64"}, + {49, "R_390_TLS_IEENT"}, + {50, "R_390_TLS_LE32"}, + {51, "R_390_TLS_LE64"}, + {52, "R_390_TLS_LDO32"}, + {53, "R_390_TLS_LDO64"}, + {54, "R_390_TLS_DTPMOD"}, + {55, "R_390_TLS_DTPOFF"}, + {56, "R_390_TLS_TPOFF"}, + {57, "R_390_20"}, + {58, "R_390_GOT20"}, + {59, "R_390_GOTPLT20"}, + {60, "R_390_TLS_GOTIE20"}, +} + +func (i R_390) String() string { return stringName(uint32(i), r390Strings, false) } +func (i R_390) GoString() string { return stringName(uint32(i), r390Strings, true) } + +// Relocation types for SPARC. +type R_SPARC int + +const ( + R_SPARC_NONE R_SPARC = 0 + R_SPARC_8 R_SPARC = 1 + R_SPARC_16 R_SPARC = 2 + R_SPARC_32 R_SPARC = 3 + R_SPARC_DISP8 R_SPARC = 4 + R_SPARC_DISP16 R_SPARC = 5 + R_SPARC_DISP32 R_SPARC = 6 + R_SPARC_WDISP30 R_SPARC = 7 + R_SPARC_WDISP22 R_SPARC = 8 + R_SPARC_HI22 R_SPARC = 9 + R_SPARC_22 R_SPARC = 10 + R_SPARC_13 R_SPARC = 11 + R_SPARC_LO10 R_SPARC = 12 + R_SPARC_GOT10 R_SPARC = 13 + R_SPARC_GOT13 R_SPARC = 14 + R_SPARC_GOT22 R_SPARC = 15 + R_SPARC_PC10 R_SPARC = 16 + R_SPARC_PC22 R_SPARC = 17 + R_SPARC_WPLT30 R_SPARC = 18 + R_SPARC_COPY R_SPARC = 19 + R_SPARC_GLOB_DAT R_SPARC = 20 + R_SPARC_JMP_SLOT R_SPARC = 21 + R_SPARC_RELATIVE R_SPARC = 22 + R_SPARC_UA32 R_SPARC = 23 + R_SPARC_PLT32 R_SPARC = 24 + R_SPARC_HIPLT22 R_SPARC = 25 + R_SPARC_LOPLT10 R_SPARC = 26 + R_SPARC_PCPLT32 R_SPARC = 27 + R_SPARC_PCPLT22 R_SPARC = 28 + R_SPARC_PCPLT10 R_SPARC = 29 + R_SPARC_10 R_SPARC = 30 + R_SPARC_11 R_SPARC = 31 + R_SPARC_64 R_SPARC = 32 + R_SPARC_OLO10 R_SPARC = 33 + R_SPARC_HH22 R_SPARC = 34 + R_SPARC_HM10 R_SPARC = 35 + R_SPARC_LM22 R_SPARC = 36 + R_SPARC_PC_HH22 R_SPARC = 37 + R_SPARC_PC_HM10 R_SPARC = 38 + R_SPARC_PC_LM22 R_SPARC = 39 + R_SPARC_WDISP16 R_SPARC = 40 + R_SPARC_WDISP19 R_SPARC = 41 + R_SPARC_GLOB_JMP R_SPARC = 42 + R_SPARC_7 R_SPARC = 43 + R_SPARC_5 R_SPARC = 44 + R_SPARC_6 R_SPARC = 45 + R_SPARC_DISP64 R_SPARC = 46 + R_SPARC_PLT64 R_SPARC = 47 + R_SPARC_HIX22 R_SPARC = 48 + R_SPARC_LOX10 R_SPARC = 49 + R_SPARC_H44 R_SPARC = 50 + R_SPARC_M44 R_SPARC = 51 + R_SPARC_L44 R_SPARC = 52 + R_SPARC_REGISTER R_SPARC = 53 + R_SPARC_UA64 R_SPARC = 54 + R_SPARC_UA16 R_SPARC = 55 +) + +var rsparcStrings = []intName{ + {0, "R_SPARC_NONE"}, + {1, "R_SPARC_8"}, + {2, "R_SPARC_16"}, + {3, "R_SPARC_32"}, + {4, "R_SPARC_DISP8"}, + {5, "R_SPARC_DISP16"}, + {6, "R_SPARC_DISP32"}, + {7, "R_SPARC_WDISP30"}, + {8, "R_SPARC_WDISP22"}, + {9, "R_SPARC_HI22"}, + {10, "R_SPARC_22"}, + {11, "R_SPARC_13"}, + {12, "R_SPARC_LO10"}, + {13, "R_SPARC_GOT10"}, + {14, "R_SPARC_GOT13"}, + {15, "R_SPARC_GOT22"}, + {16, "R_SPARC_PC10"}, + {17, "R_SPARC_PC22"}, + {18, "R_SPARC_WPLT30"}, + {19, "R_SPARC_COPY"}, + {20, "R_SPARC_GLOB_DAT"}, + {21, "R_SPARC_JMP_SLOT"}, + {22, "R_SPARC_RELATIVE"}, + {23, "R_SPARC_UA32"}, + {24, "R_SPARC_PLT32"}, + {25, "R_SPARC_HIPLT22"}, + {26, "R_SPARC_LOPLT10"}, + {27, "R_SPARC_PCPLT32"}, + {28, "R_SPARC_PCPLT22"}, + {29, "R_SPARC_PCPLT10"}, + {30, "R_SPARC_10"}, + {31, "R_SPARC_11"}, + {32, "R_SPARC_64"}, + {33, "R_SPARC_OLO10"}, + {34, "R_SPARC_HH22"}, + {35, "R_SPARC_HM10"}, + {36, "R_SPARC_LM22"}, + {37, "R_SPARC_PC_HH22"}, + {38, "R_SPARC_PC_HM10"}, + {39, "R_SPARC_PC_LM22"}, + {40, "R_SPARC_WDISP16"}, + {41, "R_SPARC_WDISP19"}, + {42, "R_SPARC_GLOB_JMP"}, + {43, "R_SPARC_7"}, + {44, "R_SPARC_5"}, + {45, "R_SPARC_6"}, + {46, "R_SPARC_DISP64"}, + {47, "R_SPARC_PLT64"}, + {48, "R_SPARC_HIX22"}, + {49, "R_SPARC_LOX10"}, + {50, "R_SPARC_H44"}, + {51, "R_SPARC_M44"}, + {52, "R_SPARC_L44"}, + {53, "R_SPARC_REGISTER"}, + {54, "R_SPARC_UA64"}, + {55, "R_SPARC_UA16"}, +} + +func (i R_SPARC) String() string { return stringName(uint32(i), rsparcStrings, false) } +func (i R_SPARC) GoString() string { return stringName(uint32(i), rsparcStrings, true) } + +// Magic number for the elf trampoline, chosen wisely to be an immediate value. +const ARM_MAGIC_TRAMP_NUMBER = 0x5c000003 + +// ELF32 File header. +type Header32 struct { + Ident [EI_NIDENT]byte /* File identification. */ + Type uint16 /* File type. */ + Machine uint16 /* Machine architecture. */ + Version uint32 /* ELF format version. */ + Entry uint32 /* Entry point. */ + Phoff uint32 /* Program header file offset. */ + Shoff uint32 /* Section header file offset. */ + Flags uint32 /* Architecture-specific flags. */ + Ehsize uint16 /* Size of ELF header in bytes. */ + Phentsize uint16 /* Size of program header entry. */ + Phnum uint16 /* Number of program header entries. */ + Shentsize uint16 /* Size of section header entry. */ + Shnum uint16 /* Number of section header entries. */ + Shstrndx uint16 /* Section name strings section. */ +} + +// ELF32 Section header. +type Section32 struct { + Name uint32 /* Section name (index into the section header string table). */ + Type uint32 /* Section type. */ + Flags uint32 /* Section flags. */ + Addr uint32 /* Address in memory image. */ + Off uint32 /* Offset in file. */ + Size uint32 /* Size in bytes. */ + Link uint32 /* Index of a related section. */ + Info uint32 /* Depends on section type. */ + Addralign uint32 /* Alignment in bytes. */ + Entsize uint32 /* Size of each entry in section. */ +} + +// ELF32 Program header. +type Prog32 struct { + Type uint32 /* Entry type. */ + Off uint32 /* File offset of contents. */ + Vaddr uint32 /* Virtual address in memory image. */ + Paddr uint32 /* Physical address (not used). */ + Filesz uint32 /* Size of contents in file. */ + Memsz uint32 /* Size of contents in memory. */ + Flags uint32 /* Access permission flags. */ + Align uint32 /* Alignment in memory and file. */ +} + +// ELF32 Dynamic structure. The ".dynamic" section contains an array of them. +type Dyn32 struct { + Tag int32 /* Entry type. */ + Val uint32 /* Integer/Address value. */ +} + +// ELF32 Compression header. +type Chdr32 struct { + Type uint32 + Size uint32 + Addralign uint32 +} + +/* + * Relocation entries. + */ + +// ELF32 Relocations that don't need an addend field. +type Rel32 struct { + Off uint32 /* Location to be relocated. */ + Info uint32 /* Relocation type and symbol index. */ +} + +// ELF32 Relocations that need an addend field. +type Rela32 struct { + Off uint32 /* Location to be relocated. */ + Info uint32 /* Relocation type and symbol index. */ + Addend int32 /* Addend. */ +} + +func R_SYM32(info uint32) uint32 { return info >> 8 } +func R_TYPE32(info uint32) uint32 { return info & 0xff } +func R_INFO32(sym, typ uint32) uint32 { return sym<<8 | typ } + +// ELF32 Symbol. +type Sym32 struct { + Name uint32 + Value uint32 + Size uint32 + Info uint8 + Other uint8 + Shndx uint16 +} + +const Sym32Size = 16 + +func ST_BIND(info uint8) SymBind { return SymBind(info >> 4) } +func ST_TYPE(info uint8) SymType { return SymType(info & 0xF) } +func ST_INFO(bind SymBind, typ SymType) uint8 { + return uint8(bind)<<4 | uint8(typ)&0xf +} +func ST_VISIBILITY(other uint8) SymVis { return SymVis(other & 3) } + +/* + * ELF64 + */ + +// ELF64 file header. +type Header64 struct { + Ident [EI_NIDENT]byte /* File identification. */ + Type uint16 /* File type. */ + Machine uint16 /* Machine architecture. */ + Version uint32 /* ELF format version. */ + Entry uint64 /* Entry point. */ + Phoff uint64 /* Program header file offset. */ + Shoff uint64 /* Section header file offset. */ + Flags uint32 /* Architecture-specific flags. */ + Ehsize uint16 /* Size of ELF header in bytes. */ + Phentsize uint16 /* Size of program header entry. */ + Phnum uint16 /* Number of program header entries. */ + Shentsize uint16 /* Size of section header entry. */ + Shnum uint16 /* Number of section header entries. */ + Shstrndx uint16 /* Section name strings section. */ +} + +// ELF64 Section header. +type Section64 struct { + Name uint32 /* Section name (index into the section header string table). */ + Type uint32 /* Section type. */ + Flags uint64 /* Section flags. */ + Addr uint64 /* Address in memory image. */ + Off uint64 /* Offset in file. */ + Size uint64 /* Size in bytes. */ + Link uint32 /* Index of a related section. */ + Info uint32 /* Depends on section type. */ + Addralign uint64 /* Alignment in bytes. */ + Entsize uint64 /* Size of each entry in section. */ +} + +// ELF64 Program header. +type Prog64 struct { + Type uint32 /* Entry type. */ + Flags uint32 /* Access permission flags. */ + Off uint64 /* File offset of contents. */ + Vaddr uint64 /* Virtual address in memory image. */ + Paddr uint64 /* Physical address (not used). */ + Filesz uint64 /* Size of contents in file. */ + Memsz uint64 /* Size of contents in memory. */ + Align uint64 /* Alignment in memory and file. */ +} + +// ELF64 Dynamic structure. The ".dynamic" section contains an array of them. +type Dyn64 struct { + Tag int64 /* Entry type. */ + Val uint64 /* Integer/address value */ +} + +// ELF64 Compression header. +type Chdr64 struct { + Type uint32 + _ uint32 /* Reserved. */ + Size uint64 + Addralign uint64 +} + +/* + * Relocation entries. + */ + +/* ELF64 relocations that don't need an addend field. */ +type Rel64 struct { + Off uint64 /* Location to be relocated. */ + Info uint64 /* Relocation type and symbol index. */ +} + +/* ELF64 relocations that need an addend field. */ +type Rela64 struct { + Off uint64 /* Location to be relocated. */ + Info uint64 /* Relocation type and symbol index. */ + Addend int64 /* Addend. */ +} + +func R_SYM64(info uint64) uint32 { return uint32(info >> 32) } +func R_TYPE64(info uint64) uint32 { return uint32(info) } +func R_INFO(sym, typ uint32) uint64 { return uint64(sym)<<32 | uint64(typ) } + +// ELF64 symbol table entries. +type Sym64 struct { + Name uint32 /* String table index of name. */ + Info uint8 /* Type and binding information. */ + Other uint8 /* Reserved (not used). */ + Shndx uint16 /* Section index of symbol. */ + Value uint64 /* Symbol value. */ + Size uint64 /* Size of associated object. */ +} + +const Sym64Size = 24 + +type intName struct { + i uint32 + s string +} + +// Dynamic version flags. +type DynamicVersionFlag uint16 + +const ( + VER_FLG_BASE DynamicVersionFlag = 0x1 /* Version definition of the file. */ + VER_FLG_WEAK DynamicVersionFlag = 0x2 /* Weak version identifier. */ + VER_FLG_INFO DynamicVersionFlag = 0x4 /* Reference exists for informational purposes. */ +) + +func stringName(i uint32, names []intName, goSyntax bool) string { + for _, n := range names { + if n.i == i { + if goSyntax { + return "elf." + n.s + } + return n.s + } + } + + // second pass - look for smaller to add with. + // assume sorted already + for j := len(names) - 1; j >= 0; j-- { + n := names[j] + if n.i < i { + s := n.s + if goSyntax { + s = "elf." + s + } + return s + "+" + strconv.FormatUint(uint64(i-n.i), 10) + } + } + + return strconv.FormatUint(uint64(i), 10) +} + +func flagName(i uint32, names []intName, goSyntax bool) string { + s := "" + for _, n := range names { + if n.i&i == n.i { + if len(s) > 0 { + s += "+" + } + if goSyntax { + s += "elf." + } + s += n.s + i -= n.i + } + } + if len(s) == 0 { + return "0x" + strconv.FormatUint(uint64(i), 16) + } + if i != 0 { + s += "+0x" + strconv.FormatUint(uint64(i), 16) + } + return s +} diff --git a/go/src/debug/elf/elf_test.go b/go/src/debug/elf/elf_test.go new file mode 100644 index 0000000000000000000000000000000000000000..256f850f967860b7a2834e9fac4e094edcd5066e --- /dev/null +++ b/go/src/debug/elf/elf_test.go @@ -0,0 +1,52 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package elf + +import ( + "fmt" + "testing" +) + +type nameTest struct { + val any + str string +} + +var nameTests = []nameTest{ + {ELFOSABI_LINUX, "ELFOSABI_LINUX"}, + {ET_EXEC, "ET_EXEC"}, + {EM_860, "EM_860"}, + {SHN_LOPROC, "SHN_LOPROC"}, + {SHT_PROGBITS, "SHT_PROGBITS"}, + {SHF_MERGE + SHF_TLS, "SHF_MERGE+SHF_TLS"}, + {PT_LOAD, "PT_LOAD"}, + {PF_W + PF_R + 0x50, "PF_W+PF_R+0x50"}, + {DT_SYMBOLIC, "DT_SYMBOLIC"}, + {DF_BIND_NOW, "DF_BIND_NOW"}, + {DF_1_PIE, "DF_1_PIE"}, + {NT_FPREGSET, "NT_FPREGSET"}, + {STB_GLOBAL, "STB_GLOBAL"}, + {STT_COMMON, "STT_COMMON"}, + {STV_HIDDEN, "STV_HIDDEN"}, + {R_X86_64_PC32, "R_X86_64_PC32"}, + {R_ALPHA_OP_PUSH, "R_ALPHA_OP_PUSH"}, + {R_ARM_THM_ABS5, "R_ARM_THM_ABS5"}, + {R_386_GOT32, "R_386_GOT32"}, + {R_LARCH_CALL36, "R_LARCH_CALL36"}, + {R_PPC_GOT16_HI, "R_PPC_GOT16_HI"}, + {R_SPARC_GOT22, "R_SPARC_GOT22"}, + {ET_LOOS + 5, "ET_LOOS+5"}, + {ProgFlag(0x50), "0x50"}, + {COMPRESS_ZLIB + 2, "COMPRESS_ZSTD+1"}, +} + +func TestNames(t *testing.T) { + for i, tt := range nameTests { + s := fmt.Sprint(tt.val) + if s != tt.str { + t.Errorf("#%d: Sprint(%d) = %q, want %q", i, tt.val, s, tt.str) + } + } +} diff --git a/go/src/debug/elf/file.go b/go/src/debug/elf/file.go new file mode 100644 index 0000000000000000000000000000000000000000..80df13ef8babe6051702808e46df14a240e13ea5 --- /dev/null +++ b/go/src/debug/elf/file.go @@ -0,0 +1,1859 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/* +Package elf implements access to ELF object files. + +# Security + +This package is not designed to be hardened against adversarial inputs, and is +outside the scope of https://go.dev/security/policy. In particular, only basic +validation is done when parsing object files. As such, care should be taken when +parsing untrusted inputs, as parsing malformed files may consume significant +resources, or cause panics. +*/ +package elf + +import ( + "bytes" + "compress/zlib" + "debug/dwarf" + "encoding/binary" + "errors" + "fmt" + "internal/saferio" + "internal/zstd" + "io" + "math" + "os" + "strings" + "unsafe" +) + +// TODO: error reporting detail + +/* + * Internal ELF representation + */ + +// A FileHeader represents an ELF file header. +type FileHeader struct { + Class Class + Data Data + Version Version + OSABI OSABI + ABIVersion uint8 + ByteOrder binary.ByteOrder + Type Type + Machine Machine + Entry uint64 +} + +// A File represents an open ELF file. +type File struct { + FileHeader + Sections []*Section + Progs []*Prog + closer io.Closer + dynVers []DynamicVersion + dynVerNeeds []DynamicVersionNeed + gnuVersym []byte +} + +// A SectionHeader represents a single ELF section header. +type SectionHeader struct { + Name string + Type SectionType + Flags SectionFlag + Addr uint64 + Offset uint64 + Size uint64 + Link uint32 + Info uint32 + Addralign uint64 + Entsize uint64 + + // FileSize is the size of this section in the file in bytes. + // If a section is compressed, FileSize is the size of the + // compressed data, while Size (above) is the size of the + // uncompressed data. + FileSize uint64 +} + +// A Section represents a single section in an ELF file. +type Section struct { + SectionHeader + + // Embed ReaderAt for ReadAt method. + // Do not embed SectionReader directly + // to avoid having Read and Seek. + // If a client wants Read and Seek it must use + // Open() to avoid fighting over the seek offset + // with other clients. + // + // ReaderAt may be nil if the section is not easily available + // in a random-access form. For example, a compressed section + // may have a nil ReaderAt. + io.ReaderAt + sr *io.SectionReader + + compressionType CompressionType + compressionOffset int64 +} + +// Data reads and returns the contents of the ELF section. +// Even if the section is stored compressed in the ELF file, +// Data returns uncompressed data. +// +// For an [SHT_NOBITS] section, Data always returns a non-nil error. +func (s *Section) Data() ([]byte, error) { + return saferio.ReadData(s.Open(), s.Size) +} + +// stringTable reads and returns the string table given by the +// specified link value. +func (f *File) stringTable(link uint32) ([]byte, error) { + if link <= 0 || link >= uint32(len(f.Sections)) { + return nil, errors.New("section has invalid string table link") + } + return f.Sections[link].Data() +} + +// Open returns a new ReadSeeker reading the ELF section. +// Even if the section is stored compressed in the ELF file, +// the ReadSeeker reads uncompressed data. +// +// For an [SHT_NOBITS] section, all calls to the opened reader +// will return a non-nil error. +func (s *Section) Open() io.ReadSeeker { + if s.Type == SHT_NOBITS { + return io.NewSectionReader(&nobitsSectionReader{}, 0, int64(s.Size)) + } + + var zrd func(io.Reader) (io.ReadCloser, error) + if s.Flags&SHF_COMPRESSED == 0 { + + if !strings.HasPrefix(s.Name, ".zdebug") { + return io.NewSectionReader(s.sr, 0, 1<<63-1) + } + + b := make([]byte, 12) + n, _ := s.sr.ReadAt(b, 0) + if n != 12 || string(b[:4]) != "ZLIB" { + return io.NewSectionReader(s.sr, 0, 1<<63-1) + } + + s.compressionOffset = 12 + s.compressionType = COMPRESS_ZLIB + s.Size = binary.BigEndian.Uint64(b[4:12]) + zrd = zlib.NewReader + + } else if s.Flags&SHF_ALLOC != 0 { + return errorReader{&FormatError{int64(s.Offset), + "SHF_COMPRESSED applies only to non-allocable sections", s.compressionType}} + } + + switch s.compressionType { + case COMPRESS_ZLIB: + zrd = zlib.NewReader + case COMPRESS_ZSTD: + zrd = func(r io.Reader) (io.ReadCloser, error) { + return io.NopCloser(zstd.NewReader(r)), nil + } + } + + if zrd == nil { + return errorReader{&FormatError{int64(s.Offset), "unknown compression type", s.compressionType}} + } + + return &readSeekerFromReader{ + reset: func() (io.Reader, error) { + fr := io.NewSectionReader(s.sr, s.compressionOffset, int64(s.FileSize)-s.compressionOffset) + return zrd(fr) + }, + size: int64(s.Size), + } +} + +// A ProgHeader represents a single ELF program header. +type ProgHeader struct { + Type ProgType + Flags ProgFlag + Off uint64 + Vaddr uint64 + Paddr uint64 + Filesz uint64 + Memsz uint64 + Align uint64 +} + +// A Prog represents a single ELF program header in an ELF binary. +type Prog struct { + ProgHeader + + // Embed ReaderAt for ReadAt method. + // Do not embed SectionReader directly + // to avoid having Read and Seek. + // If a client wants Read and Seek it must use + // Open() to avoid fighting over the seek offset + // with other clients. + io.ReaderAt + sr *io.SectionReader +} + +// Open returns a new ReadSeeker reading the ELF program body. +func (p *Prog) Open() io.ReadSeeker { return io.NewSectionReader(p.sr, 0, 1<<63-1) } + +// A Symbol represents an entry in an ELF symbol table section. +type Symbol struct { + Name string + Info, Other byte + + // HasVersion reports whether the symbol has any version information. + // This will only be true for the dynamic symbol table. + HasVersion bool + // VersionIndex is the symbol's version index. + // Use the methods of the [VersionIndex] type to access it. + // This field is only meaningful if HasVersion is true. + VersionIndex VersionIndex + + Section SectionIndex + Value, Size uint64 + + // These fields are present only for the dynamic symbol table. + Version string + Library string +} + +/* + * ELF reader + */ + +type FormatError struct { + off int64 + msg string + val any +} + +func (e *FormatError) Error() string { + msg := e.msg + if e.val != nil { + msg += fmt.Sprintf(" '%v' ", e.val) + } + msg += fmt.Sprintf("in record at byte %#x", e.off) + return msg +} + +// Open opens the named file using [os.Open] and prepares it for use as an ELF binary. +func Open(name string) (*File, error) { + f, err := os.Open(name) + if err != nil { + return nil, err + } + ff, err := NewFile(f) + if err != nil { + f.Close() + return nil, err + } + ff.closer = f + return ff, nil +} + +// Close closes the [File]. +// If the [File] was created using [NewFile] directly instead of [Open], +// Close has no effect. +func (f *File) Close() error { + var err error + if f.closer != nil { + err = f.closer.Close() + f.closer = nil + } + return err +} + +// SectionByType returns the first section in f with the +// given type, or nil if there is no such section. +func (f *File) SectionByType(typ SectionType) *Section { + for _, s := range f.Sections { + if s.Type == typ { + return s + } + } + return nil +} + +// NewFile creates a new [File] for accessing an ELF binary in an underlying reader. +// The ELF binary is expected to start at position 0 in the ReaderAt. +func NewFile(r io.ReaderAt) (*File, error) { + sr := io.NewSectionReader(r, 0, 1<<63-1) + // Read and decode ELF identifier + var ident [16]uint8 + if _, err := r.ReadAt(ident[0:], 0); err != nil { + return nil, err + } + if ident[0] != '\x7f' || ident[1] != 'E' || ident[2] != 'L' || ident[3] != 'F' { + return nil, &FormatError{0, "bad magic number", ident[0:4]} + } + + f := new(File) + f.Class = Class(ident[EI_CLASS]) + switch f.Class { + case ELFCLASS32: + case ELFCLASS64: + // ok + default: + return nil, &FormatError{0, "unknown ELF class", f.Class} + } + + f.Data = Data(ident[EI_DATA]) + var bo binary.ByteOrder + switch f.Data { + case ELFDATA2LSB: + bo = binary.LittleEndian + case ELFDATA2MSB: + bo = binary.BigEndian + default: + return nil, &FormatError{0, "unknown ELF data encoding", f.Data} + } + f.ByteOrder = bo + + f.Version = Version(ident[EI_VERSION]) + if f.Version != EV_CURRENT { + return nil, &FormatError{0, "unknown ELF version", f.Version} + } + + f.OSABI = OSABI(ident[EI_OSABI]) + f.ABIVersion = ident[EI_ABIVERSION] + + // Read ELF file header + var phoff int64 + var phentsize, phnum int + var shoff int64 + var shentsize, shnum, shstrndx int + switch f.Class { + case ELFCLASS32: + var hdr Header32 + data := make([]byte, unsafe.Sizeof(hdr)) + if _, err := sr.ReadAt(data, 0); err != nil { + return nil, err + } + f.Type = Type(bo.Uint16(data[unsafe.Offsetof(hdr.Type):])) + f.Machine = Machine(bo.Uint16(data[unsafe.Offsetof(hdr.Machine):])) + f.Entry = uint64(bo.Uint32(data[unsafe.Offsetof(hdr.Entry):])) + if v := Version(bo.Uint32(data[unsafe.Offsetof(hdr.Version):])); v != f.Version { + return nil, &FormatError{0, "mismatched ELF version", v} + } + phoff = int64(bo.Uint32(data[unsafe.Offsetof(hdr.Phoff):])) + phentsize = int(bo.Uint16(data[unsafe.Offsetof(hdr.Phentsize):])) + phnum = int(bo.Uint16(data[unsafe.Offsetof(hdr.Phnum):])) + shoff = int64(bo.Uint32(data[unsafe.Offsetof(hdr.Shoff):])) + shentsize = int(bo.Uint16(data[unsafe.Offsetof(hdr.Shentsize):])) + shnum = int(bo.Uint16(data[unsafe.Offsetof(hdr.Shnum):])) + shstrndx = int(bo.Uint16(data[unsafe.Offsetof(hdr.Shstrndx):])) + case ELFCLASS64: + var hdr Header64 + data := make([]byte, unsafe.Sizeof(hdr)) + if _, err := sr.ReadAt(data, 0); err != nil { + return nil, err + } + f.Type = Type(bo.Uint16(data[unsafe.Offsetof(hdr.Type):])) + f.Machine = Machine(bo.Uint16(data[unsafe.Offsetof(hdr.Machine):])) + f.Entry = bo.Uint64(data[unsafe.Offsetof(hdr.Entry):]) + if v := Version(bo.Uint32(data[unsafe.Offsetof(hdr.Version):])); v != f.Version { + return nil, &FormatError{0, "mismatched ELF version", v} + } + phoff = int64(bo.Uint64(data[unsafe.Offsetof(hdr.Phoff):])) + phentsize = int(bo.Uint16(data[unsafe.Offsetof(hdr.Phentsize):])) + phnum = int(bo.Uint16(data[unsafe.Offsetof(hdr.Phnum):])) + shoff = int64(bo.Uint64(data[unsafe.Offsetof(hdr.Shoff):])) + shentsize = int(bo.Uint16(data[unsafe.Offsetof(hdr.Shentsize):])) + shnum = int(bo.Uint16(data[unsafe.Offsetof(hdr.Shnum):])) + shstrndx = int(bo.Uint16(data[unsafe.Offsetof(hdr.Shstrndx):])) + } + + if shoff < 0 { + return nil, &FormatError{0, "invalid shoff", shoff} + } + if phoff < 0 { + return nil, &FormatError{0, "invalid phoff", phoff} + } + + if shoff == 0 && shnum != 0 { + return nil, &FormatError{0, "invalid ELF shnum for shoff=0", shnum} + } + + if shnum > 0 && shstrndx >= shnum { + return nil, &FormatError{0, "invalid ELF shstrndx", shstrndx} + } + + var wantPhentsize, wantShentsize int + switch f.Class { + case ELFCLASS32: + wantPhentsize = 8 * 4 + wantShentsize = 10 * 4 + case ELFCLASS64: + wantPhentsize = 2*4 + 6*8 + wantShentsize = 4*4 + 6*8 + } + if phnum > 0 && phentsize < wantPhentsize { + return nil, &FormatError{0, "invalid ELF phentsize", phentsize} + } + + // Read program headers + f.Progs = make([]*Prog, phnum) + phdata, err := saferio.ReadDataAt(sr, uint64(phnum)*uint64(phentsize), phoff) + if err != nil { + return nil, err + } + for i := 0; i < phnum; i++ { + off := uintptr(i) * uintptr(phentsize) + p := new(Prog) + switch f.Class { + case ELFCLASS32: + var ph Prog32 + p.ProgHeader = ProgHeader{ + Type: ProgType(bo.Uint32(phdata[off+unsafe.Offsetof(ph.Type):])), + Flags: ProgFlag(bo.Uint32(phdata[off+unsafe.Offsetof(ph.Flags):])), + Off: uint64(bo.Uint32(phdata[off+unsafe.Offsetof(ph.Off):])), + Vaddr: uint64(bo.Uint32(phdata[off+unsafe.Offsetof(ph.Vaddr):])), + Paddr: uint64(bo.Uint32(phdata[off+unsafe.Offsetof(ph.Paddr):])), + Filesz: uint64(bo.Uint32(phdata[off+unsafe.Offsetof(ph.Filesz):])), + Memsz: uint64(bo.Uint32(phdata[off+unsafe.Offsetof(ph.Memsz):])), + Align: uint64(bo.Uint32(phdata[off+unsafe.Offsetof(ph.Align):])), + } + case ELFCLASS64: + var ph Prog64 + p.ProgHeader = ProgHeader{ + Type: ProgType(bo.Uint32(phdata[off+unsafe.Offsetof(ph.Type):])), + Flags: ProgFlag(bo.Uint32(phdata[off+unsafe.Offsetof(ph.Flags):])), + Off: bo.Uint64(phdata[off+unsafe.Offsetof(ph.Off):]), + Vaddr: bo.Uint64(phdata[off+unsafe.Offsetof(ph.Vaddr):]), + Paddr: bo.Uint64(phdata[off+unsafe.Offsetof(ph.Paddr):]), + Filesz: bo.Uint64(phdata[off+unsafe.Offsetof(ph.Filesz):]), + Memsz: bo.Uint64(phdata[off+unsafe.Offsetof(ph.Memsz):]), + Align: bo.Uint64(phdata[off+unsafe.Offsetof(ph.Align):]), + } + } + if int64(p.Off) < 0 { + return nil, &FormatError{phoff + int64(off), "invalid program header offset", p.Off} + } + if int64(p.Filesz) < 0 { + return nil, &FormatError{phoff + int64(off), "invalid program header file size", p.Filesz} + } + p.sr = io.NewSectionReader(r, int64(p.Off), int64(p.Filesz)) + p.ReaderAt = p.sr + f.Progs[i] = p + } + + // If the number of sections is greater than or equal to SHN_LORESERVE + // (0xff00), shnum has the value zero and the actual number of section + // header table entries is contained in the sh_size field of the section + // header at index 0. + if shoff > 0 && shnum == 0 { + var typ, link uint32 + sr.Seek(shoff, io.SeekStart) + switch f.Class { + case ELFCLASS32: + sh := new(Section32) + if err := binary.Read(sr, bo, sh); err != nil { + return nil, err + } + shnum = int(sh.Size) + typ = sh.Type + link = sh.Link + case ELFCLASS64: + sh := new(Section64) + if err := binary.Read(sr, bo, sh); err != nil { + return nil, err + } + shnum = int(sh.Size) + typ = sh.Type + link = sh.Link + } + if SectionType(typ) != SHT_NULL { + return nil, &FormatError{shoff, "invalid type of the initial section", SectionType(typ)} + } + + if shnum < int(SHN_LORESERVE) { + return nil, &FormatError{shoff, "invalid ELF shnum contained in sh_size", shnum} + } + + // If the section name string table section index is greater than or + // equal to SHN_LORESERVE (0xff00), this member has the value + // SHN_XINDEX (0xffff) and the actual index of the section name + // string table section is contained in the sh_link field of the + // section header at index 0. + if shstrndx == int(SHN_XINDEX) { + shstrndx = int(link) + if shstrndx < int(SHN_LORESERVE) { + return nil, &FormatError{shoff, "invalid ELF shstrndx contained in sh_link", shstrndx} + } + } + } + + if shnum > 0 && shentsize < wantShentsize { + return nil, &FormatError{0, "invalid ELF shentsize", shentsize} + } + + // Read section headers + c := saferio.SliceCap[Section](uint64(shnum)) + if c < 0 { + return nil, &FormatError{0, "too many sections", shnum} + } + if shnum > 0 && ((1<<64)-1)/uint64(shnum) < uint64(shentsize) { + return nil, &FormatError{0, "section header overflow", shnum} + } + f.Sections = make([]*Section, 0, c) + names := make([]uint32, 0, c) + shdata, err := saferio.ReadDataAt(sr, uint64(shnum)*uint64(shentsize), shoff) + if err != nil { + return nil, err + } + for i := 0; i < shnum; i++ { + off := uintptr(i) * uintptr(shentsize) + s := new(Section) + switch f.Class { + case ELFCLASS32: + var sh Section32 + names = append(names, bo.Uint32(shdata[off+unsafe.Offsetof(sh.Name):])) + s.SectionHeader = SectionHeader{ + Type: SectionType(bo.Uint32(shdata[off+unsafe.Offsetof(sh.Type):])), + Flags: SectionFlag(bo.Uint32(shdata[off+unsafe.Offsetof(sh.Flags):])), + Addr: uint64(bo.Uint32(shdata[off+unsafe.Offsetof(sh.Addr):])), + Offset: uint64(bo.Uint32(shdata[off+unsafe.Offsetof(sh.Off):])), + FileSize: uint64(bo.Uint32(shdata[off+unsafe.Offsetof(sh.Size):])), + Link: bo.Uint32(shdata[off+unsafe.Offsetof(sh.Link):]), + Info: bo.Uint32(shdata[off+unsafe.Offsetof(sh.Info):]), + Addralign: uint64(bo.Uint32(shdata[off+unsafe.Offsetof(sh.Addralign):])), + Entsize: uint64(bo.Uint32(shdata[off+unsafe.Offsetof(sh.Entsize):])), + } + case ELFCLASS64: + var sh Section64 + names = append(names, bo.Uint32(shdata[off+unsafe.Offsetof(sh.Name):])) + s.SectionHeader = SectionHeader{ + Type: SectionType(bo.Uint32(shdata[off+unsafe.Offsetof(sh.Type):])), + Flags: SectionFlag(bo.Uint64(shdata[off+unsafe.Offsetof(sh.Flags):])), + Offset: bo.Uint64(shdata[off+unsafe.Offsetof(sh.Off):]), + FileSize: bo.Uint64(shdata[off+unsafe.Offsetof(sh.Size):]), + Addr: bo.Uint64(shdata[off+unsafe.Offsetof(sh.Addr):]), + Link: bo.Uint32(shdata[off+unsafe.Offsetof(sh.Link):]), + Info: bo.Uint32(shdata[off+unsafe.Offsetof(sh.Info):]), + Addralign: bo.Uint64(shdata[off+unsafe.Offsetof(sh.Addralign):]), + Entsize: bo.Uint64(shdata[off+unsafe.Offsetof(sh.Entsize):]), + } + } + if int64(s.Offset) < 0 { + return nil, &FormatError{shoff + int64(off), "invalid section offset", int64(s.Offset)} + } + if int64(s.FileSize) < 0 { + return nil, &FormatError{shoff + int64(off), "invalid section size", int64(s.FileSize)} + } + s.sr = io.NewSectionReader(r, int64(s.Offset), int64(s.FileSize)) + + if s.Flags&SHF_COMPRESSED == 0 { + s.ReaderAt = s.sr + s.Size = s.FileSize + } else { + // Read the compression header. + switch f.Class { + case ELFCLASS32: + var ch Chdr32 + chdata := make([]byte, unsafe.Sizeof(ch)) + if _, err := s.sr.ReadAt(chdata, 0); err != nil { + return nil, err + } + s.compressionType = CompressionType(bo.Uint32(chdata[unsafe.Offsetof(ch.Type):])) + s.Size = uint64(bo.Uint32(chdata[unsafe.Offsetof(ch.Size):])) + s.Addralign = uint64(bo.Uint32(chdata[unsafe.Offsetof(ch.Addralign):])) + s.compressionOffset = int64(unsafe.Sizeof(ch)) + case ELFCLASS64: + var ch Chdr64 + chdata := make([]byte, unsafe.Sizeof(ch)) + if _, err := s.sr.ReadAt(chdata, 0); err != nil { + return nil, err + } + s.compressionType = CompressionType(bo.Uint32(chdata[unsafe.Offsetof(ch.Type):])) + s.Size = bo.Uint64(chdata[unsafe.Offsetof(ch.Size):]) + s.Addralign = bo.Uint64(chdata[unsafe.Offsetof(ch.Addralign):]) + s.compressionOffset = int64(unsafe.Sizeof(ch)) + } + } + + f.Sections = append(f.Sections, s) + } + + if len(f.Sections) == 0 { + return f, nil + } + + // Load section header string table. + if shstrndx == 0 { + // If the file has no section name string table, + // shstrndx holds the value SHN_UNDEF (0). + return f, nil + } + shstr := f.Sections[shstrndx] + if shstr.Type != SHT_STRTAB { + return nil, &FormatError{shoff + int64(shstrndx*shentsize), "invalid ELF section name string table type", shstr.Type} + } + shstrtab, err := shstr.Data() + if err != nil { + return nil, err + } + for i, s := range f.Sections { + var ok bool + s.Name, ok = getString(shstrtab, int(names[i])) + if !ok { + return nil, &FormatError{shoff + int64(i*shentsize), "bad section name index", names[i]} + } + } + + return f, nil +} + +// getSymbols returns a slice of Symbols from parsing the symbol table +// with the given type, along with the associated string table. +func (f *File) getSymbols(typ SectionType) ([]Symbol, []byte, error) { + switch f.Class { + case ELFCLASS64: + return f.getSymbols64(typ) + + case ELFCLASS32: + return f.getSymbols32(typ) + } + + return nil, nil, errors.New("not implemented") +} + +// ErrNoSymbols is returned by [File.Symbols] and [File.DynamicSymbols] +// if there is no such section in the File. +var ErrNoSymbols = errors.New("no symbol section") + +func (f *File) getSymbols32(typ SectionType) ([]Symbol, []byte, error) { + symtabSection := f.SectionByType(typ) + if symtabSection == nil { + return nil, nil, ErrNoSymbols + } + + data, err := symtabSection.Data() + if err != nil { + return nil, nil, fmt.Errorf("cannot load symbol section: %w", err) + } + if len(data) == 0 { + return nil, nil, ErrNoSymbols + } + if len(data)%Sym32Size != 0 { + return nil, nil, errors.New("length of symbol section is not a multiple of SymSize") + } + + strdata, err := f.stringTable(symtabSection.Link) + if err != nil { + return nil, nil, fmt.Errorf("cannot load string table section: %w", err) + } + + // The first entry is all zeros. + data = data[Sym32Size:] + + symbols := make([]Symbol, len(data)/Sym32Size) + + i := 0 + var sym Sym32 + for len(data) > 0 { + sym.Name = f.ByteOrder.Uint32(data[0:4]) + sym.Value = f.ByteOrder.Uint32(data[4:8]) + sym.Size = f.ByteOrder.Uint32(data[8:12]) + sym.Info = data[12] + sym.Other = data[13] + sym.Shndx = f.ByteOrder.Uint16(data[14:16]) + str, _ := getString(strdata, int(sym.Name)) + symbols[i].Name = str + symbols[i].Info = sym.Info + symbols[i].Other = sym.Other + symbols[i].Section = SectionIndex(sym.Shndx) + symbols[i].Value = uint64(sym.Value) + symbols[i].Size = uint64(sym.Size) + i++ + data = data[Sym32Size:] + } + + return symbols, strdata, nil +} + +func (f *File) getSymbols64(typ SectionType) ([]Symbol, []byte, error) { + symtabSection := f.SectionByType(typ) + if symtabSection == nil { + return nil, nil, ErrNoSymbols + } + + data, err := symtabSection.Data() + if err != nil { + return nil, nil, fmt.Errorf("cannot load symbol section: %w", err) + } + if len(data) == 0 { + return nil, nil, ErrNoSymbols + } + if len(data)%Sym64Size != 0 { + return nil, nil, errors.New("length of symbol section is not a multiple of Sym64Size") + } + + strdata, err := f.stringTable(symtabSection.Link) + if err != nil { + return nil, nil, fmt.Errorf("cannot load string table section: %w", err) + } + + // The first entry is all zeros. + data = data[Sym64Size:] + + symbols := make([]Symbol, len(data)/Sym64Size) + + i := 0 + var sym Sym64 + for len(data) > 0 { + sym.Name = f.ByteOrder.Uint32(data[0:4]) + sym.Info = data[4] + sym.Other = data[5] + sym.Shndx = f.ByteOrder.Uint16(data[6:8]) + sym.Value = f.ByteOrder.Uint64(data[8:16]) + sym.Size = f.ByteOrder.Uint64(data[16:24]) + str, _ := getString(strdata, int(sym.Name)) + symbols[i].Name = str + symbols[i].Info = sym.Info + symbols[i].Other = sym.Other + symbols[i].Section = SectionIndex(sym.Shndx) + symbols[i].Value = sym.Value + symbols[i].Size = sym.Size + i++ + data = data[Sym64Size:] + } + + return symbols, strdata, nil +} + +// getString extracts a string from an ELF string table. +func getString(section []byte, start int) (string, bool) { + if start < 0 || start >= len(section) { + return "", false + } + + for end := start; end < len(section); end++ { + if section[end] == 0 { + return string(section[start:end]), true + } + } + return "", false +} + +// Section returns a section with the given name, or nil if no such +// section exists. +func (f *File) Section(name string) *Section { + for _, s := range f.Sections { + if s.Name == name { + return s + } + } + return nil +} + +// applyRelocations applies relocations to dst. rels is a relocations section +// in REL or RELA format. +func (f *File) applyRelocations(dst []byte, rels []byte) error { + switch { + case f.Class == ELFCLASS64 && f.Machine == EM_X86_64: + return f.applyRelocationsAMD64(dst, rels) + case f.Class == ELFCLASS32 && f.Machine == EM_386: + return f.applyRelocations386(dst, rels) + case f.Class == ELFCLASS32 && f.Machine == EM_ARM: + return f.applyRelocationsARM(dst, rels) + case f.Class == ELFCLASS64 && f.Machine == EM_AARCH64: + return f.applyRelocationsARM64(dst, rels) + case f.Class == ELFCLASS32 && f.Machine == EM_PPC: + return f.applyRelocationsPPC(dst, rels) + case f.Class == ELFCLASS64 && f.Machine == EM_PPC64: + return f.applyRelocationsPPC64(dst, rels) + case f.Class == ELFCLASS32 && f.Machine == EM_MIPS: + return f.applyRelocationsMIPS(dst, rels) + case f.Class == ELFCLASS64 && f.Machine == EM_MIPS: + return f.applyRelocationsMIPS64(dst, rels) + case f.Class == ELFCLASS64 && f.Machine == EM_LOONGARCH: + return f.applyRelocationsLOONG64(dst, rels) + case f.Class == ELFCLASS64 && f.Machine == EM_RISCV: + return f.applyRelocationsRISCV64(dst, rels) + case f.Class == ELFCLASS64 && f.Machine == EM_S390: + return f.applyRelocationss390x(dst, rels) + case f.Class == ELFCLASS64 && f.Machine == EM_SPARCV9: + return f.applyRelocationsSPARC64(dst, rels) + default: + return errors.New("applyRelocations: not implemented") + } +} + +// canApplyRelocation reports whether we should try to apply a +// relocation to a DWARF data section, given a pointer to the symbol +// targeted by the relocation. +// Most relocations in DWARF data tend to be section-relative, but +// some target non-section symbols (for example, low_PC attrs on +// subprogram or compilation unit DIEs that target function symbols). +func canApplyRelocation(sym *Symbol) bool { + return sym.Section != SHN_UNDEF && sym.Section < SHN_LORESERVE +} + +func (f *File) applyRelocationsAMD64(dst []byte, rels []byte) error { + // 24 is the size of Rela64. + if len(rels)%24 != 0 { + return errors.New("length of relocation section is not a multiple of 24") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rela Rela64 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rela) + symNo := rela.Info >> 32 + t := R_X86_64(rela.Info & 0xffff) + + if symNo == 0 || symNo > uint64(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + if !canApplyRelocation(sym) { + continue + } + + // There are relocations, so this must be a normal + // object file. The code below handles only basic relocations + // of the form S + A (symbol plus addend). + + switch t { + case R_X86_64_64: + putUint(f.ByteOrder, dst, rela.Off, 8, sym.Value, rela.Addend, false) + case R_X86_64_32: + putUint(f.ByteOrder, dst, rela.Off, 4, sym.Value, rela.Addend, false) + } + } + + return nil +} + +func (f *File) applyRelocations386(dst []byte, rels []byte) error { + // 8 is the size of Rel32. + if len(rels)%8 != 0 { + return errors.New("length of relocation section is not a multiple of 8") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rel Rel32 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rel) + symNo := rel.Info >> 8 + t := R_386(rel.Info & 0xff) + + if symNo == 0 || symNo > uint32(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + + if t == R_386_32 { + putUint(f.ByteOrder, dst, uint64(rel.Off), 4, sym.Value, 0, true) + } + } + + return nil +} + +func (f *File) applyRelocationsARM(dst []byte, rels []byte) error { + // 8 is the size of Rel32. + if len(rels)%8 != 0 { + return errors.New("length of relocation section is not a multiple of 8") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rel Rel32 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rel) + symNo := rel.Info >> 8 + t := R_ARM(rel.Info & 0xff) + + if symNo == 0 || symNo > uint32(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + + switch t { + case R_ARM_ABS32: + putUint(f.ByteOrder, dst, uint64(rel.Off), 4, sym.Value, 0, true) + } + } + + return nil +} + +func (f *File) applyRelocationsARM64(dst []byte, rels []byte) error { + // 24 is the size of Rela64. + if len(rels)%24 != 0 { + return errors.New("length of relocation section is not a multiple of 24") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rela Rela64 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rela) + symNo := rela.Info >> 32 + t := R_AARCH64(rela.Info & 0xffff) + + if symNo == 0 || symNo > uint64(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + if !canApplyRelocation(sym) { + continue + } + + // There are relocations, so this must be a normal + // object file. The code below handles only basic relocations + // of the form S + A (symbol plus addend). + + switch t { + case R_AARCH64_ABS64: + putUint(f.ByteOrder, dst, rela.Off, 8, sym.Value, rela.Addend, false) + case R_AARCH64_ABS32: + putUint(f.ByteOrder, dst, rela.Off, 4, sym.Value, rela.Addend, false) + } + } + + return nil +} + +func (f *File) applyRelocationsPPC(dst []byte, rels []byte) error { + // 12 is the size of Rela32. + if len(rels)%12 != 0 { + return errors.New("length of relocation section is not a multiple of 12") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rela Rela32 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rela) + symNo := rela.Info >> 8 + t := R_PPC(rela.Info & 0xff) + + if symNo == 0 || symNo > uint32(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + if !canApplyRelocation(sym) { + continue + } + + switch t { + case R_PPC_ADDR32: + putUint(f.ByteOrder, dst, uint64(rela.Off), 4, sym.Value, 0, false) + } + } + + return nil +} + +func (f *File) applyRelocationsPPC64(dst []byte, rels []byte) error { + // 24 is the size of Rela64. + if len(rels)%24 != 0 { + return errors.New("length of relocation section is not a multiple of 24") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rela Rela64 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rela) + symNo := rela.Info >> 32 + t := R_PPC64(rela.Info & 0xffff) + + if symNo == 0 || symNo > uint64(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + if !canApplyRelocation(sym) { + continue + } + + switch t { + case R_PPC64_ADDR64: + putUint(f.ByteOrder, dst, rela.Off, 8, sym.Value, rela.Addend, false) + case R_PPC64_ADDR32: + putUint(f.ByteOrder, dst, rela.Off, 4, sym.Value, rela.Addend, false) + } + } + + return nil +} + +func (f *File) applyRelocationsMIPS(dst []byte, rels []byte) error { + // 8 is the size of Rel32. + if len(rels)%8 != 0 { + return errors.New("length of relocation section is not a multiple of 8") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rel Rel32 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rel) + symNo := rel.Info >> 8 + t := R_MIPS(rel.Info & 0xff) + + if symNo == 0 || symNo > uint32(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + + switch t { + case R_MIPS_32: + putUint(f.ByteOrder, dst, uint64(rel.Off), 4, sym.Value, 0, true) + } + } + + return nil +} + +func (f *File) applyRelocationsMIPS64(dst []byte, rels []byte) error { + // 24 is the size of Rela64. + if len(rels)%24 != 0 { + return errors.New("length of relocation section is not a multiple of 24") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rela Rela64 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rela) + var symNo uint64 + var t R_MIPS + if f.ByteOrder == binary.BigEndian { + symNo = rela.Info >> 32 + t = R_MIPS(rela.Info & 0xff) + } else { + symNo = rela.Info & 0xffffffff + t = R_MIPS(rela.Info >> 56) + } + + if symNo == 0 || symNo > uint64(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + if !canApplyRelocation(sym) { + continue + } + + switch t { + case R_MIPS_64: + putUint(f.ByteOrder, dst, rela.Off, 8, sym.Value, rela.Addend, false) + case R_MIPS_32: + putUint(f.ByteOrder, dst, rela.Off, 4, sym.Value, rela.Addend, false) + } + } + + return nil +} + +func (f *File) applyRelocationsLOONG64(dst []byte, rels []byte) error { + // 24 is the size of Rela64. + if len(rels)%24 != 0 { + return errors.New("length of relocation section is not a multiple of 24") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rela Rela64 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rela) + var symNo uint64 + var t R_LARCH + symNo = rela.Info >> 32 + t = R_LARCH(rela.Info & 0xffff) + + if symNo == 0 || symNo > uint64(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + if !canApplyRelocation(sym) { + continue + } + + switch t { + case R_LARCH_64: + putUint(f.ByteOrder, dst, rela.Off, 8, sym.Value, rela.Addend, false) + case R_LARCH_32: + putUint(f.ByteOrder, dst, rela.Off, 4, sym.Value, rela.Addend, false) + } + } + + return nil +} + +func (f *File) applyRelocationsRISCV64(dst []byte, rels []byte) error { + // 24 is the size of Rela64. + if len(rels)%24 != 0 { + return errors.New("length of relocation section is not a multiple of 24") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rela Rela64 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rela) + symNo := rela.Info >> 32 + t := R_RISCV(rela.Info & 0xffff) + + if symNo == 0 || symNo > uint64(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + if !canApplyRelocation(sym) { + continue + } + + switch t { + case R_RISCV_64: + putUint(f.ByteOrder, dst, rela.Off, 8, sym.Value, rela.Addend, false) + case R_RISCV_32: + putUint(f.ByteOrder, dst, rela.Off, 4, sym.Value, rela.Addend, false) + } + } + + return nil +} + +func (f *File) applyRelocationss390x(dst []byte, rels []byte) error { + // 24 is the size of Rela64. + if len(rels)%24 != 0 { + return errors.New("length of relocation section is not a multiple of 24") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rela Rela64 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rela) + symNo := rela.Info >> 32 + t := R_390(rela.Info & 0xffff) + + if symNo == 0 || symNo > uint64(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + if !canApplyRelocation(sym) { + continue + } + + switch t { + case R_390_64: + putUint(f.ByteOrder, dst, rela.Off, 8, sym.Value, rela.Addend, false) + case R_390_32: + putUint(f.ByteOrder, dst, rela.Off, 4, sym.Value, rela.Addend, false) + } + } + + return nil +} + +func (f *File) applyRelocationsSPARC64(dst []byte, rels []byte) error { + // 24 is the size of Rela64. + if len(rels)%24 != 0 { + return errors.New("length of relocation section is not a multiple of 24") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rela Rela64 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rela) + symNo := rela.Info >> 32 + t := R_SPARC(rela.Info & 0xff) + + if symNo == 0 || symNo > uint64(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + if !canApplyRelocation(sym) { + continue + } + + switch t { + case R_SPARC_64, R_SPARC_UA64: + putUint(f.ByteOrder, dst, rela.Off, 8, sym.Value, rela.Addend, false) + + case R_SPARC_32, R_SPARC_UA32: + putUint(f.ByteOrder, dst, rela.Off, 4, sym.Value, rela.Addend, false) + } + } + + return nil +} + +func (f *File) DWARF() (*dwarf.Data, error) { + dwarfSuffix := func(s *Section) string { + switch { + case strings.HasPrefix(s.Name, ".debug_"): + return s.Name[7:] + case strings.HasPrefix(s.Name, ".zdebug_"): + return s.Name[8:] + default: + return "" + } + + } + // sectionData gets the data for s, checks its size, and + // applies any applicable relations. + sectionData := func(i int, s *Section) ([]byte, error) { + b, err := s.Data() + if err != nil && uint64(len(b)) < s.Size { + return nil, err + } + + if f.Type == ET_EXEC { + // Do not apply relocations to DWARF sections for ET_EXEC binaries. + // Relocations should already be applied, and .rela sections may + // contain incorrect data. + return b, nil + } + + for _, r := range f.Sections { + if r.Type != SHT_RELA && r.Type != SHT_REL { + continue + } + if int(r.Info) != i { + continue + } + rd, err := r.Data() + if err != nil { + return nil, err + } + err = f.applyRelocations(b, rd) + if err != nil { + return nil, err + } + } + return b, nil + } + + // There are many DWARF sections, but these are the ones + // the debug/dwarf package started with. + var dat = map[string][]byte{"abbrev": nil, "info": nil, "str": nil, "line": nil, "ranges": nil} + for i, s := range f.Sections { + suffix := dwarfSuffix(s) + if suffix == "" { + continue + } + if _, ok := dat[suffix]; !ok { + continue + } + b, err := sectionData(i, s) + if err != nil { + return nil, err + } + dat[suffix] = b + } + + d, err := dwarf.New(dat["abbrev"], nil, nil, dat["info"], dat["line"], nil, dat["ranges"], dat["str"]) + if err != nil { + return nil, err + } + + // Look for DWARF4 .debug_types sections and DWARF5 sections. + for i, s := range f.Sections { + suffix := dwarfSuffix(s) + if suffix == "" { + continue + } + if _, ok := dat[suffix]; ok { + // Already handled. + continue + } + + b, err := sectionData(i, s) + if err != nil { + return nil, err + } + + if suffix == "types" { + if err := d.AddTypes(fmt.Sprintf("types-%d", i), b); err != nil { + return nil, err + } + } else { + if err := d.AddSection(".debug_"+suffix, b); err != nil { + return nil, err + } + } + } + + return d, nil +} + +// Symbols returns the symbol table for f. The symbols will be listed in the order +// they appear in f. +// +// For compatibility with Go 1.0, Symbols omits the null symbol at index 0. +// After retrieving the symbols as symtab, an externally supplied index x +// corresponds to symtab[x-1], not symtab[x]. +func (f *File) Symbols() ([]Symbol, error) { + sym, _, err := f.getSymbols(SHT_SYMTAB) + return sym, err +} + +// DynamicSymbols returns the dynamic symbol table for f. The symbols +// will be listed in the order they appear in f. +// +// If f has a symbol version table, the returned [File.Symbols] will have +// initialized Version and Library fields. +// +// For compatibility with [File.Symbols], [File.DynamicSymbols] omits the null symbol at index 0. +// After retrieving the symbols as symtab, an externally supplied index x +// corresponds to symtab[x-1], not symtab[x]. +func (f *File) DynamicSymbols() ([]Symbol, error) { + sym, str, err := f.getSymbols(SHT_DYNSYM) + if err != nil { + return nil, err + } + hasVersions, err := f.gnuVersionInit(str) + if err != nil { + return nil, err + } + if hasVersions { + for i := range sym { + sym[i].HasVersion, sym[i].VersionIndex, sym[i].Version, sym[i].Library = f.gnuVersion(i) + } + } + return sym, nil +} + +type ImportedSymbol struct { + Name string + Version string + Library string +} + +// ImportedSymbols returns the names of all symbols +// referred to by the binary f that are expected to be +// satisfied by other libraries at dynamic load time. +// It does not return weak symbols. +func (f *File) ImportedSymbols() ([]ImportedSymbol, error) { + sym, str, err := f.getSymbols(SHT_DYNSYM) + if err != nil { + return nil, err + } + if _, err := f.gnuVersionInit(str); err != nil { + return nil, err + } + var all []ImportedSymbol + for i, s := range sym { + if ST_BIND(s.Info) == STB_GLOBAL && s.Section == SHN_UNDEF { + all = append(all, ImportedSymbol{Name: s.Name}) + sym := &all[len(all)-1] + _, _, sym.Version, sym.Library = f.gnuVersion(i) + } + } + return all, nil +} + +// VersionIndex is the type of a [Symbol] version index. +type VersionIndex uint16 + +// IsHidden reports whether the symbol is hidden within the version. +// This means that the symbol can only be seen by specifying the exact version. +func (vi VersionIndex) IsHidden() bool { + return vi&0x8000 != 0 +} + +// Index returns the version index. +// If this is the value 0, it means that the symbol is local, +// and is not visible externally. +// If this is the value 1, it means that the symbol is in the base version, +// and has no specific version; it may or may not match a +// [DynamicVersion.Index] in the slice returned by [File.DynamicVersions]. +// Other values will match either [DynamicVersion.Index] +// in the slice returned by [File.DynamicVersions], +// or [DynamicVersionDep.Index] in the Needs field +// of the elements of the slice returned by [File.DynamicVersionNeeds]. +// In general, a defined symbol will have an index referring +// to DynamicVersions, and an undefined symbol will have an index +// referring to some version in DynamicVersionNeeds. +func (vi VersionIndex) Index() uint16 { + return uint16(vi & 0x7fff) +} + +// DynamicVersion is a version defined by a dynamic object. +// This describes entries in the ELF SHT_GNU_verdef section. +// We assume that the vd_version field is 1. +// Note that the name of the version appears here; +// it is not in the first Deps entry as it is in the ELF file. +type DynamicVersion struct { + Name string // Name of version defined by this index. + Index uint16 // Version index. + Flags DynamicVersionFlag + Deps []string // Names of versions that this version depends upon. +} + +// DynamicVersionNeed describes a shared library needed by a dynamic object, +// with a list of the versions needed from that shared library. +// This describes entries in the ELF SHT_GNU_verneed section. +// We assume that the vn_version field is 1. +type DynamicVersionNeed struct { + Name string // Shared library name. + Needs []DynamicVersionDep // Dependencies. +} + +// DynamicVersionDep is a version needed from some shared library. +type DynamicVersionDep struct { + Flags DynamicVersionFlag + Index uint16 // Version index. + Dep string // Name of required version. +} + +// dynamicVersions returns version information for a dynamic object. +func (f *File) dynamicVersions(str []byte) error { + if f.dynVers != nil { + // Already initialized. + return nil + } + + // Accumulate verdef information. + vd := f.SectionByType(SHT_GNU_VERDEF) + if vd == nil { + return nil + } + d, _ := vd.Data() + + var dynVers []DynamicVersion + i := 0 + for { + if i+20 > len(d) { + break + } + version := f.ByteOrder.Uint16(d[i : i+2]) + if version != 1 { + return &FormatError{int64(vd.Offset + uint64(i)), "unexpected dynamic version", version} + } + flags := DynamicVersionFlag(f.ByteOrder.Uint16(d[i+2 : i+4])) + ndx := f.ByteOrder.Uint16(d[i+4 : i+6]) + cnt := f.ByteOrder.Uint16(d[i+6 : i+8]) + aux := f.ByteOrder.Uint32(d[i+12 : i+16]) + next := f.ByteOrder.Uint32(d[i+16 : i+20]) + + if cnt == 0 { + return &FormatError{int64(vd.Offset + uint64(i)), "dynamic version has no name", nil} + } + + var name string + var depName string + var deps []string + j := i + int(aux) + for c := 0; c < int(cnt); c++ { + if j+8 > len(d) { + break + } + vname := f.ByteOrder.Uint32(d[j : j+4]) + vnext := f.ByteOrder.Uint32(d[j+4 : j+8]) + depName, _ = getString(str, int(vname)) + + if c == 0 { + name = depName + } else { + deps = append(deps, depName) + } + + j += int(vnext) + } + + dynVers = append(dynVers, DynamicVersion{ + Name: name, + Index: ndx, + Flags: flags, + Deps: deps, + }) + + if next == 0 { + break + } + i += int(next) + } + + f.dynVers = dynVers + + return nil +} + +// DynamicVersions returns version information for a dynamic object. +func (f *File) DynamicVersions() ([]DynamicVersion, error) { + if f.dynVers == nil { + _, str, err := f.getSymbols(SHT_DYNSYM) + if err != nil { + return nil, err + } + hasVersions, err := f.gnuVersionInit(str) + if err != nil { + return nil, err + } + if !hasVersions { + return nil, errors.New("DynamicVersions: missing version table") + } + } + + return f.dynVers, nil +} + +// dynamicVersionNeeds returns version dependencies for a dynamic object. +func (f *File) dynamicVersionNeeds(str []byte) error { + if f.dynVerNeeds != nil { + // Already initialized. + return nil + } + + // Accumulate verneed information. + vn := f.SectionByType(SHT_GNU_VERNEED) + if vn == nil { + return nil + } + d, _ := vn.Data() + + var dynVerNeeds []DynamicVersionNeed + i := 0 + for { + if i+16 > len(d) { + break + } + vers := f.ByteOrder.Uint16(d[i : i+2]) + if vers != 1 { + return &FormatError{int64(vn.Offset + uint64(i)), "unexpected dynamic need version", vers} + } + cnt := f.ByteOrder.Uint16(d[i+2 : i+4]) + fileoff := f.ByteOrder.Uint32(d[i+4 : i+8]) + aux := f.ByteOrder.Uint32(d[i+8 : i+12]) + next := f.ByteOrder.Uint32(d[i+12 : i+16]) + file, _ := getString(str, int(fileoff)) + + var deps []DynamicVersionDep + j := i + int(aux) + for c := 0; c < int(cnt); c++ { + if j+16 > len(d) { + break + } + flags := DynamicVersionFlag(f.ByteOrder.Uint16(d[j+4 : j+6])) + index := f.ByteOrder.Uint16(d[j+6 : j+8]) + nameoff := f.ByteOrder.Uint32(d[j+8 : j+12]) + next := f.ByteOrder.Uint32(d[j+12 : j+16]) + depName, _ := getString(str, int(nameoff)) + + deps = append(deps, DynamicVersionDep{ + Flags: flags, + Index: index, + Dep: depName, + }) + + if next == 0 { + break + } + j += int(next) + } + + dynVerNeeds = append(dynVerNeeds, DynamicVersionNeed{ + Name: file, + Needs: deps, + }) + + if next == 0 { + break + } + i += int(next) + } + + f.dynVerNeeds = dynVerNeeds + + return nil +} + +// DynamicVersionNeeds returns version dependencies for a dynamic object. +func (f *File) DynamicVersionNeeds() ([]DynamicVersionNeed, error) { + if f.dynVerNeeds == nil { + _, str, err := f.getSymbols(SHT_DYNSYM) + if err != nil { + return nil, err + } + hasVersions, err := f.gnuVersionInit(str) + if err != nil { + return nil, err + } + if !hasVersions { + return nil, errors.New("DynamicVersionNeeds: missing version table") + } + } + + return f.dynVerNeeds, nil +} + +// gnuVersionInit parses the GNU version tables +// for use by calls to gnuVersion. +// It reports whether any version tables were found. +func (f *File) gnuVersionInit(str []byte) (bool, error) { + // Versym parallels symbol table, indexing into verneed. + vs := f.SectionByType(SHT_GNU_VERSYM) + if vs == nil { + return false, nil + } + d, _ := vs.Data() + + f.gnuVersym = d + if err := f.dynamicVersions(str); err != nil { + return false, err + } + if err := f.dynamicVersionNeeds(str); err != nil { + return false, err + } + return true, nil +} + +// gnuVersion adds Library and Version information to sym, +// which came from offset i of the symbol table. +func (f *File) gnuVersion(i int) (hasVersion bool, versionIndex VersionIndex, version string, library string) { + // Each entry is two bytes; skip undef entry at beginning. + i = (i + 1) * 2 + if i >= len(f.gnuVersym) { + return false, 0, "", "" + } + s := f.gnuVersym[i:] + if len(s) < 2 { + return false, 0, "", "" + } + vi := VersionIndex(f.ByteOrder.Uint16(s)) + ndx := vi.Index() + + if ndx == 0 || ndx == 1 { + return true, vi, "", "" + } + + for _, v := range f.dynVerNeeds { + for _, n := range v.Needs { + if ndx == n.Index { + return true, vi, n.Dep, v.Name + } + } + } + + for _, v := range f.dynVers { + if ndx == v.Index { + return true, vi, v.Name, "" + } + } + + return false, 0, "", "" +} + +// ImportedLibraries returns the names of all libraries +// referred to by the binary f that are expected to be +// linked with the binary at dynamic link time. +func (f *File) ImportedLibraries() ([]string, error) { + return f.DynString(DT_NEEDED) +} + +// DynString returns the strings listed for the given tag in the file's dynamic +// section. +// +// The tag must be one that takes string values: [DT_NEEDED], [DT_SONAME], [DT_RPATH], or +// [DT_RUNPATH]. +func (f *File) DynString(tag DynTag) ([]string, error) { + switch tag { + case DT_NEEDED, DT_SONAME, DT_RPATH, DT_RUNPATH: + default: + return nil, fmt.Errorf("non-string-valued tag %v", tag) + } + ds := f.SectionByType(SHT_DYNAMIC) + if ds == nil { + // not dynamic, so no libraries + return nil, nil + } + d, err := ds.Data() + if err != nil { + return nil, err + } + + dynSize := 8 + if f.Class == ELFCLASS64 { + dynSize = 16 + } + if len(d)%dynSize != 0 { + return nil, errors.New("length of dynamic section is not a multiple of dynamic entry size") + } + + str, err := f.stringTable(ds.Link) + if err != nil { + return nil, err + } + var all []string + for len(d) > 0 { + var t DynTag + var v uint64 + switch f.Class { + case ELFCLASS32: + t = DynTag(f.ByteOrder.Uint32(d[0:4])) + v = uint64(f.ByteOrder.Uint32(d[4:8])) + d = d[8:] + case ELFCLASS64: + t = DynTag(f.ByteOrder.Uint64(d[0:8])) + v = f.ByteOrder.Uint64(d[8:16]) + d = d[16:] + } + if t == tag { + s, ok := getString(str, int(v)) + if ok { + all = append(all, s) + } + } + } + return all, nil +} + +// DynValue returns the values listed for the given tag in the file's dynamic +// section. +func (f *File) DynValue(tag DynTag) ([]uint64, error) { + ds := f.SectionByType(SHT_DYNAMIC) + if ds == nil { + return nil, nil + } + d, err := ds.Data() + if err != nil { + return nil, err + } + + dynSize := 8 + if f.Class == ELFCLASS64 { + dynSize = 16 + } + if len(d)%dynSize != 0 { + return nil, errors.New("length of dynamic section is not a multiple of dynamic entry size") + } + + // Parse the .dynamic section as a string of bytes. + var vals []uint64 + for len(d) > 0 { + var t DynTag + var v uint64 + switch f.Class { + case ELFCLASS32: + t = DynTag(f.ByteOrder.Uint32(d[0:4])) + v = uint64(f.ByteOrder.Uint32(d[4:8])) + d = d[8:] + case ELFCLASS64: + t = DynTag(f.ByteOrder.Uint64(d[0:8])) + v = f.ByteOrder.Uint64(d[8:16]) + d = d[16:] + } + if t == tag { + vals = append(vals, v) + } + } + return vals, nil +} + +type nobitsSectionReader struct{} + +func (*nobitsSectionReader) ReadAt(p []byte, off int64) (n int, err error) { + return 0, errors.New("unexpected read from SHT_NOBITS section") +} + +// putUint writes a relocation to slice +// at offset start of length length (4 or 8 bytes), +// adding sym+addend to the existing value if readUint is true, +// or just writing sym+addend if readUint is false. +// If the write would extend beyond the end of slice, putUint does nothing. +// If the addend is negative, putUint does nothing. +// If the addition would overflow, putUint does nothing. +func putUint(byteOrder binary.ByteOrder, slice []byte, start, length, sym uint64, addend int64, readUint bool) { + if start+length > uint64(len(slice)) || math.MaxUint64-start < length { + return + } + if addend < 0 { + return + } + + s := slice[start : start+length] + + switch length { + case 4: + ae := uint32(addend) + if readUint { + ae += byteOrder.Uint32(s) + } + byteOrder.PutUint32(s, uint32(sym)+ae) + case 8: + ae := uint64(addend) + if readUint { + ae += byteOrder.Uint64(s) + } + byteOrder.PutUint64(s, sym+ae) + default: + panic("can't happen") + } +} diff --git a/go/src/debug/elf/file_test.go b/go/src/debug/elf/file_test.go new file mode 100644 index 0000000000000000000000000000000000000000..b796cdb95b65c6182b14c80b0c6589b33cbf340e --- /dev/null +++ b/go/src/debug/elf/file_test.go @@ -0,0 +1,1624 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package elf + +import ( + "bytes" + "compress/gzip" + "compress/zlib" + "debug/dwarf" + "encoding/binary" + "errors" + "fmt" + "io" + "math/rand" + "net" + "os" + "path" + "reflect" + "runtime" + "slices" + "strings" + "testing" +) + +type fileTest struct { + file string + hdr FileHeader + sections []SectionHeader + progs []ProgHeader + needed []string + symbols []Symbol +} + +var fileTests = []fileTest{ + { + "testdata/gcc-386-freebsd-exec", + FileHeader{ELFCLASS32, ELFDATA2LSB, EV_CURRENT, ELFOSABI_FREEBSD, 0, binary.LittleEndian, ET_EXEC, EM_386, 0x80483cc}, + []SectionHeader{ + {"", SHT_NULL, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, + {".interp", SHT_PROGBITS, SHF_ALLOC, 0x80480d4, 0xd4, 0x15, 0x0, 0x0, 0x1, 0x0, 0x15}, + {".hash", SHT_HASH, SHF_ALLOC, 0x80480ec, 0xec, 0x90, 0x3, 0x0, 0x4, 0x4, 0x90}, + {".dynsym", SHT_DYNSYM, SHF_ALLOC, 0x804817c, 0x17c, 0x110, 0x4, 0x1, 0x4, 0x10, 0x110}, + {".dynstr", SHT_STRTAB, SHF_ALLOC, 0x804828c, 0x28c, 0xbb, 0x0, 0x0, 0x1, 0x0, 0xbb}, + {".rel.plt", SHT_REL, SHF_ALLOC, 0x8048348, 0x348, 0x20, 0x3, 0x7, 0x4, 0x8, 0x20}, + {".init", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x8048368, 0x368, 0x11, 0x0, 0x0, 0x4, 0x0, 0x11}, + {".plt", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x804837c, 0x37c, 0x50, 0x0, 0x0, 0x4, 0x4, 0x50}, + {".text", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x80483cc, 0x3cc, 0x180, 0x0, 0x0, 0x4, 0x0, 0x180}, + {".fini", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x804854c, 0x54c, 0xc, 0x0, 0x0, 0x4, 0x0, 0xc}, + {".rodata", SHT_PROGBITS, SHF_ALLOC, 0x8048558, 0x558, 0xa3, 0x0, 0x0, 0x1, 0x0, 0xa3}, + {".data", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80495fc, 0x5fc, 0xc, 0x0, 0x0, 0x4, 0x0, 0xc}, + {".eh_frame", SHT_PROGBITS, SHF_ALLOC, 0x8049608, 0x608, 0x4, 0x0, 0x0, 0x4, 0x0, 0x4}, + {".dynamic", SHT_DYNAMIC, SHF_WRITE + SHF_ALLOC, 0x804960c, 0x60c, 0x98, 0x4, 0x0, 0x4, 0x8, 0x98}, + {".ctors", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80496a4, 0x6a4, 0x8, 0x0, 0x0, 0x4, 0x0, 0x8}, + {".dtors", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80496ac, 0x6ac, 0x8, 0x0, 0x0, 0x4, 0x0, 0x8}, + {".jcr", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80496b4, 0x6b4, 0x4, 0x0, 0x0, 0x4, 0x0, 0x4}, + {".got", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80496b8, 0x6b8, 0x1c, 0x0, 0x0, 0x4, 0x4, 0x1c}, + {".bss", SHT_NOBITS, SHF_WRITE + SHF_ALLOC, 0x80496d4, 0x6d4, 0x20, 0x0, 0x0, 0x4, 0x0, 0x20}, + {".comment", SHT_PROGBITS, 0x0, 0x0, 0x6d4, 0x12d, 0x0, 0x0, 0x1, 0x0, 0x12d}, + {".debug_aranges", SHT_PROGBITS, 0x0, 0x0, 0x801, 0x20, 0x0, 0x0, 0x1, 0x0, 0x20}, + {".debug_pubnames", SHT_PROGBITS, 0x0, 0x0, 0x821, 0x1b, 0x0, 0x0, 0x1, 0x0, 0x1b}, + {".debug_info", SHT_PROGBITS, 0x0, 0x0, 0x83c, 0x11d, 0x0, 0x0, 0x1, 0x0, 0x11d}, + {".debug_abbrev", SHT_PROGBITS, 0x0, 0x0, 0x959, 0x41, 0x0, 0x0, 0x1, 0x0, 0x41}, + {".debug_line", SHT_PROGBITS, 0x0, 0x0, 0x99a, 0x35, 0x0, 0x0, 0x1, 0x0, 0x35}, + {".debug_frame", SHT_PROGBITS, 0x0, 0x0, 0x9d0, 0x30, 0x0, 0x0, 0x4, 0x0, 0x30}, + {".debug_str", SHT_PROGBITS, 0x0, 0x0, 0xa00, 0xd, 0x0, 0x0, 0x1, 0x0, 0xd}, + {".shstrtab", SHT_STRTAB, 0x0, 0x0, 0xa0d, 0xf8, 0x0, 0x0, 0x1, 0x0, 0xf8}, + {".symtab", SHT_SYMTAB, 0x0, 0x0, 0xfb8, 0x4b0, 0x1d, 0x38, 0x4, 0x10, 0x4b0}, + {".strtab", SHT_STRTAB, 0x0, 0x0, 0x1468, 0x206, 0x0, 0x0, 0x1, 0x0, 0x206}, + }, + []ProgHeader{ + {PT_PHDR, PF_R + PF_X, 0x34, 0x8048034, 0x8048034, 0xa0, 0xa0, 0x4}, + {PT_INTERP, PF_R, 0xd4, 0x80480d4, 0x80480d4, 0x15, 0x15, 0x1}, + {PT_LOAD, PF_R + PF_X, 0x0, 0x8048000, 0x8048000, 0x5fb, 0x5fb, 0x1000}, + {PT_LOAD, PF_R + PF_W, 0x5fc, 0x80495fc, 0x80495fc, 0xd8, 0xf8, 0x1000}, + {PT_DYNAMIC, PF_R + PF_W, 0x60c, 0x804960c, 0x804960c, 0x98, 0x98, 0x4}, + }, + []string{"libc.so.6"}, + []Symbol{ + {"", 3, 0, false, 0, 1, 134512852, 0, "", ""}, + {"", 3, 0, false, 0, 2, 134512876, 0, "", ""}, + {"", 3, 0, false, 0, 3, 134513020, 0, "", ""}, + {"", 3, 0, false, 0, 4, 134513292, 0, "", ""}, + {"", 3, 0, false, 0, 5, 134513480, 0, "", ""}, + {"", 3, 0, false, 0, 6, 134513512, 0, "", ""}, + {"", 3, 0, false, 0, 7, 134513532, 0, "", ""}, + {"", 3, 0, false, 0, 8, 134513612, 0, "", ""}, + {"", 3, 0, false, 0, 9, 134513996, 0, "", ""}, + {"", 3, 0, false, 0, 10, 134514008, 0, "", ""}, + {"", 3, 0, false, 0, 11, 134518268, 0, "", ""}, + {"", 3, 0, false, 0, 12, 134518280, 0, "", ""}, + {"", 3, 0, false, 0, 13, 134518284, 0, "", ""}, + {"", 3, 0, false, 0, 14, 134518436, 0, "", ""}, + {"", 3, 0, false, 0, 15, 134518444, 0, "", ""}, + {"", 3, 0, false, 0, 16, 134518452, 0, "", ""}, + {"", 3, 0, false, 0, 17, 134518456, 0, "", ""}, + {"", 3, 0, false, 0, 18, 134518484, 0, "", ""}, + {"", 3, 0, false, 0, 19, 0, 0, "", ""}, + {"", 3, 0, false, 0, 20, 0, 0, "", ""}, + {"", 3, 0, false, 0, 21, 0, 0, "", ""}, + {"", 3, 0, false, 0, 22, 0, 0, "", ""}, + {"", 3, 0, false, 0, 23, 0, 0, "", ""}, + {"", 3, 0, false, 0, 24, 0, 0, "", ""}, + {"", 3, 0, false, 0, 25, 0, 0, "", ""}, + {"", 3, 0, false, 0, 26, 0, 0, "", ""}, + {"", 3, 0, false, 0, 27, 0, 0, "", ""}, + {"", 3, 0, false, 0, 28, 0, 0, "", ""}, + {"", 3, 0, false, 0, 29, 0, 0, "", ""}, + {"crt1.c", 4, 0, false, 0, 65521, 0, 0, "", ""}, + {"/usr/src/lib/csu/i386-elf/crti.S", 4, 0, false, 0, 65521, 0, 0, "", ""}, + {"", 4, 0, false, 0, 65521, 0, 0, "", ""}, + {"", 4, 0, false, 0, 65521, 0, 0, "", ""}, + {"/usr/src/lib/csu/i386-elf/crti.S", 4, 0, false, 0, 65521, 0, 0, "", ""}, + {"crtstuff.c", 4, 0, false, 0, 65521, 0, 0, "", ""}, + {"__CTOR_LIST__", 1, 0, false, 0, 14, 134518436, 0, "", ""}, + {"__DTOR_LIST__", 1, 0, false, 0, 15, 134518444, 0, "", ""}, + {"__EH_FRAME_BEGIN__", 1, 0, false, 0, 12, 134518280, 0, "", ""}, + {"__JCR_LIST__", 1, 0, false, 0, 16, 134518452, 0, "", ""}, + {"p.0", 1, 0, false, 0, 11, 134518276, 0, "", ""}, + {"completed.1", 1, 0, false, 0, 18, 134518484, 1, "", ""}, + {"__do_global_dtors_aux", 2, 0, false, 0, 8, 134513760, 0, "", ""}, + {"object.2", 1, 0, false, 0, 18, 134518488, 24, "", ""}, + {"frame_dummy", 2, 0, false, 0, 8, 134513836, 0, "", ""}, + {"crtstuff.c", 4, 0, false, 0, 65521, 0, 0, "", ""}, + {"__CTOR_END__", 1, 0, false, 0, 14, 134518440, 0, "", ""}, + {"__DTOR_END__", 1, 0, false, 0, 15, 134518448, 0, "", ""}, + {"__FRAME_END__", 1, 0, false, 0, 12, 134518280, 0, "", ""}, + {"__JCR_END__", 1, 0, false, 0, 16, 134518452, 0, "", ""}, + {"__do_global_ctors_aux", 2, 0, false, 0, 8, 134513960, 0, "", ""}, + {"/usr/src/lib/csu/i386-elf/crtn.S", 4, 0, false, 0, 65521, 0, 0, "", ""}, + {"", 4, 0, false, 0, 65521, 0, 0, "", ""}, + {"", 4, 0, false, 0, 65521, 0, 0, "", ""}, + {"/usr/src/lib/csu/i386-elf/crtn.S", 4, 0, false, 0, 65521, 0, 0, "", ""}, + {"hello.c", 4, 0, false, 0, 65521, 0, 0, "", ""}, + {"printf", 18, 0, false, 0, 0, 0, 44, "", ""}, + {"_DYNAMIC", 17, 0, false, 0, 65521, 134518284, 0, "", ""}, + {"__dso_handle", 17, 2, false, 0, 11, 134518272, 0, "", ""}, + {"_init", 18, 0, false, 0, 6, 134513512, 0, "", ""}, + {"environ", 17, 0, false, 0, 18, 134518512, 4, "", ""}, + {"__deregister_frame_info", 32, 0, false, 0, 0, 0, 0, "", ""}, + {"__progname", 17, 0, false, 0, 11, 134518268, 4, "", ""}, + {"_start", 18, 0, false, 0, 8, 134513612, 145, "", ""}, + {"__bss_start", 16, 0, false, 0, 65521, 134518484, 0, "", ""}, + {"main", 18, 0, false, 0, 8, 134513912, 46, "", ""}, + {"_init_tls", 18, 0, false, 0, 0, 0, 5, "", ""}, + {"_fini", 18, 0, false, 0, 9, 134513996, 0, "", ""}, + {"atexit", 18, 0, false, 0, 0, 0, 43, "", ""}, + {"_edata", 16, 0, false, 0, 65521, 134518484, 0, "", ""}, + {"_GLOBAL_OFFSET_TABLE_", 17, 0, false, 0, 65521, 134518456, 0, "", ""}, + {"_end", 16, 0, false, 0, 65521, 134518516, 0, "", ""}, + {"exit", 18, 0, false, 0, 0, 0, 68, "", ""}, + {"_Jv_RegisterClasses", 32, 0, false, 0, 0, 0, 0, "", ""}, + {"__register_frame_info", 32, 0, false, 0, 0, 0, 0, "", ""}, + }, + }, + { + "testdata/gcc-amd64-linux-exec", + FileHeader{ELFCLASS64, ELFDATA2LSB, EV_CURRENT, ELFOSABI_NONE, 0, binary.LittleEndian, ET_EXEC, EM_X86_64, 0x4003e0}, + []SectionHeader{ + {"", SHT_NULL, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, + {".interp", SHT_PROGBITS, SHF_ALLOC, 0x400200, 0x200, 0x1c, 0x0, 0x0, 0x1, 0x0, 0x1c}, + {".note.ABI-tag", SHT_NOTE, SHF_ALLOC, 0x40021c, 0x21c, 0x20, 0x0, 0x0, 0x4, 0x0, 0x20}, + {".hash", SHT_HASH, SHF_ALLOC, 0x400240, 0x240, 0x24, 0x5, 0x0, 0x8, 0x4, 0x24}, + {".gnu.hash", SHT_LOOS + 268435446, SHF_ALLOC, 0x400268, 0x268, 0x1c, 0x5, 0x0, 0x8, 0x0, 0x1c}, + {".dynsym", SHT_DYNSYM, SHF_ALLOC, 0x400288, 0x288, 0x60, 0x6, 0x1, 0x8, 0x18, 0x60}, + {".dynstr", SHT_STRTAB, SHF_ALLOC, 0x4002e8, 0x2e8, 0x3d, 0x0, 0x0, 0x1, 0x0, 0x3d}, + {".gnu.version", SHT_HIOS, SHF_ALLOC, 0x400326, 0x326, 0x8, 0x5, 0x0, 0x2, 0x2, 0x8}, + {".gnu.version_r", SHT_LOOS + 268435454, SHF_ALLOC, 0x400330, 0x330, 0x20, 0x6, 0x1, 0x8, 0x0, 0x20}, + {".rela.dyn", SHT_RELA, SHF_ALLOC, 0x400350, 0x350, 0x18, 0x5, 0x0, 0x8, 0x18, 0x18}, + {".rela.plt", SHT_RELA, SHF_ALLOC, 0x400368, 0x368, 0x30, 0x5, 0xc, 0x8, 0x18, 0x30}, + {".init", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x400398, 0x398, 0x18, 0x0, 0x0, 0x4, 0x0, 0x18}, + {".plt", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x4003b0, 0x3b0, 0x30, 0x0, 0x0, 0x4, 0x10, 0x30}, + {".text", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x4003e0, 0x3e0, 0x1b4, 0x0, 0x0, 0x10, 0x0, 0x1b4}, + {".fini", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x400594, 0x594, 0xe, 0x0, 0x0, 0x4, 0x0, 0xe}, + {".rodata", SHT_PROGBITS, SHF_ALLOC, 0x4005a4, 0x5a4, 0x11, 0x0, 0x0, 0x4, 0x0, 0x11}, + {".eh_frame_hdr", SHT_PROGBITS, SHF_ALLOC, 0x4005b8, 0x5b8, 0x24, 0x0, 0x0, 0x4, 0x0, 0x24}, + {".eh_frame", SHT_PROGBITS, SHF_ALLOC, 0x4005e0, 0x5e0, 0xa4, 0x0, 0x0, 0x8, 0x0, 0xa4}, + {".ctors", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600688, 0x688, 0x10, 0x0, 0x0, 0x8, 0x0, 0x10}, + {".dtors", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600698, 0x698, 0x10, 0x0, 0x0, 0x8, 0x0, 0x10}, + {".jcr", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x6006a8, 0x6a8, 0x8, 0x0, 0x0, 0x8, 0x0, 0x8}, + {".dynamic", SHT_DYNAMIC, SHF_WRITE + SHF_ALLOC, 0x6006b0, 0x6b0, 0x1a0, 0x6, 0x0, 0x8, 0x10, 0x1a0}, + {".got", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600850, 0x850, 0x8, 0x0, 0x0, 0x8, 0x8, 0x8}, + {".got.plt", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600858, 0x858, 0x28, 0x0, 0x0, 0x8, 0x8, 0x28}, + {".data", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600880, 0x880, 0x18, 0x0, 0x0, 0x8, 0x0, 0x18}, + {".bss", SHT_NOBITS, SHF_WRITE + SHF_ALLOC, 0x600898, 0x898, 0x8, 0x0, 0x0, 0x4, 0x0, 0x8}, + {".comment", SHT_PROGBITS, 0x0, 0x0, 0x898, 0x126, 0x0, 0x0, 0x1, 0x0, 0x126}, + {".debug_aranges", SHT_PROGBITS, 0x0, 0x0, 0x9c0, 0x90, 0x0, 0x0, 0x10, 0x0, 0x90}, + {".debug_pubnames", SHT_PROGBITS, 0x0, 0x0, 0xa50, 0x25, 0x0, 0x0, 0x1, 0x0, 0x25}, + {".debug_info", SHT_PROGBITS, 0x0, 0x0, 0xa75, 0x1a7, 0x0, 0x0, 0x1, 0x0, 0x1a7}, + {".debug_abbrev", SHT_PROGBITS, 0x0, 0x0, 0xc1c, 0x6f, 0x0, 0x0, 0x1, 0x0, 0x6f}, + {".debug_line", SHT_PROGBITS, 0x0, 0x0, 0xc8b, 0x13f, 0x0, 0x0, 0x1, 0x0, 0x13f}, + {".debug_str", SHT_PROGBITS, SHF_MERGE + SHF_STRINGS, 0x0, 0xdca, 0xb1, 0x0, 0x0, 0x1, 0x1, 0xb1}, + {".debug_ranges", SHT_PROGBITS, 0x0, 0x0, 0xe80, 0x90, 0x0, 0x0, 0x10, 0x0, 0x90}, + {".shstrtab", SHT_STRTAB, 0x0, 0x0, 0xf10, 0x149, 0x0, 0x0, 0x1, 0x0, 0x149}, + {".symtab", SHT_SYMTAB, 0x0, 0x0, 0x19a0, 0x6f0, 0x24, 0x39, 0x8, 0x18, 0x6f0}, + {".strtab", SHT_STRTAB, 0x0, 0x0, 0x2090, 0x1fc, 0x0, 0x0, 0x1, 0x0, 0x1fc}, + }, + []ProgHeader{ + {PT_PHDR, PF_R + PF_X, 0x40, 0x400040, 0x400040, 0x1c0, 0x1c0, 0x8}, + {PT_INTERP, PF_R, 0x200, 0x400200, 0x400200, 0x1c, 0x1c, 1}, + {PT_LOAD, PF_R + PF_X, 0x0, 0x400000, 0x400000, 0x684, 0x684, 0x200000}, + {PT_LOAD, PF_R + PF_W, 0x688, 0x600688, 0x600688, 0x210, 0x218, 0x200000}, + {PT_DYNAMIC, PF_R + PF_W, 0x6b0, 0x6006b0, 0x6006b0, 0x1a0, 0x1a0, 0x8}, + {PT_NOTE, PF_R, 0x21c, 0x40021c, 0x40021c, 0x20, 0x20, 0x4}, + {PT_LOOS + 0x474E550, PF_R, 0x5b8, 0x4005b8, 0x4005b8, 0x24, 0x24, 0x4}, + {PT_LOOS + 0x474E551, PF_R + PF_W, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8}, + }, + []string{"libc.so.6"}, + []Symbol{ + {"", 3, 0, false, 0, 1, 4194816, 0, "", ""}, + {"", 3, 0, false, 0, 2, 4194844, 0, "", ""}, + {"", 3, 0, false, 0, 3, 4194880, 0, "", ""}, + {"", 3, 0, false, 0, 4, 4194920, 0, "", ""}, + {"", 3, 0, false, 0, 5, 4194952, 0, "", ""}, + {"", 3, 0, false, 0, 6, 4195048, 0, "", ""}, + {"", 3, 0, false, 0, 7, 4195110, 0, "", ""}, + {"", 3, 0, false, 0, 8, 4195120, 0, "", ""}, + {"", 3, 0, false, 0, 9, 4195152, 0, "", ""}, + {"", 3, 0, false, 0, 10, 4195176, 0, "", ""}, + {"", 3, 0, false, 0, 11, 4195224, 0, "", ""}, + {"", 3, 0, false, 0, 12, 4195248, 0, "", ""}, + {"", 3, 0, false, 0, 13, 4195296, 0, "", ""}, + {"", 3, 0, false, 0, 14, 4195732, 0, "", ""}, + {"", 3, 0, false, 0, 15, 4195748, 0, "", ""}, + {"", 3, 0, false, 0, 16, 4195768, 0, "", ""}, + {"", 3, 0, false, 0, 17, 4195808, 0, "", ""}, + {"", 3, 0, false, 0, 18, 6293128, 0, "", ""}, + {"", 3, 0, false, 0, 19, 6293144, 0, "", ""}, + {"", 3, 0, false, 0, 20, 6293160, 0, "", ""}, + {"", 3, 0, false, 0, 21, 6293168, 0, "", ""}, + {"", 3, 0, false, 0, 22, 6293584, 0, "", ""}, + {"", 3, 0, false, 0, 23, 6293592, 0, "", ""}, + {"", 3, 0, false, 0, 24, 6293632, 0, "", ""}, + {"", 3, 0, false, 0, 25, 6293656, 0, "", ""}, + {"", 3, 0, false, 0, 26, 0, 0, "", ""}, + {"", 3, 0, false, 0, 27, 0, 0, "", ""}, + {"", 3, 0, false, 0, 28, 0, 0, "", ""}, + {"", 3, 0, false, 0, 29, 0, 0, "", ""}, + {"", 3, 0, false, 0, 30, 0, 0, "", ""}, + {"", 3, 0, false, 0, 31, 0, 0, "", ""}, + {"", 3, 0, false, 0, 32, 0, 0, "", ""}, + {"", 3, 0, false, 0, 33, 0, 0, "", ""}, + {"init.c", 4, 0, false, 0, 65521, 0, 0, "", ""}, + {"initfini.c", 4, 0, false, 0, 65521, 0, 0, "", ""}, + {"call_gmon_start", 2, 0, false, 0, 13, 4195340, 0, "", ""}, + {"crtstuff.c", 4, 0, false, 0, 65521, 0, 0, "", ""}, + {"__CTOR_LIST__", 1, 0, false, 0, 18, 6293128, 0, "", ""}, + {"__DTOR_LIST__", 1, 0, false, 0, 19, 6293144, 0, "", ""}, + {"__JCR_LIST__", 1, 0, false, 0, 20, 6293160, 0, "", ""}, + {"__do_global_dtors_aux", 2, 0, false, 0, 13, 4195376, 0, "", ""}, + {"completed.6183", 1, 0, false, 0, 25, 6293656, 1, "", ""}, + {"p.6181", 1, 0, false, 0, 24, 6293648, 0, "", ""}, + {"frame_dummy", 2, 0, false, 0, 13, 4195440, 0, "", ""}, + {"crtstuff.c", 4, 0, false, 0, 65521, 0, 0, "", ""}, + {"__CTOR_END__", 1, 0, false, 0, 18, 6293136, 0, "", ""}, + {"__DTOR_END__", 1, 0, false, 0, 19, 6293152, 0, "", ""}, + {"__FRAME_END__", 1, 0, false, 0, 17, 4195968, 0, "", ""}, + {"__JCR_END__", 1, 0, false, 0, 20, 6293160, 0, "", ""}, + {"__do_global_ctors_aux", 2, 0, false, 0, 13, 4195680, 0, "", ""}, + {"initfini.c", 4, 0, false, 0, 65521, 0, 0, "", ""}, + {"hello.c", 4, 0, false, 0, 65521, 0, 0, "", ""}, + {"_GLOBAL_OFFSET_TABLE_", 1, 2, false, 0, 23, 6293592, 0, "", ""}, + {"__init_array_end", 0, 2, false, 0, 18, 6293124, 0, "", ""}, + {"__init_array_start", 0, 2, false, 0, 18, 6293124, 0, "", ""}, + {"_DYNAMIC", 1, 2, false, 0, 21, 6293168, 0, "", ""}, + {"data_start", 32, 0, false, 0, 24, 6293632, 0, "", ""}, + {"__libc_csu_fini", 18, 0, false, 0, 13, 4195520, 2, "", ""}, + {"_start", 18, 0, false, 0, 13, 4195296, 0, "", ""}, + {"__gmon_start__", 32, 0, false, 0, 0, 0, 0, "", ""}, + {"_Jv_RegisterClasses", 32, 0, false, 0, 0, 0, 0, "", ""}, + {"puts@@GLIBC_2.2.5", 18, 0, false, 0, 0, 0, 396, "", ""}, + {"_fini", 18, 0, false, 0, 14, 4195732, 0, "", ""}, + {"__libc_start_main@@GLIBC_2.2.5", 18, 0, false, 0, 0, 0, 450, "", ""}, + {"_IO_stdin_used", 17, 0, false, 0, 15, 4195748, 4, "", ""}, + {"__data_start", 16, 0, false, 0, 24, 6293632, 0, "", ""}, + {"__dso_handle", 17, 2, false, 0, 24, 6293640, 0, "", ""}, + {"__libc_csu_init", 18, 0, false, 0, 13, 4195536, 137, "", ""}, + {"__bss_start", 16, 0, false, 0, 65521, 6293656, 0, "", ""}, + {"_end", 16, 0, false, 0, 65521, 6293664, 0, "", ""}, + {"_edata", 16, 0, false, 0, 65521, 6293656, 0, "", ""}, + {"main", 18, 0, false, 0, 13, 4195480, 27, "", ""}, + {"_init", 18, 0, false, 0, 11, 4195224, 0, "", ""}, + }, + }, + { + "testdata/hello-world-core.gz", + FileHeader{ELFCLASS64, ELFDATA2LSB, EV_CURRENT, ELFOSABI_NONE, 0x0, binary.LittleEndian, ET_CORE, EM_X86_64, 0x0}, + []SectionHeader{}, + []ProgHeader{ + {Type: PT_NOTE, Flags: 0x0, Off: 0x3f8, Vaddr: 0x0, Paddr: 0x0, Filesz: 0x8ac, Memsz: 0x0, Align: 0x0}, + {Type: PT_LOAD, Flags: PF_X + PF_R, Off: 0x1000, Vaddr: 0x400000, Paddr: 0x0, Filesz: 0x0, Memsz: 0x1000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_R, Off: 0x1000, Vaddr: 0x401000, Paddr: 0x0, Filesz: 0x1000, Memsz: 0x1000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x2000, Vaddr: 0x402000, Paddr: 0x0, Filesz: 0x1000, Memsz: 0x1000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_X + PF_R, Off: 0x3000, Vaddr: 0x7f54078b8000, Paddr: 0x0, Filesz: 0x0, Memsz: 0x1b5000, Align: 0x1000}, + {Type: PT_LOAD, Flags: 0x0, Off: 0x3000, Vaddr: 0x7f5407a6d000, Paddr: 0x0, Filesz: 0x0, Memsz: 0x1ff000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_R, Off: 0x3000, Vaddr: 0x7f5407c6c000, Paddr: 0x0, Filesz: 0x4000, Memsz: 0x4000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x7000, Vaddr: 0x7f5407c70000, Paddr: 0x0, Filesz: 0x2000, Memsz: 0x2000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x9000, Vaddr: 0x7f5407c72000, Paddr: 0x0, Filesz: 0x5000, Memsz: 0x5000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_X + PF_R, Off: 0xe000, Vaddr: 0x7f5407c77000, Paddr: 0x0, Filesz: 0x0, Memsz: 0x22000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0xe000, Vaddr: 0x7f5407e81000, Paddr: 0x0, Filesz: 0x3000, Memsz: 0x3000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x11000, Vaddr: 0x7f5407e96000, Paddr: 0x0, Filesz: 0x3000, Memsz: 0x3000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_R, Off: 0x14000, Vaddr: 0x7f5407e99000, Paddr: 0x0, Filesz: 0x1000, Memsz: 0x1000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x15000, Vaddr: 0x7f5407e9a000, Paddr: 0x0, Filesz: 0x2000, Memsz: 0x2000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x17000, Vaddr: 0x7fff79972000, Paddr: 0x0, Filesz: 0x23000, Memsz: 0x23000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_X + PF_R, Off: 0x3a000, Vaddr: 0x7fff799f8000, Paddr: 0x0, Filesz: 0x1000, Memsz: 0x1000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_X + PF_R, Off: 0x3b000, Vaddr: 0xffffffffff600000, Paddr: 0x0, Filesz: 0x1000, Memsz: 0x1000, Align: 0x1000}, + }, + nil, + nil, + }, + { + "testdata/compressed-32.obj", + FileHeader{ELFCLASS32, ELFDATA2LSB, EV_CURRENT, ELFOSABI_NONE, 0x0, binary.LittleEndian, ET_REL, EM_386, 0x0}, + []SectionHeader{ + {"", SHT_NULL, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, + {".text", SHT_PROGBITS, SHF_ALLOC | SHF_EXECINSTR, 0x0, 0x34, 0x17, 0x0, 0x0, 0x1, 0x0, 0x17}, + {".rel.text", SHT_REL, SHF_INFO_LINK, 0x0, 0x3dc, 0x10, 0x13, 0x1, 0x4, 0x8, 0x10}, + {".data", SHT_PROGBITS, SHF_WRITE | SHF_ALLOC, 0x0, 0x4b, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0}, + {".bss", SHT_NOBITS, SHF_WRITE | SHF_ALLOC, 0x0, 0x4b, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0}, + {".rodata", SHT_PROGBITS, SHF_ALLOC, 0x0, 0x4b, 0xd, 0x0, 0x0, 0x1, 0x0, 0xd}, + {".debug_info", SHT_PROGBITS, SHF_COMPRESSED, 0x0, 0x58, 0xb4, 0x0, 0x0, 0x1, 0x0, 0x84}, + {".rel.debug_info", SHT_REL, SHF_INFO_LINK, 0x0, 0x3ec, 0xa0, 0x13, 0x6, 0x4, 0x8, 0xa0}, + {".debug_abbrev", SHT_PROGBITS, 0x0, 0x0, 0xdc, 0x5a, 0x0, 0x0, 0x1, 0x0, 0x5a}, + {".debug_aranges", SHT_PROGBITS, 0x0, 0x0, 0x136, 0x20, 0x0, 0x0, 0x1, 0x0, 0x20}, + {".rel.debug_aranges", SHT_REL, SHF_INFO_LINK, 0x0, 0x48c, 0x10, 0x13, 0x9, 0x4, 0x8, 0x10}, + {".debug_line", SHT_PROGBITS, 0x0, 0x0, 0x156, 0x5c, 0x0, 0x0, 0x1, 0x0, 0x5c}, + {".rel.debug_line", SHT_REL, SHF_INFO_LINK, 0x0, 0x49c, 0x8, 0x13, 0xb, 0x4, 0x8, 0x8}, + {".debug_str", SHT_PROGBITS, SHF_MERGE | SHF_STRINGS | SHF_COMPRESSED, 0x0, 0x1b2, 0x10f, 0x0, 0x0, 0x1, 0x1, 0xb3}, + {".comment", SHT_PROGBITS, SHF_MERGE | SHF_STRINGS, 0x0, 0x265, 0x2a, 0x0, 0x0, 0x1, 0x1, 0x2a}, + {".note.GNU-stack", SHT_PROGBITS, 0x0, 0x0, 0x28f, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0}, + {".eh_frame", SHT_PROGBITS, SHF_ALLOC, 0x0, 0x290, 0x38, 0x0, 0x0, 0x4, 0x0, 0x38}, + {".rel.eh_frame", SHT_REL, SHF_INFO_LINK, 0x0, 0x4a4, 0x8, 0x13, 0x10, 0x4, 0x8, 0x8}, + {".shstrtab", SHT_STRTAB, 0x0, 0x0, 0x4ac, 0xab, 0x0, 0x0, 0x1, 0x0, 0xab}, + {".symtab", SHT_SYMTAB, 0x0, 0x0, 0x2c8, 0x100, 0x14, 0xe, 0x4, 0x10, 0x100}, + {".strtab", SHT_STRTAB, 0x0, 0x0, 0x3c8, 0x13, 0x0, 0x0, 0x1, 0x0, 0x13}, + }, + []ProgHeader{}, + nil, + []Symbol{ + {"hello.c", 4, 0, false, 0, 65521, 0, 0, "", ""}, + {"", 3, 0, false, 0, 1, 0, 0, "", ""}, + {"", 3, 0, false, 0, 3, 0, 0, "", ""}, + {"", 3, 0, false, 0, 4, 0, 0, "", ""}, + {"", 3, 0, false, 0, 5, 0, 0, "", ""}, + {"", 3, 0, false, 0, 6, 0, 0, "", ""}, + {"", 3, 0, false, 0, 8, 0, 0, "", ""}, + {"", 3, 0, false, 0, 9, 0, 0, "", ""}, + {"", 3, 0, false, 0, 11, 0, 0, "", ""}, + {"", 3, 0, false, 0, 13, 0, 0, "", ""}, + {"", 3, 0, false, 0, 15, 0, 0, "", ""}, + {"", 3, 0, false, 0, 16, 0, 0, "", ""}, + {"", 3, 0, false, 0, 14, 0, 0, "", ""}, + {"main", 18, 0, false, 0, 1, 0, 23, "", ""}, + {"puts", 16, 0, false, 0, 0, 0, 0, "", ""}, + }, + }, + { + "testdata/compressed-64.obj", + FileHeader{ELFCLASS64, ELFDATA2LSB, EV_CURRENT, ELFOSABI_NONE, 0x0, binary.LittleEndian, ET_REL, EM_X86_64, 0x0}, + []SectionHeader{ + {"", SHT_NULL, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, + {".text", SHT_PROGBITS, SHF_ALLOC | SHF_EXECINSTR, 0x0, 0x40, 0x1b, 0x0, 0x0, 0x1, 0x0, 0x1b}, + {".rela.text", SHT_RELA, SHF_INFO_LINK, 0x0, 0x488, 0x30, 0x13, 0x1, 0x8, 0x18, 0x30}, + {".data", SHT_PROGBITS, SHF_WRITE | SHF_ALLOC, 0x0, 0x5b, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0}, + {".bss", SHT_NOBITS, SHF_WRITE | SHF_ALLOC, 0x0, 0x5b, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0}, + {".rodata", SHT_PROGBITS, SHF_ALLOC, 0x0, 0x5b, 0xd, 0x0, 0x0, 0x1, 0x0, 0xd}, + {".debug_info", SHT_PROGBITS, SHF_COMPRESSED, 0x0, 0x68, 0xba, 0x0, 0x0, 0x1, 0x0, 0x72}, + {".rela.debug_info", SHT_RELA, SHF_INFO_LINK, 0x0, 0x4b8, 0x1c8, 0x13, 0x6, 0x8, 0x18, 0x1c8}, + {".debug_abbrev", SHT_PROGBITS, 0x0, 0x0, 0xda, 0x5c, 0x0, 0x0, 0x1, 0x0, 0x5c}, + {".debug_aranges", SHT_PROGBITS, SHF_COMPRESSED, 0x0, 0x136, 0x30, 0x0, 0x0, 0x1, 0x0, 0x2f}, + {".rela.debug_aranges", SHT_RELA, SHF_INFO_LINK, 0x0, 0x680, 0x30, 0x13, 0x9, 0x8, 0x18, 0x30}, + {".debug_line", SHT_PROGBITS, 0x0, 0x0, 0x165, 0x60, 0x0, 0x0, 0x1, 0x0, 0x60}, + {".rela.debug_line", SHT_RELA, SHF_INFO_LINK, 0x0, 0x6b0, 0x18, 0x13, 0xb, 0x8, 0x18, 0x18}, + {".debug_str", SHT_PROGBITS, SHF_MERGE | SHF_STRINGS | SHF_COMPRESSED, 0x0, 0x1c5, 0x104, 0x0, 0x0, 0x1, 0x1, 0xc3}, + {".comment", SHT_PROGBITS, SHF_MERGE | SHF_STRINGS, 0x0, 0x288, 0x2a, 0x0, 0x0, 0x1, 0x1, 0x2a}, + {".note.GNU-stack", SHT_PROGBITS, 0x0, 0x0, 0x2b2, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0}, + {".eh_frame", SHT_PROGBITS, SHF_ALLOC, 0x0, 0x2b8, 0x38, 0x0, 0x0, 0x8, 0x0, 0x38}, + {".rela.eh_frame", SHT_RELA, SHF_INFO_LINK, 0x0, 0x6c8, 0x18, 0x13, 0x10, 0x8, 0x18, 0x18}, + {".shstrtab", SHT_STRTAB, 0x0, 0x0, 0x6e0, 0xb0, 0x0, 0x0, 0x1, 0x0, 0xb0}, + {".symtab", SHT_SYMTAB, 0x0, 0x0, 0x2f0, 0x180, 0x14, 0xe, 0x8, 0x18, 0x180}, + {".strtab", SHT_STRTAB, 0x0, 0x0, 0x470, 0x13, 0x0, 0x0, 0x1, 0x0, 0x13}, + }, + []ProgHeader{}, + nil, + []Symbol{ + {"hello.c", 4, 0, false, 0, 65521, 0, 0, "", ""}, + {"", 3, 0, false, 0, 1, 0, 0, "", ""}, + {"", 3, 0, false, 0, 3, 0, 0, "", ""}, + {"", 3, 0, false, 0, 4, 0, 0, "", ""}, + {"", 3, 0, false, 0, 5, 0, 0, "", ""}, + {"", 3, 0, false, 0, 6, 0, 0, "", ""}, + {"", 3, 0, false, 0, 8, 0, 0, "", ""}, + {"", 3, 0, false, 0, 9, 0, 0, "", ""}, + {"", 3, 0, false, 0, 11, 0, 0, "", ""}, + {"", 3, 0, false, 0, 13, 0, 0, "", ""}, + {"", 3, 0, false, 0, 15, 0, 0, "", ""}, + {"", 3, 0, false, 0, 16, 0, 0, "", ""}, + {"", 3, 0, false, 0, 14, 0, 0, "", ""}, + {"main", 18, 0, false, 0, 1, 0, 27, "", ""}, + {"puts", 16, 0, false, 0, 0, 0, 0, "", ""}, + }, + }, + { + "testdata/go-relocation-test-gcc620-sparc64.obj", + FileHeader{Class: ELFCLASS64, Data: ELFDATA2MSB, Version: EV_CURRENT, OSABI: ELFOSABI_NONE, ABIVersion: 0x0, ByteOrder: binary.BigEndian, Type: ET_REL, Machine: EM_SPARCV9, Entry: 0x0}, + []SectionHeader{ + {"", SHT_NULL, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, + {".text", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x0, 0x40, 0x2c, 0x0, 0x0, 0x4, 0x0, 0x2c}, + {".rela.text", SHT_RELA, SHF_INFO_LINK, 0x0, 0xa58, 0x48, 0x13, 0x1, 0x8, 0x18, 0x48}, + {".data", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x0, 0x6c, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0}, + {".bss", SHT_NOBITS, SHF_WRITE + SHF_ALLOC, 0x0, 0x6c, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0}, + {".rodata", SHT_PROGBITS, SHF_ALLOC, 0x0, 0x70, 0xd, 0x0, 0x0, 0x8, 0x0, 0xd}, + {".debug_info", SHT_PROGBITS, 0x0, 0x0, 0x7d, 0x346, 0x0, 0x0, 0x1, 0x0, 0x346}, + {".rela.debug_info", SHT_RELA, SHF_INFO_LINK, 0x0, 0xaa0, 0x630, 0x13, 0x6, 0x8, 0x18, 0x630}, + {".debug_abbrev", SHT_PROGBITS, 0x0, 0x0, 0x3c3, 0xf1, 0x0, 0x0, 0x1, 0x0, 0xf1}, + {".debug_aranges", SHT_PROGBITS, 0x0, 0x0, 0x4b4, 0x30, 0x0, 0x0, 0x1, 0x0, 0x30}, + {".rela.debug_aranges", SHT_RELA, SHF_INFO_LINK, 0x0, 0x10d0, 0x30, 0x13, 0x9, 0x8, 0x18, 0x30}, + {".debug_line", SHT_PROGBITS, 0x0, 0x0, 0x4e4, 0xd3, 0x0, 0x0, 0x1, 0x0, 0xd3}, + {".rela.debug_line", SHT_RELA, SHF_INFO_LINK, 0x0, 0x1100, 0x18, 0x13, 0xb, 0x8, 0x18, 0x18}, + {".debug_str", SHT_PROGBITS, SHF_MERGE + SHF_STRINGS, 0x0, 0x5b7, 0x2a3, 0x0, 0x0, 0x1, 0x1, 0x2a3}, + {".comment", SHT_PROGBITS, SHF_MERGE + SHF_STRINGS, 0x0, 0x85a, 0x2e, 0x0, 0x0, 0x1, 0x1, 0x2e}, + {".note.GNU-stack", SHT_PROGBITS, 0x0, 0x0, 0x888, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0}, + {".debug_frame", SHT_PROGBITS, 0x0, 0x0, 0x888, 0x38, 0x0, 0x0, 0x8, 0x0, 0x38}, + {".rela.debug_frame", SHT_RELA, SHF_INFO_LINK, 0x0, 0x1118, 0x30, 0x13, 0x10, 0x8, 0x18, 0x30}, + {".shstrtab", SHT_STRTAB, 0x0, 0x0, 0x1148, 0xb3, 0x0, 0x0, 0x1, 0x0, 0xb3}, + {".symtab", SHT_SYMTAB, 0x0, 0x0, 0x8c0, 0x180, 0x14, 0xe, 0x8, 0x18, 0x180}, + {".strtab", SHT_STRTAB, 0x0, 0x0, 0xa40, 0x13, 0x0, 0x0, 0x1, 0x0, 0x13}, + }, + []ProgHeader{}, + nil, + []Symbol{ + {"hello.c", 4, 0, false, 0, 65521, 0, 0, "", ""}, + {"", 3, 0, false, 0, 1, 0, 0, "", ""}, + {"", 3, 0, false, 0, 3, 0, 0, "", ""}, + {"", 3, 0, false, 0, 4, 0, 0, "", ""}, + {"", 3, 0, false, 0, 5, 0, 0, "", ""}, + {"", 3, 0, false, 0, 6, 0, 0, "", ""}, + {"", 3, 0, false, 0, 8, 0, 0, "", ""}, + {"", 3, 0, false, 0, 9, 0, 0, "", ""}, + {"", 3, 0, false, 0, 11, 0, 0, "", ""}, + {"", 3, 0, false, 0, 13, 0, 0, "", ""}, + {"", 3, 0, false, 0, 15, 0, 0, "", ""}, + {"", 3, 0, false, 0, 16, 0, 0, "", ""}, + {"", 3, 0, false, 0, 14, 0, 0, "", ""}, + {"main", 18, 0, false, 0, 1, 0, 44, "", ""}, + {"puts", 16, 0, false, 0, 0, 0, 0, "", ""}, + }, + }, + { + "testdata/gcc-riscv64-linux-exec", + FileHeader{ELFCLASS64, ELFDATA2LSB, EV_CURRENT, ELFOSABI_NONE, 0, binary.LittleEndian, ET_EXEC, EM_RISCV, 0x10460}, + []SectionHeader{ + {"", SHT_NULL, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, + {".interp", SHT_PROGBITS, SHF_ALLOC, 0x10270, 0x270, 0x21, 0x0, 0x0, 0x1, 0x0, 0x21}, + {".note.gnu.build-id", SHT_NOTE, SHF_ALLOC, 0x10294, 0x294, 0x24, 0x0, 0x0, 0x4, 0x0, 0x24}, + {".note.ABI-tag", SHT_NOTE, SHF_ALLOC, 0x102b8, 0x2b8, 0x20, 0x0, 0x0, 0x4, 0x0, 0x20}, + {".gnu.hash", SHT_GNU_HASH, SHF_ALLOC, 0x102d8, 0x2d8, 0x30, 0x5, 0x0, 0x8, 0x0, 0x30}, + {".dynsym", SHT_DYNSYM, SHF_ALLOC, 0x10308, 0x308, 0x60, 0x6, 0x1, 0x8, 0x18, 0x60}, + {".dynstr", SHT_STRTAB, SHF_ALLOC, 0x10368, 0x368, 0x4a, 0x0, 0x0, 0x1, 0x0, 0x4a}, + {".gnu.version", SHT_GNU_VERSYM, SHF_ALLOC, 0x103b2, 0x3b2, 0x8, 0x5, 0x0, 0x2, 0x2, 0x8}, + {".gnu.version_r", SHT_GNU_VERNEED, SHF_ALLOC, 0x103c0, 0x3c0, 0x30, 0x6, 0x1, 0x8, 0x0, 0x30}, + {".rela.plt", SHT_RELA, SHF_ALLOC + SHF_INFO_LINK, 0x103f0, 0x3f0, 0x30, 0x5, 0x14, 0x8, 0x18, 0x30}, + {".plt", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x10420, 0x420, 0x40, 0x0, 0x0, 0x10, 0x10, 0x40}, + {".text", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x10460, 0x460, 0xd8, 0x0, 0x0, 0x4, 0x0, 0xd8}, + {".rodata", SHT_PROGBITS, SHF_ALLOC, 0x10538, 0x538, 0x15, 0x0, 0x0, 0x8, 0x0, 0x15}, + {".eh_frame_hdr", SHT_PROGBITS, SHF_ALLOC, 0x10550, 0x550, 0x24, 0x0, 0x0, 0x4, 0x0, 0x24}, + {".eh_frame", SHT_PROGBITS, SHF_ALLOC, 0x10578, 0x578, 0x6c, 0x0, 0x0, 0x8, 0x0, 0x6c}, + {".preinit_array", SHT_PREINIT_ARRAY, SHF_WRITE + SHF_ALLOC, 0x11e00, 0xe00, 0x8, 0x0, 0x0, 0x1, 0x8, 0x8}, + {".init_array", SHT_INIT_ARRAY, SHF_WRITE + SHF_ALLOC, 0x11e08, 0xe08, 0x8, 0x0, 0x0, 0x8, 0x8, 0x8}, + {".fini_array", SHT_FINI_ARRAY, SHF_WRITE + SHF_ALLOC, 0x11e10, 0xe10, 0x8, 0x0, 0x0, 0x8, 0x8, 0x8}, + {".dynamic", SHT_DYNAMIC, SHF_WRITE + SHF_ALLOC, 0x11e18, 0xe18, 0x1d0, 0x6, 0x0, 0x8, 0x10, 0x1d0}, + {".got", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x11fe8, 0xfe8, 0x8, 0x0, 0x0, 0x8, 0x8, 0x8}, + {".got.plt", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x11ff0, 0xff0, 0x20, 0x0, 0x0, 0x8, 0x8, 0x20}, + {".sdata", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x12010, 0x1010, 0x8, 0x0, 0x0, 0x8, 0x0, 0x8}, + {".bss", SHT_NOBITS, SHF_WRITE + SHF_ALLOC, 0x12018, 0x1018, 0x8, 0x0, 0x0, 0x1, 0x0, 0x8}, + {".comment", SHT_PROGBITS, SHF_MERGE + SHF_STRINGS, 0x0, 0x1018, 0x26, 0x0, 0x0, 0x1, 0x1, 0x26}, + {".riscv.attributes", SHT_RISCV_ATTRIBUTES, 0x0, 0x0, 0x103e, 0x66, 0x0, 0x0, 0x1, 0x0, 0x66}, + {".shstrtab", SHT_STRTAB, 0x0, 0x0, 0x10a4, 0xff, 0x0, 0x0, 0x1, 0x0, 0xff}, + }, + []ProgHeader{ + {PT_PHDR, PF_R, 0x40, 0x10040, 0x10040, 0x230, 0x230, 0x8}, + {PT_INTERP, PF_R, 0x270, 0x10270, 0x10270, 0x21, 0x21, 0x1}, + {PT_RISCV_ATTRIBUTES, PF_R, 0x103e, 0x0, 0x0, 0x66, 0x0, 0x1}, + {PT_LOAD, PF_X + PF_R, 0x0, 0x10000, 0x10000, 0x5e4, 0x5e4, 0x1000}, + {PT_LOAD, PF_W + PF_R, 0xe00, 0x11e00, 0x11e00, 0x218, 0x220, 0x1000}, + {PT_DYNAMIC, PF_W + PF_R, 0xe18, 0x11e18, 0x11e18, 0x1d0, 0x1d0, 0x8}, + {PT_NOTE, PF_R, 0x294, 0x10294, 0x10294, 0x44, 0x44, 0x4}, + {PT_GNU_EH_FRAME, PF_R, 0x550, 0x10550, 0x10550, 0x24, 0x24, 0x4}, + {PT_GNU_STACK, PF_W + PF_R, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10}, + {PT_GNU_RELRO, PF_R, 0xe00, 0x11e00, 0x11e00, 0x200, 0x200, 0x1}, + }, + []string{"libc.so.6"}, + nil, + }, +} + +func TestOpen(t *testing.T) { + for i := range fileTests { + tt := &fileTests[i] + + var f *File + var err error + if path.Ext(tt.file) == ".gz" { + var r io.ReaderAt + if r, err = decompress(tt.file); err == nil { + f, err = NewFile(r) + } + } else { + f, err = Open(tt.file) + } + if err != nil { + t.Errorf("cannot open file %s: %v", tt.file, err) + continue + } + defer f.Close() + if f.FileHeader != tt.hdr { + t.Errorf("open %s:\n\thave %#v\n\twant %#v\n", tt.file, f.FileHeader, tt.hdr) + continue + } + for i, s := range f.Sections { + if i >= len(tt.sections) { + break + } + sh := tt.sections[i] + if s.SectionHeader != sh { + t.Errorf("open %s, section %d:\n\thave %#v\n\twant %#v\n", tt.file, i, s.SectionHeader, sh) + } + } + for i, p := range f.Progs { + if i >= len(tt.progs) { + break + } + ph := tt.progs[i] + if p.ProgHeader != ph { + t.Errorf("open %s, program %d:\n\thave %#v\n\twant %#v\n", tt.file, i, p.ProgHeader, ph) + } + } + tn := len(tt.sections) + fn := len(f.Sections) + if tn != fn { + t.Errorf("open %s: len(Sections) = %d, want %d", tt.file, fn, tn) + } + tn = len(tt.progs) + fn = len(f.Progs) + if tn != fn { + t.Errorf("open %s: len(Progs) = %d, want %d", tt.file, fn, tn) + } + tl := tt.needed + fl, err := f.ImportedLibraries() + if err != nil { + t.Error(err) + } + if !reflect.DeepEqual(tl, fl) { + t.Errorf("open %s: DT_NEEDED = %v, want %v", tt.file, tl, fl) + } + symbols, err := f.Symbols() + if tt.symbols == nil { + if !errors.Is(err, ErrNoSymbols) { + t.Errorf("open %s: Symbols() expected ErrNoSymbols, have nil", tt.file) + } + if symbols != nil { + t.Errorf("open %s: Symbols() expected no symbols, have %v", tt.file, symbols) + } + } else { + if err != nil { + t.Errorf("open %s: Symbols() unexpected error %v", tt.file, err) + } + if !slices.Equal(symbols, tt.symbols) { + t.Errorf("open %s: Symbols() = %v, want %v", tt.file, symbols, tt.symbols) + } + } + } +} + +// elf.NewFile requires io.ReaderAt, which compress/gzip cannot +// provide. Decompress the file to a bytes.Reader. +func decompress(gz string) (io.ReaderAt, error) { + in, err := os.Open(gz) + if err != nil { + return nil, err + } + defer in.Close() + r, err := gzip.NewReader(in) + if err != nil { + return nil, err + } + var out bytes.Buffer + _, err = io.Copy(&out, r) + return bytes.NewReader(out.Bytes()), err +} + +type relocationTestEntry struct { + entryNumber int + entry *dwarf.Entry + pcRanges [][2]uint64 +} + +type relocationTest struct { + file string + entries []relocationTestEntry +} + +var relocationTests = []relocationTest{ + { + "testdata/go-relocation-test-gcc441-x86-64.obj", + []relocationTestEntry{ + { + entry: &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C 4.4.1", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLanguage, Val: int64(1), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrName, Val: "go-relocation-test.c", Class: dwarf.ClassString}, + {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrHighpc, Val: uint64(0x6), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}, + }, + }, + pcRanges: [][2]uint64{{0x0, 0x6}}, + }, + }, + }, + { + "testdata/go-relocation-test-gcc441-x86.obj", + []relocationTestEntry{ + { + entry: &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C 4.4.1", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLanguage, Val: int64(1), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrName, Val: "t.c", Class: dwarf.ClassString}, + {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrHighpc, Val: uint64(0x5), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}, + }, + }, + pcRanges: [][2]uint64{{0x0, 0x5}}, + }, + }, + }, + { + "testdata/go-relocation-test-gcc424-x86-64.obj", + []relocationTestEntry{ + { + entry: &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C 4.2.4 (Ubuntu 4.2.4-1ubuntu4)", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLanguage, Val: int64(1), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrName, Val: "go-relocation-test-gcc424.c", Class: dwarf.ClassString}, + {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrHighpc, Val: uint64(0x6), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}, + }, + }, + pcRanges: [][2]uint64{{0x0, 0x6}}, + }, + }, + }, + { + "testdata/go-relocation-test-gcc482-aarch64.obj", + []relocationTestEntry{ + { + entry: &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C 4.8.2 -g -fstack-protector", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLanguage, Val: int64(1), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrName, Val: "go-relocation-test-gcc482.c", Class: dwarf.ClassString}, + {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrHighpc, Val: int64(0x24), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}, + }, + }, + pcRanges: [][2]uint64{{0x0, 0x24}}, + }, + }, + }, + { + "testdata/go-relocation-test-gcc492-arm.obj", + []relocationTestEntry{ + { + entry: &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C 4.9.2 20141224 (prerelease) -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -mtls-dialect=gnu -g", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLanguage, Val: int64(1), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrName, Val: "go-relocation-test-gcc492.c", Class: dwarf.ClassString}, + {Attr: dwarf.AttrCompDir, Val: "/root/go/src/debug/elf/testdata", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrHighpc, Val: int64(0x28), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}, + }, + }, + pcRanges: [][2]uint64{{0x0, 0x28}}, + }, + }, + }, + { + "testdata/go-relocation-test-clang-arm.obj", + []relocationTestEntry{ + { + entry: &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0)", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLanguage, Val: int64(12), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrName, Val: "hello.c", Class: dwarf.ClassString}, + {Attr: dwarf.AttrStmtList, Val: int64(0x0), Class: dwarf.ClassLinePtr}, + {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrHighpc, Val: int64(0x30), Class: dwarf.ClassConstant}, + }, + }, + pcRanges: [][2]uint64{{0x0, 0x30}}, + }, + }, + }, + { + "testdata/go-relocation-test-gcc5-ppc.obj", + []relocationTestEntry{ + { + entry: &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C11 5.0.0 20150116 (experimental) -Asystem=linux -Asystem=unix -Asystem=posix -g", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLanguage, Val: int64(12), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrName, Val: "go-relocation-test-gcc5-ppc.c", Class: dwarf.ClassString}, + {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrHighpc, Val: int64(0x44), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}, + }, + }, + pcRanges: [][2]uint64{{0x0, 0x44}}, + }, + }, + }, + { + "testdata/go-relocation-test-gcc482-ppc64le.obj", + []relocationTestEntry{ + { + entry: &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C 4.8.2 -Asystem=linux -Asystem=unix -Asystem=posix -msecure-plt -mtune=power8 -mcpu=power7 -gdwarf-2 -fstack-protector", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLanguage, Val: int64(1), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrName, Val: "go-relocation-test-gcc482-ppc64le.c", Class: dwarf.ClassString}, + {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrHighpc, Val: uint64(0x24), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}, + }, + }, + pcRanges: [][2]uint64{{0x0, 0x24}}, + }, + }, + }, + { + "testdata/go-relocation-test-gcc492-mips64.obj", + []relocationTestEntry{ + { + entry: &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C 4.9.2 -meb -mabi=64 -march=mips3 -mtune=mips64 -mllsc -mno-shared -g", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLanguage, Val: int64(1), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrName, Val: "hello.c", Class: dwarf.ClassString}, + {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrHighpc, Val: int64(0x64), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}, + }, + }, + pcRanges: [][2]uint64{{0x0, 0x64}}, + }, + }, + }, + { + "testdata/go-relocation-test-gcc531-s390x.obj", + []relocationTestEntry{ + { + entry: &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C11 5.3.1 20160316 -march=zEC12 -m64 -mzarch -g -fstack-protector-strong", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLanguage, Val: int64(12), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrName, Val: "hello.c", Class: dwarf.ClassString}, + {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrHighpc, Val: int64(0x3a), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}, + }, + }, + pcRanges: [][2]uint64{{0x0, 0x3a}}, + }, + }, + }, + { + "testdata/go-relocation-test-gcc620-sparc64.obj", + []relocationTestEntry{ + { + entry: &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C11 6.2.0 20160914 -mcpu=v9 -g -fstack-protector-strong", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLanguage, Val: int64(12), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrName, Val: "hello.c", Class: dwarf.ClassString}, + {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrHighpc, Val: int64(0x2c), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}, + }, + }, + pcRanges: [][2]uint64{{0x0, 0x2c}}, + }, + }, + }, + { + "testdata/go-relocation-test-gcc492-mipsle.obj", + []relocationTestEntry{ + { + entry: &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C 4.9.2 -mel -march=mips2 -mtune=mips32 -mllsc -mno-shared -mabi=32 -g", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLanguage, Val: int64(1), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrName, Val: "hello.c", Class: dwarf.ClassString}, + {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrHighpc, Val: int64(0x58), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}, + }, + }, + pcRanges: [][2]uint64{{0x0, 0x58}}, + }, + }, + }, + { + "testdata/go-relocation-test-gcc540-mips.obj", + []relocationTestEntry{ + { + entry: &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C11 5.4.0 20160609 -meb -mips32 -mtune=mips32r2 -mfpxx -mllsc -mno-shared -mabi=32 -g -gdwarf-2", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLanguage, Val: int64(12), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrName, Val: "hello.c", Class: dwarf.ClassString}, + {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrHighpc, Val: uint64(0x5c), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}, + }, + }, + pcRanges: [][2]uint64{{0x0, 0x5c}}, + }, + }, + }, + { + "testdata/go-relocation-test-gcc493-mips64le.obj", + []relocationTestEntry{ + { + entry: &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C 4.9.3 -mel -mabi=64 -mllsc -mno-shared -g -fstack-protector-strong", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLanguage, Val: int64(1), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrName, Val: "hello.c", Class: dwarf.ClassString}, + {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrHighpc, Val: int64(0x64), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}, + }, + }, + pcRanges: [][2]uint64{{0x0, 0x64}}, + }, + }, + }, + { + "testdata/go-relocation-test-gcc720-riscv64.obj", + []relocationTestEntry{ + { + entry: &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C11 7.2.0 -march=rv64imafdc -mabi=lp64d -g -gdwarf-2", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLanguage, Val: int64(12), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrName, Val: "hello.c", Class: dwarf.ClassString}, + {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrHighpc, Val: uint64(0x2c), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}, + }, + }, + pcRanges: [][2]uint64{{0x0, 0x2c}}, + }, + }, + }, + { + "testdata/go-relocation-test-clang-x86.obj", + []relocationTestEntry{ + { + entry: &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "clang version google3-trunk (trunk r209387)", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLanguage, Val: int64(12), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrName, Val: "go-relocation-test-clang.c", Class: dwarf.ClassString}, + {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}, + {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, + }, + }, + }, + }, + }, + { + "testdata/gcc-amd64-openbsd-debug-with-rela.obj", + []relocationTestEntry{ + { + entryNumber: 203, + entry: &dwarf.Entry{ + Offset: 0xc62, + Tag: dwarf.TagMember, + Children: false, + Field: []dwarf.Field{ + {Attr: dwarf.AttrName, Val: "it_interval", Class: dwarf.ClassString}, + {Attr: dwarf.AttrDeclFile, Val: int64(7), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrDeclLine, Val: int64(236), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrType, Val: dwarf.Offset(0xb7f), Class: dwarf.ClassReference}, + {Attr: dwarf.AttrDataMemberLoc, Val: []byte{0x23, 0x0}, Class: dwarf.ClassExprLoc}, + }, + }, + }, + { + entryNumber: 204, + entry: &dwarf.Entry{ + Offset: 0xc70, + Tag: dwarf.TagMember, + Children: false, + Field: []dwarf.Field{ + {Attr: dwarf.AttrName, Val: "it_value", Class: dwarf.ClassString}, + {Attr: dwarf.AttrDeclFile, Val: int64(7), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrDeclLine, Val: int64(237), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrType, Val: dwarf.Offset(0xb7f), Class: dwarf.ClassReference}, + {Attr: dwarf.AttrDataMemberLoc, Val: []byte{0x23, 0x10}, Class: dwarf.ClassExprLoc}, + }, + }, + }, + }, + }, + { + "testdata/go-relocation-test-gcc930-ranges-no-rela-x86-64", + []relocationTestEntry{ + { + entry: &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C17 9.3.0 -mtune=generic -march=x86-64 -g -fno-asynchronous-unwind-tables", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLanguage, Val: int64(12), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrName, Val: "multiple-code-sections.c", Class: dwarf.ClassString}, + {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, + {Attr: dwarf.AttrRanges, Val: int64(0), Class: dwarf.ClassRangeListPtr}, + {Attr: dwarf.AttrLowpc, Val: uint64(0), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}, + }, + }, + pcRanges: [][2]uint64{ + {0x765, 0x777}, + {0x7e1, 0x7ec}, + }, + }, + }, + }, + { + "testdata/go-relocation-test-gcc930-ranges-with-rela-x86-64", + []relocationTestEntry{ + { + entry: &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C17 9.3.0 -mtune=generic -march=x86-64 -g -fno-asynchronous-unwind-tables", Class: dwarf.ClassString}, + {Attr: dwarf.AttrLanguage, Val: int64(12), Class: dwarf.ClassConstant}, + {Attr: dwarf.AttrName, Val: "multiple-code-sections.c", Class: dwarf.ClassString}, + {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, + {Attr: dwarf.AttrRanges, Val: int64(0), Class: dwarf.ClassRangeListPtr}, + {Attr: dwarf.AttrLowpc, Val: uint64(0), Class: dwarf.ClassAddress}, + {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}, + }, + }, + pcRanges: [][2]uint64{ + {0x765, 0x777}, + {0x7e1, 0x7ec}, + }, + }, + }, + }, +} + +func TestDWARFRelocations(t *testing.T) { + for _, test := range relocationTests { + t.Run(test.file, func(t *testing.T) { + t.Parallel() + f, err := Open(test.file) + if err != nil { + t.Fatal(err) + } + dwarf, err := f.DWARF() + if err != nil { + t.Fatal(err) + } + reader := dwarf.Reader() + idx := 0 + for _, testEntry := range test.entries { + if testEntry.entryNumber < idx { + t.Fatalf("internal test error: %d < %d", testEntry.entryNumber, idx) + } + for ; idx < testEntry.entryNumber; idx++ { + entry, err := reader.Next() + if entry == nil || err != nil { + t.Fatalf("Failed to skip to entry %d: %v", testEntry.entryNumber, err) + } + } + entry, err := reader.Next() + idx++ + if err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(testEntry.entry, entry) { + t.Errorf("entry %d mismatch: got:%#v want:%#v", testEntry.entryNumber, entry, testEntry.entry) + } + pcRanges, err := dwarf.Ranges(entry) + if err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(testEntry.pcRanges, pcRanges) { + t.Errorf("entry %d: PC range mismatch: got:%#v want:%#v", testEntry.entryNumber, pcRanges, testEntry.pcRanges) + } + } + }) + } +} + +func TestCompressedDWARF(t *testing.T) { + // Test file built with GCC 4.8.4 and as 2.24 using: + // gcc -Wa,--compress-debug-sections -g -c -o zdebug-test-gcc484-x86-64.obj hello.c + f, err := Open("testdata/zdebug-test-gcc484-x86-64.obj") + if err != nil { + t.Fatal(err) + } + dwarf, err := f.DWARF() + if err != nil { + t.Fatal(err) + } + reader := dwarf.Reader() + n := 0 + for { + entry, err := reader.Next() + if err != nil { + t.Fatal(err) + } + if entry == nil { + break + } + n++ + } + if n != 18 { + t.Fatalf("want %d DWARF entries, got %d", 18, n) + } +} + +func TestCompressedSection(t *testing.T) { + // Test files built with gcc -g -S hello.c and assembled with + // --compress-debug-sections=zlib-gabi. + f, err := Open("testdata/compressed-64.obj") + if err != nil { + t.Fatal(err) + } + sec := f.Section(".debug_info") + wantData := []byte{ + 182, 0, 0, 0, 4, 0, 0, 0, 0, 0, 8, 1, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 8, 7, + 0, 0, 0, 0, 2, 1, 8, 0, 0, 0, 0, 2, 2, 7, 0, 0, + 0, 0, 2, 4, 7, 0, 0, 0, 0, 2, 1, 6, 0, 0, 0, 0, + 2, 2, 5, 0, 0, 0, 0, 3, 4, 5, 105, 110, 116, 0, 2, 8, + 5, 0, 0, 0, 0, 2, 8, 7, 0, 0, 0, 0, 4, 8, 114, 0, + 0, 0, 2, 1, 6, 0, 0, 0, 0, 5, 0, 0, 0, 0, 1, 4, + 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, 0, 0, 0, 0, 0, 0, + 1, 156, 179, 0, 0, 0, 6, 0, 0, 0, 0, 1, 4, 87, 0, 0, + 0, 2, 145, 108, 6, 0, 0, 0, 0, 1, 4, 179, 0, 0, 0, 2, + 145, 96, 0, 4, 8, 108, 0, 0, 0, 0, + } + + // Test Data method. + b, err := sec.Data() + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(wantData, b) { + t.Fatalf("want data %x, got %x", wantData, b) + } + + // Test Open method and seeking. + buf, have, count := make([]byte, len(b)), make([]bool, len(b)), 0 + sf := sec.Open() + if got, err := sf.Seek(0, io.SeekEnd); got != int64(len(b)) || err != nil { + t.Fatalf("want seek end %d, got %d error %v", len(b), got, err) + } + if n, err := sf.Read(buf); n != 0 || err != io.EOF { + t.Fatalf("want EOF with 0 bytes, got %v with %d bytes", err, n) + } + pos := int64(len(buf)) + for count < len(buf) { + // Construct random seek arguments. + whence := rand.Intn(3) + target := rand.Int63n(int64(len(buf))) + var offset int64 + switch whence { + case io.SeekStart: + offset = target + case io.SeekCurrent: + offset = target - pos + case io.SeekEnd: + offset = target - int64(len(buf)) + } + pos, err = sf.Seek(offset, whence) + if err != nil { + t.Fatal(err) + } + if pos != target { + t.Fatalf("want position %d, got %d", target, pos) + } + + // Read data from the new position. + end := pos + 16 + if end > int64(len(buf)) { + end = int64(len(buf)) + } + n, err := io.ReadFull(sf, buf[pos:end]) + if err != nil { + t.Fatal(err) + } + for i := 0; i < n; i++ { + if !have[pos] { + have[pos] = true + count++ + } + pos++ + } + } + if !bytes.Equal(wantData, buf) { + t.Fatalf("want data %x, got %x", wantData, buf) + } +} + +func TestNoSectionOverlaps(t *testing.T) { + // Ensure cmd/link outputs sections without overlaps. + switch runtime.GOOS { + case "aix", "android", "darwin", "ios", "js", "plan9", "windows", "wasip1": + t.Skipf("cmd/link doesn't produce ELF binaries on %s", runtime.GOOS) + } + _ = net.ResolveIPAddr // force dynamic linkage + f, err := Open(os.Args[0]) + if err != nil { + t.Error(err) + return + } + for i, si := range f.Sections { + sih := si.SectionHeader + if sih.Type == SHT_NOBITS { + continue + } + // checking for overlap in file + for j, sj := range f.Sections { + sjh := sj.SectionHeader + if i == j || sjh.Type == SHT_NOBITS || sih.Offset == sjh.Offset && sih.FileSize == 0 { + continue + } + if sih.Offset >= sjh.Offset && sih.Offset < sjh.Offset+sjh.FileSize { + t.Errorf("ld produced ELF with section offset %s within %s: 0x%x <= 0x%x..0x%x < 0x%x", + sih.Name, sjh.Name, sjh.Offset, sih.Offset, sih.Offset+sih.FileSize, sjh.Offset+sjh.FileSize) + } + } + + if sih.Flags&SHF_ALLOC == 0 { + continue + } + + // checking for overlap in address space + for j, sj := range f.Sections { + sjh := sj.SectionHeader + if i == j || sjh.Flags&SHF_ALLOC == 0 || sjh.Type == SHT_NOBITS || + sih.Addr == sjh.Addr && sih.Size == 0 { + continue + } + if sih.Addr >= sjh.Addr && sih.Addr < sjh.Addr+sjh.Size { + t.Errorf("ld produced ELF with section address %s within %s: 0x%x <= 0x%x..0x%x < 0x%x", + sih.Name, sjh.Name, sjh.Addr, sih.Addr, sih.Addr+sih.Size, sjh.Addr+sjh.Size) + } + } + } +} + +func TestNobitsSection(t *testing.T) { + const testdata = "testdata/gcc-amd64-linux-exec" + f, err := Open(testdata) + if err != nil { + t.Fatalf("could not read %s: %v", testdata, err) + } + defer f.Close() + + wantError := "unexpected read from SHT_NOBITS section" + bss := f.Section(".bss") + + _, err = bss.Data() + if err == nil || err.Error() != wantError { + t.Fatalf("bss.Data() got error %q, want error %q", err, wantError) + } + + r := bss.Open() + p := make([]byte, 1) + _, err = r.Read(p) + if err == nil || err.Error() != wantError { + t.Fatalf("r.Read(p) got error %q, want error %q", err, wantError) + } +} + +// TestLargeNumberOfSections tests the case that a file has greater than or +// equal to 65280 (0xff00) sections. +func TestLargeNumberOfSections(t *testing.T) { + // A file with >= 0xff00 sections is too big, so we will construct it on the + // fly. The original file "y.o" is generated by these commands: + // 1. generate "y.c": + // for i in `seq 1 65288`; do + // printf -v x "%04x" i; + // echo "int var_$x __attribute__((section(\"section_$x\"))) = $i;" + // done > y.c + // 2. compile: gcc -c y.c -m32 + // + // $readelf -h y.o + // ELF Header: + // Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 + // Class: ELF32 + // Data: 2's complement, little endian + // Version: 1 (current) + // OS/ABI: UNIX - System V + // ABI Version: 0 + // Type: REL (Relocatable file) + // Machine: Intel 80386 + // Version: 0x1 + // Entry point address: 0x0 + // Start of program headers: 0 (bytes into file) + // Start of section headers: 3003468 (bytes into file) + // Flags: 0x0 + // Size of this header: 52 (bytes) + // Size of program headers: 0 (bytes) + // Number of program headers: 0 + // Size of section headers: 40 (bytes) + // Number of section headers: 0 (65298) + // Section header string table index: 65535 (65297) + // + // $readelf -S y.o + // There are 65298 section headers, starting at offset 0x2dd44c: + // Section Headers: + // [Nr] Name Type Addr Off Size ES Flg Lk Inf Al + // [ 0] NULL 00000000 000000 00ff12 00 65297 0 0 + // [ 1] .text PROGBITS 00000000 000034 000000 00 AX 0 0 1 + // [ 2] .data PROGBITS 00000000 000034 000000 00 WA 0 0 1 + // [ 3] .bss NOBITS 00000000 000034 000000 00 WA 0 0 1 + // [ 4] section_0001 PROGBITS 00000000 000034 000004 00 WA 0 0 4 + // [ 5] section_0002 PROGBITS 00000000 000038 000004 00 WA 0 0 4 + // [ section_0003 ~ section_ff06 truncated ] + // [65290] section_ff07 PROGBITS 00000000 03fc4c 000004 00 WA 0 0 4 + // [65291] section_ff08 PROGBITS 00000000 03fc50 000004 00 WA 0 0 4 + // [65292] .comment PROGBITS 00000000 03fc54 000027 01 MS 0 0 1 + // [65293] .note.GNU-stack PROGBITS 00000000 03fc7b 000000 00 0 0 1 + // [65294] .symtab SYMTAB 00000000 03fc7c 0ff0a0 10 65296 2 4 + // [65295] .symtab_shndx SYMTAB SECTION 00000000 13ed1c 03fc28 04 65294 0 4 + // [65296] .strtab STRTAB 00000000 17e944 08f74d 00 0 0 1 + // [65297] .shstrtab STRTAB 00000000 20e091 0cf3bb 00 0 0 1 + + var buf bytes.Buffer + + { + buf.Grow(0x55AF1C) // 3003468 + 40 * 65298 + + h := Header32{ + Ident: [16]byte{0x7F, 'E', 'L', 'F', 0x01, 0x01, 0x01}, + Type: 1, + Machine: 3, + Version: 1, + Shoff: 0x2DD44C, + Ehsize: 0x34, + Shentsize: 0x28, + Shnum: 0, + Shstrndx: 0xFFFF, + } + binary.Write(&buf, binary.LittleEndian, h) + + // Zero out sections [1]~[65294]. + buf.Write(bytes.Repeat([]byte{0}, 0x13ED1C-binary.Size(h))) + + // Write section [65295]. Section [65295] are all zeros except for the + // last 48 bytes. + buf.Write(bytes.Repeat([]byte{0}, 0x03FC28-12*4)) + for i := 0; i < 12; i++ { + binary.Write(&buf, binary.LittleEndian, uint32(0xFF00|i)) + } + + // Write section [65296]. + buf.Write([]byte{0}) + buf.Write([]byte("y.c\x00")) + for i := 1; i <= 65288; i++ { + // var_0001 ~ var_ff08 + name := fmt.Sprintf("var_%04x", i) + buf.Write([]byte(name)) + buf.Write([]byte{0}) + } + + // Write section [65297]. + buf.Write([]byte{0}) + buf.Write([]byte(".symtab\x00")) + buf.Write([]byte(".strtab\x00")) + buf.Write([]byte(".shstrtab\x00")) + buf.Write([]byte(".text\x00")) + buf.Write([]byte(".data\x00")) + buf.Write([]byte(".bss\x00")) + for i := 1; i <= 65288; i++ { + // s_0001 ~ s_ff08 + name := fmt.Sprintf("section_%04x", i) + buf.Write([]byte(name)) + buf.Write([]byte{0}) + } + buf.Write([]byte(".comment\x00")) + buf.Write([]byte(".note.GNU-stack\x00")) + buf.Write([]byte(".symtab_shndx\x00")) + + // Write section header table. + // NULL + binary.Write(&buf, binary.LittleEndian, Section32{Name: 0, Size: 0xFF12, Link: 0xFF11}) + // .text + binary.Write(&buf, binary.LittleEndian, Section32{ + Name: 0x1B, + Type: uint32(SHT_PROGBITS), + Flags: uint32(SHF_ALLOC | SHF_EXECINSTR), + Off: 0x34, + Addralign: 0x01, + }) + // .data + binary.Write(&buf, binary.LittleEndian, Section32{ + Name: 0x21, + Type: uint32(SHT_PROGBITS), + Flags: uint32(SHF_WRITE | SHF_ALLOC), + Off: 0x34, + Addralign: 0x01, + }) + // .bss + binary.Write(&buf, binary.LittleEndian, Section32{ + Name: 0x27, + Type: uint32(SHT_NOBITS), + Flags: uint32(SHF_WRITE | SHF_ALLOC), + Off: 0x34, + Addralign: 0x01, + }) + // s_1 ~ s_65537 + for i := 0; i < 65288; i++ { + s := Section32{ + Name: uint32(0x2C + i*13), + Type: uint32(SHT_PROGBITS), + Flags: uint32(SHF_WRITE | SHF_ALLOC), + Off: uint32(0x34 + i*4), + Size: 0x04, + Addralign: 0x04, + } + binary.Write(&buf, binary.LittleEndian, s) + } + // .comment + binary.Write(&buf, binary.LittleEndian, Section32{ + Name: 0x0CF394, + Type: uint32(SHT_PROGBITS), + Flags: uint32(SHF_MERGE | SHF_STRINGS), + Off: 0x03FC54, + Size: 0x27, + Addralign: 0x01, + Entsize: 0x01, + }) + // .note.GNU-stack + binary.Write(&buf, binary.LittleEndian, Section32{ + Name: 0x0CF39D, + Type: uint32(SHT_PROGBITS), + Off: 0x03FC7B, + Addralign: 0x01, + }) + // .symtab + binary.Write(&buf, binary.LittleEndian, Section32{ + Name: 0x01, + Type: uint32(SHT_SYMTAB), + Off: 0x03FC7C, + Size: 0x0FF0A0, + Link: 0xFF10, + Info: 0x02, + Addralign: 0x04, + Entsize: 0x10, + }) + // .symtab_shndx + binary.Write(&buf, binary.LittleEndian, Section32{ + Name: 0x0CF3AD, + Type: uint32(SHT_SYMTAB_SHNDX), + Off: 0x13ED1C, + Size: 0x03FC28, + Link: 0xFF0E, + Addralign: 0x04, + Entsize: 0x04, + }) + // .strtab + binary.Write(&buf, binary.LittleEndian, Section32{ + Name: 0x09, + Type: uint32(SHT_STRTAB), + Off: 0x17E944, + Size: 0x08F74D, + Addralign: 0x01, + }) + // .shstrtab + binary.Write(&buf, binary.LittleEndian, Section32{ + Name: 0x11, + Type: uint32(SHT_STRTAB), + Off: 0x20E091, + Size: 0x0CF3BB, + Addralign: 0x01, + }) + } + + data := buf.Bytes() + + f, err := NewFile(bytes.NewReader(data)) + if err != nil { + t.Errorf("cannot create file from data: %v", err) + } + defer f.Close() + + wantFileHeader := FileHeader{ + Class: ELFCLASS32, + Data: ELFDATA2LSB, + Version: EV_CURRENT, + OSABI: ELFOSABI_NONE, + ByteOrder: binary.LittleEndian, + Type: ET_REL, + Machine: EM_386, + } + if f.FileHeader != wantFileHeader { + t.Errorf("\nhave %#v\nwant %#v\n", f.FileHeader, wantFileHeader) + } + + wantSectionNum := 65298 + if len(f.Sections) != wantSectionNum { + t.Errorf("len(Sections) = %d, want %d", len(f.Sections), wantSectionNum) + } + + wantSectionHeader := SectionHeader{ + Name: "section_0007", + Type: SHT_PROGBITS, + Flags: SHF_WRITE + SHF_ALLOC, + Offset: 0x4c, + Size: 0x4, + Addralign: 0x4, + FileSize: 0x4, + } + if f.Sections[10].SectionHeader != wantSectionHeader { + t.Errorf("\nhave %#v\nwant %#v\n", f.Sections[10].SectionHeader, wantSectionHeader) + } +} + +func TestIssue10996(t *testing.T) { + data := []byte("\u007fELF\x02\x01\x010000000000000" + + "\x010000000000000000000" + + "\x00\x00\x00\x00\x00\x00\x00\x0000000000\x00\x00\x00\x00" + + "0000") + _, err := NewFile(bytes.NewReader(data)) + if err == nil { + t.Fatalf("opening invalid ELF file unexpectedly succeeded") + } +} + +func TestDynValue(t *testing.T) { + const testdata = "testdata/gcc-amd64-linux-exec" + f, err := Open(testdata) + if err != nil { + t.Fatalf("could not read %s: %v", testdata, err) + } + defer f.Close() + + vals, err := f.DynValue(DT_VERNEEDNUM) + if err != nil { + t.Fatalf("DynValue(DT_VERNEEDNUM): got unexpected error %v", err) + } + + if len(vals) != 1 || vals[0] != 1 { + t.Errorf("DynValue(DT_VERNEEDNUM): got %v, want [1]", vals) + } +} + +func TestIssue59208(t *testing.T) { + // corrupted dwarf data should raise invalid dwarf data instead of invalid zlib + const orig = "testdata/compressed-64.obj" + f, err := Open(orig) + if err != nil { + t.Fatal(err) + } + sec := f.Section(".debug_info") + + data, err := os.ReadFile(orig) + if err != nil { + t.Fatal(err) + } + + dn := make([]byte, len(data)) + zoffset := sec.Offset + uint64(sec.compressionOffset) + copy(dn, data[:zoffset]) + + ozd, err := sec.Data() + if err != nil { + t.Fatal(err) + } + buf := bytes.NewBuffer(nil) + wr := zlib.NewWriter(buf) + // corrupt origin data same as COMPRESS_ZLIB + copy(ozd, []byte{1, 0, 0, 0}) + wr.Write(ozd) + wr.Close() + + copy(dn[zoffset:], buf.Bytes()) + copy(dn[sec.Offset+sec.FileSize:], data[sec.Offset+sec.FileSize:]) + + nf, err := NewFile(bytes.NewReader(dn)) + if err != nil { + t.Error(err) + } + + const want = "decoding dwarf section info" + _, err = nf.DWARF() + if err == nil || !strings.Contains(err.Error(), want) { + t.Errorf("DWARF = %v; want %q", err, want) + } +} + +func BenchmarkSymbols64(b *testing.B) { + const testdata = "testdata/gcc-amd64-linux-exec" + f, err := Open(testdata) + if err != nil { + b.Fatalf("could not read %s: %v", testdata, err) + } + defer f.Close() + b.ResetTimer() + for i := 0; i < b.N; i++ { + symbols, err := f.Symbols() + if err != nil { + b.Fatalf("Symbols(): got unexpected error %v", err) + } + if len(symbols) != 73 { + b.Errorf("\nhave %d symbols\nwant %d symbols\n", len(symbols), 73) + } + } +} + +func BenchmarkSymbols32(b *testing.B) { + const testdata = "testdata/gcc-386-freebsd-exec" + f, err := Open(testdata) + if err != nil { + b.Fatalf("could not read %s: %v", testdata, err) + } + defer f.Close() + b.ResetTimer() + for i := 0; i < b.N; i++ { + symbols, err := f.Symbols() + if err != nil { + b.Fatalf("Symbols(): got unexpected error %v", err) + } + if len(symbols) != 74 { + b.Errorf("\nhave %d symbols\nwant %d symbols\n", len(symbols), 74) + } + } +} diff --git a/go/src/debug/elf/reader.go b/go/src/debug/elf/reader.go new file mode 100644 index 0000000000000000000000000000000000000000..eab437318d6d3e3ee6513884df7120551ff6dae8 --- /dev/null +++ b/go/src/debug/elf/reader.go @@ -0,0 +1,108 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package elf + +import ( + "io" + "os" +) + +// errorReader returns error from all operations. +type errorReader struct { + error +} + +func (r errorReader) Read(p []byte) (n int, err error) { + return 0, r.error +} + +func (r errorReader) ReadAt(p []byte, off int64) (n int, err error) { + return 0, r.error +} + +func (r errorReader) Seek(offset int64, whence int) (int64, error) { + return 0, r.error +} + +func (r errorReader) Close() error { + return r.error +} + +// readSeekerFromReader converts an io.Reader into an io.ReadSeeker. +// In general Seek may not be efficient, but it is optimized for +// common cases such as seeking to the end to find the length of the +// data. +type readSeekerFromReader struct { + reset func() (io.Reader, error) + r io.Reader + size int64 + offset int64 +} + +func (r *readSeekerFromReader) start() { + x, err := r.reset() + if err != nil { + r.r = errorReader{err} + } else { + r.r = x + } + r.offset = 0 +} + +func (r *readSeekerFromReader) Read(p []byte) (n int, err error) { + if r.r == nil { + r.start() + } + n, err = r.r.Read(p) + r.offset += int64(n) + return n, err +} + +func (r *readSeekerFromReader) Seek(offset int64, whence int) (int64, error) { + var newOffset int64 + switch whence { + case io.SeekStart: + newOffset = offset + case io.SeekCurrent: + newOffset = r.offset + offset + case io.SeekEnd: + newOffset = r.size + offset + default: + return 0, os.ErrInvalid + } + + switch { + case newOffset == r.offset: + return newOffset, nil + + case newOffset < 0, newOffset > r.size: + return 0, os.ErrInvalid + + case newOffset == 0: + r.r = nil + + case newOffset == r.size: + r.r = errorReader{io.EOF} + + default: + if newOffset < r.offset { + // Restart at the beginning. + r.start() + } + // Read until we reach offset. + var buf [512]byte + for r.offset < newOffset { + b := buf[:] + if newOffset-r.offset < int64(len(buf)) { + b = buf[:newOffset-r.offset] + } + if _, err := r.Read(b); err != nil { + return 0, err + } + } + } + r.offset = newOffset + return r.offset, nil +} diff --git a/go/src/debug/elf/symbols_test.go b/go/src/debug/elf/symbols_test.go new file mode 100644 index 0000000000000000000000000000000000000000..6053d99acc1a0be268647096a8884921cf7ad3d6 --- /dev/null +++ b/go/src/debug/elf/symbols_test.go @@ -0,0 +1,1327 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package elf + +import ( + "io" + "path" + "reflect" + "testing" +) + +// TODO: remove duplicate code +func TestSymbols(t *testing.T) { + do := func(file string, ts []Symbol, getfunc func(*File) ([]Symbol, error)) { + var f *File + var err error + if path.Ext(file) == ".gz" { + var r io.ReaderAt + if r, err = decompress(file); err == nil { + f, err = NewFile(r) + } + } else { + f, err = Open(file) + } + if err != nil { + t.Errorf("TestSymbols: cannot open file %s: %v", file, err) + return + } + defer f.Close() + fs, err := getfunc(f) + if err != nil && err != ErrNoSymbols { + t.Error(err) + return + } else if err == ErrNoSymbols { + fs = []Symbol{} + } + if !reflect.DeepEqual(ts, fs) { + t.Errorf("%s: Symbols = %v, want %v", file, fs, ts) + } + + for i, s := range fs { + if s.HasVersion { + // No hidden versions here. + if s.VersionIndex.IsHidden() { + t.Errorf("%s: symbol %d: unexpected hidden version", file, i) + } + if got, want := s.VersionIndex.Index(), uint16(s.VersionIndex); got != want { + t.Errorf("%s: symbol %d: VersionIndex.Index() == %d, want %d", file, i, got, want) + } + } + } + + } + for file, ts := range symbolsGolden { + do(file, ts, (*File).Symbols) + } + for file, ts := range dynamicSymbolsGolden { + do(file, ts, (*File).DynamicSymbols) + } +} + +// golden symbol table data generated by testdata/getgoldsym.c + +var symbolsGolden = map[string][]Symbol{ + "testdata/gcc-amd64-linux-exec": { + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x1, + Value: 0x400200, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x2, + Value: 0x40021C, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x3, + Value: 0x400240, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x4, + Value: 0x400268, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x5, + Value: 0x400288, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x6, + Value: 0x4002E8, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x7, + Value: 0x400326, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x8, + Value: 0x400330, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x9, + Value: 0x400350, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xA, + Value: 0x400368, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xB, + Value: 0x400398, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xC, + Value: 0x4003B0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xD, + Value: 0x4003E0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xE, + Value: 0x400594, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xF, + Value: 0x4005A4, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x10, + Value: 0x4005B8, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x11, + Value: 0x4005E0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x12, + Value: 0x600688, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x13, + Value: 0x600698, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x14, + Value: 0x6006A8, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x15, + Value: 0x6006B0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x16, + Value: 0x600850, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x17, + Value: 0x600858, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x18, + Value: 0x600880, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x19, + Value: 0x600898, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x1A, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x1B, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x1C, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x1D, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x1E, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x1F, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x20, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x21, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "init.c", + Info: 0x4, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xFFF1, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "initfini.c", + Info: 0x4, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xFFF1, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "call_gmon_start", + Info: 0x2, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xD, + Value: 0x40040C, + Size: 0x0, + }, + Symbol{ + Name: "crtstuff.c", + Info: 0x4, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xFFF1, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "__CTOR_LIST__", + Info: 0x1, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x12, + Value: 0x600688, + Size: 0x0, + }, + Symbol{ + Name: "__DTOR_LIST__", + Info: 0x1, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x13, + Value: 0x600698, + Size: 0x0, + }, + Symbol{ + Name: "__JCR_LIST__", + Info: 0x1, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x14, + Value: 0x6006A8, + Size: 0x0, + }, + Symbol{ + Name: "__do_global_dtors_aux", + Info: 0x2, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xD, + Value: 0x400430, + Size: 0x0, + }, + Symbol{ + Name: "completed.6183", + Info: 0x1, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x19, + Value: 0x600898, + Size: 0x1, + }, + Symbol{ + Name: "p.6181", + Info: 0x1, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x18, + Value: 0x600890, + Size: 0x0, + }, + Symbol{ + Name: "frame_dummy", + Info: 0x2, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xD, + Value: 0x400470, + Size: 0x0, + }, + Symbol{ + Name: "crtstuff.c", + Info: 0x4, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xFFF1, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "__CTOR_END__", + Info: 0x1, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x12, + Value: 0x600690, + Size: 0x0, + }, + Symbol{ + Name: "__DTOR_END__", + Info: 0x1, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x13, + Value: 0x6006A0, + Size: 0x0, + }, + Symbol{ + Name: "__FRAME_END__", + Info: 0x1, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x11, + Value: 0x400680, + Size: 0x0, + }, + Symbol{ + Name: "__JCR_END__", + Info: 0x1, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x14, + Value: 0x6006A8, + Size: 0x0, + }, + Symbol{ + Name: "__do_global_ctors_aux", + Info: 0x2, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xD, + Value: 0x400560, + Size: 0x0, + }, + Symbol{ + Name: "initfini.c", + Info: 0x4, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xFFF1, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "hello.c", + Info: 0x4, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xFFF1, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "_GLOBAL_OFFSET_TABLE_", + Info: 0x1, + Other: 0x2, + HasVersion: false, + VersionIndex: 0, + Section: 0x17, + Value: 0x600858, + Size: 0x0, + }, + Symbol{ + Name: "__init_array_end", + Info: 0x0, + Other: 0x2, + HasVersion: false, + VersionIndex: 0, + Section: 0x12, + Value: 0x600684, + Size: 0x0, + }, + Symbol{ + Name: "__init_array_start", + Info: 0x0, + Other: 0x2, + HasVersion: false, + VersionIndex: 0, + Section: 0x12, + Value: 0x600684, + Size: 0x0, + }, + Symbol{ + Name: "_DYNAMIC", + Info: 0x1, + Other: 0x2, + HasVersion: false, + VersionIndex: 0, + Section: 0x15, + Value: 0x6006B0, + Size: 0x0, + }, + Symbol{ + Name: "data_start", + Info: 0x20, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x18, + Value: 0x600880, + Size: 0x0, + }, + Symbol{ + Name: "__libc_csu_fini", + Info: 0x12, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xD, + Value: 0x4004C0, + Size: 0x2, + }, + Symbol{ + Name: "_start", + Info: 0x12, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xD, + Value: 0x4003E0, + Size: 0x0, + }, + Symbol{ + Name: "__gmon_start__", + Info: 0x20, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x0, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "_Jv_RegisterClasses", + Info: 0x20, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x0, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "puts@@GLIBC_2.2.5", + Info: 0x12, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x0, + Value: 0x0, + Size: 0x18C, + }, + Symbol{ + Name: "_fini", + Info: 0x12, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xE, + Value: 0x400594, + Size: 0x0, + }, + Symbol{ + Name: "__libc_start_main@@GLIBC_2.2.5", + Info: 0x12, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x0, + Value: 0x0, + Size: 0x1C2, + }, + Symbol{ + Name: "_IO_stdin_used", + Info: 0x11, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xF, + Value: 0x4005A4, + Size: 0x4, + }, + Symbol{ + Name: "__data_start", + Info: 0x10, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x18, + Value: 0x600880, + Size: 0x0, + }, + Symbol{ + Name: "__dso_handle", + Info: 0x11, + Other: 0x2, + HasVersion: false, + VersionIndex: 0, + Section: 0x18, + Value: 0x600888, + Size: 0x0, + }, + Symbol{ + Name: "__libc_csu_init", + Info: 0x12, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xD, + Value: 0x4004D0, + Size: 0x89, + }, + Symbol{ + Name: "__bss_start", + Info: 0x10, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xFFF1, + Value: 0x600898, + Size: 0x0, + }, + Symbol{ + Name: "_end", + Info: 0x10, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xFFF1, + Value: 0x6008A0, + Size: 0x0, + }, + Symbol{ + Name: "_edata", + Info: 0x10, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xFFF1, + Value: 0x600898, + Size: 0x0, + }, + Symbol{ + Name: "main", + Info: 0x12, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xD, + Value: 0x400498, + Size: 0x1B, + }, + Symbol{ + Name: "_init", + Info: 0x12, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xB, + Value: 0x400398, + Size: 0x0, + }, + }, + "testdata/go-relocation-test-clang-x86.obj": { + Symbol{ + Name: "go-relocation-test-clang.c", + Info: 0x4, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xFFF1, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: ".Linfo_string0", + Info: 0x0, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xC, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: ".Linfo_string1", + Info: 0x0, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xC, + Value: 0x2C, + Size: 0x0, + }, + Symbol{ + Name: ".Linfo_string2", + Info: 0x0, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xC, + Value: 0x47, + Size: 0x0, + }, + Symbol{ + Name: ".Linfo_string3", + Info: 0x0, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xC, + Value: 0x4C, + Size: 0x0, + }, + Symbol{ + Name: ".Linfo_string4", + Info: 0x0, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xC, + Value: 0x4E, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x1, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x2, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x3, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x4, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x6, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x7, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x8, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xA, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xC, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xD, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xE, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xF, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0x10, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "v", + Info: 0x11, + Other: 0x0, + HasVersion: false, + VersionIndex: 0, + Section: 0xFFF2, + Value: 0x4, + Size: 0x4, + }, + }, + "testdata/hello-world-core.gz": {}, +} + +var dynamicSymbolsGolden = map[string][]Symbol{ + "testdata/gcc-amd64-linux-exec": { + Symbol{ + Name: "__gmon_start__", + Info: 0x20, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x0, + Section: 0x0, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "puts", + Info: 0x12, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x2, + Section: 0x0, + Value: 0x0, + Size: 0x18C, + Version: "GLIBC_2.2.5", + Library: "libc.so.6", + }, + Symbol{ + Name: "__libc_start_main", + Info: 0x12, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x2, + Section: 0x0, + Value: 0x0, + Size: 0x1C2, + Version: "GLIBC_2.2.5", + Library: "libc.so.6", + }, + }, + "testdata/go-relocation-test-clang-x86.obj": {}, + "testdata/hello-world-core.gz": {}, + "testdata/libtiffxx.so_": { + Symbol{ + Name: "_ZNSo3putEc", + Info: 0x12, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x3, + Section: 0x0, + Value: 0x0, + Size: 0x0, + Version: "GLIBCXX_3.4", + Library: "libstdc++.so.6", + }, + Symbol{ + Name: "strchr", + Info: 0x12, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x4, + Section: 0x0, + Value: 0x0, + Size: 0x0, + Version: "GLIBC_2.2.5", + Library: "libc.so.6", + }, + Symbol{ + Name: "__cxa_finalize", + Info: 0x22, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x4, + Section: 0x0, + Value: 0x0, + Size: 0x0, + Version: "GLIBC_2.2.5", + Library: "libc.so.6", + }, + Symbol{ + Name: "_ZNSo5tellpEv", + Info: 0x12, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x3, + Section: 0x0, + Value: 0x0, + Size: 0x0, + Version: "GLIBCXX_3.4", + Library: "libstdc++.so.6", + }, + Symbol{ + Name: "_ZNSo5seekpElSt12_Ios_Seekdir", + Info: 0x12, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x3, + Section: 0x0, + Value: 0x0, + Size: 0x0, + Version: "GLIBCXX_3.4", + Library: "libstdc++.so.6", + }, + Symbol{ + Name: "_Znwm", + Info: 0x12, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x3, + Section: 0x0, + Value: 0x0, + Size: 0x0, + Version: "GLIBCXX_3.4", + Library: "libstdc++.so.6", + }, + Symbol{ + Name: "_ZdlPvm", + Info: 0x12, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x5, + Section: 0x0, + Value: 0x0, + Size: 0x0, + Version: "CXXABI_1.3.9", + Library: "libstdc++.so.6", + }, + Symbol{ + Name: "__stack_chk_fail", + Info: 0x12, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x6, + Section: 0x0, + Value: 0x0, + Size: 0x0, + Version: "GLIBC_2.4", + Library: "libc.so.6", + }, + Symbol{ + Name: "_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l", + Info: 0x12, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x7, + Section: 0x0, + Value: 0x0, + Size: 0x0, + Version: "GLIBCXX_3.4.9", + Library: "libstdc++.so.6", + }, + Symbol{ + Name: "_ZNSo5seekpESt4fposI11__mbstate_tE", + Info: 0x12, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x3, + Section: 0x0, + Value: 0x0, + Size: 0x0, + Version: "GLIBCXX_3.4", + Library: "libstdc++.so.6", + }, + Symbol{ + Name: "_ZNSi4readEPcl", + Info: 0x12, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x3, + Section: 0x0, + Value: 0x0, + Size: 0x0, + Version: "GLIBCXX_3.4", + Library: "libstdc++.so.6", + }, + Symbol{ + Name: "_ZNSi5seekgESt4fposI11__mbstate_tE", + Info: 0x12, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x3, + Section: 0x0, + Value: 0x0, + Size: 0x0, + Version: "GLIBCXX_3.4", + Library: "libstdc++.so.6", + }, + Symbol{ + Name: "_ZNSo5writeEPKcl", + Info: 0x12, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x3, + Section: 0x0, + Value: 0x0, + Size: 0x0, + Version: "GLIBCXX_3.4", + Library: "libstdc++.so.6", + }, + Symbol{ + Name: "_ZNSi5seekgElSt12_Ios_Seekdir", + Info: 0x12, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x3, + Section: 0x0, + Value: 0x0, + Size: 0x0, + Version: "GLIBCXX_3.4", + Library: "libstdc++.so.6", + }, + Symbol{ + Name: "_ZSt21ios_base_library_initv", + Info: 0x12, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x8, + Section: 0x0, + Value: 0x0, + Size: 0x0, + Version: "GLIBCXX_3.4.32", + Library: "libstdc++.so.6", + }, + Symbol{ + Name: "TIFFClientOpen", + Info: 0x12, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x9, + Section: 0x0, + Value: 0x0, + Size: 0x0, + Version: "LIBTIFF_4.0", + Library: "libtiff.so.6", + }, + Symbol{ + Name: "_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate", + Info: 0x12, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x3, + Section: 0x0, + Value: 0x0, + Size: 0x0, + Version: "GLIBCXX_3.4", + Library: "libstdc++.so.6", + }, + Symbol{ + Name: "_ZNSi5tellgEv", + Info: 0x12, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x3, + Section: 0x0, + Value: 0x0, + Size: 0x0, + Version: "GLIBCXX_3.4", + Library: "libstdc++.so.6", + }, + Symbol{ + Name: "_ITM_deregisterTMCloneTable", + Info: 0x20, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x1, + Section: 0x0, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "__gmon_start__", + Info: 0x20, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x1, + Section: 0x0, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "_ITM_registerTMCloneTable", + Info: 0x20, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x1, + Section: 0x0, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "LIBTIFFXX_4.0", + Info: 0x11, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x2, + Section: 0xFFF1, + Value: 0x0, + Size: 0x0, + Version: "LIBTIFFXX_4.0", + Library: "", + }, + Symbol{ + Name: "_Z14TIFFStreamOpenPKcPSo", + Info: 0x12, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x2, + Section: 0xF, + Value: 0x1860, + Size: 0xB8, + Version: "LIBTIFFXX_4.0", + Library: "", + }, + Symbol{ + Name: "_Z14TIFFStreamOpenPKcPSi", + Info: 0x12, + Other: 0x0, + HasVersion: true, + VersionIndex: 0x2, + Section: 0xF, + Value: 0x1920, + Size: 0x13, + Version: "LIBTIFFXX_4.0", + Library: "", + }, + }, +} diff --git a/go/src/debug/elf/testdata/compressed-32.obj b/go/src/debug/elf/testdata/compressed-32.obj new file mode 100644 index 0000000000000000000000000000000000000000..2bfdb4424075881a6055055b760186e031b9cf6e Binary files /dev/null and b/go/src/debug/elf/testdata/compressed-32.obj differ diff --git a/go/src/debug/elf/testdata/compressed-64.obj b/go/src/debug/elf/testdata/compressed-64.obj new file mode 100644 index 0000000000000000000000000000000000000000..ffae56a931cb13ac30d0b145ef51c6d6359a564e Binary files /dev/null and b/go/src/debug/elf/testdata/compressed-64.obj differ diff --git a/go/src/debug/elf/testdata/gcc-386-freebsd-exec b/go/src/debug/elf/testdata/gcc-386-freebsd-exec new file mode 100644 index 0000000000000000000000000000000000000000..7af9c58ca73945561c470a5e7ad29f39d0405a6e Binary files /dev/null and b/go/src/debug/elf/testdata/gcc-386-freebsd-exec differ diff --git a/go/src/debug/elf/testdata/gcc-amd64-linux-exec b/go/src/debug/elf/testdata/gcc-amd64-linux-exec new file mode 100644 index 0000000000000000000000000000000000000000..c6cb1de28c77175897ee862d91c87454a42118f2 Binary files /dev/null and b/go/src/debug/elf/testdata/gcc-amd64-linux-exec differ diff --git a/go/src/debug/elf/testdata/gcc-amd64-openbsd-debug-with-rela.obj b/go/src/debug/elf/testdata/gcc-amd64-openbsd-debug-with-rela.obj new file mode 100644 index 0000000000000000000000000000000000000000..f62b1ea1cada83530e45320cc58394933753dddb Binary files /dev/null and b/go/src/debug/elf/testdata/gcc-amd64-openbsd-debug-with-rela.obj differ diff --git a/go/src/debug/elf/testdata/gcc-riscv64-linux-exec b/go/src/debug/elf/testdata/gcc-riscv64-linux-exec new file mode 100644 index 0000000000000000000000000000000000000000..e01f6f292c9406aa745b7853e073148ab9c74a6c Binary files /dev/null and b/go/src/debug/elf/testdata/gcc-riscv64-linux-exec differ diff --git a/go/src/debug/elf/testdata/go-relocation-test-clang-arm.obj b/go/src/debug/elf/testdata/go-relocation-test-clang-arm.obj new file mode 100644 index 0000000000000000000000000000000000000000..1cc7e4b11143698a3abc3f72b88411e41f3d4989 Binary files /dev/null and b/go/src/debug/elf/testdata/go-relocation-test-clang-arm.obj differ diff --git a/go/src/debug/elf/testdata/go-relocation-test-clang-x86.obj b/go/src/debug/elf/testdata/go-relocation-test-clang-x86.obj new file mode 100644 index 0000000000000000000000000000000000000000..e909cf4e6e19a63276f497b70a170492ade64156 Binary files /dev/null and b/go/src/debug/elf/testdata/go-relocation-test-clang-x86.obj differ diff --git a/go/src/debug/elf/testdata/go-relocation-test-gcc424-x86-64.obj b/go/src/debug/elf/testdata/go-relocation-test-gcc424-x86-64.obj new file mode 100644 index 0000000000000000000000000000000000000000..a7c6d6e562c1c70342d9d1cf41194b7ef3fdedf6 Binary files /dev/null and b/go/src/debug/elf/testdata/go-relocation-test-gcc424-x86-64.obj differ diff --git a/go/src/debug/elf/testdata/go-relocation-test-gcc441-x86-64.obj b/go/src/debug/elf/testdata/go-relocation-test-gcc441-x86-64.obj new file mode 100644 index 0000000000000000000000000000000000000000..2d37ab6e6e12cfb6625cdda41dc7ecf775ade4e8 Binary files /dev/null and b/go/src/debug/elf/testdata/go-relocation-test-gcc441-x86-64.obj differ diff --git a/go/src/debug/elf/testdata/go-relocation-test-gcc441-x86.obj b/go/src/debug/elf/testdata/go-relocation-test-gcc441-x86.obj new file mode 100644 index 0000000000000000000000000000000000000000..0d59fe303b6dad25698a1e7c0644d285460797a9 Binary files /dev/null and b/go/src/debug/elf/testdata/go-relocation-test-gcc441-x86.obj differ diff --git a/go/src/debug/elf/testdata/go-relocation-test-gcc482-aarch64.obj b/go/src/debug/elf/testdata/go-relocation-test-gcc482-aarch64.obj new file mode 100644 index 0000000000000000000000000000000000000000..849e2644ec79263a958fcabda5b9e731e3cb1842 Binary files /dev/null and b/go/src/debug/elf/testdata/go-relocation-test-gcc482-aarch64.obj differ diff --git a/go/src/debug/elf/testdata/go-relocation-test-gcc482-ppc64le.obj b/go/src/debug/elf/testdata/go-relocation-test-gcc482-ppc64le.obj new file mode 100644 index 0000000000000000000000000000000000000000..dad7445486e8897ad351ec2c8fad09f0d8ee494d Binary files /dev/null and b/go/src/debug/elf/testdata/go-relocation-test-gcc482-ppc64le.obj differ diff --git a/go/src/debug/elf/testdata/go-relocation-test-gcc492-arm.obj b/go/src/debug/elf/testdata/go-relocation-test-gcc492-arm.obj new file mode 100644 index 0000000000000000000000000000000000000000..ed45be2c55fda61466e4860e42fab07cc9228978 Binary files /dev/null and b/go/src/debug/elf/testdata/go-relocation-test-gcc492-arm.obj differ diff --git a/go/src/debug/elf/testdata/go-relocation-test-gcc492-mips64.obj b/go/src/debug/elf/testdata/go-relocation-test-gcc492-mips64.obj new file mode 100644 index 0000000000000000000000000000000000000000..68febe18fe48c286168beb603b300f60cc159e82 Binary files /dev/null and b/go/src/debug/elf/testdata/go-relocation-test-gcc492-mips64.obj differ diff --git a/go/src/debug/elf/testdata/go-relocation-test-gcc492-mipsle.obj b/go/src/debug/elf/testdata/go-relocation-test-gcc492-mipsle.obj new file mode 100644 index 0000000000000000000000000000000000000000..a5fbcfbbdd24265cf41850440a90719d2545e263 Binary files /dev/null and b/go/src/debug/elf/testdata/go-relocation-test-gcc492-mipsle.obj differ diff --git a/go/src/debug/elf/testdata/go-relocation-test-gcc493-mips64le.obj b/go/src/debug/elf/testdata/go-relocation-test-gcc493-mips64le.obj new file mode 100644 index 0000000000000000000000000000000000000000..20bbd6c4e894418692a5c2f4c5bd4ac384165dbc Binary files /dev/null and b/go/src/debug/elf/testdata/go-relocation-test-gcc493-mips64le.obj differ diff --git a/go/src/debug/elf/testdata/go-relocation-test-gcc5-ppc.obj b/go/src/debug/elf/testdata/go-relocation-test-gcc5-ppc.obj new file mode 100644 index 0000000000000000000000000000000000000000..f4165af0982d3b87761a4a540900e687b39e980f Binary files /dev/null and b/go/src/debug/elf/testdata/go-relocation-test-gcc5-ppc.obj differ diff --git a/go/src/debug/elf/testdata/go-relocation-test-gcc531-s390x.obj b/go/src/debug/elf/testdata/go-relocation-test-gcc531-s390x.obj new file mode 100644 index 0000000000000000000000000000000000000000..caacb9b90a58936dcbd4481ffaeaca6716aedece Binary files /dev/null and b/go/src/debug/elf/testdata/go-relocation-test-gcc531-s390x.obj differ diff --git a/go/src/debug/elf/testdata/go-relocation-test-gcc540-mips.obj b/go/src/debug/elf/testdata/go-relocation-test-gcc540-mips.obj new file mode 100644 index 0000000000000000000000000000000000000000..270c7775968f0e6d74875fa017d5f153e88e0cf8 Binary files /dev/null and b/go/src/debug/elf/testdata/go-relocation-test-gcc540-mips.obj differ diff --git a/go/src/debug/elf/testdata/go-relocation-test-gcc620-sparc64.obj b/go/src/debug/elf/testdata/go-relocation-test-gcc620-sparc64.obj new file mode 100644 index 0000000000000000000000000000000000000000..d65c23e1cbeaad5acc30d7d256931443ac8aea2a Binary files /dev/null and b/go/src/debug/elf/testdata/go-relocation-test-gcc620-sparc64.obj differ diff --git a/go/src/debug/elf/testdata/go-relocation-test-gcc720-riscv64.obj b/go/src/debug/elf/testdata/go-relocation-test-gcc720-riscv64.obj new file mode 100644 index 0000000000000000000000000000000000000000..91ae6487a3abc3313b48b02afb6fc6b6af5ba50d Binary files /dev/null and b/go/src/debug/elf/testdata/go-relocation-test-gcc720-riscv64.obj differ diff --git a/go/src/debug/elf/testdata/go-relocation-test-gcc930-ranges-no-rela-x86-64 b/go/src/debug/elf/testdata/go-relocation-test-gcc930-ranges-no-rela-x86-64 new file mode 100644 index 0000000000000000000000000000000000000000..c013f3e081c7ecf1056be3457332be97ffa0f31c Binary files /dev/null and b/go/src/debug/elf/testdata/go-relocation-test-gcc930-ranges-no-rela-x86-64 differ diff --git a/go/src/debug/elf/testdata/go-relocation-test-gcc930-ranges-with-rela-x86-64 b/go/src/debug/elf/testdata/go-relocation-test-gcc930-ranges-with-rela-x86-64 new file mode 100644 index 0000000000000000000000000000000000000000..51e03aa7b0d6010410a31d6594540b07c0b3b6c5 Binary files /dev/null and b/go/src/debug/elf/testdata/go-relocation-test-gcc930-ranges-with-rela-x86-64 differ diff --git a/go/src/debug/elf/testdata/hello.c b/go/src/debug/elf/testdata/hello.c new file mode 100644 index 0000000000000000000000000000000000000000..34d9ee79234ef29ea03feeb69d220b0796295636 --- /dev/null +++ b/go/src/debug/elf/testdata/hello.c @@ -0,0 +1,7 @@ +#include + +void +main(int argc, char *argv[]) +{ + printf("hello, world\n"); +} diff --git a/go/src/debug/elf/testdata/libtiffxx.so_ b/go/src/debug/elf/testdata/libtiffxx.so_ new file mode 100644 index 0000000000000000000000000000000000000000..403525715183c5bacd94b7f882028702d5d19edc Binary files /dev/null and b/go/src/debug/elf/testdata/libtiffxx.so_ differ diff --git a/go/src/debug/elf/testdata/multiple-code-sections.c b/go/src/debug/elf/testdata/multiple-code-sections.c new file mode 100644 index 0000000000000000000000000000000000000000..03b9d53ab96518a25f3cb76eb91ee4106d99acd4 --- /dev/null +++ b/go/src/debug/elf/testdata/multiple-code-sections.c @@ -0,0 +1,28 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Build with: +// gcc -g multiple-code-sections.c -Wl,--emit-relocs -Wl,--discard-none -Wl,-zmax-page-size=1 -fno-asynchronous-unwind-tables -o go-relocation-test-gcc930-ranges-with-rela-x86-64 +// gcc -g multiple-code-sections.c -Wl,-zmax-page-size=1 -fno-asynchronous-unwind-tables -o go-relocation-test-gcc930-ranges-no-rela-x86-64 +// Strip with: +// strip --only-keep-debug \ +// --remove-section=.eh_frame \ +// --remove-section=.eh_frame_hdr \ +// --remove-section=.shstrtab \ +// --remove-section=.strtab \ +// --remove-section=.symtab \ +// --remove-section=.note.gnu.build-id \ +// --remove-section=.note.ABI-tag \ +// --remove-section=.dynamic \ +// --remove-section=.gnu.hash \ +// --remove-section=.interp \ +// --remove-section=.rodata +__attribute__((section(".separate_section"))) // To get GCC to emit a DW_AT_ranges attribute for the CU. +int func(void) { + return 0; +} + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/go/src/debug/elf/testdata/zdebug-test-gcc484-x86-64.obj b/go/src/debug/elf/testdata/zdebug-test-gcc484-x86-64.obj new file mode 100644 index 0000000000000000000000000000000000000000..a595a01df45c31a5f266f71103eca7a835242996 Binary files /dev/null and b/go/src/debug/elf/testdata/zdebug-test-gcc484-x86-64.obj differ diff --git a/go/src/debug/gosym/pclntab.go b/go/src/debug/gosym/pclntab.go new file mode 100644 index 0000000000000000000000000000000000000000..da80c8460d5c73a5392a2d439f23d8ade7161c2c --- /dev/null +++ b/go/src/debug/gosym/pclntab.go @@ -0,0 +1,698 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/* + * Line tables + */ + +package gosym + +import ( + "bytes" + "encoding/binary" + "internal/abi" + "sort" + "sync" +) + +// version of the pclntab +type version int + +const ( + verUnknown version = iota + ver11 + ver12 + ver116 + ver118 + ver120 +) + +// A LineTable is a data structure mapping program counters to line numbers. +// +// In Go 1.1 and earlier, each function (represented by a [Func]) had its own LineTable, +// and the line number corresponded to a numbering of all source lines in the +// program, across all files. That absolute line number would then have to be +// converted separately to a file name and line number within the file. +// +// In Go 1.2, the format of the data changed so that there is a single LineTable +// for the entire program, shared by all Funcs, and there are no absolute line +// numbers, just line numbers within specific files. +// +// For the most part, LineTable's methods should be treated as an internal +// detail of the package; callers should use the methods on [Table] instead. +type LineTable struct { + Data []byte + PC uint64 + Line int + + // This mutex is used to keep parsing of pclntab synchronous. + mu sync.Mutex + + // Contains the version of the pclntab section. + version version + + // Go 1.2/1.16/1.18 state + binary binary.ByteOrder + quantum uint32 + ptrsize uint32 + textStart uint64 // address of runtime.text symbol (1.18+) + funcnametab []byte + cutab []byte + funcdata []byte + functab []byte + nfunctab uint32 + filetab []byte + pctab []byte // points to the pctables. + nfiletab uint32 + funcNames map[uint32]string // cache the function names + strings map[uint32]string // interned substrings of Data, keyed by offset + // fileMap varies depending on the version of the object file. + // For ver12, it maps the name to the index in the file table. + // For ver116, it maps the name to the offset in filetab. + fileMap map[string]uint32 +} + +// NOTE(rsc): This is wrong for GOARCH=arm, which uses a quantum of 4, +// but we have no idea whether we're using arm or not. This only +// matters in the old (pre-Go 1.2) symbol table format, so it's not worth +// fixing. +const oldQuantum = 1 + +func (t *LineTable) parse(targetPC uint64, targetLine int) (b []byte, pc uint64, line int) { + // The PC/line table can be thought of as a sequence of + // * + // batches. Each update batch results in a (pc, line) pair, + // where line applies to every PC from pc up to but not + // including the pc of the next pair. + // + // Here we process each update individually, which simplifies + // the code, but makes the corner cases more confusing. + b, pc, line = t.Data, t.PC, t.Line + for pc <= targetPC && line != targetLine && len(b) > 0 { + code := b[0] + b = b[1:] + switch { + case code == 0: + if len(b) < 4 { + b = b[0:0] + break + } + val := binary.BigEndian.Uint32(b) + b = b[4:] + line += int(val) + case code <= 64: + line += int(code) + case code <= 128: + line -= int(code - 64) + default: + pc += oldQuantum * uint64(code-128) + continue + } + pc += oldQuantum + } + return b, pc, line +} + +func (t *LineTable) slice(pc uint64) *LineTable { + data, pc, line := t.parse(pc, -1) + return &LineTable{Data: data, PC: pc, Line: line} +} + +// PCToLine returns the line number for the given program counter. +// +// Deprecated: Use Table's PCToLine method instead. +func (t *LineTable) PCToLine(pc uint64) int { + if t.isGo12() { + return t.go12PCToLine(pc) + } + _, _, line := t.parse(pc, -1) + return line +} + +// LineToPC returns the program counter for the given line number, +// considering only program counters before maxpc. +// +// Deprecated: Use Table's LineToPC method instead. +func (t *LineTable) LineToPC(line int, maxpc uint64) uint64 { + if t.isGo12() { + return 0 + } + _, pc, line1 := t.parse(maxpc, line) + if line1 != line { + return 0 + } + // Subtract quantum from PC to account for post-line increment + return pc - oldQuantum +} + +// NewLineTable returns a new PC/line table +// corresponding to the encoded data. +// Text must be the start address of the +// corresponding text segment, with the exact +// value stored in the 'runtime.text' symbol. +// This value may differ from the start +// address of the text segment if +// binary was built with cgo enabled. +func NewLineTable(data []byte, text uint64) *LineTable { + return &LineTable{Data: data, PC: text, Line: 0, funcNames: make(map[uint32]string), strings: make(map[uint32]string)} +} + +// Go 1.2 symbol table format. +// See golang.org/s/go12symtab. +// +// A general note about the methods here: rather than try to avoid +// index out of bounds errors, we trust Go to detect them, and then +// we recover from the panics and treat them as indicative of a malformed +// or incomplete table. +// +// The methods called by symtab.go, which begin with "go12" prefixes, +// are expected to have that recovery logic. + +// isGo12 reports whether this is a Go 1.2 (or later) symbol table. +func (t *LineTable) isGo12() bool { + t.parsePclnTab() + return t.version >= ver12 +} + +// uintptr returns the pointer-sized value encoded at b. +// The pointer size is dictated by the table being read. +func (t *LineTable) uintptr(b []byte) uint64 { + if t.ptrsize == 4 { + return uint64(t.binary.Uint32(b)) + } + return t.binary.Uint64(b) +} + +// parsePclnTab parses the pclntab, setting the version. +func (t *LineTable) parsePclnTab() { + t.mu.Lock() + defer t.mu.Unlock() + if t.version != verUnknown { + return + } + + // Note that during this function, setting the version is the last thing we do. + // If we set the version too early, and parsing failed (likely as a panic on + // slice lookups), we'd have a mistaken version. + // + // Error paths through this code will default the version to 1.1. + t.version = ver11 + + if !disableRecover { + defer func() { + // If we panic parsing, assume it's a Go 1.1 pclntab. + recover() + }() + } + + // Check header: 4-byte magic, two zeros, pc quantum, pointer size. + if len(t.Data) < 16 || t.Data[4] != 0 || t.Data[5] != 0 || + (t.Data[6] != 1 && t.Data[6] != 2 && t.Data[6] != 4) || // pc quantum + (t.Data[7] != 4 && t.Data[7] != 8) { // pointer size + return + } + + var possibleVersion version + + // The magic numbers are chosen such that reading the value with + // a different endianness does not result in the same value. + // That lets us the magic number to determine the endianness. + leMagic := abi.PCLnTabMagic(binary.LittleEndian.Uint32(t.Data)) + beMagic := abi.PCLnTabMagic(binary.BigEndian.Uint32(t.Data)) + + switch { + case leMagic == abi.Go12PCLnTabMagic: + t.binary, possibleVersion = binary.LittleEndian, ver12 + case beMagic == abi.Go12PCLnTabMagic: + t.binary, possibleVersion = binary.BigEndian, ver12 + case leMagic == abi.Go116PCLnTabMagic: + t.binary, possibleVersion = binary.LittleEndian, ver116 + case beMagic == abi.Go116PCLnTabMagic: + t.binary, possibleVersion = binary.BigEndian, ver116 + case leMagic == abi.Go118PCLnTabMagic: + t.binary, possibleVersion = binary.LittleEndian, ver118 + case beMagic == abi.Go118PCLnTabMagic: + t.binary, possibleVersion = binary.BigEndian, ver118 + case leMagic == abi.Go120PCLnTabMagic: + t.binary, possibleVersion = binary.LittleEndian, ver120 + case beMagic == abi.Go120PCLnTabMagic: + t.binary, possibleVersion = binary.BigEndian, ver120 + default: + return + } + t.version = possibleVersion + + // quantum and ptrSize are the same between 1.2, 1.16, and 1.18 + t.quantum = uint32(t.Data[6]) + t.ptrsize = uint32(t.Data[7]) + + offset := func(word uint32) uint64 { + return t.uintptr(t.Data[8+word*t.ptrsize:]) + } + data := func(word uint32) []byte { + return t.Data[offset(word):] + } + + switch possibleVersion { + case ver118, ver120: + t.nfunctab = uint32(offset(0)) + t.nfiletab = uint32(offset(1)) + t.textStart = t.PC // use the start PC instead of reading from the table, which may be unrelocated + t.funcnametab = data(3) + t.cutab = data(4) + t.filetab = data(5) + t.pctab = data(6) + t.funcdata = data(7) + t.functab = data(7) + functabsize := (int(t.nfunctab)*2 + 1) * t.functabFieldSize() + t.functab = t.functab[:functabsize] + case ver116: + t.nfunctab = uint32(offset(0)) + t.nfiletab = uint32(offset(1)) + t.funcnametab = data(2) + t.cutab = data(3) + t.filetab = data(4) + t.pctab = data(5) + t.funcdata = data(6) + t.functab = data(6) + functabsize := (int(t.nfunctab)*2 + 1) * t.functabFieldSize() + t.functab = t.functab[:functabsize] + case ver12: + t.nfunctab = uint32(t.uintptr(t.Data[8:])) + t.funcdata = t.Data + t.funcnametab = t.Data + t.functab = t.Data[8+t.ptrsize:] + t.pctab = t.Data + functabsize := (int(t.nfunctab)*2 + 1) * t.functabFieldSize() + fileoff := t.binary.Uint32(t.functab[functabsize:]) + t.functab = t.functab[:functabsize] + t.filetab = t.Data[fileoff:] + t.nfiletab = t.binary.Uint32(t.filetab) + t.filetab = t.filetab[:t.nfiletab*4] + default: + panic("unreachable") + } +} + +// go12Funcs returns a slice of Funcs derived from the Go 1.2+ pcln table. +func (t *LineTable) go12Funcs() []Func { + // Assume it is malformed and return nil on error. + if !disableRecover { + defer func() { + recover() + }() + } + + ft := t.funcTab() + funcs := make([]Func, ft.Count()) + syms := make([]Sym, len(funcs)) + for i := range funcs { + f := &funcs[i] + f.Entry = ft.pc(i) + f.End = ft.pc(i + 1) + info := t.funcData(uint32(i)) + f.LineTable = t + f.FrameSize = int(info.deferreturn()) + syms[i] = Sym{ + Value: f.Entry, + Type: 'T', + Name: t.funcName(info.nameOff()), + GoType: 0, + Func: f, + goVersion: t.version, + } + f.Sym = &syms[i] + } + return funcs +} + +// findFunc returns the funcData corresponding to the given program counter. +func (t *LineTable) findFunc(pc uint64) funcData { + ft := t.funcTab() + if pc < ft.pc(0) || pc >= ft.pc(ft.Count()) { + return funcData{} + } + idx := sort.Search(int(t.nfunctab), func(i int) bool { + return ft.pc(i) > pc + }) + idx-- + return t.funcData(uint32(idx)) +} + +// readvarint reads, removes, and returns a varint from *pp. +func (t *LineTable) readvarint(pp *[]byte) uint32 { + var v, shift uint32 + p := *pp + for shift = 0; ; shift += 7 { + b := p[0] + p = p[1:] + v |= (uint32(b) & 0x7F) << shift + if b&0x80 == 0 { + break + } + } + *pp = p + return v +} + +// funcName returns the name of the function found at off. +func (t *LineTable) funcName(off uint32) string { + if s, ok := t.funcNames[off]; ok { + return s + } + i := bytes.IndexByte(t.funcnametab[off:], 0) + s := string(t.funcnametab[off : off+uint32(i)]) + t.funcNames[off] = s + return s +} + +// stringFrom returns a Go string found at off from a position. +func (t *LineTable) stringFrom(arr []byte, off uint32) string { + if s, ok := t.strings[off]; ok { + return s + } + i := bytes.IndexByte(arr[off:], 0) + s := string(arr[off : off+uint32(i)]) + t.strings[off] = s + return s +} + +// string returns a Go string found at off. +func (t *LineTable) string(off uint32) string { + return t.stringFrom(t.funcdata, off) +} + +// functabFieldSize returns the size in bytes of a single functab field. +func (t *LineTable) functabFieldSize() int { + if t.version >= ver118 { + return 4 + } + return int(t.ptrsize) +} + +// funcTab returns t's funcTab. +func (t *LineTable) funcTab() funcTab { + return funcTab{LineTable: t, sz: t.functabFieldSize()} +} + +// funcTab is memory corresponding to a slice of functab structs, followed by an invalid PC. +// A functab struct is a PC and a func offset. +type funcTab struct { + *LineTable + sz int // cached result of t.functabFieldSize +} + +// Count returns the number of func entries in f. +func (f funcTab) Count() int { + return int(f.nfunctab) +} + +// pc returns the PC of the i'th func in f. +func (f funcTab) pc(i int) uint64 { + u := f.uint(f.functab[2*i*f.sz:]) + if f.version >= ver118 { + u += f.textStart + } + return u +} + +// funcOff returns the funcdata offset of the i'th func in f. +func (f funcTab) funcOff(i int) uint64 { + return f.uint(f.functab[(2*i+1)*f.sz:]) +} + +// uint returns the uint stored at b. +func (f funcTab) uint(b []byte) uint64 { + if f.sz == 4 { + return uint64(f.binary.Uint32(b)) + } + return f.binary.Uint64(b) +} + +// funcData is memory corresponding to an _func struct. +type funcData struct { + t *LineTable // LineTable this data is a part of + data []byte // raw memory for the function +} + +// funcData returns the ith funcData in t.functab. +func (t *LineTable) funcData(i uint32) funcData { + data := t.funcdata[t.funcTab().funcOff(int(i)):] + return funcData{t: t, data: data} +} + +// IsZero reports whether f is the zero value. +func (f funcData) IsZero() bool { + return f.t == nil && f.data == nil +} + +// entryPC returns the func's entry PC. +func (f *funcData) entryPC() uint64 { + // In Go 1.18, the first field of _func changed + // from a uintptr entry PC to a uint32 entry offset. + if f.t.version >= ver118 { + // TODO: support multiple text sections. + // See runtime/symtab.go:(*moduledata).textAddr. + return uint64(f.t.binary.Uint32(f.data)) + f.t.textStart + } + return f.t.uintptr(f.data) +} + +func (f funcData) nameOff() uint32 { return f.field(1) } +func (f funcData) deferreturn() uint32 { return f.field(3) } +func (f funcData) pcfile() uint32 { return f.field(5) } +func (f funcData) pcln() uint32 { return f.field(6) } +func (f funcData) cuOffset() uint32 { return f.field(8) } + +// field returns the nth field of the _func struct. +// It panics if n == 0 or n > 9; for n == 0, call f.entryPC. +// Most callers should use a named field accessor (just above). +func (f funcData) field(n uint32) uint32 { + if n == 0 || n > 9 { + panic("bad funcdata field") + } + // In Go 1.18, the first field of _func changed + // from a uintptr entry PC to a uint32 entry offset. + sz0 := f.t.ptrsize + if f.t.version >= ver118 { + sz0 = 4 + } + off := sz0 + (n-1)*4 // subsequent fields are 4 bytes each + data := f.data[off:] + return f.t.binary.Uint32(data) +} + +// step advances to the next pc, value pair in the encoded table. +func (t *LineTable) step(p *[]byte, pc *uint64, val *int32, first bool) bool { + uvdelta := t.readvarint(p) + if uvdelta == 0 && !first { + return false + } + if uvdelta&1 != 0 { + uvdelta = ^(uvdelta >> 1) + } else { + uvdelta >>= 1 + } + vdelta := int32(uvdelta) + pcdelta := t.readvarint(p) * t.quantum + *pc += uint64(pcdelta) + *val += vdelta + return true +} + +// pcvalue reports the value associated with the target pc. +// off is the offset to the beginning of the pc-value table, +// and entry is the start PC for the corresponding function. +func (t *LineTable) pcvalue(off uint32, entry, targetpc uint64) int32 { + p := t.pctab[off:] + + val := int32(-1) + pc := entry + for t.step(&p, &pc, &val, pc == entry) { + if targetpc < pc { + return val + } + } + return -1 +} + +// findFileLine scans one function in the binary looking for a +// program counter in the given file on the given line. +// It does so by running the pc-value tables mapping program counter +// to file number. Since most functions come from a single file, these +// are usually short and quick to scan. If a file match is found, then the +// code goes to the expense of looking for a simultaneous line number match. +func (t *LineTable) findFileLine(entry uint64, filetab, linetab uint32, filenum, line int32, cutab []byte) uint64 { + if filetab == 0 || linetab == 0 { + return 0 + } + + fp := t.pctab[filetab:] + fl := t.pctab[linetab:] + fileVal := int32(-1) + filePC := entry + lineVal := int32(-1) + linePC := entry + fileStartPC := filePC + for t.step(&fp, &filePC, &fileVal, filePC == entry) { + fileIndex := fileVal + if t.version == ver116 || t.version == ver118 || t.version == ver120 { + fileIndex = int32(t.binary.Uint32(cutab[fileVal*4:])) + } + if fileIndex == filenum && fileStartPC < filePC { + // fileIndex is in effect starting at fileStartPC up to + // but not including filePC, and it's the file we want. + // Run the PC table looking for a matching line number + // or until we reach filePC. + lineStartPC := linePC + for linePC < filePC && t.step(&fl, &linePC, &lineVal, linePC == entry) { + // lineVal is in effect until linePC, and lineStartPC < filePC. + if lineVal == line { + if fileStartPC <= lineStartPC { + return lineStartPC + } + if fileStartPC < linePC { + return fileStartPC + } + } + lineStartPC = linePC + } + } + fileStartPC = filePC + } + return 0 +} + +// go12PCToLine maps program counter to line number for the Go 1.2+ pcln table. +func (t *LineTable) go12PCToLine(pc uint64) (line int) { + defer func() { + if !disableRecover && recover() != nil { + line = -1 + } + }() + + f := t.findFunc(pc) + if f.IsZero() { + return -1 + } + entry := f.entryPC() + linetab := f.pcln() + return int(t.pcvalue(linetab, entry, pc)) +} + +// go12PCToFile maps program counter to file name for the Go 1.2+ pcln table. +func (t *LineTable) go12PCToFile(pc uint64) (file string) { + defer func() { + if !disableRecover && recover() != nil { + file = "" + } + }() + + f := t.findFunc(pc) + if f.IsZero() { + return "" + } + entry := f.entryPC() + filetab := f.pcfile() + fno := t.pcvalue(filetab, entry, pc) + if t.version == ver12 { + if fno <= 0 { + return "" + } + return t.string(t.binary.Uint32(t.filetab[4*fno:])) + } + // Go ≥ 1.16 + if fno < 0 { // 0 is valid for ≥ 1.16 + return "" + } + cuoff := f.cuOffset() + if fnoff := t.binary.Uint32(t.cutab[(cuoff+uint32(fno))*4:]); fnoff != ^uint32(0) { + return t.stringFrom(t.filetab, fnoff) + } + return "" +} + +// go12LineToPC maps a (file, line) pair to a program counter for the Go 1.2+ pcln table. +func (t *LineTable) go12LineToPC(file string, line int) (pc uint64) { + defer func() { + if !disableRecover && recover() != nil { + pc = 0 + } + }() + + t.initFileMap() + filenum, ok := t.fileMap[file] + if !ok { + return 0 + } + + // Scan all functions. + // If this turns out to be a bottleneck, we could build a map[int32][]int32 + // mapping file number to a list of functions with code from that file. + var cutab []byte + for i := uint32(0); i < t.nfunctab; i++ { + f := t.funcData(i) + entry := f.entryPC() + filetab := f.pcfile() + linetab := f.pcln() + if t.version == ver116 || t.version == ver118 || t.version == ver120 { + if f.cuOffset() == ^uint32(0) { + // skip functions without compilation unit (not real function, or linker generated) + continue + } + cutab = t.cutab[f.cuOffset()*4:] + } + pc := t.findFileLine(entry, filetab, linetab, int32(filenum), int32(line), cutab) + if pc != 0 { + return pc + } + } + return 0 +} + +// initFileMap initializes the map from file name to file number. +func (t *LineTable) initFileMap() { + t.mu.Lock() + defer t.mu.Unlock() + + if t.fileMap != nil { + return + } + m := make(map[string]uint32) + + if t.version == ver12 { + for i := uint32(1); i < t.nfiletab; i++ { + s := t.string(t.binary.Uint32(t.filetab[4*i:])) + m[s] = i + } + } else { + var pos uint32 + for i := uint32(0); i < t.nfiletab; i++ { + s := t.stringFrom(t.filetab, pos) + m[s] = pos + pos += uint32(len(s) + 1) + } + } + t.fileMap = m +} + +// go12MapFiles adds to m a key for every file in the Go 1.2 LineTable. +// Every key maps to obj. That's not a very interesting map, but it provides +// a way for callers to obtain the list of files in the program. +func (t *LineTable) go12MapFiles(m map[string]*Obj, obj *Obj) { + if !disableRecover { + defer func() { + recover() + }() + } + + t.initFileMap() + for file := range t.fileMap { + m[file] = obj + } +} + +// disableRecover causes this package not to swallow panics. +// This is useful when making changes. +const disableRecover = false diff --git a/go/src/debug/gosym/pclntab_test.go b/go/src/debug/gosym/pclntab_test.go new file mode 100644 index 0000000000000000000000000000000000000000..e380bb5ad7321f7340f697548d1e2918efaf2432 --- /dev/null +++ b/go/src/debug/gosym/pclntab_test.go @@ -0,0 +1,407 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package gosym + +import ( + "bytes" + "compress/gzip" + "debug/elf" + "internal/testenv" + "io" + "os" + "os/exec" + "path/filepath" + "runtime" + "strings" + "testing" +) + +var ( + pclineTempDir string + pclinetestBinary string +) + +func dotest(t *testing.T) { + testenv.MustHaveGoBuild(t) + // For now, only works on amd64 platforms. + if runtime.GOARCH != "amd64" { + t.Skipf("skipping on non-AMD64 system %s", runtime.GOARCH) + } + // This test builds a Linux/AMD64 binary. Skipping in short mode if cross compiling. + if runtime.GOOS != "linux" && testing.Short() { + t.Skipf("skipping in short mode on non-Linux system %s", runtime.GOARCH) + } + var err error + pclineTempDir, err = os.MkdirTemp("", "pclinetest") + if err != nil { + t.Fatal(err) + } + pclinetestBinary = filepath.Join(pclineTempDir, "pclinetest") + cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", pclinetestBinary) + cmd.Dir = "testdata" + cmd.Env = append(os.Environ(), "GOOS=linux") + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + if err := cmd.Run(); err != nil { + t.Fatal(err) + } +} + +func endtest() { + if pclineTempDir != "" { + os.RemoveAll(pclineTempDir) + pclineTempDir = "" + pclinetestBinary = "" + } +} + +// skipIfNotELF skips the test if we are not running on an ELF system. +// These tests open and examine the test binary, and use elf.Open to do so. +func skipIfNotELF(t *testing.T) { + switch runtime.GOOS { + case "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris", "illumos": + // OK. + default: + t.Skipf("skipping on non-ELF system %s", runtime.GOOS) + } +} + +func getTable(t *testing.T) *Table { + f, tab := crack(os.Args[0], t) + f.Close() + return tab +} + +func crack(file string, t *testing.T) (*elf.File, *Table) { + // Open self + f, err := elf.Open(file) + if err != nil { + t.Fatal(err) + } + return parse(file, f, t) +} + +func parse(file string, f *elf.File, t *testing.T) (*elf.File, *Table) { + s := f.Section(".gosymtab") + if s == nil { + t.Skip("no .gosymtab section") + } + symdat, err := s.Data() + if err != nil { + f.Close() + t.Fatalf("reading %s gosymtab: %v", file, err) + } + pclndat, err := f.Section(".gopclntab").Data() + if err != nil { + f.Close() + t.Fatalf("reading %s gopclntab: %v", file, err) + } + + pcln := NewLineTable(pclndat, f.Section(".text").Addr) + tab, err := NewTable(symdat, pcln) + if err != nil { + f.Close() + t.Fatalf("parsing %s gosymtab: %v", file, err) + } + + return f, tab +} + +func TestLineFromAline(t *testing.T) { + skipIfNotELF(t) + + tab := getTable(t) + if tab.go12line != nil { + // aline's don't exist in the Go 1.2 table. + t.Skip("not relevant to Go 1.2 symbol table") + } + + // Find the sym package + pkg := tab.LookupFunc("debug/gosym.TestLineFromAline").Obj + if pkg == nil { + t.Fatalf("nil pkg") + } + + // Walk every absolute line and ensure that we hit every + // source line monotonically + lastline := make(map[string]int) + final := -1 + for i := 0; i < 10000; i++ { + path, line := pkg.lineFromAline(i) + // Check for end of object + if path == "" { + if final == -1 { + final = i - 1 + } + continue + } else if final != -1 { + t.Fatalf("reached end of package at absolute line %d, but absolute line %d mapped to %s:%d", final, i, path, line) + } + // It's okay to see files multiple times (e.g., sys.a) + if line == 1 { + lastline[path] = 1 + continue + } + // Check that the is the next line in path + ll, ok := lastline[path] + if !ok { + t.Errorf("file %s starts on line %d", path, line) + } else if line != ll+1 { + t.Fatalf("expected next line of file %s to be %d, got %d", path, ll+1, line) + } + lastline[path] = line + } + if final == -1 { + t.Errorf("never reached end of object") + } +} + +func TestLineAline(t *testing.T) { + skipIfNotELF(t) + + tab := getTable(t) + if tab.go12line != nil { + // aline's don't exist in the Go 1.2 table. + t.Skip("not relevant to Go 1.2 symbol table") + } + + for _, o := range tab.Files { + // A source file can appear multiple times in a + // object. alineFromLine will always return alines in + // the first file, so track which lines we've seen. + found := make(map[string]int) + for i := 0; i < 1000; i++ { + path, line := o.lineFromAline(i) + if path == "" { + break + } + + // cgo files are full of 'Z' symbols, which we don't handle + if len(path) > 4 && path[len(path)-4:] == ".cgo" { + continue + } + + if minline, ok := found[path]; path != "" && ok { + if minline >= line { + // We've already covered this file + continue + } + } + found[path] = line + + a, err := o.alineFromLine(path, line) + if err != nil { + t.Errorf("absolute line %d in object %s maps to %s:%d, but mapping that back gives error %s", i, o.Paths[0].Name, path, line, err) + } else if a != i { + t.Errorf("absolute line %d in object %s maps to %s:%d, which maps back to absolute line %d\n", i, o.Paths[0].Name, path, line, a) + } + } + } +} + +func TestPCLine(t *testing.T) { + dotest(t) + defer endtest() + + f, tab := crack(pclinetestBinary, t) + defer f.Close() + text := f.Section(".text") + textdat, err := text.Data() + if err != nil { + t.Fatalf("reading .text: %v", err) + } + + // Test PCToLine + sym := tab.LookupFunc("main.linefrompc") + wantLine := 0 + for pc := sym.Entry; pc < sym.End; pc++ { + off := pc - text.Addr // TODO(rsc): should not need off; bug in 8g + if textdat[off] == 255 { + break + } + wantLine += int(textdat[off]) + t.Logf("off is %d %#x (max %d)", off, textdat[off], sym.End-pc) + file, line, fn := tab.PCToLine(pc) + if fn == nil { + t.Errorf("failed to get line of PC %#x", pc) + } else if !strings.HasSuffix(file, "pclinetest.s") || line != wantLine || fn != sym { + t.Errorf("PCToLine(%#x) = %s:%d (%s), want %s:%d (%s)", pc, file, line, fn.Name, "pclinetest.s", wantLine, sym.Name) + } + } + + // Test LineToPC + sym = tab.LookupFunc("main.pcfromline") + lookupline := -1 + wantLine = 0 + off := uint64(0) // TODO(rsc): should not need off; bug in 8g + for pc := sym.Value; pc < sym.End; pc += 2 + uint64(textdat[off]) { + file, line, fn := tab.PCToLine(pc) + off = pc - text.Addr + if textdat[off] == 255 { + break + } + wantLine += int(textdat[off]) + if line != wantLine { + t.Errorf("expected line %d at PC %#x in pcfromline, got %d", wantLine, pc, line) + off = pc + 1 - text.Addr + continue + } + if lookupline == -1 { + lookupline = line + } + for ; lookupline <= line; lookupline++ { + pc2, fn2, err := tab.LineToPC(file, lookupline) + if lookupline != line { + // Should be nothing on this line + if err == nil { + t.Errorf("expected no PC at line %d, got %#x (%s)", lookupline, pc2, fn2.Name) + } + } else if err != nil { + t.Errorf("failed to get PC of line %d: %s", lookupline, err) + } else if pc != pc2 { + t.Errorf("expected PC %#x (%s) at line %d, got PC %#x (%s)", pc, fn.Name, line, pc2, fn2.Name) + } + } + off = pc + 1 - text.Addr + } +} + +func TestSymVersion(t *testing.T) { + skipIfNotELF(t) + + table := getTable(t) + if table.go12line == nil { + t.Skip("not relevant to Go 1.2+ symbol table") + } + for _, fn := range table.Funcs { + if fn.goVersion == verUnknown { + t.Fatalf("unexpected symbol version: %v", fn) + } + } +} + +// read115Executable returns a hello world executable compiled by Go 1.15. +// +// The file was compiled in /tmp/hello.go: +// +// package main +// +// func main() { +// println("hello") +// } +func read115Executable(tb testing.TB) []byte { + zippedDat, err := os.ReadFile("testdata/pcln115.gz") + if err != nil { + tb.Fatal(err) + } + var gzReader *gzip.Reader + gzReader, err = gzip.NewReader(bytes.NewBuffer(zippedDat)) + if err != nil { + tb.Fatal(err) + } + var dat []byte + dat, err = io.ReadAll(gzReader) + if err != nil { + tb.Fatal(err) + } + return dat +} + +// Test that we can parse a pclntab from 1.15. +func Test115PclnParsing(t *testing.T) { + dat := read115Executable(t) + const textStart = 0x1001000 + pcln := NewLineTable(dat, textStart) + tab, err := NewTable(nil, pcln) + if err != nil { + t.Fatal(err) + } + var f *Func + var pc uint64 + pc, f, err = tab.LineToPC("/tmp/hello.go", 3) + if err != nil { + t.Fatal(err) + } + if pcln.version != ver12 { + t.Fatal("Expected pcln to parse as an older version") + } + if pc != 0x105c280 { + t.Fatalf("expect pc = 0x105c280, got 0x%x", pc) + } + if f.Name != "main.main" { + t.Fatalf("expected to parse name as main.main, got %v", f.Name) + } +} + +var ( + sinkLineTable *LineTable + sinkTable *Table +) + +func Benchmark115(b *testing.B) { + dat := read115Executable(b) + const textStart = 0x1001000 + + b.Run("NewLineTable", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + sinkLineTable = NewLineTable(dat, textStart) + } + }) + + pcln := NewLineTable(dat, textStart) + b.Run("NewTable", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + var err error + sinkTable, err = NewTable(nil, pcln) + if err != nil { + b.Fatal(err) + } + } + }) + + tab, err := NewTable(nil, pcln) + if err != nil { + b.Fatal(err) + } + + b.Run("LineToPC", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + var f *Func + var pc uint64 + pc, f, err = tab.LineToPC("/tmp/hello.go", 3) + if err != nil { + b.Fatal(err) + } + if pcln.version != ver12 { + b.Fatalf("want version=%d, got %d", ver12, pcln.version) + } + if pc != 0x105c280 { + b.Fatalf("want pc=0x105c280, got 0x%x", pc) + } + if f.Name != "main.main" { + b.Fatalf("want name=main.main, got %q", f.Name) + } + } + }) + + b.Run("PCToLine", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + file, line, fn := tab.PCToLine(0x105c280) + if file != "/tmp/hello.go" { + b.Fatalf("want name=/tmp/hello.go, got %q", file) + } + if line != 3 { + b.Fatalf("want line=3, got %d", line) + } + if fn.Name != "main.main" { + b.Fatalf("want name=main.main, got %q", fn.Name) + } + } + }) +} diff --git a/go/src/debug/gosym/symtab.go b/go/src/debug/gosym/symtab.go new file mode 100644 index 0000000000000000000000000000000000000000..08d46684bf32c4fcc7cfac0062ef57339d272477 --- /dev/null +++ b/go/src/debug/gosym/symtab.go @@ -0,0 +1,775 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package gosym implements access to the Go symbol +// and line number tables embedded in Go binaries generated +// by the gc compilers. +package gosym + +import ( + "bytes" + "encoding/binary" + "fmt" + "strconv" + "strings" +) + +/* + * Symbols + */ + +// A Sym represents a single symbol table entry. +type Sym struct { + Value uint64 + Type byte + Name string + GoType uint64 + // If this symbol is a function symbol, the corresponding Func + Func *Func + + goVersion version +} + +// Static reports whether this symbol is static (not visible outside its file). +func (s *Sym) Static() bool { return s.Type >= 'a' } + +// nameWithoutInst returns s.Name if s.Name has no brackets (does not reference an +// instantiated type, function, or method). If s.Name contains brackets, then it +// returns s.Name with all the contents between (and including) the outermost left +// and right bracket removed. This is useful to ignore any extra slashes or dots +// inside the brackets from the string searches below, where needed. +func (s *Sym) nameWithoutInst() string { + start := strings.Index(s.Name, "[") + if start < 0 { + return s.Name + } + end := strings.LastIndex(s.Name, "]") + if end < 0 { + // Malformed name, should contain closing bracket too. + return s.Name + } + return s.Name[0:start] + s.Name[end+1:] +} + +// PackageName returns the package part of the symbol name, +// or the empty string if there is none. +func (s *Sym) PackageName() string { + name := s.nameWithoutInst() + + // Since go1.20, a prefix of "type:" and "go:" is a compiler-generated symbol, + // they do not belong to any package. + // + // See cmd/compile/internal/base/link.go:ReservedImports variable. + if s.goVersion >= ver120 && (strings.HasPrefix(name, "go:") || strings.HasPrefix(name, "type:")) { + return "" + } + + // For go1.18 and below, the prefix are "type." and "go." instead. + if s.goVersion <= ver118 && (strings.HasPrefix(name, "go.") || strings.HasPrefix(name, "type.")) { + return "" + } + + pathend := strings.LastIndex(name, "/") + if pathend < 0 { + pathend = 0 + } + + if i := strings.Index(name[pathend:], "."); i != -1 { + return name[:pathend+i] + } + return "" +} + +// ReceiverName returns the receiver type name of this symbol, +// or the empty string if there is none. A receiver name is only detected in +// the case that s.Name is fully-specified with a package name. +func (s *Sym) ReceiverName() string { + name := s.nameWithoutInst() + // If we find a slash in name, it should precede any bracketed expression + // that was removed, so pathend will apply correctly to name and s.Name. + pathend := strings.LastIndex(name, "/") + if pathend < 0 { + pathend = 0 + } + // Find the first dot after pathend (or from the beginning, if there was + // no slash in name). + l := strings.Index(name[pathend:], ".") + // Find the last dot after pathend (or the beginning). + r := strings.LastIndex(name[pathend:], ".") + if l == -1 || r == -1 || l == r { + // There is no receiver if we didn't find two distinct dots after pathend. + return "" + } + // Given there is a trailing '.' that is in name, find it now in s.Name. + // pathend+l should apply to s.Name, because it should be the dot in the + // package name. + r = strings.LastIndex(s.Name[pathend:], ".") + return s.Name[pathend+l+1 : pathend+r] +} + +// BaseName returns the symbol name without the package or receiver name. +func (s *Sym) BaseName() string { + name := s.nameWithoutInst() + if i := strings.LastIndex(name, "."); i != -1 { + if s.Name != name { + brack := strings.Index(s.Name, "[") + if i > brack { + // BaseName is a method name after the brackets, so + // recalculate for s.Name. Otherwise, i applies + // correctly to s.Name, since it is before the + // brackets. + i = strings.LastIndex(s.Name, ".") + } + } + return s.Name[i+1:] + } + return s.Name +} + +// A Func collects information about a single function. +type Func struct { + Entry uint64 + *Sym + End uint64 + Params []*Sym // nil for Go 1.3 and later binaries + Locals []*Sym // nil for Go 1.3 and later binaries + FrameSize int + LineTable *LineTable + Obj *Obj +} + +// An Obj represents a collection of functions in a symbol table. +// +// The exact method of division of a binary into separate Objs is an internal detail +// of the symbol table format. +// +// In early versions of Go each source file became a different Obj. +// +// In Go 1 and Go 1.1, each package produced one Obj for all Go sources +// and one Obj per C source file. +// +// In Go 1.2, there is a single Obj for the entire program. +type Obj struct { + // Funcs is a list of functions in the Obj. + Funcs []Func + + // In Go 1.1 and earlier, Paths is a list of symbols corresponding + // to the source file names that produced the Obj. + // In Go 1.2, Paths is nil. + // Use the keys of Table.Files to obtain a list of source files. + Paths []Sym // meta +} + +/* + * Symbol tables + */ + +// Table represents a Go symbol table. It stores all of the +// symbols decoded from the program and provides methods to translate +// between symbols, names, and addresses. +type Table struct { + Syms []Sym // nil for Go 1.3 and later binaries + Funcs []Func + Files map[string]*Obj // for Go 1.2 and later all files map to one Obj + Objs []Obj // for Go 1.2 and later only one Obj in slice + + go12line *LineTable // Go 1.2 line number table +} + +type sym struct { + value uint64 + gotype uint64 + typ byte + name []byte +} + +var ( + littleEndianSymtab = []byte{0xFD, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00} + bigEndianSymtab = []byte{0xFF, 0xFF, 0xFF, 0xFD, 0x00, 0x00, 0x00} + oldLittleEndianSymtab = []byte{0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00} +) + +func walksymtab(data []byte, fn func(sym) error) error { + if len(data) == 0 { // missing symtab is okay + return nil + } + var order binary.ByteOrder = binary.BigEndian + newTable := false + switch { + case bytes.HasPrefix(data, oldLittleEndianSymtab): + // Same as Go 1.0, but little endian. + // Format was used during interim development between Go 1.0 and Go 1.1. + // Should not be widespread, but easy to support. + data = data[6:] + order = binary.LittleEndian + case bytes.HasPrefix(data, bigEndianSymtab): + newTable = true + case bytes.HasPrefix(data, littleEndianSymtab): + newTable = true + order = binary.LittleEndian + } + var ptrsz int + if newTable { + if len(data) < 8 { + return &DecodingError{len(data), "unexpected EOF", nil} + } + ptrsz = int(data[7]) + if ptrsz != 4 && ptrsz != 8 { + return &DecodingError{7, "invalid pointer size", ptrsz} + } + data = data[8:] + } + var s sym + p := data + for len(p) >= 4 { + var typ byte + if newTable { + // Symbol type, value, Go type. + typ = p[0] & 0x3F + wideValue := p[0]&0x40 != 0 + goType := p[0]&0x80 != 0 + if typ < 26 { + typ += 'A' + } else { + typ += 'a' - 26 + } + s.typ = typ + p = p[1:] + if wideValue { + if len(p) < ptrsz { + return &DecodingError{len(data), "unexpected EOF", nil} + } + // fixed-width value + if ptrsz == 8 { + s.value = order.Uint64(p[0:8]) + p = p[8:] + } else { + s.value = uint64(order.Uint32(p[0:4])) + p = p[4:] + } + } else { + // varint value + s.value = 0 + shift := uint(0) + for len(p) > 0 && p[0]&0x80 != 0 { + s.value |= uint64(p[0]&0x7F) << shift + shift += 7 + p = p[1:] + } + if len(p) == 0 { + return &DecodingError{len(data), "unexpected EOF", nil} + } + s.value |= uint64(p[0]) << shift + p = p[1:] + } + if goType { + if len(p) < ptrsz { + return &DecodingError{len(data), "unexpected EOF", nil} + } + // fixed-width go type + if ptrsz == 8 { + s.gotype = order.Uint64(p[0:8]) + p = p[8:] + } else { + s.gotype = uint64(order.Uint32(p[0:4])) + p = p[4:] + } + } + } else { + // Value, symbol type. + s.value = uint64(order.Uint32(p[0:4])) + if len(p) < 5 { + return &DecodingError{len(data), "unexpected EOF", nil} + } + typ = p[4] + if typ&0x80 == 0 { + return &DecodingError{len(data) - len(p) + 4, "bad symbol type", typ} + } + typ &^= 0x80 + s.typ = typ + p = p[5:] + } + + // Name. + var i int + var nnul int + for i = 0; i < len(p); i++ { + if p[i] == 0 { + nnul = 1 + break + } + } + switch typ { + case 'z', 'Z': + p = p[i+nnul:] + for i = 0; i+2 <= len(p); i += 2 { + if p[i] == 0 && p[i+1] == 0 { + nnul = 2 + break + } + } + } + if len(p) < i+nnul { + return &DecodingError{len(data), "unexpected EOF", nil} + } + s.name = p[0:i] + i += nnul + p = p[i:] + + if !newTable { + if len(p) < 4 { + return &DecodingError{len(data), "unexpected EOF", nil} + } + // Go type. + s.gotype = uint64(order.Uint32(p[:4])) + p = p[4:] + } + fn(s) + } + return nil +} + +// NewTable decodes the Go symbol table (the ".gosymtab" section in ELF), +// returning an in-memory representation. +// Starting with Go 1.3, the Go symbol table no longer includes symbol data; +// callers should pass nil for the symtab parameter. +func NewTable(symtab []byte, pcln *LineTable) (*Table, error) { + var n int + err := walksymtab(symtab, func(s sym) error { + n++ + return nil + }) + if err != nil { + return nil, err + } + + var t Table + if pcln.isGo12() { + t.go12line = pcln + } + fname := make(map[uint16]string) + t.Syms = make([]Sym, 0, n) + nf := 0 + nz := 0 + lasttyp := uint8(0) + err = walksymtab(symtab, func(s sym) error { + n := len(t.Syms) + t.Syms = t.Syms[0 : n+1] + ts := &t.Syms[n] + ts.Type = s.typ + ts.Value = s.value + ts.GoType = s.gotype + ts.goVersion = pcln.version + switch s.typ { + default: + // rewrite name to use . instead of · (c2 b7) + w := 0 + b := s.name + for i := 0; i < len(b); i++ { + if b[i] == 0xc2 && i+1 < len(b) && b[i+1] == 0xb7 { + i++ + b[i] = '.' + } + b[w] = b[i] + w++ + } + ts.Name = string(s.name[0:w]) + case 'z', 'Z': + if lasttyp != 'z' && lasttyp != 'Z' { + nz++ + } + for i := 0; i < len(s.name); i += 2 { + eltIdx := binary.BigEndian.Uint16(s.name[i : i+2]) + elt, ok := fname[eltIdx] + if !ok { + return &DecodingError{-1, "bad filename code", eltIdx} + } + if n := len(ts.Name); n > 0 && ts.Name[n-1] != '/' { + ts.Name += "/" + } + ts.Name += elt + } + } + switch s.typ { + case 'T', 't', 'L', 'l': + nf++ + case 'f': + fname[uint16(s.value)] = ts.Name + } + lasttyp = s.typ + return nil + }) + if err != nil { + return nil, err + } + + t.Funcs = make([]Func, 0, nf) + t.Files = make(map[string]*Obj) + + var obj *Obj + if t.go12line != nil { + // Put all functions into one Obj. + t.Objs = make([]Obj, 1) + obj = &t.Objs[0] + t.go12line.go12MapFiles(t.Files, obj) + } else { + t.Objs = make([]Obj, 0, nz) + } + + // Count text symbols and attach frame sizes, parameters, and + // locals to them. Also, find object file boundaries. + lastf := 0 + for i := 0; i < len(t.Syms); i++ { + sym := &t.Syms[i] + switch sym.Type { + case 'Z', 'z': // path symbol + if t.go12line != nil { + // Go 1.2 binaries have the file information elsewhere. Ignore. + break + } + // Finish the current object + if obj != nil { + obj.Funcs = t.Funcs[lastf:] + } + lastf = len(t.Funcs) + + // Start new object + n := len(t.Objs) + t.Objs = t.Objs[0 : n+1] + obj = &t.Objs[n] + + // Count & copy path symbols + var end int + for end = i + 1; end < len(t.Syms); end++ { + if c := t.Syms[end].Type; c != 'Z' && c != 'z' { + break + } + } + obj.Paths = t.Syms[i:end] + i = end - 1 // loop will i++ + + // Record file names + depth := 0 + for j := range obj.Paths { + s := &obj.Paths[j] + if s.Name == "" { + depth-- + } else { + if depth == 0 { + t.Files[s.Name] = obj + } + depth++ + } + } + + case 'T', 't', 'L', 'l': // text symbol + if n := len(t.Funcs); n > 0 { + t.Funcs[n-1].End = sym.Value + } + if sym.Name == "runtime.etext" || sym.Name == "etext" { + continue + } + + // Count parameter and local (auto) syms + var np, na int + var end int + countloop: + for end = i + 1; end < len(t.Syms); end++ { + switch t.Syms[end].Type { + case 'T', 't', 'L', 'l', 'Z', 'z': + break countloop + case 'p': + np++ + case 'a': + na++ + } + } + + // Fill in the function symbol + n := len(t.Funcs) + t.Funcs = t.Funcs[0 : n+1] + fn := &t.Funcs[n] + sym.Func = fn + fn.Params = make([]*Sym, 0, np) + fn.Locals = make([]*Sym, 0, na) + fn.Sym = sym + fn.Entry = sym.Value + fn.Obj = obj + if t.go12line != nil { + // All functions share the same line table. + // It knows how to narrow down to a specific + // function quickly. + fn.LineTable = t.go12line + } else if pcln != nil { + fn.LineTable = pcln.slice(fn.Entry) + pcln = fn.LineTable + } + for j := i; j < end; j++ { + s := &t.Syms[j] + switch s.Type { + case 'm': + fn.FrameSize = int(s.Value) + case 'p': + n := len(fn.Params) + fn.Params = fn.Params[0 : n+1] + fn.Params[n] = s + case 'a': + n := len(fn.Locals) + fn.Locals = fn.Locals[0 : n+1] + fn.Locals[n] = s + } + } + i = end - 1 // loop will i++ + } + } + + if t.go12line != nil && nf == 0 { + t.Funcs = t.go12line.go12Funcs() + } + if obj != nil { + obj.Funcs = t.Funcs[lastf:] + } + return &t, nil +} + +// PCToFunc returns the function containing the program counter pc, +// or nil if there is no such function. +func (t *Table) PCToFunc(pc uint64) *Func { + funcs := t.Funcs + for len(funcs) > 0 { + m := len(funcs) / 2 + fn := &funcs[m] + switch { + case pc < fn.Entry: + funcs = funcs[0:m] + case fn.Entry <= pc && pc < fn.End: + return fn + default: + funcs = funcs[m+1:] + } + } + return nil +} + +// PCToLine looks up line number information for a program counter. +// If there is no information, it returns fn == nil. +func (t *Table) PCToLine(pc uint64) (file string, line int, fn *Func) { + if fn = t.PCToFunc(pc); fn == nil { + return + } + if t.go12line != nil { + file = t.go12line.go12PCToFile(pc) + line = t.go12line.go12PCToLine(pc) + } else { + file, line = fn.Obj.lineFromAline(fn.LineTable.PCToLine(pc)) + } + return +} + +// LineToPC looks up the first program counter on the given line in +// the named file. It returns [UnknownFileError] or [UnknownLineError] if +// there is an error looking up this line. +func (t *Table) LineToPC(file string, line int) (pc uint64, fn *Func, err error) { + obj, ok := t.Files[file] + if !ok { + return 0, nil, UnknownFileError(file) + } + + if t.go12line != nil { + pc := t.go12line.go12LineToPC(file, line) + if pc == 0 { + return 0, nil, &UnknownLineError{file, line} + } + return pc, t.PCToFunc(pc), nil + } + + abs, err := obj.alineFromLine(file, line) + if err != nil { + return + } + for i := range obj.Funcs { + f := &obj.Funcs[i] + pc := f.LineTable.LineToPC(abs, f.End) + if pc != 0 { + return pc, f, nil + } + } + return 0, nil, &UnknownLineError{file, line} +} + +// LookupSym returns the text, data, or bss symbol with the given name, +// or nil if no such symbol is found. +func (t *Table) LookupSym(name string) *Sym { + // TODO(austin) Maybe make a map + for i := range t.Syms { + s := &t.Syms[i] + switch s.Type { + case 'T', 't', 'L', 'l', 'D', 'd', 'B', 'b': + if s.Name == name { + return s + } + } + } + return nil +} + +// LookupFunc returns the text, data, or bss symbol with the given name, +// or nil if no such symbol is found. +func (t *Table) LookupFunc(name string) *Func { + for i := range t.Funcs { + f := &t.Funcs[i] + if f.Sym.Name == name { + return f + } + } + return nil +} + +// SymByAddr returns the text, data, or bss symbol starting at the given address. +func (t *Table) SymByAddr(addr uint64) *Sym { + for i := range t.Syms { + s := &t.Syms[i] + switch s.Type { + case 'T', 't', 'L', 'l', 'D', 'd', 'B', 'b': + if s.Value == addr { + return s + } + } + } + return nil +} + +/* + * Object files + */ + +// This is legacy code for Go 1.1 and earlier, which used the +// Plan 9 format for pc-line tables. This code was never quite +// correct. It's probably very close, and it's usually correct, but +// we never quite found all the corner cases. +// +// Go 1.2 and later use a simpler format, documented at golang.org/s/go12symtab. + +func (o *Obj) lineFromAline(aline int) (string, int) { + type stackEnt struct { + path string + start int + offset int + prev *stackEnt + } + + noPath := &stackEnt{"", 0, 0, nil} + tos := noPath + +pathloop: + for _, s := range o.Paths { + val := int(s.Value) + switch { + case val > aline: + break pathloop + + case val == 1: + // Start a new stack + tos = &stackEnt{s.Name, val, 0, noPath} + + case s.Name == "": + // Pop + if tos == noPath { + return "", 0 + } + tos.prev.offset += val - tos.start + tos = tos.prev + + default: + // Push + tos = &stackEnt{s.Name, val, 0, tos} + } + } + + if tos == noPath { + return "", 0 + } + return tos.path, aline - tos.start - tos.offset + 1 +} + +func (o *Obj) alineFromLine(path string, line int) (int, error) { + if line < 1 { + return 0, &UnknownLineError{path, line} + } + + for i, s := range o.Paths { + // Find this path + if s.Name != path { + continue + } + + // Find this line at this stack level + depth := 0 + var incstart int + line += int(s.Value) + pathloop: + for _, s := range o.Paths[i:] { + val := int(s.Value) + switch { + case depth == 1 && val >= line: + return line - 1, nil + + case s.Name == "": + depth-- + if depth == 0 { + break pathloop + } else if depth == 1 { + line += val - incstart + } + + default: + if depth == 1 { + incstart = val + } + depth++ + } + } + return 0, &UnknownLineError{path, line} + } + return 0, UnknownFileError(path) +} + +/* + * Errors + */ + +// UnknownFileError represents a failure to find the specific file in +// the symbol table. +type UnknownFileError string + +func (e UnknownFileError) Error() string { return "unknown file: " + string(e) } + +// UnknownLineError represents a failure to map a line to a program +// counter, either because the line is beyond the bounds of the file +// or because there is no code on the given line. +type UnknownLineError struct { + File string + Line int +} + +func (e *UnknownLineError) Error() string { + return "no code at " + e.File + ":" + strconv.Itoa(e.Line) +} + +// DecodingError represents an error during the decoding of +// the symbol table. +type DecodingError struct { + off int + msg string + val any +} + +func (e *DecodingError) Error() string { + msg := e.msg + if e.val != nil { + msg += fmt.Sprintf(" '%v'", e.val) + } + msg += fmt.Sprintf(" at byte %#x", e.off) + return msg +} diff --git a/go/src/debug/gosym/symtab_test.go b/go/src/debug/gosym/symtab_test.go new file mode 100644 index 0000000000000000000000000000000000000000..bb1f267a4dfc25e4cb696d845a0f132609248747 --- /dev/null +++ b/go/src/debug/gosym/symtab_test.go @@ -0,0 +1,87 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package gosym + +import ( + "fmt" + "testing" +) + +func assertString(t *testing.T, dsc, out, tgt string) { + if out != tgt { + t.Fatalf("Expected: %q Actual: %q for %s", tgt, out, dsc) + } +} + +func TestStandardLibPackage(t *testing.T) { + s1 := Sym{Name: "io.(*LimitedReader).Read"} + s2 := Sym{Name: "io.NewSectionReader"} + assertString(t, fmt.Sprintf("package of %q", s1.Name), s1.PackageName(), "io") + assertString(t, fmt.Sprintf("package of %q", s2.Name), s2.PackageName(), "io") + assertString(t, fmt.Sprintf("receiver of %q", s1.Name), s1.ReceiverName(), "(*LimitedReader)") + assertString(t, fmt.Sprintf("receiver of %q", s2.Name), s2.ReceiverName(), "") +} + +func TestStandardLibPathPackage(t *testing.T) { + s1 := Sym{Name: "debug/gosym.(*LineTable).PCToLine"} + s2 := Sym{Name: "debug/gosym.NewTable"} + assertString(t, fmt.Sprintf("package of %q", s1.Name), s1.PackageName(), "debug/gosym") + assertString(t, fmt.Sprintf("package of %q", s2.Name), s2.PackageName(), "debug/gosym") + assertString(t, fmt.Sprintf("receiver of %q", s1.Name), s1.ReceiverName(), "(*LineTable)") + assertString(t, fmt.Sprintf("receiver of %q", s2.Name), s2.ReceiverName(), "") +} + +func TestGenericNames(t *testing.T) { + s1 := Sym{Name: "main.set[int]"} + s2 := Sym{Name: "main.(*value[int]).get"} + s3 := Sym{Name: "a/b.absDifference[c/d.orderedAbs[float64]]"} + s4 := Sym{Name: "main.testfunction[.shape.int]"} + assertString(t, fmt.Sprintf("package of %q", s1.Name), s1.PackageName(), "main") + assertString(t, fmt.Sprintf("package of %q", s2.Name), s2.PackageName(), "main") + assertString(t, fmt.Sprintf("package of %q", s3.Name), s3.PackageName(), "a/b") + assertString(t, fmt.Sprintf("package of %q", s4.Name), s4.PackageName(), "main") + assertString(t, fmt.Sprintf("receiver of %q", s1.Name), s1.ReceiverName(), "") + assertString(t, fmt.Sprintf("receiver of %q", s2.Name), s2.ReceiverName(), "(*value[int])") + assertString(t, fmt.Sprintf("receiver of %q", s3.Name), s3.ReceiverName(), "") + assertString(t, fmt.Sprintf("receiver of %q", s4.Name), s4.ReceiverName(), "") + assertString(t, fmt.Sprintf("base of %q", s1.Name), s1.BaseName(), "set[int]") + assertString(t, fmt.Sprintf("base of %q", s2.Name), s2.BaseName(), "get") + assertString(t, fmt.Sprintf("base of %q", s3.Name), s3.BaseName(), "absDifference[c/d.orderedAbs[float64]]") + assertString(t, fmt.Sprintf("base of %q", s4.Name), s4.BaseName(), "testfunction[.shape.int]") +} + +func TestRemotePackage(t *testing.T) { + s1 := Sym{Name: "github.com/docker/doc.ker/pkg/mflag.(*FlagSet).PrintDefaults"} + s2 := Sym{Name: "github.com/docker/doc.ker/pkg/mflag.PrintDefaults"} + assertString(t, fmt.Sprintf("package of %q", s1.Name), s1.PackageName(), "github.com/docker/doc.ker/pkg/mflag") + assertString(t, fmt.Sprintf("package of %q", s2.Name), s2.PackageName(), "github.com/docker/doc.ker/pkg/mflag") + assertString(t, fmt.Sprintf("receiver of %q", s1.Name), s1.ReceiverName(), "(*FlagSet)") + assertString(t, fmt.Sprintf("receiver of %q", s2.Name), s2.ReceiverName(), "") +} + +func TestIssue29551(t *testing.T) { + tests := []struct { + sym Sym + pkgName string + }{ + {Sym{goVersion: ver120, Name: "type:.eq.[9]debug/elf.intName"}, ""}, + {Sym{goVersion: ver120, Name: "type:.hash.debug/elf.ProgHeader"}, ""}, + {Sym{goVersion: ver120, Name: "type:.eq.runtime._panic"}, ""}, + {Sym{goVersion: ver120, Name: "type:.hash.struct { runtime.gList; runtime.n int32 }"}, ""}, + {Sym{goVersion: ver120, Name: "go:(*struct { sync.Mutex; math/big.table [64]math/big"}, ""}, + {Sym{goVersion: ver120, Name: "go.uber.org/zap/buffer.(*Buffer).AppendString"}, "go.uber.org/zap/buffer"}, + {Sym{goVersion: ver118, Name: "type..eq.[9]debug/elf.intName"}, ""}, + {Sym{goVersion: ver118, Name: "type..hash.debug/elf.ProgHeader"}, ""}, + {Sym{goVersion: ver118, Name: "type..eq.runtime._panic"}, ""}, + {Sym{goVersion: ver118, Name: "type..hash.struct { runtime.gList; runtime.n int32 }"}, ""}, + {Sym{goVersion: ver118, Name: "go.(*struct { sync.Mutex; math/big.table [64]math/big"}, ""}, + // unfortunate + {Sym{goVersion: ver118, Name: "go.uber.org/zap/buffer.(*Buffer).AppendString"}, ""}, + } + + for _, tc := range tests { + assertString(t, fmt.Sprintf("package of %q", tc.sym.Name), tc.sym.PackageName(), tc.pkgName) + } +} diff --git a/go/src/debug/gosym/testdata/main.go b/go/src/debug/gosym/testdata/main.go new file mode 100644 index 0000000000000000000000000000000000000000..b7702184cdef4123d0fac4b2ef5e5b60f1d38bf3 --- /dev/null +++ b/go/src/debug/gosym/testdata/main.go @@ -0,0 +1,10 @@ +package main + +func linefrompc() +func pcfromline() + +func main() { + // Prevent GC of our test symbols + linefrompc() + pcfromline() +} diff --git a/go/src/debug/gosym/testdata/pclinetest.h b/go/src/debug/gosym/testdata/pclinetest.h new file mode 100644 index 0000000000000000000000000000000000000000..156c0b87b00a0f6ccb9271424bb75957b6d0c8c0 --- /dev/null +++ b/go/src/debug/gosym/testdata/pclinetest.h @@ -0,0 +1,9 @@ +// +build ignore + +// Empty include file to generate z symbols + + + + + +// EOF diff --git a/go/src/debug/gosym/testdata/pclinetest.s b/go/src/debug/gosym/testdata/pclinetest.s new file mode 100644 index 0000000000000000000000000000000000000000..53461cdfc1a1ee1033ba18945e7bbf95a6fc24d2 --- /dev/null +++ b/go/src/debug/gosym/testdata/pclinetest.s @@ -0,0 +1,48 @@ +TEXT ·linefrompc(SB),4,$0 // Each byte stores its line delta +BYTE $2; +BYTE $1; +BYTE $1; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; +BYTE $1; +BYTE $1; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +#include "pclinetest.h" +BYTE $2; +#include "pclinetest.h" +BYTE $2; +BYTE $255; + +TEXT ·pcfromline(SB),4,$0 // Each record stores its line delta, then n, then n more bytes +BYTE $32; BYTE $0; +BYTE $1; BYTE $1; BYTE $0; +BYTE $1; BYTE $0; + +BYTE $2; BYTE $4; BYTE $0; BYTE $0; BYTE $0; BYTE $0; + + +#include "pclinetest.h" +BYTE $4; BYTE $0; + + +BYTE $3; BYTE $3; BYTE $0; BYTE $0; BYTE $0; +#include "pclinetest.h" + + +BYTE $4; BYTE $3; BYTE $0; BYTE $0; BYTE $0; +BYTE $255; diff --git a/go/src/debug/macho/fat.go b/go/src/debug/macho/fat.go new file mode 100644 index 0000000000000000000000000000000000000000..f9601f86f6ee195f7c2b84103b7a8e17c04cd5a2 --- /dev/null +++ b/go/src/debug/macho/fat.go @@ -0,0 +1,153 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package macho + +import ( + "encoding/binary" + "fmt" + "internal/saferio" + "io" + "os" +) + +// A FatFile is a Mach-O universal binary that contains at least one architecture. +type FatFile struct { + Magic uint32 + Arches []FatArch + closer io.Closer +} + +// A FatArchHeader represents a fat header for a specific image architecture. +type FatArchHeader struct { + Cpu Cpu + SubCpu uint32 + Offset uint32 + Size uint32 + Align uint32 +} + +const fatArchHeaderSize = 5 * 4 + +// A FatArch is a Mach-O File inside a FatFile. +type FatArch struct { + FatArchHeader + *File +} + +// ErrNotFat is returned from [NewFatFile] or [OpenFat] when the file is not a +// universal binary but may be a thin binary, based on its magic number. +var ErrNotFat = &FormatError{0, "not a fat Mach-O file", nil} + +// NewFatFile creates a new [FatFile] for accessing all the Mach-O images in a +// universal binary. The Mach-O binary is expected to start at position 0 in +// the ReaderAt. +func NewFatFile(r io.ReaderAt) (*FatFile, error) { + var ff FatFile + sr := io.NewSectionReader(r, 0, 1<<63-1) + + // Read the fat_header struct, which is always in big endian. + // Start with the magic number. + err := binary.Read(sr, binary.BigEndian, &ff.Magic) + if err != nil { + return nil, &FormatError{0, "error reading magic number", nil} + } else if ff.Magic != MagicFat { + // See if this is a Mach-O file via its magic number. The magic + // must be converted to little endian first though. + var buf [4]byte + binary.BigEndian.PutUint32(buf[:], ff.Magic) + leMagic := binary.LittleEndian.Uint32(buf[:]) + if leMagic == Magic32 || leMagic == Magic64 { + return nil, ErrNotFat + } else { + return nil, &FormatError{0, "invalid magic number", nil} + } + } + offset := int64(4) + + // Read the number of FatArchHeaders that come after the fat_header. + var narch uint32 + err = binary.Read(sr, binary.BigEndian, &narch) + if err != nil { + return nil, &FormatError{offset, "invalid fat_header", nil} + } + offset += 4 + + if narch < 1 { + return nil, &FormatError{offset, "file contains no images", nil} + } + + // Combine the Cpu and SubCpu (both uint32) into a uint64 to make sure + // there are not duplicate architectures. + seenArches := make(map[uint64]bool) + // Make sure that all images are for the same MH_ type. + var machoType Type + + // Following the fat_header comes narch fat_arch structs that index + // Mach-O images further in the file. + c := saferio.SliceCap[FatArch](uint64(narch)) + if c < 0 { + return nil, &FormatError{offset, "too many images", nil} + } + ff.Arches = make([]FatArch, 0, c) + for i := uint32(0); i < narch; i++ { + var fa FatArch + err = binary.Read(sr, binary.BigEndian, &fa.FatArchHeader) + if err != nil { + return nil, &FormatError{offset, "invalid fat_arch header", nil} + } + offset += fatArchHeaderSize + + fr := io.NewSectionReader(r, int64(fa.Offset), int64(fa.Size)) + fa.File, err = NewFile(fr) + if err != nil { + return nil, err + } + + // Make sure the architecture for this image is not duplicate. + seenArch := (uint64(fa.Cpu) << 32) | uint64(fa.SubCpu) + if o, k := seenArches[seenArch]; o || k { + return nil, &FormatError{offset, fmt.Sprintf("duplicate architecture cpu=%v, subcpu=%#x", fa.Cpu, fa.SubCpu), nil} + } + seenArches[seenArch] = true + + // Make sure the Mach-O type matches that of the first image. + if i == 0 { + machoType = fa.Type + } else { + if fa.Type != machoType { + return nil, &FormatError{offset, fmt.Sprintf("Mach-O type for architecture #%d (type=%#x) does not match first (type=%#x)", i, fa.Type, machoType), nil} + } + } + + ff.Arches = append(ff.Arches, fa) + } + + return &ff, nil +} + +// OpenFat opens the named file using [os.Open] and prepares it for use as a Mach-O +// universal binary. +func OpenFat(name string) (*FatFile, error) { + f, err := os.Open(name) + if err != nil { + return nil, err + } + ff, err := NewFatFile(f) + if err != nil { + f.Close() + return nil, err + } + ff.closer = f + return ff, nil +} + +func (ff *FatFile) Close() error { + var err error + if ff.closer != nil { + err = ff.closer.Close() + ff.closer = nil + } + return err +} diff --git a/go/src/debug/macho/file.go b/go/src/debug/macho/file.go new file mode 100644 index 0000000000000000000000000000000000000000..8a4088828415b1b23176bc2ecc105364da517fce --- /dev/null +++ b/go/src/debug/macho/file.go @@ -0,0 +1,760 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/* +Package macho implements access to Mach-O object files. + +# Security + +This package is not designed to be hardened against adversarial inputs, and is +outside the scope of https://go.dev/security/policy. In particular, only basic +validation is done when parsing object files. As such, care should be taken when +parsing untrusted inputs, as parsing malformed files may consume significant +resources, or cause panics. +*/ +package macho + +// High level access to low level data structures. + +import ( + "bytes" + "compress/zlib" + "debug/dwarf" + "encoding/binary" + "fmt" + "internal/saferio" + "io" + "os" + "strings" +) + +// A File represents an open Mach-O file. +type File struct { + FileHeader + ByteOrder binary.ByteOrder + Loads []Load + Sections []*Section + + Symtab *Symtab + Dysymtab *Dysymtab + + closer io.Closer +} + +// A Load represents any Mach-O load command. +type Load interface { + Raw() []byte +} + +// A LoadBytes is the uninterpreted bytes of a Mach-O load command. +type LoadBytes []byte + +func (b LoadBytes) Raw() []byte { return b } + +// A SegmentHeader is the header for a Mach-O 32-bit or 64-bit load segment command. +type SegmentHeader struct { + Cmd LoadCmd + Len uint32 + Name string + Addr uint64 + Memsz uint64 + Offset uint64 + Filesz uint64 + Maxprot uint32 + Prot uint32 + Nsect uint32 + Flag uint32 +} + +// A Segment represents a Mach-O 32-bit or 64-bit load segment command. +type Segment struct { + LoadBytes + SegmentHeader + + // Embed ReaderAt for ReadAt method. + // Do not embed SectionReader directly + // to avoid having Read and Seek. + // If a client wants Read and Seek it must use + // Open() to avoid fighting over the seek offset + // with other clients. + io.ReaderAt + sr *io.SectionReader +} + +// Data reads and returns the contents of the segment. +func (s *Segment) Data() ([]byte, error) { + return saferio.ReadDataAt(s.sr, s.Filesz, 0) +} + +// Open returns a new ReadSeeker reading the segment. +func (s *Segment) Open() io.ReadSeeker { return io.NewSectionReader(s.sr, 0, 1<<63-1) } + +type SectionHeader struct { + Name string + Seg string + Addr uint64 + Size uint64 + Offset uint32 + Align uint32 + Reloff uint32 + Nreloc uint32 + Flags uint32 +} + +// A Reloc represents a Mach-O relocation. +type Reloc struct { + Addr uint32 + Value uint32 + // when Scattered == false && Extern == true, Value is the symbol number. + // when Scattered == false && Extern == false, Value is the section number. + // when Scattered == true, Value is the value that this reloc refers to. + Type uint8 + Len uint8 // 0=byte, 1=word, 2=long, 3=quad + Pcrel bool + Extern bool // valid if Scattered == false + Scattered bool +} + +type Section struct { + SectionHeader + Relocs []Reloc + + // Embed ReaderAt for ReadAt method. + // Do not embed SectionReader directly + // to avoid having Read and Seek. + // If a client wants Read and Seek it must use + // Open() to avoid fighting over the seek offset + // with other clients. + io.ReaderAt + sr *io.SectionReader +} + +// Data reads and returns the contents of the Mach-O section. +func (s *Section) Data() ([]byte, error) { + return saferio.ReadDataAt(s.sr, s.Size, 0) +} + +// Open returns a new ReadSeeker reading the Mach-O section. +func (s *Section) Open() io.ReadSeeker { return io.NewSectionReader(s.sr, 0, 1<<63-1) } + +// A Dylib represents a Mach-O load dynamic library command. +type Dylib struct { + LoadBytes + Name string + Time uint32 + CurrentVersion uint32 + CompatVersion uint32 +} + +// A Symtab represents a Mach-O symbol table command. +type Symtab struct { + LoadBytes + SymtabCmd + Syms []Symbol +} + +// A Dysymtab represents a Mach-O dynamic symbol table command. +type Dysymtab struct { + LoadBytes + DysymtabCmd + IndirectSyms []uint32 // indices into Symtab.Syms +} + +// A Rpath represents a Mach-O rpath command. +type Rpath struct { + LoadBytes + Path string +} + +// A Symbol is a Mach-O 32-bit or 64-bit symbol table entry. +type Symbol struct { + Name string + Type uint8 + Sect uint8 + Desc uint16 + Value uint64 +} + +/* + * Mach-O reader + */ + +// FormatError is returned by some operations if the data does +// not have the correct format for an object file. +type FormatError struct { + off int64 + msg string + val any +} + +func (e *FormatError) Error() string { + msg := e.msg + if e.val != nil { + msg += fmt.Sprintf(" '%v'", e.val) + } + msg += fmt.Sprintf(" in record at byte %#x", e.off) + return msg +} + +// Open opens the named file using [os.Open] and prepares it for use as a Mach-O binary. +func Open(name string) (*File, error) { + f, err := os.Open(name) + if err != nil { + return nil, err + } + ff, err := NewFile(f) + if err != nil { + f.Close() + return nil, err + } + ff.closer = f + return ff, nil +} + +// Close closes the [File]. +// If the [File] was created using [NewFile] directly instead of [Open], +// Close has no effect. +func (f *File) Close() error { + var err error + if f.closer != nil { + err = f.closer.Close() + f.closer = nil + } + return err +} + +// NewFile creates a new [File] for accessing a Mach-O binary in an underlying reader. +// The Mach-O binary is expected to start at position 0 in the ReaderAt. +func NewFile(r io.ReaderAt) (*File, error) { + f := new(File) + sr := io.NewSectionReader(r, 0, 1<<63-1) + + // Read and decode Mach magic to determine byte order, size. + // Magic32 and Magic64 differ only in the bottom bit. + var ident [4]byte + if _, err := r.ReadAt(ident[0:], 0); err != nil { + return nil, err + } + be := binary.BigEndian.Uint32(ident[0:]) + le := binary.LittleEndian.Uint32(ident[0:]) + switch Magic32 &^ 1 { + case be &^ 1: + f.ByteOrder = binary.BigEndian + f.Magic = be + case le &^ 1: + f.ByteOrder = binary.LittleEndian + f.Magic = le + default: + return nil, &FormatError{0, "invalid magic number", nil} + } + + // Read entire file header. + if err := binary.Read(sr, f.ByteOrder, &f.FileHeader); err != nil { + return nil, err + } + + // Then load commands. + offset := int64(fileHeaderSize32) + if f.Magic == Magic64 { + offset = fileHeaderSize64 + } + dat, err := saferio.ReadDataAt(r, uint64(f.Cmdsz), offset) + if err != nil { + return nil, err + } + c := saferio.SliceCap[Load](uint64(f.Ncmd)) + if c < 0 { + return nil, &FormatError{offset, "too many load commands", nil} + } + f.Loads = make([]Load, 0, c) + bo := f.ByteOrder + for i := uint32(0); i < f.Ncmd; i++ { + // Each load command begins with uint32 command and length. + if len(dat) < 8 { + return nil, &FormatError{offset, "command block too small", nil} + } + cmd, siz := LoadCmd(bo.Uint32(dat[0:4])), bo.Uint32(dat[4:8]) + if siz < 8 || siz > uint32(len(dat)) { + return nil, &FormatError{offset, "invalid command block size", nil} + } + var cmddat []byte + cmddat, dat = dat[0:siz], dat[siz:] + offset += int64(siz) + var s *Segment + switch cmd { + default: + f.Loads = append(f.Loads, LoadBytes(cmddat)) + + case LoadCmdRpath: + var hdr RpathCmd + b := bytes.NewReader(cmddat) + if err := binary.Read(b, bo, &hdr); err != nil { + return nil, err + } + l := new(Rpath) + if hdr.Path >= uint32(len(cmddat)) { + return nil, &FormatError{offset, "invalid path in rpath command", hdr.Path} + } + l.Path = cstring(cmddat[hdr.Path:]) + l.LoadBytes = LoadBytes(cmddat) + f.Loads = append(f.Loads, l) + + case LoadCmdDylib: + var hdr DylibCmd + b := bytes.NewReader(cmddat) + if err := binary.Read(b, bo, &hdr); err != nil { + return nil, err + } + l := new(Dylib) + if hdr.Name >= uint32(len(cmddat)) { + return nil, &FormatError{offset, "invalid name in dynamic library command", hdr.Name} + } + l.Name = cstring(cmddat[hdr.Name:]) + l.Time = hdr.Time + l.CurrentVersion = hdr.CurrentVersion + l.CompatVersion = hdr.CompatVersion + l.LoadBytes = LoadBytes(cmddat) + f.Loads = append(f.Loads, l) + + case LoadCmdSymtab: + var hdr SymtabCmd + b := bytes.NewReader(cmddat) + if err := binary.Read(b, bo, &hdr); err != nil { + return nil, err + } + strtab, err := saferio.ReadDataAt(r, uint64(hdr.Strsize), int64(hdr.Stroff)) + if err != nil { + return nil, err + } + var symsz int + if f.Magic == Magic64 { + symsz = 16 + } else { + symsz = 12 + } + symdat, err := saferio.ReadDataAt(r, uint64(hdr.Nsyms)*uint64(symsz), int64(hdr.Symoff)) + if err != nil { + return nil, err + } + st, err := f.parseSymtab(symdat, strtab, cmddat, &hdr, offset) + if err != nil { + return nil, err + } + f.Loads = append(f.Loads, st) + f.Symtab = st + + case LoadCmdDysymtab: + var hdr DysymtabCmd + b := bytes.NewReader(cmddat) + if err := binary.Read(b, bo, &hdr); err != nil { + return nil, err + } + if f.Symtab == nil { + return nil, &FormatError{offset, "dynamic symbol table seen before any ordinary symbol table", nil} + } else if hdr.Iundefsym > uint32(len(f.Symtab.Syms)) { + return nil, &FormatError{offset, fmt.Sprintf( + "undefined symbols index in dynamic symbol table command is greater than symbol table length (%d > %d)", + hdr.Iundefsym, len(f.Symtab.Syms)), nil} + } else if hdr.Iundefsym+hdr.Nundefsym > uint32(len(f.Symtab.Syms)) { + return nil, &FormatError{offset, fmt.Sprintf( + "number of undefined symbols after index in dynamic symbol table command is greater than symbol table length (%d > %d)", + hdr.Iundefsym+hdr.Nundefsym, len(f.Symtab.Syms)), nil} + } + dat, err := saferio.ReadDataAt(r, uint64(hdr.Nindirectsyms)*4, int64(hdr.Indirectsymoff)) + if err != nil { + return nil, err + } + x := make([]uint32, hdr.Nindirectsyms) + if err := binary.Read(bytes.NewReader(dat), bo, x); err != nil { + return nil, err + } + st := new(Dysymtab) + st.LoadBytes = LoadBytes(cmddat) + st.DysymtabCmd = hdr + st.IndirectSyms = x + f.Loads = append(f.Loads, st) + f.Dysymtab = st + + case LoadCmdSegment: + var seg32 Segment32 + b := bytes.NewReader(cmddat) + if err := binary.Read(b, bo, &seg32); err != nil { + return nil, err + } + s = new(Segment) + s.LoadBytes = cmddat + s.Cmd = cmd + s.Len = siz + s.Name = cstring(seg32.Name[0:]) + s.Addr = uint64(seg32.Addr) + s.Memsz = uint64(seg32.Memsz) + s.Offset = uint64(seg32.Offset) + s.Filesz = uint64(seg32.Filesz) + s.Maxprot = seg32.Maxprot + s.Prot = seg32.Prot + s.Nsect = seg32.Nsect + s.Flag = seg32.Flag + f.Loads = append(f.Loads, s) + for i := 0; i < int(s.Nsect); i++ { + var sh32 Section32 + if err := binary.Read(b, bo, &sh32); err != nil { + return nil, err + } + sh := new(Section) + sh.Name = cstring(sh32.Name[0:]) + sh.Seg = cstring(sh32.Seg[0:]) + sh.Addr = uint64(sh32.Addr) + sh.Size = uint64(sh32.Size) + sh.Offset = sh32.Offset + sh.Align = sh32.Align + sh.Reloff = sh32.Reloff + sh.Nreloc = sh32.Nreloc + sh.Flags = sh32.Flags + if err := f.pushSection(sh, r); err != nil { + return nil, err + } + } + + case LoadCmdSegment64: + var seg64 Segment64 + b := bytes.NewReader(cmddat) + if err := binary.Read(b, bo, &seg64); err != nil { + return nil, err + } + s = new(Segment) + s.LoadBytes = cmddat + s.Cmd = cmd + s.Len = siz + s.Name = cstring(seg64.Name[0:]) + s.Addr = seg64.Addr + s.Memsz = seg64.Memsz + s.Offset = seg64.Offset + s.Filesz = seg64.Filesz + s.Maxprot = seg64.Maxprot + s.Prot = seg64.Prot + s.Nsect = seg64.Nsect + s.Flag = seg64.Flag + f.Loads = append(f.Loads, s) + for i := 0; i < int(s.Nsect); i++ { + var sh64 Section64 + if err := binary.Read(b, bo, &sh64); err != nil { + return nil, err + } + sh := new(Section) + sh.Name = cstring(sh64.Name[0:]) + sh.Seg = cstring(sh64.Seg[0:]) + sh.Addr = sh64.Addr + sh.Size = sh64.Size + sh.Offset = sh64.Offset + sh.Align = sh64.Align + sh.Reloff = sh64.Reloff + sh.Nreloc = sh64.Nreloc + sh.Flags = sh64.Flags + if err := f.pushSection(sh, r); err != nil { + return nil, err + } + } + } + if s != nil { + if int64(s.Offset) < 0 { + return nil, &FormatError{offset, "invalid section offset", s.Offset} + } + if int64(s.Filesz) < 0 { + return nil, &FormatError{offset, "invalid section file size", s.Filesz} + } + s.sr = io.NewSectionReader(r, int64(s.Offset), int64(s.Filesz)) + s.ReaderAt = s.sr + } + } + return f, nil +} + +func (f *File) parseSymtab(symdat, strtab, cmddat []byte, hdr *SymtabCmd, offset int64) (*Symtab, error) { + bo := f.ByteOrder + c := saferio.SliceCap[Symbol](uint64(hdr.Nsyms)) + if c < 0 { + return nil, &FormatError{offset, "too many symbols", nil} + } + symtab := make([]Symbol, 0, c) + b := bytes.NewReader(symdat) + for i := 0; i < int(hdr.Nsyms); i++ { + var n Nlist64 + if f.Magic == Magic64 { + if err := binary.Read(b, bo, &n); err != nil { + return nil, err + } + } else { + var n32 Nlist32 + if err := binary.Read(b, bo, &n32); err != nil { + return nil, err + } + n.Name = n32.Name + n.Type = n32.Type + n.Sect = n32.Sect + n.Desc = n32.Desc + n.Value = uint64(n32.Value) + } + if n.Name >= uint32(len(strtab)) { + return nil, &FormatError{offset, "invalid name in symbol table", n.Name} + } + // We add "_" to Go symbols. Strip it here. See issue 33808. + name := cstring(strtab[n.Name:]) + if strings.Contains(name, ".") && name[0] == '_' { + name = name[1:] + } + symtab = append(symtab, Symbol{ + Name: name, + Type: n.Type, + Sect: n.Sect, + Desc: n.Desc, + Value: n.Value, + }) + } + st := new(Symtab) + st.LoadBytes = LoadBytes(cmddat) + st.Syms = symtab + return st, nil +} + +type relocInfo struct { + Addr uint32 + Symnum uint32 +} + +func (f *File) pushSection(sh *Section, r io.ReaderAt) error { + f.Sections = append(f.Sections, sh) + sh.sr = io.NewSectionReader(r, int64(sh.Offset), int64(sh.Size)) + sh.ReaderAt = sh.sr + + if sh.Nreloc > 0 { + reldat, err := saferio.ReadDataAt(r, uint64(sh.Nreloc)*8, int64(sh.Reloff)) + if err != nil { + return err + } + b := bytes.NewReader(reldat) + + bo := f.ByteOrder + + sh.Relocs = make([]Reloc, sh.Nreloc) + for i := range sh.Relocs { + rel := &sh.Relocs[i] + + var ri relocInfo + if err := binary.Read(b, bo, &ri); err != nil { + return err + } + + if ri.Addr&(1<<31) != 0 { // scattered + rel.Addr = ri.Addr & (1<<24 - 1) + rel.Type = uint8((ri.Addr >> 24) & (1<<4 - 1)) + rel.Len = uint8((ri.Addr >> 28) & (1<<2 - 1)) + rel.Pcrel = ri.Addr&(1<<30) != 0 + rel.Value = ri.Symnum + rel.Scattered = true + } else { + switch bo { + case binary.LittleEndian: + rel.Addr = ri.Addr + rel.Value = ri.Symnum & (1<<24 - 1) + rel.Pcrel = ri.Symnum&(1<<24) != 0 + rel.Len = uint8((ri.Symnum >> 25) & (1<<2 - 1)) + rel.Extern = ri.Symnum&(1<<27) != 0 + rel.Type = uint8((ri.Symnum >> 28) & (1<<4 - 1)) + case binary.BigEndian: + rel.Addr = ri.Addr + rel.Value = ri.Symnum >> 8 + rel.Pcrel = ri.Symnum&(1<<7) != 0 + rel.Len = uint8((ri.Symnum >> 5) & (1<<2 - 1)) + rel.Extern = ri.Symnum&(1<<4) != 0 + rel.Type = uint8(ri.Symnum & (1<<4 - 1)) + default: + panic("unreachable") + } + } + } + } + + return nil +} + +func cstring(b []byte) string { + i := bytes.IndexByte(b, 0) + if i == -1 { + i = len(b) + } + return string(b[0:i]) +} + +// Segment returns the first Segment with the given name, or nil if no such segment exists. +func (f *File) Segment(name string) *Segment { + for _, l := range f.Loads { + if s, ok := l.(*Segment); ok && s.Name == name { + return s + } + } + return nil +} + +// Section returns the first section with the given name, or nil if no such +// section exists. +func (f *File) Section(name string) *Section { + for _, s := range f.Sections { + if s.Name == name { + return s + } + } + return nil +} + +// DWARF returns the DWARF debug information for the Mach-O file. +func (f *File) DWARF() (*dwarf.Data, error) { + dwarfSuffix := func(s *Section) string { + sectname := s.Name + var pfx int + switch { + case strings.HasPrefix(sectname, "__debug_"): + pfx = 8 + case strings.HasPrefix(sectname, "__zdebug_"): + pfx = 9 + default: + return "" + } + // Mach-O executables truncate section names to 16 characters, mangling some DWARF sections. + // As of DWARFv5 these are the only problematic section names (see DWARFv5 Appendix G). + for _, longname := range []string{ + "__debug_str_offsets", + "__zdebug_line_str", + "__zdebug_loclists", + "__zdebug_pubnames", + "__zdebug_pubtypes", + "__zdebug_rnglists", + "__zdebug_str_offsets", + } { + if sectname == longname[:16] { + sectname = longname + break + } + } + return sectname[pfx:] + } + sectionData := func(s *Section) ([]byte, error) { + b, err := s.Data() + if err != nil && uint64(len(b)) < s.Size { + return nil, err + } + + if len(b) >= 12 && string(b[:4]) == "ZLIB" { + dlen := binary.BigEndian.Uint64(b[4:12]) + dbuf := make([]byte, dlen) + r, err := zlib.NewReader(bytes.NewBuffer(b[12:])) + if err != nil { + return nil, err + } + if _, err := io.ReadFull(r, dbuf); err != nil { + return nil, err + } + if err := r.Close(); err != nil { + return nil, err + } + b = dbuf + } + return b, nil + } + + // There are many other DWARF sections, but these + // are the ones the debug/dwarf package uses. + // Don't bother loading others. + var dat = map[string][]byte{"abbrev": nil, "info": nil, "str": nil, "line": nil, "ranges": nil} + for _, s := range f.Sections { + suffix := dwarfSuffix(s) + if suffix == "" { + continue + } + if _, ok := dat[suffix]; !ok { + continue + } + b, err := sectionData(s) + if err != nil { + return nil, err + } + dat[suffix] = b + } + + d, err := dwarf.New(dat["abbrev"], nil, nil, dat["info"], dat["line"], nil, dat["ranges"], dat["str"]) + if err != nil { + return nil, err + } + + // Look for DWARF4 .debug_types sections and DWARF5 sections. + for i, s := range f.Sections { + suffix := dwarfSuffix(s) + if suffix == "" { + continue + } + if _, ok := dat[suffix]; ok { + // Already handled. + continue + } + + b, err := sectionData(s) + if err != nil { + return nil, err + } + + if suffix == "types" { + err = d.AddTypes(fmt.Sprintf("types-%d", i), b) + } else { + err = d.AddSection(".debug_"+suffix, b) + } + if err != nil { + return nil, err + } + } + + return d, nil +} + +// ImportedSymbols returns the names of all symbols +// referred to by the binary f that are expected to be +// satisfied by other libraries at dynamic load time. +func (f *File) ImportedSymbols() ([]string, error) { + if f.Symtab == nil { + return nil, &FormatError{0, "missing symbol table", nil} + } + + st := f.Symtab + dt := f.Dysymtab + var all []string + if dt != nil { + for _, s := range st.Syms[dt.Iundefsym : dt.Iundefsym+dt.Nundefsym] { + all = append(all, s.Name) + } + } else { + // From Darwin's include/mach-o/nlist.h + const ( + N_TYPE = 0x0e + N_UNDF = 0x0 + N_EXT = 0x01 + ) + for _, s := range st.Syms { + if s.Type&N_TYPE == N_UNDF && s.Type&N_EXT != 0 { + all = append(all, s.Name) + } + } + } + return all, nil +} + +// ImportedLibraries returns the paths of all libraries +// referred to by the binary f that are expected to be +// linked with the binary at dynamic link time. +func (f *File) ImportedLibraries() ([]string, error) { + var all []string + for _, l := range f.Loads { + if lib, ok := l.(*Dylib); ok { + all = append(all, lib.Name) + } + } + return all, nil +} diff --git a/go/src/debug/macho/file_test.go b/go/src/debug/macho/file_test.go new file mode 100644 index 0000000000000000000000000000000000000000..fbcc7bdcb01e96ada08534c4cbf47d837c0f9752 --- /dev/null +++ b/go/src/debug/macho/file_test.go @@ -0,0 +1,453 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package macho + +import ( + "bytes" + "internal/obscuretestdata" + "io" + "reflect" + "slices" + "testing" +) + +type fileTest struct { + file string + hdr FileHeader + loads []any + sections []*SectionHeader + relocations map[string][]Reloc + importedSyms []string +} + +var fileTests = []fileTest{ + { + "testdata/gcc-386-darwin-exec.base64", + FileHeader{0xfeedface, Cpu386, 0x3, 0x2, 0xc, 0x3c0, 0x85}, + []any{ + &SegmentHeader{LoadCmdSegment, 0x38, "__PAGEZERO", 0x0, 0x1000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, + &SegmentHeader{LoadCmdSegment, 0xc0, "__TEXT", 0x1000, 0x1000, 0x0, 0x1000, 0x7, 0x5, 0x2, 0x0}, + &SegmentHeader{LoadCmdSegment, 0xc0, "__DATA", 0x2000, 0x1000, 0x1000, 0x1000, 0x7, 0x3, 0x2, 0x0}, + &SegmentHeader{LoadCmdSegment, 0x7c, "__IMPORT", 0x3000, 0x1000, 0x2000, 0x1000, 0x7, 0x7, 0x1, 0x0}, + &SegmentHeader{LoadCmdSegment, 0x38, "__LINKEDIT", 0x4000, 0x1000, 0x3000, 0x12c, 0x7, 0x1, 0x0, 0x0}, + nil, // LC_SYMTAB + nil, // LC_DYSYMTAB + nil, // LC_LOAD_DYLINKER + nil, // LC_UUID + nil, // LC_UNIXTHREAD + &Dylib{nil, "/usr/lib/libgcc_s.1.dylib", 0x2, 0x10000, 0x10000}, + &Dylib{nil, "/usr/lib/libSystem.B.dylib", 0x2, 0x6f0104, 0x10000}, + }, + []*SectionHeader{ + {"__text", "__TEXT", 0x1f68, 0x88, 0xf68, 0x2, 0x0, 0x0, 0x80000400}, + {"__cstring", "__TEXT", 0x1ff0, 0xd, 0xff0, 0x0, 0x0, 0x0, 0x2}, + {"__data", "__DATA", 0x2000, 0x14, 0x1000, 0x2, 0x0, 0x0, 0x0}, + {"__dyld", "__DATA", 0x2014, 0x1c, 0x1014, 0x2, 0x0, 0x0, 0x0}, + {"__jump_table", "__IMPORT", 0x3000, 0xa, 0x2000, 0x6, 0x0, 0x0, 0x4000008}, + }, + nil, + nil, + }, + { + "testdata/gcc-amd64-darwin-exec.base64", + FileHeader{0xfeedfacf, CpuAmd64, 0x80000003, 0x2, 0xb, 0x568, 0x85}, + []any{ + &SegmentHeader{LoadCmdSegment64, 0x48, "__PAGEZERO", 0x0, 0x100000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, + &SegmentHeader{LoadCmdSegment64, 0x1d8, "__TEXT", 0x100000000, 0x1000, 0x0, 0x1000, 0x7, 0x5, 0x5, 0x0}, + &SegmentHeader{LoadCmdSegment64, 0x138, "__DATA", 0x100001000, 0x1000, 0x1000, 0x1000, 0x7, 0x3, 0x3, 0x0}, + &SegmentHeader{LoadCmdSegment64, 0x48, "__LINKEDIT", 0x100002000, 0x1000, 0x2000, 0x140, 0x7, 0x1, 0x0, 0x0}, + nil, // LC_SYMTAB + nil, // LC_DYSYMTAB + nil, // LC_LOAD_DYLINKER + nil, // LC_UUID + nil, // LC_UNIXTHREAD + &Dylib{nil, "/usr/lib/libgcc_s.1.dylib", 0x2, 0x10000, 0x10000}, + &Dylib{nil, "/usr/lib/libSystem.B.dylib", 0x2, 0x6f0104, 0x10000}, + }, + []*SectionHeader{ + {"__text", "__TEXT", 0x100000f14, 0x6d, 0xf14, 0x2, 0x0, 0x0, 0x80000400}, + {"__symbol_stub1", "__TEXT", 0x100000f81, 0xc, 0xf81, 0x0, 0x0, 0x0, 0x80000408}, + {"__stub_helper", "__TEXT", 0x100000f90, 0x18, 0xf90, 0x2, 0x0, 0x0, 0x0}, + {"__cstring", "__TEXT", 0x100000fa8, 0xd, 0xfa8, 0x0, 0x0, 0x0, 0x2}, + {"__eh_frame", "__TEXT", 0x100000fb8, 0x48, 0xfb8, 0x3, 0x0, 0x0, 0x6000000b}, + {"__data", "__DATA", 0x100001000, 0x1c, 0x1000, 0x3, 0x0, 0x0, 0x0}, + {"__dyld", "__DATA", 0x100001020, 0x38, 0x1020, 0x3, 0x0, 0x0, 0x0}, + {"__la_symbol_ptr", "__DATA", 0x100001058, 0x10, 0x1058, 0x2, 0x0, 0x0, 0x7}, + }, + nil, + nil, + }, + { + "testdata/gcc-amd64-darwin-exec-debug.base64", + FileHeader{0xfeedfacf, CpuAmd64, 0x80000003, 0xa, 0x4, 0x5a0, 0}, + []any{ + nil, // LC_UUID + &SegmentHeader{LoadCmdSegment64, 0x1d8, "__TEXT", 0x100000000, 0x1000, 0x0, 0x0, 0x7, 0x5, 0x5, 0x0}, + &SegmentHeader{LoadCmdSegment64, 0x138, "__DATA", 0x100001000, 0x1000, 0x0, 0x0, 0x7, 0x3, 0x3, 0x0}, + &SegmentHeader{LoadCmdSegment64, 0x278, "__DWARF", 0x100002000, 0x1000, 0x1000, 0x1bc, 0x7, 0x3, 0x7, 0x0}, + }, + []*SectionHeader{ + {"__text", "__TEXT", 0x100000f14, 0x0, 0x0, 0x2, 0x0, 0x0, 0x80000400}, + {"__symbol_stub1", "__TEXT", 0x100000f81, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80000408}, + {"__stub_helper", "__TEXT", 0x100000f90, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0}, + {"__cstring", "__TEXT", 0x100000fa8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2}, + {"__eh_frame", "__TEXT", 0x100000fb8, 0x0, 0x0, 0x3, 0x0, 0x0, 0x6000000b}, + {"__data", "__DATA", 0x100001000, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0}, + {"__dyld", "__DATA", 0x100001020, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0}, + {"__la_symbol_ptr", "__DATA", 0x100001058, 0x0, 0x0, 0x2, 0x0, 0x0, 0x7}, + {"__debug_abbrev", "__DWARF", 0x100002000, 0x36, 0x1000, 0x0, 0x0, 0x0, 0x0}, + {"__debug_aranges", "__DWARF", 0x100002036, 0x30, 0x1036, 0x0, 0x0, 0x0, 0x0}, + {"__debug_frame", "__DWARF", 0x100002066, 0x40, 0x1066, 0x0, 0x0, 0x0, 0x0}, + {"__debug_info", "__DWARF", 0x1000020a6, 0x54, 0x10a6, 0x0, 0x0, 0x0, 0x0}, + {"__debug_line", "__DWARF", 0x1000020fa, 0x47, 0x10fa, 0x0, 0x0, 0x0, 0x0}, + {"__debug_pubnames", "__DWARF", 0x100002141, 0x1b, 0x1141, 0x0, 0x0, 0x0, 0x0}, + {"__debug_str", "__DWARF", 0x10000215c, 0x60, 0x115c, 0x0, 0x0, 0x0, 0x0}, + }, + nil, + nil, + }, + { + "testdata/clang-386-darwin-exec-with-rpath.base64", + FileHeader{0xfeedface, Cpu386, 0x3, 0x2, 0x10, 0x42c, 0x1200085}, + []any{ + nil, // LC_SEGMENT + nil, // LC_SEGMENT + nil, // LC_SEGMENT + nil, // LC_SEGMENT + nil, // LC_DYLD_INFO_ONLY + nil, // LC_SYMTAB + nil, // LC_DYSYMTAB + nil, // LC_LOAD_DYLINKER + nil, // LC_UUID + nil, // LC_VERSION_MIN_MACOSX + nil, // LC_SOURCE_VERSION + nil, // LC_MAIN + nil, // LC_LOAD_DYLIB + &Rpath{nil, "/my/rpath"}, + nil, // LC_FUNCTION_STARTS + nil, // LC_DATA_IN_CODE + }, + nil, + nil, + nil, + }, + { + "testdata/clang-amd64-darwin-exec-with-rpath.base64", + FileHeader{0xfeedfacf, CpuAmd64, 0x80000003, 0x2, 0x10, 0x4c8, 0x200085}, + []any{ + nil, // LC_SEGMENT + nil, // LC_SEGMENT + nil, // LC_SEGMENT + nil, // LC_SEGMENT + nil, // LC_DYLD_INFO_ONLY + nil, // LC_SYMTAB + nil, // LC_DYSYMTAB + nil, // LC_LOAD_DYLINKER + nil, // LC_UUID + nil, // LC_VERSION_MIN_MACOSX + nil, // LC_SOURCE_VERSION + nil, // LC_MAIN + nil, // LC_LOAD_DYLIB + &Rpath{nil, "/my/rpath"}, + nil, // LC_FUNCTION_STARTS + nil, // LC_DATA_IN_CODE + }, + nil, + nil, + nil, + }, + { + "testdata/clang-386-darwin.obj.base64", + FileHeader{0xfeedface, Cpu386, 0x3, 0x1, 0x4, 0x138, 0x2000}, + nil, + nil, + map[string][]Reloc{ + "__text": { + { + Addr: 0x1d, + Type: uint8(GENERIC_RELOC_VANILLA), + Len: 2, + Pcrel: true, + Extern: true, + Value: 1, + Scattered: false, + }, + { + Addr: 0xe, + Type: uint8(GENERIC_RELOC_LOCAL_SECTDIFF), + Len: 2, + Pcrel: false, + Value: 0x2d, + Scattered: true, + }, + { + Addr: 0x0, + Type: uint8(GENERIC_RELOC_PAIR), + Len: 2, + Pcrel: false, + Value: 0xb, + Scattered: true, + }, + }, + }, + nil, + }, + { + "testdata/clang-amd64-darwin.obj.base64", + FileHeader{0xfeedfacf, CpuAmd64, 0x3, 0x1, 0x4, 0x200, 0x2000}, + nil, + nil, + map[string][]Reloc{ + "__text": { + { + Addr: 0x19, + Type: uint8(X86_64_RELOC_BRANCH), + Len: 2, + Pcrel: true, + Extern: true, + Value: 1, + }, + { + Addr: 0xb, + Type: uint8(X86_64_RELOC_SIGNED), + Len: 2, + Pcrel: true, + Extern: false, + Value: 2, + }, + }, + "__compact_unwind": { + { + Addr: 0x0, + Type: uint8(X86_64_RELOC_UNSIGNED), + Len: 3, + Pcrel: false, + Extern: false, + Value: 1, + }, + }, + }, + []string{"_printf"}, + }, + { + "testdata/clang-amd64-darwin-ld-r.obj.base64", + FileHeader{0xfeedfacf, CpuAmd64, 0x3, 0x1, 0x4, 0x1c0, 0x2000}, + nil, + nil, + nil, + []string{"_printf"}, + }, +} + +func readerAtFromObscured(name string) (io.ReaderAt, error) { + b, err := obscuretestdata.ReadFile(name) + if err != nil { + return nil, err + } + return bytes.NewReader(b), nil +} + +func openObscured(name string) (*File, error) { + ra, err := readerAtFromObscured(name) + if err != nil { + return nil, err + } + ff, err := NewFile(ra) + if err != nil { + return nil, err + } + return ff, nil +} + +func openFatObscured(name string) (*FatFile, error) { + ra, err := readerAtFromObscured(name) + if err != nil { + return nil, err + } + ff, err := NewFatFile(ra) + if err != nil { + return nil, err + } + return ff, nil +} + +func TestOpen(t *testing.T) { + for i := range fileTests { + tt := &fileTests[i] + + // Use obscured files to prevent Apple’s notarization service from + // mistaking them as candidates for notarization and rejecting the entire + // toolchain. + // See golang.org/issue/34986 + f, err := openObscured(tt.file) + if err != nil { + t.Error(err) + continue + } + if !reflect.DeepEqual(f.FileHeader, tt.hdr) { + t.Errorf("open %s:\n\thave %#v\n\twant %#v\n", tt.file, f.FileHeader, tt.hdr) + continue + } + for i, l := range f.Loads { + if len(l.Raw()) < 8 { + t.Errorf("open %s, command %d:\n\tload command %T don't have enough data\n", tt.file, i, l) + } + } + if tt.loads != nil { + for i, l := range f.Loads { + if i >= len(tt.loads) { + break + } + + want := tt.loads[i] + if want == nil { + continue + } + + switch l := l.(type) { + case *Segment: + have := &l.SegmentHeader + if !reflect.DeepEqual(have, want) { + t.Errorf("open %s, command %d:\n\thave %#v\n\twant %#v\n", tt.file, i, have, want) + } + case *Dylib: + have := l + have.LoadBytes = nil + if !reflect.DeepEqual(have, want) { + t.Errorf("open %s, command %d:\n\thave %#v\n\twant %#v\n", tt.file, i, have, want) + } + case *Rpath: + have := l + have.LoadBytes = nil + if !reflect.DeepEqual(have, want) { + t.Errorf("open %s, command %d:\n\thave %#v\n\twant %#v\n", tt.file, i, have, want) + } + default: + t.Errorf("open %s, command %d: unknown load command\n\thave %#v\n\twant %#v\n", tt.file, i, l, want) + } + } + tn := len(tt.loads) + fn := len(f.Loads) + if tn != fn { + t.Errorf("open %s: len(Loads) = %d, want %d", tt.file, fn, tn) + } + } + + if tt.sections != nil { + for i, sh := range f.Sections { + if i >= len(tt.sections) { + break + } + have := &sh.SectionHeader + want := tt.sections[i] + if !reflect.DeepEqual(have, want) { + t.Errorf("open %s, section %d:\n\thave %#v\n\twant %#v\n", tt.file, i, have, want) + } + } + tn := len(tt.sections) + fn := len(f.Sections) + if tn != fn { + t.Errorf("open %s: len(Sections) = %d, want %d", tt.file, fn, tn) + } + } + + if tt.relocations != nil { + for i, sh := range f.Sections { + have := sh.Relocs + want := tt.relocations[sh.Name] + if !reflect.DeepEqual(have, want) { + t.Errorf("open %s, relocations in section %d (%s):\n\thave %#v\n\twant %#v\n", tt.file, i, sh.Name, have, want) + } + } + } + + if tt.importedSyms != nil { + ss, err := f.ImportedSymbols() + if err != nil { + t.Errorf("open %s: fail to read imported symbols: %v", tt.file, err) + } + want := tt.importedSyms + if !slices.Equal(ss, want) { + t.Errorf("open %s: imported symbols differ:\n\thave %v\n\twant %v", tt.file, ss, want) + } + } + } +} + +func TestOpenFailure(t *testing.T) { + filename := "file.go" // not a Mach-O file + _, err := Open(filename) // don't crash + if err == nil { + t.Errorf("open %s: succeeded unexpectedly", filename) + } +} + +func TestOpenFat(t *testing.T) { + ff, err := openFatObscured("testdata/fat-gcc-386-amd64-darwin-exec.base64") + if err != nil { + t.Fatal(err) + } + + if ff.Magic != MagicFat { + t.Errorf("OpenFat: got magic number %#x, want %#x", ff.Magic, MagicFat) + } + if len(ff.Arches) != 2 { + t.Errorf("OpenFat: got %d architectures, want 2", len(ff.Arches)) + } + + for i := range ff.Arches { + arch := &ff.Arches[i] + ftArch := &fileTests[i] + + if arch.Cpu != ftArch.hdr.Cpu || arch.SubCpu != ftArch.hdr.SubCpu { + t.Errorf("OpenFat: architecture #%d got cpu=%#x subtype=%#x, expected cpu=%#x, subtype=%#x", i, arch.Cpu, arch.SubCpu, ftArch.hdr.Cpu, ftArch.hdr.SubCpu) + } + + if !reflect.DeepEqual(arch.FileHeader, ftArch.hdr) { + t.Errorf("OpenFat header:\n\tgot %#v\n\twant %#v\n", arch.FileHeader, ftArch.hdr) + } + } +} + +func TestOpenFatFailure(t *testing.T) { + filename := "file.go" // not a Mach-O file + if _, err := OpenFat(filename); err == nil { + t.Errorf("OpenFat %s: succeeded unexpectedly", filename) + } + + filename = "testdata/gcc-386-darwin-exec.base64" // not a fat Mach-O + ff, err := openFatObscured(filename) + if err != ErrNotFat { + t.Errorf("OpenFat %s: got %v, want ErrNotFat", filename, err) + } + if ff != nil { + t.Errorf("OpenFat %s: got %v, want nil", filename, ff) + } +} + +func TestRelocTypeString(t *testing.T) { + if X86_64_RELOC_BRANCH.String() != "X86_64_RELOC_BRANCH" { + t.Errorf("got %v, want %v", X86_64_RELOC_BRANCH.String(), "X86_64_RELOC_BRANCH") + } + if X86_64_RELOC_BRANCH.GoString() != "macho.X86_64_RELOC_BRANCH" { + t.Errorf("got %v, want %v", X86_64_RELOC_BRANCH.GoString(), "macho.X86_64_RELOC_BRANCH") + } +} + +func TestTypeString(t *testing.T) { + if TypeExec.String() != "Exec" { + t.Errorf("got %v, want %v", TypeExec.String(), "Exec") + } + if TypeExec.GoString() != "macho.Exec" { + t.Errorf("got %v, want %v", TypeExec.GoString(), "macho.Exec") + } +} + +func TestOpenBadDysymCmd(t *testing.T) { + _, err := openObscured("testdata/gcc-amd64-darwin-exec-with-bad-dysym.base64") + if err == nil { + t.Fatal("openObscured did not fail when opening a file with an invalid dynamic symbol table command") + } +} diff --git a/go/src/debug/macho/macho.go b/go/src/debug/macho/macho.go new file mode 100644 index 0000000000000000000000000000000000000000..9fa9f9575290bd1a7f8774f9b287696aa316dca7 --- /dev/null +++ b/go/src/debug/macho/macho.go @@ -0,0 +1,341 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Mach-O header data structures +// Originally at: +// http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html (since deleted by Apple) +// Archived copy at: +// https://web.archive.org/web/20090819232456/http://developer.apple.com/documentation/DeveloperTools/Conceptual/MachORuntime/index.html +// For cloned PDF see: +// https://github.com/aidansteele/osx-abi-macho-file-format-reference + +package macho + +import "strconv" + +// A FileHeader represents a Mach-O file header. +type FileHeader struct { + Magic uint32 + Cpu Cpu + SubCpu uint32 + Type Type + Ncmd uint32 + Cmdsz uint32 + Flags uint32 +} + +const ( + fileHeaderSize32 = 7 * 4 + fileHeaderSize64 = 8 * 4 +) + +const ( + Magic32 uint32 = 0xfeedface + Magic64 uint32 = 0xfeedfacf + MagicFat uint32 = 0xcafebabe +) + +// A Type is the Mach-O file type, e.g. an object file, executable, or dynamic library. +type Type uint32 + +const ( + TypeObj Type = 1 + TypeExec Type = 2 + TypeDylib Type = 6 + TypeBundle Type = 8 +) + +var typeStrings = []intName{ + {uint32(TypeObj), "Obj"}, + {uint32(TypeExec), "Exec"}, + {uint32(TypeDylib), "Dylib"}, + {uint32(TypeBundle), "Bundle"}, +} + +func (t Type) String() string { return stringName(uint32(t), typeStrings, false) } +func (t Type) GoString() string { return stringName(uint32(t), typeStrings, true) } + +// A Cpu is a Mach-O cpu type. +type Cpu uint32 + +const cpuArch64 = 0x01000000 + +const ( + Cpu386 Cpu = 7 + CpuAmd64 Cpu = Cpu386 | cpuArch64 + CpuArm Cpu = 12 + CpuArm64 Cpu = CpuArm | cpuArch64 + CpuPpc Cpu = 18 + CpuPpc64 Cpu = CpuPpc | cpuArch64 +) + +var cpuStrings = []intName{ + {uint32(Cpu386), "Cpu386"}, + {uint32(CpuAmd64), "CpuAmd64"}, + {uint32(CpuArm), "CpuArm"}, + {uint32(CpuArm64), "CpuArm64"}, + {uint32(CpuPpc), "CpuPpc"}, + {uint32(CpuPpc64), "CpuPpc64"}, +} + +func (i Cpu) String() string { return stringName(uint32(i), cpuStrings, false) } +func (i Cpu) GoString() string { return stringName(uint32(i), cpuStrings, true) } + +// A LoadCmd is a Mach-O load command. +type LoadCmd uint32 + +const ( + LoadCmdSegment LoadCmd = 0x1 + LoadCmdSymtab LoadCmd = 0x2 + LoadCmdThread LoadCmd = 0x4 + LoadCmdUnixThread LoadCmd = 0x5 // thread+stack + LoadCmdDysymtab LoadCmd = 0xb + LoadCmdDylib LoadCmd = 0xc // load dylib command + LoadCmdDylinker LoadCmd = 0xf // id dylinker command (not load dylinker command) + LoadCmdSegment64 LoadCmd = 0x19 + LoadCmdRpath LoadCmd = 0x8000001c +) + +var cmdStrings = []intName{ + {uint32(LoadCmdSegment), "LoadCmdSegment"}, + {uint32(LoadCmdThread), "LoadCmdThread"}, + {uint32(LoadCmdUnixThread), "LoadCmdUnixThread"}, + {uint32(LoadCmdDylib), "LoadCmdDylib"}, + {uint32(LoadCmdSegment64), "LoadCmdSegment64"}, + {uint32(LoadCmdRpath), "LoadCmdRpath"}, +} + +func (i LoadCmd) String() string { return stringName(uint32(i), cmdStrings, false) } +func (i LoadCmd) GoString() string { return stringName(uint32(i), cmdStrings, true) } + +type ( + // A Segment32 is a 32-bit Mach-O segment load command. + Segment32 struct { + Cmd LoadCmd + Len uint32 + Name [16]byte + Addr uint32 + Memsz uint32 + Offset uint32 + Filesz uint32 + Maxprot uint32 + Prot uint32 + Nsect uint32 + Flag uint32 + } + + // A Segment64 is a 64-bit Mach-O segment load command. + Segment64 struct { + Cmd LoadCmd + Len uint32 + Name [16]byte + Addr uint64 + Memsz uint64 + Offset uint64 + Filesz uint64 + Maxprot uint32 + Prot uint32 + Nsect uint32 + Flag uint32 + } + + // A SymtabCmd is a Mach-O symbol table command. + SymtabCmd struct { + Cmd LoadCmd + Len uint32 + Symoff uint32 + Nsyms uint32 + Stroff uint32 + Strsize uint32 + } + + // A DysymtabCmd is a Mach-O dynamic symbol table command. + DysymtabCmd struct { + Cmd LoadCmd + Len uint32 + Ilocalsym uint32 + Nlocalsym uint32 + Iextdefsym uint32 + Nextdefsym uint32 + Iundefsym uint32 + Nundefsym uint32 + Tocoffset uint32 + Ntoc uint32 + Modtaboff uint32 + Nmodtab uint32 + Extrefsymoff uint32 + Nextrefsyms uint32 + Indirectsymoff uint32 + Nindirectsyms uint32 + Extreloff uint32 + Nextrel uint32 + Locreloff uint32 + Nlocrel uint32 + } + + // A DylibCmd is a Mach-O load dynamic library command. + DylibCmd struct { + Cmd LoadCmd + Len uint32 + Name uint32 + Time uint32 + CurrentVersion uint32 + CompatVersion uint32 + } + + // A RpathCmd is a Mach-O rpath command. + RpathCmd struct { + Cmd LoadCmd + Len uint32 + Path uint32 + } + + // A Thread is a Mach-O thread state command. + Thread struct { + Cmd LoadCmd + Len uint32 + Type uint32 + Data []uint32 + } +) + +const ( + FlagNoUndefs uint32 = 0x1 + FlagIncrLink uint32 = 0x2 + FlagDyldLink uint32 = 0x4 + FlagBindAtLoad uint32 = 0x8 + FlagPrebound uint32 = 0x10 + FlagSplitSegs uint32 = 0x20 + FlagLazyInit uint32 = 0x40 + FlagTwoLevel uint32 = 0x80 + FlagForceFlat uint32 = 0x100 + FlagNoMultiDefs uint32 = 0x200 + FlagNoFixPrebinding uint32 = 0x400 + FlagPrebindable uint32 = 0x800 + FlagAllModsBound uint32 = 0x1000 + FlagSubsectionsViaSymbols uint32 = 0x2000 + FlagCanonical uint32 = 0x4000 + FlagWeakDefines uint32 = 0x8000 + FlagBindsToWeak uint32 = 0x10000 + FlagAllowStackExecution uint32 = 0x20000 + FlagRootSafe uint32 = 0x40000 + FlagSetuidSafe uint32 = 0x80000 + FlagNoReexportedDylibs uint32 = 0x100000 + FlagPIE uint32 = 0x200000 + FlagDeadStrippableDylib uint32 = 0x400000 + FlagHasTLVDescriptors uint32 = 0x800000 + FlagNoHeapExecution uint32 = 0x1000000 + FlagAppExtensionSafe uint32 = 0x2000000 +) + +// A Section32 is a 32-bit Mach-O section header. +type Section32 struct { + Name [16]byte + Seg [16]byte + Addr uint32 + Size uint32 + Offset uint32 + Align uint32 + Reloff uint32 + Nreloc uint32 + Flags uint32 + Reserve1 uint32 + Reserve2 uint32 +} + +// A Section64 is a 64-bit Mach-O section header. +type Section64 struct { + Name [16]byte + Seg [16]byte + Addr uint64 + Size uint64 + Offset uint32 + Align uint32 + Reloff uint32 + Nreloc uint32 + Flags uint32 + Reserve1 uint32 + Reserve2 uint32 + Reserve3 uint32 +} + +// An Nlist32 is a Mach-O 32-bit symbol table entry. +type Nlist32 struct { + Name uint32 + Type uint8 + Sect uint8 + Desc uint16 + Value uint32 +} + +// An Nlist64 is a Mach-O 64-bit symbol table entry. +type Nlist64 struct { + Name uint32 + Type uint8 + Sect uint8 + Desc uint16 + Value uint64 +} + +// Regs386 is the Mach-O 386 register structure. +type Regs386 struct { + AX uint32 + BX uint32 + CX uint32 + DX uint32 + DI uint32 + SI uint32 + BP uint32 + SP uint32 + SS uint32 + FLAGS uint32 + IP uint32 + CS uint32 + DS uint32 + ES uint32 + FS uint32 + GS uint32 +} + +// RegsAMD64 is the Mach-O AMD64 register structure. +type RegsAMD64 struct { + AX uint64 + BX uint64 + CX uint64 + DX uint64 + DI uint64 + SI uint64 + BP uint64 + SP uint64 + R8 uint64 + R9 uint64 + R10 uint64 + R11 uint64 + R12 uint64 + R13 uint64 + R14 uint64 + R15 uint64 + IP uint64 + FLAGS uint64 + CS uint64 + FS uint64 + GS uint64 +} + +type intName struct { + i uint32 + s string +} + +func stringName(i uint32, names []intName, goSyntax bool) string { + for _, n := range names { + if n.i == i { + if goSyntax { + return "macho." + n.s + } + return n.s + } + } + return strconv.FormatUint(uint64(i), 10) +} diff --git a/go/src/debug/macho/reloctype.go b/go/src/debug/macho/reloctype.go new file mode 100644 index 0000000000000000000000000000000000000000..496dfce7ec16c892633cba9e1acea69bdd58c559 --- /dev/null +++ b/go/src/debug/macho/reloctype.go @@ -0,0 +1,72 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package macho + +//go:generate stringer -type=RelocTypeGeneric,RelocTypeX86_64,RelocTypeARM,RelocTypeARM64 -output reloctype_string.go + +type RelocTypeGeneric int + +const ( + GENERIC_RELOC_VANILLA RelocTypeGeneric = 0 + GENERIC_RELOC_PAIR RelocTypeGeneric = 1 + GENERIC_RELOC_SECTDIFF RelocTypeGeneric = 2 + GENERIC_RELOC_PB_LA_PTR RelocTypeGeneric = 3 + GENERIC_RELOC_LOCAL_SECTDIFF RelocTypeGeneric = 4 + GENERIC_RELOC_TLV RelocTypeGeneric = 5 +) + +func (r RelocTypeGeneric) GoString() string { return "macho." + r.String() } + +type RelocTypeX86_64 int + +const ( + X86_64_RELOC_UNSIGNED RelocTypeX86_64 = 0 + X86_64_RELOC_SIGNED RelocTypeX86_64 = 1 + X86_64_RELOC_BRANCH RelocTypeX86_64 = 2 + X86_64_RELOC_GOT_LOAD RelocTypeX86_64 = 3 + X86_64_RELOC_GOT RelocTypeX86_64 = 4 + X86_64_RELOC_SUBTRACTOR RelocTypeX86_64 = 5 + X86_64_RELOC_SIGNED_1 RelocTypeX86_64 = 6 + X86_64_RELOC_SIGNED_2 RelocTypeX86_64 = 7 + X86_64_RELOC_SIGNED_4 RelocTypeX86_64 = 8 + X86_64_RELOC_TLV RelocTypeX86_64 = 9 +) + +func (r RelocTypeX86_64) GoString() string { return "macho." + r.String() } + +type RelocTypeARM int + +const ( + ARM_RELOC_VANILLA RelocTypeARM = 0 + ARM_RELOC_PAIR RelocTypeARM = 1 + ARM_RELOC_SECTDIFF RelocTypeARM = 2 + ARM_RELOC_LOCAL_SECTDIFF RelocTypeARM = 3 + ARM_RELOC_PB_LA_PTR RelocTypeARM = 4 + ARM_RELOC_BR24 RelocTypeARM = 5 + ARM_THUMB_RELOC_BR22 RelocTypeARM = 6 + ARM_THUMB_32BIT_BRANCH RelocTypeARM = 7 + ARM_RELOC_HALF RelocTypeARM = 8 + ARM_RELOC_HALF_SECTDIFF RelocTypeARM = 9 +) + +func (r RelocTypeARM) GoString() string { return "macho." + r.String() } + +type RelocTypeARM64 int + +const ( + ARM64_RELOC_UNSIGNED RelocTypeARM64 = 0 + ARM64_RELOC_SUBTRACTOR RelocTypeARM64 = 1 + ARM64_RELOC_BRANCH26 RelocTypeARM64 = 2 + ARM64_RELOC_PAGE21 RelocTypeARM64 = 3 + ARM64_RELOC_PAGEOFF12 RelocTypeARM64 = 4 + ARM64_RELOC_GOT_LOAD_PAGE21 RelocTypeARM64 = 5 + ARM64_RELOC_GOT_LOAD_PAGEOFF12 RelocTypeARM64 = 6 + ARM64_RELOC_POINTER_TO_GOT RelocTypeARM64 = 7 + ARM64_RELOC_TLVP_LOAD_PAGE21 RelocTypeARM64 = 8 + ARM64_RELOC_TLVP_LOAD_PAGEOFF12 RelocTypeARM64 = 9 + ARM64_RELOC_ADDEND RelocTypeARM64 = 10 +) + +func (r RelocTypeARM64) GoString() string { return "macho." + r.String() } diff --git a/go/src/debug/macho/reloctype_string.go b/go/src/debug/macho/reloctype_string.go new file mode 100644 index 0000000000000000000000000000000000000000..cb31627e7e370b810b1a2a9f736a9a179bfc461a --- /dev/null +++ b/go/src/debug/macho/reloctype_string.go @@ -0,0 +1,107 @@ +// Code generated by "stringer -type=RelocTypeGeneric,RelocTypeX86_64,RelocTypeARM,RelocTypeARM64 -output reloctype_string.go"; DO NOT EDIT. + +package macho + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[GENERIC_RELOC_VANILLA-0] + _ = x[GENERIC_RELOC_PAIR-1] + _ = x[GENERIC_RELOC_SECTDIFF-2] + _ = x[GENERIC_RELOC_PB_LA_PTR-3] + _ = x[GENERIC_RELOC_LOCAL_SECTDIFF-4] + _ = x[GENERIC_RELOC_TLV-5] +} + +const _RelocTypeGeneric_name = "GENERIC_RELOC_VANILLAGENERIC_RELOC_PAIRGENERIC_RELOC_SECTDIFFGENERIC_RELOC_PB_LA_PTRGENERIC_RELOC_LOCAL_SECTDIFFGENERIC_RELOC_TLV" + +var _RelocTypeGeneric_index = [...]uint8{0, 21, 39, 61, 84, 112, 129} + +func (i RelocTypeGeneric) String() string { + if i < 0 || i >= RelocTypeGeneric(len(_RelocTypeGeneric_index)-1) { + return "RelocTypeGeneric(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _RelocTypeGeneric_name[_RelocTypeGeneric_index[i]:_RelocTypeGeneric_index[i+1]] +} +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[X86_64_RELOC_UNSIGNED-0] + _ = x[X86_64_RELOC_SIGNED-1] + _ = x[X86_64_RELOC_BRANCH-2] + _ = x[X86_64_RELOC_GOT_LOAD-3] + _ = x[X86_64_RELOC_GOT-4] + _ = x[X86_64_RELOC_SUBTRACTOR-5] + _ = x[X86_64_RELOC_SIGNED_1-6] + _ = x[X86_64_RELOC_SIGNED_2-7] + _ = x[X86_64_RELOC_SIGNED_4-8] + _ = x[X86_64_RELOC_TLV-9] +} + +const _RelocTypeX86_64_name = "X86_64_RELOC_UNSIGNEDX86_64_RELOC_SIGNEDX86_64_RELOC_BRANCHX86_64_RELOC_GOT_LOADX86_64_RELOC_GOTX86_64_RELOC_SUBTRACTORX86_64_RELOC_SIGNED_1X86_64_RELOC_SIGNED_2X86_64_RELOC_SIGNED_4X86_64_RELOC_TLV" + +var _RelocTypeX86_64_index = [...]uint8{0, 21, 40, 59, 80, 96, 119, 140, 161, 182, 198} + +func (i RelocTypeX86_64) String() string { + if i < 0 || i >= RelocTypeX86_64(len(_RelocTypeX86_64_index)-1) { + return "RelocTypeX86_64(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _RelocTypeX86_64_name[_RelocTypeX86_64_index[i]:_RelocTypeX86_64_index[i+1]] +} +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[ARM_RELOC_VANILLA-0] + _ = x[ARM_RELOC_PAIR-1] + _ = x[ARM_RELOC_SECTDIFF-2] + _ = x[ARM_RELOC_LOCAL_SECTDIFF-3] + _ = x[ARM_RELOC_PB_LA_PTR-4] + _ = x[ARM_RELOC_BR24-5] + _ = x[ARM_THUMB_RELOC_BR22-6] + _ = x[ARM_THUMB_32BIT_BRANCH-7] + _ = x[ARM_RELOC_HALF-8] + _ = x[ARM_RELOC_HALF_SECTDIFF-9] +} + +const _RelocTypeARM_name = "ARM_RELOC_VANILLAARM_RELOC_PAIRARM_RELOC_SECTDIFFARM_RELOC_LOCAL_SECTDIFFARM_RELOC_PB_LA_PTRARM_RELOC_BR24ARM_THUMB_RELOC_BR22ARM_THUMB_32BIT_BRANCHARM_RELOC_HALFARM_RELOC_HALF_SECTDIFF" + +var _RelocTypeARM_index = [...]uint8{0, 17, 31, 49, 73, 92, 106, 126, 148, 162, 185} + +func (i RelocTypeARM) String() string { + if i < 0 || i >= RelocTypeARM(len(_RelocTypeARM_index)-1) { + return "RelocTypeARM(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _RelocTypeARM_name[_RelocTypeARM_index[i]:_RelocTypeARM_index[i+1]] +} +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[ARM64_RELOC_UNSIGNED-0] + _ = x[ARM64_RELOC_SUBTRACTOR-1] + _ = x[ARM64_RELOC_BRANCH26-2] + _ = x[ARM64_RELOC_PAGE21-3] + _ = x[ARM64_RELOC_PAGEOFF12-4] + _ = x[ARM64_RELOC_GOT_LOAD_PAGE21-5] + _ = x[ARM64_RELOC_GOT_LOAD_PAGEOFF12-6] + _ = x[ARM64_RELOC_POINTER_TO_GOT-7] + _ = x[ARM64_RELOC_TLVP_LOAD_PAGE21-8] + _ = x[ARM64_RELOC_TLVP_LOAD_PAGEOFF12-9] + _ = x[ARM64_RELOC_ADDEND-10] +} + +const _RelocTypeARM64_name = "ARM64_RELOC_UNSIGNEDARM64_RELOC_SUBTRACTORARM64_RELOC_BRANCH26ARM64_RELOC_PAGE21ARM64_RELOC_PAGEOFF12ARM64_RELOC_GOT_LOAD_PAGE21ARM64_RELOC_GOT_LOAD_PAGEOFF12ARM64_RELOC_POINTER_TO_GOTARM64_RELOC_TLVP_LOAD_PAGE21ARM64_RELOC_TLVP_LOAD_PAGEOFF12ARM64_RELOC_ADDEND" + +var _RelocTypeARM64_index = [...]uint16{0, 20, 42, 62, 80, 101, 128, 158, 184, 212, 243, 261} + +func (i RelocTypeARM64) String() string { + if i < 0 || i >= RelocTypeARM64(len(_RelocTypeARM64_index)-1) { + return "RelocTypeARM64(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _RelocTypeARM64_name[_RelocTypeARM64_index[i]:_RelocTypeARM64_index[i+1]] +} diff --git a/go/src/debug/macho/testdata/clang-386-darwin-exec-with-rpath.base64 b/go/src/debug/macho/testdata/clang-386-darwin-exec-with-rpath.base64 new file mode 100644 index 0000000000000000000000000000000000000000..64047f1b1e70388d7ca72004303a7ca85bd0af71 --- /dev/null +++ b/go/src/debug/macho/testdata/clang-386-darwin-exec-with-rpath.base64 @@ -0,0 +1 @@ +zvrt/gcAAAADAAAAAgAAABAAAAAsBAAAhQAgAQEAAAA4AAAAX19QQUdFWkVSTwAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARIghREiGQH3ABcAJRAAAAEUBkeWxkX3N0dWJfYmluZGVyAFFyAJAAcggRQF9wcmludGYAkAAAAAABXwAFAAJfbWhfZXhlY3V0ZV9oZWFkZXIAIW1haW4AJQIAAAADAOAeAAAA4B4AAAIAAAAPARAAABAAABYAAAAPAQAAYB8AABwAAAABAAABAAAAACQAAAABAAABAAAAAAIAAAADAAAAAAAAQAIAAAAgAF9fbWhfZXhlY3V0ZV9oZWFkZXIAX21haW4AX3ByaW50ZgBkeWxkX3N0dWJfYmluZGVyAAAAAA== diff --git a/go/src/debug/macho/testdata/clang-386-darwin.obj.base64 b/go/src/debug/macho/testdata/clang-386-darwin.obj.base64 new file mode 100644 index 0000000000000000000000000000000000000000..60a07658c98e4404b9b89b085759cc7d9b7c1975 --- /dev/null +++ b/go/src/debug/macho/testdata/clang-386-darwin.obj.base64 @@ -0,0 +1 @@ +zvrt/gcAAAADAAAAAQAAAAQAAAA4AQAAACAAAAEAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7AAAAVAEAADsAAAAHAAAABwAAAAIAAAAAAAAAX190ZXh0AAAAAAAAAAAAAF9fVEVYVAAAAAAAAAAAAAAAAAAALQAAAFQBAAAEAAAAkAEAAAMAAAAABACAAAAAAAAAAABfX2NzdHJpbmcAAAAAAAAAX19URVhUAAAAAAAAAAAAAC0AAAAOAAAAgQEAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAACQAAAAQAAAAAAwKAAAAAAACAAAAGAAAAKgBAAACAAAAwAEAABAAAAALAAAAUAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFWJ5YPsGOgAAAAAWI2AIgAAAMdF/AAAAACJBCTo3////zHJiUX4iciDxBhdw2hlbGxvLCB3b3JsZAoAAB0AAAABAAANDgAApC0AAAAAAAChCwAAAAEAAAAPAQAAAAAAAAcAAAABAAAAAAAAAABfbWFpbgBfcHJpbnRmAAA= diff --git a/go/src/debug/macho/testdata/clang-amd64-darwin-exec-with-rpath.base64 b/go/src/debug/macho/testdata/clang-amd64-darwin-exec-with-rpath.base64 new file mode 100644 index 0000000000000000000000000000000000000000..26821814cfa7831bc8db2d24418f4e50f46bdddb --- /dev/null +++ b/go/src/debug/macho/testdata/clang-amd64-darwin-exec-with-rpath.base64 @@ -0,0 +1 @@ +z/rt/gcAAAEDAACAAgAAABAAAADIBAAAhQAgAAAAAAAZAAAASAAAAF9fUEFHRVpFUk8AAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZAAAA2AEAAF9fVEVYVAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAcAAAAFAAAABQAAAAAAAABfX3RleHQAAAAAAAAAAAAAX19URVhUAAAAAAAAAAAAAGAPAAABAAAAKgAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARIhBRAAAAABFAZHlsZF9zdHViX2JpbmRlcgBRcgCQAHIQEUBfcHJpbnRmAJAAAAAAAV8ABQACX21oX2V4ZWN1dGVfaGVhZGVyACFtYWluACUCAAAAAwDgHgAAAAAAAADgHgAAAAAAAAIAAAAPARAAAAAAAAEAAAAWAAAADwEAAGAPAAABAAAAHAAAAAEAAAEAAAAAAAAAACQAAAABAAABAAAAAAAAAAACAAAAAwAAAAAAAEACAAAAIABfX21oX2V4ZWN1dGVfaGVhZGVyAF9tYWluAF9wcmludGYAZHlsZF9zdHViX2JpbmRlcgAAAAA= diff --git a/go/src/debug/macho/testdata/clang-amd64-darwin-ld-r.obj.base64 b/go/src/debug/macho/testdata/clang-amd64-darwin-ld-r.obj.base64 new file mode 100644 index 0000000000000000000000000000000000000000..036b5746abe35114a2b1b4ac9ccc9160e7d7be62 --- /dev/null +++ b/go/src/debug/macho/testdata/clang-amd64-darwin-ld-r.obj.base64 @@ -0,0 +1 @@ +z/rt/gcAAAEDAAAAAQAAAAQAAADAAQAAACAAAAAAAAAZAAAAiAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJgAAAAAAAAAAAIAAAAAAACYAAAAAAAAAAcAAAAHAAAABAAAAAAAAABfX3RleHQAAAAAAAAAAAAAX19URVhUAAAAAAAAAAAAAAAAAAAAAAAAKgAAAAAAAAAAAgAABAAAAJgCAAACAAAAAAQAgAAAAAAAAAAAAAAAAF9fY3N0cmluZwAAAAAAAABfX1RFWFQAAAAAAAAAAAAAKgAAAAAAAAAOAAAAAAAAACoCAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAX19laF9mcmFtZQAAAAAAAF9fVEVYVAAAAAAAAAAAAAA4AAAAAAAAAEAAAAAAAAAAOAIAAAMAAACoAgAABAAAAAAAAAAAAAAAAAAAAAAAAABfX2NvbXBhY3RfdW53aW5kX19MRAAAAAAAAAAAAAAAAHgAAAAAAAAAIAAAAAAAAAB4AgAAAwAAAMgCAAABAAAAAAAAAgAAAAAAAAAAAAAAAAIAAAAYAAAA0AIAAAUAAAAgAwAAKAAAACQAAAAQAAAAAAwKAAAAAAApAAAAEAAAANACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABVSInlSIPsEEiNPQAAAADHRfwAAAAAsADoAAAAADHJiUX4ichIg8QQXcNoZWxsbywgd29ybGQKABQAAAAAAAAAAXpSAAF4EAEQDAcIkAEAACQAAAAEAAAA+P////////8qAAAAAAAAAABBDhCGAkMNBgAAAAAAAAAAAAAAAAAAACoAAAAAAAABAAAAAAAAAAAAAAAAAAAAABkAAAAEAAAtCwAAAAAAAB0cAAAAAQAAXBwAAAACAAAMIAAAAAIAAF4gAAAAAwAADgAAAAADAAAOEAAAAB4CAAAqAAAAAAAAABQAAAAOAwAAOAAAAAAAAAAeAAAADgMAAFAAAAAAAAAAAgAAAA8BAAAAAAAAAAAAAAgAAAABAAAAAAAAAAAAAAAgAF9tYWluAF9wcmludGYATEMxAEVIX0ZyYW1lMQBmdW5jLmVoAAAA diff --git a/go/src/debug/macho/testdata/clang-amd64-darwin.obj.base64 b/go/src/debug/macho/testdata/clang-amd64-darwin.obj.base64 new file mode 100644 index 0000000000000000000000000000000000000000..b8f1fce9887dd8b9066960205fd6206c77455892 --- /dev/null +++ b/go/src/debug/macho/testdata/clang-amd64-darwin.obj.base64 @@ -0,0 +1 @@ +z/rt/g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ug/macho/testdata/fat-gcc-386-amd64-darwin-exec.base64 new file mode 100644 index 0000000000000000000000000000000000000000..407d9773c419a1ec70595e6caa6ba03acca2e962 --- /dev/null +++ b/go/src/debug/macho/testdata/fat-gcc-386-amd64-darwin-exec.base64 @@ -0,0 +1 @@ +yv66vgAAAAIAAAAHAAAAAwAAEAAAADEsAAAADAEAAAeAAAADAABQAAAAIUAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAeAQAAUA8AAAEAAAAbAAAAHgEAAGQPAAABAAAALgAAAA8GAAAYEAAAAQAAADYAAAAPBgAAEBAAAAEAAAA+AAAADwYAAAAQAAABAAAASgAAAAMAEAAAAAAAAQAAAF4AAAAPBgAACBAAAAEAAABnAAAADwEAAGoPAAABAAAAbQAAAA8BAAAUDwAAAQAAAHMAAAABAAECAAAAAAAAAAB5AAAAAQABAgAAAAAAAAAACQAAAAoAAAAJAAAACgAAACAAZHlsZF9zdHViX2JpbmRpbmdfaGVscGVyAF9fZHlsZF9mdW5jX2xvb2t1cABfTlhBcmdjAF9OWEFyZ3YAX19fcHJvZ25hbWUAX19taF9leGVjdXRlX2hlYWRlcgBfZW52aXJvbgBfbWFpbgBzdGFydABfZXhpdABfcHV0cwAA diff --git a/go/src/debug/macho/testdata/gcc-386-darwin-exec.base64 b/go/src/debug/macho/testdata/gcc-386-darwin-exec.base64 new file mode 100644 index 0000000000000000000000000000000000000000..5e40ed6f0d7192ea8e4b8731aaa696bc1b78e5cb --- /dev/null +++ b/go/src/debug/macho/testdata/gcc-386-darwin-exec.base64 @@ -0,0 +1 @@ +zvrt/gcAAAADAAAAAgAAAAwAAADAAwAAhQAAAAEAAAA4AAAAX19QQUdFWkVSTwAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAMAAAABfX1RFWFQAAAAAAAAAAAAAABAAAAAQAAAAAAAAABAAAAc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fX2R5bGRfZnVuY19sb29rdXAAZHlsZF9fbWFjaF9oZWFkZXIAX05YQXJnYwBfTlhBcmd2AF9fX3Byb2duYW1lAF9fbWhfZXhlY3V0ZV9oZWFkZXIAX2Vudmlyb24AX21haW4Ac3RhcnQAX2V4aXQAX3B1dHMAAAAA diff --git a/go/src/debug/macho/testdata/gcc-amd64-darwin-exec-debug.base64 b/go/src/debug/macho/testdata/gcc-amd64-darwin-exec-debug.base64 new file mode 100644 index 0000000000000000000000000000000000000000..8884566a185f1531d34e5a80a1010df574808780 --- /dev/null +++ b/go/src/debug/macho/testdata/gcc-amd64-darwin-exec-debug.base64 @@ -0,0 +1 @@ +z/rt/gcAAAEDAACACgAAAAQAAACgBQAAAAAAAAAAAAAbAAAAGAAAACIO+tkFWYMH+V6fhzclOW8ZAAAA2AEAAF9fVEVYVAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAFAAAABQAAAAAAAABfX3RleHQAAAAAAAAAAAAAX19URVhUAAAAAAAAAAAAABQPAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAQAgAAAAAAAAAAAAAAAAF9fc3ltYm9sX3N0dWIxAABfX1RFWFQAAAAAAAAAAAAAgQ8AAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIBACAAAAAAAYAAAAAAAAAX19zdHViX2hlbHBlcgAAAF9fVEVYVAAAAAAAAAAAAACQDwAAAQAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABfX2NzdHJpbmcAAAAAAAAAX19URVhUAAAAAAAAAAAAAKgPAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAF9fZWhfZnJhbWUAAAAAAABfX1RFWFQAAAAAAAAAAAAAuA8AAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAALAABgAAAAAAAAAAAAAAAA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AAAACAAAAAABUAAAANAAAAG1haW4AAAAAAABHTlUgQyA0LjAuMSAoQXBwbGUgSW5jLiBidWlsZCA1NDg0KQBoZWxsby5jAC9ob21lL3JzYy9nby9zcmMvcGtnL2RlYnVnL21hY2hvL3Rlc3RkYXRhAGludABtYWluAA== diff --git a/go/src/debug/macho/testdata/gcc-amd64-darwin-exec-with-bad-dysym.base64 b/go/src/debug/macho/testdata/gcc-amd64-darwin-exec-with-bad-dysym.base64 new file mode 100644 index 0000000000000000000000000000000000000000..8e0436639c1096901776c28c755f81cf39233810 --- /dev/null +++ b/go/src/debug/macho/testdata/gcc-amd64-darwin-exec-with-bad-dysym.base64 @@ -0,0 +1 @@ +z/rt/gcAAAEDAACAAgAAAAsAAABoBQAAhQAAAAAAAAAZAAAASAAAAF9fUEFHRVpFUk8AAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZAAAA2AEAAF9fVEVYVAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAcAAAAFAAAABQAAAAAAAABfX3RleHQAAAAAAAAAAAAAX19URVhUAAAAAAAAAAAAABQPAAABAAAAbQAAAAAAAAAUDwAAAgAAAAAAAAAAAAAAAAQAgAAAAAAAAAAAAAAAAF9fc3ltYm9sX3N0dWIxAABfX1RFWFQAAAAAAAAAAAAAgQ8AAAEAAAAMAAAAAAAAAIEPAAAAAAAAAAAAAAAAAAAIBACAAAAAAAYAAAAAAAAAX19zdHViX2hlbHBlcgAAAF9fVEVYVAAAAAAAAAAAAACQDwAAAQAAABgAAAAAAAAAkA8AAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABfX2NzdHJpbmcAAAAAAAAAX19URVhUAAAAAAAAAAAAAKgPAAABAAAADQAAAAAAAACoDwAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAF9fZWhfZnJhbWUAAAAAAABfX1RFWFQ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AA8GAAAAEAAAAQAAAEoAAAADABAAAAAAAAEAAABeAAAADwYAAAgQAAABAAAAZwAAAA8BAABqDwAAAQAAAG0AAAAPAQAAFA8AAAEAAABzAAAAAQABAgAAAAAAAAAAeQAAAAEAAQIAAAAAAAAAAAkAAAAKAAAACQAAAAoAAAAgAGR5bGRfc3R1Yl9iaW5kaW5nX2hlbHBlcgBfX2R5bGRfZnVuY19sb29rdXAAX05YQXJnYwBfTlhBcmd2AF9fX3Byb2duYW1lAF9fbWhfZXhlY3V0ZV9oZWFkZXIAX2Vudmlyb24AX21haW4Ac3RhcnQAX2V4aXQAX3B1dHMAAA== \ No newline at end of file diff --git a/go/src/debug/macho/testdata/gcc-amd64-darwin-exec.base64 b/go/src/debug/macho/testdata/gcc-amd64-darwin-exec.base64 new file mode 100644 index 0000000000000000000000000000000000000000..b48ae5657e19ad84d50ed4aab6a16350daf4c0f3 --- /dev/null +++ b/go/src/debug/macho/testdata/gcc-amd64-darwin-exec.base64 @@ -0,0 +1 @@ +z/rt/gcAAAEDAACAAgAAAAsAAABoBQAAhQAAAAAAAAAZAAAASAAAAF9fUEFHRVpFUk8AAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZAAAA2AEAAF9fVEVYVAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAcAAAAFAAAABQAAAAAAAABfX3RleHQAAAAAAAAAAAAAX19URVhUAAAAAAAAAAAAABQPAAABAAAAbQAAAAAAAAAUDwAAAgAAAAAAAAAAAAAAAAQAgAAAAAAAAAAAAAAAAF9fc3ltYm9sX3N0dWIxAABfX1RFWFQAAAAAAAAAAAAAgQ8AAAEAAAAMAAAAAAAAAIEPAAAAAAAAAAAAAAAAAAAIBACAAAAAAAYAAAAAAAAAX19zdHViX2hlbHBlcgAAAF9fVEVYVAAAAAAAAAAAAACQDwAAAQAAABgAAAAAAAAAkA8AAAI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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAHgEAAFAPAAABAAAAGwAAAB4BAABkDwAAAQAAAC4AAAAPBgAAGBAAAAEAAAA2AAAADwYAABAQAAABAAAAPgAAAA8GAAAAEAAAAQAAAEoAAAADABAAAAAAAAEAAABeAAAADwYAAAgQAAABAAAAZwAAAA8BAABqDwAAAQAAAG0AAAAPAQAAFA8AAAEAAABzAAAAAQABAgAAAAAAAAAAeQAAAAEAAQIAAAAAAAAAAAkAAAAKAAAACQAAAAoAAAAgAGR5bGRfc3R1Yl9iaW5kaW5nX2hlbHBlcgBfX2R5bGRfZnVuY19sb29rdXAAX05YQXJnYwBfTlhBcmd2AF9fX3Byb2duYW1lAF9fbWhfZXhlY3V0ZV9oZWFkZXIAX2Vudmlyb24AX21haW4Ac3RhcnQAX2V4aXQAX3B1dHMAAA== diff --git a/go/src/debug/macho/testdata/hello.c b/go/src/debug/macho/testdata/hello.c new file mode 100644 index 0000000000000000000000000000000000000000..a689d3644e1e95d9d9cb1f013be6430d90dab71c --- /dev/null +++ b/go/src/debug/macho/testdata/hello.c @@ -0,0 +1,8 @@ +#include + +int +main(void) +{ + printf("hello, world\n"); + return 0; +} diff --git a/go/src/debug/pe/file.go b/go/src/debug/pe/file.go new file mode 100644 index 0000000000000000000000000000000000000000..91b7d1dca1ba015150b683134c3777788ce652fa --- /dev/null +++ b/go/src/debug/pe/file.go @@ -0,0 +1,640 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/* +Package pe implements access to PE (Microsoft Windows Portable Executable) files. + +# Security + +This package is not designed to be hardened against adversarial inputs, and is +outside the scope of https://go.dev/security/policy. In particular, only basic +validation is done when parsing object files. As such, care should be taken when +parsing untrusted inputs, as parsing malformed files may consume significant +resources, or cause panics. +*/ +package pe + +import ( + "bytes" + "compress/zlib" + "debug/dwarf" + "encoding/binary" + "errors" + "fmt" + "io" + "os" + "strings" +) + +// A File represents an open PE file. +type File struct { + FileHeader + OptionalHeader any // of type *OptionalHeader32 or *OptionalHeader64 + Sections []*Section + Symbols []*Symbol // COFF symbols with auxiliary symbol records removed + COFFSymbols []COFFSymbol // all COFF symbols (including auxiliary symbol records) + StringTable StringTable + + closer io.Closer +} + +// Open opens the named file using [os.Open] and prepares it for use as a PE binary. +func Open(name string) (*File, error) { + f, err := os.Open(name) + if err != nil { + return nil, err + } + ff, err := NewFile(f) + if err != nil { + f.Close() + return nil, err + } + ff.closer = f + return ff, nil +} + +// Close closes the [File]. +// If the [File] was created using [NewFile] directly instead of [Open], +// Close has no effect. +func (f *File) Close() error { + var err error + if f.closer != nil { + err = f.closer.Close() + f.closer = nil + } + return err +} + +// TODO(brainman): add Load function, as a replacement for NewFile, that does not call removeAuxSymbols (for performance) + +// NewFile creates a new [File] for accessing a PE binary in an underlying reader. +func NewFile(r io.ReaderAt) (*File, error) { + f := new(File) + sr := io.NewSectionReader(r, 0, 1<<63-1) + + var dosheader [96]byte + if _, err := r.ReadAt(dosheader[0:], 0); err != nil { + return nil, err + } + var base int64 + if dosheader[0] == 'M' && dosheader[1] == 'Z' { + signoff := int64(binary.LittleEndian.Uint32(dosheader[0x3c:])) + var sign [4]byte + r.ReadAt(sign[:], signoff) + if !(sign[0] == 'P' && sign[1] == 'E' && sign[2] == 0 && sign[3] == 0) { + return nil, fmt.Errorf("invalid PE file signature: % x", sign) + } + base = signoff + 4 + } else { + base = int64(0) + } + sr.Seek(base, io.SeekStart) + if err := binary.Read(sr, binary.LittleEndian, &f.FileHeader); err != nil { + return nil, err + } + switch f.FileHeader.Machine { + case IMAGE_FILE_MACHINE_AMD64, + IMAGE_FILE_MACHINE_ARM64, + IMAGE_FILE_MACHINE_ARMNT, + IMAGE_FILE_MACHINE_I386, + IMAGE_FILE_MACHINE_RISCV32, + IMAGE_FILE_MACHINE_RISCV64, + IMAGE_FILE_MACHINE_RISCV128, + IMAGE_FILE_MACHINE_UNKNOWN: + // ok + default: + return nil, fmt.Errorf("unrecognized PE machine: %#x", f.FileHeader.Machine) + } + + var err error + + // Read string table. + f.StringTable, err = readStringTable(&f.FileHeader, sr) + if err != nil { + return nil, err + } + + // Read symbol table. + f.COFFSymbols, err = readCOFFSymbols(&f.FileHeader, sr) + if err != nil { + return nil, err + } + f.Symbols, err = removeAuxSymbols(f.COFFSymbols, f.StringTable) + if err != nil { + return nil, err + } + + // Seek past file header. + _, err = sr.Seek(base+int64(binary.Size(f.FileHeader)), io.SeekStart) + if err != nil { + return nil, err + } + + // Read optional header. + f.OptionalHeader, err = readOptionalHeader(sr, f.FileHeader.SizeOfOptionalHeader) + if err != nil { + return nil, err + } + + // Process sections. + f.Sections = make([]*Section, f.FileHeader.NumberOfSections) + for i := 0; i < int(f.FileHeader.NumberOfSections); i++ { + sh := new(SectionHeader32) + if err := binary.Read(sr, binary.LittleEndian, sh); err != nil { + return nil, err + } + name, err := sh.fullName(f.StringTable) + if err != nil { + return nil, err + } + s := new(Section) + s.SectionHeader = SectionHeader{ + Name: name, + VirtualSize: sh.VirtualSize, + VirtualAddress: sh.VirtualAddress, + Size: sh.SizeOfRawData, + Offset: sh.PointerToRawData, + PointerToRelocations: sh.PointerToRelocations, + PointerToLineNumbers: sh.PointerToLineNumbers, + NumberOfRelocations: sh.NumberOfRelocations, + NumberOfLineNumbers: sh.NumberOfLineNumbers, + Characteristics: sh.Characteristics, + } + r2 := r + if sh.PointerToRawData == 0 { // .bss must have all 0s + r2 = &nobitsSectionReader{} + } + s.sr = io.NewSectionReader(r2, int64(s.SectionHeader.Offset), int64(s.SectionHeader.Size)) + s.ReaderAt = s.sr + f.Sections[i] = s + } + for i := range f.Sections { + var err error + f.Sections[i].Relocs, err = readRelocs(&f.Sections[i].SectionHeader, sr) + if err != nil { + return nil, err + } + } + + return f, nil +} + +type nobitsSectionReader struct{} + +func (*nobitsSectionReader) ReadAt(p []byte, off int64) (n int, err error) { + return 0, errors.New("unexpected read from section with uninitialized data") +} + +// getString extracts a string from symbol string table. +func getString(section []byte, start int) (string, bool) { + if start < 0 || start >= len(section) { + return "", false + } + + for end := start; end < len(section); end++ { + if section[end] == 0 { + return string(section[start:end]), true + } + } + return "", false +} + +// Section returns the first section with the given name, or nil if no such +// section exists. +func (f *File) Section(name string) *Section { + for _, s := range f.Sections { + if s.Name == name { + return s + } + } + return nil +} + +func (f *File) DWARF() (*dwarf.Data, error) { + dwarfSuffix := func(s *Section) string { + switch { + case strings.HasPrefix(s.Name, ".debug_"): + return s.Name[7:] + case strings.HasPrefix(s.Name, ".zdebug_"): + return s.Name[8:] + default: + return "" + } + + } + + // sectionData gets the data for s and checks its size. + sectionData := func(s *Section) ([]byte, error) { + b, err := s.Data() + if err != nil && uint32(len(b)) < s.Size { + return nil, err + } + + if 0 < s.VirtualSize && s.VirtualSize < s.Size { + b = b[:s.VirtualSize] + } + + if len(b) >= 12 && string(b[:4]) == "ZLIB" { + dlen := binary.BigEndian.Uint64(b[4:12]) + dbuf := make([]byte, dlen) + r, err := zlib.NewReader(bytes.NewBuffer(b[12:])) + if err != nil { + return nil, err + } + if _, err := io.ReadFull(r, dbuf); err != nil { + return nil, err + } + if err := r.Close(); err != nil { + return nil, err + } + b = dbuf + } + return b, nil + } + + // There are many other DWARF sections, but these + // are the ones the debug/dwarf package uses. + // Don't bother loading others. + var dat = map[string][]byte{"abbrev": nil, "info": nil, "str": nil, "line": nil, "ranges": nil} + for _, s := range f.Sections { + suffix := dwarfSuffix(s) + if suffix == "" { + continue + } + if _, ok := dat[suffix]; !ok { + continue + } + + b, err := sectionData(s) + if err != nil { + return nil, err + } + dat[suffix] = b + } + + d, err := dwarf.New(dat["abbrev"], nil, nil, dat["info"], dat["line"], nil, dat["ranges"], dat["str"]) + if err != nil { + return nil, err + } + + // Look for DWARF4 .debug_types sections and DWARF5 sections. + for i, s := range f.Sections { + suffix := dwarfSuffix(s) + if suffix == "" { + continue + } + if _, ok := dat[suffix]; ok { + // Already handled. + continue + } + + b, err := sectionData(s) + if err != nil { + return nil, err + } + + if suffix == "types" { + err = d.AddTypes(fmt.Sprintf("types-%d", i), b) + } else { + err = d.AddSection(".debug_"+suffix, b) + } + if err != nil { + return nil, err + } + } + + return d, nil +} + +// TODO(brainman): document ImportDirectory once we decide what to do with it. + +type ImportDirectory struct { + OriginalFirstThunk uint32 + TimeDateStamp uint32 + ForwarderChain uint32 + Name uint32 + FirstThunk uint32 + + dll string +} + +// ImportedSymbols returns the names of all symbols +// referred to by the binary f that are expected to be +// satisfied by other libraries at dynamic load time. +// It does not return weak symbols. +func (f *File) ImportedSymbols() ([]string, error) { + if f.OptionalHeader == nil { + return nil, nil + } + + _, pe64 := f.OptionalHeader.(*OptionalHeader64) + + // grab the number of data directory entries + var dd_length uint32 + if pe64 { + dd_length = f.OptionalHeader.(*OptionalHeader64).NumberOfRvaAndSizes + } else { + dd_length = f.OptionalHeader.(*OptionalHeader32).NumberOfRvaAndSizes + } + + // check that the length of data directory entries is large + // enough to include the imports directory. + if dd_length < IMAGE_DIRECTORY_ENTRY_IMPORT+1 { + return nil, nil + } + + // grab the import data directory entry + var idd DataDirectory + if pe64 { + idd = f.OptionalHeader.(*OptionalHeader64).DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT] + } else { + idd = f.OptionalHeader.(*OptionalHeader32).DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT] + } + + // figure out which section contains the import directory table + var ds *Section + ds = nil + for _, s := range f.Sections { + if s.Offset == 0 { + continue + } + // We are using distance between s.VirtualAddress and idd.VirtualAddress + // to avoid potential overflow of uint32 caused by addition of s.VirtualSize + // to s.VirtualAddress. + if s.VirtualAddress <= idd.VirtualAddress && idd.VirtualAddress-s.VirtualAddress < s.VirtualSize { + ds = s + break + } + } + + // didn't find a section, so no import libraries were found + if ds == nil { + return nil, nil + } + + d, err := ds.Data() + if err != nil { + return nil, err + } + + // seek to the virtual address specified in the import data directory + seek := idd.VirtualAddress - ds.VirtualAddress + if seek >= uint32(len(d)) { + return nil, errors.New("optional header data directory virtual size doesn't fit within data seek") + } + d = d[seek:] + + // start decoding the import directory + var ida []ImportDirectory + for len(d) >= 20 { + var dt ImportDirectory + dt.OriginalFirstThunk = binary.LittleEndian.Uint32(d[0:4]) + dt.TimeDateStamp = binary.LittleEndian.Uint32(d[4:8]) + dt.ForwarderChain = binary.LittleEndian.Uint32(d[8:12]) + dt.Name = binary.LittleEndian.Uint32(d[12:16]) + dt.FirstThunk = binary.LittleEndian.Uint32(d[16:20]) + d = d[20:] + if dt.OriginalFirstThunk == 0 { + break + } + ida = append(ida, dt) + } + // TODO(brainman): this needs to be rewritten + // ds.Data() returns contents of section containing import table. Why store in variable called "names"? + // Why we are retrieving it second time? We already have it in "d", and it is not modified anywhere. + // getString does not extracts a string from symbol string table (as getString doco says). + // Why ds.Data() called again and again in the loop? + // Needs test before rewrite. + names, _ := ds.Data() + var all []string + for _, dt := range ida { + dt.dll, _ = getString(names, int(dt.Name-ds.VirtualAddress)) + d, _ = ds.Data() + // seek to OriginalFirstThunk + seek := dt.OriginalFirstThunk - ds.VirtualAddress + if seek >= uint32(len(d)) { + return nil, errors.New("import directory original first thunk doesn't fit within data seek") + } + d = d[seek:] + for len(d) > 0 { + if pe64 { // 64bit + if len(d) < 8 { + return nil, errors.New("thunk parsing needs at least 8-bytes") + } + va := binary.LittleEndian.Uint64(d[0:8]) + d = d[8:] + if va == 0 { + break + } + if va&0x8000000000000000 > 0 { // is Ordinal + // TODO add dynimport ordinal support. + } else { + fn, _ := getString(names, int(uint32(va)-ds.VirtualAddress+2)) + all = append(all, fn+":"+dt.dll) + } + } else { // 32bit + if len(d) <= 4 { + return nil, errors.New("thunk parsing needs at least 5-bytes") + } + va := binary.LittleEndian.Uint32(d[0:4]) + d = d[4:] + if va == 0 { + break + } + if va&0x80000000 > 0 { // is Ordinal + // TODO add dynimport ordinal support. + //ord := va&0x0000FFFF + } else { + fn, _ := getString(names, int(va-ds.VirtualAddress+2)) + all = append(all, fn+":"+dt.dll) + } + } + } + } + + return all, nil +} + +// ImportedLibraries returns the names of all libraries +// referred to by the binary f that are expected to be +// linked with the binary at dynamic link time. +func (f *File) ImportedLibraries() ([]string, error) { + // TODO + // cgo -dynimport don't use this for windows PE, so just return. + return nil, nil +} + +// FormatError is unused. +// The type is retained for compatibility. +type FormatError struct { +} + +func (e *FormatError) Error() string { + return "unknown error" +} + +// readOptionalHeader accepts an io.ReadSeeker pointing to optional header in the PE file +// and its size as seen in the file header. +// It parses the given size of bytes and returns optional header. It infers whether the +// bytes being parsed refer to 32 bit or 64 bit version of optional header. +func readOptionalHeader(r io.ReadSeeker, sz uint16) (any, error) { + // If optional header size is 0, return empty optional header. + if sz == 0 { + return nil, nil + } + + var ( + // First couple of bytes in option header state its type. + // We need to read them first to determine the type and + // validity of optional header. + ohMagic uint16 + ohMagicSz = binary.Size(ohMagic) + ) + + // If optional header size is greater than 0 but less than its magic size, return error. + if sz < uint16(ohMagicSz) { + return nil, fmt.Errorf("optional header size is less than optional header magic size") + } + + // read reads from io.ReadSeeke, r, into data. + var err error + read := func(data any) bool { + err = binary.Read(r, binary.LittleEndian, data) + return err == nil + } + + if !read(&ohMagic) { + return nil, fmt.Errorf("failure to read optional header magic: %v", err) + + } + + switch ohMagic { + case 0x10b: // PE32 + var ( + oh32 OptionalHeader32 + // There can be 0 or more data directories. So the minimum size of optional + // header is calculated by subtracting oh32.DataDirectory size from oh32 size. + oh32MinSz = binary.Size(oh32) - binary.Size(oh32.DataDirectory) + ) + + if sz < uint16(oh32MinSz) { + return nil, fmt.Errorf("optional header size(%d) is less minimum size (%d) of PE32 optional header", sz, oh32MinSz) + } + + // Init oh32 fields + oh32.Magic = ohMagic + if !read(&oh32.MajorLinkerVersion) || + !read(&oh32.MinorLinkerVersion) || + !read(&oh32.SizeOfCode) || + !read(&oh32.SizeOfInitializedData) || + !read(&oh32.SizeOfUninitializedData) || + !read(&oh32.AddressOfEntryPoint) || + !read(&oh32.BaseOfCode) || + !read(&oh32.BaseOfData) || + !read(&oh32.ImageBase) || + !read(&oh32.SectionAlignment) || + !read(&oh32.FileAlignment) || + !read(&oh32.MajorOperatingSystemVersion) || + !read(&oh32.MinorOperatingSystemVersion) || + !read(&oh32.MajorImageVersion) || + !read(&oh32.MinorImageVersion) || + !read(&oh32.MajorSubsystemVersion) || + !read(&oh32.MinorSubsystemVersion) || + !read(&oh32.Win32VersionValue) || + !read(&oh32.SizeOfImage) || + !read(&oh32.SizeOfHeaders) || + !read(&oh32.CheckSum) || + !read(&oh32.Subsystem) || + !read(&oh32.DllCharacteristics) || + !read(&oh32.SizeOfStackReserve) || + !read(&oh32.SizeOfStackCommit) || + !read(&oh32.SizeOfHeapReserve) || + !read(&oh32.SizeOfHeapCommit) || + !read(&oh32.LoaderFlags) || + !read(&oh32.NumberOfRvaAndSizes) { + return nil, fmt.Errorf("failure to read PE32 optional header: %v", err) + } + + dd, err := readDataDirectories(r, sz-uint16(oh32MinSz), oh32.NumberOfRvaAndSizes) + if err != nil { + return nil, err + } + + copy(oh32.DataDirectory[:], dd) + + return &oh32, nil + case 0x20b: // PE32+ + var ( + oh64 OptionalHeader64 + // There can be 0 or more data directories. So the minimum size of optional + // header is calculated by subtracting oh64.DataDirectory size from oh64 size. + oh64MinSz = binary.Size(oh64) - binary.Size(oh64.DataDirectory) + ) + + if sz < uint16(oh64MinSz) { + return nil, fmt.Errorf("optional header size(%d) is less minimum size (%d) for PE32+ optional header", sz, oh64MinSz) + } + + // Init oh64 fields + oh64.Magic = ohMagic + if !read(&oh64.MajorLinkerVersion) || + !read(&oh64.MinorLinkerVersion) || + !read(&oh64.SizeOfCode) || + !read(&oh64.SizeOfInitializedData) || + !read(&oh64.SizeOfUninitializedData) || + !read(&oh64.AddressOfEntryPoint) || + !read(&oh64.BaseOfCode) || + !read(&oh64.ImageBase) || + !read(&oh64.SectionAlignment) || + !read(&oh64.FileAlignment) || + !read(&oh64.MajorOperatingSystemVersion) || + !read(&oh64.MinorOperatingSystemVersion) || + !read(&oh64.MajorImageVersion) || + !read(&oh64.MinorImageVersion) || + !read(&oh64.MajorSubsystemVersion) || + !read(&oh64.MinorSubsystemVersion) || + !read(&oh64.Win32VersionValue) || + !read(&oh64.SizeOfImage) || + !read(&oh64.SizeOfHeaders) || + !read(&oh64.CheckSum) || + !read(&oh64.Subsystem) || + !read(&oh64.DllCharacteristics) || + !read(&oh64.SizeOfStackReserve) || + !read(&oh64.SizeOfStackCommit) || + !read(&oh64.SizeOfHeapReserve) || + !read(&oh64.SizeOfHeapCommit) || + !read(&oh64.LoaderFlags) || + !read(&oh64.NumberOfRvaAndSizes) { + return nil, fmt.Errorf("failure to read PE32+ optional header: %v", err) + } + + dd, err := readDataDirectories(r, sz-uint16(oh64MinSz), oh64.NumberOfRvaAndSizes) + if err != nil { + return nil, err + } + + copy(oh64.DataDirectory[:], dd) + + return &oh64, nil + default: + return nil, fmt.Errorf("optional header has unexpected Magic of 0x%x", ohMagic) + } +} + +// readDataDirectories accepts an io.ReadSeeker pointing to data directories in the PE file, +// its size and number of data directories as seen in optional header. +// It parses the given size of bytes and returns given number of data directories. +func readDataDirectories(r io.ReadSeeker, sz uint16, n uint32) ([]DataDirectory, error) { + ddSz := uint64(binary.Size(DataDirectory{})) + if uint64(sz) != uint64(n)*ddSz { + return nil, fmt.Errorf("size of data directories(%d) is inconsistent with number of data directories(%d)", sz, n) + } + + dd := make([]DataDirectory, n) + if err := binary.Read(r, binary.LittleEndian, dd); err != nil { + return nil, fmt.Errorf("failure to read data directories: %v", err) + } + + return dd, nil +} diff --git a/go/src/debug/pe/file_cgo_test.go b/go/src/debug/pe/file_cgo_test.go new file mode 100644 index 0000000000000000000000000000000000000000..9280de1a4977c5d6f089c654e9d5ebf49a1d68e8 --- /dev/null +++ b/go/src/debug/pe/file_cgo_test.go @@ -0,0 +1,35 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build cgo + +package pe + +import ( + "os/exec" + "runtime" + "testing" +) + +func testCgoDWARF(t *testing.T, linktype int) { + if _, err := exec.LookPath("gcc"); err != nil { + t.Skip("skipping test: gcc is missing") + } + testDWARF(t, linktype) +} + +func TestDefaultLinkerDWARF(t *testing.T) { + testCgoDWARF(t, linkCgoDefault) +} + +func TestInternalLinkerDWARF(t *testing.T) { + if runtime.GOARCH == "arm64" { + t.Skip("internal linker disabled on windows/arm64") + } + testCgoDWARF(t, linkCgoInternal) +} + +func TestExternalLinkerDWARF(t *testing.T) { + testCgoDWARF(t, linkCgoExternal) +} diff --git a/go/src/debug/pe/file_test.go b/go/src/debug/pe/file_test.go new file mode 100644 index 0000000000000000000000000000000000000000..acea0455d88c19d59e4264ea9caa3d02ca70b6d5 --- /dev/null +++ b/go/src/debug/pe/file_test.go @@ -0,0 +1,737 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package pe + +import ( + "bytes" + "debug/dwarf" + "internal/testenv" + "os" + "os/exec" + "path/filepath" + "reflect" + "regexp" + "runtime" + "strconv" + "testing" + "text/template" +) + +type fileTest struct { + file string + hdr FileHeader + opthdr any + sections []*SectionHeader + symbols []*Symbol + hasNoDwarfInfo bool +} + +var fileTests = []fileTest{ + { + file: "testdata/gcc-386-mingw-obj", + hdr: FileHeader{0x014c, 0x000c, 0x0, 0x64a, 0x1e, 0x0, 0x104}, + sections: []*SectionHeader{ + {".text", 0, 0, 36, 500, 1440, 0, 3, 0, 0x60300020}, + {".data", 0, 0, 0, 0, 0, 0, 0, 0, 3224371264}, + {".bss", 0, 0, 0, 0, 0, 0, 0, 0, 3224371328}, + {".debug_abbrev", 0, 0, 137, 536, 0, 0, 0, 0, 0x42100000}, + {".debug_info", 0, 0, 418, 673, 1470, 0, 7, 0, 1108344832}, + {".debug_line", 0, 0, 128, 1091, 1540, 0, 1, 0, 1108344832}, + {".rdata", 0, 0, 16, 1219, 0, 0, 0, 0, 1076887616}, + {".debug_frame", 0, 0, 52, 1235, 1550, 0, 2, 0, 1110441984}, + {".debug_loc", 0, 0, 56, 1287, 0, 0, 0, 0, 1108344832}, + {".debug_pubnames", 0, 0, 27, 1343, 1570, 0, 1, 0, 1108344832}, + {".debug_pubtypes", 0, 0, 38, 1370, 1580, 0, 1, 0, 1108344832}, + {".debug_aranges", 0, 0, 32, 1408, 1590, 0, 2, 0, 1108344832}, + }, + symbols: []*Symbol{ + {".file", 0x0, -2, 0x0, 0x67}, + {"_main", 0x0, 1, 0x20, 0x2}, + {".text", 0x0, 1, 0x0, 0x3}, + {".data", 0x0, 2, 0x0, 0x3}, + {".bss", 0x0, 3, 0x0, 0x3}, + {".debug_abbrev", 0x0, 4, 0x0, 0x3}, + {".debug_info", 0x0, 5, 0x0, 0x3}, + {".debug_line", 0x0, 6, 0x0, 0x3}, + {".rdata", 0x0, 7, 0x0, 0x3}, + {".debug_frame", 0x0, 8, 0x0, 0x3}, + {".debug_loc", 0x0, 9, 0x0, 0x3}, + {".debug_pubnames", 0x0, 10, 0x0, 0x3}, + {".debug_pubtypes", 0x0, 11, 0x0, 0x3}, + {".debug_aranges", 0x0, 12, 0x0, 0x3}, + {"___main", 0x0, 0, 0x20, 0x2}, + {"_puts", 0x0, 0, 0x20, 0x2}, + }, + }, + { + file: "testdata/gcc-386-mingw-exec", + hdr: FileHeader{0x014c, 0x000f, 0x4c6a1b60, 0x3c00, 0x282, 0xe0, 0x107}, + opthdr: &OptionalHeader32{ + 0x10b, 0x2, 0x38, 0xe00, 0x1a00, 0x200, 0x1160, 0x1000, 0x2000, 0x400000, 0x1000, 0x200, 0x4, 0x0, 0x1, 0x0, 0x4, 0x0, 0x0, 0x10000, 0x400, 0x14abb, 0x3, 0x0, 0x200000, 0x1000, 0x100000, 0x1000, 0x0, 0x10, + [16]DataDirectory{ + {0x0, 0x0}, + {0x5000, 0x3c8}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x7000, 0x18}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + }, + }, + sections: []*SectionHeader{ + {".text", 0xcd8, 0x1000, 0xe00, 0x400, 0x0, 0x0, 0x0, 0x0, 0x60500060}, + {".data", 0x10, 0x2000, 0x200, 0x1200, 0x0, 0x0, 0x0, 0x0, 0xc0300040}, + {".rdata", 0x120, 0x3000, 0x200, 0x1400, 0x0, 0x0, 0x0, 0x0, 0x40300040}, + {".bss", 0xdc, 0x4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0400080}, + {".idata", 0x3c8, 0x5000, 0x400, 0x1600, 0x0, 0x0, 0x0, 0x0, 0xc0300040}, + {".CRT", 0x18, 0x6000, 0x200, 0x1a00, 0x0, 0x0, 0x0, 0x0, 0xc0300040}, + {".tls", 0x20, 0x7000, 0x200, 0x1c00, 0x0, 0x0, 0x0, 0x0, 0xc0300040}, + {".debug_aranges", 0x20, 0x8000, 0x200, 0x1e00, 0x0, 0x0, 0x0, 0x0, 0x42100000}, + {".debug_pubnames", 0x51, 0x9000, 0x200, 0x2000, 0x0, 0x0, 0x0, 0x0, 0x42100000}, + {".debug_pubtypes", 0x91, 0xa000, 0x200, 0x2200, 0x0, 0x0, 0x0, 0x0, 0x42100000}, + {".debug_info", 0xe22, 0xb000, 0x1000, 0x2400, 0x0, 0x0, 0x0, 0x0, 0x42100000}, + {".debug_abbrev", 0x157, 0xc000, 0x200, 0x3400, 0x0, 0x0, 0x0, 0x0, 0x42100000}, + {".debug_line", 0x144, 0xd000, 0x200, 0x3600, 0x0, 0x0, 0x0, 0x0, 0x42100000}, + {".debug_frame", 0x34, 0xe000, 0x200, 0x3800, 0x0, 0x0, 0x0, 0x0, 0x42300000}, + {".debug_loc", 0x38, 0xf000, 0x200, 0x3a00, 0x0, 0x0, 0x0, 0x0, 0x42100000}, + }, + }, + { + file: "testdata/gcc-386-mingw-no-symbols-exec", + hdr: FileHeader{0x14c, 0x8, 0x69676572, 0x0, 0x0, 0xe0, 0x30f}, + opthdr: &OptionalHeader32{0x10b, 0x2, 0x18, 0xe00, 0x1e00, 0x200, 0x1280, 0x1000, 0x2000, 0x400000, 0x1000, 0x200, 0x4, 0x0, 0x1, 0x0, 0x4, 0x0, 0x0, 0x9000, 0x400, 0x5306, 0x3, 0x0, 0x200000, 0x1000, 0x100000, 0x1000, 0x0, 0x10, + [16]DataDirectory{ + {0x0, 0x0}, + {0x6000, 0x378}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x8004, 0x18}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x60b8, 0x7c}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + }, + }, + sections: []*SectionHeader{ + {".text", 0xc64, 0x1000, 0xe00, 0x400, 0x0, 0x0, 0x0, 0x0, 0x60500060}, + {".data", 0x10, 0x2000, 0x200, 0x1200, 0x0, 0x0, 0x0, 0x0, 0xc0300040}, + {".rdata", 0x134, 0x3000, 0x200, 0x1400, 0x0, 0x0, 0x0, 0x0, 0x40300040}, + {".eh_fram", 0x3a0, 0x4000, 0x400, 0x1600, 0x0, 0x0, 0x0, 0x0, 0x40300040}, + {".bss", 0x60, 0x5000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0300080}, + {".idata", 0x378, 0x6000, 0x400, 0x1a00, 0x0, 0x0, 0x0, 0x0, 0xc0300040}, + {".CRT", 0x18, 0x7000, 0x200, 0x1e00, 0x0, 0x0, 0x0, 0x0, 0xc0300040}, + {".tls", 0x20, 0x8000, 0x200, 0x2000, 0x0, 0x0, 0x0, 0x0, 0xc0300040}, + }, + hasNoDwarfInfo: true, + }, + { + file: "testdata/gcc-amd64-mingw-obj", + hdr: FileHeader{0x8664, 0x6, 0x0, 0x198, 0x12, 0x0, 0x4}, + sections: []*SectionHeader{ + {".text", 0x0, 0x0, 0x30, 0x104, 0x15c, 0x0, 0x3, 0x0, 0x60500020}, + {".data", 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0500040}, + {".bss", 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0500080}, + {".rdata", 0x0, 0x0, 0x10, 0x134, 0x0, 0x0, 0x0, 0x0, 0x40500040}, + {".xdata", 0x0, 0x0, 0xc, 0x144, 0x0, 0x0, 0x0, 0x0, 0x40300040}, + {".pdata", 0x0, 0x0, 0xc, 0x150, 0x17a, 0x0, 0x3, 0x0, 0x40300040}, + }, + symbols: []*Symbol{ + {".file", 0x0, -2, 0x0, 0x67}, + {"main", 0x0, 1, 0x20, 0x2}, + {".text", 0x0, 1, 0x0, 0x3}, + {".data", 0x0, 2, 0x0, 0x3}, + {".bss", 0x0, 3, 0x0, 0x3}, + {".rdata", 0x0, 4, 0x0, 0x3}, + {".xdata", 0x0, 5, 0x0, 0x3}, + {".pdata", 0x0, 6, 0x0, 0x3}, + {"__main", 0x0, 0, 0x20, 0x2}, + {"puts", 0x0, 0, 0x20, 0x2}, + }, + hasNoDwarfInfo: true, + }, + { + file: "testdata/gcc-amd64-mingw-exec", + hdr: FileHeader{0x8664, 0x11, 0x53e4364f, 0x39600, 0x6fc, 0xf0, 0x27}, + opthdr: &OptionalHeader64{ + 0x20b, 0x2, 0x16, 0x6a00, 0x2400, 0x1600, 0x14e0, 0x1000, 0x400000, 0x1000, 0x200, 0x4, 0x0, 0x0, 0x0, 0x5, 0x2, 0x0, 0x45000, 0x600, 0x46f19, 0x3, 0x0, 0x200000, 0x1000, 0x100000, 0x1000, 0x0, 0x10, + [16]DataDirectory{ + {0x0, 0x0}, + {0xe000, 0x990}, + {0x0, 0x0}, + {0xa000, 0x498}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x10000, 0x28}, + {0x0, 0x0}, + {0x0, 0x0}, + {0xe254, 0x218}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + }}, + sections: []*SectionHeader{ + {".text", 0x6860, 0x1000, 0x6a00, 0x600, 0x0, 0x0, 0x0, 0x0, 0x60500020}, + {".data", 0xe0, 0x8000, 0x200, 0x7000, 0x0, 0x0, 0x0, 0x0, 0xc0500040}, + {".rdata", 0x6b0, 0x9000, 0x800, 0x7200, 0x0, 0x0, 0x0, 0x0, 0x40600040}, + {".pdata", 0x498, 0xa000, 0x600, 0x7a00, 0x0, 0x0, 0x0, 0x0, 0x40300040}, + {".xdata", 0x488, 0xb000, 0x600, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x40300040}, + {".bss", 0x1410, 0xc000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0600080}, + {".idata", 0x990, 0xe000, 0xa00, 0x8600, 0x0, 0x0, 0x0, 0x0, 0xc0300040}, + {".CRT", 0x68, 0xf000, 0x200, 0x9000, 0x0, 0x0, 0x0, 0x0, 0xc0400040}, + {".tls", 0x48, 0x10000, 0x200, 0x9200, 0x0, 0x0, 0x0, 0x0, 0xc0600040}, + {".debug_aranges", 0x600, 0x11000, 0x600, 0x9400, 0x0, 0x0, 0x0, 0x0, 0x42500040}, + {".debug_info", 0x1316e, 0x12000, 0x13200, 0x9a00, 0x0, 0x0, 0x0, 0x0, 0x42100040}, + {".debug_abbrev", 0x2ccb, 0x26000, 0x2e00, 0x1cc00, 0x0, 0x0, 0x0, 0x0, 0x42100040}, + {".debug_line", 0x3c4d, 0x29000, 0x3e00, 0x1fa00, 0x0, 0x0, 0x0, 0x0, 0x42100040}, + {".debug_frame", 0x18b8, 0x2d000, 0x1a00, 0x23800, 0x0, 0x0, 0x0, 0x0, 0x42400040}, + {".debug_str", 0x396, 0x2f000, 0x400, 0x25200, 0x0, 0x0, 0x0, 0x0, 0x42100040}, + {".debug_loc", 0x13240, 0x30000, 0x13400, 0x25600, 0x0, 0x0, 0x0, 0x0, 0x42100040}, + {".debug_ranges", 0xa70, 0x44000, 0xc00, 0x38a00, 0x0, 0x0, 0x0, 0x0, 0x42100040}, + }, + }, + { + // testdata/vmlinuz-4.15.0-47-generic is a trimmed down version of Linux Kernel image. + // The original Linux Kernel image is about 8M and it is not recommended to add such a big binary file to the repo. + // Moreover only a very small portion of the original Kernel image was being parsed by debug/pe package. + // In order to identify this portion, the original image was first parsed by modified debug/pe package. + // Modification essentially communicated reader's positions before and after parsing. + // Finally, bytes between those positions where written to a separate file, + // generating trimmed down version Linux Kernel image used in this test case. + file: "testdata/vmlinuz-4.15.0-47-generic", + hdr: FileHeader{0x8664, 0x4, 0x0, 0x0, 0x1, 0xa0, 0x206}, + opthdr: &OptionalHeader64{ + 0x20b, 0x2, 0x14, 0x7c0590, 0x0, 0x168f870, 0x4680, 0x200, 0x0, 0x20, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1e50000, 0x200, 0x7c3ab0, 0xa, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6, + [16]DataDirectory{ + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x7c07a0, 0x778}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + {0x0, 0x0}, + }}, + sections: []*SectionHeader{ + {".setup", 0x41e0, 0x200, 0x41e0, 0x200, 0x0, 0x0, 0x0, 0x0, 0x60500020}, + {".reloc", 0x20, 0x43e0, 0x20, 0x43e0, 0x0, 0x0, 0x0, 0x0, 0x42100040}, + {".text", 0x7bc390, 0x4400, 0x7bc390, 0x4400, 0x0, 0x0, 0x0, 0x0, 0x60500020}, + {".bss", 0x168f870, 0x7c0790, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc8000080}, + }, + hasNoDwarfInfo: true, + }, +} + +func isOptHdrEq(a, b any) bool { + switch va := a.(type) { + case *OptionalHeader32: + vb, ok := b.(*OptionalHeader32) + if !ok { + return false + } + return *vb == *va + case *OptionalHeader64: + vb, ok := b.(*OptionalHeader64) + if !ok { + return false + } + return *vb == *va + case nil: + return b == nil + } + return false +} + +func TestOpen(t *testing.T) { + for i := range fileTests { + tt := &fileTests[i] + + f, err := Open(tt.file) + if err != nil { + t.Error(err) + continue + } + if !reflect.DeepEqual(f.FileHeader, tt.hdr) { + t.Errorf("open %s:\n\thave %#v\n\twant %#v\n", tt.file, f.FileHeader, tt.hdr) + continue + } + if !isOptHdrEq(tt.opthdr, f.OptionalHeader) { + t.Errorf("open %s:\n\thave %#v\n\twant %#v\n", tt.file, f.OptionalHeader, tt.opthdr) + continue + } + + for i, sh := range f.Sections { + if i >= len(tt.sections) { + break + } + have := &sh.SectionHeader + want := tt.sections[i] + if !reflect.DeepEqual(have, want) { + t.Errorf("open %s, section %d:\n\thave %#v\n\twant %#v\n", tt.file, i, have, want) + } + } + tn := len(tt.sections) + fn := len(f.Sections) + if tn != fn { + t.Errorf("open %s: len(Sections) = %d, want %d", tt.file, fn, tn) + } + for i, have := range f.Symbols { + if i >= len(tt.symbols) { + break + } + want := tt.symbols[i] + if !reflect.DeepEqual(have, want) { + t.Errorf("open %s, symbol %d:\n\thave %#v\n\twant %#v\n", tt.file, i, have, want) + } + } + if !tt.hasNoDwarfInfo { + _, err = f.DWARF() + if err != nil { + t.Errorf("fetching %s dwarf details failed: %v", tt.file, err) + } + } + } +} + +func TestOpenFailure(t *testing.T) { + filename := "file.go" // not a PE file + _, err := Open(filename) // don't crash + if err == nil { + t.Errorf("open %s: succeeded unexpectedly", filename) + } +} + +const ( + linkNoCgo = iota + linkCgoDefault + linkCgoInternal + linkCgoExternal +) + +func getImageBase(f *File) uintptr { + switch oh := f.OptionalHeader.(type) { + case *OptionalHeader32: + return uintptr(oh.ImageBase) + case *OptionalHeader64: + return uintptr(oh.ImageBase) + default: + panic("unexpected optionalheader type") + } +} + +func testDWARF(t *testing.T, linktype int) { + if runtime.GOOS != "windows" { + t.Skip("skipping windows only test") + } + testenv.MustHaveGoRun(t) + + tmpdir := t.TempDir() + + src := filepath.Join(tmpdir, "a.go") + file, err := os.Create(src) + if err != nil { + t.Fatal(err) + } + err = template.Must(template.New("main").Parse(testprog)).Execute(file, linktype != linkNoCgo) + if err != nil { + if err := file.Close(); err != nil { + t.Error(err) + } + t.Fatal(err) + } + if err := file.Close(); err != nil { + t.Fatal(err) + } + + exe := filepath.Join(tmpdir, "a.exe") + args := []string{"build", "-o", exe} + switch linktype { + case linkNoCgo: + case linkCgoDefault: + case linkCgoInternal: + args = append(args, "-ldflags", "-linkmode=internal") + case linkCgoExternal: + args = append(args, "-ldflags", "-linkmode=external") + default: + t.Fatalf("invalid linktype parameter of %v", linktype) + } + args = append(args, src) + out, err := exec.Command(testenv.GoToolPath(t), args...).CombinedOutput() + if err != nil { + t.Fatalf("building test executable for linktype %d failed: %s %s", linktype, err, out) + } + out, err = exec.Command(exe).CombinedOutput() + if err != nil { + t.Fatalf("running test executable failed: %s %s", err, out) + } + t.Logf("Testprog output:\n%s", string(out)) + + matches := regexp.MustCompile("offset=(.*)\n").FindStringSubmatch(string(out)) + if len(matches) < 2 { + t.Fatalf("unexpected program output: %s", out) + } + wantoffset, err := strconv.ParseUint(matches[1], 0, 64) + if err != nil { + t.Fatalf("unexpected main offset %q: %s", matches[1], err) + } + + f, err := Open(exe) + if err != nil { + t.Fatal(err) + } + defer f.Close() + + imageBase := getImageBase(f) + + var foundDebugGDBScriptsSection bool + for _, sect := range f.Sections { + if sect.Name == ".debug_gdb_scripts" || sect.Name == ".zdebug_gdb_scripts" { + foundDebugGDBScriptsSection = true + } + } + if !foundDebugGDBScriptsSection { + t.Error(".debug_gdb_scripts section is not found") + } + + d, err := f.DWARF() + if err != nil { + t.Fatal(err) + } + + // look for main.main + r := d.Reader() + for { + e, err := r.Next() + if err != nil { + t.Fatal("r.Next:", err) + } + if e == nil { + break + } + if e.Tag == dwarf.TagSubprogram { + name, ok := e.Val(dwarf.AttrName).(string) + if ok && name == "main.main" { + t.Logf("Found main.main") + addr, ok := e.Val(dwarf.AttrLowpc).(uint64) + if !ok { + t.Fatal("Failed to get AttrLowpc") + } + offset := uintptr(addr) - imageBase + if offset != uintptr(wantoffset) { + t.Fatalf("Runtime offset (0x%x) did "+ + "not match dwarf offset "+ + "(0x%x)", wantoffset, offset) + } + return + } + } + } + t.Fatal("main.main not found") +} + +func TestBSSHasZeros(t *testing.T) { + testenv.MustHaveExec(t) + + if runtime.GOOS != "windows" { + t.Skip("skipping windows only test") + } + gccpath, err := exec.LookPath("gcc") + if err != nil { + t.Skip("skipping test: gcc is missing") + } + + tmpdir := t.TempDir() + + srcpath := filepath.Join(tmpdir, "a.c") + src := ` +#include + +int zero = 0; + +int +main(void) +{ + printf("%d\n", zero); + return 0; +} +` + err = os.WriteFile(srcpath, []byte(src), 0644) + if err != nil { + t.Fatal(err) + } + + objpath := filepath.Join(tmpdir, "a.obj") + cmd := exec.Command(gccpath, "-c", srcpath, "-o", objpath) + out, err := cmd.CombinedOutput() + if err != nil { + t.Fatalf("failed to build object file: %v - %v", err, string(out)) + } + + f, err := Open(objpath) + if err != nil { + t.Fatal(err) + } + defer f.Close() + + var bss *Section + for _, sect := range f.Sections { + if sect.Name == ".bss" { + bss = sect + break + } + } + if bss == nil { + t.Fatal("could not find .bss section") + } + // We expect an error from bss.Data, as there are no contents. + if _, err := bss.Data(); err == nil { + t.Error("bss.Data succeeded, expected error") + } +} + +func TestDWARF(t *testing.T) { + testDWARF(t, linkNoCgo) +} + +const testprog = ` +package main + +import "fmt" +import "syscall" +import "unsafe" +{{if .}}import "C" +{{end}} + +// struct MODULEINFO from the Windows SDK +type moduleinfo struct { + BaseOfDll uintptr + SizeOfImage uint32 + EntryPoint uintptr +} + +func add(p unsafe.Pointer, x uintptr) unsafe.Pointer { + return unsafe.Pointer(uintptr(p) + x) +} + +func funcPC(f interface{}) uintptr { + var a uintptr + return **(**uintptr)(add(unsafe.Pointer(&f), unsafe.Sizeof(a))) +} + +func main() { + kernel32 := syscall.MustLoadDLL("kernel32.dll") + psapi := syscall.MustLoadDLL("psapi.dll") + getModuleHandle := kernel32.MustFindProc("GetModuleHandleW") + getCurrentProcess := kernel32.MustFindProc("GetCurrentProcess") + getModuleInformation := psapi.MustFindProc("GetModuleInformation") + + procHandle, _, _ := getCurrentProcess.Call() + moduleHandle, _, err := getModuleHandle.Call(0) + if moduleHandle == 0 { + panic(fmt.Sprintf("GetModuleHandle() failed: %d", err)) + } + + var info moduleinfo + ret, _, err := getModuleInformation.Call(procHandle, moduleHandle, + uintptr(unsafe.Pointer(&info)), unsafe.Sizeof(info)) + + if ret == 0 { + panic(fmt.Sprintf("GetModuleInformation() failed: %d", err)) + } + + offset := funcPC(main) - info.BaseOfDll + fmt.Printf("base=0x%x\n", info.BaseOfDll) + fmt.Printf("main=%p\n", main) + fmt.Printf("offset=0x%x\n", offset) +} +` + +func TestBuildingWindowsGUI(t *testing.T) { + testenv.MustHaveGoBuild(t) + + if runtime.GOOS != "windows" { + t.Skip("skipping windows only test") + } + tmpdir := t.TempDir() + + src := filepath.Join(tmpdir, "a.go") + if err := os.WriteFile(src, []byte(`package main; func main() {}`), 0644); err != nil { + t.Fatal(err) + } + exe := filepath.Join(tmpdir, "a.exe") + cmd := exec.Command(testenv.GoToolPath(t), "build", "-ldflags", "-H=windowsgui", "-o", exe, src) + out, err := cmd.CombinedOutput() + if err != nil { + t.Fatalf("building test executable failed: %s %s", err, out) + } + + f, err := Open(exe) + if err != nil { + t.Fatal(err) + } + defer f.Close() + + switch oh := f.OptionalHeader.(type) { + case *OptionalHeader32: + if oh.Subsystem != IMAGE_SUBSYSTEM_WINDOWS_GUI { + t.Errorf("unexpected Subsystem value: have %d, but want %d", oh.Subsystem, IMAGE_SUBSYSTEM_WINDOWS_GUI) + } + case *OptionalHeader64: + if oh.Subsystem != IMAGE_SUBSYSTEM_WINDOWS_GUI { + t.Errorf("unexpected Subsystem value: have %d, but want %d", oh.Subsystem, IMAGE_SUBSYSTEM_WINDOWS_GUI) + } + default: + t.Fatalf("unexpected OptionalHeader type: have %T, but want *pe.OptionalHeader32 or *pe.OptionalHeader64", oh) + } +} + +func TestImportTableInUnknownSection(t *testing.T) { + if runtime.GOOS != "windows" { + t.Skip("skipping Windows-only test") + } + + // ws2_32.dll import table is located in ".rdata" section, + // so it is good enough to test issue #16103. + const filename = "ws2_32.dll" + path, err := exec.LookPath(filename) + if err != nil { + t.Fatalf("unable to locate required file %q in search path: %s", filename, err) + } + + f, err := Open(path) + if err != nil { + t.Error(err) + } + defer f.Close() + + // now we can extract its imports + symbols, err := f.ImportedSymbols() + if err != nil { + t.Error(err) + } + + if len(symbols) == 0 { + t.Fatalf("unable to locate any imported symbols within file %q.", path) + } +} + +func TestInvalidOptionalHeaderMagic(t *testing.T) { + // Files with invalid optional header magic should return error from NewFile() + // (see https://golang.org/issue/30250 and https://golang.org/issue/32126 for details). + // Input generated by gofuzz + data := []byte("\x00\x00\x00\x0000000\x00\x00\x00\x00\x00\x00\x000000" + + "00000000000000000000" + + "000000000\x00\x00\x0000000000" + + "00000000000000000000" + + "0000000000000000") + + _, err := NewFile(bytes.NewReader(data)) + if err == nil { + t.Fatal("NewFile succeeded unexpectedly") + } +} + +func TestImportedSymbolsNoPanicMissingOptionalHeader(t *testing.T) { + // https://golang.org/issue/30250 + // ImportedSymbols shouldn't panic if optional headers is missing + data, err := os.ReadFile("testdata/gcc-amd64-mingw-obj") + if err != nil { + t.Fatal(err) + } + + f, err := NewFile(bytes.NewReader(data)) + if err != nil { + t.Fatal(err) + } + + if f.OptionalHeader != nil { + t.Fatal("expected f.OptionalHeader to be nil, received non-nil optional header") + } + + syms, err := f.ImportedSymbols() + if err != nil { + t.Fatal(err) + } + + if len(syms) != 0 { + t.Fatalf("expected len(syms) == 0, received len(syms) = %d", len(syms)) + } + +} + +func TestImportedSymbolsNoPanicWithSliceOutOfBound(t *testing.T) { + // https://golang.org/issue/30253 + // ImportedSymbols shouldn't panic with slice out of bounds + // Input generated by gofuzz + data := []byte("L\x01\b\x00regi\x00\x00\x00\x00\x00\x00\x00\x00\xe0\x00\x0f\x03" + + "\v\x01\x02\x18\x00\x0e\x00\x00\x00\x1e\x00\x00\x00\x02\x00\x00\x80\x12\x00\x00" + + "\x00\x10\x00\x00\x00 \x00\x00\x00\x00@\x00\x00\x10\x00\x00\x00\x02\x00\x00" + + "\x04\x00\x00\x00\x01\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x90\x00\x00" + + "\x00\x04\x00\x00\x06S\x00\x00\x03\x00\x00\x00\x00\x00 \x00\x00\x10\x00\x00" + + "\x00\x00\x10\x00\x00\x10\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00" + + "\x00\x00\x00\x00\x00`\x00\x00x\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + + "\x00\x00\x00\x00\x00\x00\x00\x00\x04\x80\x00\x00\x18\x00\x00\x00\x00\x00\x00\x00" + + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb8`\x00\x00|\x00\x00\x00" + + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + + "\x00\x00\x00\x00.text\x00\x00\x00d\f\x00\x00\x00\x10\x00\x00" + + "\x00\x0e\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + + "`\x00P`.data\x00\x00\x00\x10\x00\x00\x00\x00 \x00\x00" + + "\x00\x02\x00\x00\x00\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + + "@\x000\xc0.rdata\x00\x004\x01\x00\x00\x000\x00\x00" + + "\x00\x02\x00\x00\x00\x14\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + + "@\x000@.eh_fram\xa0\x03\x00\x00\x00@\x00\x00" + + "\x00\x04\x00\x00\x00\x16\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + + "@\x000@.bss\x00\x00\x00\x00`\x00\x00\x00\x00P\x00\x00" + + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + + "\x80\x000\xc0.idata\x00\x00x\x03\x00\x00\x00`\x00\x00" + + "\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00@\x00" + + "0\xc0.CRT\x00\x00\x00\x00\x18\x00\x00\x00\x00p\x00\x00\x00\x02" + + "\x00\x00\x00\x1e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00@\x00" + + "0\xc0.tls\x00\x00\x00\x00 \x00\x00\x00\x00\x80\x00\x00\x00\x02" + + "\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x001\xc9" + + "H\x895\x1d") + + f, err := NewFile(bytes.NewReader(data)) + if err != nil { + t.Fatal(err) + } + + syms, err := f.ImportedSymbols() + if err != nil { + t.Fatal(err) + } + + if len(syms) != 0 { + t.Fatalf("expected len(syms) == 0, received len(syms) = %d", len(syms)) + } +} diff --git a/go/src/debug/pe/pe.go b/go/src/debug/pe/pe.go new file mode 100644 index 0000000000000000000000000000000000000000..51001bd2b3b6be762ed7f1cb42d4d15655f8de54 --- /dev/null +++ b/go/src/debug/pe/pe.go @@ -0,0 +1,189 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package pe + +type FileHeader struct { + Machine uint16 + NumberOfSections uint16 + TimeDateStamp uint32 + PointerToSymbolTable uint32 + NumberOfSymbols uint32 + SizeOfOptionalHeader uint16 + Characteristics uint16 +} + +type DataDirectory struct { + VirtualAddress uint32 + Size uint32 +} + +type OptionalHeader32 struct { + Magic uint16 + MajorLinkerVersion uint8 + MinorLinkerVersion uint8 + SizeOfCode uint32 + SizeOfInitializedData uint32 + SizeOfUninitializedData uint32 + AddressOfEntryPoint uint32 + BaseOfCode uint32 + BaseOfData uint32 + ImageBase uint32 + SectionAlignment uint32 + FileAlignment uint32 + MajorOperatingSystemVersion uint16 + MinorOperatingSystemVersion uint16 + MajorImageVersion uint16 + MinorImageVersion uint16 + MajorSubsystemVersion uint16 + MinorSubsystemVersion uint16 + Win32VersionValue uint32 + SizeOfImage uint32 + SizeOfHeaders uint32 + CheckSum uint32 + Subsystem uint16 + DllCharacteristics uint16 + SizeOfStackReserve uint32 + SizeOfStackCommit uint32 + SizeOfHeapReserve uint32 + SizeOfHeapCommit uint32 + LoaderFlags uint32 + NumberOfRvaAndSizes uint32 + DataDirectory [16]DataDirectory +} + +type OptionalHeader64 struct { + Magic uint16 + MajorLinkerVersion uint8 + MinorLinkerVersion uint8 + SizeOfCode uint32 + SizeOfInitializedData uint32 + SizeOfUninitializedData uint32 + AddressOfEntryPoint uint32 + BaseOfCode uint32 + ImageBase uint64 + SectionAlignment uint32 + FileAlignment uint32 + MajorOperatingSystemVersion uint16 + MinorOperatingSystemVersion uint16 + MajorImageVersion uint16 + MinorImageVersion uint16 + MajorSubsystemVersion uint16 + MinorSubsystemVersion uint16 + Win32VersionValue uint32 + SizeOfImage uint32 + SizeOfHeaders uint32 + CheckSum uint32 + Subsystem uint16 + DllCharacteristics uint16 + SizeOfStackReserve uint64 + SizeOfStackCommit uint64 + SizeOfHeapReserve uint64 + SizeOfHeapCommit uint64 + LoaderFlags uint32 + NumberOfRvaAndSizes uint32 + DataDirectory [16]DataDirectory +} + +const ( + IMAGE_FILE_MACHINE_UNKNOWN = 0x0 + IMAGE_FILE_MACHINE_AM33 = 0x1d3 + IMAGE_FILE_MACHINE_AMD64 = 0x8664 + IMAGE_FILE_MACHINE_ARM = 0x1c0 + IMAGE_FILE_MACHINE_ARMNT = 0x1c4 + IMAGE_FILE_MACHINE_ARM64 = 0xaa64 + IMAGE_FILE_MACHINE_EBC = 0xebc + IMAGE_FILE_MACHINE_I386 = 0x14c + IMAGE_FILE_MACHINE_IA64 = 0x200 + IMAGE_FILE_MACHINE_LOONGARCH32 = 0x6232 + IMAGE_FILE_MACHINE_LOONGARCH64 = 0x6264 + IMAGE_FILE_MACHINE_M32R = 0x9041 + IMAGE_FILE_MACHINE_MIPS16 = 0x266 + IMAGE_FILE_MACHINE_MIPSFPU = 0x366 + IMAGE_FILE_MACHINE_MIPSFPU16 = 0x466 + IMAGE_FILE_MACHINE_POWERPC = 0x1f0 + IMAGE_FILE_MACHINE_POWERPCFP = 0x1f1 + IMAGE_FILE_MACHINE_R4000 = 0x166 + IMAGE_FILE_MACHINE_SH3 = 0x1a2 + IMAGE_FILE_MACHINE_SH3DSP = 0x1a3 + IMAGE_FILE_MACHINE_SH4 = 0x1a6 + IMAGE_FILE_MACHINE_SH5 = 0x1a8 + IMAGE_FILE_MACHINE_THUMB = 0x1c2 + IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x169 + IMAGE_FILE_MACHINE_RISCV32 = 0x5032 + IMAGE_FILE_MACHINE_RISCV64 = 0x5064 + IMAGE_FILE_MACHINE_RISCV128 = 0x5128 +) + +// IMAGE_DIRECTORY_ENTRY constants +const ( + IMAGE_DIRECTORY_ENTRY_EXPORT = 0 + IMAGE_DIRECTORY_ENTRY_IMPORT = 1 + IMAGE_DIRECTORY_ENTRY_RESOURCE = 2 + IMAGE_DIRECTORY_ENTRY_EXCEPTION = 3 + IMAGE_DIRECTORY_ENTRY_SECURITY = 4 + IMAGE_DIRECTORY_ENTRY_BASERELOC = 5 + IMAGE_DIRECTORY_ENTRY_DEBUG = 6 + IMAGE_DIRECTORY_ENTRY_ARCHITECTURE = 7 + IMAGE_DIRECTORY_ENTRY_GLOBALPTR = 8 + IMAGE_DIRECTORY_ENTRY_TLS = 9 + IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG = 10 + IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT = 11 + IMAGE_DIRECTORY_ENTRY_IAT = 12 + IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT = 13 + IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR = 14 +) + +// Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together. +const ( + IMAGE_FILE_RELOCS_STRIPPED = 0x0001 + IMAGE_FILE_EXECUTABLE_IMAGE = 0x0002 + IMAGE_FILE_LINE_NUMS_STRIPPED = 0x0004 + IMAGE_FILE_LOCAL_SYMS_STRIPPED = 0x0008 + IMAGE_FILE_AGGRESIVE_WS_TRIM = 0x0010 + IMAGE_FILE_LARGE_ADDRESS_AWARE = 0x0020 + IMAGE_FILE_BYTES_REVERSED_LO = 0x0080 + IMAGE_FILE_32BIT_MACHINE = 0x0100 + IMAGE_FILE_DEBUG_STRIPPED = 0x0200 + IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = 0x0400 + IMAGE_FILE_NET_RUN_FROM_SWAP = 0x0800 + IMAGE_FILE_SYSTEM = 0x1000 + IMAGE_FILE_DLL = 0x2000 + IMAGE_FILE_UP_SYSTEM_ONLY = 0x4000 + IMAGE_FILE_BYTES_REVERSED_HI = 0x8000 +) + +// OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values. +const ( + IMAGE_SUBSYSTEM_UNKNOWN = 0 + IMAGE_SUBSYSTEM_NATIVE = 1 + IMAGE_SUBSYSTEM_WINDOWS_GUI = 2 + IMAGE_SUBSYSTEM_WINDOWS_CUI = 3 + IMAGE_SUBSYSTEM_OS2_CUI = 5 + IMAGE_SUBSYSTEM_POSIX_CUI = 7 + IMAGE_SUBSYSTEM_NATIVE_WINDOWS = 8 + IMAGE_SUBSYSTEM_WINDOWS_CE_GUI = 9 + IMAGE_SUBSYSTEM_EFI_APPLICATION = 10 + IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER = 11 + IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER = 12 + IMAGE_SUBSYSTEM_EFI_ROM = 13 + IMAGE_SUBSYSTEM_XBOX = 14 + IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION = 16 +) + +// OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics +// values. These can be combined together. +const ( + IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA = 0x0020 + IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE = 0x0040 + IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY = 0x0080 + IMAGE_DLLCHARACTERISTICS_NX_COMPAT = 0x0100 + IMAGE_DLLCHARACTERISTICS_NO_ISOLATION = 0x0200 + IMAGE_DLLCHARACTERISTICS_NO_SEH = 0x0400 + IMAGE_DLLCHARACTERISTICS_NO_BIND = 0x0800 + IMAGE_DLLCHARACTERISTICS_APPCONTAINER = 0x1000 + IMAGE_DLLCHARACTERISTICS_WDM_DRIVER = 0x2000 + IMAGE_DLLCHARACTERISTICS_GUARD_CF = 0x4000 + IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE = 0x8000 +) diff --git a/go/src/debug/pe/section.go b/go/src/debug/pe/section.go new file mode 100644 index 0000000000000000000000000000000000000000..f34134ba07a6b573d30d38af83ccb00ff2ceb107 --- /dev/null +++ b/go/src/debug/pe/section.go @@ -0,0 +1,125 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package pe + +import ( + "encoding/binary" + "fmt" + "internal/saferio" + "io" + "strconv" +) + +// SectionHeader32 represents real PE COFF section header. +type SectionHeader32 struct { + Name [8]uint8 + VirtualSize uint32 + VirtualAddress uint32 + SizeOfRawData uint32 + PointerToRawData uint32 + PointerToRelocations uint32 + PointerToLineNumbers uint32 + NumberOfRelocations uint16 + NumberOfLineNumbers uint16 + Characteristics uint32 +} + +// fullName finds real name of section sh. Normally name is stored +// in sh.Name, but if it is longer then 8 characters, it is stored +// in COFF string table st instead. +func (sh *SectionHeader32) fullName(st StringTable) (string, error) { + if sh.Name[0] != '/' { + return cstring(sh.Name[:]), nil + } + i, err := strconv.Atoi(cstring(sh.Name[1:])) + if err != nil { + return "", err + } + return st.String(uint32(i)) +} + +// TODO(brainman): copy all IMAGE_REL_* consts from ldpe.go here + +// Reloc represents a PE COFF relocation. +// Each section contains its own relocation list. +type Reloc struct { + VirtualAddress uint32 + SymbolTableIndex uint32 + Type uint16 +} + +func readRelocs(sh *SectionHeader, r io.ReadSeeker) ([]Reloc, error) { + if sh.NumberOfRelocations <= 0 { + return nil, nil + } + _, err := r.Seek(int64(sh.PointerToRelocations), io.SeekStart) + if err != nil { + return nil, fmt.Errorf("fail to seek to %q section relocations: %v", sh.Name, err) + } + relocs := make([]Reloc, sh.NumberOfRelocations) + err = binary.Read(r, binary.LittleEndian, relocs) + if err != nil { + return nil, fmt.Errorf("fail to read section relocations: %v", err) + } + return relocs, nil +} + +// SectionHeader is similar to [SectionHeader32] with Name +// field replaced by Go string. +type SectionHeader struct { + Name string + VirtualSize uint32 + VirtualAddress uint32 + Size uint32 + Offset uint32 + PointerToRelocations uint32 + PointerToLineNumbers uint32 + NumberOfRelocations uint16 + NumberOfLineNumbers uint16 + Characteristics uint32 +} + +// Section provides access to PE COFF section. +type Section struct { + SectionHeader + Relocs []Reloc + + // Embed ReaderAt for ReadAt method. + // Do not embed SectionReader directly + // to avoid having Read and Seek. + // If a client wants Read and Seek it must use + // Open() to avoid fighting over the seek offset + // with other clients. + io.ReaderAt + sr *io.SectionReader +} + +// Data reads and returns the contents of the PE section s. +// +// If s.Offset is 0, the section has no contents, +// and Data will always return a non-nil error. +func (s *Section) Data() ([]byte, error) { + return saferio.ReadDataAt(s.sr, uint64(s.Size), 0) +} + +// Open returns a new ReadSeeker reading the PE section s. +// +// If s.Offset is 0, the section has no contents, and all calls +// to the returned reader will return a non-nil error. +func (s *Section) Open() io.ReadSeeker { + return io.NewSectionReader(s.sr, 0, 1<<63-1) +} + +// Section characteristics flags. +const ( + IMAGE_SCN_CNT_CODE = 0x00000020 + IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040 + IMAGE_SCN_CNT_UNINITIALIZED_DATA = 0x00000080 + IMAGE_SCN_LNK_COMDAT = 0x00001000 + IMAGE_SCN_MEM_DISCARDABLE = 0x02000000 + IMAGE_SCN_MEM_EXECUTE = 0x20000000 + IMAGE_SCN_MEM_READ = 0x40000000 + IMAGE_SCN_MEM_WRITE = 0x80000000 +) diff --git a/go/src/debug/pe/string.go b/go/src/debug/pe/string.go new file mode 100644 index 0000000000000000000000000000000000000000..6cd08aed7152e798bb2d02e810a7145cef11c360 --- /dev/null +++ b/go/src/debug/pe/string.go @@ -0,0 +1,69 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package pe + +import ( + "bytes" + "encoding/binary" + "fmt" + "internal/saferio" + "io" +) + +// cstring converts ASCII byte sequence b to string. +// It stops once it finds 0 or reaches end of b. +func cstring(b []byte) string { + i := bytes.IndexByte(b, 0) + if i == -1 { + i = len(b) + } + return string(b[:i]) +} + +// StringTable is a COFF string table. +type StringTable []byte + +func readStringTable(fh *FileHeader, r io.ReadSeeker) (StringTable, error) { + // COFF string table is located right after COFF symbol table. + if fh.PointerToSymbolTable <= 0 { + return nil, nil + } + offset := fh.PointerToSymbolTable + COFFSymbolSize*fh.NumberOfSymbols + _, err := r.Seek(int64(offset), io.SeekStart) + if err != nil { + return nil, fmt.Errorf("fail to seek to string table: %v", err) + } + var l uint32 + err = binary.Read(r, binary.LittleEndian, &l) + if err != nil { + return nil, fmt.Errorf("fail to read string table length: %v", err) + } + // string table length includes itself + if l <= 4 { + return nil, nil + } + l -= 4 + + buf, err := saferio.ReadData(r, uint64(l)) + if err != nil { + return nil, fmt.Errorf("fail to read string table: %v", err) + } + return StringTable(buf), nil +} + +// TODO(brainman): decide if start parameter should be int instead of uint32 + +// String extracts string from COFF string table st at offset start. +func (st StringTable) String(start uint32) (string, error) { + // start includes 4 bytes of string table length + if start < 4 { + return "", fmt.Errorf("offset %d is before the start of string table", start) + } + start -= 4 + if int(start) > len(st) { + return "", fmt.Errorf("offset %d is beyond the end of string table", start) + } + return cstring(st[start:]), nil +} diff --git a/go/src/debug/pe/symbol.go b/go/src/debug/pe/symbol.go new file mode 100644 index 0000000000000000000000000000000000000000..80acebe9f1f40b9fbe9d8255b7d07cb924a2a540 --- /dev/null +++ b/go/src/debug/pe/symbol.go @@ -0,0 +1,214 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package pe + +import ( + "encoding/binary" + "errors" + "fmt" + "internal/saferio" + "io" + "unsafe" +) + +const COFFSymbolSize = 18 + +// COFFSymbol represents single COFF symbol table record. +type COFFSymbol struct { + Name [8]uint8 + Value uint32 + SectionNumber int16 + Type uint16 + StorageClass uint8 + NumberOfAuxSymbols uint8 +} + +// readCOFFSymbols reads in the symbol table for a PE file, returning +// a slice of COFFSymbol objects. The PE format includes both primary +// symbols (whose fields are described by COFFSymbol above) and +// auxiliary symbols; all symbols are 18 bytes in size. The auxiliary +// symbols for a given primary symbol are placed following it in the +// array, e.g. +// +// ... +// k+0: regular sym k +// k+1: 1st aux symbol for k +// k+2: 2nd aux symbol for k +// k+3: regular sym k+3 +// k+4: 1st aux symbol for k+3 +// k+5: regular sym k+5 +// k+6: regular sym k+6 +// +// The PE format allows for several possible aux symbol formats. For +// more info see: +// +// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#auxiliary-symbol-records +// +// At the moment this package only provides APIs for looking at +// aux symbols of format 5 (associated with section definition symbols). +func readCOFFSymbols(fh *FileHeader, r io.ReadSeeker) ([]COFFSymbol, error) { + if fh.PointerToSymbolTable == 0 { + return nil, nil + } + if fh.NumberOfSymbols <= 0 { + return nil, nil + } + _, err := r.Seek(int64(fh.PointerToSymbolTable), io.SeekStart) + if err != nil { + return nil, fmt.Errorf("fail to seek to symbol table: %v", err) + } + c := saferio.SliceCap[COFFSymbol](uint64(fh.NumberOfSymbols)) + if c < 0 { + return nil, errors.New("too many symbols; file may be corrupt") + } + syms := make([]COFFSymbol, 0, c) + naux := 0 + for k := uint32(0); k < fh.NumberOfSymbols; k++ { + var sym COFFSymbol + if naux == 0 { + // Read a primary symbol. + err = binary.Read(r, binary.LittleEndian, &sym) + if err != nil { + return nil, fmt.Errorf("fail to read symbol table: %v", err) + } + // Record how many auxiliary symbols it has. + naux = int(sym.NumberOfAuxSymbols) + } else { + // Read an aux symbol. At the moment we assume all + // aux symbols are format 5 (obviously this doesn't always + // hold; more cases will be needed below if more aux formats + // are supported in the future). + naux-- + aux := (*COFFSymbolAuxFormat5)(unsafe.Pointer(&sym)) + err = binary.Read(r, binary.LittleEndian, aux) + if err != nil { + return nil, fmt.Errorf("fail to read symbol table: %v", err) + } + } + syms = append(syms, sym) + } + if naux != 0 { + return nil, fmt.Errorf("fail to read symbol table: %d aux symbols unread", naux) + } + return syms, nil +} + +// isSymNameOffset checks symbol name if it is encoded as offset into string table. +func isSymNameOffset(name [8]byte) (bool, uint32) { + if name[0] == 0 && name[1] == 0 && name[2] == 0 && name[3] == 0 { + offset := binary.LittleEndian.Uint32(name[4:]) + if offset == 0 { + // symbol has no name + return false, 0 + } + return true, offset + } + return false, 0 +} + +// FullName finds real name of symbol sym. Normally name is stored +// in sym.Name, but if it is longer then 8 characters, it is stored +// in COFF string table st instead. +func (sym *COFFSymbol) FullName(st StringTable) (string, error) { + if ok, offset := isSymNameOffset(sym.Name); ok { + return st.String(offset) + } + return cstring(sym.Name[:]), nil +} + +func removeAuxSymbols(allsyms []COFFSymbol, st StringTable) ([]*Symbol, error) { + if len(allsyms) == 0 { + return nil, nil + } + syms := make([]*Symbol, 0) + aux := uint8(0) + for _, sym := range allsyms { + if aux > 0 { + aux-- + continue + } + name, err := sym.FullName(st) + if err != nil { + return nil, err + } + aux = sym.NumberOfAuxSymbols + s := &Symbol{ + Name: name, + Value: sym.Value, + SectionNumber: sym.SectionNumber, + Type: sym.Type, + StorageClass: sym.StorageClass, + } + syms = append(syms, s) + } + return syms, nil +} + +// Symbol is similar to [COFFSymbol] with Name field replaced +// by Go string. Symbol also does not have NumberOfAuxSymbols. +type Symbol struct { + Name string + Value uint32 + SectionNumber int16 + Type uint16 + StorageClass uint8 +} + +// COFFSymbolAuxFormat5 describes the expected form of an aux symbol +// attached to a section definition symbol. The PE format defines a +// number of different aux symbol formats: format 1 for function +// definitions, format 2 for .be and .ef symbols, and so on. Format 5 +// holds extra info associated with a section definition, including +// number of relocations + line numbers, as well as COMDAT info. See +// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#auxiliary-format-5-section-definitions +// for more on what's going on here. +type COFFSymbolAuxFormat5 struct { + Size uint32 + NumRelocs uint16 + NumLineNumbers uint16 + Checksum uint32 + SecNum uint16 + Selection uint8 + _ [3]uint8 // padding +} + +// These constants make up the possible values for the 'Selection' +// field in an AuxFormat5. +const ( + IMAGE_COMDAT_SELECT_NODUPLICATES = 1 + IMAGE_COMDAT_SELECT_ANY = 2 + IMAGE_COMDAT_SELECT_SAME_SIZE = 3 + IMAGE_COMDAT_SELECT_EXACT_MATCH = 4 + IMAGE_COMDAT_SELECT_ASSOCIATIVE = 5 + IMAGE_COMDAT_SELECT_LARGEST = 6 +) + +// COFFSymbolReadSectionDefAux returns a blob of auxiliary information +// (including COMDAT info) for a section definition symbol. Here 'idx' +// is the index of a section symbol in the main [COFFSymbol] array for +// the File. Return value is a pointer to the appropriate aux symbol +// struct. For more info, see: +// +// auxiliary symbols: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#auxiliary-symbol-records +// COMDAT sections: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#comdat-sections-object-only +// auxiliary info for section definitions: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#auxiliary-format-5-section-definitions +func (f *File) COFFSymbolReadSectionDefAux(idx int) (*COFFSymbolAuxFormat5, error) { + var rv *COFFSymbolAuxFormat5 + if idx < 0 || idx >= len(f.COFFSymbols) { + return rv, fmt.Errorf("invalid symbol index") + } + pesym := &f.COFFSymbols[idx] + const IMAGE_SYM_CLASS_STATIC = 3 + if pesym.StorageClass != uint8(IMAGE_SYM_CLASS_STATIC) { + return rv, fmt.Errorf("incorrect symbol storage class") + } + if pesym.NumberOfAuxSymbols == 0 || idx+1 >= len(f.COFFSymbols) { + return rv, fmt.Errorf("aux symbol unavailable") + } + // Locate and return a pointer to the successor aux symbol. + pesymn := &f.COFFSymbols[idx+1] + rv = (*COFFSymbolAuxFormat5)(unsafe.Pointer(pesymn)) + return rv, nil +} diff --git a/go/src/debug/pe/symbols_test.go b/go/src/debug/pe/symbols_test.go new file mode 100644 index 0000000000000000000000000000000000000000..c4dcd95391f3413010704855acbec1e298866486 --- /dev/null +++ b/go/src/debug/pe/symbols_test.go @@ -0,0 +1,91 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package pe + +import ( + "fmt" + "testing" +) + +type testpoint struct { + name string + ok bool + err string + auxstr string +} + +func TestReadCOFFSymbolAuxInfo(t *testing.T) { + testpoints := map[int]testpoint{ + 39: testpoint{ + name: ".rdata$.refptr.__native_startup_lock", + ok: true, + auxstr: "{Size:8 NumRelocs:1 NumLineNumbers:0 Checksum:0 SecNum:16 Selection:2 _:[0 0 0]}", + }, + 81: testpoint{ + name: ".debug_line", + ok: true, + auxstr: "{Size:994 NumRelocs:1 NumLineNumbers:0 Checksum:1624223678 SecNum:32 Selection:0 _:[0 0 0]}", + }, + 155: testpoint{ + name: ".file", + ok: false, + err: "incorrect symbol storage class", + }, + } + + // The testdata PE object file below was selected from a release + // build from https://github.com/mstorsjo/llvm-mingw/releases; it + // corresponds to the mingw "crt2.o" object. The object itself was + // built using an x86_64 HOST=linux TARGET=windows clang cross + // compiler based on LLVM 13. More build details can be found at + // https://github.com/mstorsjo/llvm-mingw/releases. + f, err := Open("testdata/llvm-mingw-20211002-msvcrt-x86_64-crt2") + if err != nil { + t.Errorf("open failed with %v", err) + } + defer f.Close() + for k := range f.COFFSymbols { + tp, ok := testpoints[k] + if !ok { + continue + } + sym := &f.COFFSymbols[k] + if sym.NumberOfAuxSymbols == 0 { + t.Errorf("expected aux symbols for sym %d", k) + continue + } + name, nerr := sym.FullName(f.StringTable) + if nerr != nil { + t.Errorf("FullName(%d) failed with %v", k, nerr) + continue + } + if name != tp.name { + t.Errorf("name check for %d, got %s want %s", k, name, tp.name) + continue + } + ap, err := f.COFFSymbolReadSectionDefAux(k) + if tp.ok { + if err != nil { + t.Errorf("unexpected failure on %d, got error %v", k, err) + continue + } + got := fmt.Sprintf("%+v", *ap) + if got != tp.auxstr { + t.Errorf("COFFSymbolReadSectionDefAux on %d bad return, got:\n%s\nwant:\n%s\n", k, got, tp.auxstr) + continue + } + } else { + if err == nil { + t.Errorf("unexpected non-failure on %d", k) + continue + } + got := fmt.Sprintf("%v", err) + if got != tp.err { + t.Errorf("COFFSymbolReadSectionDefAux %d wrong error, got %q want %q", k, got, tp.err) + continue + } + } + } +} diff --git a/go/src/debug/pe/testdata/gcc-386-mingw-exec b/go/src/debug/pe/testdata/gcc-386-mingw-exec new file mode 100644 index 0000000000000000000000000000000000000000..4b808d043200a8cc10fb5038fe51b70ad6630765 Binary files /dev/null and b/go/src/debug/pe/testdata/gcc-386-mingw-exec differ diff --git a/go/src/debug/pe/testdata/gcc-386-mingw-no-symbols-exec b/go/src/debug/pe/testdata/gcc-386-mingw-no-symbols-exec new file mode 100644 index 0000000000000000000000000000000000000000..329dca60b91ad5e23a0522dfd7dd9b33a8b30349 Binary files /dev/null and b/go/src/debug/pe/testdata/gcc-386-mingw-no-symbols-exec differ diff --git a/go/src/debug/pe/testdata/gcc-386-mingw-obj b/go/src/debug/pe/testdata/gcc-386-mingw-obj new file mode 100644 index 0000000000000000000000000000000000000000..0c84d898d5eee045c703a500883f97d0bdee113c Binary files /dev/null and b/go/src/debug/pe/testdata/gcc-386-mingw-obj differ diff --git a/go/src/debug/pe/testdata/gcc-amd64-mingw-obj b/go/src/debug/pe/testdata/gcc-amd64-mingw-obj new file mode 100644 index 0000000000000000000000000000000000000000..48ae7921f33e4ace83da05688ca7f0c09d8df1f8 Binary files /dev/null and b/go/src/debug/pe/testdata/gcc-amd64-mingw-obj differ diff --git a/go/src/debug/pe/testdata/hello.c b/go/src/debug/pe/testdata/hello.c new file mode 100644 index 0000000000000000000000000000000000000000..a689d3644e1e95d9d9cb1f013be6430d90dab71c --- /dev/null +++ b/go/src/debug/pe/testdata/hello.c @@ -0,0 +1,8 @@ +#include + +int +main(void) +{ + printf("hello, world\n"); + return 0; +} diff --git a/go/src/debug/pe/testdata/llvm-mingw-20211002-msvcrt-x86_64-crt2 b/go/src/debug/pe/testdata/llvm-mingw-20211002-msvcrt-x86_64-crt2 new file mode 100644 index 0000000000000000000000000000000000000000..5576c1c49e5f24e9fa45e9e9ada6dfbbff88c831 Binary files /dev/null and b/go/src/debug/pe/testdata/llvm-mingw-20211002-msvcrt-x86_64-crt2 differ diff --git a/go/src/debug/pe/testdata/vmlinuz-4.15.0-47-generic b/go/src/debug/pe/testdata/vmlinuz-4.15.0-47-generic new file mode 100644 index 0000000000000000000000000000000000000000..d01cf61d05ffdf2735fe5aac7bf8d94930e680bf Binary files /dev/null and b/go/src/debug/pe/testdata/vmlinuz-4.15.0-47-generic differ diff --git a/go/src/debug/plan9obj/file.go b/go/src/debug/plan9obj/file.go new file mode 100644 index 0000000000000000000000000000000000000000..0880c3cc182003e16b0ff00df3a8bbb714dbc1c8 --- /dev/null +++ b/go/src/debug/plan9obj/file.go @@ -0,0 +1,340 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/* +Package plan9obj implements access to Plan 9 a.out object files. + +# Security + +This package is not designed to be hardened against adversarial inputs, and is +outside the scope of https://go.dev/security/policy. In particular, only basic +validation is done when parsing object files. As such, care should be taken when +parsing untrusted inputs, as parsing malformed files may consume significant +resources, or cause panics. +*/ +package plan9obj + +import ( + "encoding/binary" + "errors" + "fmt" + "internal/saferio" + "io" + "os" +) + +// A FileHeader represents a Plan 9 a.out file header. +type FileHeader struct { + Magic uint32 + Bss uint32 + Entry uint64 + PtrSize int + LoadAddress uint64 + HdrSize uint64 +} + +// A File represents an open Plan 9 a.out file. +type File struct { + FileHeader + Sections []*Section + closer io.Closer +} + +// A SectionHeader represents a single Plan 9 a.out section header. +// This structure doesn't exist on-disk, but eases navigation +// through the object file. +type SectionHeader struct { + Name string + Size uint32 + Offset uint32 +} + +// A Section represents a single section in a Plan 9 a.out file. +type Section struct { + SectionHeader + + // Embed ReaderAt for ReadAt method. + // Do not embed SectionReader directly + // to avoid having Read and Seek. + // If a client wants Read and Seek it must use + // Open() to avoid fighting over the seek offset + // with other clients. + io.ReaderAt + sr *io.SectionReader +} + +// Data reads and returns the contents of the Plan 9 a.out section. +func (s *Section) Data() ([]byte, error) { + return saferio.ReadDataAt(s.sr, uint64(s.Size), 0) +} + +// Open returns a new ReadSeeker reading the Plan 9 a.out section. +func (s *Section) Open() io.ReadSeeker { return io.NewSectionReader(s.sr, 0, 1<<63-1) } + +// A Symbol represents an entry in a Plan 9 a.out symbol table section. +type Sym struct { + Value uint64 + Type rune + Name string +} + +/* + * Plan 9 a.out reader + */ + +// formatError is returned by some operations if the data does +// not have the correct format for an object file. +type formatError struct { + off int + msg string + val any +} + +func (e *formatError) Error() string { + msg := e.msg + if e.val != nil { + msg += fmt.Sprintf(" '%v'", e.val) + } + msg += fmt.Sprintf(" in record at byte %#x", e.off) + return msg +} + +// Open opens the named file using [os.Open] and prepares it for use as a Plan 9 a.out binary. +func Open(name string) (*File, error) { + f, err := os.Open(name) + if err != nil { + return nil, err + } + ff, err := NewFile(f) + if err != nil { + f.Close() + return nil, err + } + ff.closer = f + return ff, nil +} + +// Close closes the [File]. +// If the [File] was created using [NewFile] directly instead of [Open], +// Close has no effect. +func (f *File) Close() error { + var err error + if f.closer != nil { + err = f.closer.Close() + f.closer = nil + } + return err +} + +func parseMagic(magic []byte) (uint32, error) { + m := binary.BigEndian.Uint32(magic) + switch m { + case Magic386, MagicAMD64, MagicARM: + return m, nil + } + return 0, &formatError{0, "bad magic number", magic} +} + +// NewFile creates a new [File] for accessing a Plan 9 binary in an underlying reader. +// The Plan 9 binary is expected to start at position 0 in the ReaderAt. +func NewFile(r io.ReaderAt) (*File, error) { + sr := io.NewSectionReader(r, 0, 1<<63-1) + // Read and decode Plan 9 magic + var magic [4]byte + if _, err := r.ReadAt(magic[:], 0); err != nil { + return nil, err + } + _, err := parseMagic(magic[:]) + if err != nil { + return nil, err + } + + ph := new(prog) + if err := binary.Read(sr, binary.BigEndian, ph); err != nil { + return nil, err + } + + f := &File{FileHeader: FileHeader{ + Magic: ph.Magic, + Bss: ph.Bss, + Entry: uint64(ph.Entry), + PtrSize: 4, + LoadAddress: 0x1000, + HdrSize: 4 * 8, + }} + + if ph.Magic&Magic64 != 0 { + if err := binary.Read(sr, binary.BigEndian, &f.Entry); err != nil { + return nil, err + } + f.PtrSize = 8 + f.LoadAddress = 0x200000 + f.HdrSize += 8 + } + + var sects = []struct { + name string + size uint32 + }{ + {"text", ph.Text}, + {"data", ph.Data}, + {"syms", ph.Syms}, + {"spsz", ph.Spsz}, + {"pcsz", ph.Pcsz}, + } + + f.Sections = make([]*Section, 5) + + off := uint32(f.HdrSize) + + for i, sect := range sects { + s := new(Section) + s.SectionHeader = SectionHeader{ + Name: sect.name, + Size: sect.size, + Offset: off, + } + off += sect.size + s.sr = io.NewSectionReader(r, int64(s.Offset), int64(s.Size)) + s.ReaderAt = s.sr + f.Sections[i] = s + } + + return f, nil +} + +func walksymtab(data []byte, ptrsz int, fn func(sym) error) error { + var order binary.ByteOrder = binary.BigEndian + var s sym + p := data + for len(p) >= 4 { + // Symbol type, value. + if len(p) < ptrsz { + return &formatError{len(data), "unexpected EOF", nil} + } + // fixed-width value + if ptrsz == 8 { + s.value = order.Uint64(p[0:8]) + p = p[8:] + } else { + s.value = uint64(order.Uint32(p[0:4])) + p = p[4:] + } + + if len(p) < 1 { + return &formatError{len(data), "unexpected EOF", nil} + } + typ := p[0] & 0x7F + s.typ = typ + p = p[1:] + + // Name. + var i int + var nnul int + for i = 0; i < len(p); i++ { + if p[i] == 0 { + nnul = 1 + break + } + } + switch typ { + case 'z', 'Z': + p = p[i+nnul:] + for i = 0; i+2 <= len(p); i += 2 { + if p[i] == 0 && p[i+1] == 0 { + nnul = 2 + break + } + } + } + if len(p) < i+nnul { + return &formatError{len(data), "unexpected EOF", nil} + } + s.name = p[0:i] + i += nnul + p = p[i:] + + fn(s) + } + return nil +} + +// newTable decodes the Go symbol table in data, +// returning an in-memory representation. +func newTable(symtab []byte, ptrsz int) ([]Sym, error) { + var n int + err := walksymtab(symtab, ptrsz, func(s sym) error { + n++ + return nil + }) + if err != nil { + return nil, err + } + + fname := make(map[uint16]string) + syms := make([]Sym, 0, n) + err = walksymtab(symtab, ptrsz, func(s sym) error { + n := len(syms) + syms = syms[0 : n+1] + ts := &syms[n] + ts.Type = rune(s.typ) + ts.Value = s.value + switch s.typ { + default: + ts.Name = string(s.name) + case 'z', 'Z': + for i := 0; i < len(s.name); i += 2 { + eltIdx := binary.BigEndian.Uint16(s.name[i : i+2]) + elt, ok := fname[eltIdx] + if !ok { + return &formatError{-1, "bad filename code", eltIdx} + } + if n := len(ts.Name); n > 0 && ts.Name[n-1] != '/' { + ts.Name += "/" + } + ts.Name += elt + } + } + switch s.typ { + case 'f': + fname[uint16(s.value)] = ts.Name + } + return nil + }) + if err != nil { + return nil, err + } + + return syms, nil +} + +// ErrNoSymbols is returned by [File.Symbols] if there is no such section +// in the File. +var ErrNoSymbols = errors.New("no symbol section") + +// Symbols returns the symbol table for f. +func (f *File) Symbols() ([]Sym, error) { + symtabSection := f.Section("syms") + if symtabSection == nil { + return nil, ErrNoSymbols + } + + symtab, err := symtabSection.Data() + if err != nil { + return nil, errors.New("cannot load symbol section") + } + + return newTable(symtab, f.PtrSize) +} + +// Section returns a section with the given name, or nil if no such +// section exists. +func (f *File) Section(name string) *Section { + for _, s := range f.Sections { + if s.Name == name { + return s + } + } + return nil +} diff --git a/go/src/debug/plan9obj/file_test.go b/go/src/debug/plan9obj/file_test.go new file mode 100644 index 0000000000000000000000000000000000000000..7e107bca2f52d85a340d7e5b908a95c99fab1ed3 --- /dev/null +++ b/go/src/debug/plan9obj/file_test.go @@ -0,0 +1,81 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package plan9obj + +import ( + "reflect" + "testing" +) + +type fileTest struct { + file string + hdr FileHeader + sections []*SectionHeader +} + +var fileTests = []fileTest{ + { + "testdata/386-plan9-exec", + FileHeader{Magic386, 0x324, 0x14, 4, 0x1000, 32}, + []*SectionHeader{ + {"text", 0x4c5f, 0x20}, + {"data", 0x94c, 0x4c7f}, + {"syms", 0x2c2b, 0x55cb}, + {"spsz", 0x0, 0x81f6}, + {"pcsz", 0xf7a, 0x81f6}, + }, + }, + { + "testdata/amd64-plan9-exec", + FileHeader{MagicAMD64, 0x618, 0x13, 8, 0x200000, 40}, + []*SectionHeader{ + {"text", 0x4213, 0x28}, + {"data", 0xa80, 0x423b}, + {"syms", 0x2c8c, 0x4cbb}, + {"spsz", 0x0, 0x7947}, + {"pcsz", 0xca0, 0x7947}, + }, + }, +} + +func TestOpen(t *testing.T) { + for i := range fileTests { + tt := &fileTests[i] + + f, err := Open(tt.file) + if err != nil { + t.Error(err) + continue + } + if !reflect.DeepEqual(f.FileHeader, tt.hdr) { + t.Errorf("open %s:\n\thave %#v\n\twant %#v\n", tt.file, f.FileHeader, tt.hdr) + continue + } + + for i, sh := range f.Sections { + if i >= len(tt.sections) { + break + } + have := &sh.SectionHeader + want := tt.sections[i] + if !reflect.DeepEqual(have, want) { + t.Errorf("open %s, section %d:\n\thave %#v\n\twant %#v\n", tt.file, i, have, want) + } + } + tn := len(tt.sections) + fn := len(f.Sections) + if tn != fn { + t.Errorf("open %s: len(Sections) = %d, want %d", tt.file, fn, tn) + } + } +} + +func TestOpenFailure(t *testing.T) { + filename := "file.go" // not a Plan 9 a.out file + _, err := Open(filename) // don't crash + if err == nil { + t.Errorf("open %s: succeeded unexpectedly", filename) + } +} diff --git a/go/src/debug/plan9obj/plan9obj.go b/go/src/debug/plan9obj/plan9obj.go new file mode 100644 index 0000000000000000000000000000000000000000..7a194514c2c7194364cab05c6c7b7cdfe212bc49 --- /dev/null +++ b/go/src/debug/plan9obj/plan9obj.go @@ -0,0 +1,36 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/* + * Plan 9 a.out constants and data structures + */ + +package plan9obj + +// Plan 9 Program header. +type prog struct { + Magic uint32 /* magic number */ + Text uint32 /* size of text segment */ + Data uint32 /* size of initialized data */ + Bss uint32 /* size of uninitialized data */ + Syms uint32 /* size of symbol table */ + Entry uint32 /* entry point */ + Spsz uint32 /* size of pc/sp offset table */ + Pcsz uint32 /* size of pc/line number table */ +} + +// Plan 9 symbol table entries. +type sym struct { + value uint64 + typ byte + name []byte +} + +const ( + Magic64 = 0x8000 // 64-bit expanded header + + Magic386 = (4*11+0)*11 + 7 + MagicAMD64 = (4*26+0)*26 + 7 + Magic64 + MagicARM = (4*20+0)*20 + 7 +) diff --git a/go/src/debug/plan9obj/testdata/386-plan9-exec b/go/src/debug/plan9obj/testdata/386-plan9-exec new file mode 100644 index 0000000000000000000000000000000000000000..748e83f8e6acc310edc5081a27d989c63f0eb2de Binary files /dev/null and b/go/src/debug/plan9obj/testdata/386-plan9-exec differ diff --git a/go/src/debug/plan9obj/testdata/amd64-plan9-exec b/go/src/debug/plan9obj/testdata/amd64-plan9-exec new file mode 100644 index 0000000000000000000000000000000000000000..3e257dd8ffc00ca4a19d9552a10d782134387e8b Binary files /dev/null and b/go/src/debug/plan9obj/testdata/amd64-plan9-exec differ diff --git a/go/src/debug/plan9obj/testdata/hello.c b/go/src/debug/plan9obj/testdata/hello.c new file mode 100644 index 0000000000000000000000000000000000000000..c0d633e29f0b18b13d966f28fd9ed37718a2148f --- /dev/null +++ b/go/src/debug/plan9obj/testdata/hello.c @@ -0,0 +1,8 @@ +#include +#include + +void +main(void) +{ + print("hello, world\n"); +} diff --git a/go/src/embed/internal/embedtest/concurrency.txt b/go/src/embed/internal/embedtest/concurrency.txt new file mode 100644 index 0000000000000000000000000000000000000000..0814741261d576542facfc0b20e8fdf0da26714a --- /dev/null +++ b/go/src/embed/internal/embedtest/concurrency.txt @@ -0,0 +1 @@ +Concurrency is not parallelism. diff --git a/go/src/embed/internal/embedtest/embed_test.go b/go/src/embed/internal/embedtest/embed_test.go new file mode 100644 index 0000000000000000000000000000000000000000..875265556f09403267319da864f4e61845ffe340 --- /dev/null +++ b/go/src/embed/internal/embedtest/embed_test.go @@ -0,0 +1,251 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package embedtest + +import ( + "embed" + "io" + "reflect" + "slices" + "testing" + "testing/fstest" +) + +//go:embed testdata/h*.txt +//go:embed c*.txt testdata/g*.txt +var global embed.FS + +//go:embed c*txt +var concurrency string + +//go:embed testdata/g*.txt +var glass []byte + +func testFiles(t *testing.T, f embed.FS, name, data string) { + t.Helper() + d, err := f.ReadFile(name) + if err != nil { + t.Error(err) + return + } + if string(d) != data { + t.Errorf("read %v = %q, want %q", name, d, data) + } +} + +func testString(t *testing.T, s, name, data string) { + t.Helper() + if s != data { + t.Errorf("%v = %q, want %q", name, s, data) + } +} + +func testDir(t *testing.T, f embed.FS, name string, expect ...string) { + t.Helper() + dirs, err := f.ReadDir(name) + if err != nil { + t.Error(err) + return + } + var names []string + for _, d := range dirs { + name := d.Name() + if d.IsDir() { + name += "/" + } + names = append(names, name) + } + if !slices.Equal(names, expect) { + t.Errorf("readdir %v = %v, want %v", name, names, expect) + } +} + +// Tests for issue 49514. +var _ = '"' +var _ = '\'' +var _ = '🦆' + +func TestGlobal(t *testing.T) { + testFiles(t, global, "concurrency.txt", "Concurrency is not parallelism.\n") + testFiles(t, global, "testdata/hello.txt", "hello, world\n") + testFiles(t, global, "testdata/glass.txt", "I can eat glass and it doesn't hurt me.\n") + + if err := fstest.TestFS(global, "concurrency.txt", "testdata/hello.txt"); err != nil { + t.Fatal(err) + } + + testString(t, concurrency, "concurrency", "Concurrency is not parallelism.\n") + testString(t, string(glass), "glass", "I can eat glass and it doesn't hurt me.\n") +} + +//go:embed testdata +var testDirAll embed.FS + +func TestDir(t *testing.T) { + all := testDirAll + testFiles(t, all, "testdata/hello.txt", "hello, world\n") + testFiles(t, all, "testdata/i/i18n.txt", "internationalization\n") + testFiles(t, all, "testdata/i/j/k/k8s.txt", "kubernetes\n") + testFiles(t, all, "testdata/ken.txt", "If a program is too slow, it must have a loop.\n") + + testDir(t, all, ".", "testdata/") + testDir(t, all, "testdata/i", "i18n.txt", "j/") + testDir(t, all, "testdata/i/j", "k/") + testDir(t, all, "testdata/i/j/k", "k8s.txt") +} + +var ( + //go:embed testdata + testHiddenDir embed.FS + + //go:embed testdata/* + testHiddenStar embed.FS +) + +func TestHidden(t *testing.T) { + dir := testHiddenDir + star := testHiddenStar + + t.Logf("//go:embed testdata") + + testDir(t, dir, "testdata", + "-not-hidden/", "ascii.txt", "glass.txt", "hello.txt", "i/", "ken.txt") + + t.Logf("//go:embed testdata/*") + + testDir(t, star, "testdata", + "-not-hidden/", ".hidden/", "_hidden/", "ascii.txt", "glass.txt", "hello.txt", "i/", "ken.txt") + + testDir(t, star, "testdata/.hidden", + "fortune.txt", "more/") // but not .more or _more +} + +func TestUninitialized(t *testing.T) { + var uninitialized embed.FS + testDir(t, uninitialized, ".") + f, err := uninitialized.Open(".") + if err != nil { + t.Fatal(err) + } + defer f.Close() + fi, err := f.Stat() + if err != nil { + t.Fatal(err) + } + if !fi.IsDir() { + t.Errorf("in uninitialized embed.FS, . is not a directory") + } +} + +var ( + //go:embed "testdata/hello.txt" + helloT []T + //go:embed "testdata/hello.txt" + helloUint8 []uint8 + //go:embed "testdata/hello.txt" + helloEUint8 []EmbedUint8 + //go:embed "testdata/hello.txt" + helloBytes EmbedBytes + //go:embed "testdata/hello.txt" + helloString EmbedString +) + +type T byte +type EmbedUint8 uint8 +type EmbedBytes []byte +type EmbedString string + +// golang.org/issue/47735 +func TestAliases(t *testing.T) { + all := testDirAll + want, e := all.ReadFile("testdata/hello.txt") + if e != nil { + t.Fatal("ReadFile:", e) + } + check := func(g any) { + got := reflect.ValueOf(g) + for i := 0; i < got.Len(); i++ { + if byte(got.Index(i).Uint()) != want[i] { + t.Fatalf("got %v want %v", got.Bytes(), want) + } + } + } + check(helloT) + check(helloUint8) + check(helloEUint8) + check(helloBytes) + check(helloString) +} + +func TestOffset(t *testing.T) { + file, err := testDirAll.Open("testdata/hello.txt") + if err != nil { + t.Fatal("Open:", err) + } + + want := "hello, world\n" + + // Read the entire file. + got := make([]byte, len(want)) + n, err := file.Read(got) + if err != nil { + t.Fatal("Read:", err) + } + if n != len(want) { + t.Fatal("Read:", n) + } + if string(got) != want { + t.Fatalf("Read: %q", got) + } + + // Try to read one byte; confirm we're at the EOF. + var buf [1]byte + n, err = file.Read(buf[:]) + if err != io.EOF { + t.Fatal("Read:", err) + } + if n != 0 { + t.Fatal("Read:", n) + } + + // Use seek to get the offset at the EOF. + seeker := file.(io.Seeker) + off, err := seeker.Seek(0, io.SeekCurrent) + if err != nil { + t.Fatal("Seek:", err) + } + if off != int64(len(want)) { + t.Fatal("Seek:", off) + } + + // Use ReadAt to read the entire file, ignoring the offset. + at := file.(io.ReaderAt) + got = make([]byte, len(want)) + n, err = at.ReadAt(got, 0) + if err != nil { + t.Fatal("ReadAt:", err) + } + if n != len(want) { + t.Fatalf("ReadAt: got %d bytes, want %d bytes", n, len(want)) + } + if string(got) != want { + t.Fatalf("ReadAt: got %q, want %q", got, want) + } + + // Use ReadAt with non-zero offset. + off = int64(7) + want = want[off:] + got = make([]byte, len(want)) + n, err = at.ReadAt(got, off) + if err != nil { + t.Fatal("ReadAt:", err) + } + if n != len(want) { + t.Fatalf("ReadAt: got %d bytes, want %d bytes", n, len(want)) + } + if string(got) != want { + t.Fatalf("ReadAt: got %q, want %q", got, want) + } +} diff --git a/go/src/embed/internal/embedtest/embedx_test.go b/go/src/embed/internal/embedtest/embedx_test.go new file mode 100644 index 0000000000000000000000000000000000000000..27fa11614e9268ea19149cb5c4cabd9faa374407 --- /dev/null +++ b/go/src/embed/internal/embedtest/embedx_test.go @@ -0,0 +1,92 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package embedtest_test + +import ( + "embed" + "os" + "testing" +) + +var ( + global2 = global + concurrency2 = concurrency + glass2 = glass + sbig2 = sbig + bbig2 = bbig +) + +//go:embed testdata/*.txt +var global embed.FS + +//go:embed c*txt +var concurrency string + +//go:embed testdata/g*.txt +var glass []byte + +//go:embed testdata/ascii.txt +var sbig string + +//go:embed testdata/ascii.txt +var bbig []byte + +func testFiles(t *testing.T, f embed.FS, name, data string) { + t.Helper() + d, err := f.ReadFile(name) + if err != nil { + t.Error(err) + return + } + if string(d) != data { + t.Errorf("read %v = %q, want %q", name, d, data) + } +} + +func testString(t *testing.T, s, name, data string) { + t.Helper() + if s != data { + t.Errorf("%v = %q, want %q", name, s, data) + } +} + +func TestXGlobal(t *testing.T) { + testFiles(t, global, "testdata/hello.txt", "hello, world\n") + testString(t, concurrency, "concurrency", "Concurrency is not parallelism.\n") + testString(t, string(glass), "glass", "I can eat glass and it doesn't hurt me.\n") + testString(t, concurrency2, "concurrency2", "Concurrency is not parallelism.\n") + testString(t, string(glass2), "glass2", "I can eat glass and it doesn't hurt me.\n") + + big, err := os.ReadFile("testdata/ascii.txt") + if err != nil { + t.Fatal(err) + } + testString(t, sbig, "sbig", string(big)) + testString(t, sbig2, "sbig2", string(big)) + testString(t, string(bbig), "bbig", string(big)) + testString(t, string(bbig2), "bbig", string(big)) + + if t.Failed() { + return + } + + // Could check &glass[0] == &glass2[0] but also want to make sure write does not fault + // (data must not be in read-only memory). + old := glass[0] + glass[0]++ + if glass2[0] != glass[0] { + t.Fatalf("glass and glass2 do not share storage") + } + glass[0] = old + + // Could check &bbig[0] == &bbig2[0] but also want to make sure write does not fault + // (data must not be in read-only memory). + old = bbig[0] + bbig[0]++ + if bbig2[0] != bbig[0] { + t.Fatalf("bbig and bbig2 do not share storage") + } + bbig[0] = old +} diff --git a/go/src/embed/internal/embedtest/testdata/-not-hidden/fortune.txt b/go/src/embed/internal/embedtest/testdata/-not-hidden/fortune.txt new file mode 100644 index 0000000000000000000000000000000000000000..31f2013f94a1193bd1aa2687010b599515cca761 --- /dev/null +++ b/go/src/embed/internal/embedtest/testdata/-not-hidden/fortune.txt @@ -0,0 +1,2 @@ +WARNING: terminal is not fully functional + - (press RETURN) diff --git a/go/src/embed/internal/embedtest/testdata/.hidden/.more/tip.txt b/go/src/embed/internal/embedtest/testdata/.hidden/.more/tip.txt new file mode 100644 index 0000000000000000000000000000000000000000..71b9c6955de1609e4b70e058dadeb53aab79292b --- /dev/null +++ b/go/src/embed/internal/embedtest/testdata/.hidden/.more/tip.txt @@ -0,0 +1 @@ +#define struct union /* Great space saver */ diff --git a/go/src/embed/internal/embedtest/testdata/.hidden/_more/tip.txt b/go/src/embed/internal/embedtest/testdata/.hidden/_more/tip.txt new file mode 100644 index 0000000000000000000000000000000000000000..71b9c6955de1609e4b70e058dadeb53aab79292b --- /dev/null +++ b/go/src/embed/internal/embedtest/testdata/.hidden/_more/tip.txt @@ -0,0 +1 @@ +#define struct union /* Great space saver */ diff --git a/go/src/embed/internal/embedtest/testdata/.hidden/fortune.txt b/go/src/embed/internal/embedtest/testdata/.hidden/fortune.txt new file mode 100644 index 0000000000000000000000000000000000000000..31f2013f94a1193bd1aa2687010b599515cca761 --- /dev/null +++ b/go/src/embed/internal/embedtest/testdata/.hidden/fortune.txt @@ -0,0 +1,2 @@ +WARNING: terminal is not fully functional + - (press RETURN) diff --git a/go/src/embed/internal/embedtest/testdata/.hidden/more/tip.txt b/go/src/embed/internal/embedtest/testdata/.hidden/more/tip.txt new file mode 100644 index 0000000000000000000000000000000000000000..71b9c6955de1609e4b70e058dadeb53aab79292b --- /dev/null +++ b/go/src/embed/internal/embedtest/testdata/.hidden/more/tip.txt @@ -0,0 +1 @@ +#define struct union /* Great space saver */ diff --git a/go/src/embed/internal/embedtest/testdata/_hidden/fortune.txt b/go/src/embed/internal/embedtest/testdata/_hidden/fortune.txt new file mode 100644 index 0000000000000000000000000000000000000000..31f2013f94a1193bd1aa2687010b599515cca761 --- /dev/null +++ b/go/src/embed/internal/embedtest/testdata/_hidden/fortune.txt @@ -0,0 +1,2 @@ +WARNING: terminal is not fully functional + - (press RETURN) diff --git a/go/src/embed/internal/embedtest/testdata/ascii.txt b/go/src/embed/internal/embedtest/testdata/ascii.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfebf6e9cd121d047aa2e4d91f141ce31f7d953 --- /dev/null +++ b/go/src/embed/internal/embedtest/testdata/ascii.txt @@ -0,0 +1,25 @@ + !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmn +!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmno +"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnop +#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopq +$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr +%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrs +&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrst +'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstu +()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuv +)*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvw +*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwx ++,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxy +,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz +-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{ +./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{| +/0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|} +0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|} +123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|} ! +23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|} !" +3456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|} !"# +456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|} !"#$ +56789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|} !"#$% +6789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|} !"#$%& +789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|} !"#$%&' +89:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|} !"#$%&'( diff --git a/go/src/embed/internal/embedtest/testdata/glass.txt b/go/src/embed/internal/embedtest/testdata/glass.txt new file mode 100644 index 0000000000000000000000000000000000000000..8350baf43737b08d90ef98d066a386966982e8fb --- /dev/null +++ b/go/src/embed/internal/embedtest/testdata/glass.txt @@ -0,0 +1 @@ +I can eat glass and it doesn't hurt me. diff --git a/go/src/embed/internal/embedtest/testdata/hello.txt b/go/src/embed/internal/embedtest/testdata/hello.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b5fa63702dd96796042e92787f464e28f09f17d --- /dev/null +++ b/go/src/embed/internal/embedtest/testdata/hello.txt @@ -0,0 +1 @@ +hello, world diff --git a/go/src/embed/internal/embedtest/testdata/i/i18n.txt b/go/src/embed/internal/embedtest/testdata/i/i18n.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ee27c63b67f3543e18b51cbd13e51dbb1443c60 --- /dev/null +++ b/go/src/embed/internal/embedtest/testdata/i/i18n.txt @@ -0,0 +1 @@ +internationalization diff --git a/go/src/embed/internal/embedtest/testdata/i/j/k/k8s.txt b/go/src/embed/internal/embedtest/testdata/i/j/k/k8s.txt new file mode 100644 index 0000000000000000000000000000000000000000..807e21be4c0163e326c2abfb891cf34408fdbfb2 --- /dev/null +++ b/go/src/embed/internal/embedtest/testdata/i/j/k/k8s.txt @@ -0,0 +1 @@ +kubernetes diff --git a/go/src/embed/internal/embedtest/testdata/ken.txt b/go/src/embed/internal/embedtest/testdata/ken.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb2598132ef78f6d759f07d0bef854408d2b2acb --- /dev/null +++ b/go/src/embed/internal/embedtest/testdata/ken.txt @@ -0,0 +1 @@ +If a program is too slow, it must have a loop. diff --git a/go/src/encoding/json/internal/internal.go b/go/src/encoding/json/internal/internal.go new file mode 100644 index 0000000000000000000000000000000000000000..c95f83fe44091322e6d9b47a77752481c984cbc2 --- /dev/null +++ b/go/src/encoding/json/internal/internal.go @@ -0,0 +1,42 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package internal + +import "errors" + +// NotForPublicUse is a marker type that an API is for internal use only. +// It does not perfectly prevent usage of that API, but helps to restrict usage. +// Anything with this marker is not covered by the Go compatibility agreement. +type NotForPublicUse struct{} + +// AllowInternalUse is passed from "json" to "jsontext" to authenticate +// that the caller can have access to internal functionality. +var AllowInternalUse NotForPublicUse + +// Sentinel error values internally shared between jsonv1 and jsonv2. +var ( + ErrCycle = errors.New("encountered a cycle") + ErrNonNilReference = errors.New("value must be passed as a non-nil pointer reference") + ErrNilInterface = errors.New("cannot derive concrete type for nil interface with finite type set") +) + +var ( + // TransformMarshalError converts a v2 error into a v1 error. + // It is called only at the top-level of a Marshal function. + TransformMarshalError func(any, error) error + // NewMarshalerError constructs a jsonv1.MarshalerError. + // It is called after a user-defined Marshal method/function fails. + NewMarshalerError func(any, error, string) error + // TransformUnmarshalError converts a v2 error into a v1 error. + // It is called only at the top-level of a Unmarshal function. + TransformUnmarshalError func(any, error) error + + // NewRawNumber returns new(jsonv1.Number). + NewRawNumber func() any + // RawNumberOf returns jsonv1.Number(b). + RawNumberOf func(b []byte) any +) diff --git a/go/src/encoding/json/internal/jsonflags/flags.go b/go/src/encoding/json/internal/jsonflags/flags.go new file mode 100644 index 0000000000000000000000000000000000000000..a53dfe7985601d6869ef53c105a5efe291c0e024 --- /dev/null +++ b/go/src/encoding/json/internal/jsonflags/flags.go @@ -0,0 +1,215 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +// jsonflags implements all the optional boolean flags. +// These flags are shared across both "json", "jsontext", and "jsonopts". +package jsonflags + +import "encoding/json/internal" + +// Bools represents zero or more boolean flags, all set to true or false. +// The least-significant bit is the boolean value of all flags in the set. +// The remaining bits identify which particular flags. +// +// In common usage, this is OR'd with 0 or 1. For example: +// - (AllowInvalidUTF8 | 0) means "AllowInvalidUTF8 is false" +// - (Multiline | Indent | 1) means "Multiline and Indent are true" +type Bools uint64 + +func (Bools) JSONOptions(internal.NotForPublicUse) {} + +const ( + // AllFlags is the set of all flags. + AllFlags = AllCoderFlags | AllArshalV2Flags | AllArshalV1Flags + + // AllCoderFlags is the set of all encoder/decoder flags. + AllCoderFlags = (maxCoderFlag - 1) - initFlag + + // AllArshalV2Flags is the set of all v2 marshal/unmarshal flags. + AllArshalV2Flags = (maxArshalV2Flag - 1) - (maxCoderFlag - 1) + + // AllArshalV1Flags is the set of all v1 marshal/unmarshal flags. + AllArshalV1Flags = (maxArshalV1Flag - 1) - (maxArshalV2Flag - 1) + + // NonBooleanFlags is the set of non-boolean flags, + // where the value is some other concrete Go type. + // The value of the flag is stored within jsonopts.Struct. + NonBooleanFlags = 0 | + Indent | + IndentPrefix | + ByteLimit | + DepthLimit | + Marshalers | + Unmarshalers + + // DefaultV1Flags is the set of booleans flags that default to true under + // v1 semantics. None of the non-boolean flags differ between v1 and v2. + DefaultV1Flags = 0 | + AllowDuplicateNames | + AllowInvalidUTF8 | + EscapeForHTML | + EscapeForJS | + PreserveRawStrings | + Deterministic | + FormatNilMapAsNull | + FormatNilSliceAsNull | + MatchCaseInsensitiveNames | + CallMethodsWithLegacySemantics | + FormatByteArrayAsArray | + FormatBytesWithLegacySemantics | + FormatDurationAsNano | + MatchCaseSensitiveDelimiter | + MergeWithLegacySemantics | + OmitEmptyWithLegacySemantics | + ParseBytesWithLooseRFC4648 | + ParseTimeWithLooseRFC3339 | + ReportErrorsWithLegacySemantics | + StringifyWithLegacySemantics | + UnmarshalArrayFromAnyLength + + // AnyWhitespace reports whether the encoded output might have any whitespace. + AnyWhitespace = Multiline | SpaceAfterColon | SpaceAfterComma + + // WhitespaceFlags is the set of flags related to whitespace formatting. + // In contrast to AnyWhitespace, this includes Indent and IndentPrefix + // as those settings take no effect if Multiline is false. + WhitespaceFlags = AnyWhitespace | Indent | IndentPrefix + + // AnyEscape is the set of flags related to escaping in a JSON string. + AnyEscape = EscapeForHTML | EscapeForJS + + // CanonicalizeNumbers is the set of flags related to raw number canonicalization. + CanonicalizeNumbers = CanonicalizeRawInts | CanonicalizeRawFloats +) + +// Encoder and decoder flags. +const ( + initFlag Bools = 1 << iota // reserved for the boolean value itself + + AllowDuplicateNames // encode or decode + AllowInvalidUTF8 // encode or decode + WithinArshalCall // encode or decode; for internal use by json.Marshal and json.Unmarshal + OmitTopLevelNewline // encode only; for internal use by json.Marshal and json.MarshalWrite + PreserveRawStrings // encode only + CanonicalizeRawInts // encode only + CanonicalizeRawFloats // encode only + ReorderRawObjects // encode only + EscapeForHTML // encode only + EscapeForJS // encode only + Multiline // encode only + SpaceAfterColon // encode only + SpaceAfterComma // encode only + Indent // encode only; non-boolean flag + IndentPrefix // encode only; non-boolean flag + ByteLimit // encode or decode; non-boolean flag + DepthLimit // encode or decode; non-boolean flag + + maxCoderFlag +) + +// Marshal and Unmarshal flags (for v2). +const ( + _ Bools = (maxCoderFlag >> 1) << iota + + StringifyNumbers // marshal or unmarshal + Deterministic // marshal only + FormatNilMapAsNull // marshal only + FormatNilSliceAsNull // marshal only + OmitZeroStructFields // marshal only + MatchCaseInsensitiveNames // marshal or unmarshal + DiscardUnknownMembers // marshal only + RejectUnknownMembers // unmarshal only + Marshalers // marshal only; non-boolean flag + Unmarshalers // unmarshal only; non-boolean flag + + maxArshalV2Flag +) + +// Marshal and Unmarshal flags (for v1). +const ( + _ Bools = (maxArshalV2Flag >> 1) << iota + + CallMethodsWithLegacySemantics // marshal or unmarshal + FormatByteArrayAsArray // marshal or unmarshal + FormatBytesWithLegacySemantics // marshal or unmarshal + FormatDurationAsNano // marshal or unmarshal + MatchCaseSensitiveDelimiter // marshal or unmarshal + MergeWithLegacySemantics // unmarshal + OmitEmptyWithLegacySemantics // marshal + ParseBytesWithLooseRFC4648 // unmarshal + ParseTimeWithLooseRFC3339 // unmarshal + ReportErrorsWithLegacySemantics // marshal or unmarshal + StringifyWithLegacySemantics // marshal or unmarshal + StringifyBoolsAndStrings // marshal or unmarshal; for internal use by jsonv2.makeStructArshaler + UnmarshalAnyWithRawNumber // unmarshal; for internal use by jsonv1.Decoder.UseNumber + UnmarshalArrayFromAnyLength // unmarshal + + maxArshalV1Flag +) + +// bitsUsed is the number of bits used in the 64-bit boolean flags +const bitsUsed = 42 + +// Static compile check that bitsUsed and maxArshalV1Flag are in sync. +const _ = uint64((1< 0b_110_11011 + dst.Values &= ^src.Presence // e.g., 0b_1000_0011 & 0b_1010_0101 -> 0b_100_00001 + dst.Values |= src.Values // e.g., 0b_1000_0001 | 0b_1001_0010 -> 0b_100_10011 +} + +// Set sets both the presence and value for the provided bool (or set of bools). +func (fs *Flags) Set(f Bools) { + // Select out the bits for the flag identifiers (everything except LSB), + // then set the presence for all the identifier bits (using OR), + // then invert the identifier bits to clear out the values (using AND-NOT), + // then copy over all the identifier bits to the value if LSB is 1. + // e.g., fs := Flags{Presence: 0b_0101_0010, Values: 0b_0001_0010} + // e.g., f := 0b_1001_0001 + id := uint64(f) &^ uint64(1) // e.g., 0b_1001_0001 & 0b_1111_1110 -> 0b_1001_0000 + fs.Presence |= id // e.g., 0b_0101_0010 | 0b_1001_0000 -> 0b_1101_0011 + fs.Values &= ^id // e.g., 0b_0001_0010 & 0b_0110_1111 -> 0b_0000_0010 + fs.Values |= uint64(f&1) * id // e.g., 0b_0000_0010 | 0b_1001_0000 -> 0b_1001_0010 +} + +// Get reports whether the bool (or any of the bools) is true. +// This is generally only used with a singular bool. +// The value bit of f (i.e., the LSB) is ignored. +func (fs Flags) Get(f Bools) bool { + return fs.Values&uint64(f) > 0 +} + +// Has reports whether the bool (or any of the bools) is set. +// The value bit of f (i.e., the LSB) is ignored. +func (fs Flags) Has(f Bools) bool { + return fs.Presence&uint64(f) > 0 +} + +// Clear clears both the presence and value for the provided bool or bools. +// The value bit of f (i.e., the LSB) is ignored. +func (fs *Flags) Clear(f Bools) { + // Invert f to produce a mask to clear all bits in f (using AND). + // e.g., fs := Flags{Presence: 0b_0101_0010, Values: 0b_0001_0010} + // e.g., f := 0b_0001_1000 + mask := uint64(^f) // e.g., 0b_0001_1000 -> 0b_1110_0111 + fs.Presence &= mask // e.g., 0b_0101_0010 & 0b_1110_0111 -> 0b_0100_0010 + fs.Values &= mask // e.g., 0b_0001_0010 & 0b_1110_0111 -> 0b_0000_0010 +} diff --git a/go/src/encoding/json/internal/jsonflags/flags_test.go b/go/src/encoding/json/internal/jsonflags/flags_test.go new file mode 100644 index 0000000000000000000000000000000000000000..e4d3358bffdde1be078d348ccbc1de0d74e968f3 --- /dev/null +++ b/go/src/encoding/json/internal/jsonflags/flags_test.go @@ -0,0 +1,75 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsonflags + +import "testing" + +func TestFlags(t *testing.T) { + type Check struct{ want Flags } + type Join struct{ in Flags } + type Set struct{ in Bools } + type Clear struct{ in Bools } + type Get struct { + in Bools + want bool + wantOk bool + } + + calls := []any{ + Get{in: AllowDuplicateNames, want: false, wantOk: false}, + Set{in: AllowDuplicateNames | 0}, + Get{in: AllowDuplicateNames, want: false, wantOk: true}, + Set{in: AllowDuplicateNames | 1}, + Get{in: AllowDuplicateNames, want: true, wantOk: true}, + Check{want: Flags{Presence: uint64(AllowDuplicateNames), Values: uint64(AllowDuplicateNames)}}, + Get{in: AllowInvalidUTF8, want: false, wantOk: false}, + Set{in: AllowInvalidUTF8 | 1}, + Get{in: AllowInvalidUTF8, want: true, wantOk: true}, + Set{in: AllowInvalidUTF8 | 0}, + Get{in: AllowInvalidUTF8, want: false, wantOk: true}, + Get{in: AllowDuplicateNames, want: true, wantOk: true}, + Check{want: Flags{Presence: uint64(AllowDuplicateNames | AllowInvalidUTF8), Values: uint64(AllowDuplicateNames)}}, + Set{in: AllowDuplicateNames | AllowInvalidUTF8 | 0}, + Check{want: Flags{Presence: uint64(AllowDuplicateNames | AllowInvalidUTF8), Values: uint64(0)}}, + Set{in: AllowDuplicateNames | AllowInvalidUTF8 | 0}, + Check{want: Flags{Presence: uint64(AllowDuplicateNames | AllowInvalidUTF8), Values: uint64(0)}}, + Set{in: AllowDuplicateNames | AllowInvalidUTF8 | 1}, + Check{want: Flags{Presence: uint64(AllowDuplicateNames | AllowInvalidUTF8), Values: uint64(AllowDuplicateNames | AllowInvalidUTF8)}}, + Join{in: Flags{Presence: 0, Values: 0}}, + Check{want: Flags{Presence: uint64(AllowDuplicateNames | AllowInvalidUTF8), Values: uint64(AllowDuplicateNames | AllowInvalidUTF8)}}, + Join{in: Flags{Presence: uint64(Multiline | AllowInvalidUTF8), Values: uint64(AllowDuplicateNames)}}, + Check{want: Flags{Presence: uint64(Multiline | AllowDuplicateNames | AllowInvalidUTF8), Values: uint64(AllowDuplicateNames)}}, + Clear{in: AllowDuplicateNames | AllowInvalidUTF8}, + Check{want: Flags{Presence: uint64(Multiline), Values: uint64(0)}}, + Set{in: AllowInvalidUTF8 | Deterministic | ReportErrorsWithLegacySemantics | 1}, + Set{in: Multiline | StringifyNumbers | 0}, + Check{want: Flags{Presence: uint64(AllowInvalidUTF8 | Deterministic | ReportErrorsWithLegacySemantics | Multiline | StringifyNumbers), Values: uint64(AllowInvalidUTF8 | Deterministic | ReportErrorsWithLegacySemantics)}}, + Clear{in: ^AllCoderFlags}, + Check{want: Flags{Presence: uint64(AllowInvalidUTF8 | Multiline), Values: uint64(AllowInvalidUTF8)}}, + } + var fs Flags + for i, call := range calls { + switch call := call.(type) { + case Join: + fs.Join(call.in) + case Set: + fs.Set(call.in) + case Clear: + fs.Clear(call.in) + case Get: + got := fs.Get(call.in) + gotOk := fs.Has(call.in) + if got != call.want || gotOk != call.wantOk { + t.Fatalf("%d: GetOk = (%v, %v), want (%v, %v)", i, got, gotOk, call.want, call.wantOk) + } + case Check: + if fs != call.want { + t.Fatalf("%d: got %x, want %x", i, fs, call.want) + } + } + } +} diff --git a/go/src/encoding/json/internal/jsonopts/options.go b/go/src/encoding/json/internal/jsonopts/options.go new file mode 100644 index 0000000000000000000000000000000000000000..39da81b34549ec96f6e2100859a906bcf382693b --- /dev/null +++ b/go/src/encoding/json/internal/jsonopts/options.go @@ -0,0 +1,202 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsonopts + +import ( + "encoding/json/internal" + "encoding/json/internal/jsonflags" +) + +// Options is the common options type shared across json packages. +type Options interface { + // JSONOptions is exported so related json packages can implement Options. + JSONOptions(internal.NotForPublicUse) +} + +// Struct is the combination of all options in struct form. +// This is efficient to pass down the call stack and to query. +type Struct struct { + Flags jsonflags.Flags + + CoderValues + ArshalValues +} + +type CoderValues struct { + Indent string // jsonflags.Indent + IndentPrefix string // jsonflags.IndentPrefix + ByteLimit int64 // jsonflags.ByteLimit + DepthLimit int // jsonflags.DepthLimit +} + +type ArshalValues struct { + // The Marshalers and Unmarshalers fields use the any type to avoid a + // concrete dependency on *json.Marshalers and *json.Unmarshalers, + // which would in turn create a dependency on the "reflect" package. + + Marshalers any // jsonflags.Marshalers + Unmarshalers any // jsonflags.Unmarshalers + + Format string + FormatDepth int +} + +// DefaultOptionsV2 is the set of all options that define default v2 behavior. +var DefaultOptionsV2 = Struct{ + Flags: jsonflags.Flags{ + Presence: uint64(jsonflags.DefaultV1Flags), + Values: uint64(0), // all flags in DefaultV1Flags are false + }, +} + +// DefaultOptionsV1 is the set of all options that define default v1 behavior. +var DefaultOptionsV1 = Struct{ + Flags: jsonflags.Flags{ + Presence: uint64(jsonflags.DefaultV1Flags), + Values: uint64(jsonflags.DefaultV1Flags), // all flags in DefaultV1Flags are true + }, +} + +func (*Struct) JSONOptions(internal.NotForPublicUse) {} + +// GetUnknownOption is injected by the "json" package to handle Options +// declared in that package so that "jsonopts" can handle them. +var GetUnknownOption = func(Struct, Options) (any, bool) { panic("unknown option") } + +func GetOption[T any](opts Options, setter func(T) Options) (T, bool) { + // Collapse the options to *Struct to simplify lookup. + structOpts, ok := opts.(*Struct) + if !ok { + var structOpts2 Struct + structOpts2.Join(opts) + structOpts = &structOpts2 + } + + // Lookup the option based on the return value of the setter. + var zero T + switch opt := setter(zero).(type) { + case jsonflags.Bools: + v := structOpts.Flags.Get(opt) + ok := structOpts.Flags.Has(opt) + return any(v).(T), ok + case Indent: + if !structOpts.Flags.Has(jsonflags.Indent) { + return zero, false + } + return any(structOpts.Indent).(T), true + case IndentPrefix: + if !structOpts.Flags.Has(jsonflags.IndentPrefix) { + return zero, false + } + return any(structOpts.IndentPrefix).(T), true + case ByteLimit: + if !structOpts.Flags.Has(jsonflags.ByteLimit) { + return zero, false + } + return any(structOpts.ByteLimit).(T), true + case DepthLimit: + if !structOpts.Flags.Has(jsonflags.DepthLimit) { + return zero, false + } + return any(structOpts.DepthLimit).(T), true + default: + v, ok := GetUnknownOption(*structOpts, opt) + return v.(T), ok + } +} + +// JoinUnknownOption is injected by the "json" package to handle Options +// declared in that package so that "jsonopts" can handle them. +var JoinUnknownOption = func(Struct, Options) Struct { panic("unknown option") } + +func (dst *Struct) Join(srcs ...Options) { + dst.join(false, srcs...) +} + +func (dst *Struct) JoinWithoutCoderOptions(srcs ...Options) { + dst.join(true, srcs...) +} + +func (dst *Struct) join(excludeCoderOptions bool, srcs ...Options) { + for _, src := range srcs { + switch src := src.(type) { + case nil: + continue + case jsonflags.Bools: + if excludeCoderOptions { + src &= ^jsonflags.AllCoderFlags + } + dst.Flags.Set(src) + case Indent: + if excludeCoderOptions { + continue + } + dst.Flags.Set(jsonflags.Multiline | jsonflags.Indent | 1) + dst.Indent = string(src) + case IndentPrefix: + if excludeCoderOptions { + continue + } + dst.Flags.Set(jsonflags.Multiline | jsonflags.IndentPrefix | 1) + dst.IndentPrefix = string(src) + case ByteLimit: + if excludeCoderOptions { + continue + } + dst.Flags.Set(jsonflags.ByteLimit | 1) + dst.ByteLimit = int64(src) + case DepthLimit: + if excludeCoderOptions { + continue + } + dst.Flags.Set(jsonflags.DepthLimit | 1) + dst.DepthLimit = int(src) + case *Struct: + srcFlags := src.Flags // shallow copy the flags + if excludeCoderOptions { + srcFlags.Clear(jsonflags.AllCoderFlags) + } + dst.Flags.Join(srcFlags) + if srcFlags.Has(jsonflags.NonBooleanFlags) { + if srcFlags.Has(jsonflags.Indent) { + dst.Indent = src.Indent + } + if srcFlags.Has(jsonflags.IndentPrefix) { + dst.IndentPrefix = src.IndentPrefix + } + if srcFlags.Has(jsonflags.ByteLimit) { + dst.ByteLimit = src.ByteLimit + } + if srcFlags.Has(jsonflags.DepthLimit) { + dst.DepthLimit = src.DepthLimit + } + if srcFlags.Has(jsonflags.Marshalers) { + dst.Marshalers = src.Marshalers + } + if srcFlags.Has(jsonflags.Unmarshalers) { + dst.Unmarshalers = src.Unmarshalers + } + } + default: + *dst = JoinUnknownOption(*dst, src) + } + } +} + +type ( + Indent string // jsontext.WithIndent + IndentPrefix string // jsontext.WithIndentPrefix + ByteLimit int64 // jsontext.WithByteLimit + DepthLimit int // jsontext.WithDepthLimit + // type for jsonflags.Marshalers declared in "json" package + // type for jsonflags.Unmarshalers declared in "json" package +) + +func (Indent) JSONOptions(internal.NotForPublicUse) {} +func (IndentPrefix) JSONOptions(internal.NotForPublicUse) {} +func (ByteLimit) JSONOptions(internal.NotForPublicUse) {} +func (DepthLimit) JSONOptions(internal.NotForPublicUse) {} diff --git a/go/src/encoding/json/internal/jsonopts/options_test.go b/go/src/encoding/json/internal/jsonopts/options_test.go new file mode 100644 index 0000000000000000000000000000000000000000..caa686e4f0d579c9c8f70b6636bbb5cb4fc4426f --- /dev/null +++ b/go/src/encoding/json/internal/jsonopts/options_test.go @@ -0,0 +1,236 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsonopts_test + +import ( + "reflect" + "testing" + + "encoding/json/internal/jsonflags" + . "encoding/json/internal/jsonopts" + "encoding/json/jsontext" + "encoding/json/v2" +) + +func makeFlags(f ...jsonflags.Bools) (fs jsonflags.Flags) { + for _, f := range f { + fs.Set(f) + } + return fs +} + +func TestJoin(t *testing.T) { + tests := []struct { + in Options + excludeCoders bool + want *Struct + }{{ + in: jsonflags.AllowInvalidUTF8 | 1, + want: &Struct{Flags: makeFlags(jsonflags.AllowInvalidUTF8 | 1)}, + }, { + in: jsonflags.Multiline | 0, + want: &Struct{ + Flags: makeFlags(jsonflags.AllowInvalidUTF8|1, jsonflags.Multiline|0)}, + }, { + in: Indent("\t"), // implicitly sets Multiline=true + want: &Struct{ + Flags: makeFlags(jsonflags.AllowInvalidUTF8 | jsonflags.Multiline | jsonflags.Indent | 1), + CoderValues: CoderValues{Indent: "\t"}, + }, + }, { + in: &Struct{ + Flags: makeFlags(jsonflags.Multiline|jsonflags.EscapeForJS|0, jsonflags.AllowInvalidUTF8|1), + }, + want: &Struct{ + Flags: makeFlags(jsonflags.AllowInvalidUTF8|jsonflags.Indent|1, jsonflags.Multiline|jsonflags.EscapeForJS|0), + CoderValues: CoderValues{Indent: "\t"}, + }, + }, { + in: &DefaultOptionsV1, + want: func() *Struct { + v1 := DefaultOptionsV1 + v1.Flags.Set(jsonflags.Indent | 1) + v1.Flags.Set(jsonflags.Multiline | 0) + v1.Indent = "\t" + return &v1 + }(), // v1 fully replaces before (except for whitespace related flags) + }, { + in: &DefaultOptionsV2, + want: func() *Struct { + v2 := DefaultOptionsV2 + v2.Flags.Set(jsonflags.Indent | 1) + v2.Flags.Set(jsonflags.Multiline | 0) + v2.Indent = "\t" + return &v2 + }(), // v2 fully replaces before (except for whitespace related flags) + }, { + in: jsonflags.Deterministic | jsonflags.AllowInvalidUTF8 | 1, excludeCoders: true, + want: func() *Struct { + v2 := DefaultOptionsV2 + v2.Flags.Set(jsonflags.Deterministic | 1) + v2.Flags.Set(jsonflags.Indent | 1) + v2.Flags.Set(jsonflags.Multiline | 0) + v2.Indent = "\t" + return &v2 + }(), + }, { + in: jsontext.WithIndentPrefix(" "), excludeCoders: true, + want: func() *Struct { + v2 := DefaultOptionsV2 + v2.Flags.Set(jsonflags.Deterministic | 1) + v2.Flags.Set(jsonflags.Indent | 1) + v2.Flags.Set(jsonflags.Multiline | 0) + v2.Indent = "\t" + return &v2 + }(), + }, { + in: jsontext.WithIndentPrefix(" "), excludeCoders: false, + want: func() *Struct { + v2 := DefaultOptionsV2 + v2.Flags.Set(jsonflags.Deterministic | 1) + v2.Flags.Set(jsonflags.Indent | 1) + v2.Flags.Set(jsonflags.IndentPrefix | 1) + v2.Flags.Set(jsonflags.Multiline | 1) + v2.Indent = "\t" + v2.IndentPrefix = " " + return &v2 + }(), + }, { + in: &Struct{ + Flags: jsonflags.Flags{ + Presence: uint64(jsonflags.Deterministic | jsonflags.Indent | jsonflags.IndentPrefix), + Values: uint64(jsonflags.Indent | jsonflags.IndentPrefix), + }, + CoderValues: CoderValues{Indent: " ", IndentPrefix: " "}, + }, + excludeCoders: true, + want: func() *Struct { + v2 := DefaultOptionsV2 + v2.Flags.Set(jsonflags.Indent | 1) + v2.Flags.Set(jsonflags.IndentPrefix | 1) + v2.Flags.Set(jsonflags.Multiline | 1) + v2.Indent = "\t" + v2.IndentPrefix = " " + return &v2 + }(), + }, { + in: &Struct{ + Flags: jsonflags.Flags{ + Presence: uint64(jsonflags.Deterministic | jsonflags.Indent | jsonflags.IndentPrefix), + Values: uint64(jsonflags.Indent | jsonflags.IndentPrefix), + }, + CoderValues: CoderValues{Indent: " ", IndentPrefix: " "}, + }, + excludeCoders: false, + want: func() *Struct { + v2 := DefaultOptionsV2 + v2.Flags.Set(jsonflags.Indent | 1) + v2.Flags.Set(jsonflags.IndentPrefix | 1) + v2.Flags.Set(jsonflags.Multiline | 1) + v2.Indent = " " + v2.IndentPrefix = " " + return &v2 + }(), + }} + got := new(Struct) + for i, tt := range tests { + if tt.excludeCoders { + got.JoinWithoutCoderOptions(tt.in) + } else { + got.Join(tt.in) + } + if !reflect.DeepEqual(got, tt.want) { + t.Fatalf("%d: Join:\n\tgot: %+v\n\twant: %+v", i, got, tt.want) + } + } +} + +func TestGet(t *testing.T) { + opts := &Struct{ + Flags: makeFlags(jsonflags.Indent|jsonflags.Deterministic|jsonflags.Marshalers|1, jsonflags.Multiline|0), + CoderValues: CoderValues{Indent: "\t"}, + ArshalValues: ArshalValues{Marshalers: new(json.Marshalers)}, + } + if v, ok := json.GetOption(nil, jsontext.AllowDuplicateNames); v || ok { + t.Errorf("GetOption(..., AllowDuplicateNames) = (%v, %v), want (false, false)", v, ok) + } + if v, ok := json.GetOption(jsonflags.AllowInvalidUTF8|0, jsontext.AllowDuplicateNames); v || ok { + t.Errorf("GetOption(..., AllowDuplicateNames) = (%v, %v), want (false, false)", v, ok) + } + if v, ok := json.GetOption(jsonflags.AllowDuplicateNames|0, jsontext.AllowDuplicateNames); v || !ok { + t.Errorf("GetOption(..., AllowDuplicateNames) = (%v, %v), want (false, true)", v, ok) + } + if v, ok := json.GetOption(jsonflags.AllowDuplicateNames|1, jsontext.AllowDuplicateNames); !v || !ok { + t.Errorf("GetOption(..., AllowDuplicateNames) = (%v, %v), want (true, true)", v, ok) + } + if v, ok := json.GetOption(Indent(""), jsontext.AllowDuplicateNames); v || ok { + t.Errorf("GetOption(..., AllowDuplicateNames) = (%v, %v), want (false, false)", v, ok) + } + if v, ok := json.GetOption(Indent(" "), jsontext.WithIndent); v != " " || !ok { + t.Errorf(`GetOption(..., WithIndent) = (%q, %v), want (" ", true)`, v, ok) + } + if v, ok := json.GetOption(jsonflags.AllowDuplicateNames|1, jsontext.WithIndent); v != "" || ok { + t.Errorf(`GetOption(..., WithIndent) = (%q, %v), want ("", false)`, v, ok) + } + if v, ok := json.GetOption(opts, jsontext.AllowDuplicateNames); v || ok { + t.Errorf("GetOption(..., AllowDuplicateNames) = (%v, %v), want (false, false)", v, ok) + } + if v, ok := json.GetOption(opts, json.Deterministic); !v || !ok { + t.Errorf("GetOption(..., Deterministic) = (%v, %v), want (true, true)", v, ok) + } + if v, ok := json.GetOption(opts, jsontext.Multiline); v || !ok { + t.Errorf("GetOption(..., Multiline) = (%v, %v), want (false, true)", v, ok) + } + if v, ok := json.GetOption(opts, jsontext.AllowInvalidUTF8); v || ok { + t.Errorf("GetOption(..., AllowInvalidUTF8) = (%v, %v), want (false, false)", v, ok) + } + if v, ok := json.GetOption(opts, jsontext.WithIndent); v != "\t" || !ok { + t.Errorf(`GetOption(..., WithIndent) = (%q, %v), want ("\t", true)`, v, ok) + } + if v, ok := json.GetOption(opts, jsontext.WithIndentPrefix); v != "" || ok { + t.Errorf(`GetOption(..., WithIndentPrefix) = (%q, %v), want ("", false)`, v, ok) + } + if v, ok := json.GetOption(opts, json.WithMarshalers); v == nil || !ok { + t.Errorf(`GetOption(..., WithMarshalers) = (%v, %v), want (non-nil, true)`, v, ok) + } + if v, ok := json.GetOption(opts, json.WithUnmarshalers); v != nil || ok { + t.Errorf(`GetOption(..., WithUnmarshalers) = (%v, %v), want (nil, false)`, v, ok) + } + if v, ok := json.GetOption(json.DefaultOptionsV2(), json.WithMarshalers); v != nil || ok { + t.Errorf(`GetOption(..., WithMarshalers) = (%v, %v), want (nil, false)`, v, ok) + } +} + +var sink struct { + Bool bool + String string + Marshalers *json.Marshalers +} + +func BenchmarkGetBool(b *testing.B) { + b.ReportAllocs() + opts := json.DefaultOptionsV2() + for range b.N { + sink.Bool, sink.Bool = json.GetOption(opts, jsontext.AllowDuplicateNames) + } +} + +func BenchmarkGetIndent(b *testing.B) { + b.ReportAllocs() + opts := json.DefaultOptionsV2() + for range b.N { + sink.String, sink.Bool = json.GetOption(opts, jsontext.WithIndent) + } +} + +func BenchmarkGetMarshalers(b *testing.B) { + b.ReportAllocs() + opts := json.JoinOptions(json.DefaultOptionsV2(), json.WithMarshalers(nil)) + for range b.N { + sink.Marshalers, sink.Bool = json.GetOption(opts, json.WithMarshalers) + } +} diff --git a/go/src/encoding/json/internal/jsontest/testcase.go b/go/src/encoding/json/internal/jsontest/testcase.go new file mode 100644 index 0000000000000000000000000000000000000000..73a64c8cfada3bbaeed991dd7250c43bb3d728d9 --- /dev/null +++ b/go/src/encoding/json/internal/jsontest/testcase.go @@ -0,0 +1,37 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsontest + +import ( + "fmt" + "path" + "runtime" +) + +// TODO(https://go.dev/issue/52751): Replace with native testing support. + +// CaseName is a case name annotated with a file and line. +type CaseName struct { + Name string + Where CasePos +} + +// Name annotates a case name with the file and line of the caller. +func Name(s string) (c CaseName) { + c.Name = s + runtime.Callers(2, c.Where.pc[:]) + return c +} + +// CasePos represents a file and line number. +type CasePos struct{ pc [1]uintptr } + +func (pos CasePos) String() string { + frames := runtime.CallersFrames(pos.pc[:]) + frame, _ := frames.Next() + return fmt.Sprintf("%s:%d", path.Base(frame.File), frame.Line) +} diff --git a/go/src/encoding/json/internal/jsontest/testdata.go b/go/src/encoding/json/internal/jsontest/testdata.go new file mode 100644 index 0000000000000000000000000000000000000000..74de366136ce975a758f60f5af07bdebad39d252 --- /dev/null +++ b/go/src/encoding/json/internal/jsontest/testdata.go @@ -0,0 +1,607 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +// Package jsontest contains functionality to assist in testing JSON. +package jsontest + +import ( + "bytes" + "embed" + "errors" + "internal/zstd" + "io" + "io/fs" + "path" + "slices" + "strings" + "sync" + "time" +) + +// Embed the testdata directory as a fs.FS because this package is imported +// by other packages such that the location of testdata may change relative +// to the working directory of the test itself. +// +//go:embed testdata/*.json.zst +var testdataFS embed.FS + +type Entry struct { + Name string + Data func() []byte + New func() any // nil if there is no concrete type for this +} + +func mustGet[T any](v T, err error) T { + if err != nil { + panic(err) + } + return v +} + +// Data is a list of JSON testdata. +var Data = func() (entries []Entry) { + fis := mustGet(fs.ReadDir(testdataFS, "testdata")) + slices.SortFunc(fis, func(x, y fs.DirEntry) int { return strings.Compare(x.Name(), y.Name()) }) + for _, fi := range fis { + var entry Entry + + // Convert snake_case file name to CamelCase. + words := strings.Split(strings.TrimSuffix(fi.Name(), ".json.zst"), "_") + for i := range words { + words[i] = strings.Title(words[i]) + } + entry.Name = strings.Join(words, "") + + // Lazily read and decompress the test data. + entry.Data = sync.OnceValue(func() []byte { + filePath := path.Join("testdata", fi.Name()) + b := mustGet(fs.ReadFile(testdataFS, filePath)) + zr := zstd.NewReader(bytes.NewReader(b)) + return mustGet(io.ReadAll(zr)) + }) + + // Check whether there is a concrete type for this data. + switch entry.Name { + case "CanadaGeometry": + entry.New = func() any { return new(canadaRoot) } + case "CitmCatalog": + entry.New = func() any { return new(citmRoot) } + case "GolangSource": + entry.New = func() any { return new(golangRoot) } + case "StringEscaped": + entry.New = func() any { return new(stringRoot) } + case "StringUnicode": + entry.New = func() any { return new(stringRoot) } + case "SyntheaFhir": + entry.New = func() any { return new(syntheaRoot) } + case "TwitterStatus": + entry.New = func() any { return new(twitterRoot) } + } + + entries = append(entries, entry) + } + return entries +}() + +type ( + canadaRoot struct { + Type string `json:"type"` + Features []struct { + Type string `json:"type"` + Properties struct { + Name string `json:"name"` + } `json:"properties"` + Geometry struct { + Type string `json:"type"` + Coordinates [][][2]float64 `json:"coordinates"` + } `json:"geometry"` + } `json:"features"` + } +) + +type ( + citmRoot struct { + AreaNames map[int64]string `json:"areaNames"` + AudienceSubCategoryNames map[int64]string `json:"audienceSubCategoryNames"` + BlockNames map[int64]string `json:"blockNames"` + Events map[int64]struct { + Description string `json:"description"` + ID int `json:"id"` + Logo string `json:"logo"` + Name string `json:"name"` + SubTopicIds []int `json:"subTopicIds"` + SubjectCode any `json:"subjectCode"` + Subtitle any `json:"subtitle"` + TopicIds []int `json:"topicIds"` + } `json:"events"` + Performances []struct { + EventID int `json:"eventId"` + ID int `json:"id"` + Logo any `json:"logo"` + Name any `json:"name"` + Prices []struct { + Amount int `json:"amount"` + AudienceSubCategoryID int64 `json:"audienceSubCategoryId"` + SeatCategoryID int64 `json:"seatCategoryId"` + } `json:"prices"` + SeatCategories []struct { + Areas []struct { + AreaID int `json:"areaId"` + BlockIds []any `json:"blockIds"` + } `json:"areas"` + SeatCategoryID int `json:"seatCategoryId"` + } `json:"seatCategories"` + SeatMapImage any `json:"seatMapImage"` + Start int64 `json:"start"` + VenueCode string `json:"venueCode"` + } `json:"performances"` + SeatCategoryNames map[uint64]string `json:"seatCategoryNames"` + SubTopicNames map[uint64]string `json:"subTopicNames"` + SubjectNames map[uint64]string `json:"subjectNames"` + TopicNames map[uint64]string `json:"topicNames"` + TopicSubTopics map[uint64][]uint64 `json:"topicSubTopics"` + VenueNames map[string]string `json:"venueNames"` + } +) + +type ( + golangRoot struct { + Tree *golangNode `json:"tree"` + Username string `json:"username"` + } + golangNode struct { + Name string `json:"name"` + Kids []golangNode `json:"kids"` + CLWeight float64 `json:"cl_weight"` + Touches int `json:"touches"` + MinT uint64 `json:"min_t"` + MaxT uint64 `json:"max_t"` + MeanT uint64 `json:"mean_t"` + } +) + +type ( + stringRoot struct { + Arabic string `json:"Arabic"` + ArabicPresentationFormsA string `json:"Arabic Presentation Forms-A"` + ArabicPresentationFormsB string `json:"Arabic Presentation Forms-B"` + Armenian string `json:"Armenian"` + Arrows string `json:"Arrows"` + Bengali string `json:"Bengali"` + Bopomofo string `json:"Bopomofo"` + BoxDrawing string `json:"Box Drawing"` + CJKCompatibility string `json:"CJK Compatibility"` + CJKCompatibilityForms string `json:"CJK Compatibility Forms"` + CJKCompatibilityIdeographs string `json:"CJK Compatibility Ideographs"` + CJKSymbolsAndPunctuation string `json:"CJK Symbols and Punctuation"` + CJKUnifiedIdeographs string `json:"CJK Unified Ideographs"` + CJKUnifiedIdeographsExtensionA string `json:"CJK Unified Ideographs Extension A"` + CJKUnifiedIdeographsExtensionB string `json:"CJK Unified Ideographs Extension B"` + Cherokee string `json:"Cherokee"` + CurrencySymbols string `json:"Currency Symbols"` + Cyrillic string `json:"Cyrillic"` + CyrillicSupplementary string `json:"Cyrillic Supplementary"` + Devanagari string `json:"Devanagari"` + EnclosedAlphanumerics string `json:"Enclosed Alphanumerics"` + EnclosedCJKLettersAndMonths string `json:"Enclosed CJK Letters and Months"` + Ethiopic string `json:"Ethiopic"` + GeometricShapes string `json:"Geometric Shapes"` + Georgian string `json:"Georgian"` + GreekAndCoptic string `json:"Greek and Coptic"` + Gujarati string `json:"Gujarati"` + Gurmukhi string `json:"Gurmukhi"` + HangulCompatibilityJamo string `json:"Hangul Compatibility Jamo"` + HangulJamo string `json:"Hangul Jamo"` + HangulSyllables string `json:"Hangul Syllables"` + Hebrew string `json:"Hebrew"` + Hiragana string `json:"Hiragana"` + IPAExtentions string `json:"IPA Extentions"` + KangxiRadicals string `json:"Kangxi Radicals"` + Katakana string `json:"Katakana"` + Khmer string `json:"Khmer"` + KhmerSymbols string `json:"Khmer Symbols"` + Latin string `json:"Latin"` + LatinExtendedAdditional string `json:"Latin Extended Additional"` + Latin1Supplement string `json:"Latin-1 Supplement"` + LatinExtendedA string `json:"Latin-Extended A"` + LatinExtendedB string `json:"Latin-Extended B"` + LetterlikeSymbols string `json:"Letterlike Symbols"` + Malayalam string `json:"Malayalam"` + MathematicalAlphanumericSymbols string `json:"Mathematical Alphanumeric Symbols"` + MathematicalOperators string `json:"Mathematical Operators"` + MiscellaneousSymbols string `json:"Miscellaneous Symbols"` + Mongolian string `json:"Mongolian"` + NumberForms string `json:"Number Forms"` + Oriya string `json:"Oriya"` + PhoneticExtensions string `json:"Phonetic Extensions"` + SupplementalArrowsB string `json:"Supplemental Arrows-B"` + Syriac string `json:"Syriac"` + Tamil string `json:"Tamil"` + Thaana string `json:"Thaana"` + Thai string `json:"Thai"` + UnifiedCanadianAboriginalSyllabics string `json:"Unified Canadian Aboriginal Syllabics"` + YiRadicals string `json:"Yi Radicals"` + YiSyllables string `json:"Yi Syllables"` + } +) + +type ( + syntheaRoot struct { + Entry []struct { + FullURL string `json:"fullUrl"` + Request *struct { + Method string `json:"method"` + URL string `json:"url"` + } `json:"request"` + Resource *struct { + AbatementDateTime time.Time `json:"abatementDateTime"` + AchievementStatus syntheaCode `json:"achievementStatus"` + Active bool `json:"active"` + Activity []struct { + Detail *struct { + Code syntheaCode `json:"code"` + Location syntheaReference `json:"location"` + Status string `json:"status"` + } `json:"detail"` + } `json:"activity"` + Address []syntheaAddress `json:"address"` + Addresses []syntheaReference `json:"addresses"` + AuthoredOn time.Time `json:"authoredOn"` + BillablePeriod syntheaRange `json:"billablePeriod"` + BirthDate string `json:"birthDate"` + CareTeam []struct { + Provider syntheaReference `json:"provider"` + Reference string `json:"reference"` + Role syntheaCode `json:"role"` + Sequence int64 `json:"sequence"` + } `json:"careTeam"` + Category []syntheaCode `json:"category"` + Claim syntheaReference `json:"claim"` + Class syntheaCoding `json:"class"` + ClinicalStatus syntheaCode `json:"clinicalStatus"` + Code syntheaCode `json:"code"` + Communication []struct { + Language syntheaCode `json:"language"` + } `json:"communication"` + Component []struct { + Code syntheaCode `json:"code"` + ValueQuantity syntheaCoding `json:"valueQuantity"` + } `json:"component"` + Contained []struct { + Beneficiary syntheaReference `json:"beneficiary"` + ID string `json:"id"` + Intent string `json:"intent"` + Payor []syntheaReference `json:"payor"` + Performer []syntheaReference `json:"performer"` + Requester syntheaReference `json:"requester"` + ResourceType string `json:"resourceType"` + Status string `json:"status"` + Subject syntheaReference `json:"subject"` + Type syntheaCode `json:"type"` + } `json:"contained"` + Created time.Time `json:"created"` + DeceasedDateTime time.Time `json:"deceasedDateTime"` + Description syntheaCode `json:"description"` + Diagnosis []struct { + DiagnosisReference syntheaReference `json:"diagnosisReference"` + Sequence int64 `json:"sequence"` + Type []syntheaCode `json:"type"` + } `json:"diagnosis"` + DosageInstruction []struct { + AsNeededBoolean bool `json:"asNeededBoolean"` + DoseAndRate []struct { + DoseQuantity *struct { + Value float64 `json:"value"` + } `json:"doseQuantity"` + Type syntheaCode `json:"type"` + } `json:"doseAndRate"` + Sequence int64 `json:"sequence"` + Timing *struct { + Repeat *struct { + Frequency int64 `json:"frequency"` + Period float64 `json:"period"` + PeriodUnit string `json:"periodUnit"` + } `json:"repeat"` + } `json:"timing"` + } `json:"dosageInstruction"` + EffectiveDateTime time.Time `json:"effectiveDateTime"` + Encounter syntheaReference `json:"encounter"` + Extension []syntheaExtension `json:"extension"` + Gender string `json:"gender"` + Goal []syntheaReference `json:"goal"` + ID string `json:"id"` + Identifier []struct { + System string `json:"system"` + Type syntheaCode `json:"type"` + Use string `json:"use"` + Value string `json:"value"` + } `json:"identifier"` + Insurance []struct { + Coverage syntheaReference `json:"coverage"` + Focal bool `json:"focal"` + Sequence int64 `json:"sequence"` + } `json:"insurance"` + Insurer syntheaReference `json:"insurer"` + Intent string `json:"intent"` + Issued time.Time `json:"issued"` + Item []struct { + Adjudication []struct { + Amount syntheaCurrency `json:"amount"` + Category syntheaCode `json:"category"` + } `json:"adjudication"` + Category syntheaCode `json:"category"` + DiagnosisSequence []int64 `json:"diagnosisSequence"` + Encounter []syntheaReference `json:"encounter"` + InformationSequence []int64 `json:"informationSequence"` + LocationCodeableConcept syntheaCode `json:"locationCodeableConcept"` + Net syntheaCurrency `json:"net"` + ProcedureSequence []int64 `json:"procedureSequence"` + ProductOrService syntheaCode `json:"productOrService"` + Sequence int64 `json:"sequence"` + ServicedPeriod syntheaRange `json:"servicedPeriod"` + } `json:"item"` + LifecycleStatus string `json:"lifecycleStatus"` + ManagingOrganization []syntheaReference `json:"managingOrganization"` + MaritalStatus syntheaCode `json:"maritalStatus"` + MedicationCodeableConcept syntheaCode `json:"medicationCodeableConcept"` + MultipleBirthBoolean bool `json:"multipleBirthBoolean"` + Name rawValue `json:"name"` + NumberOfInstances int64 `json:"numberOfInstances"` + NumberOfSeries int64 `json:"numberOfSeries"` + OccurrenceDateTime time.Time `json:"occurrenceDateTime"` + OnsetDateTime time.Time `json:"onsetDateTime"` + Outcome string `json:"outcome"` + Participant []struct { + Individual syntheaReference `json:"individual"` + Member syntheaReference `json:"member"` + Role []syntheaCode `json:"role"` + } `json:"participant"` + Patient syntheaReference `json:"patient"` + Payment *struct { + Amount syntheaCurrency `json:"amount"` + } `json:"payment"` + PerformedPeriod syntheaRange `json:"performedPeriod"` + Period syntheaRange `json:"period"` + Prescription syntheaReference `json:"prescription"` + PrimarySource bool `json:"primarySource"` + Priority syntheaCode `json:"priority"` + Procedure []struct { + ProcedureReference syntheaReference `json:"procedureReference"` + Sequence int64 `json:"sequence"` + } `json:"procedure"` + Provider syntheaReference `json:"provider"` + ReasonCode []syntheaCode `json:"reasonCode"` + ReasonReference []syntheaReference `json:"reasonReference"` + RecordedDate time.Time `json:"recordedDate"` + Referral syntheaReference `json:"referral"` + Requester syntheaReference `json:"requester"` + ResourceType string `json:"resourceType"` + Result []syntheaReference `json:"result"` + Series []struct { + BodySite syntheaCoding `json:"bodySite"` + Instance []struct { + Number int64 `json:"number"` + SopClass syntheaCoding `json:"sopClass"` + Title string `json:"title"` + UID string `json:"uid"` + } `json:"instance"` + Modality syntheaCoding `json:"modality"` + Number int64 `json:"number"` + NumberOfInstances int64 `json:"numberOfInstances"` + Started string `json:"started"` + UID string `json:"uid"` + } `json:"series"` + ServiceProvider syntheaReference `json:"serviceProvider"` + Started time.Time `json:"started"` + Status string `json:"status"` + Subject syntheaReference `json:"subject"` + SupportingInfo []struct { + Category syntheaCode `json:"category"` + Sequence int64 `json:"sequence"` + ValueReference syntheaReference `json:"valueReference"` + } `json:"supportingInfo"` + Telecom []map[string]string `json:"telecom"` + Text map[string]string `json:"text"` + Total rawValue `json:"total"` + Type rawValue `json:"type"` + Use string `json:"use"` + VaccineCode syntheaCode `json:"vaccineCode"` + ValueCodeableConcept syntheaCode `json:"valueCodeableConcept"` + ValueQuantity syntheaCoding `json:"valueQuantity"` + VerificationStatus syntheaCode `json:"verificationStatus"` + } `json:"resource"` + } `json:"entry"` + ResourceType string `json:"resourceType"` + Type string `json:"type"` + } + syntheaCode struct { + Coding []syntheaCoding `json:"coding"` + Text string `json:"text"` + } + syntheaCoding struct { + Code string `json:"code"` + Display string `json:"display"` + System string `json:"system"` + Unit string `json:"unit"` + Value float64 `json:"value"` + } + syntheaReference struct { + Display string `json:"display"` + Reference string `json:"reference"` + } + syntheaAddress struct { + City string `json:"city"` + Country string `json:"country"` + Extension []syntheaExtension `json:"extension"` + Line []string `json:"line"` + PostalCode string `json:"postalCode"` + State string `json:"state"` + } + syntheaExtension struct { + URL string `json:"url"` + ValueAddress syntheaAddress `json:"valueAddress"` + ValueCode string `json:"valueCode"` + ValueDecimal float64 `json:"valueDecimal"` + ValueString string `json:"valueString"` + Extension []syntheaExtension `json:"extension"` + } + syntheaRange struct { + End time.Time `json:"end"` + Start time.Time `json:"start"` + } + syntheaCurrency struct { + Currency string `json:"currency"` + Value float64 `json:"value"` + } +) + +type ( + twitterRoot struct { + Statuses []twitterStatus `json:"statuses"` + SearchMetadata struct { + CompletedIn float64 `json:"completed_in"` + MaxID int64 `json:"max_id"` + MaxIDStr int64 `json:"max_id_str,string"` + NextResults string `json:"next_results"` + Query string `json:"query"` + RefreshURL string `json:"refresh_url"` + Count int `json:"count"` + SinceID int `json:"since_id"` + SinceIDStr int `json:"since_id_str,string"` + } `json:"search_metadata"` + } + twitterStatus struct { + Metadata struct { + ResultType string `json:"result_type"` + IsoLanguageCode string `json:"iso_language_code"` + } `json:"metadata"` + CreatedAt string `json:"created_at"` + ID int64 `json:"id"` + IDStr int64 `json:"id_str,string"` + Text string `json:"text"` + Source string `json:"source"` + Truncated bool `json:"truncated"` + InReplyToStatusID int64 `json:"in_reply_to_status_id"` + InReplyToStatusIDStr int64 `json:"in_reply_to_status_id_str,string"` + InReplyToUserID int64 `json:"in_reply_to_user_id"` + InReplyToUserIDStr int64 `json:"in_reply_to_user_id_str,string"` + InReplyToScreenName string `json:"in_reply_to_screen_name"` + User twitterUser `json:"user,omitempty"` + Geo any `json:"geo"` + Coordinates any `json:"coordinates"` + Place any `json:"place"` + Contributors any `json:"contributors"` + RetweeetedStatus *twitterStatus `json:"retweeted_status"` + RetweetCount int `json:"retweet_count"` + FavoriteCount int `json:"favorite_count"` + Entities twitterEntities `json:"entities,omitempty"` + Favorited bool `json:"favorited"` + Retweeted bool `json:"retweeted"` + PossiblySensitive bool `json:"possibly_sensitive"` + Lang string `json:"lang"` + } + twitterUser struct { + ID int64 `json:"id"` + IDStr string `json:"id_str"` + Name string `json:"name"` + ScreenName string `json:"screen_name"` + Location string `json:"location"` + Description string `json:"description"` + URL any `json:"url"` + Entities twitterEntities `json:"entities"` + Protected bool `json:"protected"` + FollowersCount int `json:"followers_count"` + FriendsCount int `json:"friends_count"` + ListedCount int `json:"listed_count"` + CreatedAt string `json:"created_at"` + FavouritesCount int `json:"favourites_count"` + UtcOffset int `json:"utc_offset"` + TimeZone string `json:"time_zone"` + GeoEnabled bool `json:"geo_enabled"` + Verified bool `json:"verified"` + StatusesCount int `json:"statuses_count"` + Lang string `json:"lang"` + ContributorsEnabled bool `json:"contributors_enabled"` + IsTranslator bool `json:"is_translator"` + IsTranslationEnabled bool `json:"is_translation_enabled"` + ProfileBackgroundColor string `json:"profile_background_color"` + ProfileBackgroundImageURL string `json:"profile_background_image_url"` + ProfileBackgroundImageURLHTTPS string `json:"profile_background_image_url_https"` + ProfileBackgroundTile bool `json:"profile_background_tile"` + ProfileImageURL string `json:"profile_image_url"` + ProfileImageURLHTTPS string `json:"profile_image_url_https"` + ProfileBannerURL string `json:"profile_banner_url"` + ProfileLinkColor string `json:"profile_link_color"` + ProfileSidebarBorderColor string `json:"profile_sidebar_border_color"` + ProfileSidebarFillColor string `json:"profile_sidebar_fill_color"` + ProfileTextColor string `json:"profile_text_color"` + ProfileUseBackgroundImage bool `json:"profile_use_background_image"` + DefaultProfile bool `json:"default_profile"` + DefaultProfileImage bool `json:"default_profile_image"` + Following bool `json:"following"` + FollowRequestSent bool `json:"follow_request_sent"` + Notifications bool `json:"notifications"` + } + twitterEntities struct { + Hashtags []any `json:"hashtags"` + Symbols []any `json:"symbols"` + URL *twitterURL `json:"url"` + URLs []twitterURL `json:"urls"` + UserMentions []struct { + ScreenName string `json:"screen_name"` + Name string `json:"name"` + ID int64 `json:"id"` + IDStr int64 `json:"id_str,string"` + Indices []int `json:"indices"` + } `json:"user_mentions"` + Description struct { + URLs []twitterURL `json:"urls"` + } `json:"description"` + Media []struct { + ID int64 `json:"id"` + IDStr string `json:"id_str"` + Indices []int `json:"indices"` + MediaURL string `json:"media_url"` + MediaURLHTTPS string `json:"media_url_https"` + URL string `json:"url"` + DisplayURL string `json:"display_url"` + ExpandedURL string `json:"expanded_url"` + Type string `json:"type"` + Sizes map[string]struct { + W int `json:"w"` + H int `json:"h"` + Resize string `json:"resize"` + } `json:"sizes"` + SourceStatusID int64 `json:"source_status_id"` + SourceStatusIDStr int64 `json:"source_status_id_str,string"` + } `json:"media"` + } + twitterURL struct { + URL string `json:"url"` + URLs []twitterURL `json:"urls"` + ExpandedURL string `json:"expanded_url"` + DisplayURL string `json:"display_url"` + Indices []int `json:"indices"` + } +) + +// rawValue is the raw encoded JSON value. +type rawValue []byte + +func (v rawValue) MarshalJSON() ([]byte, error) { + if v == nil { + return []byte("null"), nil + } + return v, nil +} + +func (v *rawValue) UnmarshalJSON(b []byte) error { + if v == nil { + return errors.New("jsontest.rawValue: UnmarshalJSON on nil pointer") + } + *v = append((*v)[:0], b...) + return nil +} diff --git a/go/src/encoding/json/internal/jsonwire/decode.go b/go/src/encoding/json/internal/jsonwire/decode.go new file mode 100644 index 0000000000000000000000000000000000000000..42eeedcddf94cfe320a501907b66552a1cfda145 --- /dev/null +++ b/go/src/encoding/json/internal/jsonwire/decode.go @@ -0,0 +1,629 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsonwire + +import ( + "io" + "math" + "slices" + "strconv" + "unicode/utf16" + "unicode/utf8" +) + +type ValueFlags uint + +const ( + _ ValueFlags = (1 << iota) / 2 // powers of two starting with zero + + stringNonVerbatim // string cannot be naively treated as valid UTF-8 + stringNonCanonical // string not formatted according to RFC 8785, section 3.2.2.2. + // TODO: Track whether a number is a non-integer? +) + +func (f *ValueFlags) Join(f2 ValueFlags) { *f |= f2 } +func (f ValueFlags) IsVerbatim() bool { return f&stringNonVerbatim == 0 } +func (f ValueFlags) IsCanonical() bool { return f&stringNonCanonical == 0 } + +// ConsumeWhitespace consumes leading JSON whitespace per RFC 7159, section 2. +func ConsumeWhitespace(b []byte) (n int) { + // NOTE: The arguments and logic are kept simple to keep this inlinable. + for len(b) > n && (b[n] == ' ' || b[n] == '\t' || b[n] == '\r' || b[n] == '\n') { + n++ + } + return n +} + +// ConsumeNull consumes the next JSON null literal per RFC 7159, section 3. +// It returns 0 if it is invalid, in which case consumeLiteral should be used. +func ConsumeNull(b []byte) int { + // NOTE: The arguments and logic are kept simple to keep this inlinable. + const literal = "null" + if len(b) >= len(literal) && string(b[:len(literal)]) == literal { + return len(literal) + } + return 0 +} + +// ConsumeFalse consumes the next JSON false literal per RFC 7159, section 3. +// It returns 0 if it is invalid, in which case consumeLiteral should be used. +func ConsumeFalse(b []byte) int { + // NOTE: The arguments and logic are kept simple to keep this inlinable. + const literal = "false" + if len(b) >= len(literal) && string(b[:len(literal)]) == literal { + return len(literal) + } + return 0 +} + +// ConsumeTrue consumes the next JSON true literal per RFC 7159, section 3. +// It returns 0 if it is invalid, in which case consumeLiteral should be used. +func ConsumeTrue(b []byte) int { + // NOTE: The arguments and logic are kept simple to keep this inlinable. + const literal = "true" + if len(b) >= len(literal) && string(b[:len(literal)]) == literal { + return len(literal) + } + return 0 +} + +// ConsumeLiteral consumes the next JSON literal per RFC 7159, section 3. +// If the input appears truncated, it returns io.ErrUnexpectedEOF. +func ConsumeLiteral(b []byte, lit string) (n int, err error) { + for i := 0; i < len(b) && i < len(lit); i++ { + if b[i] != lit[i] { + return i, NewInvalidCharacterError(b[i:], "in literal "+lit+" (expecting "+strconv.QuoteRune(rune(lit[i]))+")") + } + } + if len(b) < len(lit) { + return len(b), io.ErrUnexpectedEOF + } + return len(lit), nil +} + +// ConsumeSimpleString consumes the next JSON string per RFC 7159, section 7 +// but is limited to the grammar for an ASCII string without escape sequences. +// It returns 0 if it is invalid or more complicated than a simple string, +// in which case consumeString should be called. +// +// It rejects '<', '>', and '&' for compatibility reasons since these were +// always escaped in the v1 implementation. Thus, if this function reports +// non-zero then we know that the string would be encoded the same way +// under both v1 or v2 escape semantics. +func ConsumeSimpleString(b []byte) (n int) { + // NOTE: The arguments and logic are kept simple to keep this inlinable. + if len(b) > 0 && b[0] == '"' { + n++ + for len(b) > n && b[n] < utf8.RuneSelf && escapeASCII[b[n]] == 0 { + n++ + } + if uint(len(b)) > uint(n) && b[n] == '"' { + n++ + return n + } + } + return 0 +} + +// ConsumeString consumes the next JSON string per RFC 7159, section 7. +// If validateUTF8 is false, then this allows the presence of invalid UTF-8 +// characters within the string itself. +// It reports the number of bytes consumed and whether an error was encountered. +// If the input appears truncated, it returns io.ErrUnexpectedEOF. +func ConsumeString(flags *ValueFlags, b []byte, validateUTF8 bool) (n int, err error) { + return ConsumeStringResumable(flags, b, 0, validateUTF8) +} + +// ConsumeStringResumable is identical to consumeString but supports resuming +// from a previous call that returned io.ErrUnexpectedEOF. +func ConsumeStringResumable(flags *ValueFlags, b []byte, resumeOffset int, validateUTF8 bool) (n int, err error) { + // Consume the leading double quote. + switch { + case resumeOffset > 0: + n = resumeOffset // already handled the leading quote + case uint(len(b)) == 0: + return n, io.ErrUnexpectedEOF + case b[0] == '"': + n++ + default: + return n, NewInvalidCharacterError(b[n:], `at start of string (expecting '"')`) + } + + // Consume every character in the string. + for uint(len(b)) > uint(n) { + // Optimize for long sequences of unescaped characters. + noEscape := func(c byte) bool { + return c < utf8.RuneSelf && ' ' <= c && c != '\\' && c != '"' + } + for uint(len(b)) > uint(n) && noEscape(b[n]) { + n++ + } + if uint(len(b)) <= uint(n) { + return n, io.ErrUnexpectedEOF + } + + // Check for terminating double quote. + if b[n] == '"' { + n++ + return n, nil + } + + switch r, rn := utf8.DecodeRune(b[n:]); { + // Handle UTF-8 encoded byte sequence. + // Due to specialized handling of ASCII above, we know that + // all normal sequences at this point must be 2 bytes or larger. + case rn > 1: + n += rn + // Handle escape sequence. + case r == '\\': + flags.Join(stringNonVerbatim) + resumeOffset = n + if uint(len(b)) < uint(n+2) { + return resumeOffset, io.ErrUnexpectedEOF + } + switch r := b[n+1]; r { + case '/': + // Forward slash is the only character with 3 representations. + // Per RFC 8785, section 3.2.2.2., this must not be escaped. + flags.Join(stringNonCanonical) + n += 2 + case '"', '\\', 'b', 'f', 'n', 'r', 't': + n += 2 + case 'u': + if uint(len(b)) < uint(n+6) { + if hasEscapedUTF16Prefix(b[n:], false) { + return resumeOffset, io.ErrUnexpectedEOF + } + flags.Join(stringNonCanonical) + return n, NewInvalidEscapeSequenceError(b[n:]) + } + v1, ok := parseHexUint16(b[n+2 : n+6]) + if !ok { + flags.Join(stringNonCanonical) + return n, NewInvalidEscapeSequenceError(b[n : n+6]) + } + // Only certain control characters can use the \uFFFF notation + // for canonical formatting (per RFC 8785, section 3.2.2.2.). + switch v1 { + // \uFFFF notation not permitted for these characters. + case '\b', '\f', '\n', '\r', '\t': + flags.Join(stringNonCanonical) + default: + // \uFFFF notation only permitted for control characters. + if v1 >= ' ' { + flags.Join(stringNonCanonical) + } else { + // \uFFFF notation must be lower case. + for _, c := range b[n+2 : n+6] { + if 'A' <= c && c <= 'F' { + flags.Join(stringNonCanonical) + } + } + } + } + n += 6 + + r := rune(v1) + if validateUTF8 && utf16.IsSurrogate(r) { + if uint(len(b)) < uint(n+6) { + if hasEscapedUTF16Prefix(b[n:], true) { + return resumeOffset, io.ErrUnexpectedEOF + } + flags.Join(stringNonCanonical) + return n - 6, NewInvalidEscapeSequenceError(b[n-6:]) + } else if v2, ok := parseHexUint16(b[n+2 : n+6]); b[n] != '\\' || b[n+1] != 'u' || !ok { + flags.Join(stringNonCanonical) + return n - 6, NewInvalidEscapeSequenceError(b[n-6 : n+6]) + } else if r = utf16.DecodeRune(rune(v1), rune(v2)); r == utf8.RuneError { + flags.Join(stringNonCanonical) + return n - 6, NewInvalidEscapeSequenceError(b[n-6 : n+6]) + } else { + n += 6 + } + } + default: + flags.Join(stringNonCanonical) + return n, NewInvalidEscapeSequenceError(b[n : n+2]) + } + // Handle invalid UTF-8. + case r == utf8.RuneError: + if !utf8.FullRune(b[n:]) { + return n, io.ErrUnexpectedEOF + } + flags.Join(stringNonVerbatim | stringNonCanonical) + if validateUTF8 { + return n, ErrInvalidUTF8 + } + n++ + // Handle invalid control characters. + case r < ' ': + flags.Join(stringNonVerbatim | stringNonCanonical) + return n, NewInvalidCharacterError(b[n:], "in string (expecting non-control character)") + default: + panic("BUG: unhandled character " + QuoteRune(b[n:])) + } + } + return n, io.ErrUnexpectedEOF +} + +// AppendUnquote appends the unescaped form of a JSON string in src to dst. +// Any invalid UTF-8 within the string will be replaced with utf8.RuneError, +// but the error will be specified as having encountered such an error. +// The input must be an entire JSON string with no surrounding whitespace. +func AppendUnquote[Bytes ~[]byte | ~string](dst []byte, src Bytes) (v []byte, err error) { + dst = slices.Grow(dst, len(src)) + + // Consume the leading double quote. + var i, n int + switch { + case uint(len(src)) == 0: + return dst, io.ErrUnexpectedEOF + case src[0] == '"': + i, n = 1, 1 + default: + return dst, NewInvalidCharacterError(src, `at start of string (expecting '"')`) + } + + // Consume every character in the string. + for uint(len(src)) > uint(n) { + // Optimize for long sequences of unescaped characters. + noEscape := func(c byte) bool { + return c < utf8.RuneSelf && ' ' <= c && c != '\\' && c != '"' + } + for uint(len(src)) > uint(n) && noEscape(src[n]) { + n++ + } + if uint(len(src)) <= uint(n) { + dst = append(dst, src[i:n]...) + return dst, io.ErrUnexpectedEOF + } + + // Check for terminating double quote. + if src[n] == '"' { + dst = append(dst, src[i:n]...) + n++ + if n < len(src) { + err = NewInvalidCharacterError(src[n:], "after string value") + } + return dst, err + } + + switch r, rn := utf8.DecodeRuneInString(string(truncateMaxUTF8(src[n:]))); { + // Handle UTF-8 encoded byte sequence. + // Due to specialized handling of ASCII above, we know that + // all normal sequences at this point must be 2 bytes or larger. + case rn > 1: + n += rn + // Handle escape sequence. + case r == '\\': + dst = append(dst, src[i:n]...) + + // Handle escape sequence. + if uint(len(src)) < uint(n+2) { + return dst, io.ErrUnexpectedEOF + } + switch r := src[n+1]; r { + case '"', '\\', '/': + dst = append(dst, r) + n += 2 + case 'b': + dst = append(dst, '\b') + n += 2 + case 'f': + dst = append(dst, '\f') + n += 2 + case 'n': + dst = append(dst, '\n') + n += 2 + case 'r': + dst = append(dst, '\r') + n += 2 + case 't': + dst = append(dst, '\t') + n += 2 + case 'u': + if uint(len(src)) < uint(n+6) { + if hasEscapedUTF16Prefix(src[n:], false) { + return dst, io.ErrUnexpectedEOF + } + return dst, NewInvalidEscapeSequenceError(src[n:]) + } + v1, ok := parseHexUint16(src[n+2 : n+6]) + if !ok { + return dst, NewInvalidEscapeSequenceError(src[n : n+6]) + } + n += 6 + + // Check whether this is a surrogate half. + r := rune(v1) + if utf16.IsSurrogate(r) { + r = utf8.RuneError // assume failure unless the following succeeds + if uint(len(src)) < uint(n+6) { + if hasEscapedUTF16Prefix(src[n:], true) { + return utf8.AppendRune(dst, r), io.ErrUnexpectedEOF + } + err = NewInvalidEscapeSequenceError(src[n-6:]) + } else if v2, ok := parseHexUint16(src[n+2 : n+6]); src[n] != '\\' || src[n+1] != 'u' || !ok { + err = NewInvalidEscapeSequenceError(src[n-6 : n+6]) + } else if r = utf16.DecodeRune(rune(v1), rune(v2)); r == utf8.RuneError { + err = NewInvalidEscapeSequenceError(src[n-6 : n+6]) + } else { + n += 6 + } + } + + dst = utf8.AppendRune(dst, r) + default: + return dst, NewInvalidEscapeSequenceError(src[n : n+2]) + } + i = n + // Handle invalid UTF-8. + case r == utf8.RuneError: + dst = append(dst, src[i:n]...) + if !utf8.FullRuneInString(string(truncateMaxUTF8(src[n:]))) { + return dst, io.ErrUnexpectedEOF + } + // NOTE: An unescaped string may be longer than the escaped string + // because invalid UTF-8 bytes are being replaced. + dst = append(dst, "\uFFFD"...) + n += rn + i = n + err = ErrInvalidUTF8 + // Handle invalid control characters. + case r < ' ': + dst = append(dst, src[i:n]...) + return dst, NewInvalidCharacterError(src[n:], "in string (expecting non-control character)") + default: + panic("BUG: unhandled character " + QuoteRune(src[n:])) + } + } + dst = append(dst, src[i:n]...) + return dst, io.ErrUnexpectedEOF +} + +// hasEscapedUTF16Prefix reports whether b is possibly +// the truncated prefix of a \uFFFF escape sequence. +func hasEscapedUTF16Prefix[Bytes ~[]byte | ~string](b Bytes, lowerSurrogateHalf bool) bool { + for i := range len(b) { + switch c := b[i]; { + case i == 0 && c != '\\': + return false + case i == 1 && c != 'u': + return false + case i == 2 && lowerSurrogateHalf && c != 'd' && c != 'D': + return false // not within ['\uDC00':'\uDFFF'] + case i == 3 && lowerSurrogateHalf && !('c' <= c && c <= 'f') && !('C' <= c && c <= 'F'): + return false // not within ['\uDC00':'\uDFFF'] + case i >= 2 && i < 6 && !('0' <= c && c <= '9') && !('a' <= c && c <= 'f') && !('A' <= c && c <= 'F'): + return false + } + } + return true +} + +// UnquoteMayCopy returns the unescaped form of b. +// If there are no escaped characters, the output is simply a subslice of +// the input with the surrounding quotes removed. +// Otherwise, a new buffer is allocated for the output. +// It assumes the input is valid. +func UnquoteMayCopy(b []byte, isVerbatim bool) []byte { + // NOTE: The arguments and logic are kept simple to keep this inlinable. + if isVerbatim { + return b[len(`"`) : len(b)-len(`"`)] + } + b, _ = AppendUnquote(nil, b) + return b +} + +// ConsumeSimpleNumber consumes the next JSON number per RFC 7159, section 6 +// but is limited to the grammar for a positive integer. +// It returns 0 if it is invalid or more complicated than a simple integer, +// in which case consumeNumber should be called. +func ConsumeSimpleNumber(b []byte) (n int) { + // NOTE: The arguments and logic are kept simple to keep this inlinable. + if len(b) > 0 { + if b[0] == '0' { + n++ + } else if '1' <= b[0] && b[0] <= '9' { + n++ + for len(b) > n && ('0' <= b[n] && b[n] <= '9') { + n++ + } + } else { + return 0 + } + if uint(len(b)) <= uint(n) || (b[n] != '.' && b[n] != 'e' && b[n] != 'E') { + return n + } + } + return 0 +} + +type ConsumeNumberState uint + +const ( + consumeNumberInit ConsumeNumberState = iota + beforeIntegerDigits + withinIntegerDigits + beforeFractionalDigits + withinFractionalDigits + beforeExponentDigits + withinExponentDigits +) + +// ConsumeNumber consumes the next JSON number per RFC 7159, section 6. +// It reports the number of bytes consumed and whether an error was encountered. +// If the input appears truncated, it returns io.ErrUnexpectedEOF. +// +// Note that JSON numbers are not self-terminating. +// If the entire input is consumed, then the caller needs to consider whether +// there may be subsequent unread data that may still be part of this number. +func ConsumeNumber(b []byte) (n int, err error) { + n, _, err = ConsumeNumberResumable(b, 0, consumeNumberInit) + return n, err +} + +// ConsumeNumberResumable is identical to consumeNumber but supports resuming +// from a previous call that returned io.ErrUnexpectedEOF. +func ConsumeNumberResumable(b []byte, resumeOffset int, state ConsumeNumberState) (n int, _ ConsumeNumberState, err error) { + // Jump to the right state when resuming from a partial consumption. + n = resumeOffset + if state > consumeNumberInit { + switch state { + case withinIntegerDigits, withinFractionalDigits, withinExponentDigits: + // Consume leading digits. + for uint(len(b)) > uint(n) && ('0' <= b[n] && b[n] <= '9') { + n++ + } + if uint(len(b)) <= uint(n) { + return n, state, nil // still within the same state + } + state++ // switches "withinX" to "beforeY" where Y is the state after X + } + switch state { + case beforeIntegerDigits: + goto beforeInteger + case beforeFractionalDigits: + goto beforeFractional + case beforeExponentDigits: + goto beforeExponent + default: + return n, state, nil + } + } + + // Consume required integer component (with optional minus sign). +beforeInteger: + resumeOffset = n + if uint(len(b)) > 0 && b[0] == '-' { + n++ + } + switch { + case uint(len(b)) <= uint(n): + return resumeOffset, beforeIntegerDigits, io.ErrUnexpectedEOF + case b[n] == '0': + n++ + state = beforeFractionalDigits + case '1' <= b[n] && b[n] <= '9': + n++ + for uint(len(b)) > uint(n) && ('0' <= b[n] && b[n] <= '9') { + n++ + } + state = withinIntegerDigits + default: + return n, state, NewInvalidCharacterError(b[n:], "in number (expecting digit)") + } + + // Consume optional fractional component. +beforeFractional: + if uint(len(b)) > uint(n) && b[n] == '.' { + resumeOffset = n + n++ + switch { + case uint(len(b)) <= uint(n): + return resumeOffset, beforeFractionalDigits, io.ErrUnexpectedEOF + case '0' <= b[n] && b[n] <= '9': + n++ + default: + return n, state, NewInvalidCharacterError(b[n:], "in number (expecting digit)") + } + for uint(len(b)) > uint(n) && ('0' <= b[n] && b[n] <= '9') { + n++ + } + state = withinFractionalDigits + } + + // Consume optional exponent component. +beforeExponent: + if uint(len(b)) > uint(n) && (b[n] == 'e' || b[n] == 'E') { + resumeOffset = n + n++ + if uint(len(b)) > uint(n) && (b[n] == '-' || b[n] == '+') { + n++ + } + switch { + case uint(len(b)) <= uint(n): + return resumeOffset, beforeExponentDigits, io.ErrUnexpectedEOF + case '0' <= b[n] && b[n] <= '9': + n++ + default: + return n, state, NewInvalidCharacterError(b[n:], "in number (expecting digit)") + } + for uint(len(b)) > uint(n) && ('0' <= b[n] && b[n] <= '9') { + n++ + } + state = withinExponentDigits + } + + return n, state, nil +} + +// parseHexUint16 is similar to strconv.ParseUint, +// but operates directly on []byte and is optimized for base-16. +// See https://go.dev/issue/42429. +func parseHexUint16[Bytes ~[]byte | ~string](b Bytes) (v uint16, ok bool) { + if len(b) != 4 { + return 0, false + } + for i := range 4 { + c := b[i] + switch { + case '0' <= c && c <= '9': + c = c - '0' + case 'a' <= c && c <= 'f': + c = 10 + c - 'a' + case 'A' <= c && c <= 'F': + c = 10 + c - 'A' + default: + return 0, false + } + v = v*16 + uint16(c) + } + return v, true +} + +// ParseUint parses b as a decimal unsigned integer according to +// a strict subset of the JSON number grammar, returning the value if valid. +// It returns (0, false) if there is a syntax error and +// returns (math.MaxUint64, false) if there is an overflow. +func ParseUint(b []byte) (v uint64, ok bool) { + const unsafeWidth = 20 // len(fmt.Sprint(uint64(math.MaxUint64))) + var n int + for ; len(b) > n && ('0' <= b[n] && b[n] <= '9'); n++ { + v = 10*v + uint64(b[n]-'0') + } + switch { + case n == 0 || len(b) != n || (b[0] == '0' && string(b) != "0"): + return 0, false + case n >= unsafeWidth && (b[0] != '1' || v < 1e19 || n > unsafeWidth): + return math.MaxUint64, false + } + return v, true +} + +// ParseFloat parses a floating point number according to the Go float grammar. +// Note that the JSON number grammar is a strict subset. +// +// If the number overflows the finite representation of a float, +// then we return MaxFloat since any finite value will always be infinitely +// more accurate at representing another finite value than an infinite value. +func ParseFloat(b []byte, bits int) (v float64, ok bool) { + fv, err := strconv.ParseFloat(string(b), bits) + if math.IsInf(fv, 0) { + switch { + case bits == 32 && math.IsInf(fv, +1): + fv = +math.MaxFloat32 + case bits == 64 && math.IsInf(fv, +1): + fv = +math.MaxFloat64 + case bits == 32 && math.IsInf(fv, -1): + fv = -math.MaxFloat32 + case bits == 64 && math.IsInf(fv, -1): + fv = -math.MaxFloat64 + } + } + return fv, err == nil +} diff --git a/go/src/encoding/json/internal/jsonwire/decode_test.go b/go/src/encoding/json/internal/jsonwire/decode_test.go new file mode 100644 index 0000000000000000000000000000000000000000..549c1a1f62b283a300eb0a5dc764e23620f4593b --- /dev/null +++ b/go/src/encoding/json/internal/jsonwire/decode_test.go @@ -0,0 +1,443 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsonwire + +import ( + "errors" + "io" + "math" + "reflect" + "strings" + "testing" +) + +func TestConsumeWhitespace(t *testing.T) { + tests := []struct { + in string + want int + }{ + {"", 0}, + {"a", 0}, + {" a", 1}, + {" a ", 1}, + {" \n\r\ta", 4}, + {" \n\r\t \n\r\t \n\r\t \n\r\t", 16}, + {"\u00a0", 0}, // non-breaking space is not JSON whitespace + } + + for _, tt := range tests { + t.Run("", func(t *testing.T) { + if got := ConsumeWhitespace([]byte(tt.in)); got != tt.want { + t.Errorf("ConsumeWhitespace(%q) = %v, want %v", tt.in, got, tt.want) + } + }) + } +} + +func TestConsumeLiteral(t *testing.T) { + tests := []struct { + literal string + in string + want int + wantErr error + }{ + {"null", "", 0, io.ErrUnexpectedEOF}, + {"null", "n", 1, io.ErrUnexpectedEOF}, + {"null", "nu", 2, io.ErrUnexpectedEOF}, + {"null", "nul", 3, io.ErrUnexpectedEOF}, + {"null", "null", 4, nil}, + {"null", "nullx", 4, nil}, + {"null", "x", 0, NewInvalidCharacterError("x", "in literal null (expecting 'n')")}, + {"null", "nuxx", 2, NewInvalidCharacterError("x", "in literal null (expecting 'l')")}, + + {"false", "", 0, io.ErrUnexpectedEOF}, + {"false", "f", 1, io.ErrUnexpectedEOF}, + {"false", "fa", 2, io.ErrUnexpectedEOF}, + {"false", "fal", 3, io.ErrUnexpectedEOF}, + {"false", "fals", 4, io.ErrUnexpectedEOF}, + {"false", "false", 5, nil}, + {"false", "falsex", 5, nil}, + {"false", "x", 0, NewInvalidCharacterError("x", "in literal false (expecting 'f')")}, + {"false", "falsx", 4, NewInvalidCharacterError("x", "in literal false (expecting 'e')")}, + + {"true", "", 0, io.ErrUnexpectedEOF}, + {"true", "t", 1, io.ErrUnexpectedEOF}, + {"true", "tr", 2, io.ErrUnexpectedEOF}, + {"true", "tru", 3, io.ErrUnexpectedEOF}, + {"true", "true", 4, nil}, + {"true", "truex", 4, nil}, + {"true", "x", 0, NewInvalidCharacterError("x", "in literal true (expecting 't')")}, + {"true", "trux", 3, NewInvalidCharacterError("x", "in literal true (expecting 'e')")}, + } + + for _, tt := range tests { + t.Run("", func(t *testing.T) { + var got int + switch tt.literal { + case "null": + got = ConsumeNull([]byte(tt.in)) + case "false": + got = ConsumeFalse([]byte(tt.in)) + case "true": + got = ConsumeTrue([]byte(tt.in)) + default: + t.Errorf("invalid literal: %v", tt.literal) + } + switch { + case tt.wantErr == nil && got != tt.want: + t.Errorf("Consume%v(%q) = %v, want %v", strings.Title(tt.literal), tt.in, got, tt.want) + case tt.wantErr != nil && got != 0: + t.Errorf("Consume%v(%q) = %v, want %v", strings.Title(tt.literal), tt.in, got, 0) + } + + got, gotErr := ConsumeLiteral([]byte(tt.in), tt.literal) + if got != tt.want || !reflect.DeepEqual(gotErr, tt.wantErr) { + t.Errorf("ConsumeLiteral(%q, %q) = (%v, %v), want (%v, %v)", tt.in, tt.literal, got, gotErr, tt.want, tt.wantErr) + } + }) + } +} + +func TestConsumeString(t *testing.T) { + var errPrev = errors.New("same as previous error") + tests := []struct { + in string + simple bool + want int + wantUTF8 int // consumed bytes if validateUTF8 is specified + wantFlags ValueFlags + wantUnquote string + wantErr error + wantErrUTF8 error // error if validateUTF8 is specified + wantErrUnquote error + }{ + {``, false, 0, 0, 0, "", io.ErrUnexpectedEOF, errPrev, errPrev}, + {`"`, false, 1, 1, 0, "", io.ErrUnexpectedEOF, errPrev, errPrev}, + {`""`, true, 2, 2, 0, "", nil, nil, nil}, + {`""x`, true, 2, 2, 0, "", nil, nil, NewInvalidCharacterError("x", "after string value")}, + {` ""x`, false, 0, 0, 0, "", NewInvalidCharacterError(" ", "at start of string (expecting '\"')"), errPrev, errPrev}, + {`"hello`, false, 6, 6, 0, "hello", io.ErrUnexpectedEOF, errPrev, errPrev}, + {`"hello"`, true, 7, 7, 0, "hello", nil, nil, nil}, + {"\"\x00\"", false, 1, 1, stringNonVerbatim | stringNonCanonical, "", NewInvalidCharacterError("\x00", "in string (expecting non-control character)"), errPrev, errPrev}, + {`"\u0000"`, false, 8, 8, stringNonVerbatim, "\x00", nil, nil, nil}, + {"\"\x1f\"", false, 1, 1, stringNonVerbatim | stringNonCanonical, "", NewInvalidCharacterError("\x1f", "in string (expecting non-control character)"), errPrev, errPrev}, + {`"\u001f"`, false, 8, 8, stringNonVerbatim, "\x1f", nil, nil, nil}, + {`"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"`, true, 54, 54, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", nil, nil, nil}, + {"\" !#$%'()*+,-./0123456789:;=?@[]^_`{|}~\x7f\"", true, 41, 41, 0, " !#$%'()*+,-./0123456789:;=?@[]^_`{|}~\x7f", nil, nil, nil}, + {`"&"`, false, 3, 3, 0, "&", nil, nil, nil}, + {`"<"`, false, 3, 3, 0, "<", nil, nil, nil}, + {`">"`, false, 3, 3, 0, ">", nil, nil, nil}, + {"\"x\x80\"", false, 4, 2, stringNonVerbatim | stringNonCanonical, "x\ufffd", nil, ErrInvalidUTF8, errPrev}, + {"\"x\xff\"", false, 4, 2, stringNonVerbatim | stringNonCanonical, "x\ufffd", nil, ErrInvalidUTF8, errPrev}, + {"\"x\xc0", false, 3, 2, stringNonVerbatim | stringNonCanonical, "x\ufffd", io.ErrUnexpectedEOF, ErrInvalidUTF8, io.ErrUnexpectedEOF}, + {"\"x\xc0\x80\"", false, 5, 2, stringNonVerbatim | stringNonCanonical, "x\ufffd\ufffd", nil, ErrInvalidUTF8, errPrev}, + {"\"x\xe0", false, 2, 2, 0, "x", io.ErrUnexpectedEOF, errPrev, errPrev}, + {"\"x\xe0\x80", false, 4, 2, stringNonVerbatim | stringNonCanonical, "x\ufffd\ufffd", io.ErrUnexpectedEOF, ErrInvalidUTF8, io.ErrUnexpectedEOF}, + {"\"x\xe0\x80\x80\"", false, 6, 2, stringNonVerbatim | stringNonCanonical, "x\ufffd\ufffd\ufffd", nil, ErrInvalidUTF8, errPrev}, + {"\"x\xf0", false, 2, 2, 0, "x", io.ErrUnexpectedEOF, errPrev, errPrev}, + {"\"x\xf0\x80", false, 4, 2, stringNonVerbatim | stringNonCanonical, "x\ufffd\ufffd", io.ErrUnexpectedEOF, ErrInvalidUTF8, io.ErrUnexpectedEOF}, + {"\"x\xf0\x80\x80", false, 5, 2, stringNonVerbatim | stringNonCanonical, "x\ufffd\ufffd\ufffd", io.ErrUnexpectedEOF, ErrInvalidUTF8, io.ErrUnexpectedEOF}, + {"\"x\xf0\x80\x80\x80\"", false, 7, 2, stringNonVerbatim | stringNonCanonical, "x\ufffd\ufffd\ufffd\ufffd", nil, ErrInvalidUTF8, errPrev}, + {"\"x\xed\xba\xad\"", false, 6, 2, stringNonVerbatim | stringNonCanonical, "x\ufffd\ufffd\ufffd", nil, ErrInvalidUTF8, errPrev}, + {"\"\u0080\u00f6\u20ac\ud799\ue000\ufb33\ufffd\U0001f602\"", false, 25, 25, 0, "\u0080\u00f6\u20ac\ud799\ue000\ufb33\ufffd\U0001f602", nil, nil, nil}, + {`"¢"`[:2], false, 1, 1, 0, "", io.ErrUnexpectedEOF, errPrev, errPrev}, + {`"¢"`[:3], false, 3, 3, 0, "¢", io.ErrUnexpectedEOF, errPrev, errPrev}, // missing terminating quote + {`"¢"`[:4], false, 4, 4, 0, "¢", nil, nil, nil}, + {`"€"`[:2], false, 1, 1, 0, "", io.ErrUnexpectedEOF, errPrev, errPrev}, + {`"€"`[:3], false, 1, 1, 0, "", io.ErrUnexpectedEOF, errPrev, errPrev}, + {`"€"`[:4], false, 4, 4, 0, "€", io.ErrUnexpectedEOF, errPrev, errPrev}, // missing terminating quote + {`"€"`[:5], false, 5, 5, 0, "€", nil, nil, nil}, + {`"𐍈"`[:2], false, 1, 1, 0, "", io.ErrUnexpectedEOF, errPrev, errPrev}, + {`"𐍈"`[:3], false, 1, 1, 0, "", io.ErrUnexpectedEOF, errPrev, errPrev}, + {`"𐍈"`[:4], false, 1, 1, 0, "", io.ErrUnexpectedEOF, errPrev, errPrev}, + {`"𐍈"`[:5], false, 5, 5, 0, "𐍈", io.ErrUnexpectedEOF, errPrev, errPrev}, // missing terminating quote + {`"𐍈"`[:6], false, 6, 6, 0, "𐍈", nil, nil, nil}, + {`"x\`, false, 2, 2, stringNonVerbatim, "x", io.ErrUnexpectedEOF, errPrev, errPrev}, + {`"x\"`, false, 4, 4, stringNonVerbatim, "x\"", io.ErrUnexpectedEOF, errPrev, errPrev}, + {`"x\x"`, false, 2, 2, stringNonVerbatim | stringNonCanonical, "x", NewInvalidEscapeSequenceError(`\x`), errPrev, errPrev}, + {`"\"\\\b\f\n\r\t"`, false, 16, 16, stringNonVerbatim, "\"\\\b\f\n\r\t", nil, nil, nil}, + {`"/"`, true, 3, 3, 0, "/", nil, nil, nil}, + {`"\/"`, false, 4, 4, stringNonVerbatim | stringNonCanonical, "/", nil, nil, nil}, + {`"\u002f"`, false, 8, 8, stringNonVerbatim | stringNonCanonical, "/", nil, nil, nil}, + {`"\u`, false, 1, 1, stringNonVerbatim, "", io.ErrUnexpectedEOF, errPrev, errPrev}, + {`"\uf`, false, 1, 1, stringNonVerbatim, "", io.ErrUnexpectedEOF, errPrev, errPrev}, + {`"\uff`, false, 1, 1, stringNonVerbatim, "", io.ErrUnexpectedEOF, errPrev, errPrev}, + {`"\ufff`, false, 1, 1, stringNonVerbatim, "", io.ErrUnexpectedEOF, errPrev, errPrev}, + {`"\ufffd`, false, 7, 7, stringNonVerbatim | stringNonCanonical, "\ufffd", io.ErrUnexpectedEOF, errPrev, errPrev}, + {`"\ufffd"`, false, 8, 8, stringNonVerbatim | stringNonCanonical, "\ufffd", nil, nil, nil}, + {`"\uABCD"`, false, 8, 8, stringNonVerbatim | stringNonCanonical, "\uabcd", nil, nil, nil}, + {`"\uefX0"`, false, 1, 1, stringNonVerbatim | stringNonCanonical, "", NewInvalidEscapeSequenceError(`\uefX0`), errPrev, errPrev}, + {`"\uDEAD`, false, 7, 1, stringNonVerbatim | stringNonCanonical, "\ufffd", io.ErrUnexpectedEOF, errPrev, errPrev}, + {`"\uDEAD"`, false, 8, 1, stringNonVerbatim | stringNonCanonical, "\ufffd", nil, NewInvalidEscapeSequenceError(`\uDEAD"`), errPrev}, + {`"\uDEAD______"`, false, 14, 1, stringNonVerbatim | stringNonCanonical, "\ufffd______", nil, NewInvalidEscapeSequenceError(`\uDEAD______`), errPrev}, + {`"\uDEAD\uXXXX"`, false, 7, 1, stringNonVerbatim | stringNonCanonical, "\ufffd", NewInvalidEscapeSequenceError(`\uXXXX`), NewInvalidEscapeSequenceError(`\uDEAD\uXXXX`), NewInvalidEscapeSequenceError(`\uXXXX`)}, + {`"\uDEAD\uBEEF"`, false, 14, 1, stringNonVerbatim | stringNonCanonical, "\ufffd\ubeef", nil, NewInvalidEscapeSequenceError(`\uDEAD\uBEEF`), errPrev}, + {`"\uD800\udea`, false, 7, 1, stringNonVerbatim | stringNonCanonical, "\ufffd", io.ErrUnexpectedEOF, errPrev, errPrev}, + {`"\uD800\udb`, false, 7, 1, stringNonVerbatim | stringNonCanonical, "\ufffd", io.ErrUnexpectedEOF, NewInvalidEscapeSequenceError(`\uD800\udb`), io.ErrUnexpectedEOF}, + {`"\uD800\udead"`, false, 14, 14, stringNonVerbatim | stringNonCanonical, "\U000102ad", nil, nil, nil}, + {`"\u0022\u005c\u002f\u0008\u000c\u000a\u000d\u0009"`, false, 50, 50, stringNonVerbatim | stringNonCanonical, "\"\\/\b\f\n\r\t", nil, nil, nil}, + {`"\u0080\u00f6\u20ac\ud799\ue000\ufb33\ufffd\ud83d\ude02"`, false, 56, 56, stringNonVerbatim | stringNonCanonical, "\u0080\u00f6\u20ac\ud799\ue000\ufb33\ufffd\U0001f602", nil, nil, nil}, + } + + for _, tt := range tests { + t.Run("", func(t *testing.T) { + if tt.wantErrUTF8 == errPrev { + tt.wantErrUTF8 = tt.wantErr + } + if tt.wantErrUnquote == errPrev { + tt.wantErrUnquote = tt.wantErrUTF8 + } + + switch got := ConsumeSimpleString([]byte(tt.in)); { + case tt.simple && got != tt.want: + t.Errorf("consumeSimpleString(%q) = %v, want %v", tt.in, got, tt.want) + case !tt.simple && got != 0: + t.Errorf("consumeSimpleString(%q) = %v, want %v", tt.in, got, 0) + } + + var gotFlags ValueFlags + got, gotErr := ConsumeString(&gotFlags, []byte(tt.in), false) + if gotFlags != tt.wantFlags { + t.Errorf("consumeString(%q, false) flags = %v, want %v", tt.in, gotFlags, tt.wantFlags) + } + if got != tt.want || !reflect.DeepEqual(gotErr, tt.wantErr) { + t.Errorf("consumeString(%q, false) = (%v, %v), want (%v, %v)", tt.in, got, gotErr, tt.want, tt.wantErr) + } + + got, gotErr = ConsumeString(&gotFlags, []byte(tt.in), true) + if got != tt.wantUTF8 || !reflect.DeepEqual(gotErr, tt.wantErrUTF8) { + t.Errorf("consumeString(%q, false) = (%v, %v), want (%v, %v)", tt.in, got, gotErr, tt.wantUTF8, tt.wantErrUTF8) + } + + gotUnquote, gotErr := AppendUnquote(nil, tt.in) + if string(gotUnquote) != tt.wantUnquote || !reflect.DeepEqual(gotErr, tt.wantErrUnquote) { + t.Errorf("AppendUnquote(nil, %q) = (%q, %v), want (%q, %v)", tt.in[:got], gotUnquote, gotErr, tt.wantUnquote, tt.wantErrUnquote) + } + }) + } +} + +func TestConsumeNumber(t *testing.T) { + tests := []struct { + in string + simple bool + want int + wantErr error + }{ + {"", false, 0, io.ErrUnexpectedEOF}, + {`"NaN"`, false, 0, NewInvalidCharacterError("\"", "in number (expecting digit)")}, + {`"Infinity"`, false, 0, NewInvalidCharacterError("\"", "in number (expecting digit)")}, + {`"-Infinity"`, false, 0, NewInvalidCharacterError("\"", "in number (expecting digit)")}, + {".0", false, 0, NewInvalidCharacterError(".", "in number (expecting digit)")}, + {"0", true, 1, nil}, + {"-0", false, 2, nil}, + {"+0", false, 0, NewInvalidCharacterError("+", "in number (expecting digit)")}, + {"1", true, 1, nil}, + {"-1", false, 2, nil}, + {"00", true, 1, nil}, + {"-00", false, 2, nil}, + {"01", true, 1, nil}, + {"-01", false, 2, nil}, + {"0i", true, 1, nil}, + {"-0i", false, 2, nil}, + {"0f", true, 1, nil}, + {"-0f", false, 2, nil}, + {"9876543210", true, 10, nil}, + {"-9876543210", false, 11, nil}, + {"9876543210x", true, 10, nil}, + {"-9876543210x", false, 11, nil}, + {" 9876543210", true, 0, NewInvalidCharacterError(" ", "in number (expecting digit)")}, + {"- 9876543210", false, 1, NewInvalidCharacterError(" ", "in number (expecting digit)")}, + {strings.Repeat("9876543210", 1000), true, 10000, nil}, + {"-" + strings.Repeat("9876543210", 1000), false, 1 + 10000, nil}, + {"0.", false, 1, io.ErrUnexpectedEOF}, + {"-0.", false, 2, io.ErrUnexpectedEOF}, + {"0e", false, 1, io.ErrUnexpectedEOF}, + {"-0e", false, 2, io.ErrUnexpectedEOF}, + {"0E", false, 1, io.ErrUnexpectedEOF}, + {"-0E", false, 2, io.ErrUnexpectedEOF}, + {"0.0", false, 3, nil}, + {"-0.0", false, 4, nil}, + {"0e0", false, 3, nil}, + {"-0e0", false, 4, nil}, + {"0E0", false, 3, nil}, + {"-0E0", false, 4, nil}, + {"0.0123456789", false, 12, nil}, + {"-0.0123456789", false, 13, nil}, + {"1.f", false, 2, NewInvalidCharacterError("f", "in number (expecting digit)")}, + {"-1.f", false, 3, NewInvalidCharacterError("f", "in number (expecting digit)")}, + {"1.e", false, 2, NewInvalidCharacterError("e", "in number (expecting digit)")}, + {"-1.e", false, 3, NewInvalidCharacterError("e", "in number (expecting digit)")}, + {"1e0", false, 3, nil}, + {"-1e0", false, 4, nil}, + {"1E0", false, 3, nil}, + {"-1E0", false, 4, nil}, + {"1Ex", false, 2, NewInvalidCharacterError("x", "in number (expecting digit)")}, + {"-1Ex", false, 3, NewInvalidCharacterError("x", "in number (expecting digit)")}, + {"1e-0", false, 4, nil}, + {"-1e-0", false, 5, nil}, + {"1e+0", false, 4, nil}, + {"-1e+0", false, 5, nil}, + {"1E-0", false, 4, nil}, + {"-1E-0", false, 5, nil}, + {"1E+0", false, 4, nil}, + {"-1E+0", false, 5, nil}, + {"1E+00500", false, 8, nil}, + {"-1E+00500", false, 9, nil}, + {"1E+00500x", false, 8, nil}, + {"-1E+00500x", false, 9, nil}, + {"9876543210.0123456789e+01234589x", false, 31, nil}, + {"-9876543210.0123456789e+01234589x", false, 32, nil}, + {"1_000_000", true, 1, nil}, + {"0x12ef", true, 1, nil}, + {"0x1p-2", true, 1, nil}, + } + + for _, tt := range tests { + t.Run("", func(t *testing.T) { + switch got := ConsumeSimpleNumber([]byte(tt.in)); { + case tt.simple && got != tt.want: + t.Errorf("ConsumeSimpleNumber(%q) = %v, want %v", tt.in, got, tt.want) + case !tt.simple && got != 0: + t.Errorf("ConsumeSimpleNumber(%q) = %v, want %v", tt.in, got, 0) + } + + got, gotErr := ConsumeNumber([]byte(tt.in)) + if got != tt.want || !reflect.DeepEqual(gotErr, tt.wantErr) { + t.Errorf("ConsumeNumber(%q) = (%v, %v), want (%v, %v)", tt.in, got, gotErr, tt.want, tt.wantErr) + } + }) + } +} + +func TestParseHexUint16(t *testing.T) { + tests := []struct { + in string + want uint16 + wantOk bool + }{ + {"", 0, false}, + {"a", 0, false}, + {"ab", 0, false}, + {"abc", 0, false}, + {"abcd", 0xabcd, true}, + {"abcde", 0, false}, + {"9eA1", 0x9ea1, true}, + {"gggg", 0, false}, + {"0000", 0x0000, true}, + {"1234", 0x1234, true}, + } + + for _, tt := range tests { + t.Run("", func(t *testing.T) { + got, gotOk := parseHexUint16([]byte(tt.in)) + if got != tt.want || gotOk != tt.wantOk { + t.Errorf("parseHexUint16(%q) = (0x%04x, %v), want (0x%04x, %v)", tt.in, got, gotOk, tt.want, tt.wantOk) + } + }) + } +} + +func TestParseUint(t *testing.T) { + tests := []struct { + in string + want uint64 + wantOk bool + }{ + {"", 0, false}, + {"0", 0, true}, + {"1", 1, true}, + {"-1", 0, false}, + {"1f", 0, false}, + {"00", 0, false}, + {"01", 0, false}, + {"10", 10, true}, + {"10.9", 0, false}, + {" 10", 0, false}, + {"10 ", 0, false}, + {"123456789", 123456789, true}, + {"123456789d", 0, false}, + {"18446744073709551614", math.MaxUint64 - 1, true}, + {"18446744073709551615", math.MaxUint64, true}, + {"18446744073709551616", math.MaxUint64, false}, + {"18446744073709551620", math.MaxUint64, false}, + {"18446744073709551700", math.MaxUint64, false}, + {"18446744073709552000", math.MaxUint64, false}, + {"18446744073709560000", math.MaxUint64, false}, + {"18446744073709600000", math.MaxUint64, false}, + {"18446744073710000000", math.MaxUint64, false}, + {"18446744073800000000", math.MaxUint64, false}, + {"18446744074000000000", math.MaxUint64, false}, + {"18446744080000000000", math.MaxUint64, false}, + {"18446744100000000000", math.MaxUint64, false}, + {"18446745000000000000", math.MaxUint64, false}, + {"18446750000000000000", math.MaxUint64, false}, + {"18446800000000000000", math.MaxUint64, false}, + {"18447000000000000000", math.MaxUint64, false}, + {"18450000000000000000", math.MaxUint64, false}, + {"18500000000000000000", math.MaxUint64, false}, + {"19000000000000000000", math.MaxUint64, false}, + {"19999999999999999999", math.MaxUint64, false}, + {"20000000000000000000", math.MaxUint64, false}, + {"100000000000000000000", math.MaxUint64, false}, + {"99999999999999999999999999999999", math.MaxUint64, false}, + {"99999999999999999999999999999999f", 0, false}, + } + + for _, tt := range tests { + t.Run("", func(t *testing.T) { + got, gotOk := ParseUint([]byte(tt.in)) + if got != tt.want || gotOk != tt.wantOk { + t.Errorf("ParseUint(%q) = (%v, %v), want (%v, %v)", tt.in, got, gotOk, tt.want, tt.wantOk) + } + }) + } +} + +func TestParseFloat(t *testing.T) { + tests := []struct { + in string + want32 float64 + want64 float64 + wantOk bool + }{ + {"0", 0, 0, true}, + {"-1", -1, -1, true}, + {"1", 1, 1, true}, + + {"-16777215", -16777215, -16777215, true}, // -(1<<24 - 1) + {"16777215", 16777215, 16777215, true}, // +(1<<24 - 1) + {"-16777216", -16777216, -16777216, true}, // -(1<<24) + {"16777216", 16777216, 16777216, true}, // +(1<<24) + {"-16777217", -16777216, -16777217, true}, // -(1<<24 + 1) + {"16777217", 16777216, 16777217, true}, // +(1<<24 + 1) + + {"-9007199254740991", -9007199254740992, -9007199254740991, true}, // -(1<<53 - 1) + {"9007199254740991", 9007199254740992, 9007199254740991, true}, // +(1<<53 - 1) + {"-9007199254740992", -9007199254740992, -9007199254740992, true}, // -(1<<53) + {"9007199254740992", 9007199254740992, 9007199254740992, true}, // +(1<<53) + {"-9007199254740993", -9007199254740992, -9007199254740992, true}, // -(1<<53 + 1) + {"9007199254740993", 9007199254740992, 9007199254740992, true}, // +(1<<53 + 1) + + {"-1e1000", -math.MaxFloat32, -math.MaxFloat64, false}, + {"1e1000", +math.MaxFloat32, +math.MaxFloat64, false}, + } + + for _, tt := range tests { + t.Run("", func(t *testing.T) { + got32, gotOk32 := ParseFloat([]byte(tt.in), 32) + if got32 != tt.want32 || gotOk32 != tt.wantOk { + t.Errorf("ParseFloat(%q, 32) = (%v, %v), want (%v, %v)", tt.in, got32, gotOk32, tt.want32, tt.wantOk) + } + + got64, gotOk64 := ParseFloat([]byte(tt.in), 64) + if got64 != tt.want64 || gotOk64 != tt.wantOk { + t.Errorf("ParseFloat(%q, 64) = (%v, %v), want (%v, %v)", tt.in, got64, gotOk64, tt.want64, tt.wantOk) + } + }) + } +} diff --git a/go/src/encoding/json/internal/jsonwire/encode.go b/go/src/encoding/json/internal/jsonwire/encode.go new file mode 100644 index 0000000000000000000000000000000000000000..8f9b8ab09e64c4bc84ed17535781cafa8bcc49ea --- /dev/null +++ b/go/src/encoding/json/internal/jsonwire/encode.go @@ -0,0 +1,290 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsonwire + +import ( + "math" + "slices" + "strconv" + "unicode/utf16" + "unicode/utf8" + + "encoding/json/internal/jsonflags" +) + +// escapeASCII reports whether the ASCII character needs to be escaped. +// It conservatively assumes EscapeForHTML. +var escapeASCII = [...]uint8{ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // escape control characters + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // escape control characters + 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, // escape '"' and '&' + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, // escape '<' and '>' + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, // escape '\\' + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +} + +// NeedEscape reports whether src needs escaping of any characters. +// It conservatively assumes EscapeForHTML and EscapeForJS. +// It reports true for inputs with invalid UTF-8. +func NeedEscape[Bytes ~[]byte | ~string](src Bytes) bool { + var i int + for uint(len(src)) > uint(i) { + if c := src[i]; c < utf8.RuneSelf { + if escapeASCII[c] > 0 { + return true + } + i++ + } else { + r, rn := utf8.DecodeRuneInString(string(truncateMaxUTF8(src[i:]))) + if r == utf8.RuneError || r == '\u2028' || r == '\u2029' { + return true + } + i += rn + } + } + return false +} + +// AppendQuote appends src to dst as a JSON string per RFC 7159, section 7. +// +// It takes in flags and respects the following: +// - EscapeForHTML escapes '<', '>', and '&'. +// - EscapeForJS escapes '\u2028' and '\u2029'. +// - AllowInvalidUTF8 avoids reporting an error for invalid UTF-8. +// +// Regardless of whether AllowInvalidUTF8 is specified, +// invalid bytes are replaced with the Unicode replacement character ('\ufffd'). +// If no escape flags are set, then the shortest representable form is used, +// which is also the canonical form for strings (RFC 8785, section 3.2.2.2). +func AppendQuote[Bytes ~[]byte | ~string](dst []byte, src Bytes, flags *jsonflags.Flags) ([]byte, error) { + var i, n int + var hasInvalidUTF8 bool + dst = slices.Grow(dst, len(`"`)+len(src)+len(`"`)) + dst = append(dst, '"') + for uint(len(src)) > uint(n) { + if c := src[n]; c < utf8.RuneSelf { + // Handle single-byte ASCII. + n++ + if escapeASCII[c] == 0 { + continue // no escaping possibly needed + } + // Handle escaping of single-byte ASCII. + if !(c == '<' || c == '>' || c == '&') || flags.Get(jsonflags.EscapeForHTML) { + dst = append(dst, src[i:n-1]...) + dst = appendEscapedASCII(dst, c) + i = n + } + } else { + // Handle multi-byte Unicode. + r, rn := utf8.DecodeRuneInString(string(truncateMaxUTF8(src[n:]))) + n += rn + if r != utf8.RuneError && r != '\u2028' && r != '\u2029' { + continue // no escaping possibly needed + } + // Handle escaping of multi-byte Unicode. + switch { + case isInvalidUTF8(r, rn): + hasInvalidUTF8 = true + dst = append(dst, src[i:n-rn]...) + dst = append(dst, "\ufffd"...) + i = n + case (r == '\u2028' || r == '\u2029') && flags.Get(jsonflags.EscapeForJS): + dst = append(dst, src[i:n-rn]...) + dst = appendEscapedUnicode(dst, r) + i = n + } + } + } + dst = append(dst, src[i:n]...) + dst = append(dst, '"') + if hasInvalidUTF8 && !flags.Get(jsonflags.AllowInvalidUTF8) { + return dst, ErrInvalidUTF8 + } + return dst, nil +} + +func appendEscapedASCII(dst []byte, c byte) []byte { + switch c { + case '"', '\\': + dst = append(dst, '\\', c) + case '\b': + dst = append(dst, "\\b"...) + case '\f': + dst = append(dst, "\\f"...) + case '\n': + dst = append(dst, "\\n"...) + case '\r': + dst = append(dst, "\\r"...) + case '\t': + dst = append(dst, "\\t"...) + default: + dst = appendEscapedUTF16(dst, uint16(c)) + } + return dst +} + +func appendEscapedUnicode(dst []byte, r rune) []byte { + if r1, r2 := utf16.EncodeRune(r); r1 != '\ufffd' && r2 != '\ufffd' { + dst = appendEscapedUTF16(dst, uint16(r1)) + dst = appendEscapedUTF16(dst, uint16(r2)) + } else { + dst = appendEscapedUTF16(dst, uint16(r)) + } + return dst +} + +func appendEscapedUTF16(dst []byte, x uint16) []byte { + const hex = "0123456789abcdef" + return append(dst, '\\', 'u', hex[(x>>12)&0xf], hex[(x>>8)&0xf], hex[(x>>4)&0xf], hex[(x>>0)&0xf]) +} + +// ReformatString consumes a JSON string from src and appends it to dst, +// reformatting it if necessary according to the specified flags. +// It returns the appended output and the number of consumed input bytes. +func ReformatString(dst, src []byte, flags *jsonflags.Flags) ([]byte, int, error) { + // TODO: Should this update ValueFlags as input? + var valFlags ValueFlags + n, err := ConsumeString(&valFlags, src, !flags.Get(jsonflags.AllowInvalidUTF8)) + if err != nil { + return dst, n, err + } + + // If the output requires no special escapes, and the input + // is already in canonical form or should be preserved verbatim, + // then directly copy the input to the output. + if !flags.Get(jsonflags.AnyEscape) && + (valFlags.IsCanonical() || flags.Get(jsonflags.PreserveRawStrings)) { + dst = append(dst, src[:n]...) // copy the string verbatim + return dst, n, nil + } + + // Under [jsonflags.PreserveRawStrings], any pre-escaped sequences + // remain escaped, however we still need to respect the + // [jsonflags.EscapeForHTML] and [jsonflags.EscapeForJS] options. + if flags.Get(jsonflags.PreserveRawStrings) { + var i, lastAppendIndex int + for i < n { + if c := src[i]; c < utf8.RuneSelf { + if (c == '<' || c == '>' || c == '&') && flags.Get(jsonflags.EscapeForHTML) { + dst = append(dst, src[lastAppendIndex:i]...) + dst = appendEscapedASCII(dst, c) + lastAppendIndex = i + 1 + } + i++ + } else { + r, rn := utf8.DecodeRune(truncateMaxUTF8(src[i:])) + if (r == '\u2028' || r == '\u2029') && flags.Get(jsonflags.EscapeForJS) { + dst = append(dst, src[lastAppendIndex:i]...) + dst = appendEscapedUnicode(dst, r) + lastAppendIndex = i + rn + } + i += rn + } + } + return append(dst, src[lastAppendIndex:n]...), n, nil + } + + // The input contains characters that might need escaping, + // unnecessary escape sequences, or invalid UTF-8. + // Perform a round-trip unquote and quote to properly reformat + // these sequences according the current flags. + b, _ := AppendUnquote(nil, src[:n]) + dst, _ = AppendQuote(dst, b, flags) + return dst, n, nil +} + +// AppendFloat appends src to dst as a JSON number per RFC 7159, section 6. +// It formats numbers similar to the ES6 number-to-string conversion. +// See https://go.dev/issue/14135. +// +// The output is identical to ECMA-262, 6th edition, section 7.1.12.1 and with +// RFC 8785, section 3.2.2.3 for 64-bit floating-point numbers except for -0, +// which is formatted as -0 instead of just 0. +// +// For 32-bit floating-point numbers, +// the output is a 32-bit equivalent of the algorithm. +// Note that ECMA-262 specifies no algorithm for 32-bit numbers. +func AppendFloat(dst []byte, src float64, bits int) []byte { + if bits == 32 { + src = float64(float32(src)) + } + + abs := math.Abs(src) + fmt := byte('f') + if abs != 0 { + if bits == 64 && (float64(abs) < 1e-6 || float64(abs) >= 1e21) || + bits == 32 && (float32(abs) < 1e-6 || float32(abs) >= 1e21) { + fmt = 'e' + } + } + dst = strconv.AppendFloat(dst, src, fmt, -1, bits) + if fmt == 'e' { + // Clean up e-09 to e-9. + n := len(dst) + if n >= 4 && dst[n-4] == 'e' && dst[n-3] == '-' && dst[n-2] == '0' { + dst[n-2] = dst[n-1] + dst = dst[:n-1] + } + } + return dst +} + +// ReformatNumber consumes a JSON string from src and appends it to dst, +// canonicalizing it if specified. +// It returns the appended output and the number of consumed input bytes. +func ReformatNumber(dst, src []byte, flags *jsonflags.Flags) ([]byte, int, error) { + n, err := ConsumeNumber(src) + if err != nil { + return dst, n, err + } + if !flags.Get(jsonflags.CanonicalizeNumbers) { + dst = append(dst, src[:n]...) // copy the number verbatim + return dst, n, nil + } + + // Identify the kind of number. + var isFloat bool + for _, c := range src[:n] { + if c == '.' || c == 'e' || c == 'E' { + isFloat = true // has fraction or exponent + break + } + } + + // Check if need to canonicalize this kind of number. + switch { + case string(src[:n]) == "-0": + break // canonicalize -0 as 0 regardless of kind + case isFloat: + if !flags.Get(jsonflags.CanonicalizeRawFloats) { + dst = append(dst, src[:n]...) // copy the number verbatim + return dst, n, nil + } + default: + // As an optimization, we can copy integer numbers below 2⁵³ verbatim + // since the canonical form is always identical. + const maxExactIntegerDigits = 16 // len(strconv.AppendUint(nil, 1<<53, 10)) + if !flags.Get(jsonflags.CanonicalizeRawInts) || n < maxExactIntegerDigits { + dst = append(dst, src[:n]...) // copy the number verbatim + return dst, n, nil + } + } + + // Parse and reformat the number (which uses a canonical format). + fv, _ := strconv.ParseFloat(string(src[:n]), 64) + switch { + case fv == 0: + fv = 0 // normalize negative zero as just zero + case math.IsInf(fv, +1): + fv = +math.MaxFloat64 + case math.IsInf(fv, -1): + fv = -math.MaxFloat64 + } + return AppendFloat(dst, fv, 64), n, nil +} diff --git a/go/src/encoding/json/internal/jsonwire/encode_test.go b/go/src/encoding/json/internal/jsonwire/encode_test.go new file mode 100644 index 0000000000000000000000000000000000000000..6459d20e0951eae38f77b9859004b3eb5390a085 --- /dev/null +++ b/go/src/encoding/json/internal/jsonwire/encode_test.go @@ -0,0 +1,332 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsonwire + +import ( + "bufio" + "bytes" + "compress/gzip" + "crypto/sha256" + "encoding/binary" + "encoding/hex" + "flag" + "math" + "net/http" + "reflect" + "strconv" + "strings" + "testing" + "time" + + "encoding/json/internal/jsonflags" +) + +func TestAppendQuote(t *testing.T) { + tests := []struct { + in string + flags jsonflags.Bools + want string + wantErr error + wantErrUTF8 error + }{ + {"", 0, `""`, nil, nil}, + {"hello", 0, `"hello"`, nil, nil}, + {"\x00", 0, `"\u0000"`, nil, nil}, + {"\x1f", 0, `"\u001f"`, nil, nil}, + {"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 0, `"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"`, nil, nil}, + {" !#$%&'()*+,-./0123456789:;<=>?@[]^_`{|}~\x7f", 0, "\" !#$%&'()*+,-./0123456789:;<=>?@[]^_`{|}~\x7f\"", nil, nil}, + {" !#$%&'()*+,-./0123456789:;<=>?@[]^_`{|}~\x7f", jsonflags.EscapeForHTML, "\" !#$%\\u0026'()*+,-./0123456789:;\\u003c=\\u003e?@[]^_`{|}~\x7f\"", nil, nil}, + {" !#$%&'()*+,-./0123456789:;<=>?@[]^_`{|}~\x7f", jsonflags.EscapeForJS, "\" !#$%&'()*+,-./0123456789:;<=>?@[]^_`{|}~\x7f\"", nil, nil}, + {"\u2027\u2028\u2029\u2030", 0, "\"\u2027\u2028\u2029\u2030\"", nil, nil}, + {"\u2027\u2028\u2029\u2030", jsonflags.EscapeForHTML, "\"\u2027\u2028\u2029\u2030\"", nil, nil}, + {"\u2027\u2028\u2029\u2030", jsonflags.EscapeForJS, "\"\u2027\\u2028\\u2029\u2030\"", nil, nil}, + {"x\x80\ufffd", 0, "\"x\ufffd\ufffd\"", nil, ErrInvalidUTF8}, + {"x\xff\ufffd", 0, "\"x\ufffd\ufffd\"", nil, ErrInvalidUTF8}, + {"x\xc0", 0, "\"x\ufffd\"", nil, ErrInvalidUTF8}, + {"x\xc0\x80", 0, "\"x\ufffd\ufffd\"", nil, ErrInvalidUTF8}, + {"x\xe0", 0, "\"x\ufffd\"", nil, ErrInvalidUTF8}, + {"x\xe0\x80", 0, "\"x\ufffd\ufffd\"", nil, ErrInvalidUTF8}, + {"x\xe0\x80\x80", 0, "\"x\ufffd\ufffd\ufffd\"", nil, ErrInvalidUTF8}, + {"x\xf0", 0, "\"x\ufffd\"", nil, ErrInvalidUTF8}, + {"x\xf0\x80", 0, "\"x\ufffd\ufffd\"", nil, ErrInvalidUTF8}, + {"x\xf0\x80\x80", 0, "\"x\ufffd\ufffd\ufffd\"", nil, ErrInvalidUTF8}, + {"x\xf0\x80\x80\x80", 0, "\"x\ufffd\ufffd\ufffd\ufffd\"", nil, ErrInvalidUTF8}, + {"x\xed\xba\xad", 0, "\"x\ufffd\ufffd\ufffd\"", nil, ErrInvalidUTF8}, + {"\"\\/\b\f\n\r\t", 0, `"\"\\/\b\f\n\r\t"`, nil, nil}, + {"٩(-̮̮̃-̃)۶ ٩(●̮̮̃•̃)۶ ٩(͡๏̯͡๏)۶ ٩(-̮̮̃•̃).", 0, `"٩(-̮̮̃-̃)۶ ٩(●̮̮̃•̃)۶ ٩(͡๏̯͡๏)۶ ٩(-̮̮̃•̃)."`, nil, nil}, + {"\u0080\u00f6\u20ac\ud799\ue000\ufb33\ufffd\U0001f602", 0, "\"\u0080\u00f6\u20ac\ud799\ue000\ufb33\ufffd\U0001f602\"", nil, nil}, + {"\u0000\u001f\u0020\u0022\u0026\u003c\u003e\u005c\u007f\u0080\u2028\u2029\ufffd\U0001f602", 0, "\"\\u0000\\u001f\u0020\\\"\u0026\u003c\u003e\\\\\u007f\u0080\u2028\u2029\ufffd\U0001f602\"", nil, nil}, + } + + for _, tt := range tests { + t.Run("", func(t *testing.T) { + var flags jsonflags.Flags + flags.Set(tt.flags | 1) + + flags.Set(jsonflags.AllowInvalidUTF8 | 1) + got, gotErr := AppendQuote(nil, tt.in, &flags) + if string(got) != tt.want || !reflect.DeepEqual(gotErr, tt.wantErr) { + t.Errorf("AppendQuote(nil, %q, ...) = (%s, %v), want (%s, %v)", tt.in, got, gotErr, tt.want, tt.wantErr) + } + flags.Set(jsonflags.AllowInvalidUTF8 | 0) + switch got, gotErr := AppendQuote(nil, tt.in, &flags); { + case tt.wantErrUTF8 == nil && (string(got) != tt.want || !reflect.DeepEqual(gotErr, tt.wantErr)): + t.Errorf("AppendQuote(nil, %q, ...) = (%s, %v), want (%s, %v)", tt.in, got, gotErr, tt.want, tt.wantErr) + case tt.wantErrUTF8 != nil && (!strings.HasPrefix(tt.want, string(got)) || !reflect.DeepEqual(gotErr, tt.wantErrUTF8)): + t.Errorf("AppendQuote(nil, %q, ...) = (%s, %v), want (%s, %v)", tt.in, got, gotErr, tt.want, tt.wantErrUTF8) + } + }) + } +} + +func TestAppendNumber(t *testing.T) { + tests := []struct { + in float64 + want32 string + want64 string + }{ + {math.E, "2.7182817", "2.718281828459045"}, + {math.Pi, "3.1415927", "3.141592653589793"}, + {math.SmallestNonzeroFloat32, "1e-45", "1.401298464324817e-45"}, + {math.SmallestNonzeroFloat64, "0", "5e-324"}, + {math.MaxFloat32, "3.4028235e+38", "3.4028234663852886e+38"}, + {math.MaxFloat64, "", "1.7976931348623157e+308"}, + {0.1111111111111111, "0.11111111", "0.1111111111111111"}, + {0.2222222222222222, "0.22222222", "0.2222222222222222"}, + {0.3333333333333333, "0.33333334", "0.3333333333333333"}, + {0.4444444444444444, "0.44444445", "0.4444444444444444"}, + {0.5555555555555555, "0.5555556", "0.5555555555555555"}, + {0.6666666666666666, "0.6666667", "0.6666666666666666"}, + {0.7777777777777777, "0.7777778", "0.7777777777777777"}, + {0.8888888888888888, "0.8888889", "0.8888888888888888"}, + {0.9999999999999999, "1", "0.9999999999999999"}, + + // The following entries are from RFC 8785, appendix B + // which are designed to ensure repeatable formatting of 64-bit floats. + {math.Float64frombits(0x0000000000000000), "0", "0"}, + {math.Float64frombits(0x8000000000000000), "-0", "-0"}, // differs from RFC 8785 + {math.Float64frombits(0x0000000000000001), "0", "5e-324"}, + {math.Float64frombits(0x8000000000000001), "-0", "-5e-324"}, + {math.Float64frombits(0x7fefffffffffffff), "", "1.7976931348623157e+308"}, + {math.Float64frombits(0xffefffffffffffff), "", "-1.7976931348623157e+308"}, + {math.Float64frombits(0x4340000000000000), "9007199000000000", "9007199254740992"}, + {math.Float64frombits(0xc340000000000000), "-9007199000000000", "-9007199254740992"}, + {math.Float64frombits(0x4430000000000000), "295147900000000000000", "295147905179352830000"}, + {math.Float64frombits(0x44b52d02c7e14af5), "1e+23", "9.999999999999997e+22"}, + {math.Float64frombits(0x44b52d02c7e14af6), "1e+23", "1e+23"}, + {math.Float64frombits(0x44b52d02c7e14af7), "1e+23", "1.0000000000000001e+23"}, + {math.Float64frombits(0x444b1ae4d6e2ef4e), "1e+21", "999999999999999700000"}, + {math.Float64frombits(0x444b1ae4d6e2ef4f), "1e+21", "999999999999999900000"}, + {math.Float64frombits(0x444b1ae4d6e2ef50), "1e+21", "1e+21"}, + {math.Float64frombits(0x3eb0c6f7a0b5ed8c), "0.000001", "9.999999999999997e-7"}, + {math.Float64frombits(0x3eb0c6f7a0b5ed8d), "0.000001", "0.000001"}, + {math.Float64frombits(0x41b3de4355555553), "333333340", "333333333.3333332"}, + {math.Float64frombits(0x41b3de4355555554), "333333340", "333333333.33333325"}, + {math.Float64frombits(0x41b3de4355555555), "333333340", "333333333.3333333"}, + {math.Float64frombits(0x41b3de4355555556), "333333340", "333333333.3333334"}, + {math.Float64frombits(0x41b3de4355555557), "333333340", "333333333.33333343"}, + {math.Float64frombits(0xbecbf647612f3696), "-0.0000033333333", "-0.0000033333333333333333"}, + {math.Float64frombits(0x43143ff3c1cb0959), "1424953900000000", "1424953923781206.2"}, + + // The following are select entries from RFC 8785, appendix B, + // but modified for equivalent 32-bit behavior. + {float64(math.Float32frombits(0x65a96815)), "9.999999e+22", "9.999998877476383e+22"}, + {float64(math.Float32frombits(0x65a96816)), "1e+23", "9.999999778196308e+22"}, + {float64(math.Float32frombits(0x65a96817)), "1.0000001e+23", "1.0000000678916234e+23"}, + {float64(math.Float32frombits(0x6258d725)), "999999900000000000000", "999999879303389000000"}, + {float64(math.Float32frombits(0x6258d726)), "999999950000000000000", "999999949672133200000"}, + {float64(math.Float32frombits(0x6258d727)), "1e+21", "1.0000000200408773e+21"}, + {float64(math.Float32frombits(0x6258d728)), "1.0000001e+21", "1.0000000904096215e+21"}, + {float64(math.Float32frombits(0x358637bc)), "9.999999e-7", "9.99999883788405e-7"}, + {float64(math.Float32frombits(0x358637bd)), "0.000001", "9.999999974752427e-7"}, + {float64(math.Float32frombits(0x358637be)), "0.0000010000001", "0.0000010000001111620804"}, + } + + for _, tt := range tests { + t.Run("", func(t *testing.T) { + if got32 := string(AppendFloat(nil, tt.in, 32)); got32 != tt.want32 && tt.want32 != "" { + t.Errorf("AppendFloat(nil, %v, 32) = %v, want %v", tt.in, got32, tt.want32) + } + if got64 := string(AppendFloat(nil, tt.in, 64)); got64 != tt.want64 && tt.want64 != "" { + t.Errorf("AppendFloat(nil, %v, 64) = %v, want %v", tt.in, got64, tt.want64) + } + }) + } +} + +// The default of 1e4 lines was chosen since it is sufficiently large to include +// test numbers from all three categories (i.e., static, series, and random). +// Yet, it is sufficiently low to execute quickly relative to other tests. +// +// Processing 1e8 lines takes a minute and processes about 4GiB worth of text. +var testCanonicalNumberLines = flag.Float64("canonical-number-lines", 1e4, "specify the number of lines to check from the canonical numbers testdata") + +// TestCanonicalNumber verifies that appendNumber complies with RFC 8785 +// according to the testdata provided by the reference implementation. +// See https://github.com/cyberphone/json-canonicalization/tree/master/testdata#es6-numbers. +func TestCanonicalNumber(t *testing.T) { + const testfileURL = "https://github.com/cyberphone/json-canonicalization/releases/download/es6testfile/es6testfile100m.txt.gz" + hashes := map[float64]string{ + 1e3: "be18b62b6f69cdab33a7e0dae0d9cfa869fda80ddc712221570f9f40a5878687", + 1e4: "b9f7a8e75ef22a835685a52ccba7f7d6bdc99e34b010992cbc5864cd12be6892", + 1e5: "22776e6d4b49fa294a0d0f349268e5c28808fe7e0cb2bcbe28f63894e494d4c7", + 1e6: "49415fee2c56c77864931bd3624faad425c3c577d6d74e89a83bc725506dad16", + 1e7: "b9f8a44a91d46813b21b9602e72f112613c91408db0b8341fb94603d9db135e0", + 1e8: "0f7dda6b0837dde083c5d6b896f7d62340c8a2415b0c7121d83145e08a755272", + } + wantHash := hashes[*testCanonicalNumberLines] + if wantHash == "" { + t.Fatalf("canonical-number-lines must be one of the following values: 1e3, 1e4, 1e5, 1e6, 1e7, 1e8") + } + numLines := int(*testCanonicalNumberLines) + + // generator returns a function that generates the next float64 to format. + // This implements the algorithm specified in the reference implementation. + generator := func() func() float64 { + static := [...]uint64{ + 0x0000000000000000, 0x8000000000000000, 0x0000000000000001, 0x8000000000000001, + 0xc46696695dbd1cc3, 0xc43211ede4974a35, 0xc3fce97ca0f21056, 0xc3c7213080c1a6ac, + 0xc39280f39a348556, 0xc35d9b1f5d20d557, 0xc327af4c4a80aaac, 0xc2f2f2a36ecd5556, + 0xc2be51057e155558, 0xc28840d131aaaaac, 0xc253670dc1555557, 0xc21f0b4935555557, + 0xc1e8d5d42aaaaaac, 0xc1b3de4355555556, 0xc17fca0555555556, 0xc1496e6aaaaaaaab, + 0xc114585555555555, 0xc0e046aaaaaaaaab, 0xc0aa0aaaaaaaaaaa, 0xc074d55555555555, + 0xc040aaaaaaaaaaab, 0xc00aaaaaaaaaaaab, 0xbfd5555555555555, 0xbfa1111111111111, + 0xbf6b4e81b4e81b4f, 0xbf35d867c3ece2a5, 0xbf0179ec9cbd821e, 0xbecbf647612f3696, + 0xbe965e9f80f29212, 0xbe61e54c672874db, 0xbe2ca213d840baf8, 0xbdf6e80fe033c8c6, + 0xbdc2533fe68fd3d2, 0xbd8d51ffd74c861c, 0xbd5774ccac3d3817, 0xbd22c3d6f030f9ac, + 0xbcee0624b3818f79, 0xbcb804ea293472c7, 0xbc833721ba905bd3, 0xbc4ebe9c5db3c61e, + 0xbc18987d17c304e5, 0xbbe3ad30dfcf371d, 0xbbaf7b816618582f, 0xbb792f9ab81379bf, + 0xbb442615600f9499, 0xbb101e77800c76e1, 0xbad9ca58cce0be35, 0xbaa4a1e0a3e6fe90, + 0xba708180831f320d, 0xba3a68cd9e985016, 0x446696695dbd1cc3, 0x443211ede4974a35, + 0x43fce97ca0f21056, 0x43c7213080c1a6ac, 0x439280f39a348556, 0x435d9b1f5d20d557, + 0x4327af4c4a80aaac, 0x42f2f2a36ecd5556, 0x42be51057e155558, 0x428840d131aaaaac, + 0x4253670dc1555557, 0x421f0b4935555557, 0x41e8d5d42aaaaaac, 0x41b3de4355555556, + 0x417fca0555555556, 0x41496e6aaaaaaaab, 0x4114585555555555, 0x40e046aaaaaaaaab, + 0x40aa0aaaaaaaaaaa, 0x4074d55555555555, 0x4040aaaaaaaaaaab, 0x400aaaaaaaaaaaab, + 0x3fd5555555555555, 0x3fa1111111111111, 0x3f6b4e81b4e81b4f, 0x3f35d867c3ece2a5, + 0x3f0179ec9cbd821e, 0x3ecbf647612f3696, 0x3e965e9f80f29212, 0x3e61e54c672874db, + 0x3e2ca213d840baf8, 0x3df6e80fe033c8c6, 0x3dc2533fe68fd3d2, 0x3d8d51ffd74c861c, + 0x3d5774ccac3d3817, 0x3d22c3d6f030f9ac, 0x3cee0624b3818f79, 0x3cb804ea293472c7, + 0x3c833721ba905bd3, 0x3c4ebe9c5db3c61e, 0x3c18987d17c304e5, 0x3be3ad30dfcf371d, + 0x3baf7b816618582f, 0x3b792f9ab81379bf, 0x3b442615600f9499, 0x3b101e77800c76e1, + 0x3ad9ca58cce0be35, 0x3aa4a1e0a3e6fe90, 0x3a708180831f320d, 0x3a3a68cd9e985016, + 0x4024000000000000, 0x4014000000000000, 0x3fe0000000000000, 0x3fa999999999999a, + 0x3f747ae147ae147b, 0x3f40624dd2f1a9fc, 0x3f0a36e2eb1c432d, 0x3ed4f8b588e368f1, + 0x3ea0c6f7a0b5ed8d, 0x3e6ad7f29abcaf48, 0x3e35798ee2308c3a, 0x3ed539223589fa95, + 0x3ed4ff26cd5a7781, 0x3ed4f95a762283ff, 0x3ed4f8c60703520c, 0x3ed4f8b72f19cd0d, + 0x3ed4f8b5b31c0c8d, 0x3ed4f8b58d1c461a, 0x3ed4f8b5894f7f0e, 0x3ed4f8b588ee37f3, + 0x3ed4f8b588e47da4, 0x3ed4f8b588e3849c, 0x3ed4f8b588e36bb5, 0x3ed4f8b588e36937, + 0x3ed4f8b588e368f8, 0x3ed4f8b588e368f1, 0x3ff0000000000000, 0xbff0000000000000, + 0xbfeffffffffffffa, 0xbfeffffffffffffb, 0x3feffffffffffffa, 0x3feffffffffffffb, + 0x3feffffffffffffc, 0x3feffffffffffffe, 0xbfefffffffffffff, 0xbfefffffffffffff, + 0x3fefffffffffffff, 0x3fefffffffffffff, 0x3fd3333333333332, 0x3fd3333333333333, + 0x3fd3333333333334, 0x0010000000000000, 0x000ffffffffffffd, 0x000fffffffffffff, + 0x7fefffffffffffff, 0xffefffffffffffff, 0x4340000000000000, 0xc340000000000000, + 0x4430000000000000, 0x44b52d02c7e14af5, 0x44b52d02c7e14af6, 0x44b52d02c7e14af7, + 0x444b1ae4d6e2ef4e, 0x444b1ae4d6e2ef4f, 0x444b1ae4d6e2ef50, 0x3eb0c6f7a0b5ed8c, + 0x3eb0c6f7a0b5ed8d, 0x41b3de4355555553, 0x41b3de4355555554, 0x41b3de4355555555, + 0x41b3de4355555556, 0x41b3de4355555557, 0xbecbf647612f3696, 0x43143ff3c1cb0959, + } + var state struct { + idx int + data []byte + block [sha256.Size]byte + } + return func() float64 { + const numSerial = 2000 + var f float64 + switch { + case state.idx < len(static): + f = math.Float64frombits(static[state.idx]) + case state.idx < len(static)+numSerial: + f = math.Float64frombits(0x0010000000000000 + uint64(state.idx-len(static))) + default: + for f == 0 || math.IsNaN(f) || math.IsInf(f, 0) { + if len(state.data) == 0 { + state.block = sha256.Sum256(state.block[:]) + state.data = state.block[:] + } + f = math.Float64frombits(binary.LittleEndian.Uint64(state.data)) + state.data = state.data[8:] + } + } + state.idx++ + return f + } + } + + // Pass through the test twice. In the first pass we only hash the output, + // while in the second pass we check every line against the golden testdata. + // If the hashes match in the first pass, then we skip the second pass. + for _, checkGolden := range []bool{false, true} { + var br *bufio.Reader // for line-by-line reading of es6testfile100m.txt + if checkGolden { + resp, err := http.Get(testfileURL) + if err != nil { + t.Fatalf("http.Get error: %v", err) + } + defer resp.Body.Close() + + zr, err := gzip.NewReader(resp.Body) + if err != nil { + t.Fatalf("gzip.NewReader error: %v", err) + } + + br = bufio.NewReader(zr) + } + + // appendNumberJCS differs from appendNumber only for -0. + appendNumberJCS := func(b []byte, f float64) []byte { + if math.Signbit(f) && f == 0 { + return append(b, '0') + } + return AppendFloat(b, f, 64) + } + + var gotLine []byte + next := generator() + hash := sha256.New() + start := time.Now() + lastPrint := start + for n := 1; n <= numLines; n++ { + // Generate the formatted line for this number. + f := next() + gotLine = gotLine[:0] // reset from previous usage + gotLine = strconv.AppendUint(gotLine, math.Float64bits(f), 16) + gotLine = append(gotLine, ',') + gotLine = appendNumberJCS(gotLine, f) + gotLine = append(gotLine, '\n') + hash.Write(gotLine) + + // Check that the formatted line matches. + if checkGolden { + wantLine, err := br.ReadBytes('\n') + if err != nil { + t.Fatalf("bufio.Reader.ReadBytes error: %v", err) + } + if !bytes.Equal(gotLine, wantLine) { + t.Errorf("mismatch on line %d:\n\tgot %v\n\twant %v", + n, strings.TrimSpace(string(gotLine)), strings.TrimSpace(string(wantLine))) + } + } + + // Print progress. + if now := time.Now(); now.Sub(lastPrint) > time.Second || n == numLines { + remaining := float64(now.Sub(start)) * float64(numLines-n) / float64(n) + t.Logf("%0.3f%% (%v remaining)", + 100.0*float64(n)/float64(numLines), + time.Duration(remaining).Round(time.Second)) + lastPrint = now + } + } + + gotHash := hex.EncodeToString(hash.Sum(nil)) + if gotHash == wantHash { + return // hashes match, no need to check golden testdata + } + } +} diff --git a/go/src/encoding/json/internal/jsonwire/wire.go b/go/src/encoding/json/internal/jsonwire/wire.go new file mode 100644 index 0000000000000000000000000000000000000000..6cf19c5cfe62bb910ddba8027070cf27b6a36ab6 --- /dev/null +++ b/go/src/encoding/json/internal/jsonwire/wire.go @@ -0,0 +1,217 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +// Package jsonwire implements stateless functionality for handling JSON text. +package jsonwire + +import ( + "cmp" + "errors" + "strconv" + "strings" + "unicode" + "unicode/utf16" + "unicode/utf8" +) + +// TrimSuffixWhitespace trims JSON from the end of b. +func TrimSuffixWhitespace(b []byte) []byte { + // NOTE: The arguments and logic are kept simple to keep this inlinable. + n := len(b) - 1 + for n >= 0 && (b[n] == ' ' || b[n] == '\t' || b[n] == '\r' || b[n] == '\n') { + n-- + } + return b[:n+1] +} + +// TrimSuffixString trims a valid JSON string at the end of b. +// The behavior is undefined if there is not a valid JSON string present. +func TrimSuffixString(b []byte) []byte { + // NOTE: The arguments and logic are kept simple to keep this inlinable. + if len(b) > 0 && b[len(b)-1] == '"' { + b = b[:len(b)-1] + } + for len(b) >= 2 && !(b[len(b)-1] == '"' && b[len(b)-2] != '\\') { + b = b[:len(b)-1] // trim all characters except an unescaped quote + } + if len(b) > 0 && b[len(b)-1] == '"' { + b = b[:len(b)-1] + } + return b +} + +// HasSuffixByte reports whether b ends with c. +func HasSuffixByte(b []byte, c byte) bool { + // NOTE: The arguments and logic are kept simple to keep this inlinable. + return len(b) > 0 && b[len(b)-1] == c +} + +// TrimSuffixByte removes c from the end of b if it is present. +func TrimSuffixByte(b []byte, c byte) []byte { + // NOTE: The arguments and logic are kept simple to keep this inlinable. + if len(b) > 0 && b[len(b)-1] == c { + return b[:len(b)-1] + } + return b +} + +// QuoteRune quotes the first rune in the input. +func QuoteRune[Bytes ~[]byte | ~string](b Bytes) string { + r, n := utf8.DecodeRuneInString(string(truncateMaxUTF8(b))) + if r == utf8.RuneError && n == 1 { + return `'\x` + strconv.FormatUint(uint64(b[0]), 16) + `'` + } + return strconv.QuoteRune(r) +} + +// CompareUTF16 lexicographically compares x to y according +// to the UTF-16 codepoints of the UTF-8 encoded input strings. +// This implements the ordering specified in RFC 8785, section 3.2.3. +func CompareUTF16[Bytes ~[]byte | ~string](x, y Bytes) int { + // NOTE: This is an optimized, mostly allocation-free implementation + // of CompareUTF16Simple in wire_test.go. FuzzCompareUTF16 verifies that the + // two implementations agree on the result of comparing any two strings. + isUTF16Self := func(r rune) bool { + return ('\u0000' <= r && r <= '\uD7FF') || ('\uE000' <= r && r <= '\uFFFF') + } + + for { + if len(x) == 0 || len(y) == 0 { + return cmp.Compare(len(x), len(y)) + } + + // ASCII fast-path. + if x[0] < utf8.RuneSelf || y[0] < utf8.RuneSelf { + if x[0] != y[0] { + return cmp.Compare(x[0], y[0]) + } + x, y = x[1:], y[1:] + continue + } + + // Decode next pair of runes as UTF-8. + rx, nx := utf8.DecodeRuneInString(string(truncateMaxUTF8(x))) + ry, ny := utf8.DecodeRuneInString(string(truncateMaxUTF8(y))) + + selfx := isUTF16Self(rx) + selfy := isUTF16Self(ry) + switch { + // The x rune is a single UTF-16 codepoint, while + // the y rune is a surrogate pair of UTF-16 codepoints. + case selfx && !selfy: + ry, _ = utf16.EncodeRune(ry) + // The y rune is a single UTF-16 codepoint, while + // the x rune is a surrogate pair of UTF-16 codepoints. + case selfy && !selfx: + rx, _ = utf16.EncodeRune(rx) + } + if rx != ry { + return cmp.Compare(rx, ry) + } + + // Check for invalid UTF-8, in which case, + // we just perform a byte-for-byte comparison. + if isInvalidUTF8(rx, nx) || isInvalidUTF8(ry, ny) { + if x[0] != y[0] { + return cmp.Compare(x[0], y[0]) + } + } + x, y = x[nx:], y[ny:] + } +} + +// truncateMaxUTF8 truncates b such it contains at least one rune. +// +// The utf8 package currently lacks generic variants, which complicates +// generic functions that operates on either []byte or string. +// As a hack, we always call the utf8 function operating on strings, +// but always truncate the input such that the result is identical. +// +// Example usage: +// +// utf8.DecodeRuneInString(string(truncateMaxUTF8(b))) +// +// Converting a []byte to a string is stack allocated since +// truncateMaxUTF8 guarantees that the []byte is short. +func truncateMaxUTF8[Bytes ~[]byte | ~string](b Bytes) Bytes { + // TODO(https://go.dev/issue/56948): Remove this function and + // instead directly call generic utf8 functions wherever used. + if len(b) > utf8.UTFMax { + return b[:utf8.UTFMax] + } + return b +} + +// TODO(https://go.dev/issue/70547): Use utf8.ErrInvalid instead. +var ErrInvalidUTF8 = errors.New("invalid UTF-8") + +func NewInvalidCharacterError[Bytes ~[]byte | ~string](prefix Bytes, where string) error { + what := QuoteRune(prefix) + return errors.New("invalid character " + what + " " + where) +} + +func NewInvalidEscapeSequenceError[Bytes ~[]byte | ~string](what Bytes) error { + label := "escape sequence" + if len(what) > 6 { + label = "surrogate pair" + } + needEscape := strings.IndexFunc(string(what), func(r rune) bool { + return r == '`' || r == utf8.RuneError || unicode.IsSpace(r) || !unicode.IsPrint(r) + }) >= 0 + if needEscape { + return errors.New("invalid " + label + " " + strconv.Quote(string(what)) + " in string") + } else { + return errors.New("invalid " + label + " `" + string(what) + "` in string") + } +} + +// TruncatePointer optionally truncates the JSON pointer, +// enforcing that the length roughly does not exceed n. +func TruncatePointer(s string, n int) string { + if len(s) <= n { + return s + } + i := n / 2 + j := len(s) - n/2 + + // Avoid truncating a name if there are multiple names present. + if k := strings.LastIndexByte(s[:i], '/'); k > 0 { + i = k + } + if k := strings.IndexByte(s[j:], '/'); k >= 0 { + j += k + len("/") + } + + // Avoid truncation in the middle of a UTF-8 rune. + for i > 0 && isInvalidUTF8(utf8.DecodeLastRuneInString(s[:i])) { + i-- + } + for j < len(s) && isInvalidUTF8(utf8.DecodeRuneInString(s[j:])) { + j++ + } + + // Determine the right middle fragment to use. + var middle string + switch strings.Count(s[i:j], "/") { + case 0: + middle = "…" + case 1: + middle = "…/…" + default: + middle = "…/…/…" + } + if strings.HasPrefix(s[i:j], "/") && middle != "…" { + middle = strings.TrimPrefix(middle, "…") + } + if strings.HasSuffix(s[i:j], "/") && middle != "…" { + middle = strings.TrimSuffix(middle, "…") + } + return s[:i] + middle + s[j:] +} + +func isInvalidUTF8(r rune, rn int) bool { + return r == utf8.RuneError && rn == 1 +} diff --git a/go/src/encoding/json/internal/jsonwire/wire_test.go b/go/src/encoding/json/internal/jsonwire/wire_test.go new file mode 100644 index 0000000000000000000000000000000000000000..a0bf1d1368e686efd6d8908ed54a3a24a274ce33 --- /dev/null +++ b/go/src/encoding/json/internal/jsonwire/wire_test.go @@ -0,0 +1,98 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsonwire + +import ( + "cmp" + "slices" + "testing" + "unicode/utf16" + "unicode/utf8" +) + +func TestQuoteRune(t *testing.T) { + tests := []struct{ in, want string }{ + {"x", `'x'`}, + {"\n", `'\n'`}, + {"'", `'\''`}, + {"\xff", `'\xff'`}, + {"💩", `'💩'`}, + {"💩"[:1], `'\xf0'`}, + {"\uffff", `'\uffff'`}, + {"\U00101234", `'\U00101234'`}, + } + for _, tt := range tests { + got := QuoteRune([]byte(tt.in)) + if got != tt.want { + t.Errorf("quoteRune(%q) = %s, want %s", tt.in, got, tt.want) + } + } +} + +var compareUTF16Testdata = []string{"", "\r", "1", "f\xfe", "f\xfe\xff", "f\xff", "\u0080", "\u00f6", "\u20ac", "\U0001f600", "\ufb33"} + +func TestCompareUTF16(t *testing.T) { + for i, si := range compareUTF16Testdata { + for j, sj := range compareUTF16Testdata { + got := CompareUTF16([]byte(si), []byte(sj)) + want := cmp.Compare(i, j) + if got != want { + t.Errorf("CompareUTF16(%q, %q) = %v, want %v", si, sj, got, want) + } + } + } +} + +func FuzzCompareUTF16(f *testing.F) { + for _, td1 := range compareUTF16Testdata { + for _, td2 := range compareUTF16Testdata { + f.Add([]byte(td1), []byte(td2)) + } + } + + // CompareUTF16Simple is identical to CompareUTF16, + // but relies on naively converting a string to a []uint16 codepoints. + // It is easy to verify as correct, but is slow. + CompareUTF16Simple := func(x, y []byte) int { + ux := utf16.Encode([]rune(string(x))) + uy := utf16.Encode([]rune(string(y))) + return slices.Compare(ux, uy) + } + + f.Fuzz(func(t *testing.T, s1, s2 []byte) { + // Compare the optimized and simplified implementations. + got := CompareUTF16(s1, s2) + want := CompareUTF16Simple(s1, s2) + if got != want && utf8.Valid(s1) && utf8.Valid(s2) { + t.Errorf("CompareUTF16(%q, %q) = %v, want %v", s1, s2, got, want) + } + }) +} + +func TestTruncatePointer(t *testing.T) { + tests := []struct{ in, want string }{ + {"hello", "hello"}, + {"/a/b/c", "/a/b/c"}, + {"/a/b/c/d/e/f/g", "/a/b/…/f/g"}, + {"supercalifragilisticexpialidocious", "super…cious"}, + {"/supercalifragilisticexpialidocious/supercalifragilisticexpialidocious", "/supe…/…cious"}, + {"/supercalifragilisticexpialidocious/supercalifragilisticexpialidocious/supercalifragilisticexpialidocious", "/supe…/…/…cious"}, + {"/a/supercalifragilisticexpialidocious/supercalifragilisticexpialidocious", "/a/…/…cious"}, + {"/supercalifragilisticexpialidocious/supercalifragilisticexpialidocious/b", "/supe…/…/b"}, + {"/fizz/buzz/bazz", "/fizz/…/bazz"}, + {"/fizz/buzz/bazz/razz", "/fizz/…/razz"}, + {"/////////////////////////////", "/////…/////"}, + {"/🎄❤️✨/🎁✅😊/🎅🔥⭐", "/🎄…/…/…⭐"}, + } + for _, tt := range tests { + got := TruncatePointer(tt.in, 10) + if got != tt.want { + t.Errorf("TruncatePointer(%q) = %q, want %q", tt.in, got, tt.want) + } + } + +} diff --git a/go/src/encoding/json/jsontext/coder_test.go b/go/src/encoding/json/jsontext/coder_test.go new file mode 100644 index 0000000000000000000000000000000000000000..8602e3e7fff2860a565876feb041ad92a981937b --- /dev/null +++ b/go/src/encoding/json/jsontext/coder_test.go @@ -0,0 +1,856 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsontext + +import ( + "bytes" + "errors" + "io" + "math" + "math/rand" + "path" + "reflect" + "strings" + "testing" + + "encoding/json/internal/jsontest" + "encoding/json/internal/jsonwire" +) + +func E(err error) *SyntacticError { + return &SyntacticError{Err: err} +} + +func newInvalidCharacterError(prefix, where string) *SyntacticError { + return E(jsonwire.NewInvalidCharacterError(prefix, where)) +} + +func newInvalidEscapeSequenceError(what string) *SyntacticError { + return E(jsonwire.NewInvalidEscapeSequenceError(what)) +} + +func (e *SyntacticError) withPos(prefix string, pointer Pointer) *SyntacticError { + e.ByteOffset = int64(len(prefix)) + e.JSONPointer = pointer + return e +} + +func equalError(x, y error) bool { + return reflect.DeepEqual(x, y) +} + +var ( + zeroToken Token + zeroValue Value +) + +// tokOrVal is either a Token or a Value. +type tokOrVal interface{ Kind() Kind } + +type coderTestdataEntry struct { + name jsontest.CaseName + in string + outCompacted string + outEscaped string // outCompacted if empty; escapes all runes in a string + outIndented string // outCompacted if empty; uses " " for indent prefix and "\t" for indent + outCanonicalized string // outCompacted if empty + tokens []Token + pointers []Pointer +} + +var coderTestdata = []coderTestdataEntry{{ + name: jsontest.Name("Null"), + in: ` null `, + outCompacted: `null`, + tokens: []Token{Null}, + pointers: []Pointer{""}, +}, { + name: jsontest.Name("False"), + in: ` false `, + outCompacted: `false`, + tokens: []Token{False}, +}, { + name: jsontest.Name("True"), + in: ` true `, + outCompacted: `true`, + tokens: []Token{True}, +}, { + name: jsontest.Name("EmptyString"), + in: ` "" `, + outCompacted: `""`, + tokens: []Token{String("")}, +}, { + name: jsontest.Name("SimpleString"), + in: ` "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" `, + outCompacted: `"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"`, + outEscaped: `"\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006a\u006b\u006c\u006d\u006e\u006f\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007a\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004a\u004b\u004c\u004d\u004e\u004f\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005a"`, + tokens: []Token{String("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")}, +}, { + name: jsontest.Name("ComplicatedString"), + in: " \"Hello, 世界 🌟★☆✩🌠 " + "\u0080\u00f6\u20ac\ud799\ue000\ufb33\ufffd\U0001f602" + ` \ud800\udead \"\\\/\b\f\n\r\t \u0022\u005c\u002f\u0008\u000c\u000a\u000d\u0009" `, + outCompacted: "\"Hello, 世界 🌟★☆✩🌠 " + "\u0080\u00f6\u20ac\ud799\ue000\ufb33\ufffd\U0001f602" + " 𐊭 \\\"\\\\/\\b\\f\\n\\r\\t \\\"\\\\/\\b\\f\\n\\r\\t\"", + outEscaped: `"\u0048\u0065\u006c\u006c\u006f\u002c\u0020\u4e16\u754c\u0020\ud83c\udf1f\u2605\u2606\u2729\ud83c\udf20\u0020\u0080\u00f6\u20ac\ud799\ue000\ufb33\ufffd\ud83d\ude02\u0020\ud800\udead\u0020\u0022\u005c\u002f\u0008\u000c\u000a\u000d\u0009\u0020\u0022\u005c\u002f\u0008\u000c\u000a\u000d\u0009"`, + outCanonicalized: `"Hello, 世界 🌟★☆✩🌠 €ö€힙דּ�😂 𐊭 \"\\/\b\f\n\r\t \"\\/\b\f\n\r\t"`, + tokens: []Token{rawToken("\"Hello, 世界 🌟★☆✩🌠 " + "\u0080\u00f6\u20ac\ud799\ue000\ufb33\ufffd\U0001f602" + " 𐊭 \\\"\\\\/\\b\\f\\n\\r\\t \\\"\\\\/\\b\\f\\n\\r\\t\"")}, +}, { + name: jsontest.Name("ZeroNumber"), + in: ` 0 `, + outCompacted: `0`, + tokens: []Token{Uint(0)}, +}, { + name: jsontest.Name("SimpleNumber"), + in: ` 123456789 `, + outCompacted: `123456789`, + tokens: []Token{Uint(123456789)}, +}, { + name: jsontest.Name("NegativeNumber"), + in: ` -123456789 `, + outCompacted: `-123456789`, + tokens: []Token{Int(-123456789)}, +}, { + name: jsontest.Name("FractionalNumber"), + in: " 0.123456789 ", + outCompacted: `0.123456789`, + tokens: []Token{Float(0.123456789)}, +}, { + name: jsontest.Name("ExponentNumber"), + in: " 0e12456789 ", + outCompacted: `0e12456789`, + outCanonicalized: `0`, + tokens: []Token{rawToken(`0e12456789`)}, +}, { + name: jsontest.Name("ExponentNumberP"), + in: " 0e+12456789 ", + outCompacted: `0e+12456789`, + outCanonicalized: `0`, + tokens: []Token{rawToken(`0e+12456789`)}, +}, { + name: jsontest.Name("ExponentNumberN"), + in: " 0e-12456789 ", + outCompacted: `0e-12456789`, + outCanonicalized: `0`, + tokens: []Token{rawToken(`0e-12456789`)}, +}, { + name: jsontest.Name("ComplicatedNumber"), + in: ` -123456789.987654321E+0123456789 `, + outCompacted: `-123456789.987654321E+0123456789`, + outCanonicalized: `-1.7976931348623157e+308`, + tokens: []Token{rawToken(`-123456789.987654321E+0123456789`)}, +}, { + name: jsontest.Name("Numbers"), + in: ` [ + 0, -0, 0.0, -0.0, 1.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001, 1e1000, + -5e-324, 1e+100, 1.7976931348623157e+308, + 9007199254740990, 9007199254740991, 9007199254740992, 9007199254740993, 9007199254740994, + -9223372036854775808, 9223372036854775807, 0, 18446744073709551615 + ] `, + outCompacted: "[0,-0,0.0,-0.0,1.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,1e1000,-5e-324,1e+100,1.7976931348623157e+308,9007199254740990,9007199254740991,9007199254740992,9007199254740993,9007199254740994,-9223372036854775808,9223372036854775807,0,18446744073709551615]", + outIndented: `[ + 0, + -0, + 0.0, + -0.0, + 1.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001, + 1e1000, + -5e-324, + 1e+100, + 1.7976931348623157e+308, + 9007199254740990, + 9007199254740991, + 9007199254740992, + 9007199254740993, + 9007199254740994, + -9223372036854775808, + 9223372036854775807, + 0, + 18446744073709551615 + ]`, + outCanonicalized: `[0,0,0,0,1,1.7976931348623157e+308,-5e-324,1e+100,1.7976931348623157e+308,9007199254740990,9007199254740991,9007199254740992,9007199254740992,9007199254740994,-9223372036854776000,9223372036854776000,0,18446744073709552000]`, + tokens: []Token{ + BeginArray, + Float(0), Float(math.Copysign(0, -1)), rawToken(`0.0`), rawToken(`-0.0`), rawToken(`1.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001`), rawToken(`1e1000`), + Float(-5e-324), Float(1e100), Float(1.7976931348623157e+308), + Float(9007199254740990), Float(9007199254740991), Float(9007199254740992), rawToken(`9007199254740993`), rawToken(`9007199254740994`), + Int(minInt64), Int(maxInt64), Uint(minUint64), Uint(maxUint64), + EndArray, + }, + pointers: []Pointer{ + "", "/0", "/1", "/2", "/3", "/4", "/5", "/6", "/7", "/8", "/9", "/10", "/11", "/12", "/13", "/14", "/15", "/16", "/17", "", + }, +}, { + name: jsontest.Name("ObjectN0"), + in: ` { } `, + outCompacted: `{}`, + tokens: []Token{BeginObject, EndObject}, + pointers: []Pointer{"", ""}, +}, { + name: jsontest.Name("ObjectN1"), + in: ` { "0" : 0 } `, + outCompacted: `{"0":0}`, + outEscaped: `{"\u0030":0}`, + outIndented: `{ + "0": 0 + }`, + tokens: []Token{BeginObject, String("0"), Uint(0), EndObject}, + pointers: []Pointer{"", "/0", "/0", ""}, +}, { + name: jsontest.Name("ObjectN2"), + in: ` { "0" : 0 , "1" : 1 } `, + outCompacted: `{"0":0,"1":1}`, + outEscaped: `{"\u0030":0,"\u0031":1}`, + outIndented: `{ + "0": 0, + "1": 1 + }`, + tokens: []Token{BeginObject, String("0"), Uint(0), String("1"), Uint(1), EndObject}, + pointers: []Pointer{"", "/0", "/0", "/1", "/1", ""}, +}, { + name: jsontest.Name("ObjectNested"), + in: ` { "0" : { "1" : { "2" : { "3" : { "4" : { } } } } } } `, + outCompacted: `{"0":{"1":{"2":{"3":{"4":{}}}}}}`, + outEscaped: `{"\u0030":{"\u0031":{"\u0032":{"\u0033":{"\u0034":{}}}}}}`, + outIndented: `{ + "0": { + "1": { + "2": { + "3": { + "4": {} + } + } + } + } + }`, + tokens: []Token{BeginObject, String("0"), BeginObject, String("1"), BeginObject, String("2"), BeginObject, String("3"), BeginObject, String("4"), BeginObject, EndObject, EndObject, EndObject, EndObject, EndObject, EndObject}, + pointers: []Pointer{ + "", + "/0", "/0", + "/0/1", "/0/1", + "/0/1/2", "/0/1/2", + "/0/1/2/3", "/0/1/2/3", + "/0/1/2/3/4", "/0/1/2/3/4", + "/0/1/2/3/4", + "/0/1/2/3", + "/0/1/2", + "/0/1", + "/0", + "", + }, +}, { + name: jsontest.Name("ObjectSuperNested"), + in: `{"": { + "44444": { + "6666666": "ccccccc", + "77777777": "bb", + "555555": "aaaa" + }, + "0": { + "3333": "bbb", + "11": "", + "222": "aaaaa" + } + }}`, + outCompacted: `{"":{"44444":{"6666666":"ccccccc","77777777":"bb","555555":"aaaa"},"0":{"3333":"bbb","11":"","222":"aaaaa"}}}`, + outEscaped: `{"":{"\u0034\u0034\u0034\u0034\u0034":{"\u0036\u0036\u0036\u0036\u0036\u0036\u0036":"\u0063\u0063\u0063\u0063\u0063\u0063\u0063","\u0037\u0037\u0037\u0037\u0037\u0037\u0037\u0037":"\u0062\u0062","\u0035\u0035\u0035\u0035\u0035\u0035":"\u0061\u0061\u0061\u0061"},"\u0030":{"\u0033\u0033\u0033\u0033":"\u0062\u0062\u0062","\u0031\u0031":"","\u0032\u0032\u0032":"\u0061\u0061\u0061\u0061\u0061"}}}`, + outIndented: `{ + "": { + "44444": { + "6666666": "ccccccc", + "77777777": "bb", + "555555": "aaaa" + }, + "0": { + "3333": "bbb", + "11": "", + "222": "aaaaa" + } + } + }`, + outCanonicalized: `{"":{"0":{"11":"","222":"aaaaa","3333":"bbb"},"44444":{"555555":"aaaa","6666666":"ccccccc","77777777":"bb"}}}`, + tokens: []Token{ + BeginObject, + String(""), + BeginObject, + String("44444"), + BeginObject, + String("6666666"), String("ccccccc"), + String("77777777"), String("bb"), + String("555555"), String("aaaa"), + EndObject, + String("0"), + BeginObject, + String("3333"), String("bbb"), + String("11"), String(""), + String("222"), String("aaaaa"), + EndObject, + EndObject, + EndObject, + }, + pointers: []Pointer{ + "", + "/", "/", + "//44444", "//44444", + "//44444/6666666", "//44444/6666666", + "//44444/77777777", "//44444/77777777", + "//44444/555555", "//44444/555555", + "//44444", + "//0", "//0", + "//0/3333", "//0/3333", + "//0/11", "//0/11", + "//0/222", "//0/222", + "//0", + "/", + "", + }, +}, { + name: jsontest.Name("ArrayN0"), + in: ` [ ] `, + outCompacted: `[]`, + tokens: []Token{BeginArray, EndArray}, + pointers: []Pointer{"", ""}, +}, { + name: jsontest.Name("ArrayN1"), + in: ` [ 0 ] `, + outCompacted: `[0]`, + outIndented: `[ + 0 + ]`, + tokens: []Token{BeginArray, Uint(0), EndArray}, + pointers: []Pointer{"", "/0", ""}, +}, { + name: jsontest.Name("ArrayN2"), + in: ` [ 0 , 1 ] `, + outCompacted: `[0,1]`, + outIndented: `[ + 0, + 1 + ]`, + tokens: []Token{BeginArray, Uint(0), Uint(1), EndArray}, +}, { + name: jsontest.Name("ArrayNested"), + in: ` [ [ [ [ [ ] ] ] ] ] `, + outCompacted: `[[[[[]]]]]`, + outIndented: `[ + [ + [ + [ + [] + ] + ] + ] + ]`, + tokens: []Token{BeginArray, BeginArray, BeginArray, BeginArray, BeginArray, EndArray, EndArray, EndArray, EndArray, EndArray}, + pointers: []Pointer{ + "", + "/0", + "/0/0", + "/0/0/0", + "/0/0/0/0", + "/0/0/0/0", + "/0/0/0", + "/0/0", + "/0", + "", + }, +}, { + name: jsontest.Name("Everything"), + in: ` { + "literals" : [ null , false , true ], + "string" : "Hello, 世界" , + "number" : 3.14159 , + "arrayN0" : [ ] , + "arrayN1" : [ 0 ] , + "arrayN2" : [ 0 , 1 ] , + "objectN0" : { } , + "objectN1" : { "0" : 0 } , + "objectN2" : { "0" : 0 , "1" : 1 } + } `, + outCompacted: `{"literals":[null,false,true],"string":"Hello, 世界","number":3.14159,"arrayN0":[],"arrayN1":[0],"arrayN2":[0,1],"objectN0":{},"objectN1":{"0":0},"objectN2":{"0":0,"1":1}}`, + outEscaped: `{"\u006c\u0069\u0074\u0065\u0072\u0061\u006c\u0073":[null,false,true],"\u0073\u0074\u0072\u0069\u006e\u0067":"\u0048\u0065\u006c\u006c\u006f\u002c\u0020\u4e16\u754c","\u006e\u0075\u006d\u0062\u0065\u0072":3.14159,"\u0061\u0072\u0072\u0061\u0079\u004e\u0030":[],"\u0061\u0072\u0072\u0061\u0079\u004e\u0031":[0],"\u0061\u0072\u0072\u0061\u0079\u004e\u0032":[0,1],"\u006f\u0062\u006a\u0065\u0063\u0074\u004e\u0030":{},"\u006f\u0062\u006a\u0065\u0063\u0074\u004e\u0031":{"\u0030":0},"\u006f\u0062\u006a\u0065\u0063\u0074\u004e\u0032":{"\u0030":0,"\u0031":1}}`, + outIndented: `{ + "literals": [ + null, + false, + true + ], + "string": "Hello, 世界", + "number": 3.14159, + "arrayN0": [], + "arrayN1": [ + 0 + ], + "arrayN2": [ + 0, + 1 + ], + "objectN0": {}, + "objectN1": { + "0": 0 + }, + "objectN2": { + "0": 0, + "1": 1 + } + }`, + outCanonicalized: `{"arrayN0":[],"arrayN1":[0],"arrayN2":[0,1],"literals":[null,false,true],"number":3.14159,"objectN0":{},"objectN1":{"0":0},"objectN2":{"0":0,"1":1},"string":"Hello, 世界"}`, + tokens: []Token{ + BeginObject, + String("literals"), BeginArray, Null, False, True, EndArray, + String("string"), String("Hello, 世界"), + String("number"), Float(3.14159), + String("arrayN0"), BeginArray, EndArray, + String("arrayN1"), BeginArray, Uint(0), EndArray, + String("arrayN2"), BeginArray, Uint(0), Uint(1), EndArray, + String("objectN0"), BeginObject, EndObject, + String("objectN1"), BeginObject, String("0"), Uint(0), EndObject, + String("objectN2"), BeginObject, String("0"), Uint(0), String("1"), Uint(1), EndObject, + EndObject, + }, + pointers: []Pointer{ + "", + "/literals", "/literals", + "/literals/0", + "/literals/1", + "/literals/2", + "/literals", + "/string", "/string", + "/number", "/number", + "/arrayN0", "/arrayN0", "/arrayN0", + "/arrayN1", "/arrayN1", + "/arrayN1/0", + "/arrayN1", + "/arrayN2", "/arrayN2", + "/arrayN2/0", + "/arrayN2/1", + "/arrayN2", + "/objectN0", "/objectN0", "/objectN0", + "/objectN1", "/objectN1", + "/objectN1/0", "/objectN1/0", + "/objectN1", + "/objectN2", "/objectN2", + "/objectN2/0", "/objectN2/0", + "/objectN2/1", "/objectN2/1", + "/objectN2", + "", + }, +}} + +// TestCoderInterleaved tests that we can interleave calls that operate on +// tokens and raw values. The only error condition is trying to operate on a +// raw value when the next token is an end of object or array. +func TestCoderInterleaved(t *testing.T) { + for _, td := range coderTestdata { + // In TokenFirst and ValueFirst, alternate between tokens and values. + // In TokenDelims, only use tokens for object and array delimiters. + for _, modeName := range []string{"TokenFirst", "ValueFirst", "TokenDelims"} { + t.Run(path.Join(td.name.Name, modeName), func(t *testing.T) { + testCoderInterleaved(t, td.name.Where, modeName, td) + }) + } + } +} +func testCoderInterleaved(t *testing.T, where jsontest.CasePos, modeName string, td coderTestdataEntry) { + src := strings.NewReader(td.in) + dst := new(bytes.Buffer) + dec := NewDecoder(src) + enc := NewEncoder(dst) + tickTock := modeName == "TokenFirst" + for { + if modeName == "TokenDelims" { + switch dec.PeekKind() { + case '{', '}', '[', ']': + tickTock = true // as token + default: + tickTock = false // as value + } + } + if tickTock { + tok, err := dec.ReadToken() + if err != nil { + if err == io.EOF { + break + } + t.Fatalf("%s: Decoder.ReadToken error: %v", where, err) + } + if err := enc.WriteToken(tok); err != nil { + t.Fatalf("%s: Encoder.WriteToken error: %v", where, err) + } + } else { + val, err := dec.ReadValue() + if err != nil { + // It is a syntactic error to call ReadValue + // at the end of an object or array. + // Retry as a ReadToken call. + expectError := dec.PeekKind() == '}' || dec.PeekKind() == ']' + if expectError { + if _, ok := errors.AsType[*SyntacticError](err); !ok { + t.Fatalf("%s: Decoder.ReadToken error is %T, want %T", where, err, new(SyntacticError)) + } + tickTock = !tickTock + continue + } + + if err == io.EOF { + break + } + t.Fatalf("%s: Decoder.ReadValue error: %v", where, err) + } + if err := enc.WriteValue(val); err != nil { + t.Fatalf("%s: Encoder.WriteValue error: %v", where, err) + } + } + tickTock = !tickTock + } + + got := dst.String() + want := td.outCompacted + "\n" + if got != want { + t.Fatalf("%s: output mismatch:\ngot %q\nwant %q", where, got, want) + } +} + +func TestCoderStackPointer(t *testing.T) { + tests := []struct { + token Token + want Pointer + }{ + {Null, ""}, + + {BeginArray, ""}, + {EndArray, ""}, + + {BeginArray, ""}, + {Bool(true), "/0"}, + {EndArray, ""}, + + {BeginArray, ""}, + {String("hello"), "/0"}, + {String("goodbye"), "/1"}, + {EndArray, ""}, + + {BeginObject, ""}, + {EndObject, ""}, + + {BeginObject, ""}, + {String("hello"), "/hello"}, + {String("goodbye"), "/hello"}, + {EndObject, ""}, + + {BeginObject, ""}, + {String(""), "/"}, + {Null, "/"}, + {String("0"), "/0"}, + {Null, "/0"}, + {String("~"), "/~0"}, + {Null, "/~0"}, + {String("/"), "/~1"}, + {Null, "/~1"}, + {String("a//b~/c/~d~~e"), "/a~1~1b~0~1c~1~0d~0~0e"}, + {Null, "/a~1~1b~0~1c~1~0d~0~0e"}, + {String(" \r\n\t"), "/ \r\n\t"}, + {Null, "/ \r\n\t"}, + {EndObject, ""}, + + {BeginArray, ""}, + {BeginObject, "/0"}, + {String(""), "/0/"}, + {BeginArray, "/0/"}, + {BeginObject, "/0//0"}, + {String("#"), "/0//0/#"}, + {Null, "/0//0/#"}, + {EndObject, "/0//0"}, + {EndArray, "/0/"}, + {EndObject, "/0"}, + {EndArray, ""}, + } + + for _, allowDupes := range []bool{false, true} { + var name string + switch allowDupes { + case false: + name = "RejectDuplicateNames" + case true: + name = "AllowDuplicateNames" + } + + t.Run(name, func(t *testing.T) { + bb := new(bytes.Buffer) + + enc := NewEncoder(bb, AllowDuplicateNames(allowDupes)) + for i, tt := range tests { + if err := enc.WriteToken(tt.token); err != nil { + t.Fatalf("%d: Encoder.WriteToken error: %v", i, err) + } + if got := enc.StackPointer(); got != tests[i].want { + t.Fatalf("%d: Encoder.StackPointer = %v, want %v", i, got, tests[i].want) + } + } + + dec := NewDecoder(bb, AllowDuplicateNames(allowDupes)) + for i := range tests { + if _, err := dec.ReadToken(); err != nil { + t.Fatalf("%d: Decoder.ReadToken error: %v", i, err) + } + if got := dec.StackPointer(); got != tests[i].want { + t.Fatalf("%d: Decoder.StackPointer = %v, want %v", i, got, tests[i].want) + } + } + }) + } +} + +func TestCoderMaxDepth(t *testing.T) { + trimArray := func(b []byte) []byte { return b[len(`[`) : len(b)-len(`]`)] } + maxArrays := []byte(strings.Repeat(`[`, maxNestingDepth+1) + strings.Repeat(`]`, maxNestingDepth+1)) + trimObject := func(b []byte) []byte { return b[len(`{"":`) : len(b)-len(`}`)] } + maxObjects := []byte(strings.Repeat(`{"":`, maxNestingDepth+1) + `""` + strings.Repeat(`}`, maxNestingDepth+1)) + + t.Run("Decoder", func(t *testing.T) { + var dec Decoder + checkReadToken := func(t *testing.T, wantKind Kind, wantErr error) { + t.Helper() + if tok, err := dec.ReadToken(); tok.Kind() != wantKind || !equalError(err, wantErr) { + t.Fatalf("Decoder.ReadToken = (%q, %v), want (%q, %v)", byte(tok.Kind()), err, byte(wantKind), wantErr) + } + } + checkReadValue := func(t *testing.T, wantLen int, wantErr error) { + t.Helper() + if val, err := dec.ReadValue(); len(val) != wantLen || !equalError(err, wantErr) { + t.Fatalf("Decoder.ReadValue = (%d, %v), want (%d, %v)", len(val), err, wantLen, wantErr) + } + } + + t.Run("ArraysValid/SingleValue", func(t *testing.T) { + dec.s.reset(trimArray(maxArrays), nil) + checkReadValue(t, maxNestingDepth*len(`[]`), nil) + }) + t.Run("ArraysValid/TokenThenValue", func(t *testing.T) { + dec.s.reset(trimArray(maxArrays), nil) + checkReadToken(t, '[', nil) + checkReadValue(t, (maxNestingDepth-1)*len(`[]`), nil) + checkReadToken(t, ']', nil) + }) + t.Run("ArraysValid/AllTokens", func(t *testing.T) { + dec.s.reset(trimArray(maxArrays), nil) + for range maxNestingDepth { + checkReadToken(t, '[', nil) + } + for range maxNestingDepth { + checkReadToken(t, ']', nil) + } + }) + + wantErr := &SyntacticError{ + ByteOffset: maxNestingDepth, + JSONPointer: Pointer(strings.Repeat("/0", maxNestingDepth)), + Err: errMaxDepth, + } + t.Run("ArraysInvalid/SingleValue", func(t *testing.T) { + dec.s.reset(maxArrays, nil) + checkReadValue(t, 0, wantErr) + }) + t.Run("ArraysInvalid/TokenThenValue", func(t *testing.T) { + dec.s.reset(maxArrays, nil) + checkReadToken(t, '[', nil) + checkReadValue(t, 0, wantErr) + }) + t.Run("ArraysInvalid/AllTokens", func(t *testing.T) { + dec.s.reset(maxArrays, nil) + for range maxNestingDepth { + checkReadToken(t, '[', nil) + } + checkReadValue(t, 0, wantErr) + }) + + t.Run("ObjectsValid/SingleValue", func(t *testing.T) { + dec.s.reset(trimObject(maxObjects), nil) + checkReadValue(t, maxNestingDepth*len(`{"":}`)+len(`""`), nil) + }) + t.Run("ObjectsValid/TokenThenValue", func(t *testing.T) { + dec.s.reset(trimObject(maxObjects), nil) + checkReadToken(t, '{', nil) + checkReadToken(t, '"', nil) + checkReadValue(t, (maxNestingDepth-1)*len(`{"":}`)+len(`""`), nil) + checkReadToken(t, '}', nil) + }) + t.Run("ObjectsValid/AllTokens", func(t *testing.T) { + dec.s.reset(trimObject(maxObjects), nil) + for range maxNestingDepth { + checkReadToken(t, '{', nil) + checkReadToken(t, '"', nil) + } + checkReadToken(t, '"', nil) + for range maxNestingDepth { + checkReadToken(t, '}', nil) + } + }) + + wantErr = &SyntacticError{ + ByteOffset: maxNestingDepth * int64(len(`{"":`)), + JSONPointer: Pointer(strings.Repeat("/", maxNestingDepth)), + Err: errMaxDepth, + } + t.Run("ObjectsInvalid/SingleValue", func(t *testing.T) { + dec.s.reset(maxObjects, nil) + checkReadValue(t, 0, wantErr) + }) + t.Run("ObjectsInvalid/TokenThenValue", func(t *testing.T) { + dec.s.reset(maxObjects, nil) + checkReadToken(t, '{', nil) + checkReadToken(t, '"', nil) + checkReadValue(t, 0, wantErr) + }) + t.Run("ObjectsInvalid/AllTokens", func(t *testing.T) { + dec.s.reset(maxObjects, nil) + for range maxNestingDepth { + checkReadToken(t, '{', nil) + checkReadToken(t, '"', nil) + } + checkReadToken(t, 0, wantErr) + }) + }) + + t.Run("Encoder", func(t *testing.T) { + var enc Encoder + checkWriteToken := func(t *testing.T, tok Token, wantErr error) { + t.Helper() + if err := enc.WriteToken(tok); !equalError(err, wantErr) { + t.Fatalf("Encoder.WriteToken = %v, want %v", err, wantErr) + } + } + checkWriteValue := func(t *testing.T, val Value, wantErr error) { + t.Helper() + if err := enc.WriteValue(val); !equalError(err, wantErr) { + t.Fatalf("Encoder.WriteValue = %v, want %v", err, wantErr) + } + } + + wantErr := &SyntacticError{ + ByteOffset: maxNestingDepth, + JSONPointer: Pointer(strings.Repeat("/0", maxNestingDepth)), + Err: errMaxDepth, + } + t.Run("Arrays/SingleValue", func(t *testing.T) { + enc.s.reset(enc.s.Buf[:0], nil) + checkWriteValue(t, maxArrays, wantErr) + checkWriteValue(t, trimArray(maxArrays), nil) + }) + t.Run("Arrays/TokenThenValue", func(t *testing.T) { + enc.s.reset(enc.s.Buf[:0], nil) + checkWriteToken(t, BeginArray, nil) + checkWriteValue(t, trimArray(maxArrays), wantErr) + checkWriteValue(t, trimArray(trimArray(maxArrays)), nil) + checkWriteToken(t, EndArray, nil) + }) + t.Run("Arrays/AllTokens", func(t *testing.T) { + enc.s.reset(enc.s.Buf[:0], nil) + for range maxNestingDepth { + checkWriteToken(t, BeginArray, nil) + } + checkWriteToken(t, BeginArray, wantErr) + for range maxNestingDepth { + checkWriteToken(t, EndArray, nil) + } + }) + + wantErr = &SyntacticError{ + ByteOffset: maxNestingDepth * int64(len(`{"":`)), + JSONPointer: Pointer(strings.Repeat("/", maxNestingDepth)), + Err: errMaxDepth, + } + t.Run("Objects/SingleValue", func(t *testing.T) { + enc.s.reset(enc.s.Buf[:0], nil) + checkWriteValue(t, maxObjects, wantErr) + checkWriteValue(t, trimObject(maxObjects), nil) + }) + t.Run("Objects/TokenThenValue", func(t *testing.T) { + enc.s.reset(enc.s.Buf[:0], nil) + checkWriteToken(t, BeginObject, nil) + checkWriteToken(t, String(""), nil) + checkWriteValue(t, trimObject(maxObjects), wantErr) + checkWriteValue(t, trimObject(trimObject(maxObjects)), nil) + checkWriteToken(t, EndObject, nil) + }) + t.Run("Objects/AllTokens", func(t *testing.T) { + enc.s.reset(enc.s.Buf[:0], nil) + for range maxNestingDepth - 1 { + checkWriteToken(t, BeginObject, nil) + checkWriteToken(t, String(""), nil) + } + checkWriteToken(t, BeginObject, nil) + checkWriteToken(t, String(""), nil) + checkWriteToken(t, BeginObject, wantErr) + checkWriteToken(t, String(""), nil) + for range maxNestingDepth { + checkWriteToken(t, EndObject, nil) + } + }) + }) +} + +// FaultyBuffer implements io.Reader and io.Writer. +// It may process fewer bytes than the provided buffer +// and may randomly return an error. +type FaultyBuffer struct { + B []byte + + // MaxBytes is the maximum number of bytes read/written. + // A random number of bytes within [0, MaxBytes] are processed. + // A non-positive value is treated as infinity. + MaxBytes int + + // MayError specifies whether to randomly provide this error. + // Even if an error is returned, no bytes are dropped. + MayError error + + // Rand to use for pseudo-random behavior. + // If nil, it will be initialized with rand.NewSource(0). + Rand rand.Source +} + +func (p *FaultyBuffer) Read(b []byte) (int, error) { + b = b[:copy(b[:p.mayTruncate(len(b))], p.B)] + p.B = p.B[len(b):] + if len(p.B) == 0 && (len(b) == 0 || p.randN(2) == 0) { + return len(b), io.EOF + } + return len(b), p.mayError() +} + +func (p *FaultyBuffer) Write(b []byte) (int, error) { + b2 := b[:p.mayTruncate(len(b))] + p.B = append(p.B, b2...) + if len(b2) < len(b) { + return len(b2), io.ErrShortWrite + } + return len(b2), p.mayError() +} + +// mayTruncate may return a value between [0, n]. +func (p *FaultyBuffer) mayTruncate(n int) int { + if p.MaxBytes > 0 { + if n > p.MaxBytes { + n = p.MaxBytes + } + return p.randN(n + 1) + } + return n +} + +// mayError may return a non-nil error. +func (p *FaultyBuffer) mayError() error { + if p.MayError != nil && p.randN(2) == 0 { + return p.MayError + } + return nil +} + +func (p *FaultyBuffer) randN(n int) int { + if p.Rand == nil { + p.Rand = rand.NewSource(0) + } + return int(p.Rand.Int63() % int64(n)) +} diff --git a/go/src/encoding/json/jsontext/decode.go b/go/src/encoding/json/jsontext/decode.go new file mode 100644 index 0000000000000000000000000000000000000000..48d66fb1d4875b378ef0ba07ecbf41a3225e89c1 --- /dev/null +++ b/go/src/encoding/json/jsontext/decode.go @@ -0,0 +1,1185 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsontext + +import ( + "bytes" + "errors" + "io" + + "encoding/json/internal/jsonflags" + "encoding/json/internal/jsonopts" + "encoding/json/internal/jsonwire" +) + +// NOTE: The logic for decoding is complicated by the fact that reading from +// an io.Reader into a temporary buffer means that the buffer may contain a +// truncated portion of some valid input, requiring the need to fetch more data. +// +// This file is structured in the following way: +// +// - consumeXXX functions parse an exact JSON token from a []byte. +// If the buffer appears truncated, then it returns io.ErrUnexpectedEOF. +// The consumeSimpleXXX functions are so named because they only handle +// a subset of the grammar for the JSON token being parsed. +// They do not handle the full grammar to keep these functions inlinable. +// +// - Decoder.consumeXXX methods parse the next JSON token from Decoder.buf, +// automatically fetching more input if necessary. These methods take +// a position relative to the start of Decoder.buf as an argument and +// return the end of the consumed JSON token as a position, +// also relative to the start of Decoder.buf. +// +// - In the event of an I/O errors or state machine violations, +// the implementation avoids mutating the state of Decoder +// (aside from the book-keeping needed to implement Decoder.fetch). +// For this reason, only Decoder.ReadToken and Decoder.ReadValue are +// responsible for updated Decoder.prevStart and Decoder.prevEnd. +// +// - For performance, much of the implementation uses the pattern of calling +// the inlinable consumeXXX functions first, and if more work is necessary, +// then it calls the slower Decoder.consumeXXX methods. +// TODO: Revisit this pattern if the Go compiler provides finer control +// over exactly which calls are inlined or not. + +// Decoder is a streaming decoder for raw JSON tokens and values. +// It is used to read a stream of top-level JSON values, +// each separated by optional whitespace characters. +// +// [Decoder.ReadToken] and [Decoder.ReadValue] calls may be interleaved. +// For example, the following JSON value: +// +// {"name":"value","array":[null,false,true,3.14159],"object":{"k":"v"}} +// +// can be parsed with the following calls (ignoring errors for brevity): +// +// d.ReadToken() // { +// d.ReadToken() // "name" +// d.ReadToken() // "value" +// d.ReadValue() // "array" +// d.ReadToken() // [ +// d.ReadToken() // null +// d.ReadToken() // false +// d.ReadValue() // true +// d.ReadToken() // 3.14159 +// d.ReadToken() // ] +// d.ReadValue() // "object" +// d.ReadValue() // {"k":"v"} +// d.ReadToken() // } +// +// The above is one of many possible sequence of calls and +// may not represent the most sensible method to call for any given token/value. +// For example, it is probably more common to call [Decoder.ReadToken] to obtain a +// string token for object names. +type Decoder struct { + s decoderState +} + +// decoderState is the low-level state of Decoder. +// It has exported fields and method for use by the "json" package. +type decoderState struct { + state + decodeBuffer + jsonopts.Struct + + StringCache *[256]string // only used when unmarshaling; identical to json.stringCache +} + +// decodeBuffer is a buffer split into 4 segments: +// +// - buf[0:prevEnd] // already read portion of the buffer +// - buf[prevStart:prevEnd] // previously read value +// - buf[prevEnd:len(buf)] // unread portion of the buffer +// - buf[len(buf):cap(buf)] // unused portion of the buffer +// +// Invariants: +// +// 0 ≤ prevStart ≤ prevEnd ≤ len(buf) ≤ cap(buf) +type decodeBuffer struct { + peekPos int // non-zero if valid offset into buf for start of next token + peekErr error // implies peekPos is -1 + + buf []byte // may alias rd if it is a bytes.Buffer + prevStart int + prevEnd int + + // baseOffset is added to prevStart and prevEnd to obtain + // the absolute offset relative to the start of io.Reader stream. + baseOffset int64 + + rd io.Reader +} + +// NewDecoder constructs a new streaming decoder reading from r. +// +// If r is a [bytes.Buffer], then the decoder parses directly from the buffer +// without first copying the contents to an intermediate buffer. +// Additional writes to the buffer must not occur while the decoder is in use. +func NewDecoder(r io.Reader, opts ...Options) *Decoder { + d := new(Decoder) + d.Reset(r, opts...) + return d +} + +// Reset resets a decoder such that it is reading afresh from r and +// configured with the provided options. Reset must not be called on an +// a Decoder passed to the [encoding/json/v2.UnmarshalerFrom.UnmarshalJSONFrom] method +// or the [encoding/json/v2.UnmarshalFromFunc] function. +func (d *Decoder) Reset(r io.Reader, opts ...Options) { + switch { + case d == nil: + panic("jsontext: invalid nil Decoder") + case r == nil: + panic("jsontext: invalid nil io.Reader") + case d.s.Flags.Get(jsonflags.WithinArshalCall): + panic("jsontext: cannot reset Decoder passed to json.UnmarshalerFrom") + } + // Reuse the buffer if it does not alias a previous [bytes.Buffer]. + b := d.s.buf[:0] + if _, ok := d.s.rd.(*bytes.Buffer); ok { + b = nil + } + d.s.reset(b, r, opts...) +} + +func (d *decoderState) reset(b []byte, r io.Reader, opts ...Options) { + d.state.reset() + d.decodeBuffer = decodeBuffer{buf: b, rd: r} + opts2 := jsonopts.Struct{} // avoid mutating d.Struct in case it is part of opts + opts2.Join(opts...) + d.Struct = opts2 +} + +// Options returns the options used to construct the encoder and +// may additionally contain semantic options passed to a +// [encoding/json/v2.UnmarshalDecode] call. +// +// If operating within +// a [encoding/json/v2.UnmarshalerFrom.UnmarshalJSONFrom] method call or +// a [encoding/json/v2.UnmarshalFromFunc] function call, +// then the returned options are only valid within the call. +func (d *Decoder) Options() Options { + return &d.s.Struct +} + +var errBufferWriteAfterNext = errors.New("invalid bytes.Buffer.Write call after calling bytes.Buffer.Next") + +// fetch reads at least 1 byte from the underlying io.Reader. +// It returns io.ErrUnexpectedEOF if zero bytes were read and io.EOF was seen. +func (d *decoderState) fetch() error { + if d.rd == nil { + return io.ErrUnexpectedEOF + } + + // Inform objectNameStack that we are about to fetch new buffer content. + d.Names.copyQuotedBuffer(d.buf) + + // Specialize bytes.Buffer for better performance. + if bb, ok := d.rd.(*bytes.Buffer); ok { + switch { + case bb.Len() == 0: + return io.ErrUnexpectedEOF + case len(d.buf) == 0: + d.buf = bb.Next(bb.Len()) // "read" all data in the buffer + return nil + default: + // This only occurs if a partially filled bytes.Buffer was provided + // and more data is written to it while Decoder is reading from it. + // This practice will lead to data corruption since future writes + // may overwrite the contents of the current buffer. + // + // The user is trying to use a bytes.Buffer as a pipe, + // but a bytes.Buffer is poor implementation of a pipe, + // the purpose-built io.Pipe should be used instead. + return &ioError{action: "read", err: errBufferWriteAfterNext} + } + } + + // Allocate initial buffer if empty. + if cap(d.buf) == 0 { + d.buf = make([]byte, 0, 64) + } + + // Check whether to grow the buffer. + const maxBufferSize = 4 << 10 + const growthSizeFactor = 2 // higher value is faster + const growthRateFactor = 2 // higher value is slower + // By default, grow if below the maximum buffer size. + grow := cap(d.buf) <= maxBufferSize/growthSizeFactor + // Growing can be expensive, so only grow + // if a sufficient number of bytes have been processed. + grow = grow && int64(cap(d.buf)) < d.previousOffsetEnd()/growthRateFactor + // If prevStart==0, then fetch was called in order to fetch more data + // to finish consuming a large JSON value contiguously. + // Grow if less than 25% of the remaining capacity is available. + // Note that this may cause the input buffer to exceed maxBufferSize. + grow = grow || (d.prevStart == 0 && len(d.buf) >= 3*cap(d.buf)/4) + + if grow { + // Allocate a new buffer and copy the contents of the old buffer over. + // TODO: Provide a hard limit on the maximum internal buffer size? + buf := make([]byte, 0, cap(d.buf)*growthSizeFactor) + d.buf = append(buf, d.buf[d.prevStart:]...) + } else { + // Move unread portion of the data to the front. + n := copy(d.buf[:cap(d.buf)], d.buf[d.prevStart:]) + d.buf = d.buf[:n] + } + d.baseOffset += int64(d.prevStart) + d.prevEnd -= d.prevStart + d.prevStart = 0 + + // Read more data into the internal buffer. + for { + n, err := d.rd.Read(d.buf[len(d.buf):cap(d.buf)]) + switch { + case n > 0: + d.buf = d.buf[:len(d.buf)+n] + return nil // ignore errors if any bytes are read + case err == io.EOF: + return io.ErrUnexpectedEOF + case err != nil: + return &ioError{action: "read", err: err} + default: + continue // Read returned (0, nil) + } + } +} + +const invalidateBufferByte = '#' // invalid starting character for JSON grammar + +// invalidatePreviousRead invalidates buffers returned by Peek and Read calls +// so that the first byte is an invalid character. +// This Hyrum-proofs the API against faulty application code that assumes +// values returned by ReadValue remain valid past subsequent Read calls. +func (d *decodeBuffer) invalidatePreviousRead() { + // Avoid mutating the buffer if d.rd is nil which implies that d.buf + // is provided by the user code and may not expect mutations. + isBytesBuffer := func(r io.Reader) bool { + _, ok := r.(*bytes.Buffer) + return ok + } + if d.rd != nil && !isBytesBuffer(d.rd) && d.prevStart < d.prevEnd && uint(d.prevStart) < uint(len(d.buf)) { + d.buf[d.prevStart] = invalidateBufferByte + d.prevStart = d.prevEnd + } +} + +// needMore reports whether there are no more unread bytes. +func (d *decodeBuffer) needMore(pos int) bool { + // NOTE: The arguments and logic are kept simple to keep this inlinable. + return pos == len(d.buf) +} + +func (d *decodeBuffer) offsetAt(pos int) int64 { return d.baseOffset + int64(pos) } +func (d *decodeBuffer) previousOffsetStart() int64 { return d.baseOffset + int64(d.prevStart) } +func (d *decodeBuffer) previousOffsetEnd() int64 { return d.baseOffset + int64(d.prevEnd) } +func (d *decodeBuffer) previousBuffer() []byte { return d.buf[d.prevStart:d.prevEnd] } +func (d *decodeBuffer) unreadBuffer() []byte { return d.buf[d.prevEnd:len(d.buf)] } + +// PreviousTokenOrValue returns the previously read token or value +// unless it has been invalidated by a call to PeekKind. +// If a token is just a delimiter, then this returns a 1-byte buffer. +// This method is used for error reporting at the semantic layer. +func (d *decodeBuffer) PreviousTokenOrValue() []byte { + b := d.previousBuffer() + // If peek was called, then the previous token or buffer is invalidated. + if d.peekPos > 0 || len(b) > 0 && b[0] == invalidateBufferByte { + return nil + } + // ReadToken does not preserve the buffer for null, bools, or delimiters. + // Manually re-construct that buffer. + if len(b) == 0 { + b = d.buf[:d.prevEnd] // entirety of the previous buffer + for _, tok := range []string{"null", "false", "true", "{", "}", "[", "]"} { + if len(b) >= len(tok) && string(b[len(b)-len(tok):]) == tok { + return b[len(b)-len(tok):] + } + } + } + return b +} + +// PeekKind retrieves the next token kind, but does not advance the read offset. +// +// It returns [KindInvalid] if an error occurs. Any such error is cached until +// the next read call and it is the caller's responsibility to eventually +// follow up a PeekKind call with a read call. +func (d *Decoder) PeekKind() Kind { + return d.s.PeekKind() +} +func (d *decoderState) PeekKind() Kind { + // Check whether we have a cached peek result. + if d.peekPos > 0 { + return Kind(d.buf[d.peekPos]).normalize() + } + + var err error + d.invalidatePreviousRead() + pos := d.prevEnd + + // Consume leading whitespace. + pos += jsonwire.ConsumeWhitespace(d.buf[pos:]) + if d.needMore(pos) { + if pos, err = d.consumeWhitespace(pos); err != nil { + if err == io.ErrUnexpectedEOF && d.Tokens.Depth() == 1 { + err = io.EOF // EOF possibly if no Tokens present after top-level value + } + d.peekPos, d.peekErr = -1, wrapSyntacticError(d, err, pos, 0) + return invalidKind + } + } + + // Consume colon or comma. + var delim byte + if c := d.buf[pos]; c == ':' || c == ',' { + delim = c + pos += 1 + pos += jsonwire.ConsumeWhitespace(d.buf[pos:]) + if d.needMore(pos) { + if pos, err = d.consumeWhitespace(pos); err != nil { + err = wrapSyntacticError(d, err, pos, 0) + d.peekPos, d.peekErr = -1, d.checkDelimBeforeIOError(delim, err) + return invalidKind + } + } + } + next := Kind(d.buf[pos]).normalize() + if d.Tokens.needDelim(next) != delim { + d.peekPos, d.peekErr = -1, d.checkDelim(delim, next) + return invalidKind + } + + // This may set peekPos to zero, which is indistinguishable from + // the uninitialized state. While a small hit to performance, it is correct + // since ReadValue and ReadToken will disregard the cached result and + // recompute the next kind. + d.peekPos, d.peekErr = pos, nil + return next +} + +// checkDelimBeforeIOError checks whether the delim is even valid +// before returning an IO error, which occurs after the delim. +func (d *decoderState) checkDelimBeforeIOError(delim byte, err error) error { + // Since an IO error occurred, we do not know what the next kind is. + // However, knowing the next kind is necessary to validate + // whether the current delim is at least potentially valid. + // Since a JSON string is always valid as the next token, + // conservatively assume that is the next kind for validation. + const next = Kind('"') + if d.Tokens.needDelim(next) != delim { + err = d.checkDelim(delim, next) + } + return err +} + +// CountNextDelimWhitespace counts the number of upcoming bytes of +// delimiter or whitespace characters. +// This method is used for error reporting at the semantic layer. +func (d *decoderState) CountNextDelimWhitespace() int { + d.PeekKind() // populate unreadBuffer + return len(d.unreadBuffer()) - len(bytes.TrimLeft(d.unreadBuffer(), ",: \n\r\t")) +} + +// checkDelim checks whether delim is valid for the given next kind. +func (d *decoderState) checkDelim(delim byte, next Kind) error { + where := "at start of value" + switch d.Tokens.needDelim(next) { + case delim: + return nil + case ':': + where = "after object name (expecting ':')" + case ',': + if d.Tokens.Last.isObject() { + where = "after object value (expecting ',' or '}')" + } else { + where = "after array element (expecting ',' or ']')" + } + } + pos := d.prevEnd // restore position to right after leading whitespace + pos += jsonwire.ConsumeWhitespace(d.buf[pos:]) + err := jsonwire.NewInvalidCharacterError(d.buf[pos:], where) + return wrapSyntacticError(d, err, pos, 0) +} + +// SkipValue is semantically equivalent to calling [Decoder.ReadValue] and discarding +// the result except that memory is not wasted trying to hold the entire result. +func (d *Decoder) SkipValue() error { + return d.s.SkipValue() +} +func (d *decoderState) SkipValue() error { + switch d.PeekKind() { + case '{', '[': + // For JSON objects and arrays, keep skipping all tokens + // until the depth matches the starting depth. + depth := d.Tokens.Depth() + for { + if _, err := d.ReadToken(); err != nil { + return err + } + if depth >= d.Tokens.Depth() { + return nil + } + } + default: + // Trying to skip a value when the next token is a '}' or ']' + // will result in an error being returned here. + var flags jsonwire.ValueFlags + if _, err := d.ReadValue(&flags); err != nil { + return err + } + return nil + } +} + +// SkipValueRemainder skips the remainder of a value +// after reading a '{' or '[' token. +func (d *decoderState) SkipValueRemainder() error { + if d.Tokens.Depth()-1 > 0 && d.Tokens.Last.Length() == 0 { + for n := d.Tokens.Depth(); d.Tokens.Depth() >= n; { + if _, err := d.ReadToken(); err != nil { + return err + } + } + } + return nil +} + +// SkipUntil skips all tokens until the state machine +// is at or past the specified depth and length. +func (d *decoderState) SkipUntil(depth int, length int64) error { + for d.Tokens.Depth() > depth || (d.Tokens.Depth() == depth && d.Tokens.Last.Length() < length) { + if _, err := d.ReadToken(); err != nil { + return err + } + } + return nil +} + +// ReadToken reads the next [Token], advancing the read offset. +// The returned token is only valid until the next Peek, Read, or Skip call. +// It returns [io.EOF] if there are no more tokens. +func (d *Decoder) ReadToken() (Token, error) { + return d.s.ReadToken() +} +func (d *decoderState) ReadToken() (Token, error) { + // Determine the next kind. + var err error + var next Kind + pos := d.peekPos + if pos != 0 { + // Use cached peek result. + if d.peekErr != nil { + err := d.peekErr + d.peekPos, d.peekErr = 0, nil // possibly a transient I/O error + return Token{}, err + } + next = Kind(d.buf[pos]).normalize() + d.peekPos = 0 // reset cache + } else { + d.invalidatePreviousRead() + pos = d.prevEnd + + // Consume leading whitespace. + pos += jsonwire.ConsumeWhitespace(d.buf[pos:]) + if d.needMore(pos) { + if pos, err = d.consumeWhitespace(pos); err != nil { + if err == io.ErrUnexpectedEOF && d.Tokens.Depth() == 1 { + err = io.EOF // EOF possibly if no Tokens present after top-level value + } + return Token{}, wrapSyntacticError(d, err, pos, 0) + } + } + + // Consume colon or comma. + var delim byte + if c := d.buf[pos]; c == ':' || c == ',' { + delim = c + pos += 1 + pos += jsonwire.ConsumeWhitespace(d.buf[pos:]) + if d.needMore(pos) { + if pos, err = d.consumeWhitespace(pos); err != nil { + err = wrapSyntacticError(d, err, pos, 0) + return Token{}, d.checkDelimBeforeIOError(delim, err) + } + } + } + next = Kind(d.buf[pos]).normalize() + if d.Tokens.needDelim(next) != delim { + return Token{}, d.checkDelim(delim, next) + } + } + + // Handle the next token. + var n int + switch next { + case 'n': + if jsonwire.ConsumeNull(d.buf[pos:]) == 0 { + pos, err = d.consumeLiteral(pos, "null") + if err != nil { + return Token{}, wrapSyntacticError(d, err, pos, +1) + } + } else { + pos += len("null") + } + if err = d.Tokens.appendLiteral(); err != nil { + return Token{}, wrapSyntacticError(d, err, pos-len("null"), +1) // report position at start of literal + } + d.prevStart, d.prevEnd = pos, pos + return Null, nil + + case 'f': + if jsonwire.ConsumeFalse(d.buf[pos:]) == 0 { + pos, err = d.consumeLiteral(pos, "false") + if err != nil { + return Token{}, wrapSyntacticError(d, err, pos, +1) + } + } else { + pos += len("false") + } + if err = d.Tokens.appendLiteral(); err != nil { + return Token{}, wrapSyntacticError(d, err, pos-len("false"), +1) // report position at start of literal + } + d.prevStart, d.prevEnd = pos, pos + return False, nil + + case 't': + if jsonwire.ConsumeTrue(d.buf[pos:]) == 0 { + pos, err = d.consumeLiteral(pos, "true") + if err != nil { + return Token{}, wrapSyntacticError(d, err, pos, +1) + } + } else { + pos += len("true") + } + if err = d.Tokens.appendLiteral(); err != nil { + return Token{}, wrapSyntacticError(d, err, pos-len("true"), +1) // report position at start of literal + } + d.prevStart, d.prevEnd = pos, pos + return True, nil + + case '"': + var flags jsonwire.ValueFlags // TODO: Preserve this in Token? + if n = jsonwire.ConsumeSimpleString(d.buf[pos:]); n == 0 { + oldAbsPos := d.baseOffset + int64(pos) + pos, err = d.consumeString(&flags, pos) + newAbsPos := d.baseOffset + int64(pos) + n = int(newAbsPos - oldAbsPos) + if err != nil { + return Token{}, wrapSyntacticError(d, err, pos, +1) + } + } else { + pos += n + } + if d.Tokens.Last.NeedObjectName() { + if !d.Flags.Get(jsonflags.AllowDuplicateNames) { + if !d.Tokens.Last.isValidNamespace() { + return Token{}, wrapSyntacticError(d, errInvalidNamespace, pos-n, +1) + } + if d.Tokens.Last.isActiveNamespace() && !d.Namespaces.Last().insertQuoted(d.buf[pos-n:pos], flags.IsVerbatim()) { + err = wrapWithObjectName(ErrDuplicateName, d.buf[pos-n:pos]) + return Token{}, wrapSyntacticError(d, err, pos-n, +1) // report position at start of string + } + } + d.Names.ReplaceLastQuotedOffset(pos - n) // only replace if insertQuoted succeeds + } + if err = d.Tokens.appendString(); err != nil { + return Token{}, wrapSyntacticError(d, err, pos-n, +1) // report position at start of string + } + d.prevStart, d.prevEnd = pos-n, pos + return Token{raw: &d.decodeBuffer, num: uint64(d.previousOffsetStart())}, nil + + case '0': + // NOTE: Since JSON numbers are not self-terminating, + // we need to make sure that the next byte is not part of a number. + if n = jsonwire.ConsumeSimpleNumber(d.buf[pos:]); n == 0 || d.needMore(pos+n) { + oldAbsPos := d.baseOffset + int64(pos) + pos, err = d.consumeNumber(pos) + newAbsPos := d.baseOffset + int64(pos) + n = int(newAbsPos - oldAbsPos) + if err != nil { + return Token{}, wrapSyntacticError(d, err, pos, +1) + } + } else { + pos += n + } + if err = d.Tokens.appendNumber(); err != nil { + return Token{}, wrapSyntacticError(d, err, pos-n, +1) // report position at start of number + } + d.prevStart, d.prevEnd = pos-n, pos + return Token{raw: &d.decodeBuffer, num: uint64(d.previousOffsetStart())}, nil + + case '{': + if err = d.Tokens.pushObject(); err != nil { + return Token{}, wrapSyntacticError(d, err, pos, +1) + } + d.Names.push() + if !d.Flags.Get(jsonflags.AllowDuplicateNames) { + d.Namespaces.push() + } + pos += 1 + d.prevStart, d.prevEnd = pos, pos + return BeginObject, nil + + case '}': + if err = d.Tokens.popObject(); err != nil { + return Token{}, wrapSyntacticError(d, err, pos, +1) + } + d.Names.pop() + if !d.Flags.Get(jsonflags.AllowDuplicateNames) { + d.Namespaces.pop() + } + pos += 1 + d.prevStart, d.prevEnd = pos, pos + return EndObject, nil + + case '[': + if err = d.Tokens.pushArray(); err != nil { + return Token{}, wrapSyntacticError(d, err, pos, +1) + } + pos += 1 + d.prevStart, d.prevEnd = pos, pos + return BeginArray, nil + + case ']': + if err = d.Tokens.popArray(); err != nil { + return Token{}, wrapSyntacticError(d, err, pos, +1) + } + pos += 1 + d.prevStart, d.prevEnd = pos, pos + return EndArray, nil + + default: + err = jsonwire.NewInvalidCharacterError(d.buf[pos:], "at start of value") + return Token{}, wrapSyntacticError(d, err, pos, +1) + } +} + +// ReadValue returns the next raw JSON value, advancing the read offset. +// The value is stripped of any leading or trailing whitespace and +// contains the exact bytes of the input, which may contain invalid UTF-8 +// if [AllowInvalidUTF8] is specified. +// +// The returned value is only valid until the next Peek, Read, or Skip call and +// may not be mutated while the Decoder remains in use. +// If the decoder is currently at the end token for an object or array, +// then it reports a [SyntacticError] and the internal state remains unchanged. +// It returns [io.EOF] if there are no more values. +func (d *Decoder) ReadValue() (Value, error) { + var flags jsonwire.ValueFlags + return d.s.ReadValue(&flags) +} +func (d *decoderState) ReadValue(flags *jsonwire.ValueFlags) (Value, error) { + // Determine the next kind. + var err error + var next Kind + pos := d.peekPos + if pos != 0 { + // Use cached peek result. + if d.peekErr != nil { + err := d.peekErr + d.peekPos, d.peekErr = 0, nil // possibly a transient I/O error + return nil, err + } + next = Kind(d.buf[pos]).normalize() + d.peekPos = 0 // reset cache + } else { + d.invalidatePreviousRead() + pos = d.prevEnd + + // Consume leading whitespace. + pos += jsonwire.ConsumeWhitespace(d.buf[pos:]) + if d.needMore(pos) { + if pos, err = d.consumeWhitespace(pos); err != nil { + if err == io.ErrUnexpectedEOF && d.Tokens.Depth() == 1 { + err = io.EOF // EOF possibly if no Tokens present after top-level value + } + return nil, wrapSyntacticError(d, err, pos, 0) + } + } + + // Consume colon or comma. + var delim byte + if c := d.buf[pos]; c == ':' || c == ',' { + delim = c + pos += 1 + pos += jsonwire.ConsumeWhitespace(d.buf[pos:]) + if d.needMore(pos) { + if pos, err = d.consumeWhitespace(pos); err != nil { + err = wrapSyntacticError(d, err, pos, 0) + return nil, d.checkDelimBeforeIOError(delim, err) + } + } + } + next = Kind(d.buf[pos]).normalize() + if d.Tokens.needDelim(next) != delim { + return nil, d.checkDelim(delim, next) + } + } + + // Handle the next value. + oldAbsPos := d.baseOffset + int64(pos) + pos, err = d.consumeValue(flags, pos, d.Tokens.Depth()) + newAbsPos := d.baseOffset + int64(pos) + n := int(newAbsPos - oldAbsPos) + if err != nil { + return nil, wrapSyntacticError(d, err, pos, +1) + } + switch next { + case 'n', 't', 'f': + err = d.Tokens.appendLiteral() + case '"': + if d.Tokens.Last.NeedObjectName() { + if !d.Flags.Get(jsonflags.AllowDuplicateNames) { + if !d.Tokens.Last.isValidNamespace() { + err = errInvalidNamespace + break + } + if d.Tokens.Last.isActiveNamespace() && !d.Namespaces.Last().insertQuoted(d.buf[pos-n:pos], flags.IsVerbatim()) { + err = wrapWithObjectName(ErrDuplicateName, d.buf[pos-n:pos]) + break + } + } + d.Names.ReplaceLastQuotedOffset(pos - n) // only replace if insertQuoted succeeds + } + err = d.Tokens.appendString() + case '0': + err = d.Tokens.appendNumber() + case '{': + if err = d.Tokens.pushObject(); err != nil { + break + } + if err = d.Tokens.popObject(); err != nil { + panic("BUG: popObject should never fail immediately after pushObject: " + err.Error()) + } + case '[': + if err = d.Tokens.pushArray(); err != nil { + break + } + if err = d.Tokens.popArray(); err != nil { + panic("BUG: popArray should never fail immediately after pushArray: " + err.Error()) + } + } + if err != nil { + return nil, wrapSyntacticError(d, err, pos-n, +1) // report position at start of value + } + d.prevEnd = pos + d.prevStart = pos - n + return d.buf[pos-n : pos : pos], nil +} + +// CheckNextValue checks whether the next value is syntactically valid, +// but does not advance the read offset. +// If last, it verifies that the stream cleanly terminates with [io.EOF]. +func (d *decoderState) CheckNextValue(last bool) error { + d.PeekKind() // populates d.peekPos and d.peekErr + pos, err := d.peekPos, d.peekErr + d.peekPos, d.peekErr = 0, nil + if err != nil { + return err + } + + var flags jsonwire.ValueFlags + if pos, err := d.consumeValue(&flags, pos, d.Tokens.Depth()); err != nil { + return wrapSyntacticError(d, err, pos, +1) + } else if last { + return d.checkEOF(pos) + } + return nil +} + +// AtEOF reports whether the decoder is at EOF. +func (d *decoderState) AtEOF() bool { + _, err := d.consumeWhitespace(d.prevEnd) + return err == io.ErrUnexpectedEOF +} + +// CheckEOF verifies that the input has no more data. +func (d *decoderState) CheckEOF() error { + return d.checkEOF(d.prevEnd) +} +func (d *decoderState) checkEOF(pos int) error { + switch pos, err := d.consumeWhitespace(pos); err { + case nil: + err := jsonwire.NewInvalidCharacterError(d.buf[pos:], "after top-level value") + return wrapSyntacticError(d, err, pos, 0) + case io.ErrUnexpectedEOF: + return nil + default: + return err + } +} + +// consumeWhitespace consumes all whitespace starting at d.buf[pos:]. +// It returns the new position in d.buf immediately after the last whitespace. +// If it returns nil, there is guaranteed to at least be one unread byte. +// +// The following pattern is common in this implementation: +// +// pos += jsonwire.ConsumeWhitespace(d.buf[pos:]) +// if d.needMore(pos) { +// if pos, err = d.consumeWhitespace(pos); err != nil { +// return ... +// } +// } +// +// It is difficult to simplify this without sacrificing performance since +// consumeWhitespace must be inlined. The body of the if statement is +// executed only in rare situations where we need to fetch more data. +// Since fetching may return an error, we also need to check the error. +func (d *decoderState) consumeWhitespace(pos int) (newPos int, err error) { + for { + pos += jsonwire.ConsumeWhitespace(d.buf[pos:]) + if d.needMore(pos) { + absPos := d.baseOffset + int64(pos) + err = d.fetch() // will mutate d.buf and invalidate pos + pos = int(absPos - d.baseOffset) + if err != nil { + return pos, err + } + continue + } + return pos, nil + } +} + +// consumeValue consumes a single JSON value starting at d.buf[pos:]. +// It returns the new position in d.buf immediately after the value. +func (d *decoderState) consumeValue(flags *jsonwire.ValueFlags, pos, depth int) (newPos int, err error) { + for { + var n int + var err error + switch next := Kind(d.buf[pos]).normalize(); next { + case 'n': + if n = jsonwire.ConsumeNull(d.buf[pos:]); n == 0 { + n, err = jsonwire.ConsumeLiteral(d.buf[pos:], "null") + } + case 'f': + if n = jsonwire.ConsumeFalse(d.buf[pos:]); n == 0 { + n, err = jsonwire.ConsumeLiteral(d.buf[pos:], "false") + } + case 't': + if n = jsonwire.ConsumeTrue(d.buf[pos:]); n == 0 { + n, err = jsonwire.ConsumeLiteral(d.buf[pos:], "true") + } + case '"': + if n = jsonwire.ConsumeSimpleString(d.buf[pos:]); n == 0 { + return d.consumeString(flags, pos) + } + case '0': + // NOTE: Since JSON numbers are not self-terminating, + // we need to make sure that the next byte is not part of a number. + if n = jsonwire.ConsumeSimpleNumber(d.buf[pos:]); n == 0 || d.needMore(pos+n) { + return d.consumeNumber(pos) + } + case '{': + return d.consumeObject(flags, pos, depth) + case '[': + return d.consumeArray(flags, pos, depth) + default: + if (d.Tokens.Last.isObject() && next == ']') || (d.Tokens.Last.isArray() && next == '}') { + return pos, errMismatchDelim + } + return pos, jsonwire.NewInvalidCharacterError(d.buf[pos:], "at start of value") + } + if err == io.ErrUnexpectedEOF { + absPos := d.baseOffset + int64(pos) + err = d.fetch() // will mutate d.buf and invalidate pos + pos = int(absPos - d.baseOffset) + if err != nil { + return pos + n, err + } + continue + } + return pos + n, err + } +} + +// consumeLiteral consumes a single JSON literal starting at d.buf[pos:]. +// It returns the new position in d.buf immediately after the literal. +func (d *decoderState) consumeLiteral(pos int, lit string) (newPos int, err error) { + for { + n, err := jsonwire.ConsumeLiteral(d.buf[pos:], lit) + if err == io.ErrUnexpectedEOF { + absPos := d.baseOffset + int64(pos) + err = d.fetch() // will mutate d.buf and invalidate pos + pos = int(absPos - d.baseOffset) + if err != nil { + return pos + n, err + } + continue + } + return pos + n, err + } +} + +// consumeString consumes a single JSON string starting at d.buf[pos:]. +// It returns the new position in d.buf immediately after the string. +func (d *decoderState) consumeString(flags *jsonwire.ValueFlags, pos int) (newPos int, err error) { + var n int + for { + n, err = jsonwire.ConsumeStringResumable(flags, d.buf[pos:], n, !d.Flags.Get(jsonflags.AllowInvalidUTF8)) + if err == io.ErrUnexpectedEOF { + absPos := d.baseOffset + int64(pos) + err = d.fetch() // will mutate d.buf and invalidate pos + pos = int(absPos - d.baseOffset) + if err != nil { + return pos + n, err + } + continue + } + return pos + n, err + } +} + +// consumeNumber consumes a single JSON number starting at d.buf[pos:]. +// It returns the new position in d.buf immediately after the number. +func (d *decoderState) consumeNumber(pos int) (newPos int, err error) { + var n int + var state jsonwire.ConsumeNumberState + for { + n, state, err = jsonwire.ConsumeNumberResumable(d.buf[pos:], n, state) + // NOTE: Since JSON numbers are not self-terminating, + // we need to make sure that the next byte is not part of a number. + if err == io.ErrUnexpectedEOF || d.needMore(pos+n) { + mayTerminate := err == nil + absPos := d.baseOffset + int64(pos) + err = d.fetch() // will mutate d.buf and invalidate pos + pos = int(absPos - d.baseOffset) + if err != nil { + if mayTerminate && err == io.ErrUnexpectedEOF { + return pos + n, nil + } + return pos, err + } + continue + } + return pos + n, err + } +} + +// consumeObject consumes a single JSON object starting at d.buf[pos:]. +// It returns the new position in d.buf immediately after the object. +func (d *decoderState) consumeObject(flags *jsonwire.ValueFlags, pos, depth int) (newPos int, err error) { + var n int + var names *objectNamespace + if !d.Flags.Get(jsonflags.AllowDuplicateNames) { + d.Namespaces.push() + defer d.Namespaces.pop() + names = d.Namespaces.Last() + } + + // Handle before start. + if uint(pos) >= uint(len(d.buf)) || d.buf[pos] != '{' { + panic("BUG: consumeObject must be called with a buffer that starts with '{'") + } else if depth == maxNestingDepth+1 { + return pos, errMaxDepth + } + pos++ + + // Handle after start. + pos += jsonwire.ConsumeWhitespace(d.buf[pos:]) + if d.needMore(pos) { + if pos, err = d.consumeWhitespace(pos); err != nil { + return pos, err + } + } + if d.buf[pos] == '}' { + pos++ + return pos, nil + } + + depth++ + for { + // Handle before name. + pos += jsonwire.ConsumeWhitespace(d.buf[pos:]) + if d.needMore(pos) { + if pos, err = d.consumeWhitespace(pos); err != nil { + return pos, err + } + } + var flags2 jsonwire.ValueFlags + if n = jsonwire.ConsumeSimpleString(d.buf[pos:]); n == 0 { + oldAbsPos := d.baseOffset + int64(pos) + pos, err = d.consumeString(&flags2, pos) + newAbsPos := d.baseOffset + int64(pos) + n = int(newAbsPos - oldAbsPos) + flags.Join(flags2) + if err != nil { + return pos, err + } + } else { + pos += n + } + quotedName := d.buf[pos-n : pos] + if !d.Flags.Get(jsonflags.AllowDuplicateNames) && !names.insertQuoted(quotedName, flags2.IsVerbatim()) { + return pos - n, wrapWithObjectName(ErrDuplicateName, quotedName) + } + + // Handle after name. + pos += jsonwire.ConsumeWhitespace(d.buf[pos:]) + if d.needMore(pos) { + if pos, err = d.consumeWhitespace(pos); err != nil { + return pos, wrapWithObjectName(err, quotedName) + } + } + if d.buf[pos] != ':' { + err := jsonwire.NewInvalidCharacterError(d.buf[pos:], "after object name (expecting ':')") + return pos, wrapWithObjectName(err, quotedName) + } + pos++ + + // Handle before value. + pos += jsonwire.ConsumeWhitespace(d.buf[pos:]) + if d.needMore(pos) { + if pos, err = d.consumeWhitespace(pos); err != nil { + return pos, wrapWithObjectName(err, quotedName) + } + } + pos, err = d.consumeValue(flags, pos, depth) + if err != nil { + return pos, wrapWithObjectName(err, quotedName) + } + + // Handle after value. + pos += jsonwire.ConsumeWhitespace(d.buf[pos:]) + if d.needMore(pos) { + if pos, err = d.consumeWhitespace(pos); err != nil { + return pos, err + } + } + switch d.buf[pos] { + case ',': + pos++ + continue + case '}': + pos++ + return pos, nil + default: + return pos, jsonwire.NewInvalidCharacterError(d.buf[pos:], "after object value (expecting ',' or '}')") + } + } +} + +// consumeArray consumes a single JSON array starting at d.buf[pos:]. +// It returns the new position in d.buf immediately after the array. +func (d *decoderState) consumeArray(flags *jsonwire.ValueFlags, pos, depth int) (newPos int, err error) { + // Handle before start. + if uint(pos) >= uint(len(d.buf)) || d.buf[pos] != '[' { + panic("BUG: consumeArray must be called with a buffer that starts with '['") + } else if depth == maxNestingDepth+1 { + return pos, errMaxDepth + } + pos++ + + // Handle after start. + pos += jsonwire.ConsumeWhitespace(d.buf[pos:]) + if d.needMore(pos) { + if pos, err = d.consumeWhitespace(pos); err != nil { + return pos, err + } + } + if d.buf[pos] == ']' { + pos++ + return pos, nil + } + + var idx int64 + depth++ + for { + // Handle before value. + pos += jsonwire.ConsumeWhitespace(d.buf[pos:]) + if d.needMore(pos) { + if pos, err = d.consumeWhitespace(pos); err != nil { + return pos, err + } + } + pos, err = d.consumeValue(flags, pos, depth) + if err != nil { + return pos, wrapWithArrayIndex(err, idx) + } + + // Handle after value. + pos += jsonwire.ConsumeWhitespace(d.buf[pos:]) + if d.needMore(pos) { + if pos, err = d.consumeWhitespace(pos); err != nil { + return pos, err + } + } + switch d.buf[pos] { + case ',': + pos++ + idx++ + continue + case ']': + pos++ + return pos, nil + default: + return pos, jsonwire.NewInvalidCharacterError(d.buf[pos:], "after array element (expecting ',' or ']')") + } + } +} + +// InputOffset returns the current input byte offset. It gives the location +// of the next byte immediately after the most recently returned token or value. +// The number of bytes actually read from the underlying [io.Reader] may be more +// than this offset due to internal buffering effects. +func (d *Decoder) InputOffset() int64 { + return d.s.previousOffsetEnd() +} + +// UnreadBuffer returns the data remaining in the unread buffer, +// which may contain zero or more bytes. +// The returned buffer must not be mutated while Decoder continues to be used. +// The buffer contents are valid until the next Peek, Read, or Skip call. +func (d *Decoder) UnreadBuffer() []byte { + return d.s.unreadBuffer() +} + +// StackDepth returns the depth of the state machine for read JSON data. +// Each level on the stack represents a nested JSON object or array. +// It is incremented whenever an [BeginObject] or [BeginArray] token is encountered +// and decremented whenever an [EndObject] or [EndArray] token is encountered. +// The depth is zero-indexed, where zero represents the top-level JSON value. +func (d *Decoder) StackDepth() int { + // NOTE: Keep in sync with Encoder.StackDepth. + return d.s.Tokens.Depth() - 1 +} + +// StackIndex returns information about the specified stack level. +// It must be a number between 0 and [Decoder.StackDepth], inclusive. +// For each level, it reports the kind: +// +// - [KindInvalid] for a level of zero, +// - [KindBeginObject] for a level representing a JSON object, and +// - [KindBeginArray] for a level representing a JSON array. +// +// It also reports the length of that JSON object or array. +// Each name and value in a JSON object is counted separately, +// so the effective number of members would be half the length. +// A complete JSON object must have an even length. +func (d *Decoder) StackIndex(i int) (Kind, int64) { + // NOTE: Keep in sync with Encoder.StackIndex. + switch s := d.s.Tokens.index(i); { + case i > 0 && s.isObject(): + return '{', s.Length() + case i > 0 && s.isArray(): + return '[', s.Length() + default: + return 0, s.Length() + } +} + +// StackPointer returns a JSON Pointer (RFC 6901) to the most recently read value. +func (d *Decoder) StackPointer() Pointer { + return Pointer(d.s.AppendStackPointer(nil, -1)) +} + +func (d *decoderState) AppendStackPointer(b []byte, where int) []byte { + d.Names.copyQuotedBuffer(d.buf) + return d.state.appendStackPointer(b, where) +} diff --git a/go/src/encoding/json/jsontext/decode_test.go b/go/src/encoding/json/jsontext/decode_test.go new file mode 100644 index 0000000000000000000000000000000000000000..3f48cae2d1d09377e0c6697b3b098dee41361efd --- /dev/null +++ b/go/src/encoding/json/jsontext/decode_test.go @@ -0,0 +1,1350 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsontext + +import ( + "bytes" + "errors" + "fmt" + "io" + "net" + "path" + "reflect" + "slices" + "strings" + "testing" + "testing/iotest" + + "encoding/json/internal/jsonflags" + "encoding/json/internal/jsontest" + "encoding/json/internal/jsonwire" +) + +// equalTokens reports whether to sequences of tokens formats the same way. +func equalTokens(xs, ys []Token) bool { + if len(xs) != len(ys) { + return false + } + for i := range xs { + if !(reflect.DeepEqual(xs[i], ys[i]) || xs[i].String() == ys[i].String()) { + return false + } + } + return true +} + +// TestDecoder tests whether we can parse JSON with either tokens or raw values. +func TestDecoder(t *testing.T) { + for _, td := range coderTestdata { + for _, typeName := range []string{"Token", "Value", "TokenDelims"} { + t.Run(path.Join(td.name.Name, typeName), func(t *testing.T) { + testDecoder(t, td.name.Where, typeName, td) + }) + } + } +} +func testDecoder(t *testing.T, where jsontest.CasePos, typeName string, td coderTestdataEntry) { + dec := NewDecoder(bytes.NewBufferString(td.in)) + switch typeName { + case "Token": + var tokens []Token + var pointers []Pointer + for { + tok, err := dec.ReadToken() + if err != nil { + if err == io.EOF { + break + } + t.Fatalf("%s: Decoder.ReadToken error: %v", where, err) + } + tokens = append(tokens, tok.Clone()) + if td.pointers != nil { + pointers = append(pointers, dec.StackPointer()) + } + } + if !equalTokens(tokens, td.tokens) { + t.Fatalf("%s: tokens mismatch:\ngot %v\nwant %v", where, tokens, td.tokens) + } + if !slices.Equal(pointers, td.pointers) { + t.Fatalf("%s: pointers mismatch:\ngot %q\nwant %q", where, pointers, td.pointers) + } + case "Value": + val, err := dec.ReadValue() + if err != nil { + t.Fatalf("%s: Decoder.ReadValue error: %v", where, err) + } + got := string(val) + want := strings.TrimSpace(td.in) + if got != want { + t.Fatalf("%s: Decoder.ReadValue = %s, want %s", where, got, want) + } + case "TokenDelims": + // Use ReadToken for object/array delimiters, ReadValue otherwise. + var tokens []Token + loop: + for { + switch dec.PeekKind() { + case '{', '}', '[', ']': + tok, err := dec.ReadToken() + if err != nil { + if err == io.EOF { + break loop + } + t.Fatalf("%s: Decoder.ReadToken error: %v", where, err) + } + tokens = append(tokens, tok.Clone()) + default: + val, err := dec.ReadValue() + if err != nil { + if err == io.EOF { + break loop + } + t.Fatalf("%s: Decoder.ReadValue error: %v", where, err) + } + tokens = append(tokens, rawToken(string(val))) + } + } + if !equalTokens(tokens, td.tokens) { + t.Fatalf("%s: tokens mismatch:\ngot %v\nwant %v", where, tokens, td.tokens) + } + } +} + +// TestFaultyDecoder tests that temporary I/O errors are not fatal. +func TestFaultyDecoder(t *testing.T) { + for _, td := range coderTestdata { + for _, typeName := range []string{"Token", "Value"} { + t.Run(path.Join(td.name.Name, typeName), func(t *testing.T) { + testFaultyDecoder(t, td.name.Where, typeName, td) + }) + } + } +} +func testFaultyDecoder(t *testing.T, where jsontest.CasePos, typeName string, td coderTestdataEntry) { + b := &FaultyBuffer{ + B: []byte(td.in), + MaxBytes: 1, + MayError: io.ErrNoProgress, + } + + // Read all the tokens. + // If the underlying io.Reader is faulty, then Read may return + // an error without changing the internal state machine. + // In other words, I/O errors occur before syntactic errors. + dec := NewDecoder(b) + switch typeName { + case "Token": + var tokens []Token + for { + tok, err := dec.ReadToken() + if err != nil { + if err == io.EOF { + break + } + if !errors.Is(err, io.ErrNoProgress) { + t.Fatalf("%s: %d: Decoder.ReadToken error: %v", where, len(tokens), err) + } + continue + } + tokens = append(tokens, tok.Clone()) + } + if !equalTokens(tokens, td.tokens) { + t.Fatalf("%s: tokens mismatch:\ngot %s\nwant %s", where, tokens, td.tokens) + } + case "Value": + for { + val, err := dec.ReadValue() + if err != nil { + if err == io.EOF { + break + } + if !errors.Is(err, io.ErrNoProgress) { + t.Fatalf("%s: Decoder.ReadValue error: %v", where, err) + } + continue + } + got := string(val) + want := strings.TrimSpace(td.in) + if got != want { + t.Fatalf("%s: Decoder.ReadValue = %s, want %s", where, got, want) + } + } + } +} + +type decoderMethodCall struct { + wantKind Kind + wantOut tokOrVal + wantErr error + wantPointer Pointer +} + +var decoderErrorTestdata = []struct { + name jsontest.CaseName + opts []Options + in string + calls []decoderMethodCall + wantOffset int +}{{ + name: jsontest.Name("InvalidStart"), + in: ` #`, + calls: []decoderMethodCall{ + {0, zeroToken, newInvalidCharacterError("#", "at start of value").withPos(" ", ""), ""}, + {0, zeroValue, newInvalidCharacterError("#", "at start of value").withPos(" ", ""), ""}, + }, +}, { + name: jsontest.Name("StreamN0"), + in: ` `, + calls: []decoderMethodCall{ + {0, zeroToken, io.EOF, ""}, + {0, zeroValue, io.EOF, ""}, + }, +}, { + name: jsontest.Name("StreamN1"), + in: ` null `, + calls: []decoderMethodCall{ + {'n', Null, nil, ""}, + {0, zeroToken, io.EOF, ""}, + {0, zeroValue, io.EOF, ""}, + }, + wantOffset: len(` null`), +}, { + name: jsontest.Name("StreamN2"), + in: ` nullnull `, + calls: []decoderMethodCall{ + {'n', Null, nil, ""}, + {'n', Null, nil, ""}, + {0, zeroToken, io.EOF, ""}, + {0, zeroValue, io.EOF, ""}, + }, + wantOffset: len(` nullnull`), +}, { + name: jsontest.Name("StreamN2/ExtraComma"), // stream is whitespace delimited, not comma delimited + in: ` null , null `, + calls: []decoderMethodCall{ + {'n', Null, nil, ""}, + {0, zeroToken, newInvalidCharacterError(",", `at start of value`).withPos(` null `, ""), ""}, + {0, zeroValue, newInvalidCharacterError(",", `at start of value`).withPos(` null `, ""), ""}, + }, + wantOffset: len(` null`), +}, { + name: jsontest.Name("TruncatedNull"), + in: `nul`, + calls: []decoderMethodCall{ + {'n', zeroToken, E(io.ErrUnexpectedEOF).withPos(`nul`, ""), ""}, + {'n', zeroValue, E(io.ErrUnexpectedEOF).withPos(`nul`, ""), ""}, + }, +}, { + name: jsontest.Name("InvalidNull"), + in: `nulL`, + calls: []decoderMethodCall{ + {'n', zeroToken, newInvalidCharacterError("L", `in literal null (expecting 'l')`).withPos(`nul`, ""), ""}, + {'n', zeroValue, newInvalidCharacterError("L", `in literal null (expecting 'l')`).withPos(`nul`, ""), ""}, + }, +}, { + name: jsontest.Name("TruncatedFalse"), + in: `fals`, + calls: []decoderMethodCall{ + {'f', zeroToken, E(io.ErrUnexpectedEOF).withPos(`fals`, ""), ""}, + {'f', zeroValue, E(io.ErrUnexpectedEOF).withPos(`fals`, ""), ""}, + }, +}, { + name: jsontest.Name("InvalidFalse"), + in: `falsE`, + calls: []decoderMethodCall{ + {'f', zeroToken, newInvalidCharacterError("E", `in literal false (expecting 'e')`).withPos(`fals`, ""), ""}, + {'f', zeroValue, newInvalidCharacterError("E", `in literal false (expecting 'e')`).withPos(`fals`, ""), ""}, + }, +}, { + name: jsontest.Name("TruncatedTrue"), + in: `tru`, + calls: []decoderMethodCall{ + {'t', zeroToken, E(io.ErrUnexpectedEOF).withPos(`tru`, ""), ""}, + {'t', zeroValue, E(io.ErrUnexpectedEOF).withPos(`tru`, ""), ""}, + }, +}, { + name: jsontest.Name("InvalidTrue"), + in: `truE`, + calls: []decoderMethodCall{ + {'t', zeroToken, newInvalidCharacterError("E", `in literal true (expecting 'e')`).withPos(`tru`, ""), ""}, + {'t', zeroValue, newInvalidCharacterError("E", `in literal true (expecting 'e')`).withPos(`tru`, ""), ""}, + }, +}, { + name: jsontest.Name("TruncatedString"), + in: `"start`, + calls: []decoderMethodCall{ + {'"', zeroToken, E(io.ErrUnexpectedEOF).withPos(`"start`, ""), ""}, + {'"', zeroValue, E(io.ErrUnexpectedEOF).withPos(`"start`, ""), ""}, + }, +}, { + name: jsontest.Name("InvalidString"), + in: `"ok` + "\x00", + calls: []decoderMethodCall{ + {'"', zeroToken, newInvalidCharacterError("\x00", `in string (expecting non-control character)`).withPos(`"ok`, ""), ""}, + {'"', zeroValue, newInvalidCharacterError("\x00", `in string (expecting non-control character)`).withPos(`"ok`, ""), ""}, + }, +}, { + name: jsontest.Name("ValidString/AllowInvalidUTF8/Token"), + opts: []Options{AllowInvalidUTF8(true)}, + in: "\"living\xde\xad\xbe\xef\"", + calls: []decoderMethodCall{ + {'"', rawToken("\"living\xde\xad\xbe\xef\""), nil, ""}, + }, + wantOffset: len("\"living\xde\xad\xbe\xef\""), +}, { + name: jsontest.Name("ValidString/AllowInvalidUTF8/Value"), + opts: []Options{AllowInvalidUTF8(true)}, + in: "\"living\xde\xad\xbe\xef\"", + calls: []decoderMethodCall{ + {'"', Value("\"living\xde\xad\xbe\xef\""), nil, ""}, + }, + wantOffset: len("\"living\xde\xad\xbe\xef\""), +}, { + name: jsontest.Name("InvalidString/RejectInvalidUTF8"), + opts: []Options{AllowInvalidUTF8(false)}, + in: "\"living\xde\xad\xbe\xef\"", + calls: []decoderMethodCall{ + {'"', zeroToken, E(jsonwire.ErrInvalidUTF8).withPos("\"living\xde\xad", ""), ""}, + {'"', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos("\"living\xde\xad", ""), ""}, + }, +}, { + name: jsontest.Name("TruncatedNumber"), + in: `0.`, + calls: []decoderMethodCall{ + {'0', zeroToken, E(io.ErrUnexpectedEOF), ""}, + {'0', zeroValue, E(io.ErrUnexpectedEOF), ""}, + }, +}, { + name: jsontest.Name("InvalidNumber"), + in: `0.e`, + calls: []decoderMethodCall{ + {'0', zeroToken, newInvalidCharacterError("e", "in number (expecting digit)").withPos(`0.`, ""), ""}, + {'0', zeroValue, newInvalidCharacterError("e", "in number (expecting digit)").withPos(`0.`, ""), ""}, + }, +}, { + name: jsontest.Name("TruncatedObject/AfterStart"), + in: `{`, + calls: []decoderMethodCall{ + {'{', zeroValue, E(io.ErrUnexpectedEOF).withPos("{", ""), ""}, + {'{', BeginObject, nil, ""}, + {0, zeroToken, E(io.ErrUnexpectedEOF).withPos("{", ""), ""}, + {0, zeroValue, E(io.ErrUnexpectedEOF).withPos("{", ""), ""}, + }, + wantOffset: len(`{`), +}, { + name: jsontest.Name("TruncatedObject/AfterName"), + in: `{"0"`, + calls: []decoderMethodCall{ + {'{', zeroValue, E(io.ErrUnexpectedEOF).withPos(`{"0"`, "/0"), ""}, + {'{', BeginObject, nil, ""}, + {'"', String("0"), nil, ""}, + {0, zeroToken, E(io.ErrUnexpectedEOF).withPos(`{"0"`, "/0"), ""}, + {0, zeroValue, E(io.ErrUnexpectedEOF).withPos(`{"0"`, "/0"), ""}, + }, + wantOffset: len(`{"0"`), +}, { + name: jsontest.Name("TruncatedObject/AfterColon"), + in: `{"0":`, + calls: []decoderMethodCall{ + {'{', zeroValue, E(io.ErrUnexpectedEOF).withPos(`{"0":`, "/0"), ""}, + {'{', BeginObject, nil, ""}, + {'"', String("0"), nil, ""}, + {0, zeroToken, E(io.ErrUnexpectedEOF).withPos(`{"0":`, "/0"), ""}, + {0, zeroValue, E(io.ErrUnexpectedEOF).withPos(`{"0":`, "/0"), ""}, + }, + wantOffset: len(`{"0"`), +}, { + name: jsontest.Name("TruncatedObject/AfterValue"), + in: `{"0":0`, + calls: []decoderMethodCall{ + {'{', zeroValue, E(io.ErrUnexpectedEOF).withPos(`{"0":0`, ""), ""}, + {'{', BeginObject, nil, ""}, + {'"', String("0"), nil, ""}, + {'0', Uint(0), nil, ""}, + {0, zeroToken, E(io.ErrUnexpectedEOF).withPos(`{"0":0`, ""), ""}, + {0, zeroValue, E(io.ErrUnexpectedEOF).withPos(`{"0":0`, ""), ""}, + }, + wantOffset: len(`{"0":0`), +}, { + name: jsontest.Name("TruncatedObject/AfterComma"), + in: `{"0":0,`, + calls: []decoderMethodCall{ + {'{', zeroValue, E(io.ErrUnexpectedEOF).withPos(`{"0":0,`, ""), ""}, + {'{', BeginObject, nil, ""}, + {'"', String("0"), nil, ""}, + {'0', Uint(0), nil, ""}, + {0, zeroToken, E(io.ErrUnexpectedEOF).withPos(`{"0":0,`, ""), ""}, + {0, zeroValue, E(io.ErrUnexpectedEOF).withPos(`{"0":0,`, ""), ""}, + }, + wantOffset: len(`{"0":0`), +}, { + name: jsontest.Name("InvalidObject/MissingColon"), + in: ` { "fizz" "buzz" } `, + calls: []decoderMethodCall{ + {'{', zeroValue, newInvalidCharacterError("\"", "after object name (expecting ':')").withPos(` { "fizz" `, "/fizz"), ""}, + {'{', BeginObject, nil, ""}, + {'"', String("fizz"), nil, ""}, + {0, zeroToken, newInvalidCharacterError("\"", "after object name (expecting ':')").withPos(` { "fizz" `, "/fizz"), ""}, + {0, zeroValue, newInvalidCharacterError("\"", "after object name (expecting ':')").withPos(` { "fizz" `, "/fizz"), ""}, + }, + wantOffset: len(` { "fizz"`), +}, { + name: jsontest.Name("InvalidObject/MissingColon/GotComma"), + in: ` { "fizz" , "buzz" } `, + calls: []decoderMethodCall{ + {'{', zeroValue, newInvalidCharacterError(",", "after object name (expecting ':')").withPos(` { "fizz" `, "/fizz"), ""}, + {'{', BeginObject, nil, ""}, + {'"', String("fizz"), nil, ""}, + {0, zeroToken, newInvalidCharacterError(",", "after object name (expecting ':')").withPos(` { "fizz" `, "/fizz"), ""}, + {0, zeroValue, newInvalidCharacterError(",", "after object name (expecting ':')").withPos(` { "fizz" `, "/fizz"), ""}, + }, + wantOffset: len(` { "fizz"`), +}, { + name: jsontest.Name("InvalidObject/MissingColon/GotHash"), + in: ` { "fizz" # "buzz" } `, + calls: []decoderMethodCall{ + {'{', zeroValue, newInvalidCharacterError("#", "after object name (expecting ':')").withPos(` { "fizz" `, "/fizz"), ""}, + {'{', BeginObject, nil, ""}, + {'"', String("fizz"), nil, ""}, + {0, zeroToken, newInvalidCharacterError("#", "after object name (expecting ':')").withPos(` { "fizz" `, "/fizz"), ""}, + {0, zeroValue, newInvalidCharacterError("#", "after object name (expecting ':')").withPos(` { "fizz" `, "/fizz"), ""}, + }, + wantOffset: len(` { "fizz"`), +}, { + name: jsontest.Name("InvalidObject/MissingComma"), + in: ` { "fizz" : "buzz" "gazz" } `, + calls: []decoderMethodCall{ + {'{', zeroValue, newInvalidCharacterError("\"", "after object value (expecting ',' or '}')").withPos(` { "fizz" : "buzz" `, ""), ""}, + {'{', BeginObject, nil, ""}, + {'"', String("fizz"), nil, ""}, + {'"', String("buzz"), nil, ""}, + {0, zeroToken, newInvalidCharacterError("\"", "after object value (expecting ',' or '}')").withPos(` { "fizz" : "buzz" `, ""), ""}, + {0, zeroValue, newInvalidCharacterError("\"", "after object value (expecting ',' or '}')").withPos(` { "fizz" : "buzz" `, ""), ""}, + }, + wantOffset: len(` { "fizz" : "buzz"`), +}, { + name: jsontest.Name("InvalidObject/MissingComma/GotColon"), + in: ` { "fizz" : "buzz" : "gazz" } `, + calls: []decoderMethodCall{ + {'{', zeroValue, newInvalidCharacterError(":", "after object value (expecting ',' or '}')").withPos(` { "fizz" : "buzz" `, ""), ""}, + {'{', BeginObject, nil, ""}, + {'"', String("fizz"), nil, ""}, + {'"', String("buzz"), nil, ""}, + {0, zeroToken, newInvalidCharacterError(":", "after object value (expecting ',' or '}')").withPos(` { "fizz" : "buzz" `, ""), ""}, + {0, zeroValue, newInvalidCharacterError(":", "after object value (expecting ',' or '}')").withPos(` { "fizz" : "buzz" `, ""), ""}, + }, + wantOffset: len(` { "fizz" : "buzz"`), +}, { + name: jsontest.Name("InvalidObject/MissingComma/GotHash"), + in: ` { "fizz" : "buzz" # "gazz" } `, + calls: []decoderMethodCall{ + {'{', zeroValue, newInvalidCharacterError("#", "after object value (expecting ',' or '}')").withPos(` { "fizz" : "buzz" `, ""), ""}, + {'{', BeginObject, nil, ""}, + {'"', String("fizz"), nil, ""}, + {'"', String("buzz"), nil, ""}, + {0, zeroToken, newInvalidCharacterError("#", "after object value (expecting ',' or '}')").withPos(` { "fizz" : "buzz" `, ""), ""}, + {0, zeroValue, newInvalidCharacterError("#", "after object value (expecting ',' or '}')").withPos(` { "fizz" : "buzz" `, ""), ""}, + }, + wantOffset: len(` { "fizz" : "buzz"`), +}, { + name: jsontest.Name("InvalidObject/ExtraComma/AfterStart"), + in: ` { , } `, + calls: []decoderMethodCall{ + {'{', zeroValue, newInvalidCharacterError(",", `at start of string (expecting '"')`).withPos(` { `, ""), ""}, + {'{', BeginObject, nil, ""}, + {0, zeroToken, newInvalidCharacterError(",", `at start of value`).withPos(` { `, ""), ""}, + {0, zeroValue, newInvalidCharacterError(",", `at start of value`).withPos(` { `, ""), ""}, + }, + wantOffset: len(` {`), +}, { + name: jsontest.Name("InvalidObject/ExtraComma/AfterValue"), + in: ` { "fizz" : "buzz" , } `, + calls: []decoderMethodCall{ + {'{', zeroValue, newInvalidCharacterError("}", `at start of string (expecting '"')`).withPos(` { "fizz" : "buzz" , `, ""), ""}, + {'{', BeginObject, nil, ""}, + {'"', String("fizz"), nil, ""}, + {'"', String("buzz"), nil, ""}, + {0, zeroToken, newInvalidCharacterError(",", `at start of value`).withPos(` { "fizz" : "buzz" `, ""), ""}, + {0, zeroValue, newInvalidCharacterError(",", `at start of value`).withPos(` { "fizz" : "buzz" `, ""), ""}, + }, + wantOffset: len(` { "fizz" : "buzz"`), +}, { + name: jsontest.Name("InvalidObject/InvalidName/GotNull"), + in: ` { null : null } `, + calls: []decoderMethodCall{ + {'{', zeroValue, newInvalidCharacterError("n", "at start of string (expecting '\"')").withPos(` { `, ""), ""}, + {'{', BeginObject, nil, ""}, + {'n', zeroToken, E(ErrNonStringName).withPos(` { `, ""), ""}, + {'n', zeroValue, E(ErrNonStringName).withPos(` { `, ""), ""}, + }, + wantOffset: len(` {`), +}, { + name: jsontest.Name("InvalidObject/InvalidName/GotFalse"), + in: ` { false : false } `, + calls: []decoderMethodCall{ + {'{', zeroValue, newInvalidCharacterError("f", "at start of string (expecting '\"')").withPos(` { `, ""), ""}, + {'{', BeginObject, nil, ""}, + {'f', zeroToken, E(ErrNonStringName).withPos(` { `, ""), ""}, + {'f', zeroValue, E(ErrNonStringName).withPos(` { `, ""), ""}, + }, + wantOffset: len(` {`), +}, { + name: jsontest.Name("InvalidObject/InvalidName/GotTrue"), + in: ` { true : true } `, + calls: []decoderMethodCall{ + {'{', zeroValue, newInvalidCharacterError("t", "at start of string (expecting '\"')").withPos(` { `, ""), ""}, + {'{', BeginObject, nil, ""}, + {'t', zeroToken, E(ErrNonStringName).withPos(` { `, ""), ""}, + {'t', zeroValue, E(ErrNonStringName).withPos(` { `, ""), ""}, + }, + wantOffset: len(` {`), +}, { + name: jsontest.Name("InvalidObject/InvalidName/GotNumber"), + in: ` { 0 : 0 } `, + calls: []decoderMethodCall{ + {'{', zeroValue, newInvalidCharacterError("0", "at start of string (expecting '\"')").withPos(` { `, ""), ""}, + {'{', BeginObject, nil, ""}, + {'0', zeroToken, E(ErrNonStringName).withPos(` { `, ""), ""}, + {'0', zeroValue, E(ErrNonStringName).withPos(` { `, ""), ""}, + }, + wantOffset: len(` {`), +}, { + name: jsontest.Name("InvalidObject/InvalidName/GotObject"), + in: ` { {} : {} } `, + calls: []decoderMethodCall{ + {'{', zeroValue, newInvalidCharacterError("{", "at start of string (expecting '\"')").withPos(` { `, ""), ""}, + {'{', BeginObject, nil, ""}, + {'{', zeroToken, E(ErrNonStringName).withPos(` { `, ""), ""}, + {'{', zeroValue, E(ErrNonStringName).withPos(` { `, ""), ""}, + }, + wantOffset: len(` {`), +}, { + name: jsontest.Name("InvalidObject/InvalidName/GotArray"), + in: ` { [] : [] } `, + calls: []decoderMethodCall{ + {'{', zeroValue, newInvalidCharacterError("[", "at start of string (expecting '\"')").withPos(` { `, ""), ""}, + {'{', BeginObject, nil, ""}, + {'[', zeroToken, E(ErrNonStringName).withPos(` { `, ""), ""}, + {'[', zeroValue, E(ErrNonStringName).withPos(` { `, ""), ""}, + }, + wantOffset: len(` {`), +}, { + name: jsontest.Name("InvalidObject/MismatchingDelim"), + in: ` { ] `, + calls: []decoderMethodCall{ + {'{', zeroValue, newInvalidCharacterError("]", "at start of string (expecting '\"')").withPos(` { `, ""), ""}, + {'{', BeginObject, nil, ""}, + {']', zeroToken, newInvalidCharacterError("]", "at start of value").withPos(` { `, ""), ""}, + {']', zeroValue, newInvalidCharacterError("]", "at start of value").withPos(` { `, ""), ""}, + }, + wantOffset: len(` {`), +}, { + name: jsontest.Name("ValidObject/InvalidValue"), + in: ` { } `, + calls: []decoderMethodCall{ + {'{', BeginObject, nil, ""}, + {'}', zeroValue, newInvalidCharacterError("}", "at start of value").withPos(" { ", ""), ""}, + }, + wantOffset: len(` {`), +}, { + name: jsontest.Name("ValidObject/UniqueNames"), + in: `{"0":0,"1":1} `, + calls: []decoderMethodCall{ + {'{', BeginObject, nil, ""}, + {'"', String("0"), nil, ""}, + {'0', Uint(0), nil, ""}, + {'"', String("1"), nil, ""}, + {'0', Uint(1), nil, ""}, + {'}', EndObject, nil, ""}, + }, + wantOffset: len(`{"0":0,"1":1}`), +}, { + name: jsontest.Name("ValidObject/DuplicateNames"), + opts: []Options{AllowDuplicateNames(true)}, + in: `{"0":0,"0":0} `, + calls: []decoderMethodCall{ + {'{', BeginObject, nil, ""}, + {'"', String("0"), nil, ""}, + {'0', Uint(0), nil, ""}, + {'"', String("0"), nil, ""}, + {'0', Uint(0), nil, ""}, + {'}', EndObject, nil, ""}, + }, + wantOffset: len(`{"0":0,"0":0}`), +}, { + name: jsontest.Name("InvalidObject/DuplicateNames"), + in: `{"X":{},"Y":{},"X":{}} `, + calls: []decoderMethodCall{ + {'{', zeroValue, E(ErrDuplicateName).withPos(`{"X":{},"Y":{},`, "/X"), ""}, + {'{', BeginObject, nil, ""}, + {'"', String("X"), nil, ""}, + {'{', BeginObject, nil, ""}, + {'}', EndObject, nil, ""}, + {'"', String("Y"), nil, ""}, + {'{', BeginObject, nil, ""}, + {'}', EndObject, nil, ""}, + {'"', zeroToken, E(ErrDuplicateName).withPos(`{"X":{},"Y":{},`, "/X"), "/Y"}, + {'"', zeroValue, E(ErrDuplicateName).withPos(`{"0":{},"Y":{},`, "/X"), "/Y"}, + }, + wantOffset: len(`{"0":{},"1":{}`), +}, { + name: jsontest.Name("TruncatedArray/AfterStart"), + in: `[`, + calls: []decoderMethodCall{ + {'[', zeroValue, E(io.ErrUnexpectedEOF).withPos("[", ""), ""}, + {'[', BeginArray, nil, ""}, + {0, zeroToken, E(io.ErrUnexpectedEOF).withPos("[", ""), ""}, + {0, zeroValue, E(io.ErrUnexpectedEOF).withPos("[", ""), ""}, + }, + wantOffset: len(`[`), +}, { + name: jsontest.Name("TruncatedArray/AfterValue"), + in: `[0`, + calls: []decoderMethodCall{ + {'[', zeroValue, E(io.ErrUnexpectedEOF).withPos("[0", ""), ""}, + {'[', BeginArray, nil, ""}, + {'0', Uint(0), nil, ""}, + {0, zeroToken, E(io.ErrUnexpectedEOF).withPos("[0", ""), ""}, + {0, zeroValue, E(io.ErrUnexpectedEOF).withPos("[0", ""), ""}, + }, + wantOffset: len(`[0`), +}, { + name: jsontest.Name("TruncatedArray/AfterComma"), + in: `[0,`, + calls: []decoderMethodCall{ + {'[', zeroValue, E(io.ErrUnexpectedEOF).withPos("[0,", ""), ""}, + {'[', BeginArray, nil, ""}, + {'0', Uint(0), nil, ""}, + {0, zeroToken, E(io.ErrUnexpectedEOF).withPos("[0,", ""), ""}, + {0, zeroValue, E(io.ErrUnexpectedEOF).withPos("[0,", ""), ""}, + }, + wantOffset: len(`[0`), +}, { + name: jsontest.Name("InvalidArray/MissingComma"), + in: ` [ "fizz" "buzz" ] `, + calls: []decoderMethodCall{ + {'[', zeroValue, newInvalidCharacterError("\"", "after array element (expecting ',' or ']')").withPos(` [ "fizz" `, ""), ""}, + {'[', BeginArray, nil, ""}, + {'"', String("fizz"), nil, ""}, + {0, zeroToken, newInvalidCharacterError("\"", "after array element (expecting ',' or ']')").withPos(` [ "fizz" `, ""), ""}, + {0, zeroValue, newInvalidCharacterError("\"", "after array element (expecting ',' or ']')").withPos(` [ "fizz" `, ""), ""}, + }, + wantOffset: len(` [ "fizz"`), +}, { + name: jsontest.Name("InvalidArray/MismatchingDelim"), + in: ` [ } `, + calls: []decoderMethodCall{ + {'[', zeroValue, newInvalidCharacterError("}", "at start of value").withPos(` [ `, "/0"), ""}, + {'[', BeginArray, nil, ""}, + {'}', zeroToken, newInvalidCharacterError("}", "at start of value").withPos(` [ `, "/0"), ""}, + {'}', zeroValue, newInvalidCharacterError("}", "at start of value").withPos(` [ `, "/0"), ""}, + }, + wantOffset: len(` [`), +}, { + name: jsontest.Name("ValidArray/InvalidValue"), + in: ` [ ] `, + calls: []decoderMethodCall{ + {'[', BeginArray, nil, ""}, + {']', zeroValue, newInvalidCharacterError("]", "at start of value").withPos(" [ ", "/0"), ""}, + }, + wantOffset: len(` [`), +}, { + name: jsontest.Name("InvalidDelim/AfterTopLevel"), + in: `"",`, + calls: []decoderMethodCall{ + {'"', String(""), nil, ""}, + {0, zeroToken, newInvalidCharacterError(",", "at start of value").withPos(`""`, ""), ""}, + {0, zeroValue, newInvalidCharacterError(",", "at start of value").withPos(`""`, ""), ""}, + }, + wantOffset: len(`""`), +}, { + name: jsontest.Name("InvalidDelim/AfterBeginObject"), + in: `{:`, + calls: []decoderMethodCall{ + {'{', zeroValue, newInvalidCharacterError(":", `at start of string (expecting '"')`).withPos(`{`, ""), ""}, + {'{', BeginObject, nil, ""}, + {0, zeroToken, newInvalidCharacterError(":", "at start of value").withPos(`{`, ""), ""}, + {0, zeroValue, newInvalidCharacterError(":", "at start of value").withPos(`{`, ""), ""}, + }, + wantOffset: len(`{`), +}, { + name: jsontest.Name("InvalidDelim/AfterObjectName"), + in: `{"",`, + calls: []decoderMethodCall{ + {'{', zeroValue, newInvalidCharacterError(",", "after object name (expecting ':')").withPos(`{""`, "/"), ""}, + {'{', BeginObject, nil, ""}, + {'"', String(""), nil, ""}, + {0, zeroToken, newInvalidCharacterError(",", "after object name (expecting ':')").withPos(`{""`, "/"), ""}, + {0, zeroValue, newInvalidCharacterError(",", "after object name (expecting ':')").withPos(`{""`, "/"), ""}, + }, + wantOffset: len(`{""`), +}, { + name: jsontest.Name("ValidDelim/AfterObjectName"), + in: `{"":`, + calls: []decoderMethodCall{ + {'{', zeroValue, E(io.ErrUnexpectedEOF).withPos(`{"":`, "/"), ""}, + {'{', BeginObject, nil, ""}, + {'"', String(""), nil, ""}, + {0, zeroToken, E(io.ErrUnexpectedEOF).withPos(`{"":`, "/"), ""}, + {0, zeroValue, E(io.ErrUnexpectedEOF).withPos(`{"":`, "/"), ""}, + }, + wantOffset: len(`{""`), +}, { + name: jsontest.Name("InvalidDelim/AfterObjectValue"), + in: `{"":"":`, + calls: []decoderMethodCall{ + {'{', zeroValue, newInvalidCharacterError(":", "after object value (expecting ',' or '}')").withPos(`{"":""`, ""), ""}, + {'{', BeginObject, nil, ""}, + {'"', String(""), nil, ""}, + {'"', String(""), nil, ""}, + {0, zeroToken, newInvalidCharacterError(":", "after object value (expecting ',' or '}')").withPos(`{"":""`, ""), ""}, + {0, zeroValue, newInvalidCharacterError(":", "after object value (expecting ',' or '}')").withPos(`{"":""`, ""), ""}, + }, + wantOffset: len(`{"":""`), +}, { + name: jsontest.Name("ValidDelim/AfterObjectValue"), + in: `{"":"",`, + calls: []decoderMethodCall{ + {'{', zeroValue, E(io.ErrUnexpectedEOF).withPos(`{"":"",`, ""), ""}, + {'{', BeginObject, nil, ""}, + {'"', String(""), nil, ""}, + {'"', String(""), nil, ""}, + {0, zeroToken, E(io.ErrUnexpectedEOF).withPos(`{"":"",`, ""), ""}, + {0, zeroValue, E(io.ErrUnexpectedEOF).withPos(`{"":"",`, ""), ""}, + }, + wantOffset: len(`{"":""`), +}, { + name: jsontest.Name("InvalidDelim/AfterBeginArray"), + in: `[,`, + calls: []decoderMethodCall{ + {'[', zeroValue, newInvalidCharacterError(",", "at start of value").withPos(`[`, "/0"), ""}, + {'[', BeginArray, nil, ""}, + {0, zeroToken, newInvalidCharacterError(",", "at start of value").withPos(`[`, ""), ""}, + {0, zeroValue, newInvalidCharacterError(",", "at start of value").withPos(`[`, ""), ""}, + }, + wantOffset: len(`[`), +}, { + name: jsontest.Name("InvalidDelim/AfterArrayValue"), + in: `["":`, + calls: []decoderMethodCall{ + {'[', zeroValue, newInvalidCharacterError(":", "after array element (expecting ',' or ']')").withPos(`[""`, ""), ""}, + {'[', BeginArray, nil, ""}, + {'"', String(""), nil, ""}, + {0, zeroToken, newInvalidCharacterError(":", "after array element (expecting ',' or ']')").withPos(`[""`, ""), ""}, + {0, zeroValue, newInvalidCharacterError(":", "after array element (expecting ',' or ']')").withPos(`[""`, ""), ""}, + }, + wantOffset: len(`[""`), +}, { + name: jsontest.Name("ValidDelim/AfterArrayValue"), + in: `["",`, + calls: []decoderMethodCall{ + {'[', zeroValue, E(io.ErrUnexpectedEOF).withPos(`["",`, ""), ""}, + {'[', BeginArray, nil, ""}, + {'"', String(""), nil, ""}, + {0, zeroToken, E(io.ErrUnexpectedEOF).withPos(`["",`, ""), ""}, + {0, zeroValue, E(io.ErrUnexpectedEOF).withPos(`["",`, ""), ""}, + }, + wantOffset: len(`[""`), +}, { + name: jsontest.Name("ErrorPosition"), + in: ` "a` + "\xff" + `0" `, + calls: []decoderMethodCall{ + {'"', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` "a`, ""), ""}, + {'"', zeroToken, E(jsonwire.ErrInvalidUTF8).withPos(` "a`, ""), ""}, + }, +}, { + name: jsontest.Name("ErrorPosition/0"), + in: ` [ "a` + "\xff" + `1" ] `, + calls: []decoderMethodCall{ + {'[', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ "a`, "/0"), ""}, + {'[', BeginArray, nil, ""}, + {'"', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ "a`, "/0"), ""}, + {'"', zeroToken, E(jsonwire.ErrInvalidUTF8).withPos(` [ "a`, "/0"), ""}, + }, + wantOffset: len(` [`), +}, { + name: jsontest.Name("ErrorPosition/1"), + in: ` [ "a1" , "b` + "\xff" + `1" ] `, + calls: []decoderMethodCall{ + {'[', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ "a1" , "b`, "/1"), ""}, + {'[', BeginArray, nil, ""}, + {'"', String("a1"), nil, ""}, + {'"', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ "a1" , "b`, "/1"), ""}, + {'"', zeroToken, E(jsonwire.ErrInvalidUTF8).withPos(` [ "a1" , "b`, "/1"), ""}, + }, + wantOffset: len(` [ "a1"`), +}, { + name: jsontest.Name("ErrorPosition/0/0"), + in: ` [ [ "a` + "\xff" + `2" ] ] `, + calls: []decoderMethodCall{ + {'[', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ [ "a`, "/0/0"), ""}, + {'[', BeginArray, nil, ""}, + {'[', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ [ "a`, "/0/0"), ""}, + {'[', BeginArray, nil, "/0"}, + {'"', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ [ "a`, "/0/0"), ""}, + {'"', zeroToken, E(jsonwire.ErrInvalidUTF8).withPos(` [ [ "a`, "/0/0"), ""}, + }, + wantOffset: len(` [ [`), +}, { + name: jsontest.Name("ErrorPosition/1/0"), + in: ` [ "a1" , [ "a` + "\xff" + `2" ] ] `, + calls: []decoderMethodCall{ + {'[', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ "a1" , [ "a`, "/1/0"), ""}, + {'[', BeginArray, nil, ""}, + {'"', String("a1"), nil, "/0"}, + {'[', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ "a1" , [ "a`, "/1/0"), "/0"}, + {'[', BeginArray, nil, "/1"}, + {'"', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ "a1" , [ "a`, "/1/0"), "/1"}, + {'"', zeroToken, E(jsonwire.ErrInvalidUTF8).withPos(` [ "a1" , [ "a`, "/1/0"), "/1"}, + }, + wantOffset: len(` [ "a1" , [`), +}, { + name: jsontest.Name("ErrorPosition/0/1"), + in: ` [ [ "a2" , "b` + "\xff" + `2" ] ] `, + calls: []decoderMethodCall{ + {'[', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ [ "a2" , "b`, "/0/1"), ""}, + {'[', BeginArray, nil, ""}, + {'[', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ [ "a2" , "b`, "/0/1"), ""}, + {'[', BeginArray, nil, "/0"}, + {'"', String("a2"), nil, "/0/0"}, + {'"', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ [ "a2" , "b`, "/0/1"), "/0/0"}, + {'"', zeroToken, E(jsonwire.ErrInvalidUTF8).withPos(` [ [ "a2" , "b`, "/0/1"), "/0/0"}, + }, + wantOffset: len(` [ [ "a2"`), +}, { + name: jsontest.Name("ErrorPosition/1/1"), + in: ` [ "a1" , [ "a2" , "b` + "\xff" + `2" ] ] `, + calls: []decoderMethodCall{ + {'[', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ "a1" , [ "a2" , "b`, "/1/1"), ""}, + {'[', BeginArray, nil, ""}, + {'"', String("a1"), nil, "/0"}, + {'[', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ "a1" , [ "a2" , "b`, "/1/1"), ""}, + {'[', BeginArray, nil, "/1"}, + {'"', String("a2"), nil, "/1/0"}, + {'"', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ "a1" , [ "a2" , "b`, "/1/1"), "/1/0"}, + {'"', zeroToken, E(jsonwire.ErrInvalidUTF8).withPos(` [ "a1" , [ "a2" , "b`, "/1/1"), "/1/0"}, + }, + wantOffset: len(` [ "a1" , [ "a2"`), +}, { + name: jsontest.Name("ErrorPosition/a1-"), + in: ` { "a` + "\xff" + `1" : "b1" } `, + calls: []decoderMethodCall{ + {'{', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a`, ""), ""}, + {'{', BeginObject, nil, ""}, + {'"', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a`, ""), ""}, + {'"', zeroToken, E(jsonwire.ErrInvalidUTF8).withPos(` { "a`, ""), ""}, + }, + wantOffset: len(` {`), +}, { + name: jsontest.Name("ErrorPosition/a1"), + in: ` { "a1" : "b` + "\xff" + `1" } `, + calls: []decoderMethodCall{ + {'{', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : "b`, "/a1"), ""}, + {'{', BeginObject, nil, ""}, + {'"', String("a1"), nil, "/a1"}, + {'"', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : "b`, "/a1"), ""}, + {'"', zeroToken, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : "b`, "/a1"), ""}, + }, + wantOffset: len(` { "a1"`), +}, { + name: jsontest.Name("ErrorPosition/c1-"), + in: ` { "a1" : "b1" , "c` + "\xff" + `1" : "d1" } `, + calls: []decoderMethodCall{ + {'{', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : "b1" , "c`, ""), ""}, + {'{', BeginObject, nil, ""}, + {'"', String("a1"), nil, "/a1"}, + {'"', String("b1"), nil, "/a1"}, + {'"', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : "b1" : "c`, ""), "/a1"}, + {'"', zeroToken, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : "b1" : "c`, ""), "/a1"}, + }, + wantOffset: len(` { "a1" : "b1"`), +}, { + name: jsontest.Name("ErrorPosition/c1"), + in: ` { "a1" : "b1" , "c1" : "d` + "\xff" + `1" } `, + calls: []decoderMethodCall{ + {'{', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : "b1" , "c1" : "d`, "/c1"), ""}, + {'{', BeginObject, nil, ""}, + {'"', String("a1"), nil, "/a1"}, + {'"', String("b1"), nil, "/a1"}, + {'"', String("c1"), nil, "/c1"}, + {'"', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : "b1" : "c1" : "d`, "/c1"), "/c1"}, + {'"', zeroToken, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : "b1" : "c1" : "d`, "/c1"), "/c1"}, + }, + wantOffset: len(` { "a1" : "b1" , "c1"`), +}, { + name: jsontest.Name("ErrorPosition/a1/a2-"), + in: ` { "a1" : { "a` + "\xff" + `2" : "b2" } } `, + calls: []decoderMethodCall{ + {'{', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : { "a`, "/a1"), ""}, + {'{', BeginObject, nil, ""}, + {'"', String("a1"), nil, "/a1"}, + {'{', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : { "a`, "/a1"), ""}, + {'{', BeginObject, nil, "/a1"}, + {'"', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : { "a`, "/a1"), "/a1"}, + {'"', zeroToken, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : { "a`, "/a1"), "/a1"}, + }, + wantOffset: len(` { "a1" : {`), +}, { + name: jsontest.Name("ErrorPosition/a1/a2"), + in: ` { "a1" : { "a2" : "b` + "\xff" + `2" } } `, + calls: []decoderMethodCall{ + {'{', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : { "a2" : "b`, "/a1/a2"), ""}, + {'{', BeginObject, nil, ""}, + {'"', String("a1"), nil, "/a1"}, + {'{', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : { "a2" : "b`, "/a1/a2"), ""}, + {'{', BeginObject, nil, "/a1"}, + {'"', String("a2"), nil, "/a1/a2"}, + {'"', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : { "a2" : "b`, "/a1/a2"), "/a1/a2"}, + {'"', zeroToken, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : { "a2" : "b`, "/a1/a2"), "/a1/a2"}, + }, + wantOffset: len(` { "a1" : { "a2"`), +}, { + name: jsontest.Name("ErrorPosition/a1/c2-"), + in: ` { "a1" : { "a2" : "b2" , "c` + "\xff" + `2" : "d2" } } `, + calls: []decoderMethodCall{ + {'{', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : { "a2" : "b2" , "c`, "/a1"), ""}, + {'{', BeginObject, nil, ""}, + {'"', String("a1"), nil, "/a1"}, + {'{', BeginObject, nil, "/a1"}, + {'"', String("a2"), nil, "/a1/a2"}, + {'"', String("b2"), nil, "/a1/a2"}, + {'"', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : { "a2" : "b2" , "c`, "/a1"), "/a1/a2"}, + {'"', zeroToken, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : { "a2" : "b2" , "c`, "/a1"), "/a1/a2"}, + }, + wantOffset: len(` { "a1" : { "a2" : "b2"`), +}, { + name: jsontest.Name("ErrorPosition/a1/c2"), + in: ` { "a1" : { "a2" : "b2" , "c2" : "d` + "\xff" + `2" } } `, + calls: []decoderMethodCall{ + {'{', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : { "a2" : "b2" , "c2" : "d`, "/a1/c2"), ""}, + {'{', BeginObject, nil, ""}, + {'"', String("a1"), nil, "/a1"}, + {'{', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : { "a2" : "b2" , "c2" : "d`, "/a1/c2"), ""}, + {'{', BeginObject, nil, ""}, + {'"', String("a2"), nil, "/a1/a2"}, + {'"', String("b2"), nil, "/a1/a2"}, + {'"', String("c2"), nil, "/a1/c2"}, + {'"', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : { "a2" : "b2" , "c2" : "d`, "/a1/c2"), "/a1/c2"}, + {'"', zeroToken, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : { "a2" : "b2" , "c2" : "d`, "/a1/c2"), "/a1/c2"}, + }, + wantOffset: len(` { "a1" : { "a2" : "b2" , "c2"`), +}, { + name: jsontest.Name("ErrorPosition/1/a2"), + in: ` [ "a1" , { "a2" : "b` + "\xff" + `2" } ] `, + calls: []decoderMethodCall{ + {'[', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ "a1" , { "a2" : "b`, "/1/a2"), ""}, + {'[', BeginArray, nil, ""}, + {'"', String("a1"), nil, "/0"}, + {'{', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ "a1" , { "a2" : "b`, "/1/a2"), ""}, + {'{', BeginObject, nil, "/1"}, + {'"', String("a2"), nil, "/1/a2"}, + {'"', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ "a1" , { "a2" : "b`, "/1/a2"), "/1/a2"}, + {'"', zeroToken, E(jsonwire.ErrInvalidUTF8).withPos(` [ "a1" , { "a2" : "b`, "/1/a2"), "/1/a2"}, + }, + wantOffset: len(` [ "a1" , { "a2"`), +}, { + name: jsontest.Name("ErrorPosition/c1/1"), + in: ` { "a1" : "b1" , "c1" : [ "a2" , "b` + "\xff" + `2" ] } `, + calls: []decoderMethodCall{ + {'{', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : "b1" , "c1" : [ "a2" , "b`, "/c1/1"), ""}, + {'{', BeginObject, nil, ""}, + {'"', String("a1"), nil, "/a1"}, + {'"', String("b1"), nil, "/a1"}, + {'"', String("c1"), nil, "/c1"}, + {'[', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : "b1" , "c1" : [ "a2" , "b`, "/c1/1"), ""}, + {'[', BeginArray, nil, "/c1"}, + {'"', String("a2"), nil, "/c1/0"}, + {'"', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : "b1" , "c1" : [ "a2" , "b`, "/c1/1"), "/c1/0"}, + {'"', zeroToken, E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : "b1" , "c1" : [ "a2" , "b`, "/c1/1"), "/c1/0"}, + }, + wantOffset: len(` { "a1" : "b1" , "c1" : [ "a2"`), +}, { + name: jsontest.Name("ErrorPosition/0/a1/1/c3/1"), + in: ` [ { "a1" : [ "a2" , { "a3" : "b3" , "c3" : [ "a4" , "b` + "\xff" + `4" ] } ] } ] `, + calls: []decoderMethodCall{ + {'[', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ { "a1" : [ "a2" , { "a3" : "b3" , "c3" : [ "a4" , "b`, "/0/a1/1/c3/1"), ""}, + {'[', BeginArray, nil, ""}, + {'{', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ { "a1" : [ "a2" , { "a3" : "b3" , "c3" : [ "a4" , "b`, "/0/a1/1/c3/1"), ""}, + {'{', BeginObject, nil, "/0"}, + {'"', String("a1"), nil, "/0/a1"}, + {'[', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ { "a1" : [ "a2" , { "a3" : "b3" , "c3" : [ "a4" , "b`, "/0/a1/1/c3/1"), ""}, + {'[', BeginArray, nil, ""}, + {'"', String("a2"), nil, "/0/a1/0"}, + {'{', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ { "a1" : [ "a2" , { "a3" : "b3" , "c3" : [ "a4" , "b`, "/0/a1/1/c3/1"), ""}, + {'{', BeginObject, nil, "/0/a1/1"}, + {'"', String("a3"), nil, "/0/a1/1/a3"}, + {'"', String("b3"), nil, "/0/a1/1/a3"}, + {'"', String("c3"), nil, "/0/a1/1/c3"}, + {'[', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ { "a1" : [ "a2" , { "a3" : "b3" , "c3" : [ "a4" , "b`, "/0/a1/1/c3/1"), ""}, + {'[', BeginArray, nil, "/0/a1/1/c3"}, + {'"', String("a4"), nil, "/0/a1/1/c3/0"}, + {'"', zeroValue, E(jsonwire.ErrInvalidUTF8).withPos(` [ { "a1" : [ "a2" , { "a3" : "b3" , "c3" : [ "a4" , "b`, "/0/a1/1/c3/1"), "/0/a1/1/c3/0"}, + {'"', zeroToken, E(jsonwire.ErrInvalidUTF8).withPos(` [ { "a1" : [ "a2" , { "a3" : "b3" , "c3" : [ "a4" , "b`, "/0/a1/1/c3/1"), "/0/a1/1/c3/0"}, + }, + wantOffset: len(` [ { "a1" : [ "a2" , { "a3" : "b3" , "c3" : [ "a4"`), +}} + +// TestDecoderErrors test that Decoder errors occur when we expect and +// leaves the Decoder in a consistent state. +func TestDecoderErrors(t *testing.T) { + for _, td := range decoderErrorTestdata { + t.Run(path.Join(td.name.Name), func(t *testing.T) { + testDecoderErrors(t, td.name.Where, td.opts, td.in, td.calls, td.wantOffset) + }) + } +} +func testDecoderErrors(t *testing.T, where jsontest.CasePos, opts []Options, in string, calls []decoderMethodCall, wantOffset int) { + src := bytes.NewBufferString(in) + dec := NewDecoder(src, opts...) + for i, call := range calls { + gotKind := dec.PeekKind() + if gotKind != call.wantKind { + t.Fatalf("%s: %d: Decoder.PeekKind = %v, want %v", where, i, gotKind, call.wantKind) + } + + var gotErr error + switch wantOut := call.wantOut.(type) { + case Token: + var gotOut Token + gotOut, gotErr = dec.ReadToken() + if gotOut.String() != wantOut.String() { + t.Fatalf("%s: %d: Decoder.ReadToken = %v, want %v", where, i, gotOut, wantOut) + } + case Value: + var gotOut Value + gotOut, gotErr = dec.ReadValue() + if string(gotOut) != string(wantOut) { + t.Fatalf("%s: %d: Decoder.ReadValue = %s, want %s", where, i, gotOut, wantOut) + } + } + if !equalError(gotErr, call.wantErr) { + t.Fatalf("%s: %d: error mismatch:\ngot %v\nwant %v", where, i, gotErr, call.wantErr) + } + if call.wantPointer != "" { + gotPointer := dec.StackPointer() + if gotPointer != call.wantPointer { + t.Fatalf("%s: %d: Decoder.StackPointer = %s, want %s", where, i, gotPointer, call.wantPointer) + } + } + } + gotOffset := int(dec.InputOffset()) + if gotOffset != wantOffset { + t.Fatalf("%s: Decoder.InputOffset = %v, want %v", where, gotOffset, wantOffset) + } + gotUnread := string(dec.s.unreadBuffer()) // should be a prefix of wantUnread + wantUnread := in[wantOffset:] + if !strings.HasPrefix(wantUnread, gotUnread) { + t.Fatalf("%s: Decoder.UnreadBuffer = %v, want %v", where, gotUnread, wantUnread) + } +} + +// TestBufferDecoder tests that we detect misuses of bytes.Buffer with Decoder. +func TestBufferDecoder(t *testing.T) { + bb := bytes.NewBufferString("[null, false, true]") + dec := NewDecoder(bb) + var err error + for { + if _, err = dec.ReadToken(); err != nil { + break + } + bb.WriteByte(' ') // not allowed to write to the buffer while reading + } + want := &ioError{action: "read", err: errBufferWriteAfterNext} + if !equalError(err, want) { + t.Fatalf("error mismatch: got %v, want %v", err, want) + } +} + +var resumableDecoderTestdata = []string{ + `0`, + `123456789`, + `0.0`, + `0.123456789`, + `0e0`, + `0e+0`, + `0e123456789`, + `0e+123456789`, + `123456789.123456789e+123456789`, + `-0`, + `-123456789`, + `-0.0`, + `-0.123456789`, + `-0e0`, + `-0e-0`, + `-0e123456789`, + `-0e-123456789`, + `-123456789.123456789e-123456789`, + + `""`, + `"a"`, + `"ab"`, + `"abc"`, + `"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"`, + `"\"\\\/\b\f\n\r\t"`, + `"\u0022\u005c\u002f\u0008\u000c\u000a\u000d\u0009"`, + `"\ud800\udead"`, + "\"\u0080\u00f6\u20ac\ud799\ue000\ufb33\ufffd\U0001f602\"", + `"\u0080\u00f6\u20ac\ud799\ue000\ufb33\ufffd\ud83d\ude02"`, +} + +// TestResumableDecoder tests that resume logic for parsing a +// JSON string and number properly works across every possible split point. +func TestResumableDecoder(t *testing.T) { + for _, want := range resumableDecoderTestdata { + t.Run("", func(t *testing.T) { + dec := NewDecoder(iotest.OneByteReader(strings.NewReader(want))) + got, err := dec.ReadValue() + if err != nil { + t.Fatalf("Decoder.ReadValue error: %v", err) + } + if string(got) != want { + t.Fatalf("Decoder.ReadValue = %s, want %s", got, want) + } + }) + } +} + +// TestBlockingDecoder verifies that JSON values except numbers can be +// synchronously sent and received on a blocking pipe without a deadlock. +// Numbers are the exception since termination cannot be determined until +// either the pipe ends or a non-numeric character is encountered. +func TestBlockingDecoder(t *testing.T) { + values := []string{"null", "false", "true", `""`, `{}`, `[]`} + + r, w := net.Pipe() + defer r.Close() + defer w.Close() + + enc := NewEncoder(w, jsonflags.OmitTopLevelNewline|1) + dec := NewDecoder(r) + + errCh := make(chan error) + + // Test synchronous ReadToken calls. + for _, want := range values { + go func() { + errCh <- enc.WriteValue(Value(want)) + }() + + tok, err := dec.ReadToken() + if err != nil { + t.Fatalf("Decoder.ReadToken error: %v", err) + } + got := tok.String() + switch tok.Kind() { + case '"': + got = `"` + got + `"` + case '{', '[': + tok, err := dec.ReadToken() + if err != nil { + t.Fatalf("Decoder.ReadToken error: %v", err) + } + got += tok.String() + } + if got != want { + t.Fatalf("ReadTokens = %s, want %s", got, want) + } + + if err := <-errCh; err != nil { + t.Fatalf("Encoder.WriteValue error: %v", err) + } + } + + // Test synchronous ReadValue calls. + for _, want := range values { + go func() { + errCh <- enc.WriteValue(Value(want)) + }() + + got, err := dec.ReadValue() + if err != nil { + t.Fatalf("Decoder.ReadValue error: %v", err) + } + if string(got) != want { + t.Fatalf("ReadValue = %s, want %s", got, want) + } + + if err := <-errCh; err != nil { + t.Fatalf("Encoder.WriteValue error: %v", err) + } + } +} + +func TestPeekableDecoder(t *testing.T) { + type operation any // PeekKind | ReadToken | ReadValue | BufferWrite + type PeekKind struct { + want Kind + } + type ReadToken struct { + wantKind Kind + wantErr error + } + type ReadValue struct { + wantKind Kind + wantErr error + } + type WriteString struct { + in string + } + ops := []operation{ + PeekKind{0}, + WriteString{"[ "}, + ReadToken{0, io.EOF}, // previous error from PeekKind is cached once + ReadToken{'[', nil}, + + PeekKind{0}, + WriteString{"] "}, + ReadValue{0, E(io.ErrUnexpectedEOF).withPos("[ ", "")}, // previous error from PeekKind is cached once + ReadValue{0, newInvalidCharacterError("]", "at start of value").withPos("[ ", "/0")}, + ReadToken{']', nil}, + + WriteString{"[ "}, + ReadToken{'[', nil}, + + WriteString{" null "}, + PeekKind{'n'}, + PeekKind{'n'}, + ReadToken{'n', nil}, + + WriteString{", "}, + PeekKind{0}, + WriteString{"fal"}, + PeekKind{'f'}, + ReadValue{0, E(io.ErrUnexpectedEOF).withPos("[ ] [ null , fal", "/1")}, + WriteString{"se "}, + ReadValue{'f', nil}, + + PeekKind{0}, + WriteString{" , "}, + PeekKind{0}, + WriteString{` "" `}, + ReadValue{0, E(io.ErrUnexpectedEOF).withPos("[ ] [ null , false , ", "")}, // previous error from PeekKind is cached once + ReadValue{'"', nil}, + + WriteString{" , 0"}, + PeekKind{'0'}, + ReadToken{'0', nil}, + + WriteString{" , {} , []"}, + PeekKind{'{'}, + ReadValue{'{', nil}, + ReadValue{'[', nil}, + + WriteString{"]"}, + ReadToken{']', nil}, + } + + bb := struct{ *bytes.Buffer }{new(bytes.Buffer)} + d := NewDecoder(bb) + for i, op := range ops { + switch op := op.(type) { + case PeekKind: + if got := d.PeekKind(); got != op.want { + t.Fatalf("%d: Decoder.PeekKind() = %v, want %v", i, got, op.want) + } + case ReadToken: + gotTok, gotErr := d.ReadToken() + gotKind := gotTok.Kind() + if gotKind != op.wantKind || !equalError(gotErr, op.wantErr) { + t.Fatalf("%d: Decoder.ReadToken() = (%v, %v), want (%v, %v)", i, gotKind, gotErr, op.wantKind, op.wantErr) + } + case ReadValue: + gotVal, gotErr := d.ReadValue() + gotKind := gotVal.Kind() + if gotKind != op.wantKind || !equalError(gotErr, op.wantErr) { + t.Fatalf("%d: Decoder.ReadValue() = (%v, %v), want (%v, %v)", i, gotKind, gotErr, op.wantKind, op.wantErr) + } + case WriteString: + bb.WriteString(op.in) + default: + panic(fmt.Sprintf("unknown operation: %T", op)) + } + } +} + +// TestDecoderReset tests that the decoder preserves its internal +// buffer between Reset calls to avoid frequent allocations when reusing the decoder. +// It ensures that the buffer capacity is maintained while avoiding aliasing +// issues with [bytes.Buffer]. +func TestDecoderReset(t *testing.T) { + // Create a decoder with a reasonably large JSON input to ensure buffer growth. + largeJSON := `{"key1":"value1","key2":"value2","key3":"value3","key4":"value4","key5":"value5"}` + dec := NewDecoder(strings.NewReader(largeJSON)) + + t.Run("Test capacity preservation", func(t *testing.T) { + // Read the first JSON value to grow the internal buffer. + val1, err := dec.ReadValue() + if err != nil { + t.Fatalf("first ReadValue failed: %v", err) + } + if string(val1) != largeJSON { + t.Fatalf("first ReadValue = %q, want %q", val1, largeJSON) + } + + // Get the buffer capacity after first use. + initialCapacity := cap(dec.s.buf) + if initialCapacity == 0 { + t.Fatalf("expected non-zero buffer capacity after first use") + } + + // Reset with a new reader - this should preserve the buffer capacity. + dec.Reset(strings.NewReader(largeJSON)) + + // Verify the buffer capacity is preserved (or at least not smaller). + preservedCapacity := cap(dec.s.buf) + if preservedCapacity < initialCapacity { + t.Fatalf("buffer capacity reduced after Reset: got %d, want at least %d", preservedCapacity, initialCapacity) + } + + // Read the second JSON value to ensure the decoder still works correctly. + val2, err := dec.ReadValue() + if err != nil { + t.Fatalf("second ReadValue failed: %v", err) + } + if string(val2) != largeJSON { + t.Fatalf("second ReadValue = %q, want %q", val2, largeJSON) + } + }) + + var bbBuf []byte + t.Run("Test aliasing with bytes.Buffer", func(t *testing.T) { + // Test with bytes.Buffer to verify proper aliasing behavior. + bb := bytes.NewBufferString(largeJSON) + dec.Reset(bb) + bbBuf = bb.Bytes() + + // Read the third JSON value to ensure functionality with bytes.Buffer. + val3, err := dec.ReadValue() + if err != nil { + t.Fatalf("fourth ReadValue failed: %v", err) + } + if string(val3) != largeJSON { + t.Fatalf("fourth ReadValue = %q, want %q", val3, largeJSON) + } + // The decoder buffer should alias bytes.Buffer's internal buffer. + if len(dec.s.buf) == 0 || len(bbBuf) == 0 || &dec.s.buf[0] != &bbBuf[0] { + t.Fatalf("decoder buffer does not alias bytes.Buffer") + } + }) + + t.Run("Test aliasing removed after Reset", func(t *testing.T) { + // Reset with a new reader and verify the buffer is not aliased. + dec.Reset(strings.NewReader(largeJSON)) + val4, err := dec.ReadValue() + if err != nil { + t.Fatalf("fifth ReadValue failed: %v", err) + } + if string(val4) != largeJSON { + t.Fatalf("fourth ReadValue = %q, want %q", val4, largeJSON) + } + + // The decoder buffer should not alias the bytes.Buffer's internal buffer. + if len(dec.s.buf) == 0 || len(bbBuf) == 0 || &dec.s.buf[0] == &bbBuf[0] { + t.Fatalf("decoder buffer aliases bytes.Buffer") + } + }) +} diff --git a/go/src/encoding/json/jsontext/doc.go b/go/src/encoding/json/jsontext/doc.go new file mode 100644 index 0000000000000000000000000000000000000000..d8906926863a86de7b1a7d4944bfea4f605e0491 --- /dev/null +++ b/go/src/encoding/json/jsontext/doc.go @@ -0,0 +1,116 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +// Package jsontext implements syntactic processing of JSON +// as specified in RFC 4627, RFC 7159, RFC 7493, RFC 8259, and RFC 8785. +// JSON is a simple data interchange format that can represent +// primitive data types such as booleans, strings, and numbers, +// in addition to structured data types such as objects and arrays. +// +// This package (encoding/json/jsontext) is experimental, +// and not subject to the Go 1 compatibility promise. +// It only exists when building with the GOEXPERIMENT=jsonv2 environment variable set. +// Most users should use [encoding/json]. +// +// The [Encoder] and [Decoder] types are used to encode or decode +// a stream of JSON tokens or values. +// +// # Tokens and Values +// +// A JSON token refers to the basic structural elements of JSON: +// +// - a JSON literal (i.e., null, true, or false) +// - a JSON string (e.g., "hello, world!") +// - a JSON number (e.g., 123.456) +// - a begin or end delimiter for a JSON object (i.e., '{' or '}') +// - a begin or end delimiter for a JSON array (i.e., '[' or ']') +// +// A JSON token is represented by the [Token] type in Go. Technically, +// there are two additional structural characters (i.e., ':' and ','), +// but there is no [Token] representation for them since their presence +// can be inferred by the structure of the JSON grammar itself. +// For example, there must always be an implicit colon between +// the name and value of a JSON object member. +// +// A JSON value refers to a complete unit of JSON data: +// +// - a JSON literal, string, or number +// - a JSON object (e.g., `{"name":"value"}`) +// - a JSON array (e.g., `[1,2,3,]`) +// +// A JSON value is represented by the [Value] type in Go and is a []byte +// containing the raw textual representation of the value. There is some overlap +// between tokens and values as both contain literals, strings, and numbers. +// However, only a value can represent the entirety of a JSON object or array. +// +// The [Encoder] and [Decoder] types contain methods to read or write the next +// [Token] or [Value] in a sequence. They maintain a state machine to validate +// whether the sequence of JSON tokens and/or values produces a valid JSON. +// [Options] may be passed to the [NewEncoder] or [NewDecoder] constructors +// to configure the syntactic behavior of encoding and decoding. +// +// # Terminology +// +// The terms "encode" and "decode" are used for syntactic functionality +// that is concerned with processing JSON based on its grammar, and +// the terms "marshal" and "unmarshal" are used for semantic functionality +// that determines the meaning of JSON values as Go values and vice-versa. +// This package (i.e., [jsontext]) deals with JSON at a syntactic layer, +// while [encoding/json/v2] deals with JSON at a semantic layer. +// The goal is to provide a clear distinction between functionality that +// is purely concerned with encoding versus that of marshaling. +// For example, one can directly encode a stream of JSON tokens without +// needing to marshal a concrete Go value representing them. +// Similarly, one can decode a stream of JSON tokens without +// needing to unmarshal them into a concrete Go value. +// +// This package uses JSON terminology when discussing JSON, which may differ +// from related concepts in Go or elsewhere in computing literature. +// +// - a JSON "object" refers to an unordered collection of name/value members. +// - a JSON "array" refers to an ordered sequence of elements. +// - a JSON "value" refers to either a literal (i.e., null, false, or true), +// string, number, object, or array. +// +// See RFC 8259 for more information. +// +// # Specifications +// +// Relevant specifications include RFC 4627, RFC 7159, RFC 7493, RFC 8259, +// and RFC 8785. Each RFC is generally a stricter subset of another RFC. +// In increasing order of strictness: +// +// - RFC 4627 and RFC 7159 do not require (but recommend) the use of UTF-8 +// and also do not require (but recommend) that object names be unique. +// - RFC 8259 requires the use of UTF-8, +// but does not require (but recommends) that object names be unique. +// - RFC 7493 requires the use of UTF-8 +// and also requires that object names be unique. +// - RFC 8785 defines a canonical representation. It requires the use of UTF-8 +// and also requires that object names be unique and in a specific ordering. +// It specifies exactly how strings and numbers must be formatted. +// +// The primary difference between RFC 4627 and RFC 7159 is that the former +// restricted top-level values to only JSON objects and arrays, while +// RFC 7159 and subsequent RFCs permit top-level values to additionally be +// JSON nulls, booleans, strings, or numbers. +// +// By default, this package operates on RFC 7493, but can be configured +// to operate according to the other RFC specifications. +// RFC 7493 is a stricter subset of RFC 8259 and fully compliant with it. +// In particular, it makes specific choices about behavior that RFC 8259 +// leaves as undefined in order to ensure greater interoperability. +// +// # Security Considerations +// +// See the "Security Considerations" section in [encoding/json/v2]. +package jsontext + +// requireKeyedLiterals can be embedded in a struct to require keyed literals. +type requireKeyedLiterals struct{} + +// nonComparable can be embedded in a struct to prevent comparability. +type nonComparable [0]func() diff --git a/go/src/encoding/json/jsontext/encode.go b/go/src/encoding/json/jsontext/encode.go new file mode 100644 index 0000000000000000000000000000000000000000..20f020700b810c9715db46147bdc67e8f1208b9b --- /dev/null +++ b/go/src/encoding/json/jsontext/encode.go @@ -0,0 +1,977 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsontext + +import ( + "bytes" + "io" + "math/bits" + + "encoding/json/internal/jsonflags" + "encoding/json/internal/jsonopts" + "encoding/json/internal/jsonwire" +) + +// Encoder is a streaming encoder from raw JSON tokens and values. +// It is used to write a stream of top-level JSON values, +// each terminated with a newline character. +// +// [Encoder.WriteToken] and [Encoder.WriteValue] calls may be interleaved. +// For example, the following JSON value: +// +// {"name":"value","array":[null,false,true,3.14159],"object":{"k":"v"}} +// +// can be composed with the following calls (ignoring errors for brevity): +// +// e.WriteToken(BeginObject) // { +// e.WriteToken(String("name")) // "name" +// e.WriteToken(String("value")) // "value" +// e.WriteValue(Value(`"array"`)) // "array" +// e.WriteToken(BeginArray) // [ +// e.WriteToken(Null) // null +// e.WriteToken(False) // false +// e.WriteValue(Value("true")) // true +// e.WriteToken(Float(3.14159)) // 3.14159 +// e.WriteToken(EndArray) // ] +// e.WriteValue(Value(`"object"`)) // "object" +// e.WriteValue(Value(`{"k":"v"}`)) // {"k":"v"} +// e.WriteToken(EndObject) // } +// +// The above is one of many possible sequence of calls and +// may not represent the most sensible method to call for any given token/value. +// For example, it is probably more common to call [Encoder.WriteToken] with a string +// for object names. +type Encoder struct { + s encoderState +} + +// encoderState is the low-level state of Encoder. +// It has exported fields and method for use by the "json" package. +type encoderState struct { + state + encodeBuffer + jsonopts.Struct + + SeenPointers map[any]struct{} // only used when marshaling; identical to json.seenPointers +} + +// encodeBuffer is a buffer split into 2 segments: +// +// - buf[0:len(buf)] // written (but unflushed) portion of the buffer +// - buf[len(buf):cap(buf)] // unused portion of the buffer +type encodeBuffer struct { + Buf []byte // may alias wr if it is a bytes.Buffer + + // baseOffset is added to len(buf) to obtain the absolute offset + // relative to the start of io.Writer stream. + baseOffset int64 + + wr io.Writer + + // maxValue is the approximate maximum Value size passed to WriteValue. + maxValue int + // availBuffer is the buffer returned by the AvailableBuffer method. + availBuffer []byte // always has zero length + // bufStats is statistics about buffer utilization. + // It is only used with pooled encoders in pools.go. + bufStats bufferStatistics +} + +// NewEncoder constructs a new streaming encoder writing to w +// configured with the provided options. +// It flushes the internal buffer when the buffer is sufficiently full or +// when a top-level value has been written. +// +// If w is a [bytes.Buffer], then the encoder appends directly into the buffer +// without copying the contents from an intermediate buffer. +func NewEncoder(w io.Writer, opts ...Options) *Encoder { + e := new(Encoder) + e.Reset(w, opts...) + return e +} + +// Reset resets an encoder such that it is writing afresh to w and +// configured with the provided options. Reset must not be called on +// a Encoder passed to the [encoding/json/v2.MarshalerTo.MarshalJSONTo] method +// or the [encoding/json/v2.MarshalToFunc] function. +func (e *Encoder) Reset(w io.Writer, opts ...Options) { + switch { + case e == nil: + panic("jsontext: invalid nil Encoder") + case w == nil: + panic("jsontext: invalid nil io.Writer") + case e.s.Flags.Get(jsonflags.WithinArshalCall): + panic("jsontext: cannot reset Encoder passed to json.MarshalerTo") + } + // Reuse the buffer if it does not alias a previous [bytes.Buffer]. + b := e.s.Buf[:0] + if _, ok := e.s.wr.(*bytes.Buffer); ok { + b = nil + } + e.s.reset(b, w, opts...) +} + +func (e *encoderState) reset(b []byte, w io.Writer, opts ...Options) { + e.state.reset() + e.encodeBuffer = encodeBuffer{Buf: b, wr: w, availBuffer: e.availBuffer, bufStats: e.bufStats} + if bb, ok := w.(*bytes.Buffer); ok && bb != nil { + e.Buf = bb.AvailableBuffer() // alias the unused buffer of bb + } + opts2 := jsonopts.Struct{} // avoid mutating e.Struct in case it is part of opts + opts2.Join(opts...) + e.Struct = opts2 + if e.Flags.Get(jsonflags.Multiline) { + if !e.Flags.Has(jsonflags.SpaceAfterColon) { + e.Flags.Set(jsonflags.SpaceAfterColon | 1) + } + if !e.Flags.Has(jsonflags.SpaceAfterComma) { + e.Flags.Set(jsonflags.SpaceAfterComma | 0) + } + if !e.Flags.Has(jsonflags.Indent) { + e.Flags.Set(jsonflags.Indent | 1) + e.Indent = "\t" + } + } +} + +// Options returns the options used to construct the decoder and +// may additionally contain semantic options passed to a +// [encoding/json/v2.MarshalEncode] call. +// +// If operating within +// a [encoding/json/v2.MarshalerTo.MarshalJSONTo] method call or +// a [encoding/json/v2.MarshalToFunc] function call, +// then the returned options are only valid within the call. +func (e *Encoder) Options() Options { + return &e.s.Struct +} + +// NeedFlush determines whether to flush at this point. +func (e *encoderState) NeedFlush() bool { + // NOTE: This function is carefully written to be inlinable. + + // Avoid flushing if e.wr is nil since there is no underlying writer. + // Flush if less than 25% of the capacity remains. + // Flushing at some constant fraction ensures that the buffer stops growing + // so long as the largest Token or Value fits within that unused capacity. + return e.wr != nil && (e.Tokens.Depth() == 1 || len(e.Buf) > 3*cap(e.Buf)/4) +} + +// Flush flushes the buffer to the underlying io.Writer. +// It may append a trailing newline after the top-level value. +func (e *encoderState) Flush() error { + if e.wr == nil || e.avoidFlush() { + return nil + } + + // In streaming mode, always emit a newline after the top-level value. + if e.Tokens.Depth() == 1 && !e.Flags.Get(jsonflags.OmitTopLevelNewline) { + e.Buf = append(e.Buf, '\n') + } + + // Inform objectNameStack that we are about to flush the buffer content. + e.Names.copyQuotedBuffer(e.Buf) + + // Specialize bytes.Buffer for better performance. + if bb, ok := e.wr.(*bytes.Buffer); ok { + // If e.buf already aliases the internal buffer of bb, + // then the Write call simply increments the internal offset, + // otherwise Write operates as expected. + // See https://go.dev/issue/42986. + n, _ := bb.Write(e.Buf) // never fails unless bb is nil + e.baseOffset += int64(n) + + // If the internal buffer of bytes.Buffer is too small, + // append operations elsewhere in the Encoder may grow the buffer. + // This would be semantically correct, but hurts performance. + // As such, ensure 25% of the current length is always available + // to reduce the probability that other appends must allocate. + if avail := bb.Available(); avail < bb.Len()/4 { + bb.Grow(avail + 1) + } + + e.Buf = bb.AvailableBuffer() + return nil + } + + // Flush the internal buffer to the underlying io.Writer. + n, err := e.wr.Write(e.Buf) + e.baseOffset += int64(n) + if err != nil { + // In the event of an error, preserve the unflushed portion. + // Thus, write errors aren't fatal so long as the io.Writer + // maintains consistent state after errors. + if n > 0 { + e.Buf = e.Buf[:copy(e.Buf, e.Buf[n:])] + } + return &ioError{action: "write", err: err} + } + e.Buf = e.Buf[:0] + + // Check whether to grow the buffer. + // Note that cap(e.buf) may already exceed maxBufferSize since + // an append elsewhere already grew it to store a large token. + const maxBufferSize = 4 << 10 + const growthSizeFactor = 2 // higher value is faster + const growthRateFactor = 2 // higher value is slower + // By default, grow if below the maximum buffer size. + grow := cap(e.Buf) <= maxBufferSize/growthSizeFactor + // Growing can be expensive, so only grow + // if a sufficient number of bytes have been processed. + grow = grow && int64(cap(e.Buf)) < e.previousOffsetEnd()/growthRateFactor + if grow { + e.Buf = make([]byte, 0, cap(e.Buf)*growthSizeFactor) + } + + return nil +} +func (d *encodeBuffer) offsetAt(pos int) int64 { return d.baseOffset + int64(pos) } +func (e *encodeBuffer) previousOffsetEnd() int64 { return e.baseOffset + int64(len(e.Buf)) } +func (e *encodeBuffer) unflushedBuffer() []byte { return e.Buf } + +// avoidFlush indicates whether to avoid flushing to ensure there is always +// enough in the buffer to unwrite the last object member if it were empty. +func (e *encoderState) avoidFlush() bool { + switch { + case e.Tokens.Last.Length() == 0: + // Never flush after BeginObject or BeginArray since we don't know yet + // if the object or array will end up being empty. + return true + case e.Tokens.Last.needObjectValue(): + // Never flush before the object value since we don't know yet + // if the object value will end up being empty. + return true + case e.Tokens.Last.NeedObjectName() && len(e.Buf) >= 2: + // Never flush after the object value if it does turn out to be empty. + switch string(e.Buf[len(e.Buf)-2:]) { + case `ll`, `""`, `{}`, `[]`: // last two bytes of every empty value + return true + } + } + return false +} + +// UnwriteEmptyObjectMember unwrites the last object member if it is empty +// and reports whether it performed an unwrite operation. +func (e *encoderState) UnwriteEmptyObjectMember(prevName *string) bool { + if last := e.Tokens.Last; !last.isObject() || !last.NeedObjectName() || last.Length() == 0 { + panic("BUG: must be called on an object after writing a value") + } + + // The flushing logic is modified to never flush a trailing empty value. + // The encoder never writes trailing whitespace eagerly. + b := e.unflushedBuffer() + + // Detect whether the last value was empty. + var n int + if len(b) >= 3 { + switch string(b[len(b)-2:]) { + case "ll": // last two bytes of `null` + n = len(`null`) + case `""`: + // It is possible for a non-empty string to have `""` as a suffix + // if the second to the last quote was escaped. + if b[len(b)-3] == '\\' { + return false // e.g., `"\""` is not empty + } + n = len(`""`) + case `{}`: + n = len(`{}`) + case `[]`: + n = len(`[]`) + } + } + if n == 0 { + return false + } + + // Unwrite the value, whitespace, colon, name, whitespace, and comma. + b = b[:len(b)-n] + b = jsonwire.TrimSuffixWhitespace(b) + b = jsonwire.TrimSuffixByte(b, ':') + b = jsonwire.TrimSuffixString(b) + b = jsonwire.TrimSuffixWhitespace(b) + b = jsonwire.TrimSuffixByte(b, ',') + e.Buf = b // store back truncated unflushed buffer + + // Undo state changes. + e.Tokens.Last.decrement() // for object member value + e.Tokens.Last.decrement() // for object member name + if !e.Flags.Get(jsonflags.AllowDuplicateNames) { + if e.Tokens.Last.isActiveNamespace() { + e.Namespaces.Last().removeLast() + } + } + e.Names.clearLast() + if prevName != nil { + e.Names.copyQuotedBuffer(e.Buf) // required by objectNameStack.replaceLastUnquotedName + e.Names.replaceLastUnquotedName(*prevName) + } + return true +} + +// UnwriteOnlyObjectMemberName unwrites the only object member name +// and returns the unquoted name. +func (e *encoderState) UnwriteOnlyObjectMemberName() string { + if last := e.Tokens.Last; !last.isObject() || last.Length() != 1 { + panic("BUG: must be called on an object after writing first name") + } + + // Unwrite the name and whitespace. + b := jsonwire.TrimSuffixString(e.Buf) + isVerbatim := bytes.IndexByte(e.Buf[len(b):], '\\') < 0 + name := string(jsonwire.UnquoteMayCopy(e.Buf[len(b):], isVerbatim)) + e.Buf = jsonwire.TrimSuffixWhitespace(b) + + // Undo state changes. + e.Tokens.Last.decrement() + if !e.Flags.Get(jsonflags.AllowDuplicateNames) { + if e.Tokens.Last.isActiveNamespace() { + e.Namespaces.Last().removeLast() + } + } + e.Names.clearLast() + return name +} + +// WriteToken writes the next token and advances the internal write offset. +// +// The provided token kind must be consistent with the JSON grammar. +// For example, it is an error to provide a number when the encoder +// is expecting an object name (which is always a string), or +// to provide an end object delimiter when the encoder is finishing an array. +// If the provided token is invalid, then it reports a [SyntacticError] and +// the internal state remains unchanged. The offset reported +// in [SyntacticError] will be relative to the [Encoder.OutputOffset]. +func (e *Encoder) WriteToken(t Token) error { + return e.s.WriteToken(t) +} +func (e *encoderState) WriteToken(t Token) error { + k := t.Kind() + b := e.Buf // use local variable to avoid mutating e in case of error + + // Append any delimiters or optional whitespace. + b = e.Tokens.MayAppendDelim(b, k) + if e.Flags.Get(jsonflags.AnyWhitespace) { + b = e.appendWhitespace(b, k) + } + pos := len(b) // offset before the token + + // Append the token to the output and to the state machine. + var err error + switch k { + case 'n': + b = append(b, "null"...) + err = e.Tokens.appendLiteral() + case 'f': + b = append(b, "false"...) + err = e.Tokens.appendLiteral() + case 't': + b = append(b, "true"...) + err = e.Tokens.appendLiteral() + case '"': + if b, err = t.appendString(b, &e.Flags); err != nil { + break + } + if e.Tokens.Last.NeedObjectName() { + if !e.Flags.Get(jsonflags.AllowDuplicateNames) { + if !e.Tokens.Last.isValidNamespace() { + err = errInvalidNamespace + break + } + if e.Tokens.Last.isActiveNamespace() && !e.Namespaces.Last().insertQuoted(b[pos:], false) { + err = wrapWithObjectName(ErrDuplicateName, b[pos:]) + break + } + } + e.Names.ReplaceLastQuotedOffset(pos) // only replace if insertQuoted succeeds + } + err = e.Tokens.appendString() + case '0': + if b, err = t.appendNumber(b, &e.Flags); err != nil { + break + } + err = e.Tokens.appendNumber() + case '{': + b = append(b, '{') + if err = e.Tokens.pushObject(); err != nil { + break + } + e.Names.push() + if !e.Flags.Get(jsonflags.AllowDuplicateNames) { + e.Namespaces.push() + } + case '}': + b = append(b, '}') + if err = e.Tokens.popObject(); err != nil { + break + } + e.Names.pop() + if !e.Flags.Get(jsonflags.AllowDuplicateNames) { + e.Namespaces.pop() + } + case '[': + b = append(b, '[') + err = e.Tokens.pushArray() + case ']': + b = append(b, ']') + err = e.Tokens.popArray() + default: + err = errInvalidToken + } + if err != nil { + return wrapSyntacticError(e, err, pos, +1) + } + + // Finish off the buffer and store it back into e. + e.Buf = b + if e.NeedFlush() { + return e.Flush() + } + return nil +} + +// AppendRaw appends either a raw string (without double quotes) or number. +// Specify safeASCII if the string output is guaranteed to be ASCII +// without any characters (including '<', '>', and '&') that need escaping, +// otherwise this will validate whether the string needs escaping. +// The appended bytes for a JSON number must be valid. +// +// This is a specialized implementation of Encoder.WriteValue +// that allows appending directly into the buffer. +// It is only called from marshal logic in the "json" package. +func (e *encoderState) AppendRaw(k Kind, safeASCII bool, appendFn func([]byte) ([]byte, error)) error { + b := e.Buf // use local variable to avoid mutating e in case of error + + // Append any delimiters or optional whitespace. + b = e.Tokens.MayAppendDelim(b, k) + if e.Flags.Get(jsonflags.AnyWhitespace) { + b = e.appendWhitespace(b, k) + } + pos := len(b) // offset before the token + + var err error + switch k { + case '"': + // Append directly into the encoder buffer by assuming that + // most of the time none of the characters need escaping. + b = append(b, '"') + if b, err = appendFn(b); err != nil { + return err + } + b = append(b, '"') + + // Check whether we need to escape the string and if necessary + // copy it to a scratch buffer and then escape it back. + isVerbatim := safeASCII || !jsonwire.NeedEscape(b[pos+len(`"`):len(b)-len(`"`)]) + if !isVerbatim { + var err error + b2 := append(e.availBuffer, b[pos+len(`"`):len(b)-len(`"`)]...) + b, err = jsonwire.AppendQuote(b[:pos], string(b2), &e.Flags) + e.availBuffer = b2[:0] + if err != nil { + return wrapSyntacticError(e, err, pos, +1) + } + } + + // Update the state machine. + if e.Tokens.Last.NeedObjectName() { + if !e.Flags.Get(jsonflags.AllowDuplicateNames) { + if !e.Tokens.Last.isValidNamespace() { + return wrapSyntacticError(e, err, pos, +1) + } + if e.Tokens.Last.isActiveNamespace() && !e.Namespaces.Last().insertQuoted(b[pos:], isVerbatim) { + err = wrapWithObjectName(ErrDuplicateName, b[pos:]) + return wrapSyntacticError(e, err, pos, +1) + } + } + e.Names.ReplaceLastQuotedOffset(pos) // only replace if insertQuoted succeeds + } + if err := e.Tokens.appendString(); err != nil { + return wrapSyntacticError(e, err, pos, +1) + } + case '0': + if b, err = appendFn(b); err != nil { + return err + } + if err := e.Tokens.appendNumber(); err != nil { + return wrapSyntacticError(e, err, pos, +1) + } + default: + panic("BUG: invalid kind") + } + + // Finish off the buffer and store it back into e. + e.Buf = b + if e.NeedFlush() { + return e.Flush() + } + return nil +} + +// WriteValue writes the next raw value and advances the internal write offset. +// The Encoder does not simply copy the provided value verbatim, but +// parses it to ensure that it is syntactically valid and reformats it +// according to how the Encoder is configured to format whitespace and strings. +// If [AllowInvalidUTF8] is specified, then any invalid UTF-8 is mangled +// as the Unicode replacement character, U+FFFD. +// +// The provided value kind must be consistent with the JSON grammar +// (see examples on [Encoder.WriteToken]). If the provided value is invalid, +// then it reports a [SyntacticError] and the internal state remains unchanged. +// The offset reported in [SyntacticError] will be relative to the +// [Encoder.OutputOffset] plus the offset into v of any encountered syntax error. +func (e *Encoder) WriteValue(v Value) error { + return e.s.WriteValue(v) +} +func (e *encoderState) WriteValue(v Value) error { + e.maxValue |= len(v) // bitwise OR is a fast approximation of max + + k := v.Kind() + b := e.Buf // use local variable to avoid mutating e in case of error + + // Append any delimiters or optional whitespace. + b = e.Tokens.MayAppendDelim(b, k) + if e.Flags.Get(jsonflags.AnyWhitespace) { + b = e.appendWhitespace(b, k) + } + pos := len(b) // offset before the value + + // Append the value the output. + var n int + n += jsonwire.ConsumeWhitespace(v[n:]) + b, m, err := e.reformatValue(b, v[n:], e.Tokens.Depth()) + if err != nil { + return wrapSyntacticError(e, err, pos+n+m, +1) + } + n += m + n += jsonwire.ConsumeWhitespace(v[n:]) + if len(v) > n { + err = jsonwire.NewInvalidCharacterError(v[n:], "after top-level value") + return wrapSyntacticError(e, err, pos+n, 0) + } + + // Append the kind to the state machine. + switch k { + case 'n', 'f', 't': + err = e.Tokens.appendLiteral() + case '"': + if e.Tokens.Last.NeedObjectName() { + if !e.Flags.Get(jsonflags.AllowDuplicateNames) { + if !e.Tokens.Last.isValidNamespace() { + err = errInvalidNamespace + break + } + if e.Tokens.Last.isActiveNamespace() && !e.Namespaces.Last().insertQuoted(b[pos:], false) { + err = wrapWithObjectName(ErrDuplicateName, b[pos:]) + break + } + } + e.Names.ReplaceLastQuotedOffset(pos) // only replace if insertQuoted succeeds + } + err = e.Tokens.appendString() + case '0': + err = e.Tokens.appendNumber() + case '{': + if err = e.Tokens.pushObject(); err != nil { + break + } + if err = e.Tokens.popObject(); err != nil { + panic("BUG: popObject should never fail immediately after pushObject: " + err.Error()) + } + if e.Flags.Get(jsonflags.ReorderRawObjects) { + mustReorderObjects(b[pos:]) + } + case '[': + if err = e.Tokens.pushArray(); err != nil { + break + } + if err = e.Tokens.popArray(); err != nil { + panic("BUG: popArray should never fail immediately after pushArray: " + err.Error()) + } + if e.Flags.Get(jsonflags.ReorderRawObjects) { + mustReorderObjects(b[pos:]) + } + } + if err != nil { + return wrapSyntacticError(e, err, pos, +1) + } + + // Finish off the buffer and store it back into e. + e.Buf = b + if e.NeedFlush() { + return e.Flush() + } + return nil +} + +// CountNextDelimWhitespace counts the number of bytes of delimiter and +// whitespace bytes assuming the upcoming token is a JSON value. +// This method is used for error reporting at the semantic layer. +func (e *encoderState) CountNextDelimWhitespace() (n int) { + const next = Kind('"') // arbitrary kind as next JSON value + delim := e.Tokens.needDelim(next) + if delim > 0 { + n += len(",") | len(":") + } + if delim == ':' { + if e.Flags.Get(jsonflags.SpaceAfterColon) { + n += len(" ") + } + } else { + if delim == ',' && e.Flags.Get(jsonflags.SpaceAfterComma) { + n += len(" ") + } + if e.Flags.Get(jsonflags.Multiline) { + if m := e.Tokens.NeedIndent(next); m > 0 { + n += len("\n") + len(e.IndentPrefix) + (m-1)*len(e.Indent) + } + } + } + return n +} + +// appendWhitespace appends whitespace that immediately precedes the next token. +func (e *encoderState) appendWhitespace(b []byte, next Kind) []byte { + if delim := e.Tokens.needDelim(next); delim == ':' { + if e.Flags.Get(jsonflags.SpaceAfterColon) { + b = append(b, ' ') + } + } else { + if delim == ',' && e.Flags.Get(jsonflags.SpaceAfterComma) { + b = append(b, ' ') + } + if e.Flags.Get(jsonflags.Multiline) { + b = e.AppendIndent(b, e.Tokens.NeedIndent(next)) + } + } + return b +} + +// AppendIndent appends the appropriate number of indentation characters +// for the current nested level, n. +func (e *encoderState) AppendIndent(b []byte, n int) []byte { + if n == 0 { + return b + } + b = append(b, '\n') + b = append(b, e.IndentPrefix...) + for ; n > 1; n-- { + b = append(b, e.Indent...) + } + return b +} + +// reformatValue parses a JSON value from the start of src and +// appends it to the end of dst, reformatting whitespace and strings as needed. +// It returns the extended dst buffer and the number of consumed input bytes. +func (e *encoderState) reformatValue(dst []byte, src Value, depth int) ([]byte, int, error) { + // TODO: Should this update ValueFlags as input? + if len(src) == 0 { + return dst, 0, io.ErrUnexpectedEOF + } + switch k := Kind(src[0]).normalize(); k { + case 'n': + if jsonwire.ConsumeNull(src) == 0 { + n, err := jsonwire.ConsumeLiteral(src, "null") + return dst, n, err + } + return append(dst, "null"...), len("null"), nil + case 'f': + if jsonwire.ConsumeFalse(src) == 0 { + n, err := jsonwire.ConsumeLiteral(src, "false") + return dst, n, err + } + return append(dst, "false"...), len("false"), nil + case 't': + if jsonwire.ConsumeTrue(src) == 0 { + n, err := jsonwire.ConsumeLiteral(src, "true") + return dst, n, err + } + return append(dst, "true"...), len("true"), nil + case '"': + if n := jsonwire.ConsumeSimpleString(src); n > 0 { + dst = append(dst, src[:n]...) // copy simple strings verbatim + return dst, n, nil + } + return jsonwire.ReformatString(dst, src, &e.Flags) + case '0': + if n := jsonwire.ConsumeSimpleNumber(src); n > 0 && !e.Flags.Get(jsonflags.CanonicalizeNumbers) { + dst = append(dst, src[:n]...) // copy simple numbers verbatim + return dst, n, nil + } + return jsonwire.ReformatNumber(dst, src, &e.Flags) + case '{': + return e.reformatObject(dst, src, depth) + case '[': + return e.reformatArray(dst, src, depth) + default: + return dst, 0, jsonwire.NewInvalidCharacterError(src, "at start of value") + } +} + +// reformatObject parses a JSON object from the start of src and +// appends it to the end of src, reformatting whitespace and strings as needed. +// It returns the extended dst buffer and the number of consumed input bytes. +func (e *encoderState) reformatObject(dst []byte, src Value, depth int) ([]byte, int, error) { + // Append object begin. + if len(src) == 0 || src[0] != '{' { + panic("BUG: reformatObject must be called with a buffer that starts with '{'") + } else if depth == maxNestingDepth+1 { + return dst, 0, errMaxDepth + } + dst = append(dst, '{') + n := len("{") + + // Append (possible) object end. + n += jsonwire.ConsumeWhitespace(src[n:]) + if uint(len(src)) <= uint(n) { + return dst, n, io.ErrUnexpectedEOF + } + if src[n] == '}' { + dst = append(dst, '}') + n += len("}") + return dst, n, nil + } + + var err error + var names *objectNamespace + if !e.Flags.Get(jsonflags.AllowDuplicateNames) { + e.Namespaces.push() + defer e.Namespaces.pop() + names = e.Namespaces.Last() + } + depth++ + for { + // Append optional newline and indentation. + if e.Flags.Get(jsonflags.Multiline) { + dst = e.AppendIndent(dst, depth) + } + + // Append object name. + n += jsonwire.ConsumeWhitespace(src[n:]) + if uint(len(src)) <= uint(n) { + return dst, n, io.ErrUnexpectedEOF + } + m := jsonwire.ConsumeSimpleString(src[n:]) + isVerbatim := m > 0 + if isVerbatim { + dst = append(dst, src[n:n+m]...) + } else { + dst, m, err = jsonwire.ReformatString(dst, src[n:], &e.Flags) + if err != nil { + return dst, n + m, err + } + } + quotedName := src[n : n+m] + if !e.Flags.Get(jsonflags.AllowDuplicateNames) && !names.insertQuoted(quotedName, isVerbatim) { + return dst, n, wrapWithObjectName(ErrDuplicateName, quotedName) + } + n += m + + // Append colon. + n += jsonwire.ConsumeWhitespace(src[n:]) + if uint(len(src)) <= uint(n) { + return dst, n, wrapWithObjectName(io.ErrUnexpectedEOF, quotedName) + } + if src[n] != ':' { + err = jsonwire.NewInvalidCharacterError(src[n:], "after object name (expecting ':')") + return dst, n, wrapWithObjectName(err, quotedName) + } + dst = append(dst, ':') + n += len(":") + if e.Flags.Get(jsonflags.SpaceAfterColon) { + dst = append(dst, ' ') + } + + // Append object value. + n += jsonwire.ConsumeWhitespace(src[n:]) + if uint(len(src)) <= uint(n) { + return dst, n, wrapWithObjectName(io.ErrUnexpectedEOF, quotedName) + } + dst, m, err = e.reformatValue(dst, src[n:], depth) + if err != nil { + return dst, n + m, wrapWithObjectName(err, quotedName) + } + n += m + + // Append comma or object end. + n += jsonwire.ConsumeWhitespace(src[n:]) + if uint(len(src)) <= uint(n) { + return dst, n, io.ErrUnexpectedEOF + } + switch src[n] { + case ',': + dst = append(dst, ',') + if e.Flags.Get(jsonflags.SpaceAfterComma) { + dst = append(dst, ' ') + } + n += len(",") + continue + case '}': + if e.Flags.Get(jsonflags.Multiline) { + dst = e.AppendIndent(dst, depth-1) + } + dst = append(dst, '}') + n += len("}") + return dst, n, nil + default: + return dst, n, jsonwire.NewInvalidCharacterError(src[n:], "after object value (expecting ',' or '}')") + } + } +} + +// reformatArray parses a JSON array from the start of src and +// appends it to the end of dst, reformatting whitespace and strings as needed. +// It returns the extended dst buffer and the number of consumed input bytes. +func (e *encoderState) reformatArray(dst []byte, src Value, depth int) ([]byte, int, error) { + // Append array begin. + if len(src) == 0 || src[0] != '[' { + panic("BUG: reformatArray must be called with a buffer that starts with '['") + } else if depth == maxNestingDepth+1 { + return dst, 0, errMaxDepth + } + dst = append(dst, '[') + n := len("[") + + // Append (possible) array end. + n += jsonwire.ConsumeWhitespace(src[n:]) + if uint(len(src)) <= uint(n) { + return dst, n, io.ErrUnexpectedEOF + } + if src[n] == ']' { + dst = append(dst, ']') + n += len("]") + return dst, n, nil + } + + var idx int64 + var err error + depth++ + for { + // Append optional newline and indentation. + if e.Flags.Get(jsonflags.Multiline) { + dst = e.AppendIndent(dst, depth) + } + + // Append array value. + n += jsonwire.ConsumeWhitespace(src[n:]) + if uint(len(src)) <= uint(n) { + return dst, n, io.ErrUnexpectedEOF + } + var m int + dst, m, err = e.reformatValue(dst, src[n:], depth) + if err != nil { + return dst, n + m, wrapWithArrayIndex(err, idx) + } + n += m + + // Append comma or array end. + n += jsonwire.ConsumeWhitespace(src[n:]) + if uint(len(src)) <= uint(n) { + return dst, n, io.ErrUnexpectedEOF + } + switch src[n] { + case ',': + dst = append(dst, ',') + if e.Flags.Get(jsonflags.SpaceAfterComma) { + dst = append(dst, ' ') + } + n += len(",") + idx++ + continue + case ']': + if e.Flags.Get(jsonflags.Multiline) { + dst = e.AppendIndent(dst, depth-1) + } + dst = append(dst, ']') + n += len("]") + return dst, n, nil + default: + return dst, n, jsonwire.NewInvalidCharacterError(src[n:], "after array value (expecting ',' or ']')") + } + } +} + +// OutputOffset returns the current output byte offset. It gives the location +// of the next byte immediately after the most recently written token or value. +// The number of bytes actually written to the underlying [io.Writer] may be less +// than this offset due to internal buffering effects. +func (e *Encoder) OutputOffset() int64 { + return e.s.previousOffsetEnd() +} + +// AvailableBuffer returns a zero-length buffer with a possible non-zero capacity. +// This buffer is intended to be used to populate a [Value] +// being passed to an immediately succeeding [Encoder.WriteValue] call. +// +// Example usage: +// +// b := d.AvailableBuffer() +// b = append(b, '"') +// b = appendString(b, v) // append the string formatting of v +// b = append(b, '"') +// ... := d.WriteValue(b) +// +// It is the user's responsibility to ensure that the value is valid JSON. +func (e *Encoder) AvailableBuffer() []byte { + // NOTE: We don't return e.buf[len(e.buf):cap(e.buf)] since WriteValue would + // need to take special care to avoid mangling the data while reformatting. + // WriteValue can't easily identify whether the input Value aliases e.buf + // without using unsafe.Pointer. Thus, we just return a different buffer. + // Should this ever alias e.buf, we need to consider how it operates with + // the specialized performance optimization for bytes.Buffer. + n := 1 << bits.Len(uint(e.s.maxValue|63)) // fast approximation for max length + if cap(e.s.availBuffer) < n { + e.s.availBuffer = make([]byte, 0, n) + } + return e.s.availBuffer +} + +// StackDepth returns the depth of the state machine for written JSON data. +// Each level on the stack represents a nested JSON object or array. +// It is incremented whenever an [BeginObject] or [BeginArray] token is encountered +// and decremented whenever an [EndObject] or [EndArray] token is encountered. +// The depth is zero-indexed, where zero represents the top-level JSON value. +func (e *Encoder) StackDepth() int { + // NOTE: Keep in sync with Decoder.StackDepth. + return e.s.Tokens.Depth() - 1 +} + +// StackIndex returns information about the specified stack level. +// It must be a number between 0 and [Encoder.StackDepth], inclusive. +// For each level, it reports the kind: +// +// - [KindInvalid] for a level of zero, +// - [KindBeginObject] for a level representing a JSON object, and +// - [KindBeginArray] for a level representing a JSON array. +// +// It also reports the length of that JSON object or array. +// Each name and value in a JSON object is counted separately, +// so the effective number of members would be half the length. +// A complete JSON object must have an even length. +func (e *Encoder) StackIndex(i int) (Kind, int64) { + // NOTE: Keep in sync with Decoder.StackIndex. + switch s := e.s.Tokens.index(i); { + case i > 0 && s.isObject(): + return '{', s.Length() + case i > 0 && s.isArray(): + return '[', s.Length() + default: + return 0, s.Length() + } +} + +// StackPointer returns a JSON Pointer (RFC 6901) to the most recently written value. +func (e *Encoder) StackPointer() Pointer { + return Pointer(e.s.AppendStackPointer(nil, -1)) +} + +func (e *encoderState) AppendStackPointer(b []byte, where int) []byte { + e.Names.copyQuotedBuffer(e.Buf) + return e.state.appendStackPointer(b, where) +} diff --git a/go/src/encoding/json/jsontext/encode_test.go b/go/src/encoding/json/jsontext/encode_test.go new file mode 100644 index 0000000000000000000000000000000000000000..a9505f5258cbfeae3541db2bd2a8a790e8569dfc --- /dev/null +++ b/go/src/encoding/json/jsontext/encode_test.go @@ -0,0 +1,829 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsontext + +import ( + "bytes" + "errors" + "io" + "path" + "slices" + "testing" + + "encoding/json/internal/jsonflags" + "encoding/json/internal/jsontest" + "encoding/json/internal/jsonwire" +) + +// TestEncoder tests whether we can produce JSON with either tokens or raw values. +func TestEncoder(t *testing.T) { + for _, td := range coderTestdata { + for _, formatName := range []string{"Compact", "Indented"} { + for _, typeName := range []string{"Token", "Value", "TokenDelims"} { + t.Run(path.Join(td.name.Name, typeName, formatName), func(t *testing.T) { + testEncoder(t, td.name.Where, formatName, typeName, td) + }) + } + } + } +} +func testEncoder(t *testing.T, where jsontest.CasePos, formatName, typeName string, td coderTestdataEntry) { + var want string + var opts []Options + dst := new(bytes.Buffer) + opts = append(opts, jsonflags.OmitTopLevelNewline|1) + want = td.outCompacted + switch formatName { + case "Indented": + opts = append(opts, Multiline(true)) + opts = append(opts, WithIndentPrefix("\t")) + opts = append(opts, WithIndent(" ")) + if td.outIndented != "" { + want = td.outIndented + } + } + enc := NewEncoder(dst, opts...) + + switch typeName { + case "Token": + var pointers []Pointer + for _, tok := range td.tokens { + if err := enc.WriteToken(tok); err != nil { + t.Fatalf("%s: Encoder.WriteToken error: %v", where, err) + } + if td.pointers != nil { + pointers = append(pointers, enc.StackPointer()) + } + } + if !slices.Equal(pointers, td.pointers) { + t.Fatalf("%s: pointers mismatch:\ngot %q\nwant %q", where, pointers, td.pointers) + } + case "Value": + if err := enc.WriteValue(Value(td.in)); err != nil { + t.Fatalf("%s: Encoder.WriteValue error: %v", where, err) + } + case "TokenDelims": + // Use WriteToken for object/array delimiters, WriteValue otherwise. + for _, tok := range td.tokens { + switch tok.Kind() { + case '{', '}', '[', ']': + if err := enc.WriteToken(tok); err != nil { + t.Fatalf("%s: Encoder.WriteToken error: %v", where, err) + } + default: + val := Value(tok.String()) + if tok.Kind() == '"' { + val, _ = jsonwire.AppendQuote(nil, tok.String(), &jsonflags.Flags{}) + } + if err := enc.WriteValue(val); err != nil { + t.Fatalf("%s: Encoder.WriteValue error: %v", where, err) + } + } + } + } + + got := dst.String() + if got != want { + t.Errorf("%s: output mismatch:\ngot %q\nwant %q", where, got, want) + } +} + +// TestFaultyEncoder tests that temporary I/O errors are not fatal. +func TestFaultyEncoder(t *testing.T) { + for _, td := range coderTestdata { + for _, typeName := range []string{"Token", "Value"} { + t.Run(path.Join(td.name.Name, typeName), func(t *testing.T) { + testFaultyEncoder(t, td.name.Where, typeName, td) + }) + } + } +} +func testFaultyEncoder(t *testing.T, where jsontest.CasePos, typeName string, td coderTestdataEntry) { + b := &FaultyBuffer{ + MaxBytes: 1, + MayError: io.ErrShortWrite, + } + + // Write all the tokens. + // Even if the underlying io.Writer may be faulty, + // writing a valid token or value is guaranteed to at least + // be appended to the internal buffer. + // In other words, syntactic errors occur before I/O errors. + enc := NewEncoder(b) + switch typeName { + case "Token": + for i, tok := range td.tokens { + err := enc.WriteToken(tok) + if err != nil && !errors.Is(err, io.ErrShortWrite) { + t.Fatalf("%s: %d: Encoder.WriteToken error: %v", where, i, err) + } + } + case "Value": + err := enc.WriteValue(Value(td.in)) + if err != nil && !errors.Is(err, io.ErrShortWrite) { + t.Fatalf("%s: Encoder.WriteValue error: %v", where, err) + } + } + gotOutput := string(append(b.B, enc.s.unflushedBuffer()...)) + wantOutput := td.outCompacted + "\n" + if gotOutput != wantOutput { + t.Fatalf("%s: output mismatch:\ngot %s\nwant %s", where, gotOutput, wantOutput) + } +} + +type encoderMethodCall struct { + in tokOrVal + wantErr error + wantPointer Pointer +} + +var encoderErrorTestdata = []struct { + name jsontest.CaseName + opts []Options + calls []encoderMethodCall + wantOut string +}{{ + name: jsontest.Name("InvalidToken"), + calls: []encoderMethodCall{ + {zeroToken, E(errInvalidToken), ""}, + }, +}, { + name: jsontest.Name("InvalidValue"), + calls: []encoderMethodCall{ + {Value(`#`), newInvalidCharacterError("#", "at start of value"), ""}, + }, +}, { + name: jsontest.Name("InvalidValue/DoubleZero"), + calls: []encoderMethodCall{ + {Value(`00`), newInvalidCharacterError("0", "after top-level value").withPos(`0`, ""), ""}, + }, +}, { + name: jsontest.Name("TruncatedValue"), + calls: []encoderMethodCall{ + {zeroValue, E(io.ErrUnexpectedEOF).withPos("", ""), ""}, + }, +}, { + name: jsontest.Name("TruncatedNull"), + calls: []encoderMethodCall{ + {Value(`nul`), E(io.ErrUnexpectedEOF).withPos("nul", ""), ""}, + }, +}, { + name: jsontest.Name("InvalidNull"), + calls: []encoderMethodCall{ + {Value(`nulL`), newInvalidCharacterError("L", "in literal null (expecting 'l')").withPos(`nul`, ""), ""}, + }, +}, { + name: jsontest.Name("TruncatedFalse"), + calls: []encoderMethodCall{ + {Value(`fals`), E(io.ErrUnexpectedEOF).withPos("fals", ""), ""}, + }, +}, { + name: jsontest.Name("InvalidFalse"), + calls: []encoderMethodCall{ + {Value(`falsE`), newInvalidCharacterError("E", "in literal false (expecting 'e')").withPos(`fals`, ""), ""}, + }, +}, { + name: jsontest.Name("TruncatedTrue"), + calls: []encoderMethodCall{ + {Value(`tru`), E(io.ErrUnexpectedEOF).withPos(`tru`, ""), ""}, + }, +}, { + name: jsontest.Name("InvalidTrue"), + calls: []encoderMethodCall{ + {Value(`truE`), newInvalidCharacterError("E", "in literal true (expecting 'e')").withPos(`tru`, ""), ""}, + }, +}, { + name: jsontest.Name("TruncatedString"), + calls: []encoderMethodCall{ + {Value(`"star`), E(io.ErrUnexpectedEOF).withPos(`"star`, ""), ""}, + }, +}, { + name: jsontest.Name("InvalidString"), + calls: []encoderMethodCall{ + {Value(`"ok` + "\x00"), newInvalidCharacterError("\x00", `in string (expecting non-control character)`).withPos(`"ok`, ""), ""}, + }, +}, { + name: jsontest.Name("ValidString/AllowInvalidUTF8/Token"), + opts: []Options{AllowInvalidUTF8(true)}, + calls: []encoderMethodCall{ + {String("living\xde\xad\xbe\xef"), nil, ""}, + }, + wantOut: "\"living\xde\xad\ufffd\ufffd\"\n", +}, { + name: jsontest.Name("ValidString/AllowInvalidUTF8/Value"), + opts: []Options{AllowInvalidUTF8(true)}, + calls: []encoderMethodCall{ + {Value("\"living\xde\xad\xbe\xef\""), nil, ""}, + }, + wantOut: "\"living\xde\xad\ufffd\ufffd\"\n", +}, { + name: jsontest.Name("InvalidString/RejectInvalidUTF8"), + opts: []Options{AllowInvalidUTF8(false)}, + calls: []encoderMethodCall{ + {String("living\xde\xad\xbe\xef"), E(jsonwire.ErrInvalidUTF8), ""}, + {Value("\"living\xde\xad\xbe\xef\""), E(jsonwire.ErrInvalidUTF8).withPos("\"living\xde\xad", ""), ""}, + {BeginObject, nil, ""}, + {String("name"), nil, ""}, + {BeginArray, nil, ""}, + {String("living\xde\xad\xbe\xef"), E(jsonwire.ErrInvalidUTF8).withPos(`{"name":[`, "/name/0"), ""}, + {Value("\"living\xde\xad\xbe\xef\""), E(jsonwire.ErrInvalidUTF8).withPos("{\"name\":[\"living\xde\xad", "/name/0"), ""}, + }, + wantOut: `{"name":[`, +}, { + name: jsontest.Name("TruncatedNumber"), + calls: []encoderMethodCall{ + {Value(`0.`), E(io.ErrUnexpectedEOF).withPos("0", ""), ""}, + }, +}, { + name: jsontest.Name("InvalidNumber"), + calls: []encoderMethodCall{ + {Value(`0.e`), newInvalidCharacterError("e", "in number (expecting digit)").withPos(`0.`, ""), ""}, + }, +}, { + name: jsontest.Name("TruncatedObject/AfterStart"), + calls: []encoderMethodCall{ + {Value(`{`), E(io.ErrUnexpectedEOF).withPos("{", ""), ""}, + }, +}, { + name: jsontest.Name("TruncatedObject/AfterName"), + calls: []encoderMethodCall{ + {Value(`{"X"`), E(io.ErrUnexpectedEOF).withPos(`{"X"`, "/X"), ""}, + }, +}, { + name: jsontest.Name("TruncatedObject/AfterColon"), + calls: []encoderMethodCall{ + {Value(`{"X":`), E(io.ErrUnexpectedEOF).withPos(`{"X":`, "/X"), ""}, + }, +}, { + name: jsontest.Name("TruncatedObject/AfterValue"), + calls: []encoderMethodCall{ + {Value(`{"0":0`), E(io.ErrUnexpectedEOF).withPos(`{"0":0`, ""), ""}, + }, +}, { + name: jsontest.Name("TruncatedObject/AfterComma"), + calls: []encoderMethodCall{ + {Value(`{"0":0,`), E(io.ErrUnexpectedEOF).withPos(`{"0":0,`, ""), ""}, + }, +}, { + name: jsontest.Name("InvalidObject/MissingColon"), + calls: []encoderMethodCall{ + {Value(` { "fizz" "buzz" } `), newInvalidCharacterError("\"", "after object name (expecting ':')").withPos(` { "fizz" `, "/fizz"), ""}, + {Value(` { "fizz" , "buzz" } `), newInvalidCharacterError(",", "after object name (expecting ':')").withPos(` { "fizz" `, "/fizz"), ""}, + }, +}, { + name: jsontest.Name("InvalidObject/MissingComma"), + calls: []encoderMethodCall{ + {Value(` { "fizz" : "buzz" "gazz" } `), newInvalidCharacterError("\"", "after object value (expecting ',' or '}')").withPos(` { "fizz" : "buzz" `, ""), ""}, + {Value(` { "fizz" : "buzz" : "gazz" } `), newInvalidCharacterError(":", "after object value (expecting ',' or '}')").withPos(` { "fizz" : "buzz" `, ""), ""}, + }, +}, { + name: jsontest.Name("InvalidObject/ExtraComma"), + calls: []encoderMethodCall{ + {Value(` { , } `), newInvalidCharacterError(",", `at start of string (expecting '"')`).withPos(` { `, ""), ""}, + {Value(` { "fizz" : "buzz" , } `), newInvalidCharacterError("}", `at start of string (expecting '"')`).withPos(` { "fizz" : "buzz" , `, ""), ""}, + }, +}, { + name: jsontest.Name("InvalidObject/InvalidName"), + calls: []encoderMethodCall{ + {Value(`{ null }`), newInvalidCharacterError("n", `at start of string (expecting '"')`).withPos(`{ `, ""), ""}, + {Value(`{ false }`), newInvalidCharacterError("f", `at start of string (expecting '"')`).withPos(`{ `, ""), ""}, + {Value(`{ true }`), newInvalidCharacterError("t", `at start of string (expecting '"')`).withPos(`{ `, ""), ""}, + {Value(`{ 0 }`), newInvalidCharacterError("0", `at start of string (expecting '"')`).withPos(`{ `, ""), ""}, + {Value(`{ {} }`), newInvalidCharacterError("{", `at start of string (expecting '"')`).withPos(`{ `, ""), ""}, + {Value(`{ [] }`), newInvalidCharacterError("[", `at start of string (expecting '"')`).withPos(`{ `, ""), ""}, + {BeginObject, nil, ""}, + {Null, E(ErrNonStringName).withPos(`{`, ""), ""}, + {Value(`null`), E(ErrNonStringName).withPos(`{`, ""), ""}, + {False, E(ErrNonStringName).withPos(`{`, ""), ""}, + {Value(`false`), E(ErrNonStringName).withPos(`{`, ""), ""}, + {True, E(ErrNonStringName).withPos(`{`, ""), ""}, + {Value(`true`), E(ErrNonStringName).withPos(`{`, ""), ""}, + {Uint(0), E(ErrNonStringName).withPos(`{`, ""), ""}, + {Value(`0`), E(ErrNonStringName).withPos(`{`, ""), ""}, + {BeginObject, E(ErrNonStringName).withPos(`{`, ""), ""}, + {Value(`{}`), E(ErrNonStringName).withPos(`{`, ""), ""}, + {BeginArray, E(ErrNonStringName).withPos(`{`, ""), ""}, + {Value(`[]`), E(ErrNonStringName).withPos(`{`, ""), ""}, + {EndObject, nil, ""}, + }, + wantOut: "{}\n", +}, { + name: jsontest.Name("InvalidObject/InvalidValue"), + calls: []encoderMethodCall{ + {Value(`{ "0": x }`), newInvalidCharacterError("x", `at start of value`).withPos(`{ "0": `, "/0"), ""}, + }, +}, { + name: jsontest.Name("InvalidObject/MismatchingDelim"), + calls: []encoderMethodCall{ + {Value(` { ] `), newInvalidCharacterError("]", `at start of string (expecting '"')`).withPos(` { `, ""), ""}, + {Value(` { "0":0 ] `), newInvalidCharacterError("]", `after object value (expecting ',' or '}')`).withPos(` { "0":0 `, ""), ""}, + {BeginObject, nil, ""}, + {EndArray, E(errMismatchDelim).withPos(`{`, ""), ""}, + {Value(`]`), newInvalidCharacterError("]", "at start of value").withPos(`{`, ""), ""}, + {EndObject, nil, ""}, + }, + wantOut: "{}\n", +}, { + name: jsontest.Name("ValidObject/UniqueNames"), + calls: []encoderMethodCall{ + {BeginObject, nil, ""}, + {String("0"), nil, ""}, + {Uint(0), nil, ""}, + {String("1"), nil, ""}, + {Uint(1), nil, ""}, + {EndObject, nil, ""}, + {Value(` { "0" : 0 , "1" : 1 } `), nil, ""}, + }, + wantOut: `{"0":0,"1":1}` + "\n" + `{"0":0,"1":1}` + "\n", +}, { + name: jsontest.Name("ValidObject/DuplicateNames"), + opts: []Options{AllowDuplicateNames(true)}, + calls: []encoderMethodCall{ + {BeginObject, nil, ""}, + {String("0"), nil, ""}, + {Uint(0), nil, ""}, + {String("0"), nil, ""}, + {Uint(0), nil, ""}, + {EndObject, nil, ""}, + {Value(` { "0" : 0 , "0" : 0 } `), nil, ""}, + }, + wantOut: `{"0":0,"0":0}` + "\n" + `{"0":0,"0":0}` + "\n", +}, { + name: jsontest.Name("InvalidObject/DuplicateNames"), + calls: []encoderMethodCall{ + {BeginObject, nil, ""}, + {String("X"), nil, ""}, + {BeginObject, nil, ""}, + {EndObject, nil, ""}, + {String("X"), E(ErrDuplicateName).withPos(`{"X":{},`, "/X"), "/X"}, + {Value(`"X"`), E(ErrDuplicateName).withPos(`{"X":{},`, "/X"), "/X"}, + {String("Y"), nil, ""}, + {BeginObject, nil, ""}, + {EndObject, nil, ""}, + {String("X"), E(ErrDuplicateName).withPos(`{"X":{},"Y":{},`, "/X"), "/Y"}, + {Value(`"X"`), E(ErrDuplicateName).withPos(`{"X":{},"Y":{},`, "/X"), "/Y"}, + {String("Y"), E(ErrDuplicateName).withPos(`{"X":{},"Y":{},`, "/Y"), "/Y"}, + {Value(`"Y"`), E(ErrDuplicateName).withPos(`{"X":{},"Y":{},`, "/Y"), "/Y"}, + {EndObject, nil, ""}, + {Value(` { "X" : 0 , "Y" : 1 , "X" : 0 } `), E(ErrDuplicateName).withPos(`{"X":{},"Y":{}}`+"\n"+` { "X" : 0 , "Y" : 1 , `, "/X"), ""}, + }, + wantOut: `{"X":{},"Y":{}}` + "\n", +}, { + name: jsontest.Name("TruncatedArray/AfterStart"), + calls: []encoderMethodCall{ + {Value(`[`), E(io.ErrUnexpectedEOF).withPos(`[`, ""), ""}, + }, +}, { + name: jsontest.Name("TruncatedArray/AfterValue"), + calls: []encoderMethodCall{ + {Value(`[0`), E(io.ErrUnexpectedEOF).withPos(`[0`, ""), ""}, + }, +}, { + name: jsontest.Name("TruncatedArray/AfterComma"), + calls: []encoderMethodCall{ + {Value(`[0,`), E(io.ErrUnexpectedEOF).withPos(`[0,`, ""), ""}, + }, +}, { + name: jsontest.Name("TruncatedArray/MissingComma"), + calls: []encoderMethodCall{ + {Value(` [ "fizz" "buzz" ] `), newInvalidCharacterError("\"", "after array value (expecting ',' or ']')").withPos(` [ "fizz" `, ""), ""}, + }, +}, { + name: jsontest.Name("InvalidArray/MismatchingDelim"), + calls: []encoderMethodCall{ + {Value(` [ } `), newInvalidCharacterError("}", `at start of value`).withPos(` [ `, "/0"), ""}, + {BeginArray, nil, ""}, + {EndObject, E(errMismatchDelim).withPos(`[`, "/0"), ""}, + {Value(`}`), newInvalidCharacterError("}", "at start of value").withPos(`[`, "/0"), ""}, + {EndArray, nil, ""}, + }, + wantOut: "[]\n", +}, { + name: jsontest.Name("Format/Object/SpaceAfterColon"), + opts: []Options{SpaceAfterColon(true)}, + calls: []encoderMethodCall{{Value(`{"fizz":"buzz","wizz":"wuzz"}`), nil, ""}}, + wantOut: "{\"fizz\": \"buzz\",\"wizz\": \"wuzz\"}\n", +}, { + name: jsontest.Name("Format/Object/SpaceAfterComma"), + opts: []Options{SpaceAfterComma(true)}, + calls: []encoderMethodCall{{Value(`{"fizz":"buzz","wizz":"wuzz"}`), nil, ""}}, + wantOut: "{\"fizz\":\"buzz\", \"wizz\":\"wuzz\"}\n", +}, { + name: jsontest.Name("Format/Object/SpaceAfterColonAndComma"), + opts: []Options{SpaceAfterColon(true), SpaceAfterComma(true)}, + calls: []encoderMethodCall{{Value(`{"fizz":"buzz","wizz":"wuzz"}`), nil, ""}}, + wantOut: "{\"fizz\": \"buzz\", \"wizz\": \"wuzz\"}\n", +}, { + name: jsontest.Name("Format/Object/NoSpaceAfterColon+SpaceAfterComma+Multiline"), + opts: []Options{SpaceAfterColon(false), SpaceAfterComma(true), Multiline(true)}, + calls: []encoderMethodCall{{Value(`{"fizz":"buzz","wizz":"wuzz"}`), nil, ""}}, + wantOut: "{\n\t\"fizz\":\"buzz\", \n\t\"wizz\":\"wuzz\"\n}\n", +}, { + name: jsontest.Name("Format/Array/SpaceAfterComma"), + opts: []Options{SpaceAfterComma(true)}, + calls: []encoderMethodCall{{Value(`["fizz","buzz"]`), nil, ""}}, + wantOut: "[\"fizz\", \"buzz\"]\n", +}, { + name: jsontest.Name("Format/Array/NoSpaceAfterComma+Multiline"), + opts: []Options{SpaceAfterComma(false), Multiline(true)}, + calls: []encoderMethodCall{{Value(`["fizz","buzz"]`), nil, ""}}, + wantOut: "[\n\t\"fizz\",\n\t\"buzz\"\n]\n", +}, { + name: jsontest.Name("Format/ReorderWithWhitespace"), + opts: []Options{ + AllowDuplicateNames(true), + AllowInvalidUTF8(true), + ReorderRawObjects(true), + SpaceAfterComma(true), + SpaceAfterColon(false), + Multiline(true), + WithIndentPrefix(" "), + WithIndent("\t"), + PreserveRawStrings(true), + }, + calls: []encoderMethodCall{ + {BeginArray, nil, ""}, + {BeginArray, nil, ""}, + {Value(` { "fizz" : "buzz" , + "zip" : { + "x` + "\xfd" + `x" : 123 , "x` + "\xff" + `x" : 123, "x` + "\xfe" + `x" : 123 + }, + "zap" : { + "xxx" : 333, "xxx": 1, "xxx": 22 + }, + "alpha" : "bravo" } `), nil, ""}, + {EndArray, nil, ""}, + {EndArray, nil, ""}, + }, + wantOut: "[\n \t[\n \t\t{\n \t\t\t\"alpha\":\"bravo\", \n \t\t\t\"fizz\":\"buzz\", \n \t\t\t\"zap\":{\n \t\t\t\t\"xxx\":1, \n \t\t\t\t\"xxx\":22, \n \t\t\t\t\"xxx\":333\n \t\t\t}, \n \t\t\t\"zip\":{\n \t\t\t\t\"x\xfdx\":123, \n \t\t\t\t\"x\xfex\":123, \n \t\t\t\t\"x\xffx\":123\n \t\t\t}\n \t\t}\n \t]\n ]\n", +}, { + name: jsontest.Name("Format/CanonicalizeRawInts"), + opts: []Options{CanonicalizeRawInts(true), SpaceAfterComma(true)}, + calls: []encoderMethodCall{ + {Value(`[0.100,5.0,1E6,-9223372036854775808,-10,-1,-0,0,1,10,9223372036854775807]`), nil, ""}, + }, + wantOut: "[0.100, 5.0, 1E6, -9223372036854776000, -10, -1, 0, 0, 1, 10, 9223372036854776000]\n", +}, { + name: jsontest.Name("Format/CanonicalizeRawFloats"), + opts: []Options{CanonicalizeRawFloats(true), SpaceAfterComma(true)}, + calls: []encoderMethodCall{ + {Value(`[0.100,5.0,1E6,-9223372036854775808,-10,-1,-0,0,1,10,9223372036854775807]`), nil, ""}, + }, + wantOut: "[0.1, 5, 1000000, -9223372036854775808, -10, -1, 0, 0, 1, 10, 9223372036854775807]\n", +}, { + name: jsontest.Name("ErrorPosition"), + calls: []encoderMethodCall{ + {Value(` "a` + "\xff" + `0" `), E(jsonwire.ErrInvalidUTF8).withPos(` "a`, ""), ""}, + {String(`a` + "\xff" + `0`), E(jsonwire.ErrInvalidUTF8).withPos(``, ""), ""}, + }, +}, { + name: jsontest.Name("ErrorPosition/0"), + calls: []encoderMethodCall{ + {Value(` [ "a` + "\xff" + `1" ] `), E(jsonwire.ErrInvalidUTF8).withPos(` [ "a`, "/0"), ""}, + {BeginArray, nil, ""}, + {Value(` "a` + "\xff" + `1" `), E(jsonwire.ErrInvalidUTF8).withPos(`[ "a`, "/0"), ""}, + {String(`a` + "\xff" + `1`), E(jsonwire.ErrInvalidUTF8).withPos(`[`, "/0"), ""}, + }, + wantOut: `[`, +}, { + name: jsontest.Name("ErrorPosition/1"), + calls: []encoderMethodCall{ + {Value(` [ "a1" , "b` + "\xff" + `1" ] `), E(jsonwire.ErrInvalidUTF8).withPos(` [ "a1" , "b`, "/1"), ""}, + {BeginArray, nil, ""}, + {String("a1"), nil, ""}, + {Value(` "b` + "\xff" + `1" `), E(jsonwire.ErrInvalidUTF8).withPos(`["a1", "b`, "/1"), ""}, + {String(`b` + "\xff" + `1`), E(jsonwire.ErrInvalidUTF8).withPos(`["a1",`, "/1"), ""}, + }, + wantOut: `["a1"`, +}, { + name: jsontest.Name("ErrorPosition/0/0"), + calls: []encoderMethodCall{ + {Value(` [ [ "a` + "\xff" + `2" ] ] `), E(jsonwire.ErrInvalidUTF8).withPos(` [ [ "a`, "/0/0"), ""}, + {BeginArray, nil, ""}, + {Value(` [ "a` + "\xff" + `2" ] `), E(jsonwire.ErrInvalidUTF8).withPos(`[ [ "a`, "/0/0"), ""}, + {BeginArray, nil, "/0"}, + {Value(` "a` + "\xff" + `2" `), E(jsonwire.ErrInvalidUTF8).withPos(`[[ "a`, "/0/0"), "/0"}, + {String(`a` + "\xff" + `2`), E(jsonwire.ErrInvalidUTF8).withPos(`[[`, "/0/0"), "/0"}, + }, + wantOut: `[[`, +}, { + name: jsontest.Name("ErrorPosition/1/0"), + calls: []encoderMethodCall{ + {Value(` [ "a1" , [ "a` + "\xff" + `2" ] ] `), E(jsonwire.ErrInvalidUTF8).withPos(` [ "a1" , [ "a`, "/1/0"), ""}, + {BeginArray, nil, ""}, + {String("a1"), nil, "/0"}, + {Value(` [ "a` + "\xff" + `2" ] `), E(jsonwire.ErrInvalidUTF8).withPos(`["a1", [ "a`, "/1/0"), ""}, + {BeginArray, nil, "/1"}, + {Value(` "a` + "\xff" + `2" `), E(jsonwire.ErrInvalidUTF8).withPos(`["a1",[ "a`, "/1/0"), "/1"}, + {String(`a` + "\xff" + `2`), E(jsonwire.ErrInvalidUTF8).withPos(`["a1",[`, "/1/0"), "/1"}, + }, + wantOut: `["a1",[`, +}, { + name: jsontest.Name("ErrorPosition/0/1"), + calls: []encoderMethodCall{ + {Value(` [ [ "a2" , "b` + "\xff" + `2" ] ] `), E(jsonwire.ErrInvalidUTF8).withPos(` [ [ "a2" , "b`, "/0/1"), ""}, + {BeginArray, nil, ""}, + {Value(` [ "a2" , "b` + "\xff" + `2" ] `), E(jsonwire.ErrInvalidUTF8).withPos(`[ [ "a2" , "b`, "/0/1"), ""}, + {BeginArray, nil, "/0"}, + {String("a2"), nil, "/0/0"}, + {Value(` "b` + "\xff" + `2" `), E(jsonwire.ErrInvalidUTF8).withPos(`[["a2", "b`, "/0/1"), "/0/0"}, + {String(`b` + "\xff" + `2`), E(jsonwire.ErrInvalidUTF8).withPos(`[["a2",`, "/0/1"), "/0/0"}, + }, + wantOut: `[["a2"`, +}, { + name: jsontest.Name("ErrorPosition/1/1"), + calls: []encoderMethodCall{ + {Value(` [ "a1" , [ "a2" , "b` + "\xff" + `2" ] ] `), E(jsonwire.ErrInvalidUTF8).withPos(` [ "a1" , [ "a2" , "b`, "/1/1"), ""}, + {BeginArray, nil, ""}, + {String("a1"), nil, "/0"}, + {Value(` [ "a2" , "b` + "\xff" + `2" ] `), E(jsonwire.ErrInvalidUTF8).withPos(`["a1", [ "a2" , "b`, "/1/1"), ""}, + {BeginArray, nil, "/1"}, + {String("a2"), nil, "/1/0"}, + {Value(` "b` + "\xff" + `2" `), E(jsonwire.ErrInvalidUTF8).withPos(`["a1",["a2", "b`, "/1/1"), "/1/0"}, + {String(`b` + "\xff" + `2`), E(jsonwire.ErrInvalidUTF8).withPos(`["a1",["a2",`, "/1/1"), "/1/0"}, + }, + wantOut: `["a1",["a2"`, +}, { + name: jsontest.Name("ErrorPosition/a1-"), + calls: []encoderMethodCall{ + {Value(` { "a` + "\xff" + `1" : "b1" } `), E(jsonwire.ErrInvalidUTF8).withPos(` { "a`, ""), ""}, + {BeginObject, nil, ""}, + {Value(` "a` + "\xff" + `1" `), E(jsonwire.ErrInvalidUTF8).withPos(`{ "a`, ""), ""}, + {String(`a` + "\xff" + `1`), E(jsonwire.ErrInvalidUTF8).withPos(`{`, ""), ""}, + }, + wantOut: `{`, +}, { + name: jsontest.Name("ErrorPosition/a1"), + calls: []encoderMethodCall{ + {Value(` { "a1" : "b` + "\xff" + `1" } `), E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : "b`, "/a1"), ""}, + {BeginObject, nil, ""}, + {String("a1"), nil, "/a1"}, + {Value(` "b` + "\xff" + `1" `), E(jsonwire.ErrInvalidUTF8).withPos(`{"a1": "b`, "/a1"), ""}, + {String(`b` + "\xff" + `1`), E(jsonwire.ErrInvalidUTF8).withPos(`{"a1":`, "/a1"), ""}, + }, + wantOut: `{"a1"`, +}, { + name: jsontest.Name("ErrorPosition/c1-"), + calls: []encoderMethodCall{ + {Value(` { "a1" : "b1" , "c` + "\xff" + `1" : "d1" } `), E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : "b1" , "c`, ""), ""}, + {BeginObject, nil, ""}, + {String("a1"), nil, "/a1"}, + {String("b1"), nil, "/a1"}, + {Value(` "c` + "\xff" + `1" `), E(jsonwire.ErrInvalidUTF8).withPos(`{"a1":"b1": "c`, ""), "/a1"}, + {String(`c` + "\xff" + `1`), E(jsonwire.ErrInvalidUTF8).withPos(`{"a1":"b1":`, ""), "/a1"}, + }, + wantOut: `{"a1":"b1"`, +}, { + name: jsontest.Name("ErrorPosition/c1"), + calls: []encoderMethodCall{ + {Value(` { "a1" : "b1" , "c1" : "d` + "\xff" + `1" } `), E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : "b1" , "c1" : "d`, "/c1"), ""}, + {BeginObject, nil, ""}, + {String("a1"), nil, "/a1"}, + {String("b1"), nil, "/a1"}, + {String("c1"), nil, "/c1"}, + {Value(` "d` + "\xff" + `1" `), E(jsonwire.ErrInvalidUTF8).withPos(`{"a1":"b1":"c1": "d`, "/c1"), "/c1"}, + {String(`d` + "\xff" + `1`), E(jsonwire.ErrInvalidUTF8).withPos(`{"a1":"b1":"c1":`, "/c1"), "/c1"}, + }, + wantOut: `{"a1":"b1","c1"`, +}, { + name: jsontest.Name("ErrorPosition/a1/a2-"), + calls: []encoderMethodCall{ + {Value(` { "a1" : { "a` + "\xff" + `2" : "b2" } } `), E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : { "a`, "/a1"), ""}, + {BeginObject, nil, ""}, + {String("a1"), nil, "/a1"}, + {Value(` { "a` + "\xff" + `2" : "b2" } `), E(jsonwire.ErrInvalidUTF8).withPos(`{"a1": { "a`, "/a1"), ""}, + {BeginObject, nil, "/a1"}, + {Value(` "a` + "\xff" + `2" `), E(jsonwire.ErrInvalidUTF8).withPos(`{"a1":{ "a`, "/a1"), "/a1"}, + {String(`a` + "\xff" + `2`), E(jsonwire.ErrInvalidUTF8).withPos(`{"a1":{`, "/a1"), "/a1"}, + }, + wantOut: `{"a1":{`, +}, { + name: jsontest.Name("ErrorPosition/a1/a2"), + calls: []encoderMethodCall{ + {Value(` { "a1" : { "a2" : "b` + "\xff" + `2" } } `), E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : { "a2" : "b`, "/a1/a2"), ""}, + {BeginObject, nil, ""}, + {String("a1"), nil, "/a1"}, + {Value(` { "a2" : "b` + "\xff" + `2" } `), E(jsonwire.ErrInvalidUTF8).withPos(`{"a1": { "a2" : "b`, "/a1/a2"), ""}, + {BeginObject, nil, "/a1"}, + {String("a2"), nil, "/a1/a2"}, + {Value(` "b` + "\xff" + `2" `), E(jsonwire.ErrInvalidUTF8).withPos(`{"a1":{"a2": "b`, "/a1/a2"), "/a1/a2"}, + {String(`b` + "\xff" + `2`), E(jsonwire.ErrInvalidUTF8).withPos(`{"a1":{"a2":`, "/a1/a2"), "/a1/a2"}, + }, + wantOut: `{"a1":{"a2"`, +}, { + name: jsontest.Name("ErrorPosition/a1/c2-"), + calls: []encoderMethodCall{ + {Value(` { "a1" : { "a2" : "b2" , "c` + "\xff" + `2" : "d2" } } `), E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : { "a2" : "b2" , "c`, "/a1"), ""}, + {BeginObject, nil, ""}, + {String("a1"), nil, "/a1"}, + {BeginObject, nil, "/a1"}, + {String("a2"), nil, "/a1/a2"}, + {String("b2"), nil, "/a1/a2"}, + {Value(` "c` + "\xff" + `2" `), E(jsonwire.ErrInvalidUTF8).withPos(`{"a1":{"a2":"b2", "c`, "/a1"), "/a1/a2"}, + {String(`c` + "\xff" + `2`), E(jsonwire.ErrInvalidUTF8).withPos(`{"a1":{"a2":"b2",`, "/a1"), "/a1/a2"}, + }, + wantOut: `{"a1":{"a2":"b2"`, +}, { + name: jsontest.Name("ErrorPosition/a1/c2"), + calls: []encoderMethodCall{ + {Value(` { "a1" : { "a2" : "b2" , "c2" : "d` + "\xff" + `2" } } `), E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : { "a2" : "b2" , "c2" : "d`, "/a1/c2"), ""}, + {BeginObject, nil, ""}, + {String("a1"), nil, "/a1"}, + {Value(` { "a2" : "b2" , "c2" : "d` + "\xff" + `2" } `), E(jsonwire.ErrInvalidUTF8).withPos(`{"a1": { "a2" : "b2" , "c2" : "d`, "/a1/c2"), ""}, + {BeginObject, nil, ""}, + {String("a2"), nil, "/a1/a2"}, + {String("b2"), nil, "/a1/a2"}, + {String("c2"), nil, "/a1/c2"}, + {Value(` "d` + "\xff" + `2" `), E(jsonwire.ErrInvalidUTF8).withPos(`{"a1":{"a2":"b2","c2": "d`, "/a1/c2"), "/a1/c2"}, + {String(`d` + "\xff" + `2`), E(jsonwire.ErrInvalidUTF8).withPos(`{"a1":{"a2":"b2","c2":`, "/a1/c2"), "/a1/c2"}, + }, + wantOut: `{"a1":{"a2":"b2","c2"`, +}, { + name: jsontest.Name("ErrorPosition/1/a2"), + calls: []encoderMethodCall{ + {Value(` [ "a1" , { "a2" : "b` + "\xff" + `2" } ] `), E(jsonwire.ErrInvalidUTF8).withPos(` [ "a1" , { "a2" : "b`, "/1/a2"), ""}, + {BeginArray, nil, ""}, + {String("a1"), nil, "/0"}, + {Value(` { "a2" : "b` + "\xff" + `2" } `), E(jsonwire.ErrInvalidUTF8).withPos(`["a1", { "a2" : "b`, "/1/a2"), ""}, + {BeginObject, nil, "/1"}, + {String("a2"), nil, "/1/a2"}, + {Value(` "b` + "\xff" + `2" `), E(jsonwire.ErrInvalidUTF8).withPos(`["a1",{"a2": "b`, "/1/a2"), "/1/a2"}, + {String(`b` + "\xff" + `2`), E(jsonwire.ErrInvalidUTF8).withPos(`["a1",{"a2":`, "/1/a2"), "/1/a2"}, + }, + wantOut: `["a1",{"a2"`, +}, { + name: jsontest.Name("ErrorPosition/c1/1"), + calls: []encoderMethodCall{ + {Value(` { "a1" : "b1" , "c1" : [ "a2" , "b` + "\xff" + `2" ] } `), E(jsonwire.ErrInvalidUTF8).withPos(` { "a1" : "b1" , "c1" : [ "a2" , "b`, "/c1/1"), ""}, + {BeginObject, nil, ""}, + {String("a1"), nil, "/a1"}, + {String("b1"), nil, "/a1"}, + {String("c1"), nil, "/c1"}, + {Value(` [ "a2" , "b` + "\xff" + `2" ] `), E(jsonwire.ErrInvalidUTF8).withPos(`{"a1":"b1","c1": [ "a2" , "b`, "/c1/1"), ""}, + {BeginArray, nil, "/c1"}, + {String("a2"), nil, "/c1/0"}, + {Value(` "b` + "\xff" + `2" `), E(jsonwire.ErrInvalidUTF8).withPos(`{"a1":"b1","c1":["a2", "b`, "/c1/1"), "/c1/0"}, + {String(`b` + "\xff" + `2`), E(jsonwire.ErrInvalidUTF8).withPos(`{"a1":"b1","c1":["a2",`, "/c1/1"), "/c1/0"}, + }, + wantOut: `{"a1":"b1","c1":["a2"`, +}, { + name: jsontest.Name("ErrorPosition/0/a1/1/c3/1"), + calls: []encoderMethodCall{ + {Value(` [ { "a1" : [ "a2" , { "a3" : "b3" , "c3" : [ "a4" , "b` + "\xff" + `4" ] } ] } ] `), E(jsonwire.ErrInvalidUTF8).withPos(` [ { "a1" : [ "a2" , { "a3" : "b3" , "c3" : [ "a4" , "b`, "/0/a1/1/c3/1"), ""}, + {BeginArray, nil, ""}, + {Value(` { "a1" : [ "a2" , { "a3" : "b3" , "c3" : [ "a4" , "b` + "\xff" + `4" ] } ] } `), E(jsonwire.ErrInvalidUTF8).withPos(`[ { "a1" : [ "a2" , { "a3" : "b3" , "c3" : [ "a4" , "b`, "/0/a1/1/c3/1"), ""}, + {BeginObject, nil, "/0"}, + {String("a1"), nil, "/0/a1"}, + {Value(` [ "a2" , { "a3" : "b3" , "c3" : [ "a4" , "b` + "\xff" + `4" ] } ] `), E(jsonwire.ErrInvalidUTF8).withPos(`[{"a1": [ "a2" , { "a3" : "b3" , "c3" : [ "a4" , "b`, "/0/a1/1/c3/1"), ""}, + {BeginArray, nil, ""}, + {String("a2"), nil, "/0/a1/0"}, + {Value(` { "a3" : "b3" , "c3" : [ "a4" , "b` + "\xff" + `4" ] } `), E(jsonwire.ErrInvalidUTF8).withPos(`[{"a1":["a2", { "a3" : "b3" , "c3" : [ "a4" , "b`, "/0/a1/1/c3/1"), ""}, + {BeginObject, nil, "/0/a1/1"}, + {String("a3"), nil, "/0/a1/1/a3"}, + {String("b3"), nil, "/0/a1/1/a3"}, + {String("c3"), nil, "/0/a1/1/c3"}, + {Value(` [ "a4" , "b` + "\xff" + `4" ] `), E(jsonwire.ErrInvalidUTF8).withPos(`[{"a1":["a2",{"a3":"b3","c3": [ "a4" , "b`, "/0/a1/1/c3/1"), ""}, + {BeginArray, nil, "/0/a1/1/c3"}, + {String("a4"), nil, "/0/a1/1/c3/0"}, + {Value(` "b` + "\xff" + `4" `), E(jsonwire.ErrInvalidUTF8).withPos(`[{"a1":["a2",{"a3":"b3","c3":["a4", "b`, "/0/a1/1/c3/1"), "/0/a1/1/c3/0"}, + {String(`b` + "\xff" + `4`), E(jsonwire.ErrInvalidUTF8).withPos(`[{"a1":["a2",{"a3":"b3","c3":["a4",`, "/0/a1/1/c3/1"), "/0/a1/1/c3/0"}, + }, + wantOut: `[{"a1":["a2",{"a3":"b3","c3":["a4"`, +}} + +// TestEncoderErrors test that Encoder errors occur when we expect and +// leaves the Encoder in a consistent state. +func TestEncoderErrors(t *testing.T) { + for _, td := range encoderErrorTestdata { + t.Run(path.Join(td.name.Name), func(t *testing.T) { + testEncoderErrors(t, td.name.Where, td.opts, td.calls, td.wantOut) + }) + } +} +func testEncoderErrors(t *testing.T, where jsontest.CasePos, opts []Options, calls []encoderMethodCall, wantOut string) { + dst := new(bytes.Buffer) + enc := NewEncoder(dst, opts...) + for i, call := range calls { + var gotErr error + switch tokVal := call.in.(type) { + case Token: + gotErr = enc.WriteToken(tokVal) + case Value: + gotErr = enc.WriteValue(tokVal) + } + if !equalError(gotErr, call.wantErr) { + t.Fatalf("%s: %d: error mismatch:\ngot %v\nwant %v", where, i, gotErr, call.wantErr) + } + if call.wantPointer != "" { + gotPointer := enc.StackPointer() + if gotPointer != call.wantPointer { + t.Fatalf("%s: %d: Encoder.StackPointer = %s, want %s", where, i, gotPointer, call.wantPointer) + } + } + } + gotOut := dst.String() + string(enc.s.unflushedBuffer()) + if gotOut != wantOut { + t.Fatalf("%s: output mismatch:\ngot %q\nwant %q", where, gotOut, wantOut) + } + gotOffset := int(enc.OutputOffset()) + wantOffset := len(wantOut) + if gotOffset != wantOffset { + t.Fatalf("%s: Encoder.OutputOffset = %v, want %v", where, gotOffset, wantOffset) + } +} + +// TestEncoderReset tests that the encoder preserves its internal +// buffer between Reset calls to avoid frequent allocations when reusing the encoder. +// It ensures that the buffer capacity is maintained while avoiding aliasing +// issues with [bytes.Buffer]. +func TestEncoderReset(t *testing.T) { + // Create an encoder with a reasonably large JSON input to ensure buffer growth. + largeJSON := `{"key1":"value1","key2":"value2","key3":"value3","key4":"value4","key5":"value5"}` + "\n" + bb := new(bytes.Buffer) + enc := NewEncoder(struct{ io.Writer }{bb}) // mask out underlying [bytes.Buffer] + + t.Run("Test capacity preservation", func(t *testing.T) { + // Write the first JSON value to grow the internal buffer. + err := enc.WriteValue(append(enc.AvailableBuffer(), largeJSON...)) + if err != nil { + t.Fatalf("first WriteValue failed: %v", err) + } + if bb.String() != largeJSON { + t.Fatalf("first WriteValue = %q, want %q", bb.String(), largeJSON) + } + + // Get the buffer capacity after first use. + initialCapacity := cap(enc.s.Buf) + initialCacheCapacity := cap(enc.s.availBuffer) + if initialCapacity == 0 { + t.Fatalf("expected non-zero buffer capacity after first use") + } + if initialCacheCapacity == 0 { + t.Fatalf("expected non-zero cache capacity after first use") + } + + // Reset with a new writer - this should preserve the buffer capacity. + bb.Reset() + enc.Reset(struct{ io.Writer }{bb}) + + // Verify the buffer capacity is preserved (or at least not smaller). + preservedCapacity := cap(enc.s.Buf) + if preservedCapacity < initialCapacity { + t.Fatalf("buffer capacity reduced after Reset: got %d, want at least %d", preservedCapacity, initialCapacity) + } + preservedCacheCapacity := cap(enc.s.availBuffer) + if preservedCacheCapacity < initialCacheCapacity { + t.Fatalf("cache capacity reduced after Reset: got %d, want at least %d", preservedCapacity, initialCapacity) + } + + // Write the second JSON value to ensure the encoder still works correctly. + err = enc.WriteValue(append(enc.AvailableBuffer(), largeJSON...)) + if err != nil { + t.Fatalf("second WriteValue failed: %v", err) + } + if bb.String() != largeJSON { + t.Fatalf("second WriteValue = %q, want %q", bb.String(), largeJSON) + } + }) + + t.Run("Test aliasing with bytes.Buffer", func(t *testing.T) { + // Test with bytes.Buffer to verify proper aliasing behavior. + bb.Reset() + enc.Reset(bb) + + // Write the third JSON value to ensure functionality with bytes.Buffer. + err := enc.WriteValue([]byte(largeJSON)) + if err != nil { + t.Fatalf("fourth WriteValue failed: %v", err) + } + if bb.String() != largeJSON { + t.Fatalf("fourth WriteValue = %q, want %q", bb.String(), largeJSON) + } + // The encoder buffer should alias bytes.Buffer's internal buffer. + if cap(enc.s.Buf) == 0 || cap(bb.AvailableBuffer()) == 0 || &enc.s.Buf[:1][0] != &bb.AvailableBuffer()[:1][0] { + t.Fatalf("encoder buffer does not alias bytes.Buffer") + } + }) + + t.Run("Test aliasing removed after Reset", func(t *testing.T) { + // Reset with a new reader and verify the buffer is not aliased. + bb.Reset() + enc.Reset(struct{ io.Writer }{bb}) + err := enc.WriteValue([]byte(largeJSON)) + if err != nil { + t.Fatalf("fifth WriteValue failed: %v", err) + } + if bb.String() != largeJSON { + t.Fatalf("fourth WriteValue = %q, want %q", bb.String(), largeJSON) + } + + // The encoder buffer should not alias the bytes.Buffer's internal buffer. + if cap(enc.s.Buf) == 0 || cap(bb.AvailableBuffer()) == 0 || &enc.s.Buf[:1][0] == &bb.AvailableBuffer()[:1][0] { + t.Fatalf("encoder buffer aliases bytes.Buffer") + } + }) +} diff --git a/go/src/encoding/json/jsontext/errors.go b/go/src/encoding/json/jsontext/errors.go new file mode 100644 index 0000000000000000000000000000000000000000..4b95d03f409e2e9e00acef7033398b6c209bcf93 --- /dev/null +++ b/go/src/encoding/json/jsontext/errors.go @@ -0,0 +1,182 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsontext + +import ( + "bytes" + "io" + "strconv" + + "encoding/json/internal/jsonwire" +) + +const errorPrefix = "jsontext: " + +type ioError struct { + action string // either "read" or "write" + err error +} + +func (e *ioError) Error() string { + return errorPrefix + e.action + " error: " + e.err.Error() +} +func (e *ioError) Unwrap() error { + return e.err +} + +// SyntacticError is a description of a syntactic error that occurred when +// encoding or decoding JSON according to the grammar. +// +// The contents of this error as produced by this package may change over time. +type SyntacticError struct { + requireKeyedLiterals + nonComparable + + // ByteOffset indicates that an error occurred after this byte offset. + ByteOffset int64 + // JSONPointer indicates that an error occurred within this JSON value + // as indicated using the JSON Pointer notation (see RFC 6901). + JSONPointer Pointer + + // Err is the underlying error. + Err error +} + +// wrapSyntacticError wraps an error and annotates it with a precise location +// using the provided [encoderState] or [decoderState]. +// If err is an [ioError] or [io.EOF], then it is not wrapped. +// +// It takes a relative offset pos that can be resolved into +// an absolute offset using state.offsetAt. +// +// It takes a where that specify how the JSON pointer is derived. +// If the underlying error is a [pointerSuffixError], +// then the suffix is appended to the derived pointer. +func wrapSyntacticError(state interface { + offsetAt(pos int) int64 + AppendStackPointer(b []byte, where int) []byte +}, err error, pos, where int) error { + if _, ok := err.(*ioError); err == io.EOF || ok { + return err + } + offset := state.offsetAt(pos) + ptr := state.AppendStackPointer(nil, where) + if serr, ok := err.(*pointerSuffixError); ok { + ptr = serr.appendPointer(ptr) + err = serr.error + } + if d, ok := state.(*decoderState); ok && err == errMismatchDelim { + where := "at start of value" + if len(d.Tokens.Stack) > 0 && d.Tokens.Last.Length() > 0 { + switch { + case d.Tokens.Last.isArray(): + where = "after array element (expecting ',' or ']')" + ptr = []byte(Pointer(ptr).Parent()) // problem is with parent array + case d.Tokens.Last.isObject(): + where = "after object value (expecting ',' or '}')" + ptr = []byte(Pointer(ptr).Parent()) // problem is with parent object + } + } + err = jsonwire.NewInvalidCharacterError(d.buf[pos:], where) + } + return &SyntacticError{ByteOffset: offset, JSONPointer: Pointer(ptr), Err: err} +} + +func (e *SyntacticError) Error() string { + pointer := e.JSONPointer + offset := e.ByteOffset + b := []byte(errorPrefix) + if e.Err != nil { + b = append(b, e.Err.Error()...) + if e.Err == ErrDuplicateName { + b = strconv.AppendQuote(append(b, ' '), pointer.LastToken()) + pointer = pointer.Parent() + offset = 0 // not useful to print offset for duplicate names + } + } else { + b = append(b, "syntactic error"...) + } + if pointer != "" { + b = strconv.AppendQuote(append(b, " within "...), jsonwire.TruncatePointer(string(pointer), 100)) + } + if offset > 0 { + b = strconv.AppendInt(append(b, " after offset "...), offset, 10) + } + return string(b) +} + +func (e *SyntacticError) Unwrap() error { + return e.Err +} + +// pointerSuffixError represents a JSON pointer suffix to be appended +// to [SyntacticError.JSONPointer]. It is an internal error type +// used within this package and does not appear in the public API. +// +// This type is primarily used to annotate errors in Encoder.WriteValue +// and Decoder.ReadValue with precise positions. +// At the time WriteValue or ReadValue is called, a JSON pointer to the +// upcoming value can be constructed using the Encoder/Decoder state. +// However, tracking pointers within values during normal operation +// would incur a performance penalty in the error-free case. +// +// To provide precise error locations without this overhead, +// the error is wrapped with object names or array indices +// as the call stack is popped when an error occurs. +// Since this happens in reverse order, pointerSuffixError holds +// the pointer in reverse and is only later reversed when appending to +// the pointer prefix. +// +// For example, if the encoder is at "/alpha/bravo/charlie" +// and an error occurs in WriteValue at "/xray/yankee/zulu", then +// the final pointer should be "/alpha/bravo/charlie/xray/yankee/zulu". +// +// As pointerSuffixError is populated during the error return path, +// it first contains "/zulu", then "/zulu/yankee", +// and finally "/zulu/yankee/xray". +// These tokens are reversed and concatenated to "/alpha/bravo/charlie" +// to form the full pointer. +type pointerSuffixError struct { + error + + // reversePointer is a JSON pointer, but with each token in reverse order. + reversePointer []byte +} + +// wrapWithObjectName wraps err with a JSON object name access, +// which must be a valid quoted JSON string. +func wrapWithObjectName(err error, quotedName []byte) error { + serr, _ := err.(*pointerSuffixError) + if serr == nil { + serr = &pointerSuffixError{error: err} + } + name := jsonwire.UnquoteMayCopy(quotedName, false) + serr.reversePointer = appendEscapePointerName(append(serr.reversePointer, '/'), name) + return serr +} + +// wrapWithArrayIndex wraps err with a JSON array index access. +func wrapWithArrayIndex(err error, index int64) error { + serr, _ := err.(*pointerSuffixError) + if serr == nil { + serr = &pointerSuffixError{error: err} + } + serr.reversePointer = strconv.AppendUint(append(serr.reversePointer, '/'), uint64(index), 10) + return serr +} + +// appendPointer appends the path encoded in e to the end of pointer. +func (e *pointerSuffixError) appendPointer(pointer []byte) []byte { + // Copy each token in reversePointer to the end of pointer in reverse order. + // Double reversal means that the appended suffix is now in forward order. + bi, bo := e.reversePointer, pointer + for len(bi) > 0 { + i := bytes.LastIndexByte(bi, '/') + bi, bo = bi[:i], append(bo, bi[i:]...) + } + return bo +} diff --git a/go/src/encoding/json/jsontext/example_test.go b/go/src/encoding/json/jsontext/example_test.go new file mode 100644 index 0000000000000000000000000000000000000000..4bf6a7ae5aef0b2e3893a3b16bb832781aa521b6 --- /dev/null +++ b/go/src/encoding/json/jsontext/example_test.go @@ -0,0 +1,130 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsontext_test + +import ( + "bytes" + "fmt" + "io" + "log" + "strings" + + "encoding/json/jsontext" + "encoding/json/v2" +) + +// This example demonstrates the use of the [Encoder] and [Decoder] to +// parse and modify JSON without unmarshaling it into a concrete Go type. +func Example_stringReplace() { + // Example input with non-idiomatic use of "Golang" instead of "Go". + const input = `{ + "title": "Golang version 1 is released", + "author": "Andrew Gerrand", + "date": "2012-03-28", + "text": "Today marks a major milestone in the development of the Golang programming language.", + "otherArticles": [ + "Twelve Years of Golang", + "The Laws of Reflection", + "Learn Golang from your browser" + ] + }` + + // Using a Decoder and Encoder, we can parse through every token, + // check and modify the token if necessary, and + // write the token to the output. + var replacements []jsontext.Pointer + in := strings.NewReader(input) + dec := jsontext.NewDecoder(in) + out := new(bytes.Buffer) + enc := jsontext.NewEncoder(out, jsontext.Multiline(true)) // expand for readability + for { + // Read a token from the input. + tok, err := dec.ReadToken() + if err != nil { + if err == io.EOF { + break + } + log.Fatal(err) + } + + // Check whether the token contains the string "Golang" and + // replace each occurrence with "Go" instead. + if tok.Kind() == '"' && strings.Contains(tok.String(), "Golang") { + replacements = append(replacements, dec.StackPointer()) + tok = jsontext.String(strings.ReplaceAll(tok.String(), "Golang", "Go")) + } + + // Write the (possibly modified) token to the output. + if err := enc.WriteToken(tok); err != nil { + log.Fatal(err) + } + } + + // Print the list of replacements and the adjusted JSON output. + if len(replacements) > 0 { + fmt.Println(`Replaced "Golang" with "Go" in:`) + for _, where := range replacements { + fmt.Println("\t" + where) + } + fmt.Println() + } + fmt.Println("Result:", out.String()) + + // Output: + // Replaced "Golang" with "Go" in: + // /title + // /text + // /otherArticles/0 + // /otherArticles/2 + // + // Result: { + // "title": "Go version 1 is released", + // "author": "Andrew Gerrand", + // "date": "2012-03-28", + // "text": "Today marks a major milestone in the development of the Go programming language.", + // "otherArticles": [ + // "Twelve Years of Go", + // "The Laws of Reflection", + // "Learn Go from your browser" + // ] + // } +} + +// Directly embedding JSON within HTML requires special handling for safety. +// Escape certain runes to prevent JSON directly treated as HTML +// from being able to perform `, + } + + b, err := json.Marshal(&page, + // Escape certain runes within a JSON string so that + // JSON will be safe to directly embed inside HTML. + jsontext.EscapeForHTML(true), + jsontext.EscapeForJS(true), + jsontext.Multiline(true)) // expand for readability + if err != nil { + log.Fatal(err) + } + fmt.Println(string(b)) + + // Output: + // { + // "Title": "Example Embedded Javascript", + // "Body": "\u003cscript\u003e console.log(\"Hello, world!\"); \u003c/script\u003e" + // } +} diff --git a/go/src/encoding/json/jsontext/export.go b/go/src/encoding/json/jsontext/export.go new file mode 100644 index 0000000000000000000000000000000000000000..0ecccad5b3c67152adbbf700c90594c1442841de --- /dev/null +++ b/go/src/encoding/json/jsontext/export.go @@ -0,0 +1,77 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsontext + +import ( + "io" + + "encoding/json/internal" +) + +// Internal is for internal use only. +// This is exempt from the Go compatibility agreement. +var Internal exporter + +type exporter struct{} + +// Export exposes internal functionality from "jsontext" to "json". +// This cannot be dynamically called by other packages since +// they cannot obtain a reference to the internal.AllowInternalUse value. +func (exporter) Export(p *internal.NotForPublicUse) export { + if p != &internal.AllowInternalUse { + panic("unauthorized call to Export") + } + return export{} +} + +// The export type exposes functionality to packages with visibility to +// the internal.AllowInternalUse variable. The "json" package uses this +// to modify low-level state in the Encoder and Decoder types. +// It mutates the state directly instead of calling ReadToken or WriteToken +// since this is more performant. The public APIs need to track state to ensure +// that users are constructing a valid JSON value, but the "json" implementation +// guarantees that it emits valid JSON by the structure of the code itself. +type export struct{} + +// Encoder returns a pointer to the underlying encoderState. +func (export) Encoder(e *Encoder) *encoderState { return &e.s } + +// Decoder returns a pointer to the underlying decoderState. +func (export) Decoder(d *Decoder) *decoderState { return &d.s } + +func (export) GetBufferedEncoder(o ...Options) *Encoder { + return getBufferedEncoder(o...) +} +func (export) PutBufferedEncoder(e *Encoder) { + putBufferedEncoder(e) +} + +func (export) GetStreamingEncoder(w io.Writer, o ...Options) *Encoder { + return getStreamingEncoder(w, o...) +} +func (export) PutStreamingEncoder(e *Encoder) { + putStreamingEncoder(e) +} + +func (export) GetBufferedDecoder(b []byte, o ...Options) *Decoder { + return getBufferedDecoder(b, o...) +} +func (export) PutBufferedDecoder(d *Decoder) { + putBufferedDecoder(d) +} + +func (export) GetStreamingDecoder(r io.Reader, o ...Options) *Decoder { + return getStreamingDecoder(r, o...) +} +func (export) PutStreamingDecoder(d *Decoder) { + putStreamingDecoder(d) +} + +func (export) IsIOError(err error) bool { + _, ok := err.(*ioError) + return ok +} diff --git a/go/src/encoding/json/jsontext/fuzz_test.go b/go/src/encoding/json/jsontext/fuzz_test.go new file mode 100644 index 0000000000000000000000000000000000000000..3ad181d43416b890369443c0b8ca105b65d95ed7 --- /dev/null +++ b/go/src/encoding/json/jsontext/fuzz_test.go @@ -0,0 +1,237 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsontext + +import ( + "bytes" + "errors" + "io" + "math/rand" + "slices" + "testing" + + "encoding/json/internal/jsontest" +) + +func FuzzCoder(f *testing.F) { + // Add a number of inputs to the corpus including valid and invalid data. + for _, td := range coderTestdata { + f.Add(int64(0), []byte(td.in)) + } + for _, td := range decoderErrorTestdata { + f.Add(int64(0), []byte(td.in)) + } + for _, td := range encoderErrorTestdata { + f.Add(int64(0), []byte(td.wantOut)) + } + for _, td := range jsontest.Data { + f.Add(int64(0), td.Data()) + } + + f.Fuzz(func(t *testing.T, seed int64, b []byte) { + var tokVals []tokOrVal + rn := rand.NewSource(seed) + + // Read a sequence of tokens or values. Skip the test for any errors + // since we expect this with randomly generated fuzz inputs. + src := bytes.NewReader(b) + dec := NewDecoder(src) + for { + if rn.Int63()%8 > 0 { + tok, err := dec.ReadToken() + if err != nil { + if err == io.EOF { + break + } + t.Skipf("Decoder.ReadToken error: %v", err) + } + tokVals = append(tokVals, tok.Clone()) + } else { + val, err := dec.ReadValue() + if err != nil { + if expectError := dec.PeekKind() == '}' || dec.PeekKind() == ']'; expectError { + if _, ok := errors.AsType[*SyntacticError](err); ok { + continue + } + } + if err == io.EOF { + break + } + t.Skipf("Decoder.ReadValue error: %v", err) + } + tokVals = append(tokVals, append(zeroValue, val...)) + } + } + + // Write a sequence of tokens or values. Fail the test for any errors + // since the previous stage guarantees that the input is valid. + dst := new(bytes.Buffer) + enc := NewEncoder(dst) + for _, tokVal := range tokVals { + switch tokVal := tokVal.(type) { + case Token: + if err := enc.WriteToken(tokVal); err != nil { + t.Fatalf("Encoder.WriteToken error: %v", err) + } + case Value: + if err := enc.WriteValue(tokVal); err != nil { + t.Fatalf("Encoder.WriteValue error: %v", err) + } + } + } + + // Encoded output and original input must decode to the same thing. + var got, want []Token + for dec := NewDecoder(bytes.NewReader(b)); dec.PeekKind() > 0; { + tok, err := dec.ReadToken() + if err != nil { + t.Fatalf("Decoder.ReadToken error: %v", err) + } + got = append(got, tok.Clone()) + } + for dec := NewDecoder(dst); dec.PeekKind() > 0; { + tok, err := dec.ReadToken() + if err != nil { + t.Fatalf("Decoder.ReadToken error: %v", err) + } + want = append(want, tok.Clone()) + } + if !equalTokens(got, want) { + t.Fatalf("mismatching output:\ngot %v\nwant %v", got, want) + } + }) +} + +func FuzzResumableDecoder(f *testing.F) { + for _, td := range resumableDecoderTestdata { + f.Add(int64(0), []byte(td)) + } + + f.Fuzz(func(t *testing.T, seed int64, b []byte) { + rn := rand.NewSource(seed) + + // Regardless of how many bytes the underlying io.Reader produces, + // the provided tokens, values, and errors should always be identical. + t.Run("ReadToken", func(t *testing.T) { + decGot := NewDecoder(&FaultyBuffer{B: b, MaxBytes: 8, Rand: rn}) + decWant := NewDecoder(bytes.NewReader(b)) + gotTok, gotErr := decGot.ReadToken() + wantTok, wantErr := decWant.ReadToken() + if gotTok.String() != wantTok.String() || !equalError(gotErr, wantErr) { + t.Errorf("Decoder.ReadToken = (%v, %v), want (%v, %v)", gotTok, gotErr, wantTok, wantErr) + } + }) + t.Run("ReadValue", func(t *testing.T) { + decGot := NewDecoder(&FaultyBuffer{B: b, MaxBytes: 8, Rand: rn}) + decWant := NewDecoder(bytes.NewReader(b)) + gotVal, gotErr := decGot.ReadValue() + wantVal, wantErr := decWant.ReadValue() + if !slices.Equal(gotVal, wantVal) || !equalError(gotErr, wantErr) { + t.Errorf("Decoder.ReadValue = (%s, %v), want (%s, %v)", gotVal, gotErr, wantVal, wantErr) + } + }) + }) +} + +func FuzzValueFormat(f *testing.F) { + for _, td := range valueTestdata { + f.Add(int64(0), []byte(td.in)) + } + + // isValid reports whether b is valid according to the specified options. + isValid := func(b []byte, opts ...Options) bool { + d := NewDecoder(bytes.NewReader(b), opts...) + _, errVal := d.ReadValue() + _, errEOF := d.ReadToken() + return errVal == nil && errEOF == io.EOF + } + + // stripWhitespace removes all JSON whitespace characters from the input. + stripWhitespace := func(in []byte) (out []byte) { + out = make([]byte, 0, len(in)) + for _, c := range in { + switch c { + case ' ', '\n', '\r', '\t': + default: + out = append(out, c) + } + } + return out + } + + allOptions := []Options{ + AllowDuplicateNames(true), + AllowInvalidUTF8(true), + EscapeForHTML(true), + EscapeForJS(true), + PreserveRawStrings(true), + CanonicalizeRawInts(true), + CanonicalizeRawFloats(true), + ReorderRawObjects(true), + SpaceAfterColon(true), + SpaceAfterComma(true), + Multiline(true), + WithIndent("\t"), + WithIndentPrefix(" "), + } + + f.Fuzz(func(t *testing.T, seed int64, b []byte) { + validRFC7159 := isValid(b, AllowInvalidUTF8(true), AllowDuplicateNames(true)) + validRFC8259 := isValid(b, AllowInvalidUTF8(false), AllowDuplicateNames(true)) + validRFC7493 := isValid(b, AllowInvalidUTF8(false), AllowDuplicateNames(false)) + switch { + case !validRFC7159 && validRFC8259: + t.Errorf("invalid input per RFC 7159 implies invalid per RFC 8259") + case !validRFC8259 && validRFC7493: + t.Errorf("invalid input per RFC 8259 implies invalid per RFC 7493") + } + + gotValid := Value(b).IsValid() + wantValid := validRFC7493 + if gotValid != wantValid { + t.Errorf("Value.IsValid = %v, want %v", gotValid, wantValid) + } + + gotCompacted := Value(string(b)) + gotCompactOk := gotCompacted.Compact() == nil + wantCompactOk := validRFC7159 + if !bytes.Equal(stripWhitespace(gotCompacted), stripWhitespace(b)) { + t.Errorf("stripWhitespace(Value.Compact) = %s, want %s", stripWhitespace(gotCompacted), stripWhitespace(b)) + } + if gotCompactOk != wantCompactOk { + t.Errorf("Value.Compact success mismatch: got %v, want %v", gotCompactOk, wantCompactOk) + } + + gotIndented := Value(string(b)) + gotIndentOk := gotIndented.Indent() == nil + wantIndentOk := validRFC7159 + if !bytes.Equal(stripWhitespace(gotIndented), stripWhitespace(b)) { + t.Errorf("stripWhitespace(Value.Indent) = %s, want %s", stripWhitespace(gotIndented), stripWhitespace(b)) + } + if gotIndentOk != wantIndentOk { + t.Errorf("Value.Indent success mismatch: got %v, want %v", gotIndentOk, wantIndentOk) + } + + gotCanonicalized := Value(string(b)) + gotCanonicalizeOk := gotCanonicalized.Canonicalize() == nil + wantCanonicalizeOk := validRFC7493 + if gotCanonicalizeOk != wantCanonicalizeOk { + t.Errorf("Value.Canonicalize success mismatch: got %v, want %v", gotCanonicalizeOk, wantCanonicalizeOk) + } + + // Random options should not result in a panic. + var opts []Options + rn := rand.New(rand.NewSource(seed)) + for _, opt := range allOptions { + if rn.Intn(len(allOptions)/4) == 0 { + opts = append(opts, opt) + } + } + v := Value(b) + v.Format(opts...) // should not panic + }) +} diff --git a/go/src/encoding/json/jsontext/options.go b/go/src/encoding/json/jsontext/options.go new file mode 100644 index 0000000000000000000000000000000000000000..7eb4f9b9e048a830e9022e142ac7a88a67447710 --- /dev/null +++ b/go/src/encoding/json/jsontext/options.go @@ -0,0 +1,304 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsontext + +import ( + "strings" + + "encoding/json/internal/jsonflags" + "encoding/json/internal/jsonopts" + "encoding/json/internal/jsonwire" +) + +// Options configures [NewEncoder], [Encoder.Reset], [NewDecoder], +// and [Decoder.Reset] with specific features. +// Each function takes in a variadic list of options, where properties +// set in latter options override the value of previously set properties. +// +// There is a single Options type, which is used with both encoding and decoding. +// Some options affect both operations, while others only affect one operation: +// +// - [AllowDuplicateNames] affects encoding and decoding +// - [AllowInvalidUTF8] affects encoding and decoding +// - [EscapeForHTML] affects encoding only +// - [EscapeForJS] affects encoding only +// - [PreserveRawStrings] affects encoding only +// - [CanonicalizeRawInts] affects encoding only +// - [CanonicalizeRawFloats] affects encoding only +// - [ReorderRawObjects] affects encoding only +// - [SpaceAfterColon] affects encoding only +// - [SpaceAfterComma] affects encoding only +// - [Multiline] affects encoding only +// - [WithIndent] affects encoding only +// - [WithIndentPrefix] affects encoding only +// +// Options that do not affect a particular operation are ignored. +// +// The Options type is identical to [encoding/json.Options] and +// [encoding/json/v2.Options]. Options from the other packages may +// be passed to functionality in this package, but are ignored. +// Options from this package may be used with the other packages. +type Options = jsonopts.Options + +// AllowDuplicateNames specifies that JSON objects may contain +// duplicate member names. Disabling the duplicate name check may provide +// performance benefits, but breaks compliance with RFC 7493, section 2.3. +// The input or output will still be compliant with RFC 8259, +// which leaves the handling of duplicate names as unspecified behavior. +// +// This affects either encoding or decoding. +func AllowDuplicateNames(v bool) Options { + if v { + return jsonflags.AllowDuplicateNames | 1 + } else { + return jsonflags.AllowDuplicateNames | 0 + } +} + +// AllowInvalidUTF8 specifies that JSON strings may contain invalid UTF-8, +// which will be mangled as the Unicode replacement character, U+FFFD. +// This causes the encoder or decoder to break compliance with +// RFC 7493, section 2.1, and RFC 8259, section 8.1. +// +// This affects either encoding or decoding. +func AllowInvalidUTF8(v bool) Options { + if v { + return jsonflags.AllowInvalidUTF8 | 1 + } else { + return jsonflags.AllowInvalidUTF8 | 0 + } +} + +// EscapeForHTML specifies that '<', '>', and '&' characters within JSON strings +// should be escaped as a hexadecimal Unicode codepoint (e.g., \u003c) so that +// the output is safe to embed within HTML. +// +// This only affects encoding and is ignored when decoding. +func EscapeForHTML(v bool) Options { + if v { + return jsonflags.EscapeForHTML | 1 + } else { + return jsonflags.EscapeForHTML | 0 + } +} + +// EscapeForJS specifies that U+2028 and U+2029 characters within JSON strings +// should be escaped as a hexadecimal Unicode codepoint (e.g., \u2028) so that +// the output is valid to embed within JavaScript. See RFC 8259, section 12. +// +// This only affects encoding and is ignored when decoding. +func EscapeForJS(v bool) Options { + if v { + return jsonflags.EscapeForJS | 1 + } else { + return jsonflags.EscapeForJS | 0 + } +} + +// PreserveRawStrings specifies that when encoding a raw JSON string in a +// [Token] or [Value], pre-escaped sequences +// in a JSON string are preserved to the output. +// However, raw strings still respect [EscapeForHTML] and [EscapeForJS] +// such that the relevant characters are escaped. +// If [AllowInvalidUTF8] is enabled, bytes of invalid UTF-8 +// are preserved to the output. +// +// This only affects encoding and is ignored when decoding. +func PreserveRawStrings(v bool) Options { + if v { + return jsonflags.PreserveRawStrings | 1 + } else { + return jsonflags.PreserveRawStrings | 0 + } +} + +// CanonicalizeRawInts specifies that when encoding a raw JSON +// integer number (i.e., a number without a fraction and exponent) in a +// [Token] or [Value], the number is canonicalized +// according to RFC 8785, section 3.2.2.3. As a special case, +// the number -0 is canonicalized as 0. +// +// JSON numbers are treated as IEEE 754 double precision numbers. +// Any numbers with precision beyond what is representable by that form +// will lose their precision when canonicalized. For example, +// integer values beyond ±2⁵³ will lose their precision. +// For example, 1234567890123456789 is formatted as 1234567890123456800. +// +// This only affects encoding and is ignored when decoding. +func CanonicalizeRawInts(v bool) Options { + if v { + return jsonflags.CanonicalizeRawInts | 1 + } else { + return jsonflags.CanonicalizeRawInts | 0 + } +} + +// CanonicalizeRawFloats specifies that when encoding a raw JSON +// floating-point number (i.e., a number with a fraction or exponent) in a +// [Token] or [Value], the number is canonicalized +// according to RFC 8785, section 3.2.2.3. As a special case, +// the number -0 is canonicalized as 0. +// +// JSON numbers are treated as IEEE 754 double precision numbers. +// It is safe to canonicalize a serialized single precision number and +// parse it back as a single precision number and expect the same value. +// If a number exceeds ±1.7976931348623157e+308, which is the maximum +// finite number, then it saturated at that value and formatted as such. +// +// This only affects encoding and is ignored when decoding. +func CanonicalizeRawFloats(v bool) Options { + if v { + return jsonflags.CanonicalizeRawFloats | 1 + } else { + return jsonflags.CanonicalizeRawFloats | 0 + } +} + +// ReorderRawObjects specifies that when encoding a raw JSON object in a +// [Value], the object members are reordered according to +// RFC 8785, section 3.2.3. +// +// This only affects encoding and is ignored when decoding. +func ReorderRawObjects(v bool) Options { + if v { + return jsonflags.ReorderRawObjects | 1 + } else { + return jsonflags.ReorderRawObjects | 0 + } +} + +// SpaceAfterColon specifies that the JSON output should emit a space character +// after each colon separator following a JSON object name. +// If false, then no space character appears after the colon separator. +// +// This only affects encoding and is ignored when decoding. +func SpaceAfterColon(v bool) Options { + if v { + return jsonflags.SpaceAfterColon | 1 + } else { + return jsonflags.SpaceAfterColon | 0 + } +} + +// SpaceAfterComma specifies that the JSON output should emit a space character +// after each comma separator following a JSON object value or array element. +// If false, then no space character appears after the comma separator. +// +// This only affects encoding and is ignored when decoding. +func SpaceAfterComma(v bool) Options { + if v { + return jsonflags.SpaceAfterComma | 1 + } else { + return jsonflags.SpaceAfterComma | 0 + } +} + +// Multiline specifies that the JSON output should expand to multiple lines, +// where every JSON object member or JSON array element appears on +// a new, indented line according to the nesting depth. +// +// If [SpaceAfterColon] is not specified, then the default is true. +// If [SpaceAfterComma] is not specified, then the default is false. +// If [WithIndent] is not specified, then the default is "\t". +// +// If set to false, then the output is a single-line, +// where the only whitespace emitted is determined by the current +// values of [SpaceAfterColon] and [SpaceAfterComma]. +// +// This only affects encoding and is ignored when decoding. +func Multiline(v bool) Options { + if v { + return jsonflags.Multiline | 1 + } else { + return jsonflags.Multiline | 0 + } +} + +// WithIndent specifies that the encoder should emit multiline output +// where each element in a JSON object or array begins on a new, indented line +// beginning with the indent prefix (see [WithIndentPrefix]) +// followed by one or more copies of indent according to the nesting depth. +// The indent must only be composed of space or tab characters. +// +// If the intent to emit indented output without a preference for +// the particular indent string, then use [Multiline] instead. +// +// This only affects encoding and is ignored when decoding. +// Use of this option implies [Multiline] being set to true. +func WithIndent(indent string) Options { + // Fast-path: Return a constant for common indents, which avoids allocating. + // These are derived from analyzing the Go module proxy on 2023-07-01. + switch indent { + case "\t": + return jsonopts.Indent("\t") // ~14k usages + case " ": + return jsonopts.Indent(" ") // ~18k usages + case " ": + return jsonopts.Indent(" ") // ~1.7k usages + case " ": + return jsonopts.Indent(" ") // ~52k usages + case " ": + return jsonopts.Indent(" ") // ~12k usages + case "": + return jsonopts.Indent("") // ~1.5k usages + } + + // Otherwise, allocate for this unique value. + if s := strings.Trim(indent, " \t"); len(s) > 0 { + panic("json: invalid character " + jsonwire.QuoteRune(s) + " in indent") + } + return jsonopts.Indent(indent) +} + +// WithIndentPrefix specifies that the encoder should emit multiline output +// where each element in a JSON object or array begins on a new, indented line +// beginning with the indent prefix followed by one or more copies of indent +// (see [WithIndent]) according to the nesting depth. +// The prefix must only be composed of space or tab characters. +// +// This only affects encoding and is ignored when decoding. +// Use of this option implies [Multiline] being set to true. +func WithIndentPrefix(prefix string) Options { + if s := strings.Trim(prefix, " \t"); len(s) > 0 { + panic("json: invalid character " + jsonwire.QuoteRune(s) + " in indent prefix") + } + return jsonopts.IndentPrefix(prefix) +} + +/* +// TODO(https://go.dev/issue/56733): Implement WithByteLimit and WithDepthLimit. +// Remember to also update the "Security Considerations" section. + +// WithByteLimit sets a limit on the number of bytes of input or output bytes +// that may be consumed or produced for each top-level JSON value. +// If a [Decoder] or [Encoder] method call would need to consume/produce +// more than a total of n bytes to make progress on the top-level JSON value, +// then the call will report an error. +// Whitespace before and within the top-level value are counted against the limit. +// Whitespace after a top-level value are counted against the limit +// for the next top-level value. +// +// A non-positive limit is equivalent to no limit at all. +// If unspecified, the default limit is no limit at all. +// This affects either encoding or decoding. +func WithByteLimit(n int64) Options { + return jsonopts.ByteLimit(max(n, 0)) +} + +// WithDepthLimit sets a limit on the maximum depth of JSON nesting +// that may be consumed or produced for each top-level JSON value. +// If a [Decoder] or [Encoder] method call would need to consume or produce +// a depth greater than n to make progress on the top-level JSON value, +// then the call will report an error. +// +// A non-positive limit is equivalent to no limit at all. +// If unspecified, the default limit is 10000. +// This affects either encoding or decoding. +func WithDepthLimit(n int) Options { + return jsonopts.DepthLimit(max(n, 0)) +} +*/ diff --git a/go/src/encoding/json/jsontext/pools.go b/go/src/encoding/json/jsontext/pools.go new file mode 100644 index 0000000000000000000000000000000000000000..3066ab4a1d2590838738c9edfeef541d127cd503 --- /dev/null +++ b/go/src/encoding/json/jsontext/pools.go @@ -0,0 +1,164 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsontext + +import ( + "bytes" + "io" + "math/bits" + "sync" +) + +// TODO(https://go.dev/issue/47657): Use sync.PoolOf. + +var ( + // This owns the internal buffer since there is no io.Writer to output to. + // Since the buffer can get arbitrarily large in normal usage, + // there is statistical tracking logic to determine whether to recycle + // the internal buffer or not based on a history of utilization. + bufferedEncoderPool = &sync.Pool{New: func() any { return new(Encoder) }} + + // This owns the internal buffer, but it is only used to temporarily store + // buffered JSON before flushing it to the underlying io.Writer. + // In a sufficiently efficient streaming mode, we do not expect the buffer + // to grow arbitrarily large. Thus, we avoid recycling large buffers. + streamingEncoderPool = &sync.Pool{New: func() any { return new(Encoder) }} + + // This does not own the internal buffer since + // it is taken directly from the provided bytes.Buffer. + bytesBufferEncoderPool = &sync.Pool{New: func() any { return new(Encoder) }} +) + +// bufferStatistics is statistics to track buffer utilization. +// It is used to determine whether to recycle a buffer or not +// to avoid https://go.dev/issue/23199. +type bufferStatistics struct { + strikes int // number of times the buffer was under-utilized + prevLen int // length of previous buffer +} + +func getBufferedEncoder(opts ...Options) *Encoder { + e := bufferedEncoderPool.Get().(*Encoder) + if e.s.Buf == nil { + // Round up to nearest 2ⁿ to make best use of malloc size classes. + // See runtime/sizeclasses.go on Go1.15. + // Logical OR with 63 to ensure 64 as the minimum buffer size. + n := 1 << bits.Len(uint(e.s.bufStats.prevLen|63)) + e.s.Buf = make([]byte, 0, n) + } + e.s.reset(e.s.Buf[:0], nil, opts...) + return e +} +func putBufferedEncoder(e *Encoder) { + if cap(e.s.availBuffer) > 64<<10 { + e.s.availBuffer = nil // avoid pinning arbitrarily large amounts of memory + } + + // Recycle large buffers only if sufficiently utilized. + // If a buffer is under-utilized enough times sequentially, + // then it is discarded, ensuring that a single large buffer + // won't be kept alive by a continuous stream of small usages. + // + // The worst case utilization is computed as: + // MIN_UTILIZATION_THRESHOLD / (1 + MAX_NUM_STRIKES) + // + // For the constants chosen below, this is (25%)/(1+4) ⇒ 5%. + // This may seem low, but it ensures a lower bound on + // the absolute worst-case utilization. Without this check, + // this would be theoretically 0%, which is infinitely worse. + // + // See https://go.dev/issue/27735. + switch { + case cap(e.s.Buf) <= 4<<10: // always recycle buffers smaller than 4KiB + e.s.bufStats.strikes = 0 + case cap(e.s.Buf)/4 <= len(e.s.Buf): // at least 25% utilization + e.s.bufStats.strikes = 0 + case e.s.bufStats.strikes < 4: // at most 4 strikes + e.s.bufStats.strikes++ + default: // discard the buffer; too large and too often under-utilized + e.s.bufStats.strikes = 0 + e.s.bufStats.prevLen = len(e.s.Buf) // heuristic for size to allocate next time + e.s.Buf = nil + } + bufferedEncoderPool.Put(e) +} + +func getStreamingEncoder(w io.Writer, opts ...Options) *Encoder { + if _, ok := w.(*bytes.Buffer); ok { + e := bytesBufferEncoderPool.Get().(*Encoder) + e.s.reset(nil, w, opts...) // buffer taken from bytes.Buffer + return e + } else { + e := streamingEncoderPool.Get().(*Encoder) + e.s.reset(e.s.Buf[:0], w, opts...) // preserve existing buffer + return e + } +} +func putStreamingEncoder(e *Encoder) { + if cap(e.s.availBuffer) > 64<<10 { + e.s.availBuffer = nil // avoid pinning arbitrarily large amounts of memory + } + if _, ok := e.s.wr.(*bytes.Buffer); ok { + e.s.wr, e.s.Buf = nil, nil // avoid pinning the provided bytes.Buffer + bytesBufferEncoderPool.Put(e) + } else { + e.s.wr = nil // avoid pinning the provided io.Writer + if cap(e.s.Buf) > 64<<10 { + e.s.Buf = nil // avoid pinning arbitrarily large amounts of memory + } + streamingEncoderPool.Put(e) + } +} + +var ( + // This does not own the internal buffer since it is externally provided. + bufferedDecoderPool = &sync.Pool{New: func() any { return new(Decoder) }} + + // This owns the internal buffer, but it is only used to temporarily store + // buffered JSON fetched from the underlying io.Reader. + // In a sufficiently efficient streaming mode, we do not expect the buffer + // to grow arbitrarily large. Thus, we avoid recycling large buffers. + streamingDecoderPool = &sync.Pool{New: func() any { return new(Decoder) }} + + // This does not own the internal buffer since + // it is taken directly from the provided bytes.Buffer. + bytesBufferDecoderPool = bufferedDecoderPool +) + +func getBufferedDecoder(b []byte, opts ...Options) *Decoder { + d := bufferedDecoderPool.Get().(*Decoder) + d.s.reset(b, nil, opts...) + return d +} +func putBufferedDecoder(d *Decoder) { + d.s.buf = nil // avoid pinning the provided buffer + bufferedDecoderPool.Put(d) +} + +func getStreamingDecoder(r io.Reader, opts ...Options) *Decoder { + if _, ok := r.(*bytes.Buffer); ok { + d := bytesBufferDecoderPool.Get().(*Decoder) + d.s.reset(nil, r, opts...) // buffer taken from bytes.Buffer + return d + } else { + d := streamingDecoderPool.Get().(*Decoder) + d.s.reset(d.s.buf[:0], r, opts...) // preserve existing buffer + return d + } +} +func putStreamingDecoder(d *Decoder) { + if _, ok := d.s.rd.(*bytes.Buffer); ok { + d.s.rd, d.s.buf = nil, nil // avoid pinning the provided bytes.Buffer + bytesBufferDecoderPool.Put(d) + } else { + d.s.rd = nil // avoid pinning the provided io.Reader + if cap(d.s.buf) > 64<<10 { + d.s.buf = nil // avoid pinning arbitrarily large amounts of memory + } + streamingDecoderPool.Put(d) + } +} diff --git a/go/src/encoding/json/jsontext/quote.go b/go/src/encoding/json/jsontext/quote.go new file mode 100644 index 0000000000000000000000000000000000000000..5ecfdbc21156e3393a20a877ef67733e734272b5 --- /dev/null +++ b/go/src/encoding/json/jsontext/quote.go @@ -0,0 +1,41 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsontext + +import ( + "encoding/json/internal/jsonflags" + "encoding/json/internal/jsonwire" +) + +// AppendQuote appends a double-quoted JSON string literal representing src +// to dst and returns the extended buffer. +// It uses the minimal string representation per RFC 8785, section 3.2.2.2. +// Invalid UTF-8 bytes are replaced with the Unicode replacement character +// and an error is returned at the end indicating the presence of invalid UTF-8. +// The dst must not overlap with the src. +func AppendQuote[Bytes ~[]byte | ~string](dst []byte, src Bytes) ([]byte, error) { + dst, err := jsonwire.AppendQuote(dst, src, &jsonflags.Flags{}) + if err != nil { + err = &SyntacticError{Err: err} + } + return dst, err +} + +// AppendUnquote appends the decoded interpretation of src as a +// double-quoted JSON string literal to dst and returns the extended buffer. +// The input src must be a JSON string without any surrounding whitespace. +// Invalid UTF-8 bytes are replaced with the Unicode replacement character +// and an error is returned at the end indicating the presence of invalid UTF-8. +// Any trailing bytes after the JSON string literal results in an error. +// The dst must not overlap with the src. +func AppendUnquote[Bytes ~[]byte | ~string](dst []byte, src Bytes) ([]byte, error) { + dst, err := jsonwire.AppendUnquote(dst, src) + if err != nil { + err = &SyntacticError{Err: err} + } + return dst, err +} diff --git a/go/src/encoding/json/jsontext/state.go b/go/src/encoding/json/jsontext/state.go new file mode 100644 index 0000000000000000000000000000000000000000..e93057a34c577d22693495954fc0dede63c7d8ea --- /dev/null +++ b/go/src/encoding/json/jsontext/state.go @@ -0,0 +1,828 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsontext + +import ( + "errors" + "iter" + "math" + "strconv" + "strings" + "unicode/utf8" + + "encoding/json/internal/jsonwire" +) + +// ErrDuplicateName indicates that a JSON token could not be +// encoded or decoded because it results in a duplicate JSON object name. +// This error is directly wrapped within a [SyntacticError] when produced. +// +// The name of a duplicate JSON object member can be extracted as: +// +// err := ... +// serr, ok := errors.AsType[*jsontext.SyntacticError](err) +// if ok && serr.Err == jsontext.ErrDuplicateName { +// ptr := serr.JSONPointer // JSON pointer to duplicate name +// name := ptr.LastToken() // duplicate name itself +// ... +// } +// +// This error is only returned if [AllowDuplicateNames] is false. +var ErrDuplicateName = errors.New("duplicate object member name") + +// ErrNonStringName indicates that a JSON token could not be +// encoded or decoded because it is not a string, +// as required for JSON object names according to RFC 8259, section 4. +// This error is directly wrapped within a [SyntacticError] when produced. +var ErrNonStringName = errors.New("object member name must be a string") + +var ( + errMissingValue = errors.New("missing value after object name") + errMismatchDelim = errors.New("mismatching structural token for object or array") + errMaxDepth = errors.New("exceeded max depth") + + errInvalidNamespace = errors.New("object namespace is in an invalid state") +) + +// Per RFC 8259, section 9, implementations may enforce a maximum depth. +// Such a limit is necessary to prevent stack overflows. +const maxNestingDepth = 10000 + +type state struct { + // Tokens validates whether the next token kind is valid. + Tokens stateMachine + + // Names is a stack of object names. + Names objectNameStack + + // Namespaces is a stack of object namespaces. + // For performance reasons, Encoder or Decoder may not update this + // if Marshal or Unmarshal is able to track names in a more efficient way. + // See makeMapArshaler and makeStructArshaler. + // Not used if AllowDuplicateNames is true. + Namespaces objectNamespaceStack +} + +// needObjectValue reports whether the next token should be an object value. +// This method is used by [wrapSyntacticError]. +func (s *state) needObjectValue() bool { + return s.Tokens.Last.needObjectValue() +} + +func (s *state) reset() { + s.Tokens.reset() + s.Names.reset() + s.Namespaces.reset() +} + +// Pointer is a JSON Pointer (RFC 6901) that references a particular JSON value +// relative to the root of the top-level JSON value. +// +// A Pointer is a slash-separated list of tokens, where each token is +// either a JSON object name or an index to a JSON array element +// encoded as a base-10 integer value. +// It is impossible to distinguish between an array index and an object name +// (that happens to be an base-10 encoded integer) without also knowing +// the structure of the top-level JSON value that the pointer refers to. +// +// There is exactly one representation of a pointer to a particular value, +// so comparability of Pointer values is equivalent to checking whether +// they both point to the exact same value. +type Pointer string + +// IsValid reports whether p is a valid JSON Pointer according to RFC 6901. +// Note that the concatenation of two valid pointers produces a valid pointer. +func (p Pointer) IsValid() bool { + for i, r := range p { + switch { + case r == '~' && (i+1 == len(p) || (p[i+1] != '0' && p[i+1] != '1')): + return false // invalid escape + case r == '\ufffd' && !strings.HasPrefix(string(p[i:]), "\ufffd"): + return false // invalid UTF-8 + } + } + return len(p) == 0 || p[0] == '/' +} + +// Contains reports whether the JSON value that p points to +// is equal to or contains the JSON value that pc points to. +func (p Pointer) Contains(pc Pointer) bool { + // Invariant: len(p) <= len(pc) if p.Contains(pc) + suffix, ok := strings.CutPrefix(string(pc), string(p)) + return ok && (suffix == "" || suffix[0] == '/') +} + +// Parent strips off the last token and returns the remaining pointer. +// The parent of an empty p is an empty string. +func (p Pointer) Parent() Pointer { + return p[:max(strings.LastIndexByte(string(p), '/'), 0)] +} + +// LastToken returns the last token in the pointer. +// The last token of an empty p is an empty string. +func (p Pointer) LastToken() string { + last := p[max(strings.LastIndexByte(string(p), '/'), 0):] + return unescapePointerToken(strings.TrimPrefix(string(last), "/")) +} + +// AppendToken appends a token to the end of p and returns the full pointer. +func (p Pointer) AppendToken(tok string) Pointer { + return Pointer(appendEscapePointerName([]byte(p+"/"), tok)) +} + +// TODO: Add Pointer.AppendTokens, +// but should this take in a ...string or an iter.Seq[string]? + +// Tokens returns an iterator over the reference tokens in the JSON pointer, +// starting from the first token until the last token (unless stopped early). +func (p Pointer) Tokens() iter.Seq[string] { + return func(yield func(string) bool) { + for len(p) > 0 { + p = Pointer(strings.TrimPrefix(string(p), "/")) + i := min(uint(strings.IndexByte(string(p), '/')), uint(len(p))) + if !yield(unescapePointerToken(string(p)[:i])) { + return + } + p = p[i:] + } + } +} + +func unescapePointerToken(token string) string { + if strings.Contains(token, "~") { + // Per RFC 6901, section 3, unescape '~' and '/' characters. + token = strings.ReplaceAll(token, "~1", "/") + token = strings.ReplaceAll(token, "~0", "~") + } + return token +} + +// appendStackPointer appends a JSON Pointer (RFC 6901) to the current value. +// +// - If where is -1, then it points to the previously processed token. +// +// - If where is 0, then it points to the parent JSON object or array, +// or an object member if in-between an object member key and value. +// This is useful when the position is ambiguous whether +// we are interested in the previous or next token, or +// when we are uncertain whether the next token +// continues or terminates the current object or array. +// +// - If where is +1, then it points to the next expected value, +// assuming that it continues the current JSON object or array. +// As a special case, if the next token is a JSON object name, +// then it points to the parent JSON object. +// +// Invariant: Must call s.names.copyQuotedBuffer beforehand. +func (s state) appendStackPointer(b []byte, where int) []byte { + var objectDepth int + for i := 1; i < s.Tokens.Depth(); i++ { + e := s.Tokens.index(i) + arrayDelta := -1 // by default point to previous array element + if isLast := i == s.Tokens.Depth()-1; isLast { + switch { + case where < 0 && e.Length() == 0 || where == 0 && !e.needObjectValue() || where > 0 && e.NeedObjectName(): + return b + case where > 0 && e.isArray(): + arrayDelta = 0 // point to next array element + } + } + switch { + case e.isObject(): + b = appendEscapePointerName(append(b, '/'), s.Names.getUnquoted(objectDepth)) + objectDepth++ + case e.isArray(): + b = strconv.AppendUint(append(b, '/'), uint64(e.Length()+int64(arrayDelta)), 10) + } + } + return b +} + +func appendEscapePointerName[Bytes ~[]byte | ~string](b []byte, name Bytes) []byte { + for _, r := range string(name) { + // Per RFC 6901, section 3, escape '~' and '/' characters. + switch r { + case '~': + b = append(b, "~0"...) + case '/': + b = append(b, "~1"...) + default: + b = utf8.AppendRune(b, r) + } + } + return b +} + +// stateMachine is a push-down automaton that validates whether +// a sequence of tokens is valid or not according to the JSON grammar. +// It is useful for both encoding and decoding. +// +// It is a stack where each entry represents a nested JSON object or array. +// The stack has a minimum depth of 1 where the first level is a +// virtual JSON array to handle a stream of top-level JSON values. +// The top-level virtual JSON array is special in that it doesn't require commas +// between each JSON value. +// +// For performance, most methods are carefully written to be inlinable. +// The zero value is a valid state machine ready for use. +type stateMachine struct { + Stack []stateEntry + Last stateEntry +} + +// reset resets the state machine. +// The machine always starts with a minimum depth of 1. +func (m *stateMachine) reset() { + m.Stack = m.Stack[:0] + if cap(m.Stack) > 1<<10 { + m.Stack = nil + } + m.Last = stateTypeArray +} + +// Depth is the current nested depth of JSON objects and arrays. +// It is one-indexed (i.e., top-level values have a depth of 1). +func (m stateMachine) Depth() int { + return len(m.Stack) + 1 +} + +// index returns a reference to the ith entry. +// It is only valid until the next push method call. +func (m *stateMachine) index(i int) *stateEntry { + if i == len(m.Stack) { + return &m.Last + } + return &m.Stack[i] +} + +// DepthLength reports the current nested depth and +// the length of the last JSON object or array. +func (m stateMachine) DepthLength() (int, int64) { + return m.Depth(), m.Last.Length() +} + +// appendLiteral appends a JSON literal as the next token in the sequence. +// If an error is returned, the state is not mutated. +func (m *stateMachine) appendLiteral() error { + switch { + case m.Last.NeedObjectName(): + return ErrNonStringName + case !m.Last.isValidNamespace(): + return errInvalidNamespace + default: + m.Last.Increment() + return nil + } +} + +// appendString appends a JSON string as the next token in the sequence. +// If an error is returned, the state is not mutated. +func (m *stateMachine) appendString() error { + switch { + case !m.Last.isValidNamespace(): + return errInvalidNamespace + default: + m.Last.Increment() + return nil + } +} + +// appendNumber appends a JSON number as the next token in the sequence. +// If an error is returned, the state is not mutated. +func (m *stateMachine) appendNumber() error { + return m.appendLiteral() +} + +// pushObject appends a JSON begin object token as next in the sequence. +// If an error is returned, the state is not mutated. +func (m *stateMachine) pushObject() error { + switch { + case m.Last.NeedObjectName(): + return ErrNonStringName + case !m.Last.isValidNamespace(): + return errInvalidNamespace + case len(m.Stack) == maxNestingDepth: + return errMaxDepth + default: + m.Last.Increment() + m.Stack = append(m.Stack, m.Last) + m.Last = stateTypeObject + return nil + } +} + +// popObject appends a JSON end object token as next in the sequence. +// If an error is returned, the state is not mutated. +func (m *stateMachine) popObject() error { + switch { + case !m.Last.isObject(): + return errMismatchDelim + case m.Last.needObjectValue(): + return errMissingValue + case !m.Last.isValidNamespace(): + return errInvalidNamespace + default: + m.Last = m.Stack[len(m.Stack)-1] + m.Stack = m.Stack[:len(m.Stack)-1] + return nil + } +} + +// pushArray appends a JSON begin array token as next in the sequence. +// If an error is returned, the state is not mutated. +func (m *stateMachine) pushArray() error { + switch { + case m.Last.NeedObjectName(): + return ErrNonStringName + case !m.Last.isValidNamespace(): + return errInvalidNamespace + case len(m.Stack) == maxNestingDepth: + return errMaxDepth + default: + m.Last.Increment() + m.Stack = append(m.Stack, m.Last) + m.Last = stateTypeArray + return nil + } +} + +// popArray appends a JSON end array token as next in the sequence. +// If an error is returned, the state is not mutated. +func (m *stateMachine) popArray() error { + switch { + case !m.Last.isArray() || len(m.Stack) == 0: // forbid popping top-level virtual JSON array + return errMismatchDelim + case !m.Last.isValidNamespace(): + return errInvalidNamespace + default: + m.Last = m.Stack[len(m.Stack)-1] + m.Stack = m.Stack[:len(m.Stack)-1] + return nil + } +} + +// NeedIndent reports whether indent whitespace should be injected. +// A zero value means that no whitespace should be injected. +// A positive value means '\n', indentPrefix, and (n-1) copies of indentBody +// should be appended to the output immediately before the next token. +func (m stateMachine) NeedIndent(next Kind) (n int) { + willEnd := next == '}' || next == ']' + switch { + case m.Depth() == 1: + return 0 // top-level values are never indented + case m.Last.Length() == 0 && willEnd: + return 0 // an empty object or array is never indented + case m.Last.Length() == 0 || m.Last.needImplicitComma(next): + return m.Depth() + case willEnd: + return m.Depth() - 1 + default: + return 0 + } +} + +// MayAppendDelim appends a colon or comma that may precede the next token. +func (m stateMachine) MayAppendDelim(b []byte, next Kind) []byte { + switch { + case m.Last.needImplicitColon(): + return append(b, ':') + case m.Last.needImplicitComma(next) && len(m.Stack) != 0: // comma not needed for top-level values + return append(b, ',') + default: + return b + } +} + +// needDelim reports whether a colon or comma token should be implicitly emitted +// before the next token of the specified kind. +// A zero value means no delimiter should be emitted. +func (m stateMachine) needDelim(next Kind) (delim byte) { + switch { + case m.Last.needImplicitColon(): + return ':' + case m.Last.needImplicitComma(next) && len(m.Stack) != 0: // comma not needed for top-level values + return ',' + default: + return 0 + } +} + +// InvalidateDisabledNamespaces marks all disabled namespaces as invalid. +// +// For efficiency, Marshal and Unmarshal may disable namespaces since there are +// more efficient ways to track duplicate names. However, if an error occurs, +// the namespaces in Encoder or Decoder will be left in an inconsistent state. +// Mark the namespaces as invalid so that future method calls on +// Encoder or Decoder will return an error. +func (m *stateMachine) InvalidateDisabledNamespaces() { + for i := range m.Depth() { + e := m.index(i) + if !e.isActiveNamespace() { + e.invalidateNamespace() + } + } +} + +// stateEntry encodes several artifacts within a single unsigned integer: +// - whether this represents a JSON object or array, +// - whether this object should check for duplicate names, and +// - how many elements are in this JSON object or array. +type stateEntry uint64 + +const ( + // The type mask (1 bit) records whether this is a JSON object or array. + stateTypeMask stateEntry = 0x8000_0000_0000_0000 + stateTypeObject stateEntry = 0x8000_0000_0000_0000 + stateTypeArray stateEntry = 0x0000_0000_0000_0000 + + // The name check mask (2 bit) records whether to update + // the namespaces for the current JSON object and + // whether the namespace is valid. + stateNamespaceMask stateEntry = 0x6000_0000_0000_0000 + stateDisableNamespace stateEntry = 0x4000_0000_0000_0000 + stateInvalidNamespace stateEntry = 0x2000_0000_0000_0000 + + // The count mask (61 bits) records the number of elements. + stateCountMask stateEntry = 0x1fff_ffff_ffff_ffff + stateCountLSBMask stateEntry = 0x0000_0000_0000_0001 + stateCountOdd stateEntry = 0x0000_0000_0000_0001 + stateCountEven stateEntry = 0x0000_0000_0000_0000 +) + +// Length reports the number of elements in the JSON object or array. +// Each name and value in an object entry is treated as a separate element. +func (e stateEntry) Length() int64 { + return int64(e & stateCountMask) +} + +// isObject reports whether this is a JSON object. +func (e stateEntry) isObject() bool { + return e&stateTypeMask == stateTypeObject +} + +// isArray reports whether this is a JSON array. +func (e stateEntry) isArray() bool { + return e&stateTypeMask == stateTypeArray +} + +// NeedObjectName reports whether the next token must be a JSON string, +// which is necessary for JSON object names. +func (e stateEntry) NeedObjectName() bool { + return e&(stateTypeMask|stateCountLSBMask) == stateTypeObject|stateCountEven +} + +// needImplicitColon reports whether an colon should occur next, +// which always occurs after JSON object names. +func (e stateEntry) needImplicitColon() bool { + return e.needObjectValue() +} + +// needObjectValue reports whether the next token must be a JSON value, +// which is necessary after every JSON object name. +func (e stateEntry) needObjectValue() bool { + return e&(stateTypeMask|stateCountLSBMask) == stateTypeObject|stateCountOdd +} + +// needImplicitComma reports whether an comma should occur next, +// which always occurs after a value in a JSON object or array +// before the next value (or name). +func (e stateEntry) needImplicitComma(next Kind) bool { + return !e.needObjectValue() && e.Length() > 0 && next != '}' && next != ']' +} + +// Increment increments the number of elements for the current object or array. +// This assumes that overflow won't practically be an issue since +// 1< 0. +func (e *stateEntry) decrement() { + (*e)-- +} + +// DisableNamespace disables the JSON object namespace such that the +// Encoder or Decoder no longer updates the namespace. +func (e *stateEntry) DisableNamespace() { + *e |= stateDisableNamespace +} + +// isActiveNamespace reports whether the JSON object namespace is actively +// being updated and used for duplicate name checks. +func (e stateEntry) isActiveNamespace() bool { + return e&(stateDisableNamespace) == 0 +} + +// invalidateNamespace marks the JSON object namespace as being invalid. +func (e *stateEntry) invalidateNamespace() { + *e |= stateInvalidNamespace +} + +// isValidNamespace reports whether the JSON object namespace is valid. +func (e stateEntry) isValidNamespace() bool { + return e&(stateInvalidNamespace) == 0 +} + +// objectNameStack is a stack of names when descending into a JSON object. +// In contrast to objectNamespaceStack, this only has to remember a single name +// per JSON object. +// +// This data structure may contain offsets to encodeBuffer or decodeBuffer. +// It violates clean abstraction of layers, but is significantly more efficient. +// This ensures that popping and pushing in the common case is a trivial +// push/pop of an offset integer. +// +// The zero value is an empty names stack ready for use. +type objectNameStack struct { + // offsets is a stack of offsets for each name. + // A non-negative offset is the ending offset into the local names buffer. + // A negative offset is the bit-wise inverse of a starting offset into + // a remote buffer (e.g., encodeBuffer or decodeBuffer). + // A math.MinInt offset at the end implies that the last object is empty. + // Invariant: Positive offsets always occur before negative offsets. + offsets []int + // unquotedNames is a back-to-back concatenation of names. + unquotedNames []byte +} + +func (ns *objectNameStack) reset() { + ns.offsets = ns.offsets[:0] + ns.unquotedNames = ns.unquotedNames[:0] + if cap(ns.offsets) > 1<<6 { + ns.offsets = nil // avoid pinning arbitrarily large amounts of memory + } + if cap(ns.unquotedNames) > 1<<10 { + ns.unquotedNames = nil // avoid pinning arbitrarily large amounts of memory + } +} + +func (ns *objectNameStack) length() int { + return len(ns.offsets) +} + +// getUnquoted retrieves the ith unquoted name in the stack. +// It returns an empty string if the last object is empty. +// +// Invariant: Must call copyQuotedBuffer beforehand. +func (ns *objectNameStack) getUnquoted(i int) []byte { + ns.ensureCopiedBuffer() + if i == 0 { + return ns.unquotedNames[:ns.offsets[0]] + } else { + return ns.unquotedNames[ns.offsets[i-1]:ns.offsets[i-0]] + } +} + +// invalidOffset indicates that the last JSON object currently has no name. +const invalidOffset = math.MinInt + +// push descends into a nested JSON object. +func (ns *objectNameStack) push() { + ns.offsets = append(ns.offsets, invalidOffset) +} + +// ReplaceLastQuotedOffset replaces the last name with the starting offset +// to the quoted name in some remote buffer. All offsets provided must be +// relative to the same buffer until copyQuotedBuffer is called. +func (ns *objectNameStack) ReplaceLastQuotedOffset(i int) { + // Use bit-wise inversion instead of naive multiplication by -1 to avoid + // ambiguity regarding zero (which is a valid offset into the names field). + // Bit-wise inversion is mathematically equivalent to -i-1, + // such that 0 becomes -1, 1 becomes -2, and so forth. + // This ensures that remote offsets are always negative. + ns.offsets[len(ns.offsets)-1] = ^i +} + +// replaceLastUnquotedName replaces the last name with the provided name. +// +// Invariant: Must call copyQuotedBuffer beforehand. +func (ns *objectNameStack) replaceLastUnquotedName(s string) { + ns.ensureCopiedBuffer() + var startOffset int + if len(ns.offsets) > 1 { + startOffset = ns.offsets[len(ns.offsets)-2] + } + ns.unquotedNames = append(ns.unquotedNames[:startOffset], s...) + ns.offsets[len(ns.offsets)-1] = len(ns.unquotedNames) +} + +// clearLast removes any name in the last JSON object. +// It is semantically equivalent to ns.push followed by ns.pop. +func (ns *objectNameStack) clearLast() { + ns.offsets[len(ns.offsets)-1] = invalidOffset +} + +// pop ascends out of a nested JSON object. +func (ns *objectNameStack) pop() { + ns.offsets = ns.offsets[:len(ns.offsets)-1] +} + +// copyQuotedBuffer copies names from the remote buffer into the local names +// buffer so that there are no more offset references into the remote buffer. +// This allows the remote buffer to change contents without affecting +// the names that this data structure is trying to remember. +func (ns *objectNameStack) copyQuotedBuffer(b []byte) { + // Find the first negative offset. + var i int + for i = len(ns.offsets) - 1; i >= 0 && ns.offsets[i] < 0; i-- { + continue + } + + // Copy each name from the remote buffer into the local buffer. + for i = i + 1; i < len(ns.offsets); i++ { + if i == len(ns.offsets)-1 && ns.offsets[i] == invalidOffset { + if i == 0 { + ns.offsets[i] = 0 + } else { + ns.offsets[i] = ns.offsets[i-1] + } + break // last JSON object had a push without any names + } + + // As a form of Hyrum proofing, we write an invalid character into the + // buffer to make misuse of Decoder.ReadToken more obvious. + // We need to undo that mutation here. + quotedName := b[^ns.offsets[i]:] + if quotedName[0] == invalidateBufferByte { + quotedName[0] = '"' + } + + // Append the unquoted name to the local buffer. + var startOffset int + if i > 0 { + startOffset = ns.offsets[i-1] + } + if n := jsonwire.ConsumeSimpleString(quotedName); n > 0 { + ns.unquotedNames = append(ns.unquotedNames[:startOffset], quotedName[len(`"`):n-len(`"`)]...) + } else { + ns.unquotedNames, _ = jsonwire.AppendUnquote(ns.unquotedNames[:startOffset], quotedName) + } + ns.offsets[i] = len(ns.unquotedNames) + } +} + +func (ns *objectNameStack) ensureCopiedBuffer() { + if len(ns.offsets) > 0 && ns.offsets[len(ns.offsets)-1] < 0 { + panic("BUG: copyQuotedBuffer not called beforehand") + } +} + +// objectNamespaceStack is a stack of object namespaces. +// This data structure assists in detecting duplicate names. +type objectNamespaceStack []objectNamespace + +// reset resets the object namespace stack. +func (nss *objectNamespaceStack) reset() { + if cap(*nss) > 1<<10 { + *nss = nil + } + *nss = (*nss)[:0] +} + +// push starts a new namespace for a nested JSON object. +func (nss *objectNamespaceStack) push() { + if cap(*nss) > len(*nss) { + *nss = (*nss)[:len(*nss)+1] + nss.Last().reset() + } else { + *nss = append(*nss, objectNamespace{}) + } +} + +// Last returns a pointer to the last JSON object namespace. +func (nss objectNamespaceStack) Last() *objectNamespace { + return &nss[len(nss)-1] +} + +// pop terminates the namespace for a nested JSON object. +func (nss *objectNamespaceStack) pop() { + *nss = (*nss)[:len(*nss)-1] +} + +// objectNamespace is the namespace for a JSON object. +// In contrast to objectNameStack, this needs to remember a all names +// per JSON object. +// +// The zero value is an empty namespace ready for use. +type objectNamespace struct { + // It relies on a linear search over all the names before switching + // to use a Go map for direct lookup. + + // endOffsets is a list of offsets to the end of each name in buffers. + // The length of offsets is the number of names in the namespace. + endOffsets []uint + // allUnquotedNames is a back-to-back concatenation of every name in the namespace. + allUnquotedNames []byte + // mapNames is a Go map containing every name in the namespace. + // Only valid if non-nil. + mapNames map[string]struct{} +} + +// reset resets the namespace to be empty. +func (ns *objectNamespace) reset() { + ns.endOffsets = ns.endOffsets[:0] + ns.allUnquotedNames = ns.allUnquotedNames[:0] + ns.mapNames = nil + if cap(ns.endOffsets) > 1<<6 { + ns.endOffsets = nil // avoid pinning arbitrarily large amounts of memory + } + if cap(ns.allUnquotedNames) > 1<<10 { + ns.allUnquotedNames = nil // avoid pinning arbitrarily large amounts of memory + } +} + +// length reports the number of names in the namespace. +func (ns *objectNamespace) length() int { + return len(ns.endOffsets) +} + +// getUnquoted retrieves the ith unquoted name in the namespace. +func (ns *objectNamespace) getUnquoted(i int) []byte { + if i == 0 { + return ns.allUnquotedNames[:ns.endOffsets[0]] + } else { + return ns.allUnquotedNames[ns.endOffsets[i-1]:ns.endOffsets[i-0]] + } +} + +// lastUnquoted retrieves the last name in the namespace. +func (ns *objectNamespace) lastUnquoted() []byte { + return ns.getUnquoted(ns.length() - 1) +} + +// insertQuoted inserts a name and reports whether it was inserted, +// which only occurs if name is not already in the namespace. +// The provided name must be a valid JSON string. +func (ns *objectNamespace) insertQuoted(name []byte, isVerbatim bool) bool { + if isVerbatim { + name = name[len(`"`) : len(name)-len(`"`)] + } + return ns.insert(name, !isVerbatim) +} +func (ns *objectNamespace) InsertUnquoted(name []byte) bool { + return ns.insert(name, false) +} +func (ns *objectNamespace) insert(name []byte, quoted bool) bool { + var allNames []byte + if quoted { + allNames, _ = jsonwire.AppendUnquote(ns.allUnquotedNames, name) + } else { + allNames = append(ns.allUnquotedNames, name...) + } + name = allNames[len(ns.allUnquotedNames):] + + // Switch to a map if the buffer is too large for linear search. + // This does not add the current name to the map. + if ns.mapNames == nil && (ns.length() > 64 || len(ns.allUnquotedNames) > 1024) { + ns.mapNames = make(map[string]struct{}) + var startOffset uint + for _, endOffset := range ns.endOffsets { + name := ns.allUnquotedNames[startOffset:endOffset] + ns.mapNames[string(name)] = struct{}{} // allocates a new string + startOffset = endOffset + } + } + + if ns.mapNames == nil { + // Perform linear search over the buffer to find matching names. + // It provides O(n) lookup, but does not require any allocations. + var startOffset uint + for _, endOffset := range ns.endOffsets { + if string(ns.allUnquotedNames[startOffset:endOffset]) == string(name) { + return false + } + startOffset = endOffset + } + } else { + // Use the map if it is populated. + // It provides O(1) lookup, but requires a string allocation per name. + if _, ok := ns.mapNames[string(name)]; ok { + return false + } + ns.mapNames[string(name)] = struct{}{} // allocates a new string + } + + ns.allUnquotedNames = allNames + ns.endOffsets = append(ns.endOffsets, uint(len(ns.allUnquotedNames))) + return true +} + +// removeLast removes the last name in the namespace. +func (ns *objectNamespace) removeLast() { + if ns.mapNames != nil { + delete(ns.mapNames, string(ns.lastUnquoted())) + } + if ns.length()-1 == 0 { + ns.endOffsets = ns.endOffsets[:0] + ns.allUnquotedNames = ns.allUnquotedNames[:0] + } else { + ns.endOffsets = ns.endOffsets[:ns.length()-1] + ns.allUnquotedNames = ns.allUnquotedNames[:ns.endOffsets[ns.length()-1]] + } +} diff --git a/go/src/encoding/json/jsontext/state_test.go b/go/src/encoding/json/jsontext/state_test.go new file mode 100644 index 0000000000000000000000000000000000000000..c227600945e1225f73770d24f15665746b08e80c --- /dev/null +++ b/go/src/encoding/json/jsontext/state_test.go @@ -0,0 +1,396 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsontext + +import ( + "fmt" + "slices" + "strings" + "testing" + "unicode/utf8" +) + +func TestPointer(t *testing.T) { + tests := []struct { + in Pointer + wantParent Pointer + wantLast string + wantTokens []string + wantValid bool + }{ + {"", "", "", nil, true}, + {"a", "", "a", []string{"a"}, false}, + {"~", "", "~", []string{"~"}, false}, + {"/a", "", "a", []string{"a"}, true}, + {"/foo/bar", "/foo", "bar", []string{"foo", "bar"}, true}, + {"///", "//", "", []string{"", "", ""}, true}, + {"/~0~1", "", "~/", []string{"~/"}, true}, + {"/\xde\xad\xbe\xef", "", "\xde\xad\xbe\xef", []string{"\xde\xad\xbe\xef"}, false}, + } + for _, tt := range tests { + if got := tt.in.Parent(); got != tt.wantParent { + t.Errorf("Pointer(%q).Parent = %q, want %q", tt.in, got, tt.wantParent) + } + if got := tt.in.LastToken(); got != tt.wantLast { + t.Errorf("Pointer(%q).Last = %q, want %q", tt.in, got, tt.wantLast) + } + if strings.HasPrefix(string(tt.in), "/") { + wantRoundtrip := tt.in + if !utf8.ValidString(string(wantRoundtrip)) { + // Replace bytes of invalid UTF-8 with Unicode replacement character. + wantRoundtrip = Pointer([]rune(wantRoundtrip)) + } + if got := tt.in.Parent().AppendToken(tt.in.LastToken()); got != wantRoundtrip { + t.Errorf("Pointer(%q).Parent().AppendToken(LastToken()) = %q, want %q", tt.in, got, tt.in) + } + in := tt.in + for { + if (in + "x").Contains(tt.in) { + t.Errorf("Pointer(%q).Contains(%q) = true, want false", in+"x", tt.in) + } + if !in.Contains(tt.in) { + t.Errorf("Pointer(%q).Contains(%q) = false, want true", in, tt.in) + } + if in == in.Parent() { + break + } + in = in.Parent() + } + } + if got := slices.Collect(tt.in.Tokens()); !slices.Equal(got, tt.wantTokens) { + t.Errorf("Pointer(%q).Tokens = %q, want %q", tt.in, got, tt.wantTokens) + } + if got := tt.in.IsValid(); got != tt.wantValid { + t.Errorf("Pointer(%q).IsValid = %v, want %v", tt.in, got, tt.wantValid) + } + } +} + +func TestStateMachine(t *testing.T) { + // To test a state machine, we pass an ordered sequence of operations and + // check whether the current state is as expected. + // The operation type is a union type of various possible operations, + // which either call mutating methods on the state machine or + // call accessor methods on state machine and verify the results. + type operation any + type ( + // stackLengths checks the results of stateEntry.length accessors. + stackLengths []int64 + + // appendTokens is sequence of token kinds to append where + // none of them are expected to fail. + // + // For example: `[nft]` is equivalent to the following sequence: + // + // pushArray() + // appendLiteral() + // appendString() + // appendNumber() + // popArray() + // + appendTokens string + + // appendToken is a single token kind to append with the expected error. + appendToken struct { + kind Kind + want error + } + + // needDelim checks the result of the needDelim accessor. + needDelim struct { + next Kind + want byte + } + ) + + // Each entry is a sequence of tokens to pass to the state machine. + tests := []struct { + label string + ops []operation + }{{ + "TopLevelValues", + []operation{ + stackLengths{0}, + needDelim{'n', 0}, + appendTokens(`nft`), + stackLengths{3}, + needDelim{'"', 0}, + appendTokens(`"0[]{}`), + stackLengths{7}, + }, + }, { + "ArrayValues", + []operation{ + stackLengths{0}, + needDelim{'[', 0}, + appendTokens(`[`), + stackLengths{1, 0}, + needDelim{'n', 0}, + appendTokens(`nft`), + stackLengths{1, 3}, + needDelim{'"', ','}, + appendTokens(`"0[]{}`), + stackLengths{1, 7}, + needDelim{']', 0}, + appendTokens(`]`), + stackLengths{1}, + }, + }, { + "ObjectValues", + []operation{ + stackLengths{0}, + needDelim{'{', 0}, + appendTokens(`{`), + stackLengths{1, 0}, + needDelim{'"', 0}, + appendTokens(`"`), + stackLengths{1, 1}, + needDelim{'n', ':'}, + appendTokens(`n`), + stackLengths{1, 2}, + needDelim{'"', ','}, + appendTokens(`"f"t`), + stackLengths{1, 6}, + appendTokens(`"""0"[]"{}`), + stackLengths{1, 14}, + needDelim{'}', 0}, + appendTokens(`}`), + stackLengths{1}, + }, + }, { + "ObjectCardinality", + []operation{ + appendTokens(`{`), + + // Appending any kind other than string for object name is an error. + appendToken{'n', ErrNonStringName}, + appendToken{'f', ErrNonStringName}, + appendToken{'t', ErrNonStringName}, + appendToken{'0', ErrNonStringName}, + appendToken{'{', ErrNonStringName}, + appendToken{'[', ErrNonStringName}, + appendTokens(`"`), + + // Appending '}' without first appending any value is an error. + appendToken{'}', errMissingValue}, + appendTokens(`"`), + + appendTokens(`}`), + }, + }, { + "MismatchingDelims", + []operation{ + appendToken{'}', errMismatchDelim}, // appending '}' without preceding '{' + appendTokens(`[[{`), + appendToken{']', errMismatchDelim}, // appending ']' that mismatches preceding '{' + appendTokens(`}]`), + appendToken{'}', errMismatchDelim}, // appending '}' that mismatches preceding '[' + appendTokens(`]`), + appendToken{']', errMismatchDelim}, // appending ']' without preceding '[' + }, + }} + + for _, tt := range tests { + t.Run(tt.label, func(t *testing.T) { + // Flatten appendTokens to sequence of appendToken entries. + var ops []operation + for _, op := range tt.ops { + if toks, ok := op.(appendTokens); ok { + for _, k := range []byte(toks) { + ops = append(ops, appendToken{Kind(k), nil}) + } + continue + } + ops = append(ops, op) + } + + // Append each token to the state machine and check the output. + var state stateMachine + state.reset() + var sequence []Kind + for _, op := range ops { + switch op := op.(type) { + case stackLengths: + var got []int64 + for i := range state.Depth() { + e := state.index(i) + got = append(got, e.Length()) + } + want := []int64(op) + if !slices.Equal(got, want) { + t.Fatalf("%s: stack lengths mismatch:\ngot %v\nwant %v", sequence, got, want) + } + case appendToken: + got := state.append(op.kind) + if !equalError(got, op.want) { + t.Fatalf("%s: append('%c') = %v, want %v", sequence, op.kind, got, op.want) + } + if got == nil { + sequence = append(sequence, op.kind) + } + case needDelim: + if got := state.needDelim(op.next); got != op.want { + t.Fatalf("%s: needDelim('%c') = '%c', want '%c'", sequence, op.next, got, op.want) + } + default: + panic(fmt.Sprintf("unknown operation: %T", op)) + } + } + }) + } +} + +// append is a thin wrapper over the other append, pop, or push methods +// based on the token kind. +func (s *stateMachine) append(k Kind) error { + switch k { + case 'n', 'f', 't': + return s.appendLiteral() + case '"': + return s.appendString() + case '0': + return s.appendNumber() + case '{': + return s.pushObject() + case '}': + return s.popObject() + case '[': + return s.pushArray() + case ']': + return s.popArray() + default: + panic(fmt.Sprintf("invalid token kind: '%c'", k)) + } +} + +func TestObjectNamespace(t *testing.T) { + type operation any + type ( + insert struct { + name string + wantInserted bool + } + removeLast struct{} + ) + + // Sequence of insert operations to perform (order matters). + ops := []operation{ + insert{`""`, true}, + removeLast{}, + insert{`""`, true}, + insert{`""`, false}, + + // Test insertion of the same name with different formatting. + insert{`"alpha"`, true}, + insert{`"ALPHA"`, true}, // case-sensitive matching + insert{`"alpha"`, false}, + insert{`"\u0061\u006c\u0070\u0068\u0061"`, false}, // unescapes to "alpha" + removeLast{}, // removes "ALPHA" + insert{`"alpha"`, false}, + removeLast{}, // removes "alpha" + insert{`"alpha"`, true}, + removeLast{}, + + // Bulk insert simple names. + insert{`"alpha"`, true}, + insert{`"bravo"`, true}, + insert{`"charlie"`, true}, + insert{`"delta"`, true}, + insert{`"echo"`, true}, + insert{`"foxtrot"`, true}, + insert{`"golf"`, true}, + insert{`"hotel"`, true}, + insert{`"india"`, true}, + insert{`"juliet"`, true}, + insert{`"kilo"`, true}, + insert{`"lima"`, true}, + insert{`"mike"`, true}, + insert{`"november"`, true}, + insert{`"oscar"`, true}, + insert{`"papa"`, true}, + insert{`"quebec"`, true}, + insert{`"romeo"`, true}, + insert{`"sierra"`, true}, + insert{`"tango"`, true}, + insert{`"uniform"`, true}, + insert{`"victor"`, true}, + insert{`"whiskey"`, true}, + insert{`"xray"`, true}, + insert{`"yankee"`, true}, + insert{`"zulu"`, true}, + + // Test insertion of invalid UTF-8. + insert{`"` + "\ufffd" + `"`, true}, + insert{`"` + "\ufffd" + `"`, false}, + insert{`"\ufffd"`, false}, // unescapes to Unicode replacement character + insert{`"\uFFFD"`, false}, // unescapes to Unicode replacement character + insert{`"` + "\xff" + `"`, false}, // mangles as Unicode replacement character + removeLast{}, + insert{`"` + "\ufffd" + `"`, true}, + + // Test insertion of unicode characters. + insert{`"☺☻☹"`, true}, + insert{`"☺☻☹"`, false}, + removeLast{}, + insert{`"☺☻☹"`, true}, + } + + // Execute the sequence of operations twice: + // 1) on a fresh namespace and 2) on a namespace that has been reset. + var ns objectNamespace + wantNames := []string{} + for _, reset := range []bool{false, true} { + if reset { + ns.reset() + wantNames = nil + } + + // Execute the operations and ensure the state is consistent. + for i, op := range ops { + switch op := op.(type) { + case insert: + gotInserted := ns.insertQuoted([]byte(op.name), false) + if gotInserted != op.wantInserted { + t.Fatalf("%d: objectNamespace{%v}.insert(%v) = %v, want %v", i, strings.Join(wantNames, " "), op.name, gotInserted, op.wantInserted) + } + if gotInserted { + b, _ := AppendUnquote(nil, []byte(op.name)) + wantNames = append(wantNames, string(b)) + } + case removeLast: + ns.removeLast() + wantNames = wantNames[:len(wantNames)-1] + default: + panic(fmt.Sprintf("unknown operation: %T", op)) + } + + // Check that the namespace is consistent. + gotNames := []string{} + for i := range ns.length() { + gotNames = append(gotNames, string(ns.getUnquoted(i))) + } + if !slices.Equal(gotNames, wantNames) { + t.Fatalf("%d: objectNamespace = {%v}, want {%v}", i, strings.Join(gotNames, " "), strings.Join(wantNames, " ")) + } + } + + // Verify that we have not switched to using a Go map. + if ns.mapNames != nil { + t.Errorf("objectNamespace.mapNames = non-nil, want nil") + } + + // Insert a large number of names. + for i := range 64 { + ns.InsertUnquoted([]byte(fmt.Sprintf(`name%d`, i))) + } + + // Verify that we did switch to using a Go map. + if ns.mapNames == nil { + t.Errorf("objectNamespace.mapNames = nil, want non-nil") + } + } +} diff --git a/go/src/encoding/json/jsontext/token.go b/go/src/encoding/json/jsontext/token.go new file mode 100644 index 0000000000000000000000000000000000000000..6d9ad4b499888d96eddc1af2706f115d6c48df96 --- /dev/null +++ b/go/src/encoding/json/jsontext/token.go @@ -0,0 +1,552 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsontext + +import ( + "bytes" + "errors" + "math" + "strconv" + + "encoding/json/internal/jsonflags" + "encoding/json/internal/jsonwire" +) + +// NOTE: Token is analogous to v1 json.Token. + +const ( + maxInt64 = math.MaxInt64 + minInt64 = math.MinInt64 + maxUint64 = math.MaxUint64 + minUint64 = 0 // for consistency and readability purposes + + invalidTokenPanic = "invalid jsontext.Token; it has been voided by a subsequent json.Decoder call" +) + +var errInvalidToken = errors.New("invalid jsontext.Token") + +// Token represents a lexical JSON token, which may be one of the following: +// - a JSON literal (i.e., null, true, or false) +// - a JSON string (e.g., "hello, world!") +// - a JSON number (e.g., 123.456) +// - a begin or end delimiter for a JSON object (i.e., { or } ) +// - a begin or end delimiter for a JSON array (i.e., [ or ] ) +// +// A Token cannot represent entire array or object values, while a [Value] can. +// There is no Token to represent commas and colons since +// these structural tokens can be inferred from the surrounding context. +type Token struct { + nonComparable + + // Tokens can exist in either a "raw" or an "exact" form. + // Tokens produced by the Decoder are in the "raw" form. + // Tokens returned by constructors are usually in the "exact" form. + // The Encoder accepts Tokens in either the "raw" or "exact" form. + // + // The following chart shows the possible values for each Token type: + // ╔═════════════════╦════════════╤════════════╤════════════╗ + // ║ Token type ║ raw field │ str field │ num field ║ + // ╠═════════════════╬════════════╪════════════╪════════════╣ + // ║ null (raw) ║ "null" │ "" │ 0 ║ + // ║ false (raw) ║ "false" │ "" │ 0 ║ + // ║ true (raw) ║ "true" │ "" │ 0 ║ + // ║ string (raw) ║ non-empty │ "" │ offset ║ + // ║ string (string) ║ nil │ non-empty │ 0 ║ + // ║ number (raw) ║ non-empty │ "" │ offset ║ + // ║ number (float) ║ nil │ "f" │ non-zero ║ + // ║ number (int64) ║ nil │ "i" │ non-zero ║ + // ║ number (uint64) ║ nil │ "u" │ non-zero ║ + // ║ object (delim) ║ "{" or "}" │ "" │ 0 ║ + // ║ array (delim) ║ "[" or "]" │ "" │ 0 ║ + // ╚═════════════════╩════════════╧════════════╧════════════╝ + // + // Notes: + // - For tokens stored in "raw" form, the num field contains the + // absolute offset determined by raw.previousOffsetStart(). + // The buffer itself is stored in raw.previousBuffer(). + // - JSON literals and structural characters are always in the "raw" form. + // - JSON strings and numbers can be in either "raw" or "exact" forms. + // - The exact zero value of JSON strings and numbers in the "exact" forms + // have ambiguous representation. Thus, they are always represented + // in the "raw" form. + + // raw contains a reference to the raw decode buffer. + // If non-nil, then its value takes precedence over str and num. + // It is only valid if num == raw.previousOffsetStart(). + raw *decodeBuffer + + // str is the unescaped JSON string if num is zero. + // Otherwise, it is "f", "i", or "u" if num should be interpreted + // as a float64, int64, or uint64, respectively. + str string + + // num is a float64, int64, or uint64 stored as a uint64 value. + // It is non-zero for any JSON number in the "exact" form. + num uint64 +} + +// TODO: Does representing 1-byte delimiters as *decodeBuffer cause performance issues? + +var ( + Null Token = rawToken("null") + False Token = rawToken("false") + True Token = rawToken("true") + + BeginObject Token = rawToken("{") + EndObject Token = rawToken("}") + BeginArray Token = rawToken("[") + EndArray Token = rawToken("]") + + zeroString Token = rawToken(`""`) + zeroNumber Token = rawToken(`0`) + + nanString Token = String("NaN") + pinfString Token = String("Infinity") + ninfString Token = String("-Infinity") +) + +func rawToken(s string) Token { + return Token{raw: &decodeBuffer{buf: []byte(s), prevStart: 0, prevEnd: len(s)}} +} + +// Bool constructs a Token representing a JSON boolean. +func Bool(b bool) Token { + if b { + return True + } + return False +} + +// String constructs a Token representing a JSON string. +// The provided string should contain valid UTF-8, otherwise invalid characters +// may be mangled as the Unicode replacement character. +func String(s string) Token { + if len(s) == 0 { + return zeroString + } + return Token{str: s} +} + +// Float constructs a Token representing a JSON number. +// The values NaN, +Inf, and -Inf will be represented +// as a JSON string with the values "NaN", "Infinity", and "-Infinity". +func Float(n float64) Token { + switch { + case math.Float64bits(n) == 0: + return zeroNumber + case math.IsNaN(n): + return nanString + case math.IsInf(n, +1): + return pinfString + case math.IsInf(n, -1): + return ninfString + } + return Token{str: "f", num: math.Float64bits(n)} +} + +// Int constructs a Token representing a JSON number from an int64. +func Int(n int64) Token { + if n == 0 { + return zeroNumber + } + return Token{str: "i", num: uint64(n)} +} + +// Uint constructs a Token representing a JSON number from a uint64. +func Uint(n uint64) Token { + if n == 0 { + return zeroNumber + } + return Token{str: "u", num: uint64(n)} +} + +// Clone makes a copy of the Token such that its value remains valid +// even after a subsequent [Decoder.Read] call. +func (t Token) Clone() Token { + // TODO: Allow caller to avoid any allocations? + if raw := t.raw; raw != nil { + // Avoid copying globals. + if t.raw.prevStart == 0 { + switch t.raw { + case Null.raw: + return Null + case False.raw: + return False + case True.raw: + return True + case BeginObject.raw: + return BeginObject + case EndObject.raw: + return EndObject + case BeginArray.raw: + return BeginArray + case EndArray.raw: + return EndArray + } + } + + if uint64(raw.previousOffsetStart()) != t.num { + panic(invalidTokenPanic) + } + buf := bytes.Clone(raw.previousBuffer()) + return Token{raw: &decodeBuffer{buf: buf, prevStart: 0, prevEnd: len(buf)}} + } + return t +} + +// Bool returns the value for a JSON boolean. +// It panics if the token kind is not a JSON boolean. +func (t Token) Bool() bool { + switch t.raw { + case True.raw: + return true + case False.raw: + return false + default: + panic("invalid JSON token kind: " + t.Kind().String()) + } +} + +// appendString appends a JSON string to dst and returns it. +// It panics if t is not a JSON string. +func (t Token) appendString(dst []byte, flags *jsonflags.Flags) ([]byte, error) { + if raw := t.raw; raw != nil { + // Handle raw string value. + buf := raw.previousBuffer() + if Kind(buf[0]) == '"' { + if jsonwire.ConsumeSimpleString(buf) == len(buf) { + return append(dst, buf...), nil + } + dst, _, err := jsonwire.ReformatString(dst, buf, flags) + return dst, err + } + } else if len(t.str) != 0 && t.num == 0 { + // Handle exact string value. + return jsonwire.AppendQuote(dst, t.str, flags) + } + + panic("invalid JSON token kind: " + t.Kind().String()) +} + +// String returns the unescaped string value for a JSON string. +// For other JSON kinds, this returns the raw JSON representation. +func (t Token) String() string { + // This is inlinable to take advantage of "function outlining". + // This avoids an allocation for the string(b) conversion + // if the caller does not use the string in an escaping manner. + // See https://blog.filippo.io/efficient-go-apis-with-the-inliner/ + s, b := t.string() + if len(b) > 0 { + return string(b) + } + return s +} +func (t Token) string() (string, []byte) { + if raw := t.raw; raw != nil { + if uint64(raw.previousOffsetStart()) != t.num { + panic(invalidTokenPanic) + } + buf := raw.previousBuffer() + if buf[0] == '"' { + // TODO: Preserve ValueFlags in Token? + isVerbatim := jsonwire.ConsumeSimpleString(buf) == len(buf) + return "", jsonwire.UnquoteMayCopy(buf, isVerbatim) + } + // Handle tokens that are not JSON strings for fmt.Stringer. + return "", buf + } + if len(t.str) != 0 && t.num == 0 { + return t.str, nil + } + // Handle tokens that are not JSON strings for fmt.Stringer. + if t.num > 0 { + switch t.str[0] { + case 'f': + return string(jsonwire.AppendFloat(nil, math.Float64frombits(t.num), 64)), nil + case 'i': + return strconv.FormatInt(int64(t.num), 10), nil + case 'u': + return strconv.FormatUint(uint64(t.num), 10), nil + } + } + return "", nil +} + +// appendNumber appends a JSON number to dst and returns it. +// It panics if t is not a JSON number. +func (t Token) appendNumber(dst []byte, flags *jsonflags.Flags) ([]byte, error) { + if raw := t.raw; raw != nil { + // Handle raw number value. + buf := raw.previousBuffer() + if Kind(buf[0]).normalize() == '0' { + dst, _, err := jsonwire.ReformatNumber(dst, buf, flags) + return dst, err + } + } else if t.num != 0 { + // Handle exact number value. + switch t.str[0] { + case 'f': + return jsonwire.AppendFloat(dst, math.Float64frombits(t.num), 64), nil + case 'i': + return strconv.AppendInt(dst, int64(t.num), 10), nil + case 'u': + return strconv.AppendUint(dst, uint64(t.num), 10), nil + } + } + + panic("invalid JSON token kind: " + t.Kind().String()) +} + +// Float returns the floating-point value for a JSON number. +// It returns a NaN, +Inf, or -Inf value for any JSON string +// with the values "NaN", "Infinity", or "-Infinity". +// It panics for all other cases. +func (t Token) Float() float64 { + if raw := t.raw; raw != nil { + // Handle raw number value. + if uint64(raw.previousOffsetStart()) != t.num { + panic(invalidTokenPanic) + } + buf := raw.previousBuffer() + if Kind(buf[0]).normalize() == '0' { + fv, _ := jsonwire.ParseFloat(buf, 64) + return fv + } + } else if t.num != 0 { + // Handle exact number value. + switch t.str[0] { + case 'f': + return math.Float64frombits(t.num) + case 'i': + return float64(int64(t.num)) + case 'u': + return float64(uint64(t.num)) + } + } + + // Handle string values with "NaN", "Infinity", or "-Infinity". + if t.Kind() == '"' { + switch t.String() { + case "NaN": + return math.NaN() + case "Infinity": + return math.Inf(+1) + case "-Infinity": + return math.Inf(-1) + } + } + + panic("invalid JSON token kind: " + t.Kind().String()) +} + +// Int returns the signed integer value for a JSON number. +// The fractional component of any number is ignored (truncation toward zero). +// Any number beyond the representation of an int64 will be saturated +// to the closest representable value. +// It panics if the token kind is not a JSON number. +func (t Token) Int() int64 { + if raw := t.raw; raw != nil { + // Handle raw integer value. + if uint64(raw.previousOffsetStart()) != t.num { + panic(invalidTokenPanic) + } + neg := false + buf := raw.previousBuffer() + if len(buf) > 0 && buf[0] == '-' { + neg, buf = true, buf[1:] + } + if numAbs, ok := jsonwire.ParseUint(buf); ok { + if neg { + if numAbs > -minInt64 { + return minInt64 + } + return -1 * int64(numAbs) + } else { + if numAbs > +maxInt64 { + return maxInt64 + } + return +1 * int64(numAbs) + } + } + } else if t.num != 0 { + // Handle exact integer value. + switch t.str[0] { + case 'i': + return int64(t.num) + case 'u': + if t.num > maxInt64 { + return maxInt64 + } + return int64(t.num) + } + } + + // Handle JSON number that is a floating-point value. + if t.Kind() == '0' { + switch fv := t.Float(); { + case fv >= maxInt64: + return maxInt64 + case fv <= minInt64: + return minInt64 + default: + return int64(fv) // truncation toward zero + } + } + + panic("invalid JSON token kind: " + t.Kind().String()) +} + +// Uint returns the unsigned integer value for a JSON number. +// The fractional component of any number is ignored (truncation toward zero). +// Any number beyond the representation of an uint64 will be saturated +// to the closest representable value. +// It panics if the token kind is not a JSON number. +func (t Token) Uint() uint64 { + // NOTE: This accessor returns 0 for any negative JSON number, + // which might be surprising, but is at least consistent with the behavior + // of saturating out-of-bounds numbers to the closest representable number. + + if raw := t.raw; raw != nil { + // Handle raw integer value. + if uint64(raw.previousOffsetStart()) != t.num { + panic(invalidTokenPanic) + } + neg := false + buf := raw.previousBuffer() + if len(buf) > 0 && buf[0] == '-' { + neg, buf = true, buf[1:] + } + if num, ok := jsonwire.ParseUint(buf); ok { + if neg { + return minUint64 + } + return num + } + } else if t.num != 0 { + // Handle exact integer value. + switch t.str[0] { + case 'u': + return t.num + case 'i': + if int64(t.num) < minUint64 { + return minUint64 + } + return uint64(int64(t.num)) + } + } + + // Handle JSON number that is a floating-point value. + if t.Kind() == '0' { + switch fv := t.Float(); { + case fv >= maxUint64: + return maxUint64 + case fv <= minUint64: + return minUint64 + default: + return uint64(fv) // truncation toward zero + } + } + + panic("invalid JSON token kind: " + t.Kind().String()) +} + +// Kind returns the token kind. +func (t Token) Kind() Kind { + switch { + case t.raw != nil: + raw := t.raw + if uint64(raw.previousOffsetStart()) != t.num { + panic(invalidTokenPanic) + } + return Kind(t.raw.buf[raw.prevStart]).normalize() + case t.num != 0: + return '0' + case len(t.str) != 0: + return '"' + default: + return invalidKind + } +} + +// A Kind represents the kind of a JSON token. +// +// Kind represents each possible JSON token kind with a single byte, +// which is conveniently the first byte of that kind's grammar +// with the restriction that numbers always be represented with '0'. +type Kind byte + +const ( + KindInvalid Kind = 0 // invalid kind + KindNull Kind = 'n' // null + KindFalse Kind = 'f' // false + KindTrue Kind = 't' // true + KindString Kind = '"' // string + KindNumber Kind = '0' // number + KindBeginObject Kind = '{' // begin object + KindEndObject Kind = '}' // end object + KindBeginArray Kind = '[' // begin array + KindEndArray Kind = ']' // end array +) + +const invalidKind Kind = 0 + +// String prints the kind in a humanly readable fashion. +func (k Kind) String() string { + switch k { + case 0: + return "invalid" + case 'n': + return "null" + case 'f': + return "false" + case 't': + return "true" + case '"': + return "string" + case '0': + return "number" + case '{': + return "{" + case '}': + return "}" + case '[': + return "[" + case ']': + return "]" + default: + return "" + } +} + +var normKind = [256]Kind{ + 'n': 'n', + 'f': 'f', + 't': 't', + '"': '"', + '{': '{', + '}': '}', + '[': '[', + ']': ']', + '-': '0', + '0': '0', + '1': '0', + '2': '0', + '3': '0', + '4': '0', + '5': '0', + '6': '0', + '7': '0', + '8': '0', + '9': '0', +} + +// normalize coalesces all possible starting characters of a number as just '0', +// and converts all invalid kinds to 0. +func (k Kind) normalize() Kind { + // A lookup table keeps the inlining cost as low as possible. + return normKind[k] +} diff --git a/go/src/encoding/json/jsontext/token_test.go b/go/src/encoding/json/jsontext/token_test.go new file mode 100644 index 0000000000000000000000000000000000000000..ebe324e0dbcce6ea0232f4ddf46d3c990f378f37 --- /dev/null +++ b/go/src/encoding/json/jsontext/token_test.go @@ -0,0 +1,168 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsontext + +import ( + "math" + "reflect" + "testing" +) + +func TestTokenStringAllocations(t *testing.T) { + if testing.CoverMode() != "" { + t.Skip("coverage mode breaks the compiler optimization this depends on") + } + + tok := rawToken(`"hello"`) + var m map[string]bool + got := int(testing.AllocsPerRun(10, func() { + // This function uses tok.String() is a non-escaping manner + // (i.e., looking it up in a Go map). It should not allocate. + if m[tok.String()] { + panic("never executed") + } + })) + if got > 0 { + t.Errorf("Token.String allocated %d times, want 0", got) + } +} + +func TestTokenAccessors(t *testing.T) { + type token struct { + Bool bool + String string + Float float64 + Int int64 + Uint uint64 + Kind Kind + } + + tests := []struct { + in Token + want token + }{ + {Token{}, token{String: ""}}, + {Null, token{String: "null", Kind: 'n'}}, + {False, token{Bool: false, String: "false", Kind: 'f'}}, + {True, token{Bool: true, String: "true", Kind: 't'}}, + {Bool(false), token{Bool: false, String: "false", Kind: 'f'}}, + {Bool(true), token{Bool: true, String: "true", Kind: 't'}}, + {BeginObject, token{String: "{", Kind: '{'}}, + {EndObject, token{String: "}", Kind: '}'}}, + {BeginArray, token{String: "[", Kind: '['}}, + {EndArray, token{String: "]", Kind: ']'}}, + {String(""), token{String: "", Kind: '"'}}, + {String("hello, world!"), token{String: "hello, world!", Kind: '"'}}, + {rawToken(`"hello, world!"`), token{String: "hello, world!", Kind: '"'}}, + {Float(0), token{String: "0", Float: 0, Int: 0, Uint: 0, Kind: '0'}}, + {Float(math.Copysign(0, -1)), token{String: "-0", Float: math.Copysign(0, -1), Int: 0, Uint: 0, Kind: '0'}}, + {Float(math.NaN()), token{String: "NaN", Float: math.NaN(), Int: 0, Uint: 0, Kind: '"'}}, + {Float(math.Inf(+1)), token{String: "Infinity", Float: math.Inf(+1), Kind: '"'}}, + {Float(math.Inf(-1)), token{String: "-Infinity", Float: math.Inf(-1), Kind: '"'}}, + {Int(minInt64), token{String: "-9223372036854775808", Float: minInt64, Int: minInt64, Uint: minUint64, Kind: '0'}}, + {Int(minInt64 + 1), token{String: "-9223372036854775807", Float: minInt64 + 1, Int: minInt64 + 1, Uint: minUint64, Kind: '0'}}, + {Int(-1), token{String: "-1", Float: -1, Int: -1, Uint: minUint64, Kind: '0'}}, + {Int(0), token{String: "0", Float: 0, Int: 0, Uint: 0, Kind: '0'}}, + {Int(+1), token{String: "1", Float: +1, Int: +1, Uint: +1, Kind: '0'}}, + {Int(maxInt64 - 1), token{String: "9223372036854775806", Float: maxInt64 - 1, Int: maxInt64 - 1, Uint: maxInt64 - 1, Kind: '0'}}, + {Int(maxInt64), token{String: "9223372036854775807", Float: maxInt64, Int: maxInt64, Uint: maxInt64, Kind: '0'}}, + {Uint(minUint64), token{String: "0", Kind: '0'}}, + {Uint(minUint64 + 1), token{String: "1", Float: minUint64 + 1, Int: minUint64 + 1, Uint: minUint64 + 1, Kind: '0'}}, + {Uint(maxUint64 - 1), token{String: "18446744073709551614", Float: maxUint64 - 1, Int: maxInt64, Uint: maxUint64 - 1, Kind: '0'}}, + {Uint(maxUint64), token{String: "18446744073709551615", Float: maxUint64, Int: maxInt64, Uint: maxUint64, Kind: '0'}}, + {rawToken(`-0`), token{String: "-0", Float: math.Copysign(0, -1), Int: 0, Uint: 0, Kind: '0'}}, + {rawToken(`1e1000`), token{String: "1e1000", Float: math.MaxFloat64, Int: maxInt64, Uint: maxUint64, Kind: '0'}}, + {rawToken(`-1e1000`), token{String: "-1e1000", Float: -math.MaxFloat64, Int: minInt64, Uint: minUint64, Kind: '0'}}, + {rawToken(`0.1`), token{String: "0.1", Float: 0.1, Int: 0, Uint: 0, Kind: '0'}}, + {rawToken(`0.5`), token{String: "0.5", Float: 0.5, Int: 0, Uint: 0, Kind: '0'}}, + {rawToken(`0.9`), token{String: "0.9", Float: 0.9, Int: 0, Uint: 0, Kind: '0'}}, + {rawToken(`1.1`), token{String: "1.1", Float: 1.1, Int: 1, Uint: 1, Kind: '0'}}, + {rawToken(`-0.1`), token{String: "-0.1", Float: -0.1, Int: 0, Uint: 0, Kind: '0'}}, + {rawToken(`-0.5`), token{String: "-0.5", Float: -0.5, Int: 0, Uint: 0, Kind: '0'}}, + {rawToken(`-0.9`), token{String: "-0.9", Float: -0.9, Int: 0, Uint: 0, Kind: '0'}}, + {rawToken(`-1.1`), token{String: "-1.1", Float: -1.1, Int: -1, Uint: 0, Kind: '0'}}, + {rawToken(`99999999999999999999`), token{String: "99999999999999999999", Float: 1e20 - 1, Int: maxInt64, Uint: maxUint64, Kind: '0'}}, + {rawToken(`-99999999999999999999`), token{String: "-99999999999999999999", Float: -1e20 - 1, Int: minInt64, Uint: minUint64, Kind: '0'}}, + } + + for _, tt := range tests { + t.Run("", func(t *testing.T) { + got := token{ + Bool: func() bool { + defer func() { recover() }() + return tt.in.Bool() + }(), + String: tt.in.String(), + Float: func() float64 { + defer func() { recover() }() + return tt.in.Float() + }(), + Int: func() int64 { + defer func() { recover() }() + return tt.in.Int() + }(), + Uint: func() uint64 { + defer func() { recover() }() + return tt.in.Uint() + }(), + Kind: tt.in.Kind(), + } + + if got.Bool != tt.want.Bool { + t.Errorf("Token(%s).Bool() = %v, want %v", tt.in, got.Bool, tt.want.Bool) + } + if got.String != tt.want.String { + t.Errorf("Token(%s).String() = %v, want %v", tt.in, got.String, tt.want.String) + } + if math.Float64bits(got.Float) != math.Float64bits(tt.want.Float) { + t.Errorf("Token(%s).Float() = %v, want %v", tt.in, got.Float, tt.want.Float) + } + if got.Int != tt.want.Int { + t.Errorf("Token(%s).Int() = %v, want %v", tt.in, got.Int, tt.want.Int) + } + if got.Uint != tt.want.Uint { + t.Errorf("Token(%s).Uint() = %v, want %v", tt.in, got.Uint, tt.want.Uint) + } + if got.Kind != tt.want.Kind { + t.Errorf("Token(%s).Kind() = %v, want %v", tt.in, got.Kind, tt.want.Kind) + } + }) + } +} + +func TestTokenClone(t *testing.T) { + tests := []struct { + in Token + wantExactRaw bool + }{ + {Token{}, true}, + {Null, true}, + {False, true}, + {True, true}, + {BeginObject, true}, + {EndObject, true}, + {BeginArray, true}, + {EndArray, true}, + {String("hello, world!"), true}, + {rawToken(`"hello, world!"`), false}, + {Float(3.14159), true}, + {rawToken(`3.14159`), false}, + } + + for _, tt := range tests { + t.Run("", func(t *testing.T) { + got := tt.in.Clone() + if !reflect.DeepEqual(got, tt.in) { + t.Errorf("Token(%s) == Token(%s).Clone() = false, want true", tt.in, tt.in) + } + gotExactRaw := got.raw == tt.in.raw + if gotExactRaw != tt.wantExactRaw { + t.Errorf("Token(%s).raw == Token(%s).Clone().raw = %v, want %v", tt.in, tt.in, gotExactRaw, tt.wantExactRaw) + } + }) + } +} diff --git a/go/src/encoding/json/jsontext/value.go b/go/src/encoding/json/jsontext/value.go new file mode 100644 index 0000000000000000000000000000000000000000..84c919b9dc591e160382457ff3f42f517c35adbd --- /dev/null +++ b/go/src/encoding/json/jsontext/value.go @@ -0,0 +1,395 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsontext + +import ( + "bytes" + "errors" + "io" + "slices" + "sync" + + "encoding/json/internal/jsonflags" + "encoding/json/internal/jsonwire" +) + +// NOTE: Value is analogous to v1 json.RawMessage. + +// AppendFormat formats the JSON value in src and appends it to dst +// according to the specified options. +// See [Value.Format] for more details about the formatting behavior. +// +// The dst and src may overlap. +// If an error is reported, then the entirety of src is appended to dst. +func AppendFormat(dst, src []byte, opts ...Options) ([]byte, error) { + e := getBufferedEncoder(opts...) + defer putBufferedEncoder(e) + e.s.Flags.Set(jsonflags.OmitTopLevelNewline | 1) + if err := e.s.WriteValue(src); err != nil { + return append(dst, src...), err + } + return append(dst, e.s.Buf...), nil +} + +// Value represents a single raw JSON value, which may be one of the following: +// - a JSON literal (i.e., null, true, or false) +// - a JSON string (e.g., "hello, world!") +// - a JSON number (e.g., 123.456) +// - an entire JSON object (e.g., {"fizz":"buzz"} ) +// - an entire JSON array (e.g., [1,2,3] ) +// +// Value can represent entire array or object values, while [Token] cannot. +// Value may contain leading and/or trailing whitespace. +type Value []byte + +// Clone returns a copy of v. +func (v Value) Clone() Value { + return bytes.Clone(v) +} + +// String returns the string formatting of v. +func (v Value) String() string { + if v == nil { + return "null" + } + return string(v) +} + +// IsValid reports whether the raw JSON value is syntactically valid +// according to the specified options. +// +// By default (if no options are specified), it validates according to RFC 7493. +// It verifies whether the input is properly encoded as UTF-8, +// that escape sequences within strings decode to valid Unicode codepoints, and +// that all names in each object are unique. +// It does not verify whether numbers are representable within the limits +// of any common numeric type (e.g., float64, int64, or uint64). +// +// Relevant options include: +// - [AllowDuplicateNames] +// - [AllowInvalidUTF8] +// +// All other options are ignored. +func (v Value) IsValid(opts ...Options) bool { + // TODO: Document support for [WithByteLimit] and [WithDepthLimit]. + d := getBufferedDecoder(v, opts...) + defer putBufferedDecoder(d) + _, errVal := d.ReadValue() + _, errEOF := d.ReadToken() + return errVal == nil && errEOF == io.EOF +} + +// Format formats the raw JSON value in place. +// +// By default (if no options are specified), it validates according to RFC 7493 +// and produces the minimal JSON representation, where +// all whitespace is elided and JSON strings use the shortest encoding. +// +// Relevant options include: +// - [AllowDuplicateNames] +// - [AllowInvalidUTF8] +// - [EscapeForHTML] +// - [EscapeForJS] +// - [PreserveRawStrings] +// - [CanonicalizeRawInts] +// - [CanonicalizeRawFloats] +// - [ReorderRawObjects] +// - [SpaceAfterColon] +// - [SpaceAfterComma] +// - [Multiline] +// - [WithIndent] +// - [WithIndentPrefix] +// +// All other options are ignored. +// +// It is guaranteed to succeed if the value is valid according to the same options. +// If the value is already formatted, then the buffer is not mutated. +func (v *Value) Format(opts ...Options) error { + // TODO: Document support for [WithByteLimit] and [WithDepthLimit]. + return v.format(opts, nil) +} + +// format accepts two []Options to avoid the allocation appending them together. +// It is equivalent to v.Format(append(opts1, opts2...)...). +func (v *Value) format(opts1, opts2 []Options) error { + e := getBufferedEncoder(opts1...) + defer putBufferedEncoder(e) + e.s.Join(opts2...) + e.s.Flags.Set(jsonflags.OmitTopLevelNewline | 1) + if err := e.s.WriteValue(*v); err != nil { + return err + } + if !bytes.Equal(*v, e.s.Buf) { + *v = append((*v)[:0], e.s.Buf...) + } + return nil +} + +// Compact removes all whitespace from the raw JSON value. +// +// It does not reformat JSON strings or numbers to use any other representation. +// To maximize the set of JSON values that can be formatted, +// this permits values with duplicate names and invalid UTF-8. +// +// Compact is equivalent to calling [Value.Format] with the following options: +// - [AllowDuplicateNames](true) +// - [AllowInvalidUTF8](true) +// - [PreserveRawStrings](true) +// +// Any options specified by the caller are applied after the initial set +// and may deliberately override prior options. +func (v *Value) Compact(opts ...Options) error { + return v.format([]Options{ + AllowDuplicateNames(true), + AllowInvalidUTF8(true), + PreserveRawStrings(true), + }, opts) +} + +// Indent reformats the whitespace in the raw JSON value so that each element +// in a JSON object or array begins on a indented line according to the nesting. +// +// It does not reformat JSON strings or numbers to use any other representation. +// To maximize the set of JSON values that can be formatted, +// this permits values with duplicate names and invalid UTF-8. +// +// Indent is equivalent to calling [Value.Format] with the following options: +// - [AllowDuplicateNames](true) +// - [AllowInvalidUTF8](true) +// - [PreserveRawStrings](true) +// - [Multiline](true) +// +// Any options specified by the caller are applied after the initial set +// and may deliberately override prior options. +func (v *Value) Indent(opts ...Options) error { + return v.format([]Options{ + AllowDuplicateNames(true), + AllowInvalidUTF8(true), + PreserveRawStrings(true), + Multiline(true), + }, opts) +} + +// Canonicalize canonicalizes the raw JSON value according to the +// JSON Canonicalization Scheme (JCS) as defined by RFC 8785 +// where it produces a stable representation of a JSON value. +// +// JSON strings are formatted to use their minimal representation, +// JSON numbers are formatted as double precision numbers according +// to some stable serialization algorithm. +// JSON object members are sorted in ascending order by name. +// All whitespace is removed. +// +// The output stability is dependent on the stability of the application data +// (see RFC 8785, Appendix E). It cannot produce stable output from +// fundamentally unstable input. For example, if the JSON value +// contains ephemeral data (e.g., a frequently changing timestamp), +// then the value is still unstable regardless of whether this is called. +// +// Canonicalize is equivalent to calling [Value.Format] with the following options: +// - [CanonicalizeRawInts](true) +// - [CanonicalizeRawFloats](true) +// - [ReorderRawObjects](true) +// +// Any options specified by the caller are applied after the initial set +// and may deliberately override prior options. +// +// Note that JCS treats all JSON numbers as IEEE 754 double precision numbers. +// Any numbers with precision beyond what is representable by that form +// will lose their precision when canonicalized. For example, integer values +// beyond ±2⁵³ will lose their precision. To preserve the original representation +// of JSON integers, additionally set [CanonicalizeRawInts] to false: +// +// v.Canonicalize(jsontext.CanonicalizeRawInts(false)) +func (v *Value) Canonicalize(opts ...Options) error { + return v.format([]Options{ + CanonicalizeRawInts(true), + CanonicalizeRawFloats(true), + ReorderRawObjects(true), + }, opts) +} + +// MarshalJSON returns v as the JSON encoding of v. +// It returns the stored value as the raw JSON output without any validation. +// If v is nil, then this returns a JSON null. +func (v Value) MarshalJSON() ([]byte, error) { + // NOTE: This matches the behavior of v1 json.RawMessage.MarshalJSON. + if v == nil { + return []byte("null"), nil + } + return v, nil +} + +// UnmarshalJSON sets v as the JSON encoding of b. +// It stores a copy of the provided raw JSON input without any validation. +func (v *Value) UnmarshalJSON(b []byte) error { + // NOTE: This matches the behavior of v1 json.RawMessage.UnmarshalJSON. + if v == nil { + return errors.New("jsontext.Value: UnmarshalJSON on nil pointer") + } + *v = append((*v)[:0], b...) + return nil +} + +// Kind returns the starting token kind. +// For a valid value, this will never include [KindEndObject] or [KindEndArray]. +func (v Value) Kind() Kind { + if v := v[jsonwire.ConsumeWhitespace(v):]; len(v) > 0 { + return Kind(v[0]).normalize() + } + return invalidKind +} + +const commaAndWhitespace = ", \n\r\t" + +type objectMember struct { + // name is the unquoted name. + name []byte // e.g., "name" + // buffer is the entirety of the raw JSON object member + // starting from right after the previous member (or opening '{') + // until right after the member value. + buffer []byte // e.g., `, \n\r\t"name": "value"` +} + +func (x objectMember) Compare(y objectMember) int { + if c := jsonwire.CompareUTF16(x.name, y.name); c != 0 { + return c + } + // With [AllowDuplicateNames] or [AllowInvalidUTF8], + // names could be identical, so also sort using the member value. + return jsonwire.CompareUTF16( + bytes.TrimLeft(x.buffer, commaAndWhitespace), + bytes.TrimLeft(y.buffer, commaAndWhitespace)) +} + +var objectMemberPool = sync.Pool{New: func() any { return new([]objectMember) }} + +func getObjectMembers() *[]objectMember { + ns := objectMemberPool.Get().(*[]objectMember) + *ns = (*ns)[:0] + return ns +} +func putObjectMembers(ns *[]objectMember) { + if cap(*ns) < 1<<10 { + clear(*ns) // avoid pinning name and buffer + objectMemberPool.Put(ns) + } +} + +// mustReorderObjects reorders in-place all object members in a JSON value, +// which must be valid otherwise it panics. +func mustReorderObjects(b []byte) { + // Obtain a buffered encoder just to use its internal buffer as + // a scratch buffer for reordering object members. + e2 := getBufferedEncoder() + defer putBufferedEncoder(e2) + + // Disable unnecessary checks to syntactically parse the JSON value. + d := getBufferedDecoder(b) + defer putBufferedDecoder(d) + d.s.Flags.Set(jsonflags.AllowDuplicateNames | jsonflags.AllowInvalidUTF8 | 1) + mustReorderObjectsFromDecoder(d, &e2.s.Buf) // per RFC 8785, section 3.2.3 +} + +// mustReorderObjectsFromDecoder recursively reorders all object members in place +// according to the ordering specified in RFC 8785, section 3.2.3. +// +// Pre-conditions: +// - The value is valid (i.e., no decoder errors should ever occur). +// - Initial call is provided a Decoder reading from the start of v. +// +// Post-conditions: +// - Exactly one JSON value is read from the Decoder. +// - All fully-parsed JSON objects are reordered by directly moving +// the members in the value buffer. +// +// The runtime is approximately O(n·log(n)) + O(m·log(m)), +// where n is len(v) and m is the total number of object members. +func mustReorderObjectsFromDecoder(d *Decoder, scratch *[]byte) { + switch tok, err := d.ReadToken(); tok.Kind() { + case '{': + // Iterate and collect the name and offsets for every object member. + members := getObjectMembers() + defer putObjectMembers(members) + var prevMember objectMember + isSorted := true + + beforeBody := d.InputOffset() // offset after '{' + for d.PeekKind() != '}' { + beforeName := d.InputOffset() + var flags jsonwire.ValueFlags + name, _ := d.s.ReadValue(&flags) + name = jsonwire.UnquoteMayCopy(name, flags.IsVerbatim()) + mustReorderObjectsFromDecoder(d, scratch) + afterValue := d.InputOffset() + + currMember := objectMember{name, d.s.buf[beforeName:afterValue]} + if isSorted && len(*members) > 0 { + isSorted = objectMember.Compare(prevMember, currMember) < 0 + } + *members = append(*members, currMember) + prevMember = currMember + } + afterBody := d.InputOffset() // offset before '}' + d.ReadToken() + + // Sort the members; return early if it's already sorted. + if isSorted { + return + } + firstBufferBeforeSorting := (*members)[0].buffer + slices.SortFunc(*members, objectMember.Compare) + firstBufferAfterSorting := (*members)[0].buffer + + // Append the reordered members to a new buffer, + // then copy the reordered members back over the original members. + // Avoid swapping in place since each member may be a different size + // where moving a member over a smaller member may corrupt the data + // for subsequent members before they have been moved. + // + // The following invariant must hold: + // sum([m.after-m.before for m in members]) == afterBody-beforeBody + commaAndWhitespacePrefix := func(b []byte) []byte { + return b[:len(b)-len(bytes.TrimLeft(b, commaAndWhitespace))] + } + sorted := (*scratch)[:0] + for i, member := range *members { + switch { + case i == 0 && &member.buffer[0] != &firstBufferBeforeSorting[0]: + // First member after sorting is not the first member before sorting, + // so use the prefix of the first member before sorting. + sorted = append(sorted, commaAndWhitespacePrefix(firstBufferBeforeSorting)...) + sorted = append(sorted, bytes.TrimLeft(member.buffer, commaAndWhitespace)...) + case i != 0 && &member.buffer[0] == &firstBufferBeforeSorting[0]: + // Later member after sorting is the first member before sorting, + // so use the prefix of the first member after sorting. + sorted = append(sorted, commaAndWhitespacePrefix(firstBufferAfterSorting)...) + sorted = append(sorted, bytes.TrimLeft(member.buffer, commaAndWhitespace)...) + default: + sorted = append(sorted, member.buffer...) + } + } + if int(afterBody-beforeBody) != len(sorted) { + panic("BUG: length invariant violated") + } + copy(d.s.buf[beforeBody:afterBody], sorted) + + // Update scratch buffer to the largest amount ever used. + if len(sorted) > len(*scratch) { + *scratch = sorted + } + case '[': + for d.PeekKind() != ']' { + mustReorderObjectsFromDecoder(d, scratch) + } + d.ReadToken() + default: + if err != nil { + panic("BUG: " + err.Error()) + } + } +} diff --git a/go/src/encoding/json/jsontext/value_test.go b/go/src/encoding/json/jsontext/value_test.go new file mode 100644 index 0000000000000000000000000000000000000000..184a27d88ea7f741f9577fa221883d3391f7109c --- /dev/null +++ b/go/src/encoding/json/jsontext/value_test.go @@ -0,0 +1,200 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package jsontext + +import ( + "io" + "strings" + "testing" + + "encoding/json/internal/jsontest" + "encoding/json/internal/jsonwire" +) + +type valueTestdataEntry struct { + name jsontest.CaseName + in string + wantValid bool + wantCompacted string + wantCompactErr error // implies wantCompacted is in + wantIndented string // wantCompacted if empty; uses "\t" for indent prefix and " " for indent + wantIndentErr error // implies wantCompacted is in + wantCanonicalized string // wantCompacted if empty + wantCanonicalizeErr error // implies wantCompacted is in +} + +var valueTestdata = append(func() (out []valueTestdataEntry) { + // Initialize valueTestdata from coderTestdata. + for _, td := range coderTestdata { + // NOTE: The Compact method preserves the raw formatting of strings, + // while the Encoder (by default) does not. + if td.name.Name == "ComplicatedString" { + td.outCompacted = strings.TrimSpace(td.in) + } + out = append(out, valueTestdataEntry{ + name: td.name, + in: td.in, + wantValid: true, + wantCompacted: td.outCompacted, + wantIndented: td.outIndented, + wantCanonicalized: td.outCanonicalized, + }) + } + return out +}(), []valueTestdataEntry{{ + name: jsontest.Name("RFC8785/Primitives"), + in: `{ + "numbers": [333333333.33333329, 1E30, 4.50, + 2e-3, 0.000000000000000000000000001, -0], + "string": "\u20ac$\u000F\u000aA'\u0042\u0022\u005c\\\"\/", + "literals": [null, true, false] + }`, + wantValid: true, + wantCompacted: `{"numbers":[333333333.33333329,1E30,4.50,2e-3,0.000000000000000000000000001,-0],"string":"\u20ac$\u000F\u000aA'\u0042\u0022\u005c\\\"\/","literals":[null,true,false]}`, + wantIndented: `{ + "numbers": [ + 333333333.33333329, + 1E30, + 4.50, + 2e-3, + 0.000000000000000000000000001, + -0 + ], + "string": "\u20ac$\u000F\u000aA'\u0042\u0022\u005c\\\"\/", + "literals": [ + null, + true, + false + ] + }`, + wantCanonicalized: `{"literals":[null,true,false],"numbers":[333333333.3333333,1e+30,4.5,0.002,1e-27,0],"string":"€$\u000f\nA'B\"\\\\\"/"}`, +}, { + name: jsontest.Name("RFC8785/ObjectOrdering"), + in: `{ + "\u20ac": "Euro Sign", + "\r": "Carriage Return", + "\ufb33": "Hebrew Letter Dalet With Dagesh", + "1": "One", + "\ud83d\ude00": "Emoji: Grinning Face", + "\u0080": "Control", + "\u00f6": "Latin Small Letter O With Diaeresis" + }`, + wantValid: true, + wantCompacted: `{"\u20ac":"Euro Sign","\r":"Carriage Return","\ufb33":"Hebrew Letter Dalet With Dagesh","1":"One","\ud83d\ude00":"Emoji: Grinning Face","\u0080":"Control","\u00f6":"Latin Small Letter O With Diaeresis"}`, + wantIndented: `{ + "\u20ac": "Euro Sign", + "\r": "Carriage Return", + "\ufb33": "Hebrew Letter Dalet With Dagesh", + "1": "One", + "\ud83d\ude00": "Emoji: Grinning Face", + "\u0080": "Control", + "\u00f6": "Latin Small Letter O With Diaeresis" + }`, + wantCanonicalized: `{"\r":"Carriage Return","1":"One","€":"Control","ö":"Latin Small Letter O With Diaeresis","€":"Euro Sign","😀":"Emoji: Grinning Face","דּ":"Hebrew Letter Dalet With Dagesh"}`, +}, { + name: jsontest.Name("LargeIntegers"), + in: ` [ -9223372036854775808 , 9223372036854775807 ] `, + wantValid: true, + wantCompacted: `[-9223372036854775808,9223372036854775807]`, + wantIndented: `[ + -9223372036854775808, + 9223372036854775807 + ]`, + wantCanonicalized: `[-9223372036854776000,9223372036854776000]`, // NOTE: Loss of precision due to numbers being treated as floats. +}, { + name: jsontest.Name("InvalidUTF8"), + in: ` "living` + "\xde\xad\xbe\xef" + `\ufffd�" `, + wantValid: false, // uses RFC 7493 as the definition; which validates UTF-8 + wantCompacted: `"living` + "\xde\xad\xbe\xef" + `\ufffd�"`, + wantCanonicalizeErr: E(jsonwire.ErrInvalidUTF8).withPos(` "living`+"\xde\xad", ""), +}, { + name: jsontest.Name("InvalidUTF8/SurrogateHalf"), + in: `"\ud800"`, + wantValid: false, // uses RFC 7493 as the definition; which validates UTF-8 + wantCompacted: `"\ud800"`, + wantCanonicalizeErr: newInvalidEscapeSequenceError(`\ud800"`).withPos(`"`, ""), +}, { + name: jsontest.Name("UppercaseEscaped"), + in: `"\u000B"`, + wantValid: true, + wantCompacted: `"\u000B"`, + wantCanonicalized: `"\u000b"`, +}, { + name: jsontest.Name("DuplicateNames"), + in: ` { "0" : 0 , "1" : 1 , "0" : 0 }`, + wantValid: false, // uses RFC 7493 as the definition; which does check for object uniqueness + wantCompacted: `{"0":0,"1":1,"0":0}`, + wantIndented: `{ + "0": 0, + "1": 1, + "0": 0 + }`, + wantCanonicalizeErr: E(ErrDuplicateName).withPos(` { "0" : 0 , "1" : 1 , `, "/0"), +}, { + name: jsontest.Name("Whitespace"), + in: " \n\r\t", + wantValid: false, + wantCompacted: " \n\r\t", + wantCompactErr: E(io.ErrUnexpectedEOF).withPos(" \n\r\t", ""), + wantIndentErr: E(io.ErrUnexpectedEOF).withPos(" \n\r\t", ""), + wantCanonicalizeErr: E(io.ErrUnexpectedEOF).withPos(" \n\r\t", ""), +}}...) + +func TestValueMethods(t *testing.T) { + for _, td := range valueTestdata { + t.Run(td.name.Name, func(t *testing.T) { + if td.wantIndented == "" { + td.wantIndented = td.wantCompacted + } + if td.wantCanonicalized == "" { + td.wantCanonicalized = td.wantCompacted + } + if td.wantCompactErr != nil { + td.wantCompacted = td.in + } + if td.wantIndentErr != nil { + td.wantIndented = td.in + } + if td.wantCanonicalizeErr != nil { + td.wantCanonicalized = td.in + } + + v := Value(td.in) + gotValid := v.IsValid() + if gotValid != td.wantValid { + t.Errorf("%s: Value.IsValid = %v, want %v", td.name.Where, gotValid, td.wantValid) + } + + gotCompacted := Value(td.in) + gotCompactErr := gotCompacted.Compact() + if string(gotCompacted) != td.wantCompacted { + t.Errorf("%s: Value.Compact = %s, want %s", td.name.Where, gotCompacted, td.wantCompacted) + } + if !equalError(gotCompactErr, td.wantCompactErr) { + t.Errorf("%s: Value.Compact error mismatch:\ngot %v\nwant %v", td.name.Where, gotCompactErr, td.wantCompactErr) + } + + gotIndented := Value(td.in) + gotIndentErr := gotIndented.Indent(WithIndentPrefix("\t"), WithIndent(" ")) + if string(gotIndented) != td.wantIndented { + t.Errorf("%s: Value.Indent = %s, want %s", td.name.Where, gotIndented, td.wantIndented) + } + if !equalError(gotIndentErr, td.wantIndentErr) { + t.Errorf("%s: Value.Indent error mismatch:\ngot %v\nwant %v", td.name.Where, gotIndentErr, td.wantIndentErr) + } + + gotCanonicalized := Value(td.in) + gotCanonicalizeErr := gotCanonicalized.Canonicalize() + if string(gotCanonicalized) != td.wantCanonicalized { + t.Errorf("%s: Value.Canonicalize = %s, want %s", td.name.Where, gotCanonicalized, td.wantCanonicalized) + } + if !equalError(gotCanonicalizeErr, td.wantCanonicalizeErr) { + t.Errorf("%s: Value.Canonicalize error mismatch:\ngot %v\nwant %v", td.name.Where, gotCanonicalizeErr, td.wantCanonicalizeErr) + } + }) + } +} diff --git a/go/src/encoding/json/v2/arshal.go b/go/src/encoding/json/v2/arshal.go new file mode 100644 index 0000000000000000000000000000000000000000..5537a467d836e3cfe86aa583a648e4bc5ca7b7b6 --- /dev/null +++ b/go/src/encoding/json/v2/arshal.go @@ -0,0 +1,576 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json + +import ( + "bytes" + "encoding" + "io" + "reflect" + "sync" + "time" + + "encoding/json/internal" + "encoding/json/internal/jsonflags" + "encoding/json/internal/jsonopts" + "encoding/json/jsontext" +) + +// Reference encoding and time packages to assist pkgsite +// in being able to hotlink references to those packages. +var ( + _ encoding.TextMarshaler + _ encoding.TextAppender + _ encoding.TextUnmarshaler + _ time.Time + _ time.Duration +) + +// export exposes internal functionality of the "jsontext" package. +var export = jsontext.Internal.Export(&internal.AllowInternalUse) + +// Marshal serializes a Go value as a []byte according to the provided +// marshal and encode options (while ignoring unmarshal or decode options). +// It does not terminate the output with a newline. +// +// Type-specific marshal functions and methods take precedence +// over the default representation of a value. +// Functions or methods that operate on *T are only called when encoding +// a value of type T (by taking its address) or a non-nil value of *T. +// Marshal ensures that a value is always addressable +// (by boxing it on the heap if necessary) so that +// these functions and methods can be consistently called. For performance, +// it is recommended that Marshal be passed a non-nil pointer to the value. +// +// The input value is encoded as JSON according the following rules: +// +// - If any type-specific functions in a [WithMarshalers] option match +// the value type, then those functions are called to encode the value. +// If all applicable functions return [SkipFunc], +// then the value is encoded according to subsequent rules. +// +// - If the value type implements [MarshalerTo], +// then the MarshalJSONTo method is called to encode the value. +// +// - If the value type implements [Marshaler], +// then the MarshalJSON method is called to encode the value. +// +// - If the value type implements [encoding.TextAppender], +// then the AppendText method is called to encode the value and +// subsequently encode its result as a JSON string. +// +// - If the value type implements [encoding.TextMarshaler], +// then the MarshalText method is called to encode the value and +// subsequently encode its result as a JSON string. +// +// - Otherwise, the value is encoded according to the value's type +// as described in detail below. +// +// Most Go types have a default JSON representation. +// Certain types support specialized formatting according to +// a format flag optionally specified in the Go struct tag +// for the struct field that contains the current value +// (see the “JSON Representation of Go structs” section for more details). +// +// The representation of each type is as follows: +// +// - A Go boolean is encoded as a JSON boolean (e.g., true or false). +// It does not support any custom format flags. +// +// - A Go string is encoded as a JSON string. +// It does not support any custom format flags. +// +// - A Go []byte or [N]byte is encoded as a JSON string containing +// the binary value encoded using RFC 4648. +// If the format is "base64" or unspecified, then this uses RFC 4648, section 4. +// If the format is "base64url", then this uses RFC 4648, section 5. +// If the format is "base32", then this uses RFC 4648, section 6. +// If the format is "base32hex", then this uses RFC 4648, section 7. +// If the format is "base16" or "hex", then this uses RFC 4648, section 8. +// If the format is "array", then the bytes value is encoded as a JSON array +// where each byte is recursively JSON-encoded as each JSON array element. +// +// - A Go integer is encoded as a JSON number without fractions or exponents. +// If [StringifyNumbers] is specified or encoding a JSON object name, +// then the JSON number is encoded within a JSON string. +// It does not support any custom format flags. +// +// - A Go float is encoded as a JSON number. +// If [StringifyNumbers] is specified or encoding a JSON object name, +// then the JSON number is encoded within a JSON string. +// If the format is "nonfinite", then NaN, +Inf, and -Inf are encoded as +// the JSON strings "NaN", "Infinity", and "-Infinity", respectively. +// Otherwise, the presence of non-finite numbers results in a [SemanticError]. +// +// - A Go map is encoded as a JSON object, where each Go map key and value +// is recursively encoded as a name and value pair in the JSON object. +// The Go map key must encode as a JSON string, otherwise this results +// in a [SemanticError]. The Go map is traversed in a non-deterministic order. +// For deterministic encoding, consider using the [Deterministic] option. +// If the format is "emitnull", then a nil map is encoded as a JSON null. +// If the format is "emitempty", then a nil map is encoded as an empty JSON object, +// regardless of whether [FormatNilMapAsNull] is specified. +// Otherwise by default, a nil map is encoded as an empty JSON object. +// +// - A Go struct is encoded as a JSON object. +// See the “JSON Representation of Go structs” section +// in the package-level documentation for more details. +// +// - A Go slice is encoded as a JSON array, where each Go slice element +// is recursively JSON-encoded as the elements of the JSON array. +// If the format is "emitnull", then a nil slice is encoded as a JSON null. +// If the format is "emitempty", then a nil slice is encoded as an empty JSON array, +// regardless of whether [FormatNilSliceAsNull] is specified. +// Otherwise by default, a nil slice is encoded as an empty JSON array. +// +// - A Go array is encoded as a JSON array, where each Go array element +// is recursively JSON-encoded as the elements of the JSON array. +// The JSON array length is always identical to the Go array length. +// It does not support any custom format flags. +// +// - A Go pointer is encoded as a JSON null if nil, otherwise it is +// the recursively JSON-encoded representation of the underlying value. +// Format flags are forwarded to the encoding of the underlying value. +// +// - A Go interface is encoded as a JSON null if nil, otherwise it is +// the recursively JSON-encoded representation of the underlying value. +// It does not support any custom format flags. +// +// - A Go [time.Time] is encoded as a JSON string containing the timestamp +// formatted in RFC 3339 with nanosecond precision. +// If the format matches one of the format constants declared +// in the time package (e.g., RFC1123), then that format is used. +// If the format is "unix", "unixmilli", "unixmicro", or "unixnano", +// then the timestamp is encoded as a possibly fractional JSON number +// of the number of seconds (or milliseconds, microseconds, or nanoseconds) +// since the Unix epoch, which is January 1st, 1970 at 00:00:00 UTC. +// To avoid a fractional component, round the timestamp to the relevant unit. +// Otherwise, the format is used as-is with [time.Time.Format] if non-empty. +// +// - A Go [time.Duration] currently has no default representation and +// requires an explicit format to be specified. +// If the format is "sec", "milli", "micro", or "nano", +// then the duration is encoded as a possibly fractional JSON number +// of the number of seconds (or milliseconds, microseconds, or nanoseconds). +// To avoid a fractional component, round the duration to the relevant unit. +// If the format is "units", it is encoded as a JSON string formatted using +// [time.Duration.String] (e.g., "1h30m" for 1 hour 30 minutes). +// If the format is "iso8601", it is encoded as a JSON string using the +// ISO 8601 standard for durations (e.g., "PT1H30M" for 1 hour 30 minutes) +// using only accurate units of hours, minutes, and seconds. +// +// - All other Go types (e.g., complex numbers, channels, and functions) +// have no default representation and result in a [SemanticError]. +// +// JSON cannot represent cyclic data structures and Marshal does not handle them. +// Passing cyclic structures will result in an error. +func Marshal(in any, opts ...Options) (out []byte, err error) { + enc := export.GetBufferedEncoder(opts...) + defer export.PutBufferedEncoder(enc) + xe := export.Encoder(enc) + xe.Flags.Set(jsonflags.OmitTopLevelNewline | 1) + err = marshalEncode(enc, in, &xe.Struct) + if err != nil && xe.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return nil, internal.TransformMarshalError(in, err) + } + return bytes.Clone(xe.Buf), err +} + +// MarshalWrite serializes a Go value into an [io.Writer] according to the provided +// marshal and encode options (while ignoring unmarshal or decode options). +// It does not terminate the output with a newline. +// See [Marshal] for details about the conversion of a Go value into JSON. +func MarshalWrite(out io.Writer, in any, opts ...Options) (err error) { + enc := export.GetStreamingEncoder(out, opts...) + defer export.PutStreamingEncoder(enc) + xe := export.Encoder(enc) + xe.Flags.Set(jsonflags.OmitTopLevelNewline | 1) + err = marshalEncode(enc, in, &xe.Struct) + if err != nil && xe.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return internal.TransformMarshalError(in, err) + } + return err +} + +// MarshalEncode serializes a Go value into an [jsontext.Encoder] according to +// the provided marshal options (while ignoring unmarshal, encode, or decode options). +// Any marshal-relevant options already specified on the [jsontext.Encoder] +// take lower precedence than the set of options provided by the caller. +// Unlike [Marshal] and [MarshalWrite], encode options are ignored because +// they must have already been specified on the provided [jsontext.Encoder]. +// +// See [Marshal] for details about the conversion of a Go value into JSON. +func MarshalEncode(out *jsontext.Encoder, in any, opts ...Options) (err error) { + xe := export.Encoder(out) + if len(opts) > 0 { + optsOriginal := xe.Struct + defer func() { xe.Struct = optsOriginal }() + xe.Struct.JoinWithoutCoderOptions(opts...) + } + err = marshalEncode(out, in, &xe.Struct) + if err != nil && xe.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return internal.TransformMarshalError(in, err) + } + return err +} + +func marshalEncode(out *jsontext.Encoder, in any, mo *jsonopts.Struct) (err error) { + v := reflect.ValueOf(in) + if !v.IsValid() || (v.Kind() == reflect.Pointer && v.IsNil()) { + return out.WriteToken(jsontext.Null) + } + // Shallow copy non-pointer values to obtain an addressable value. + // It is beneficial to performance to always pass pointers to avoid this. + forceAddr := v.Kind() != reflect.Pointer + if forceAddr { + v2 := reflect.New(v.Type()) + v2.Elem().Set(v) + v = v2 + } + va := addressableValue{v.Elem(), forceAddr} // dereferenced pointer is always addressable + t := va.Type() + + // Lookup and call the marshal function for this type. + marshal := lookupArshaler(t).marshal + if mo.Marshalers != nil { + marshal, _ = mo.Marshalers.(*Marshalers).lookup(marshal, t) + } + if err := marshal(out, va, mo); err != nil { + if !mo.Flags.Get(jsonflags.AllowDuplicateNames) { + export.Encoder(out).Tokens.InvalidateDisabledNamespaces() + } + return err + } + return nil +} + +// Unmarshal decodes a []byte input into a Go value according to the provided +// unmarshal and decode options (while ignoring marshal or encode options). +// The input must be a single JSON value with optional whitespace interspersed. +// The output must be a non-nil pointer. +// +// Type-specific unmarshal functions and methods take precedence +// over the default representation of a value. +// Functions or methods that operate on *T are only called when decoding +// a value of type T (by taking its address) or a non-nil value of *T. +// Unmarshal ensures that a value is always addressable +// (by boxing it on the heap if necessary) so that +// these functions and methods can be consistently called. +// +// The input is decoded into the output according the following rules: +// +// - If any type-specific functions in a [WithUnmarshalers] option match +// the value type, then those functions are called to decode the JSON +// value. If all applicable functions return [SkipFunc], +// then the input is decoded according to subsequent rules. +// +// - If the value type implements [UnmarshalerFrom], +// then the UnmarshalJSONFrom method is called to decode the JSON value. +// +// - If the value type implements [Unmarshaler], +// then the UnmarshalJSON method is called to decode the JSON value. +// +// - If the value type implements [encoding.TextUnmarshaler], +// then the input is decoded as a JSON string and +// the UnmarshalText method is called with the decoded string value. +// This fails with a [SemanticError] if the input is not a JSON string. +// +// - Otherwise, the JSON value is decoded according to the value's type +// as described in detail below. +// +// Most Go types have a default JSON representation. +// Certain types support specialized formatting according to +// a format flag optionally specified in the Go struct tag +// for the struct field that contains the current value +// (see the “JSON Representation of Go structs” section for more details). +// A JSON null may be decoded into every supported Go value where +// it is equivalent to storing the zero value of the Go value. +// If the input JSON kind is not handled by the current Go value type, +// then this fails with a [SemanticError]. Unless otherwise specified, +// the decoded value replaces any pre-existing value. +// +// The representation of each type is as follows: +// +// - A Go boolean is decoded from a JSON boolean (e.g., true or false). +// It does not support any custom format flags. +// +// - A Go string is decoded from a JSON string. +// It does not support any custom format flags. +// +// - A Go []byte or [N]byte is decoded from a JSON string +// containing the binary value encoded using RFC 4648. +// If the format is "base64" or unspecified, then this uses RFC 4648, section 4. +// If the format is "base64url", then this uses RFC 4648, section 5. +// If the format is "base32", then this uses RFC 4648, section 6. +// If the format is "base32hex", then this uses RFC 4648, section 7. +// If the format is "base16" or "hex", then this uses RFC 4648, section 8. +// If the format is "array", then the Go slice or array is decoded from a +// JSON array where each JSON element is recursively decoded for each byte. +// When decoding into a non-nil []byte, the slice length is reset to zero +// and the decoded input is appended to it. +// When decoding into a [N]byte, the input must decode to exactly N bytes, +// otherwise it fails with a [SemanticError]. +// +// - A Go integer is decoded from a JSON number. +// It must be decoded from a JSON string containing a JSON number +// if [StringifyNumbers] is specified or decoding a JSON object name. +// It fails with a [SemanticError] if the JSON number +// has a fractional or exponent component. +// It also fails if it overflows the representation of the Go integer type. +// It does not support any custom format flags. +// +// - A Go float is decoded from a JSON number. +// It must be decoded from a JSON string containing a JSON number +// if [StringifyNumbers] is specified or decoding a JSON object name. +// It fails if it overflows the representation of the Go float type. +// If the format is "nonfinite", then the JSON strings +// "NaN", "Infinity", and "-Infinity" are decoded as NaN, +Inf, and -Inf. +// Otherwise, the presence of such strings results in a [SemanticError]. +// +// - A Go map is decoded from a JSON object, +// where each JSON object name and value pair is recursively decoded +// as the Go map key and value. Maps are not cleared. +// If the Go map is nil, then a new map is allocated to decode into. +// If the decoded key matches an existing Go map entry, the entry value +// is reused by decoding the JSON object value into it. +// The formats "emitnull" and "emitempty" have no effect when decoding. +// +// - A Go struct is decoded from a JSON object. +// See the “JSON Representation of Go structs” section +// in the package-level documentation for more details. +// +// - A Go slice is decoded from a JSON array, where each JSON element +// is recursively decoded and appended to the Go slice. +// Before appending into a Go slice, a new slice is allocated if it is nil, +// otherwise the slice length is reset to zero. +// The formats "emitnull" and "emitempty" have no effect when decoding. +// +// - A Go array is decoded from a JSON array, where each JSON array element +// is recursively decoded as each corresponding Go array element. +// Each Go array element is zeroed before decoding into it. +// It fails with a [SemanticError] if the JSON array does not contain +// the exact same number of elements as the Go array. +// It does not support any custom format flags. +// +// - A Go pointer is decoded based on the JSON kind and underlying Go type. +// If the input is a JSON null, then this stores a nil pointer. +// Otherwise, it allocates a new underlying value if the pointer is nil, +// and recursively JSON decodes into the underlying value. +// Format flags are forwarded to the decoding of the underlying type. +// +// - A Go interface is decoded based on the JSON kind and underlying Go type. +// If the input is a JSON null, then this stores a nil interface value. +// Otherwise, a nil interface value of an empty interface type is initialized +// with a zero Go bool, string, float64, map[string]any, or []any if the +// input is a JSON boolean, string, number, object, or array, respectively. +// If the interface value is still nil, then this fails with a [SemanticError] +// since decoding could not determine an appropriate Go type to decode into. +// For example, unmarshaling into a nil io.Reader fails since +// there is no concrete type to populate the interface value with. +// Otherwise an underlying value exists and it recursively decodes +// the JSON input into it. It does not support any custom format flags. +// +// - A Go [time.Time] is decoded from a JSON string containing the time +// formatted in RFC 3339 with nanosecond precision. +// If the format matches one of the format constants declared in +// the time package (e.g., RFC1123), then that format is used for parsing. +// If the format is "unix", "unixmilli", "unixmicro", or "unixnano", +// then the timestamp is decoded from an optionally fractional JSON number +// of the number of seconds (or milliseconds, microseconds, or nanoseconds) +// since the Unix epoch, which is January 1st, 1970 at 00:00:00 UTC. +// Otherwise, the format is used as-is with [time.Time.Parse] if non-empty. +// +// - A Go [time.Duration] currently has no default representation and +// requires an explicit format to be specified. +// If the format is "sec", "milli", "micro", or "nano", +// then the duration is decoded from an optionally fractional JSON number +// of the number of seconds (or milliseconds, microseconds, or nanoseconds). +// If the format is "units", it is decoded from a JSON string parsed using +// [time.ParseDuration] (e.g., "1h30m" for 1 hour 30 minutes). +// If the format is "iso8601", it is decoded from a JSON string using the +// ISO 8601 standard for durations (e.g., "PT1H30M" for 1 hour 30 minutes) +// accepting only accurate units of hours, minutes, or seconds. +// +// - All other Go types (e.g., complex numbers, channels, and functions) +// have no default representation and result in a [SemanticError]. +// +// In general, unmarshaling follows merge semantics (similar to RFC 7396) +// where the decoded Go value replaces the destination value +// for any JSON kind other than an object. +// For JSON objects, the input object is merged into the destination value +// where matching object members recursively apply merge semantics. +func Unmarshal(in []byte, out any, opts ...Options) (err error) { + dec := export.GetBufferedDecoder(in, opts...) + defer export.PutBufferedDecoder(dec) + xd := export.Decoder(dec) + err = unmarshalDecode(dec, out, &xd.Struct, true) + if err != nil && xd.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return internal.TransformUnmarshalError(out, err) + } + return err +} + +// UnmarshalRead deserializes a Go value from an [io.Reader] according to the +// provided unmarshal and decode options (while ignoring marshal or encode options). +// The input must be a single JSON value with optional whitespace interspersed. +// It consumes the entirety of [io.Reader] until [io.EOF] is encountered, +// without reporting an error for EOF. The output must be a non-nil pointer. +// See [Unmarshal] for details about the conversion of JSON into a Go value. +func UnmarshalRead(in io.Reader, out any, opts ...Options) (err error) { + dec := export.GetStreamingDecoder(in, opts...) + defer export.PutStreamingDecoder(dec) + xd := export.Decoder(dec) + err = unmarshalDecode(dec, out, &xd.Struct, true) + if err != nil && xd.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return internal.TransformUnmarshalError(out, err) + } + return err +} + +// UnmarshalDecode deserializes a Go value from a [jsontext.Decoder] according to +// the provided unmarshal options (while ignoring marshal, encode, or decode options). +// Any unmarshal options already specified on the [jsontext.Decoder] +// take lower precedence than the set of options provided by the caller. +// Unlike [Unmarshal] and [UnmarshalRead], decode options are ignored because +// they must have already been specified on the provided [jsontext.Decoder]. +// +// The input may be a stream of zero or more JSON values, +// where this only unmarshals the next JSON value in the stream. +// If there are no more top-level JSON values, it reports [io.EOF]. +// The output must be a non-nil pointer. +// See [Unmarshal] for details about the conversion of JSON into a Go value. +func UnmarshalDecode(in *jsontext.Decoder, out any, opts ...Options) (err error) { + xd := export.Decoder(in) + if len(opts) > 0 { + optsOriginal := xd.Struct + defer func() { xd.Struct = optsOriginal }() + xd.Struct.JoinWithoutCoderOptions(opts...) + } + err = unmarshalDecode(in, out, &xd.Struct, false) + if err != nil && xd.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return internal.TransformUnmarshalError(out, err) + } + return err +} + +func unmarshalDecode(in *jsontext.Decoder, out any, uo *jsonopts.Struct, last bool) (err error) { + v := reflect.ValueOf(out) + if v.Kind() != reflect.Pointer || v.IsNil() { + return &SemanticError{action: "unmarshal", GoType: reflect.TypeOf(out), Err: internal.ErrNonNilReference} + } + va := addressableValue{v.Elem(), false} // dereferenced pointer is always addressable + t := va.Type() + + // In legacy semantics, the entirety of the next JSON value + // was validated before attempting to unmarshal it. + if uo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + if err := export.Decoder(in).CheckNextValue(last); err != nil { + if err == io.EOF && last { + offset := in.InputOffset() + int64(len(in.UnreadBuffer())) + return &jsontext.SyntacticError{ByteOffset: offset, Err: io.ErrUnexpectedEOF} + } + return err + } + } + + // Lookup and call the unmarshal function for this type. + unmarshal := lookupArshaler(t).unmarshal + if uo.Unmarshalers != nil { + unmarshal, _ = uo.Unmarshalers.(*Unmarshalers).lookup(unmarshal, t) + } + if err := unmarshal(in, va, uo); err != nil { + if !uo.Flags.Get(jsonflags.AllowDuplicateNames) { + export.Decoder(in).Tokens.InvalidateDisabledNamespaces() + } + if err == io.EOF && last { + offset := in.InputOffset() + int64(len(in.UnreadBuffer())) + return &jsontext.SyntacticError{ByteOffset: offset, Err: io.ErrUnexpectedEOF} + } + return err + } + if last { + return export.Decoder(in).CheckEOF() + } + return nil +} + +// addressableValue is a reflect.Value that is guaranteed to be addressable +// such that calling the Addr and Set methods do not panic. +// +// There is no compile magic that enforces this property, +// but rather the need to construct this type makes it easier to examine each +// construction site to ensure that this property is upheld. +type addressableValue struct { + reflect.Value + + // forcedAddr reports whether this value is addressable + // only through the use of [newAddressableValue]. + // This is only used for [jsonflags.CallMethodsWithLegacySemantics]. + forcedAddr bool +} + +// newAddressableValue constructs a new addressable value of type t. +func newAddressableValue(t reflect.Type) addressableValue { + return addressableValue{reflect.New(t).Elem(), true} +} + +// TODO: Remove *jsonopts.Struct argument from [marshaler] and [unmarshaler]. +// This can be directly accessed on the encoder or decoder. + +// All marshal and unmarshal behavior is implemented using these signatures. +// The *jsonopts.Struct argument is guaranteed to identical to or at least +// a strict super-set of the options in Encoder.Struct or Decoder.Struct. +// It is identical for Marshal, Unmarshal, MarshalWrite, and UnmarshalRead. +// It is a super-set for MarshalEncode and UnmarshalDecode. +type ( + marshaler = func(*jsontext.Encoder, addressableValue, *jsonopts.Struct) error + unmarshaler = func(*jsontext.Decoder, addressableValue, *jsonopts.Struct) error +) + +type arshaler struct { + marshal marshaler + unmarshal unmarshaler + nonDefault bool +} + +var lookupArshalerCache sync.Map // map[reflect.Type]*arshaler + +func lookupArshaler(t reflect.Type) *arshaler { + if v, ok := lookupArshalerCache.Load(t); ok { + return v.(*arshaler) + } + + fncs := makeDefaultArshaler(t) + fncs = makeMethodArshaler(fncs, t) + fncs = makeTimeArshaler(fncs, t) + + // Use the last stored so that duplicate arshalers can be garbage collected. + v, _ := lookupArshalerCache.LoadOrStore(t, fncs) + return v.(*arshaler) +} + +var stringsPools = &sync.Pool{New: func() any { return new(stringSlice) }} + +type stringSlice []string + +// getStrings returns a non-nil pointer to a slice with length n. +func getStrings(n int) *stringSlice { + s := stringsPools.Get().(*stringSlice) + if cap(*s) < n { + *s = make([]string, n) + } + *s = (*s)[:n] + return s +} + +func putStrings(s *stringSlice) { + if cap(*s) > 1<<10 { + *s = nil // avoid pinning arbitrarily large amounts of memory + } + clear(*s) // avoid pinning a reference to each string + stringsPools.Put(s) +} diff --git a/go/src/encoding/json/v2/arshal_any.go b/go/src/encoding/json/v2/arshal_any.go new file mode 100644 index 0000000000000000000000000000000000000000..8c0c445404d8839fead216d4c7aafbf4a9a368e4 --- /dev/null +++ b/go/src/encoding/json/v2/arshal_any.go @@ -0,0 +1,288 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json + +import ( + "cmp" + "math" + "reflect" + "slices" + "strconv" + + "encoding/json/internal" + "encoding/json/internal/jsonflags" + "encoding/json/internal/jsonopts" + "encoding/json/internal/jsonwire" + "encoding/json/jsontext" +) + +// This file contains an optimized marshal and unmarshal implementation +// for the any type. This type is often used when the Go program has +// no knowledge of the JSON schema. This is a common enough occurrence +// to justify the complexity of adding logic for this. + +// marshalValueAny marshals a Go any as a JSON value. +// This assumes that there are no special formatting directives +// for any possible nested value. +func marshalValueAny(enc *jsontext.Encoder, val any, mo *jsonopts.Struct) error { + switch val := val.(type) { + case nil: + return enc.WriteToken(jsontext.Null) + case bool: + return enc.WriteToken(jsontext.Bool(val)) + case string: + return enc.WriteToken(jsontext.String(val)) + case float64: + if math.IsNaN(val) || math.IsInf(val, 0) { + break // use default logic below + } + return enc.WriteToken(jsontext.Float(val)) + case map[string]any: + return marshalObjectAny(enc, val, mo) + case []any: + return marshalArrayAny(enc, val, mo) + } + + v := newAddressableValue(reflect.TypeOf(val)) + v.Set(reflect.ValueOf(val)) + marshal := lookupArshaler(v.Type()).marshal + if mo.Marshalers != nil { + marshal, _ = mo.Marshalers.(*Marshalers).lookup(marshal, v.Type()) + } + return marshal(enc, v, mo) +} + +// unmarshalValueAny unmarshals a JSON value as a Go any. +// This assumes that there are no special formatting directives +// for any possible nested value. +// Duplicate names must be rejected since this does not implement merging. +func unmarshalValueAny(dec *jsontext.Decoder, uo *jsonopts.Struct) (any, error) { + switch k := dec.PeekKind(); k { + case '{': + return unmarshalObjectAny(dec, uo) + case '[': + return unmarshalArrayAny(dec, uo) + default: + xd := export.Decoder(dec) + var flags jsonwire.ValueFlags + val, err := xd.ReadValue(&flags) + if err != nil { + return nil, err + } + switch val.Kind() { + case 'n': + return nil, nil + case 'f': + return false, nil + case 't': + return true, nil + case '"': + val = jsonwire.UnquoteMayCopy(val, flags.IsVerbatim()) + if xd.StringCache == nil { + xd.StringCache = new(stringCache) + } + return makeString(xd.StringCache, val), nil + case '0': + if uo.Flags.Get(jsonflags.UnmarshalAnyWithRawNumber) { + return internal.RawNumberOf(val), nil + } + fv, ok := jsonwire.ParseFloat(val, 64) + if !ok { + return fv, newUnmarshalErrorAfterWithValue(dec, float64Type, strconv.ErrRange) + } + return fv, nil + default: + panic("BUG: invalid kind: " + k.String()) + } + } +} + +// marshalObjectAny marshals a Go map[string]any as a JSON object +// (or as a JSON null if nil and [jsonflags.FormatNilMapAsNull]). +func marshalObjectAny(enc *jsontext.Encoder, obj map[string]any, mo *jsonopts.Struct) error { + // Check for cycles. + xe := export.Encoder(enc) + if xe.Tokens.Depth() > startDetectingCyclesAfter { + v := reflect.ValueOf(obj) + if err := visitPointer(&xe.SeenPointers, v); err != nil { + return newMarshalErrorBefore(enc, mapStringAnyType, err) + } + defer leavePointer(&xe.SeenPointers, v) + } + + // Handle empty maps. + if len(obj) == 0 { + if mo.Flags.Get(jsonflags.FormatNilMapAsNull) && obj == nil { + return enc.WriteToken(jsontext.Null) + } + // Optimize for marshaling an empty map without any preceding whitespace. + if !mo.Flags.Get(jsonflags.AnyWhitespace) && !xe.Tokens.Last.NeedObjectName() { + xe.Buf = append(xe.Tokens.MayAppendDelim(xe.Buf, '{'), "{}"...) + xe.Tokens.Last.Increment() + if xe.NeedFlush() { + return xe.Flush() + } + return nil + } + } + + if err := enc.WriteToken(jsontext.BeginObject); err != nil { + return err + } + // A Go map guarantees that each entry has a unique key + // The only possibility of duplicates is due to invalid UTF-8. + if !mo.Flags.Get(jsonflags.AllowInvalidUTF8) { + xe.Tokens.Last.DisableNamespace() + } + if !mo.Flags.Get(jsonflags.Deterministic) || len(obj) <= 1 { + for name, val := range obj { + if err := enc.WriteToken(jsontext.String(name)); err != nil { + return err + } + if err := marshalValueAny(enc, val, mo); err != nil { + return err + } + } + } else { + names := getStrings(len(obj)) + var i int + for name := range obj { + (*names)[i] = name + i++ + } + slices.Sort(*names) + for _, name := range *names { + if err := enc.WriteToken(jsontext.String(name)); err != nil { + return err + } + if err := marshalValueAny(enc, obj[name], mo); err != nil { + return err + } + } + putStrings(names) + } + if err := enc.WriteToken(jsontext.EndObject); err != nil { + return err + } + return nil +} + +// unmarshalObjectAny unmarshals a JSON object as a Go map[string]any. +// It panics if not decoding a JSON object. +func unmarshalObjectAny(dec *jsontext.Decoder, uo *jsonopts.Struct) (map[string]any, error) { + switch tok, err := dec.ReadToken(); { + case err != nil: + return nil, err + case tok.Kind() != '{': + panic("BUG: invalid kind: " + tok.Kind().String()) + } + obj := make(map[string]any) + // A Go map guarantees that each entry has a unique key + // The only possibility of duplicates is due to invalid UTF-8. + if !uo.Flags.Get(jsonflags.AllowInvalidUTF8) { + export.Decoder(dec).Tokens.Last.DisableNamespace() + } + var errUnmarshal error + for dec.PeekKind() != '}' { + tok, err := dec.ReadToken() + if err != nil { + return obj, err + } + name := tok.String() + + // Manually check for duplicate names. + if _, ok := obj[name]; ok { + // TODO: Unread the object name. + name := export.Decoder(dec).PreviousTokenOrValue() + err := newDuplicateNameError(dec.StackPointer(), nil, dec.InputOffset()-len64(name)) + return obj, err + } + + val, err := unmarshalValueAny(dec, uo) + obj[name] = val + if err != nil { + if isFatalError(err, uo.Flags) { + return obj, err + } + errUnmarshal = cmp.Or(err, errUnmarshal) + } + } + if _, err := dec.ReadToken(); err != nil { + return obj, err + } + return obj, errUnmarshal +} + +// marshalArrayAny marshals a Go []any as a JSON array +// (or as a JSON null if nil and [jsonflags.FormatNilSliceAsNull]). +func marshalArrayAny(enc *jsontext.Encoder, arr []any, mo *jsonopts.Struct) error { + // Check for cycles. + xe := export.Encoder(enc) + if xe.Tokens.Depth() > startDetectingCyclesAfter { + v := reflect.ValueOf(arr) + if err := visitPointer(&xe.SeenPointers, v); err != nil { + return newMarshalErrorBefore(enc, sliceAnyType, err) + } + defer leavePointer(&xe.SeenPointers, v) + } + + // Handle empty slices. + if len(arr) == 0 { + if mo.Flags.Get(jsonflags.FormatNilSliceAsNull) && arr == nil { + return enc.WriteToken(jsontext.Null) + } + // Optimize for marshaling an empty slice without any preceding whitespace. + if !mo.Flags.Get(jsonflags.AnyWhitespace) && !xe.Tokens.Last.NeedObjectName() { + xe.Buf = append(xe.Tokens.MayAppendDelim(xe.Buf, '['), "[]"...) + xe.Tokens.Last.Increment() + if xe.NeedFlush() { + return xe.Flush() + } + return nil + } + } + + if err := enc.WriteToken(jsontext.BeginArray); err != nil { + return err + } + for _, val := range arr { + if err := marshalValueAny(enc, val, mo); err != nil { + return err + } + } + if err := enc.WriteToken(jsontext.EndArray); err != nil { + return err + } + return nil +} + +// unmarshalArrayAny unmarshals a JSON array as a Go []any. +// It panics if not decoding a JSON array. +func unmarshalArrayAny(dec *jsontext.Decoder, uo *jsonopts.Struct) ([]any, error) { + switch tok, err := dec.ReadToken(); { + case err != nil: + return nil, err + case tok.Kind() != '[': + panic("BUG: invalid kind: " + tok.Kind().String()) + } + arr := []any{} + var errUnmarshal error + for dec.PeekKind() != ']' { + val, err := unmarshalValueAny(dec, uo) + arr = append(arr, val) + if err != nil { + if isFatalError(err, uo.Flags) { + return arr, err + } + errUnmarshal = cmp.Or(errUnmarshal, err) + } + } + if _, err := dec.ReadToken(); err != nil { + return arr, err + } + return arr, errUnmarshal +} diff --git a/go/src/encoding/json/v2/arshal_default.go b/go/src/encoding/json/v2/arshal_default.go new file mode 100644 index 0000000000000000000000000000000000000000..33931af17e642343485004d273aebc5d3a1e52bb --- /dev/null +++ b/go/src/encoding/json/v2/arshal_default.go @@ -0,0 +1,1943 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json + +import ( + "bytes" + "cmp" + "encoding" + "encoding/base32" + "encoding/base64" + "encoding/hex" + "errors" + "fmt" + "math" + "reflect" + "slices" + "strconv" + "strings" + "sync" + + "encoding/json/internal" + "encoding/json/internal/jsonflags" + "encoding/json/internal/jsonopts" + "encoding/json/internal/jsonwire" + "encoding/json/jsontext" +) + +// optimizeCommon specifies whether to use optimizations targeted for certain +// common patterns, rather than using the slower, but more general logic. +// All tests should pass regardless of whether this is true or not. +const optimizeCommon = true + +var ( + // Most natural Go type that correspond with each JSON type. + anyType = reflect.TypeFor[any]() // JSON value + boolType = reflect.TypeFor[bool]() // JSON bool + stringType = reflect.TypeFor[string]() // JSON string + float64Type = reflect.TypeFor[float64]() // JSON number + mapStringAnyType = reflect.TypeFor[map[string]any]() // JSON object + sliceAnyType = reflect.TypeFor[[]any]() // JSON array + + bytesType = reflect.TypeFor[[]byte]() + emptyStructType = reflect.TypeFor[struct{}]() +) + +const startDetectingCyclesAfter = 1000 + +type seenPointers = map[any]struct{} + +type typedPointer struct { + typ reflect.Type + ptr any // always stores unsafe.Pointer, but avoids depending on unsafe + len int // remember slice length to avoid false positives +} + +// visitPointer visits pointer p of type t, reporting an error if seen before. +// If successfully visited, then the caller must eventually call leave. +func visitPointer(m *seenPointers, v reflect.Value) error { + p := typedPointer{v.Type(), v.UnsafePointer(), sliceLen(v)} + if _, ok := (*m)[p]; ok { + return internal.ErrCycle + } + if *m == nil { + *m = make(seenPointers) + } + (*m)[p] = struct{}{} + return nil +} +func leavePointer(m *seenPointers, v reflect.Value) { + p := typedPointer{v.Type(), v.UnsafePointer(), sliceLen(v)} + delete(*m, p) +} + +func sliceLen(v reflect.Value) int { + if v.Kind() == reflect.Slice { + return v.Len() + } + return 0 +} + +func len64[Bytes ~[]byte | ~string](in Bytes) int64 { + return int64(len(in)) +} + +func makeDefaultArshaler(t reflect.Type) *arshaler { + switch t.Kind() { + case reflect.Bool: + return makeBoolArshaler(t) + case reflect.String: + return makeStringArshaler(t) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return makeIntArshaler(t) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return makeUintArshaler(t) + case reflect.Float32, reflect.Float64: + return makeFloatArshaler(t) + case reflect.Map: + return makeMapArshaler(t) + case reflect.Struct: + return makeStructArshaler(t) + case reflect.Slice: + fncs := makeSliceArshaler(t) + if t.Elem().Kind() == reflect.Uint8 { + return makeBytesArshaler(t, fncs) + } + return fncs + case reflect.Array: + fncs := makeArrayArshaler(t) + if t.Elem().Kind() == reflect.Uint8 { + return makeBytesArshaler(t, fncs) + } + return fncs + case reflect.Pointer: + return makePointerArshaler(t) + case reflect.Interface: + return makeInterfaceArshaler(t) + default: + return makeInvalidArshaler(t) + } +} + +func makeBoolArshaler(t reflect.Type) *arshaler { + var fncs arshaler + fncs.marshal = func(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct) error { + xe := export.Encoder(enc) + if mo.Format != "" && mo.FormatDepth == xe.Tokens.Depth() { + return newInvalidFormatError(enc, t) + } + + // Optimize for marshaling without preceding whitespace. + if optimizeCommon && !mo.Flags.Get(jsonflags.AnyWhitespace|jsonflags.StringifyBoolsAndStrings) && !xe.Tokens.Last.NeedObjectName() { + xe.Buf = strconv.AppendBool(xe.Tokens.MayAppendDelim(xe.Buf, 't'), va.Bool()) + xe.Tokens.Last.Increment() + if xe.NeedFlush() { + return xe.Flush() + } + return nil + } + + if mo.Flags.Get(jsonflags.StringifyBoolsAndStrings) { + if va.Bool() { + return enc.WriteToken(jsontext.String("true")) + } else { + return enc.WriteToken(jsontext.String("false")) + } + } + return enc.WriteToken(jsontext.Bool(va.Bool())) + } + fncs.unmarshal = func(dec *jsontext.Decoder, va addressableValue, uo *jsonopts.Struct) error { + xd := export.Decoder(dec) + if uo.Format != "" && uo.FormatDepth == xd.Tokens.Depth() { + return newInvalidFormatError(dec, t) + } + tok, err := dec.ReadToken() + if err != nil { + return err + } + k := tok.Kind() + switch k { + case 'n': + if !uo.Flags.Get(jsonflags.MergeWithLegacySemantics) { + va.SetBool(false) + } + return nil + case 't', 'f': + if !uo.Flags.Get(jsonflags.StringifyBoolsAndStrings) { + va.SetBool(tok.Bool()) + return nil + } + case '"': + if uo.Flags.Get(jsonflags.StringifyBoolsAndStrings) { + switch tok.String() { + case "true": + va.SetBool(true) + case "false": + va.SetBool(false) + default: + if uo.Flags.Get(jsonflags.StringifyWithLegacySemantics) && tok.String() == "null" { + if !uo.Flags.Get(jsonflags.MergeWithLegacySemantics) { + va.SetBool(false) + } + return nil + } + return newUnmarshalErrorAfterWithValue(dec, t, strconv.ErrSyntax) + } + return nil + } + } + return newUnmarshalErrorAfterWithSkipping(dec, t, nil) + } + return &fncs +} + +func makeStringArshaler(t reflect.Type) *arshaler { + var fncs arshaler + fncs.marshal = func(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct) error { + xe := export.Encoder(enc) + if mo.Format != "" && mo.FormatDepth == xe.Tokens.Depth() { + return newInvalidFormatError(enc, t) + } + + // Optimize for marshaling without preceding whitespace. + s := va.String() + if optimizeCommon && !mo.Flags.Get(jsonflags.AnyWhitespace|jsonflags.StringifyBoolsAndStrings) && !xe.Tokens.Last.NeedObjectName() { + b := xe.Buf + b = xe.Tokens.MayAppendDelim(b, '"') + b, err := jsonwire.AppendQuote(b, s, &mo.Flags) + if err == nil { + xe.Buf = b + xe.Tokens.Last.Increment() + if xe.NeedFlush() { + return xe.Flush() + } + return nil + } + // Otherwise, the string contains invalid UTF-8, + // so let the logic below construct the proper error. + } + + if mo.Flags.Get(jsonflags.StringifyBoolsAndStrings) { + b, err := jsonwire.AppendQuote(nil, s, &mo.Flags) + if err != nil { + return newMarshalErrorBefore(enc, t, &jsontext.SyntacticError{Err: err}) + } + q, err := jsontext.AppendQuote(nil, b) + if err != nil { + panic("BUG: second AppendQuote should never fail: " + err.Error()) + } + return enc.WriteValue(q) + } + return enc.WriteToken(jsontext.String(s)) + } + fncs.unmarshal = func(dec *jsontext.Decoder, va addressableValue, uo *jsonopts.Struct) error { + xd := export.Decoder(dec) + if uo.Format != "" && uo.FormatDepth == xd.Tokens.Depth() { + return newInvalidFormatError(dec, t) + } + var flags jsonwire.ValueFlags + val, err := xd.ReadValue(&flags) + if err != nil { + return err + } + k := val.Kind() + switch k { + case 'n': + if !uo.Flags.Get(jsonflags.MergeWithLegacySemantics) { + va.SetString("") + } + return nil + case '"': + val = jsonwire.UnquoteMayCopy(val, flags.IsVerbatim()) + if uo.Flags.Get(jsonflags.StringifyBoolsAndStrings) { + val, err = jsontext.AppendUnquote(nil, val) + if err != nil { + return newUnmarshalErrorAfter(dec, t, err) + } + if uo.Flags.Get(jsonflags.StringifyWithLegacySemantics) && string(val) == "null" { + if !uo.Flags.Get(jsonflags.MergeWithLegacySemantics) { + va.SetString("") + } + return nil + } + } + if xd.StringCache == nil { + xd.StringCache = new(stringCache) + } + str := makeString(xd.StringCache, val) + va.SetString(str) + return nil + } + return newUnmarshalErrorAfter(dec, t, nil) + } + return &fncs +} + +var ( + appendEncodeBase16 = hex.AppendEncode + appendEncodeBase32 = base32.StdEncoding.AppendEncode + appendEncodeBase32Hex = base32.HexEncoding.AppendEncode + appendEncodeBase64 = base64.StdEncoding.AppendEncode + appendEncodeBase64URL = base64.URLEncoding.AppendEncode + encodedLenBase16 = hex.EncodedLen + encodedLenBase32 = base32.StdEncoding.EncodedLen + encodedLenBase32Hex = base32.HexEncoding.EncodedLen + encodedLenBase64 = base64.StdEncoding.EncodedLen + encodedLenBase64URL = base64.URLEncoding.EncodedLen + appendDecodeBase16 = hex.AppendDecode + appendDecodeBase32 = base32.StdEncoding.AppendDecode + appendDecodeBase32Hex = base32.HexEncoding.AppendDecode + appendDecodeBase64 = base64.StdEncoding.AppendDecode + appendDecodeBase64URL = base64.URLEncoding.AppendDecode +) + +func makeBytesArshaler(t reflect.Type, fncs *arshaler) *arshaler { + // NOTE: This handles both []~byte and [N]~byte. + // The v2 default is to treat a []namedByte as equivalent to []T + // since being able to convert []namedByte to []byte relies on + // dubious Go reflection behavior (see https://go.dev/issue/24746). + // For v1 emulation, we use jsonflags.FormatBytesWithLegacySemantics + // to forcibly treat []namedByte as a []byte. + marshalArray := fncs.marshal + isNamedByte := t.Elem().PkgPath() != "" + hasMarshaler := implementsAny(t.Elem(), allMarshalerTypes...) + fncs.marshal = func(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct) error { + if !mo.Flags.Get(jsonflags.FormatBytesWithLegacySemantics) && isNamedByte { + return marshalArray(enc, va, mo) // treat as []T or [N]T + } + xe := export.Encoder(enc) + appendEncode := appendEncodeBase64 + if mo.Format != "" && mo.FormatDepth == xe.Tokens.Depth() { + switch mo.Format { + case "base64": + appendEncode = appendEncodeBase64 + case "base64url": + appendEncode = appendEncodeBase64URL + case "base32": + appendEncode = appendEncodeBase32 + case "base32hex": + appendEncode = appendEncodeBase32Hex + case "base16", "hex": + appendEncode = appendEncodeBase16 + case "array": + mo.Format = "" + return marshalArray(enc, va, mo) + default: + return newInvalidFormatError(enc, t) + } + } else if mo.Flags.Get(jsonflags.FormatByteArrayAsArray) && va.Kind() == reflect.Array { + return marshalArray(enc, va, mo) + } else if mo.Flags.Get(jsonflags.FormatBytesWithLegacySemantics) && hasMarshaler { + return marshalArray(enc, va, mo) + } + if mo.Flags.Get(jsonflags.FormatNilSliceAsNull) && va.Kind() == reflect.Slice && va.IsNil() { + // TODO: Provide a "emitempty" format override? + return enc.WriteToken(jsontext.Null) + } + return xe.AppendRaw('"', true, func(b []byte) ([]byte, error) { + return appendEncode(b, va.Bytes()), nil + }) + } + unmarshalArray := fncs.unmarshal + fncs.unmarshal = func(dec *jsontext.Decoder, va addressableValue, uo *jsonopts.Struct) error { + if !uo.Flags.Get(jsonflags.FormatBytesWithLegacySemantics) && isNamedByte { + return unmarshalArray(dec, va, uo) // treat as []T or [N]T + } + xd := export.Decoder(dec) + appendDecode, encodedLen := appendDecodeBase64, encodedLenBase64 + if uo.Format != "" && uo.FormatDepth == xd.Tokens.Depth() { + switch uo.Format { + case "base64": + appendDecode, encodedLen = appendDecodeBase64, encodedLenBase64 + case "base64url": + appendDecode, encodedLen = appendDecodeBase64URL, encodedLenBase64URL + case "base32": + appendDecode, encodedLen = appendDecodeBase32, encodedLenBase32 + case "base32hex": + appendDecode, encodedLen = appendDecodeBase32Hex, encodedLenBase32Hex + case "base16", "hex": + appendDecode, encodedLen = appendDecodeBase16, encodedLenBase16 + case "array": + uo.Format = "" + return unmarshalArray(dec, va, uo) + default: + return newInvalidFormatError(dec, t) + } + } else if uo.Flags.Get(jsonflags.FormatByteArrayAsArray) && va.Kind() == reflect.Array { + return unmarshalArray(dec, va, uo) + } else if uo.Flags.Get(jsonflags.FormatBytesWithLegacySemantics) && dec.PeekKind() == '[' { + return unmarshalArray(dec, va, uo) + } + var flags jsonwire.ValueFlags + val, err := xd.ReadValue(&flags) + if err != nil { + return err + } + k := val.Kind() + switch k { + case 'n': + if !uo.Flags.Get(jsonflags.MergeWithLegacySemantics) || va.Kind() != reflect.Array { + va.SetZero() + } + return nil + case '"': + // NOTE: The v2 default is to strictly comply with RFC 4648. + // Section 3.2 specifies that padding is required. + // Section 3.3 specifies that non-alphabet characters + // (e.g., '\r' or '\n') must be rejected. + // Section 3.5 specifies that unnecessary non-zero bits in + // the last quantum may be rejected. Since this is optional, + // we do not reject such inputs. + val = jsonwire.UnquoteMayCopy(val, flags.IsVerbatim()) + b, err := appendDecode(va.Bytes()[:0], val) + if err != nil { + return newUnmarshalErrorAfter(dec, t, err) + } + if len(val) != encodedLen(len(b)) && !uo.Flags.Get(jsonflags.ParseBytesWithLooseRFC4648) { + // TODO(https://go.dev/issue/53845): RFC 4648, section 3.3, + // specifies that non-alphabet characters must be rejected. + // Unfortunately, the "base32" and "base64" packages allow + // '\r' and '\n' characters by default. + i := bytes.IndexAny(val, "\r\n") + err := fmt.Errorf("illegal character %s at offset %d", jsonwire.QuoteRune(val[i:]), i) + return newUnmarshalErrorAfter(dec, t, err) + } + + if va.Kind() == reflect.Array { + dst := va.Bytes() + clear(dst[copy(dst, b):]) // noop if len(b) <= len(dst) + if len(b) != len(dst) && !uo.Flags.Get(jsonflags.UnmarshalArrayFromAnyLength) { + err := fmt.Errorf("decoded length of %d mismatches array length of %d", len(b), len(dst)) + return newUnmarshalErrorAfter(dec, t, err) + } + } else { + if b == nil { + b = []byte{} + } + va.SetBytes(b) + } + return nil + } + return newUnmarshalErrorAfter(dec, t, nil) + } + return fncs +} + +func makeIntArshaler(t reflect.Type) *arshaler { + var fncs arshaler + bits := t.Bits() + fncs.marshal = func(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct) error { + xe := export.Encoder(enc) + if mo.Format != "" && mo.FormatDepth == xe.Tokens.Depth() { + return newInvalidFormatError(enc, t) + } + + // Optimize for marshaling without preceding whitespace or string escaping. + if optimizeCommon && !mo.Flags.Get(jsonflags.AnyWhitespace|jsonflags.StringifyNumbers) && !xe.Tokens.Last.NeedObjectName() { + xe.Buf = strconv.AppendInt(xe.Tokens.MayAppendDelim(xe.Buf, '0'), va.Int(), 10) + xe.Tokens.Last.Increment() + if xe.NeedFlush() { + return xe.Flush() + } + return nil + } + + k := stringOrNumberKind(xe.Tokens.Last.NeedObjectName() || mo.Flags.Get(jsonflags.StringifyNumbers)) + return xe.AppendRaw(k, true, func(b []byte) ([]byte, error) { + return strconv.AppendInt(b, va.Int(), 10), nil + }) + } + fncs.unmarshal = func(dec *jsontext.Decoder, va addressableValue, uo *jsonopts.Struct) error { + xd := export.Decoder(dec) + if uo.Format != "" && uo.FormatDepth == xd.Tokens.Depth() { + return newInvalidFormatError(dec, t) + } + stringify := xd.Tokens.Last.NeedObjectName() || uo.Flags.Get(jsonflags.StringifyNumbers) + var flags jsonwire.ValueFlags + val, err := xd.ReadValue(&flags) + if err != nil { + return err + } + k := val.Kind() + switch k { + case 'n': + if !uo.Flags.Get(jsonflags.MergeWithLegacySemantics) { + va.SetInt(0) + } + return nil + case '"': + if !stringify { + break + } + val = jsonwire.UnquoteMayCopy(val, flags.IsVerbatim()) + if uo.Flags.Get(jsonflags.StringifyWithLegacySemantics) { + // For historical reasons, v1 parsed a quoted number + // according to the Go syntax and permitted a quoted null. + // See https://go.dev/issue/75619 + n, err := strconv.ParseInt(string(val), 10, bits) + if err != nil { + if string(val) == "null" { + if !uo.Flags.Get(jsonflags.MergeWithLegacySemantics) { + va.SetInt(0) + } + return nil + } + return newUnmarshalErrorAfterWithValue(dec, t, errors.Unwrap(err)) + } + va.SetInt(n) + return nil + } + fallthrough + case '0': + if stringify && k == '0' { + break + } + var negOffset int + neg := len(val) > 0 && val[0] == '-' + if neg { + negOffset = 1 + } + n, ok := jsonwire.ParseUint(val[negOffset:]) + maxInt := uint64(1) << (bits - 1) + overflow := (neg && n > maxInt) || (!neg && n > maxInt-1) + if !ok { + if n != math.MaxUint64 { + return newUnmarshalErrorAfterWithValue(dec, t, strconv.ErrSyntax) + } + overflow = true + } + if overflow { + return newUnmarshalErrorAfterWithValue(dec, t, strconv.ErrRange) + } + if neg { + va.SetInt(int64(-n)) + } else { + va.SetInt(int64(+n)) + } + return nil + } + return newUnmarshalErrorAfter(dec, t, nil) + } + return &fncs +} + +func makeUintArshaler(t reflect.Type) *arshaler { + var fncs arshaler + bits := t.Bits() + fncs.marshal = func(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct) error { + xe := export.Encoder(enc) + if mo.Format != "" && mo.FormatDepth == xe.Tokens.Depth() { + return newInvalidFormatError(enc, t) + } + + // Optimize for marshaling without preceding whitespace or string escaping. + if optimizeCommon && !mo.Flags.Get(jsonflags.AnyWhitespace|jsonflags.StringifyNumbers) && !xe.Tokens.Last.NeedObjectName() { + xe.Buf = strconv.AppendUint(xe.Tokens.MayAppendDelim(xe.Buf, '0'), va.Uint(), 10) + xe.Tokens.Last.Increment() + if xe.NeedFlush() { + return xe.Flush() + } + return nil + } + + k := stringOrNumberKind(xe.Tokens.Last.NeedObjectName() || mo.Flags.Get(jsonflags.StringifyNumbers)) + return xe.AppendRaw(k, true, func(b []byte) ([]byte, error) { + return strconv.AppendUint(b, va.Uint(), 10), nil + }) + } + fncs.unmarshal = func(dec *jsontext.Decoder, va addressableValue, uo *jsonopts.Struct) error { + xd := export.Decoder(dec) + if uo.Format != "" && uo.FormatDepth == xd.Tokens.Depth() { + return newInvalidFormatError(dec, t) + } + stringify := xd.Tokens.Last.NeedObjectName() || uo.Flags.Get(jsonflags.StringifyNumbers) + var flags jsonwire.ValueFlags + val, err := xd.ReadValue(&flags) + if err != nil { + return err + } + k := val.Kind() + switch k { + case 'n': + if !uo.Flags.Get(jsonflags.MergeWithLegacySemantics) { + va.SetUint(0) + } + return nil + case '"': + if !stringify { + break + } + val = jsonwire.UnquoteMayCopy(val, flags.IsVerbatim()) + if uo.Flags.Get(jsonflags.StringifyWithLegacySemantics) { + // For historical reasons, v1 parsed a quoted number + // according to the Go syntax and permitted a quoted null. + // See https://go.dev/issue/75619 + n, err := strconv.ParseUint(string(val), 10, bits) + if err != nil { + if string(val) == "null" { + if !uo.Flags.Get(jsonflags.MergeWithLegacySemantics) { + va.SetUint(0) + } + return nil + } + return newUnmarshalErrorAfterWithValue(dec, t, errors.Unwrap(err)) + } + va.SetUint(n) + return nil + } + fallthrough + case '0': + if stringify && k == '0' { + break + } + n, ok := jsonwire.ParseUint(val) + maxUint := uint64(1) << bits + overflow := n > maxUint-1 + if !ok { + if n != math.MaxUint64 { + return newUnmarshalErrorAfterWithValue(dec, t, strconv.ErrSyntax) + } + overflow = true + } + if overflow { + return newUnmarshalErrorAfterWithValue(dec, t, strconv.ErrRange) + } + va.SetUint(n) + return nil + } + return newUnmarshalErrorAfter(dec, t, nil) + } + return &fncs +} + +func makeFloatArshaler(t reflect.Type) *arshaler { + var fncs arshaler + bits := t.Bits() + fncs.marshal = func(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct) error { + xe := export.Encoder(enc) + var allowNonFinite bool + if mo.Format != "" && mo.FormatDepth == xe.Tokens.Depth() { + if mo.Format == "nonfinite" { + allowNonFinite = true + } else { + return newInvalidFormatError(enc, t) + } + } + + fv := va.Float() + if math.IsNaN(fv) || math.IsInf(fv, 0) { + if !allowNonFinite { + err := fmt.Errorf("unsupported value: %v", fv) + return newMarshalErrorBefore(enc, t, err) + } + return enc.WriteToken(jsontext.Float(fv)) + } + + // Optimize for marshaling without preceding whitespace or string escaping. + if optimizeCommon && !mo.Flags.Get(jsonflags.AnyWhitespace|jsonflags.StringifyNumbers) && !xe.Tokens.Last.NeedObjectName() { + xe.Buf = jsonwire.AppendFloat(xe.Tokens.MayAppendDelim(xe.Buf, '0'), fv, bits) + xe.Tokens.Last.Increment() + if xe.NeedFlush() { + return xe.Flush() + } + return nil + } + + k := stringOrNumberKind(xe.Tokens.Last.NeedObjectName() || mo.Flags.Get(jsonflags.StringifyNumbers)) + return xe.AppendRaw(k, true, func(b []byte) ([]byte, error) { + return jsonwire.AppendFloat(b, va.Float(), bits), nil + }) + } + fncs.unmarshal = func(dec *jsontext.Decoder, va addressableValue, uo *jsonopts.Struct) error { + xd := export.Decoder(dec) + var allowNonFinite bool + if uo.Format != "" && uo.FormatDepth == xd.Tokens.Depth() { + if uo.Format == "nonfinite" { + allowNonFinite = true + } else { + return newInvalidFormatError(dec, t) + } + } + stringify := xd.Tokens.Last.NeedObjectName() || uo.Flags.Get(jsonflags.StringifyNumbers) + var flags jsonwire.ValueFlags + val, err := xd.ReadValue(&flags) + if err != nil { + return err + } + k := val.Kind() + switch k { + case 'n': + if !uo.Flags.Get(jsonflags.MergeWithLegacySemantics) { + va.SetFloat(0) + } + return nil + case '"': + val = jsonwire.UnquoteMayCopy(val, flags.IsVerbatim()) + if allowNonFinite { + switch string(val) { + case "NaN": + va.SetFloat(math.NaN()) + return nil + case "Infinity": + va.SetFloat(math.Inf(+1)) + return nil + case "-Infinity": + va.SetFloat(math.Inf(-1)) + return nil + } + } + if !stringify { + break + } + if uo.Flags.Get(jsonflags.StringifyWithLegacySemantics) { + // For historical reasons, v1 parsed a quoted number + // according to the Go syntax and permitted a quoted null. + // See https://go.dev/issue/75619 + n, err := strconv.ParseFloat(string(val), bits) + if err != nil { + if string(val) == "null" { + if !uo.Flags.Get(jsonflags.MergeWithLegacySemantics) { + va.SetFloat(0) + } + return nil + } + return newUnmarshalErrorAfterWithValue(dec, t, errors.Unwrap(err)) + } + va.SetFloat(n) + return nil + } + if n, err := jsonwire.ConsumeNumber(val); n != len(val) || err != nil { + return newUnmarshalErrorAfterWithValue(dec, t, strconv.ErrSyntax) + } + fallthrough + case '0': + if stringify && k == '0' { + break + } + fv, ok := jsonwire.ParseFloat(val, bits) + va.SetFloat(fv) + if !ok { + return newUnmarshalErrorAfterWithValue(dec, t, strconv.ErrRange) + } + return nil + } + return newUnmarshalErrorAfter(dec, t, nil) + } + return &fncs +} + +func makeMapArshaler(t reflect.Type) *arshaler { + // NOTE: The logic below disables namespaces for tracking duplicate names + // when handling map keys with a unique representation. + + // NOTE: Values retrieved from a map are not addressable, + // so we shallow copy the values to make them addressable and + // store them back into the map afterwards. + + var fncs arshaler + var ( + once sync.Once + keyFncs *arshaler + valFncs *arshaler + ) + init := func() { + keyFncs = lookupArshaler(t.Key()) + valFncs = lookupArshaler(t.Elem()) + } + nillableLegacyKey := t.Key().Kind() == reflect.Pointer && + implementsAny(t.Key(), textMarshalerType, textAppenderType) + fncs.marshal = func(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct) error { + // Check for cycles. + xe := export.Encoder(enc) + if xe.Tokens.Depth() > startDetectingCyclesAfter { + if err := visitPointer(&xe.SeenPointers, va.Value); err != nil { + return newMarshalErrorBefore(enc, t, err) + } + defer leavePointer(&xe.SeenPointers, va.Value) + } + + emitNull := mo.Flags.Get(jsonflags.FormatNilMapAsNull) + if mo.Format != "" && mo.FormatDepth == xe.Tokens.Depth() { + switch mo.Format { + case "emitnull": + emitNull = true + mo.Format = "" + case "emitempty": + emitNull = false + mo.Format = "" + default: + return newInvalidFormatError(enc, t) + } + } + + // Handle empty maps. + n := va.Len() + if n == 0 { + if emitNull && va.IsNil() { + return enc.WriteToken(jsontext.Null) + } + // Optimize for marshaling an empty map without any preceding whitespace. + if optimizeCommon && !mo.Flags.Get(jsonflags.AnyWhitespace) && !xe.Tokens.Last.NeedObjectName() { + xe.Buf = append(xe.Tokens.MayAppendDelim(xe.Buf, '{'), "{}"...) + xe.Tokens.Last.Increment() + if xe.NeedFlush() { + return xe.Flush() + } + return nil + } + } + + once.Do(init) + if err := enc.WriteToken(jsontext.BeginObject); err != nil { + return err + } + if n > 0 { + nonDefaultKey := keyFncs.nonDefault + marshalKey := keyFncs.marshal + marshalVal := valFncs.marshal + if mo.Marshalers != nil { + var ok bool + marshalKey, ok = mo.Marshalers.(*Marshalers).lookup(marshalKey, t.Key()) + marshalVal, _ = mo.Marshalers.(*Marshalers).lookup(marshalVal, t.Elem()) + nonDefaultKey = nonDefaultKey || ok + } + k := newAddressableValue(t.Key()) + v := newAddressableValue(t.Elem()) + + // A Go map guarantees that each entry has a unique key. + // As such, disable the expensive duplicate name check if we know + // that every Go key will serialize as a unique JSON string. + if !nonDefaultKey && mapKeyWithUniqueRepresentation(k.Kind(), mo.Flags.Get(jsonflags.AllowInvalidUTF8)) { + xe.Tokens.Last.DisableNamespace() + } + + switch { + case !mo.Flags.Get(jsonflags.Deterministic) || n <= 1: + for iter := va.Value.MapRange(); iter.Next(); { + k.SetIterKey(iter) + err := marshalKey(enc, k, mo) + if err != nil { + if mo.Flags.Get(jsonflags.CallMethodsWithLegacySemantics) && + errors.Is(err, jsontext.ErrNonStringName) && nillableLegacyKey && k.IsNil() { + err = enc.WriteToken(jsontext.String("")) + } + if err != nil { + if serr, ok := err.(*jsontext.SyntacticError); ok && serr.Err == jsontext.ErrNonStringName { + err = newMarshalErrorBefore(enc, k.Type(), err) + } + return err + } + } + v.SetIterValue(iter) + if err := marshalVal(enc, v, mo); err != nil { + return err + } + } + case !nonDefaultKey && t.Key().Kind() == reflect.String: + names := getStrings(n) + for i, iter := 0, va.Value.MapRange(); i < n && iter.Next(); i++ { + k.SetIterKey(iter) + (*names)[i] = k.String() + } + slices.Sort(*names) + for _, name := range *names { + if err := enc.WriteToken(jsontext.String(name)); err != nil { + return err + } + // TODO(https://go.dev/issue/57061): Use v.SetMapIndexOf. + k.SetString(name) + v.Set(va.MapIndex(k.Value)) + if err := marshalVal(enc, v, mo); err != nil { + return err + } + } + putStrings(names) + default: + type member struct { + name string // unquoted name + key addressableValue + val addressableValue + } + members := make([]member, n) + keys := reflect.MakeSlice(reflect.SliceOf(t.Key()), n, n) + vals := reflect.MakeSlice(reflect.SliceOf(t.Elem()), n, n) + for i, iter := 0, va.Value.MapRange(); i < n && iter.Next(); i++ { + // Marshal the member name. + k := addressableValue{keys.Index(i), true} // indexed slice element is always addressable + k.SetIterKey(iter) + v := addressableValue{vals.Index(i), true} // indexed slice element is always addressable + v.SetIterValue(iter) + err := marshalKey(enc, k, mo) + if err != nil { + if mo.Flags.Get(jsonflags.CallMethodsWithLegacySemantics) && + errors.Is(err, jsontext.ErrNonStringName) && nillableLegacyKey && k.IsNil() { + err = enc.WriteToken(jsontext.String("")) + } + if err != nil { + if serr, ok := err.(*jsontext.SyntacticError); ok && serr.Err == jsontext.ErrNonStringName { + err = newMarshalErrorBefore(enc, k.Type(), err) + } + return err + } + } + name := xe.UnwriteOnlyObjectMemberName() + members[i] = member{name, k, v} + } + // TODO: If AllowDuplicateNames is enabled, then sort according + // to reflect.Value as well if the names are equal. + // See internal/fmtsort. + slices.SortFunc(members, func(x, y member) int { + return strings.Compare(x.name, y.name) + }) + for _, member := range members { + if err := enc.WriteToken(jsontext.String(member.name)); err != nil { + return err + } + if err := marshalVal(enc, member.val, mo); err != nil { + return err + } + } + } + } + if err := enc.WriteToken(jsontext.EndObject); err != nil { + return err + } + return nil + } + fncs.unmarshal = func(dec *jsontext.Decoder, va addressableValue, uo *jsonopts.Struct) error { + xd := export.Decoder(dec) + if uo.Format != "" && uo.FormatDepth == xd.Tokens.Depth() { + switch uo.Format { + case "emitnull", "emitempty": + uo.Format = "" // only relevant for marshaling + default: + return newInvalidFormatError(dec, t) + } + } + tok, err := dec.ReadToken() + if err != nil { + return err + } + k := tok.Kind() + switch k { + case 'n': + va.SetZero() + return nil + case '{': + once.Do(init) + if va.IsNil() { + va.Set(reflect.MakeMap(t)) + } + + nonDefaultKey := keyFncs.nonDefault + unmarshalKey := keyFncs.unmarshal + unmarshalVal := valFncs.unmarshal + if uo.Unmarshalers != nil { + var ok bool + unmarshalKey, ok = uo.Unmarshalers.(*Unmarshalers).lookup(unmarshalKey, t.Key()) + unmarshalVal, _ = uo.Unmarshalers.(*Unmarshalers).lookup(unmarshalVal, t.Elem()) + nonDefaultKey = nonDefaultKey || ok + } + k := newAddressableValue(t.Key()) + v := newAddressableValue(t.Elem()) + + // Manually check for duplicate entries by virtue of whether the + // unmarshaled key already exists in the destination Go map. + // Consequently, syntactically different names (e.g., "0" and "-0") + // will be rejected as duplicates since they semantically refer + // to the same Go value. This is an unusual interaction + // between syntax and semantics, but is more correct. + if !nonDefaultKey && mapKeyWithUniqueRepresentation(k.Kind(), uo.Flags.Get(jsonflags.AllowInvalidUTF8)) { + xd.Tokens.Last.DisableNamespace() + } + + // In the rare case where the map is not already empty, + // then we need to manually track which keys we already saw + // since existing presence alone is insufficient to indicate + // whether the input had a duplicate name. + var seen reflect.Value + if !uo.Flags.Get(jsonflags.AllowDuplicateNames) && va.Len() > 0 { + seen = reflect.MakeMap(reflect.MapOf(k.Type(), emptyStructType)) + } + + var errUnmarshal error + for dec.PeekKind() != '}' { + // Unmarshal the map entry key. + k.SetZero() + err := unmarshalKey(dec, k, uo) + if err != nil { + if isFatalError(err, uo.Flags) { + return err + } + if err := dec.SkipValue(); err != nil { + return err + } + errUnmarshal = cmp.Or(errUnmarshal, err) + continue + } + if k.Kind() == reflect.Interface && !k.IsNil() && !k.Elem().Type().Comparable() { + err := newUnmarshalErrorAfter(dec, t, fmt.Errorf("invalid incomparable key type %v", k.Elem().Type())) + if !uo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return err + } + if err2 := dec.SkipValue(); err2 != nil { + return err2 + } + errUnmarshal = cmp.Or(errUnmarshal, err) + continue + } + + // Check if a pre-existing map entry value exists for this key. + if v2 := va.MapIndex(k.Value); v2.IsValid() { + if !uo.Flags.Get(jsonflags.AllowDuplicateNames) && (!seen.IsValid() || seen.MapIndex(k.Value).IsValid()) { + // TODO: Unread the object name. + name := xd.PreviousTokenOrValue() + return newDuplicateNameError(dec.StackPointer(), nil, dec.InputOffset()-len64(name)) + } + if !uo.Flags.Get(jsonflags.MergeWithLegacySemantics) { + v.Set(v2) + } else { + v.SetZero() + } + } else { + v.SetZero() + } + + // Unmarshal the map entry value. + err = unmarshalVal(dec, v, uo) + va.SetMapIndex(k.Value, v.Value) + if seen.IsValid() { + seen.SetMapIndex(k.Value, reflect.Zero(emptyStructType)) + } + if err != nil { + if isFatalError(err, uo.Flags) { + return err + } + errUnmarshal = cmp.Or(errUnmarshal, err) + } + } + if _, err := dec.ReadToken(); err != nil { + return err + } + return errUnmarshal + } + return newUnmarshalErrorAfterWithSkipping(dec, t, nil) + } + return &fncs +} + +// mapKeyWithUniqueRepresentation reports whether all possible values of k +// marshal to a different JSON value, and whether all possible JSON values +// that can unmarshal into k unmarshal to different Go values. +// In other words, the representation must be a bijective. +func mapKeyWithUniqueRepresentation(k reflect.Kind, allowInvalidUTF8 bool) bool { + switch k { + case reflect.Bool, + reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return true + case reflect.String: + // For strings, we have to be careful since names with invalid UTF-8 + // maybe unescape to the same Go string value. + return !allowInvalidUTF8 + default: + // Floating-point kinds are not listed above since NaNs + // can appear multiple times and all serialize as "NaN". + return false + } +} + +var errNilField = errors.New("cannot set embedded pointer to unexported struct type") + +func makeStructArshaler(t reflect.Type) *arshaler { + // NOTE: The logic below disables namespaces for tracking duplicate names + // and does the tracking locally with an efficient bit-set based on which + // Go struct fields were seen. + + var fncs arshaler + var ( + once sync.Once + fields structFields + errInit *SemanticError + ) + init := func() { + fields, errInit = makeStructFields(t) + } + fncs.marshal = func(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct) error { + xe := export.Encoder(enc) + if mo.Format != "" && mo.FormatDepth == xe.Tokens.Depth() { + return newInvalidFormatError(enc, t) + } + once.Do(init) + if errInit != nil && !mo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return newMarshalErrorBefore(enc, errInit.GoType, errInit.Err) + } + if err := enc.WriteToken(jsontext.BeginObject); err != nil { + return err + } + var seenIdxs uintSet + prevIdx := -1 + xe.Tokens.Last.DisableNamespace() // we manually ensure unique names below + for i := range fields.flattened { + f := &fields.flattened[i] + v := addressableValue{va.Field(f.index0), va.forcedAddr} // addressable if struct value is addressable + if len(f.index) > 0 { + v = v.fieldByIndex(f.index, false) + if !v.IsValid() { + continue // implies a nil inlined field + } + } + + // OmitZero skips the field if the Go value is zero, + // which we can determine up front without calling the marshaler. + if (f.omitzero || mo.Flags.Get(jsonflags.OmitZeroStructFields)) && + ((f.isZero == nil && v.IsZero()) || (f.isZero != nil && f.isZero(v))) { + continue + } + + // Check for the legacy definition of omitempty. + if f.omitempty && mo.Flags.Get(jsonflags.OmitEmptyWithLegacySemantics) && isLegacyEmpty(v) { + continue + } + + marshal := f.fncs.marshal + nonDefault := f.fncs.nonDefault + if mo.Marshalers != nil { + var ok bool + marshal, ok = mo.Marshalers.(*Marshalers).lookup(marshal, f.typ) + nonDefault = nonDefault || ok + } + + // OmitEmpty skips the field if the marshaled JSON value is empty, + // which we can know up front if there are no custom marshalers, + // otherwise we must marshal the value and unwrite it if empty. + if f.omitempty && !mo.Flags.Get(jsonflags.OmitEmptyWithLegacySemantics) && + !nonDefault && f.isEmpty != nil && f.isEmpty(v) { + continue // fast path for omitempty + } + + // Write the object member name. + // + // The logic below is semantically equivalent to: + // enc.WriteToken(String(f.name)) + // but specialized and simplified because: + // 1. The Encoder must be expecting an object name. + // 2. The object namespace is guaranteed to be disabled. + // 3. The object name is guaranteed to be valid and pre-escaped. + // 4. There is no need to flush the buffer (for unwrite purposes). + // 5. There is no possibility of an error occurring. + if optimizeCommon { + // Append any delimiters or optional whitespace. + b := xe.Buf + if xe.Tokens.Last.Length() > 0 { + b = append(b, ',') + if mo.Flags.Get(jsonflags.SpaceAfterComma) { + b = append(b, ' ') + } + } + if mo.Flags.Get(jsonflags.Multiline) { + b = xe.AppendIndent(b, xe.Tokens.NeedIndent('"')) + } + + // Append the token to the output and to the state machine. + n0 := len(b) // offset before calling AppendQuote + if !f.nameNeedEscape { + b = append(b, f.quotedName...) + } else { + b, _ = jsonwire.AppendQuote(b, f.name, &mo.Flags) + } + xe.Buf = b + xe.Names.ReplaceLastQuotedOffset(n0) + xe.Tokens.Last.Increment() + } else { + if err := enc.WriteToken(jsontext.String(f.name)); err != nil { + return err + } + } + + // Write the object member value. + flagsOriginal := mo.Flags + if f.string { + if !mo.Flags.Get(jsonflags.StringifyWithLegacySemantics) { + mo.Flags.Set(jsonflags.StringifyNumbers | 1) + } else if canLegacyStringify(f.typ) { + mo.Flags.Set(jsonflags.StringifyNumbers | jsonflags.StringifyBoolsAndStrings | 1) + } + } + if f.format != "" { + mo.FormatDepth = xe.Tokens.Depth() + mo.Format = f.format + } + err := marshal(enc, v, mo) + mo.Flags = flagsOriginal + mo.Format = "" + if err != nil { + return err + } + + // Try unwriting the member if empty (slow path for omitempty). + if f.omitempty && !mo.Flags.Get(jsonflags.OmitEmptyWithLegacySemantics) { + var prevName *string + if prevIdx >= 0 { + prevName = &fields.flattened[prevIdx].name + } + if xe.UnwriteEmptyObjectMember(prevName) { + continue + } + } + + // Remember the previous written object member. + // The set of seen fields only needs to be updated to detect + // duplicate names with those from the inlined fallback. + if !mo.Flags.Get(jsonflags.AllowDuplicateNames) && fields.inlinedFallback != nil { + seenIdxs.insert(uint(f.id)) + } + prevIdx = f.id + } + if fields.inlinedFallback != nil && !(mo.Flags.Get(jsonflags.DiscardUnknownMembers) && fields.inlinedFallback.unknown) { + var insertUnquotedName func([]byte) bool + if !mo.Flags.Get(jsonflags.AllowDuplicateNames) { + insertUnquotedName = func(name []byte) bool { + // Check that the name from inlined fallback does not match + // one of the previously marshaled names from known fields. + if foldedFields := fields.lookupByFoldedName(name); len(foldedFields) > 0 { + if f := fields.byActualName[string(name)]; f != nil { + return seenIdxs.insert(uint(f.id)) + } + for _, f := range foldedFields { + if f.matchFoldedName(name, &mo.Flags) { + return seenIdxs.insert(uint(f.id)) + } + } + } + + // Check that the name does not match any other name + // previously marshaled from the inlined fallback. + return xe.Namespaces.Last().InsertUnquoted(name) + } + } + if err := marshalInlinedFallbackAll(enc, va, mo, fields.inlinedFallback, insertUnquotedName); err != nil { + return err + } + } + if err := enc.WriteToken(jsontext.EndObject); err != nil { + return err + } + return nil + } + fncs.unmarshal = func(dec *jsontext.Decoder, va addressableValue, uo *jsonopts.Struct) error { + xd := export.Decoder(dec) + if uo.Format != "" && uo.FormatDepth == xd.Tokens.Depth() { + return newInvalidFormatError(dec, t) + } + tok, err := dec.ReadToken() + if err != nil { + return err + } + k := tok.Kind() + switch k { + case 'n': + if !uo.Flags.Get(jsonflags.MergeWithLegacySemantics) { + va.SetZero() + } + return nil + case '{': + once.Do(init) + if errInit != nil && !uo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return newUnmarshalErrorAfter(dec, errInit.GoType, errInit.Err) + } + var seenIdxs uintSet + xd.Tokens.Last.DisableNamespace() + var errUnmarshal error + for dec.PeekKind() != '}' { + // Process the object member name. + var flags jsonwire.ValueFlags + val, err := xd.ReadValue(&flags) + if err != nil { + return err + } + name := jsonwire.UnquoteMayCopy(val, flags.IsVerbatim()) + f := fields.byActualName[string(name)] + if f == nil { + for _, f2 := range fields.lookupByFoldedName(name) { + if f2.matchFoldedName(name, &uo.Flags) { + f = f2 + break + } + } + if f == nil { + if uo.Flags.Get(jsonflags.RejectUnknownMembers) && (fields.inlinedFallback == nil || fields.inlinedFallback.unknown) { + err := newUnmarshalErrorAfter(dec, t, ErrUnknownName) + if !uo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return err + } + errUnmarshal = cmp.Or(errUnmarshal, err) + } + if !uo.Flags.Get(jsonflags.AllowDuplicateNames) && !xd.Namespaces.Last().InsertUnquoted(name) { + // TODO: Unread the object name. + return newDuplicateNameError(dec.StackPointer(), nil, dec.InputOffset()-len64(val)) + } + + if fields.inlinedFallback == nil { + // Skip unknown value since we have no place to store it. + if err := dec.SkipValue(); err != nil { + return err + } + } else { + // Marshal into value capable of storing arbitrary object members. + if err := unmarshalInlinedFallbackNext(dec, va, uo, fields.inlinedFallback, val, name); err != nil { + if isFatalError(err, uo.Flags) { + return err + } + errUnmarshal = cmp.Or(errUnmarshal, err) + } + } + continue + } + } + if !uo.Flags.Get(jsonflags.AllowDuplicateNames) && !seenIdxs.insert(uint(f.id)) { + // TODO: Unread the object name. + return newDuplicateNameError(dec.StackPointer(), nil, dec.InputOffset()-len64(val)) + } + + // Process the object member value. + unmarshal := f.fncs.unmarshal + if uo.Unmarshalers != nil { + unmarshal, _ = uo.Unmarshalers.(*Unmarshalers).lookup(unmarshal, f.typ) + } + flagsOriginal := uo.Flags + if f.string { + if !uo.Flags.Get(jsonflags.StringifyWithLegacySemantics) { + uo.Flags.Set(jsonflags.StringifyNumbers | 1) + } else if canLegacyStringify(f.typ) { + uo.Flags.Set(jsonflags.StringifyNumbers | jsonflags.StringifyBoolsAndStrings | 1) + } + } + if f.format != "" { + uo.FormatDepth = xd.Tokens.Depth() + uo.Format = f.format + } + v := addressableValue{va.Field(f.index0), va.forcedAddr} // addressable if struct value is addressable + if len(f.index) > 0 { + v = v.fieldByIndex(f.index, true) + if !v.IsValid() { + err := newUnmarshalErrorBefore(dec, t, errNilField) + if !uo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return err + } + errUnmarshal = cmp.Or(errUnmarshal, err) + unmarshal = func(dec *jsontext.Decoder, _ addressableValue, _ *jsonopts.Struct) error { + return dec.SkipValue() + } + } + } + err = unmarshal(dec, v, uo) + uo.Flags = flagsOriginal + uo.Format = "" + if err != nil { + if isFatalError(err, uo.Flags) { + return err + } + errUnmarshal = cmp.Or(errUnmarshal, err) + } + } + if _, err := dec.ReadToken(); err != nil { + return err + } + return errUnmarshal + } + return newUnmarshalErrorAfterWithSkipping(dec, t, nil) + } + return &fncs +} + +func (va addressableValue) fieldByIndex(index []int, mayAlloc bool) addressableValue { + for _, i := range index { + va = va.indirect(mayAlloc) + if !va.IsValid() { + return va + } + va = addressableValue{va.Field(i), va.forcedAddr} // addressable if struct value is addressable + } + return va +} + +func (va addressableValue) indirect(mayAlloc bool) addressableValue { + if va.Kind() == reflect.Pointer { + if va.IsNil() { + if !mayAlloc || !va.CanSet() { + return addressableValue{} + } + va.Set(reflect.New(va.Type().Elem())) + } + va = addressableValue{va.Elem(), false} // dereferenced pointer is always addressable + } + return va +} + +// isLegacyEmpty reports whether a value is empty according to the v1 definition. +func isLegacyEmpty(v addressableValue) bool { + // Equivalent to encoding/json.isEmptyValue@v1.21.0. + switch v.Kind() { + case reflect.Bool: + return v.Bool() == false + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.String, reflect.Map, reflect.Slice, reflect.Array: + return v.Len() == 0 + case reflect.Pointer, reflect.Interface: + return v.IsNil() + } + return false +} + +// canLegacyStringify reports whether t can be stringified according to v1, +// where t is a bool, string, or number (or unnamed pointer to such). +// In v1, the `string` option does not apply recursively to nested types within +// a composite Go type (e.g., an array, slice, struct, map, or interface). +func canLegacyStringify(t reflect.Type) bool { + // Based on encoding/json.typeFields#L1126-L1143@v1.23.0 + if t.Name() == "" && t.Kind() == reflect.Ptr { + t = t.Elem() + } + switch t.Kind() { + case reflect.Bool, reflect.String, + reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, + reflect.Float32, reflect.Float64: + return true + } + return false +} + +func makeSliceArshaler(t reflect.Type) *arshaler { + var fncs arshaler + var ( + once sync.Once + valFncs *arshaler + ) + init := func() { + valFncs = lookupArshaler(t.Elem()) + } + fncs.marshal = func(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct) error { + // Check for cycles. + xe := export.Encoder(enc) + if xe.Tokens.Depth() > startDetectingCyclesAfter { + if err := visitPointer(&xe.SeenPointers, va.Value); err != nil { + return newMarshalErrorBefore(enc, t, err) + } + defer leavePointer(&xe.SeenPointers, va.Value) + } + + emitNull := mo.Flags.Get(jsonflags.FormatNilSliceAsNull) + if mo.Format != "" && mo.FormatDepth == xe.Tokens.Depth() { + switch mo.Format { + case "emitnull": + emitNull = true + mo.Format = "" + case "emitempty": + emitNull = false + mo.Format = "" + default: + return newInvalidFormatError(enc, t) + } + } + + // Handle empty slices. + n := va.Len() + if n == 0 { + if emitNull && va.IsNil() { + return enc.WriteToken(jsontext.Null) + } + // Optimize for marshaling an empty slice without any preceding whitespace. + if optimizeCommon && !mo.Flags.Get(jsonflags.AnyWhitespace) && !xe.Tokens.Last.NeedObjectName() { + xe.Buf = append(xe.Tokens.MayAppendDelim(xe.Buf, '['), "[]"...) + xe.Tokens.Last.Increment() + if xe.NeedFlush() { + return xe.Flush() + } + return nil + } + } + + once.Do(init) + if err := enc.WriteToken(jsontext.BeginArray); err != nil { + return err + } + marshal := valFncs.marshal + if mo.Marshalers != nil { + marshal, _ = mo.Marshalers.(*Marshalers).lookup(marshal, t.Elem()) + } + for i := range n { + v := addressableValue{va.Index(i), false} // indexed slice element is always addressable + if err := marshal(enc, v, mo); err != nil { + return err + } + } + if err := enc.WriteToken(jsontext.EndArray); err != nil { + return err + } + return nil + } + emptySlice := reflect.MakeSlice(t, 0, 0) + fncs.unmarshal = func(dec *jsontext.Decoder, va addressableValue, uo *jsonopts.Struct) error { + xd := export.Decoder(dec) + if uo.Format != "" && uo.FormatDepth == xd.Tokens.Depth() { + switch uo.Format { + case "emitnull", "emitempty": + uo.Format = "" // only relevant for marshaling + default: + return newInvalidFormatError(dec, t) + } + } + + tok, err := dec.ReadToken() + if err != nil { + return err + } + k := tok.Kind() + switch k { + case 'n': + va.SetZero() + return nil + case '[': + once.Do(init) + unmarshal := valFncs.unmarshal + if uo.Unmarshalers != nil { + unmarshal, _ = uo.Unmarshalers.(*Unmarshalers).lookup(unmarshal, t.Elem()) + } + mustZero := true // we do not know the cleanliness of unused capacity + cap := va.Cap() + if cap > 0 { + va.SetLen(cap) + } + var i int + var errUnmarshal error + for dec.PeekKind() != ']' { + if i == cap { + va.Value.Grow(1) + cap = va.Cap() + va.SetLen(cap) + mustZero = false // reflect.Value.Grow ensures new capacity is zero-initialized + } + v := addressableValue{va.Index(i), false} // indexed slice element is always addressable + i++ + if mustZero && !uo.Flags.Get(jsonflags.MergeWithLegacySemantics) { + v.SetZero() + } + if err := unmarshal(dec, v, uo); err != nil { + if isFatalError(err, uo.Flags) { + va.SetLen(i) + return err + } + errUnmarshal = cmp.Or(errUnmarshal, err) + } + } + if i == 0 { + va.Set(emptySlice) + } else { + va.SetLen(i) + } + if _, err := dec.ReadToken(); err != nil { + return err + } + return errUnmarshal + } + return newUnmarshalErrorAfterWithSkipping(dec, t, nil) + } + return &fncs +} + +var errArrayUnderflow = errors.New("too few array elements") +var errArrayOverflow = errors.New("too many array elements") + +func makeArrayArshaler(t reflect.Type) *arshaler { + var fncs arshaler + var ( + once sync.Once + valFncs *arshaler + ) + init := func() { + valFncs = lookupArshaler(t.Elem()) + } + n := t.Len() + fncs.marshal = func(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct) error { + xe := export.Encoder(enc) + if mo.Format != "" && mo.FormatDepth == xe.Tokens.Depth() { + return newInvalidFormatError(enc, t) + } + once.Do(init) + if err := enc.WriteToken(jsontext.BeginArray); err != nil { + return err + } + marshal := valFncs.marshal + if mo.Marshalers != nil { + marshal, _ = mo.Marshalers.(*Marshalers).lookup(marshal, t.Elem()) + } + for i := range n { + v := addressableValue{va.Index(i), va.forcedAddr} // indexed array element is addressable if array is addressable + if err := marshal(enc, v, mo); err != nil { + return err + } + } + if err := enc.WriteToken(jsontext.EndArray); err != nil { + return err + } + return nil + } + fncs.unmarshal = func(dec *jsontext.Decoder, va addressableValue, uo *jsonopts.Struct) error { + xd := export.Decoder(dec) + if uo.Format != "" && uo.FormatDepth == xd.Tokens.Depth() { + return newInvalidFormatError(dec, t) + } + tok, err := dec.ReadToken() + if err != nil { + return err + } + k := tok.Kind() + switch k { + case 'n': + if !uo.Flags.Get(jsonflags.MergeWithLegacySemantics) { + va.SetZero() + } + return nil + case '[': + once.Do(init) + unmarshal := valFncs.unmarshal + if uo.Unmarshalers != nil { + unmarshal, _ = uo.Unmarshalers.(*Unmarshalers).lookup(unmarshal, t.Elem()) + } + var i int + var errUnmarshal error + for dec.PeekKind() != ']' { + if i >= n { + if err := dec.SkipValue(); err != nil { + return err + } + err = errArrayOverflow + continue + } + v := addressableValue{va.Index(i), va.forcedAddr} // indexed array element is addressable if array is addressable + if !uo.Flags.Get(jsonflags.MergeWithLegacySemantics) { + v.SetZero() + } + if err := unmarshal(dec, v, uo); err != nil { + if isFatalError(err, uo.Flags) { + return err + } + errUnmarshal = cmp.Or(errUnmarshal, err) + } + i++ + } + for ; i < n; i++ { + va.Index(i).SetZero() + err = errArrayUnderflow + } + if _, err := dec.ReadToken(); err != nil { + return err + } + if err != nil && !uo.Flags.Get(jsonflags.UnmarshalArrayFromAnyLength) { + return newUnmarshalErrorAfter(dec, t, err) + } + return errUnmarshal + } + return newUnmarshalErrorAfterWithSkipping(dec, t, nil) + } + return &fncs +} + +func makePointerArshaler(t reflect.Type) *arshaler { + var fncs arshaler + var ( + once sync.Once + valFncs *arshaler + ) + init := func() { + valFncs = lookupArshaler(t.Elem()) + } + fncs.marshal = func(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct) error { + // Check for cycles. + xe := export.Encoder(enc) + if xe.Tokens.Depth() > startDetectingCyclesAfter { + if err := visitPointer(&xe.SeenPointers, va.Value); err != nil { + return newMarshalErrorBefore(enc, t, err) + } + defer leavePointer(&xe.SeenPointers, va.Value) + } + + // NOTE: Struct.Format is forwarded to underlying marshal. + if va.IsNil() { + return enc.WriteToken(jsontext.Null) + } + once.Do(init) + marshal := valFncs.marshal + if mo.Marshalers != nil { + marshal, _ = mo.Marshalers.(*Marshalers).lookup(marshal, t.Elem()) + } + v := addressableValue{va.Elem(), false} // dereferenced pointer is always addressable + return marshal(enc, v, mo) + } + fncs.unmarshal = func(dec *jsontext.Decoder, va addressableValue, uo *jsonopts.Struct) error { + // NOTE: Struct.Format is forwarded to underlying unmarshal. + if dec.PeekKind() == 'n' { + if _, err := dec.ReadToken(); err != nil { + return err + } + va.SetZero() + return nil + } + once.Do(init) + unmarshal := valFncs.unmarshal + if uo.Unmarshalers != nil { + unmarshal, _ = uo.Unmarshalers.(*Unmarshalers).lookup(unmarshal, t.Elem()) + } + if va.IsNil() { + va.Set(reflect.New(t.Elem())) + } + v := addressableValue{va.Elem(), false} // dereferenced pointer is always addressable + if err := unmarshal(dec, v, uo); err != nil { + return err + } + if uo.Flags.Get(jsonflags.StringifyWithLegacySemantics) && + uo.Flags.Get(jsonflags.StringifyNumbers|jsonflags.StringifyBoolsAndStrings) { + // A JSON null quoted within a JSON string should take effect + // within the pointer value, rather than the indirect value. + // + // TODO: This does not correctly handle escaped nulls + // (e.g., "\u006e\u0075\u006c\u006c"), but is good enough + // for such an esoteric use case of the `string` option. + if string(export.Decoder(dec).PreviousTokenOrValue()) == `"null"` { + va.SetZero() + } + } + return nil + } + return &fncs +} + +func makeInterfaceArshaler(t reflect.Type) *arshaler { + // NOTE: Values retrieved from an interface are not addressable, + // so we shallow copy the values to make them addressable and + // store them back into the interface afterwards. + + var fncs arshaler + var whichMarshaler reflect.Type + for _, iface := range allMarshalerTypes { + if t.Implements(iface) { + whichMarshaler = t + break + } + } + fncs.marshal = func(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct) error { + xe := export.Encoder(enc) + if mo.Format != "" && mo.FormatDepth == xe.Tokens.Depth() { + return newInvalidFormatError(enc, t) + } + if va.IsNil() { + return enc.WriteToken(jsontext.Null) + } else if mo.Flags.Get(jsonflags.CallMethodsWithLegacySemantics) && whichMarshaler != nil { + // The marshaler for a pointer never calls the method on a nil receiver. + // Wrap the nil pointer within a struct type so that marshal + // instead appears on a value receiver and may be called. + if va.Elem().Kind() == reflect.Pointer && va.Elem().IsNil() { + v2 := newAddressableValue(whichMarshaler) + switch whichMarshaler { + case jsonMarshalerToType: + v2.Set(reflect.ValueOf(struct{ MarshalerTo }{va.Elem().Interface().(MarshalerTo)})) + case jsonMarshalerType: + v2.Set(reflect.ValueOf(struct{ Marshaler }{va.Elem().Interface().(Marshaler)})) + case textAppenderType: + v2.Set(reflect.ValueOf(struct{ encoding.TextAppender }{va.Elem().Interface().(encoding.TextAppender)})) + case textMarshalerType: + v2.Set(reflect.ValueOf(struct{ encoding.TextMarshaler }{va.Elem().Interface().(encoding.TextMarshaler)})) + } + va = v2 + } + } + v := newAddressableValue(va.Elem().Type()) + v.Set(va.Elem()) + marshal := lookupArshaler(v.Type()).marshal + if mo.Marshalers != nil { + marshal, _ = mo.Marshalers.(*Marshalers).lookup(marshal, v.Type()) + } + // Optimize for the any type if there are no special options. + if optimizeCommon && + t == anyType && !mo.Flags.Get(jsonflags.StringifyNumbers|jsonflags.StringifyBoolsAndStrings) && mo.Format == "" && + (mo.Marshalers == nil || !mo.Marshalers.(*Marshalers).fromAny) { + return marshalValueAny(enc, va.Elem().Interface(), mo) + } + return marshal(enc, v, mo) + } + fncs.unmarshal = func(dec *jsontext.Decoder, va addressableValue, uo *jsonopts.Struct) error { + xd := export.Decoder(dec) + if uo.Format != "" && uo.FormatDepth == xd.Tokens.Depth() { + return newInvalidFormatError(dec, t) + } + if uo.Flags.Get(jsonflags.MergeWithLegacySemantics) && !va.IsNil() { + // Legacy merge behavior is difficult to explain. + // In general, it only merges for non-nil pointer kinds. + // As a special case, unmarshaling a JSON null into a pointer + // sets a concrete nil pointer of the underlying type + // (rather than setting the interface value itself to nil). + e := va.Elem() + if e.Kind() == reflect.Pointer && !e.IsNil() { + if dec.PeekKind() == 'n' && e.Elem().Kind() == reflect.Pointer { + if _, err := dec.ReadToken(); err != nil { + return err + } + va.Elem().Elem().SetZero() + return nil + } + } else { + va.SetZero() + } + } + if dec.PeekKind() == 'n' { + if _, err := dec.ReadToken(); err != nil { + return err + } + va.SetZero() + return nil + } + var v addressableValue + if va.IsNil() { + // Optimize for the any type if there are no special options. + // We do not care about stringified numbers since JSON strings + // are always unmarshaled into an any value as Go strings. + // Duplicate name check must be enforced since unmarshalValueAny + // does not implement merge semantics. + if optimizeCommon && + t == anyType && !uo.Flags.Get(jsonflags.AllowDuplicateNames) && uo.Format == "" && + (uo.Unmarshalers == nil || !uo.Unmarshalers.(*Unmarshalers).fromAny) { + v, err := unmarshalValueAny(dec, uo) + // We must check for nil interface values up front. + // See https://go.dev/issue/52310. + if v != nil { + va.Set(reflect.ValueOf(v)) + } + return err + } + + k := dec.PeekKind() + if !isAnyType(t) { + return newUnmarshalErrorBeforeWithSkipping(dec, t, internal.ErrNilInterface) + } + switch k { + case 'f', 't': + v = newAddressableValue(boolType) + case '"': + v = newAddressableValue(stringType) + case '0': + if uo.Flags.Get(jsonflags.UnmarshalAnyWithRawNumber) { + v = addressableValue{reflect.ValueOf(internal.NewRawNumber()).Elem(), true} + } else { + v = newAddressableValue(float64Type) + } + case '{': + v = newAddressableValue(mapStringAnyType) + case '[': + v = newAddressableValue(sliceAnyType) + default: + // If k is invalid (e.g., due to an I/O or syntax error), then + // that will be cached by PeekKind and returned by ReadValue. + // If k is '}' or ']', then ReadValue must error since + // those are invalid kinds at the start of a JSON value. + _, err := dec.ReadValue() + return err + } + } else { + // Shallow copy the existing value to keep it addressable. + // Any mutations at the top-level of the value will be observable + // since we always store this value back into the interface value. + v = newAddressableValue(va.Elem().Type()) + v.Set(va.Elem()) + } + unmarshal := lookupArshaler(v.Type()).unmarshal + if uo.Unmarshalers != nil { + unmarshal, _ = uo.Unmarshalers.(*Unmarshalers).lookup(unmarshal, v.Type()) + } + err := unmarshal(dec, v, uo) + va.Set(v.Value) + return err + } + return &fncs +} + +// isAnyType reports wether t is equivalent to the any interface type. +func isAnyType(t reflect.Type) bool { + // This is forward compatible if the Go language permits type sets within + // ordinary interfaces where an interface with zero methods does not + // necessarily mean it can hold every possible Go type. + // See https://go.dev/issue/45346. + return t == anyType || anyType.Implements(t) +} + +func makeInvalidArshaler(t reflect.Type) *arshaler { + var fncs arshaler + fncs.marshal = func(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct) error { + return newMarshalErrorBefore(enc, t, nil) + } + fncs.unmarshal = func(dec *jsontext.Decoder, va addressableValue, uo *jsonopts.Struct) error { + return newUnmarshalErrorBefore(dec, t, nil) + } + return &fncs +} + +func stringOrNumberKind(isString bool) jsontext.Kind { + if isString { + return '"' + } else { + return '0' + } +} + +type uintSet64 uint64 + +func (s uintSet64) has(i uint) bool { return s&(1< 0 } +func (s *uintSet64) set(i uint) { *s |= 1 << i } + +// uintSet is a set of unsigned integers. +// It is optimized for most integers being close to zero. +type uintSet struct { + lo uintSet64 + hi []uintSet64 +} + +// has reports whether i is in the set. +func (s *uintSet) has(i uint) bool { + if i < 64 { + return s.lo.has(i) + } else { + i -= 64 + iHi, iLo := int(i/64), i%64 + return iHi < len(s.hi) && s.hi[iHi].has(iLo) + } +} + +// insert inserts i into the set and reports whether it was the first insertion. +func (s *uintSet) insert(i uint) bool { + // TODO: Make this inlinable at least for the lower 64-bit case. + if i < 64 { + has := s.lo.has(i) + s.lo.set(i) + return !has + } else { + i -= 64 + iHi, iLo := int(i/64), i%64 + if iHi >= len(s.hi) { + s.hi = append(s.hi, make([]uintSet64, iHi+1-len(s.hi))...) + s.hi = s.hi[:cap(s.hi)] + } + has := s.hi[iHi].has(iLo) + s.hi[iHi].set(iLo) + return !has + } +} diff --git a/go/src/encoding/json/v2/arshal_funcs.go b/go/src/encoding/json/v2/arshal_funcs.go new file mode 100644 index 0000000000000000000000000000000000000000..28916af948db6e8190e74b066fa09411a0c671b9 --- /dev/null +++ b/go/src/encoding/json/v2/arshal_funcs.go @@ -0,0 +1,440 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json + +import ( + "errors" + "fmt" + "io" + "reflect" + "sync" + + "encoding/json/internal" + "encoding/json/internal/jsonflags" + "encoding/json/internal/jsonopts" + "encoding/json/jsontext" +) + +// SkipFunc may be returned by [MarshalToFunc] and [UnmarshalFromFunc] functions. +// +// Any function that returns SkipFunc must not cause observable side effects +// on the provided [jsontext.Encoder] or [jsontext.Decoder]. +// For example, it is permissible to call [jsontext.Decoder.PeekKind], +// but not permissible to call [jsontext.Decoder.ReadToken] or +// [jsontext.Encoder.WriteToken] since such methods mutate the state. +var SkipFunc = errors.New("json: skip function") + +var errSkipMutation = errors.New("must not read or write any tokens when skipping") +var errNonSingularValue = errors.New("must read or write exactly one value") + +// Marshalers is a list of functions that may override the marshal behavior +// of specific types. Populate [WithMarshalers] to use it with +// [Marshal], [MarshalWrite], or [MarshalEncode]. +// A nil *Marshalers is equivalent to an empty list. +// There are no exported fields or methods on Marshalers. +type Marshalers = typedMarshalers + +// JoinMarshalers constructs a flattened list of marshal functions. +// If multiple functions in the list are applicable for a value of a given type, +// then those earlier in the list take precedence over those that come later. +// If a function returns [SkipFunc], then the next applicable function is called, +// otherwise the default marshaling behavior is used. +// +// For example: +// +// m1 := JoinMarshalers(f1, f2) +// m2 := JoinMarshalers(f0, m1, f3) // equivalent to m3 +// m3 := JoinMarshalers(f0, f1, f2, f3) // equivalent to m2 +func JoinMarshalers(ms ...*Marshalers) *Marshalers { + return newMarshalers(ms...) +} + +// Unmarshalers is a list of functions that may override the unmarshal behavior +// of specific types. Populate [WithUnmarshalers] to use it with +// [Unmarshal], [UnmarshalRead], or [UnmarshalDecode]. +// A nil *Unmarshalers is equivalent to an empty list. +// There are no exported fields or methods on Unmarshalers. +type Unmarshalers = typedUnmarshalers + +// JoinUnmarshalers constructs a flattened list of unmarshal functions. +// If multiple functions in the list are applicable for a value of a given type, +// then those earlier in the list take precedence over those that come later. +// If a function returns [SkipFunc], then the next applicable function is called, +// otherwise the default unmarshaling behavior is used. +// +// For example: +// +// u1 := JoinUnmarshalers(f1, f2) +// u2 := JoinUnmarshalers(f0, u1, f3) // equivalent to u3 +// u3 := JoinUnmarshalers(f0, f1, f2, f3) // equivalent to u2 +func JoinUnmarshalers(us ...*Unmarshalers) *Unmarshalers { + return newUnmarshalers(us...) +} + +type typedMarshalers = typedArshalers[jsontext.Encoder] +type typedUnmarshalers = typedArshalers[jsontext.Decoder] +type typedArshalers[Coder any] struct { + nonComparable + + fncVals []typedArshaler[Coder] + fncCache sync.Map // map[reflect.Type]arshaler + + // fromAny reports whether any of Go types used to represent arbitrary JSON + // (i.e., any, bool, string, float64, map[string]any, or []any) matches + // any of the provided type-specific arshalers. + // + // This bit of information is needed in arshal_default.go to determine + // whether to use the specialized logic in arshal_any.go to handle + // the any interface type. The logic in arshal_any.go does not support + // type-specific arshal functions, so we must avoid using that logic + // if this is true. + fromAny bool +} +type typedMarshaler = typedArshaler[jsontext.Encoder] +type typedUnmarshaler = typedArshaler[jsontext.Decoder] +type typedArshaler[Coder any] struct { + typ reflect.Type + fnc func(*Coder, addressableValue, *jsonopts.Struct) error + maySkip bool +} + +func newMarshalers(ms ...*Marshalers) *Marshalers { return newTypedArshalers(ms...) } +func newUnmarshalers(us ...*Unmarshalers) *Unmarshalers { return newTypedArshalers(us...) } +func newTypedArshalers[Coder any](as ...*typedArshalers[Coder]) *typedArshalers[Coder] { + var a typedArshalers[Coder] + for _, a2 := range as { + if a2 != nil { + a.fncVals = append(a.fncVals, a2.fncVals...) + a.fromAny = a.fromAny || a2.fromAny + } + } + if len(a.fncVals) == 0 { + return nil + } + return &a +} + +func (a *typedArshalers[Coder]) lookup(fnc func(*Coder, addressableValue, *jsonopts.Struct) error, t reflect.Type) (func(*Coder, addressableValue, *jsonopts.Struct) error, bool) { + if a == nil { + return fnc, false + } + if v, ok := a.fncCache.Load(t); ok { + if v == nil { + return fnc, false + } + return v.(func(*Coder, addressableValue, *jsonopts.Struct) error), true + } + + // Collect a list of arshalers that can be called for this type. + // This list may be longer than 1 since some arshalers can be skipped. + var fncs []func(*Coder, addressableValue, *jsonopts.Struct) error + for _, fncVal := range a.fncVals { + if !castableTo(t, fncVal.typ) { + continue + } + fncs = append(fncs, fncVal.fnc) + if !fncVal.maySkip { + break // subsequent arshalers will never be called + } + } + + if len(fncs) == 0 { + a.fncCache.Store(t, nil) // nil to indicate that no funcs found + return fnc, false + } + + // Construct an arshaler that may call every applicable arshaler. + fncDefault := fnc + fnc = func(c *Coder, v addressableValue, o *jsonopts.Struct) error { + for _, fnc := range fncs { + if err := fnc(c, v, o); err != SkipFunc { + return err // may be nil or non-nil + } + } + return fncDefault(c, v, o) + } + + // Use the first stored so duplicate work can be garbage collected. + v, _ := a.fncCache.LoadOrStore(t, fnc) + return v.(func(*Coder, addressableValue, *jsonopts.Struct) error), true +} + +// MarshalFunc constructs a type-specific marshaler that +// specifies how to marshal values of type T. +// T can be any type except a named pointer. +// The function is always provided with a non-nil pointer value +// if T is an interface or pointer type. +// +// The function must marshal exactly one JSON value. +// The value of T must not be retained outside the function call. +// It may not return [SkipFunc]. +func MarshalFunc[T any](fn func(T) ([]byte, error)) *Marshalers { + t := reflect.TypeFor[T]() + assertCastableTo(t, true) + typFnc := typedMarshaler{ + typ: t, + fnc: func(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct) error { + v, _ := reflect.TypeAssert[T](va.castTo(t)) + val, err := fn(v) + if err != nil { + err = wrapSkipFunc(err, "marshal function of type func(T) ([]byte, error)") + if mo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return internal.NewMarshalerError(va.Addr().Interface(), err, "MarshalFunc") // unlike unmarshal, always wrapped + } + err = newMarshalErrorBefore(enc, t, err) + return collapseSemanticErrors(err) + } + if err := enc.WriteValue(val); err != nil { + if mo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return internal.NewMarshalerError(va.Addr().Interface(), err, "MarshalFunc") // unlike unmarshal, always wrapped + } + if isSyntacticError(err) { + err = newMarshalErrorBefore(enc, t, err) + } + return err + } + return nil + }, + } + return &Marshalers{fncVals: []typedMarshaler{typFnc}, fromAny: castableToFromAny(t)} +} + +// MarshalToFunc constructs a type-specific marshaler that +// specifies how to marshal values of type T. +// T can be any type except a named pointer. +// The function is always provided with a non-nil pointer value +// if T is an interface or pointer type. +// +// The function must marshal exactly one JSON value by calling write methods +// on the provided encoder. It may return [SkipFunc] such that marshaling can +// move on to the next marshal function. However, no mutable method calls may +// be called on the encoder if [SkipFunc] is returned. +// The pointer to [jsontext.Encoder] and the value of T +// must not be retained outside the function call. +func MarshalToFunc[T any](fn func(*jsontext.Encoder, T) error) *Marshalers { + t := reflect.TypeFor[T]() + assertCastableTo(t, true) + typFnc := typedMarshaler{ + typ: t, + fnc: func(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct) error { + xe := export.Encoder(enc) + prevDepth, prevLength := xe.Tokens.DepthLength() + xe.Flags.Set(jsonflags.WithinArshalCall | 1) + v, _ := reflect.TypeAssert[T](va.castTo(t)) + err := fn(enc, v) + xe.Flags.Set(jsonflags.WithinArshalCall | 0) + currDepth, currLength := xe.Tokens.DepthLength() + if err == nil && (prevDepth != currDepth || prevLength+1 != currLength) { + err = errNonSingularValue + } + if err != nil { + if err == SkipFunc { + if prevDepth == currDepth && prevLength == currLength { + return SkipFunc + } + err = errSkipMutation + } + if mo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return internal.NewMarshalerError(va.Addr().Interface(), err, "MarshalToFunc") // unlike unmarshal, always wrapped + } + if !export.IsIOError(err) { + err = newSemanticErrorWithPosition(enc, t, prevDepth, prevLength, err) + } + return err + } + return nil + }, + maySkip: true, + } + return &Marshalers{fncVals: []typedMarshaler{typFnc}, fromAny: castableToFromAny(t)} +} + +// UnmarshalFunc constructs a type-specific unmarshaler that +// specifies how to unmarshal values of type T. +// T must be an unnamed pointer or an interface type. +// The function is always provided with a non-nil pointer value. +// +// The function must unmarshal exactly one JSON value. +// The input []byte must not be mutated. +// The input []byte and value T must not be retained outside the function call. +// It may not return [SkipFunc]. +func UnmarshalFunc[T any](fn func([]byte, T) error) *Unmarshalers { + t := reflect.TypeFor[T]() + assertCastableTo(t, false) + typFnc := typedUnmarshaler{ + typ: t, + fnc: func(dec *jsontext.Decoder, va addressableValue, uo *jsonopts.Struct) error { + val, err := dec.ReadValue() + if err != nil { + return err // must be a syntactic or I/O error + } + v, _ := reflect.TypeAssert[T](va.castTo(t)) + err = fn(val, v) + if err != nil { + err = wrapSkipFunc(err, "unmarshal function of type func([]byte, T) error") + if uo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return err // unlike marshal, never wrapped + } + err = newUnmarshalErrorAfter(dec, t, err) + return collapseSemanticErrors(err) + } + return nil + }, + } + return &Unmarshalers{fncVals: []typedUnmarshaler{typFnc}, fromAny: castableToFromAny(t)} +} + +// UnmarshalFromFunc constructs a type-specific unmarshaler that +// specifies how to unmarshal values of type T. +// T must be an unnamed pointer or an interface type. +// The function is always provided with a non-nil pointer value. +// +// The function must unmarshal exactly one JSON value by calling read methods +// on the provided decoder. It may return [SkipFunc] such that unmarshaling can +// move on to the next unmarshal function. However, no mutable method calls may +// be called on the decoder if [SkipFunc] is returned. +// The pointer to [jsontext.Decoder] and the value of T +// must not be retained outside the function call. +func UnmarshalFromFunc[T any](fn func(*jsontext.Decoder, T) error) *Unmarshalers { + t := reflect.TypeFor[T]() + assertCastableTo(t, false) + typFnc := typedUnmarshaler{ + typ: t, + fnc: func(dec *jsontext.Decoder, va addressableValue, uo *jsonopts.Struct) error { + xd := export.Decoder(dec) + prevDepth, prevLength := xd.Tokens.DepthLength() + if prevDepth == 1 && xd.AtEOF() { + return io.EOF // check EOF early to avoid fn reporting an EOF + } + xd.Flags.Set(jsonflags.WithinArshalCall | 1) + v, _ := reflect.TypeAssert[T](va.castTo(t)) + err := fn(dec, v) + xd.Flags.Set(jsonflags.WithinArshalCall | 0) + currDepth, currLength := xd.Tokens.DepthLength() + if err == nil && (prevDepth != currDepth || prevLength+1 != currLength) { + err = errNonSingularValue + } + if err != nil { + if err == SkipFunc { + if prevDepth == currDepth && prevLength == currLength { + return SkipFunc + } + err = errSkipMutation + } + if uo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + if err2 := xd.SkipUntil(prevDepth, prevLength+1); err2 != nil { + return err2 + } + return err // unlike marshal, never wrapped + } + if !isSyntacticError(err) && !export.IsIOError(err) { + err = newSemanticErrorWithPosition(dec, t, prevDepth, prevLength, err) + } + return err + } + return nil + }, + maySkip: true, + } + return &Unmarshalers{fncVals: []typedUnmarshaler{typFnc}, fromAny: castableToFromAny(t)} +} + +// assertCastableTo asserts that "to" is a valid type to be casted to. +// These are the Go types that type-specific arshalers may operate upon. +// +// Let AllTypes be the universal set of all possible Go types. +// This function generally asserts that: +// +// len([from for from in AllTypes if castableTo(from, to)]) > 0 +// +// otherwise it panics. +// +// As a special-case if marshal is false, then we forbid any non-pointer or +// non-interface type since it is almost always a bug trying to unmarshal +// into something where the end-user caller did not pass in an addressable value +// since they will not observe the mutations. +func assertCastableTo(to reflect.Type, marshal bool) { + switch to.Kind() { + case reflect.Interface: + return + case reflect.Pointer: + // Only allow unnamed pointers to be consistent with the fact that + // taking the address of a value produces an unnamed pointer type. + if to.Name() == "" { + return + } + default: + // Technically, non-pointer types are permissible for unmarshal. + // However, they are often a bug since the receiver would be immutable. + // Thus, only allow them for marshaling. + if marshal { + return + } + } + if marshal { + panic(fmt.Sprintf("input type %v must be an interface type, an unnamed pointer type, or a non-pointer type", to)) + } else { + panic(fmt.Sprintf("input type %v must be an interface type or an unnamed pointer type", to)) + } +} + +// castableTo checks whether values of type "from" can be casted to type "to". +// Nil pointer or interface "from" values are never considered castable. +// +// This function must be kept in sync with addressableValue.castTo. +func castableTo(from, to reflect.Type) bool { + switch to.Kind() { + case reflect.Interface: + // TODO: This breaks when ordinary interfaces can have type sets + // since interfaces now exist where only the value form of a type (T) + // implements the interface, but not the pointer variant (*T). + // See https://go.dev/issue/45346. + return reflect.PointerTo(from).Implements(to) + case reflect.Pointer: + // Common case for unmarshaling. + // From must be a concrete or interface type. + return reflect.PointerTo(from) == to + default: + // Common case for marshaling. + // From must be a concrete type. + return from == to + } +} + +// castTo casts va to the specified type. +// If the type is an interface, then the underlying type will always +// be a non-nil pointer to a concrete type. +// +// Requirement: castableTo(va.Type(), to) must hold. +func (va addressableValue) castTo(to reflect.Type) reflect.Value { + switch to.Kind() { + case reflect.Interface: + return va.Addr().Convert(to) + case reflect.Pointer: + return va.Addr() + default: + return va.Value + } +} + +// castableToFromAny reports whether "to" can be casted to from any +// of the dynamic types used to represent arbitrary JSON. +func castableToFromAny(to reflect.Type) bool { + for _, from := range []reflect.Type{anyType, boolType, stringType, float64Type, mapStringAnyType, sliceAnyType} { + if castableTo(from, to) { + return true + } + } + return false +} + +func wrapSkipFunc(err error, what string) error { + if err == SkipFunc { + return errors.New(what + " cannot be skipped") + } + return err +} diff --git a/go/src/encoding/json/v2/arshal_inlined.go b/go/src/encoding/json/v2/arshal_inlined.go new file mode 100644 index 0000000000000000000000000000000000000000..03e563a0c095457e707bbb72539fc28263beed47 --- /dev/null +++ b/go/src/encoding/json/v2/arshal_inlined.go @@ -0,0 +1,230 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json + +import ( + "bytes" + "errors" + "io" + "reflect" + "slices" + + "encoding/json/internal/jsonflags" + "encoding/json/internal/jsonopts" + "encoding/json/internal/jsonwire" + "encoding/json/jsontext" +) + +// This package supports "inlining" a Go struct field, where the contents +// of the serialized field (which must be a JSON object) are treated as if +// they are part of the parent Go struct (which represents a JSON object). +// +// Generally, inlined fields are of a Go struct type, where the fields of the +// nested struct are virtually hoisted up to the parent struct using rules +// similar to how Go embedding works (but operating within the JSON namespace). +// +// However, inlined fields may also be of a Go map type with a string key or +// a jsontext.Value. Such inlined fields are called "fallback" fields since they +// represent any arbitrary JSON object member. Explicitly named fields take +// precedence over the inlined fallback. Only one inlined fallback is allowed. + +var errRawInlinedNotObject = errors.New("inlined raw value must be a JSON object") + +var jsontextValueType = reflect.TypeFor[jsontext.Value]() + +// marshalInlinedFallbackAll marshals all the members in an inlined fallback. +func marshalInlinedFallbackAll(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct, f *structField, insertUnquotedName func([]byte) bool) error { + v := addressableValue{va.Field(f.index0), va.forcedAddr} // addressable if struct value is addressable + if len(f.index) > 0 { + v = v.fieldByIndex(f.index, false) + if !v.IsValid() { + return nil // implies a nil inlined field + } + } + v = v.indirect(false) + if !v.IsValid() { + return nil + } + + if v.Type() == jsontextValueType { + b, _ := reflect.TypeAssert[jsontext.Value](v.Value) + if len(b) == 0 { // TODO: Should this be nil? What if it were all whitespace? + return nil + } + + dec := export.GetBufferedDecoder(b) + defer export.PutBufferedDecoder(dec) + xd := export.Decoder(dec) + xd.Flags.Set(jsonflags.AllowDuplicateNames | jsonflags.AllowInvalidUTF8 | 1) + + tok, err := dec.ReadToken() + if err != nil { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + return newMarshalErrorBefore(enc, v.Type(), err) + } + if tok.Kind() != '{' { + return newMarshalErrorBefore(enc, v.Type(), errRawInlinedNotObject) + } + for dec.PeekKind() != '}' { + // Parse the JSON object name. + var flags jsonwire.ValueFlags + val, err := xd.ReadValue(&flags) + if err != nil { + return newMarshalErrorBefore(enc, v.Type(), err) + } + if insertUnquotedName != nil { + name := jsonwire.UnquoteMayCopy(val, flags.IsVerbatim()) + if !insertUnquotedName(name) { + return newDuplicateNameError(enc.StackPointer().Parent(), val, enc.OutputOffset()) + } + } + if err := enc.WriteValue(val); err != nil { + return err + } + + // Parse the JSON object value. + val, err = xd.ReadValue(&flags) + if err != nil { + return newMarshalErrorBefore(enc, v.Type(), err) + } + if err := enc.WriteValue(val); err != nil { + return err + } + } + if _, err := dec.ReadToken(); err != nil { + return newMarshalErrorBefore(enc, v.Type(), err) + } + if err := xd.CheckEOF(); err != nil { + return newMarshalErrorBefore(enc, v.Type(), err) + } + return nil + } else { + m := v // must be a map[~string]V + n := m.Len() + if n == 0 { + return nil + } + mk := newAddressableValue(m.Type().Key()) + mv := newAddressableValue(m.Type().Elem()) + marshalKey := func(mk addressableValue) error { + b, err := jsonwire.AppendQuote(enc.AvailableBuffer(), mk.String(), &mo.Flags) + if err != nil { + return newMarshalErrorBefore(enc, m.Type().Key(), err) + } + if insertUnquotedName != nil { + isVerbatim := bytes.IndexByte(b, '\\') < 0 + name := jsonwire.UnquoteMayCopy(b, isVerbatim) + if !insertUnquotedName(name) { + return newDuplicateNameError(enc.StackPointer().Parent(), b, enc.OutputOffset()) + } + } + return enc.WriteValue(b) + } + marshalVal := f.fncs.marshal + if mo.Marshalers != nil { + marshalVal, _ = mo.Marshalers.(*Marshalers).lookup(marshalVal, mv.Type()) + } + if !mo.Flags.Get(jsonflags.Deterministic) || n <= 1 { + for iter := m.MapRange(); iter.Next(); { + mk.SetIterKey(iter) + if err := marshalKey(mk); err != nil { + return err + } + mv.Set(iter.Value()) + if err := marshalVal(enc, mv, mo); err != nil { + return err + } + } + } else { + names := getStrings(n) + for i, iter := 0, m.Value.MapRange(); i < n && iter.Next(); i++ { + mk.SetIterKey(iter) + (*names)[i] = mk.String() + } + slices.Sort(*names) + for _, name := range *names { + mk.SetString(name) + if err := marshalKey(mk); err != nil { + return err + } + // TODO(https://go.dev/issue/57061): Use mv.SetMapIndexOf. + mv.Set(m.MapIndex(mk.Value)) + if err := marshalVal(enc, mv, mo); err != nil { + return err + } + } + putStrings(names) + } + return nil + } +} + +// unmarshalInlinedFallbackNext unmarshals only the next member in an inlined fallback. +func unmarshalInlinedFallbackNext(dec *jsontext.Decoder, va addressableValue, uo *jsonopts.Struct, f *structField, quotedName, unquotedName []byte) error { + v := addressableValue{va.Field(f.index0), va.forcedAddr} // addressable if struct value is addressable + if len(f.index) > 0 { + v = v.fieldByIndex(f.index, true) + } + v = v.indirect(true) + + if v.Type() == jsontextValueType { + b, _ := reflect.TypeAssert[*jsontext.Value](v.Addr()) + if len(*b) == 0 { // TODO: Should this be nil? What if it were all whitespace? + *b = append(*b, '{') + } else { + *b = jsonwire.TrimSuffixWhitespace(*b) + if jsonwire.HasSuffixByte(*b, '}') { + // TODO: When merging into an object for the first time, + // should we verify that it is valid? + *b = jsonwire.TrimSuffixByte(*b, '}') + *b = jsonwire.TrimSuffixWhitespace(*b) + if !jsonwire.HasSuffixByte(*b, ',') && !jsonwire.HasSuffixByte(*b, '{') { + *b = append(*b, ',') + } + } else { + return newUnmarshalErrorAfterWithSkipping(dec, v.Type(), errRawInlinedNotObject) + } + } + *b = append(*b, quotedName...) + *b = append(*b, ':') + val, err := dec.ReadValue() + if err != nil { + return err + } + *b = append(*b, val...) + *b = append(*b, '}') + return nil + } else { + name := string(unquotedName) // TODO: Intern this? + + m := v // must be a map[~string]V + if m.IsNil() { + m.Set(reflect.MakeMap(m.Type())) + } + mk := reflect.ValueOf(name) + if mkt := m.Type().Key(); mkt != stringType { + mk = mk.Convert(mkt) + } + mv := newAddressableValue(m.Type().Elem()) // TODO: Cache across calls? + if v2 := m.MapIndex(mk); v2.IsValid() { + mv.Set(v2) + } + + unmarshal := f.fncs.unmarshal + if uo.Unmarshalers != nil { + unmarshal, _ = uo.Unmarshalers.(*Unmarshalers).lookup(unmarshal, mv.Type()) + } + err := unmarshal(dec, mv, uo) + m.SetMapIndex(mk, mv.Value) + if err != nil { + return err + } + return nil + } +} diff --git a/go/src/encoding/json/v2/arshal_methods.go b/go/src/encoding/json/v2/arshal_methods.go new file mode 100644 index 0000000000000000000000000000000000000000..1621eadc0807631750e261fefc71d91fca972b01 --- /dev/null +++ b/go/src/encoding/json/v2/arshal_methods.go @@ -0,0 +1,361 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json + +import ( + "encoding" + "errors" + "io" + "reflect" + + "encoding/json/internal" + "encoding/json/internal/jsonflags" + "encoding/json/internal/jsonopts" + "encoding/json/internal/jsonwire" + "encoding/json/jsontext" +) + +var errNonStringValue = errors.New("JSON value must be string type") + +// Interfaces for custom serialization. +var ( + jsonMarshalerType = reflect.TypeFor[Marshaler]() + jsonMarshalerToType = reflect.TypeFor[MarshalerTo]() + jsonUnmarshalerType = reflect.TypeFor[Unmarshaler]() + jsonUnmarshalerFromType = reflect.TypeFor[UnmarshalerFrom]() + textAppenderType = reflect.TypeFor[encoding.TextAppender]() + textMarshalerType = reflect.TypeFor[encoding.TextMarshaler]() + textUnmarshalerType = reflect.TypeFor[encoding.TextUnmarshaler]() + + allMarshalerTypes = []reflect.Type{jsonMarshalerToType, jsonMarshalerType, textAppenderType, textMarshalerType} + allUnmarshalerTypes = []reflect.Type{jsonUnmarshalerFromType, jsonUnmarshalerType, textUnmarshalerType} + allMethodTypes = append(allMarshalerTypes, allUnmarshalerTypes...) +) + +// Marshaler is implemented by types that can marshal themselves. +// It is recommended that types implement [MarshalerTo] unless the implementation +// is trying to avoid a hard dependency on the "jsontext" package. +// +// It is recommended that implementations return a buffer that is safe +// for the caller to retain and potentially mutate. +// +// If the returned error is a [SemanticError], then unpopulated fields +// of the error may be populated by [json] with additional context. +// Errors of other types are wrapped within a [SemanticError]. +type Marshaler interface { + MarshalJSON() ([]byte, error) +} + +// MarshalerTo is implemented by types that can marshal themselves. +// It is recommended that types implement MarshalerTo instead of [Marshaler] +// since this is both more performant and flexible. +// If a type implements both Marshaler and MarshalerTo, +// then MarshalerTo takes precedence. In such a case, both implementations +// should aim to have equivalent behavior for the default marshal options. +// +// The implementation must write only one JSON value to the Encoder and +// must not retain the pointer to [jsontext.Encoder]. +// +// If the returned error is a [SemanticError], then unpopulated fields +// of the error may be populated by [json] with additional context. +// Errors of other types are wrapped within a [SemanticError], +// unless it is an IO error. +type MarshalerTo interface { + MarshalJSONTo(*jsontext.Encoder) error + + // TODO: Should users call the MarshalEncode function or + // should/can they call this method directly? Does it matter? +} + +// Unmarshaler is implemented by types that can unmarshal themselves. +// It is recommended that types implement [UnmarshalerFrom] unless the implementation +// is trying to avoid a hard dependency on the "jsontext" package. +// +// The input can be assumed to be a valid encoding of a JSON value +// if called from unmarshal functionality in this package. +// UnmarshalJSON must copy the JSON data if it is retained after returning. +// It is recommended that UnmarshalJSON implement merge semantics when +// unmarshaling into a pre-populated value. +// +// Implementations must not retain or mutate the input []byte. +// +// If the returned error is a [SemanticError], then unpopulated fields +// of the error may be populated by [json] with additional context. +// Errors of other types are wrapped within a [SemanticError]. +type Unmarshaler interface { + UnmarshalJSON([]byte) error +} + +// UnmarshalerFrom is implemented by types that can unmarshal themselves. +// It is recommended that types implement UnmarshalerFrom instead of [Unmarshaler] +// since this is both more performant and flexible. +// If a type implements both Unmarshaler and UnmarshalerFrom, +// then UnmarshalerFrom takes precedence. In such a case, both implementations +// should aim to have equivalent behavior for the default unmarshal options. +// +// The implementation must read only one JSON value from the Decoder. +// It is recommended that UnmarshalJSONFrom implement merge semantics when +// unmarshaling into a pre-populated value. +// +// Implementations must not retain the pointer to [jsontext.Decoder]. +// +// If the returned error is a [SemanticError], then unpopulated fields +// of the error may be populated by [json] with additional context. +// Errors of other types are wrapped within a [SemanticError], +// unless it is a [jsontext.SyntacticError] or an IO error. +type UnmarshalerFrom interface { + UnmarshalJSONFrom(*jsontext.Decoder) error + + // TODO: Should users call the UnmarshalDecode function or + // should/can they call this method directly? Does it matter? +} + +func makeMethodArshaler(fncs *arshaler, t reflect.Type) *arshaler { + // Avoid injecting method arshaler on the pointer or interface version + // to avoid ever calling the method on a nil pointer or interface receiver. + // Let it be injected on the value receiver (which is always addressable). + if t.Kind() == reflect.Pointer || t.Kind() == reflect.Interface { + return fncs + } + + if needAddr, ok := implements(t, textMarshalerType); ok { + fncs.nonDefault = true + prevMarshal := fncs.marshal + fncs.marshal = func(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct) error { + if mo.Flags.Get(jsonflags.CallMethodsWithLegacySemantics) && + (needAddr && va.forcedAddr) { + return prevMarshal(enc, va, mo) + } + marshaler, _ := reflect.TypeAssert[encoding.TextMarshaler](va.Addr()) + if err := export.Encoder(enc).AppendRaw('"', false, func(b []byte) ([]byte, error) { + b2, err := marshaler.MarshalText() + return append(b, b2...), err + }); err != nil { + err = wrapSkipFunc(err, "marshal method") + if mo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return internal.NewMarshalerError(va.Addr().Interface(), err, "MarshalText") // unlike unmarshal, always wrapped + } + if !isSemanticError(err) && !export.IsIOError(err) { + err = newMarshalErrorBefore(enc, t, err) + } + return err + } + return nil + } + } + + if needAddr, ok := implements(t, textAppenderType); ok { + fncs.nonDefault = true + prevMarshal := fncs.marshal + fncs.marshal = func(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct) (err error) { + if mo.Flags.Get(jsonflags.CallMethodsWithLegacySemantics) && + (needAddr && va.forcedAddr) { + return prevMarshal(enc, va, mo) + } + appender, _ := reflect.TypeAssert[encoding.TextAppender](va.Addr()) + if err := export.Encoder(enc).AppendRaw('"', false, appender.AppendText); err != nil { + err = wrapSkipFunc(err, "append method") + if mo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return internal.NewMarshalerError(va.Addr().Interface(), err, "AppendText") // unlike unmarshal, always wrapped + } + if !isSemanticError(err) && !export.IsIOError(err) { + err = newMarshalErrorBefore(enc, t, err) + } + return err + } + return nil + } + } + + if needAddr, ok := implements(t, jsonMarshalerType); ok { + fncs.nonDefault = true + prevMarshal := fncs.marshal + fncs.marshal = func(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct) error { + if mo.Flags.Get(jsonflags.CallMethodsWithLegacySemantics) && + ((needAddr && va.forcedAddr) || export.Encoder(enc).Tokens.Last.NeedObjectName()) { + return prevMarshal(enc, va, mo) + } + marshaler, _ := reflect.TypeAssert[Marshaler](va.Addr()) + val, err := marshaler.MarshalJSON() + if err != nil { + err = wrapSkipFunc(err, "marshal method") + if mo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return internal.NewMarshalerError(va.Addr().Interface(), err, "MarshalJSON") // unlike unmarshal, always wrapped + } + err = newMarshalErrorBefore(enc, t, err) + return collapseSemanticErrors(err) + } + if err := enc.WriteValue(val); err != nil { + if mo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return internal.NewMarshalerError(va.Addr().Interface(), err, "MarshalJSON") // unlike unmarshal, always wrapped + } + if isSyntacticError(err) { + err = newMarshalErrorBefore(enc, t, err) + } + return err + } + return nil + } + } + + if needAddr, ok := implements(t, jsonMarshalerToType); ok { + fncs.nonDefault = true + prevMarshal := fncs.marshal + fncs.marshal = func(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct) error { + if mo.Flags.Get(jsonflags.CallMethodsWithLegacySemantics) && + ((needAddr && va.forcedAddr) || export.Encoder(enc).Tokens.Last.NeedObjectName()) { + return prevMarshal(enc, va, mo) + } + xe := export.Encoder(enc) + prevDepth, prevLength := xe.Tokens.DepthLength() + xe.Flags.Set(jsonflags.WithinArshalCall | 1) + marshaler, _ := reflect.TypeAssert[MarshalerTo](va.Addr()) + err := marshaler.MarshalJSONTo(enc) + xe.Flags.Set(jsonflags.WithinArshalCall | 0) + currDepth, currLength := xe.Tokens.DepthLength() + if (prevDepth != currDepth || prevLength+1 != currLength) && err == nil { + err = errNonSingularValue + } + if err != nil { + err = wrapSkipFunc(err, "marshal method") + if mo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return internal.NewMarshalerError(va.Addr().Interface(), err, "MarshalJSONTo") // unlike unmarshal, always wrapped + } + if !export.IsIOError(err) { + err = newSemanticErrorWithPosition(enc, t, prevDepth, prevLength, err) + } + return err + } + return nil + } + } + + if _, ok := implements(t, textUnmarshalerType); ok { + fncs.nonDefault = true + fncs.unmarshal = func(dec *jsontext.Decoder, va addressableValue, uo *jsonopts.Struct) error { + xd := export.Decoder(dec) + var flags jsonwire.ValueFlags + val, err := xd.ReadValue(&flags) + if err != nil { + return err // must be a syntactic or I/O error + } + if val.Kind() == 'n' { + if !uo.Flags.Get(jsonflags.MergeWithLegacySemantics) { + va.SetZero() + } + return nil + } + if val.Kind() != '"' { + return newUnmarshalErrorAfter(dec, t, errNonStringValue) + } + s := jsonwire.UnquoteMayCopy(val, flags.IsVerbatim()) + unmarshaler, _ := reflect.TypeAssert[encoding.TextUnmarshaler](va.Addr()) + if err := unmarshaler.UnmarshalText(s); err != nil { + err = wrapSkipFunc(err, "unmarshal method") + if uo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return err // unlike marshal, never wrapped + } + if !isSemanticError(err) && !isSyntacticError(err) && !export.IsIOError(err) { + err = newUnmarshalErrorAfter(dec, t, err) + } + return err + } + return nil + } + } + + if _, ok := implements(t, jsonUnmarshalerType); ok { + fncs.nonDefault = true + prevUnmarshal := fncs.unmarshal + fncs.unmarshal = func(dec *jsontext.Decoder, va addressableValue, uo *jsonopts.Struct) error { + if uo.Flags.Get(jsonflags.CallMethodsWithLegacySemantics) && + export.Decoder(dec).Tokens.Last.NeedObjectName() { + return prevUnmarshal(dec, va, uo) + } + val, err := dec.ReadValue() + if err != nil { + return err // must be a syntactic or I/O error + } + unmarshaler, _ := reflect.TypeAssert[Unmarshaler](va.Addr()) + if err := unmarshaler.UnmarshalJSON(val); err != nil { + err = wrapSkipFunc(err, "unmarshal method") + if uo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return err // unlike marshal, never wrapped + } + err = newUnmarshalErrorAfter(dec, t, err) + return collapseSemanticErrors(err) + } + return nil + } + } + + if _, ok := implements(t, jsonUnmarshalerFromType); ok { + fncs.nonDefault = true + prevUnmarshal := fncs.unmarshal + fncs.unmarshal = func(dec *jsontext.Decoder, va addressableValue, uo *jsonopts.Struct) error { + if uo.Flags.Get(jsonflags.CallMethodsWithLegacySemantics) && + export.Decoder(dec).Tokens.Last.NeedObjectName() { + return prevUnmarshal(dec, va, uo) + } + xd := export.Decoder(dec) + prevDepth, prevLength := xd.Tokens.DepthLength() + if prevDepth == 1 && xd.AtEOF() { + return io.EOF // check EOF early to avoid fn reporting an EOF + } + xd.Flags.Set(jsonflags.WithinArshalCall | 1) + unmarshaler, _ := reflect.TypeAssert[UnmarshalerFrom](va.Addr()) + err := unmarshaler.UnmarshalJSONFrom(dec) + xd.Flags.Set(jsonflags.WithinArshalCall | 0) + currDepth, currLength := xd.Tokens.DepthLength() + if (prevDepth != currDepth || prevLength+1 != currLength) && err == nil { + err = errNonSingularValue + } + if err != nil { + err = wrapSkipFunc(err, "unmarshal method") + if uo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + if err2 := xd.SkipUntil(prevDepth, prevLength+1); err2 != nil { + return err2 + } + return err // unlike marshal, never wrapped + } + if !isSyntacticError(err) && !export.IsIOError(err) { + err = newSemanticErrorWithPosition(dec, t, prevDepth, prevLength, err) + } + return err + } + return nil + } + } + + return fncs +} + +// implementsAny is like t.Implements(ifaceType) for a list of interfaces, +// but checks whether either t or reflect.PointerTo(t) implements the interface. +func implementsAny(t reflect.Type, ifaceTypes ...reflect.Type) bool { + for _, ifaceType := range ifaceTypes { + if _, ok := implements(t, ifaceType); ok { + return true + } + } + return false +} + +// implements is like t.Implements(ifaceType) but checks whether +// either t or reflect.PointerTo(t) implements the interface. +// It also reports whether the value needs to be addressed +// in order to satisfy the interface. +func implements(t, ifaceType reflect.Type) (needAddr, ok bool) { + switch { + case t.Implements(ifaceType): + return false, true + case reflect.PointerTo(t).Implements(ifaceType): + return true, true + default: + return false, false + } +} diff --git a/go/src/encoding/json/v2/arshal_test.go b/go/src/encoding/json/v2/arshal_test.go new file mode 100644 index 0000000000000000000000000000000000000000..dc15c5a5f531b53b468dedb992d75f1a01769aaa --- /dev/null +++ b/go/src/encoding/json/v2/arshal_test.go @@ -0,0 +1,9620 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json + +import ( + "bytes" + "encoding" + "encoding/base32" + "encoding/base64" + "encoding/hex" + "errors" + "fmt" + "io" + "math" + "net" + "net/netip" + "reflect" + "strconv" + "strings" + "testing" + "time" + + "encoding/json/internal" + "encoding/json/internal/jsonflags" + "encoding/json/internal/jsonopts" + "encoding/json/internal/jsontest" + "encoding/json/internal/jsonwire" + "encoding/json/jsontext" +) + +func newNonStringNameError(offset int64, pointer jsontext.Pointer) error { + return &jsontext.SyntacticError{ByteOffset: offset, JSONPointer: pointer, Err: jsontext.ErrNonStringName} +} + +func newInvalidCharacterError(prefix, where string, offset int64, pointer jsontext.Pointer) error { + return &jsontext.SyntacticError{ByteOffset: offset, JSONPointer: pointer, Err: jsonwire.NewInvalidCharacterError(prefix, where)} +} + +func newInvalidUTF8Error(offset int64, pointer jsontext.Pointer) error { + return &jsontext.SyntacticError{ByteOffset: offset, JSONPointer: pointer, Err: jsonwire.ErrInvalidUTF8} +} + +func newParseTimeError(layout, value, layoutElem, valueElem, message string) error { + return &time.ParseError{Layout: layout, Value: value, LayoutElem: layoutElem, ValueElem: valueElem, Message: message} +} + +func EM(err error) *SemanticError { + return &SemanticError{action: "marshal", Err: err} +} + +func EU(err error) *SemanticError { + return &SemanticError{action: "unmarshal", Err: err} +} + +func (e *SemanticError) withVal(val string) *SemanticError { + e.JSONValue = jsontext.Value(val) + return e +} + +func (e *SemanticError) withPos(prefix string, pointer jsontext.Pointer) *SemanticError { + e.ByteOffset = int64(len(prefix)) + e.JSONPointer = pointer + return e +} + +func (e *SemanticError) withType(k jsontext.Kind, t reflect.Type) *SemanticError { + e.JSONKind = k + e.GoType = t + return e +} + +var ( + errInvalidFormatFlag = errors.New(`invalid format flag "invalid"`) + errSomeError = errors.New("some error") + errMustNotCall = errors.New("must not call") +) + +func T[T any]() reflect.Type { return reflect.TypeFor[T]() } + +type ( + jsonObject = map[string]any + jsonArray = []any + + namedAny any + namedBool bool + namedString string + NamedString string + namedBytes []byte + namedInt64 int64 + namedUint64 uint64 + namedFloat64 float64 + namedByte byte + netipAddr = netip.Addr + + recursiveMap map[string]recursiveMap + recursiveSlice []recursiveSlice + recursivePointer struct{ P *recursivePointer } + + structEmpty struct{} + structConflicting struct { + A string `json:"conflict"` + B string `json:"conflict"` + } + structNoneExported struct { + unexported string + } + structUnexportedIgnored struct { + ignored string `json:"-"` + } + structMalformedTag struct { + Malformed string `json:"\""` + } + structUnexportedTag struct { + unexported string `json:"name"` + } + structExportedEmbedded struct { + NamedString + } + structExportedEmbeddedTag struct { + NamedString `json:"name"` + } + structUnexportedEmbedded struct { + namedString + } + structUnexportedEmbeddedTag struct { + namedString `json:"name"` + } + structUnexportedEmbeddedMethodTag struct { + // netipAddr cannot be marshaled since the MarshalText method + // cannot be called on an unexported field. + netipAddr `json:"name"` + + // Bogus MarshalText and AppendText methods are declared on + // structUnexportedEmbeddedMethodTag to prevent it from + // implementing those method interfaces. + } + structUnexportedEmbeddedStruct struct { + structOmitZeroAll + FizzBuzz int + structNestedAddr + } + structUnexportedEmbeddedStructPointer struct { + *structOmitZeroAll + FizzBuzz int + *structNestedAddr + } + structNestedAddr struct { + Addr netip.Addr + } + structIgnoredUnexportedEmbedded struct { + namedString `json:"-"` + } + structWeirdNames struct { + Empty string `json:"''"` + Comma string `json:"','"` + Quote string `json:"'\"'"` + } + structNoCase struct { + Aaa string `json:",case:strict"` + AA_A string + AaA string `json:",case:ignore"` + AAa string `json:",case:ignore"` + AAA string + } + structScalars struct { + unexported bool + Ignored bool `json:"-"` + + Bool bool + String string + Bytes []byte + Int int64 + Uint uint64 + Float float64 + } + structSlices struct { + unexported bool + Ignored bool `json:"-"` + + SliceBool []bool + SliceString []string + SliceBytes [][]byte + SliceInt []int64 + SliceUint []uint64 + SliceFloat []float64 + } + structMaps struct { + unexported bool + Ignored bool `json:"-"` + + MapBool map[string]bool + MapString map[string]string + MapBytes map[string][]byte + MapInt map[string]int64 + MapUint map[string]uint64 + MapFloat map[string]float64 + } + structAll struct { + Bool bool + String string + Bytes []byte + Int int64 + Uint uint64 + Float float64 + Map map[string]string + StructScalars structScalars + StructMaps structMaps + StructSlices structSlices + Slice []string + Array [1]string + Pointer *structAll + Interface any + } + structStringifiedAll struct { + Bool bool `json:",string"` + String string `json:",string"` + Bytes []byte `json:",string"` + Int int64 `json:",string"` + Uint uint64 `json:",string"` + Float float64 `json:",string"` + Map map[string]string `json:",string"` + StructScalars structScalars `json:",string"` + StructMaps structMaps `json:",string"` + StructSlices structSlices `json:",string"` + Slice []string `json:",string"` + Array [1]string `json:",string"` + Pointer *structStringifiedAll `json:",string"` + Interface any `json:",string"` + } + structOmitZeroAll struct { + Bool bool `json:",omitzero"` + String string `json:",omitzero"` + Bytes []byte `json:",omitzero"` + Int int64 `json:",omitzero"` + Uint uint64 `json:",omitzero"` + Float float64 `json:",omitzero"` + Map map[string]string `json:",omitzero"` + StructScalars structScalars `json:",omitzero"` + StructMaps structMaps `json:",omitzero"` + StructSlices structSlices `json:",omitzero"` + Slice []string `json:",omitzero"` + Array [1]string `json:",omitzero"` + Pointer *structOmitZeroAll `json:",omitzero"` + Interface any `json:",omitzero"` + } + structOmitZeroMethodAll struct { + ValueAlwaysZero valueAlwaysZero `json:",omitzero"` + ValueNeverZero valueNeverZero `json:",omitzero"` + PointerAlwaysZero pointerAlwaysZero `json:",omitzero"` + PointerNeverZero pointerNeverZero `json:",omitzero"` + PointerValueAlwaysZero *valueAlwaysZero `json:",omitzero"` + PointerValueNeverZero *valueNeverZero `json:",omitzero"` + PointerPointerAlwaysZero *pointerAlwaysZero `json:",omitzero"` + PointerPointerNeverZero *pointerNeverZero `json:",omitzero"` + PointerPointerValueAlwaysZero **valueAlwaysZero `json:",omitzero"` + PointerPointerValueNeverZero **valueNeverZero `json:",omitzero"` + PointerPointerPointerAlwaysZero **pointerAlwaysZero `json:",omitzero"` + PointerPointerPointerNeverZero **pointerNeverZero `json:",omitzero"` + } + structOmitZeroMethodInterfaceAll struct { + ValueAlwaysZero isZeroer `json:",omitzero"` + ValueNeverZero isZeroer `json:",omitzero"` + PointerValueAlwaysZero isZeroer `json:",omitzero"` + PointerValueNeverZero isZeroer `json:",omitzero"` + PointerPointerAlwaysZero isZeroer `json:",omitzero"` + PointerPointerNeverZero isZeroer `json:",omitzero"` + } + structOmitEmptyAll struct { + Bool bool `json:",omitempty"` + PointerBool *bool `json:",omitempty"` + String string `json:",omitempty"` + StringEmpty stringMarshalEmpty `json:",omitempty"` + StringNonEmpty stringMarshalNonEmpty `json:",omitempty"` + PointerString *string `json:",omitempty"` + PointerStringEmpty *stringMarshalEmpty `json:",omitempty"` + PointerStringNonEmpty *stringMarshalNonEmpty `json:",omitempty"` + Bytes []byte `json:",omitempty"` + BytesEmpty bytesMarshalEmpty `json:",omitempty"` + BytesNonEmpty bytesMarshalNonEmpty `json:",omitempty"` + PointerBytes *[]byte `json:",omitempty"` + PointerBytesEmpty *bytesMarshalEmpty `json:",omitempty"` + PointerBytesNonEmpty *bytesMarshalNonEmpty `json:",omitempty"` + Float float64 `json:",omitempty"` + PointerFloat *float64 `json:",omitempty"` + Map map[string]string `json:",omitempty"` + MapEmpty mapMarshalEmpty `json:",omitempty"` + MapNonEmpty mapMarshalNonEmpty `json:",omitempty"` + PointerMap *map[string]string `json:",omitempty"` + PointerMapEmpty *mapMarshalEmpty `json:",omitempty"` + PointerMapNonEmpty *mapMarshalNonEmpty `json:",omitempty"` + Slice []string `json:",omitempty"` + SliceEmpty sliceMarshalEmpty `json:",omitempty"` + SliceNonEmpty sliceMarshalNonEmpty `json:",omitempty"` + PointerSlice *[]string `json:",omitempty"` + PointerSliceEmpty *sliceMarshalEmpty `json:",omitempty"` + PointerSliceNonEmpty *sliceMarshalNonEmpty `json:",omitempty"` + Pointer *structOmitZeroEmptyAll `json:",omitempty"` + Interface any `json:",omitempty"` + } + structOmitZeroEmptyAll struct { + Bool bool `json:",omitzero,omitempty"` + String string `json:",omitzero,omitempty"` + Bytes []byte `json:",omitzero,omitempty"` + Int int64 `json:",omitzero,omitempty"` + Uint uint64 `json:",omitzero,omitempty"` + Float float64 `json:",omitzero,omitempty"` + Map map[string]string `json:",omitzero,omitempty"` + Slice []string `json:",omitzero,omitempty"` + Array [1]string `json:",omitzero,omitempty"` + Pointer *structOmitZeroEmptyAll `json:",omitzero,omitempty"` + Interface any `json:",omitzero,omitempty"` + } + structFormatBytes struct { + Base16 []byte `json:",format:base16"` + Base32 []byte `json:",format:base32"` + Base32Hex []byte `json:",format:base32hex"` + Base64 []byte `json:",format:base64"` + Base64URL []byte `json:",format:base64url"` + Array []byte `json:",format:array"` + } + structFormatArrayBytes struct { + Base16 [4]byte `json:",format:base16"` + Base32 [4]byte `json:",format:base32"` + Base32Hex [4]byte `json:",format:base32hex"` + Base64 [4]byte `json:",format:base64"` + Base64URL [4]byte `json:",format:base64url"` + Array [4]byte `json:",format:array"` + Default [4]byte + } + structFormatFloats struct { + NonFinite float64 `json:",format:nonfinite"` + PointerNonFinite *float64 `json:",format:nonfinite"` + } + structFormatMaps struct { + EmitNull map[string]string `json:",format:emitnull"` + PointerEmitNull *map[string]string `json:",format:emitnull"` + EmitEmpty map[string]string `json:",format:emitempty"` + PointerEmitEmpty *map[string]string `json:",format:emitempty"` + EmitDefault map[string]string + PointerEmitDefault *map[string]string + } + structFormatSlices struct { + EmitNull []string `json:",format:emitnull"` + PointerEmitNull *[]string `json:",format:emitnull"` + EmitEmpty []string `json:",format:emitempty"` + PointerEmitEmpty *[]string `json:",format:emitempty"` + EmitDefault []string + PointerEmitDefault *[]string + } + structFormatInvalid struct { + Bool bool `json:",omitzero,format:invalid"` + String string `json:",omitzero,format:invalid"` + Bytes []byte `json:",omitzero,format:invalid"` + Int int64 `json:",omitzero,format:invalid"` + Uint uint64 `json:",omitzero,format:invalid"` + Float float64 `json:",omitzero,format:invalid"` + Map map[string]string `json:",omitzero,format:invalid"` + Struct structAll `json:",omitzero,format:invalid"` + Slice []string `json:",omitzero,format:invalid"` + Array [1]string `json:",omitzero,format:invalid"` + Interface any `json:",omitzero,format:invalid"` + } + structDurationFormat struct { + D1 time.Duration `json:",format:units"` // TODO(https://go.dev/issue/71631): Remove the format flag. + D2 time.Duration `json:",format:units"` + D3 time.Duration `json:",format:sec"` + D4 time.Duration `json:",string,format:sec"` + D5 time.Duration `json:",format:milli"` + D6 time.Duration `json:",string,format:milli"` + D7 time.Duration `json:",format:micro"` + D8 time.Duration `json:",string,format:micro"` + D9 time.Duration `json:",format:nano"` + D10 time.Duration `json:",string,format:nano"` + D11 time.Duration `json:",format:iso8601"` + } + structTimeFormat struct { + T1 time.Time + T2 time.Time `json:",format:ANSIC"` + T3 time.Time `json:",format:UnixDate"` + T4 time.Time `json:",format:RubyDate"` + T5 time.Time `json:",format:RFC822"` + T6 time.Time `json:",format:RFC822Z"` + T7 time.Time `json:",format:RFC850"` + T8 time.Time `json:",format:RFC1123"` + T9 time.Time `json:",format:RFC1123Z"` + T10 time.Time `json:",format:RFC3339"` + T11 time.Time `json:",format:RFC3339Nano"` + T12 time.Time `json:",format:Kitchen"` + T13 time.Time `json:",format:Stamp"` + T14 time.Time `json:",format:StampMilli"` + T15 time.Time `json:",format:StampMicro"` + T16 time.Time `json:",format:StampNano"` + T17 time.Time `json:",format:DateTime"` + T18 time.Time `json:",format:DateOnly"` + T19 time.Time `json:",format:TimeOnly"` + T20 time.Time `json:",format:'2006-01-02'"` + T21 time.Time `json:",format:'\"weird\"2006'"` + T22 time.Time `json:",format:unix"` + T23 time.Time `json:",string,format:unix"` + T24 time.Time `json:",format:unixmilli"` + T25 time.Time `json:",string,format:unixmilli"` + T26 time.Time `json:",format:unixmicro"` + T27 time.Time `json:",string,format:unixmicro"` + T28 time.Time `json:",format:unixnano"` + T29 time.Time `json:",string,format:unixnano"` + } + structInlined struct { + X structInlinedL1 `json:",inline"` + *StructEmbed2 // implicit inline + } + structInlinedL1 struct { + X *structInlinedL2 `json:",inline"` + StructEmbed1 `json:",inline"` + } + structInlinedL2 struct{ A, B, C string } + StructEmbed1 struct{ C, D, E string } + StructEmbed2 struct{ E, F, G string } + structUnknownTextValue struct { + A int `json:",omitzero"` + X jsontext.Value `json:",unknown"` + B int `json:",omitzero"` + } + structInlineTextValue struct { + A int `json:",omitzero"` + X jsontext.Value `json:",inline"` + B int `json:",omitzero"` + } + structInlinePointerTextValue struct { + A int `json:",omitzero"` + X *jsontext.Value `json:",inline"` + B int `json:",omitzero"` + } + structInlinePointerInlineTextValue struct { + X *struct { + A int + X jsontext.Value `json:",inline"` + } `json:",inline"` + } + structInlineInlinePointerTextValue struct { + X struct { + X *jsontext.Value `json:",inline"` + } `json:",inline"` + } + structInlineMapStringAny struct { + A int `json:",omitzero"` + X jsonObject `json:",inline"` + B int `json:",omitzero"` + } + structInlinePointerMapStringAny struct { + A int `json:",omitzero"` + X *jsonObject `json:",inline"` + B int `json:",omitzero"` + } + structInlinePointerInlineMapStringAny struct { + X *struct { + A int + X jsonObject `json:",inline"` + } `json:",inline"` + } + structInlineInlinePointerMapStringAny struct { + X struct { + X *jsonObject `json:",inline"` + } `json:",inline"` + } + structInlineMapStringInt struct { + X map[string]int `json:",inline"` + } + structInlineMapNamedStringInt struct { + X map[namedString]int `json:",inline"` + } + structInlineMapNamedStringAny struct { + A int `json:",omitzero"` + X map[namedString]any `json:",inline"` + B int `json:",omitzero"` + } + structNoCaseInlineTextValue struct { + AAA string `json:",omitempty,case:strict"` + AA_b string `json:",omitempty"` + AaA string `json:",omitempty,case:ignore"` + AAa string `json:",omitempty,case:ignore"` + Aaa string `json:",omitempty"` + X jsontext.Value `json:",inline"` + } + structNoCaseInlineMapStringAny struct { + AAA string `json:",omitempty"` + AaA string `json:",omitempty,case:ignore"` + AAa string `json:",omitempty,case:ignore"` + Aaa string `json:",omitempty"` + X jsonObject `json:",inline"` + } + + allMethods struct { + method string // the method that was called + value []byte // the raw value to provide or store + } + allMethodsExceptJSONv2 struct { + allMethods + MarshalJSONTo struct{} // cancel out MarshalJSONTo method with collision + UnmarshalJSONFrom struct{} // cancel out UnmarshalJSONFrom method with collision + } + allMethodsExceptJSONv1 struct { + allMethods + MarshalJSON struct{} // cancel out MarshalJSON method with collision + UnmarshalJSON struct{} // cancel out UnmarshalJSON method with collision + } + allMethodsExceptText struct { + allMethods + MarshalText struct{} // cancel out MarshalText method with collision + UnmarshalText struct{} // cancel out UnmarshalText method with collision + } + onlyMethodJSONv2 struct { + allMethods + MarshalJSON struct{} // cancel out MarshalJSON method with collision + UnmarshalJSON struct{} // cancel out UnmarshalJSON method with collision + MarshalText struct{} // cancel out MarshalText method with collision + UnmarshalText struct{} // cancel out UnmarshalText method with collision + } + onlyMethodJSONv1 struct { + allMethods + MarshalJSONTo struct{} // cancel out MarshalJSONTo method with collision + UnmarshalJSONFrom struct{} // cancel out UnmarshalJSONFrom method with collision + MarshalText struct{} // cancel out MarshalText method with collision + UnmarshalText struct{} // cancel out UnmarshalText method with collision + } + onlyMethodText struct { + allMethods + MarshalJSONTo struct{} // cancel out MarshalJSONTo method with collision + UnmarshalJSONFrom struct{} // cancel out UnmarshalJSONFrom method with collision + MarshalJSON struct{} // cancel out MarshalJSON method with collision + UnmarshalJSON struct{} // cancel out UnmarshalJSON method with collision + } + + structMethodJSONv2 struct{ value string } + structMethodJSONv1 struct{ value string } + structMethodText struct{ value string } + + marshalJSONv2Func func(*jsontext.Encoder) error + marshalJSONv1Func func() ([]byte, error) + appendTextFunc func([]byte) ([]byte, error) + marshalTextFunc func() ([]byte, error) + unmarshalJSONv2Func func(*jsontext.Decoder) error + unmarshalJSONv1Func func([]byte) error + unmarshalTextFunc func([]byte) error + + nocaseString string + + stringMarshalEmpty string + stringMarshalNonEmpty string + bytesMarshalEmpty []byte + bytesMarshalNonEmpty []byte + mapMarshalEmpty map[string]string + mapMarshalNonEmpty map[string]string + sliceMarshalEmpty []string + sliceMarshalNonEmpty []string + + valueAlwaysZero string + valueNeverZero string + pointerAlwaysZero string + pointerNeverZero string + + valueStringer struct{} + pointerStringer struct{} + + cyclicA struct { + B1 cyclicB `json:",inline"` + B2 cyclicB `json:",inline"` + } + cyclicB struct { + F int + A *cyclicA `json:",inline"` + } +) + +func (structUnexportedEmbeddedMethodTag) MarshalText() {} +func (structUnexportedEmbeddedMethodTag) AppendText() {} + +func (p *allMethods) MarshalJSONTo(enc *jsontext.Encoder) error { + if got, want := "MarshalJSONTo", p.method; got != want { + return fmt.Errorf("called wrong method: got %v, want %v", got, want) + } + return enc.WriteValue(p.value) +} +func (p *allMethods) MarshalJSON() ([]byte, error) { + if got, want := "MarshalJSON", p.method; got != want { + return nil, fmt.Errorf("called wrong method: got %v, want %v", got, want) + } + return p.value, nil +} +func (p *allMethods) MarshalText() ([]byte, error) { + if got, want := "MarshalText", p.method; got != want { + return nil, fmt.Errorf("called wrong method: got %v, want %v", got, want) + } + return p.value, nil +} + +func (p *allMethods) UnmarshalJSONFrom(dec *jsontext.Decoder) error { + p.method = "UnmarshalJSONFrom" + val, err := dec.ReadValue() + p.value = val + return err +} +func (p *allMethods) UnmarshalJSON(val []byte) error { + p.method = "UnmarshalJSON" + p.value = val + return nil +} +func (p *allMethods) UnmarshalText(val []byte) error { + p.method = "UnmarshalText" + p.value = val + return nil +} + +func (s structMethodJSONv2) MarshalJSONTo(enc *jsontext.Encoder) error { + return enc.WriteToken(jsontext.String(s.value)) +} +func (s *structMethodJSONv2) UnmarshalJSONFrom(dec *jsontext.Decoder) error { + tok, err := dec.ReadToken() + if err != nil { + return err + } + if k := tok.Kind(); k != '"' { + return EU(nil).withType(k, T[structMethodJSONv2]()) + } + s.value = tok.String() + return nil +} + +func (s structMethodJSONv1) MarshalJSON() ([]byte, error) { + return jsontext.AppendQuote(nil, s.value) +} +func (s *structMethodJSONv1) UnmarshalJSON(b []byte) error { + if k := jsontext.Value(b).Kind(); k != '"' { + return EU(nil).withType(k, T[structMethodJSONv1]()) + } + b, _ = jsontext.AppendUnquote(nil, b) + s.value = string(b) + return nil +} + +func (s structMethodText) MarshalText() ([]byte, error) { + return []byte(s.value), nil +} +func (s *structMethodText) UnmarshalText(b []byte) error { + s.value = string(b) + return nil +} + +func (f marshalJSONv2Func) MarshalJSONTo(enc *jsontext.Encoder) error { + return f(enc) +} +func (f marshalJSONv1Func) MarshalJSON() ([]byte, error) { + return f() +} +func (f appendTextFunc) AppendText(b []byte) ([]byte, error) { + return f(b) +} +func (f marshalTextFunc) MarshalText() ([]byte, error) { + return f() +} +func (f unmarshalJSONv2Func) UnmarshalJSONFrom(dec *jsontext.Decoder) error { + return f(dec) +} +func (f unmarshalJSONv1Func) UnmarshalJSON(b []byte) error { + return f(b) +} +func (f unmarshalTextFunc) UnmarshalText(b []byte) error { + return f(b) +} + +func (k nocaseString) MarshalText() ([]byte, error) { + return []byte(strings.ToLower(string(k))), nil +} +func (k *nocaseString) UnmarshalText(b []byte) error { + *k = nocaseString(strings.ToLower(string(b))) + return nil +} + +func (stringMarshalEmpty) MarshalJSON() ([]byte, error) { return []byte(`""`), nil } +func (stringMarshalNonEmpty) MarshalJSON() ([]byte, error) { return []byte(`"value"`), nil } +func (bytesMarshalEmpty) MarshalJSON() ([]byte, error) { return []byte(`[]`), nil } +func (bytesMarshalNonEmpty) MarshalJSON() ([]byte, error) { return []byte(`["value"]`), nil } +func (mapMarshalEmpty) MarshalJSON() ([]byte, error) { return []byte(`{}`), nil } +func (mapMarshalNonEmpty) MarshalJSON() ([]byte, error) { return []byte(`{"key":"value"}`), nil } +func (sliceMarshalEmpty) MarshalJSON() ([]byte, error) { return []byte(`[]`), nil } +func (sliceMarshalNonEmpty) MarshalJSON() ([]byte, error) { return []byte(`["value"]`), nil } + +func (valueAlwaysZero) IsZero() bool { return true } +func (valueNeverZero) IsZero() bool { return false } +func (*pointerAlwaysZero) IsZero() bool { return true } +func (*pointerNeverZero) IsZero() bool { return false } + +func (valueStringer) String() string { return "" } +func (*pointerStringer) String() string { return "" } + +func addr[T any](v T) *T { + return &v +} + +func mustParseTime(layout, value string) time.Time { + t, err := time.Parse(layout, value) + if err != nil { + panic(err) + } + return t +} + +var invalidFormatOption = &jsonopts.Struct{ + ArshalValues: jsonopts.ArshalValues{FormatDepth: 1000, Format: "invalid"}, +} + +func TestMarshal(t *testing.T) { + tests := []struct { + name jsontest.CaseName + opts []Options + in any + want string + wantErr error + + canonicalize bool // canonicalize the output before comparing? + useWriter bool // call MarshalWrite instead of Marshal + }{{ + name: jsontest.Name("Nil"), + in: nil, + want: `null`, + }, { + name: jsontest.Name("Bools"), + in: []bool{false, true}, + want: `[false,true]`, + }, { + name: jsontest.Name("Bools/Named"), + in: []namedBool{false, true}, + want: `[false,true]`, + }, { + name: jsontest.Name("Bools/NotStringified"), + opts: []Options{StringifyNumbers(true)}, + in: []bool{false, true}, + want: `[false,true]`, + }, { + name: jsontest.Name("Bools/StringifiedBool"), + opts: []Options{jsonflags.StringifyBoolsAndStrings | 1}, + in: []bool{false, true}, + want: `["false","true"]`, + }, { + name: jsontest.Name("Bools/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + in: true, + want: `true`, + }, { + name: jsontest.Name("Strings"), + in: []string{"", "hello", "世界"}, + want: `["","hello","世界"]`, + }, { + name: jsontest.Name("Strings/Named"), + in: []namedString{"", "hello", "世界"}, + want: `["","hello","世界"]`, + }, { + name: jsontest.Name("Strings/StringifiedBool"), + opts: []Options{jsonflags.StringifyBoolsAndStrings | 1}, + in: []string{"", "hello", "世界"}, + want: `["\"\"","\"hello\"","\"世界\""]`, + }, { + name: jsontest.Name("Strings/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + in: "string", + want: `"string"`, + }, { + name: jsontest.Name("Bytes"), + in: [][]byte{nil, {}, {1}, {1, 2}, {1, 2, 3}}, + want: `["","","AQ==","AQI=","AQID"]`, + }, { + name: jsontest.Name("Bytes/FormatNilSliceAsNull"), + opts: []Options{FormatNilSliceAsNull(true)}, + in: [][]byte{nil, {}}, + want: `[null,""]`, + }, { + name: jsontest.Name("Bytes/Large"), + in: []byte("the quick brown fox jumped over the lazy dog and ate the homework that I spent so much time on."), + want: `"dGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2cgYW5kIGF0ZSB0aGUgaG9tZXdvcmsgdGhhdCBJIHNwZW50IHNvIG11Y2ggdGltZSBvbi4="`, + }, { + name: jsontest.Name("Bytes/Named"), + in: []namedBytes{nil, {}, {1}, {1, 2}, {1, 2, 3}}, + want: `["","","AQ==","AQI=","AQID"]`, + }, { + name: jsontest.Name("Bytes/NotStringified"), + opts: []Options{StringifyNumbers(true)}, + in: [][]byte{nil, {}, {1}, {1, 2}, {1, 2, 3}}, + want: `["","","AQ==","AQI=","AQID"]`, + }, { + // NOTE: []namedByte is not assignable to []byte, + // so the following should be treated as a slice of uints. + name: jsontest.Name("Bytes/Invariant"), + in: [][]namedByte{nil, {}, {1}, {1, 2}, {1, 2, 3}}, + want: `[[],[],[1],[1,2],[1,2,3]]`, + }, { + // NOTE: This differs in behavior from v1, + // but keeps the representation of slices and arrays more consistent. + name: jsontest.Name("Bytes/ByteArray"), + in: [5]byte{'h', 'e', 'l', 'l', 'o'}, + want: `"aGVsbG8="`, + }, { + // NOTE: []namedByte is not assignable to []byte, + // so the following should be treated as an array of uints. + name: jsontest.Name("Bytes/NamedByteArray"), + in: [5]namedByte{'h', 'e', 'l', 'l', 'o'}, + want: `[104,101,108,108,111]`, + }, { + name: jsontest.Name("Bytes/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + in: []byte("hello"), + want: `"aGVsbG8="`, + }, { + name: jsontest.Name("Ints"), + in: []any{ + int(0), int8(math.MinInt8), int16(math.MinInt16), int32(math.MinInt32), int64(math.MinInt64), namedInt64(-6464), + }, + want: `[0,-128,-32768,-2147483648,-9223372036854775808,-6464]`, + }, { + name: jsontest.Name("Ints/Stringified"), + opts: []Options{StringifyNumbers(true)}, + in: []any{ + int(0), int8(math.MinInt8), int16(math.MinInt16), int32(math.MinInt32), int64(math.MinInt64), namedInt64(-6464), + }, + want: `["0","-128","-32768","-2147483648","-9223372036854775808","-6464"]`, + }, { + name: jsontest.Name("Ints/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + in: int(0), + want: `0`, + }, { + name: jsontest.Name("Uints"), + in: []any{ + uint(0), uint8(math.MaxUint8), uint16(math.MaxUint16), uint32(math.MaxUint32), uint64(math.MaxUint64), namedUint64(6464), uintptr(1234), + }, + want: `[0,255,65535,4294967295,18446744073709551615,6464,1234]`, + }, { + name: jsontest.Name("Uints/Stringified"), + opts: []Options{StringifyNumbers(true)}, + in: []any{ + uint(0), uint8(math.MaxUint8), uint16(math.MaxUint16), uint32(math.MaxUint32), uint64(math.MaxUint64), namedUint64(6464), + }, + want: `["0","255","65535","4294967295","18446744073709551615","6464"]`, + }, { + name: jsontest.Name("Uints/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + in: uint(0), + want: `0`, + }, { + name: jsontest.Name("Floats"), + in: []any{ + float32(math.MaxFloat32), float64(math.MaxFloat64), namedFloat64(64.64), + }, + want: `[3.4028235e+38,1.7976931348623157e+308,64.64]`, + }, { + name: jsontest.Name("Floats/Stringified"), + opts: []Options{StringifyNumbers(true)}, + in: []any{ + float32(math.MaxFloat32), float64(math.MaxFloat64), namedFloat64(64.64), + }, + want: `["3.4028235e+38","1.7976931348623157e+308","64.64"]`, + }, { + name: jsontest.Name("Floats/Invalid/NaN"), + opts: []Options{StringifyNumbers(true)}, + in: math.NaN(), + wantErr: EM(fmt.Errorf("unsupported value: %v", math.NaN())).withType(0, float64Type), + }, { + name: jsontest.Name("Floats/Invalid/PositiveInfinity"), + in: math.Inf(+1), + wantErr: EM(fmt.Errorf("unsupported value: %v", math.Inf(+1))).withType(0, float64Type), + }, { + name: jsontest.Name("Floats/Invalid/NegativeInfinity"), + in: math.Inf(-1), + wantErr: EM(fmt.Errorf("unsupported value: %v", math.Inf(-1))).withType(0, float64Type), + }, { + name: jsontest.Name("Floats/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + in: float64(0), + want: `0`, + }, { + name: jsontest.Name("Maps/InvalidKey/Bool"), + in: map[bool]string{false: "value"}, + want: `{`, + wantErr: EM(newNonStringNameError(len64(`{`), "")).withPos(`{`, "").withType(0, boolType), + }, { + name: jsontest.Name("Maps/InvalidKey/NamedBool"), + in: map[namedBool]string{false: "value"}, + want: `{`, + wantErr: EM(newNonStringNameError(len64(`{`), "")).withPos(`{`, "").withType(0, T[namedBool]()), + }, { + name: jsontest.Name("Maps/InvalidKey/Array"), + in: map[[1]string]string{{"key"}: "value"}, + want: `{`, + wantErr: EM(newNonStringNameError(len64(`{`), "")).withPos(`{`, "").withType(0, T[[1]string]()), + }, { + name: jsontest.Name("Maps/InvalidKey/Channel"), + in: map[chan string]string{make(chan string): "value"}, + want: `{`, + wantErr: EM(nil).withPos(`{`, "").withType(0, T[chan string]()), + }, { + name: jsontest.Name("Maps/ValidKey/Int"), + in: map[int64]string{math.MinInt64: "MinInt64", 0: "Zero", math.MaxInt64: "MaxInt64"}, + canonicalize: true, + want: `{"-9223372036854775808":"MinInt64","0":"Zero","9223372036854775807":"MaxInt64"}`, + }, { + name: jsontest.Name("Maps/ValidKey/PointerInt"), + in: map[*int64]string{addr(int64(math.MinInt64)): "MinInt64", addr(int64(0)): "Zero", addr(int64(math.MaxInt64)): "MaxInt64"}, + canonicalize: true, + want: `{"-9223372036854775808":"MinInt64","0":"Zero","9223372036854775807":"MaxInt64"}`, + }, { + name: jsontest.Name("Maps/DuplicateName/PointerInt"), + in: map[*int64]string{addr(int64(0)): "0", addr(int64(0)): "0"}, + canonicalize: true, + want: `{"0":"0"`, + wantErr: newDuplicateNameError("", []byte(`"0"`), len64(`{"0":"0",`)), + }, { + name: jsontest.Name("Maps/ValidKey/NamedInt"), + in: map[namedInt64]string{math.MinInt64: "MinInt64", 0: "Zero", math.MaxInt64: "MaxInt64"}, + canonicalize: true, + want: `{"-9223372036854775808":"MinInt64","0":"Zero","9223372036854775807":"MaxInt64"}`, + }, { + name: jsontest.Name("Maps/ValidKey/Uint"), + in: map[uint64]string{0: "Zero", math.MaxUint64: "MaxUint64"}, + canonicalize: true, + want: `{"0":"Zero","18446744073709551615":"MaxUint64"}`, + }, { + name: jsontest.Name("Maps/ValidKey/NamedUint"), + in: map[namedUint64]string{0: "Zero", math.MaxUint64: "MaxUint64"}, + canonicalize: true, + want: `{"0":"Zero","18446744073709551615":"MaxUint64"}`, + }, { + name: jsontest.Name("Maps/ValidKey/Float"), + in: map[float64]string{3.14159: "value"}, + want: `{"3.14159":"value"}`, + }, { + name: jsontest.Name("Maps/InvalidKey/Float/NaN"), + in: map[float64]string{math.NaN(): "NaN", math.NaN(): "NaN"}, + want: `{`, + wantErr: EM(errors.New("unsupported value: NaN")).withPos(`{`, "").withType(0, float64Type), + }, { + name: jsontest.Name("Maps/ValidKey/Interface"), + in: map[any]any{ + "key": "key", + namedInt64(-64): int32(-32), + namedUint64(+64): uint32(+32), + namedFloat64(64.64): float32(32.32), + }, + canonicalize: true, + want: `{"-64":-32,"64":32,"64.64":32.32,"key":"key"}`, + }, { + name: jsontest.Name("Maps/DuplicateName/String/AllowInvalidUTF8+AllowDuplicateNames"), + opts: []Options{jsontext.AllowInvalidUTF8(true), jsontext.AllowDuplicateNames(true)}, + in: map[string]string{"\x80": "", "\x81": ""}, + want: `{"�":"","�":""}`, + }, { + name: jsontest.Name("Maps/DuplicateName/String/AllowInvalidUTF8"), + opts: []Options{jsontext.AllowInvalidUTF8(true)}, + in: map[string]string{"\x80": "", "\x81": ""}, + want: `{"�":""`, + wantErr: newDuplicateNameError("", []byte(`"�"`), len64(`{"�":"",`)), + }, { + name: jsontest.Name("Maps/DuplicateName/NoCaseString/AllowDuplicateNames"), + opts: []Options{jsontext.AllowDuplicateNames(true)}, + in: map[nocaseString]string{"hello": "", "HELLO": ""}, + want: `{"hello":"","hello":""}`, + }, { + name: jsontest.Name("Maps/DuplicateName/NoCaseString"), + in: map[nocaseString]string{"hello": "", "HELLO": ""}, + want: `{"hello":""`, + wantErr: EM(newDuplicateNameError("", []byte(`"hello"`), len64(`{"hello":"",`))).withPos(`{"hello":"",`, "").withType(0, T[nocaseString]()), + }, { + name: jsontest.Name("Maps/DuplicateName/NaNs/Deterministic+AllowDuplicateNames"), + opts: []Options{ + WithMarshalers( + MarshalFunc(func(v float64) ([]byte, error) { return []byte(`"NaN"`), nil }), + ), + Deterministic(true), + jsontext.AllowDuplicateNames(true), + }, + in: map[float64]string{math.NaN(): "NaN", math.NaN(): "NaN"}, + want: `{"NaN":"NaN","NaN":"NaN"}`, + }, { + name: jsontest.Name("Maps/InvalidValue/Channel"), + in: map[string]chan string{ + "key": nil, + }, + want: `{"key"`, + wantErr: EM(nil).withPos(`{"key":`, "/key").withType(0, T[chan string]()), + }, { + name: jsontest.Name("Maps/String/Deterministic"), + opts: []Options{Deterministic(true)}, + in: map[string]int{"a": 0, "b": 1, "c": 2}, + want: `{"a":0,"b":1,"c":2}`, + }, { + name: jsontest.Name("Maps/String/Deterministic+AllowInvalidUTF8+RejectDuplicateNames"), + opts: []Options{ + Deterministic(true), + jsontext.AllowInvalidUTF8(true), + jsontext.AllowDuplicateNames(false), + }, + in: map[string]int{"\xff": 0, "\xfe": 1}, + want: `{"�":1`, + wantErr: newDuplicateNameError("", []byte(`"�"`), len64(`{"�":1,`)), + }, { + name: jsontest.Name("Maps/String/Deterministic+AllowInvalidUTF8+AllowDuplicateNames"), + opts: []Options{ + Deterministic(true), + jsontext.AllowInvalidUTF8(true), + jsontext.AllowDuplicateNames(true), + }, + in: map[string]int{"\xff": 0, "\xfe": 1}, + want: `{"�":1,"�":0}`, + }, { + name: jsontest.Name("Maps/String/Deterministic+MarshalFuncs"), + opts: []Options{ + Deterministic(true), + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v string) error { + if p := enc.StackPointer(); p != "/X" { + return fmt.Errorf("invalid stack pointer: got %s, want /X", p) + } + switch v { + case "a": + return enc.WriteToken(jsontext.String("b")) + case "b": + return enc.WriteToken(jsontext.String("a")) + default: + return fmt.Errorf("invalid value: %q", v) + } + })), + }, + in: map[namedString]map[string]int{"X": {"a": -1, "b": 1}}, + want: `{"X":{"a":1,"b":-1}}`, + }, { + name: jsontest.Name("Maps/String/Deterministic+MarshalFuncs+RejectDuplicateNames"), + opts: []Options{ + Deterministic(true), + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v string) error { + if p := enc.StackPointer(); p != "/X" { + return fmt.Errorf("invalid stack pointer: got %s, want /X", p) + } + switch v { + case "a", "b": + return enc.WriteToken(jsontext.String("x")) + default: + return fmt.Errorf("invalid value: %q", v) + } + })), + jsontext.AllowDuplicateNames(false), + }, + in: map[namedString]map[string]int{"X": {"a": 1, "b": 1}}, + want: `{"X":{"x":1`, + wantErr: newDuplicateNameError("/X/x", nil, len64(`{"X":{"x":1,`)), + }, { + name: jsontest.Name("Maps/String/Deterministic+MarshalFuncs+AllowDuplicateNames"), + opts: []Options{ + Deterministic(true), + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v string) error { + if p := enc.StackPointer(); p != "/X" { + return fmt.Errorf("invalid stack pointer: got %s, want /0", p) + } + switch v { + case "a", "b": + return enc.WriteToken(jsontext.String("x")) + default: + return fmt.Errorf("invalid value: %q", v) + } + })), + jsontext.AllowDuplicateNames(true), + }, + in: map[namedString]map[string]int{"X": {"a": 1, "b": 1}}, + // NOTE: Since the names are identical, the exact values may be + // non-deterministic since sort cannot distinguish between members. + want: `{"X":{"x":1,"x":1}}`, + }, { + name: jsontest.Name("Maps/RecursiveMap"), + in: recursiveMap{ + "fizz": { + "foo": {}, + "bar": nil, + }, + "buzz": nil, + }, + canonicalize: true, + want: `{"buzz":{},"fizz":{"bar":{},"foo":{}}}`, + }, { + name: jsontest.Name("Maps/CyclicMap"), + in: func() recursiveMap { + m := recursiveMap{"k": nil} + m["k"] = m + return m + }(), + want: strings.Repeat(`{"k":`, startDetectingCyclesAfter) + `{"k"`, + wantErr: EM(internal.ErrCycle).withPos(strings.Repeat(`{"k":`, startDetectingCyclesAfter+1), jsontext.Pointer(strings.Repeat("/k", startDetectingCyclesAfter+1))).withType(0, T[recursiveMap]()), + }, { + name: jsontest.Name("Maps/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + in: map[string]string{}, + want: `{}`, + }, { + name: jsontest.Name("Structs/Empty"), + in: structEmpty{}, + want: `{}`, + }, { + name: jsontest.Name("Structs/UnexportedIgnored"), + in: structUnexportedIgnored{ignored: "ignored"}, + want: `{}`, + }, { + name: jsontest.Name("Structs/IgnoredUnexportedEmbedded"), + in: structIgnoredUnexportedEmbedded{namedString: "ignored"}, + want: `{}`, + }, { + name: jsontest.Name("Structs/WeirdNames"), + in: structWeirdNames{Empty: "empty", Comma: "comma", Quote: "quote"}, + want: `{"":"empty",",":"comma","\"":"quote"}`, + }, { + name: jsontest.Name("Structs/EscapedNames"), + opts: []Options{jsontext.EscapeForHTML(true), jsontext.EscapeForJS(true)}, + in: struct { + S string "json:\"'abc<>&\u2028\u2029xyz'\"" + M any + I structInlineTextValue + }{ + S: "abc<>&\u2028\u2029xyz", + M: map[string]string{"abc<>&\u2028\u2029xyz": "abc<>&\u2028\u2029xyz"}, + I: structInlineTextValue{X: jsontext.Value(`{"abc<>&` + "\u2028\u2029" + `xyz":"abc<>&` + "\u2028\u2029" + `xyz"}`)}, + }, + want: `{"abc\u003c\u003e\u0026\u2028\u2029xyz":"abc\u003c\u003e\u0026\u2028\u2029xyz","M":{"abc\u003c\u003e\u0026\u2028\u2029xyz":"abc\u003c\u003e\u0026\u2028\u2029xyz"},"I":{"abc\u003c\u003e\u0026\u2028\u2029xyz":"abc\u003c\u003e\u0026\u2028\u2029xyz"}}`, + }, { + name: jsontest.Name("Structs/NoCase"), + in: structNoCase{AaA: "AaA", AAa: "AAa", Aaa: "Aaa", AAA: "AAA", AA_A: "AA_A"}, + want: `{"Aaa":"Aaa","AA_A":"AA_A","AaA":"AaA","AAa":"AAa","AAA":"AAA"}`, + }, { + name: jsontest.Name("Structs/NoCase/MatchCaseInsensitiveNames"), + opts: []Options{MatchCaseInsensitiveNames(true)}, + in: structNoCase{AaA: "AaA", AAa: "AAa", Aaa: "Aaa", AAA: "AAA", AA_A: "AA_A"}, + want: `{"Aaa":"Aaa","AA_A":"AA_A","AaA":"AaA","AAa":"AAa","AAA":"AAA"}`, + }, { + name: jsontest.Name("Structs/NoCase/MatchCaseInsensitiveNames+MatchCaseSensitiveDelimiter"), + opts: []Options{MatchCaseInsensitiveNames(true), jsonflags.MatchCaseSensitiveDelimiter | 1}, + in: structNoCase{AaA: "AaA", AAa: "AAa", Aaa: "Aaa", AAA: "AAA", AA_A: "AA_A"}, + want: `{"Aaa":"Aaa","AA_A":"AA_A","AaA":"AaA","AAa":"AAa","AAA":"AAA"}`, + }, { + name: jsontest.Name("Structs/Normal"), + opts: []Options{jsontext.Multiline(true)}, + in: structAll{ + Bool: true, + String: "hello", + Bytes: []byte{1, 2, 3}, + Int: -64, + Uint: +64, + Float: 3.14159, + Map: map[string]string{"key": "value"}, + StructScalars: structScalars{ + Bool: true, + String: "hello", + Bytes: []byte{1, 2, 3}, + Int: -64, + Uint: +64, + Float: 3.14159, + }, + StructMaps: structMaps{ + MapBool: map[string]bool{"": true}, + MapString: map[string]string{"": "hello"}, + MapBytes: map[string][]byte{"": {1, 2, 3}}, + MapInt: map[string]int64{"": -64}, + MapUint: map[string]uint64{"": +64}, + MapFloat: map[string]float64{"": 3.14159}, + }, + StructSlices: structSlices{ + SliceBool: []bool{true}, + SliceString: []string{"hello"}, + SliceBytes: [][]byte{{1, 2, 3}}, + SliceInt: []int64{-64}, + SliceUint: []uint64{+64}, + SliceFloat: []float64{3.14159}, + }, + Slice: []string{"fizz", "buzz"}, + Array: [1]string{"goodbye"}, + Pointer: new(structAll), + Interface: (*structAll)(nil), + }, + want: `{ + "Bool": true, + "String": "hello", + "Bytes": "AQID", + "Int": -64, + "Uint": 64, + "Float": 3.14159, + "Map": { + "key": "value" + }, + "StructScalars": { + "Bool": true, + "String": "hello", + "Bytes": "AQID", + "Int": -64, + "Uint": 64, + "Float": 3.14159 + }, + "StructMaps": { + "MapBool": { + "": true + }, + "MapString": { + "": "hello" + }, + "MapBytes": { + "": "AQID" + }, + "MapInt": { + "": -64 + }, + "MapUint": { + "": 64 + }, + "MapFloat": { + "": 3.14159 + } + }, + "StructSlices": { + "SliceBool": [ + true + ], + "SliceString": [ + "hello" + ], + "SliceBytes": [ + "AQID" + ], + "SliceInt": [ + -64 + ], + "SliceUint": [ + 64 + ], + "SliceFloat": [ + 3.14159 + ] + }, + "Slice": [ + "fizz", + "buzz" + ], + "Array": [ + "goodbye" + ], + "Pointer": { + "Bool": false, + "String": "", + "Bytes": "", + "Int": 0, + "Uint": 0, + "Float": 0, + "Map": {}, + "StructScalars": { + "Bool": false, + "String": "", + "Bytes": "", + "Int": 0, + "Uint": 0, + "Float": 0 + }, + "StructMaps": { + "MapBool": {}, + "MapString": {}, + "MapBytes": {}, + "MapInt": {}, + "MapUint": {}, + "MapFloat": {} + }, + "StructSlices": { + "SliceBool": [], + "SliceString": [], + "SliceBytes": [], + "SliceInt": [], + "SliceUint": [], + "SliceFloat": [] + }, + "Slice": [], + "Array": [ + "" + ], + "Pointer": null, + "Interface": null + }, + "Interface": null +}`, + }, { + name: jsontest.Name("Structs/SpaceAfterColonAndComma"), + opts: []Options{jsontext.SpaceAfterColon(true), jsontext.SpaceAfterComma(true)}, + in: structOmitZeroAll{Int: 1, Uint: 1}, + want: `{"Int": 1, "Uint": 1}`, + }, { + name: jsontest.Name("Structs/SpaceAfterColon"), + opts: []Options{jsontext.SpaceAfterColon(true)}, + in: structOmitZeroAll{Int: 1, Uint: 1}, + want: `{"Int": 1,"Uint": 1}`, + }, { + name: jsontest.Name("Structs/SpaceAfterComma"), + opts: []Options{jsontext.SpaceAfterComma(true)}, + in: structOmitZeroAll{Int: 1, Uint: 1, Slice: []string{"a", "b"}}, + want: `{"Int":1, "Uint":1, "Slice":["a", "b"]}`, + }, { + name: jsontest.Name("Structs/Stringified"), + opts: []Options{jsontext.Multiline(true)}, + in: structStringifiedAll{ + Bool: true, + String: "hello", + Bytes: []byte{1, 2, 3}, + Int: -64, // should be stringified + Uint: +64, // should be stringified + Float: 3.14159, // should be stringified + Map: map[string]string{"key": "value"}, + StructScalars: structScalars{ + Bool: true, + String: "hello", + Bytes: []byte{1, 2, 3}, + Int: -64, // should be stringified + Uint: +64, // should be stringified + Float: 3.14159, // should be stringified + }, + StructMaps: structMaps{ + MapBool: map[string]bool{"": true}, + MapString: map[string]string{"": "hello"}, + MapBytes: map[string][]byte{"": {1, 2, 3}}, + MapInt: map[string]int64{"": -64}, // should be stringified + MapUint: map[string]uint64{"": +64}, // should be stringified + MapFloat: map[string]float64{"": 3.14159}, // should be stringified + }, + StructSlices: structSlices{ + SliceBool: []bool{true}, + SliceString: []string{"hello"}, + SliceBytes: [][]byte{{1, 2, 3}}, + SliceInt: []int64{-64}, // should be stringified + SliceUint: []uint64{+64}, // should be stringified + SliceFloat: []float64{3.14159}, // should be stringified + }, + Slice: []string{"fizz", "buzz"}, + Array: [1]string{"goodbye"}, + Pointer: new(structStringifiedAll), // should be stringified + Interface: (*structStringifiedAll)(nil), + }, + want: `{ + "Bool": true, + "String": "hello", + "Bytes": "AQID", + "Int": "-64", + "Uint": "64", + "Float": "3.14159", + "Map": { + "key": "value" + }, + "StructScalars": { + "Bool": true, + "String": "hello", + "Bytes": "AQID", + "Int": "-64", + "Uint": "64", + "Float": "3.14159" + }, + "StructMaps": { + "MapBool": { + "": true + }, + "MapString": { + "": "hello" + }, + "MapBytes": { + "": "AQID" + }, + "MapInt": { + "": "-64" + }, + "MapUint": { + "": "64" + }, + "MapFloat": { + "": "3.14159" + } + }, + "StructSlices": { + "SliceBool": [ + true + ], + "SliceString": [ + "hello" + ], + "SliceBytes": [ + "AQID" + ], + "SliceInt": [ + "-64" + ], + "SliceUint": [ + "64" + ], + "SliceFloat": [ + "3.14159" + ] + }, + "Slice": [ + "fizz", + "buzz" + ], + "Array": [ + "goodbye" + ], + "Pointer": { + "Bool": false, + "String": "", + "Bytes": "", + "Int": "0", + "Uint": "0", + "Float": "0", + "Map": {}, + "StructScalars": { + "Bool": false, + "String": "", + "Bytes": "", + "Int": "0", + "Uint": "0", + "Float": "0" + }, + "StructMaps": { + "MapBool": {}, + "MapString": {}, + "MapBytes": {}, + "MapInt": {}, + "MapUint": {}, + "MapFloat": {} + }, + "StructSlices": { + "SliceBool": [], + "SliceString": [], + "SliceBytes": [], + "SliceInt": [], + "SliceUint": [], + "SliceFloat": [] + }, + "Slice": [], + "Array": [ + "" + ], + "Pointer": null, + "Interface": null + }, + "Interface": null +}`, + }, { + name: jsontest.Name("Structs/LegacyStringified"), + opts: []Options{jsontext.Multiline(true), jsonflags.StringifyWithLegacySemantics | 1}, + in: structStringifiedAll{ + Bool: true, // should be stringified + String: "hello", // should be stringified + Bytes: []byte{1, 2, 3}, + Int: -64, // should be stringified + Uint: +64, // should be stringified + Float: 3.14159, // should be stringified + Map: map[string]string{"key": "value"}, + StructScalars: structScalars{ + Bool: true, + String: "hello", + Bytes: []byte{1, 2, 3}, + Int: -64, + Uint: +64, + Float: 3.14159, + }, + StructMaps: structMaps{ + MapBool: map[string]bool{"": true}, + MapString: map[string]string{"": "hello"}, + MapBytes: map[string][]byte{"": {1, 2, 3}}, + MapInt: map[string]int64{"": -64}, + MapUint: map[string]uint64{"": +64}, + MapFloat: map[string]float64{"": 3.14159}, + }, + StructSlices: structSlices{ + SliceBool: []bool{true}, + SliceString: []string{"hello"}, + SliceBytes: [][]byte{{1, 2, 3}}, + SliceInt: []int64{-64}, + SliceUint: []uint64{+64}, + SliceFloat: []float64{3.14159}, + }, + Slice: []string{"fizz", "buzz"}, + Array: [1]string{"goodbye"}, + Pointer: new(structStringifiedAll), // should be stringified + Interface: (*structStringifiedAll)(nil), + }, + want: `{ + "Bool": "true", + "String": "\"hello\"", + "Bytes": "AQID", + "Int": "-64", + "Uint": "64", + "Float": "3.14159", + "Map": { + "key": "value" + }, + "StructScalars": { + "Bool": true, + "String": "hello", + "Bytes": "AQID", + "Int": -64, + "Uint": 64, + "Float": 3.14159 + }, + "StructMaps": { + "MapBool": { + "": true + }, + "MapString": { + "": "hello" + }, + "MapBytes": { + "": "AQID" + }, + "MapInt": { + "": -64 + }, + "MapUint": { + "": 64 + }, + "MapFloat": { + "": 3.14159 + } + }, + "StructSlices": { + "SliceBool": [ + true + ], + "SliceString": [ + "hello" + ], + "SliceBytes": [ + "AQID" + ], + "SliceInt": [ + -64 + ], + "SliceUint": [ + 64 + ], + "SliceFloat": [ + 3.14159 + ] + }, + "Slice": [ + "fizz", + "buzz" + ], + "Array": [ + "goodbye" + ], + "Pointer": { + "Bool": "false", + "String": "\"\"", + "Bytes": "", + "Int": "0", + "Uint": "0", + "Float": "0", + "Map": {}, + "StructScalars": { + "Bool": false, + "String": "", + "Bytes": "", + "Int": 0, + "Uint": 0, + "Float": 0 + }, + "StructMaps": { + "MapBool": {}, + "MapString": {}, + "MapBytes": {}, + "MapInt": {}, + "MapUint": {}, + "MapFloat": {} + }, + "StructSlices": { + "SliceBool": [], + "SliceString": [], + "SliceBytes": [], + "SliceInt": [], + "SliceUint": [], + "SliceFloat": [] + }, + "Slice": [], + "Array": [ + "" + ], + "Pointer": null, + "Interface": null + }, + "Interface": null +}`, + }, { + name: jsontest.Name("Structs/OmitZero/Zero"), + in: structOmitZeroAll{}, + want: `{}`, + }, { + name: jsontest.Name("Structs/OmitZeroOption/Zero"), + opts: []Options{OmitZeroStructFields(true)}, + in: structAll{}, + want: `{}`, + }, { + name: jsontest.Name("Structs/OmitZero/NonZero"), + opts: []Options{jsontext.Multiline(true)}, + in: structOmitZeroAll{ + Bool: true, // not omitted since true is non-zero + String: " ", // not omitted since non-empty string is non-zero + Bytes: []byte{}, // not omitted since allocated slice is non-zero + Int: 1, // not omitted since 1 is non-zero + Uint: 1, // not omitted since 1 is non-zero + Float: math.SmallestNonzeroFloat64, // not omitted since still slightly above zero + Map: map[string]string{}, // not omitted since allocated map is non-zero + StructScalars: structScalars{unexported: true}, // not omitted since unexported is non-zero + StructSlices: structSlices{Ignored: true}, // not omitted since Ignored is non-zero + StructMaps: structMaps{MapBool: map[string]bool{}}, // not omitted since MapBool is non-zero + Slice: []string{}, // not omitted since allocated slice is non-zero + Array: [1]string{" "}, // not omitted since single array element is non-zero + Pointer: new(structOmitZeroAll), // not omitted since pointer is non-zero (even if all fields of the struct value are zero) + Interface: (*structOmitZeroAll)(nil), // not omitted since interface value is non-zero (even if interface value is a nil pointer) + }, + want: `{ + "Bool": true, + "String": " ", + "Bytes": "", + "Int": 1, + "Uint": 1, + "Float": 5e-324, + "Map": {}, + "StructScalars": { + "Bool": false, + "String": "", + "Bytes": "", + "Int": 0, + "Uint": 0, + "Float": 0 + }, + "StructMaps": { + "MapBool": {}, + "MapString": {}, + "MapBytes": {}, + "MapInt": {}, + "MapUint": {}, + "MapFloat": {} + }, + "StructSlices": { + "SliceBool": [], + "SliceString": [], + "SliceBytes": [], + "SliceInt": [], + "SliceUint": [], + "SliceFloat": [] + }, + "Slice": [], + "Array": [ + " " + ], + "Pointer": {}, + "Interface": null +}`, + }, { + name: jsontest.Name("Structs/OmitZeroOption/NonZero"), + opts: []Options{OmitZeroStructFields(true), jsontext.Multiline(true)}, + in: structAll{ + Bool: true, + String: " ", + Bytes: []byte{}, + Int: 1, + Uint: 1, + Float: math.SmallestNonzeroFloat64, + Map: map[string]string{}, + StructScalars: structScalars{unexported: true}, + StructSlices: structSlices{Ignored: true}, + StructMaps: structMaps{MapBool: map[string]bool{}}, + Slice: []string{}, + Array: [1]string{" "}, + Pointer: new(structAll), + Interface: (*structAll)(nil), + }, + want: `{ + "Bool": true, + "String": " ", + "Bytes": "", + "Int": 1, + "Uint": 1, + "Float": 5e-324, + "Map": {}, + "StructScalars": {}, + "StructMaps": { + "MapBool": {} + }, + "StructSlices": {}, + "Slice": [], + "Array": [ + " " + ], + "Pointer": {}, + "Interface": null +}`, + }, { + name: jsontest.Name("Structs/OmitZeroMethod/Zero"), + in: structOmitZeroMethodAll{}, + want: `{"ValueNeverZero":"","PointerNeverZero":""}`, + }, { + name: jsontest.Name("Structs/OmitZeroMethod/NonZero"), + opts: []Options{jsontext.Multiline(true)}, + in: structOmitZeroMethodAll{ + ValueAlwaysZero: valueAlwaysZero("nonzero"), + ValueNeverZero: valueNeverZero("nonzero"), + PointerAlwaysZero: pointerAlwaysZero("nonzero"), + PointerNeverZero: pointerNeverZero("nonzero"), + PointerValueAlwaysZero: addr(valueAlwaysZero("nonzero")), + PointerValueNeverZero: addr(valueNeverZero("nonzero")), + PointerPointerAlwaysZero: addr(pointerAlwaysZero("nonzero")), + PointerPointerNeverZero: addr(pointerNeverZero("nonzero")), + PointerPointerValueAlwaysZero: addr(addr(valueAlwaysZero("nonzero"))), // marshaled since **valueAlwaysZero does not implement IsZero + PointerPointerValueNeverZero: addr(addr(valueNeverZero("nonzero"))), + PointerPointerPointerAlwaysZero: addr(addr(pointerAlwaysZero("nonzero"))), // marshaled since **pointerAlwaysZero does not implement IsZero + PointerPointerPointerNeverZero: addr(addr(pointerNeverZero("nonzero"))), + }, + want: `{ + "ValueNeverZero": "nonzero", + "PointerNeverZero": "nonzero", + "PointerValueNeverZero": "nonzero", + "PointerPointerNeverZero": "nonzero", + "PointerPointerValueAlwaysZero": "nonzero", + "PointerPointerValueNeverZero": "nonzero", + "PointerPointerPointerAlwaysZero": "nonzero", + "PointerPointerPointerNeverZero": "nonzero" +}`, + }, { + name: jsontest.Name("Structs/OmitZeroMethod/Interface/Zero"), + opts: []Options{jsontext.Multiline(true)}, + in: structOmitZeroMethodInterfaceAll{}, + want: `{}`, + }, { + name: jsontest.Name("Structs/OmitZeroMethod/Interface/PartialZero"), + opts: []Options{jsontext.Multiline(true)}, + in: structOmitZeroMethodInterfaceAll{ + ValueAlwaysZero: valueAlwaysZero(""), + ValueNeverZero: valueNeverZero(""), + PointerValueAlwaysZero: (*valueAlwaysZero)(nil), + PointerValueNeverZero: (*valueNeverZero)(nil), // nil pointer, so method not called + PointerPointerAlwaysZero: (*pointerAlwaysZero)(nil), + PointerPointerNeverZero: (*pointerNeverZero)(nil), // nil pointer, so method not called + }, + want: `{ + "ValueNeverZero": "" +}`, + }, { + name: jsontest.Name("Structs/OmitZeroMethod/Interface/NonZero"), + opts: []Options{jsontext.Multiline(true)}, + in: structOmitZeroMethodInterfaceAll{ + ValueAlwaysZero: valueAlwaysZero("nonzero"), + ValueNeverZero: valueNeverZero("nonzero"), + PointerValueAlwaysZero: addr(valueAlwaysZero("nonzero")), + PointerValueNeverZero: addr(valueNeverZero("nonzero")), + PointerPointerAlwaysZero: addr(pointerAlwaysZero("nonzero")), + PointerPointerNeverZero: addr(pointerNeverZero("nonzero")), + }, + want: `{ + "ValueNeverZero": "nonzero", + "PointerValueNeverZero": "nonzero", + "PointerPointerNeverZero": "nonzero" +}`, + }, { + name: jsontest.Name("Structs/OmitEmpty/Zero"), + opts: []Options{jsontext.Multiline(true)}, + in: structOmitEmptyAll{}, + want: `{ + "Bool": false, + "StringNonEmpty": "value", + "BytesNonEmpty": [ + "value" + ], + "Float": 0, + "MapNonEmpty": { + "key": "value" + }, + "SliceNonEmpty": [ + "value" + ] +}`, + }, { + name: jsontest.Name("Structs/OmitEmpty/EmptyNonZero"), + opts: []Options{jsontext.Multiline(true)}, + in: structOmitEmptyAll{ + String: string(""), + StringEmpty: stringMarshalEmpty(""), + StringNonEmpty: stringMarshalNonEmpty(""), + PointerString: addr(string("")), + PointerStringEmpty: addr(stringMarshalEmpty("")), + PointerStringNonEmpty: addr(stringMarshalNonEmpty("")), + Bytes: []byte(""), + BytesEmpty: bytesMarshalEmpty([]byte("")), + BytesNonEmpty: bytesMarshalNonEmpty([]byte("")), + PointerBytes: addr([]byte("")), + PointerBytesEmpty: addr(bytesMarshalEmpty([]byte(""))), + PointerBytesNonEmpty: addr(bytesMarshalNonEmpty([]byte(""))), + Map: map[string]string{}, + MapEmpty: mapMarshalEmpty{}, + MapNonEmpty: mapMarshalNonEmpty{}, + PointerMap: addr(map[string]string{}), + PointerMapEmpty: addr(mapMarshalEmpty{}), + PointerMapNonEmpty: addr(mapMarshalNonEmpty{}), + Slice: []string{}, + SliceEmpty: sliceMarshalEmpty{}, + SliceNonEmpty: sliceMarshalNonEmpty{}, + PointerSlice: addr([]string{}), + PointerSliceEmpty: addr(sliceMarshalEmpty{}), + PointerSliceNonEmpty: addr(sliceMarshalNonEmpty{}), + Pointer: &structOmitZeroEmptyAll{}, + Interface: []string{}, + }, + want: `{ + "Bool": false, + "StringNonEmpty": "value", + "PointerStringNonEmpty": "value", + "BytesNonEmpty": [ + "value" + ], + "PointerBytesNonEmpty": [ + "value" + ], + "Float": 0, + "MapNonEmpty": { + "key": "value" + }, + "PointerMapNonEmpty": { + "key": "value" + }, + "SliceNonEmpty": [ + "value" + ], + "PointerSliceNonEmpty": [ + "value" + ] +}`, + }, { + name: jsontest.Name("Structs/OmitEmpty/NonEmpty"), + opts: []Options{jsontext.Multiline(true)}, + in: structOmitEmptyAll{ + Bool: true, + PointerBool: addr(true), + String: string("value"), + StringEmpty: stringMarshalEmpty("value"), + StringNonEmpty: stringMarshalNonEmpty("value"), + PointerString: addr(string("value")), + PointerStringEmpty: addr(stringMarshalEmpty("value")), + PointerStringNonEmpty: addr(stringMarshalNonEmpty("value")), + Bytes: []byte("value"), + BytesEmpty: bytesMarshalEmpty([]byte("value")), + BytesNonEmpty: bytesMarshalNonEmpty([]byte("value")), + PointerBytes: addr([]byte("value")), + PointerBytesEmpty: addr(bytesMarshalEmpty([]byte("value"))), + PointerBytesNonEmpty: addr(bytesMarshalNonEmpty([]byte("value"))), + Float: math.Copysign(0, -1), + PointerFloat: addr(math.Copysign(0, -1)), + Map: map[string]string{"": ""}, + MapEmpty: mapMarshalEmpty{"key": "value"}, + MapNonEmpty: mapMarshalNonEmpty{"key": "value"}, + PointerMap: addr(map[string]string{"": ""}), + PointerMapEmpty: addr(mapMarshalEmpty{"key": "value"}), + PointerMapNonEmpty: addr(mapMarshalNonEmpty{"key": "value"}), + Slice: []string{""}, + SliceEmpty: sliceMarshalEmpty{"value"}, + SliceNonEmpty: sliceMarshalNonEmpty{"value"}, + PointerSlice: addr([]string{""}), + PointerSliceEmpty: addr(sliceMarshalEmpty{"value"}), + PointerSliceNonEmpty: addr(sliceMarshalNonEmpty{"value"}), + Pointer: &structOmitZeroEmptyAll{Float: math.SmallestNonzeroFloat64}, + Interface: []string{""}, + }, + want: `{ + "Bool": true, + "PointerBool": true, + "String": "value", + "StringNonEmpty": "value", + "PointerString": "value", + "PointerStringNonEmpty": "value", + "Bytes": "dmFsdWU=", + "BytesNonEmpty": [ + "value" + ], + "PointerBytes": "dmFsdWU=", + "PointerBytesNonEmpty": [ + "value" + ], + "Float": -0, + "PointerFloat": -0, + "Map": { + "": "" + }, + "MapNonEmpty": { + "key": "value" + }, + "PointerMap": { + "": "" + }, + "PointerMapNonEmpty": { + "key": "value" + }, + "Slice": [ + "" + ], + "SliceNonEmpty": [ + "value" + ], + "PointerSlice": [ + "" + ], + "PointerSliceNonEmpty": [ + "value" + ], + "Pointer": { + "Float": 5e-324 + }, + "Interface": [ + "" + ] +}`, + }, { + name: jsontest.Name("Structs/OmitEmpty/Legacy/Zero"), + opts: []Options{jsonflags.OmitEmptyWithLegacySemantics | 1}, + in: structOmitEmptyAll{}, + want: `{}`, + }, { + name: jsontest.Name("Structs/OmitEmpty/Legacy/NonEmpty"), + opts: []Options{jsontext.Multiline(true), jsonflags.OmitEmptyWithLegacySemantics | 1}, + in: structOmitEmptyAll{ + Bool: true, + PointerBool: addr(true), + String: string("value"), + StringEmpty: stringMarshalEmpty("value"), + StringNonEmpty: stringMarshalNonEmpty("value"), + PointerString: addr(string("value")), + PointerStringEmpty: addr(stringMarshalEmpty("value")), + PointerStringNonEmpty: addr(stringMarshalNonEmpty("value")), + Bytes: []byte("value"), + BytesEmpty: bytesMarshalEmpty([]byte("value")), + BytesNonEmpty: bytesMarshalNonEmpty([]byte("value")), + PointerBytes: addr([]byte("value")), + PointerBytesEmpty: addr(bytesMarshalEmpty([]byte("value"))), + PointerBytesNonEmpty: addr(bytesMarshalNonEmpty([]byte("value"))), + Float: math.Copysign(0, -1), + PointerFloat: addr(math.Copysign(0, -1)), + Map: map[string]string{"": ""}, + MapEmpty: mapMarshalEmpty{"key": "value"}, + MapNonEmpty: mapMarshalNonEmpty{"key": "value"}, + PointerMap: addr(map[string]string{"": ""}), + PointerMapEmpty: addr(mapMarshalEmpty{"key": "value"}), + PointerMapNonEmpty: addr(mapMarshalNonEmpty{"key": "value"}), + Slice: []string{""}, + SliceEmpty: sliceMarshalEmpty{"value"}, + SliceNonEmpty: sliceMarshalNonEmpty{"value"}, + PointerSlice: addr([]string{""}), + PointerSliceEmpty: addr(sliceMarshalEmpty{"value"}), + PointerSliceNonEmpty: addr(sliceMarshalNonEmpty{"value"}), + Pointer: &structOmitZeroEmptyAll{Float: math.Copysign(0, -1)}, + Interface: []string{""}, + }, + want: `{ + "Bool": true, + "PointerBool": true, + "String": "value", + "StringEmpty": "", + "StringNonEmpty": "value", + "PointerString": "value", + "PointerStringEmpty": "", + "PointerStringNonEmpty": "value", + "Bytes": "dmFsdWU=", + "BytesEmpty": [], + "BytesNonEmpty": [ + "value" + ], + "PointerBytes": "dmFsdWU=", + "PointerBytesEmpty": [], + "PointerBytesNonEmpty": [ + "value" + ], + "PointerFloat": -0, + "Map": { + "": "" + }, + "MapEmpty": {}, + "MapNonEmpty": { + "key": "value" + }, + "PointerMap": { + "": "" + }, + "PointerMapEmpty": {}, + "PointerMapNonEmpty": { + "key": "value" + }, + "Slice": [ + "" + ], + "SliceEmpty": [], + "SliceNonEmpty": [ + "value" + ], + "PointerSlice": [ + "" + ], + "PointerSliceEmpty": [], + "PointerSliceNonEmpty": [ + "value" + ], + "Pointer": {}, + "Interface": [ + "" + ] +}`, + }, { + name: jsontest.Name("Structs/OmitEmpty/NonEmptyString"), + in: struct { + X string `json:",omitempty"` + }{`"`}, + want: `{"X":"\""}`, + }, { + name: jsontest.Name("Structs/OmitZeroEmpty/Zero"), + in: structOmitZeroEmptyAll{}, + want: `{}`, + }, { + name: jsontest.Name("Structs/OmitZeroEmpty/Empty"), + in: structOmitZeroEmptyAll{ + Bytes: []byte{}, + Map: map[string]string{}, + Slice: []string{}, + Pointer: &structOmitZeroEmptyAll{}, + Interface: []string{}, + }, + want: `{}`, + }, { + name: jsontest.Name("Structs/OmitEmpty/PathologicalDepth"), + in: func() any { + type X struct { + X *X `json:",omitempty"` + } + var make func(int) *X + make = func(n int) *X { + if n == 0 { + return nil + } + return &X{make(n - 1)} + } + return make(100) + }(), + want: `{}`, + useWriter: true, + }, { + name: jsontest.Name("Structs/OmitEmpty/PathologicalBreadth"), + in: func() any { + var fields []reflect.StructField + for i := range 100 { + fields = append(fields, reflect.StructField{ + Name: fmt.Sprintf("X%d", i), + Type: T[stringMarshalEmpty](), + Tag: `json:",omitempty"`, + }) + } + return reflect.New(reflect.StructOf(fields)).Interface() + }(), + want: `{}`, + useWriter: true, + }, { + name: jsontest.Name("Structs/OmitEmpty/PathologicalTree"), + in: func() any { + type X struct { + XL, XR *X `json:",omitempty"` + } + var make func(int) *X + make = func(n int) *X { + if n == 0 { + return nil + } + return &X{make(n - 1), make(n - 1)} + } + return make(8) + }(), + want: `{}`, + useWriter: true, + }, { + name: jsontest.Name("Structs/OmitZeroEmpty/NonEmpty"), + in: structOmitZeroEmptyAll{ + Bytes: []byte("value"), + Map: map[string]string{"": ""}, + Slice: []string{""}, + Pointer: &structOmitZeroEmptyAll{Bool: true}, + Interface: []string{""}, + }, + want: `{"Bytes":"dmFsdWU=","Map":{"":""},"Slice":[""],"Pointer":{"Bool":true},"Interface":[""]}`, + }, { + name: jsontest.Name("Structs/Format/Bytes"), + opts: []Options{jsontext.Multiline(true)}, + in: structFormatBytes{ + Base16: []byte("\x01\x23\x45\x67\x89\xab\xcd\xef"), + Base32: []byte("\x00D2\x14\xc7BT\xb65τe:V\xd7\xc6u\xbew\xdf"), + Base32Hex: []byte("\x00D2\x14\xc7BT\xb65τe:V\xd7\xc6u\xbew\xdf"), + Base64: []byte("\x00\x10\x83\x10Q\x87 \x92\x8b0ӏA\x14\x93QU\x97a\x96\x9bqן\x82\x18\xa3\x92Y\xa7\xa2\x9a\xab\xb2ۯ\xc3\x1c\xb3\xd3]\xb7㞻\xf3߿"), + Base64URL: []byte("\x00\x10\x83\x10Q\x87 \x92\x8b0ӏA\x14\x93QU\x97a\x96\x9bqן\x82\x18\xa3\x92Y\xa7\xa2\x9a\xab\xb2ۯ\xc3\x1c\xb3\xd3]\xb7㞻\xf3߿"), + Array: []byte{1, 2, 3, 4}, + }, + want: `{ + "Base16": "0123456789abcdef", + "Base32": "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", + "Base32Hex": "0123456789ABCDEFGHIJKLMNOPQRSTUV", + "Base64": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", + "Base64URL": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", + "Array": [ + 1, + 2, + 3, + 4 + ] +}`}, { + name: jsontest.Name("Structs/Format/ArrayBytes"), + opts: []Options{jsontext.Multiline(true)}, + in: structFormatArrayBytes{ + Base16: [4]byte{1, 2, 3, 4}, + Base32: [4]byte{1, 2, 3, 4}, + Base32Hex: [4]byte{1, 2, 3, 4}, + Base64: [4]byte{1, 2, 3, 4}, + Base64URL: [4]byte{1, 2, 3, 4}, + Array: [4]byte{1, 2, 3, 4}, + Default: [4]byte{1, 2, 3, 4}, + }, + want: `{ + "Base16": "01020304", + "Base32": "AEBAGBA=", + "Base32Hex": "0410610=", + "Base64": "AQIDBA==", + "Base64URL": "AQIDBA==", + "Array": [ + 1, + 2, + 3, + 4 + ], + "Default": "AQIDBA==" +}`}, { + name: jsontest.Name("Structs/Format/ArrayBytes/Legacy"), + opts: []Options{jsontext.Multiline(true), jsonflags.FormatByteArrayAsArray | jsonflags.FormatBytesWithLegacySemantics | 1}, + in: structFormatArrayBytes{ + Base16: [4]byte{1, 2, 3, 4}, + Base32: [4]byte{1, 2, 3, 4}, + Base32Hex: [4]byte{1, 2, 3, 4}, + Base64: [4]byte{1, 2, 3, 4}, + Base64URL: [4]byte{1, 2, 3, 4}, + Array: [4]byte{1, 2, 3, 4}, + Default: [4]byte{1, 2, 3, 4}, + }, + want: `{ + "Base16": "01020304", + "Base32": "AEBAGBA=", + "Base32Hex": "0410610=", + "Base64": "AQIDBA==", + "Base64URL": "AQIDBA==", + "Array": [ + 1, + 2, + 3, + 4 + ], + "Default": [ + 1, + 2, + 3, + 4 + ] +}`}, { + name: jsontest.Name("Structs/Format/Bytes/Array"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(in byte) ([]byte, error) { + if in > 3 { + return []byte("true"), nil + } else { + return []byte("false"), nil + } + })), + }, + in: struct { + Array []byte `json:",format:array"` + }{ + Array: []byte{1, 6, 2, 5, 3, 4}, + }, + want: `{"Array":[false,true,false,true,false,true]}`, + }, { + name: jsontest.Name("Structs/Format/Floats"), + opts: []Options{jsontext.Multiline(true)}, + in: []structFormatFloats{ + {NonFinite: math.Pi, PointerNonFinite: addr(math.Pi)}, + {NonFinite: math.NaN(), PointerNonFinite: addr(math.NaN())}, + {NonFinite: math.Inf(-1), PointerNonFinite: addr(math.Inf(-1))}, + {NonFinite: math.Inf(+1), PointerNonFinite: addr(math.Inf(+1))}, + }, + want: `[ + { + "NonFinite": 3.141592653589793, + "PointerNonFinite": 3.141592653589793 + }, + { + "NonFinite": "NaN", + "PointerNonFinite": "NaN" + }, + { + "NonFinite": "-Infinity", + "PointerNonFinite": "-Infinity" + }, + { + "NonFinite": "Infinity", + "PointerNonFinite": "Infinity" + } +]`, + }, { + name: jsontest.Name("Structs/Format/Maps"), + opts: []Options{jsontext.Multiline(true)}, + in: []structFormatMaps{{ + EmitNull: map[string]string(nil), PointerEmitNull: addr(map[string]string(nil)), + EmitEmpty: map[string]string(nil), PointerEmitEmpty: addr(map[string]string(nil)), + EmitDefault: map[string]string(nil), PointerEmitDefault: addr(map[string]string(nil)), + }, { + EmitNull: map[string]string{}, PointerEmitNull: addr(map[string]string{}), + EmitEmpty: map[string]string{}, PointerEmitEmpty: addr(map[string]string{}), + EmitDefault: map[string]string{}, PointerEmitDefault: addr(map[string]string{}), + }, { + EmitNull: map[string]string{"k": "v"}, PointerEmitNull: addr(map[string]string{"k": "v"}), + EmitEmpty: map[string]string{"k": "v"}, PointerEmitEmpty: addr(map[string]string{"k": "v"}), + EmitDefault: map[string]string{"k": "v"}, PointerEmitDefault: addr(map[string]string{"k": "v"}), + }}, + want: `[ + { + "EmitNull": null, + "PointerEmitNull": null, + "EmitEmpty": {}, + "PointerEmitEmpty": {}, + "EmitDefault": {}, + "PointerEmitDefault": {} + }, + { + "EmitNull": {}, + "PointerEmitNull": {}, + "EmitEmpty": {}, + "PointerEmitEmpty": {}, + "EmitDefault": {}, + "PointerEmitDefault": {} + }, + { + "EmitNull": { + "k": "v" + }, + "PointerEmitNull": { + "k": "v" + }, + "EmitEmpty": { + "k": "v" + }, + "PointerEmitEmpty": { + "k": "v" + }, + "EmitDefault": { + "k": "v" + }, + "PointerEmitDefault": { + "k": "v" + } + } +]`, + }, { + name: jsontest.Name("Structs/Format/Maps/FormatNilMapAsNull"), + opts: []Options{ + FormatNilMapAsNull(true), + jsontext.Multiline(true), + }, + in: []structFormatMaps{{ + EmitNull: map[string]string(nil), PointerEmitNull: addr(map[string]string(nil)), + EmitEmpty: map[string]string(nil), PointerEmitEmpty: addr(map[string]string(nil)), + EmitDefault: map[string]string(nil), PointerEmitDefault: addr(map[string]string(nil)), + }, { + EmitNull: map[string]string{}, PointerEmitNull: addr(map[string]string{}), + EmitEmpty: map[string]string{}, PointerEmitEmpty: addr(map[string]string{}), + EmitDefault: map[string]string{}, PointerEmitDefault: addr(map[string]string{}), + }, { + EmitNull: map[string]string{"k": "v"}, PointerEmitNull: addr(map[string]string{"k": "v"}), + EmitEmpty: map[string]string{"k": "v"}, PointerEmitEmpty: addr(map[string]string{"k": "v"}), + EmitDefault: map[string]string{"k": "v"}, PointerEmitDefault: addr(map[string]string{"k": "v"}), + }}, + want: `[ + { + "EmitNull": null, + "PointerEmitNull": null, + "EmitEmpty": {}, + "PointerEmitEmpty": {}, + "EmitDefault": null, + "PointerEmitDefault": null + }, + { + "EmitNull": {}, + "PointerEmitNull": {}, + "EmitEmpty": {}, + "PointerEmitEmpty": {}, + "EmitDefault": {}, + "PointerEmitDefault": {} + }, + { + "EmitNull": { + "k": "v" + }, + "PointerEmitNull": { + "k": "v" + }, + "EmitEmpty": { + "k": "v" + }, + "PointerEmitEmpty": { + "k": "v" + }, + "EmitDefault": { + "k": "v" + }, + "PointerEmitDefault": { + "k": "v" + } + } +]`, + }, { + name: jsontest.Name("Structs/Format/Slices"), + opts: []Options{jsontext.Multiline(true)}, + in: []structFormatSlices{{ + EmitNull: []string(nil), PointerEmitNull: addr([]string(nil)), + EmitEmpty: []string(nil), PointerEmitEmpty: addr([]string(nil)), + EmitDefault: []string(nil), PointerEmitDefault: addr([]string(nil)), + }, { + EmitNull: []string{}, PointerEmitNull: addr([]string{}), + EmitEmpty: []string{}, PointerEmitEmpty: addr([]string{}), + EmitDefault: []string{}, PointerEmitDefault: addr([]string{}), + }, { + EmitNull: []string{"v"}, PointerEmitNull: addr([]string{"v"}), + EmitEmpty: []string{"v"}, PointerEmitEmpty: addr([]string{"v"}), + EmitDefault: []string{"v"}, PointerEmitDefault: addr([]string{"v"}), + }}, + want: `[ + { + "EmitNull": null, + "PointerEmitNull": null, + "EmitEmpty": [], + "PointerEmitEmpty": [], + "EmitDefault": [], + "PointerEmitDefault": [] + }, + { + "EmitNull": [], + "PointerEmitNull": [], + "EmitEmpty": [], + "PointerEmitEmpty": [], + "EmitDefault": [], + "PointerEmitDefault": [] + }, + { + "EmitNull": [ + "v" + ], + "PointerEmitNull": [ + "v" + ], + "EmitEmpty": [ + "v" + ], + "PointerEmitEmpty": [ + "v" + ], + "EmitDefault": [ + "v" + ], + "PointerEmitDefault": [ + "v" + ] + } +]`, + }, { + name: jsontest.Name("Structs/Format/Invalid/Bool"), + in: structFormatInvalid{Bool: true}, + want: `{"Bool"`, + wantErr: EM(errInvalidFormatFlag).withPos(`{"Bool":`, "/Bool").withType(0, boolType), + }, { + name: jsontest.Name("Structs/Format/Invalid/String"), + in: structFormatInvalid{String: "string"}, + want: `{"String"`, + wantErr: EM(errInvalidFormatFlag).withPos(`{"String":`, "/String").withType(0, stringType), + }, { + name: jsontest.Name("Structs/Format/Invalid/Bytes"), + in: structFormatInvalid{Bytes: []byte("bytes")}, + want: `{"Bytes"`, + wantErr: EM(errInvalidFormatFlag).withPos(`{"Bytes":`, "/Bytes").withType(0, bytesType), + }, { + name: jsontest.Name("Structs/Format/Invalid/Int"), + in: structFormatInvalid{Int: 1}, + want: `{"Int"`, + wantErr: EM(errInvalidFormatFlag).withPos(`{"Int":`, "/Int").withType(0, T[int64]()), + }, { + name: jsontest.Name("Structs/Format/Invalid/Uint"), + in: structFormatInvalid{Uint: 1}, + want: `{"Uint"`, + wantErr: EM(errInvalidFormatFlag).withPos(`{"Uint":`, "/Uint").withType(0, T[uint64]()), + }, { + name: jsontest.Name("Structs/Format/Invalid/Float"), + in: structFormatInvalid{Float: 1}, + want: `{"Float"`, + wantErr: EM(errInvalidFormatFlag).withPos(`{"Float":`, "/Float").withType(0, T[float64]()), + }, { + name: jsontest.Name("Structs/Format/Invalid/Map"), + in: structFormatInvalid{Map: map[string]string{}}, + want: `{"Map"`, + wantErr: EM(errInvalidFormatFlag).withPos(`{"Map":`, "/Map").withType(0, T[map[string]string]()), + }, { + name: jsontest.Name("Structs/Format/Invalid/Struct"), + in: structFormatInvalid{Struct: structAll{Bool: true}}, + want: `{"Struct"`, + wantErr: EM(errInvalidFormatFlag).withPos(`{"Struct":`, "/Struct").withType(0, T[structAll]()), + }, { + name: jsontest.Name("Structs/Format/Invalid/Slice"), + in: structFormatInvalid{Slice: []string{}}, + want: `{"Slice"`, + wantErr: EM(errInvalidFormatFlag).withPos(`{"Slice":`, "/Slice").withType(0, T[[]string]()), + }, { + name: jsontest.Name("Structs/Format/Invalid/Array"), + in: structFormatInvalid{Array: [1]string{"string"}}, + want: `{"Array"`, + wantErr: EM(errInvalidFormatFlag).withPos(`{"Array":`, "/Array").withType(0, T[[1]string]()), + }, { + name: jsontest.Name("Structs/Format/Invalid/Interface"), + in: structFormatInvalid{Interface: "anything"}, + want: `{"Interface"`, + wantErr: EM(errInvalidFormatFlag).withPos(`{"Interface":`, "/Interface").withType(0, T[any]()), + }, { + name: jsontest.Name("Structs/Inline/Zero"), + in: structInlined{}, + want: `{"D":""}`, + }, { + name: jsontest.Name("Structs/Inline/Alloc"), + in: structInlined{ + X: structInlinedL1{ + X: &structInlinedL2{}, + StructEmbed1: StructEmbed1{}, + }, + StructEmbed2: &StructEmbed2{}, + }, + want: `{"A":"","B":"","D":"","E":"","F":"","G":""}`, + }, { + name: jsontest.Name("Structs/Inline/NonZero"), + in: structInlined{ + X: structInlinedL1{ + X: &structInlinedL2{A: "A1", B: "B1", C: "C1"}, + StructEmbed1: StructEmbed1{C: "C2", D: "D2", E: "E2"}, + }, + StructEmbed2: &StructEmbed2{E: "E3", F: "F3", G: "G3"}, + }, + want: `{"A":"A1","B":"B1","D":"D2","E":"E3","F":"F3","G":"G3"}`, + }, { + name: jsontest.Name("Structs/Inline/DualCycle"), + in: cyclicA{ + B1: cyclicB{F: 1}, // B1.F ignored since it conflicts with B2.F + B2: cyclicB{F: 2}, // B2.F ignored since it conflicts with B1.F + }, + want: `{}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/Nil"), + in: structInlineTextValue{X: jsontext.Value(nil)}, + want: `{}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/Empty"), + in: structInlineTextValue{X: jsontext.Value("")}, + want: `{}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/NonEmptyN1"), + in: structInlineTextValue{X: jsontext.Value(` { "fizz" : "buzz" } `)}, + want: `{"fizz":"buzz"}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/NonEmptyN2"), + in: structInlineTextValue{X: jsontext.Value(` { "fizz" : "buzz" , "foo" : "bar" } `)}, + want: `{"fizz":"buzz","foo":"bar"}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/NonEmptyWithOthers"), + in: structInlineTextValue{ + A: 1, + X: jsontext.Value(` { "fizz" : "buzz" , "foo" : "bar" } `), + B: 2, + }, + // NOTE: Inlined fallback fields are always serialized last. + want: `{"A":1,"B":2,"fizz":"buzz","foo":"bar"}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/RejectDuplicateNames"), + opts: []Options{jsontext.AllowDuplicateNames(false)}, + in: structInlineTextValue{X: jsontext.Value(` { "fizz" : "buzz" , "fizz" : "buzz" } `)}, + want: `{"fizz":"buzz"`, + wantErr: newDuplicateNameError("/fizz", nil, len64(`{"fizz":"buzz"`)), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/AllowDuplicateNames"), + opts: []Options{jsontext.AllowDuplicateNames(true)}, + in: structInlineTextValue{X: jsontext.Value(` { "fizz" : "buzz" , "fizz" : "buzz" } `)}, + want: `{"fizz":"buzz","fizz":"buzz"}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/RejectInvalidUTF8"), + opts: []Options{jsontext.AllowInvalidUTF8(false)}, + in: structInlineTextValue{X: jsontext.Value(`{"` + "\xde\xad\xbe\xef" + `":"value"}`)}, + want: `{`, + wantErr: newInvalidUTF8Error(len64(`{"`+"\xde\xad"), ""), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/AllowInvalidUTF8"), + opts: []Options{jsontext.AllowInvalidUTF8(true)}, + in: structInlineTextValue{X: jsontext.Value(`{"` + "\xde\xad\xbe\xef" + `":"value"}`)}, + want: `{"ޭ��":"value"}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/InvalidWhitespace"), + in: structInlineTextValue{X: jsontext.Value("\n\r\t ")}, + want: `{`, + wantErr: EM(io.ErrUnexpectedEOF).withPos(`{`, "").withType(0, T[jsontext.Value]()), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/InvalidObject"), + in: structInlineTextValue{X: jsontext.Value(` true `)}, + want: `{`, + wantErr: EM(errRawInlinedNotObject).withPos(`{`, "").withType(0, T[jsontext.Value]()), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/InvalidObjectName"), + in: structInlineTextValue{X: jsontext.Value(` { true : false } `)}, + want: `{`, + wantErr: EM(newNonStringNameError(len64(" { "), "")).withPos(`{`, "").withType(0, T[jsontext.Value]()), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/InvalidEndObject"), + in: structInlineTextValue{X: jsontext.Value(` { "name" : false , } `)}, + want: `{"name":false`, + wantErr: EM(newInvalidCharacterError(",", "at start of value", len64(` { "name" : false `), "")).withPos(`{"name":false,`, "").withType(0, T[jsontext.Value]()), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/InvalidDualObject"), + in: structInlineTextValue{X: jsontext.Value(`{}{}`)}, + want: `{`, + wantErr: EM(newInvalidCharacterError("{", "after top-level value", len64(`{}`), "")).withPos(`{`, "").withType(0, T[jsontext.Value]()), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/Nested/Nil"), + in: structInlinePointerInlineTextValue{}, + want: `{}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/PointerTextValue/Nil"), + in: structInlinePointerTextValue{}, + want: `{}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/PointerTextValue/NonEmpty"), + in: structInlinePointerTextValue{X: addr(jsontext.Value(` { "fizz" : "buzz" } `))}, + want: `{"fizz":"buzz"}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/PointerTextValue/Nested/Nil"), + in: structInlineInlinePointerTextValue{}, + want: `{}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/Nil"), + in: structInlineMapStringAny{X: nil}, + want: `{}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/Empty"), + in: structInlineMapStringAny{X: make(jsonObject)}, + want: `{}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/NonEmptyN1"), + in: structInlineMapStringAny{X: jsonObject{"fizz": nil}}, + want: `{"fizz":null}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/NonEmptyN2"), + in: structInlineMapStringAny{X: jsonObject{"fizz": time.Time{}, "buzz": math.Pi}}, + want: `{"buzz":3.141592653589793,"fizz":"0001-01-01T00:00:00Z"}`, + canonicalize: true, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/NonEmptyWithOthers"), + in: structInlineMapStringAny{ + A: 1, + X: jsonObject{"fizz": nil}, + B: 2, + }, + // NOTE: Inlined fallback fields are always serialized last. + want: `{"A":1,"B":2,"fizz":null}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/RejectInvalidUTF8"), + opts: []Options{jsontext.AllowInvalidUTF8(false)}, + in: structInlineMapStringAny{X: jsonObject{"\xde\xad\xbe\xef": nil}}, + want: `{`, + wantErr: EM(jsonwire.ErrInvalidUTF8).withPos(`{`, "").withType(0, stringType), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/AllowInvalidUTF8"), + opts: []Options{jsontext.AllowInvalidUTF8(true)}, + in: structInlineMapStringAny{X: jsonObject{"\xde\xad\xbe\xef": nil}}, + want: `{"ޭ��":null}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/InvalidValue"), + opts: []Options{jsontext.AllowInvalidUTF8(true)}, + in: structInlineMapStringAny{X: jsonObject{"name": make(chan string)}}, + want: `{"name"`, + wantErr: EM(nil).withPos(`{"name":`, "/name").withType(0, T[chan string]()), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/Nested/Nil"), + in: structInlinePointerInlineMapStringAny{}, + want: `{}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/MarshalFunc"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(v float64) ([]byte, error) { + return []byte(fmt.Sprintf(`"%v"`, v)), nil + })), + }, + in: structInlineMapStringAny{X: jsonObject{"fizz": 3.14159}}, + want: `{"fizz":"3.14159"}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/PointerMapStringAny/Nil"), + in: structInlinePointerMapStringAny{X: nil}, + want: `{}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/PointerMapStringAny/NonEmpty"), + in: structInlinePointerMapStringAny{X: addr(jsonObject{"name": "value"})}, + want: `{"name":"value"}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/PointerMapStringAny/Nested/Nil"), + in: structInlineInlinePointerMapStringAny{}, + want: `{}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringInt"), + in: structInlineMapStringInt{ + X: map[string]int{"zero": 0, "one": 1, "two": 2}, + }, + want: `{"one":1,"two":2,"zero":0}`, + canonicalize: true, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringInt/Deterministic"), + opts: []Options{Deterministic(true)}, + in: structInlineMapStringInt{ + X: map[string]int{"zero": 0, "one": 1, "two": 2}, + }, + want: `{"one":1,"two":2,"zero":0}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringInt/Deterministic+AllowInvalidUTF8+RejectDuplicateNames"), + opts: []Options{Deterministic(true), jsontext.AllowInvalidUTF8(true), jsontext.AllowDuplicateNames(false)}, + in: structInlineMapStringInt{ + X: map[string]int{"\xff": 0, "\xfe": 1}, + }, + want: `{"�":1`, + wantErr: newDuplicateNameError("", []byte(`"�"`), len64(`{"�":1`)), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringInt/Deterministic+AllowInvalidUTF8+AllowDuplicateNames"), + opts: []Options{Deterministic(true), jsontext.AllowInvalidUTF8(true), jsontext.AllowDuplicateNames(true)}, + in: structInlineMapStringInt{ + X: map[string]int{"\xff": 0, "\xfe": 1}, + }, + want: `{"�":1,"�":0}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringInt/StringifiedNumbers"), + opts: []Options{StringifyNumbers(true)}, + in: structInlineMapStringInt{ + X: map[string]int{"zero": 0, "one": 1, "two": 2}, + }, + want: `{"one":"1","two":"2","zero":"0"}`, + canonicalize: true, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringInt/MarshalFunc"), + opts: []Options{ + WithMarshalers(JoinMarshalers( + // Marshalers do not affect the string key of inlined maps. + MarshalFunc(func(v string) ([]byte, error) { + return []byte(fmt.Sprintf(`"%q"`, strings.ToUpper(v))), nil + }), + MarshalFunc(func(v int) ([]byte, error) { + return []byte(fmt.Sprintf(`"%v"`, v)), nil + }), + )), + }, + in: structInlineMapStringInt{ + X: map[string]int{"zero": 0, "one": 1, "two": 2}, + }, + want: `{"one":"1","two":"2","zero":"0"}`, + canonicalize: true, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringInt"), + in: structInlineMapNamedStringInt{ + X: map[namedString]int{"zero": 0, "one": 1, "two": 2}, + }, + want: `{"one":1,"two":2,"zero":0}`, + canonicalize: true, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringInt/Deterministic"), + opts: []Options{Deterministic(true)}, + in: structInlineMapNamedStringInt{ + X: map[namedString]int{"zero": 0, "one": 1, "two": 2}, + }, + want: `{"one":1,"two":2,"zero":0}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringAny/Nil"), + in: structInlineMapNamedStringAny{X: nil}, + want: `{}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringAny/Empty"), + in: structInlineMapNamedStringAny{X: make(map[namedString]any)}, + want: `{}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringAny/NonEmptyN1"), + in: structInlineMapNamedStringAny{X: map[namedString]any{"fizz": nil}}, + want: `{"fizz":null}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringAny/NonEmptyN2"), + in: structInlineMapNamedStringAny{X: map[namedString]any{"fizz": time.Time{}, "buzz": math.Pi}}, + want: `{"buzz":3.141592653589793,"fizz":"0001-01-01T00:00:00Z"}`, + canonicalize: true, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringAny/NonEmptyWithOthers"), + in: structInlineMapNamedStringAny{ + A: 1, + X: map[namedString]any{"fizz": nil}, + B: 2, + }, + // NOTE: Inlined fallback fields are always serialized last. + want: `{"A":1,"B":2,"fizz":null}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringAny/RejectInvalidUTF8"), + opts: []Options{jsontext.AllowInvalidUTF8(false)}, + in: structInlineMapNamedStringAny{X: map[namedString]any{"\xde\xad\xbe\xef": nil}}, + want: `{`, + wantErr: EM(jsonwire.ErrInvalidUTF8).withPos(`{`, "").withType(0, T[namedString]()), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringAny/AllowInvalidUTF8"), + opts: []Options{jsontext.AllowInvalidUTF8(true)}, + in: structInlineMapNamedStringAny{X: map[namedString]any{"\xde\xad\xbe\xef": nil}}, + want: `{"ޭ��":null}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringAny/InvalidValue"), + opts: []Options{jsontext.AllowInvalidUTF8(true)}, + in: structInlineMapNamedStringAny{X: map[namedString]any{"name": make(chan string)}}, + want: `{"name"`, + wantErr: EM(nil).withPos(`{"name":`, "/name").withType(0, T[chan string]()), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringAny/MarshalFunc"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(v float64) ([]byte, error) { + return []byte(fmt.Sprintf(`"%v"`, v)), nil + })), + }, + in: structInlineMapNamedStringAny{X: map[namedString]any{"fizz": 3.14159}}, + want: `{"fizz":"3.14159"}`, + }, { + name: jsontest.Name("Structs/InlinedFallback/DiscardUnknownMembers"), + opts: []Options{DiscardUnknownMembers(true)}, + in: structInlineTextValue{ + A: 1, + X: jsontext.Value(` { "fizz" : "buzz" } `), + B: 2, + }, + // NOTE: DiscardUnknownMembers has no effect since this is "inline". + want: `{"A":1,"B":2,"fizz":"buzz"}`, + }, { + name: jsontest.Name("Structs/UnknownFallback/DiscardUnknownMembers"), + opts: []Options{DiscardUnknownMembers(true)}, + in: structUnknownTextValue{ + A: 1, + X: jsontext.Value(` { "fizz" : "buzz" } `), + B: 2, + }, + want: `{"A":1,"B":2}`, + }, { + name: jsontest.Name("Structs/UnknownFallback"), + in: structUnknownTextValue{ + A: 1, + X: jsontext.Value(` { "fizz" : "buzz" } `), + B: 2, + }, + want: `{"A":1,"B":2,"fizz":"buzz"}`, + }, { + name: jsontest.Name("Structs/DuplicateName/NoCaseInlineTextValue/Other"), + in: structNoCaseInlineTextValue{ + X: jsontext.Value(`{"dupe":"","dupe":""}`), + }, + want: `{"dupe":""`, + wantErr: newDuplicateNameError("", []byte(`"dupe"`), len64(`{"dupe":""`)), + }, { + name: jsontest.Name("Structs/DuplicateName/NoCaseInlineTextValue/Other/AllowDuplicateNames"), + opts: []Options{jsontext.AllowDuplicateNames(true)}, + in: structNoCaseInlineTextValue{ + X: jsontext.Value(`{"dupe": "", "dupe": ""}`), + }, + want: `{"dupe":"","dupe":""}`, + }, { + name: jsontest.Name("Structs/DuplicateName/NoCaseInlineTextValue/ExactDifferent"), + in: structNoCaseInlineTextValue{ + X: jsontext.Value(`{"Aaa": "", "AaA": "", "AAa": "", "AAA": ""}`), + }, + want: `{"Aaa":"","AaA":"","AAa":"","AAA":""}`, + }, { + name: jsontest.Name("Structs/DuplicateName/NoCaseInlineTextValue/ExactConflict"), + in: structNoCaseInlineTextValue{ + X: jsontext.Value(`{"Aaa": "", "Aaa": ""}`), + }, + want: `{"Aaa":""`, + wantErr: newDuplicateNameError("", []byte(`"Aaa"`), len64(`{"Aaa":""`)), + }, { + name: jsontest.Name("Structs/DuplicateName/NoCaseInlineTextValue/ExactConflict/AllowDuplicateNames"), + opts: []Options{jsontext.AllowDuplicateNames(true)}, + in: structNoCaseInlineTextValue{ + X: jsontext.Value(`{"Aaa": "", "Aaa": ""}`), + }, + want: `{"Aaa":"","Aaa":""}`, + }, { + name: jsontest.Name("Structs/DuplicateName/NoCaseInlineTextValue/NoCaseConflict"), + in: structNoCaseInlineTextValue{ + X: jsontext.Value(`{"Aaa": "", "AaA": "", "aaa": ""}`), + }, + want: `{"Aaa":"","AaA":""`, + wantErr: newDuplicateNameError("", []byte(`"aaa"`), len64(`{"Aaa":"","AaA":""`)), + }, { + name: jsontest.Name("Structs/DuplicateName/NoCaseInlineTextValue/NoCaseConflict/AllowDuplicateNames"), + opts: []Options{jsontext.AllowDuplicateNames(true)}, + in: structNoCaseInlineTextValue{ + X: jsontext.Value(`{"Aaa": "", "AaA": "", "aaa": ""}`), + }, + want: `{"Aaa":"","AaA":"","aaa":""}`, + }, { + name: jsontest.Name("Structs/DuplicateName/NoCaseInlineTextValue/ExactDifferentWithField"), + in: structNoCaseInlineTextValue{ + AAA: "x", + AaA: "x", + X: jsontext.Value(`{"Aaa": ""}`), + }, + want: `{"AAA":"x","AaA":"x","Aaa":""}`, + }, { + name: jsontest.Name("Structs/DuplicateName/NoCaseInlineTextValue/ExactConflictWithField"), + in: structNoCaseInlineTextValue{ + AAA: "x", + AaA: "x", + X: jsontext.Value(`{"AAA": ""}`), + }, + want: `{"AAA":"x","AaA":"x"`, + wantErr: newDuplicateNameError("", []byte(`"AAA"`), len64(`{"AAA":"x","AaA":"x"`)), + }, { + name: jsontest.Name("Structs/DuplicateName/NoCaseInlineTextValue/NoCaseConflictWithField"), + in: structNoCaseInlineTextValue{ + AAA: "x", + AaA: "x", + X: jsontext.Value(`{"aaa": ""}`), + }, + want: `{"AAA":"x","AaA":"x"`, + wantErr: newDuplicateNameError("", []byte(`"aaa"`), len64(`{"AAA":"x","AaA":"x"`)), + }, { + name: jsontest.Name("Structs/DuplicateName/MatchCaseInsensitiveDelimiter"), + in: structNoCaseInlineTextValue{ + AaA: "x", + X: jsontext.Value(`{"aa_a": ""}`), + }, + want: `{"AaA":"x"`, + wantErr: newDuplicateNameError("", []byte(`"aa_a"`), len64(`{"AaA":"x"`)), + }, { + name: jsontest.Name("Structs/DuplicateName/MatchCaseSensitiveDelimiter"), + opts: []Options{jsonflags.MatchCaseSensitiveDelimiter | 1}, + in: structNoCaseInlineTextValue{ + AaA: "x", + X: jsontext.Value(`{"aa_a": ""}`), + }, + want: `{"AaA":"x","aa_a":""}`, + }, { + name: jsontest.Name("Structs/DuplicateName/MatchCaseInsensitiveNames+MatchCaseSensitiveDelimiter"), + opts: []Options{MatchCaseInsensitiveNames(true), jsonflags.MatchCaseSensitiveDelimiter | 1}, + in: structNoCaseInlineTextValue{ + AaA: "x", + X: jsontext.Value(`{"aa_a": ""}`), + }, + want: `{"AaA":"x","aa_a":""}`, + }, { + name: jsontest.Name("Structs/DuplicateName/MatchCaseInsensitiveNames+MatchCaseSensitiveDelimiter"), + opts: []Options{MatchCaseInsensitiveNames(true), jsonflags.MatchCaseSensitiveDelimiter | 1}, + in: structNoCaseInlineTextValue{ + AA_b: "x", + X: jsontext.Value(`{"aa_b": ""}`), + }, + want: `{"AA_b":"x"`, + wantErr: newDuplicateNameError("", []byte(`"aa_b"`), len64(`{"AA_b":"x"`)), + }, { + name: jsontest.Name("Structs/DuplicateName/NoCaseInlineMapStringAny/ExactDifferent"), + in: structNoCaseInlineMapStringAny{ + X: jsonObject{"Aaa": "", "AaA": "", "AAa": "", "AAA": ""}, + }, + want: `{"AAA":"","AAa":"","AaA":"","Aaa":""}`, + canonicalize: true, + }, { + name: jsontest.Name("Structs/DuplicateName/NoCaseInlineMapStringAny/ExactDifferentWithField"), + in: structNoCaseInlineMapStringAny{ + AAA: "x", + AaA: "x", + X: jsonObject{"Aaa": ""}, + }, + want: `{"AAA":"x","AaA":"x","Aaa":""}`, + }, { + name: jsontest.Name("Structs/DuplicateName/NoCaseInlineMapStringAny/ExactConflictWithField"), + in: structNoCaseInlineMapStringAny{ + AAA: "x", + AaA: "x", + X: jsonObject{"AAA": ""}, + }, + want: `{"AAA":"x","AaA":"x"`, + wantErr: newDuplicateNameError("", []byte(`"AAA"`), len64(`{"AAA":"x","AaA":"x"`)), + }, { + name: jsontest.Name("Structs/DuplicateName/NoCaseInlineMapStringAny/NoCaseConflictWithField"), + in: structNoCaseInlineMapStringAny{ + AAA: "x", + AaA: "x", + X: jsonObject{"aaa": ""}, + }, + want: `{"AAA":"x","AaA":"x"`, + wantErr: newDuplicateNameError("", []byte(`"aaa"`), len64(`{"AAA":"x","AaA":"x"`)), + }, { + name: jsontest.Name("Structs/Invalid/Conflicting"), + in: structConflicting{}, + want: ``, + wantErr: EM(errors.New("Go struct fields A and B conflict over JSON object name \"conflict\"")).withType(0, T[structConflicting]()), + }, { + name: jsontest.Name("Structs/Invalid/NoneExported"), + in: structNoneExported{}, + want: ``, + wantErr: EM(errNoExportedFields).withType(0, T[structNoneExported]()), + }, { + name: jsontest.Name("Structs/Invalid/MalformedTag"), + in: structMalformedTag{}, + want: ``, + wantErr: EM(errors.New("Go struct field Malformed has malformed `json` tag: invalid character '\"' at start of option (expecting Unicode letter or single quote)")).withType(0, T[structMalformedTag]()), + }, { + name: jsontest.Name("Structs/Invalid/UnexportedTag"), + in: structUnexportedTag{}, + want: ``, + wantErr: EM(errors.New("unexported Go struct field unexported cannot have non-ignored `json:\"name\"` tag")).withType(0, T[structUnexportedTag]()), + }, { + name: jsontest.Name("Structs/Invalid/ExportedEmbedded"), + in: structExportedEmbedded{"hello"}, + want: ``, + wantErr: EM(errors.New("embedded Go struct field NamedString of non-struct type must be explicitly given a JSON name")).withType(0, T[structExportedEmbedded]()), + }, { + name: jsontest.Name("Structs/Valid/ExportedEmbedded"), + opts: []Options{jsonflags.ReportErrorsWithLegacySemantics | 1}, + in: structExportedEmbedded{"hello"}, + want: `{"NamedString":"hello"}`, + }, { + name: jsontest.Name("Structs/Valid/ExportedEmbeddedTag"), + in: structExportedEmbeddedTag{"hello"}, + want: `{"name":"hello"}`, + }, { + name: jsontest.Name("Structs/Invalid/UnexportedEmbedded"), + in: structUnexportedEmbedded{}, + want: ``, + wantErr: EM(errors.New("embedded Go struct field namedString of non-struct type must be explicitly given a JSON name")).withType(0, T[structUnexportedEmbedded]()), + }, { + name: jsontest.Name("Structs/Valid/UnexportedEmbedded"), + opts: []Options{jsonflags.ReportErrorsWithLegacySemantics | 1}, + in: structUnexportedEmbedded{}, + want: `{}`, + }, { + name: jsontest.Name("Structs/Invalid/UnexportedEmbeddedTag"), + in: structUnexportedEmbeddedTag{}, + wantErr: EM(errors.New("Go struct field namedString is not exported")).withType(0, T[structUnexportedEmbeddedTag]()), + }, { + name: jsontest.Name("Structs/Valid/UnexportedEmbeddedTag"), + opts: []Options{jsonflags.ReportErrorsWithLegacySemantics | 1}, + in: structUnexportedEmbeddedTag{}, + want: `{}`, + }, { + name: jsontest.Name("Structs/Invalid/UnexportedEmbeddedMethodTag"), + opts: []Options{jsonflags.ReportErrorsWithLegacySemantics | 1}, + in: structUnexportedEmbeddedMethodTag{}, + want: `{}`, + }, { + name: jsontest.Name("Structs/UnexportedEmbeddedStruct/Zero"), + in: structUnexportedEmbeddedStruct{}, + want: `{"FizzBuzz":0,"Addr":""}`, + }, { + name: jsontest.Name("Structs/UnexportedEmbeddedStruct/NonZero"), + in: structUnexportedEmbeddedStruct{structOmitZeroAll{Bool: true}, 5, structNestedAddr{netip.AddrFrom4([4]byte{192, 168, 0, 1})}}, + want: `{"Bool":true,"FizzBuzz":5,"Addr":"192.168.0.1"}`, + }, { + name: jsontest.Name("Structs/UnexportedEmbeddedStructPointer/Nil"), + in: structUnexportedEmbeddedStructPointer{}, + want: `{"FizzBuzz":0}`, + }, { + name: jsontest.Name("Structs/UnexportedEmbeddedStructPointer/Zero"), + in: structUnexportedEmbeddedStructPointer{&structOmitZeroAll{}, 0, &structNestedAddr{}}, + want: `{"FizzBuzz":0,"Addr":""}`, + }, { + name: jsontest.Name("Structs/UnexportedEmbeddedStructPointer/NonZero"), + in: structUnexportedEmbeddedStructPointer{&structOmitZeroAll{Bool: true}, 5, &structNestedAddr{netip.AddrFrom4([4]byte{192, 168, 0, 1})}}, + want: `{"Bool":true,"FizzBuzz":5,"Addr":"192.168.0.1"}`, + }, { + name: jsontest.Name("Structs/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + in: struct{}{}, + want: `{}`, + }, { + name: jsontest.Name("Slices/Interface"), + in: []any{ + false, true, + "hello", []byte("world"), + int32(-32), namedInt64(-64), + uint32(+32), namedUint64(+64), + float32(32.32), namedFloat64(64.64), + }, + want: `[false,true,"hello","d29ybGQ=",-32,-64,32,64,32.32,64.64]`, + }, { + name: jsontest.Name("Slices/Invalid/Channel"), + in: [](chan string){nil}, + want: `[`, + wantErr: EM(nil).withPos(`[`, "/0").withType(0, T[chan string]()), + }, { + name: jsontest.Name("Slices/RecursiveSlice"), + in: recursiveSlice{ + nil, + {}, + {nil}, + {nil, {}}, + }, + want: `[[],[],[[]],[[],[]]]`, + }, { + name: jsontest.Name("Slices/CyclicSlice"), + in: func() recursiveSlice { + s := recursiveSlice{{}} + s[0] = s + return s + }(), + want: strings.Repeat(`[`, startDetectingCyclesAfter) + `[`, + wantErr: EM(internal.ErrCycle).withPos(strings.Repeat("[", startDetectingCyclesAfter+1), jsontext.Pointer(strings.Repeat("/0", startDetectingCyclesAfter+1))).withType(0, T[recursiveSlice]()), + }, { + name: jsontest.Name("Slices/NonCyclicSlice"), + in: func() []any { + v := []any{nil, nil} + v[1] = v[:1] + for i := 1000; i > 0; i-- { + v = []any{v} + } + return v + }(), + want: strings.Repeat(`[`, startDetectingCyclesAfter) + `[null,[null]]` + strings.Repeat(`]`, startDetectingCyclesAfter), + }, { + name: jsontest.Name("Slices/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + in: []string{"hello", "goodbye"}, + want: `["hello","goodbye"]`, + }, { + name: jsontest.Name("Arrays/Empty"), + in: [0]struct{}{}, + want: `[]`, + }, { + name: jsontest.Name("Arrays/Bool"), + in: [2]bool{false, true}, + want: `[false,true]`, + }, { + name: jsontest.Name("Arrays/String"), + in: [2]string{"hello", "goodbye"}, + want: `["hello","goodbye"]`, + }, { + name: jsontest.Name("Arrays/Bytes"), + in: [2][]byte{[]byte("hello"), []byte("goodbye")}, + want: `["aGVsbG8=","Z29vZGJ5ZQ=="]`, + }, { + name: jsontest.Name("Arrays/Int"), + in: [2]int64{math.MinInt64, math.MaxInt64}, + want: `[-9223372036854775808,9223372036854775807]`, + }, { + name: jsontest.Name("Arrays/Uint"), + in: [2]uint64{0, math.MaxUint64}, + want: `[0,18446744073709551615]`, + }, { + name: jsontest.Name("Arrays/Float"), + in: [2]float64{-math.MaxFloat64, +math.MaxFloat64}, + want: `[-1.7976931348623157e+308,1.7976931348623157e+308]`, + }, { + name: jsontest.Name("Arrays/Invalid/Channel"), + in: new([1]chan string), + want: `[`, + wantErr: EM(nil).withPos(`[`, "/0").withType(0, T[chan string]()), + }, { + name: jsontest.Name("Arrays/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + in: [2]string{"hello", "goodbye"}, + want: `["hello","goodbye"]`, + }, { + name: jsontest.Name("Pointers/NilL0"), + in: (*int)(nil), + want: `null`, + }, { + name: jsontest.Name("Pointers/NilL1"), + in: new(*int), + want: `null`, + }, { + name: jsontest.Name("Pointers/Bool"), + in: addr(addr(bool(true))), + want: `true`, + }, { + name: jsontest.Name("Pointers/String"), + in: addr(addr(string("string"))), + want: `"string"`, + }, { + name: jsontest.Name("Pointers/Bytes"), + in: addr(addr([]byte("bytes"))), + want: `"Ynl0ZXM="`, + }, { + name: jsontest.Name("Pointers/Int"), + in: addr(addr(int(-100))), + want: `-100`, + }, { + name: jsontest.Name("Pointers/Uint"), + in: addr(addr(uint(100))), + want: `100`, + }, { + name: jsontest.Name("Pointers/Float"), + in: addr(addr(float64(3.14159))), + want: `3.14159`, + }, { + name: jsontest.Name("Pointers/CyclicPointer"), + in: func() *recursivePointer { + p := new(recursivePointer) + p.P = p + return p + }(), + want: strings.Repeat(`{"P":`, startDetectingCyclesAfter) + `{"P"`, + wantErr: EM(internal.ErrCycle).withPos(strings.Repeat(`{"P":`, startDetectingCyclesAfter+1), jsontext.Pointer(strings.Repeat("/P", startDetectingCyclesAfter+1))).withType(0, T[*recursivePointer]()), + }, { + name: jsontest.Name("Pointers/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + in: addr(addr(bool(true))), + want: `true`, + }, { + name: jsontest.Name("Interfaces/Nil/Empty"), + in: [1]any{nil}, + want: `[null]`, + }, { + name: jsontest.Name("Interfaces/Nil/NonEmpty"), + in: [1]io.Reader{nil}, + want: `[null]`, + }, { + name: jsontest.Name("Interfaces/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + in: [1]io.Reader{nil}, + want: `[null]`, + }, { + name: jsontest.Name("Interfaces/Any"), + in: struct{ X any }{[]any{nil, false, "", 0.0, map[string]any{}, []any{}, [8]byte{}}}, + want: `{"X":[null,false,"",0,{},[],"AAAAAAAAAAA="]}`, + }, { + name: jsontest.Name("Interfaces/Any/Named"), + in: struct{ X namedAny }{[]namedAny{nil, false, "", 0.0, map[string]namedAny{}, []namedAny{}, [8]byte{}}}, + want: `{"X":[null,false,"",0,{},[],"AAAAAAAAAAA="]}`, + }, { + name: jsontest.Name("Interfaces/Any/Stringified"), + opts: []Options{StringifyNumbers(true)}, + in: struct{ X any }{0.0}, + want: `{"X":"0"}`, + }, { + name: jsontest.Name("Interfaces/Any/MarshalFunc/Any"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(v any) ([]byte, error) { + return []byte(`"called"`), nil + })), + }, + in: struct{ X any }{[]any{nil, false, "", 0.0, map[string]any{}, []any{}}}, + want: `"called"`, + }, { + name: jsontest.Name("Interfaces/Any/MarshalFunc/Bool"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(v bool) ([]byte, error) { + return []byte(`"called"`), nil + })), + }, + in: struct{ X any }{[]any{nil, false, "", 0.0, map[string]any{}, []any{}}}, + want: `{"X":[null,"called","",0,{},[]]}`, + }, { + name: jsontest.Name("Interfaces/Any/MarshalFunc/String"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(v string) ([]byte, error) { + return []byte(`"called"`), nil + })), + }, + in: struct{ X any }{[]any{nil, false, "", 0.0, map[string]any{}, []any{}}}, + want: `{"X":[null,false,"called",0,{},[]]}`, + }, { + name: jsontest.Name("Interfaces/Any/MarshalFunc/Float64"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(v float64) ([]byte, error) { + return []byte(`"called"`), nil + })), + }, + in: struct{ X any }{[]any{nil, false, "", 0.0, map[string]any{}, []any{}}}, + want: `{"X":[null,false,"","called",{},[]]}`, + }, { + name: jsontest.Name("Interfaces/Any/MarshalFunc/MapStringAny"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(v map[string]any) ([]byte, error) { + return []byte(`"called"`), nil + })), + }, + in: struct{ X any }{[]any{nil, false, "", 0.0, map[string]any{}, []any{}}}, + want: `{"X":[null,false,"",0,"called",[]]}`, + }, { + name: jsontest.Name("Interfaces/Any/MarshalFunc/SliceAny"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(v []any) ([]byte, error) { + return []byte(`"called"`), nil + })), + }, + in: struct{ X any }{[]any{nil, false, "", 0.0, map[string]any{}, []any{}}}, + want: `{"X":"called"}`, + }, { + name: jsontest.Name("Interfaces/Any/MarshalFunc/Bytes"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(v [8]byte) ([]byte, error) { + return []byte(`"called"`), nil + })), + }, + in: struct{ X any }{[8]byte{}}, + want: `{"X":"called"}`, + }, { + name: jsontest.Name("Interfaces/Any/Float/NaN"), + in: struct{ X any }{math.NaN()}, + want: `{"X"`, + wantErr: EM(fmt.Errorf("unsupported value: %v", math.NaN())).withType(0, reflect.TypeFor[float64]()).withPos(`{"X":`, "/X"), + }, { + name: jsontest.Name("Interfaces/Any/Maps/Nil"), + in: struct{ X any }{map[string]any(nil)}, + want: `{"X":{}}`, + }, { + name: jsontest.Name("Interfaces/Any/Maps/Nil/FormatNilMapAsNull"), + opts: []Options{FormatNilMapAsNull(true)}, + in: struct{ X any }{map[string]any(nil)}, + want: `{"X":null}`, + }, { + name: jsontest.Name("Interfaces/Any/Maps/Empty"), + in: struct{ X any }{map[string]any{}}, + want: `{"X":{}}`, + }, { + name: jsontest.Name("Interfaces/Any/Maps/Empty/Multiline"), + opts: []Options{jsontext.Multiline(true), jsontext.WithIndent("")}, + in: struct{ X any }{map[string]any{}}, + want: "{\n\"X\": {}\n}", + }, { + name: jsontest.Name("Interfaces/Any/Maps/NonEmpty"), + in: struct{ X any }{map[string]any{"fizz": "buzz"}}, + want: `{"X":{"fizz":"buzz"}}`, + }, { + name: jsontest.Name("Interfaces/Any/Maps/Deterministic"), + opts: []Options{Deterministic(true)}, + in: struct{ X any }{map[string]any{"alpha": "", "bravo": ""}}, + want: `{"X":{"alpha":"","bravo":""}}`, + }, { + name: jsontest.Name("Interfaces/Any/Maps/Deterministic+AllowInvalidUTF8+RejectDuplicateNames"), + opts: []Options{Deterministic(true), jsontext.AllowInvalidUTF8(true), jsontext.AllowDuplicateNames(false)}, + in: struct{ X any }{map[string]any{"\xff": "", "\xfe": ""}}, + want: `{"X":{"�":""`, + wantErr: newDuplicateNameError("/X", []byte(`"�"`), len64(`{"X":{"�":"",`)), + }, { + name: jsontest.Name("Interfaces/Any/Maps/Deterministic+AllowInvalidUTF8+AllowDuplicateNames"), + opts: []Options{Deterministic(true), jsontext.AllowInvalidUTF8(true), jsontext.AllowDuplicateNames(true)}, + in: struct{ X any }{map[string]any{"\xff": "alpha", "\xfe": "bravo"}}, + want: `{"X":{"�":"bravo","�":"alpha"}}`, + }, { + name: jsontest.Name("Interfaces/Any/Maps/RejectInvalidUTF8"), + in: struct{ X any }{map[string]any{"\xff": "", "\xfe": ""}}, + want: `{"X":{`, + wantErr: newInvalidUTF8Error(len64(`{"X":{`), "/X"), + }, { + name: jsontest.Name("Interfaces/Any/Maps/AllowInvalidUTF8+RejectDuplicateNames"), + opts: []Options{jsontext.AllowInvalidUTF8(true)}, + in: struct{ X any }{map[string]any{"\xff": "", "\xfe": ""}}, + want: `{"X":{"�":""`, + wantErr: newDuplicateNameError("/X", []byte(`"�"`), len64(`{"X":{"�":"",`)), + }, { + name: jsontest.Name("Interfaces/Any/Maps/AllowInvalidUTF8+AllowDuplicateNames"), + opts: []Options{jsontext.AllowInvalidUTF8(true), jsontext.AllowDuplicateNames(true)}, + in: struct{ X any }{map[string]any{"\xff": "", "\xfe": ""}}, + want: `{"X":{"�":"","�":""}}`, + }, { + name: jsontest.Name("Interfaces/Any/Maps/Cyclic"), + in: func() any { + m := map[string]any{} + m[""] = m + return struct{ X any }{m} + }(), + want: `{"X"` + strings.Repeat(`:{""`, startDetectingCyclesAfter), + wantErr: EM(internal.ErrCycle).withPos(`{"X":`+strings.Repeat(`{"":`, startDetectingCyclesAfter), "/X"+jsontext.Pointer(strings.Repeat("/", startDetectingCyclesAfter))).withType(0, T[map[string]any]()), + }, { + name: jsontest.Name("Interfaces/Any/Slices/Nil"), + in: struct{ X any }{[]any(nil)}, + want: `{"X":[]}`, + }, { + name: jsontest.Name("Interfaces/Any/Slices/Nil/FormatNilSliceAsNull"), + opts: []Options{FormatNilSliceAsNull(true)}, + in: struct{ X any }{[]any(nil)}, + want: `{"X":null}`, + }, { + name: jsontest.Name("Interfaces/Any/Slices/Empty"), + in: struct{ X any }{[]any{}}, + want: `{"X":[]}`, + }, { + name: jsontest.Name("Interfaces/Any/Slices/Empty/Multiline"), + opts: []Options{jsontext.Multiline(true), jsontext.WithIndent("")}, + in: struct{ X any }{[]any{}}, + want: "{\n\"X\": []\n}", + }, { + name: jsontest.Name("Interfaces/Any/Slices/NonEmpty"), + in: struct{ X any }{[]any{"fizz", "buzz"}}, + want: `{"X":["fizz","buzz"]}`, + }, { + name: jsontest.Name("Interfaces/Any/Slices/Cyclic"), + in: func() any { + s := make([]any, 1) + s[0] = s + return struct{ X any }{s} + }(), + want: `{"X":` + strings.Repeat(`[`, startDetectingCyclesAfter), + wantErr: EM(internal.ErrCycle).withPos(`{"X":`+strings.Repeat(`[`, startDetectingCyclesAfter), "/X"+jsontext.Pointer(strings.Repeat("/0", startDetectingCyclesAfter))).withType(0, T[[]any]()), + }, { + name: jsontest.Name("Methods/NilPointer"), + in: struct{ X *allMethods }{X: (*allMethods)(nil)}, // method should not be called + want: `{"X":null}`, + }, { + // NOTE: Fixes https://github.com/dominikh/go-tools/issues/975. + name: jsontest.Name("Methods/NilInterface"), + in: struct{ X MarshalerTo }{X: (*allMethods)(nil)}, // method should not be called + want: `{"X":null}`, + }, { + name: jsontest.Name("Methods/AllMethods"), + in: struct{ X *allMethods }{X: &allMethods{method: "MarshalJSONTo", value: []byte(`"hello"`)}}, + want: `{"X":"hello"}`, + }, { + name: jsontest.Name("Methods/AllMethodsExceptJSONv2"), + in: struct{ X *allMethodsExceptJSONv2 }{X: &allMethodsExceptJSONv2{allMethods: allMethods{method: "MarshalJSON", value: []byte(`"hello"`)}}}, + want: `{"X":"hello"}`, + }, { + name: jsontest.Name("Methods/AllMethodsExceptJSONv1"), + in: struct{ X *allMethodsExceptJSONv1 }{X: &allMethodsExceptJSONv1{allMethods: allMethods{method: "MarshalJSONTo", value: []byte(`"hello"`)}}}, + want: `{"X":"hello"}`, + }, { + name: jsontest.Name("Methods/AllMethodsExceptText"), + in: struct{ X *allMethodsExceptText }{X: &allMethodsExceptText{allMethods: allMethods{method: "MarshalJSONTo", value: []byte(`"hello"`)}}}, + want: `{"X":"hello"}`, + }, { + name: jsontest.Name("Methods/OnlyMethodJSONv2"), + in: struct{ X *onlyMethodJSONv2 }{X: &onlyMethodJSONv2{allMethods: allMethods{method: "MarshalJSONTo", value: []byte(`"hello"`)}}}, + want: `{"X":"hello"}`, + }, { + name: jsontest.Name("Methods/OnlyMethodJSONv1"), + in: struct{ X *onlyMethodJSONv1 }{X: &onlyMethodJSONv1{allMethods: allMethods{method: "MarshalJSON", value: []byte(`"hello"`)}}}, + want: `{"X":"hello"}`, + }, { + name: jsontest.Name("Methods/OnlyMethodText"), + in: struct{ X *onlyMethodText }{X: &onlyMethodText{allMethods: allMethods{method: "MarshalText", value: []byte(`hello`)}}}, + want: `{"X":"hello"}`, + }, { + name: jsontest.Name("Methods/IP"), + in: net.IPv4(192, 168, 0, 100), + want: `"192.168.0.100"`, + }, { + name: jsontest.Name("Methods/NetIP"), + in: struct { + Addr netip.Addr + AddrPort netip.AddrPort + Prefix netip.Prefix + }{ + Addr: netip.AddrFrom4([4]byte{1, 2, 3, 4}), + AddrPort: netip.AddrPortFrom(netip.AddrFrom4([4]byte{1, 2, 3, 4}), 1234), + Prefix: netip.PrefixFrom(netip.AddrFrom4([4]byte{1, 2, 3, 4}), 24), + }, + want: `{"Addr":"1.2.3.4","AddrPort":"1.2.3.4:1234","Prefix":"1.2.3.4/24"}`, + }, { + // NOTE: Fixes https://go.dev/issue/46516. + name: jsontest.Name("Methods/Anonymous"), + in: struct{ X struct{ allMethods } }{X: struct{ allMethods }{allMethods{method: "MarshalJSONTo", value: []byte(`"hello"`)}}}, + want: `{"X":"hello"}`, + }, { + // NOTE: Fixes https://go.dev/issue/22967. + name: jsontest.Name("Methods/Addressable"), + in: struct { + V allMethods + M map[string]allMethods + I any + }{ + V: allMethods{method: "MarshalJSONTo", value: []byte(`"hello"`)}, + M: map[string]allMethods{"K": {method: "MarshalJSONTo", value: []byte(`"hello"`)}}, + I: allMethods{method: "MarshalJSONTo", value: []byte(`"hello"`)}, + }, + want: `{"V":"hello","M":{"K":"hello"},"I":"hello"}`, + }, { + // NOTE: Fixes https://go.dev/issue/29732. + name: jsontest.Name("Methods/MapKey/JSONv2"), + in: map[structMethodJSONv2]string{{"k1"}: "v1", {"k2"}: "v2"}, + want: `{"k1":"v1","k2":"v2"}`, + canonicalize: true, + }, { + // NOTE: Fixes https://go.dev/issue/29732. + name: jsontest.Name("Methods/MapKey/JSONv1"), + in: map[structMethodJSONv1]string{{"k1"}: "v1", {"k2"}: "v2"}, + want: `{"k1":"v1","k2":"v2"}`, + canonicalize: true, + }, { + name: jsontest.Name("Methods/MapKey/Text"), + in: map[structMethodText]string{{"k1"}: "v1", {"k2"}: "v2"}, + want: `{"k1":"v1","k2":"v2"}`, + canonicalize: true, + }, { + name: jsontest.Name("Methods/Invalid/JSONv2/Error"), + in: marshalJSONv2Func(func(*jsontext.Encoder) error { + return errSomeError + }), + wantErr: EM(errSomeError).withType(0, T[marshalJSONv2Func]()), + }, { + name: jsontest.Name("Methods/Invalid/JSONv2/TooFew"), + in: marshalJSONv2Func(func(*jsontext.Encoder) error { + return nil // do nothing + }), + wantErr: EM(errNonSingularValue).withType(0, T[marshalJSONv2Func]()), + }, { + name: jsontest.Name("Methods/Invalid/JSONv2/TooMany"), + in: marshalJSONv2Func(func(enc *jsontext.Encoder) error { + enc.WriteToken(jsontext.Null) + enc.WriteToken(jsontext.Null) + return nil + }), + want: `nullnull`, + wantErr: EM(errNonSingularValue).withPos(`nullnull`, "").withType(0, T[marshalJSONv2Func]()), + }, { + name: jsontest.Name("Methods/Invalid/JSONv2/SkipFunc"), + in: marshalJSONv2Func(func(enc *jsontext.Encoder) error { + return SkipFunc + }), + wantErr: EM(errors.New("marshal method cannot be skipped")).withType(0, T[marshalJSONv2Func]()), + }, { + name: jsontest.Name("Methods/Invalid/JSONv1/Error"), + in: marshalJSONv1Func(func() ([]byte, error) { + return nil, errSomeError + }), + wantErr: EM(errSomeError).withType(0, T[marshalJSONv1Func]()), + }, { + name: jsontest.Name("Methods/Invalid/JSONv1/Syntax"), + in: marshalJSONv1Func(func() ([]byte, error) { + return []byte("invalid"), nil + }), + wantErr: EM(newInvalidCharacterError("i", "at start of value", 0, "")).withType(0, T[marshalJSONv1Func]()), + }, { + name: jsontest.Name("Methods/Invalid/JSONv1/SkipFunc"), + in: marshalJSONv1Func(func() ([]byte, error) { + return nil, SkipFunc + }), + wantErr: EM(errors.New("marshal method cannot be skipped")).withType(0, T[marshalJSONv1Func]()), + }, { + name: jsontest.Name("Methods/AppendText"), + in: appendTextFunc(func(b []byte) ([]byte, error) { return append(b, "hello"...), nil }), + want: `"hello"`, + }, { + name: jsontest.Name("Methods/AppendText/Error"), + in: appendTextFunc(func(b []byte) ([]byte, error) { return append(b, "hello"...), errSomeError }), + wantErr: EM(errSomeError).withType(0, T[appendTextFunc]()), + }, { + name: jsontest.Name("Methods/AppendText/NeedEscape"), + in: appendTextFunc(func(b []byte) ([]byte, error) { return append(b, `"`...), nil }), + want: `"\""`, + }, { + name: jsontest.Name("Methods/AppendText/RejectInvalidUTF8"), + in: appendTextFunc(func(b []byte) ([]byte, error) { return append(b, "\xde\xad\xbe\xef"...), nil }), + wantErr: EM(newInvalidUTF8Error(0, "")).withType(0, T[appendTextFunc]()), + }, { + name: jsontest.Name("Methods/AppendText/AllowInvalidUTF8"), + opts: []Options{jsontext.AllowInvalidUTF8(true)}, + in: appendTextFunc(func(b []byte) ([]byte, error) { return append(b, "\xde\xad\xbe\xef"...), nil }), + want: "\"\xde\xad\ufffd\ufffd\"", + }, { + name: jsontest.Name("Methods/Invalid/Text/Error"), + in: marshalTextFunc(func() ([]byte, error) { + return nil, errSomeError + }), + wantErr: EM(errSomeError).withType(0, T[marshalTextFunc]()), + }, { + name: jsontest.Name("Methods/Text/RejectInvalidUTF8"), + in: marshalTextFunc(func() ([]byte, error) { + return []byte("\xde\xad\xbe\xef"), nil + }), + wantErr: EM(newInvalidUTF8Error(0, "")).withType(0, T[marshalTextFunc]()), + }, { + name: jsontest.Name("Methods/Text/AllowInvalidUTF8"), + opts: []Options{jsontext.AllowInvalidUTF8(true)}, + in: marshalTextFunc(func() ([]byte, error) { + return []byte("\xde\xad\xbe\xef"), nil + }), + want: "\"\xde\xad\ufffd\ufffd\"", + }, { + name: jsontest.Name("Methods/Invalid/Text/SkipFunc"), + in: marshalTextFunc(func() ([]byte, error) { + return nil, SkipFunc + }), + wantErr: EM(wrapSkipFunc(SkipFunc, "marshal method")).withType(0, T[marshalTextFunc]()), + }, { + name: jsontest.Name("Methods/Invalid/MapKey/JSONv2/Syntax"), + in: map[any]string{ + addr(marshalJSONv2Func(func(enc *jsontext.Encoder) error { + return enc.WriteToken(jsontext.Null) + })): "invalid", + }, + want: `{`, + wantErr: EM(newNonStringNameError(len64(`{`), "")).withPos(`{`, "").withType(0, T[marshalJSONv2Func]()), + }, { + name: jsontest.Name("Methods/Invalid/MapKey/JSONv1/Syntax"), + in: map[any]string{ + addr(marshalJSONv1Func(func() ([]byte, error) { + return []byte(`null`), nil + })): "invalid", + }, + want: `{`, + wantErr: EM(newNonStringNameError(len64(`{`), "")).withPos(`{`, "").withType(0, T[marshalJSONv1Func]()), + }, { + name: jsontest.Name("Functions/Bool/V1"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(bool) ([]byte, error) { + return []byte(`"called"`), nil + })), + }, + in: true, + want: `"called"`, + }, { + name: jsontest.Name("Functions/Bool/Empty"), + opts: []Options{WithMarshalers(nil)}, + in: true, + want: `true`, + }, { + name: jsontest.Name("Functions/NamedBool/V1/NoMatch"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(namedBool) ([]byte, error) { + return nil, errMustNotCall + })), + }, + in: true, + want: `true`, + }, { + name: jsontest.Name("Functions/NamedBool/V1/Match"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(namedBool) ([]byte, error) { + return []byte(`"called"`), nil + })), + }, + in: namedBool(true), + want: `"called"`, + }, { + name: jsontest.Name("Functions/PointerBool/V1/Match"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(v *bool) ([]byte, error) { + _ = *v // must be a non-nil pointer + return []byte(`"called"`), nil + })), + }, + in: true, + want: `"called"`, + }, { + name: jsontest.Name("Functions/Bool/V2"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v bool) error { + return enc.WriteToken(jsontext.String("called")) + })), + }, + in: true, + want: `"called"`, + }, { + name: jsontest.Name("Functions/NamedBool/V2/NoMatch"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v namedBool) error { + return errMustNotCall + })), + }, + in: true, + want: `true`, + }, { + name: jsontest.Name("Functions/NamedBool/V2/Match"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v namedBool) error { + return enc.WriteToken(jsontext.String("called")) + })), + }, + in: namedBool(true), + want: `"called"`, + }, { + name: jsontest.Name("Functions/PointerBool/V2/Match"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v *bool) error { + _ = *v // must be a non-nil pointer + return enc.WriteToken(jsontext.String("called")) + })), + }, + in: true, + want: `"called"`, + }, { + name: jsontest.Name("Functions/Bool/Empty1/NoMatch"), + opts: []Options{ + WithMarshalers(new(Marshalers)), + }, + in: true, + want: `true`, + }, { + name: jsontest.Name("Functions/Bool/Empty2/NoMatch"), + opts: []Options{ + WithMarshalers(JoinMarshalers()), + }, + in: true, + want: `true`, + }, { + name: jsontest.Name("Functions/Bool/V1/DirectError"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(bool) ([]byte, error) { + return nil, errSomeError + })), + }, + in: true, + wantErr: EM(errSomeError).withType(0, T[bool]()), + }, { + name: jsontest.Name("Functions/Bool/V1/SkipError"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(bool) ([]byte, error) { + return nil, SkipFunc + })), + }, + in: true, + wantErr: EM(wrapSkipFunc(SkipFunc, "marshal function of type func(T) ([]byte, error)")).withType(0, T[bool]()), + }, { + name: jsontest.Name("Functions/Bool/V1/InvalidValue"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(bool) ([]byte, error) { + return []byte("invalid"), nil + })), + }, + in: true, + wantErr: EM(newInvalidCharacterError("i", "at start of value", 0, "")).withType(0, T[bool]()), + }, { + name: jsontest.Name("Functions/Bool/V2/DirectError"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v bool) error { + return errSomeError + })), + }, + in: true, + wantErr: EM(errSomeError).withType(0, T[bool]()), + }, { + name: jsontest.Name("Functions/Bool/V2/TooFew"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v bool) error { + return nil + })), + }, + in: true, + wantErr: EM(errNonSingularValue).withType(0, T[bool]()), + }, { + name: jsontest.Name("Functions/Bool/V2/TooMany"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v bool) error { + enc.WriteValue([]byte(`"hello"`)) + enc.WriteValue([]byte(`"world"`)) + return nil + })), + }, + in: true, + want: `"hello""world"`, + wantErr: EM(errNonSingularValue).withPos(`"hello""world"`, "").withType(0, T[bool]()), + }, { + name: jsontest.Name("Functions/Bool/V2/Skipped"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v bool) error { + return SkipFunc + })), + }, + in: true, + want: `true`, + }, { + name: jsontest.Name("Functions/Bool/V2/ProcessBeforeSkip"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v bool) error { + enc.WriteValue([]byte(`"hello"`)) + return SkipFunc + })), + }, + in: true, + want: `"hello"`, + wantErr: EM(errSkipMutation).withPos(`"hello"`, "").withType(0, T[bool]()), + }, { + name: jsontest.Name("Functions/Bool/V2/WrappedSkipError"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v bool) error { + return fmt.Errorf("wrap: %w", SkipFunc) + })), + }, + in: true, + wantErr: EM(fmt.Errorf("wrap: %w", SkipFunc)).withType(0, T[bool]()), + }, { + name: jsontest.Name("Functions/Map/Key/NoCaseString/V1"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(v nocaseString) ([]byte, error) { + return []byte(`"called"`), nil + })), + }, + in: map[nocaseString]string{"hello": "world"}, + want: `{"called":"world"}`, + }, { + name: jsontest.Name("Functions/Map/Key/PointerNoCaseString/V1"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(v *nocaseString) ([]byte, error) { + _ = *v // must be a non-nil pointer + return []byte(`"called"`), nil + })), + }, + in: map[nocaseString]string{"hello": "world"}, + want: `{"called":"world"}`, + }, { + name: jsontest.Name("Functions/Map/Key/TextMarshaler/V1"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(v encoding.TextMarshaler) ([]byte, error) { + _ = *v.(*nocaseString) // must be a non-nil *nocaseString + return []byte(`"called"`), nil + })), + }, + in: map[nocaseString]string{"hello": "world"}, + want: `{"called":"world"}`, + }, { + name: jsontest.Name("Functions/Map/Key/NoCaseString/V1/InvalidValue"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(v nocaseString) ([]byte, error) { + return []byte(`null`), nil + })), + }, + in: map[nocaseString]string{"hello": "world"}, + want: `{`, + wantErr: EM(newNonStringNameError(len64(`{`), "")).withPos(`{`, "").withType(0, T[nocaseString]()), + }, { + name: jsontest.Name("Functions/Map/Key/NoCaseString/V2/InvalidKind"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(v nocaseString) ([]byte, error) { + return []byte(`null`), nil + })), + }, + in: map[nocaseString]string{"hello": "world"}, + want: `{`, + wantErr: EM(newNonStringNameError(len64(`{`), "")).withPos(`{`, "").withType(0, T[nocaseString]()), + }, { + name: jsontest.Name("Functions/Map/Key/String/V1/DuplicateName"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(v string) ([]byte, error) { + return []byte(`"name"`), nil + })), + }, + in: map[string]string{"name1": "value", "name2": "value"}, + want: `{"name":"name"`, + wantErr: EM(newDuplicateNameError("", []byte(`"name"`), len64(`{"name":"name",`))). + withPos(`{"name":"name",`, "").withType(0, T[string]()), + }, { + name: jsontest.Name("Functions/Map/Key/NoCaseString/V2"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v nocaseString) error { + return enc.WriteValue([]byte(`"called"`)) + })), + }, + in: map[nocaseString]string{"hello": "world"}, + want: `{"called":"world"}`, + }, { + name: jsontest.Name("Functions/Map/Key/PointerNoCaseString/V2"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v *nocaseString) error { + _ = *v // must be a non-nil pointer + return enc.WriteValue([]byte(`"called"`)) + })), + }, + in: map[nocaseString]string{"hello": "world"}, + want: `{"called":"world"}`, + }, { + name: jsontest.Name("Functions/Map/Key/TextMarshaler/V2"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v encoding.TextMarshaler) error { + _ = *v.(*nocaseString) // must be a non-nil *nocaseString + return enc.WriteValue([]byte(`"called"`)) + })), + }, + in: map[nocaseString]string{"hello": "world"}, + want: `{"called":"world"}`, + }, { + name: jsontest.Name("Functions/Map/Key/NoCaseString/V2/InvalidToken"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v nocaseString) error { + return enc.WriteToken(jsontext.Null) + })), + }, + in: map[nocaseString]string{"hello": "world"}, + want: `{`, + wantErr: EM(newNonStringNameError(len64(`{`), "")).withPos(`{`, "").withType(0, T[nocaseString]()), + }, { + name: jsontest.Name("Functions/Map/Key/NoCaseString/V2/InvalidValue"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v nocaseString) error { + return enc.WriteValue([]byte(`null`)) + })), + }, + in: map[nocaseString]string{"hello": "world"}, + want: `{`, + wantErr: EM(newNonStringNameError(len64(`{`), "")).withPos(`{`, "").withType(0, T[nocaseString]()), + }, { + name: jsontest.Name("Functions/Map/Value/NoCaseString/V1"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(v nocaseString) ([]byte, error) { + return []byte(`"called"`), nil + })), + }, + in: map[string]nocaseString{"hello": "world"}, + want: `{"hello":"called"}`, + }, { + name: jsontest.Name("Functions/Map/Value/PointerNoCaseString/V1"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(v *nocaseString) ([]byte, error) { + _ = *v // must be a non-nil pointer + return []byte(`"called"`), nil + })), + }, + in: map[string]nocaseString{"hello": "world"}, + want: `{"hello":"called"}`, + }, { + name: jsontest.Name("Functions/Map/Value/TextMarshaler/V1"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(v encoding.TextMarshaler) ([]byte, error) { + _ = *v.(*nocaseString) // must be a non-nil *nocaseString + return []byte(`"called"`), nil + })), + }, + in: map[string]nocaseString{"hello": "world"}, + want: `{"hello":"called"}`, + }, { + name: jsontest.Name("Functions/Map/Value/NoCaseString/V2"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v nocaseString) error { + return enc.WriteValue([]byte(`"called"`)) + })), + }, + in: map[string]nocaseString{"hello": "world"}, + want: `{"hello":"called"}`, + }, { + name: jsontest.Name("Functions/Map/Value/PointerNoCaseString/V2"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v *nocaseString) error { + _ = *v // must be a non-nil pointer + return enc.WriteValue([]byte(`"called"`)) + })), + }, + in: map[string]nocaseString{"hello": "world"}, + want: `{"hello":"called"}`, + }, { + name: jsontest.Name("Functions/Map/Value/TextMarshaler/V2"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v encoding.TextMarshaler) error { + _ = *v.(*nocaseString) // must be a non-nil *nocaseString + return enc.WriteValue([]byte(`"called"`)) + })), + }, + in: map[string]nocaseString{"hello": "world"}, + want: `{"hello":"called"}`, + }, { + name: jsontest.Name("Funtions/Struct/Fields"), + opts: []Options{ + WithMarshalers(JoinMarshalers( + MarshalFunc(func(v bool) ([]byte, error) { + return []byte(`"called1"`), nil + }), + MarshalFunc(func(v *string) ([]byte, error) { + return []byte(`"called2"`), nil + }), + MarshalToFunc(func(enc *jsontext.Encoder, v []byte) error { + return enc.WriteValue([]byte(`"called3"`)) + }), + MarshalToFunc(func(enc *jsontext.Encoder, v *int64) error { + return enc.WriteValue([]byte(`"called4"`)) + }), + )), + }, + in: structScalars{}, + want: `{"Bool":"called1","String":"called2","Bytes":"called3","Int":"called4","Uint":0,"Float":0}`, + }, { + name: jsontest.Name("Functions/Struct/OmitEmpty"), + opts: []Options{ + WithMarshalers(JoinMarshalers( + MarshalFunc(func(v bool) ([]byte, error) { + return []byte(`null`), nil + }), + MarshalFunc(func(v string) ([]byte, error) { + return []byte(`"called1"`), nil + }), + MarshalFunc(func(v *stringMarshalNonEmpty) ([]byte, error) { + return []byte(`""`), nil + }), + MarshalToFunc(func(enc *jsontext.Encoder, v bytesMarshalNonEmpty) error { + return enc.WriteValue([]byte(`{}`)) + }), + MarshalToFunc(func(enc *jsontext.Encoder, v *float64) error { + return enc.WriteValue([]byte(`[]`)) + }), + MarshalFunc(func(v mapMarshalNonEmpty) ([]byte, error) { + return []byte(`"called2"`), nil + }), + MarshalFunc(func(v []string) ([]byte, error) { + return []byte(`"called3"`), nil + }), + MarshalToFunc(func(enc *jsontext.Encoder, v *sliceMarshalNonEmpty) error { + return enc.WriteValue([]byte(`"called4"`)) + }), + )), + }, + in: structOmitEmptyAll{}, + want: `{"String":"called1","MapNonEmpty":"called2","Slice":"called3","SliceNonEmpty":"called4"}`, + }, { + name: jsontest.Name("Functions/Struct/OmitZero"), + opts: []Options{ + WithMarshalers(JoinMarshalers( + MarshalFunc(func(v bool) ([]byte, error) { + panic("should not be called") + }), + MarshalFunc(func(v *string) ([]byte, error) { + panic("should not be called") + }), + MarshalToFunc(func(enc *jsontext.Encoder, v []byte) error { + panic("should not be called") + }), + MarshalToFunc(func(enc *jsontext.Encoder, v *int64) error { + panic("should not be called") + }), + )), + }, + in: structOmitZeroAll{}, + want: `{}`, + }, { + name: jsontest.Name("Functions/Struct/Inlined"), + opts: []Options{ + WithMarshalers(JoinMarshalers( + MarshalFunc(func(v structInlinedL1) ([]byte, error) { + panic("should not be called") + }), + MarshalToFunc(func(enc *jsontext.Encoder, v *StructEmbed2) error { + panic("should not be called") + }), + )), + }, + in: structInlined{}, + want: `{"D":""}`, + }, { + name: jsontest.Name("Functions/Slice/Elem"), + opts: []Options{ + WithMarshalers(MarshalFunc(func(v bool) ([]byte, error) { + return []byte(`"` + strconv.FormatBool(v) + `"`), nil + })), + }, + in: []bool{true, false}, + want: `["true","false"]`, + }, { + name: jsontest.Name("Functions/Array/Elem"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v *bool) error { + return enc.WriteValue([]byte(`"` + strconv.FormatBool(*v) + `"`)) + })), + }, + in: [2]bool{true, false}, + want: `["true","false"]`, + }, { + name: jsontest.Name("Functions/Pointer/Nil"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v *bool) error { + panic("should not be called") + })), + }, + in: struct{ X *bool }{nil}, + want: `{"X":null}`, + }, { + name: jsontest.Name("Functions/Pointer/NonNil"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v *bool) error { + return enc.WriteValue([]byte(`"called"`)) + })), + }, + in: struct{ X *bool }{addr(false)}, + want: `{"X":"called"}`, + }, { + name: jsontest.Name("Functions/Interface/Nil"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v fmt.Stringer) error { + panic("should not be called") + })), + }, + in: struct{ X fmt.Stringer }{nil}, + want: `{"X":null}`, + }, { + name: jsontest.Name("Functions/Interface/NonNil/MatchInterface"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v fmt.Stringer) error { + return enc.WriteValue([]byte(`"called"`)) + })), + }, + in: struct{ X fmt.Stringer }{valueStringer{}}, + want: `{"X":"called"}`, + }, { + name: jsontest.Name("Functions/Interface/NonNil/MatchConcrete"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v valueStringer) error { + return enc.WriteValue([]byte(`"called"`)) + })), + }, + in: struct{ X fmt.Stringer }{valueStringer{}}, + want: `{"X":"called"}`, + }, { + name: jsontest.Name("Functions/Interface/NonNil/MatchPointer"), + opts: []Options{ + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, v *valueStringer) error { + return enc.WriteValue([]byte(`"called"`)) + })), + }, + in: struct{ X fmt.Stringer }{valueStringer{}}, + want: `{"X":"called"}`, + }, { + name: jsontest.Name("Functions/Interface/Any"), + in: []any{ + nil, // nil + valueStringer{}, // T + (*valueStringer)(nil), // *T + addr(valueStringer{}), // *T + (**valueStringer)(nil), // **T + addr((*valueStringer)(nil)), // **T + addr(addr(valueStringer{})), // **T + pointerStringer{}, // T + (*pointerStringer)(nil), // *T + addr(pointerStringer{}), // *T + (**pointerStringer)(nil), // **T + addr((*pointerStringer)(nil)), // **T + addr(addr(pointerStringer{})), // **T + "LAST", + }, + want: `[null,{},null,{},null,null,{},{},null,{},null,null,{},"LAST"]`, + opts: []Options{ + WithMarshalers(func() *Marshalers { + type P struct { + D int + N int64 + } + type PV struct { + P P + V any + } + + var lastChecks []func() error + checkLast := func() error { + for _, fn := range lastChecks { + if err := fn(); err != nil { + return err + } + } + return SkipFunc + } + makeValueChecker := func(name string, want []PV) func(e *jsontext.Encoder, v any) error { + checkNext := func(e *jsontext.Encoder, v any) error { + xe := export.Encoder(e) + p := P{len(xe.Tokens.Stack), xe.Tokens.Last.Length()} + rv := reflect.ValueOf(v) + pv := PV{p, v} + switch { + case len(want) == 0: + return fmt.Errorf("%s: %v: got more values than expected", name, p) + case !rv.IsValid() || rv.Kind() != reflect.Pointer || rv.IsNil(): + return fmt.Errorf("%s: %v: got %#v, want non-nil pointer type", name, p, v) + case !reflect.DeepEqual(pv, want[0]): + return fmt.Errorf("%s:\n\tgot %#v\n\twant %#v", name, pv, want[0]) + default: + want = want[1:] + return SkipFunc + } + } + lastChecks = append(lastChecks, func() error { + if len(want) > 0 { + return fmt.Errorf("%s: did not get enough values, want %d more", name, len(want)) + } + return nil + }) + return checkNext + } + makePositionChecker := func(name string, want []P) func(e *jsontext.Encoder, v any) error { + checkNext := func(e *jsontext.Encoder, v any) error { + xe := export.Encoder(e) + p := P{len(xe.Tokens.Stack), xe.Tokens.Last.Length()} + switch { + case len(want) == 0: + return fmt.Errorf("%s: %v: got more values than wanted", name, p) + case p != want[0]: + return fmt.Errorf("%s: got %v, want %v", name, p, want[0]) + default: + want = want[1:] + return SkipFunc + } + } + lastChecks = append(lastChecks, func() error { + if len(want) > 0 { + return fmt.Errorf("%s: did not get enough values, want %d more", name, len(want)) + } + return nil + }) + return checkNext + } + + wantAny := []PV{ + {P{0, 0}, addr([]any{ + nil, + valueStringer{}, + (*valueStringer)(nil), + addr(valueStringer{}), + (**valueStringer)(nil), + addr((*valueStringer)(nil)), + addr(addr(valueStringer{})), + pointerStringer{}, + (*pointerStringer)(nil), + addr(pointerStringer{}), + (**pointerStringer)(nil), + addr((*pointerStringer)(nil)), + addr(addr(pointerStringer{})), + "LAST", + })}, + {P{1, 0}, addr(any(nil))}, + {P{1, 1}, addr(any(valueStringer{}))}, + {P{1, 1}, addr(valueStringer{})}, + {P{1, 2}, addr(any((*valueStringer)(nil)))}, + {P{1, 2}, addr((*valueStringer)(nil))}, + {P{1, 3}, addr(any(addr(valueStringer{})))}, + {P{1, 3}, addr(addr(valueStringer{}))}, + {P{1, 3}, addr(valueStringer{})}, + {P{1, 4}, addr(any((**valueStringer)(nil)))}, + {P{1, 4}, addr((**valueStringer)(nil))}, + {P{1, 5}, addr(any(addr((*valueStringer)(nil))))}, + {P{1, 5}, addr(addr((*valueStringer)(nil)))}, + {P{1, 5}, addr((*valueStringer)(nil))}, + {P{1, 6}, addr(any(addr(addr(valueStringer{}))))}, + {P{1, 6}, addr(addr(addr(valueStringer{})))}, + {P{1, 6}, addr(addr(valueStringer{}))}, + {P{1, 6}, addr(valueStringer{})}, + {P{1, 7}, addr(any(pointerStringer{}))}, + {P{1, 7}, addr(pointerStringer{})}, + {P{1, 8}, addr(any((*pointerStringer)(nil)))}, + {P{1, 8}, addr((*pointerStringer)(nil))}, + {P{1, 9}, addr(any(addr(pointerStringer{})))}, + {P{1, 9}, addr(addr(pointerStringer{}))}, + {P{1, 9}, addr(pointerStringer{})}, + {P{1, 10}, addr(any((**pointerStringer)(nil)))}, + {P{1, 10}, addr((**pointerStringer)(nil))}, + {P{1, 11}, addr(any(addr((*pointerStringer)(nil))))}, + {P{1, 11}, addr(addr((*pointerStringer)(nil)))}, + {P{1, 11}, addr((*pointerStringer)(nil))}, + {P{1, 12}, addr(any(addr(addr(pointerStringer{}))))}, + {P{1, 12}, addr(addr(addr(pointerStringer{})))}, + {P{1, 12}, addr(addr(pointerStringer{}))}, + {P{1, 12}, addr(pointerStringer{})}, + {P{1, 13}, addr(any("LAST"))}, + {P{1, 13}, addr("LAST")}, + } + checkAny := makeValueChecker("any", wantAny) + anyMarshaler := MarshalToFunc(func(enc *jsontext.Encoder, v any) error { + return checkAny(enc, v) + }) + + var wantPointerAny []PV + for _, v := range wantAny { + if _, ok := v.V.(*any); ok { + wantPointerAny = append(wantPointerAny, v) + } + } + checkPointerAny := makeValueChecker("*any", wantPointerAny) + pointerAnyMarshaler := MarshalToFunc(func(enc *jsontext.Encoder, v *any) error { + return checkPointerAny(enc, v) + }) + + checkNamedAny := makeValueChecker("namedAny", wantAny) + namedAnyMarshaler := MarshalToFunc(func(enc *jsontext.Encoder, v namedAny) error { + return checkNamedAny(enc, v) + }) + + checkPointerNamedAny := makeValueChecker("*namedAny", nil) + pointerNamedAnyMarshaler := MarshalToFunc(func(enc *jsontext.Encoder, v *namedAny) error { + return checkPointerNamedAny(enc, v) + }) + + type stringer = fmt.Stringer + var wantStringer []PV + for _, v := range wantAny { + if _, ok := v.V.(stringer); ok { + wantStringer = append(wantStringer, v) + } + } + checkStringer := makeValueChecker("stringer", wantStringer) + stringerMarshaler := MarshalToFunc(func(enc *jsontext.Encoder, v stringer) error { + return checkStringer(enc, v) + }) + + checkPointerStringer := makeValueChecker("*stringer", nil) + pointerStringerMarshaler := MarshalToFunc(func(enc *jsontext.Encoder, v *stringer) error { + return checkPointerStringer(enc, v) + }) + + wantValueStringer := []P{{1, 1}, {1, 3}, {1, 6}} + checkValueValueStringer := makePositionChecker("valueStringer", wantValueStringer) + valueValueStringerMarshaler := MarshalToFunc(func(enc *jsontext.Encoder, v valueStringer) error { + return checkValueValueStringer(enc, v) + }) + + checkPointerValueStringer := makePositionChecker("*valueStringer", wantValueStringer) + pointerValueStringerMarshaler := MarshalToFunc(func(enc *jsontext.Encoder, v *valueStringer) error { + return checkPointerValueStringer(enc, v) + }) + + wantPointerStringer := []P{{1, 7}, {1, 9}, {1, 12}} + checkValuePointerStringer := makePositionChecker("pointerStringer", wantPointerStringer) + valuePointerStringerMarshaler := MarshalToFunc(func(enc *jsontext.Encoder, v pointerStringer) error { + return checkValuePointerStringer(enc, v) + }) + + checkPointerPointerStringer := makePositionChecker("*pointerStringer", wantPointerStringer) + pointerPointerStringerMarshaler := MarshalToFunc(func(enc *jsontext.Encoder, v *pointerStringer) error { + return checkPointerPointerStringer(enc, v) + }) + + lastMarshaler := MarshalToFunc(func(enc *jsontext.Encoder, v string) error { + return checkLast() + }) + + return JoinMarshalers( + anyMarshaler, + pointerAnyMarshaler, + namedAnyMarshaler, + pointerNamedAnyMarshaler, // never called + stringerMarshaler, + pointerStringerMarshaler, // never called + valueValueStringerMarshaler, + pointerValueStringerMarshaler, + valuePointerStringerMarshaler, + pointerPointerStringerMarshaler, + lastMarshaler, + ) + }()), + }, + }, { + name: jsontest.Name("Functions/Precedence/V1First"), + opts: []Options{ + WithMarshalers(JoinMarshalers( + MarshalFunc(func(bool) ([]byte, error) { + return []byte(`"called"`), nil + }), + MarshalToFunc(func(enc *jsontext.Encoder, v bool) error { + panic("should not be called") + }), + )), + }, + in: true, + want: `"called"`, + }, { + name: jsontest.Name("Functions/Precedence/V2First"), + opts: []Options{ + WithMarshalers(JoinMarshalers( + MarshalToFunc(func(enc *jsontext.Encoder, v bool) error { + return enc.WriteToken(jsontext.String("called")) + }), + MarshalFunc(func(bool) ([]byte, error) { + panic("should not be called") + }), + )), + }, + in: true, + want: `"called"`, + }, { + name: jsontest.Name("Functions/Precedence/V2Skipped"), + opts: []Options{ + WithMarshalers(JoinMarshalers( + MarshalToFunc(func(enc *jsontext.Encoder, v bool) error { + return SkipFunc + }), + MarshalFunc(func(bool) ([]byte, error) { + return []byte(`"called"`), nil + }), + )), + }, + in: true, + want: `"called"`, + }, { + name: jsontest.Name("Functions/Precedence/NestedFirst"), + opts: []Options{ + WithMarshalers(JoinMarshalers( + JoinMarshalers( + MarshalFunc(func(bool) ([]byte, error) { + return []byte(`"called"`), nil + }), + ), + MarshalFunc(func(bool) ([]byte, error) { + panic("should not be called") + }), + )), + }, + in: true, + want: `"called"`, + }, { + name: jsontest.Name("Functions/Precedence/NestedLast"), + opts: []Options{ + WithMarshalers(JoinMarshalers( + MarshalFunc(func(bool) ([]byte, error) { + return []byte(`"called"`), nil + }), + JoinMarshalers( + MarshalFunc(func(bool) ([]byte, error) { + panic("should not be called") + }), + ), + )), + }, + in: true, + want: `"called"`, + }, { + name: jsontest.Name("Duration/Zero"), + in: struct { + D1 time.Duration `json:",format:units"` // TODO(https://go.dev/issue/71631): Remove the format flag. + D2 time.Duration `json:",format:nano"` + }{0, 0}, + want: `{"D1":"0s","D2":0}`, + }, { + name: jsontest.Name("Duration/Positive"), + in: struct { + D1 time.Duration `json:",format:units"` // TODO(https://go.dev/issue/71631): Remove the format flag. + D2 time.Duration `json:",format:nano"` + }{ + 123456789123456789, + 123456789123456789, + }, + want: `{"D1":"34293h33m9.123456789s","D2":123456789123456789}`, + }, { + name: jsontest.Name("Duration/Negative"), + in: struct { + D1 time.Duration `json:",format:units"` // TODO(https://go.dev/issue/71631): Remove the format flag. + D2 time.Duration `json:",format:nano"` + }{ + -123456789123456789, + -123456789123456789, + }, + want: `{"D1":"-34293h33m9.123456789s","D2":-123456789123456789}`, + }, { + name: jsontest.Name("Duration/Nanos/String"), + in: struct { + D1 time.Duration `json:",string,format:nano"` + D2 time.Duration `json:",string,format:nano"` + D3 time.Duration `json:",string,format:nano"` + }{ + math.MinInt64, + 0, + math.MaxInt64, + }, + want: `{"D1":"-9223372036854775808","D2":"0","D3":"9223372036854775807"}`, + }, { + name: jsontest.Name("Duration/Format/Invalid"), + in: struct { + D time.Duration `json:",format:invalid"` + }{}, + want: `{"D"`, + wantErr: EM(errInvalidFormatFlag).withPos(`{"D":`, "/D").withType(0, T[time.Duration]()), + }, { + /* TODO(https://go.dev/issue/71631): Re-enable this test case. + name: jsontest.Name("Duration/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + in: time.Duration(0), + want: `"0s"`, + }, { */ + name: jsontest.Name("Duration/Format"), + opts: []Options{jsontext.Multiline(true)}, + in: structDurationFormat{ + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + }, + want: `{ + "D1": "12h34m56.078090012s", + "D2": "12h34m56.078090012s", + "D3": 45296.078090012, + "D4": "45296.078090012", + "D5": 45296078.090012, + "D6": "45296078.090012", + "D7": 45296078090.012, + "D8": "45296078090.012", + "D9": 45296078090012, + "D10": "45296078090012", + "D11": "PT12H34M56.078090012S" +}`, + }, { + /* TODO(https://go.dev/issue/71631): Re-enable this test case. + name: jsontest.Name("Duration/Format/Legacy"), + opts: []Options{jsonflags.FormatDurationAsNano | 1}, + in: structDurationFormat{ + D1: 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + D2: 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + }, + want: `{"D1":45296078090012,"D2":"12h34m56.078090012s","D3":0,"D4":"0","D5":0,"D6":"0","D7":0,"D8":"0","D9":0,"D10":"0","D11":"PT0S"}`, + }, { */ + /* TODO(https://go.dev/issue/71631): Re-enable this test case. + name: jsontest.Name("Duration/MapKey"), + in: map[time.Duration]string{time.Second: ""}, + want: `{"1s":""}`, + }, { */ + name: jsontest.Name("Duration/MapKey/Legacy"), + opts: []Options{jsonflags.FormatDurationAsNano | 1}, + in: map[time.Duration]string{time.Second: ""}, + want: `{"1000000000":""}`, + }, { + name: jsontest.Name("Time/Zero"), + in: struct { + T1 time.Time + T2 time.Time `json:",format:RFC822"` + T3 time.Time `json:",format:'2006-01-02'"` + T4 time.Time `json:",omitzero"` + T5 time.Time `json:",omitempty"` + }{ + time.Time{}, + time.Time{}, + time.Time{}, + // This is zero according to time.Time.IsZero, + // but non-zero according to reflect.Value.IsZero. + time.Date(1, 1, 1, 0, 0, 0, 0, time.FixedZone("UTC", 0)), + time.Time{}, + }, + want: `{"T1":"0001-01-01T00:00:00Z","T2":"01 Jan 01 00:00 UTC","T3":"0001-01-01","T5":"0001-01-01T00:00:00Z"}`, + }, { + name: jsontest.Name("Time/Format"), + opts: []Options{jsontext.Multiline(true)}, + in: structTimeFormat{ + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + time.Date(1234, 1, 2, 3, 4, 5, 6, time.UTC), + }, + want: `{ + "T1": "1234-01-02T03:04:05.000000006Z", + "T2": "Mon Jan 2 03:04:05 1234", + "T3": "Mon Jan 2 03:04:05 UTC 1234", + "T4": "Mon Jan 02 03:04:05 +0000 1234", + "T5": "02 Jan 34 03:04 UTC", + "T6": "02 Jan 34 03:04 +0000", + "T7": "Monday, 02-Jan-34 03:04:05 UTC", + "T8": "Mon, 02 Jan 1234 03:04:05 UTC", + "T9": "Mon, 02 Jan 1234 03:04:05 +0000", + "T10": "1234-01-02T03:04:05Z", + "T11": "1234-01-02T03:04:05.000000006Z", + "T12": "3:04AM", + "T13": "Jan 2 03:04:05", + "T14": "Jan 2 03:04:05.000", + "T15": "Jan 2 03:04:05.000000", + "T16": "Jan 2 03:04:05.000000006", + "T17": "1234-01-02 03:04:05", + "T18": "1234-01-02", + "T19": "03:04:05", + "T20": "1234-01-02", + "T21": "\"weird\"1234", + "T22": -23225777754.999999994, + "T23": "-23225777754.999999994", + "T24": -23225777754999.999994, + "T25": "-23225777754999.999994", + "T26": -23225777754999999.994, + "T27": "-23225777754999999.994", + "T28": -23225777754999999994, + "T29": "-23225777754999999994" +}`, + }, { + name: jsontest.Name("Time/Format/Invalid"), + in: struct { + T time.Time `json:",format:UndefinedConstant"` + }{}, + want: `{"T"`, + wantErr: EM(errors.New(`invalid format flag "UndefinedConstant"`)).withPos(`{"T":`, "/T").withType(0, timeTimeType), + }, { + name: jsontest.Name("Time/Format/YearOverflow"), + in: struct { + T1 time.Time + T2 time.Time + }{ + time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Add(-time.Second), + time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC), + }, + want: `{"T1":"9999-12-31T23:59:59Z","T2"`, + wantErr: EM(errors.New(`year outside of range [0,9999]`)).withPos(`{"T1":"9999-12-31T23:59:59Z","T2":`, "/T2").withType(0, timeTimeType), + }, { + name: jsontest.Name("Time/Format/YearUnderflow"), + in: struct { + T1 time.Time + T2 time.Time + }{ + time.Date(0, 1, 1, 0, 0, 0, 0, time.UTC), + time.Date(0, 1, 1, 0, 0, 0, 0, time.UTC).Add(-time.Second), + }, + want: `{"T1":"0000-01-01T00:00:00Z","T2"`, + wantErr: EM(errors.New(`year outside of range [0,9999]`)).withPos(`{"T1":"0000-01-01T00:00:00Z","T2":`, "/T2").withType(0, timeTimeType), + }, { + name: jsontest.Name("Time/Format/YearUnderflow"), + in: struct{ T time.Time }{time.Date(-998, 1, 1, 0, 0, 0, 0, time.UTC).Add(-time.Second)}, + want: `{"T"`, + wantErr: EM(errors.New(`year outside of range [0,9999]`)).withPos(`{"T":`, "/T").withType(0, timeTimeType), + }, { + name: jsontest.Name("Time/Format/ZoneExact"), + in: struct{ T time.Time }{time.Date(2020, 1, 1, 0, 0, 0, 0, time.FixedZone("", 23*60*60+59*60))}, + want: `{"T":"2020-01-01T00:00:00+23:59"}`, + }, { + name: jsontest.Name("Time/Format/ZoneHourOverflow"), + in: struct{ T time.Time }{time.Date(2020, 1, 1, 0, 0, 0, 0, time.FixedZone("", 24*60*60))}, + want: `{"T"`, + wantErr: EM(errors.New(`timezone hour outside of range [0,23]`)).withPos(`{"T":`, "/T").withType(0, timeTimeType), + }, { + name: jsontest.Name("Time/Format/ZoneHourOverflow"), + in: struct{ T time.Time }{time.Date(2020, 1, 1, 0, 0, 0, 0, time.FixedZone("", 123*60*60))}, + want: `{"T"`, + wantErr: EM(errors.New(`timezone hour outside of range [0,23]`)).withPos(`{"T":`, "/T").withType(0, timeTimeType), + }, { + name: jsontest.Name("Time/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + in: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), + want: `"2000-01-01T00:00:00Z"`, + }} + + for _, tt := range tests { + t.Run(tt.name.Name, func(t *testing.T) { + var got []byte + var gotErr error + if tt.useWriter { + bb := new(struct{ bytes.Buffer }) // avoid optimizations with bytes.Buffer + gotErr = MarshalWrite(bb, tt.in, tt.opts...) + got = bb.Bytes() + } else { + got, gotErr = Marshal(tt.in, tt.opts...) + } + if tt.canonicalize { + (*jsontext.Value)(&got).Canonicalize() + } + if string(got) != tt.want { + t.Errorf("%s: Marshal output mismatch:\ngot %s\nwant %s", tt.name.Where, got, tt.want) + } + if !reflect.DeepEqual(gotErr, tt.wantErr) { + t.Errorf("%s: Marshal error mismatch:\ngot %v\nwant %v", tt.name.Where, gotErr, tt.wantErr) + } + }) + } +} + +func TestUnmarshal(t *testing.T) { + tests := []struct { + name jsontest.CaseName + opts []Options + inBuf string + inVal any + want any + wantErr error + }{{ + name: jsontest.Name("Nil"), + inBuf: `null`, + wantErr: EU(internal.ErrNonNilReference), + }, { + name: jsontest.Name("NilPointer"), + inBuf: `null`, + inVal: (*string)(nil), + want: (*string)(nil), + wantErr: EU(internal.ErrNonNilReference).withType(0, T[*string]()), + }, { + name: jsontest.Name("NonPointer"), + inBuf: `null`, + inVal: "unchanged", + want: "unchanged", + wantErr: EU(internal.ErrNonNilReference).withType(0, T[string]()), + }, { + name: jsontest.Name("Bools/TrailingJunk"), + inBuf: `falsetrue`, + inVal: addr(true), + want: addr(false), + wantErr: newInvalidCharacterError("t", "after top-level value", len64(`false`), ""), + }, { + name: jsontest.Name("Bools/Null"), + inBuf: `null`, + inVal: addr(true), + want: addr(false), + }, { + name: jsontest.Name("Bools"), + inBuf: `[null,false,true]`, + inVal: new([]bool), + want: addr([]bool{false, false, true}), + }, { + name: jsontest.Name("Bools/Named"), + inBuf: `[null,false,true]`, + inVal: new([]namedBool), + want: addr([]namedBool{false, false, true}), + }, { + name: jsontest.Name("Bools/Invalid/StringifiedFalse"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"false"`, + inVal: addr(true), + want: addr(true), + wantErr: EU(nil).withType('"', boolType), + }, { + name: jsontest.Name("Bools/Invalid/StringifiedTrue"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"true"`, + inVal: addr(true), + want: addr(true), + wantErr: EU(nil).withType('"', boolType), + }, { + name: jsontest.Name("Bools/StringifiedBool/True"), + opts: []Options{jsonflags.StringifyBoolsAndStrings | 1}, + inBuf: `"true"`, + inVal: addr(false), + want: addr(true), + }, { + name: jsontest.Name("Bools/StringifiedBool/False"), + opts: []Options{jsonflags.StringifyBoolsAndStrings | 1}, + inBuf: `"false"`, + inVal: addr(true), + want: addr(false), + }, { + name: jsontest.Name("Bools/StringifiedBool/InvalidWhitespace"), + opts: []Options{jsonflags.StringifyBoolsAndStrings | 1}, + inBuf: `"false "`, + inVal: addr(true), + want: addr(true), + wantErr: EU(strconv.ErrSyntax).withVal(`"false "`).withType('"', boolType), + }, { + name: jsontest.Name("Bools/StringifiedBool/InvalidBool"), + opts: []Options{jsonflags.StringifyBoolsAndStrings | 1}, + inBuf: `false`, + inVal: addr(true), + want: addr(true), + wantErr: EU(nil).withType('f', boolType), + }, { + name: jsontest.Name("Bools/Invalid/Number"), + inBuf: `0`, + inVal: addr(true), + want: addr(true), + wantErr: EU(nil).withType('0', boolType), + }, { + name: jsontest.Name("Bools/Invalid/String"), + inBuf: `""`, + inVal: addr(true), + want: addr(true), + wantErr: EU(nil).withType('"', boolType), + }, { + name: jsontest.Name("Bools/Invalid/Object"), + inBuf: `{}`, + inVal: addr(true), + want: addr(true), + wantErr: EU(nil).withType('{', boolType), + }, { + name: jsontest.Name("Bools/Invalid/Array"), + inBuf: `[]`, + inVal: addr(true), + want: addr(true), + wantErr: EU(nil).withType('[', boolType), + }, { + name: jsontest.Name("Bools/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + inBuf: `false`, + inVal: addr(true), + want: addr(false), + }, { + name: jsontest.Name("Strings/Null"), + inBuf: `null`, + inVal: addr("something"), + want: addr(""), + }, { + name: jsontest.Name("Strings"), + inBuf: `[null,"","hello","世界"]`, + inVal: new([]string), + want: addr([]string{"", "", "hello", "世界"}), + }, { + name: jsontest.Name("Strings/Escaped"), + inBuf: `[null,"","\u0068\u0065\u006c\u006c\u006f","\u4e16\u754c"]`, + inVal: new([]string), + want: addr([]string{"", "", "hello", "世界"}), + }, { + name: jsontest.Name("Strings/Named"), + inBuf: `[null,"","hello","世界"]`, + inVal: new([]namedString), + want: addr([]namedString{"", "", "hello", "世界"}), + }, { + name: jsontest.Name("Strings/Invalid/False"), + inBuf: `false`, + inVal: addr("nochange"), + want: addr("nochange"), + wantErr: EU(nil).withType('f', stringType), + }, { + name: jsontest.Name("Strings/Invalid/True"), + inBuf: `true`, + inVal: addr("nochange"), + want: addr("nochange"), + wantErr: EU(nil).withType('t', stringType), + }, { + name: jsontest.Name("Strings/Invalid/Object"), + inBuf: `{}`, + inVal: addr("nochange"), + want: addr("nochange"), + wantErr: EU(nil).withType('{', stringType), + }, { + name: jsontest.Name("Strings/Invalid/Array"), + inBuf: `[]`, + inVal: addr("nochange"), + want: addr("nochange"), + wantErr: EU(nil).withType('[', stringType), + }, { + name: jsontest.Name("Strings/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + inBuf: `"hello"`, + inVal: addr("goodbye"), + want: addr("hello"), + }, { + name: jsontest.Name("Strings/StringifiedString"), + opts: []Options{jsonflags.StringifyBoolsAndStrings | 1}, + inBuf: `"\"foo\""`, + inVal: new(string), + want: addr("foo"), + }, { + name: jsontest.Name("Strings/StringifiedString/InvalidWhitespace"), + opts: []Options{jsonflags.StringifyBoolsAndStrings | 1}, + inBuf: `"\"foo\" "`, + inVal: new(string), + want: new(string), + wantErr: EU(newInvalidCharacterError(" ", "after string value", 0, "")).withType('"', stringType), + }, { + name: jsontest.Name("Strings/StringifiedString/InvalidString"), + opts: []Options{jsonflags.StringifyBoolsAndStrings | 1}, + inBuf: `""`, + inVal: new(string), + want: new(string), + wantErr: EU(&jsontext.SyntacticError{Err: io.ErrUnexpectedEOF}).withType('"', stringType), + }, { + name: jsontest.Name("Bytes/Null"), + inBuf: `null`, + inVal: addr([]byte("something")), + want: addr([]byte(nil)), + }, { + name: jsontest.Name("Bytes"), + inBuf: `[null,"","AQ==","AQI=","AQID"]`, + inVal: new([][]byte), + want: addr([][]byte{nil, {}, {1}, {1, 2}, {1, 2, 3}}), + }, { + name: jsontest.Name("Bytes/Large"), + inBuf: `"dGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2cgYW5kIGF0ZSB0aGUgaG9tZXdvcmsgdGhhdCBJIHNwZW50IHNvIG11Y2ggdGltZSBvbi4="`, + inVal: new([]byte), + want: addr([]byte("the quick brown fox jumped over the lazy dog and ate the homework that I spent so much time on.")), + }, { + name: jsontest.Name("Bytes/Reuse"), + inBuf: `"AQID"`, + inVal: addr([]byte("changed")), + want: addr([]byte{1, 2, 3}), + }, { + name: jsontest.Name("Bytes/Escaped"), + inBuf: `[null,"","\u0041\u0051\u003d\u003d","\u0041\u0051\u0049\u003d","\u0041\u0051\u0049\u0044"]`, + inVal: new([][]byte), + want: addr([][]byte{nil, {}, {1}, {1, 2}, {1, 2, 3}}), + }, { + name: jsontest.Name("Bytes/Named"), + inBuf: `[null,"","AQ==","AQI=","AQID"]`, + inVal: new([]namedBytes), + want: addr([]namedBytes{nil, {}, {1}, {1, 2}, {1, 2, 3}}), + }, { + name: jsontest.Name("Bytes/NotStringified"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `[null,"","AQ==","AQI=","AQID"]`, + inVal: new([][]byte), + want: addr([][]byte{nil, {}, {1}, {1, 2}, {1, 2, 3}}), + }, { + // NOTE: []namedByte is not assignable to []byte, + // so the following should be treated as a slice of uints. + name: jsontest.Name("Bytes/Invariant"), + inBuf: `[null,[],[1],[1,2],[1,2,3]]`, + inVal: new([][]namedByte), + want: addr([][]namedByte{nil, {}, {1}, {1, 2}, {1, 2, 3}}), + }, { + // NOTE: This differs in behavior from v1, + // but keeps the representation of slices and arrays more consistent. + name: jsontest.Name("Bytes/ByteArray"), + inBuf: `"aGVsbG8="`, + inVal: new([5]byte), + want: addr([5]byte{'h', 'e', 'l', 'l', 'o'}), + }, { + name: jsontest.Name("Bytes/ByteArray0/Valid"), + inBuf: `""`, + inVal: new([0]byte), + want: addr([0]byte{}), + }, { + name: jsontest.Name("Bytes/ByteArray0/Invalid"), + inBuf: `"A"`, + inVal: new([0]byte), + want: addr([0]byte{}), + wantErr: EU(func() error { + _, err := base64.StdEncoding.Decode(make([]byte, 0), []byte("A")) + return err + }()).withType('"', T[[0]byte]()), + }, { + name: jsontest.Name("Bytes/ByteArray0/Overflow"), + inBuf: `"AA=="`, + inVal: new([0]byte), + want: addr([0]byte{}), + wantErr: EU(errors.New("decoded length of 1 mismatches array length of 0")).withType('"', T[[0]byte]()), + }, { + name: jsontest.Name("Bytes/ByteArray1/Valid"), + inBuf: `"AQ=="`, + inVal: new([1]byte), + want: addr([1]byte{1}), + }, { + name: jsontest.Name("Bytes/ByteArray1/Invalid"), + inBuf: `"$$=="`, + inVal: new([1]byte), + want: addr([1]byte{}), + wantErr: EU(func() error { + _, err := base64.StdEncoding.Decode(make([]byte, 1), []byte("$$==")) + return err + }()).withType('"', T[[1]byte]()), + }, { + name: jsontest.Name("Bytes/ByteArray1/Underflow"), + inBuf: `""`, + inVal: new([1]byte), + want: addr([1]byte{}), + wantErr: EU(errors.New("decoded length of 0 mismatches array length of 1")).withType('"', T[[1]byte]()), + }, { + name: jsontest.Name("Bytes/ByteArray1/Overflow"), + inBuf: `"AQI="`, + inVal: new([1]byte), + want: addr([1]byte{1}), + wantErr: EU(errors.New("decoded length of 2 mismatches array length of 1")).withType('"', T[[1]byte]()), + }, { + name: jsontest.Name("Bytes/ByteArray2/Valid"), + inBuf: `"AQI="`, + inVal: new([2]byte), + want: addr([2]byte{1, 2}), + }, { + name: jsontest.Name("Bytes/ByteArray2/Invalid"), + inBuf: `"$$$="`, + inVal: new([2]byte), + want: addr([2]byte{}), + wantErr: EU(func() error { + _, err := base64.StdEncoding.Decode(make([]byte, 2), []byte("$$$=")) + return err + }()).withType('"', T[[2]byte]()), + }, { + name: jsontest.Name("Bytes/ByteArray2/Underflow"), + inBuf: `"AQ=="`, + inVal: new([2]byte), + want: addr([2]byte{1, 0}), + wantErr: EU(errors.New("decoded length of 1 mismatches array length of 2")).withType('"', T[[2]byte]()), + }, { + name: jsontest.Name("Bytes/ByteArray2/Underflow/Allowed"), + opts: []Options{jsonflags.UnmarshalArrayFromAnyLength | 1}, + inBuf: `"AQ=="`, + inVal: new([2]byte), + want: addr([2]byte{1, 0}), + }, { + name: jsontest.Name("Bytes/ByteArray2/Overflow"), + inBuf: `"AQID"`, + inVal: new([2]byte), + want: addr([2]byte{1, 2}), + wantErr: EU(errors.New("decoded length of 3 mismatches array length of 2")).withType('"', T[[2]byte]()), + }, { + name: jsontest.Name("Bytes/ByteArray2/Overflow/Allowed"), + opts: []Options{jsonflags.UnmarshalArrayFromAnyLength | 1}, + inBuf: `"AQID"`, + inVal: new([2]byte), + want: addr([2]byte{1, 2}), + }, { + name: jsontest.Name("Bytes/ByteArray3/Valid"), + inBuf: `"AQID"`, + inVal: new([3]byte), + want: addr([3]byte{1, 2, 3}), + }, { + name: jsontest.Name("Bytes/ByteArray3/Invalid"), + inBuf: `"$$$$"`, + inVal: new([3]byte), + want: addr([3]byte{}), + wantErr: EU(func() error { + _, err := base64.StdEncoding.Decode(make([]byte, 3), []byte("$$$$")) + return err + }()).withType('"', T[[3]byte]()), + }, { + name: jsontest.Name("Bytes/ByteArray3/Underflow"), + inBuf: `"AQI="`, + inVal: addr([3]byte{0xff, 0xff, 0xff}), + want: addr([3]byte{1, 2, 0}), + wantErr: EU(errors.New("decoded length of 2 mismatches array length of 3")).withType('"', T[[3]byte]()), + }, { + name: jsontest.Name("Bytes/ByteArray3/Overflow"), + inBuf: `"AQIDAQ=="`, + inVal: new([3]byte), + want: addr([3]byte{1, 2, 3}), + wantErr: EU(errors.New("decoded length of 4 mismatches array length of 3")).withType('"', T[[3]byte]()), + }, { + name: jsontest.Name("Bytes/ByteArray4/Valid"), + inBuf: `"AQIDBA=="`, + inVal: new([4]byte), + want: addr([4]byte{1, 2, 3, 4}), + }, { + name: jsontest.Name("Bytes/ByteArray4/Invalid"), + inBuf: `"$$$$$$=="`, + inVal: new([4]byte), + want: addr([4]byte{}), + wantErr: EU(func() error { + _, err := base64.StdEncoding.Decode(make([]byte, 4), []byte("$$$$$$==")) + return err + }()).withType('"', T[[4]byte]()), + }, { + name: jsontest.Name("Bytes/ByteArray4/Underflow"), + inBuf: `"AQID"`, + inVal: new([4]byte), + want: addr([4]byte{1, 2, 3, 0}), + wantErr: EU(errors.New("decoded length of 3 mismatches array length of 4")).withType('"', T[[4]byte]()), + }, { + name: jsontest.Name("Bytes/ByteArray4/Overflow"), + inBuf: `"AQIDBAU="`, + inVal: new([4]byte), + want: addr([4]byte{1, 2, 3, 4}), + wantErr: EU(errors.New("decoded length of 5 mismatches array length of 4")).withType('"', T[[4]byte]()), + }, { + // NOTE: []namedByte is not assignable to []byte, + // so the following should be treated as a array of uints. + name: jsontest.Name("Bytes/NamedByteArray"), + inBuf: `[104,101,108,108,111]`, + inVal: new([5]namedByte), + want: addr([5]namedByte{'h', 'e', 'l', 'l', 'o'}), + }, { + name: jsontest.Name("Bytes/Valid/Denormalized"), + inBuf: `"AR=="`, + inVal: new([]byte), + want: addr([]byte{1}), + }, { + name: jsontest.Name("Bytes/Invalid/Unpadded1"), + inBuf: `"AQ="`, + inVal: addr([]byte("nochange")), + want: addr([]byte("nochange")), + wantErr: EU(func() error { + _, err := base64.StdEncoding.Decode(make([]byte, 0), []byte("AQ=")) + return err + }()).withType('"', bytesType), + }, { + name: jsontest.Name("Bytes/Invalid/Unpadded2"), + inBuf: `"AQ"`, + inVal: addr([]byte("nochange")), + want: addr([]byte("nochange")), + wantErr: EU(func() error { + _, err := base64.StdEncoding.Decode(make([]byte, 0), []byte("AQ")) + return err + }()).withType('"', bytesType), + }, { + name: jsontest.Name("Bytes/Invalid/Character"), + inBuf: `"@@@@"`, + inVal: addr([]byte("nochange")), + want: addr([]byte("nochange")), + wantErr: EU(func() error { + _, err := base64.StdEncoding.Decode(make([]byte, 3), []byte("@@@@")) + return err + }()).withType('"', bytesType), + }, { + name: jsontest.Name("Bytes/Invalid/Bool"), + inBuf: `true`, + inVal: addr([]byte("nochange")), + want: addr([]byte("nochange")), + wantErr: EU(nil).withType('t', bytesType), + }, { + name: jsontest.Name("Bytes/Invalid/Number"), + inBuf: `0`, + inVal: addr([]byte("nochange")), + want: addr([]byte("nochange")), + wantErr: EU(nil).withType('0', bytesType), + }, { + name: jsontest.Name("Bytes/Invalid/Object"), + inBuf: `{}`, + inVal: addr([]byte("nochange")), + want: addr([]byte("nochange")), + wantErr: EU(nil).withType('{', bytesType), + }, { + name: jsontest.Name("Bytes/Invalid/Array"), + inBuf: `[]`, + inVal: addr([]byte("nochange")), + want: addr([]byte("nochange")), + wantErr: EU(nil).withType('[', bytesType), + }, { + name: jsontest.Name("Bytes/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + inBuf: `"aGVsbG8="`, + inVal: new([]byte), + want: addr([]byte("hello")), + }, { + name: jsontest.Name("Ints/Null"), + inBuf: `null`, + inVal: addr(int(1)), + want: addr(int(0)), + }, { + name: jsontest.Name("Ints/Int"), + inBuf: `1`, + inVal: addr(int(0)), + want: addr(int(1)), + }, { + name: jsontest.Name("Ints/Int8/MinOverflow"), + inBuf: `-129`, + inVal: addr(int8(-1)), + want: addr(int8(-1)), + wantErr: EU(strconv.ErrRange).withVal(`-129`).withType('0', T[int8]()), + }, { + name: jsontest.Name("Ints/Int8/Min"), + inBuf: `-128`, + inVal: addr(int8(0)), + want: addr(int8(-128)), + }, { + name: jsontest.Name("Ints/Int8/Max"), + inBuf: `127`, + inVal: addr(int8(0)), + want: addr(int8(127)), + }, { + name: jsontest.Name("Ints/Int8/MaxOverflow"), + inBuf: `128`, + inVal: addr(int8(-1)), + want: addr(int8(-1)), + wantErr: EU(strconv.ErrRange).withVal(`128`).withType('0', T[int8]()), + }, { + name: jsontest.Name("Ints/Int16/MinOverflow"), + inBuf: `-32769`, + inVal: addr(int16(-1)), + want: addr(int16(-1)), + wantErr: EU(strconv.ErrRange).withVal(`-32769`).withType('0', T[int16]()), + }, { + name: jsontest.Name("Ints/Int16/Min"), + inBuf: `-32768`, + inVal: addr(int16(0)), + want: addr(int16(-32768)), + }, { + name: jsontest.Name("Ints/Int16/Max"), + inBuf: `32767`, + inVal: addr(int16(0)), + want: addr(int16(32767)), + }, { + name: jsontest.Name("Ints/Int16/MaxOverflow"), + inBuf: `32768`, + inVal: addr(int16(-1)), + want: addr(int16(-1)), + wantErr: EU(strconv.ErrRange).withVal(`32768`).withType('0', T[int16]()), + }, { + name: jsontest.Name("Ints/Int32/MinOverflow"), + inBuf: `-2147483649`, + inVal: addr(int32(-1)), + want: addr(int32(-1)), + wantErr: EU(strconv.ErrRange).withVal(`-2147483649`).withType('0', T[int32]()), + }, { + name: jsontest.Name("Ints/Int32/Min"), + inBuf: `-2147483648`, + inVal: addr(int32(0)), + want: addr(int32(-2147483648)), + }, { + name: jsontest.Name("Ints/Int32/Max"), + inBuf: `2147483647`, + inVal: addr(int32(0)), + want: addr(int32(2147483647)), + }, { + name: jsontest.Name("Ints/Int32/MaxOverflow"), + inBuf: `2147483648`, + inVal: addr(int32(-1)), + want: addr(int32(-1)), + wantErr: EU(strconv.ErrRange).withVal(`2147483648`).withType('0', T[int32]()), + }, { + name: jsontest.Name("Ints/Int64/MinOverflow"), + inBuf: `-9223372036854775809`, + inVal: addr(int64(-1)), + want: addr(int64(-1)), + wantErr: EU(strconv.ErrRange).withVal(`-9223372036854775809`).withType('0', T[int64]()), + }, { + name: jsontest.Name("Ints/Int64/Min"), + inBuf: `-9223372036854775808`, + inVal: addr(int64(0)), + want: addr(int64(-9223372036854775808)), + }, { + name: jsontest.Name("Ints/Int64/Max"), + inBuf: `9223372036854775807`, + inVal: addr(int64(0)), + want: addr(int64(9223372036854775807)), + }, { + name: jsontest.Name("Ints/Int64/MaxOverflow"), + inBuf: `9223372036854775808`, + inVal: addr(int64(-1)), + want: addr(int64(-1)), + wantErr: EU(strconv.ErrRange).withVal(`9223372036854775808`).withType('0', T[int64]()), + }, { + name: jsontest.Name("Ints/Named"), + inBuf: `-6464`, + inVal: addr(namedInt64(0)), + want: addr(namedInt64(-6464)), + }, { + name: jsontest.Name("Ints/Stringified"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"-6464"`, + inVal: new(int), + want: addr(int(-6464)), + }, { + name: jsontest.Name("Ints/Stringified/Invalid"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `-6464`, + inVal: new(int), + want: new(int), + wantErr: EU(nil).withType('0', T[int]()), + }, { + name: jsontest.Name("Ints/Stringified/LeadingZero"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"00"`, + inVal: addr(int(-1)), + want: addr(int(-1)), + wantErr: EU(strconv.ErrSyntax).withVal(`"00"`).withType('"', T[int]()), + }, { + name: jsontest.Name("Ints/Escaped"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"\u002d\u0036\u0034\u0036\u0034"`, + inVal: new(int), + want: addr(int(-6464)), + }, { + name: jsontest.Name("Ints/Valid/NegativeZero"), + inBuf: `-0`, + inVal: addr(int(1)), + want: addr(int(0)), + }, { + name: jsontest.Name("Ints/Invalid/Fraction"), + inBuf: `1.0`, + inVal: addr(int(-1)), + want: addr(int(-1)), + wantErr: EU(strconv.ErrSyntax).withVal(`1.0`).withType('0', T[int]()), + }, { + name: jsontest.Name("Ints/Invalid/Exponent"), + inBuf: `1e0`, + inVal: addr(int(-1)), + want: addr(int(-1)), + wantErr: EU(strconv.ErrSyntax).withVal(`1e0`).withType('0', T[int]()), + }, { + name: jsontest.Name("Ints/Invalid/StringifiedFraction"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"1.0"`, + inVal: addr(int(-1)), + want: addr(int(-1)), + wantErr: EU(strconv.ErrSyntax).withVal(`"1.0"`).withType('"', T[int]()), + }, { + name: jsontest.Name("Ints/Invalid/StringifiedExponent"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"1e0"`, + inVal: addr(int(-1)), + want: addr(int(-1)), + wantErr: EU(strconv.ErrSyntax).withVal(`"1e0"`).withType('"', T[int]()), + }, { + name: jsontest.Name("Ints/Invalid/Overflow"), + inBuf: `100000000000000000000000000000`, + inVal: addr(int(-1)), + want: addr(int(-1)), + wantErr: EU(strconv.ErrRange).withVal(`100000000000000000000000000000`).withType('0', T[int]()), + }, { + name: jsontest.Name("Ints/Invalid/OverflowSyntax"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"100000000000000000000000000000x"`, + inVal: addr(int(-1)), + want: addr(int(-1)), + wantErr: EU(strconv.ErrSyntax).withVal(`"100000000000000000000000000000x"`).withType('"', T[int]()), + }, { + name: jsontest.Name("Ints/Invalid/Whitespace"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"0 "`, + inVal: addr(int(-1)), + want: addr(int(-1)), + wantErr: EU(strconv.ErrSyntax).withVal(`"0 "`).withType('"', T[int]()), + }, { + name: jsontest.Name("Ints/Invalid/Bool"), + inBuf: `true`, + inVal: addr(int(-1)), + want: addr(int(-1)), + wantErr: EU(nil).withType('t', T[int]()), + }, { + name: jsontest.Name("Ints/Invalid/String"), + inBuf: `"0"`, + inVal: addr(int(-1)), + want: addr(int(-1)), + wantErr: EU(nil).withType('"', T[int]()), + }, { + name: jsontest.Name("Ints/Invalid/Object"), + inBuf: `{}`, + inVal: addr(int(-1)), + want: addr(int(-1)), + wantErr: EU(nil).withType('{', T[int]()), + }, { + name: jsontest.Name("Ints/Invalid/Array"), + inBuf: `[]`, + inVal: addr(int(-1)), + want: addr(int(-1)), + wantErr: EU(nil).withType('[', T[int]()), + }, { + name: jsontest.Name("Ints/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + inBuf: `1`, + inVal: addr(int(0)), + want: addr(int(1)), + }, { + name: jsontest.Name("Uints/Null"), + inBuf: `null`, + inVal: addr(uint(1)), + want: addr(uint(0)), + }, { + name: jsontest.Name("Uints/Uint"), + inBuf: `1`, + inVal: addr(uint(0)), + want: addr(uint(1)), + }, { + name: jsontest.Name("Uints/Uint8/Min"), + inBuf: `0`, + inVal: addr(uint8(1)), + want: addr(uint8(0)), + }, { + name: jsontest.Name("Uints/Uint8/Max"), + inBuf: `255`, + inVal: addr(uint8(0)), + want: addr(uint8(255)), + }, { + name: jsontest.Name("Uints/Uint8/MaxOverflow"), + inBuf: `256`, + inVal: addr(uint8(1)), + want: addr(uint8(1)), + wantErr: EU(strconv.ErrRange).withVal(`256`).withType('0', T[uint8]()), + }, { + name: jsontest.Name("Uints/Uint16/Min"), + inBuf: `0`, + inVal: addr(uint16(1)), + want: addr(uint16(0)), + }, { + name: jsontest.Name("Uints/Uint16/Max"), + inBuf: `65535`, + inVal: addr(uint16(0)), + want: addr(uint16(65535)), + }, { + name: jsontest.Name("Uints/Uint16/MaxOverflow"), + inBuf: `65536`, + inVal: addr(uint16(1)), + want: addr(uint16(1)), + wantErr: EU(strconv.ErrRange).withVal(`65536`).withType('0', T[uint16]()), + }, { + name: jsontest.Name("Uints/Uint32/Min"), + inBuf: `0`, + inVal: addr(uint32(1)), + want: addr(uint32(0)), + }, { + name: jsontest.Name("Uints/Uint32/Max"), + inBuf: `4294967295`, + inVal: addr(uint32(0)), + want: addr(uint32(4294967295)), + }, { + name: jsontest.Name("Uints/Uint32/MaxOverflow"), + inBuf: `4294967296`, + inVal: addr(uint32(1)), + want: addr(uint32(1)), + wantErr: EU(strconv.ErrRange).withVal(`4294967296`).withType('0', T[uint32]()), + }, { + name: jsontest.Name("Uints/Uint64/Min"), + inBuf: `0`, + inVal: addr(uint64(1)), + want: addr(uint64(0)), + }, { + name: jsontest.Name("Uints/Uint64/Max"), + inBuf: `18446744073709551615`, + inVal: addr(uint64(0)), + want: addr(uint64(18446744073709551615)), + }, { + name: jsontest.Name("Uints/Uint64/MaxOverflow"), + inBuf: `18446744073709551616`, + inVal: addr(uint64(1)), + want: addr(uint64(1)), + wantErr: EU(strconv.ErrRange).withVal(`18446744073709551616`).withType('0', T[uint64]()), + }, { + name: jsontest.Name("Uints/Uintptr"), + inBuf: `1`, + inVal: addr(uintptr(0)), + want: addr(uintptr(1)), + }, { + name: jsontest.Name("Uints/Named"), + inBuf: `6464`, + inVal: addr(namedUint64(0)), + want: addr(namedUint64(6464)), + }, { + name: jsontest.Name("Uints/Stringified"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"6464"`, + inVal: new(uint), + want: addr(uint(6464)), + }, { + name: jsontest.Name("Uints/Stringified/Invalid"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `6464`, + inVal: new(uint), + want: new(uint), + wantErr: EU(nil).withType('0', T[uint]()), + }, { + name: jsontest.Name("Uints/Stringified/LeadingZero"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"00"`, + inVal: addr(uint(1)), + want: addr(uint(1)), + wantErr: EU(strconv.ErrSyntax).withVal(`"00"`).withType('"', T[uint]()), + }, { + name: jsontest.Name("Uints/Escaped"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"\u0036\u0034\u0036\u0034"`, + inVal: new(uint), + want: addr(uint(6464)), + }, { + name: jsontest.Name("Uints/Invalid/NegativeOne"), + inBuf: `-1`, + inVal: addr(uint(1)), + want: addr(uint(1)), + wantErr: EU(strconv.ErrSyntax).withVal(`-1`).withType('0', T[uint]()), + }, { + name: jsontest.Name("Uints/Invalid/NegativeZero"), + inBuf: `-0`, + inVal: addr(uint(1)), + want: addr(uint(1)), + wantErr: EU(strconv.ErrSyntax).withVal(`-0`).withType('0', T[uint]()), + }, { + name: jsontest.Name("Uints/Invalid/Fraction"), + inBuf: `1.0`, + inVal: addr(uint(10)), + want: addr(uint(10)), + wantErr: EU(strconv.ErrSyntax).withVal(`1.0`).withType('0', T[uint]()), + }, { + name: jsontest.Name("Uints/Invalid/Exponent"), + inBuf: `1e0`, + inVal: addr(uint(10)), + want: addr(uint(10)), + wantErr: EU(strconv.ErrSyntax).withVal(`1e0`).withType('0', T[uint]()), + }, { + name: jsontest.Name("Uints/Invalid/StringifiedFraction"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"1.0"`, + inVal: addr(uint(10)), + want: addr(uint(10)), + wantErr: EU(strconv.ErrSyntax).withVal(`"1.0"`).withType('"', T[uint]()), + }, { + name: jsontest.Name("Uints/Invalid/StringifiedExponent"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"1e0"`, + inVal: addr(uint(10)), + want: addr(uint(10)), + wantErr: EU(strconv.ErrSyntax).withVal(`"1e0"`).withType('"', T[uint]()), + }, { + name: jsontest.Name("Uints/Invalid/Overflow"), + inBuf: `100000000000000000000000000000`, + inVal: addr(uint(1)), + want: addr(uint(1)), + wantErr: EU(strconv.ErrRange).withVal(`100000000000000000000000000000`).withType('0', T[uint]()), + }, { + name: jsontest.Name("Uints/Invalid/OverflowSyntax"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"100000000000000000000000000000x"`, + inVal: addr(uint(1)), + want: addr(uint(1)), + wantErr: EU(strconv.ErrSyntax).withVal(`"100000000000000000000000000000x"`).withType('"', T[uint]()), + }, { + name: jsontest.Name("Uints/Invalid/Whitespace"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"0 "`, + inVal: addr(uint(1)), + want: addr(uint(1)), + wantErr: EU(strconv.ErrSyntax).withVal(`"0 "`).withType('"', T[uint]()), + }, { + name: jsontest.Name("Uints/Invalid/Bool"), + inBuf: `true`, + inVal: addr(uint(1)), + want: addr(uint(1)), + wantErr: EU(nil).withType('t', T[uint]()), + }, { + name: jsontest.Name("Uints/Invalid/String"), + inBuf: `"0"`, + inVal: addr(uint(1)), + want: addr(uint(1)), + wantErr: EU(nil).withType('"', T[uint]()), + }, { + name: jsontest.Name("Uints/Invalid/Object"), + inBuf: `{}`, + inVal: addr(uint(1)), + want: addr(uint(1)), + wantErr: EU(nil).withType('{', T[uint]()), + }, { + name: jsontest.Name("Uints/Invalid/Array"), + inBuf: `[]`, + inVal: addr(uint(1)), + want: addr(uint(1)), + wantErr: EU(nil).withType('[', T[uint]()), + }, { + name: jsontest.Name("Uints/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + inBuf: `1`, + inVal: addr(uint(0)), + want: addr(uint(1)), + }, { + name: jsontest.Name("Floats/Null"), + inBuf: `null`, + inVal: addr(float64(64.64)), + want: addr(float64(0)), + }, { + name: jsontest.Name("Floats/Float32/Pi"), + inBuf: `3.14159265358979323846264338327950288419716939937510582097494459`, + inVal: addr(float32(32.32)), + want: addr(float32(math.Pi)), + }, { + name: jsontest.Name("Floats/Float32/Underflow"), + inBuf: `1e-1000`, + inVal: addr(float32(32.32)), + want: addr(float32(0)), + }, { + name: jsontest.Name("Floats/Float32/Overflow"), + inBuf: `-1e1000`, + inVal: addr(float32(32.32)), + want: addr(float32(-math.MaxFloat32)), + wantErr: EU(strconv.ErrRange).withVal(`-1e1000`).withType('0', T[float32]()), + }, { + name: jsontest.Name("Floats/Float64/Pi"), + inBuf: `3.14159265358979323846264338327950288419716939937510582097494459`, + inVal: addr(float64(64.64)), + want: addr(float64(math.Pi)), + }, { + name: jsontest.Name("Floats/Float64/Underflow"), + inBuf: `1e-1000`, + inVal: addr(float64(64.64)), + want: addr(float64(0)), + }, { + name: jsontest.Name("Floats/Float64/Overflow"), + inBuf: `-1e1000`, + inVal: addr(float64(64.64)), + want: addr(float64(-math.MaxFloat64)), + wantErr: EU(strconv.ErrRange).withVal(`-1e1000`).withType('0', T[float64]()), + }, { + name: jsontest.Name("Floats/Any/Overflow"), + inBuf: `1e1000`, + inVal: new(any), + want: addr(any(float64(math.MaxFloat64))), + wantErr: EU(strconv.ErrRange).withVal(`1e1000`).withType('0', T[float64]()), + }, { + name: jsontest.Name("Floats/Named"), + inBuf: `64.64`, + inVal: addr(namedFloat64(0)), + want: addr(namedFloat64(64.64)), + }, { + name: jsontest.Name("Floats/Stringified"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"64.64"`, + inVal: new(float64), + want: addr(float64(64.64)), + }, { + name: jsontest.Name("Floats/Stringified/Invalid"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `64.64`, + inVal: new(float64), + want: new(float64), + wantErr: EU(nil).withType('0', T[float64]()), + }, { + name: jsontest.Name("Floats/Escaped"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"\u0036\u0034\u002e\u0036\u0034"`, + inVal: new(float64), + want: addr(float64(64.64)), + }, { + name: jsontest.Name("Floats/Invalid/NaN"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"NaN"`, + inVal: addr(float64(64.64)), + want: addr(float64(64.64)), + wantErr: EU(strconv.ErrSyntax).withVal(`"NaN"`).withType('"', float64Type), + }, { + name: jsontest.Name("Floats/Invalid/Infinity"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"Infinity"`, + inVal: addr(float64(64.64)), + want: addr(float64(64.64)), + wantErr: EU(strconv.ErrSyntax).withVal(`"Infinity"`).withType('"', float64Type), + }, { + name: jsontest.Name("Floats/Invalid/Whitespace"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"1 "`, + inVal: addr(float64(64.64)), + want: addr(float64(64.64)), + wantErr: EU(strconv.ErrSyntax).withVal(`"1 "`).withType('"', float64Type), + }, { + name: jsontest.Name("Floats/Invalid/GoSyntax"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `"1p-2"`, + inVal: addr(float64(64.64)), + want: addr(float64(64.64)), + wantErr: EU(strconv.ErrSyntax).withVal(`"1p-2"`).withType('"', float64Type), + }, { + name: jsontest.Name("Floats/Invalid/Bool"), + inBuf: `true`, + inVal: addr(float64(64.64)), + want: addr(float64(64.64)), + wantErr: EU(nil).withType('t', float64Type), + }, { + name: jsontest.Name("Floats/Invalid/String"), + inBuf: `"0"`, + inVal: addr(float64(64.64)), + want: addr(float64(64.64)), + wantErr: EU(nil).withType('"', float64Type), + }, { + name: jsontest.Name("Floats/Invalid/Object"), + inBuf: `{}`, + inVal: addr(float64(64.64)), + want: addr(float64(64.64)), + wantErr: EU(nil).withType('{', float64Type), + }, { + name: jsontest.Name("Floats/Invalid/Array"), + inBuf: `[]`, + inVal: addr(float64(64.64)), + want: addr(float64(64.64)), + wantErr: EU(nil).withType('[', float64Type), + }, { + name: jsontest.Name("Floats/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + inBuf: `1`, + inVal: addr(float64(0)), + want: addr(float64(1)), + }, { + name: jsontest.Name("Maps/Null"), + inBuf: `null`, + inVal: addr(map[string]string{"key": "value"}), + want: new(map[string]string), + }, { + name: jsontest.Name("Maps/InvalidKey/Bool"), + inBuf: `{"true":"false"}`, + inVal: new(map[bool]bool), + want: addr(make(map[bool]bool)), + wantErr: EU(nil).withPos(`{`, "/true").withType('"', boolType), + }, { + name: jsontest.Name("Maps/InvalidKey/NamedBool"), + inBuf: `{"true":"false"}`, + inVal: new(map[namedBool]bool), + want: addr(make(map[namedBool]bool)), + wantErr: EU(nil).withPos(`{`, "/true").withType('"', T[namedBool]()), + }, { + name: jsontest.Name("Maps/InvalidKey/Array"), + inBuf: `{"key":"value"}`, + inVal: new(map[[1]string]string), + want: addr(make(map[[1]string]string)), + wantErr: EU(nil).withPos(`{`, "/key").withType('"', T[[1]string]()), + }, { + name: jsontest.Name("Maps/InvalidKey/Channel"), + inBuf: `{"key":"value"}`, + inVal: new(map[chan string]string), + want: addr(make(map[chan string]string)), + wantErr: EU(nil).withPos(`{`, "").withType(0, T[chan string]()), + }, { + name: jsontest.Name("Maps/ValidKey/Int"), + inBuf: `{"0":0,"-1":1,"2":2,"-3":3}`, + inVal: new(map[int]int), + want: addr(map[int]int{0: 0, -1: 1, 2: 2, -3: 3}), + }, { + name: jsontest.Name("Maps/ValidKey/NamedInt"), + inBuf: `{"0":0,"-1":1,"2":2,"-3":3}`, + inVal: new(map[namedInt64]int), + want: addr(map[namedInt64]int{0: 0, -1: 1, 2: 2, -3: 3}), + }, { + name: jsontest.Name("Maps/ValidKey/Uint"), + inBuf: `{"0":0,"1":1,"2":2,"3":3}`, + inVal: new(map[uint]uint), + want: addr(map[uint]uint{0: 0, 1: 1, 2: 2, 3: 3}), + }, { + name: jsontest.Name("Maps/ValidKey/NamedUint"), + inBuf: `{"0":0,"1":1,"2":2,"3":3}`, + inVal: new(map[namedUint64]uint), + want: addr(map[namedUint64]uint{0: 0, 1: 1, 2: 2, 3: 3}), + }, { + name: jsontest.Name("Maps/ValidKey/Float"), + inBuf: `{"1.234":1.234,"12.34":12.34,"123.4":123.4}`, + inVal: new(map[float64]float64), + want: addr(map[float64]float64{1.234: 1.234, 12.34: 12.34, 123.4: 123.4}), + }, { + name: jsontest.Name("Maps/DuplicateName/Int"), + inBuf: `{"0":1,"-0":-1}`, + inVal: new(map[int]int), + want: addr(map[int]int{0: 1}), + wantErr: newDuplicateNameError("", []byte(`"-0"`), len64(`{"0":1,`)), + }, { + name: jsontest.Name("Maps/DuplicateName/Int/MergeWithLegacySemantics"), + opts: []Options{jsonflags.MergeWithLegacySemantics | 1}, + inBuf: `{"0":1,"-0":-1}`, + inVal: new(map[int]int), + want: addr(map[int]int{0: 1}), + wantErr: newDuplicateNameError("", []byte(`"-0"`), len64(`{"0":1,`)), + }, { + name: jsontest.Name("Maps/DuplicateName/Int/AllowDuplicateNames"), + opts: []Options{jsontext.AllowDuplicateNames(true)}, + inBuf: `{"0":1,"-0":-1}`, + inVal: new(map[int]int), + want: addr(map[int]int{0: -1}), // latter takes precedence + }, { + name: jsontest.Name("Maps/DuplicateName/Int/OverwriteExisting"), + inBuf: `{"-0":-1}`, + inVal: addr(map[int]int{0: 1}), + want: addr(map[int]int{0: -1}), + }, { + name: jsontest.Name("Maps/DuplicateName/Float"), + inBuf: `{"1.0":"1.0","1":"1","1e0":"1e0"}`, + inVal: new(map[float64]string), + want: addr(map[float64]string{1: "1.0"}), + wantErr: newDuplicateNameError("", []byte(`"1"`), len64(`{"1.0":"1.0",`)), + }, { + name: jsontest.Name("Maps/DuplicateName/Float/AllowDuplicateNames"), + opts: []Options{jsontext.AllowDuplicateNames(true)}, + inBuf: `{"1.0":"1.0","1":"1","1e0":"1e0"}`, + inVal: new(map[float64]string), + want: addr(map[float64]string{1: "1e0"}), // latter takes precedence + }, { + name: jsontest.Name("Maps/DuplicateName/Float/OverwriteExisting"), + inBuf: `{"1.0":"1.0"}`, + inVal: addr(map[float64]string{1: "1"}), + want: addr(map[float64]string{1: "1.0"}), + }, { + name: jsontest.Name("Maps/DuplicateName/NoCaseString"), + inBuf: `{"hello":"hello","HELLO":"HELLO"}`, + inVal: new(map[nocaseString]string), + want: addr(map[nocaseString]string{"hello": "hello"}), + wantErr: newDuplicateNameError("", []byte(`"HELLO"`), len64(`{"hello":"hello",`)), + }, { + name: jsontest.Name("Maps/DuplicateName/NoCaseString/AllowDuplicateNames"), + opts: []Options{jsontext.AllowDuplicateNames(true)}, + inBuf: `{"hello":"hello","HELLO":"HELLO"}`, + inVal: new(map[nocaseString]string), + want: addr(map[nocaseString]string{"hello": "HELLO"}), // latter takes precedence + }, { + name: jsontest.Name("Maps/DuplicateName/NoCaseString/OverwriteExisting"), + opts: []Options{jsontext.AllowDuplicateNames(true)}, + inBuf: `{"HELLO":"HELLO"}`, + inVal: addr(map[nocaseString]string{"hello": "hello"}), + want: addr(map[nocaseString]string{"hello": "HELLO"}), + }, { + name: jsontest.Name("Maps/ValidKey/Interface"), + inBuf: `{"false":"false","true":"true","string":"string","0":"0","[]":"[]","{}":"{}"}`, + inVal: new(map[any]string), + want: addr(map[any]string{ + "false": "false", + "true": "true", + "string": "string", + "0": "0", + "[]": "[]", + "{}": "{}", + }), + }, { + name: jsontest.Name("Maps/InvalidValue/Channel"), + inBuf: `{"key":"value"}`, + inVal: new(map[string]chan string), + want: addr(map[string]chan string{ + "key": nil, + }), + wantErr: EU(nil).withPos(`{"key":`, "/key").withType(0, T[chan string]()), + }, { + name: jsontest.Name("Maps/RecursiveMap"), + inBuf: `{"buzz":{},"fizz":{"bar":{},"foo":{}}}`, + inVal: new(recursiveMap), + want: addr(recursiveMap{ + "fizz": { + "foo": {}, + "bar": {}, + }, + "buzz": {}, + }), + }, { + // NOTE: The semantics differs from v1, + // where existing map entries were not merged into. + // See https://go.dev/issue/31924. + name: jsontest.Name("Maps/Merge"), + opts: []Options{jsontext.AllowDuplicateNames(true)}, + inBuf: `{"k1":{"k2":"v2"},"k2":{"k1":"v1"},"k2":{"k2":"v2"}}`, + inVal: addr(map[string]map[string]string{ + "k1": {"k1": "v1"}, + }), + want: addr(map[string]map[string]string{ + "k1": {"k1": "v1", "k2": "v2"}, + "k2": {"k1": "v1", "k2": "v2"}, + }), + }, { + name: jsontest.Name("Maps/Invalid/Bool"), + inBuf: `true`, + inVal: addr(map[string]string{"key": "value"}), + want: addr(map[string]string{"key": "value"}), + wantErr: EU(nil).withType('t', T[map[string]string]()), + }, { + name: jsontest.Name("Maps/Invalid/String"), + inBuf: `""`, + inVal: addr(map[string]string{"key": "value"}), + want: addr(map[string]string{"key": "value"}), + wantErr: EU(nil).withType('"', T[map[string]string]()), + }, { + name: jsontest.Name("Maps/Invalid/Number"), + inBuf: `0`, + inVal: addr(map[string]string{"key": "value"}), + want: addr(map[string]string{"key": "value"}), + wantErr: EU(nil).withType('0', T[map[string]string]()), + }, { + name: jsontest.Name("Maps/Invalid/Array"), + inBuf: `[]`, + inVal: addr(map[string]string{"key": "value"}), + want: addr(map[string]string{"key": "value"}), + wantErr: EU(nil).withType('[', T[map[string]string]()), + }, { + name: jsontest.Name("Maps/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + inBuf: `{"hello":"goodbye"}`, + inVal: addr(map[string]string{}), + want: addr(map[string]string{"hello": "goodbye"}), + }, { + name: jsontest.Name("Structs/Null"), + inBuf: `null`, + inVal: addr(structAll{String: "something"}), + want: addr(structAll{}), + }, { + name: jsontest.Name("Structs/Empty"), + inBuf: `{}`, + inVal: addr(structAll{ + String: "hello", + Map: map[string]string{}, + Slice: []string{}, + }), + want: addr(structAll{ + String: "hello", + Map: map[string]string{}, + Slice: []string{}, + }), + }, { + name: jsontest.Name("Structs/Normal"), + inBuf: `{ + "Bool": true, + "String": "hello", + "Bytes": "AQID", + "Int": -64, + "Uint": 64, + "Float": 3.14159, + "Map": {"key": "value"}, + "StructScalars": { + "Bool": true, + "String": "hello", + "Bytes": "AQID", + "Int": -64, + "Uint": 64, + "Float": 3.14159 + }, + "StructMaps": { + "MapBool": {"": true}, + "MapString": {"": "hello"}, + "MapBytes": {"": "AQID"}, + "MapInt": {"": -64}, + "MapUint": {"": 64}, + "MapFloat": {"": 3.14159} + }, + "StructSlices": { + "SliceBool": [true], + "SliceString": ["hello"], + "SliceBytes": ["AQID"], + "SliceInt": [-64], + "SliceUint": [64], + "SliceFloat": [3.14159] + }, + "Slice": ["fizz","buzz"], + "Array": ["goodbye"], + "Pointer": {}, + "Interface": null +}`, + inVal: new(structAll), + want: addr(structAll{ + Bool: true, + String: "hello", + Bytes: []byte{1, 2, 3}, + Int: -64, + Uint: +64, + Float: 3.14159, + Map: map[string]string{"key": "value"}, + StructScalars: structScalars{ + Bool: true, + String: "hello", + Bytes: []byte{1, 2, 3}, + Int: -64, + Uint: +64, + Float: 3.14159, + }, + StructMaps: structMaps{ + MapBool: map[string]bool{"": true}, + MapString: map[string]string{"": "hello"}, + MapBytes: map[string][]byte{"": {1, 2, 3}}, + MapInt: map[string]int64{"": -64}, + MapUint: map[string]uint64{"": +64}, + MapFloat: map[string]float64{"": 3.14159}, + }, + StructSlices: structSlices{ + SliceBool: []bool{true}, + SliceString: []string{"hello"}, + SliceBytes: [][]byte{{1, 2, 3}}, + SliceInt: []int64{-64}, + SliceUint: []uint64{+64}, + SliceFloat: []float64{3.14159}, + }, + Slice: []string{"fizz", "buzz"}, + Array: [1]string{"goodbye"}, + Pointer: new(structAll), + }), + }, { + name: jsontest.Name("Structs/Merge"), + inBuf: `{ + "Bool": false, + "String": "goodbye", + "Int": -64, + "Float": 3.14159, + "Map": {"k2": "v2"}, + "StructScalars": { + "Bool": true, + "String": "hello", + "Bytes": "AQID", + "Int": -64 + }, + "StructMaps": { + "MapBool": {"": true}, + "MapString": {"": "hello"}, + "MapBytes": {"": "AQID"}, + "MapInt": {"": -64}, + "MapUint": {"": 64}, + "MapFloat": {"": 3.14159} + }, + "StructSlices": { + "SliceString": ["hello"], + "SliceBytes": ["AQID"], + "SliceInt": [-64], + "SliceUint": [64] + }, + "Slice": ["fizz","buzz"], + "Array": ["goodbye"], + "Pointer": {}, + "Interface": {"k2":"v2"} +}`, + inVal: addr(structAll{ + Bool: true, + String: "hello", + Bytes: []byte{1, 2, 3}, + Uint: +64, + Float: math.NaN(), + Map: map[string]string{"k1": "v1"}, + StructScalars: structScalars{ + String: "hello", + Bytes: make([]byte, 2, 4), + Uint: +64, + Float: 3.14159, + }, + StructMaps: structMaps{ + MapBool: map[string]bool{"": false}, + MapBytes: map[string][]byte{"": {}}, + MapInt: map[string]int64{"": 123}, + MapFloat: map[string]float64{"": math.Inf(+1)}, + }, + StructSlices: structSlices{ + SliceBool: []bool{true}, + SliceBytes: [][]byte{nil, nil}, + SliceInt: []int64{-123}, + SliceUint: []uint64{+123}, + SliceFloat: []float64{3.14159}, + }, + Slice: []string{"buzz", "fizz", "gizz"}, + Array: [1]string{"hello"}, + Pointer: new(structAll), + Interface: map[string]string{"k1": "v1"}, + }), + want: addr(structAll{ + Bool: false, + String: "goodbye", + Bytes: []byte{1, 2, 3}, + Int: -64, + Uint: +64, + Float: 3.14159, + Map: map[string]string{"k1": "v1", "k2": "v2"}, + StructScalars: structScalars{ + Bool: true, + String: "hello", + Bytes: []byte{1, 2, 3}, + Int: -64, + Uint: +64, + Float: 3.14159, + }, + StructMaps: structMaps{ + MapBool: map[string]bool{"": true}, + MapString: map[string]string{"": "hello"}, + MapBytes: map[string][]byte{"": {1, 2, 3}}, + MapInt: map[string]int64{"": -64}, + MapUint: map[string]uint64{"": +64}, + MapFloat: map[string]float64{"": 3.14159}, + }, + StructSlices: structSlices{ + SliceBool: []bool{true}, + SliceString: []string{"hello"}, + SliceBytes: [][]byte{{1, 2, 3}}, + SliceInt: []int64{-64}, + SliceUint: []uint64{+64}, + SliceFloat: []float64{3.14159}, + }, + Slice: []string{"fizz", "buzz"}, + Array: [1]string{"goodbye"}, + Pointer: new(structAll), + Interface: map[string]string{"k1": "v1", "k2": "v2"}, + }), + }, { + name: jsontest.Name("Structs/Stringified/Normal"), + inBuf: `{ + "Bool": true, + "String": "hello", + "Bytes": "AQID", + "Int": "-64", + "Uint": "64", + "Float": "3.14159", + "Map": {"key": "value"}, + "StructScalars": { + "Bool": true, + "String": "hello", + "Bytes": "AQID", + "Int": "-64", + "Uint": "64", + "Float": "3.14159" + }, + "StructMaps": { + "MapBool": {"": true}, + "MapString": {"": "hello"}, + "MapBytes": {"": "AQID"}, + "MapInt": {"": "-64"}, + "MapUint": {"": "64"}, + "MapFloat": {"": "3.14159"} + }, + "StructSlices": { + "SliceBool": [true], + "SliceString": ["hello"], + "SliceBytes": ["AQID"], + "SliceInt": ["-64"], + "SliceUint": ["64"], + "SliceFloat": ["3.14159"] + }, + "Slice": ["fizz","buzz"], + "Array": ["goodbye"], + "Pointer": {}, + "Interface": null +}`, + inVal: new(structStringifiedAll), + want: addr(structStringifiedAll{ + Bool: true, + String: "hello", + Bytes: []byte{1, 2, 3}, + Int: -64, // may be stringified + Uint: +64, // may be stringified + Float: 3.14159, // may be stringified + Map: map[string]string{"key": "value"}, + StructScalars: structScalars{ + Bool: true, + String: "hello", + Bytes: []byte{1, 2, 3}, + Int: -64, // may be stringified + Uint: +64, // may be stringified + Float: 3.14159, // may be stringified + }, + StructMaps: structMaps{ + MapBool: map[string]bool{"": true}, + MapString: map[string]string{"": "hello"}, + MapBytes: map[string][]byte{"": {1, 2, 3}}, + MapInt: map[string]int64{"": -64}, // may be stringified + MapUint: map[string]uint64{"": +64}, // may be stringified + MapFloat: map[string]float64{"": 3.14159}, // may be stringified + }, + StructSlices: structSlices{ + SliceBool: []bool{true}, + SliceString: []string{"hello"}, + SliceBytes: [][]byte{{1, 2, 3}}, + SliceInt: []int64{-64}, // may be stringified + SliceUint: []uint64{+64}, // may be stringified + SliceFloat: []float64{3.14159}, // may be stringified + }, + Slice: []string{"fizz", "buzz"}, + Array: [1]string{"goodbye"}, + Pointer: new(structStringifiedAll), // may be stringified + }), + }, { + name: jsontest.Name("Structs/Stringified/String"), + inBuf: `{ + "Bool": true, + "String": "hello", + "Bytes": "AQID", + "Int": "-64", + "Uint": "64", + "Float": "3.14159", + "Map": {"key": "value"}, + "StructScalars": { + "Bool": true, + "String": "hello", + "Bytes": "AQID", + "Int": "-64", + "Uint": "64", + "Float": "3.14159" + }, + "StructMaps": { + "MapBool": {"": true}, + "MapString": {"": "hello"}, + "MapBytes": {"": "AQID"}, + "MapInt": {"": "-64"}, + "MapUint": {"": "64"}, + "MapFloat": {"": "3.14159"} + }, + "StructSlices": { + "SliceBool": [true], + "SliceString": ["hello"], + "SliceBytes": ["AQID"], + "SliceInt": ["-64"], + "SliceUint": ["64"], + "SliceFloat": ["3.14159"] + }, + "Slice": ["fizz","buzz"], + "Array": ["goodbye"], + "Pointer": {}, + "Interface": null +}`, + inVal: new(structStringifiedAll), + want: addr(structStringifiedAll{ + Bool: true, + String: "hello", + Bytes: []byte{1, 2, 3}, + Int: -64, // may be stringified + Uint: +64, // may be stringified + Float: 3.14159, // may be stringified + Map: map[string]string{"key": "value"}, + StructScalars: structScalars{ + Bool: true, + String: "hello", + Bytes: []byte{1, 2, 3}, + Int: -64, // may be stringified + Uint: +64, // may be stringified + Float: 3.14159, // may be stringified + }, + StructMaps: structMaps{ + MapBool: map[string]bool{"": true}, + MapString: map[string]string{"": "hello"}, + MapBytes: map[string][]byte{"": {1, 2, 3}}, + MapInt: map[string]int64{"": -64}, // may be stringified + MapUint: map[string]uint64{"": +64}, // may be stringified + MapFloat: map[string]float64{"": 3.14159}, // may be stringified + }, + StructSlices: structSlices{ + SliceBool: []bool{true}, + SliceString: []string{"hello"}, + SliceBytes: [][]byte{{1, 2, 3}}, + SliceInt: []int64{-64}, // may be stringified + SliceUint: []uint64{+64}, // may be stringified + SliceFloat: []float64{3.14159}, // may be stringified + }, + Slice: []string{"fizz", "buzz"}, + Array: [1]string{"goodbye"}, + Pointer: new(structStringifiedAll), // may be stringified + }), + }, { + name: jsontest.Name("Structs/Stringified/InvalidEmpty"), + inBuf: `{"Int":""}`, + inVal: new(structStringifiedAll), + want: new(structStringifiedAll), + wantErr: EU(strconv.ErrSyntax).withVal(`""`).withPos(`{"Int":`, "/Int").withType('"', T[int64]()), + }, { + name: jsontest.Name("Structs/LegacyStringified"), + opts: []Options{jsonflags.StringifyWithLegacySemantics | 1}, + inBuf: `{ + "Bool": "true", + "String": "\"hello\"", + "Bytes": "AQID", + "Int": "-64", + "Uint": "64", + "Float": "3.14159", + "Map": {"key": "value"}, + "StructScalars": { + "Bool": true, + "String": "hello", + "Bytes": "AQID", + "Int": -64, + "Uint": 64, + "Float": 3.14159 + }, + "StructMaps": { + "MapBool": {"": true}, + "MapString": {"": "hello"}, + "MapBytes": {"": "AQID"}, + "MapInt": {"": -64}, + "MapUint": {"": 64}, + "MapFloat": {"": 3.14159} + }, + "StructSlices": { + "SliceBool": [true], + "SliceString": ["hello"], + "SliceBytes": ["AQID"], + "SliceInt": [-64], + "SliceUint": [64], + "SliceFloat": [3.14159] + }, + "Slice": ["fizz", "buzz"], + "Array": ["goodbye"] +}`, + inVal: new(structStringifiedAll), + want: addr(structStringifiedAll{ + Bool: true, + String: "hello", + Bytes: []byte{1, 2, 3}, + Int: -64, + Uint: +64, + Float: 3.14159, + Map: map[string]string{"key": "value"}, + StructScalars: structScalars{ + Bool: true, + String: "hello", + Bytes: []byte{1, 2, 3}, + Int: -64, + Uint: +64, + Float: 3.14159, + }, + StructMaps: structMaps{ + MapBool: map[string]bool{"": true}, + MapString: map[string]string{"": "hello"}, + MapBytes: map[string][]byte{"": {1, 2, 3}}, + MapInt: map[string]int64{"": -64}, + MapUint: map[string]uint64{"": +64}, + MapFloat: map[string]float64{"": 3.14159}, + }, + StructSlices: structSlices{ + SliceBool: []bool{true}, + SliceString: []string{"hello"}, + SliceBytes: [][]byte{{1, 2, 3}}, + SliceInt: []int64{-64}, + SliceUint: []uint64{+64}, + SliceFloat: []float64{3.14159}, + }, + Slice: []string{"fizz", "buzz"}, + Array: [1]string{"goodbye"}, + }), + }, { + name: jsontest.Name("Structs/LegacyStringified/InvalidBool"), + opts: []Options{jsonflags.StringifyWithLegacySemantics | 1}, + inBuf: `{"Bool": true}`, + inVal: new(structStringifiedAll), + wantErr: EU(nil).withPos(`{"Bool": `, "/Bool").withType('t', T[bool]()), + }, { + name: jsontest.Name("Structs/LegacyStringified/InvalidString"), + opts: []Options{jsonflags.StringifyWithLegacySemantics | 1}, + inBuf: `{"String": "string"}`, + inVal: new(structStringifiedAll), + wantErr: EU(newInvalidCharacterError("s", "at start of string (expecting '\"')", 0, "")). + withPos(`{"String": `, "/String").withType('"', T[string]()), + }, { + name: jsontest.Name("Structs/Format/Bytes"), + inBuf: `{ + "Base16": "0123456789abcdef", + "Base32": "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", + "Base32Hex": "0123456789ABCDEFGHIJKLMNOPQRSTUV", + "Base64": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", + "Base64URL": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", + "Array": [1, 2, 3, 4] +}`, + inVal: new(structFormatBytes), + want: addr(structFormatBytes{ + Base16: []byte("\x01\x23\x45\x67\x89\xab\xcd\xef"), + Base32: []byte("\x00D2\x14\xc7BT\xb65τe:V\xd7\xc6u\xbew\xdf"), + Base32Hex: []byte("\x00D2\x14\xc7BT\xb65τe:V\xd7\xc6u\xbew\xdf"), + Base64: []byte("\x00\x10\x83\x10Q\x87 \x92\x8b0ӏA\x14\x93QU\x97a\x96\x9bqן\x82\x18\xa3\x92Y\xa7\xa2\x9a\xab\xb2ۯ\xc3\x1c\xb3\xd3]\xb7㞻\xf3߿"), + Base64URL: []byte("\x00\x10\x83\x10Q\x87 \x92\x8b0ӏA\x14\x93QU\x97a\x96\x9bqן\x82\x18\xa3\x92Y\xa7\xa2\x9a\xab\xb2ۯ\xc3\x1c\xb3\xd3]\xb7㞻\xf3߿"), + Array: []byte{1, 2, 3, 4}, + }), + }, { + name: jsontest.Name("Structs/Format/ArrayBytes"), + inBuf: `{ + "Base16": "01020304", + "Base32": "AEBAGBA=", + "Base32Hex": "0410610=", + "Base64": "AQIDBA==", + "Base64URL": "AQIDBA==", + "Array": [1, 2, 3, 4], + "Default": "AQIDBA==" +}`, + inVal: new(structFormatArrayBytes), + want: addr(structFormatArrayBytes{ + Base16: [4]byte{1, 2, 3, 4}, + Base32: [4]byte{1, 2, 3, 4}, + Base32Hex: [4]byte{1, 2, 3, 4}, + Base64: [4]byte{1, 2, 3, 4}, + Base64URL: [4]byte{1, 2, 3, 4}, + Array: [4]byte{1, 2, 3, 4}, + Default: [4]byte{1, 2, 3, 4}, + }), + }, { + name: jsontest.Name("Structs/Format/ArrayBytes/Legacy"), + opts: []Options{jsonflags.FormatBytesWithLegacySemantics | 1}, + inBuf: `{ + "Base16": "01020304", + "Base32": "AEBAGBA=", + "Base32Hex": "0410610=", + "Base64": "AQIDBA==", + "Base64URL": "AQIDBA==", + "Array": [1, 2, 3, 4], + "Default": [1, 2, 3, 4] +}`, + inVal: new(structFormatArrayBytes), + want: addr(structFormatArrayBytes{ + Base16: [4]byte{1, 2, 3, 4}, + Base32: [4]byte{1, 2, 3, 4}, + Base32Hex: [4]byte{1, 2, 3, 4}, + Base64: [4]byte{1, 2, 3, 4}, + Base64URL: [4]byte{1, 2, 3, 4}, + Array: [4]byte{1, 2, 3, 4}, + Default: [4]byte{1, 2, 3, 4}, + }), + }, { + name: jsontest.Name("Structs/Format/Bytes/Array"), + opts: []Options{ + WithUnmarshalers(UnmarshalFunc(func(b []byte, v *byte) error { + if string(b) == "true" { + *v = 1 + } else { + *v = 0 + } + return nil + })), + }, + inBuf: `{"Array":[false,true,false,true,false,true]}`, + inVal: new(struct { + Array []byte `json:",format:array"` + }), + want: addr(struct { + Array []byte `json:",format:array"` + }{ + Array: []byte{0, 1, 0, 1, 0, 1}, + }), + }, { + name: jsontest.Name("Structs/Format/Bytes/Invalid/Base16/WrongKind"), + inBuf: `{"Base16": [1,2,3,4]}`, + inVal: new(structFormatBytes), + wantErr: EU(nil).withPos(`{"Base16": `, "/Base16").withType('[', T[[]byte]()), + }, { + name: jsontest.Name("Structs/Format/Bytes/Invalid/Base16/AllPadding"), + inBuf: `{"Base16": "===="}`, + inVal: new(structFormatBytes), + wantErr: EU(func() error { + _, err := hex.Decode(make([]byte, 2), []byte("=====")) + return err + }()).withPos(`{"Base16": `, "/Base16").withType('"', T[[]byte]()), + }, { + name: jsontest.Name("Structs/Format/Bytes/Invalid/Base16/EvenPadding"), + inBuf: `{"Base16": "0123456789abcdef="}`, + inVal: new(structFormatBytes), + wantErr: EU(func() error { + _, err := hex.Decode(make([]byte, 8), []byte("0123456789abcdef=")) + return err + }()).withPos(`{"Base16": `, "/Base16").withType('"', T[[]byte]()), + }, { + name: jsontest.Name("Structs/Format/Bytes/Invalid/Base16/OddPadding"), + inBuf: `{"Base16": "0123456789abcdef0="}`, + inVal: new(structFormatBytes), + wantErr: EU(func() error { + _, err := hex.Decode(make([]byte, 9), []byte("0123456789abcdef0=")) + return err + }()).withPos(`{"Base16": `, "/Base16").withType('"', T[[]byte]()), + }, { + name: jsontest.Name("Structs/Format/Bytes/Invalid/Base16/NonAlphabet/LineFeed"), + inBuf: `{"Base16": "aa\naa"}`, + inVal: new(structFormatBytes), + wantErr: EU(func() error { + _, err := hex.Decode(make([]byte, 9), []byte("aa\naa")) + return err + }()).withPos(`{"Base16": `, "/Base16").withType('"', T[[]byte]()), + }, { + name: jsontest.Name("Structs/Format/Bytes/Invalid/Base16/NonAlphabet/CarriageReturn"), + inBuf: `{"Base16": "aa\raa"}`, + inVal: new(structFormatBytes), + wantErr: EU(func() error { + _, err := hex.Decode(make([]byte, 9), []byte("aa\raa")) + return err + }()).withPos(`{"Base16": `, "/Base16").withType('"', T[[]byte]()), + }, { + name: jsontest.Name("Structs/Format/Bytes/Invalid/Base16/NonAlphabet/Space"), + inBuf: `{"Base16": "aa aa"}`, + inVal: new(structFormatBytes), + wantErr: EU(func() error { + _, err := hex.Decode(make([]byte, 9), []byte("aa aa")) + return err + }()).withPos(`{"Base16": `, "/Base16").withType('"', T[[]byte]()), + }, { + name: jsontest.Name("Structs/Format/Bytes/Invalid/Base32/Padding"), + inBuf: `[ + {"Base32": "NA======"}, + {"Base32": "NBSQ===="}, + {"Base32": "NBSWY==="}, + {"Base32": "NBSWY3A="}, + {"Base32": "NBSWY3DP"} + ]`, + inVal: new([]structFormatBytes), + want: addr([]structFormatBytes{ + {Base32: []byte("h")}, + {Base32: []byte("he")}, + {Base32: []byte("hel")}, + {Base32: []byte("hell")}, + {Base32: []byte("hello")}, + }), + }, { + name: jsontest.Name("Structs/Format/Bytes/Invalid/Base32/Invalid/NoPadding"), + inBuf: `[ + {"Base32": "NA"}, + {"Base32": "NBSQ"}, + {"Base32": "NBSWY"}, + {"Base32": "NBSWY3A"}, + {"Base32": "NBSWY3DP"} + ]`, + inVal: new([]structFormatBytes), + wantErr: EU(func() error { + _, err := base32.StdEncoding.Decode(make([]byte, 1), []byte("NA")) + return err + }()).withPos(`[`+"\n\t\t\t\t"+`{"Base32": `, "/0/Base32").withType('"', T[[]byte]()), + }, { + name: jsontest.Name("Structs/Format/Bytes/Invalid/Base32/WrongAlphabet"), + inBuf: `{"Base32": "0123456789ABCDEFGHIJKLMNOPQRSTUV"}`, + inVal: new(structFormatBytes), + wantErr: EU(func() error { + _, err := base32.StdEncoding.Decode(make([]byte, 20), []byte("0123456789ABCDEFGHIJKLMNOPQRSTUV")) + return err + }()).withPos(`{"Base32": `, "/Base32").withType('"', T[[]byte]()), + }, { + name: jsontest.Name("Structs/Format/Bytes/Invalid/Base32Hex/WrongAlphabet"), + inBuf: `{"Base32Hex": "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"}`, + inVal: new(structFormatBytes), + wantErr: EU(func() error { + _, err := base32.HexEncoding.Decode(make([]byte, 20), []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567")) + return err + }()).withPos(`{"Base32Hex": `, "/Base32Hex").withType('"', T[[]byte]()), + }, { + name: jsontest.Name("Structs/Format/Bytes/Invalid/Base32/NonAlphabet/LineFeed"), + inBuf: `{"Base32": "AAAA\nAAAA"}`, + inVal: new(structFormatBytes), + wantErr: EU(errors.New("illegal character '\\n' at offset 4")).withPos(`{"Base32": `, "/Base32").withType('"', T[[]byte]()), + }, { + name: jsontest.Name("Structs/Format/Bytes/Invalid/Base32/NonAlphabet/CarriageReturn"), + inBuf: `{"Base32": "AAAA\rAAAA"}`, + inVal: new(structFormatBytes), + wantErr: EU(errors.New("illegal character '\\r' at offset 4")).withPos(`{"Base32": `, "/Base32").withType('"', T[[]byte]()), + }, { + name: jsontest.Name("Structs/Format/Bytes/Invalid/Base32/NonAlphabet/Space"), + inBuf: `{"Base32": "AAAA AAAA"}`, + inVal: new(structFormatBytes), + wantErr: EU(base32.CorruptInputError(4)).withPos(`{"Base32": `, "/Base32").withType('"', T[[]byte]()), + }, { + name: jsontest.Name("Structs/Format/Bytes/Invalid/Base64/WrongAlphabet"), + inBuf: `{"Base64": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}`, + inVal: new(structFormatBytes), + wantErr: EU(func() error { + _, err := base64.StdEncoding.Decode(make([]byte, 48), []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_")) + return err + }()).withPos(`{"Base64": `, "/Base64").withType('"', T[[]byte]()), + }, { + name: jsontest.Name("Structs/Format/Bytes/Invalid/Base64URL/WrongAlphabet"), + inBuf: `{"Base64URL": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"}`, + inVal: new(structFormatBytes), + wantErr: EU(func() error { + _, err := base64.URLEncoding.Decode(make([]byte, 48), []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")) + return err + }()).withPos(`{"Base64URL": `, "/Base64URL").withType('"', T[[]byte]()), + }, { + name: jsontest.Name("Structs/Format/Bytes/Invalid/Base64/NonAlphabet/LineFeed"), + inBuf: `{"Base64": "aa=\n="}`, + inVal: new(structFormatBytes), + wantErr: EU(errors.New("illegal character '\\n' at offset 3")).withPos(`{"Base64": `, "/Base64").withType('"', T[[]byte]()), + }, { + name: jsontest.Name("Structs/Format/Bytes/Invalid/Base64/NonAlphabet/CarriageReturn"), + inBuf: `{"Base64": "aa=\r="}`, + inVal: new(structFormatBytes), + wantErr: EU(errors.New("illegal character '\\r' at offset 3")).withPos(`{"Base64": `, "/Base64").withType('"', T[[]byte]()), + }, { + name: jsontest.Name("Structs/Format/Bytes/Base64/NonAlphabet/Ignored"), + opts: []Options{jsonflags.ParseBytesWithLooseRFC4648 | 1}, + inBuf: `{"Base64": "aa=\r\n="}`, + inVal: new(structFormatBytes), + want: &structFormatBytes{Base64: []byte{105}}, + }, { + name: jsontest.Name("Structs/Format/Bytes/Invalid/Base64/NonAlphabet/Space"), + inBuf: `{"Base64": "aa= ="}`, + inVal: new(structFormatBytes), + wantErr: EU(base64.CorruptInputError(2)).withPos(`{"Base64": `, "/Base64").withType('"', T[[]byte]()), + }, { + name: jsontest.Name("Structs/Format/Floats"), + inBuf: `[ + {"NonFinite": 3.141592653589793, "PointerNonFinite": 3.141592653589793}, + {"NonFinite": "-Infinity", "PointerNonFinite": "-Infinity"}, + {"NonFinite": "Infinity", "PointerNonFinite": "Infinity"} +]`, + inVal: new([]structFormatFloats), + want: addr([]structFormatFloats{ + {NonFinite: math.Pi, PointerNonFinite: addr(math.Pi)}, + {NonFinite: math.Inf(-1), PointerNonFinite: addr(math.Inf(-1))}, + {NonFinite: math.Inf(+1), PointerNonFinite: addr(math.Inf(+1))}, + }), + }, { + name: jsontest.Name("Structs/Format/Floats/NaN"), + inBuf: `{"NonFinite": "NaN"}`, + inVal: new(structFormatFloats), + // Avoid checking want since reflect.DeepEqual fails for NaNs. + }, { + name: jsontest.Name("Structs/Format/Floats/Invalid/NaN"), + inBuf: `{"NonFinite": "nan"}`, + inVal: new(structFormatFloats), + wantErr: EU(nil).withPos(`{"NonFinite": `, "/NonFinite").withType('"', T[float64]()), + }, { + name: jsontest.Name("Structs/Format/Floats/Invalid/PositiveInfinity"), + inBuf: `{"NonFinite": "+Infinity"}`, + inVal: new(structFormatFloats), + wantErr: EU(nil).withPos(`{"NonFinite": `, "/NonFinite").withType('"', T[float64]()), + }, { + name: jsontest.Name("Structs/Format/Floats/Invalid/NegativeInfinitySpace"), + inBuf: `{"NonFinite": "-Infinity "}`, + inVal: new(structFormatFloats), + wantErr: EU(nil).withPos(`{"NonFinite": `, "/NonFinite").withType('"', T[float64]()), + }, { + name: jsontest.Name("Structs/Format/Maps"), + inBuf: `[ + {"EmitNull": null, "PointerEmitNull": null, "EmitEmpty": null, "PointerEmitEmpty": null, "EmitDefault": null, "PointerEmitDefault": null}, + {"EmitNull": {}, "PointerEmitNull": {}, "EmitEmpty": {}, "PointerEmitEmpty": {}, "EmitDefault": {}, "PointerEmitDefault": {}}, + {"EmitNull": {"k": "v"}, "PointerEmitNull": {"k": "v"}, "EmitEmpty": {"k": "v"}, "PointerEmitEmpty": {"k": "v"}, "EmitDefault": {"k": "v"}, "PointerEmitDefault": {"k": "v"}} +]`, + inVal: new([]structFormatMaps), + want: addr([]structFormatMaps{{ + EmitNull: map[string]string(nil), PointerEmitNull: (*map[string]string)(nil), + EmitEmpty: map[string]string(nil), PointerEmitEmpty: (*map[string]string)(nil), + EmitDefault: map[string]string(nil), PointerEmitDefault: (*map[string]string)(nil), + }, { + EmitNull: map[string]string{}, PointerEmitNull: addr(map[string]string{}), + EmitEmpty: map[string]string{}, PointerEmitEmpty: addr(map[string]string{}), + EmitDefault: map[string]string{}, PointerEmitDefault: addr(map[string]string{}), + }, { + EmitNull: map[string]string{"k": "v"}, PointerEmitNull: addr(map[string]string{"k": "v"}), + EmitEmpty: map[string]string{"k": "v"}, PointerEmitEmpty: addr(map[string]string{"k": "v"}), + EmitDefault: map[string]string{"k": "v"}, PointerEmitDefault: addr(map[string]string{"k": "v"}), + }}), + }, { + name: jsontest.Name("Structs/Format/Slices"), + inBuf: `[ + {"EmitNull": null, "PointerEmitNull": null, "EmitEmpty": null, "PointerEmitEmpty": null, "EmitDefault": null, "PointerEmitDefault": null}, + {"EmitNull": [], "PointerEmitNull": [], "EmitEmpty": [], "PointerEmitEmpty": [], "EmitDefault": [], "PointerEmitDefault": []}, + {"EmitNull": ["v"], "PointerEmitNull": ["v"], "EmitEmpty": ["v"], "PointerEmitEmpty": ["v"], "EmitDefault": ["v"], "PointerEmitDefault": ["v"]} +]`, + inVal: new([]structFormatSlices), + want: addr([]structFormatSlices{{ + EmitNull: []string(nil), PointerEmitNull: (*[]string)(nil), + EmitEmpty: []string(nil), PointerEmitEmpty: (*[]string)(nil), + EmitDefault: []string(nil), PointerEmitDefault: (*[]string)(nil), + }, { + EmitNull: []string{}, PointerEmitNull: addr([]string{}), + EmitEmpty: []string{}, PointerEmitEmpty: addr([]string{}), + EmitDefault: []string{}, PointerEmitDefault: addr([]string{}), + }, { + EmitNull: []string{"v"}, PointerEmitNull: addr([]string{"v"}), + EmitEmpty: []string{"v"}, PointerEmitEmpty: addr([]string{"v"}), + EmitDefault: []string{"v"}, PointerEmitDefault: addr([]string{"v"}), + }}), + }, { + name: jsontest.Name("Structs/Format/Invalid/Bool"), + inBuf: `{"Bool":true}`, + inVal: new(structFormatInvalid), + wantErr: EU(errInvalidFormatFlag).withPos(`{"Bool":`, "/Bool").withType(0, T[bool]()), + }, { + name: jsontest.Name("Structs/Format/Invalid/String"), + inBuf: `{"String": "string"}`, + inVal: new(structFormatInvalid), + wantErr: EU(errInvalidFormatFlag).withPos(`{"String": `, "/String").withType(0, T[string]()), + }, { + name: jsontest.Name("Structs/Format/Invalid/Bytes"), + inBuf: `{"Bytes": "bytes"}`, + inVal: new(structFormatInvalid), + wantErr: EU(errInvalidFormatFlag).withPos(`{"Bytes": `, "/Bytes").withType(0, T[[]byte]()), + }, { + name: jsontest.Name("Structs/Format/Invalid/Int"), + inBuf: `{"Int": 1}`, + inVal: new(structFormatInvalid), + wantErr: EU(errInvalidFormatFlag).withPos(`{"Int": `, "/Int").withType(0, T[int64]()), + }, { + name: jsontest.Name("Structs/Format/Invalid/Uint"), + inBuf: `{"Uint": 1}`, + inVal: new(structFormatInvalid), + wantErr: EU(errInvalidFormatFlag).withPos(`{"Uint": `, "/Uint").withType(0, T[uint64]()), + }, { + name: jsontest.Name("Structs/Format/Invalid/Float"), + inBuf: `{"Float" : 1}`, + inVal: new(structFormatInvalid), + wantErr: EU(errInvalidFormatFlag).withPos(`{"Float" : `, "/Float").withType(0, T[float64]()), + }, { + name: jsontest.Name("Structs/Format/Invalid/Map"), + inBuf: `{"Map":{}}`, + inVal: new(structFormatInvalid), + wantErr: EU(errInvalidFormatFlag).withPos(`{"Map":`, "/Map").withType(0, T[map[string]string]()), + }, { + name: jsontest.Name("Structs/Format/Invalid/Struct"), + inBuf: `{"Struct": {}}`, + inVal: new(structFormatInvalid), + wantErr: EU(errInvalidFormatFlag).withPos(`{"Struct": `, "/Struct").withType(0, T[structAll]()), + }, { + name: jsontest.Name("Structs/Format/Invalid/Slice"), + inBuf: `{"Slice": {}}`, + inVal: new(structFormatInvalid), + wantErr: EU(errInvalidFormatFlag).withPos(`{"Slice": `, "/Slice").withType(0, T[[]string]()), + }, { + name: jsontest.Name("Structs/Format/Invalid/Array"), + inBuf: `{"Array": []}`, + inVal: new(structFormatInvalid), + wantErr: EU(errInvalidFormatFlag).withPos(`{"Array": `, "/Array").withType(0, T[[1]string]()), + }, { + name: jsontest.Name("Structs/Format/Invalid/Interface"), + inBuf: `{"Interface": "anything"}`, + inVal: new(structFormatInvalid), + wantErr: EU(errInvalidFormatFlag).withPos(`{"Interface": `, "/Interface").withType(0, T[any]()), + }, { + name: jsontest.Name("Structs/Inline/Zero"), + inBuf: `{"D":""}`, + inVal: new(structInlined), + want: new(structInlined), + }, { + name: jsontest.Name("Structs/Inline/Alloc"), + inBuf: `{"E":"","F":"","G":"","A":"","B":"","D":""}`, + inVal: new(structInlined), + want: addr(structInlined{ + X: structInlinedL1{ + X: &structInlinedL2{}, + StructEmbed1: StructEmbed1{}, + }, + StructEmbed2: &StructEmbed2{}, + }), + }, { + name: jsontest.Name("Structs/Inline/NonZero"), + inBuf: `{"E":"E3","F":"F3","G":"G3","A":"A1","B":"B1","D":"D2"}`, + inVal: new(structInlined), + want: addr(structInlined{ + X: structInlinedL1{ + X: &structInlinedL2{A: "A1", B: "B1" /* C: "C1" */}, + StructEmbed1: StructEmbed1{ /* C: "C2" */ D: "D2" /* E: "E2" */}, + }, + StructEmbed2: &StructEmbed2{E: "E3", F: "F3", G: "G3"}, + }), + }, { + name: jsontest.Name("Structs/Inline/Merge"), + inBuf: `{"E":"E3","F":"F3","G":"G3","A":"A1","B":"B1","D":"D2"}`, + inVal: addr(structInlined{ + X: structInlinedL1{ + X: &structInlinedL2{B: "##", C: "C1"}, + StructEmbed1: StructEmbed1{C: "C2", E: "E2"}, + }, + StructEmbed2: &StructEmbed2{E: "##", G: "G3"}, + }), + want: addr(structInlined{ + X: structInlinedL1{ + X: &structInlinedL2{A: "A1", B: "B1", C: "C1"}, + StructEmbed1: StructEmbed1{C: "C2", D: "D2", E: "E2"}, + }, + StructEmbed2: &StructEmbed2{E: "E3", F: "F3", G: "G3"}, + }), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/Noop"), + inBuf: `{"A":1,"B":2}`, + inVal: new(structInlineTextValue), + want: addr(structInlineTextValue{A: 1, X: jsontext.Value(nil), B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/MergeN1/Nil"), + inBuf: `{"A":1,"fizz":"buzz","B":2}`, + inVal: new(structInlineTextValue), + want: addr(structInlineTextValue{A: 1, X: jsontext.Value(`{"fizz":"buzz"}`), B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/MergeN1/Empty"), + inBuf: `{"A":1,"fizz":"buzz","B":2}`, + inVal: addr(structInlineTextValue{X: jsontext.Value{}}), + want: addr(structInlineTextValue{A: 1, X: jsontext.Value(`{"fizz":"buzz"}`), B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/MergeN1/Whitespace"), + inBuf: `{"A":1,"fizz":"buzz","B":2}`, + inVal: addr(structInlineTextValue{X: jsontext.Value("\n\r\t ")}), + want: addr(structInlineTextValue{A: 1, X: jsontext.Value("")}), + wantErr: EU(errRawInlinedNotObject).withPos(`{"A":1,`, "/fizz").withType('"', T[jsontext.Value]()), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/MergeN1/Null"), + inBuf: `{"A":1,"fizz":"buzz","B":2}`, + inVal: addr(structInlineTextValue{X: jsontext.Value("null")}), + want: addr(structInlineTextValue{A: 1, X: jsontext.Value("null")}), + wantErr: EU(errRawInlinedNotObject).withPos(`{"A":1,`, "/fizz").withType('"', T[jsontext.Value]()), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/MergeN1/ObjectN0"), + inBuf: `{"A":1,"fizz":"buzz","B":2}`, + inVal: addr(structInlineTextValue{X: jsontext.Value(` { } `)}), + want: addr(structInlineTextValue{A: 1, X: jsontext.Value(` {"fizz":"buzz"}`), B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/MergeN2/ObjectN1"), + inBuf: `{"A":1,"fizz":"buzz","B":2,"foo": [ 1 , 2 , 3 ]}`, + inVal: addr(structInlineTextValue{X: jsontext.Value(` { "fizz" : "buzz" } `)}), + want: addr(structInlineTextValue{A: 1, X: jsontext.Value(` { "fizz" : "buzz","fizz":"buzz","foo":[ 1 , 2 , 3 ]}`), B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/Merge/EndObject"), + inBuf: `{"A":1,"fizz":"buzz","B":2}`, + inVal: addr(structInlineTextValue{X: jsontext.Value(` } `)}), + // NOTE: This produces invalid output, + // but the value being merged into is already invalid. + want: addr(structInlineTextValue{A: 1, X: jsontext.Value(`,"fizz":"buzz"}`), B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/MergeInvalidValue"), + inBuf: `{"A":1,"fizz":nil,"B":2}`, + inVal: new(structInlineTextValue), + want: addr(structInlineTextValue{A: 1, X: jsontext.Value(`{"fizz":`)}), + wantErr: newInvalidCharacterError("i", "in literal null (expecting 'u')", len64(`{"A":1,"fizz":n`), "/fizz"), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/CaseSensitive"), + inBuf: `{"A":1,"fizz":"buzz","B":2,"a":3}`, + inVal: new(structInlineTextValue), + want: addr(structInlineTextValue{A: 1, X: jsontext.Value(`{"fizz":"buzz","a":3}`), B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/RejectDuplicateNames"), + opts: []Options{jsontext.AllowDuplicateNames(false)}, + inBuf: `{"A":1,"fizz":"buzz","B":2,"fizz":"buzz"}`, + inVal: new(structInlineTextValue), + want: addr(structInlineTextValue{A: 1, X: jsontext.Value(`{"fizz":"buzz"}`), B: 2}), + wantErr: newDuplicateNameError("", []byte(`"fizz"`), len64(`{"A":1,"fizz":"buzz","B":2,`)), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/AllowDuplicateNames"), + opts: []Options{jsontext.AllowDuplicateNames(true)}, + inBuf: `{"A":1,"fizz":"buzz","B":2,"fizz":"buzz"}`, + inVal: new(structInlineTextValue), + want: addr(structInlineTextValue{A: 1, X: jsontext.Value(`{"fizz":"buzz","fizz":"buzz"}`), B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/Nested/Noop"), + inBuf: `{}`, + inVal: new(structInlinePointerInlineTextValue), + want: new(structInlinePointerInlineTextValue), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/Nested/Alloc"), + inBuf: `{"A":1,"fizz":"buzz"}`, + inVal: new(structInlinePointerInlineTextValue), + want: addr(structInlinePointerInlineTextValue{ + X: &struct { + A int + X jsontext.Value `json:",inline"` + }{A: 1, X: jsontext.Value(`{"fizz":"buzz"}`)}, + }), + }, { + name: jsontest.Name("Structs/InlinedFallback/TextValue/Nested/Merge"), + inBuf: `{"fizz":"buzz"}`, + inVal: addr(structInlinePointerInlineTextValue{ + X: &struct { + A int + X jsontext.Value `json:",inline"` + }{A: 1}, + }), + want: addr(structInlinePointerInlineTextValue{ + X: &struct { + A int + X jsontext.Value `json:",inline"` + }{A: 1, X: jsontext.Value(`{"fizz":"buzz"}`)}, + }), + }, { + name: jsontest.Name("Structs/InlinedFallback/PointerTextValue/Noop"), + inBuf: `{"A":1,"B":2}`, + inVal: new(structInlinePointerTextValue), + want: addr(structInlinePointerTextValue{A: 1, X: nil, B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/PointerTextValue/Alloc"), + inBuf: `{"A":1,"fizz":"buzz","B":2}`, + inVal: new(structInlinePointerTextValue), + want: addr(structInlinePointerTextValue{A: 1, X: addr(jsontext.Value(`{"fizz":"buzz"}`)), B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/PointerTextValue/Merge"), + inBuf: `{"A":1,"fizz":"buzz","B":2}`, + inVal: addr(structInlinePointerTextValue{X: addr(jsontext.Value(`{"fizz":"buzz"}`))}), + want: addr(structInlinePointerTextValue{A: 1, X: addr(jsontext.Value(`{"fizz":"buzz","fizz":"buzz"}`)), B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/PointerTextValue/Nested/Nil"), + inBuf: `{"fizz":"buzz"}`, + inVal: new(structInlineInlinePointerTextValue), + want: addr(structInlineInlinePointerTextValue{ + X: struct { + X *jsontext.Value `json:",inline"` + }{X: addr(jsontext.Value(`{"fizz":"buzz"}`))}, + }), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/Noop"), + inBuf: `{"A":1,"B":2}`, + inVal: new(structInlineMapStringAny), + want: addr(structInlineMapStringAny{A: 1, X: nil, B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/MergeN1/Nil"), + inBuf: `{"A":1,"fizz":"buzz","B":2}`, + inVal: new(structInlineMapStringAny), + want: addr(structInlineMapStringAny{A: 1, X: jsonObject{"fizz": "buzz"}, B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/MergeN1/Empty"), + inBuf: `{"A":1,"fizz":"buzz","B":2}`, + inVal: addr(structInlineMapStringAny{X: jsonObject{}}), + want: addr(structInlineMapStringAny{A: 1, X: jsonObject{"fizz": "buzz"}, B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/MergeN1/ObjectN1"), + inBuf: `{"A":1,"fizz":{"charlie":"DELTA","echo":"foxtrot"},"B":2}`, + inVal: addr(structInlineMapStringAny{X: jsonObject{"fizz": jsonObject{ + "alpha": "bravo", + "charlie": "delta", + }}}), + want: addr(structInlineMapStringAny{A: 1, X: jsonObject{"fizz": jsonObject{ + "alpha": "bravo", + "charlie": "DELTA", + "echo": "foxtrot", + }}, B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/MergeN2/ObjectN1"), + inBuf: `{"A":1,"fizz":"buzz","B":2,"foo": [ 1 , 2 , 3 ]}`, + inVal: addr(structInlineMapStringAny{X: jsonObject{"fizz": "wuzz"}}), + want: addr(structInlineMapStringAny{A: 1, X: jsonObject{"fizz": "buzz", "foo": jsonArray{1.0, 2.0, 3.0}}, B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/MergeInvalidValue"), + inBuf: `{"A":1,"fizz":nil,"B":2}`, + inVal: new(structInlineMapStringAny), + want: addr(structInlineMapStringAny{A: 1, X: jsonObject{"fizz": nil}}), + wantErr: newInvalidCharacterError("i", "in literal null (expecting 'u')", len64(`{"A":1,"fizz":n`), "/fizz"), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/MergeInvalidValue/Existing"), + inBuf: `{"A":1,"fizz":nil,"B":2}`, + inVal: addr(structInlineMapStringAny{A: 1, X: jsonObject{"fizz": true}}), + want: addr(structInlineMapStringAny{A: 1, X: jsonObject{"fizz": true}}), + wantErr: newInvalidCharacterError("i", "in literal null (expecting 'u')", len64(`{"A":1,"fizz":n`), "/fizz"), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/CaseSensitive"), + inBuf: `{"A":1,"fizz":"buzz","B":2,"a":3}`, + inVal: new(structInlineMapStringAny), + want: addr(structInlineMapStringAny{A: 1, X: jsonObject{"fizz": "buzz", "a": 3.0}, B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/RejectDuplicateNames"), + opts: []Options{jsontext.AllowDuplicateNames(false)}, + inBuf: `{"A":1,"fizz":"buzz","B":2,"fizz":"buzz"}`, + inVal: new(structInlineMapStringAny), + want: addr(structInlineMapStringAny{A: 1, X: jsonObject{"fizz": "buzz"}, B: 2}), + wantErr: newDuplicateNameError("", []byte(`"fizz"`), len64(`{"A":1,"fizz":"buzz","B":2,`)), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/AllowDuplicateNames"), + opts: []Options{jsontext.AllowDuplicateNames(true)}, + inBuf: `{"A":1,"fizz":{"one":1,"two":-2},"B":2,"fizz":{"two":2,"three":3}}`, + inVal: new(structInlineMapStringAny), + want: addr(structInlineMapStringAny{A: 1, X: jsonObject{"fizz": jsonObject{"one": 1.0, "two": 2.0, "three": 3.0}}, B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/Nested/Noop"), + inBuf: `{}`, + inVal: new(structInlinePointerInlineMapStringAny), + want: new(structInlinePointerInlineMapStringAny), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/Nested/Alloc"), + inBuf: `{"A":1,"fizz":"buzz"}`, + inVal: new(structInlinePointerInlineMapStringAny), + want: addr(structInlinePointerInlineMapStringAny{ + X: &struct { + A int + X jsonObject `json:",inline"` + }{A: 1, X: jsonObject{"fizz": "buzz"}}, + }), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringAny/Nested/Merge"), + inBuf: `{"fizz":"buzz"}`, + inVal: addr(structInlinePointerInlineMapStringAny{ + X: &struct { + A int + X jsonObject `json:",inline"` + }{A: 1}, + }), + want: addr(structInlinePointerInlineMapStringAny{ + X: &struct { + A int + X jsonObject `json:",inline"` + }{A: 1, X: jsonObject{"fizz": "buzz"}}, + }), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringInt/UnmarshalFunc"), + opts: []Options{ + WithUnmarshalers(UnmarshalFunc(func(b []byte, v *any) error { + var err error + *v, err = strconv.ParseFloat(string(bytes.Trim(b, `"`)), 64) + return err + })), + }, + inBuf: `{"D":"1.1","E":"2.2","F":"3.3"}`, + inVal: new(structInlineMapStringAny), + want: addr(structInlineMapStringAny{X: jsonObject{"D": 1.1, "E": 2.2, "F": 3.3}}), + }, { + name: jsontest.Name("Structs/InlinedFallback/PointerMapStringAny/Noop"), + inBuf: `{"A":1,"B":2}`, + inVal: new(structInlinePointerMapStringAny), + want: addr(structInlinePointerMapStringAny{A: 1, X: nil, B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/PointerMapStringAny/Alloc"), + inBuf: `{"A":1,"fizz":"buzz","B":2}`, + inVal: new(structInlinePointerMapStringAny), + want: addr(structInlinePointerMapStringAny{A: 1, X: addr(jsonObject{"fizz": "buzz"}), B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/PointerMapStringAny/Merge"), + inBuf: `{"A":1,"fizz":"wuzz","B":2}`, + inVal: addr(structInlinePointerMapStringAny{X: addr(jsonObject{"fizz": "buzz"})}), + want: addr(structInlinePointerMapStringAny{A: 1, X: addr(jsonObject{"fizz": "wuzz"}), B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/PointerMapStringAny/Nested/Nil"), + inBuf: `{"fizz":"buzz"}`, + inVal: new(structInlineInlinePointerMapStringAny), + want: addr(structInlineInlinePointerMapStringAny{ + X: struct { + X *jsonObject `json:",inline"` + }{X: addr(jsonObject{"fizz": "buzz"})}, + }), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringInt"), + inBuf: `{"zero": 0, "one": 1, "two": 2}`, + inVal: new(structInlineMapStringInt), + want: addr(structInlineMapStringInt{ + X: map[string]int{"zero": 0, "one": 1, "two": 2}, + }), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringInt/Null"), + inBuf: `{"zero": 0, "one": null, "two": 2}`, + inVal: new(structInlineMapStringInt), + want: addr(structInlineMapStringInt{ + X: map[string]int{"zero": 0, "one": 0, "two": 2}, + }), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringInt/Invalid"), + inBuf: `{"zero": 0, "one": {}, "two": 2}`, + inVal: new(structInlineMapStringInt), + want: addr(structInlineMapStringInt{ + X: map[string]int{"zero": 0, "one": 0}, + }), + wantErr: EU(nil).withPos(`{"zero": 0, "one": `, "/one").withType('{', T[int]()), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringInt/StringifiedNumbers"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `{"zero": "0", "one": "1", "two": "2"}`, + inVal: new(structInlineMapStringInt), + want: addr(structInlineMapStringInt{ + X: map[string]int{"zero": 0, "one": 1, "two": 2}, + }), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapStringInt/UnmarshalFunc"), + opts: []Options{ + WithUnmarshalers(UnmarshalFunc(func(b []byte, v *int) error { + i, err := strconv.ParseInt(string(bytes.Trim(b, `"`)), 10, 64) + if err != nil { + return err + } + *v = int(i) + return nil + })), + }, + inBuf: `{"zero": "0", "one": "1", "two": "2"}`, + inVal: new(structInlineMapStringInt), + want: addr(structInlineMapStringInt{ + X: map[string]int{"zero": 0, "one": 1, "two": 2}, + }), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringInt"), + inBuf: `{"zero": 0, "one": 1, "two": 2}`, + inVal: new(structInlineMapNamedStringInt), + want: addr(structInlineMapNamedStringInt{ + X: map[namedString]int{"zero": 0, "one": 1, "two": 2}, + }), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringInt/Null"), + inBuf: `{"zero": 0, "one": null, "two": 2}`, + inVal: new(structInlineMapNamedStringInt), + want: addr(structInlineMapNamedStringInt{ + X: map[namedString]int{"zero": 0, "one": 0, "two": 2}, + }), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringInt/Invalid"), + inBuf: `{"zero": 0, "one": {}, "two": 2}`, + inVal: new(structInlineMapNamedStringInt), + want: addr(structInlineMapNamedStringInt{ + X: map[namedString]int{"zero": 0, "one": 0}, + }), + wantErr: EU(nil).withPos(`{"zero": 0, "one": `, "/one").withType('{', T[int]()), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringInt/StringifiedNumbers"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `{"zero": "0", "one": 1, "two": "2"}`, + inVal: new(structInlineMapNamedStringInt), + want: addr(structInlineMapNamedStringInt{ + X: map[namedString]int{"zero": 0, "one": 0}, + }), + wantErr: EU(nil).withPos(`{"zero": "0", "one": `, "/one").withType('0', T[int]()), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringInt/UnmarshalFunc"), + opts: []Options{ + WithUnmarshalers(UnmarshalFunc(func(b []byte, v *int) error { + i, err := strconv.ParseInt(string(bytes.Trim(b, `"`)), 10, 64) + if err != nil { + return err + } + *v = int(i) + return nil + })), + }, + inBuf: `{"zero": "0", "one": "1", "two": "2"}`, + inVal: new(structInlineMapNamedStringInt), + want: addr(structInlineMapNamedStringInt{ + X: map[namedString]int{"zero": 0, "one": 1, "two": 2}, + }), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringAny/Noop"), + inBuf: `{"A":1,"B":2}`, + inVal: new(structInlineMapNamedStringAny), + want: addr(structInlineMapNamedStringAny{A: 1, X: nil, B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringAny/MergeN1/Nil"), + inBuf: `{"A":1,"fizz":"buzz","B":2}`, + inVal: new(structInlineMapNamedStringAny), + want: addr(structInlineMapNamedStringAny{A: 1, X: map[namedString]any{"fizz": "buzz"}, B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringAny/MergeN1/Empty"), + inBuf: `{"A":1,"fizz":"buzz","B":2}`, + inVal: addr(structInlineMapNamedStringAny{X: map[namedString]any{}}), + want: addr(structInlineMapNamedStringAny{A: 1, X: map[namedString]any{"fizz": "buzz"}, B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringAny/MergeN1/ObjectN1"), + inBuf: `{"A":1,"fizz":{"charlie":"DELTA","echo":"foxtrot"},"B":2}`, + inVal: addr(structInlineMapNamedStringAny{X: map[namedString]any{"fizz": jsonObject{ + "alpha": "bravo", + "charlie": "delta", + }}}), + want: addr(structInlineMapNamedStringAny{A: 1, X: map[namedString]any{"fizz": jsonObject{ + "alpha": "bravo", + "charlie": "DELTA", + "echo": "foxtrot", + }}, B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringAny/MergeN2/ObjectN1"), + inBuf: `{"A":1,"fizz":"buzz","B":2,"foo": [ 1 , 2 , 3 ]}`, + inVal: addr(structInlineMapNamedStringAny{X: map[namedString]any{"fizz": "wuzz"}}), + want: addr(structInlineMapNamedStringAny{A: 1, X: map[namedString]any{"fizz": "buzz", "foo": jsonArray{1.0, 2.0, 3.0}}, B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringAny/MergeInvalidValue"), + inBuf: `{"A":1,"fizz":nil,"B":2}`, + inVal: new(structInlineMapNamedStringAny), + want: addr(structInlineMapNamedStringAny{A: 1, X: map[namedString]any{"fizz": nil}}), + wantErr: newInvalidCharacterError("i", "in literal null (expecting 'u')", len64(`{"A":1,"fizz":n`), "/fizz"), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringAny/MergeInvalidValue/Existing"), + inBuf: `{"A":1,"fizz":nil,"B":2}`, + inVal: addr(structInlineMapNamedStringAny{A: 1, X: map[namedString]any{"fizz": true}}), + want: addr(structInlineMapNamedStringAny{A: 1, X: map[namedString]any{"fizz": true}}), + wantErr: newInvalidCharacterError("i", "in literal null (expecting 'u')", len64(`{"A":1,"fizz":n`), "/fizz"), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringAny/CaseSensitive"), + inBuf: `{"A":1,"fizz":"buzz","B":2,"a":3}`, + inVal: new(structInlineMapNamedStringAny), + want: addr(structInlineMapNamedStringAny{A: 1, X: map[namedString]any{"fizz": "buzz", "a": 3.0}, B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringAny/RejectDuplicateNames"), + opts: []Options{jsontext.AllowDuplicateNames(false)}, + inBuf: `{"A":1,"fizz":"buzz","B":2,"fizz":"buzz"}`, + inVal: new(structInlineMapNamedStringAny), + want: addr(structInlineMapNamedStringAny{A: 1, X: map[namedString]any{"fizz": "buzz"}, B: 2}), + wantErr: newDuplicateNameError("", []byte(`"fizz"`), len64(`{"A":1,"fizz":"buzz","B":2,`)), + }, { + name: jsontest.Name("Structs/InlinedFallback/MapNamedStringAny/AllowDuplicateNames"), + opts: []Options{jsontext.AllowDuplicateNames(true)}, + inBuf: `{"A":1,"fizz":{"one":1,"two":-2},"B":2,"fizz":{"two":2,"three":3}}`, + inVal: new(structInlineMapNamedStringAny), + want: addr(structInlineMapNamedStringAny{A: 1, X: map[namedString]any{"fizz": map[string]any{"one": 1.0, "two": 2.0, "three": 3.0}}, B: 2}), + }, { + name: jsontest.Name("Structs/InlinedFallback/RejectUnknownMembers"), + opts: []Options{RejectUnknownMembers(true)}, + inBuf: `{"A":1,"fizz":"buzz","B":2}`, + inVal: new(structInlineTextValue), + // NOTE: DiscardUnknownMembers has no effect since this is "inline". + want: addr(structInlineTextValue{ + A: 1, + X: jsontext.Value(`{"fizz":"buzz"}`), + B: 2, + }), + }, { + name: jsontest.Name("Structs/UnknownFallback/RejectUnknownMembers"), + opts: []Options{RejectUnknownMembers(true)}, + inBuf: `{"A":1,"fizz":"buzz","B":2}`, + inVal: new(structUnknownTextValue), + want: addr(structUnknownTextValue{A: 1}), + wantErr: EU(ErrUnknownName).withPos(`{"A":1,`, "/fizz").withType('"', T[structUnknownTextValue]()), + }, { + name: jsontest.Name("Structs/UnknownFallback"), + inBuf: `{"A":1,"fizz":"buzz","B":2}`, + inVal: new(structUnknownTextValue), + want: addr(structUnknownTextValue{ + A: 1, + X: jsontext.Value(`{"fizz":"buzz"}`), + B: 2, + }), + }, { + name: jsontest.Name("Structs/UnknownIgnored"), + opts: []Options{RejectUnknownMembers(false)}, + inBuf: `{"unknown":"fizzbuzz"}`, + inVal: new(structAll), + want: new(structAll), + }, { + name: jsontest.Name("Structs/RejectUnknownMembers"), + opts: []Options{RejectUnknownMembers(true)}, + inBuf: `{"unknown":"fizzbuzz"}`, + inVal: new(structAll), + want: new(structAll), + wantErr: EU(ErrUnknownName).withPos(`{`, "/unknown").withType('"', T[structAll]()), + }, { + name: jsontest.Name("Structs/UnexportedIgnored"), + inBuf: `{"ignored":"unused"}`, + inVal: new(structUnexportedIgnored), + want: new(structUnexportedIgnored), + }, { + name: jsontest.Name("Structs/IgnoredUnexportedEmbedded"), + inBuf: `{"namedString":"unused"}`, + inVal: new(structIgnoredUnexportedEmbedded), + want: new(structIgnoredUnexportedEmbedded), + }, { + name: jsontest.Name("Structs/WeirdNames"), + inBuf: `{"":"empty",",":"comma","\"":"quote"}`, + inVal: new(structWeirdNames), + want: addr(structWeirdNames{Empty: "empty", Comma: "comma", Quote: "quote"}), + }, { + name: jsontest.Name("Structs/NoCase/Exact"), + inBuf: `{"Aaa":"Aaa","AA_A":"AA_A","AaA":"AaA","AAa":"AAa","AAA":"AAA"}`, + inVal: new(structNoCase), + want: addr(structNoCase{AaA: "AaA", AAa: "AAa", Aaa: "Aaa", AAA: "AAA", AA_A: "AA_A"}), + }, { + name: jsontest.Name("Structs/NoCase/CaseInsensitiveDefault"), + inBuf: `{"aa_a":"aa_a"}`, + inVal: new(structNoCase), + want: addr(structNoCase{AaA: "aa_a"}), + }, { + name: jsontest.Name("Structs/NoCase/MatchCaseSensitiveDelimiter"), + opts: []Options{jsonflags.MatchCaseSensitiveDelimiter | 1}, + inBuf: `{"aa_a":"aa_a"}`, + inVal: new(structNoCase), + want: addr(structNoCase{}), + }, { + name: jsontest.Name("Structs/NoCase/MatchCaseInsensitiveNames+MatchCaseSensitiveDelimiter"), + opts: []Options{MatchCaseInsensitiveNames(true), jsonflags.MatchCaseSensitiveDelimiter | 1}, + inBuf: `{"aa_a":"aa_a"}`, + inVal: new(structNoCase), + want: addr(structNoCase{AA_A: "aa_a"}), + }, { + name: jsontest.Name("Structs/NoCase/Merge/AllowDuplicateNames"), + opts: []Options{jsontext.AllowDuplicateNames(true)}, + inBuf: `{"AaA":"AaA","aaa":"aaa","aAa":"aAa"}`, + inVal: new(structNoCase), + want: addr(structNoCase{AaA: "aAa"}), + }, { + name: jsontest.Name("Structs/NoCase/Merge/RejectDuplicateNames"), + opts: []Options{jsontext.AllowDuplicateNames(false)}, + inBuf: `{"AaA":"AaA","aaa":"aaa"}`, + inVal: new(structNoCase), + want: addr(structNoCase{AaA: "AaA"}), + wantErr: newDuplicateNameError("", []byte(`"aaa"`), len64(`{"AaA":"AaA",`)), + }, { + name: jsontest.Name("Structs/CaseSensitive"), + inBuf: `{"BOOL": true, "STRING": "hello", "BYTES": "AQID", "INT": -64, "UINT": 64, "FLOAT": 3.14159}`, + inVal: new(structScalars), + want: addr(structScalars{}), + }, { + name: jsontest.Name("Structs/DuplicateName/NoCase/ExactDifferent"), + inBuf: `{"AAA":"AAA","AaA":"AaA","AAa":"AAa","Aaa":"Aaa"}`, + inVal: addr(structNoCaseInlineTextValue{}), + want: addr(structNoCaseInlineTextValue{AAA: "AAA", AaA: "AaA", AAa: "AAa", Aaa: "Aaa"}), + }, { + name: jsontest.Name("Structs/DuplicateName/NoCase/ExactConflict"), + inBuf: `{"AAA":"AAA","AAA":"AAA"}`, + inVal: addr(structNoCaseInlineTextValue{}), + want: addr(structNoCaseInlineTextValue{AAA: "AAA"}), + wantErr: newDuplicateNameError("", []byte(`"AAA"`), len64(`{"AAA":"AAA",`)), + }, { + name: jsontest.Name("Structs/DuplicateName/NoCase/OverwriteExact"), + inBuf: `{"AAA":"after"}`, + inVal: addr(structNoCaseInlineTextValue{AAA: "before"}), + want: addr(structNoCaseInlineTextValue{AAA: "after"}), + }, { + name: jsontest.Name("Structs/DuplicateName/NoCase/NoCaseConflict"), + inBuf: `{"aaa":"aaa","aaA":"aaA"}`, + inVal: addr(structNoCaseInlineTextValue{}), + want: addr(structNoCaseInlineTextValue{AaA: "aaa"}), + wantErr: newDuplicateNameError("", []byte(`"aaA"`), len64(`{"aaa":"aaa",`)), + }, { + name: jsontest.Name("Structs/DuplicateName/NoCase/OverwriteNoCase"), + inBuf: `{"aaa":"aaa","aaA":"aaA"}`, + inVal: addr(structNoCaseInlineTextValue{}), + want: addr(structNoCaseInlineTextValue{AaA: "aaa"}), + wantErr: newDuplicateNameError("", []byte(`"aaA"`), len64(`{"aaa":"aaa",`)), + }, { + name: jsontest.Name("Structs/DuplicateName/Inline/Unknown"), + inBuf: `{"unknown":""}`, + inVal: addr(structNoCaseInlineTextValue{}), + want: addr(structNoCaseInlineTextValue{X: jsontext.Value(`{"unknown":""}`)}), + }, { + name: jsontest.Name("Structs/DuplicateName/Inline/UnknownMerge"), + inBuf: `{"unknown":""}`, + inVal: addr(structNoCaseInlineTextValue{X: jsontext.Value(`{"unknown":""}`)}), + want: addr(structNoCaseInlineTextValue{X: jsontext.Value(`{"unknown":"","unknown":""}`)}), + }, { + name: jsontest.Name("Structs/DuplicateName/Inline/NoCaseOkay"), + inBuf: `{"b":"","B":""}`, + inVal: addr(structNoCaseInlineTextValue{}), + want: addr(structNoCaseInlineTextValue{X: jsontext.Value(`{"b":"","B":""}`)}), + }, { + name: jsontest.Name("Structs/DuplicateName/Inline/ExactConflict"), + inBuf: `{"b":"","b":""}`, + inVal: addr(structNoCaseInlineTextValue{}), + want: addr(structNoCaseInlineTextValue{X: jsontext.Value(`{"b":""}`)}), + wantErr: newDuplicateNameError("", []byte(`"b"`), len64(`{"b":"",`)), + }, { + name: jsontest.Name("Structs/Invalid/ErrUnexpectedEOF"), + inBuf: ``, + inVal: addr(structAll{}), + want: addr(structAll{}), + wantErr: &jsontext.SyntacticError{Err: io.ErrUnexpectedEOF}, + }, { + name: jsontest.Name("Structs/Invalid/ErrUnexpectedEOF"), + inBuf: " \n\r\t", + inVal: addr(structAll{}), + want: addr(structAll{}), + wantErr: &jsontext.SyntacticError{Err: io.ErrUnexpectedEOF, ByteOffset: len64(" \n\r\t")}, + }, { + name: jsontest.Name("Structs/Invalid/NestedErrUnexpectedEOF"), + inBuf: `{"Pointer":`, + inVal: addr(structAll{}), + want: addr(structAll{Pointer: new(structAll)}), + wantErr: &jsontext.SyntacticError{ByteOffset: len64(`{"Pointer":`), JSONPointer: "/Pointer", Err: io.ErrUnexpectedEOF}, + }, { + name: jsontest.Name("Structs/Invalid/Conflicting"), + inBuf: `{}`, + inVal: addr(structConflicting{}), + want: addr(structConflicting{}), + wantErr: EU(errors.New(`Go struct fields A and B conflict over JSON object name "conflict"`)).withType('{', T[structConflicting]()), + }, { + name: jsontest.Name("Structs/Invalid/NoneExported"), + inBuf: ` {}`, + inVal: addr(structNoneExported{}), + want: addr(structNoneExported{}), + wantErr: EU(errNoExportedFields).withPos(` `, "").withType('{', T[structNoneExported]()), + }, { + name: jsontest.Name("Structs/Invalid/MalformedTag"), + inBuf: `{}`, + inVal: addr(structMalformedTag{}), + want: addr(structMalformedTag{}), + wantErr: EU(errors.New("Go struct field Malformed has malformed `json` tag: invalid character '\"' at start of option (expecting Unicode letter or single quote)")).withType('{', T[structMalformedTag]()), + }, { + name: jsontest.Name("Structs/Invalid/UnexportedTag"), + inBuf: `{}`, + inVal: addr(structUnexportedTag{}), + want: addr(structUnexportedTag{}), + wantErr: EU(errors.New("unexported Go struct field unexported cannot have non-ignored `json:\"name\"` tag")).withType('{', T[structUnexportedTag]()), + }, { + name: jsontest.Name("Structs/Invalid/ExportedEmbedded"), + inBuf: `{"NamedString":"hello"}`, + inVal: addr(structExportedEmbedded{}), + want: addr(structExportedEmbedded{}), + wantErr: EU(errors.New("embedded Go struct field NamedString of non-struct type must be explicitly given a JSON name")).withType('{', T[structExportedEmbedded]()), + }, { + name: jsontest.Name("Structs/Valid/ExportedEmbedded"), + opts: []Options{jsonflags.ReportErrorsWithLegacySemantics | 1}, + inBuf: `{"NamedString":"hello"}`, + inVal: addr(structExportedEmbedded{}), + want: addr(structExportedEmbedded{"hello"}), + }, { + name: jsontest.Name("Structs/Valid/ExportedEmbeddedTag"), + inBuf: `{"name":"hello"}`, + inVal: addr(structExportedEmbeddedTag{}), + want: addr(structExportedEmbeddedTag{"hello"}), + }, { + name: jsontest.Name("Structs/Invalid/UnexportedEmbedded"), + inBuf: `{}`, + inVal: addr(structUnexportedEmbedded{}), + want: addr(structUnexportedEmbedded{}), + wantErr: EU(errors.New("embedded Go struct field namedString of non-struct type must be explicitly given a JSON name")).withType('{', T[structUnexportedEmbedded]()), + }, { + name: jsontest.Name("Structs/UnexportedEmbeddedStruct"), + inBuf: `{"Bool":true,"FizzBuzz":5,"Addr":"192.168.0.1"}`, + inVal: addr(structUnexportedEmbeddedStruct{}), + want: addr(structUnexportedEmbeddedStruct{structOmitZeroAll{Bool: true}, 5, structNestedAddr{netip.AddrFrom4([4]byte{192, 168, 0, 1})}}), + }, { + name: jsontest.Name("Structs/UnexportedEmbeddedStructPointer/Nil"), + inBuf: `{"Bool":true,"FizzBuzz":5}`, + inVal: addr(structUnexportedEmbeddedStructPointer{}), + wantErr: EU(errNilField).withPos(`{"Bool":`, "/Bool").withType(0, T[structUnexportedEmbeddedStructPointer]()), + }, { + name: jsontest.Name("Structs/UnexportedEmbeddedStructPointer/Nil"), + inBuf: `{"FizzBuzz":5,"Addr":"192.168.0.1"}`, + inVal: addr(structUnexportedEmbeddedStructPointer{}), + wantErr: EU(errNilField).withPos(`{"FizzBuzz":5,"Addr":`, "/Addr").withType(0, T[structUnexportedEmbeddedStructPointer]()), + }, { + name: jsontest.Name("Structs/UnexportedEmbeddedStructPointer/Nil"), + inBuf: `{"Bool":true,"FizzBuzz":10,"Addr":"192.168.0.1"}`, + inVal: addr(structUnexportedEmbeddedStructPointer{&structOmitZeroAll{Int: 5}, 5, &structNestedAddr{netip.AddrFrom4([4]byte{127, 0, 0, 1})}}), + want: addr(structUnexportedEmbeddedStructPointer{&structOmitZeroAll{Bool: true, Int: 5}, 10, &structNestedAddr{netip.AddrFrom4([4]byte{192, 168, 0, 1})}}), + }, { + name: jsontest.Name("Structs/Unknown"), + inBuf: `{ + "object0": {}, + "object1": {"key1": "value"}, + "object2": {"key1": "value", "key2": "value"}, + "objects": {"":{"":{"":{}}}}, + "array0": [], + "array1": ["value1"], + "array2": ["value1", "value2"], + "array": [[[]]], + "scalars": [null, false, true, "string", 12.345] +}`, + inVal: addr(struct{}{}), + want: addr(struct{}{}), + }, { + name: jsontest.Name("Structs/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + inBuf: `{"Field":"Value"}`, + inVal: addr(struct{ Field string }{}), + want: addr(struct{ Field string }{"Value"}), + }, { + name: jsontest.Name("Slices/Null"), + inBuf: `null`, + inVal: addr([]string{"something"}), + want: addr([]string(nil)), + }, { + name: jsontest.Name("Slices/Bool"), + inBuf: `[true,false]`, + inVal: new([]bool), + want: addr([]bool{true, false}), + }, { + name: jsontest.Name("Slices/String"), + inBuf: `["hello","goodbye"]`, + inVal: new([]string), + want: addr([]string{"hello", "goodbye"}), + }, { + name: jsontest.Name("Slices/Bytes"), + inBuf: `["aGVsbG8=","Z29vZGJ5ZQ=="]`, + inVal: new([][]byte), + want: addr([][]byte{[]byte("hello"), []byte("goodbye")}), + }, { + name: jsontest.Name("Slices/Int"), + inBuf: `[-2,-1,0,1,2]`, + inVal: new([]int), + want: addr([]int{-2, -1, 0, 1, 2}), + }, { + name: jsontest.Name("Slices/Uint"), + inBuf: `[0,1,2,3,4]`, + inVal: new([]uint), + want: addr([]uint{0, 1, 2, 3, 4}), + }, { + name: jsontest.Name("Slices/Float"), + inBuf: `[3.14159,12.34]`, + inVal: new([]float64), + want: addr([]float64{3.14159, 12.34}), + }, { + // NOTE: The semantics differs from v1, where the slice length is reset + // and new elements are appended to the end. + // See https://go.dev/issue/21092. + name: jsontest.Name("Slices/Merge"), + inBuf: `[{"k3":"v3"},{"k4":"v4"}]`, + inVal: addr([]map[string]string{{"k1": "v1"}, {"k2": "v2"}}[:1]), + want: addr([]map[string]string{{"k3": "v3"}, {"k4": "v4"}}), + }, { + name: jsontest.Name("Slices/Invalid/Channel"), + inBuf: `["hello"]`, + inVal: new([]chan string), + want: addr([]chan string{nil}), + wantErr: EU(nil).withPos(`[`, "/0").withType(0, T[chan string]()), + }, { + name: jsontest.Name("Slices/RecursiveSlice"), + inBuf: `[[],[],[[]],[[],[]]]`, + inVal: new(recursiveSlice), + want: addr(recursiveSlice{ + {}, + {}, + {{}}, + {{}, {}}, + }), + }, { + name: jsontest.Name("Slices/Invalid/Bool"), + inBuf: `true`, + inVal: addr([]string{"nochange"}), + want: addr([]string{"nochange"}), + wantErr: EU(nil).withType('t', T[[]string]()), + }, { + name: jsontest.Name("Slices/Invalid/String"), + inBuf: `""`, + inVal: addr([]string{"nochange"}), + want: addr([]string{"nochange"}), + wantErr: EU(nil).withType('"', T[[]string]()), + }, { + name: jsontest.Name("Slices/Invalid/Number"), + inBuf: `0`, + inVal: addr([]string{"nochange"}), + want: addr([]string{"nochange"}), + wantErr: EU(nil).withType('0', T[[]string]()), + }, { + name: jsontest.Name("Slices/Invalid/Object"), + inBuf: `{}`, + inVal: addr([]string{"nochange"}), + want: addr([]string{"nochange"}), + wantErr: EU(nil).withType('{', T[[]string]()), + }, { + name: jsontest.Name("Slices/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + inBuf: `[false,true]`, + inVal: addr([]bool{true, false}), + want: addr([]bool{false, true}), + }, { + name: jsontest.Name("Arrays/Null"), + inBuf: `null`, + inVal: addr([1]string{"something"}), + want: addr([1]string{}), + }, { + name: jsontest.Name("Arrays/Bool"), + inBuf: `[true,false]`, + inVal: new([2]bool), + want: addr([2]bool{true, false}), + }, { + name: jsontest.Name("Arrays/String"), + inBuf: `["hello","goodbye"]`, + inVal: new([2]string), + want: addr([2]string{"hello", "goodbye"}), + }, { + name: jsontest.Name("Arrays/Bytes"), + inBuf: `["aGVsbG8=","Z29vZGJ5ZQ=="]`, + inVal: new([2][]byte), + want: addr([2][]byte{[]byte("hello"), []byte("goodbye")}), + }, { + name: jsontest.Name("Arrays/Int"), + inBuf: `[-2,-1,0,1,2]`, + inVal: new([5]int), + want: addr([5]int{-2, -1, 0, 1, 2}), + }, { + name: jsontest.Name("Arrays/Uint"), + inBuf: `[0,1,2,3,4]`, + inVal: new([5]uint), + want: addr([5]uint{0, 1, 2, 3, 4}), + }, { + name: jsontest.Name("Arrays/Float"), + inBuf: `[3.14159,12.34]`, + inVal: new([2]float64), + want: addr([2]float64{3.14159, 12.34}), + }, { + // NOTE: The semantics differs from v1, where elements are not merged. + // This is to maintain consistent merge semantics with slices. + name: jsontest.Name("Arrays/Merge"), + inBuf: `[{"k3":"v3"},{"k4":"v4"}]`, + inVal: addr([2]map[string]string{{"k1": "v1"}, {"k2": "v2"}}), + want: addr([2]map[string]string{{"k3": "v3"}, {"k4": "v4"}}), + }, { + name: jsontest.Name("Arrays/Invalid/Channel"), + inBuf: `["hello"]`, + inVal: new([1]chan string), + want: new([1]chan string), + wantErr: EU(nil).withPos(`[`, "/0").withType(0, T[chan string]()), + }, { + name: jsontest.Name("Arrays/Invalid/Underflow"), + inBuf: `{"F":[ ]}`, + inVal: new(struct{ F [1]string }), + want: addr(struct{ F [1]string }{}), + wantErr: EU(errArrayUnderflow).withPos(`{"F":[ `, "/F").withType(']', T[[1]string]()), + }, { + name: jsontest.Name("Arrays/Invalid/Underflow/UnmarshalArrayFromAnyLength"), + opts: []Options{jsonflags.UnmarshalArrayFromAnyLength | 1}, + inBuf: `[-1,-2]`, + inVal: addr([4]int{1, 2, 3, 4}), + want: addr([4]int{-1, -2, 0, 0}), + }, { + name: jsontest.Name("Arrays/Invalid/Overflow"), + inBuf: `["1","2"]`, + inVal: new([1]string), + want: addr([1]string{"1"}), + wantErr: EU(errArrayOverflow).withPos(`["1","2"`, "").withType(']', T[[1]string]()), + }, { + name: jsontest.Name("Arrays/Invalid/Overflow/UnmarshalArrayFromAnyLength"), + opts: []Options{jsonflags.UnmarshalArrayFromAnyLength | 1}, + inBuf: `[-1,-2,-3,-4,-5,-6]`, + inVal: addr([4]int{1, 2, 3, 4}), + want: addr([4]int{-1, -2, -3, -4}), + }, { + name: jsontest.Name("Arrays/Invalid/Bool"), + inBuf: `true`, + inVal: addr([1]string{"nochange"}), + want: addr([1]string{"nochange"}), + wantErr: EU(nil).withType('t', T[[1]string]()), + }, { + name: jsontest.Name("Arrays/Invalid/String"), + inBuf: `""`, + inVal: addr([1]string{"nochange"}), + want: addr([1]string{"nochange"}), + wantErr: EU(nil).withType('"', T[[1]string]()), + }, { + name: jsontest.Name("Arrays/Invalid/Number"), + inBuf: `0`, + inVal: addr([1]string{"nochange"}), + want: addr([1]string{"nochange"}), + wantErr: EU(nil).withType('0', T[[1]string]()), + }, { + name: jsontest.Name("Arrays/Invalid/Object"), + inBuf: `{}`, + inVal: addr([1]string{"nochange"}), + want: addr([1]string{"nochange"}), + wantErr: EU(nil).withType('{', T[[1]string]()), + }, { + name: jsontest.Name("Arrays/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + inBuf: `[false,true]`, + inVal: addr([2]bool{true, false}), + want: addr([2]bool{false, true}), + }, { + name: jsontest.Name("Pointers/NullL0"), + inBuf: `null`, + inVal: new(*string), + want: addr((*string)(nil)), + }, { + name: jsontest.Name("Pointers/NullL1"), + inBuf: `null`, + inVal: addr(new(*string)), + want: addr((**string)(nil)), + }, { + name: jsontest.Name("Pointers/Bool"), + inBuf: `true`, + inVal: addr(new(bool)), + want: addr(addr(true)), + }, { + name: jsontest.Name("Pointers/String"), + inBuf: `"hello"`, + inVal: addr(new(string)), + want: addr(addr("hello")), + }, { + name: jsontest.Name("Pointers/Bytes"), + inBuf: `"aGVsbG8="`, + inVal: addr(new([]byte)), + want: addr(addr([]byte("hello"))), + }, { + name: jsontest.Name("Pointers/Int"), + inBuf: `-123`, + inVal: addr(new(int)), + want: addr(addr(int(-123))), + }, { + name: jsontest.Name("Pointers/Uint"), + inBuf: `123`, + inVal: addr(new(int)), + want: addr(addr(int(123))), + }, { + name: jsontest.Name("Pointers/Float"), + inBuf: `123.456`, + inVal: addr(new(float64)), + want: addr(addr(float64(123.456))), + }, { + name: jsontest.Name("Pointers/Allocate"), + inBuf: `"hello"`, + inVal: addr((*string)(nil)), + want: addr(addr("hello")), + }, { + name: jsontest.Name("Points/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + inBuf: `true`, + inVal: addr(new(bool)), + want: addr(addr(true)), + }, { + name: jsontest.Name("Interfaces/Empty/Null"), + inBuf: `null`, + inVal: new(any), + want: new(any), + }, { + name: jsontest.Name("Interfaces/NonEmpty/Null"), + inBuf: `null`, + inVal: new(io.Reader), + want: new(io.Reader), + }, { + name: jsontest.Name("Interfaces/NonEmpty/Invalid"), + inBuf: `"hello"`, + inVal: new(io.Reader), + want: new(io.Reader), + wantErr: EU(internal.ErrNilInterface).withType(0, T[io.Reader]()), + }, { + name: jsontest.Name("Interfaces/Empty/False"), + inBuf: `false`, + inVal: new(any), + want: func() any { + var vi any = false + return &vi + }(), + }, { + name: jsontest.Name("Interfaces/Empty/True"), + inBuf: `true`, + inVal: new(any), + want: func() any { + var vi any = true + return &vi + }(), + }, { + name: jsontest.Name("Interfaces/Empty/String"), + inBuf: `"string"`, + inVal: new(any), + want: func() any { + var vi any = "string" + return &vi + }(), + }, { + name: jsontest.Name("Interfaces/Empty/Number"), + inBuf: `3.14159`, + inVal: new(any), + want: func() any { + var vi any = 3.14159 + return &vi + }(), + }, { + name: jsontest.Name("Interfaces/Empty/Object"), + inBuf: `{"k":"v"}`, + inVal: new(any), + want: func() any { + var vi any = map[string]any{"k": "v"} + return &vi + }(), + }, { + name: jsontest.Name("Interfaces/Empty/Array"), + inBuf: `["v"]`, + inVal: new(any), + want: func() any { + var vi any = []any{"v"} + return &vi + }(), + }, { + name: jsontest.Name("Interfaces/NamedAny/String"), + inBuf: `"string"`, + inVal: new(namedAny), + want: func() namedAny { + var vi namedAny = "string" + return &vi + }(), + }, { + name: jsontest.Name("Interfaces/Invalid"), + inBuf: `]`, + inVal: new(any), + want: new(any), + wantErr: newInvalidCharacterError("]", "at start of value", 0, ""), + }, { + // NOTE: The semantics differs from v1, + // where existing map entries were not merged into. + // See https://go.dev/issue/26946. + // See https://go.dev/issue/33993. + name: jsontest.Name("Interfaces/Merge/Map"), + inBuf: `{"k2":"v2"}`, + inVal: func() any { + var vi any = map[string]string{"k1": "v1"} + return &vi + }(), + want: func() any { + var vi any = map[string]string{"k1": "v1", "k2": "v2"} + return &vi + }(), + }, { + name: jsontest.Name("Interfaces/Merge/Struct"), + inBuf: `{"Array":["goodbye"]}`, + inVal: func() any { + var vi any = structAll{String: "hello"} + return &vi + }(), + want: func() any { + var vi any = structAll{String: "hello", Array: [1]string{"goodbye"}} + return &vi + }(), + }, { + name: jsontest.Name("Interfaces/Merge/NamedInt"), + inBuf: `64`, + inVal: func() any { + var vi any = namedInt64(-64) + return &vi + }(), + want: func() any { + var vi any = namedInt64(+64) + return &vi + }(), + }, { + name: jsontest.Name("Interfaces/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + inBuf: `true`, + inVal: new(any), + want: func() any { + var vi any = true + return &vi + }(), + }, { + name: jsontest.Name("Interfaces/Any"), + inBuf: `{"X":[null,false,true,"",0,{},[]]}`, + inVal: new(struct{ X any }), + want: addr(struct{ X any }{[]any{nil, false, true, "", 0.0, map[string]any{}, []any{}}}), + }, { + name: jsontest.Name("Interfaces/Any/Named"), + inBuf: `{"X":[null,false,true,"",0,{},[]]}`, + inVal: new(struct{ X namedAny }), + want: addr(struct{ X namedAny }{[]any{nil, false, true, "", 0.0, map[string]any{}, []any{}}}), + }, { + name: jsontest.Name("Interfaces/Any/Stringified"), + opts: []Options{StringifyNumbers(true)}, + inBuf: `{"X":"0"}`, + inVal: new(struct{ X any }), + want: addr(struct{ X any }{"0"}), + }, { + name: jsontest.Name("Interfaces/Any/UnmarshalFunc/Any"), + opts: []Options{ + WithUnmarshalers(UnmarshalFunc(func(b []byte, v *any) error { + *v = "called" + return nil + })), + }, + inBuf: `{"X":[null,false,true,"",0,{},[]]}`, + inVal: new(struct{ X any }), + want: addr(struct{ X any }{"called"}), + }, { + name: jsontest.Name("Interfaces/Any/UnmarshalFunc/Bool"), + opts: []Options{ + WithUnmarshalers(UnmarshalFunc(func(b []byte, v *bool) error { + *v = string(b) != "true" + return nil + })), + }, + inBuf: `{"X":[null,false,true,"",0,{},[]]}`, + inVal: new(struct{ X any }), + want: addr(struct{ X any }{[]any{nil, true, false, "", 0.0, map[string]any{}, []any{}}}), + }, { + name: jsontest.Name("Interfaces/Any/UnmarshalFunc/String"), + opts: []Options{ + WithUnmarshalers(UnmarshalFunc(func(b []byte, v *string) error { + *v = "called" + return nil + })), + }, + inBuf: `{"X":[null,false,true,"",0,{},[]]}`, + inVal: new(struct{ X any }), + want: addr(struct{ X any }{[]any{nil, false, true, "called", 0.0, map[string]any{}, []any{}}}), + }, { + name: jsontest.Name("Interfaces/Any/UnmarshalFunc/Float64"), + opts: []Options{ + WithUnmarshalers(UnmarshalFunc(func(b []byte, v *float64) error { + *v = 3.14159 + return nil + })), + }, + inBuf: `{"X":[null,false,true,"",0,{},[]]}`, + inVal: new(struct{ X any }), + want: addr(struct{ X any }{[]any{nil, false, true, "", 3.14159, map[string]any{}, []any{}}}), + }, { + name: jsontest.Name("Interfaces/Any/UnmarshalFunc/MapStringAny"), + opts: []Options{ + WithUnmarshalers(UnmarshalFunc(func(b []byte, v *map[string]any) error { + *v = map[string]any{"called": nil} + return nil + })), + }, + inBuf: `{"X":[null,false,true,"",0,{},[]]}`, + inVal: new(struct{ X any }), + want: addr(struct{ X any }{[]any{nil, false, true, "", 0.0, map[string]any{"called": nil}, []any{}}}), + }, { + name: jsontest.Name("Interfaces/Any/UnmarshalFunc/SliceAny"), + opts: []Options{ + WithUnmarshalers(UnmarshalFunc(func(b []byte, v *[]any) error { + *v = []any{"called"} + return nil + })), + }, + inBuf: `{"X":[null,false,true,"",0,{},[]]}`, + inVal: new(struct{ X any }), + want: addr(struct{ X any }{[]any{"called"}}), + }, { + name: jsontest.Name("Interfaces/Any/Maps/NonEmpty"), + inBuf: `{"X":{"fizz":"buzz"}}`, + inVal: new(struct{ X any }), + want: addr(struct{ X any }{map[string]any{"fizz": "buzz"}}), + }, { + name: jsontest.Name("Interfaces/Any/Maps/RejectDuplicateNames"), + inBuf: `{"X":{"fizz":"buzz","fizz":true}}`, + inVal: new(struct{ X any }), + want: addr(struct{ X any }{map[string]any{"fizz": "buzz"}}), + wantErr: newDuplicateNameError("/X", []byte(`"fizz"`), len64(`{"X":{"fizz":"buzz",`)), + }, { + name: jsontest.Name("Interfaces/Any/Maps/AllowDuplicateNames"), + opts: []Options{jsontext.AllowDuplicateNames(true)}, + inBuf: `{"X":{"fizz":"buzz","fizz":true}}`, + inVal: new(struct{ X any }), + want: addr(struct{ X any }{map[string]any{"fizz": "buzz"}}), + wantErr: EU(nil).withPos(`{"X":{"fizz":"buzz","fizz":`, "/X/fizz").withType('t', T[string]()), + }, { + name: jsontest.Name("Interfaces/Any/Slices/NonEmpty"), + inBuf: `{"X":["fizz","buzz"]}`, + inVal: new(struct{ X any }), + want: addr(struct{ X any }{[]any{"fizz", "buzz"}}), + }, { + name: jsontest.Name("Methods/NilPointer/Null"), + inBuf: `{"X":null}`, + inVal: addr(struct{ X *allMethods }{X: (*allMethods)(nil)}), + want: addr(struct{ X *allMethods }{X: (*allMethods)(nil)}), // method should not be called + }, { + name: jsontest.Name("Methods/NilPointer/Value"), + inBuf: `{"X":"value"}`, + inVal: addr(struct{ X *allMethods }{X: (*allMethods)(nil)}), + want: addr(struct{ X *allMethods }{X: &allMethods{method: "UnmarshalJSONFrom", value: []byte(`"value"`)}}), + }, { + name: jsontest.Name("Methods/NilInterface/Null"), + inBuf: `{"X":null}`, + inVal: addr(struct{ X MarshalerTo }{X: (*allMethods)(nil)}), + want: addr(struct{ X MarshalerTo }{X: nil}), // interface value itself is nil'd out + }, { + name: jsontest.Name("Methods/NilInterface/Value"), + inBuf: `{"X":"value"}`, + inVal: addr(struct{ X MarshalerTo }{X: (*allMethods)(nil)}), + want: addr(struct{ X MarshalerTo }{X: &allMethods{method: "UnmarshalJSONFrom", value: []byte(`"value"`)}}), + }, { + name: jsontest.Name("Methods/AllMethods"), + inBuf: `{"X":"hello"}`, + inVal: new(struct{ X *allMethods }), + want: addr(struct{ X *allMethods }{X: &allMethods{method: "UnmarshalJSONFrom", value: []byte(`"hello"`)}}), + }, { + name: jsontest.Name("Methods/AllMethodsExceptJSONv2"), + inBuf: `{"X":"hello"}`, + inVal: new(struct{ X *allMethodsExceptJSONv2 }), + want: addr(struct{ X *allMethodsExceptJSONv2 }{X: &allMethodsExceptJSONv2{allMethods: allMethods{method: "UnmarshalJSON", value: []byte(`"hello"`)}}}), + }, { + name: jsontest.Name("Methods/AllMethodsExceptJSONv1"), + inBuf: `{"X":"hello"}`, + inVal: new(struct{ X *allMethodsExceptJSONv1 }), + want: addr(struct{ X *allMethodsExceptJSONv1 }{X: &allMethodsExceptJSONv1{allMethods: allMethods{method: "UnmarshalJSONFrom", value: []byte(`"hello"`)}}}), + }, { + name: jsontest.Name("Methods/AllMethodsExceptText"), + inBuf: `{"X":"hello"}`, + inVal: new(struct{ X *allMethodsExceptText }), + want: addr(struct{ X *allMethodsExceptText }{X: &allMethodsExceptText{allMethods: allMethods{method: "UnmarshalJSONFrom", value: []byte(`"hello"`)}}}), + }, { + name: jsontest.Name("Methods/OnlyMethodJSONv2"), + inBuf: `{"X":"hello"}`, + inVal: new(struct{ X *onlyMethodJSONv2 }), + want: addr(struct{ X *onlyMethodJSONv2 }{X: &onlyMethodJSONv2{allMethods: allMethods{method: "UnmarshalJSONFrom", value: []byte(`"hello"`)}}}), + }, { + name: jsontest.Name("Methods/OnlyMethodJSONv1"), + inBuf: `{"X":"hello"}`, + inVal: new(struct{ X *onlyMethodJSONv1 }), + want: addr(struct{ X *onlyMethodJSONv1 }{X: &onlyMethodJSONv1{allMethods: allMethods{method: "UnmarshalJSON", value: []byte(`"hello"`)}}}), + }, { + name: jsontest.Name("Methods/OnlyMethodText"), + inBuf: `{"X":"hello"}`, + inVal: new(struct{ X *onlyMethodText }), + want: addr(struct{ X *onlyMethodText }{X: &onlyMethodText{allMethods: allMethods{method: "UnmarshalText", value: []byte(`hello`)}}}), + }, { + name: jsontest.Name("Methods/Text/Null"), + inBuf: `{"X":null}`, + inVal: addr(struct{ X unmarshalTextFunc }{unmarshalTextFunc(func(b []byte) error { + return errMustNotCall + })}), + want: addr(struct{ X unmarshalTextFunc }{nil}), + }, { + name: jsontest.Name("Methods/IP"), + inBuf: `"192.168.0.100"`, + inVal: new(net.IP), + want: addr(net.IPv4(192, 168, 0, 100)), + }, { + // NOTE: Fixes https://go.dev/issue/46516. + name: jsontest.Name("Methods/Anonymous"), + inBuf: `{"X":"hello"}`, + inVal: new(struct{ X struct{ allMethods } }), + want: addr(struct{ X struct{ allMethods } }{X: struct{ allMethods }{allMethods{method: "UnmarshalJSONFrom", value: []byte(`"hello"`)}}}), + }, { + // NOTE: Fixes https://go.dev/issue/22967. + name: jsontest.Name("Methods/Addressable"), + inBuf: `{"V":"hello","M":{"K":"hello"},"I":"hello"}`, + inVal: addr(struct { + V allMethods + M map[string]allMethods + I any + }{ + I: allMethods{}, // need to initialize with concrete value + }), + want: addr(struct { + V allMethods + M map[string]allMethods + I any + }{ + V: allMethods{method: "UnmarshalJSONFrom", value: []byte(`"hello"`)}, + M: map[string]allMethods{"K": {method: "UnmarshalJSONFrom", value: []byte(`"hello"`)}}, + I: allMethods{method: "UnmarshalJSONFrom", value: []byte(`"hello"`)}, + }), + }, { + // NOTE: Fixes https://go.dev/issue/29732. + name: jsontest.Name("Methods/MapKey/JSONv2"), + inBuf: `{"k1":"v1b","k2":"v2"}`, + inVal: addr(map[structMethodJSONv2]string{{"k1"}: "v1a", {"k3"}: "v3"}), + want: addr(map[structMethodJSONv2]string{{"k1"}: "v1b", {"k2"}: "v2", {"k3"}: "v3"}), + }, { + // NOTE: Fixes https://go.dev/issue/29732. + name: jsontest.Name("Methods/MapKey/JSONv1"), + inBuf: `{"k1":"v1b","k2":"v2"}`, + inVal: addr(map[structMethodJSONv1]string{{"k1"}: "v1a", {"k3"}: "v3"}), + want: addr(map[structMethodJSONv1]string{{"k1"}: "v1b", {"k2"}: "v2", {"k3"}: "v3"}), + }, { + name: jsontest.Name("Methods/MapKey/Text"), + inBuf: `{"k1":"v1b","k2":"v2"}`, + inVal: addr(map[structMethodText]string{{"k1"}: "v1a", {"k3"}: "v3"}), + want: addr(map[structMethodText]string{{"k1"}: "v1b", {"k2"}: "v2", {"k3"}: "v3"}), + }, { + name: jsontest.Name("Methods/Invalid/JSONv2/Error"), + inBuf: `{}`, + inVal: addr(unmarshalJSONv2Func(func(*jsontext.Decoder) error { + return errSomeError + })), + wantErr: EU(errSomeError).withType(0, T[unmarshalJSONv2Func]()), + }, { + name: jsontest.Name("Methods/Invalid/JSONv2/TooFew"), + inBuf: `{}`, + inVal: addr(unmarshalJSONv2Func(func(*jsontext.Decoder) error { + return nil // do nothing + })), + wantErr: EU(errNonSingularValue).withType(0, T[unmarshalJSONv2Func]()), + }, { + name: jsontest.Name("Methods/Invalid/JSONv2/TooMany"), + inBuf: `{}{}`, + inVal: addr(unmarshalJSONv2Func(func(dec *jsontext.Decoder) error { + dec.ReadValue() + dec.ReadValue() + return nil + })), + wantErr: EU(errNonSingularValue).withPos(`{}`, "").withType(0, T[unmarshalJSONv2Func]()), + }, { + name: jsontest.Name("Methods/Invalid/JSONv2/SkipFunc"), + inBuf: `{}`, + inVal: addr(unmarshalJSONv2Func(func(*jsontext.Decoder) error { + return SkipFunc + })), + wantErr: EU(wrapSkipFunc(SkipFunc, "unmarshal method")).withType(0, T[unmarshalJSONv2Func]()), + }, { + name: jsontest.Name("Methods/Invalid/JSONv1/Error"), + inBuf: `{}`, + inVal: addr(unmarshalJSONv1Func(func([]byte) error { + return errSomeError + })), + wantErr: EU(errSomeError).withType('{', T[unmarshalJSONv1Func]()), + }, { + name: jsontest.Name("Methods/Invalid/JSONv1/SkipFunc"), + inBuf: `{}`, + inVal: addr(unmarshalJSONv1Func(func([]byte) error { + return SkipFunc + })), + wantErr: EU(wrapSkipFunc(SkipFunc, "unmarshal method")).withType('{', T[unmarshalJSONv1Func]()), + }, { + name: jsontest.Name("Methods/Invalid/Text/Error"), + inBuf: `"value"`, + inVal: addr(unmarshalTextFunc(func([]byte) error { + return errSomeError + })), + wantErr: EU(errSomeError).withType('"', T[unmarshalTextFunc]()), + }, { + name: jsontest.Name("Methods/Invalid/Text/Syntax"), + inBuf: `{}`, + inVal: addr(unmarshalTextFunc(func([]byte) error { + panic("should not be called") + })), + wantErr: EU(errNonStringValue).withType('{', T[unmarshalTextFunc]()), + }, { + name: jsontest.Name("Methods/Invalid/Text/SkipFunc"), + inBuf: `"value"`, + inVal: addr(unmarshalTextFunc(func([]byte) error { + return SkipFunc + })), + wantErr: EU(wrapSkipFunc(SkipFunc, "unmarshal method")).withType('"', T[unmarshalTextFunc]()), + }, { + name: jsontest.Name("Functions/String/V1"), + opts: []Options{ + WithUnmarshalers(UnmarshalFunc(func(b []byte, v *string) error { + if string(b) != `""` { + return fmt.Errorf("got %s, want %s", b, `""`) + } + *v = "called" + return nil + })), + }, + inBuf: `""`, + inVal: addr(""), + want: addr("called"), + }, { + name: jsontest.Name("Functions/String/Empty"), + opts: []Options{WithUnmarshalers(nil)}, + inBuf: `"hello"`, + inVal: addr(""), + want: addr("hello"), + }, { + name: jsontest.Name("Functions/NamedString/V1/NoMatch"), + opts: []Options{ + WithUnmarshalers(UnmarshalFunc(func(b []byte, v *namedString) error { + panic("should not be called") + })), + }, + inBuf: `""`, + inVal: addr(""), + want: addr(""), + }, { + name: jsontest.Name("Functions/NamedString/V1/Match"), + opts: []Options{ + WithUnmarshalers(UnmarshalFunc(func(b []byte, v *namedString) error { + if string(b) != `""` { + return fmt.Errorf("got %s, want %s", b, `""`) + } + *v = "called" + return nil + })), + }, + inBuf: `""`, + inVal: addr(namedString("")), + want: addr(namedString("called")), + }, { + name: jsontest.Name("Functions/String/V2"), + opts: []Options{ + WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, v *string) error { + switch b, err := dec.ReadValue(); { + case err != nil: + return err + case string(b) != `""`: + return fmt.Errorf("got %s, want %s", b, `""`) + } + *v = "called" + return nil + })), + }, + inBuf: `""`, + inVal: addr(""), + want: addr("called"), + }, { + name: jsontest.Name("Functions/NamedString/V2/NoMatch"), + opts: []Options{ + WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, v *namedString) error { + panic("should not be called") + })), + }, + inBuf: `""`, + inVal: addr(""), + want: addr(""), + }, { + name: jsontest.Name("Functions/NamedString/V2/Match"), + opts: []Options{ + WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, v *namedString) error { + switch t, err := dec.ReadToken(); { + case err != nil: + return err + case t.String() != ``: + return fmt.Errorf("got %q, want %q", t, ``) + } + *v = "called" + return nil + })), + }, + inBuf: `""`, + inVal: addr(namedString("")), + want: addr(namedString("called")), + }, { + name: jsontest.Name("Functions/String/Empty1/NoMatch"), + opts: []Options{ + WithUnmarshalers(new(Unmarshalers)), + }, + inBuf: `""`, + inVal: addr(""), + want: addr(""), + }, { + name: jsontest.Name("Functions/String/Empty2/NoMatch"), + opts: []Options{ + WithUnmarshalers(JoinUnmarshalers()), + }, + inBuf: `""`, + inVal: addr(""), + want: addr(""), + }, { + name: jsontest.Name("Functions/String/V1/DirectError"), + opts: []Options{ + WithUnmarshalers(UnmarshalFunc(func([]byte, *string) error { + return errSomeError + })), + }, + inBuf: `""`, + inVal: addr(""), + want: addr(""), + wantErr: EU(errSomeError).withType('"', reflect.PointerTo(stringType)), + }, { + name: jsontest.Name("Functions/String/V1/SkipError"), + opts: []Options{ + WithUnmarshalers(UnmarshalFunc(func([]byte, *string) error { + return SkipFunc + })), + }, + inBuf: `""`, + inVal: addr(""), + want: addr(""), + wantErr: EU(wrapSkipFunc(SkipFunc, "unmarshal function of type func([]byte, T) error")).withType('"', reflect.PointerTo(stringType)), + }, { + name: jsontest.Name("Functions/String/V2/DirectError"), + opts: []Options{ + WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, v *string) error { + return errSomeError + })), + }, + inBuf: `""`, + inVal: addr(""), + want: addr(""), + wantErr: EU(errSomeError).withType(0, reflect.PointerTo(stringType)), + }, { + name: jsontest.Name("Functions/String/V2/TooFew"), + opts: []Options{ + WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, v *string) error { + return nil + })), + }, + inBuf: `""`, + inVal: addr(""), + want: addr(""), + wantErr: EU(errNonSingularValue).withType(0, reflect.PointerTo(stringType)), + }, { + name: jsontest.Name("Functions/String/V2/TooMany"), + opts: []Options{ + WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, v *string) error { + if _, err := dec.ReadValue(); err != nil { + return err + } + if _, err := dec.ReadValue(); err != nil { + return err + } + return nil + })), + }, + inBuf: `{"X":["",""]}`, + inVal: addr(struct{ X []string }{}), + want: addr(struct{ X []string }{[]string{""}}), + wantErr: EU(errNonSingularValue).withPos(`{"X":["",`, "/X").withType(0, reflect.PointerTo(stringType)), + }, { + name: jsontest.Name("Functions/String/V2/Skipped"), + opts: []Options{ + WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, v *string) error { + return SkipFunc + })), + }, + inBuf: `""`, + inVal: addr(""), + want: addr(""), + }, { + name: jsontest.Name("Functions/String/V2/ProcessBeforeSkip"), + opts: []Options{ + WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, v *string) error { + if _, err := dec.ReadValue(); err != nil { + return err + } + return SkipFunc + })), + }, + inBuf: `""`, + inVal: addr(""), + want: addr(""), + wantErr: EU(errSkipMutation).withType(0, reflect.PointerTo(stringType)), + }, { + name: jsontest.Name("Functions/String/V2/WrappedSkipError"), + opts: []Options{ + WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, v *string) error { + return fmt.Errorf("wrap: %w", SkipFunc) + })), + }, + inBuf: `""`, + inVal: addr(""), + want: addr(""), + wantErr: EU(fmt.Errorf("wrap: %w", SkipFunc)).withType(0, reflect.PointerTo(stringType)), + }, { + name: jsontest.Name("Functions/Map/Key/NoCaseString/V1"), + opts: []Options{ + WithUnmarshalers(UnmarshalFunc(func(b []byte, v *nocaseString) error { + if string(b) != `"hello"` { + return fmt.Errorf("got %s, want %s", b, `"hello"`) + } + *v = "called" + return nil + })), + }, + inBuf: `{"hello":"world"}`, + inVal: addr(map[nocaseString]string{}), + want: addr(map[nocaseString]string{"called": "world"}), + }, { + name: jsontest.Name("Functions/Map/Key/TextMarshaler/V1"), + opts: []Options{ + WithUnmarshalers(UnmarshalFunc(func(b []byte, v encoding.TextMarshaler) error { + if string(b) != `"hello"` { + return fmt.Errorf("got %s, want %s", b, `"hello"`) + } + *v.(*nocaseString) = "called" + return nil + })), + }, + inBuf: `{"hello":"world"}`, + inVal: addr(map[nocaseString]string{}), + want: addr(map[nocaseString]string{"called": "world"}), + }, { + name: jsontest.Name("Functions/Map/Key/NoCaseString/V2"), + opts: []Options{ + WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, v *nocaseString) error { + switch t, err := dec.ReadToken(); { + case err != nil: + return err + case t.String() != "hello": + return fmt.Errorf("got %q, want %q", t, "hello") + } + *v = "called" + return nil + })), + }, + inBuf: `{"hello":"world"}`, + inVal: addr(map[nocaseString]string{}), + want: addr(map[nocaseString]string{"called": "world"}), + }, { + name: jsontest.Name("Functions/Map/Key/TextMarshaler/V2"), + opts: []Options{ + WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, v encoding.TextMarshaler) error { + switch b, err := dec.ReadValue(); { + case err != nil: + return err + case string(b) != `"hello"`: + return fmt.Errorf("got %s, want %s", b, `"hello"`) + } + *v.(*nocaseString) = "called" + return nil + })), + }, + inBuf: `{"hello":"world"}`, + inVal: addr(map[nocaseString]string{}), + want: addr(map[nocaseString]string{"called": "world"}), + }, { + name: jsontest.Name("Functions/Map/Key/String/V1/DuplicateName"), + opts: []Options{ + WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, v *string) error { + if _, err := dec.ReadValue(); err != nil { + return err + } + xd := export.Decoder(dec) + *v = fmt.Sprintf("%d-%d", len(xd.Tokens.Stack), xd.Tokens.Last.Length()) + return nil + })), + }, + inBuf: `{"name":"value","name":"value"}`, + inVal: addr(map[string]string{}), + want: addr(map[string]string{"1-1": "1-2"}), + wantErr: newDuplicateNameError("", []byte(`"name"`), len64(`{"name":"value",`)), + }, { + name: jsontest.Name("Functions/Map/Value/NoCaseString/V1"), + opts: []Options{ + WithUnmarshalers(UnmarshalFunc(func(b []byte, v *nocaseString) error { + if string(b) != `"world"` { + return fmt.Errorf("got %s, want %s", b, `"world"`) + } + *v = "called" + return nil + })), + }, + inBuf: `{"hello":"world"}`, + inVal: addr(map[string]nocaseString{}), + want: addr(map[string]nocaseString{"hello": "called"}), + }, { + name: jsontest.Name("Functions/Map/Value/TextMarshaler/V1"), + opts: []Options{ + WithUnmarshalers(UnmarshalFunc(func(b []byte, v encoding.TextMarshaler) error { + if string(b) != `"world"` { + return fmt.Errorf("got %s, want %s", b, `"world"`) + } + *v.(*nocaseString) = "called" + return nil + })), + }, + inBuf: `{"hello":"world"}`, + inVal: addr(map[string]nocaseString{}), + want: addr(map[string]nocaseString{"hello": "called"}), + }, { + name: jsontest.Name("Functions/Map/Value/NoCaseString/V2"), + opts: []Options{ + WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, v *nocaseString) error { + switch t, err := dec.ReadToken(); { + case err != nil: + return err + case t.String() != "world": + return fmt.Errorf("got %q, want %q", t, "world") + } + *v = "called" + return nil + })), + }, + inBuf: `{"hello":"world"}`, + inVal: addr(map[string]nocaseString{}), + want: addr(map[string]nocaseString{"hello": "called"}), + }, { + name: jsontest.Name("Functions/Map/Value/TextMarshaler/V2"), + opts: []Options{ + WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, v encoding.TextMarshaler) error { + switch b, err := dec.ReadValue(); { + case err != nil: + return err + case string(b) != `"world"`: + return fmt.Errorf("got %s, want %s", b, `"world"`) + } + *v.(*nocaseString) = "called" + return nil + })), + }, + inBuf: `{"hello":"world"}`, + inVal: addr(map[string]nocaseString{}), + want: addr(map[string]nocaseString{"hello": "called"}), + }, { + name: jsontest.Name("Funtions/Struct/Fields"), + opts: []Options{ + WithUnmarshalers(JoinUnmarshalers( + UnmarshalFunc(func(b []byte, v *bool) error { + if string(b) != `"called1"` { + return fmt.Errorf("got %s, want %s", b, `"called1"`) + } + *v = true + return nil + }), + UnmarshalFunc(func(b []byte, v *string) error { + if string(b) != `"called2"` { + return fmt.Errorf("got %s, want %s", b, `"called2"`) + } + *v = "called2" + return nil + }), + UnmarshalFromFunc(func(dec *jsontext.Decoder, v *[]byte) error { + switch t, err := dec.ReadToken(); { + case err != nil: + return err + case t.String() != "called3": + return fmt.Errorf("got %q, want %q", t, "called3") + } + *v = []byte("called3") + return nil + }), + UnmarshalFromFunc(func(dec *jsontext.Decoder, v *int64) error { + switch b, err := dec.ReadValue(); { + case err != nil: + return err + case string(b) != `"called4"`: + return fmt.Errorf("got %s, want %s", b, `"called4"`) + } + *v = 123 + return nil + }), + )), + }, + inBuf: `{"Bool":"called1","String":"called2","Bytes":"called3","Int":"called4","Uint":456,"Float":789}`, + inVal: addr(structScalars{}), + want: addr(structScalars{Bool: true, String: "called2", Bytes: []byte("called3"), Int: 123, Uint: 456, Float: 789}), + }, { + name: jsontest.Name("Functions/Struct/Inlined"), + opts: []Options{ + WithUnmarshalers(JoinUnmarshalers( + UnmarshalFunc(func([]byte, *structInlinedL1) error { + panic("should not be called") + }), + UnmarshalFromFunc(func(dec *jsontext.Decoder, v *StructEmbed2) error { + panic("should not be called") + }), + )), + }, + inBuf: `{"E":"E3","F":"F3","G":"G3","A":"A1","B":"B1","D":"D2"}`, + inVal: new(structInlined), + want: addr(structInlined{ + X: structInlinedL1{ + X: &structInlinedL2{A: "A1", B: "B1" /* C: "C1" */}, + StructEmbed1: StructEmbed1{ /* C: "C2" */ D: "D2" /* E: "E2" */}, + }, + StructEmbed2: &StructEmbed2{E: "E3", F: "F3", G: "G3"}, + }), + }, { + name: jsontest.Name("Functions/Slice/Elem"), + opts: []Options{ + WithUnmarshalers(UnmarshalFunc(func(b []byte, v *string) error { + *v = strings.Trim(strings.ToUpper(string(b)), `"`) + return nil + })), + }, + inBuf: `["hello","World"]`, + inVal: addr([]string{}), + want: addr([]string{"HELLO", "WORLD"}), + }, { + name: jsontest.Name("Functions/Array/Elem"), + opts: []Options{ + WithUnmarshalers(UnmarshalFunc(func(b []byte, v *string) error { + *v = strings.Trim(strings.ToUpper(string(b)), `"`) + return nil + })), + }, + inBuf: `["hello","World"]`, + inVal: addr([2]string{}), + want: addr([2]string{"HELLO", "WORLD"}), + }, { + name: jsontest.Name("Functions/Pointer/Nil"), + opts: []Options{ + WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, v *string) error { + t, err := dec.ReadToken() + *v = strings.ToUpper(t.String()) + return err + })), + }, + inBuf: `{"X":"hello"}`, + inVal: addr(struct{ X *string }{nil}), + want: addr(struct{ X *string }{addr("HELLO")}), + }, { + name: jsontest.Name("Functions/Pointer/NonNil"), + opts: []Options{ + WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, v *string) error { + t, err := dec.ReadToken() + *v = strings.ToUpper(t.String()) + return err + })), + }, + inBuf: `{"X":"hello"}`, + inVal: addr(struct{ X *string }{addr("")}), + want: addr(struct{ X *string }{addr("HELLO")}), + }, { + name: jsontest.Name("Functions/Interface/Nil"), + opts: []Options{ + WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, v fmt.Stringer) error { + panic("should not be called") + })), + }, + inBuf: `{"X":"hello"}`, + inVal: addr(struct{ X fmt.Stringer }{nil}), + want: addr(struct{ X fmt.Stringer }{nil}), + wantErr: EU(internal.ErrNilInterface).withPos(`{"X":`, "/X").withType(0, T[fmt.Stringer]()), + }, { + name: jsontest.Name("Functions/Interface/NetIP"), + opts: []Options{ + WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, v *fmt.Stringer) error { + *v = net.IP{} + return SkipFunc + })), + }, + inBuf: `{"X":"1.1.1.1"}`, + inVal: addr(struct{ X fmt.Stringer }{nil}), + want: addr(struct{ X fmt.Stringer }{net.IPv4(1, 1, 1, 1)}), + }, { + name: jsontest.Name("Functions/Interface/NewPointerNetIP"), + opts: []Options{ + WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, v *fmt.Stringer) error { + *v = new(net.IP) + return SkipFunc + })), + }, + inBuf: `{"X":"1.1.1.1"}`, + inVal: addr(struct{ X fmt.Stringer }{nil}), + want: addr(struct{ X fmt.Stringer }{addr(net.IPv4(1, 1, 1, 1))}), + }, { + name: jsontest.Name("Functions/Interface/NilPointerNetIP"), + opts: []Options{ + WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, v *fmt.Stringer) error { + *v = (*net.IP)(nil) + return SkipFunc + })), + }, + inBuf: `{"X":"1.1.1.1"}`, + inVal: addr(struct{ X fmt.Stringer }{nil}), + want: addr(struct{ X fmt.Stringer }{addr(net.IPv4(1, 1, 1, 1))}), + }, { + name: jsontest.Name("Functions/Interface/NilPointerNetIP/Override"), + opts: []Options{ + WithUnmarshalers(JoinUnmarshalers( + UnmarshalFromFunc(func(dec *jsontext.Decoder, v *fmt.Stringer) error { + *v = (*net.IP)(nil) + return SkipFunc + }), + UnmarshalFunc(func(b []byte, v *net.IP) error { + b = bytes.ReplaceAll(b, []byte(`1`), []byte(`8`)) + return v.UnmarshalText(bytes.Trim(b, `"`)) + }), + )), + }, + inBuf: `{"X":"1.1.1.1"}`, + inVal: addr(struct{ X fmt.Stringer }{nil}), + want: addr(struct{ X fmt.Stringer }{addr(net.IPv4(8, 8, 8, 8))}), + }, { + name: jsontest.Name("Functions/Interface/Any"), + inBuf: `[null,{},{},{},{},{},{},{},{},{},{},{},{},"LAST"]`, + inVal: addr([...]any{ + nil, // nil + valueStringer{}, // T + (*valueStringer)(nil), // *T + addr(valueStringer{}), // *T + (**valueStringer)(nil), // **T + addr((*valueStringer)(nil)), // **T + addr(addr(valueStringer{})), // **T + pointerStringer{}, // T + (*pointerStringer)(nil), // *T + addr(pointerStringer{}), // *T + (**pointerStringer)(nil), // **T + addr((*pointerStringer)(nil)), // **T + addr(addr(pointerStringer{})), // **T + "LAST", + }), + opts: []Options{ + WithUnmarshalers(func() *Unmarshalers { + type P struct { + D int + N int64 + } + type PV struct { + P P + V any + } + + var lastChecks []func() error + checkLast := func() error { + for _, fn := range lastChecks { + if err := fn(); err != nil { + return err + } + } + return SkipFunc + } + makeValueChecker := func(name string, want []PV) func(d *jsontext.Decoder, v any) error { + checkNext := func(d *jsontext.Decoder, v any) error { + xd := export.Decoder(d) + p := P{len(xd.Tokens.Stack), xd.Tokens.Last.Length()} + rv := reflect.ValueOf(v) + pv := PV{p, v} + switch { + case len(want) == 0: + return fmt.Errorf("%s: %v: got more values than expected", name, p) + case !rv.IsValid() || rv.Kind() != reflect.Pointer || rv.IsNil(): + return fmt.Errorf("%s: %v: got %#v, want non-nil pointer type", name, p, v) + case !reflect.DeepEqual(pv, want[0]): + return fmt.Errorf("%s:\n\tgot %#v\n\twant %#v", name, pv, want[0]) + default: + want = want[1:] + return SkipFunc + } + } + lastChecks = append(lastChecks, func() error { + if len(want) > 0 { + return fmt.Errorf("%s: did not get enough values, want %d more", name, len(want)) + } + return nil + }) + return checkNext + } + makePositionChecker := func(name string, want []P) func(d *jsontext.Decoder, v any) error { + checkNext := func(d *jsontext.Decoder, v any) error { + xd := export.Decoder(d) + p := P{len(xd.Tokens.Stack), xd.Tokens.Last.Length()} + switch { + case len(want) == 0: + return fmt.Errorf("%s: %v: got more values than wanted", name, p) + case p != want[0]: + return fmt.Errorf("%s: got %v, want %v", name, p, want[0]) + default: + want = want[1:] + return SkipFunc + } + } + lastChecks = append(lastChecks, func() error { + if len(want) > 0 { + return fmt.Errorf("%s: did not get enough values, want %d more", name, len(want)) + } + return nil + }) + return checkNext + } + + // In contrast to marshal, unmarshal automatically allocates for + // nil pointers, which causes unmarshal to visit more values. + wantAny := []PV{ + {P{1, 0}, addr(any(nil))}, + {P{1, 1}, addr(any(valueStringer{}))}, + {P{1, 1}, addr(valueStringer{})}, + {P{1, 2}, addr(any((*valueStringer)(nil)))}, + {P{1, 2}, addr((*valueStringer)(nil))}, + {P{1, 2}, addr(valueStringer{})}, + {P{1, 3}, addr(any(addr(valueStringer{})))}, + {P{1, 3}, addr(addr(valueStringer{}))}, + {P{1, 3}, addr(valueStringer{})}, + {P{1, 4}, addr(any((**valueStringer)(nil)))}, + {P{1, 4}, addr((**valueStringer)(nil))}, + {P{1, 4}, addr((*valueStringer)(nil))}, + {P{1, 4}, addr(valueStringer{})}, + {P{1, 5}, addr(any(addr((*valueStringer)(nil))))}, + {P{1, 5}, addr(addr((*valueStringer)(nil)))}, + {P{1, 5}, addr((*valueStringer)(nil))}, + {P{1, 5}, addr(valueStringer{})}, + {P{1, 6}, addr(any(addr(addr(valueStringer{}))))}, + {P{1, 6}, addr(addr(addr(valueStringer{})))}, + {P{1, 6}, addr(addr(valueStringer{}))}, + {P{1, 6}, addr(valueStringer{})}, + {P{1, 7}, addr(any(pointerStringer{}))}, + {P{1, 7}, addr(pointerStringer{})}, + {P{1, 8}, addr(any((*pointerStringer)(nil)))}, + {P{1, 8}, addr((*pointerStringer)(nil))}, + {P{1, 8}, addr(pointerStringer{})}, + {P{1, 9}, addr(any(addr(pointerStringer{})))}, + {P{1, 9}, addr(addr(pointerStringer{}))}, + {P{1, 9}, addr(pointerStringer{})}, + {P{1, 10}, addr(any((**pointerStringer)(nil)))}, + {P{1, 10}, addr((**pointerStringer)(nil))}, + {P{1, 10}, addr((*pointerStringer)(nil))}, + {P{1, 10}, addr(pointerStringer{})}, + {P{1, 11}, addr(any(addr((*pointerStringer)(nil))))}, + {P{1, 11}, addr(addr((*pointerStringer)(nil)))}, + {P{1, 11}, addr((*pointerStringer)(nil))}, + {P{1, 11}, addr(pointerStringer{})}, + {P{1, 12}, addr(any(addr(addr(pointerStringer{}))))}, + {P{1, 12}, addr(addr(addr(pointerStringer{})))}, + {P{1, 12}, addr(addr(pointerStringer{}))}, + {P{1, 12}, addr(pointerStringer{})}, + {P{1, 13}, addr(any("LAST"))}, + {P{1, 13}, addr("LAST")}, + } + checkAny := makeValueChecker("any", wantAny) + anyUnmarshaler := UnmarshalFromFunc(func(dec *jsontext.Decoder, v any) error { + return checkAny(dec, v) + }) + + var wantPointerAny []PV + for _, v := range wantAny { + if _, ok := v.V.(*any); ok { + wantPointerAny = append(wantPointerAny, v) + } + } + checkPointerAny := makeValueChecker("*any", wantPointerAny) + pointerAnyUnmarshaler := UnmarshalFromFunc(func(dec *jsontext.Decoder, v *any) error { + return checkPointerAny(dec, v) + }) + + checkNamedAny := makeValueChecker("namedAny", wantAny) + namedAnyUnmarshaler := UnmarshalFromFunc(func(dec *jsontext.Decoder, v namedAny) error { + return checkNamedAny(dec, v) + }) + + checkPointerNamedAny := makeValueChecker("*namedAny", nil) + pointerNamedAnyUnmarshaler := UnmarshalFromFunc(func(dec *jsontext.Decoder, v *namedAny) error { + return checkPointerNamedAny(dec, v) + }) + + type stringer = fmt.Stringer + var wantStringer []PV + for _, v := range wantAny { + if _, ok := v.V.(stringer); ok { + wantStringer = append(wantStringer, v) + } + } + checkStringer := makeValueChecker("stringer", wantStringer) + stringerUnmarshaler := UnmarshalFromFunc(func(dec *jsontext.Decoder, v stringer) error { + return checkStringer(dec, v) + }) + + checkPointerStringer := makeValueChecker("*stringer", nil) + pointerStringerUnmarshaler := UnmarshalFromFunc(func(dec *jsontext.Decoder, v *stringer) error { + return checkPointerStringer(dec, v) + }) + + wantValueStringer := []P{{1, 1}, {1, 2}, {1, 3}, {1, 4}, {1, 5}, {1, 6}} + checkPointerValueStringer := makePositionChecker("*valueStringer", wantValueStringer) + pointerValueStringerUnmarshaler := UnmarshalFromFunc(func(dec *jsontext.Decoder, v *valueStringer) error { + return checkPointerValueStringer(dec, v) + }) + + wantPointerStringer := []P{{1, 7}, {1, 8}, {1, 9}, {1, 10}, {1, 11}, {1, 12}} + checkPointerPointerStringer := makePositionChecker("*pointerStringer", wantPointerStringer) + pointerPointerStringerUnmarshaler := UnmarshalFromFunc(func(dec *jsontext.Decoder, v *pointerStringer) error { + return checkPointerPointerStringer(dec, v) + }) + + lastUnmarshaler := UnmarshalFromFunc(func(dec *jsontext.Decoder, v *string) error { + return checkLast() + }) + + return JoinUnmarshalers( + // This is just like unmarshaling into a Go array, + // but avoids zeroing the element before calling unmarshal. + UnmarshalFromFunc(func(dec *jsontext.Decoder, v *[14]any) error { + if _, err := dec.ReadToken(); err != nil { + return err + } + for i := range len(*v) { + if err := UnmarshalDecode(dec, &(*v)[i]); err != nil { + return err + } + } + if _, err := dec.ReadToken(); err != nil { + return err + } + return nil + }), + + anyUnmarshaler, + pointerAnyUnmarshaler, + namedAnyUnmarshaler, + pointerNamedAnyUnmarshaler, // never called + stringerUnmarshaler, + pointerStringerUnmarshaler, // never called + pointerValueStringerUnmarshaler, + pointerPointerStringerUnmarshaler, + lastUnmarshaler, + ) + }()), + }, + }, { + name: jsontest.Name("Functions/Precedence/V1First"), + opts: []Options{ + WithUnmarshalers(JoinUnmarshalers( + UnmarshalFunc(func(b []byte, v *string) error { + if string(b) != `"called"` { + return fmt.Errorf("got %s, want %s", b, `"called"`) + } + *v = "called" + return nil + }), + UnmarshalFromFunc(func(dec *jsontext.Decoder, v *string) error { + panic("should not be called") + }), + )), + }, + inBuf: `"called"`, + inVal: addr(""), + want: addr("called"), + }, { + name: jsontest.Name("Functions/Precedence/V2First"), + opts: []Options{ + WithUnmarshalers(JoinUnmarshalers( + UnmarshalFromFunc(func(dec *jsontext.Decoder, v *string) error { + switch t, err := dec.ReadToken(); { + case err != nil: + return err + case t.String() != "called": + return fmt.Errorf("got %q, want %q", t, "called") + } + *v = "called" + return nil + }), + UnmarshalFunc(func([]byte, *string) error { + panic("should not be called") + }), + )), + }, + inBuf: `"called"`, + inVal: addr(""), + want: addr("called"), + }, { + name: jsontest.Name("Functions/Precedence/V2Skipped"), + opts: []Options{ + WithUnmarshalers(JoinUnmarshalers( + UnmarshalFromFunc(func(dec *jsontext.Decoder, v *string) error { + return SkipFunc + }), + UnmarshalFunc(func(b []byte, v *string) error { + if string(b) != `"called"` { + return fmt.Errorf("got %s, want %s", b, `"called"`) + } + *v = "called" + return nil + }), + )), + }, + inBuf: `"called"`, + inVal: addr(""), + want: addr("called"), + }, { + name: jsontest.Name("Functions/Precedence/NestedFirst"), + opts: []Options{ + WithUnmarshalers(JoinUnmarshalers( + JoinUnmarshalers( + UnmarshalFunc(func(b []byte, v *string) error { + if string(b) != `"called"` { + return fmt.Errorf("got %s, want %s", b, `"called"`) + } + *v = "called" + return nil + }), + ), + UnmarshalFunc(func([]byte, *string) error { + panic("should not be called") + }), + )), + }, + inBuf: `"called"`, + inVal: addr(""), + want: addr("called"), + }, { + name: jsontest.Name("Functions/Precedence/NestedLast"), + opts: []Options{ + WithUnmarshalers(JoinUnmarshalers( + UnmarshalFunc(func(b []byte, v *string) error { + if string(b) != `"called"` { + return fmt.Errorf("got %s, want %s", b, `"called"`) + } + *v = "called" + return nil + }), + JoinUnmarshalers( + UnmarshalFunc(func([]byte, *string) error { + panic("should not be called") + }), + ), + )), + }, + inBuf: `"called"`, + inVal: addr(""), + want: addr("called"), + }, { + name: jsontest.Name("Duration/Null"), + inBuf: `{"D1":null,"D2":null}`, + inVal: addr(struct { + D1 time.Duration `json:",format:units"` // TODO(https://go.dev/issue/71631): Remove the format flag. + D2 time.Duration `json:",format:nano"` + }{1, 1}), + want: addr(struct { + D1 time.Duration `json:",format:units"` // TODO(https://go.dev/issue/71631): Remove the format flag. + D2 time.Duration `json:",format:nano"` + }{0, 0}), + }, { + name: jsontest.Name("Duration/Zero"), + inBuf: `{"D1":"0s","D2":0}`, + inVal: addr(struct { + D1 time.Duration `json:",format:units"` // TODO(https://go.dev/issue/71631): Remove the format flag. + D2 time.Duration `json:",format:nano"` + }{1, 1}), + want: addr(struct { + D1 time.Duration `json:",format:units"` // TODO(https://go.dev/issue/71631): Remove the format flag. + D2 time.Duration `json:",format:nano"` + }{0, 0}), + }, { + name: jsontest.Name("Duration/Positive"), + inBuf: `{"D1":"34293h33m9.123456789s","D2":123456789123456789}`, + inVal: new(struct { + D1 time.Duration `json:",format:units"` // TODO(https://go.dev/issue/71631): Remove the format flag. + D2 time.Duration `json:",format:nano"` + }), + want: addr(struct { + D1 time.Duration `json:",format:units"` // TODO(https://go.dev/issue/71631): Remove the format flag. + D2 time.Duration `json:",format:nano"` + }{ + 123456789123456789, + 123456789123456789, + }), + }, { + name: jsontest.Name("Duration/Negative"), + inBuf: `{"D1":"-34293h33m9.123456789s","D2":-123456789123456789}`, + inVal: new(struct { + D1 time.Duration `json:",format:units"` // TODO(https://go.dev/issue/71631): Remove the format flag. + D2 time.Duration `json:",format:nano"` + }), + want: addr(struct { + D1 time.Duration `json:",format:units"` // TODO(https://go.dev/issue/71631): Remove the format flag. + D2 time.Duration `json:",format:nano"` + }{ + -123456789123456789, + -123456789123456789, + }), + }, { + name: jsontest.Name("Duration/Nanos/String"), + inBuf: `{"D":"12345"}`, + inVal: addr(struct { + D time.Duration `json:",string,format:nano"` + }{1}), + want: addr(struct { + D time.Duration `json:",string,format:nano"` + }{12345}), + }, { + name: jsontest.Name("Duration/Nanos/String/Invalid"), + inBuf: `{"D":"+12345"}`, + inVal: addr(struct { + D time.Duration `json:",string,format:nano"` + }{1}), + want: addr(struct { + D time.Duration `json:",string,format:nano"` + }{1}), + wantErr: EU(fmt.Errorf(`invalid duration "+12345": %w`, strconv.ErrSyntax)).withPos(`{"D":`, "/D").withType('"', timeDurationType), + }, { + name: jsontest.Name("Duration/Nanos/Mismatch"), + inBuf: `{"D":"34293h33m9.123456789s"}`, + inVal: addr(struct { + D time.Duration `json:",format:nano"` + }{1}), + want: addr(struct { + D time.Duration `json:",format:nano"` + }{1}), + wantErr: EU(nil).withPos(`{"D":`, "/D").withType('"', timeDurationType), + }, { + name: jsontest.Name("Duration/Nanos"), + inBuf: `{"D":1.324}`, + inVal: addr(struct { + D time.Duration `json:",format:nano"` + }{-1}), + want: addr(struct { + D time.Duration `json:",format:nano"` + }{1}), + }, { + name: jsontest.Name("Duration/String/Mismatch"), + inBuf: `{"D":-123456789123456789}`, + inVal: addr(struct { + D time.Duration `json:",format:units"` // TODO(https://go.dev/issue/71631): Remove the format flag. + }{1}), + want: addr(struct { + D time.Duration `json:",format:units"` // TODO(https://go.dev/issue/71631): Remove the format flag. + }{1}), + wantErr: EU(nil).withPos(`{"D":`, "/D").withType('0', timeDurationType), + }, { + name: jsontest.Name("Duration/String/Invalid"), + inBuf: `{"D":"5minkutes"}`, + inVal: addr(struct { + D time.Duration `json:",format:units"` // TODO(https://go.dev/issue/71631): Remove the format flag. + }{1}), + want: addr(struct { + D time.Duration `json:",format:units"` // TODO(https://go.dev/issue/71631): Remove the format flag. + }{1}), + wantErr: EU(func() error { + _, err := time.ParseDuration("5minkutes") + return err + }()).withPos(`{"D":`, "/D").withType('"', timeDurationType), + }, { + name: jsontest.Name("Duration/Syntax/Invalid"), + inBuf: `{"D":x}`, + inVal: addr(struct { + D time.Duration `json:",format:units"` // TODO(https://go.dev/issue/71631): Remove the format flag. + }{1}), + want: addr(struct { + D time.Duration `json:",format:units"` // TODO(https://go.dev/issue/71631): Remove the format flag. + }{1}), + wantErr: newInvalidCharacterError("x", "at start of value", len64(`{"D":`), "/D"), + }, { + name: jsontest.Name("Duration/Format"), + inBuf: `{ + "D1": "12h34m56.078090012s", + "D2": "12h34m56.078090012s", + "D3": 45296.078090012, + "D4": "45296.078090012", + "D5": 45296078.090012, + "D6": "45296078.090012", + "D7": 45296078090.012, + "D8": "45296078090.012", + "D9": 45296078090012, + "D10": "45296078090012", + "D11": "PT12H34M56.078090012S" + }`, + inVal: new(structDurationFormat), + want: addr(structDurationFormat{ + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + }), + }, { + name: jsontest.Name("Duration/Format/Invalid"), + inBuf: `{"D":"0s"}`, + inVal: addr(struct { + D time.Duration `json:",format:invalid"` + }{1}), + want: addr(struct { + D time.Duration `json:",format:invalid"` + }{1}), + wantErr: EU(errInvalidFormatFlag).withPos(`{"D":`, "/D").withType(0, timeDurationType), + }, { + /* TODO(https://go.dev/issue/71631): Re-enable this test case. + name: jsontest.Name("Duration/Format/Legacy"), + inBuf: `{"D1":45296078090012,"D2":"12h34m56.078090012s"}`, + opts: []Options{jsonflags.FormatDurationAsNano | 1}, + inVal: new(structDurationFormat), + want: addr(structDurationFormat{ + D1: 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + D2: 12*time.Hour + 34*time.Minute + 56*time.Second + 78*time.Millisecond + 90*time.Microsecond + 12*time.Nanosecond, + }), + }, { */ + /* TODO(https://go.dev/issue/71631): Re-enable this test case. + name: jsontest.Name("Duration/MapKey"), + inBuf: `{"1s":""}`, + inVal: new(map[time.Duration]string), + want: addr(map[time.Duration]string{time.Second: ""}), + }, { */ + name: jsontest.Name("Duration/MapKey/Legacy"), + opts: []Options{jsonflags.FormatDurationAsNano | 1}, + inBuf: `{"1000000000":""}`, + inVal: new(map[time.Duration]string), + want: addr(map[time.Duration]string{time.Second: ""}), + }, { + /* TODO(https://go.dev/issue/71631): Re-enable this test case. + name: jsontest.Name("Duration/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + inBuf: `"1s"`, + inVal: addr(time.Duration(0)), + want: addr(time.Second), + }, { */ + name: jsontest.Name("Time/Zero"), + inBuf: `{"T1":"0001-01-01T00:00:00Z","T2":"01 Jan 01 00:00 UTC","T3":"0001-01-01","T4":"0001-01-01T00:00:00Z","T5":"0001-01-01T00:00:00Z"}`, + inVal: new(struct { + T1 time.Time + T2 time.Time `json:",format:RFC822"` + T3 time.Time `json:",format:'2006-01-02'"` + T4 time.Time `json:",omitzero"` + T5 time.Time `json:",omitempty"` + }), + want: addr(struct { + T1 time.Time + T2 time.Time `json:",format:RFC822"` + T3 time.Time `json:",format:'2006-01-02'"` + T4 time.Time `json:",omitzero"` + T5 time.Time `json:",omitempty"` + }{ + mustParseTime(time.RFC3339Nano, "0001-01-01T00:00:00Z"), + mustParseTime(time.RFC822, "01 Jan 01 00:00 UTC"), + mustParseTime("2006-01-02", "0001-01-01"), + mustParseTime(time.RFC3339Nano, "0001-01-01T00:00:00Z"), + mustParseTime(time.RFC3339Nano, "0001-01-01T00:00:00Z"), + }), + }, { + name: jsontest.Name("Time/Format"), + inBuf: `{ + "T1": "1234-01-02T03:04:05.000000006Z", + "T2": "Mon Jan 2 03:04:05 1234", + "T3": "Mon Jan 2 03:04:05 UTC 1234", + "T4": "Mon Jan 02 03:04:05 +0000 1234", + "T5": "02 Jan 34 03:04 UTC", + "T6": "02 Jan 34 03:04 +0000", + "T7": "Monday, 02-Jan-34 03:04:05 UTC", + "T8": "Mon, 02 Jan 1234 03:04:05 UTC", + "T9": "Mon, 02 Jan 1234 03:04:05 +0000", + "T10": "1234-01-02T03:04:05Z", + "T11": "1234-01-02T03:04:05.000000006Z", + "T12": "3:04AM", + "T13": "Jan 2 03:04:05", + "T14": "Jan 2 03:04:05.000", + "T15": "Jan 2 03:04:05.000000", + "T16": "Jan 2 03:04:05.000000006", + "T17": "1234-01-02 03:04:05", + "T18": "1234-01-02", + "T19": "03:04:05", + "T20": "1234-01-02", + "T21": "\"weird\"1234", + "T22": -23225777754.999999994, + "T23": "-23225777754.999999994", + "T24": -23225777754999.999994, + "T25": "-23225777754999.999994", + "T26": -23225777754999999.994, + "T27": "-23225777754999999.994", + "T28": -23225777754999999994, + "T29": "-23225777754999999994" + }`, + inVal: new(structTimeFormat), + want: addr(structTimeFormat{ + mustParseTime(time.RFC3339Nano, "1234-01-02T03:04:05.000000006Z"), + mustParseTime(time.ANSIC, "Mon Jan 2 03:04:05 1234"), + mustParseTime(time.UnixDate, "Mon Jan 2 03:04:05 UTC 1234"), + mustParseTime(time.RubyDate, "Mon Jan 02 03:04:05 +0000 1234"), + mustParseTime(time.RFC822, "02 Jan 34 03:04 UTC"), + mustParseTime(time.RFC822Z, "02 Jan 34 03:04 +0000"), + mustParseTime(time.RFC850, "Monday, 02-Jan-34 03:04:05 UTC"), + mustParseTime(time.RFC1123, "Mon, 02 Jan 1234 03:04:05 UTC"), + mustParseTime(time.RFC1123Z, "Mon, 02 Jan 1234 03:04:05 +0000"), + mustParseTime(time.RFC3339, "1234-01-02T03:04:05Z"), + mustParseTime(time.RFC3339Nano, "1234-01-02T03:04:05.000000006Z"), + mustParseTime(time.Kitchen, "3:04AM"), + mustParseTime(time.Stamp, "Jan 2 03:04:05"), + mustParseTime(time.StampMilli, "Jan 2 03:04:05.000"), + mustParseTime(time.StampMicro, "Jan 2 03:04:05.000000"), + mustParseTime(time.StampNano, "Jan 2 03:04:05.000000006"), + mustParseTime(time.DateTime, "1234-01-02 03:04:05"), + mustParseTime(time.DateOnly, "1234-01-02"), + mustParseTime(time.TimeOnly, "03:04:05"), + mustParseTime("2006-01-02", "1234-01-02"), + mustParseTime(`\"weird\"2006`, `\"weird\"1234`), + time.Unix(-23225777755, 6).UTC(), + time.Unix(-23225777755, 6).UTC(), + time.Unix(-23225777755, 6).UTC(), + time.Unix(-23225777755, 6).UTC(), + time.Unix(-23225777755, 6).UTC(), + time.Unix(-23225777755, 6).UTC(), + time.Unix(-23225777755, 6).UTC(), + time.Unix(-23225777755, 6).UTC(), + }), + }, { + name: jsontest.Name("Time/Format/UnixString/InvalidNumber"), + inBuf: `{ + "T23": -23225777754.999999994, + "T25": -23225777754999.999994, + "T27": -23225777754999999.994, + "T29": -23225777754999999994 + }`, + inVal: new(structTimeFormat), + want: new(structTimeFormat), + wantErr: EU(nil).withPos(`{`+"\n\t\t\t"+`"T23": `, "/T23").withType('0', timeTimeType), + }, { + name: jsontest.Name("Time/Format/UnixString/InvalidString"), + inBuf: `{ + "T22": "-23225777754.999999994", + "T24": "-23225777754999.999994", + "T26": "-23225777754999999.994", + "T28": "-23225777754999999994" + }`, + inVal: new(structTimeFormat), + want: new(structTimeFormat), + wantErr: EU(nil).withPos(`{`+"\n\t\t\t"+`"T22": `, "/T22").withType('"', timeTimeType), + }, { + name: jsontest.Name("Time/Format/Null"), + inBuf: `{"T1":null,"T2":null,"T3":null,"T4":null,"T5":null,"T6":null,"T7":null,"T8":null,"T9":null,"T10":null,"T11":null,"T12":null,"T13":null,"T14":null,"T15":null,"T16":null,"T17":null,"T18":null,"T19":null,"T20":null,"T21":null,"T22":null,"T23":null,"T24":null,"T25":null,"T26":null,"T27":null,"T28":null,"T29":null}`, + inVal: addr(structTimeFormat{ + mustParseTime(time.RFC3339Nano, "1234-01-02T03:04:05.000000006Z"), + mustParseTime(time.ANSIC, "Mon Jan 2 03:04:05 1234"), + mustParseTime(time.UnixDate, "Mon Jan 2 03:04:05 UTC 1234"), + mustParseTime(time.RubyDate, "Mon Jan 02 03:04:05 +0000 1234"), + mustParseTime(time.RFC822, "02 Jan 34 03:04 UTC"), + mustParseTime(time.RFC822Z, "02 Jan 34 03:04 +0000"), + mustParseTime(time.RFC850, "Monday, 02-Jan-34 03:04:05 UTC"), + mustParseTime(time.RFC1123, "Mon, 02 Jan 1234 03:04:05 UTC"), + mustParseTime(time.RFC1123Z, "Mon, 02 Jan 1234 03:04:05 +0000"), + mustParseTime(time.RFC3339, "1234-01-02T03:04:05Z"), + mustParseTime(time.RFC3339Nano, "1234-01-02T03:04:05.000000006Z"), + mustParseTime(time.Kitchen, "3:04AM"), + mustParseTime(time.Stamp, "Jan 2 03:04:05"), + mustParseTime(time.StampMilli, "Jan 2 03:04:05.000"), + mustParseTime(time.StampMicro, "Jan 2 03:04:05.000000"), + mustParseTime(time.StampNano, "Jan 2 03:04:05.000000006"), + mustParseTime(time.DateTime, "1234-01-02 03:04:05"), + mustParseTime(time.DateOnly, "1234-01-02"), + mustParseTime(time.TimeOnly, "03:04:05"), + mustParseTime("2006-01-02", "1234-01-02"), + mustParseTime(`\"weird\"2006`, `\"weird\"1234`), + time.Unix(-23225777755, 6).UTC(), + time.Unix(-23225777755, 6).UTC(), + time.Unix(-23225777755, 6).UTC(), + time.Unix(-23225777755, 6).UTC(), + time.Unix(-23225777755, 6).UTC(), + time.Unix(-23225777755, 6).UTC(), + time.Unix(-23225777755, 6).UTC(), + time.Unix(-23225777755, 6).UTC(), + }), + want: new(structTimeFormat), + }, { + name: jsontest.Name("Time/RFC3339/Mismatch"), + inBuf: `{"T":1234}`, + inVal: new(struct { + T time.Time + }), + wantErr: EU(nil).withPos(`{"T":`, "/T").withType('0', timeTimeType), + }, { + name: jsontest.Name("Time/RFC3339/ParseError"), + inBuf: `{"T":"2021-09-29T12:44:52"}`, + inVal: new(struct { + T time.Time + }), + wantErr: EU(func() error { + _, err := time.Parse(time.RFC3339, "2021-09-29T12:44:52") + return err + }()).withPos(`{"T":`, "/T").withType('"', timeTimeType), + }, { + name: jsontest.Name("Time/Format/Invalid"), + inBuf: `{"T":""}`, + inVal: new(struct { + T time.Time `json:",format:UndefinedConstant"` + }), + wantErr: EU(errors.New(`invalid format flag "UndefinedConstant"`)).withPos(`{"T":`, "/T").withType(0, timeTimeType), + }, { + name: jsontest.Name("Time/Format/SingleDigitHour"), + inBuf: `{"T":"2000-01-01T1:12:34Z"}`, + inVal: new(struct{ T time.Time }), + wantErr: EU(newParseTimeError(time.RFC3339, "2000-01-01T1:12:34Z", "15", "1", "")).withPos(`{"T":`, "/T").withType('"', timeTimeType), + }, { + name: jsontest.Name("Time/Format/SubsecondComma"), + inBuf: `{"T":"2000-01-01T00:00:00,000Z"}`, + inVal: new(struct{ T time.Time }), + wantErr: EU(newParseTimeError(time.RFC3339, "2000-01-01T00:00:00,000Z", ".", ",", "")).withPos(`{"T":`, "/T").withType('"', timeTimeType), + }, { + name: jsontest.Name("Time/Format/TimezoneHourOverflow"), + inBuf: `{"T":"2000-01-01T00:00:00+24:00"}`, + inVal: new(struct{ T time.Time }), + wantErr: EU(newParseTimeError(time.RFC3339, "2000-01-01T00:00:00+24:00", "Z07:00", "+24:00", ": timezone hour out of range")).withPos(`{"T":`, "/T").withType('"', timeTimeType), + }, { + name: jsontest.Name("Time/Format/TimezoneMinuteOverflow"), + inBuf: `{"T":"2000-01-01T00:00:00+00:60"}`, + inVal: new(struct{ T time.Time }), + wantErr: EU(newParseTimeError(time.RFC3339, "2000-01-01T00:00:00+00:60", "Z07:00", "+00:60", ": timezone minute out of range")).withPos(`{"T":`, "/T").withType('"', timeTimeType), + }, { + name: jsontest.Name("Time/Syntax/Invalid"), + inBuf: `{"T":x}`, + inVal: new(struct { + T time.Time + }), + wantErr: newInvalidCharacterError("x", "at start of value", len64(`{"T":`), "/T"), + }, { + name: jsontest.Name("Time/IgnoreInvalidFormat"), + opts: []Options{invalidFormatOption}, + inBuf: `"2000-01-01T00:00:00Z"`, + inVal: addr(time.Time{}), + want: addr(time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC)), + }} + + for _, tt := range tests { + t.Run(tt.name.Name, func(t *testing.T) { + got := tt.inVal + gotErr := Unmarshal([]byte(tt.inBuf), got, tt.opts...) + if !reflect.DeepEqual(got, tt.want) && tt.want != nil { + t.Errorf("%s: Unmarshal output mismatch:\ngot %v\nwant %v", tt.name.Where, got, tt.want) + } + if !reflect.DeepEqual(gotErr, tt.wantErr) { + t.Errorf("%s: Unmarshal error mismatch:\ngot %v\nwant %v", tt.name.Where, gotErr, tt.wantErr) + } + }) + } +} + +func TestMarshalInvalidNamespace(t *testing.T) { + tests := []struct { + name jsontest.CaseName + val any + }{ + {jsontest.Name("Map"), map[string]string{"X": "\xde\xad\xbe\xef"}}, + {jsontest.Name("Struct"), struct{ X string }{"\xde\xad\xbe\xef"}}, + } + for _, tt := range tests { + t.Run(tt.name.Name, func(t *testing.T) { + enc := jsontext.NewEncoder(new(bytes.Buffer)) + if err := MarshalEncode(enc, tt.val); err == nil { + t.Fatalf("%s: MarshalEncode error is nil, want non-nil", tt.name.Where) + } + for _, tok := range []jsontext.Token{ + jsontext.Null, jsontext.String(""), jsontext.Int(0), jsontext.BeginObject, jsontext.EndObject, jsontext.BeginArray, jsontext.EndArray, + } { + if err := enc.WriteToken(tok); err == nil { + t.Fatalf("%s: WriteToken error is nil, want non-nil", tt.name.Where) + } + } + for _, val := range []string{`null`, `""`, `0`, `{}`, `[]`} { + if err := enc.WriteValue([]byte(val)); err == nil { + t.Fatalf("%s: WriteToken error is nil, want non-nil", tt.name.Where) + } + } + }) + } +} + +func TestUnmarshalInvalidNamespace(t *testing.T) { + tests := []struct { + name jsontest.CaseName + val any + }{ + {jsontest.Name("Map"), addr(map[string]int{})}, + {jsontest.Name("Struct"), addr(struct{ X int }{})}, + } + for _, tt := range tests { + t.Run(tt.name.Name, func(t *testing.T) { + dec := jsontext.NewDecoder(strings.NewReader(`{"X":""}`)) + if err := UnmarshalDecode(dec, tt.val); err == nil { + t.Fatalf("%s: UnmarshalDecode error is nil, want non-nil", tt.name.Where) + } + if _, err := dec.ReadToken(); err == nil { + t.Fatalf("%s: ReadToken error is nil, want non-nil", tt.name.Where) + } + if _, err := dec.ReadValue(); err == nil { + t.Fatalf("%s: ReadValue error is nil, want non-nil", tt.name.Where) + } + }) + } +} + +func TestUnmarshalReuse(t *testing.T) { + t.Run("Bytes", func(t *testing.T) { + in := make([]byte, 3) + want := &in[0] + if err := Unmarshal([]byte(`"AQID"`), &in); err != nil { + t.Fatalf("Unmarshal error: %v", err) + } + got := &in[0] + if got != want { + t.Errorf("input buffer was not reused") + } + }) + t.Run("Slices", func(t *testing.T) { + in := make([]int, 3) + want := &in[0] + if err := Unmarshal([]byte(`[0,1,2]`), &in); err != nil { + t.Fatalf("Unmarshal error: %v", err) + } + got := &in[0] + if got != want { + t.Errorf("input slice was not reused") + } + }) + t.Run("Maps", func(t *testing.T) { + in := make(map[string]string) + want := reflect.ValueOf(in).Pointer() + if err := Unmarshal([]byte(`{"key":"value"}`), &in); err != nil { + t.Fatalf("Unmarshal error: %v", err) + } + got := reflect.ValueOf(in).Pointer() + if got != want { + t.Errorf("input map was not reused") + } + }) + t.Run("Pointers", func(t *testing.T) { + in := addr(addr(addr("hello"))) + want := **in + if err := Unmarshal([]byte(`"goodbye"`), &in); err != nil { + t.Fatalf("Unmarshal error: %v", err) + } + got := **in + if got != want { + t.Errorf("input pointer was not reused") + } + }) +} + +type unmarshalerEOF struct{} + +func (unmarshalerEOF) UnmarshalJSONFrom(dec *jsontext.Decoder) error { + return io.EOF // should be wrapped and converted by Unmarshal to io.ErrUnexpectedEOF +} + +// TestUnmarshalEOF verifies that io.EOF is only ever returned by +// UnmarshalDecode for a top-level value. +func TestUnmarshalEOF(t *testing.T) { + opts := WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, _ *struct{}) error { + return io.EOF // should be wrapped and converted by Unmarshal to io.ErrUnexpectedEOF + })) + + for _, in := range []string{"", "[", "[null", "[null]"} { + for _, newOut := range []func() any{ + func() any { return new(unmarshalerEOF) }, + func() any { return new([]unmarshalerEOF) }, + func() any { return new(struct{}) }, + func() any { return new([]struct{}) }, + } { + wantErr := io.ErrUnexpectedEOF + if gotErr := Unmarshal([]byte(in), newOut(), opts); !errors.Is(gotErr, wantErr) { + t.Errorf("Unmarshal = %v, want %v", gotErr, wantErr) + } + if gotErr := UnmarshalRead(strings.NewReader(in), newOut(), opts); !errors.Is(gotErr, wantErr) { + t.Errorf("Unmarshal = %v, want %v", gotErr, wantErr) + } + switch gotErr := UnmarshalDecode(jsontext.NewDecoder(strings.NewReader(in)), newOut(), opts); { + case in != "" && !errors.Is(gotErr, wantErr): + t.Errorf("Unmarshal = %v, want %v", gotErr, wantErr) + case in == "" && gotErr != io.EOF: + t.Errorf("Unmarshal = %v, want %v", gotErr, io.EOF) + } + } + } +} + +type ReaderFunc func([]byte) (int, error) + +func (f ReaderFunc) Read(b []byte) (int, error) { return f(b) } + +type WriterFunc func([]byte) (int, error) + +func (f WriterFunc) Write(b []byte) (int, error) { return f(b) } + +func TestCoderBufferGrowth(t *testing.T) { + // The growth rate of the internal buffer should be exponential, + // but should not grow unbounded. + checkGrowth := func(ns []int) { + t.Helper() + var sumBytes, sumRates, numGrows float64 + prev := ns[0] + for i := 1; i < len(ns)-1; i++ { + n := ns[i] + if n != prev { + sumRates += float64(n) / float64(prev) + numGrows++ + prev = n + } + if n > 1<<20 { + t.Fatalf("single Read/Write too large: %d", n) + } + sumBytes += float64(n) + } + if mean := sumBytes / float64(len(ns)); mean < 1<<10 { + t.Fatalf("average Read/Write too small: %0.1f", mean) + } + switch mean := sumRates / numGrows; { + case mean < 1.25: + t.Fatalf("average growth rate too slow: %0.3f", mean) + case mean > 2.00: + t.Fatalf("average growth rate too fast: %0.3f", mean) + } + } + + // bb is identical to bytes.Buffer, + // but a different type to avoid any optimizations for bytes.Buffer. + bb := struct{ *bytes.Buffer }{new(bytes.Buffer)} + + var writeSizes []int + if err := MarshalWrite(WriterFunc(func(b []byte) (int, error) { + n, err := bb.Write(b) + writeSizes = append(writeSizes, n) + return n, err + }), make([]struct{}, 1e6)); err != nil { + t.Fatalf("MarshalWrite error: %v", err) + } + checkGrowth(writeSizes) + + var readSizes []int + if err := UnmarshalRead(ReaderFunc(func(b []byte) (int, error) { + n, err := bb.Read(b) + readSizes = append(readSizes, n) + return n, err + }), new([]struct{})); err != nil { + t.Fatalf("UnmarshalRead error: %v", err) + } + checkGrowth(readSizes) +} + +func TestUintSet(t *testing.T) { + type operation any // has | insert + type has struct { + in uint + want bool + } + type insert struct { + in uint + want bool + } + + // Sequence of operations to perform (order matters). + ops := []operation{ + has{0, false}, + has{63, false}, + has{64, false}, + has{1234, false}, + insert{3, true}, + has{2, false}, + has{3, true}, + has{4, false}, + has{63, false}, + insert{3, false}, + insert{63, true}, + has{63, true}, + insert{64, true}, + insert{64, false}, + has{64, true}, + insert{3264, true}, + has{3264, true}, + insert{3, false}, + has{3, true}, + } + + var us uintSet + for i, op := range ops { + switch op := op.(type) { + case has: + if got := us.has(op.in); got != op.want { + t.Fatalf("%d: uintSet.has(%v) = %v, want %v", i, op.in, got, op.want) + } + case insert: + if got := us.insert(op.in); got != op.want { + t.Fatalf("%d: uintSet.insert(%v) = %v, want %v", i, op.in, got, op.want) + } + default: + panic(fmt.Sprintf("unknown operation: %T", op)) + } + } +} + +func TestUnmarshalDecodeOptions(t *testing.T) { + var calledFuncs int + var calledOptions Options + in := strings.NewReader(strings.Repeat("\"\xde\xad\xbe\xef\"\n", 5)) + dec := jsontext.NewDecoder(in, + jsontext.AllowInvalidUTF8(true), // decoder-specific option + WithUnmarshalers(UnmarshalFromFunc(func(dec *jsontext.Decoder, _ any) error { + opts := dec.Options() + if v, _ := GetOption(opts, jsontext.AllowInvalidUTF8); !v { + t.Errorf("nested Options.AllowInvalidUTF8 = false, want true") + } + calledFuncs++ + calledOptions = opts + return SkipFunc + })), // unmarshal-specific option; only relevant for UnmarshalDecode + ) + + if err := UnmarshalDecode(dec, new(string)); err != nil { + t.Fatalf("UnmarshalDecode: %v", err) + } + if calledFuncs != 1 { + t.Fatalf("calledFuncs = %d, want 1", calledFuncs) + } + if err := UnmarshalDecode(dec, new(string), calledOptions); err != nil { + t.Fatalf("UnmarshalDecode: %v", err) + } + if calledFuncs != 2 { + t.Fatalf("calledFuncs = %d, want 2", calledFuncs) + } + if err := UnmarshalDecode(dec, new(string), + jsontext.AllowInvalidUTF8(false), // should be ignored + WithUnmarshalers(nil), // should override + ); err != nil { + t.Fatalf("UnmarshalDecode: %v", err) + } + if calledFuncs != 2 { + t.Fatalf("calledFuncs = %d, want 2", calledFuncs) + } + if err := UnmarshalDecode(dec, new(string)); err != nil { + t.Fatalf("UnmarshalDecode: %v", err) + } + if calledFuncs != 3 { + t.Fatalf("calledFuncs = %d, want 3", calledFuncs) + } + if err := UnmarshalDecode(dec, new(string), JoinOptions( + jsontext.AllowInvalidUTF8(false), // should be ignored + WithUnmarshalers(UnmarshalFromFunc(func(_ *jsontext.Decoder, _ any) error { + opts := dec.Options() + if v, _ := GetOption(opts, jsontext.AllowInvalidUTF8); !v { + t.Errorf("nested Options.AllowInvalidUTF8 = false, want true") + } + calledFuncs = math.MaxInt + return SkipFunc + })), // should override + )); err != nil { + t.Fatalf("UnmarshalDecode: %v", err) + } + if calledFuncs != math.MaxInt { + t.Fatalf("calledFuncs = %d, want %d", calledFuncs, math.MaxInt) + } + + // Reset with the decoder options as part of the arguments should not + // observe mutations to the options until after Reset is done. + opts := dec.Options() // AllowInvalidUTF8 is currently true + dec.Reset(in, jsontext.AllowInvalidUTF8(false), opts) // earlier AllowInvalidUTF8(false) should be overridden by latter AllowInvalidUTF8(true) in opts + if v, _ := GetOption(dec.Options(), jsontext.AllowInvalidUTF8); v == false { + t.Errorf("Options.AllowInvalidUTF8 = false, want true") + } +} + +func TestUnmarshalDecodeStream(t *testing.T) { + tests := []struct { + in string + want []any + err error + }{ + {in: ``, err: io.EOF}, + {in: `{`, err: &jsontext.SyntacticError{ByteOffset: len64(`{`), Err: io.ErrUnexpectedEOF}}, + {in: `{"`, err: &jsontext.SyntacticError{ByteOffset: len64(`{"`), Err: io.ErrUnexpectedEOF}}, + {in: `{"k"`, err: &jsontext.SyntacticError{ByteOffset: len64(`{"k"`), JSONPointer: "/k", Err: io.ErrUnexpectedEOF}}, + {in: `{"k":`, err: &jsontext.SyntacticError{ByteOffset: len64(`{"k":`), JSONPointer: "/k", Err: io.ErrUnexpectedEOF}}, + {in: `{"k",`, err: &jsontext.SyntacticError{ByteOffset: len64(`{"k"`), JSONPointer: "/k", Err: jsonwire.NewInvalidCharacterError(",", "after object name (expecting ':')")}}, + {in: `{"k"}`, err: &jsontext.SyntacticError{ByteOffset: len64(`{"k"`), JSONPointer: "/k", Err: jsonwire.NewInvalidCharacterError("}", "after object name (expecting ':')")}}, + {in: `[`, err: &jsontext.SyntacticError{ByteOffset: len64(`[`), Err: io.ErrUnexpectedEOF}}, + {in: `[0`, err: &jsontext.SyntacticError{ByteOffset: len64(`[0`), Err: io.ErrUnexpectedEOF}}, + {in: ` [0`, err: &jsontext.SyntacticError{ByteOffset: len64(` [0`), Err: io.ErrUnexpectedEOF}}, + {in: `[0.`, err: &jsontext.SyntacticError{ByteOffset: len64(`[`), JSONPointer: "/0", Err: io.ErrUnexpectedEOF}}, + {in: `[0. `, err: &jsontext.SyntacticError{ByteOffset: len64(`[0.`), JSONPointer: "/0", Err: jsonwire.NewInvalidCharacterError(" ", "in number (expecting digit)")}}, + {in: `[0,`, err: &jsontext.SyntacticError{ByteOffset: len64(`[0,`), Err: io.ErrUnexpectedEOF}}, + {in: `[0:`, err: &jsontext.SyntacticError{ByteOffset: len64(`[0`), Err: jsonwire.NewInvalidCharacterError(":", "after array element (expecting ',' or ']')")}}, + {in: `n`, err: &jsontext.SyntacticError{ByteOffset: len64(`n`), Err: io.ErrUnexpectedEOF}}, + {in: `nul`, err: &jsontext.SyntacticError{ByteOffset: len64(`nul`), Err: io.ErrUnexpectedEOF}}, + {in: `fal `, err: &jsontext.SyntacticError{ByteOffset: len64(`fal`), Err: jsonwire.NewInvalidCharacterError(" ", "in literal false (expecting 's')")}}, + {in: `false`, want: []any{false}, err: io.EOF}, + {in: `false0.0[]null`, want: []any{false, 0.0, []any{}, nil}, err: io.EOF}, + } + for _, tt := range tests { + d := jsontext.NewDecoder(strings.NewReader(tt.in)) + var got []any + for { + var v any + if err := UnmarshalDecode(d, &v); err != nil { + if !reflect.DeepEqual(err, tt.err) { + t.Errorf("`%s`: UnmarshalDecode error = %v, want %v", tt.in, err, tt.err) + } + break + } + got = append(got, v) + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("`%s`: UnmarshalDecode = %v, want %v", tt.in, got, tt.want) + } + } +} + +// BenchmarkUnmarshalDecodeOptions is a minimal decode operation to measure +// the overhead options setup before the unmarshal operation. +func BenchmarkUnmarshalDecodeOptions(b *testing.B) { + var i int + in := new(bytes.Buffer) + dec := jsontext.NewDecoder(in) + makeBench := func(opts ...Options) func(*testing.B) { + return func(b *testing.B) { + for range b.N { + in.WriteString("0 ") + } + dec.Reset(in) + b.ResetTimer() + for range b.N { + UnmarshalDecode(dec, &i, opts...) + } + } + } + b.Run("None", makeBench()) + b.Run("Same", makeBench(&export.Decoder(dec).Struct)) + b.Run("New", makeBench(DefaultOptionsV2())) +} + +func TestMarshalEncodeOptions(t *testing.T) { + var calledFuncs int + var calledOptions Options + out := new(bytes.Buffer) + enc := jsontext.NewEncoder( + out, + jsontext.AllowInvalidUTF8(true), // encoder-specific option + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, _ any) error { + opts := enc.Options() + if v, _ := GetOption(opts, jsontext.AllowInvalidUTF8); !v { + t.Errorf("nested Options.AllowInvalidUTF8 = false, want true") + } + calledFuncs++ + calledOptions = opts + return SkipFunc + })), // marshal-specific option; only relevant for MarshalEncode + ) + + if err := MarshalEncode(enc, "\xde\xad\xbe\xef"); err != nil { + t.Fatalf("MarshalEncode: %v", err) + } + if calledFuncs != 1 { + t.Fatalf("calledFuncs = %d, want 1", calledFuncs) + } + if err := MarshalEncode(enc, "\xde\xad\xbe\xef", calledOptions); err != nil { + t.Fatalf("MarshalEncode: %v", err) + } + if calledFuncs != 2 { + t.Fatalf("calledFuncs = %d, want 2", calledFuncs) + } + if err := MarshalEncode(enc, "\xde\xad\xbe\xef", + jsontext.AllowInvalidUTF8(false), // should be ignored + WithMarshalers(nil), // should override + ); err != nil { + t.Fatalf("MarshalEncode: %v", err) + } + if calledFuncs != 2 { + t.Fatalf("calledFuncs = %d, want 2", calledFuncs) + } + if err := MarshalEncode(enc, "\xde\xad\xbe\xef"); err != nil { + t.Fatalf("MarshalEncode: %v", err) + } + if calledFuncs != 3 { + t.Fatalf("calledFuncs = %d, want 3", calledFuncs) + } + if err := MarshalEncode(enc, "\xde\xad\xbe\xef", JoinOptions( + jsontext.AllowInvalidUTF8(false), // should be ignored + WithMarshalers(MarshalToFunc(func(enc *jsontext.Encoder, _ any) error { + opts := enc.Options() + if v, _ := GetOption(opts, jsontext.AllowInvalidUTF8); !v { + t.Errorf("nested Options.AllowInvalidUTF8 = false, want true") + } + calledFuncs = math.MaxInt + return SkipFunc + })), // should override + )); err != nil { + t.Fatalf("MarshalEncode: %v", err) + } + if calledFuncs != math.MaxInt { + t.Fatalf("calledFuncs = %d, want %d", calledFuncs, math.MaxInt) + } + if out.String() != strings.Repeat("\"\xde\xad\ufffd\ufffd\"\n", 5) { + t.Fatalf("output mismatch:\n\tgot: %s\n\twant: %s", out.String(), strings.Repeat("\"\xde\xad\xbe\xef\"\n", 5)) + } + + // Reset with the encoder options as part of the arguments should not + // observe mutations to the options until after Reset is done. + opts := enc.Options() // AllowInvalidUTF8 is currently true + enc.Reset(out, jsontext.AllowInvalidUTF8(false), opts) // earlier AllowInvalidUTF8(false) should be overridden by latter AllowInvalidUTF8(true) in opts + if v, _ := GetOption(enc.Options(), jsontext.AllowInvalidUTF8); v == false { + t.Errorf("Options.AllowInvalidUTF8 = false, want true") + } +} + +// BenchmarkMarshalEncodeOptions is a minimal encode operation to measure +// the overhead of options setup before the marshal operation. +func BenchmarkMarshalEncodeOptions(b *testing.B) { + var i int + out := new(bytes.Buffer) + enc := jsontext.NewEncoder(out) + makeBench := func(opts ...Options) func(*testing.B) { + return func(b *testing.B) { + out.Reset() + enc.Reset(out) + b.ResetTimer() + for range b.N { + MarshalEncode(enc, &i, opts...) + } + } + } + b.Run("None", makeBench()) + b.Run("Same", makeBench(&export.Encoder(enc).Struct)) + b.Run("New", makeBench(DefaultOptionsV2())) +} diff --git a/go/src/encoding/json/v2/arshal_time.go b/go/src/encoding/json/v2/arshal_time.go new file mode 100644 index 0000000000000000000000000000000000000000..027503734e783e3c3dede92178d84d1e0d614b94 --- /dev/null +++ b/go/src/encoding/json/v2/arshal_time.go @@ -0,0 +1,775 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json + +import ( + "bytes" + "cmp" + "errors" + "fmt" + "math" + "math/bits" + "reflect" + "strconv" + "strings" + "time" + + "encoding/json/internal" + "encoding/json/internal/jsonflags" + "encoding/json/internal/jsonopts" + "encoding/json/internal/jsonwire" + "encoding/json/jsontext" +) + +var ( + timeDurationType = reflect.TypeFor[time.Duration]() + timeTimeType = reflect.TypeFor[time.Time]() +) + +func makeTimeArshaler(fncs *arshaler, t reflect.Type) *arshaler { + // Ideally, time types would implement MarshalerTo and UnmarshalerFrom, + // but that would incur a dependency on package json from package time. + // Given how widely used time is, it is more acceptable that we incur a + // dependency on time from json. + // + // Injecting the arshaling functionality like this will not be identical + // to actually declaring methods on the time types since embedding of the + // time types will not be able to forward this functionality. + switch t { + case timeDurationType: + fncs.nonDefault = true + marshalNano := fncs.marshal + fncs.marshal = func(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct) error { + xe := export.Encoder(enc) + var m durationArshaler + if mo.Format != "" && mo.FormatDepth == xe.Tokens.Depth() { + if !m.initFormat(mo.Format) { + return newInvalidFormatError(enc, t) + } + } else if mo.Flags.Get(jsonflags.FormatDurationAsNano) { + return marshalNano(enc, va, mo) + } else { + // TODO(https://go.dev/issue/71631): Decide on default duration representation. + return newMarshalErrorBefore(enc, t, errors.New("no default representation (see https://go.dev/issue/71631); specify an explicit format")) + } + + m.td, _ = reflect.TypeAssert[time.Duration](va.Value) + k := stringOrNumberKind(!m.isNumeric() || xe.Tokens.Last.NeedObjectName() || mo.Flags.Get(jsonflags.StringifyNumbers)) + if err := xe.AppendRaw(k, true, m.appendMarshal); err != nil { + if !isSyntacticError(err) && !export.IsIOError(err) { + err = newMarshalErrorBefore(enc, t, err) + } + return err + } + return nil + } + unmarshalNano := fncs.unmarshal + fncs.unmarshal = func(dec *jsontext.Decoder, va addressableValue, uo *jsonopts.Struct) error { + xd := export.Decoder(dec) + var u durationArshaler + if uo.Format != "" && uo.FormatDepth == xd.Tokens.Depth() { + if !u.initFormat(uo.Format) { + return newInvalidFormatError(dec, t) + } + } else if uo.Flags.Get(jsonflags.FormatDurationAsNano) { + return unmarshalNano(dec, va, uo) + } else { + // TODO(https://go.dev/issue/71631): Decide on default duration representation. + return newUnmarshalErrorBeforeWithSkipping(dec, t, errors.New("no default representation (see https://go.dev/issue/71631); specify an explicit format")) + } + + stringify := !u.isNumeric() || xd.Tokens.Last.NeedObjectName() || uo.Flags.Get(jsonflags.StringifyNumbers) + var flags jsonwire.ValueFlags + td, _ := reflect.TypeAssert[*time.Duration](va.Addr()) + val, err := xd.ReadValue(&flags) + if err != nil { + return err + } + switch k := val.Kind(); k { + case 'n': + if !uo.Flags.Get(jsonflags.MergeWithLegacySemantics) { + *td = time.Duration(0) + } + return nil + case '"': + if !stringify { + break + } + val = jsonwire.UnquoteMayCopy(val, flags.IsVerbatim()) + if err := u.unmarshal(val); err != nil { + return newUnmarshalErrorAfter(dec, t, err) + } + *td = u.td + return nil + case '0': + if stringify { + break + } + if err := u.unmarshal(val); err != nil { + return newUnmarshalErrorAfter(dec, t, err) + } + *td = u.td + return nil + } + return newUnmarshalErrorAfter(dec, t, nil) + } + case timeTimeType: + fncs.nonDefault = true + fncs.marshal = func(enc *jsontext.Encoder, va addressableValue, mo *jsonopts.Struct) (err error) { + xe := export.Encoder(enc) + var m timeArshaler + if mo.Format != "" && mo.FormatDepth == xe.Tokens.Depth() { + if !m.initFormat(mo.Format) { + return newInvalidFormatError(enc, t) + } + } + + m.tt, _ = reflect.TypeAssert[time.Time](va.Value) + k := stringOrNumberKind(!m.isNumeric() || xe.Tokens.Last.NeedObjectName() || mo.Flags.Get(jsonflags.StringifyNumbers)) + if err := xe.AppendRaw(k, !m.hasCustomFormat(), m.appendMarshal); err != nil { + if mo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return internal.NewMarshalerError(va.Addr().Interface(), err, "MarshalJSON") // unlike unmarshal, always wrapped + } + if !isSyntacticError(err) && !export.IsIOError(err) { + err = newMarshalErrorBefore(enc, t, err) + } + return err + } + return nil + } + fncs.unmarshal = func(dec *jsontext.Decoder, va addressableValue, uo *jsonopts.Struct) (err error) { + xd := export.Decoder(dec) + var u timeArshaler + if uo.Format != "" && uo.FormatDepth == xd.Tokens.Depth() { + if !u.initFormat(uo.Format) { + return newInvalidFormatError(dec, t) + } + } else if uo.Flags.Get(jsonflags.ParseTimeWithLooseRFC3339) { + u.looseRFC3339 = true + } + + stringify := !u.isNumeric() || xd.Tokens.Last.NeedObjectName() || uo.Flags.Get(jsonflags.StringifyNumbers) + var flags jsonwire.ValueFlags + tt, _ := reflect.TypeAssert[*time.Time](va.Addr()) + val, err := xd.ReadValue(&flags) + if err != nil { + return err + } + switch k := val.Kind(); k { + case 'n': + if !uo.Flags.Get(jsonflags.MergeWithLegacySemantics) { + *tt = time.Time{} + } + return nil + case '"': + if !stringify { + break + } + val = jsonwire.UnquoteMayCopy(val, flags.IsVerbatim()) + if err := u.unmarshal(val); err != nil { + if uo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return err // unlike marshal, never wrapped + } + return newUnmarshalErrorAfter(dec, t, err) + } + *tt = u.tt + return nil + case '0': + if stringify { + break + } + if err := u.unmarshal(val); err != nil { + if uo.Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + return err // unlike marshal, never wrapped + } + return newUnmarshalErrorAfter(dec, t, err) + } + *tt = u.tt + return nil + } + return newUnmarshalErrorAfter(dec, t, nil) + } + } + return fncs +} + +type durationArshaler struct { + td time.Duration + + // base records the representation where: + // - 0 uses time.Duration.String + // - 1e0, 1e3, 1e6, or 1e9 use a decimal encoding of the duration as + // nanoseconds, microseconds, milliseconds, or seconds. + // - 8601 uses ISO 8601 + base uint64 +} + +func (a *durationArshaler) initFormat(format string) (ok bool) { + switch format { + case "units": + a.base = 0 + case "sec": + a.base = 1e9 + case "milli": + a.base = 1e6 + case "micro": + a.base = 1e3 + case "nano": + a.base = 1e0 + case "iso8601": + a.base = 8601 + default: + return false + } + return true +} + +func (a *durationArshaler) isNumeric() bool { + return a.base != 0 && a.base != 8601 +} + +func (a *durationArshaler) appendMarshal(b []byte) ([]byte, error) { + switch a.base { + case 0: + return append(b, a.td.String()...), nil + case 8601: + return appendDurationISO8601(b, a.td), nil + default: + return appendDurationBase10(b, a.td, a.base), nil + } +} + +func (a *durationArshaler) unmarshal(b []byte) (err error) { + switch a.base { + case 0: + a.td, err = time.ParseDuration(string(b)) + case 8601: + a.td, err = parseDurationISO8601(b) + default: + a.td, err = parseDurationBase10(b, a.base) + } + return err +} + +type timeArshaler struct { + tt time.Time + + // base records the representation where: + // - 0 uses RFC 3339 encoding of the timestamp + // - 1e0, 1e3, 1e6, or 1e9 use a decimal encoding of the timestamp as + // seconds, milliseconds, microseconds, or nanoseconds since Unix epoch. + // - math.MaxUint uses time.Time.Format to encode the timestamp + base uint64 + format string // time format passed to time.Parse + + looseRFC3339 bool +} + +func (a *timeArshaler) initFormat(format string) bool { + // We assume that an exported constant in the time package will + // always start with an uppercase ASCII letter. + if len(format) == 0 { + return false + } + a.base = math.MaxUint // implies custom format + if c := format[0]; !('a' <= c && c <= 'z') && !('A' <= c && c <= 'Z') { + a.format = format + return true + } + switch format { + case "ANSIC": + a.format = time.ANSIC + case "UnixDate": + a.format = time.UnixDate + case "RubyDate": + a.format = time.RubyDate + case "RFC822": + a.format = time.RFC822 + case "RFC822Z": + a.format = time.RFC822Z + case "RFC850": + a.format = time.RFC850 + case "RFC1123": + a.format = time.RFC1123 + case "RFC1123Z": + a.format = time.RFC1123Z + case "RFC3339": + a.base = 0 + a.format = time.RFC3339 + case "RFC3339Nano": + a.base = 0 + a.format = time.RFC3339Nano + case "Kitchen": + a.format = time.Kitchen + case "Stamp": + a.format = time.Stamp + case "StampMilli": + a.format = time.StampMilli + case "StampMicro": + a.format = time.StampMicro + case "StampNano": + a.format = time.StampNano + case "DateTime": + a.format = time.DateTime + case "DateOnly": + a.format = time.DateOnly + case "TimeOnly": + a.format = time.TimeOnly + case "unix": + a.base = 1e0 + case "unixmilli": + a.base = 1e3 + case "unixmicro": + a.base = 1e6 + case "unixnano": + a.base = 1e9 + default: + // Reject any Go identifier in case new constants are supported. + if strings.TrimFunc(format, isLetterOrDigit) == "" { + return false + } + a.format = format + } + return true +} + +func (a *timeArshaler) isNumeric() bool { + return int(a.base) > 0 +} + +func (a *timeArshaler) hasCustomFormat() bool { + return a.base == math.MaxUint +} + +func (a *timeArshaler) appendMarshal(b []byte) ([]byte, error) { + switch a.base { + case 0: + format := cmp.Or(a.format, time.RFC3339Nano) + n0 := len(b) + b = a.tt.AppendFormat(b, format) + // Not all Go timestamps can be represented as valid RFC 3339. + // Explicitly check for these edge cases. + // See https://go.dev/issue/4556 and https://go.dev/issue/54580. + switch b := b[n0:]; { + case b[len("9999")] != '-': // year must be exactly 4 digits wide + return b, errors.New("year outside of range [0,9999]") + case b[len(b)-1] != 'Z': + c := b[len(b)-len("Z07:00")] + if ('0' <= c && c <= '9') || parseDec2(b[len(b)-len("07:00"):]) >= 24 { + return b, errors.New("timezone hour outside of range [0,23]") + } + } + return b, nil + case math.MaxUint: + return a.tt.AppendFormat(b, a.format), nil + default: + return appendTimeUnix(b, a.tt, a.base), nil + } +} + +func (a *timeArshaler) unmarshal(b []byte) (err error) { + switch a.base { + case 0: + // Use time.Time.UnmarshalText to avoid possible string allocation. + if err := a.tt.UnmarshalText(b); err != nil { + return err + } + // TODO(https://go.dev/issue/57912): + // RFC 3339 specifies the grammar for a valid timestamp. + // However, the parsing functionality in "time" is too loose and + // incorrectly accepts invalid timestamps as valid. + // Remove these manual checks when "time" checks it for us. + newParseError := func(layout, value, layoutElem, valueElem, message string) error { + return &time.ParseError{Layout: layout, Value: value, LayoutElem: layoutElem, ValueElem: valueElem, Message: message} + } + switch { + case a.looseRFC3339: + return nil + case b[len("2006-01-02T")+1] == ':': // hour must be two digits + return newParseError(time.RFC3339, string(b), "15", string(b[len("2006-01-02T"):][:1]), "") + case b[len("2006-01-02T15:04:05")] == ',': // sub-second separator must be a period + return newParseError(time.RFC3339, string(b), ".", ",", "") + case b[len(b)-1] != 'Z': + switch { + case parseDec2(b[len(b)-len("07:00"):]) >= 24: // timezone hour must be in range + return newParseError(time.RFC3339, string(b), "Z07:00", string(b[len(b)-len("Z07:00"):]), ": timezone hour out of range") + case parseDec2(b[len(b)-len("00"):]) >= 60: // timezone minute must be in range + return newParseError(time.RFC3339, string(b), "Z07:00", string(b[len(b)-len("Z07:00"):]), ": timezone minute out of range") + } + } + return nil + case math.MaxUint: + a.tt, err = time.Parse(a.format, string(b)) + return err + default: + a.tt, err = parseTimeUnix(b, a.base) + return err + } +} + +// appendDurationBase10 appends d formatted as a decimal fractional number, +// where pow10 is a power-of-10 used to scale down the number. +func appendDurationBase10(b []byte, d time.Duration, pow10 uint64) []byte { + b, n := mayAppendDurationSign(b, d) // append sign + whole, frac := bits.Div64(0, n, uint64(pow10)) // compute whole and frac fields + b = strconv.AppendUint(b, whole, 10) // append whole field + return appendFracBase10(b, frac, pow10) // append frac field +} + +// parseDurationBase10 parses d from a decimal fractional number, +// where pow10 is a power-of-10 used to scale up the number. +func parseDurationBase10(b []byte, pow10 uint64) (time.Duration, error) { + suffix, neg := consumeSign(b, false) // consume sign + wholeBytes, fracBytes := bytesCutByte(suffix, '.', true) // consume whole and frac fields + whole, okWhole := jsonwire.ParseUint(wholeBytes) // parse whole field; may overflow + frac, okFrac := parseFracBase10(fracBytes, pow10) // parse frac field + hi, lo := bits.Mul64(whole, uint64(pow10)) // overflow if hi > 0 + sum, co := bits.Add64(lo, uint64(frac), 0) // overflow if co > 0 + switch d := mayApplyDurationSign(sum, neg); { // overflow if neg != (d < 0) + case (!okWhole && whole != math.MaxUint64) || !okFrac: + return 0, fmt.Errorf("invalid duration %q: %w", b, strconv.ErrSyntax) + case !okWhole || hi > 0 || co > 0 || neg != (d < 0): + return 0, fmt.Errorf("invalid duration %q: %w", b, strconv.ErrRange) + default: + return d, nil + } +} + +// appendDurationISO8601 appends an ISO 8601 duration with a restricted grammar, +// where leading and trailing zeroes and zero-value designators are omitted. +// It only uses hour, minute, and second designators since ISO 8601 defines +// those as being "accurate", while year, month, week, and day are "nominal". +func appendDurationISO8601(b []byte, d time.Duration) []byte { + if d == 0 { + return append(b, "PT0S"...) + } + b, n := mayAppendDurationSign(b, d) + b = append(b, "PT"...) + n, nsec := bits.Div64(0, n, 1e9) // compute nsec field + n, sec := bits.Div64(0, n, 60) // compute sec field + hour, min := bits.Div64(0, n, 60) // compute hour and min fields + if hour > 0 { + b = append(strconv.AppendUint(b, hour, 10), 'H') + } + if min > 0 { + b = append(strconv.AppendUint(b, min, 10), 'M') + } + if sec > 0 || nsec > 0 { + b = append(appendFracBase10(strconv.AppendUint(b, sec, 10), nsec, 1e9), 'S') + } + return b +} + +// daysPerYear is the exact average number of days in a year according to +// the Gregorian calendar, which has an extra day each year that is +// a multiple of 4, unless it is evenly divisible by 100 but not by 400. +// This does not take into account leap seconds, which are not deterministic. +const daysPerYear = 365.2425 + +var errInaccurateDateUnits = errors.New("inaccurate year, month, week, or day units") + +// parseDurationISO8601 parses a duration according to ISO 8601-1:2019, +// section 5.5.2.2 and 5.5.2.3 with the following restrictions or extensions: +// +// - A leading minus sign is permitted for negative duration according +// to ISO 8601-2:2019, section 4.4.1.9. We do not permit negative values +// for each "time scale component", which is permitted by section 4.4.1.1, +// but rarely supported by parsers. +// +// - A leading plus sign is permitted (and ignored). +// This is not required by ISO 8601, but not forbidden either. +// There is some precedent for this as it is supported by the principle of +// duration arithmetic as specified in ISO 8601-2-2019, section 14.1. +// Of note, the JavaScript grammar for ISO 8601 permits a leading plus sign. +// +// - A fractional value is only permitted for accurate units +// (i.e., hour, minute, and seconds) in the last time component, +// which is permissible by ISO 8601-1:2019, section 5.5.2.3. +// +// - Both periods ('.') and commas (',') are supported as the separator +// between the integer part and fraction part of a number, +// as specified in ISO 8601-1:2019, section 3.2.6. +// While ISO 8601 recommends comma as the default separator, +// most formatters uses a period. +// +// - Leading zeros are ignored. This is not required by ISO 8601, +// but also not forbidden by the standard. Many parsers support this. +// +// - Lowercase designators are supported. This is not required by ISO 8601, +// but also not forbidden by the standard. Many parsers support this. +// +// If the nominal units of year, month, week, or day are present, +// this produces a best-effort value and also reports [errInaccurateDateUnits]. +// +// The accepted grammar is identical to JavaScript's Duration: +// +// https://tc39.es/proposal-temporal/#prod-Duration +// +// We follow JavaScript's grammar as JSON itself is derived from JavaScript. +// The Temporal.Duration.toJSON method is guaranteed to produce an output +// that can be parsed by this function so long as arithmetic in JavaScript +// do not use a largestUnit value higher than "hours" (which is the default). +// Even if it does, this will do a best-effort parsing with inaccurate units, +// but report [errInaccurateDateUnits]. +func parseDurationISO8601(b []byte) (time.Duration, error) { + var invalid, overflow, inaccurate, sawFrac bool + var sumNanos, n, co uint64 + + // cutBytes is like [bytes.Cut], but uses either c0 or c1 as the separator. + cutBytes := func(b []byte, c0, c1 byte) (prefix, suffix []byte, ok bool) { + for i, c := range b { + if c == c0 || c == c1 { + return b[:i], b[i+1:], true + } + } + return b, nil, false + } + + // mayParseUnit attempts to parse another date or time number + // identified by the desHi and desLo unit characters. + // If the part is absent for current unit, it returns b as is. + mayParseUnit := func(b []byte, desHi, desLo byte, unit time.Duration) []byte { + number, suffix, ok := cutBytes(b, desHi, desLo) + if !ok || sawFrac { + return b // designator is not present or already saw fraction, which can only be in the last component + } + + // Parse the number. + // A fraction allowed for the accurate units in the last part. + whole, frac, ok := cutBytes(number, '.', ',') + if ok { + sawFrac = true + invalid = invalid || len(frac) == len("") || unit > time.Hour + if unit == time.Second { + n, ok = parsePaddedBase10(frac, uint64(time.Second)) + invalid = invalid || !ok + } else { + f, err := strconv.ParseFloat("0."+string(frac), 64) + invalid = invalid || err != nil || len(bytes.Trim(frac[len("."):], "0123456789")) > 0 + n = uint64(math.Round(f * float64(unit))) // never overflows since f is within [0..1] + } + sumNanos, co = bits.Add64(sumNanos, n, 0) // overflow if co > 0 + overflow = overflow || co > 0 + } + for len(whole) > 1 && whole[0] == '0' { + whole = whole[len("0"):] // trim leading zeros + } + n, ok := jsonwire.ParseUint(whole) // overflow if !ok && MaxUint64 + hi, lo := bits.Mul64(n, uint64(unit)) // overflow if hi > 0 + sumNanos, co = bits.Add64(sumNanos, lo, 0) // overflow if co > 0 + invalid = invalid || (!ok && n != math.MaxUint64) + overflow = overflow || (!ok && n == math.MaxUint64) || hi > 0 || co > 0 + inaccurate = inaccurate || unit > time.Hour + return suffix + } + + suffix, neg := consumeSign(b, true) + prefix, suffix, okP := cutBytes(suffix, 'P', 'p') + durDate, durTime, okT := cutBytes(suffix, 'T', 't') + invalid = invalid || len(prefix) > 0 || !okP || (okT && len(durTime) == 0) || len(durDate)+len(durTime) == 0 + if len(durDate) > 0 { // nominal portion of the duration + durDate = mayParseUnit(durDate, 'Y', 'y', time.Duration(daysPerYear*24*60*60*1e9)) + durDate = mayParseUnit(durDate, 'M', 'm', time.Duration(daysPerYear/12*24*60*60*1e9)) + durDate = mayParseUnit(durDate, 'W', 'w', time.Duration(7*24*60*60*1e9)) + durDate = mayParseUnit(durDate, 'D', 'd', time.Duration(24*60*60*1e9)) + invalid = invalid || len(durDate) > 0 // unknown elements + } + if len(durTime) > 0 { // accurate portion of the duration + durTime = mayParseUnit(durTime, 'H', 'h', time.Duration(60*60*1e9)) + durTime = mayParseUnit(durTime, 'M', 'm', time.Duration(60*1e9)) + durTime = mayParseUnit(durTime, 'S', 's', time.Duration(1e9)) + invalid = invalid || len(durTime) > 0 // unknown elements + } + d := mayApplyDurationSign(sumNanos, neg) + overflow = overflow || (neg != (d < 0) && d != 0) // overflows signed duration + + switch { + case invalid: + return 0, fmt.Errorf("invalid ISO 8601 duration %q: %w", b, strconv.ErrSyntax) + case overflow: + return 0, fmt.Errorf("invalid ISO 8601 duration %q: %w", b, strconv.ErrRange) + case inaccurate: + return d, fmt.Errorf("invalid ISO 8601 duration %q: %w", b, errInaccurateDateUnits) + default: + return d, nil + } +} + +// mayAppendDurationSign appends a negative sign if n is negative. +func mayAppendDurationSign(b []byte, d time.Duration) ([]byte, uint64) { + if d < 0 { + b = append(b, '-') + d *= -1 + } + return b, uint64(d) +} + +// mayApplyDurationSign inverts n if neg is specified. +func mayApplyDurationSign(n uint64, neg bool) time.Duration { + if neg { + return -1 * time.Duration(n) + } else { + return +1 * time.Duration(n) + } +} + +// appendTimeUnix appends t formatted as a decimal fractional number, +// where pow10 is a power-of-10 used to scale up the number. +func appendTimeUnix(b []byte, t time.Time, pow10 uint64) []byte { + sec, nsec := t.Unix(), int64(t.Nanosecond()) + if sec < 0 { + b = append(b, '-') + sec, nsec = negateSecNano(sec, nsec) + } + switch { + case pow10 == 1e0: // fast case where units is in seconds + b = strconv.AppendUint(b, uint64(sec), 10) + return appendFracBase10(b, uint64(nsec), 1e9) + case uint64(sec) < 1e9: // intermediate case where units is not seconds, but no overflow + b = strconv.AppendUint(b, uint64(sec)*uint64(pow10)+uint64(uint64(nsec)/(1e9/pow10)), 10) + return appendFracBase10(b, (uint64(nsec)*pow10)%1e9, 1e9) + default: // slow case where units is not seconds and overflow would occur + b = strconv.AppendUint(b, uint64(sec), 10) + b = appendPaddedBase10(b, uint64(nsec)/(1e9/pow10), pow10) + return appendFracBase10(b, (uint64(nsec)*pow10)%1e9, 1e9) + } +} + +// parseTimeUnix parses t formatted as a decimal fractional number, +// where pow10 is a power-of-10 used to scale down the number. +func parseTimeUnix(b []byte, pow10 uint64) (time.Time, error) { + suffix, neg := consumeSign(b, false) // consume sign + wholeBytes, fracBytes := bytesCutByte(suffix, '.', true) // consume whole and frac fields + whole, okWhole := jsonwire.ParseUint(wholeBytes) // parse whole field; may overflow + frac, okFrac := parseFracBase10(fracBytes, 1e9/pow10) // parse frac field + var sec, nsec int64 + switch { + case pow10 == 1e0: // fast case where units is in seconds + sec = int64(whole) // check overflow later after negation + nsec = int64(frac) // cannot overflow + case okWhole: // intermediate case where units is not seconds, but no overflow + sec = int64(whole / pow10) // check overflow later after negation + nsec = int64((whole%pow10)*(1e9/pow10) + frac) // cannot overflow + case !okWhole && whole == math.MaxUint64: // slow case where units is not seconds and overflow occurred + width := int(math.Log10(float64(pow10))) // compute len(strconv.Itoa(pow10-1)) + whole, okWhole = jsonwire.ParseUint(wholeBytes[:len(wholeBytes)-width]) // parse the upper whole field + mid, _ := parsePaddedBase10(wholeBytes[len(wholeBytes)-width:], pow10) // parse the lower whole field + sec = int64(whole) // check overflow later after negation + nsec = int64(mid*(1e9/pow10) + frac) // cannot overflow + } + if neg { + sec, nsec = negateSecNano(sec, nsec) + } + switch t := time.Unix(sec, nsec).UTC(); { + case (!okWhole && whole != math.MaxUint64) || !okFrac: + return time.Time{}, fmt.Errorf("invalid time %q: %w", b, strconv.ErrSyntax) + case !okWhole || neg != (t.Unix() < 0): + return time.Time{}, fmt.Errorf("invalid time %q: %w", b, strconv.ErrRange) + default: + return t, nil + } +} + +// negateSecNano negates a Unix timestamp, where nsec must be within [0, 1e9). +func negateSecNano(sec, nsec int64) (int64, int64) { + sec = ^sec // twos-complement negation (i.e., -1*sec + 1) + nsec = -nsec + 1e9 // negate nsec and add 1e9 (which is the extra +1 from sec negation) + sec += int64(nsec / 1e9) // handle possible overflow of nsec if it started as zero + nsec %= 1e9 // ensure nsec stays within [0, 1e9) + return sec, nsec +} + +// appendFracBase10 appends the fraction of n/max10, +// where max10 is a power-of-10 that is larger than n. +func appendFracBase10(b []byte, n, max10 uint64) []byte { + if n == 0 { + return b + } + return bytes.TrimRight(appendPaddedBase10(append(b, '.'), n, max10), "0") +} + +// parseFracBase10 parses the fraction of n/max10, +// where max10 is a power-of-10 that is larger than n. +func parseFracBase10(b []byte, max10 uint64) (n uint64, ok bool) { + switch { + case len(b) == 0: + return 0, true + case len(b) < len(".0") || b[0] != '.': + return 0, false + } + return parsePaddedBase10(b[len("."):], max10) +} + +// appendPaddedBase10 appends a zero-padded encoding of n, +// where max10 is a power-of-10 that is larger than n. +func appendPaddedBase10(b []byte, n, max10 uint64) []byte { + if n < max10/10 { + // Formatting of n is shorter than log10(max10), + // so add max10/10 to ensure the length is equal to log10(max10). + i := len(b) + b = strconv.AppendUint(b, n+max10/10, 10) + b[i]-- // subtract the addition of max10/10 + return b + } + return strconv.AppendUint(b, n, 10) +} + +// parsePaddedBase10 parses b as the zero-padded encoding of n, +// where max10 is a power-of-10 that is larger than n. +// Truncated suffix is treated as implicit zeros. +// Extended suffix is ignored, but verified to contain only digits. +func parsePaddedBase10(b []byte, max10 uint64) (n uint64, ok bool) { + pow10 := uint64(1) + for pow10 < max10 { + n *= 10 + if len(b) > 0 { + if b[0] < '0' || '9' < b[0] { + return n, false + } + n += uint64(b[0] - '0') + b = b[1:] + } + pow10 *= 10 + } + if len(b) > 0 && len(bytes.TrimRight(b, "0123456789")) > 0 { + return n, false // trailing characters are not digits + } + return n, true +} + +// consumeSign consumes an optional leading negative or positive sign. +func consumeSign(b []byte, allowPlus bool) ([]byte, bool) { + if len(b) > 0 { + if b[0] == '-' { + return b[len("-"):], true + } else if b[0] == '+' && allowPlus { + return b[len("+"):], false + } + } + return b, false +} + +// bytesCutByte is similar to bytes.Cut(b, []byte{c}), +// except c may optionally be included as part of the suffix. +func bytesCutByte(b []byte, c byte, include bool) ([]byte, []byte) { + if i := bytes.IndexByte(b, c); i >= 0 { + if include { + return b[:i], b[i:] + } + return b[:i], b[i+1:] + } + return b, nil +} + +// parseDec2 parses b as an unsigned, base-10, 2-digit number. +// The result is undefined if digits are not base-10. +func parseDec2(b []byte) byte { + if len(b) < 2 { + return 0 + } + return 10*(b[0]-'0') + (b[1] - '0') +} diff --git a/go/src/encoding/json/v2/arshal_time_test.go b/go/src/encoding/json/v2/arshal_time_test.go new file mode 100644 index 0000000000000000000000000000000000000000..6c08e12494860ba4e731e315643a95c6d6e18c58 --- /dev/null +++ b/go/src/encoding/json/v2/arshal_time_test.go @@ -0,0 +1,394 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json + +import ( + "errors" + "fmt" + "math" + "strconv" + "testing" + "time" + + "encoding/json/internal/jsonwire" +) + +func baseLabel(base uint64) string { + if log10 := math.Log10(float64(base)); log10 == float64(int64(log10)) { + return fmt.Sprintf("1e%d", int(log10)) + } + return fmt.Sprint(base) +} + +var formatDurationTestdata = []struct { + td time.Duration + base10Sec string + base10Milli string + base10Micro string + base10Nano string + iso8601 string +}{ + {math.MaxInt64, "9223372036.854775807", "9223372036854.775807", "9223372036854775.807", "9223372036854775807", "PT2562047H47M16.854775807S"}, + {123*time.Hour + 4*time.Minute + 56*time.Second, "443096", "443096000", "443096000000", "443096000000000", "PT123H4M56S"}, + {time.Hour, "3600", "3600000", "3600000000", "3600000000000", "PT1H"}, + {time.Minute, "60", "60000", "60000000", "60000000000", "PT1M"}, + {1e12 + 1e12, "2000", "2000000", "2000000000", "2000000000000", "PT33M20S"}, + {1e12 + 1e11, "1100", "1100000", "1100000000", "1100000000000", "PT18M20S"}, + {1e12 + 1e10, "1010", "1010000", "1010000000", "1010000000000", "PT16M50S"}, + {1e12 + 1e9, "1001", "1001000", "1001000000", "1001000000000", "PT16M41S"}, + {1e12 + 1e8, "1000.1", "1000100", "1000100000", "1000100000000", "PT16M40.1S"}, + {1e12 + 1e7, "1000.01", "1000010", "1000010000", "1000010000000", "PT16M40.01S"}, + {1e12 + 1e6, "1000.001", "1000001", "1000001000", "1000001000000", "PT16M40.001S"}, + {1e12 + 1e5, "1000.0001", "1000000.1", "1000000100", "1000000100000", "PT16M40.0001S"}, + {1e12 + 1e4, "1000.00001", "1000000.01", "1000000010", "1000000010000", "PT16M40.00001S"}, + {1e12 + 1e3, "1000.000001", "1000000.001", "1000000001", "1000000001000", "PT16M40.000001S"}, + {1e12 + 1e2, "1000.0000001", "1000000.0001", "1000000000.1", "1000000000100", "PT16M40.0000001S"}, + {1e12 + 1e1, "1000.00000001", "1000000.00001", "1000000000.01", "1000000000010", "PT16M40.00000001S"}, + {1e12 + 1e0, "1000.000000001", "1000000.000001", "1000000000.001", "1000000000001", "PT16M40.000000001S"}, + {+(1e9 + 1), "1.000000001", "1000.000001", "1000000.001", "1000000001", "PT1.000000001S"}, + {+(1e9), "1", "1000", "1000000", "1000000000", "PT1S"}, + {+(1e9 - 1), "0.999999999", "999.999999", "999999.999", "999999999", "PT0.999999999S"}, + {+100000000, "0.1", "100", "100000", "100000000", "PT0.1S"}, + {+120000000, "0.12", "120", "120000", "120000000", "PT0.12S"}, + {+123000000, "0.123", "123", "123000", "123000000", "PT0.123S"}, + {+123400000, "0.1234", "123.4", "123400", "123400000", "PT0.1234S"}, + {+123450000, "0.12345", "123.45", "123450", "123450000", "PT0.12345S"}, + {+123456000, "0.123456", "123.456", "123456", "123456000", "PT0.123456S"}, + {+123456700, "0.1234567", "123.4567", "123456.7", "123456700", "PT0.1234567S"}, + {+123456780, "0.12345678", "123.45678", "123456.78", "123456780", "PT0.12345678S"}, + {+123456789, "0.123456789", "123.456789", "123456.789", "123456789", "PT0.123456789S"}, + {+12345678, "0.012345678", "12.345678", "12345.678", "12345678", "PT0.012345678S"}, + {+1234567, "0.001234567", "1.234567", "1234.567", "1234567", "PT0.001234567S"}, + {+123456, "0.000123456", "0.123456", "123.456", "123456", "PT0.000123456S"}, + {+12345, "0.000012345", "0.012345", "12.345", "12345", "PT0.000012345S"}, + {+1234, "0.000001234", "0.001234", "1.234", "1234", "PT0.000001234S"}, + {+123, "0.000000123", "0.000123", "0.123", "123", "PT0.000000123S"}, + {+12, "0.000000012", "0.000012", "0.012", "12", "PT0.000000012S"}, + {+1, "0.000000001", "0.000001", "0.001", "1", "PT0.000000001S"}, + {0, "0", "0", "0", "0", "PT0S"}, + {-1, "-0.000000001", "-0.000001", "-0.001", "-1", "-PT0.000000001S"}, + {-12, "-0.000000012", "-0.000012", "-0.012", "-12", "-PT0.000000012S"}, + {-123, "-0.000000123", "-0.000123", "-0.123", "-123", "-PT0.000000123S"}, + {-1234, "-0.000001234", "-0.001234", "-1.234", "-1234", "-PT0.000001234S"}, + {-12345, "-0.000012345", "-0.012345", "-12.345", "-12345", "-PT0.000012345S"}, + {-123456, "-0.000123456", "-0.123456", "-123.456", "-123456", "-PT0.000123456S"}, + {-1234567, "-0.001234567", "-1.234567", "-1234.567", "-1234567", "-PT0.001234567S"}, + {-12345678, "-0.012345678", "-12.345678", "-12345.678", "-12345678", "-PT0.012345678S"}, + {-123456789, "-0.123456789", "-123.456789", "-123456.789", "-123456789", "-PT0.123456789S"}, + {-123456780, "-0.12345678", "-123.45678", "-123456.78", "-123456780", "-PT0.12345678S"}, + {-123456700, "-0.1234567", "-123.4567", "-123456.7", "-123456700", "-PT0.1234567S"}, + {-123456000, "-0.123456", "-123.456", "-123456", "-123456000", "-PT0.123456S"}, + {-123450000, "-0.12345", "-123.45", "-123450", "-123450000", "-PT0.12345S"}, + {-123400000, "-0.1234", "-123.4", "-123400", "-123400000", "-PT0.1234S"}, + {-123000000, "-0.123", "-123", "-123000", "-123000000", "-PT0.123S"}, + {-120000000, "-0.12", "-120", "-120000", "-120000000", "-PT0.12S"}, + {-100000000, "-0.1", "-100", "-100000", "-100000000", "-PT0.1S"}, + {-(1e9 - 1), "-0.999999999", "-999.999999", "-999999.999", "-999999999", "-PT0.999999999S"}, + {-(1e9), "-1", "-1000", "-1000000", "-1000000000", "-PT1S"}, + {-(1e9 + 1), "-1.000000001", "-1000.000001", "-1000000.001", "-1000000001", "-PT1.000000001S"}, + {math.MinInt64, "-9223372036.854775808", "-9223372036854.775808", "-9223372036854775.808", "-9223372036854775808", "-PT2562047H47M16.854775808S"}, +} + +func TestFormatDuration(t *testing.T) { + var gotBuf []byte + check := func(td time.Duration, s string, base uint64) { + a := durationArshaler{td, base} + gotBuf, _ = a.appendMarshal(gotBuf[:0]) + if string(gotBuf) != s { + t.Errorf("formatDuration(%d, %s) = %q, want %q", td, baseLabel(base), string(gotBuf), s) + } + if err := a.unmarshal(gotBuf); err != nil { + t.Errorf("parseDuration(%q, %s) error: %v", gotBuf, baseLabel(base), err) + } + if a.td != td { + t.Errorf("parseDuration(%q, %s) = %d, want %d", gotBuf, baseLabel(base), a.td, td) + } + } + for _, tt := range formatDurationTestdata { + check(tt.td, tt.base10Sec, 1e9) + check(tt.td, tt.base10Milli, 1e6) + check(tt.td, tt.base10Micro, 1e3) + check(tt.td, tt.base10Nano, 1e0) + check(tt.td, tt.iso8601, 8601) + } +} + +var parseDurationTestdata = []struct { + in string + base uint64 + want time.Duration + wantErr error +}{ + {"0", 1e0, 0, nil}, + {"0.", 1e0, 0, strconv.ErrSyntax}, + {"0.0", 1e0, 0, nil}, + {"0.00", 1e0, 0, nil}, + {"00.0", 1e0, 0, strconv.ErrSyntax}, + {"+0", 1e0, 0, strconv.ErrSyntax}, + {"1e0", 1e0, 0, strconv.ErrSyntax}, + {"1.000000000x", 1e9, 0, strconv.ErrSyntax}, + {"1.000000x", 1e6, 0, strconv.ErrSyntax}, + {"1.000x", 1e3, 0, strconv.ErrSyntax}, + {"1.x", 1e0, 0, strconv.ErrSyntax}, + {"1.0000000009", 1e9, +time.Second, nil}, + {"1.0000009", 1e6, +time.Millisecond, nil}, + {"1.0009", 1e3, +time.Microsecond, nil}, + {"1.9", 1e0, +time.Nanosecond, nil}, + {"-9223372036854775809", 1e0, 0, strconv.ErrRange}, + {"9223372036854775.808", 1e3, 0, strconv.ErrRange}, + {"-9223372036854.775809", 1e6, 0, strconv.ErrRange}, + {"9223372036.854775808", 1e9, 0, strconv.ErrRange}, + {"-1.9", 1e0, -time.Nanosecond, nil}, + {"-1.0009", 1e3, -time.Microsecond, nil}, + {"-1.0000009", 1e6, -time.Millisecond, nil}, + {"-1.0000000009", 1e9, -time.Second, nil}, + {"", 8601, 0, strconv.ErrSyntax}, + {"P", 8601, 0, strconv.ErrSyntax}, + {"PT", 8601, 0, strconv.ErrSyntax}, + {"PT0", 8601, 0, strconv.ErrSyntax}, + {"DT0S", 8601, 0, strconv.ErrSyntax}, + {"PT0S", 8601, 0, nil}, + {" PT0S", 8601, 0, strconv.ErrSyntax}, + {"PT0S ", 8601, 0, strconv.ErrSyntax}, + {"+PT0S", 8601, 0, nil}, + {"PT0.M", 8601, 0, strconv.ErrSyntax}, + {"PT0.S", 8601, 0, strconv.ErrSyntax}, + {"PT0.0S", 8601, 0, nil}, + {"PT0.0_0H", 8601, 0, strconv.ErrSyntax}, + {"PT0.0_0M", 8601, 0, strconv.ErrSyntax}, + {"PT0.0_0S", 8601, 0, strconv.ErrSyntax}, + {"PT.0S", 8601, 0, strconv.ErrSyntax}, + {"PT00.0S", 8601, 0, nil}, + {"PT0S", 8601, 0, nil}, + {"PT1,5S", 8601, time.Second + 500*time.Millisecond, nil}, + {"PT1H", 8601, time.Hour, nil}, + {"PT1H0S", 8601, time.Hour, nil}, + {"PT0S", 8601, 0, nil}, + {"PT00S", 8601, 0, nil}, + {"PT000S", 8601, 0, nil}, + {"PTS", 8601, 0, strconv.ErrSyntax}, + {"PT1M", 8601, time.Minute, nil}, + {"PT01M", 8601, time.Minute, nil}, + {"PT001M", 8601, time.Minute, nil}, + {"PT1H59S", 8601, time.Hour + 59*time.Second, nil}, + {"PT123H4M56.789S", 8601, 123*time.Hour + 4*time.Minute + 56*time.Second + 789*time.Millisecond, nil}, + {"-PT123H4M56.789S", 8601, -123*time.Hour - 4*time.Minute - 56*time.Second - 789*time.Millisecond, nil}, + {"PT0H0S", 8601, 0, nil}, + {"PT0H", 8601, 0, nil}, + {"PT0M", 8601, 0, nil}, + {"-PT0S", 8601, 0, nil}, + {"PT1M0S", 8601, time.Minute, nil}, + {"PT0H1M0S", 8601, time.Minute, nil}, + {"PT01H02M03S", 8601, 1*time.Hour + 2*time.Minute + 3*time.Second, nil}, + {"PT0,123S", 8601, 123 * time.Millisecond, nil}, + {"PT1.S", 8601, 0, strconv.ErrSyntax}, + {"PT1.000S", 8601, time.Second, nil}, + {"PT0.025H", 8601, time.Minute + 30*time.Second, nil}, + {"PT0.025H0M", 8601, 0, strconv.ErrSyntax}, + {"PT1.5M", 8601, time.Minute + 30*time.Second, nil}, + {"PT1.5M0S", 8601, 0, strconv.ErrSyntax}, + {"PT60M", 8601, time.Hour, nil}, + {"PT3600S", 8601, time.Hour, nil}, + {"PT1H2M3.0S", 8601, 1*time.Hour + 2*time.Minute + 3*time.Second, nil}, + {"pt1h2m3,0s", 8601, 1*time.Hour + 2*time.Minute + 3*time.Second, nil}, + {"PT-1H-2M-3S", 8601, 0, strconv.ErrSyntax}, + {"P1Y", 8601, time.Duration(daysPerYear * 24 * 60 * 60 * 1e9), errInaccurateDateUnits}, + {"P1.0Y", 8601, 0, strconv.ErrSyntax}, + {"P1M", 8601, time.Duration(daysPerYear / 12 * 24 * 60 * 60 * 1e9), errInaccurateDateUnits}, + {"P1.0M", 8601, 0, strconv.ErrSyntax}, + {"P1W", 8601, 7 * 24 * time.Hour, errInaccurateDateUnits}, + {"P1.0W", 8601, 0, strconv.ErrSyntax}, + {"P1D", 8601, 24 * time.Hour, errInaccurateDateUnits}, + {"P1.0D", 8601, 0, strconv.ErrSyntax}, + {"P1W1S", 8601, 0, strconv.ErrSyntax}, + {"-P1Y2M3W4DT5H6M7.8S", 8601, -(time.Duration(14*daysPerYear/12*24*60*60*1e9) + time.Duration((3*7+4)*24*60*60*1e9) + 5*time.Hour + 6*time.Minute + 7*time.Second + 800*time.Millisecond), errInaccurateDateUnits}, + {"-p1y2m3w4dt5h6m7.8s", 8601, -(time.Duration(14*daysPerYear/12*24*60*60*1e9) + time.Duration((3*7+4)*24*60*60*1e9) + 5*time.Hour + 6*time.Minute + 7*time.Second + 800*time.Millisecond), errInaccurateDateUnits}, + {"P0Y0M0DT1H2M3S", 8601, 1*time.Hour + 2*time.Minute + 3*time.Second, errInaccurateDateUnits}, + {"PT0.0000000001S", 8601, 0, nil}, + {"PT0.0000000005S", 8601, 0, nil}, + {"PT0.000000000500000000S", 8601, 0, nil}, + {"PT0.000000000499999999S", 8601, 0, nil}, + {"PT2562047H47M16.854775808S", 8601, 0, strconv.ErrRange}, + {"-PT2562047H47M16.854775809S", 8601, 0, strconv.ErrRange}, + {"PT9223372036.854775807S", 8601, math.MaxInt64, nil}, + {"PT9223372036.854775808S", 8601, 0, strconv.ErrRange}, + {"-PT9223372036.854775808S", 8601, math.MinInt64, nil}, + {"-PT9223372036.854775809S", 8601, 0, strconv.ErrRange}, + {"PT18446744073709551616S", 8601, 0, strconv.ErrRange}, + {"PT5124096H", 8601, 0, strconv.ErrRange}, + {"PT2562047.7880152155019444H", 8601, math.MaxInt64, nil}, + {"PT2562047.7880152155022222H", 8601, 0, strconv.ErrRange}, + {"PT5124094H94M33.709551616S", 8601, 0, strconv.ErrRange}, +} + +func TestParseDuration(t *testing.T) { + for _, tt := range parseDurationTestdata { + a := durationArshaler{base: tt.base} + switch err := a.unmarshal([]byte(tt.in)); { + case a.td != tt.want: + t.Errorf("parseDuration(%q, %s) = %v, want %v", tt.in, baseLabel(tt.base), a.td, tt.want) + case !errors.Is(err, tt.wantErr): + t.Errorf("parseDuration(%q, %s) error = %v, want %v", tt.in, baseLabel(tt.base), err, tt.wantErr) + } + } +} + +func FuzzFormatDuration(f *testing.F) { + for _, tt := range formatDurationTestdata { + f.Add(int64(tt.td)) + } + f.Fuzz(func(t *testing.T, want int64) { + var buf []byte + for _, base := range [...]uint64{1e0, 1e3, 1e6, 1e9, 8601} { + a := durationArshaler{td: time.Duration(want), base: base} + buf, _ = a.appendMarshal(buf[:0]) + switch err := a.unmarshal(buf); { + case err != nil: + t.Fatalf("parseDuration(%q, %s) error: %v", buf, baseLabel(base), err) + case a.td != time.Duration(want): + t.Fatalf("parseDuration(%q, %s) = %v, want %v", buf, baseLabel(base), a.td, time.Duration(want)) + } + } + }) +} + +func FuzzParseDuration(f *testing.F) { + for _, tt := range parseDurationTestdata { + f.Add([]byte(tt.in)) + } + f.Fuzz(func(t *testing.T, in []byte) { + for _, base := range [...]uint64{1e0, 1e3, 1e6, 1e9, 8601} { + a := durationArshaler{base: base} + switch err := a.unmarshal(in); { + case err != nil: // nothing else to check + case base != 8601: + if n, err := jsonwire.ConsumeNumber(in); err != nil || n != len(in) { + t.Fatalf("parseDuration(%q) error is nil for invalid JSON number", in) + } + } + } + }) +} + +type formatTimeTestdataEntry struct { + ts time.Time + unixSec string + unixMilli string + unixMicro string + unixNano string +} + +var formatTimeTestdata = func() []formatTimeTestdataEntry { + out := []formatTimeTestdataEntry{ + {time.Unix(math.MaxInt64/int64(1e0), 1e9-1).UTC(), "9223372036854775807.999999999", "9223372036854775807999.999999", "9223372036854775807999999.999", "9223372036854775807999999999"}, + {time.Unix(math.MaxInt64/int64(1e1), 1e9-1).UTC(), "922337203685477580.999999999", "922337203685477580999.999999", "922337203685477580999999.999", "922337203685477580999999999"}, + {time.Unix(math.MaxInt64/int64(1e2), 1e9-1).UTC(), "92233720368547758.999999999", "92233720368547758999.999999", "92233720368547758999999.999", "92233720368547758999999999"}, + {time.Unix(math.MinInt64, 1).UTC(), "-9223372036854775807.999999999", "-9223372036854775807999.999999", "-9223372036854775807999999.999", "-9223372036854775807999999999"}, + {time.Unix(math.MinInt64, 0).UTC(), "-9223372036854775808", "-9223372036854775808000", "-9223372036854775808000000", "-9223372036854775808000000000"}, + } + for _, tt := range formatDurationTestdata { + out = append(out, formatTimeTestdataEntry{time.Unix(0, int64(tt.td)).UTC(), tt.base10Sec, tt.base10Milli, tt.base10Micro, tt.base10Nano}) + } + return out +}() + +func TestFormatTime(t *testing.T) { + var gotBuf []byte + check := func(ts time.Time, s string, pow10 uint64) { + gotBuf = appendTimeUnix(gotBuf[:0], ts, pow10) + if string(gotBuf) != s { + t.Errorf("formatTime(time.Unix(%d, %d), %s) = %q, want %q", ts.Unix(), ts.Nanosecond(), baseLabel(pow10), string(gotBuf), s) + } + gotTS, err := parseTimeUnix(gotBuf, pow10) + if err != nil { + t.Errorf("parseTime(%q, %s) error: %v", gotBuf, baseLabel(pow10), err) + } + if !gotTS.Equal(ts) { + t.Errorf("parseTime(%q, %s) = time.Unix(%d, %d), want time.Unix(%d, %d)", gotBuf, baseLabel(pow10), gotTS.Unix(), gotTS.Nanosecond(), ts.Unix(), ts.Nanosecond()) + } + } + for _, tt := range formatTimeTestdata { + check(tt.ts, tt.unixSec, 1e0) + check(tt.ts, tt.unixMilli, 1e3) + check(tt.ts, tt.unixMicro, 1e6) + check(tt.ts, tt.unixNano, 1e9) + } +} + +var parseTimeTestdata = []struct { + in string + base uint64 + want time.Time + wantErr error +}{ + {"0", 1e0, time.Unix(0, 0).UTC(), nil}, + {"0.", 1e0, time.Time{}, strconv.ErrSyntax}, + {"0.0", 1e0, time.Unix(0, 0).UTC(), nil}, + {"0.00", 1e0, time.Unix(0, 0).UTC(), nil}, + {"00.0", 1e0, time.Time{}, strconv.ErrSyntax}, + {"+0", 1e0, time.Time{}, strconv.ErrSyntax}, + {"1e0", 1e0, time.Time{}, strconv.ErrSyntax}, + {"1234567890123456789012345678901234567890", 1e0, time.Time{}, strconv.ErrRange}, + {"9223372036854775808000.000000", 1e3, time.Time{}, strconv.ErrRange}, + {"9223372036854775807999999.9999", 1e6, time.Unix(math.MaxInt64, 1e9-1).UTC(), nil}, + {"9223372036854775807999999999.9", 1e9, time.Unix(math.MaxInt64, 1e9-1).UTC(), nil}, + {"9223372036854775807.999999999x", 1e0, time.Time{}, strconv.ErrSyntax}, + {"9223372036854775807000000000", 1e9, time.Unix(math.MaxInt64, 0).UTC(), nil}, + {"-9223372036854775808", 1e0, time.Unix(math.MinInt64, 0).UTC(), nil}, + {"-9223372036854775808000.000001", 1e3, time.Time{}, strconv.ErrRange}, + {"-9223372036854775808000000.0001", 1e6, time.Unix(math.MinInt64, 0).UTC(), nil}, + {"-9223372036854775808000000000.x", 1e9, time.Time{}, strconv.ErrSyntax}, + {"-1234567890123456789012345678901234567890", 1e9, time.Time{}, strconv.ErrRange}, +} + +func TestParseTime(t *testing.T) { + for _, tt := range parseTimeTestdata { + a := timeArshaler{base: tt.base} + switch err := a.unmarshal([]byte(tt.in)); { + case a.tt != tt.want: + t.Errorf("parseTime(%q, %s) = time.Unix(%d, %d), want time.Unix(%d, %d)", tt.in, baseLabel(tt.base), a.tt.Unix(), a.tt.Nanosecond(), tt.want.Unix(), tt.want.Nanosecond()) + case !errors.Is(err, tt.wantErr): + t.Errorf("parseTime(%q, %s) error = %v, want %v", tt.in, baseLabel(tt.base), err, tt.wantErr) + } + } +} + +func FuzzFormatTime(f *testing.F) { + for _, tt := range formatTimeTestdata { + f.Add(tt.ts.Unix(), int64(tt.ts.Nanosecond())) + } + f.Fuzz(func(t *testing.T, wantSec, wantNano int64) { + want := time.Unix(wantSec, int64(uint64(wantNano)%1e9)).UTC() + var buf []byte + for _, base := range [...]uint64{1e0, 1e3, 1e6, 1e9} { + a := timeArshaler{tt: want, base: base} + buf, _ = a.appendMarshal(buf[:0]) + switch err := a.unmarshal(buf); { + case err != nil: + t.Fatalf("parseTime(%q, %s) error: %v", buf, baseLabel(base), err) + case a.tt != want: + t.Fatalf("parseTime(%q, %s) = time.Unix(%d, %d), want time.Unix(%d, %d)", buf, baseLabel(base), a.tt.Unix(), a.tt.Nanosecond(), want.Unix(), want.Nanosecond()) + } + } + }) +} + +func FuzzParseTime(f *testing.F) { + for _, tt := range parseTimeTestdata { + f.Add([]byte(tt.in)) + } + f.Fuzz(func(t *testing.T, in []byte) { + for _, base := range [...]uint64{1e0, 1e3, 1e6, 1e9} { + a := timeArshaler{base: base} + if err := a.unmarshal(in); err == nil { + if n, err := jsonwire.ConsumeNumber(in); err != nil || n != len(in) { + t.Fatalf("parseTime(%q) error is nil for invalid JSON number", in) + } + } + } + }) +} diff --git a/go/src/encoding/json/v2/bench_test.go b/go/src/encoding/json/v2/bench_test.go new file mode 100644 index 0000000000000000000000000000000000000000..ae4a5b20a5cd56fa98225525664eef0b0dceb3d3 --- /dev/null +++ b/go/src/encoding/json/v2/bench_test.go @@ -0,0 +1,648 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json_test + +import ( + "bytes" + "cmp" + "fmt" + "io" + "os" + "path" + "reflect" + "strings" + "testing" + "testing/iotest" + "time" + + jsonv1 "encoding/json" + + jsonv1in2 "encoding/json" + "encoding/json/internal/jsontest" + "encoding/json/jsontext" + jsonv2 "encoding/json/v2" +) + +// benchVersion is the version to benchmark (either "v1", "v1in2", or "v2"). +var benchVersion = cmp.Or(os.Getenv("BENCHMARK_VERSION"), "v2") + +var jsonFuncs = func() (funcs struct { + marshal func(any) ([]byte, error) + unmarshal func([]byte, any) error + encodeValue func(w io.Writer, b []byte) error + encodeTokens func(w io.Writer, toks []jsontext.Token) error + decodeValue func(r io.Reader) error + decodeTokens func(r io.Reader) error +}) { + ignoreEOF := func(err error) error { + if err == io.EOF { + err = nil + } + return err + } + + switch benchVersion { + case "v1": + funcs.marshal = jsonv1.Marshal + funcs.unmarshal = jsonv1.Unmarshal + funcs.encodeValue = func(w io.Writer, b []byte) error { + return jsonv1.NewEncoder(w).Encode(jsonv1.RawMessage(b)) + } + funcs.decodeValue = func(r io.Reader) error { + var v jsonv1.RawMessage + return jsonv1.NewDecoder(r).Decode(&v) + } + funcs.decodeTokens = func(r io.Reader) error { + d := jsonv1.NewDecoder(r) + for { + if _, err := d.Token(); err != nil { + return ignoreEOF(err) + } + } + } + case "v1in2": + funcs.marshal = jsonv1in2.Marshal + funcs.unmarshal = jsonv1in2.Unmarshal + funcs.encodeValue = func(w io.Writer, b []byte) error { + return jsonv1in2.NewEncoder(w).Encode(jsonv1in2.RawMessage(b)) + } + funcs.decodeValue = func(r io.Reader) error { + var v jsonv1in2.RawMessage + return jsonv1in2.NewDecoder(r).Decode(&v) + } + funcs.decodeTokens = func(r io.Reader) error { + d := jsonv1in2.NewDecoder(r) + for { + if _, err := d.Token(); err != nil { + return ignoreEOF(err) + } + } + } + case "v2": + funcs.marshal = func(v any) ([]byte, error) { return jsonv2.Marshal(v) } + funcs.unmarshal = func(b []byte, v any) error { return jsonv2.Unmarshal(b, v) } + funcs.encodeValue = func(w io.Writer, b []byte) error { + return jsontext.NewEncoder(w).WriteValue(b) + } + funcs.encodeTokens = func(w io.Writer, toks []jsontext.Token) error { + e := jsontext.NewEncoder(w) + for _, tok := range toks { + if err := e.WriteToken(tok); err != nil { + return err + } + } + return nil + } + funcs.decodeValue = func(r io.Reader) error { + _, err := jsontext.NewDecoder(r).ReadValue() + return err + } + funcs.decodeTokens = func(r io.Reader) error { + d := jsontext.NewDecoder(r) + for { + if _, err := d.ReadToken(); err != nil { + return ignoreEOF(err) + } + } + } + default: + panic("unknown version: " + benchVersion) + } + return +}() + +// bytesBuffer is identical to bytes.Buffer, +// but a different type to avoid any optimizations for bytes.Buffer. +type bytesBuffer struct{ *bytes.Buffer } + +func addr[T any](v T) *T { + return &v +} + +func len64[Bytes ~[]byte | ~string](in Bytes) int64 { + return int64(len(in)) +} + +var arshalTestdata = []struct { + name string + raw []byte + val any + new func() any + skipV1 bool +}{{ + name: "Bool", + raw: []byte("true"), + val: addr(true), + new: func() any { return new(bool) }, +}, { + name: "String", + raw: []byte(`"hello, world!"`), + val: addr("hello, world!"), + new: func() any { return new(string) }, +}, { + name: "Int", + raw: []byte("-1234"), + val: addr(int64(-1234)), + new: func() any { return new(int64) }, +}, { + name: "Uint", + raw: []byte("1234"), + val: addr(uint64(1234)), + new: func() any { return new(uint64) }, +}, { + name: "Float", + raw: []byte("12.34"), + val: addr(float64(12.34)), + new: func() any { return new(float64) }, +}, { + name: "Map/ManyEmpty", + raw: []byte(`[{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]`), + val: addr(func() (out []map[string]string) { + for range 100 { + out = append(out, map[string]string{}) + } + return out + }()), + new: func() any { return new([]map[string]string) }, +}, { + name: "Map/OneLarge", + raw: []byte(`{"A":"A","B":"B","C":"C","D":"D","E":"E","F":"F","G":"G","H":"H","I":"I","J":"J","K":"K","L":"L","M":"M","N":"N","O":"O","P":"P","Q":"Q","R":"R","S":"S","T":"T","U":"U","V":"V","W":"W","X":"X","Y":"Y","Z":"Z"}`), + val: addr(map[string]string{"A": "A", "B": "B", "C": "C", "D": "D", "E": "E", "F": "F", "G": "G", "H": "H", "I": "I", "J": "J", "K": "K", "L": "L", "M": "M", "N": "N", "O": "O", "P": "P", "Q": "Q", "R": "R", "S": "S", "T": "T", "U": "U", "V": "V", "W": "W", "X": "X", "Y": "Y", "Z": "Z"}), + new: func() any { return new(map[string]string) }, +}, { + name: "Map/ManySmall", + raw: []byte(`{"A":{"K":"V"},"B":{"K":"V"},"C":{"K":"V"},"D":{"K":"V"},"E":{"K":"V"},"F":{"K":"V"},"G":{"K":"V"},"H":{"K":"V"},"I":{"K":"V"},"J":{"K":"V"},"K":{"K":"V"},"L":{"K":"V"},"M":{"K":"V"},"N":{"K":"V"},"O":{"K":"V"},"P":{"K":"V"},"Q":{"K":"V"},"R":{"K":"V"},"S":{"K":"V"},"T":{"K":"V"},"U":{"K":"V"},"V":{"K":"V"},"W":{"K":"V"},"X":{"K":"V"},"Y":{"K":"V"},"Z":{"K":"V"}}`), + val: addr(map[string]map[string]string{"A": {"K": "V"}, "B": {"K": "V"}, "C": {"K": "V"}, "D": {"K": "V"}, "E": {"K": "V"}, "F": {"K": "V"}, "G": {"K": "V"}, "H": {"K": "V"}, "I": {"K": "V"}, "J": {"K": "V"}, "K": {"K": "V"}, "L": {"K": "V"}, "M": {"K": "V"}, "N": {"K": "V"}, "O": {"K": "V"}, "P": {"K": "V"}, "Q": {"K": "V"}, "R": {"K": "V"}, "S": {"K": "V"}, "T": {"K": "V"}, "U": {"K": "V"}, "V": {"K": "V"}, "W": {"K": "V"}, "X": {"K": "V"}, "Y": {"K": "V"}, "Z": {"K": "V"}}), + new: func() any { return new(map[string]map[string]string) }, +}, { + name: "Struct/ManyEmpty", + raw: []byte(`[{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]`), + val: addr(make([]struct{}, 100)), + new: func() any { + return new([]struct{}) + }, +}, { + name: "Struct/OneLarge", + raw: []byte(`{"A":"A","B":"B","C":"C","D":"D","E":"E","F":"F","G":"G","H":"H","I":"I","J":"J","K":"K","L":"L","M":"M","N":"N","O":"O","P":"P","Q":"Q","R":"R","S":"S","T":"T","U":"U","V":"V","W":"W","X":"X","Y":"Y","Z":"Z"}`), + val: addr(struct{ A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z string }{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}), + new: func() any { + return new(struct{ A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z string }) + }, +}, { + name: "Struct/ManySmall", + raw: []byte(`{"A":{"K":"V"},"B":{"K":"V"},"C":{"K":"V"},"D":{"K":"V"},"E":{"K":"V"},"F":{"K":"V"},"G":{"K":"V"},"H":{"K":"V"},"I":{"K":"V"},"J":{"K":"V"},"K":{"K":"V"},"L":{"K":"V"},"M":{"K":"V"},"N":{"K":"V"},"O":{"K":"V"},"P":{"K":"V"},"Q":{"K":"V"},"R":{"K":"V"},"S":{"K":"V"},"T":{"K":"V"},"U":{"K":"V"},"V":{"K":"V"},"W":{"K":"V"},"X":{"K":"V"},"Y":{"K":"V"},"Z":{"K":"V"}}`), + val: func() any { + V := struct{ K string }{"V"} + return addr(struct{ A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z struct{ K string } }{ + V, V, V, V, V, V, V, V, V, V, V, V, V, V, V, V, V, V, V, V, V, V, V, V, V, V, + }) + }(), + new: func() any { + return new(struct{ A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z struct{ K string } }) + }, +}, { + name: "Slice/ManyEmpty", + raw: []byte(`[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]]`), + val: addr(func() (out [][]string) { + for range 100 { + out = append(out, []string{}) + } + return out + }()), + new: func() any { return new([][]string) }, +}, { + name: "Slice/OneLarge", + raw: []byte(`["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]`), + val: addr([]string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}), + new: func() any { return new([]string) }, +}, { + name: "Slice/ManySmall", + raw: []byte(`[["A"],["B"],["C"],["D"],["E"],["F"],["G"],["H"],["I"],["J"],["K"],["L"],["M"],["N"],["O"],["P"],["Q"],["R"],["S"],["T"],["U"],["V"],["W"],["X"],["Y"],["Z"]]`), + val: addr([][]string{{"A"}, {"B"}, {"C"}, {"D"}, {"E"}, {"F"}, {"G"}, {"H"}, {"I"}, {"J"}, {"K"}, {"L"}, {"M"}, {"N"}, {"O"}, {"P"}, {"Q"}, {"R"}, {"S"}, {"T"}, {"U"}, {"V"}, {"W"}, {"X"}, {"Y"}, {"Z"}}), + new: func() any { return new([][]string) }, +}, { + name: "Array/OneLarge", + raw: []byte(`["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]`), + val: addr([26]string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}), + new: func() any { return new([26]string) }, +}, { + name: "Array/ManySmall", + raw: []byte(`[["A"],["B"],["C"],["D"],["E"],["F"],["G"],["H"],["I"],["J"],["K"],["L"],["M"],["N"],["O"],["P"],["Q"],["R"],["S"],["T"],["U"],["V"],["W"],["X"],["Y"],["Z"]]`), + val: addr([26][1]string{{"A"}, {"B"}, {"C"}, {"D"}, {"E"}, {"F"}, {"G"}, {"H"}, {"I"}, {"J"}, {"K"}, {"L"}, {"M"}, {"N"}, {"O"}, {"P"}, {"Q"}, {"R"}, {"S"}, {"T"}, {"U"}, {"V"}, {"W"}, {"X"}, {"Y"}, {"Z"}}), + new: func() any { return new([26][1]string) }, +}, { + name: "Bytes/Slice", + raw: []byte(`"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU="`), + val: addr([]byte{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}), + new: func() any { return new([]byte) }, +}, { + name: "Bytes/Array", + raw: []byte(`"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU="`), + val: addr([32]byte{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}), + new: func() any { return new([32]byte) }, + skipV1: true, +}, { + name: "Pointer", + raw: []byte("true"), + val: addr(addr(addr(addr(addr(addr(addr(addr(addr(addr(addr(true))))))))))), + new: func() any { return new(**********bool) }, +}, { + name: "TextArshal", + raw: []byte(`"method"`), + val: new(textArshaler), + new: func() any { return new(textArshaler) }, +}, { + name: "JSONArshalV1", + raw: []byte(`"method"`), + val: new(jsonArshalerV1), + new: func() any { return new(jsonArshalerV1) }, +}, { + name: "JSONArshalV2", + raw: []byte(`"method"`), + val: new(jsonArshalerV2), + new: func() any { return new(jsonArshalerV2) }, + skipV1: true, +}, { + /* TODO(https://go.dev/issue/71631): Re-enable this test case. + name: "Duration", + raw: []byte(`"1h1m1s"`), + val: addr(time.Hour + time.Minute + time.Second), + new: func() any { return new(time.Duration) }, + skipV1: true, + }, { */ + name: "Time", + raw: []byte(`"2006-01-02T22:04:05Z"`), + val: addr(time.Unix(1136239445, 0).UTC()), + new: func() any { return new(time.Time) }, +}} + +type textArshaler struct{ _ [4]int } + +func (textArshaler) MarshalText() ([]byte, error) { + return []byte("method"), nil +} +func (*textArshaler) UnmarshalText(b []byte) error { + if string(b) != "method" { + return fmt.Errorf("UnmarshalText: got %q, want %q", b, "method") + } + return nil +} + +type jsonArshalerV1 struct{ _ [4]int } + +func (jsonArshalerV1) MarshalJSON() ([]byte, error) { + return []byte(`"method"`), nil +} +func (*jsonArshalerV1) UnmarshalJSON(b []byte) error { + if string(b) != `"method"` { + return fmt.Errorf("UnmarshalJSON: got %q, want %q", b, `"method"`) + } + return nil +} + +type jsonArshalerV2 struct{ _ [4]int } + +func (jsonArshalerV2) MarshalJSONTo(enc *jsontext.Encoder) error { + return enc.WriteToken(jsontext.String("method")) +} +func (*jsonArshalerV2) UnmarshalJSONFrom(dec *jsontext.Decoder) error { + b, err := dec.ReadValue() + if string(b) != `"method"` { + return fmt.Errorf("UnmarshalJSONFrom: got %q, want %q", b, `"method"`) + } + return err +} + +func TestBenchmarkUnmarshal(t *testing.T) { runUnmarshal(t) } +func BenchmarkUnmarshal(b *testing.B) { runUnmarshal(b) } + +func runUnmarshal(tb testing.TB) { + for _, tt := range arshalTestdata { + if tt.skipV1 && strings.HasPrefix(benchVersion, "v1") { + runTestOrBench(tb, tt.name, 0, func(tb testing.TB) { tb.Skip("not supported in v1") }) + return + } + + // Setup the unmarshal operation. + var val any + run := func(tb testing.TB) { + val = tt.new() + if err := jsonFuncs.unmarshal(tt.raw, val); err != nil { + tb.Fatalf("Unmarshal error: %v", err) + } + } + + // Verify the results. + if _, ok := tb.(*testing.T); ok { + run0 := run + run = func(tb testing.TB) { + run0(tb) + if !reflect.DeepEqual(val, tt.val) { + tb.Fatalf("Unmarshal output mismatch:\ngot %v\nwant %v", val, tt.val) + } + } + } + + runTestOrBench(tb, tt.name, len64(tt.raw), run) + } +} + +func TestBenchmarkMarshal(t *testing.T) { runMarshal(t) } +func BenchmarkMarshal(b *testing.B) { runMarshal(b) } + +func runMarshal(tb testing.TB) { + for _, tt := range arshalTestdata { + if tt.skipV1 && strings.HasPrefix(benchVersion, "v1") { + runTestOrBench(tb, tt.name, 0, func(tb testing.TB) { tb.Skip("not supported in v1") }) + return + } + + // Setup the marshal operation. + var raw []byte + run := func(tb testing.TB) { + var err error + raw, err = jsonFuncs.marshal(tt.val) + if err != nil { + tb.Fatalf("Marshal error: %v", err) + } + } + + // Verify the results. + if _, ok := tb.(*testing.T); ok { + run0 := run + run = func(tb testing.TB) { + run0(tb) + if !bytes.Equal(raw, tt.raw) { + // Map marshaling in v2 is non-deterministic. + byteHistogram := func(b []byte) (h [256]int) { + for _, c := range b { + h[c]++ + } + return h + } + if !(strings.HasPrefix(tt.name, "Map/") && byteHistogram(raw) == byteHistogram(tt.raw)) { + tb.Fatalf("Marshal output mismatch:\ngot %s\nwant %s", raw, tt.raw) + } + } + } + } + + runTestOrBench(tb, tt.name, len64(tt.raw), run) + } +} + +func TestBenchmarkTestdata(t *testing.T) { runAllTestdata(t) } +func BenchmarkTestdata(b *testing.B) { runAllTestdata(b) } + +func runAllTestdata(tb testing.TB) { + for _, td := range jsontest.Data { + for _, arshalName := range []string{"Marshal", "Unmarshal"} { + for _, typeName := range []string{"Concrete", "Interface"} { + newValue := func() any { return new(any) } + if typeName == "Concrete" { + if td.New == nil { + continue + } + newValue = td.New + } + value := mustUnmarshalValue(tb, td.Data(), newValue) + name := path.Join(td.Name, arshalName, typeName) + runTestOrBench(tb, name, int64(len(td.Data())), func(tb testing.TB) { + runArshal(tb, arshalName, newValue, td.Data(), value) + }) + } + } + + tokens := mustDecodeTokens(tb, td.Data()) + buffer := make([]byte, 0, 2*len(td.Data())) + for _, codeName := range []string{"Encode", "Decode"} { + for _, typeName := range []string{"Token", "Value"} { + for _, modeName := range []string{"Streaming", "Buffered"} { + name := path.Join(td.Name, codeName, typeName, modeName) + runTestOrBench(tb, name, int64(len(td.Data())), func(tb testing.TB) { + runCode(tb, codeName, typeName, modeName, buffer, td.Data(), tokens) + }) + } + } + } + } +} + +func mustUnmarshalValue(t testing.TB, data []byte, newValue func() any) (value any) { + value = newValue() + if err := jsonv2.Unmarshal(data, value); err != nil { + t.Fatalf("Unmarshal error: %v", err) + } + return value +} + +func runArshal(t testing.TB, arshalName string, newValue func() any, data []byte, value any) { + switch arshalName { + case "Marshal": + if _, err := jsonFuncs.marshal(value); err != nil { + t.Fatalf("Marshal error: %v", err) + } + case "Unmarshal": + if err := jsonFuncs.unmarshal(data, newValue()); err != nil { + t.Fatalf("Unmarshal error: %v", err) + } + } +} + +func mustDecodeTokens(t testing.TB, data []byte) []jsontext.Token { + var tokens []jsontext.Token + dec := jsontext.NewDecoder(bytes.NewReader(data)) + for { + tok, err := dec.ReadToken() + if err != nil { + if err == io.EOF { + break + } + t.Fatalf("Decoder.ReadToken error: %v", err) + } + + // Prefer exact representation for JSON strings and numbers + // since this more closely matches common use cases. + switch tok.Kind() { + case '"': + tokens = append(tokens, jsontext.String(tok.String())) + case '0': + tokens = append(tokens, jsontext.Float(tok.Float())) + default: + tokens = append(tokens, tok.Clone()) + } + } + return tokens +} + +func runCode(t testing.TB, codeName, typeName, modeName string, buffer, data []byte, tokens []jsontext.Token) { + switch codeName { + case "Encode": + runEncode(t, typeName, modeName, buffer, data, tokens) + case "Decode": + runDecode(t, typeName, modeName, buffer, data, tokens) + } +} + +func runEncode(t testing.TB, typeName, modeName string, buffer, data []byte, tokens []jsontext.Token) { + if strings.HasPrefix(benchVersion, "v1") { + switch { + case modeName == "Buffered": + t.Skip("no support for direct buffered output in v1; see https://go.dev/issue/7872") + case typeName == "Token": + t.Skip("no support for encoding tokens in v1; see https://go.dev/issue/40127") + } + } + + var w io.Writer + switch modeName { + case "Streaming": + w = bytesBuffer{bytes.NewBuffer(buffer[:0])} + case "Buffered": + w = bytes.NewBuffer(buffer[:0]) + } + switch typeName { + case "Token": + if err := jsonFuncs.encodeTokens(w, tokens); err != nil { + t.Fatalf("Encoder.WriteToken error: %v", err) + } + case "Value": + if err := jsonFuncs.encodeValue(w, data); err != nil { + t.Fatalf("Encoder.WriteValue error: %v", err) + } + } +} + +func runDecode(t testing.TB, typeName, modeName string, buffer, data []byte, tokens []jsontext.Token) { + if strings.HasPrefix(benchVersion, "v1") && modeName == "Buffered" { + t.Skip("no support for direct buffered input in v1; see https://go.dev/issue/11046") + } + + var r io.Reader + switch modeName { + case "Streaming": + r = bytesBuffer{bytes.NewBuffer(data)} + case "Buffered": + r = bytes.NewBuffer(data) + } + switch typeName { + case "Token": + if err := jsonFuncs.decodeTokens(r); err != nil { + t.Fatalf("Decoder.ReadToken error: %v", err) + } + case "Value": + if err := jsonFuncs.decodeValue(r); err != nil { + t.Fatalf("Decoder.ReadValue error: %v", err) + } + } +} + +var ws = strings.Repeat(" ", 4<<10) +var slowStreamingDecodeTestdata = []struct { + name string + data []byte +}{ + {"LargeString", []byte(`"` + strings.Repeat(" ", 4<<10) + `"`)}, + {"LargeNumber", []byte("0." + strings.Repeat("0", 4<<10))}, + {"LargeWhitespace/Null", []byte(ws + "null" + ws)}, + {"LargeWhitespace/Object", []byte(ws + "{" + ws + `"name1"` + ws + ":" + ws + `"value"` + ws + "," + ws + `"name2"` + ws + ":" + ws + `"value"` + ws + "}" + ws)}, + {"LargeWhitespace/Array", []byte(ws + "[" + ws + `"value"` + ws + "," + ws + `"value"` + ws + "]" + ws)}, +} + +func TestBenchmarkSlowStreamingDecode(t *testing.T) { runAllSlowStreamingDecode(t) } +func BenchmarkSlowStreamingDecode(b *testing.B) { runAllSlowStreamingDecode(b) } + +func runAllSlowStreamingDecode(tb testing.TB) { + for _, td := range slowStreamingDecodeTestdata { + for _, typeName := range []string{"Token", "Value"} { + name := path.Join(td.name, typeName) + runTestOrBench(tb, name, len64(td.data), func(tb testing.TB) { + runSlowStreamingDecode(tb, typeName, td.data) + }) + } + } +} + +// runSlowStreamingDecode tests a streaming Decoder operating on +// a slow io.Reader that only returns 1 byte at a time, +// which tends to exercise pathological behavior. +func runSlowStreamingDecode(t testing.TB, typeName string, data []byte) { + r := iotest.OneByteReader(bytes.NewReader(data)) + switch typeName { + case "Token": + if err := jsonFuncs.decodeTokens(r); err != nil { + t.Fatalf("Decoder.ReadToken error: %v", err) + } + case "Value": + if err := jsonFuncs.decodeValue(r); err != nil { + t.Fatalf("Decoder.ReadValue error: %v", err) + } + } +} + +func TestBenchmarkTextValue(t *testing.T) { runValue(t) } +func BenchmarkTextValue(b *testing.B) { runValue(b) } + +func runValue(tb testing.TB) { + if testing.Short() { + tb.Skip() // CitmCatalog is not loaded in short mode + } + var data []byte + for _, ts := range jsontest.Data { + if ts.Name == "CitmCatalog" { + data = ts.Data() + } + } + + runTestOrBench(tb, "IsValid", len64(data), func(tb testing.TB) { + jsontext.Value(data).IsValid() + }) + + methods := []struct { + name string + format func(*jsontext.Value, ...jsontext.Options) error + }{ + {"Compact", (*jsontext.Value).Compact}, + {"Indent", (*jsontext.Value).Indent}, + {"Canonicalize", (*jsontext.Value).Canonicalize}, + } + + var v jsontext.Value + for _, method := range methods { + runTestOrBench(tb, method.name, len64(data), func(tb testing.TB) { + v = append(v[:0], data...) // reset with original input + if err := method.format(&v); err != nil { + tb.Errorf("jsontext.Value.%v error: %v", method.name, err) + } + }) + v = append(v[:0], data...) + method.format(&v) + runTestOrBench(tb, method.name+"/Noop", len64(data), func(tb testing.TB) { + if err := method.format(&v); err != nil { + tb.Errorf("jsontext.Value.%v error: %v", method.name, err) + } + }) + } +} + +func runTestOrBench(tb testing.TB, name string, numBytes int64, run func(tb testing.TB)) { + switch tb := tb.(type) { + case *testing.T: + tb.Run(name, func(t *testing.T) { + run(t) + }) + case *testing.B: + tb.Run(name, func(b *testing.B) { + b.ResetTimer() + b.ReportAllocs() + b.SetBytes(numBytes) + for range b.N { + run(b) + } + }) + } +} diff --git a/go/src/encoding/json/v2/doc.go b/go/src/encoding/json/v2/doc.go new file mode 100644 index 0000000000000000000000000000000000000000..8179f8ab179504d44d3900262b178519d600f6eb --- /dev/null +++ b/go/src/encoding/json/v2/doc.go @@ -0,0 +1,269 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +// Package json implements semantic processing of JSON as specified in RFC 8259. +// JSON is a simple data interchange format that can represent +// primitive data types such as booleans, strings, and numbers, +// in addition to structured data types such as objects and arrays. +// +// This package (encoding/json/v2) is experimental, +// and not subject to the Go 1 compatibility promise. +// It only exists when building with the GOEXPERIMENT=jsonv2 environment variable set. +// Most users should use [encoding/json]. +// +// [Marshal] and [Unmarshal] encode and decode Go values +// to/from JSON text contained within a []byte. +// [MarshalWrite] and [UnmarshalRead] operate on JSON text +// by writing to or reading from an [io.Writer] or [io.Reader]. +// [MarshalEncode] and [UnmarshalDecode] operate on JSON text +// by encoding to or decoding from a [jsontext.Encoder] or [jsontext.Decoder]. +// [Options] may be passed to each of the marshal or unmarshal functions +// to configure the semantic behavior of marshaling and unmarshaling +// (i.e., alter how JSON data is understood as Go data and vice versa). +// [jsontext.Options] may also be passed to the marshal or unmarshal functions +// to configure the syntactic behavior of encoding or decoding. +// +// The data types of JSON are mapped to/from the data types of Go based on +// the closest logical equivalent between the two type systems. For example, +// a JSON boolean corresponds with a Go bool, +// a JSON string corresponds with a Go string, +// a JSON number corresponds with a Go int, uint or float, +// a JSON array corresponds with a Go slice or array, and +// a JSON object corresponds with a Go struct or map. +// See the documentation on [Marshal] and [Unmarshal] for a comprehensive list +// of how the JSON and Go type systems correspond. +// +// Arbitrary Go types can customize their JSON representation by implementing +// [Marshaler], [MarshalerTo], [Unmarshaler], or [UnmarshalerFrom]. +// This provides authors of Go types with control over how their types are +// serialized as JSON. Alternatively, users can implement functions that match +// [MarshalFunc], [MarshalToFunc], [UnmarshalFunc], or [UnmarshalFromFunc] +// to specify the JSON representation for arbitrary types. +// This provides callers of JSON functionality with control over +// how any arbitrary type is serialized as JSON. +// +// # JSON Representation of Go structs +// +// A Go struct is naturally represented as a JSON object, +// where each Go struct field corresponds with a JSON object member. +// When marshaling, all Go struct fields are recursively encoded in depth-first +// order as JSON object members except those that are ignored or omitted. +// When unmarshaling, JSON object members are recursively decoded +// into the corresponding Go struct fields. +// Object members that do not match any struct fields, +// also known as “unknown members”, are ignored by default or rejected +// if [RejectUnknownMembers] is specified. +// +// The representation of each struct field can be customized in the +// "json" struct field tag, where the tag is a comma separated list of options. +// As a special case, if the entire tag is `json:"-"`, +// then the field is ignored with regard to its JSON representation. +// Some options also have equivalent behavior controlled by a caller-specified [Options]. +// Field-specified options take precedence over caller-specified options. +// +// The first option is the JSON object name override for the Go struct field. +// If the name is not specified, then the Go struct field name +// is used as the JSON object name. JSON names containing commas or quotes, +// or names identical to "" or "-", can be specified using +// a single-quoted string literal, where the syntax is identical to +// the Go grammar for a double-quoted string literal, +// but instead uses single quotes as the delimiters. +// By default, unmarshaling uses case-sensitive matching to identify +// the Go struct field associated with a JSON object name. +// +// After the name, the following tag options are supported: +// +// - omitzero: When marshaling, the "omitzero" option specifies that +// the struct field should be omitted if the field value is zero +// as determined by the "IsZero() bool" method if present, +// otherwise based on whether the field is the zero Go value. +// This option has no effect when unmarshaling. +// +// - omitempty: When marshaling, the "omitempty" option specifies that +// the struct field should be omitted if the field value would have been +// encoded as a JSON null, empty string, empty object, or empty array. +// This option has no effect when unmarshaling. +// +// - string: The "string" option specifies that [StringifyNumbers] +// be set when marshaling or unmarshaling a struct field value. +// This causes numeric types to be encoded as a JSON number +// within a JSON string, and to be decoded from a JSON string +// containing the JSON number without any surrounding whitespace. +// This extra level of encoding is often necessary since +// many JSON parsers cannot precisely represent 64-bit integers. +// +// - case: When unmarshaling, the "case" option specifies how +// JSON object names are matched with the JSON name for Go struct fields. +// The option is a key-value pair specified as "case:value" where +// the value must either be 'ignore' or 'strict'. +// The 'ignore' value specifies that matching is case-insensitive +// where dashes and underscores are also ignored. If multiple fields match, +// the first declared field in breadth-first order takes precedence. +// The 'strict' value specifies that matching is case-sensitive. +// This takes precedence over the [MatchCaseInsensitiveNames] option. +// +// - inline: The "inline" option specifies that +// the JSON representable content of this field type is to be promoted +// as if they were specified in the parent struct. +// It is the JSON equivalent of Go struct embedding. +// A Go embedded field is implicitly inlined unless an explicit JSON name +// is specified. The inlined field must be a Go struct +// (that does not implement any JSON methods), [jsontext.Value], +// map[~string]T, or an unnamed pointer to such types. When marshaling, +// inlined fields from a pointer type are omitted if it is nil. +// Inlined fields of type [jsontext.Value] and map[~string]T are called +// “inlined fallbacks” as they can represent all possible +// JSON object members not directly handled by the parent struct. +// Only one inlined fallback field may be specified in a struct, +// while many non-fallback fields may be specified. This option +// must not be specified with any other option (including the JSON name). +// +// - unknown: The "unknown" option is a specialized variant +// of the inlined fallback to indicate that this Go struct field +// contains any number of unknown JSON object members. The field type must +// be a [jsontext.Value], map[~string]T, or an unnamed pointer to such types. +// If [DiscardUnknownMembers] is specified when marshaling, +// the contents of this field are ignored. +// If [RejectUnknownMembers] is specified when unmarshaling, +// any unknown object members are rejected regardless of whether +// an inlined fallback with the "unknown" option exists. This option +// must not be specified with any other option (including the JSON name). +// +// - format: The "format" option specifies a format flag +// used to specialize the formatting of the field value. +// The option is a key-value pair specified as "format:value" where +// the value must be either a literal consisting of letters and numbers +// (e.g., "format:RFC3339") or a single-quoted string literal +// (e.g., "format:'2006-01-02'"). The interpretation of the format flag +// is determined by the struct field type. +// +// The "omitzero" and "omitempty" options are mostly semantically identical. +// The former is defined in terms of the Go type system, +// while the latter in terms of the JSON type system. +// Consequently they behave differently in some circumstances. +// For example, only a nil slice or map is omitted under "omitzero", while +// an empty slice or map is omitted under "omitempty" regardless of nilness. +// The "omitzero" option is useful for types with a well-defined zero value +// (e.g., [net/netip.Addr]) or have an IsZero method (e.g., [time.Time.IsZero]). +// +// Every Go struct corresponds to a list of JSON representable fields +// which is constructed by performing a breadth-first search over +// all struct fields (excluding unexported or ignored fields), +// where the search recursively descends into inlined structs. +// The set of non-inlined fields in a struct must have unique JSON names. +// If multiple fields all have the same JSON name, then the one +// at shallowest depth takes precedence and the other fields at deeper depths +// are excluded from the list of JSON representable fields. +// If multiple fields at the shallowest depth have the same JSON name, +// but exactly one is explicitly tagged with a JSON name, +// then that field takes precedence and all others are excluded from the list. +// This is analogous to Go visibility rules for struct field selection +// with embedded struct types. +// +// Marshaling or unmarshaling a non-empty struct +// without any JSON representable fields results in a [SemanticError]. +// Unexported fields must not have any `json` tags except for `json:"-"`. +// +// # Security Considerations +// +// JSON is frequently used as a data interchange format to communicate +// between different systems, possibly implemented in different languages. +// For interoperability and security reasons, it is important that +// all implementations agree upon the semantic meaning of the data. +// +// [For example, suppose we have two micro-services.] +// The first service is responsible for authenticating a JSON request, +// while the second service is responsible for executing the request +// (having assumed that the prior service authenticated the request). +// If an attacker were able to maliciously craft a JSON request such that +// both services believe that the same request is from different users, +// it could bypass the authenticator with valid credentials for one user, +// but maliciously perform an action on behalf of a different user. +// +// According to RFC 8259, there unfortunately exist many JSON texts +// that are syntactically valid but semantically ambiguous. +// For example, the standard does not define how to interpret duplicate +// names within an object. +// +// The v1 [encoding/json] and [encoding/json/v2] packages +// interpret some inputs in different ways. In particular: +// +// - The standard specifies that JSON must be encoded using UTF-8. +// By default, v1 replaces invalid bytes of UTF-8 in JSON strings +// with the Unicode replacement character, +// while v2 rejects inputs with invalid UTF-8. +// To change the default, specify the [jsontext.AllowInvalidUTF8] option. +// The replacement of invalid UTF-8 is a form of data corruption +// that alters the precise meaning of strings. +// +// - The standard does not specify a particular behavior when +// duplicate names are encountered within a JSON object, +// which means that different implementations may behave differently. +// By default, v1 allows for the presence of duplicate names, +// while v2 rejects duplicate names. +// To change the default, specify the [jsontext.AllowDuplicateNames] option. +// If allowed, object members are processed in the order they are observed, +// meaning that later values will replace or be merged into prior values, +// depending on the Go value type. +// +// - The standard defines a JSON object as an unordered collection of name/value pairs. +// While ordering can be observed through the underlying [jsontext] API, +// both v1 and v2 generally avoid exposing the ordering. +// No application should semantically depend on the order of object members. +// Allowing duplicate names is a vector through which ordering of members +// can accidentally be observed and depended upon. +// +// - The standard suggests that JSON object names are typically compared +// based on equality of the sequence of Unicode code points, +// which implies that comparing names is often case-sensitive. +// When unmarshaling a JSON object into a Go struct, +// by default, v1 uses a (loose) case-insensitive match on the name, +// while v2 uses a (strict) case-sensitive match on the name. +// To change the default, specify the [MatchCaseInsensitiveNames] option. +// The use of case-insensitive matching provides another vector through +// which duplicate names can occur. Allowing case-insensitive matching +// means that v1 or v2 might interpret JSON objects differently from most +// other JSON implementations (which typically use a case-sensitive match). +// +// - The standard does not specify a particular behavior when +// an unknown name in a JSON object is encountered. +// When unmarshaling a JSON object into a Go struct, by default +// both v1 and v2 ignore unknown names and their corresponding values. +// To change the default, specify the [RejectUnknownMembers] option. +// +// - The standard suggests that implementations may use a float64 +// to represent a JSON number. Consequently, large JSON integers +// may lose precision when stored as a floating-point type. +// Both v1 and v2 correctly preserve precision when marshaling and +// unmarshaling a concrete integer type. However, even if v1 and v2 +// preserve precision for concrete types, other JSON implementations +// may not be able to preserve precision for outputs produced by v1 or v2. +// The `string` tag option can be used to specify that an integer type +// is to be quoted within a JSON string to avoid loss of precision. +// Furthermore, v1 and v2 may still lose precision when unmarshaling +// into an any interface value, where unmarshal uses a float64 +// by default to represent a JSON number. +// To change the default, specify the [WithUnmarshalers] option +// with a custom unmarshaler that pre-populates the interface value +// with a concrete Go type that can preserve precision. +// +// RFC 8785 specifies a canonical form for any JSON text, +// which explicitly defines specific behaviors that RFC 8259 leaves undefined. +// In theory, if a text can successfully [jsontext.Value.Canonicalize] +// without changing the semantic meaning of the data, then it provides a +// greater degree of confidence that the data is more secure and interoperable. +// +// The v2 API generally chooses more secure defaults than v1, +// but care should still be taken with large integers or unknown members. +// +// [For example, suppose we have two micro-services.]: https://www.youtube.com/watch?v=avilmOcHKHE&t=1057s +package json + +// requireKeyedLiterals can be embedded in a struct to require keyed literals. +type requireKeyedLiterals struct{} + +// nonComparable can be embedded in a struct to prevent comparability. +type nonComparable [0]func() diff --git a/go/src/encoding/json/v2/errors.go b/go/src/encoding/json/v2/errors.go new file mode 100644 index 0000000000000000000000000000000000000000..4895386fe2ca37e1071cbd1b89fd131cbdb90d84 --- /dev/null +++ b/go/src/encoding/json/v2/errors.go @@ -0,0 +1,445 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json + +import ( + "cmp" + "errors" + "fmt" + "io" + "reflect" + "strconv" + "strings" + "sync" + + "encoding/json/internal/jsonflags" + "encoding/json/internal/jsonopts" + "encoding/json/internal/jsonwire" + "encoding/json/jsontext" +) + +// ErrUnknownName indicates that a JSON object member could not be +// unmarshaled because the name is not known to the target Go struct. +// This error is directly wrapped within a [SemanticError] when produced. +// +// The name of an unknown JSON object member can be extracted as: +// +// err := ... +// serr, ok := errors.AsType[*json.SemanticError](err) +// if ok && serr.Err == json.ErrUnknownName { +// ptr := serr.JSONPointer // JSON pointer to unknown name +// name := ptr.LastToken() // unknown name itself +// ... +// } +// +// This error is only returned if [RejectUnknownMembers] is true. +var ErrUnknownName = errors.New("unknown object member name") + +const errorPrefix = "json: " + +func isSemanticError(err error) bool { + _, ok := err.(*SemanticError) + return ok +} + +func isSyntacticError(err error) bool { + _, ok := err.(*jsontext.SyntacticError) + return ok +} + +// isFatalError reports whether this error must terminate asharling. +// All errors are considered fatal unless operating under +// [jsonflags.ReportErrorsWithLegacySemantics] in which case only +// syntactic errors and I/O errors are considered fatal. +func isFatalError(err error, flags jsonflags.Flags) bool { + return !flags.Get(jsonflags.ReportErrorsWithLegacySemantics) || + isSyntacticError(err) || export.IsIOError(err) +} + +// SemanticError describes an error determining the meaning +// of JSON data as Go data or vice-versa. +// +// If a [Marshaler], [MarshalerTo], [Unmarshaler], or [UnmarshalerFrom] method +// returns a SemanticError when called by the [json] package, +// then the ByteOffset, JSONPointer, and GoType fields are automatically +// populated by the calling context if they are the zero value. +// +// The contents of this error as produced by this package may change over time. +type SemanticError struct { + requireKeyedLiterals + nonComparable + + action string // either "marshal" or "unmarshal" + + // ByteOffset indicates that an error occurred after this byte offset. + ByteOffset int64 + // JSONPointer indicates that an error occurred within this JSON value + // as indicated using the JSON Pointer notation (see RFC 6901). + JSONPointer jsontext.Pointer + + // JSONKind is the JSON kind that could not be handled. + JSONKind jsontext.Kind // may be zero if unknown + // JSONValue is the JSON number or string that could not be unmarshaled. + // It is not populated during marshaling. + JSONValue jsontext.Value // may be nil if irrelevant or unknown + // GoType is the Go type that could not be handled. + GoType reflect.Type // may be nil if unknown + + // Err is the underlying error. + Err error // may be nil +} + +// coder is implemented by [jsontext.Encoder] or [jsontext.Decoder]. +type coder interface { + StackPointer() jsontext.Pointer + Options() Options +} + +// newInvalidFormatError wraps err in a SemanticError because +// the current type t cannot handle the provided options format. +// This error must be called before producing or consuming the next value. +// +// If [jsonflags.ReportErrorsWithLegacySemantics] is specified, +// then this automatically skips the next value when unmarshaling +// to ensure that the value is fully consumed. +func newInvalidFormatError(c coder, t reflect.Type) error { + err := fmt.Errorf("invalid format flag %q", c.Options().(*jsonopts.Struct).Format) + switch c := c.(type) { + case *jsontext.Encoder: + err = newMarshalErrorBefore(c, t, err) + case *jsontext.Decoder: + err = newUnmarshalErrorBeforeWithSkipping(c, t, err) + } + return err +} + +// newMarshalErrorBefore wraps err in a SemanticError assuming that e +// is positioned right before the next token or value, which causes an error. +func newMarshalErrorBefore(e *jsontext.Encoder, t reflect.Type, err error) error { + return &SemanticError{action: "marshal", GoType: t, Err: toUnexpectedEOF(err), + ByteOffset: e.OutputOffset() + int64(export.Encoder(e).CountNextDelimWhitespace()), + JSONPointer: jsontext.Pointer(export.Encoder(e).AppendStackPointer(nil, +1))} +} + +// newUnmarshalErrorBefore wraps err in a SemanticError assuming that d +// is positioned right before the next token or value, which causes an error. +// It does not record the next JSON kind as this error is used to indicate +// the receiving Go value is invalid to unmarshal into (and not a JSON error). +// However, if [jsonflags.ReportErrorsWithLegacySemantics] is specified, +// then it does record the next JSON kind for historical reporting reasons. +func newUnmarshalErrorBefore(d *jsontext.Decoder, t reflect.Type, err error) error { + var k jsontext.Kind + if export.Decoder(d).Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + k = d.PeekKind() + } + return &SemanticError{action: "unmarshal", GoType: t, Err: toUnexpectedEOF(err), + ByteOffset: d.InputOffset() + int64(export.Decoder(d).CountNextDelimWhitespace()), + JSONPointer: jsontext.Pointer(export.Decoder(d).AppendStackPointer(nil, +1)), + JSONKind: k} +} + +// newUnmarshalErrorBeforeWithSkipping is like [newUnmarshalErrorBefore], +// but automatically skips the next value if +// [jsonflags.ReportErrorsWithLegacySemantics] is specified. +func newUnmarshalErrorBeforeWithSkipping(d *jsontext.Decoder, t reflect.Type, err error) error { + err = newUnmarshalErrorBefore(d, t, err) + if export.Decoder(d).Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + if err2 := export.Decoder(d).SkipValue(); err2 != nil { + return err2 + } + } + return err +} + +// newUnmarshalErrorAfter wraps err in a SemanticError assuming that d +// is positioned right after the previous token or value, which caused an error. +func newUnmarshalErrorAfter(d *jsontext.Decoder, t reflect.Type, err error) error { + tokOrVal := export.Decoder(d).PreviousTokenOrValue() + return &SemanticError{action: "unmarshal", GoType: t, Err: toUnexpectedEOF(err), + ByteOffset: d.InputOffset() - int64(len(tokOrVal)), + JSONPointer: jsontext.Pointer(export.Decoder(d).AppendStackPointer(nil, -1)), + JSONKind: jsontext.Value(tokOrVal).Kind()} +} + +// newUnmarshalErrorAfter wraps err in a SemanticError assuming that d +// is positioned right after the previous token or value, which caused an error. +// It also stores a copy of the last JSON value if it is a string or number. +func newUnmarshalErrorAfterWithValue(d *jsontext.Decoder, t reflect.Type, err error) error { + serr := newUnmarshalErrorAfter(d, t, err).(*SemanticError) + if serr.JSONKind == '"' || serr.JSONKind == '0' { + serr.JSONValue = jsontext.Value(export.Decoder(d).PreviousTokenOrValue()).Clone() + } + return serr +} + +// newUnmarshalErrorAfterWithSkipping is like [newUnmarshalErrorAfter], +// but automatically skips the remainder of the current value if +// [jsonflags.ReportErrorsWithLegacySemantics] is specified. +func newUnmarshalErrorAfterWithSkipping(d *jsontext.Decoder, t reflect.Type, err error) error { + err = newUnmarshalErrorAfter(d, t, err) + if export.Decoder(d).Flags.Get(jsonflags.ReportErrorsWithLegacySemantics) { + if err2 := export.Decoder(d).SkipValueRemainder(); err2 != nil { + return err2 + } + } + return err +} + +// newSemanticErrorWithPosition wraps err in a SemanticError assuming that +// the error occurred at the provided depth, and length. +// If err is already a SemanticError, then position information is only +// injected if it is currently unpopulated. +// +// If the position is unpopulated, it is ambiguous where the error occurred +// in the user code, whether it was before or after the current position. +// For the byte offset, we assume that the error occurred before the last read +// token or value when decoding, or before the next value when encoding. +// For the JSON pointer, we point to the parent object or array unless +// we can be certain that it happened with an object member. +// +// This is used to annotate errors returned by user-provided +// v2 MarshalJSON or UnmarshalJSON methods or functions. +func newSemanticErrorWithPosition(c coder, t reflect.Type, prevDepth int, prevLength int64, err error) error { + serr, _ := err.(*SemanticError) + if serr == nil { + serr = &SemanticError{Err: err} + } + serr.Err = toUnexpectedEOF(serr.Err) + var currDepth int + var currLength int64 + var coderState interface{ AppendStackPointer([]byte, int) []byte } + var offset int64 + switch c := c.(type) { + case *jsontext.Encoder: + e := export.Encoder(c) + serr.action = cmp.Or(serr.action, "marshal") + currDepth, currLength = e.Tokens.DepthLength() + offset = c.OutputOffset() + int64(export.Encoder(c).CountNextDelimWhitespace()) + coderState = e + case *jsontext.Decoder: + d := export.Decoder(c) + serr.action = cmp.Or(serr.action, "unmarshal") + currDepth, currLength = d.Tokens.DepthLength() + tokOrVal := d.PreviousTokenOrValue() + offset = c.InputOffset() - int64(len(tokOrVal)) + if (prevDepth == currDepth && prevLength == currLength) || len(tokOrVal) == 0 { + // If no Read method was called in the user-defined method or + // if the Peek method was called, then use the offset of the next value. + offset = c.InputOffset() + int64(export.Decoder(c).CountNextDelimWhitespace()) + } + coderState = d + } + serr.ByteOffset = cmp.Or(serr.ByteOffset, offset) + if serr.JSONPointer == "" { + where := 0 // default to ambiguous positioning + switch { + case prevDepth == currDepth && prevLength+0 == currLength: + where = +1 + case prevDepth == currDepth && prevLength+1 == currLength: + where = -1 + } + serr.JSONPointer = jsontext.Pointer(coderState.AppendStackPointer(nil, where)) + } + serr.GoType = cmp.Or(serr.GoType, t) + return serr +} + +// collapseSemanticErrors collapses double SemanticErrors at the outer levels +// into a single SemanticError by preserving the inner error, +// but prepending the ByteOffset and JSONPointer with the outer error. +// +// For example: +// +// collapseSemanticErrors(&SemanticError{ +// ByteOffset: len64(`[0,{"alpha":[0,1,`), +// JSONPointer: "/1/alpha/2", +// GoType: reflect.TypeFor[outerType](), +// Err: &SemanticError{ +// ByteOffset: len64(`{"foo":"bar","fizz":[0,`), +// JSONPointer: "/fizz/1", +// GoType: reflect.TypeFor[innerType](), +// Err: ..., +// }, +// }) +// +// results in: +// +// &SemanticError{ +// ByteOffset: len64(`[0,{"alpha":[0,1,`) + len64(`{"foo":"bar","fizz":[0,`), +// JSONPointer: "/1/alpha/2" + "/fizz/1", +// GoType: reflect.TypeFor[innerType](), +// Err: ..., +// } +// +// This is used to annotate errors returned by user-provided +// v1 MarshalJSON or UnmarshalJSON methods with precise position information +// if they themselves happened to return a SemanticError. +// Since MarshalJSON and UnmarshalJSON are not operating on the root JSON value, +// their positioning must be relative to the nested JSON value +// returned by UnmarshalJSON or passed to MarshalJSON. +// Therefore, we can construct an absolute position by concatenating +// the outer with the inner positions. +// +// Note that we do not use collapseSemanticErrors with user-provided functions +// that take in an [jsontext.Encoder] or [jsontext.Decoder] since they contain +// methods to report position relative to the root JSON value. +// We assume user-constructed errors are correctly precise about position. +func collapseSemanticErrors(err error) error { + if serr1, ok := err.(*SemanticError); ok { + if serr2, ok := serr1.Err.(*SemanticError); ok { + serr2.ByteOffset = serr1.ByteOffset + serr2.ByteOffset + serr2.JSONPointer = serr1.JSONPointer + serr2.JSONPointer + *serr1 = *serr2 + } + } + return err +} + +// errorModalVerb is a modal verb like "cannot" or "unable to". +// +// Once per process, Hyrum-proof the error message by deliberately +// switching between equivalent renderings of the same error message. +// The randomization is tied to the Hyrum-proofing already applied +// on map iteration in Go. +var errorModalVerb = sync.OnceValue(func() string { + for phrase := range map[string]struct{}{"cannot": {}, "unable to": {}} { + return phrase // use whichever phrase we get in the first iteration + } + return "" +}) + +func (e *SemanticError) Error() string { + var sb strings.Builder + sb.WriteString(errorPrefix) + sb.WriteString(errorModalVerb()) + + // Format action. + var preposition string + switch e.action { + case "marshal": + sb.WriteString(" marshal") + preposition = " from" + case "unmarshal": + sb.WriteString(" unmarshal") + preposition = " into" + default: + sb.WriteString(" handle") + preposition = " with" + } + + // Format JSON kind. + switch e.JSONKind { + case 'n': + sb.WriteString(" JSON null") + case 'f', 't': + sb.WriteString(" JSON boolean") + case '"': + sb.WriteString(" JSON string") + case '0': + sb.WriteString(" JSON number") + case '{', '}': + sb.WriteString(" JSON object") + case '[', ']': + sb.WriteString(" JSON array") + default: + if e.action == "" { + preposition = "" + } + } + if len(e.JSONValue) > 0 && len(e.JSONValue) < 100 { + sb.WriteByte(' ') + sb.Write(e.JSONValue) + } + + // Format Go type. + if e.GoType != nil { + typeString := e.GoType.String() + if len(typeString) > 100 { + // An excessively long type string most likely occurs for + // an anonymous struct declaration with many fields. + // Reduce the noise by just printing the kind, + // and optionally prepending it with the package name + // if the struct happens to include an unexported field. + typeString = e.GoType.Kind().String() + if e.GoType.Kind() == reflect.Struct && e.GoType.Name() == "" { + for i := range e.GoType.NumField() { + if pkgPath := e.GoType.Field(i).PkgPath; pkgPath != "" { + typeString = pkgPath[strings.LastIndexByte(pkgPath, '/')+len("/"):] + ".struct" + break + } + } + } + } + sb.WriteString(preposition) + sb.WriteString(" Go ") + sb.WriteString(typeString) + } + + // Special handling for unknown names. + if e.Err == ErrUnknownName { + sb.WriteString(": ") + sb.WriteString(ErrUnknownName.Error()) + sb.WriteString(" ") + sb.WriteString(strconv.Quote(e.JSONPointer.LastToken())) + if parent := e.JSONPointer.Parent(); parent != "" { + sb.WriteString(" within ") + sb.WriteString(strconv.Quote(jsonwire.TruncatePointer(string(parent), 100))) + } + return sb.String() + } + + // Format where. + // Avoid printing if it overlaps with a wrapped SyntacticError. + switch serr, _ := e.Err.(*jsontext.SyntacticError); { + case e.JSONPointer != "": + if serr == nil || !e.JSONPointer.Contains(serr.JSONPointer) { + sb.WriteString(" within ") + sb.WriteString(strconv.Quote(jsonwire.TruncatePointer(string(e.JSONPointer), 100))) + } + case e.ByteOffset > 0: + if serr == nil || !(e.ByteOffset <= serr.ByteOffset) { + sb.WriteString(" after offset ") + sb.WriteString(strconv.FormatInt(e.ByteOffset, 10)) + } + } + + // Format underlying error. + if e.Err != nil { + errString := e.Err.Error() + if isSyntacticError(e.Err) { + errString = strings.TrimPrefix(errString, "jsontext: ") + } + sb.WriteString(": ") + sb.WriteString(errString) + } + + return sb.String() +} + +func (e *SemanticError) Unwrap() error { + return e.Err +} + +func newDuplicateNameError(ptr jsontext.Pointer, quotedName []byte, offset int64) error { + if quotedName != nil { + name, _ := jsonwire.AppendUnquote(nil, quotedName) + ptr = ptr.AppendToken(string(name)) + } + return &jsontext.SyntacticError{ + ByteOffset: offset, + JSONPointer: ptr, + Err: jsontext.ErrDuplicateName, + } +} + +// toUnexpectedEOF converts [io.EOF] to [io.ErrUnexpectedEOF]. +func toUnexpectedEOF(err error) error { + if err == io.EOF { + return io.ErrUnexpectedEOF + } + return err +} diff --git a/go/src/encoding/json/v2/errors_test.go b/go/src/encoding/json/v2/errors_test.go new file mode 100644 index 0000000000000000000000000000000000000000..76a7f2ae31d4c8222d5c2ee1a5cb5ed61afcc10f --- /dev/null +++ b/go/src/encoding/json/v2/errors_test.go @@ -0,0 +1,115 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json + +import ( + "archive/tar" + "bytes" + "errors" + "io" + "strings" + "testing" + + "encoding/json/internal/jsonwire" + "encoding/json/jsontext" +) + +func TestSemanticError(t *testing.T) { + tests := []struct { + err error + want string + }{{ + err: &SemanticError{}, + want: `json: cannot handle`, + }, { + err: &SemanticError{JSONKind: 'n'}, + want: `json: cannot handle JSON null`, + }, { + err: &SemanticError{action: "unmarshal", JSONKind: 't'}, + want: `json: cannot unmarshal JSON boolean`, + }, { + err: &SemanticError{action: "unmarshal", JSONKind: 'x'}, + want: `json: cannot unmarshal`, // invalid token kinds are ignored + }, { + err: &SemanticError{action: "marshal", JSONKind: '"'}, + want: `json: cannot marshal JSON string`, + }, { + err: &SemanticError{GoType: T[bool]()}, + want: `json: cannot handle Go bool`, + }, { + err: &SemanticError{action: "marshal", GoType: T[int]()}, + want: `json: cannot marshal from Go int`, + }, { + err: &SemanticError{action: "unmarshal", GoType: T[uint]()}, + want: `json: cannot unmarshal into Go uint`, + }, { + err: &SemanticError{GoType: T[struct{ Alpha, Bravo, Charlie, Delta, Echo, Foxtrot, Golf, Hotel string }]()}, + want: `json: cannot handle Go struct`, + }, { + err: &SemanticError{GoType: T[struct{ Alpha, Bravo, Charlie, Delta, Echo, Foxtrot, Golf, Hotel, x string }]()}, + want: `json: cannot handle Go v2.struct`, + }, { + err: &SemanticError{JSONKind: '0', GoType: T[tar.Header]()}, + want: `json: cannot handle JSON number with Go tar.Header`, + }, { + err: &SemanticError{action: "unmarshal", JSONKind: '0', JSONValue: jsontext.Value(`1e1000`), GoType: T[int]()}, + want: `json: cannot unmarshal JSON number 1e1000 into Go int`, + }, { + err: &SemanticError{action: "marshal", JSONKind: '{', GoType: T[bytes.Buffer]()}, + want: `json: cannot marshal JSON object from Go bytes.Buffer`, + }, { + err: &SemanticError{action: "unmarshal", JSONKind: ']', GoType: T[strings.Reader]()}, + want: `json: cannot unmarshal JSON array into Go strings.Reader`, + }, { + err: &SemanticError{action: "unmarshal", JSONKind: '{', GoType: T[float64](), ByteOffset: 123}, + want: `json: cannot unmarshal JSON object into Go float64 after offset 123`, + }, { + err: &SemanticError{action: "marshal", JSONKind: 'f', GoType: T[complex128](), ByteOffset: 123, JSONPointer: "/foo/2/bar/3"}, + want: `json: cannot marshal JSON boolean from Go complex128 within "/foo/2/bar/3"`, + }, { + err: &SemanticError{action: "unmarshal", JSONKind: '}', GoType: T[io.Reader](), ByteOffset: 123, JSONPointer: "/foo/2/bar/3", Err: errors.New("some underlying error")}, + want: `json: cannot unmarshal JSON object into Go io.Reader within "/foo/2/bar/3": some underlying error`, + }, { + err: &SemanticError{Err: errors.New("some underlying error")}, + want: `json: cannot handle: some underlying error`, + }, { + err: &SemanticError{ByteOffset: 123}, + want: `json: cannot handle after offset 123`, + }, { + err: &SemanticError{JSONPointer: "/foo/2/bar/3"}, + want: `json: cannot handle within "/foo/2/bar/3"`, + }, { + err: &SemanticError{action: "unmarshal", JSONPointer: "/3", GoType: T[struct{ Fizz, Buzz string }](), Err: ErrUnknownName}, + want: `json: cannot unmarshal into Go struct { Fizz string; Buzz string }: unknown object member name "3"`, + }, { + err: &SemanticError{action: "unmarshal", JSONPointer: "/foo/2/bar/3", GoType: T[struct{ Foo string }](), Err: ErrUnknownName}, + want: `json: cannot unmarshal into Go struct { Foo string }: unknown object member name "3" within "/foo/2/bar"`, + }, { + err: &SemanticError{JSONPointer: "/foo/bar", ByteOffset: 16, GoType: T[string](), Err: &jsontext.SyntacticError{JSONPointer: "/foo/bar/baz", ByteOffset: 53, Err: jsonwire.ErrInvalidUTF8}}, + want: `json: cannot handle Go string: invalid UTF-8 within "/foo/bar/baz" after offset 53`, + }, { + err: &SemanticError{JSONPointer: "/fizz/bar", ByteOffset: 16, GoType: T[string](), Err: &jsontext.SyntacticError{JSONPointer: "/foo/bar/baz", ByteOffset: 53, Err: jsonwire.ErrInvalidUTF8}}, + want: `json: cannot handle Go string within "/fizz/bar": invalid UTF-8 within "/foo/bar/baz" after offset 53`, + }, { + err: &SemanticError{ByteOffset: 16, GoType: T[string](), Err: &jsontext.SyntacticError{JSONPointer: "/foo/bar/baz", ByteOffset: 53, Err: jsonwire.ErrInvalidUTF8}}, + want: `json: cannot handle Go string: invalid UTF-8 within "/foo/bar/baz" after offset 53`, + }, { + err: &SemanticError{ByteOffset: 85, GoType: T[string](), Err: &jsontext.SyntacticError{JSONPointer: "/foo/bar/baz", ByteOffset: 53, Err: jsonwire.ErrInvalidUTF8}}, + want: `json: cannot handle Go string after offset 85: invalid UTF-8 within "/foo/bar/baz" after offset 53`, + }} + + for _, tt := range tests { + got := tt.err.Error() + // Cleanup the error of non-deterministic rendering effects. + if strings.HasPrefix(got, errorPrefix+"unable to ") { + got = errorPrefix + "cannot " + strings.TrimPrefix(got, errorPrefix+"unable to ") + } + if got != tt.want { + t.Errorf("%#v.Error mismatch:\ngot %v\nwant %v", tt.err, got, tt.want) + } + } +} diff --git a/go/src/encoding/json/v2/example_orderedobject_test.go b/go/src/encoding/json/v2/example_orderedobject_test.go new file mode 100644 index 0000000000000000000000000000000000000000..fc231325040190a4dc892e3eb0bc75db9e1bddb8 --- /dev/null +++ b/go/src/encoding/json/v2/example_orderedobject_test.go @@ -0,0 +1,115 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json_test + +import ( + "fmt" + "log" + "reflect" + + "encoding/json/jsontext" + "encoding/json/v2" +) + +// OrderedObject is an ordered sequence of name/value members in a JSON object. +// +// RFC 8259 defines an object as an "unordered collection". +// JSON implementations need not make "ordering of object members visible" +// to applications nor will they agree on the semantic meaning of an object if +// "the names within an object are not unique". For maximum compatibility, +// applications should avoid relying on ordering or duplicity of object names. +type OrderedObject[V any] []ObjectMember[V] + +// ObjectMember is a JSON object member. +type ObjectMember[V any] struct { + Name string + Value V +} + +// MarshalJSONTo encodes obj as a JSON object into enc. +func (obj *OrderedObject[V]) MarshalJSONTo(enc *jsontext.Encoder) error { + if err := enc.WriteToken(jsontext.BeginObject); err != nil { + return err + } + for i := range *obj { + member := &(*obj)[i] + if err := json.MarshalEncode(enc, &member.Name); err != nil { + return err + } + if err := json.MarshalEncode(enc, &member.Value); err != nil { + return err + } + } + if err := enc.WriteToken(jsontext.EndObject); err != nil { + return err + } + return nil +} + +// UnmarshalJSONFrom decodes a JSON object from dec into obj. +func (obj *OrderedObject[V]) UnmarshalJSONFrom(dec *jsontext.Decoder) error { + if k := dec.PeekKind(); k != '{' { + // The [json] package automatically populates relevant fields + // in a [json.SemanticError] to provide additional context. + return &json.SemanticError{JSONKind: k} + } + if _, err := dec.ReadToken(); err != nil { + return err + } + for dec.PeekKind() != '}' { + *obj = append(*obj, ObjectMember[V]{}) + member := &(*obj)[len(*obj)-1] + if err := json.UnmarshalDecode(dec, &member.Name); err != nil { + return err + } + if err := json.UnmarshalDecode(dec, &member.Value); err != nil { + return err + } + } + if _, err := dec.ReadToken(); err != nil { + return err + } + return nil +} + +// The exact order of JSON object can be preserved through the use of a +// specialized type that implements [MarshalerTo] and [UnmarshalerFrom]. +func Example_orderedObject() { + // Round-trip marshal and unmarshal an ordered object. + // We expect the order and duplicity of JSON object members to be preserved. + // Specify jsontext.AllowDuplicateNames since this object contains "fizz" twice. + want := OrderedObject[string]{ + {"fizz", "buzz"}, + {"hello", "world"}, + {"fizz", "wuzz"}, + } + b, err := json.Marshal(&want, jsontext.AllowDuplicateNames(true)) + if err != nil { + log.Fatal(err) + } + var got OrderedObject[string] + err = json.Unmarshal(b, &got, jsontext.AllowDuplicateNames(true)) + if err != nil { + log.Fatal(err) + } + + // Sanity check. + if !reflect.DeepEqual(got, want) { + log.Fatalf("roundtrip mismatch: got %v, want %v", got, want) + } + + // Print the serialized JSON object. + (*jsontext.Value)(&b).Indent() // indent for readability + fmt.Println(string(b)) + + // Output: + // { + // "fizz": "buzz", + // "hello": "world", + // "fizz": "wuzz" + // } +} diff --git a/go/src/encoding/json/v2/example_test.go b/go/src/encoding/json/v2/example_test.go new file mode 100644 index 0000000000000000000000000000000000000000..dc1f06674ce24a0c2dd75da1b18bdb4eaf2b87d8 --- /dev/null +++ b/go/src/encoding/json/v2/example_test.go @@ -0,0 +1,695 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json_test + +import ( + "bytes" + "errors" + "fmt" + "log" + "math" + "net/http" + "net/netip" + "os" + "reflect" + "strconv" + "strings" + "sync/atomic" + "time" + + "encoding/json/jsontext" + "encoding/json/v2" +) + +// If a type implements [encoding.TextMarshaler] and/or [encoding.TextUnmarshaler], +// then the MarshalText and UnmarshalText methods are used to encode/decode +// the value to/from a JSON string. +func Example_textMarshal() { + // Round-trip marshal and unmarshal a hostname map where the netip.Addr type + // implements both encoding.TextMarshaler and encoding.TextUnmarshaler. + want := map[netip.Addr]string{ + netip.MustParseAddr("192.168.0.100"): "carbonite", + netip.MustParseAddr("192.168.0.101"): "obsidian", + netip.MustParseAddr("192.168.0.102"): "diamond", + } + b, err := json.Marshal(&want, json.Deterministic(true)) + if err != nil { + log.Fatal(err) + } + var got map[netip.Addr]string + err = json.Unmarshal(b, &got) + if err != nil { + log.Fatal(err) + } + + // Sanity check. + if !reflect.DeepEqual(got, want) { + log.Fatalf("roundtrip mismatch: got %v, want %v", got, want) + } + + // Print the serialized JSON object. + (*jsontext.Value)(&b).Indent() // indent for readability + fmt.Println(string(b)) + + // Output: + // { + // "192.168.0.100": "carbonite", + // "192.168.0.101": "obsidian", + // "192.168.0.102": "diamond" + // } +} + +// By default, JSON object names for Go struct fields are derived from +// the Go field name, but may be specified in the `json` tag. +// Due to JSON's heritage in JavaScript, the most common naming convention +// used for JSON object names is camelCase. +func Example_fieldNames() { + var value struct { + // This field is explicitly ignored with the special "-" name. + Ignored any `json:"-"` + // No JSON name is not provided, so the Go field name is used. + GoName any + // A JSON name is provided without any special characters. + JSONName any `json:"jsonName"` + // No JSON name is not provided, so the Go field name is used. + Option any `json:",case:ignore"` + // An empty JSON name specified using an single-quoted string literal. + Empty any `json:"''"` + // A dash JSON name specified using an single-quoted string literal. + Dash any `json:"'-'"` + // A comma JSON name specified using an single-quoted string literal. + Comma any `json:"','"` + // JSON name with quotes specified using a single-quoted string literal. + Quote any `json:"'\"\\''"` + // An unexported field is always ignored. + unexported any + } + + b, err := json.Marshal(value) + if err != nil { + log.Fatal(err) + } + (*jsontext.Value)(&b).Indent() // indent for readability + fmt.Println(string(b)) + + // Output: + // { + // "GoName": null, + // "jsonName": null, + // "Option": null, + // "": null, + // "-": null, + // ",": null, + // "\"'": null + // } +} + +// Unmarshal matches JSON object names with Go struct fields using +// a case-sensitive match, but can be configured to use a case-insensitive +// match with the "case:ignore" option. This permits unmarshaling from inputs +// that use naming conventions such as camelCase, snake_case, or kebab-case. +func Example_caseSensitivity() { + // JSON input using various naming conventions. + const input = `[ + {"firstname": true}, + {"firstName": true}, + {"FirstName": true}, + {"FIRSTNAME": true}, + {"first_name": true}, + {"FIRST_NAME": true}, + {"first-name": true}, + {"FIRST-NAME": true}, + {"unknown": true} + ]` + + // Without "case:ignore", Unmarshal looks for an exact match. + var caseStrict []struct { + X bool `json:"firstName"` + } + if err := json.Unmarshal([]byte(input), &caseStrict); err != nil { + log.Fatal(err) + } + fmt.Println(caseStrict) // exactly 1 match found + + // With "case:ignore", Unmarshal looks first for an exact match, + // then for a case-insensitive match if none found. + var caseIgnore []struct { + X bool `json:"firstName,case:ignore"` + } + if err := json.Unmarshal([]byte(input), &caseIgnore); err != nil { + log.Fatal(err) + } + fmt.Println(caseIgnore) // 8 matches found + + // Output: + // [{false} {true} {false} {false} {false} {false} {false} {false} {false}] + // [{true} {true} {true} {true} {true} {true} {true} {true} {false}] +} + +// Go struct fields can be omitted from the output depending on either +// the input Go value or the output JSON encoding of the value. +// The "omitzero" option omits a field if it is the zero Go value or +// implements a "IsZero() bool" method that reports true. +// The "omitempty" option omits a field if it encodes as an empty JSON value, +// which we define as a JSON null or empty JSON string, object, or array. +// In many cases, the behavior of "omitzero" and "omitempty" are equivalent. +// If both provide the desired effect, then using "omitzero" is preferred. +func Example_omitFields() { + type MyStruct struct { + Foo string `json:",omitzero"` + Bar []int `json:",omitempty"` + // Both "omitzero" and "omitempty" can be specified together, + // in which case the field is omitted if either would take effect. + // This omits the Baz field either if it is a nil pointer or + // if it would have encoded as an empty JSON object. + Baz *MyStruct `json:",omitzero,omitempty"` + } + + // Demonstrate behavior of "omitzero". + b, err := json.Marshal(struct { + Bool bool `json:",omitzero"` + Int int `json:",omitzero"` + String string `json:",omitzero"` + Time time.Time `json:",omitzero"` + Addr netip.Addr `json:",omitzero"` + Struct MyStruct `json:",omitzero"` + SliceNil []int `json:",omitzero"` + Slice []int `json:",omitzero"` + MapNil map[int]int `json:",omitzero"` + Map map[int]int `json:",omitzero"` + PointerNil *string `json:",omitzero"` + Pointer *string `json:",omitzero"` + InterfaceNil any `json:",omitzero"` + Interface any `json:",omitzero"` + }{ + // Bool is omitted since false is the zero value for a Go bool. + Bool: false, + // Int is omitted since 0 is the zero value for a Go int. + Int: 0, + // String is omitted since "" is the zero value for a Go string. + String: "", + // Time is omitted since time.Time.IsZero reports true. + Time: time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC), + // Addr is omitted since netip.Addr{} is the zero value for a Go struct. + Addr: netip.Addr{}, + // Struct is NOT omitted since it is not the zero value for a Go struct. + Struct: MyStruct{Bar: []int{}, Baz: new(MyStruct)}, + // SliceNil is omitted since nil is the zero value for a Go slice. + SliceNil: nil, + // Slice is NOT omitted since []int{} is not the zero value for a Go slice. + Slice: []int{}, + // MapNil is omitted since nil is the zero value for a Go map. + MapNil: nil, + // Map is NOT omitted since map[int]int{} is not the zero value for a Go map. + Map: map[int]int{}, + // PointerNil is omitted since nil is the zero value for a Go pointer. + PointerNil: nil, + // Pointer is NOT omitted since new(string) is not the zero value for a Go pointer. + Pointer: new(string), + // InterfaceNil is omitted since nil is the zero value for a Go interface. + InterfaceNil: nil, + // Interface is NOT omitted since (*string)(nil) is not the zero value for a Go interface. + Interface: (*string)(nil), + }) + if err != nil { + log.Fatal(err) + } + (*jsontext.Value)(&b).Indent() // indent for readability + fmt.Println("OmitZero:", string(b)) // outputs "Struct", "Slice", "Map", "Pointer", and "Interface" + + // Demonstrate behavior of "omitempty". + b, err = json.Marshal(struct { + Bool bool `json:",omitempty"` + Int int `json:",omitempty"` + String string `json:",omitempty"` + Time time.Time `json:",omitempty"` + Addr netip.Addr `json:",omitempty"` + Struct MyStruct `json:",omitempty"` + Slice []int `json:",omitempty"` + Map map[int]int `json:",omitempty"` + PointerNil *string `json:",omitempty"` + Pointer *string `json:",omitempty"` + InterfaceNil any `json:",omitempty"` + Interface any `json:",omitempty"` + }{ + // Bool is NOT omitted since false is not an empty JSON value. + Bool: false, + // Int is NOT omitted since 0 is not a empty JSON value. + Int: 0, + // String is omitted since "" is an empty JSON string. + String: "", + // Time is NOT omitted since this encodes as a non-empty JSON string. + Time: time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC), + // Addr is omitted since this encodes as an empty JSON string. + Addr: netip.Addr{}, + // Struct is omitted since {} is an empty JSON object. + Struct: MyStruct{Bar: []int{}, Baz: new(MyStruct)}, + // Slice is omitted since [] is an empty JSON array. + Slice: []int{}, + // Map is omitted since {} is an empty JSON object. + Map: map[int]int{}, + // PointerNil is omitted since null is an empty JSON value. + PointerNil: nil, + // Pointer is omitted since "" is an empty JSON string. + Pointer: new(string), + // InterfaceNil is omitted since null is an empty JSON value. + InterfaceNil: nil, + // Interface is omitted since null is an empty JSON value. + Interface: (*string)(nil), + }) + if err != nil { + log.Fatal(err) + } + (*jsontext.Value)(&b).Indent() // indent for readability + fmt.Println("OmitEmpty:", string(b)) // outputs "Bool", "Int", and "Time" + + // Output: + // OmitZero: { + // "Struct": {}, + // "Slice": [], + // "Map": {}, + // "Pointer": "", + // "Interface": null + // } + // OmitEmpty: { + // "Bool": false, + // "Int": 0, + // "Time": "0001-01-01T00:00:00Z" + // } +} + +// JSON objects can be inlined within a parent object similar to +// how Go structs can be embedded within a parent struct. +// The inlining rules are similar to those of Go embedding, +// but operates upon the JSON namespace. +func Example_inlinedFields() { + // Base is embedded within Container. + type Base struct { + // ID is promoted into the JSON object for Container. + ID string + // Type is ignored due to presence of Container.Type. + Type string + // Time cancels out with Container.Inlined.Time. + Time time.Time + } + // Other is embedded within Container. + type Other struct{ Cost float64 } + // Container embeds Base and Other. + type Container struct { + // Base is an embedded struct and is implicitly JSON inlined. + Base + // Type takes precedence over Base.Type. + Type int + // Inlined is a named Go field, but is explicitly JSON inlined. + Inlined struct { + // User is promoted into the JSON object for Container. + User string + // Time cancels out with Base.Time. + Time string + } `json:",inline"` + // ID does not conflict with Base.ID since the JSON name is different. + ID string `json:"uuid"` + // Other is not JSON inlined since it has an explicit JSON name. + Other `json:"other"` + } + + // Format an empty Container to show what fields are JSON serializable. + var input Container + b, err := json.Marshal(&input) + if err != nil { + log.Fatal(err) + } + (*jsontext.Value)(&b).Indent() // indent for readability + fmt.Println(string(b)) + + // Output: + // { + // "ID": "", + // "Type": 0, + // "User": "", + // "uuid": "", + // "other": { + // "Cost": 0 + // } + // } +} + +// Due to version skew, the set of JSON object members known at compile-time +// may differ from the set of members encountered at execution-time. +// As such, it may be useful to have finer grain handling of unknown members. +// This package supports preserving, rejecting, or discarding such members. +func Example_unknownMembers() { + const input = `{ + "Name": "Teal", + "Value": "#008080", + "WebSafe": false + }` + type Color struct { + Name string + Value string + + // Unknown is a Go struct field that holds unknown JSON object members. + // It is marked as having this behavior with the "unknown" tag option. + // + // The type may be a jsontext.Value or map[string]T. + Unknown jsontext.Value `json:",unknown"` + } + + // By default, unknown members are stored in a Go field marked as "unknown" + // or ignored if no such field exists. + var color Color + err := json.Unmarshal([]byte(input), &color) + if err != nil { + log.Fatal(err) + } + fmt.Println("Unknown members:", string(color.Unknown)) + + // Specifying RejectUnknownMembers causes Unmarshal + // to reject the presence of any unknown members. + err = json.Unmarshal([]byte(input), new(Color), json.RejectUnknownMembers(true)) + serr, ok := errors.AsType[*json.SemanticError](err) + if ok && serr.Err == json.ErrUnknownName { + fmt.Println("Unmarshal error:", serr.Err, strconv.Quote(serr.JSONPointer.LastToken())) + } + + // By default, Marshal preserves unknown members stored in + // a Go struct field marked as "unknown". + b, err := json.Marshal(color) + if err != nil { + log.Fatal(err) + } + fmt.Println("Output with unknown members: ", string(b)) + + // Specifying DiscardUnknownMembers causes Marshal + // to discard any unknown members. + b, err = json.Marshal(color, json.DiscardUnknownMembers(true)) + if err != nil { + log.Fatal(err) + } + fmt.Println("Output without unknown members:", string(b)) + + // Output: + // Unknown members: {"WebSafe":false} + // Unmarshal error: unknown object member name "WebSafe" + // Output with unknown members: {"Name":"Teal","Value":"#008080","WebSafe":false} + // Output without unknown members: {"Name":"Teal","Value":"#008080"} +} + +// The "format" tag option can be used to alter the formatting of certain types. +func Example_formatFlags() { + value := struct { + BytesBase64 []byte `json:",format:base64"` + BytesHex [8]byte `json:",format:hex"` + BytesArray []byte `json:",format:array"` + FloatNonFinite float64 `json:",format:nonfinite"` + MapEmitNull map[string]any `json:",format:emitnull"` + SliceEmitNull []any `json:",format:emitnull"` + TimeDateOnly time.Time `json:",format:'2006-01-02'"` + TimeUnixSec time.Time `json:",format:unix"` + DurationSecs time.Duration `json:",format:sec"` + DurationNanos time.Duration `json:",format:nano"` + DurationISO8601 time.Duration `json:",format:iso8601"` + }{ + BytesBase64: []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, + BytesHex: [8]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, + BytesArray: []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, + FloatNonFinite: math.NaN(), + MapEmitNull: nil, + SliceEmitNull: nil, + TimeDateOnly: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), + TimeUnixSec: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), + DurationSecs: 12*time.Hour + 34*time.Minute + 56*time.Second + 7*time.Millisecond + 8*time.Microsecond + 9*time.Nanosecond, + DurationNanos: 12*time.Hour + 34*time.Minute + 56*time.Second + 7*time.Millisecond + 8*time.Microsecond + 9*time.Nanosecond, + DurationISO8601: 12*time.Hour + 34*time.Minute + 56*time.Second + 7*time.Millisecond + 8*time.Microsecond + 9*time.Nanosecond, + } + + b, err := json.Marshal(&value) + if err != nil { + log.Fatal(err) + } + (*jsontext.Value)(&b).Indent() // indent for readability + fmt.Println(string(b)) + + // Output: + // { + // "BytesBase64": "ASNFZ4mrze8=", + // "BytesHex": "0123456789abcdef", + // "BytesArray": [ + // 1, + // 35, + // 69, + // 103, + // 137, + // 171, + // 205, + // 239 + // ], + // "FloatNonFinite": "NaN", + // "MapEmitNull": null, + // "SliceEmitNull": null, + // "TimeDateOnly": "2000-01-01", + // "TimeUnixSec": 946684800, + // "DurationSecs": 45296.007008009, + // "DurationNanos": 45296007008009, + // "DurationISO8601": "PT12H34M56.007008009S" + // } +} + +// When implementing HTTP endpoints, it is common to be operating with an +// [io.Reader] and an [io.Writer]. The [MarshalWrite] and [UnmarshalRead] functions +// assist in operating on such input/output types. +// [UnmarshalRead] reads the entirety of the [io.Reader] to ensure that [io.EOF] +// is encountered without any unexpected bytes after the top-level JSON value. +func Example_serveHTTP() { + // Some global state maintained by the server. + var n int64 + + // The "add" endpoint accepts a POST request with a JSON object + // containing a number to atomically add to the server's global counter. + // It returns the updated value of the counter. + http.HandleFunc("/api/add", func(w http.ResponseWriter, r *http.Request) { + // Unmarshal the request from the client. + var val struct{ N int64 } + if err := json.UnmarshalRead(r.Body, &val); err != nil { + // Inability to unmarshal the input suggests a client-side problem. + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + + // Marshal a response from the server. + val.N = atomic.AddInt64(&n, val.N) + if err := json.MarshalWrite(w, &val); err != nil { + // Inability to marshal the output suggests a server-side problem. + // This error is not always observable by the client since + // json.MarshalWrite may have already written to the output. + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + }) +} + +// Some Go types have a custom JSON representation where the implementation +// is delegated to some external package. Consequently, the "json" package +// will not know how to use that external implementation. +// For example, the [google.golang.org/protobuf/encoding/protojson] package +// implements JSON for all [google.golang.org/protobuf/proto.Message] types. +// [WithMarshalers] and [WithUnmarshalers] can be used +// to configure "json" and "protojson" to cooperate together. +func Example_protoJSON() { + // Let protoMessage be "google.golang.org/protobuf/proto".Message. + type protoMessage interface{ ProtoReflect() } + // Let foopbMyMessage be a concrete implementation of proto.Message. + type foopbMyMessage struct{ protoMessage } + // Let protojson be an import of "google.golang.org/protobuf/encoding/protojson". + var protojson struct { + Marshal func(protoMessage) ([]byte, error) + Unmarshal func([]byte, protoMessage) error + } + + // This value mixes both non-proto.Message types and proto.Message types. + // It should use the "json" package to handle non-proto.Message types and + // should use the "protojson" package to handle proto.Message types. + var value struct { + // GoStruct does not implement proto.Message and + // should use the default behavior of the "json" package. + GoStruct struct { + Name string + Age int + } + + // ProtoMessage implements proto.Message and + // should be handled using protojson.Marshal. + ProtoMessage *foopbMyMessage + } + + // Marshal using protojson.Marshal for proto.Message types. + b, err := json.Marshal(&value, + // Use protojson.Marshal as a type-specific marshaler. + json.WithMarshalers(json.MarshalFunc(protojson.Marshal))) + if err != nil { + log.Fatal(err) + } + + // Unmarshal using protojson.Unmarshal for proto.Message types. + err = json.Unmarshal(b, &value, + // Use protojson.Unmarshal as a type-specific unmarshaler. + json.WithUnmarshalers(json.UnmarshalFunc(protojson.Unmarshal))) + if err != nil { + log.Fatal(err) + } +} + +// Many error types are not serializable since they tend to be Go structs +// without any exported fields (e.g., errors constructed with [errors.New]). +// Some applications, may desire to marshal an error as a JSON string +// even if these errors cannot be unmarshaled. +func ExampleWithMarshalers_errors() { + // Response to serialize with some Go errors encountered. + response := []struct { + Result string `json:",omitzero"` + Error error `json:",omitzero"` + }{ + {Result: "Oranges are a good source of Vitamin C."}, + {Error: &strconv.NumError{Func: "ParseUint", Num: "-1234", Err: strconv.ErrSyntax}}, + {Error: &os.PathError{Op: "ReadFile", Path: "/path/to/secret/file", Err: os.ErrPermission}}, + } + + b, err := json.Marshal(&response, + // Intercept every attempt to marshal an error type. + json.WithMarshalers(json.JoinMarshalers( + // Suppose we consider strconv.NumError to be a safe to serialize: + // this type-specific marshal function intercepts this type + // and encodes the error message as a JSON string. + json.MarshalToFunc(func(enc *jsontext.Encoder, err *strconv.NumError) error { + return enc.WriteToken(jsontext.String(err.Error())) + }), + // Error messages may contain sensitive information that may not + // be appropriate to serialize. For all errors not handled above, + // report some generic error message. + json.MarshalFunc(func(error) ([]byte, error) { + return []byte(`"internal server error"`), nil + }), + )), + jsontext.Multiline(true)) // expand for readability + if err != nil { + log.Fatal(err) + } + fmt.Println(string(b)) + + // Output: + // [ + // { + // "Result": "Oranges are a good source of Vitamin C." + // }, + // { + // "Error": "strconv.ParseUint: parsing \"-1234\": invalid syntax" + // }, + // { + // "Error": "internal server error" + // } + // ] +} + +// In some applications, the exact precision of JSON numbers needs to be +// preserved when unmarshaling. This can be accomplished using a type-specific +// unmarshal function that intercepts all any types and pre-populates the +// interface value with a [jsontext.Value], which can represent a JSON number exactly. +func ExampleWithUnmarshalers_rawNumber() { + // Input with JSON numbers beyond the representation of a float64. + const input = `[false, 1e-1000, 3.141592653589793238462643383279, 1e+1000, true]` + + var value any + err := json.Unmarshal([]byte(input), &value, + // Intercept every attempt to unmarshal into the any type. + json.WithUnmarshalers( + json.UnmarshalFromFunc(func(dec *jsontext.Decoder, val *any) error { + // If the next value to be decoded is a JSON number, + // then provide a concrete Go type to unmarshal into. + if dec.PeekKind() == '0' { + *val = jsontext.Value(nil) + } + // Return SkipFunc to fallback on default unmarshal behavior. + return json.SkipFunc + }), + )) + if err != nil { + log.Fatal(err) + } + fmt.Println(value) + + // Sanity check. + want := []any{false, jsontext.Value("1e-1000"), jsontext.Value("3.141592653589793238462643383279"), jsontext.Value("1e+1000"), true} + if !reflect.DeepEqual(value, want) { + log.Fatalf("value mismatch:\ngot %v\nwant %v", value, want) + } + + // Output: + // [false 1e-1000 3.141592653589793238462643383279 1e+1000 true] +} + +// When using JSON for parsing configuration files, +// the parsing logic often needs to report an error with a line and column +// indicating where in the input an error occurred. +func ExampleWithUnmarshalers_recordOffsets() { + // Hypothetical configuration file. + const input = `[ + {"Source": "192.168.0.100:1234", "Destination": "192.168.0.1:80"}, + {"Source": "192.168.0.251:4004"}, + {"Source": "192.168.0.165:8080", "Destination": "0.0.0.0:80"} + ]` + type Tunnel struct { + Source netip.AddrPort + Destination netip.AddrPort + + // ByteOffset is populated during unmarshal with the byte offset + // within the JSON input of the JSON object for this Go struct. + ByteOffset int64 `json:"-"` // metadata to be ignored for JSON serialization + } + + var tunnels []Tunnel + err := json.Unmarshal([]byte(input), &tunnels, + // Intercept every attempt to unmarshal into the Tunnel type. + json.WithUnmarshalers( + json.UnmarshalFromFunc(func(dec *jsontext.Decoder, tunnel *Tunnel) error { + // Decoder.InputOffset reports the offset after the last token, + // but we want to record the offset before the next token. + // + // Call Decoder.PeekKind to buffer enough to reach the next token. + // Add the number of leading whitespace, commas, and colons + // to locate the start of the next token. + dec.PeekKind() + unread := dec.UnreadBuffer() + n := len(unread) - len(bytes.TrimLeft(unread, " \n\r\t,:")) + tunnel.ByteOffset = dec.InputOffset() + int64(n) + + // Return SkipFunc to fallback on default unmarshal behavior. + return json.SkipFunc + }), + )) + if err != nil { + log.Fatal(err) + } + + // lineColumn converts a byte offset into a one-indexed line and column. + // The offset must be within the bounds of the input. + lineColumn := func(input string, offset int) (line, column int) { + line = 1 + strings.Count(input[:offset], "\n") + column = 1 + offset - (strings.LastIndex(input[:offset], "\n") + len("\n")) + return line, column + } + + // Verify that the configuration file is valid. + for _, tunnel := range tunnels { + if !tunnel.Source.IsValid() || !tunnel.Destination.IsValid() { + line, column := lineColumn(input, int(tunnel.ByteOffset)) + fmt.Printf("%d:%d: source and destination must both be specified", line, column) + } + } + + // Output: + // 3:3: source and destination must both be specified +} diff --git a/go/src/encoding/json/v2/fields.go b/go/src/encoding/json/v2/fields.go new file mode 100644 index 0000000000000000000000000000000000000000..4a02be7327a04b9ffae1ab3e8e565b9318d9c7a7 --- /dev/null +++ b/go/src/encoding/json/v2/fields.go @@ -0,0 +1,654 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json + +import ( + "cmp" + "errors" + "fmt" + "io" + "reflect" + "slices" + "strconv" + "strings" + "unicode" + "unicode/utf8" + + "encoding/json/internal/jsonflags" + "encoding/json/internal/jsonwire" +) + +type isZeroer interface { + IsZero() bool +} + +var isZeroerType = reflect.TypeFor[isZeroer]() + +type structFields struct { + flattened []structField // listed in depth-first ordering + byActualName map[string]*structField + byFoldedName map[string][]*structField + inlinedFallback *structField +} + +// reindex recomputes index to avoid bounds check during runtime. +// +// During the construction of each [structField] in [makeStructFields], +// the index field is 0-indexed. However, before it returns, +// the 0th field is stored in index0 and index stores the remainder. +func (sf *structFields) reindex() { + reindex := func(f *structField) { + f.index0 = f.index[0] + f.index = f.index[1:] + if len(f.index) == 0 { + f.index = nil // avoid pinning the backing slice + } + } + for i := range sf.flattened { + reindex(&sf.flattened[i]) + } + if sf.inlinedFallback != nil { + reindex(sf.inlinedFallback) + } +} + +// lookupByFoldedName looks up name by a case-insensitive match +// that also ignores the presence of dashes and underscores. +func (fs *structFields) lookupByFoldedName(name []byte) []*structField { + return fs.byFoldedName[string(foldName(name))] +} + +type structField struct { + id int // unique numeric ID in breadth-first ordering + index0 int // 0th index into a struct according to [reflect.Type.FieldByIndex] + index []int // 1st index and remainder according to [reflect.Type.FieldByIndex] + typ reflect.Type + fncs *arshaler + isZero func(addressableValue) bool + isEmpty func(addressableValue) bool + fieldOptions +} + +var errNoExportedFields = errors.New("Go struct has no exported fields") + +func makeStructFields(root reflect.Type) (fs structFields, serr *SemanticError) { + orErrorf := func(serr *SemanticError, t reflect.Type, f string, a ...any) *SemanticError { + return cmp.Or(serr, &SemanticError{GoType: t, Err: fmt.Errorf(f, a...)}) + } + + // Setup a queue for a breath-first search. + var queueIndex int + type queueEntry struct { + typ reflect.Type + index []int + visitChildren bool // whether to recursively visit inlined field in this struct + } + queue := []queueEntry{{root, nil, true}} + seen := map[reflect.Type]bool{root: true} + + // Perform a breadth-first search over all reachable fields. + // This ensures that len(f.index) will be monotonically increasing. + var allFields, inlinedFallbacks []structField + for queueIndex < len(queue) { + qe := queue[queueIndex] + queueIndex++ + + t := qe.typ + inlinedFallbackIndex := -1 // index of last inlined fallback field in current struct + namesIndex := make(map[string]int) // index of each field with a given JSON object name in current struct + var hasAnyJSONTag bool // whether any Go struct field has a `json` tag + var hasAnyJSONField bool // whether any JSON serializable fields exist in current struct + for i := range t.NumField() { + sf := t.Field(i) + _, hasTag := sf.Tag.Lookup("json") + hasAnyJSONTag = hasAnyJSONTag || hasTag + options, ignored, err := parseFieldOptions(sf) + if err != nil { + serr = cmp.Or(serr, &SemanticError{GoType: t, Err: err}) + } + if ignored { + continue + } + hasAnyJSONField = true + f := structField{ + // Allocate a new slice (len=N+1) to hold both + // the parent index (len=N) and the current index (len=1). + // Do this to avoid clobbering the memory of the parent index. + index: append(append(make([]int, 0, len(qe.index)+1), qe.index...), i), + typ: sf.Type, + fieldOptions: options, + } + if sf.Anonymous && !f.hasName { + if indirectType(f.typ).Kind() != reflect.Struct { + serr = orErrorf(serr, t, "embedded Go struct field %s of non-struct type must be explicitly given a JSON name", sf.Name) + } else { + f.inline = true // implied by use of Go embedding without an explicit name + } + } + if f.inline || f.unknown { + // Handle an inlined field that serializes to/from + // zero or more JSON object members. + + switch f.fieldOptions { + case fieldOptions{name: f.name, quotedName: f.quotedName, inline: true}: + case fieldOptions{name: f.name, quotedName: f.quotedName, unknown: true}: + case fieldOptions{name: f.name, quotedName: f.quotedName, inline: true, unknown: true}: + serr = orErrorf(serr, t, "Go struct field %s cannot have both `inline` and `unknown` specified", sf.Name) + f.inline = false // let `unknown` take precedence + default: + serr = orErrorf(serr, t, "Go struct field %s cannot have any options other than `inline` or `unknown` specified", sf.Name) + if f.hasName { + continue // invalid inlined field; treat as ignored + } + f.fieldOptions = fieldOptions{name: f.name, quotedName: f.quotedName, inline: f.inline, unknown: f.unknown} + if f.inline && f.unknown { + f.inline = false // let `unknown` take precedence + } + } + + // Reject any types with custom serialization otherwise + // it becomes impossible to know what sub-fields to inline. + tf := indirectType(f.typ) + if implementsAny(tf, allMethodTypes...) && tf != jsontextValueType { + serr = orErrorf(serr, t, "inlined Go struct field %s of type %s must not implement marshal or unmarshal methods", sf.Name, tf) + } + + // Handle an inlined field that serializes to/from + // a finite number of JSON object members backed by a Go struct. + if tf.Kind() == reflect.Struct { + if f.unknown { + serr = orErrorf(serr, t, "inlined Go struct field %s of type %s with `unknown` tag must be a Go map of string key or a jsontext.Value", sf.Name, tf) + continue // invalid inlined field; treat as ignored + } + if qe.visitChildren { + queue = append(queue, queueEntry{tf, f.index, !seen[tf]}) + } + seen[tf] = true + continue + } else if !sf.IsExported() { + serr = orErrorf(serr, t, "inlined Go struct field %s is not exported", sf.Name) + continue // invalid inlined field; treat as ignored + } + + // Handle an inlined field that serializes to/from any number of + // JSON object members back by a Go map or jsontext.Value. + switch { + case tf == jsontextValueType: + f.fncs = nil // specially handled in arshal_inlined.go + case tf.Kind() == reflect.Map && tf.Key().Kind() == reflect.String: + if implementsAny(tf.Key(), allMethodTypes...) { + serr = orErrorf(serr, t, "inlined map field %s of type %s must have a string key that does not implement marshal or unmarshal methods", sf.Name, tf) + continue // invalid inlined field; treat as ignored + } + f.fncs = lookupArshaler(tf.Elem()) + default: + serr = orErrorf(serr, t, "inlined Go struct field %s of type %s must be a Go struct, Go map of string key, or jsontext.Value", sf.Name, tf) + continue // invalid inlined field; treat as ignored + } + + // Reject multiple inlined fallback fields within the same struct. + if inlinedFallbackIndex >= 0 { + serr = orErrorf(serr, t, "inlined Go struct fields %s and %s cannot both be a Go map or jsontext.Value", t.Field(inlinedFallbackIndex).Name, sf.Name) + // Still append f to inlinedFallbacks as there is still a + // check for a dominant inlined fallback before returning. + } + inlinedFallbackIndex = i + + inlinedFallbacks = append(inlinedFallbacks, f) + } else { + // Handle normal Go struct field that serializes to/from + // a single JSON object member. + + // Unexported fields cannot be serialized except for + // embedded fields of a struct type, + // which might promote exported fields of their own. + if !sf.IsExported() { + tf := indirectType(f.typ) + if !(sf.Anonymous && tf.Kind() == reflect.Struct) { + serr = orErrorf(serr, t, "Go struct field %s is not exported", sf.Name) + continue + } + // Unfortunately, methods on the unexported field + // still cannot be called. + if implementsAny(tf, allMethodTypes...) || + (f.omitzero && implementsAny(tf, isZeroerType)) { + serr = orErrorf(serr, t, "Go struct field %s is not exported for method calls", sf.Name) + continue + } + } + + // Provide a function that uses a type's IsZero method. + switch { + case sf.Type.Kind() == reflect.Interface && sf.Type.Implements(isZeroerType): + f.isZero = func(va addressableValue) bool { + // Avoid panics calling IsZero on a nil interface or + // non-nil interface with nil pointer. + return va.IsNil() || (va.Elem().Kind() == reflect.Pointer && va.Elem().IsNil()) || va.Interface().(isZeroer).IsZero() + } + case sf.Type.Kind() == reflect.Pointer && sf.Type.Implements(isZeroerType): + f.isZero = func(va addressableValue) bool { + // Avoid panics calling IsZero on nil pointer. + return va.IsNil() || va.Interface().(isZeroer).IsZero() + } + case sf.Type.Implements(isZeroerType): + f.isZero = func(va addressableValue) bool { return va.Interface().(isZeroer).IsZero() } + case reflect.PointerTo(sf.Type).Implements(isZeroerType): + f.isZero = func(va addressableValue) bool { return va.Addr().Interface().(isZeroer).IsZero() } + } + + // Provide a function that can determine whether the value would + // serialize as an empty JSON value. + switch sf.Type.Kind() { + case reflect.String, reflect.Map, reflect.Array, reflect.Slice: + f.isEmpty = func(va addressableValue) bool { return va.Len() == 0 } + case reflect.Pointer, reflect.Interface: + f.isEmpty = func(va addressableValue) bool { return va.IsNil() } + } + + // Reject multiple fields with same name within the same struct. + if j, ok := namesIndex[f.name]; ok { + serr = orErrorf(serr, t, "Go struct fields %s and %s conflict over JSON object name %q", t.Field(j).Name, sf.Name, f.name) + // Still append f to allFields as there is still a + // check for a dominant field before returning. + } + namesIndex[f.name] = i + + f.id = len(allFields) + f.fncs = lookupArshaler(sf.Type) + allFields = append(allFields, f) + } + } + + // NOTE: New users to the json package are occasionally surprised that + // unexported fields are ignored. This occurs by necessity due to our + // inability to directly introspect such fields with Go reflection + // without the use of unsafe. + // + // To reduce friction here, refuse to serialize any Go struct that + // has no JSON serializable fields, has at least one Go struct field, + // and does not have any `json` tags present. For example, + // errors returned by errors.New would fail to serialize. + isEmptyStruct := t.NumField() == 0 + if !isEmptyStruct && !hasAnyJSONTag && !hasAnyJSONField { + serr = cmp.Or(serr, &SemanticError{GoType: t, Err: errNoExportedFields}) + } + } + + // Sort the fields by exact name (breaking ties by depth and + // then by presence of an explicitly provided JSON name). + // Select the dominant field from each set of fields with the same name. + // If multiple fields have the same name, then the dominant field + // is the one that exists alone at the shallowest depth, + // or the one that is uniquely tagged with a JSON name. + // Otherwise, no dominant field exists for the set. + flattened := allFields[:0] + slices.SortStableFunc(allFields, func(x, y structField) int { + return cmp.Or( + strings.Compare(x.name, y.name), + cmp.Compare(len(x.index), len(y.index)), + boolsCompare(!x.hasName, !y.hasName)) + }) + for len(allFields) > 0 { + n := 1 // number of fields with the same exact name + for n < len(allFields) && allFields[n-1].name == allFields[n].name { + n++ + } + if n == 1 || len(allFields[0].index) != len(allFields[1].index) || allFields[0].hasName != allFields[1].hasName { + flattened = append(flattened, allFields[0]) // only keep field if there is a dominant field + } + allFields = allFields[n:] + } + + // Sort the fields according to a breadth-first ordering + // so that we can re-number IDs with the smallest possible values. + // This optimizes use of uintSet such that it fits in the 64-entry bit set. + slices.SortFunc(flattened, func(x, y structField) int { + return cmp.Compare(x.id, y.id) + }) + for i := range flattened { + flattened[i].id = i + } + + // Sort the fields according to a depth-first ordering + // as the typical order that fields are marshaled. + slices.SortFunc(flattened, func(x, y structField) int { + return slices.Compare(x.index, y.index) + }) + + // Compute the mapping of fields in the byActualName map. + // Pre-fold all names so that we can lookup folded names quickly. + fs = structFields{ + flattened: flattened, + byActualName: make(map[string]*structField, len(flattened)), + byFoldedName: make(map[string][]*structField, len(flattened)), + } + for i, f := range fs.flattened { + foldedName := string(foldName([]byte(f.name))) + fs.byActualName[f.name] = &fs.flattened[i] + fs.byFoldedName[foldedName] = append(fs.byFoldedName[foldedName], &fs.flattened[i]) + } + for foldedName, fields := range fs.byFoldedName { + if len(fields) > 1 { + // The precedence order for conflicting ignoreCase names + // is by breadth-first order, rather than depth-first order. + slices.SortFunc(fields, func(x, y *structField) int { + return cmp.Compare(x.id, y.id) + }) + fs.byFoldedName[foldedName] = fields + } + } + if n := len(inlinedFallbacks); n == 1 || (n > 1 && len(inlinedFallbacks[0].index) != len(inlinedFallbacks[1].index)) { + fs.inlinedFallback = &inlinedFallbacks[0] // dominant inlined fallback field + } + fs.reindex() + return fs, serr +} + +// indirectType unwraps one level of pointer indirection +// similar to how Go only allows embedding either T or *T, +// but not **T or P (which is a named pointer). +func indirectType(t reflect.Type) reflect.Type { + if t.Kind() == reflect.Pointer && t.Name() == "" { + t = t.Elem() + } + return t +} + +// matchFoldedName matches a case-insensitive name depending on the options. +// It assumes that foldName(f.name) == foldName(name). +// +// Case-insensitive matching is used if the `case:ignore` tag option is specified +// or the MatchCaseInsensitiveNames call option is specified +// (and the `case:strict` tag option is not specified). +// Functionally, the `case:ignore` and `case:strict` tag options take precedence. +// +// The v1 definition of case-insensitivity operated under strings.EqualFold +// and would strictly compare dashes and underscores, +// while the v2 definition would ignore the presence of dashes and underscores. +// Thus, if the MatchCaseSensitiveDelimiter call option is specified, +// the match is further restricted to using strings.EqualFold. +func (f *structField) matchFoldedName(name []byte, flags *jsonflags.Flags) bool { + if f.casing == caseIgnore || (flags.Get(jsonflags.MatchCaseInsensitiveNames) && f.casing != caseStrict) { + if !flags.Get(jsonflags.MatchCaseSensitiveDelimiter) || strings.EqualFold(string(name), f.name) { + return true + } + } + return false +} + +const ( + caseIgnore = 1 + caseStrict = 2 +) + +type fieldOptions struct { + name string + quotedName string // quoted name per RFC 8785, section 3.2.2.2. + hasName bool + nameNeedEscape bool + casing int8 // either 0, caseIgnore, or caseStrict + inline bool + unknown bool + omitzero bool + omitempty bool + string bool + format string +} + +// parseFieldOptions parses the `json` tag in a Go struct field as +// a structured set of options configuring parameters such as +// the JSON member name and other features. +func parseFieldOptions(sf reflect.StructField) (out fieldOptions, ignored bool, err error) { + tag, hasTag := sf.Tag.Lookup("json") + tagOrig := tag + + // Check whether this field is explicitly ignored. + if tag == "-" { + return fieldOptions{}, true, nil + } + + // Check whether this field is unexported and not embedded, + // which Go reflection cannot mutate for the sake of serialization. + // + // An embedded field of an unexported type is still capable of + // forwarding exported fields, which may be JSON serialized. + // This technically operates on the edge of what is permissible by + // the Go language, but the most recent decision is to permit this. + // + // See https://go.dev/issue/24153 and https://go.dev/issue/32772. + if !sf.IsExported() && !sf.Anonymous { + // Tag options specified on an unexported field suggests user error. + if hasTag { + err = cmp.Or(err, fmt.Errorf("unexported Go struct field %s cannot have non-ignored `json:%q` tag", sf.Name, tag)) + } + return fieldOptions{}, true, err + } + + // Determine the JSON member name for this Go field. A user-specified name + // may be provided as either an identifier or a single-quoted string. + // The single-quoted string allows arbitrary characters in the name. + // See https://go.dev/issue/2718 and https://go.dev/issue/3546. + out.name = sf.Name // always starts with an uppercase character + if len(tag) > 0 && !strings.HasPrefix(tag, ",") { + // For better compatibility with v1, accept almost any unescaped name. + n := len(tag) - len(strings.TrimLeftFunc(tag, func(r rune) bool { + return !strings.ContainsRune(",\\'\"`", r) // reserve comma, backslash, and quotes + })) + name := tag[:n] + + // If the next character is not a comma, then the name is either + // malformed (if n > 0) or a single-quoted name. + // In either case, call consumeTagOption to handle it further. + var err2 error + if !strings.HasPrefix(tag[n:], ",") && len(name) != len(tag) { + name, n, err2 = consumeTagOption(tag) + if err2 != nil { + err = cmp.Or(err, fmt.Errorf("Go struct field %s has malformed `json` tag: %v", sf.Name, err2)) + } + } + if !utf8.ValidString(name) { + err = cmp.Or(err, fmt.Errorf("Go struct field %s has JSON object name %q with invalid UTF-8", sf.Name, name)) + name = string([]rune(name)) // replace invalid UTF-8 with utf8.RuneError + } + if name == "-" && tag[0] == '-' { + defer func() { // defer to let other errors take precedence + err = cmp.Or(err, fmt.Errorf("Go struct field %s has JSON object name %q; either "+ + "use `json:\"-\"` to ignore the field or "+ + "use `json:\"'-'%s` to specify %q as the name", sf.Name, out.name, strings.TrimPrefix(strconv.Quote(tagOrig), `"-`), name)) + }() + } + if err2 == nil { + out.hasName = true + out.name = name + } + tag = tag[n:] + } + b, _ := jsonwire.AppendQuote(nil, out.name, &jsonflags.Flags{}) + out.quotedName = string(b) + out.nameNeedEscape = jsonwire.NeedEscape(out.name) + + // Handle any additional tag options (if any). + var wasFormat bool + seenOpts := make(map[string]bool) + for len(tag) > 0 { + // Consume comma delimiter. + if tag[0] != ',' { + err = cmp.Or(err, fmt.Errorf("Go struct field %s has malformed `json` tag: invalid character %q before next option (expecting ',')", sf.Name, tag[0])) + } else { + tag = tag[len(","):] + if len(tag) == 0 { + err = cmp.Or(err, fmt.Errorf("Go struct field %s has malformed `json` tag: invalid trailing ',' character", sf.Name)) + break + } + } + + // Consume and process the tag option. + opt, n, err2 := consumeTagOption(tag) + if err2 != nil { + err = cmp.Or(err, fmt.Errorf("Go struct field %s has malformed `json` tag: %v", sf.Name, err2)) + } + rawOpt := tag[:n] + tag = tag[n:] + switch { + case wasFormat: + err = cmp.Or(err, fmt.Errorf("Go struct field %s has `format` tag option that was not specified last", sf.Name)) + case strings.HasPrefix(rawOpt, "'") && strings.TrimFunc(opt, isLetterOrDigit) == "": + err = cmp.Or(err, fmt.Errorf("Go struct field %s has unnecessarily quoted appearance of `%s` tag option; specify `%s` instead", sf.Name, rawOpt, opt)) + } + switch opt { + case "case": + if !strings.HasPrefix(tag, ":") { + err = cmp.Or(err, fmt.Errorf("Go struct field %s is missing value for `case` tag option; specify `case:ignore` or `case:strict` instead", sf.Name)) + break + } + tag = tag[len(":"):] + opt, n, err2 := consumeTagOption(tag) + if err2 != nil { + err = cmp.Or(err, fmt.Errorf("Go struct field %s has malformed value for `case` tag option: %v", sf.Name, err2)) + break + } + rawOpt := tag[:n] + tag = tag[n:] + if strings.HasPrefix(rawOpt, "'") { + err = cmp.Or(err, fmt.Errorf("Go struct field %s has unnecessarily quoted appearance of `case:%s` tag option; specify `case:%s` instead", sf.Name, rawOpt, opt)) + } + switch opt { + case "ignore": + out.casing |= caseIgnore + case "strict": + out.casing |= caseStrict + default: + err = cmp.Or(err, fmt.Errorf("Go struct field %s has unknown `case:%s` tag value", sf.Name, rawOpt)) + } + case "inline": + out.inline = true + case "unknown": + out.unknown = true + case "omitzero": + out.omitzero = true + case "omitempty": + out.omitempty = true + case "string": + out.string = true + case "format": + if !strings.HasPrefix(tag, ":") { + err = cmp.Or(err, fmt.Errorf("Go struct field %s is missing value for `format` tag option", sf.Name)) + break + } + tag = tag[len(":"):] + opt, n, err2 := consumeTagOption(tag) + if err2 != nil { + err = cmp.Or(err, fmt.Errorf("Go struct field %s has malformed value for `format` tag option: %v", sf.Name, err2)) + break + } + tag = tag[n:] + out.format = opt + wasFormat = true + default: + // Reject keys that resemble one of the supported options. + // This catches invalid mutants such as "omitEmpty" or "omit_empty". + normOpt := strings.ReplaceAll(strings.ToLower(opt), "_", "") + switch normOpt { + case "case", "inline", "unknown", "omitzero", "omitempty", "string", "format": + err = cmp.Or(err, fmt.Errorf("Go struct field %s has invalid appearance of `%s` tag option; specify `%s` instead", sf.Name, opt, normOpt)) + } + + // NOTE: Everything else is ignored. This does not mean it is + // forward compatible to insert arbitrary tag options since + // a future version of this package may understand that tag. + } + + // Reject duplicates. + switch { + case out.casing == caseIgnore|caseStrict: + err = cmp.Or(err, fmt.Errorf("Go struct field %s cannot have both `case:ignore` and `case:strict` tag options", sf.Name)) + case seenOpts[opt]: + err = cmp.Or(err, fmt.Errorf("Go struct field %s has duplicate appearance of `%s` tag option", sf.Name, rawOpt)) + } + seenOpts[opt] = true + } + return out, false, err +} + +// consumeTagOption consumes the next option, +// which is either a Go identifier or a single-quoted string. +// If the next option is invalid, it returns all of in until the next comma, +// and reports an error. +func consumeTagOption(in string) (string, int, error) { + // For legacy compatibility with v1, assume options are comma-separated. + i := strings.IndexByte(in, ',') + if i < 0 { + i = len(in) + } + + switch r, _ := utf8.DecodeRuneInString(in); { + // Option as a Go identifier. + case r == '_' || unicode.IsLetter(r): + n := len(in) - len(strings.TrimLeftFunc(in, isLetterOrDigit)) + return in[:n], n, nil + // Option as a single-quoted string. + case r == '\'': + // The grammar is nearly identical to a double-quoted Go string literal, + // but uses single quotes as the terminators. The reason for a custom + // grammar is because both backtick and double quotes cannot be used + // verbatim in a struct tag. + // + // Convert a single-quoted string to a double-quote string and rely on + // strconv.Unquote to handle the rest. + var inEscape bool + b := []byte{'"'} + n := len(`'`) + for len(in) > n { + r, rn := utf8.DecodeRuneInString(in[n:]) + switch { + case inEscape: + if r == '\'' { + b = b[:len(b)-1] // remove escape character: `\'` => `'` + } + inEscape = false + case r == '\\': + inEscape = true + case r == '"': + b = append(b, '\\') // insert escape character: `"` => `\"` + case r == '\'': + b = append(b, '"') + n += len(`'`) + out, err := strconv.Unquote(string(b)) + if err != nil { + return in[:i], i, fmt.Errorf("invalid single-quoted string: %s", in[:n]) + } + return out, n, nil + } + b = append(b, in[n:][:rn]...) + n += rn + } + if n > 10 { + n = 10 // limit the amount of context printed in the error + } + return in[:i], i, fmt.Errorf("single-quoted string not terminated: %s...", in[:n]) + case len(in) == 0: + return in[:i], i, io.ErrUnexpectedEOF + default: + return in[:i], i, fmt.Errorf("invalid character %q at start of option (expecting Unicode letter or single quote)", r) + } +} + +func isLetterOrDigit(r rune) bool { + return r == '_' || unicode.IsLetter(r) || unicode.IsNumber(r) +} + +// boolsCompare compares x and y, ordering false before true. +func boolsCompare(x, y bool) int { + switch { + case !x && y: + return -1 + default: + return 0 + case x && !y: + return +1 + } +} diff --git a/go/src/encoding/json/v2/fields_test.go b/go/src/encoding/json/v2/fields_test.go new file mode 100644 index 0000000000000000000000000000000000000000..ae58182f298ab4d05b7758a3533d7bfbb4d74033 --- /dev/null +++ b/go/src/encoding/json/v2/fields_test.go @@ -0,0 +1,834 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json + +import ( + "encoding" + "errors" + "reflect" + "testing" + + "encoding/json/internal/jsontest" + "encoding/json/jsontext" +) + +type unexported struct{} + +func TestMakeStructFields(t *testing.T) { + type Embed struct { + Foo string + } + type Recursive struct { + A string + *Recursive `json:",inline"` + B string + } + type MapStringAny map[string]any + tests := []struct { + name jsontest.CaseName + in any + want structFields + wantErr error + }{{ + name: jsontest.Name("Names"), + in: struct { + F1 string + F2 string `json:"-"` + F3 string `json:"json_name"` + f3 string + F5 string `json:"json_name_nocase,case:ignore"` + }{}, + want: structFields{ + flattened: []structField{ + {id: 0, index: []int{0}, typ: stringType, fieldOptions: fieldOptions{name: "F1", quotedName: `"F1"`}}, + {id: 1, index: []int{2}, typ: stringType, fieldOptions: fieldOptions{name: "json_name", quotedName: `"json_name"`, hasName: true}}, + {id: 2, index: []int{4}, typ: stringType, fieldOptions: fieldOptions{name: "json_name_nocase", quotedName: `"json_name_nocase"`, hasName: true, casing: caseIgnore}}, + }, + }, + }, { + name: jsontest.Name("BreadthFirstSearch"), + in: struct { + L1A string + L1B struct { + L2A string + L2B struct { + L3A string + } `json:",inline"` + L2C string + } `json:",inline"` + L1C string + L1D struct { + L2D string + L2E struct { + L3B string + } `json:",inline"` + L2F string + } `json:",inline"` + L1E string + }{}, + want: structFields{ + flattened: []structField{ + {id: 0, index: []int{0}, typ: stringType, fieldOptions: fieldOptions{name: "L1A", quotedName: `"L1A"`}}, + {id: 3, index: []int{1, 0}, typ: stringType, fieldOptions: fieldOptions{name: "L2A", quotedName: `"L2A"`}}, + {id: 7, index: []int{1, 1, 0}, typ: stringType, fieldOptions: fieldOptions{name: "L3A", quotedName: `"L3A"`}}, + {id: 4, index: []int{1, 2}, typ: stringType, fieldOptions: fieldOptions{name: "L2C", quotedName: `"L2C"`}}, + {id: 1, index: []int{2}, typ: stringType, fieldOptions: fieldOptions{name: "L1C", quotedName: `"L1C"`}}, + {id: 5, index: []int{3, 0}, typ: stringType, fieldOptions: fieldOptions{name: "L2D", quotedName: `"L2D"`}}, + {id: 8, index: []int{3, 1, 0}, typ: stringType, fieldOptions: fieldOptions{name: "L3B", quotedName: `"L3B"`}}, + {id: 6, index: []int{3, 2}, typ: stringType, fieldOptions: fieldOptions{name: "L2F", quotedName: `"L2F"`}}, + {id: 2, index: []int{4}, typ: stringType, fieldOptions: fieldOptions{name: "L1E", quotedName: `"L1E"`}}, + }, + }, + }, { + name: jsontest.Name("NameResolution"), + in: struct { + X1 struct { + X struct { + A string // loses in precedence to A + B string // cancels out with X2.X.B + D string // loses in precedence to D + } `json:",inline"` + } `json:",inline"` + X2 struct { + X struct { + B string // cancels out with X1.X.B + C string + D string // loses in precedence to D + } `json:",inline"` + } `json:",inline"` + A string // takes precedence over X1.X.A + D string // takes precedence over X1.X.D and X2.X.D + }{}, + want: structFields{ + flattened: []structField{ + {id: 2, index: []int{1, 0, 1}, typ: stringType, fieldOptions: fieldOptions{name: "C", quotedName: `"C"`}}, + {id: 0, index: []int{2}, typ: stringType, fieldOptions: fieldOptions{name: "A", quotedName: `"A"`}}, + {id: 1, index: []int{3}, typ: stringType, fieldOptions: fieldOptions{name: "D", quotedName: `"D"`}}, + }, + }, + }, { + name: jsontest.Name("NameResolution/ExplicitNameUniquePrecedence"), + in: struct { + X1 struct { + A string // loses in precedence to X2.A + } `json:",inline"` + X2 struct { + A string `json:"A"` + } `json:",inline"` + X3 struct { + A string // loses in precedence to X2.A + } `json:",inline"` + }{}, + want: structFields{ + flattened: []structField{ + {id: 0, index: []int{1, 0}, typ: stringType, fieldOptions: fieldOptions{hasName: true, name: "A", quotedName: `"A"`}}, + }, + }, + }, { + name: jsontest.Name("NameResolution/ExplicitNameCancelsOut"), + in: struct { + X1 struct { + A string // loses in precedence to X2.A or X3.A + } `json:",inline"` + X2 struct { + A string `json:"A"` // cancels out with X3.A + } `json:",inline"` + X3 struct { + A string `json:"A"` // cancels out with X2.A + } `json:",inline"` + }{}, + want: structFields{flattened: []structField{}}, + }, { + name: jsontest.Name("Embed/Implicit"), + in: struct { + Embed + }{}, + want: structFields{ + flattened: []structField{ + {id: 0, index: []int{0, 0}, typ: stringType, fieldOptions: fieldOptions{name: "Foo", quotedName: `"Foo"`}}, + }, + }, + }, { + name: jsontest.Name("Embed/Explicit"), + in: struct { + Embed `json:",inline"` + }{}, + want: structFields{ + flattened: []structField{ + {id: 0, index: []int{0, 0}, typ: stringType, fieldOptions: fieldOptions{name: "Foo", quotedName: `"Foo"`}}, + }, + }, + }, { + name: jsontest.Name("Recursive"), + in: struct { + A string + Recursive `json:",inline"` + C string + }{}, + want: structFields{ + flattened: []structField{ + {id: 0, index: []int{0}, typ: stringType, fieldOptions: fieldOptions{name: "A", quotedName: `"A"`}}, + {id: 2, index: []int{1, 2}, typ: stringType, fieldOptions: fieldOptions{name: "B", quotedName: `"B"`}}, + {id: 1, index: []int{2}, typ: stringType, fieldOptions: fieldOptions{name: "C", quotedName: `"C"`}}, + }, + }, + }, { + name: jsontest.Name("InlinedFallback/Cancelation"), + in: struct { + X1 struct { + X jsontext.Value `json:",inline"` + } `json:",inline"` + X2 struct { + X map[string]any `json:",unknown"` + } `json:",inline"` + }{}, + want: structFields{}, + }, { + name: jsontest.Name("InlinedFallback/Precedence"), + in: struct { + X1 struct { + X jsontext.Value `json:",inline"` + } `json:",inline"` + X2 struct { + X map[string]any `json:",unknown"` + } `json:",inline"` + X map[string]jsontext.Value `json:",unknown"` + }{}, + want: structFields{ + inlinedFallback: &structField{id: 0, index: []int{2}, typ: T[map[string]jsontext.Value](), fieldOptions: fieldOptions{name: "X", quotedName: `"X"`, unknown: true}}, + }, + }, { + name: jsontest.Name("InlinedFallback/InvalidImplicit"), + in: struct { + MapStringAny + }{}, + want: structFields{ + flattened: []structField{ + {id: 0, index: []int{0}, typ: reflect.TypeOf(MapStringAny(nil)), fieldOptions: fieldOptions{name: "MapStringAny", quotedName: `"MapStringAny"`}}, + }, + }, + wantErr: errors.New("embedded Go struct field MapStringAny of non-struct type must be explicitly given a JSON name"), + }, { + name: jsontest.Name("InvalidUTF8"), + in: struct { + Name string `json:"'\\xde\\xad\\xbe\\xef'"` + }{}, + want: structFields{ + flattened: []structField{ + {id: 0, index: []int{0}, typ: stringType, fieldOptions: fieldOptions{hasName: true, name: "\u07ad\ufffd\ufffd", quotedName: "\"\u07ad\ufffd\ufffd\"", nameNeedEscape: true}}, + }, + }, + wantErr: errors.New(`Go struct field Name has JSON object name "ޭ\xbe\xef" with invalid UTF-8`), + }, { + name: jsontest.Name("DuplicateName"), + in: struct { + A string `json:"same"` + B string `json:"same"` + }{}, + want: structFields{flattened: []structField{}}, + wantErr: errors.New(`Go struct fields A and B conflict over JSON object name "same"`), + }, { + name: jsontest.Name("BothInlineAndUnknown"), + in: struct { + A struct{} `json:",inline,unknown"` + }{}, + wantErr: errors.New("Go struct field A cannot have both `inline` and `unknown` specified"), + }, { + name: jsontest.Name("InlineWithOptions"), + in: struct { + A struct{} `json:",inline,omitempty"` + }{}, + wantErr: errors.New("Go struct field A cannot have any options other than `inline` or `unknown` specified"), + }, { + name: jsontest.Name("UnknownWithOptions"), + in: struct { + A map[string]any `json:",inline,omitempty"` + }{}, + want: structFields{inlinedFallback: &structField{ + index: []int{0}, + typ: reflect.TypeFor[map[string]any](), + fieldOptions: fieldOptions{ + name: "A", + quotedName: `"A"`, + inline: true, + }, + }}, + wantErr: errors.New("Go struct field A cannot have any options other than `inline` or `unknown` specified"), + }, { + name: jsontest.Name("InlineTextMarshaler"), + in: struct { + A struct{ encoding.TextMarshaler } `json:",inline"` + }{}, + want: structFields{flattened: []structField{{ + index: []int{0, 0}, + typ: reflect.TypeFor[encoding.TextMarshaler](), + fieldOptions: fieldOptions{ + name: "TextMarshaler", + quotedName: `"TextMarshaler"`, + }, + }}}, + wantErr: errors.New(`inlined Go struct field A of type struct { encoding.TextMarshaler } must not implement marshal or unmarshal methods`), + }, { + name: jsontest.Name("InlineTextAppender"), + in: struct { + A struct{ encoding.TextAppender } `json:",inline"` + }{}, + want: structFields{flattened: []structField{{ + index: []int{0, 0}, + typ: reflect.TypeFor[encoding.TextAppender](), + fieldOptions: fieldOptions{ + name: "TextAppender", + quotedName: `"TextAppender"`, + }, + }}}, + wantErr: errors.New(`inlined Go struct field A of type struct { encoding.TextAppender } must not implement marshal or unmarshal methods`), + }, { + name: jsontest.Name("UnknownJSONMarshaler"), + in: struct { + A struct{ Marshaler } `json:",unknown"` + }{}, + wantErr: errors.New(`inlined Go struct field A of type struct { json.Marshaler } must not implement marshal or unmarshal methods`), + }, { + name: jsontest.Name("InlineJSONMarshalerTo"), + in: struct { + A struct{ MarshalerTo } `json:",inline"` + }{}, + want: structFields{flattened: []structField{{ + index: []int{0, 0}, + typ: reflect.TypeFor[MarshalerTo](), + fieldOptions: fieldOptions{ + name: "MarshalerTo", + quotedName: `"MarshalerTo"`, + }, + }}}, + wantErr: errors.New(`inlined Go struct field A of type struct { json.MarshalerTo } must not implement marshal or unmarshal methods`), + }, { + name: jsontest.Name("UnknownTextUnmarshaler"), + in: struct { + A *struct{ encoding.TextUnmarshaler } `json:",unknown"` + }{}, + wantErr: errors.New(`inlined Go struct field A of type struct { encoding.TextUnmarshaler } must not implement marshal or unmarshal methods`), + }, { + name: jsontest.Name("InlineJSONUnmarshaler"), + in: struct { + A *struct{ Unmarshaler } `json:",inline"` + }{}, + want: structFields{flattened: []structField{{ + index: []int{0, 0}, + typ: reflect.TypeFor[Unmarshaler](), + fieldOptions: fieldOptions{ + name: "Unmarshaler", + quotedName: `"Unmarshaler"`, + }, + }}}, + wantErr: errors.New(`inlined Go struct field A of type struct { json.Unmarshaler } must not implement marshal or unmarshal methods`), + }, { + name: jsontest.Name("UnknownJSONUnmarshalerFrom"), + in: struct { + A struct{ UnmarshalerFrom } `json:",unknown"` + }{}, + wantErr: errors.New(`inlined Go struct field A of type struct { json.UnmarshalerFrom } must not implement marshal or unmarshal methods`), + }, { + name: jsontest.Name("UnknownStruct"), + in: struct { + A struct { + X, Y, Z string + } `json:",unknown"` + }{}, + wantErr: errors.New("inlined Go struct field A of type struct { X string; Y string; Z string } with `unknown` tag must be a Go map of string key or a jsontext.Value"), + }, { + name: jsontest.Name("InlineUnsupported/MapIntKey"), + in: struct { + A map[int]any `json:",unknown"` + }{}, + wantErr: errors.New(`inlined Go struct field A of type map[int]interface {} must be a Go struct, Go map of string key, or jsontext.Value`), + }, { + name: jsontest.Name("InlineUnsupported/MapTextMarshalerStringKey"), + in: struct { + A map[nocaseString]any `json:",inline"` + }{}, + wantErr: errors.New(`inlined map field A of type map[json.nocaseString]interface {} must have a string key that does not implement marshal or unmarshal methods`), + }, { + name: jsontest.Name("InlineUnsupported/MapMarshalerStringKey"), + in: struct { + A map[stringMarshalEmpty]any `json:",inline"` + }{}, + wantErr: errors.New(`inlined map field A of type map[json.stringMarshalEmpty]interface {} must have a string key that does not implement marshal or unmarshal methods`), + }, { + name: jsontest.Name("InlineUnsupported/DoublePointer"), + in: struct { + A **struct{} `json:",inline"` + }{}, + wantErr: errors.New(`inlined Go struct field A of type *struct {} must be a Go struct, Go map of string key, or jsontext.Value`), + }, { + name: jsontest.Name("DuplicateInline"), + in: struct { + A map[string]any `json:",inline"` + B jsontext.Value `json:",inline"` + }{}, + wantErr: errors.New(`inlined Go struct fields A and B cannot both be a Go map or jsontext.Value`), + }, { + name: jsontest.Name("DuplicateEmbedInline"), + in: struct { + A MapStringAny `json:",inline"` + B jsontext.Value `json:",inline"` + }{}, + wantErr: errors.New(`inlined Go struct fields A and B cannot both be a Go map or jsontext.Value`), + }} + + for _, tt := range tests { + t.Run(tt.name.Name, func(t *testing.T) { + got, err := makeStructFields(reflect.TypeOf(tt.in)) + + // Sanity check that pointers are consistent. + pointers := make(map[*structField]bool) + for i := range got.flattened { + pointers[&got.flattened[i]] = true + } + for _, f := range got.byActualName { + if !pointers[f] { + t.Errorf("%s: byActualName pointer not in flattened", tt.name.Where) + } + } + for _, fs := range got.byFoldedName { + for _, f := range fs { + if !pointers[f] { + t.Errorf("%s: byFoldedName pointer not in flattened", tt.name.Where) + } + } + } + + // Zero out fields that are incomparable. + for i := range got.flattened { + got.flattened[i].fncs = nil + got.flattened[i].isEmpty = nil + } + if got.inlinedFallback != nil { + got.inlinedFallback.fncs = nil + got.inlinedFallback.isEmpty = nil + } + + // Reproduce maps in want. + tt.want.byActualName = make(map[string]*structField) + for i := range tt.want.flattened { + f := &tt.want.flattened[i] + tt.want.byActualName[f.name] = f + } + tt.want.byFoldedName = make(map[string][]*structField) + for i, f := range tt.want.flattened { + foldedName := string(foldName([]byte(f.name))) + tt.want.byFoldedName[foldedName] = append(tt.want.byFoldedName[foldedName], &tt.want.flattened[i]) + } + + // Only compare underlying error to simplify test logic. + var gotErr error + if err != nil { + gotErr = err.Err + } + + tt.want.reindex() + if !reflect.DeepEqual(got, tt.want) || !reflect.DeepEqual(gotErr, tt.wantErr) { + t.Errorf("%s: makeStructFields(%T):\n\tgot (%v, %v)\n\twant (%v, %v)", tt.name.Where, tt.in, got, gotErr, tt.want, tt.wantErr) + } + }) + } +} + +func TestParseTagOptions(t *testing.T) { + tests := []struct { + name jsontest.CaseName + in any // must be a struct with a single field + wantOpts fieldOptions + wantIgnored bool + wantErr error + }{{ + name: jsontest.Name("GoName"), + in: struct { + FieldName int + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`}, + }, { + name: jsontest.Name("GoNameWithOptions"), + in: struct { + FieldName int `json:",inline"` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`, inline: true}, + }, { + name: jsontest.Name("Empty"), + in: struct { + V int `json:""` + }{}, + wantOpts: fieldOptions{name: "V", quotedName: `"V"`}, + }, { + name: jsontest.Name("Unexported"), + in: struct { + v int `json:"Hello"` + }{}, + wantIgnored: true, + wantErr: errors.New("unexported Go struct field v cannot have non-ignored `json:\"Hello\"` tag"), + }, { + name: jsontest.Name("UnexportedEmpty"), + in: struct { + v int `json:""` + }{}, + wantIgnored: true, + wantErr: errors.New("unexported Go struct field v cannot have non-ignored `json:\"\"` tag"), + }, { + name: jsontest.Name("EmbedUnexported"), + in: struct { + unexported + }{}, + wantOpts: fieldOptions{name: "unexported", quotedName: `"unexported"`}, + }, { + name: jsontest.Name("Ignored"), + in: struct { + V int `json:"-"` + }{}, + wantIgnored: true, + }, { + name: jsontest.Name("IgnoredEmbedUnexported"), + in: struct { + unexported `json:"-"` + }{}, + wantIgnored: true, + }, { + name: jsontest.Name("DashComma"), + in: struct { + V int `json:"-,"` + }{}, + wantOpts: fieldOptions{hasName: true, name: "-", quotedName: `"-"`}, + wantErr: errors.New("Go struct field V has malformed `json` tag: invalid trailing ',' character"), + }, { + name: jsontest.Name("DashCommaOmitEmpty"), + in: struct { + V int `json:"-,omitempty"` + }{}, + wantOpts: fieldOptions{hasName: true, name: "-", quotedName: `"-"`, omitempty: true}, + wantErr: errors.New("Go struct field V has JSON object name \"-\"; either use `json:\"-\"` to ignore the field or use `json:\"'-',omitempty\"` to specify \"-\" as the name"), + }, { + name: jsontest.Name("QuotedDashCommaOmitEmpty"), + in: struct { + V int `json:"'-',omitempty"` + }{}, + wantOpts: fieldOptions{hasName: true, name: "-", quotedName: `"-"`, omitempty: true}, + }, { + name: jsontest.Name("QuotedDashName"), + in: struct { + V int `json:"'-'"` + }{}, + wantOpts: fieldOptions{hasName: true, name: "-", quotedName: `"-"`}, + }, { + name: jsontest.Name("LatinPunctuationName"), + in: struct { + V int `json:"$%-/"` + }{}, + wantOpts: fieldOptions{hasName: true, name: "$%-/", quotedName: `"$%-/"`}, + }, { + name: jsontest.Name("QuotedLatinPunctuationName"), + in: struct { + V int `json:"'$%-/'"` + }{}, + wantOpts: fieldOptions{hasName: true, name: "$%-/", quotedName: `"$%-/"`}, + }, { + name: jsontest.Name("LatinDigitsName"), + in: struct { + V int `json:"0123456789"` + }{}, + wantOpts: fieldOptions{hasName: true, name: "0123456789", quotedName: `"0123456789"`}, + }, { + name: jsontest.Name("QuotedLatinDigitsName"), + in: struct { + V int `json:"'0123456789'"` + }{}, + wantOpts: fieldOptions{hasName: true, name: "0123456789", quotedName: `"0123456789"`}, + }, { + name: jsontest.Name("LatinUppercaseName"), + in: struct { + V int `json:"ABCDEFGHIJKLMOPQRSTUVWXYZ"` + }{}, + wantOpts: fieldOptions{hasName: true, name: "ABCDEFGHIJKLMOPQRSTUVWXYZ", quotedName: `"ABCDEFGHIJKLMOPQRSTUVWXYZ"`}, + }, { + name: jsontest.Name("LatinLowercaseName"), + in: struct { + V int `json:"abcdefghijklmnopqrstuvwxyz_"` + }{}, + wantOpts: fieldOptions{hasName: true, name: "abcdefghijklmnopqrstuvwxyz_", quotedName: `"abcdefghijklmnopqrstuvwxyz_"`}, + }, { + name: jsontest.Name("GreekName"), + in: struct { + V string `json:"Ελλάδα"` + }{}, + wantOpts: fieldOptions{hasName: true, name: "Ελλάδα", quotedName: `"Ελλάδα"`}, + }, { + name: jsontest.Name("QuotedGreekName"), + in: struct { + V string `json:"'Ελλάδα'"` + }{}, + wantOpts: fieldOptions{hasName: true, name: "Ελλάδα", quotedName: `"Ελλάδα"`}, + }, { + name: jsontest.Name("ChineseName"), + in: struct { + V string `json:"世界"` + }{}, + wantOpts: fieldOptions{hasName: true, name: "世界", quotedName: `"世界"`}, + }, { + name: jsontest.Name("QuotedChineseName"), + in: struct { + V string `json:"'世界'"` + }{}, + wantOpts: fieldOptions{hasName: true, name: "世界", quotedName: `"世界"`}, + }, { + name: jsontest.Name("PercentSlashName"), + in: struct { + V int `json:"text/html%"` + }{}, + wantOpts: fieldOptions{hasName: true, name: "text/html%", quotedName: `"text/html%"`}, + }, { + name: jsontest.Name("QuotedPercentSlashName"), + in: struct { + V int `json:"'text/html%'"` + }{}, + wantOpts: fieldOptions{hasName: true, name: "text/html%", quotedName: `"text/html%"`}, + }, { + name: jsontest.Name("PunctuationName"), + in: struct { + V string `json:"!#$%&()*+-./:;<=>?@[]^_{|}~ "` + }{}, + wantOpts: fieldOptions{hasName: true, name: "!#$%&()*+-./:;<=>?@[]^_{|}~ ", quotedName: `"!#$%&()*+-./:;<=>?@[]^_{|}~ "`, nameNeedEscape: true}, + }, { + name: jsontest.Name("QuotedPunctuationName"), + in: struct { + V string `json:"'!#$%&()*+-./:;<=>?@[]^_{|}~ '"` + }{}, + wantOpts: fieldOptions{hasName: true, name: "!#$%&()*+-./:;<=>?@[]^_{|}~ ", quotedName: `"!#$%&()*+-./:;<=>?@[]^_{|}~ "`, nameNeedEscape: true}, + }, { + name: jsontest.Name("EmptyName"), + in: struct { + V int `json:"''"` + }{}, + wantOpts: fieldOptions{hasName: true, name: "", quotedName: `""`}, + }, { + name: jsontest.Name("SpaceName"), + in: struct { + V int `json:"' '"` + }{}, + wantOpts: fieldOptions{hasName: true, name: " ", quotedName: `" "`}, + }, { + name: jsontest.Name("CommaQuotes"), + in: struct { + V int `json:"',\\'\"\\\"'"` + }{}, + wantOpts: fieldOptions{hasName: true, name: `,'""`, quotedName: `",'\"\""`, nameNeedEscape: true}, + }, { + name: jsontest.Name("SingleComma"), + in: struct { + V int `json:","` + }{}, + wantOpts: fieldOptions{name: "V", quotedName: `"V"`}, + wantErr: errors.New("Go struct field V has malformed `json` tag: invalid trailing ',' character"), + }, { + name: jsontest.Name("SuperfluousCommas"), + in: struct { + V int `json:",,,,\"\",,inline,unknown,,,,"` + }{}, + wantOpts: fieldOptions{name: "V", quotedName: `"V"`, inline: true, unknown: true}, + wantErr: errors.New("Go struct field V has malformed `json` tag: invalid character ',' at start of option (expecting Unicode letter or single quote)"), + }, { + name: jsontest.Name("CaseAloneOption"), + in: struct { + FieldName int `json:",case"` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`}, + wantErr: errors.New("Go struct field FieldName is missing value for `case` tag option; specify `case:ignore` or `case:strict` instead"), + }, { + name: jsontest.Name("CaseIgnoreOption"), + in: struct { + FieldName int `json:",case:ignore"` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`, casing: caseIgnore}, + }, { + name: jsontest.Name("CaseStrictOption"), + in: struct { + FieldName int `json:",case:strict"` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`, casing: caseStrict}, + }, { + name: jsontest.Name("CaseUnknownOption"), + in: struct { + FieldName int `json:",case:unknown"` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`}, + wantErr: errors.New("Go struct field FieldName has unknown `case:unknown` tag value"), + }, { + name: jsontest.Name("CaseQuotedOption"), + in: struct { + FieldName int `json:",case:'ignore'"` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`, casing: caseIgnore}, + wantErr: errors.New("Go struct field FieldName has unnecessarily quoted appearance of `case:'ignore'` tag option; specify `case:ignore` instead"), + }, { + name: jsontest.Name("BothCaseOptions"), + in: struct { + FieldName int `json:",case:ignore,case:strict"` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`, casing: caseIgnore | caseStrict}, + wantErr: errors.New("Go struct field FieldName cannot have both `case:ignore` and `case:strict` tag options"), + }, { + name: jsontest.Name("InlineOption"), + in: struct { + FieldName int `json:",inline"` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`, inline: true}, + }, { + name: jsontest.Name("UnknownOption"), + in: struct { + FieldName int `json:",unknown"` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`, unknown: true}, + }, { + name: jsontest.Name("OmitZeroOption"), + in: struct { + FieldName int `json:",omitzero"` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`, omitzero: true}, + }, { + name: jsontest.Name("OmitEmptyOption"), + in: struct { + FieldName int `json:",omitempty"` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`, omitempty: true}, + }, { + name: jsontest.Name("StringOption"), + in: struct { + FieldName int `json:",string"` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`, string: true}, + }, { + name: jsontest.Name("FormatOptionEqual"), + in: struct { + FieldName int `json:",format=fizzbuzz"` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`}, + wantErr: errors.New("Go struct field FieldName is missing value for `format` tag option"), + }, { + name: jsontest.Name("FormatOptionColon"), + in: struct { + FieldName int `json:",format:fizzbuzz"` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`, format: "fizzbuzz"}, + }, { + name: jsontest.Name("FormatOptionQuoted"), + in: struct { + FieldName int `json:",format:'2006-01-02'"` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`, format: "2006-01-02"}, + }, { + name: jsontest.Name("FormatOptionInvalid"), + in: struct { + FieldName int `json:",format:'2006-01-02"` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`}, + wantErr: errors.New("Go struct field FieldName has malformed value for `format` tag option: single-quoted string not terminated: '2006-01-0..."), + }, { + name: jsontest.Name("FormatOptionNotLast"), + in: struct { + FieldName int `json:",format:alpha,ordered"` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`, format: "alpha"}, + wantErr: errors.New("Go struct field FieldName has `format` tag option that was not specified last"), + }, { + name: jsontest.Name("AllOptions"), + in: struct { + FieldName int `json:",case:ignore,inline,unknown,omitzero,omitempty,string,format:format"` + }{}, + wantOpts: fieldOptions{ + name: "FieldName", + quotedName: `"FieldName"`, + casing: caseIgnore, + inline: true, + unknown: true, + omitzero: true, + omitempty: true, + string: true, + format: "format", + }, + }, { + name: jsontest.Name("AllOptionsQuoted"), + in: struct { + FieldName int `json:",'case':'ignore','inline','unknown','omitzero','omitempty','string','format':'format'"` + }{}, + wantOpts: fieldOptions{ + name: "FieldName", + quotedName: `"FieldName"`, + casing: caseIgnore, + inline: true, + unknown: true, + omitzero: true, + omitempty: true, + string: true, + format: "format", + }, + wantErr: errors.New("Go struct field FieldName has unnecessarily quoted appearance of `'case'` tag option; specify `case` instead"), + }, { + name: jsontest.Name("AllOptionsCaseSensitive"), + in: struct { + FieldName int `json:",CASE:IGNORE,INLINE,UNKNOWN,OMITZERO,OMITEMPTY,STRING,FORMAT:FORMAT"` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`}, + wantErr: errors.New("Go struct field FieldName has invalid appearance of `CASE` tag option; specify `case` instead"), + }, { + name: jsontest.Name("AllOptionsSpaceSensitive"), + in: struct { + FieldName int `json:", case:ignore , inline , unknown , omitzero , omitempty , string , format:format "` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`}, + wantErr: errors.New("Go struct field FieldName has malformed `json` tag: invalid character ' ' at start of option (expecting Unicode letter or single quote)"), + }, { + name: jsontest.Name("UnknownTagOption"), + in: struct { + FieldName int `json:",inline,whoknows,string"` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`, inline: true, string: true}, + }, { + name: jsontest.Name("MalformedQuotedString/MissingQuote"), + in: struct { + FieldName int `json:"'hello,string"` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`, string: true}, + wantErr: errors.New("Go struct field FieldName has malformed `json` tag: single-quoted string not terminated: 'hello,str..."), + }, { + name: jsontest.Name("MalformedQuotedString/MissingComma"), + in: struct { + FieldName int `json:"'hello'inline,string"` + }{}, + wantOpts: fieldOptions{hasName: true, name: "hello", quotedName: `"hello"`, inline: true, string: true}, + wantErr: errors.New("Go struct field FieldName has malformed `json` tag: invalid character 'i' before next option (expecting ',')"), + }, { + name: jsontest.Name("MalformedQuotedString/InvalidEscape"), + in: struct { + FieldName int `json:"'hello\\u####',inline,string"` + }{}, + wantOpts: fieldOptions{name: "FieldName", quotedName: `"FieldName"`, inline: true, string: true}, + wantErr: errors.New("Go struct field FieldName has malformed `json` tag: invalid single-quoted string: 'hello\\u####'"), + }, { + name: jsontest.Name("MisnamedTag"), + in: struct { + V int `jsom:"Misnamed"` + }{}, + wantOpts: fieldOptions{name: "V", quotedName: `"V"`}, + }} + + for _, tt := range tests { + t.Run(tt.name.Name, func(t *testing.T) { + fs := reflect.TypeOf(tt.in).Field(0) + gotOpts, gotIgnored, gotErr := parseFieldOptions(fs) + if !reflect.DeepEqual(gotOpts, tt.wantOpts) || gotIgnored != tt.wantIgnored || !reflect.DeepEqual(gotErr, tt.wantErr) { + t.Errorf("%s: parseFieldOptions(%T) = (\n\t%v,\n\t%v,\n\t%v\n), want (\n\t%v,\n\t%v,\n\t%v\n)", tt.name.Where, tt.in, gotOpts, gotIgnored, gotErr, tt.wantOpts, tt.wantIgnored, tt.wantErr) + } + }) + } +} diff --git a/go/src/encoding/json/v2/fold.go b/go/src/encoding/json/v2/fold.go new file mode 100644 index 0000000000000000000000000000000000000000..ca33efe85fd9aa54bbc1c32a215302a4988ca1aa --- /dev/null +++ b/go/src/encoding/json/v2/fold.go @@ -0,0 +1,58 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json + +import ( + "unicode" + "unicode/utf8" +) + +// foldName returns a folded string such that foldName(x) == foldName(y) +// is similar to strings.EqualFold(x, y), but ignores underscore and dashes. +// This allows foldName to match common naming conventions. +func foldName(in []byte) []byte { + // This is inlinable to take advantage of "function outlining". + // See https://blog.filippo.io/efficient-go-apis-with-the-inliner/ + var arr [32]byte // large enough for most JSON names + return appendFoldedName(arr[:0], in) +} +func appendFoldedName(out, in []byte) []byte { + for i := 0; i < len(in); { + // Handle single-byte ASCII. + if c := in[i]; c < utf8.RuneSelf { + if c != '_' && c != '-' { + if 'a' <= c && c <= 'z' { + c -= 'a' - 'A' + } + out = append(out, c) + } + i++ + continue + } + // Handle multi-byte Unicode. + r, n := utf8.DecodeRune(in[i:]) + out = utf8.AppendRune(out, foldRune(r)) + i += n + } + return out +} + +// foldRune is a variation on unicode.SimpleFold that returns the same rune +// for all runes in the same fold set. +// +// Invariant: +// +// foldRune(x) == foldRune(y) ⇔ strings.EqualFold(string(x), string(y)) +func foldRune(r rune) rune { + for { + r2 := unicode.SimpleFold(r) + if r2 <= r { + return r2 // smallest character in the fold set + } + r = r2 + } +} diff --git a/go/src/encoding/json/v2/fold_test.go b/go/src/encoding/json/v2/fold_test.go new file mode 100644 index 0000000000000000000000000000000000000000..a1c897238029838c01df29c3297ece486d57cd40 --- /dev/null +++ b/go/src/encoding/json/v2/fold_test.go @@ -0,0 +1,127 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json + +import ( + "fmt" + "reflect" + "testing" + "unicode" +) + +var equalFoldTestdata = []struct { + in1, in2 string + want bool +}{ + {"", "", true}, + {"abc", "abc", true}, + {"ABcd", "ABcd", true}, + {"123abc", "123ABC", true}, + {"_1_2_-_3__--a-_-b-c-", "123ABC", true}, + {"αβδ", "ΑΒΔ", true}, + {"abc", "xyz", false}, + {"abc", "XYZ", false}, + {"abcdefghijk", "abcdefghijX", false}, + {"abcdefghijk", "abcdefghij\u212A", true}, + {"abcdefghijK", "abcdefghij\u212A", true}, + {"abcdefghijkz", "abcdefghij\u212Ay", false}, + {"abcdefghijKz", "abcdefghij\u212Ay", false}, + {"1", "2", false}, + {"utf-8", "US-ASCII", false}, + {"hello, world!", "hello, world!", true}, + {"hello, world!", "Hello, World!", true}, + {"hello, world!", "HELLO, WORLD!", true}, + {"hello, world!", "jello, world!", false}, + {"γειά, κόσμε!", "γειά, κόσμε!", true}, + {"γειά, κόσμε!", "Γειά, Κόσμε!", true}, + {"γειά, κόσμε!", "ΓΕΙΆ, ΚΌΣΜΕ!", true}, + {"γειά, κόσμε!", "ΛΕΙΆ, ΚΌΣΜΕ!", false}, + {"AESKey", "aesKey", true}, + {"γειά, κόσμε!", "Γ\xce_\xb5ιά, Κόσμε!", false}, + {"aeskey", "AESKEY", true}, + {"AESKEY", "aes_key", true}, + {"aes_key", "AES_KEY", true}, + {"AES_KEY", "aes-key", true}, + {"aes-key", "AES-KEY", true}, + {"AES-KEY", "aesKey", true}, + {"aesKey", "AesKey", true}, + {"AesKey", "AESKey", true}, + {"AESKey", "aeskey", true}, + {"DESKey", "aeskey", false}, + {"AES Key", "aeskey", false}, + {"aes﹏key", "aeskey", false}, // Unicode underscore not handled + {"aes〰key", "aeskey", false}, // Unicode dash not handled +} + +func TestEqualFold(t *testing.T) { + for _, tt := range equalFoldTestdata { + got := equalFold([]byte(tt.in1), []byte(tt.in2)) + if got != tt.want { + t.Errorf("equalFold(%q, %q) = %v, want %v", tt.in1, tt.in2, got, tt.want) + } + } +} + +func equalFold(x, y []byte) bool { + return string(foldName(x)) == string(foldName(y)) +} + +func TestFoldRune(t *testing.T) { + if testing.Short() { + t.Skip() + } + + var foldSet []rune + for r := range rune(unicode.MaxRune + 1) { + // Derive all runes that are all part of the same fold set. + foldSet = foldSet[:0] + for r0 := r; r != r0 || len(foldSet) == 0; r = unicode.SimpleFold(r) { + foldSet = append(foldSet, r) + } + + // Normalized form of each rune in a foldset must be the same and + // also be within the set itself. + var withinSet bool + rr0 := foldRune(foldSet[0]) + for _, r := range foldSet { + withinSet = withinSet || rr0 == r + rr := foldRune(r) + if rr0 != rr { + t.Errorf("foldRune(%q) = %q, want %q", r, rr, rr0) + } + } + if !withinSet { + t.Errorf("foldRune(%q) = %q not in fold set %q", foldSet[0], rr0, string(foldSet)) + } + } +} + +// TestBenchmarkUnmarshalUnknown unmarshals an unknown field into a struct with +// varying number of fields. Since the unknown field does not directly match +// any known field by name, it must fall back on case-insensitive matching. +func TestBenchmarkUnmarshalUnknown(t *testing.T) { + in := []byte(`{"NameUnknown":null}`) + for _, n := range []int{1, 2, 5, 10, 20, 50, 100} { + unmarshal := Unmarshal + + var fields []reflect.StructField + for i := range n { + fields = append(fields, reflect.StructField{ + Name: fmt.Sprintf("Name%d", i), + Type: T[int](), + Tag: `json:",case:ignore"`, + }) + } + out := reflect.New(reflect.StructOf(fields)).Interface() + + t.Run(fmt.Sprintf("N%d", n), func(t *testing.T) { + if err := unmarshal(in, out); err != nil { + t.Fatalf("Unmarshal error: %v", err) + } + }) + } +} diff --git a/go/src/encoding/json/v2/fuzz_test.go b/go/src/encoding/json/v2/fuzz_test.go new file mode 100644 index 0000000000000000000000000000000000000000..491a08311eb0a341127856c28bc2a310e9977d58 --- /dev/null +++ b/go/src/encoding/json/v2/fuzz_test.go @@ -0,0 +1,39 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json + +import ( + "bytes" + "testing" +) + +func FuzzEqualFold(f *testing.F) { + for _, tt := range equalFoldTestdata { + f.Add([]byte(tt.in1), []byte(tt.in2)) + } + + equalFoldSimple := func(x, y []byte) bool { + strip := func(b []byte) []byte { + return bytes.Map(func(r rune) rune { + if r == '_' || r == '-' { + return -1 // ignore underscores and dashes + } + return r + }, b) + } + return bytes.EqualFold(strip(x), strip(y)) + } + + f.Fuzz(func(t *testing.T, s1, s2 []byte) { + // Compare the optimized and simplified implementations. + got := equalFold(s1, s2) + want := equalFoldSimple(s1, s2) + if got != want { + t.Errorf("equalFold(%q, %q) = %v, want %v", s1, s2, got, want) + } + }) +} diff --git a/go/src/encoding/json/v2/inline_test.go b/go/src/encoding/json/v2/inline_test.go new file mode 100644 index 0000000000000000000000000000000000000000..b68fefb06425797565363b85ed5daefd3876d984 --- /dev/null +++ b/go/src/encoding/json/v2/inline_test.go @@ -0,0 +1,109 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json + +import ( + "os" + "os/exec" + "strings" + "testing" +) + +// Whether a function is inlinable is dependent on the Go compiler version +// and also relies on the presence of the Go toolchain itself being installed. +// This test is disabled by default and explicitly enabled with an +// environment variable that is specified in our integration tests, +// which have fine control over exactly which Go version is being tested. +var testInline = os.Getenv("TEST_INLINE") != "" + +func TestInline(t *testing.T) { + if !testInline { + t.SkipNow() + } + + pkgs := map[string]map[string]bool{ + ".": { + "hash64": true, + "foldName": true, // thin wrapper over appendFoldedName + }, + "./internal/jsonwire": { + "ConsumeWhitespace": true, + "ConsumeNull": true, + "ConsumeFalse": true, + "ConsumeTrue": true, + "ConsumeSimpleString": true, + "ConsumeString": true, // thin wrapper over consumeStringResumable + "ConsumeSimpleNumber": true, + "ConsumeNumber": true, // thin wrapper over consumeNumberResumable + "UnquoteMayCopy": true, // thin wrapper over unescapeString + "HasSuffixByte": true, + "TrimSuffixByte": true, + "TrimSuffixString": true, + "TrimSuffixWhitespace": true, + }, + "./jsontext": { + "encoderState.NeedFlush": true, + "Decoder.ReadToken": true, // thin wrapper over decoderState.ReadToken + "Decoder.ReadValue": true, // thin wrapper over decoderState.ReadValue + "Encoder.WriteToken": true, // thin wrapper over encoderState.WriteToken + "Encoder.WriteValue": true, // thin wrapper over encoderState.WriteValue + "decodeBuffer.needMore": true, + "stateMachine.appendLiteral": true, + "stateMachine.appendNumber": true, + "stateMachine.appendString": true, + "stateMachine.Depth": true, + "stateMachine.reset": true, + "stateMachine.MayAppendDelim": true, + "stateMachine.needDelim": true, + "stateMachine.popArray": true, + "stateMachine.popObject": true, + "stateMachine.pushArray": true, + "stateMachine.pushObject": true, + "stateEntry.Increment": true, + "stateEntry.decrement": true, + "stateEntry.isArray": true, + "stateEntry.isObject": true, + "stateEntry.Length": true, + "stateEntry.needImplicitColon": true, + "stateEntry.needImplicitComma": true, + "stateEntry.NeedObjectName": true, + "stateEntry.needObjectValue": true, + "objectNameStack.reset": true, + "objectNameStack.length": true, + "objectNameStack.getUnquoted": true, + "objectNameStack.push": true, + "objectNameStack.ReplaceLastQuotedOffset": true, + "objectNameStack.replaceLastUnquotedName": true, + "objectNameStack.pop": true, + "objectNameStack.ensureCopiedBuffer": true, + "objectNamespace.insertQuoted": true, // thin wrapper over objectNamespace.insert + "objectNamespace.InsertUnquoted": true, // thin wrapper over objectNamespace.insert + "Token.String": true, // thin wrapper over Token.string + }, + } + + for pkg, fncs := range pkgs { + cmd := exec.Command("go", "build", "-gcflags=-m", pkg) + b, err := cmd.CombinedOutput() + if err != nil { + t.Fatalf("exec.Command error: %v\n\n%s", err, b) + } + for _, line := range strings.Split(string(b), "\n") { + const phrase = ": can inline " + if i := strings.Index(line, phrase); i >= 0 { + fnc := line[i+len(phrase):] + fnc = strings.ReplaceAll(fnc, "(", "") + fnc = strings.ReplaceAll(fnc, "*", "") + fnc = strings.ReplaceAll(fnc, ")", "") + delete(fncs, fnc) + } + } + for fnc := range fncs { + t.Errorf("%v is not inlinable, expected it to be", fnc) + } + } +} diff --git a/go/src/encoding/json/v2/intern.go b/go/src/encoding/json/v2/intern.go new file mode 100644 index 0000000000000000000000000000000000000000..3c75e034f0553736b6da91cd7a3025f78f7ef398 --- /dev/null +++ b/go/src/encoding/json/v2/intern.go @@ -0,0 +1,88 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json + +import ( + "encoding/binary" + "math/bits" +) + +// stringCache is a cache for strings converted from a []byte. +type stringCache = [256]string // 256*unsafe.Sizeof(string("")) => 4KiB + +// makeString returns the string form of b. +// It returns a pre-allocated string from c if present, otherwise +// it allocates a new string, inserts it into the cache, and returns it. +func makeString(c *stringCache, b []byte) string { + const ( + minCachedLen = 2 // single byte strings are already interned by the runtime + maxCachedLen = 256 // large enough for UUIDs, IPv6 addresses, SHA-256 checksums, etc. + ) + if c == nil || len(b) < minCachedLen || len(b) > maxCachedLen { + return string(b) + } + + // Compute a hash from the fixed-width prefix and suffix of the string. + // This ensures hashing a string is a constant time operation. + var h uint32 + switch { + case len(b) >= 8: + lo := binary.LittleEndian.Uint64(b[:8]) + hi := binary.LittleEndian.Uint64(b[len(b)-8:]) + h = hash64(uint32(lo), uint32(lo>>32)) ^ hash64(uint32(hi), uint32(hi>>32)) + case len(b) >= 4: + lo := binary.LittleEndian.Uint32(b[:4]) + hi := binary.LittleEndian.Uint32(b[len(b)-4:]) + h = hash64(lo, hi) + case len(b) >= 2: + lo := binary.LittleEndian.Uint16(b[:2]) + hi := binary.LittleEndian.Uint16(b[len(b)-2:]) + h = hash64(uint32(lo), uint32(hi)) + } + + // Check the cache for the string. + i := h % uint32(len(*c)) + if s := (*c)[i]; s == string(b) { + return s + } + s := string(b) + (*c)[i] = s + return s +} + +// hash64 returns the hash of two uint32s as a single uint32. +func hash64(lo, hi uint32) uint32 { + // If avalanche=true, this is identical to XXH32 hash on a 8B string: + // var b [8]byte + // binary.LittleEndian.PutUint32(b[:4], lo) + // binary.LittleEndian.PutUint32(b[4:], hi) + // return xxhash.Sum32(b[:]) + const ( + prime1 = 0x9e3779b1 + prime2 = 0x85ebca77 + prime3 = 0xc2b2ae3d + prime4 = 0x27d4eb2f + prime5 = 0x165667b1 + ) + h := prime5 + uint32(8) + h += lo * prime3 + h = bits.RotateLeft32(h, 17) * prime4 + h += hi * prime3 + h = bits.RotateLeft32(h, 17) * prime4 + // Skip final mix (avalanche) step of XXH32 for performance reasons. + // Empirical testing shows that the improvements in unbiased distribution + // does not outweigh the extra cost in computational complexity. + const avalanche = false + if avalanche { + h ^= h >> 15 + h *= prime2 + h ^= h >> 13 + h *= prime3 + h ^= h >> 16 + } + return h +} diff --git a/go/src/encoding/json/v2/intern_test.go b/go/src/encoding/json/v2/intern_test.go new file mode 100644 index 0000000000000000000000000000000000000000..9163f41006a4eff03a55ffbfea12aaedd9a64654 --- /dev/null +++ b/go/src/encoding/json/v2/intern_test.go @@ -0,0 +1,146 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json + +import ( + "bytes" + "fmt" + "io" + "testing" + + "encoding/json/internal/jsontest" + "encoding/json/jsontext" +) + +func TestIntern(t *testing.T) { + var sc stringCache + const alphabet = "abcdefghijklmnopqrstuvwxyz" + for i := range len(alphabet) + 1 { + want := alphabet[i:] + if got := makeString(&sc, []byte(want)); got != want { + t.Fatalf("make = %v, want %v", got, want) + } + } + for i := range 1000 { + want := fmt.Sprintf("test%b", i) + if got := makeString(&sc, []byte(want)); got != want { + t.Fatalf("make = %v, want %v", got, want) + } + } +} + +var sink string + +func BenchmarkIntern(b *testing.B) { + datasetStrings := func(name string) (out [][]byte) { + var data []byte + for _, ts := range jsontest.Data { + if ts.Name == name { + data = ts.Data() + } + } + dec := jsontext.NewDecoder(bytes.NewReader(data)) + for { + k, n := dec.StackIndex(dec.StackDepth()) + isObjectName := k == '{' && n%2 == 0 + tok, err := dec.ReadToken() + if err != nil { + if err == io.EOF { + break + } + b.Fatalf("ReadToken error: %v", err) + } + if tok.Kind() == '"' && !isObjectName { + out = append(out, []byte(tok.String())) + } + } + return out + } + + tests := []struct { + label string + data [][]byte + }{ + // Best is the best case scenario where every string is the same. + {"Best", func() (out [][]byte) { + for range 1000 { + out = append(out, []byte("hello, world!")) + } + return out + }()}, + + // Repeat is a sequence of the same set of names repeated. + // This commonly occurs when unmarshaling a JSON array of JSON objects, + // where the set of all names is usually small. + {"Repeat", func() (out [][]byte) { + for range 100 { + for _, s := range []string{"first_name", "last_name", "age", "address", "street_address", "city", "state", "postal_code", "phone_numbers", "gender"} { + out = append(out, []byte(s)) + } + } + return out + }()}, + + // Synthea is all string values encountered in the Synthea FHIR dataset. + {"Synthea", datasetStrings("SyntheaFhir")}, + + // Twitter is all string values encountered in the Twitter dataset. + {"Twitter", datasetStrings("TwitterStatus")}, + + // Worst is the worst case scenario where every string is different + // resulting in wasted time looking up a string that will never match. + {"Worst", func() (out [][]byte) { + for i := range 1000 { + out = append(out, []byte(fmt.Sprintf("%016x", i))) + } + return out + }()}, + } + + for _, tt := range tests { + b.Run(tt.label, func(b *testing.B) { + // Alloc simply heap allocates each string. + // This provides an upper bound on the number of allocations. + b.Run("Alloc", func(b *testing.B) { + b.ReportAllocs() + for range b.N { + for _, b := range tt.data { + sink = string(b) + } + } + }) + // Cache interns strings using stringCache. + // We want to optimize for having a faster runtime than Alloc, + // and also keeping the number of allocations closer to GoMap. + b.Run("Cache", func(b *testing.B) { + b.ReportAllocs() + for range b.N { + var sc stringCache + for _, b := range tt.data { + sink = makeString(&sc, b) + } + } + }) + // GoMap interns all strings in a simple Go map. + // This provides a lower bound on the number of allocations. + b.Run("GoMap", func(b *testing.B) { + b.ReportAllocs() + for range b.N { + m := make(map[string]string) + for _, b := range tt.data { + s, ok := m[string(b)] + if !ok { + s = string(b) + m[s] = s + } + sink = s + } + } + }) + }) + } +} diff --git a/go/src/encoding/json/v2/options.go b/go/src/encoding/json/v2/options.go new file mode 100644 index 0000000000000000000000000000000000000000..9685f20f9f805f220142366e8f72467c50f7bca5 --- /dev/null +++ b/go/src/encoding/json/v2/options.go @@ -0,0 +1,288 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build goexperiment.jsonv2 + +package json + +import ( + "fmt" + + "encoding/json/internal" + "encoding/json/internal/jsonflags" + "encoding/json/internal/jsonopts" +) + +// Options configure [Marshal], [MarshalWrite], [MarshalEncode], +// [Unmarshal], [UnmarshalRead], and [UnmarshalDecode] with specific features. +// Each function takes in a variadic list of options, where properties +// set in later options override the value of previously set properties. +// +// The Options type is identical to [encoding/json.Options] and +// [encoding/json/jsontext.Options]. Options from the other packages can +// be used interchangeably with functionality in this package. +// +// Options represent either a singular option or a set of options. +// It can be functionally thought of as a Go map of option properties +// (even though the underlying implementation avoids Go maps for performance). +// +// The constructors (e.g., [Deterministic]) return a singular option value: +// +// opt := Deterministic(true) +// +// which is analogous to creating a single entry map: +// +// opt := Options{"Deterministic": true} +// +// [JoinOptions] composes multiple options values to together: +// +// out := JoinOptions(opts...) +// +// which is analogous to making a new map and copying the options over: +// +// out := make(Options) +// for _, m := range opts { +// for k, v := range m { +// out[k] = v +// } +// } +// +// [GetOption] looks up the value of options parameter: +// +// v, ok := GetOption(opts, Deterministic) +// +// which is analogous to a Go map lookup: +// +// v, ok := Options["Deterministic"] +// +// There is a single Options type, which is used with both marshal and unmarshal. +// Some options affect both operations, while others only affect one operation: +// +// - [StringifyNumbers] affects marshaling and unmarshaling +// - [Deterministic] affects marshaling only +// - [FormatNilSliceAsNull] affects marshaling only +// - [FormatNilMapAsNull] affects marshaling only +// - [OmitZeroStructFields] affects marshaling only +// - [MatchCaseInsensitiveNames] affects marshaling and unmarshaling +// - [DiscardUnknownMembers] affects marshaling only +// - [RejectUnknownMembers] affects unmarshaling only +// - [WithMarshalers] affects marshaling only +// - [WithUnmarshalers] affects unmarshaling only +// +// Options that do not affect a particular operation are ignored. +type Options = jsonopts.Options + +// JoinOptions coalesces the provided list of options into a single Options. +// Properties set in later options override the value of previously set properties. +func JoinOptions(srcs ...Options) Options { + var dst jsonopts.Struct + dst.Join(srcs...) + return &dst +} + +// GetOption returns the value stored in opts with the provided setter, +// reporting whether the value is present. +// +// Example usage: +// +// v, ok := json.GetOption(opts, json.Deterministic) +// +// Options are most commonly introspected to alter the JSON representation of +// [MarshalerTo.MarshalJSONTo] and [UnmarshalerFrom.UnmarshalJSONFrom] methods, and +// [MarshalToFunc] and [UnmarshalFromFunc] functions. +// In such cases, the presence bit should generally be ignored. +func GetOption[T any](opts Options, setter func(T) Options) (T, bool) { + return jsonopts.GetOption(opts, setter) +} + +// DefaultOptionsV2 is the full set of all options that define v2 semantics. +// It is equivalent to the set of options in [encoding/json.DefaultOptionsV1] +// all being set to false. All other options are not present. +func DefaultOptionsV2() Options { + return &jsonopts.DefaultOptionsV2 +} + +// StringifyNumbers specifies that numeric Go types should be marshaled +// as a JSON string containing the equivalent JSON number value. +// When unmarshaling, numeric Go types are parsed from a JSON string +// containing the JSON number without any surrounding whitespace. +// +// According to RFC 8259, section 6, a JSON implementation may choose to +// limit the representation of a JSON number to an IEEE 754 binary64 value. +// This may cause decoders to lose precision for int64 and uint64 types. +// Quoting JSON numbers as a JSON string preserves the exact precision. +// +// This affects either marshaling or unmarshaling. +func StringifyNumbers(v bool) Options { + if v { + return jsonflags.StringifyNumbers | 1 + } else { + return jsonflags.StringifyNumbers | 0 + } +} + +// Deterministic specifies that the same input value will be serialized +// as the exact same output bytes. Different processes of +// the same program will serialize equal values to the same bytes, +// but different versions of the same program are not guaranteed +// to produce the exact same sequence of bytes. +// +// This only affects marshaling and is ignored when unmarshaling. +func Deterministic(v bool) Options { + if v { + return jsonflags.Deterministic | 1 + } else { + return jsonflags.Deterministic | 0 + } +} + +// FormatNilSliceAsNull specifies that a nil Go slice should marshal as a +// JSON null instead of the default representation as an empty JSON array +// (or an empty JSON string in the case of ~[]byte). +// Slice fields explicitly marked with `format:emitempty` still marshal +// as an empty JSON array. +// +// This only affects marshaling and is ignored when unmarshaling. +func FormatNilSliceAsNull(v bool) Options { + if v { + return jsonflags.FormatNilSliceAsNull | 1 + } else { + return jsonflags.FormatNilSliceAsNull | 0 + } +} + +// FormatNilMapAsNull specifies that a nil Go map should marshal as a +// JSON null instead of the default representation as an empty JSON object. +// Map fields explicitly marked with `format:emitempty` still marshal +// as an empty JSON object. +// +// This only affects marshaling and is ignored when unmarshaling. +func FormatNilMapAsNull(v bool) Options { + if v { + return jsonflags.FormatNilMapAsNull | 1 + } else { + return jsonflags.FormatNilMapAsNull | 0 + } +} + +// OmitZeroStructFields specifies that a Go struct should marshal in such a way +// that all struct fields that are zero are omitted from the marshaled output +// if the value is zero as determined by the "IsZero() bool" method if present, +// otherwise based on whether the field is the zero Go value. +// This is semantically equivalent to specifying the `omitzero` tag option +// on every field in a Go struct. +// +// This only affects marshaling and is ignored when unmarshaling. +func OmitZeroStructFields(v bool) Options { + if v { + return jsonflags.OmitZeroStructFields | 1 + } else { + return jsonflags.OmitZeroStructFields | 0 + } +} + +// MatchCaseInsensitiveNames specifies that JSON object members are matched +// against Go struct fields using a case-insensitive match of the name. +// Go struct fields explicitly marked with `case:strict` or `case:ignore` +// always use case-sensitive (or case-insensitive) name matching, +// regardless of the value of this option. +// +// This affects either marshaling or unmarshaling. +// For marshaling, this option may alter the detection of duplicate names +// (assuming [jsontext.AllowDuplicateNames] is false) from inlined fields +// if it matches one of the declared fields in the Go struct. +func MatchCaseInsensitiveNames(v bool) Options { + if v { + return jsonflags.MatchCaseInsensitiveNames | 1 + } else { + return jsonflags.MatchCaseInsensitiveNames | 0 + } +} + +// DiscardUnknownMembers specifies that marshaling should ignore any +// JSON object members stored in Go struct fields dedicated to storing +// unknown JSON object members. +// +// This only affects marshaling and is ignored when unmarshaling. +func DiscardUnknownMembers(v bool) Options { + if v { + return jsonflags.DiscardUnknownMembers | 1 + } else { + return jsonflags.DiscardUnknownMembers | 0 + } +} + +// RejectUnknownMembers specifies that unknown members should be rejected +// when unmarshaling a JSON object, regardless of whether there is a field +// to store unknown members. +// +// This only affects unmarshaling and is ignored when marshaling. +func RejectUnknownMembers(v bool) Options { + if v { + return jsonflags.RejectUnknownMembers | 1 + } else { + return jsonflags.RejectUnknownMembers | 0 + } +} + +// WithMarshalers specifies a list of type-specific marshalers to use, +// which can be used to override the default marshal behavior for values +// of particular types. +// +// This only affects marshaling and is ignored when unmarshaling. +func WithMarshalers(v *Marshalers) Options { + return (*marshalersOption)(v) +} + +// WithUnmarshalers specifies a list of type-specific unmarshalers to use, +// which can be used to override the default unmarshal behavior for values +// of particular types. +// +// This only affects unmarshaling and is ignored when marshaling. +func WithUnmarshalers(v *Unmarshalers) Options { + return (*unmarshalersOption)(v) +} + +// These option types are declared here instead of "jsonopts" +// to avoid a dependency on "reflect" from "jsonopts". +type ( + marshalersOption Marshalers + unmarshalersOption Unmarshalers +) + +func (*marshalersOption) JSONOptions(internal.NotForPublicUse) {} +func (*unmarshalersOption) JSONOptions(internal.NotForPublicUse) {} + +// Inject support into "jsonopts" to handle these types. +func init() { + jsonopts.GetUnknownOption = func(src jsonopts.Struct, zero jsonopts.Options) (any, bool) { + switch zero.(type) { + case *marshalersOption: + if !src.Flags.Has(jsonflags.Marshalers) { + return (*Marshalers)(nil), false + } + return src.Marshalers.(*Marshalers), true + case *unmarshalersOption: + if !src.Flags.Has(jsonflags.Unmarshalers) { + return (*Unmarshalers)(nil), false + } + return src.Unmarshalers.(*Unmarshalers), true + default: + panic(fmt.Sprintf("unknown option %T", zero)) + } + } + jsonopts.JoinUnknownOption = func(dst jsonopts.Struct, src jsonopts.Options) jsonopts.Struct { + switch src := src.(type) { + case *marshalersOption: + dst.Flags.Set(jsonflags.Marshalers | 1) + dst.Marshalers = (*Marshalers)(src) + case *unmarshalersOption: + dst.Flags.Set(jsonflags.Unmarshalers | 1) + dst.Unmarshalers = (*Unmarshalers)(src) + default: + panic(fmt.Sprintf("unknown option %T", src)) + } + return dst + } +} diff --git a/go/src/encoding/xml/marshal_test.go b/go/src/encoding/xml/marshal_test.go new file mode 100644 index 0000000000000000000000000000000000000000..6c7e711aac056658335e8d90d5927da0ebaf0990 --- /dev/null +++ b/go/src/encoding/xml/marshal_test.go @@ -0,0 +1,2590 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package xml + +import ( + "bytes" + "errors" + "fmt" + "io" + "reflect" + "strconv" + "strings" + "sync" + "testing" + "time" +) + +type DriveType int + +const ( + HyperDrive DriveType = iota + ImprobabilityDrive +) + +type Passenger struct { + Name []string `xml:"name"` + Weight float32 `xml:"weight"` +} + +type Ship struct { + XMLName struct{} `xml:"spaceship"` + + Name string `xml:"name,attr"` + Pilot string `xml:"pilot,attr"` + Drive DriveType `xml:"drive"` + Age uint `xml:"age"` + Passenger []*Passenger `xml:"passenger"` + secret string +} + +type NamedType string + +type Port struct { + XMLName struct{} `xml:"port"` + Type string `xml:"type,attr,omitempty"` + Comment string `xml:",comment"` + Number string `xml:",chardata"` +} + +type Domain struct { + XMLName struct{} `xml:"domain"` + Country string `xml:",attr,omitempty"` + Name []byte `xml:",chardata"` + Comment []byte `xml:",comment"` +} + +type Book struct { + XMLName struct{} `xml:"book"` + Title string `xml:",chardata"` +} + +type Event struct { + XMLName struct{} `xml:"event"` + Year int `xml:",chardata"` +} + +type Movie struct { + XMLName struct{} `xml:"movie"` + Length uint `xml:",chardata"` +} + +type Pi struct { + XMLName struct{} `xml:"pi"` + Approximation float32 `xml:",chardata"` +} + +type Universe struct { + XMLName struct{} `xml:"universe"` + Visible float64 `xml:",chardata"` +} + +type Particle struct { + XMLName struct{} `xml:"particle"` + HasMass bool `xml:",chardata"` +} + +type Departure struct { + XMLName struct{} `xml:"departure"` + When time.Time `xml:",chardata"` +} + +type SecretAgent struct { + XMLName struct{} `xml:"agent"` + Handle string `xml:"handle,attr"` + Identity string + Obfuscate string `xml:",innerxml"` +} + +type NestedItems struct { + XMLName struct{} `xml:"result"` + Items []string `xml:">item"` + Item1 []string `xml:"Items>item1"` +} + +type NestedOrder struct { + XMLName struct{} `xml:"result"` + Field1 string `xml:"parent>c"` + Field2 string `xml:"parent>b"` + Field3 string `xml:"parent>a"` +} + +type MixedNested struct { + XMLName struct{} `xml:"result"` + A string `xml:"parent1>a"` + B string `xml:"b"` + C string `xml:"parent1>parent2>c"` + D string `xml:"parent1>d"` +} + +type NilTest struct { + A any `xml:"parent1>parent2>a"` + B any `xml:"parent1>b"` + C any `xml:"parent1>parent2>c"` +} + +type Service struct { + XMLName struct{} `xml:"service"` + Domain *Domain `xml:"host>domain"` + Port *Port `xml:"host>port"` + Extra1 any + Extra2 any `xml:"host>extra2"` +} + +var nilStruct *Ship + +type EmbedA struct { + EmbedC + EmbedB EmbedB + FieldA string + embedD +} + +type EmbedB struct { + FieldB string + *EmbedC +} + +type EmbedC struct { + FieldA1 string `xml:"FieldA>A1"` + FieldA2 string `xml:"FieldA>A2"` + FieldB string + FieldC string +} + +type embedD struct { + fieldD string + FieldE string // Promoted and visible when embedD is embedded. +} + +type NameCasing struct { + XMLName struct{} `xml:"casing"` + Xy string + XY string + XyA string `xml:"Xy,attr"` + XYA string `xml:"XY,attr"` +} + +type NamePrecedence struct { + XMLName Name `xml:"Parent"` + FromTag XMLNameWithoutTag `xml:"InTag"` + FromNameVal XMLNameWithoutTag + FromNameTag XMLNameWithTag + InFieldName string +} + +type XMLNameWithTag struct { + XMLName Name `xml:"InXMLNameTag"` + Value string `xml:",chardata"` +} + +type XMLNameWithoutTag struct { + XMLName Name + Value string `xml:",chardata"` +} + +type NameInField struct { + Foo Name `xml:"ns foo"` +} + +type AttrTest struct { + Int int `xml:",attr"` + Named int `xml:"int,attr"` + Float float64 `xml:",attr"` + Uint8 uint8 `xml:",attr"` + Bool bool `xml:",attr"` + Str string `xml:",attr"` + Bytes []byte `xml:",attr"` +} + +type AttrsTest struct { + Attrs []Attr `xml:",any,attr"` + Int int `xml:",attr"` + Named int `xml:"int,attr"` + Float float64 `xml:",attr"` + Uint8 uint8 `xml:",attr"` + Bool bool `xml:",attr"` + Str string `xml:",attr"` + Bytes []byte `xml:",attr"` +} + +type OmitAttrTest struct { + Int int `xml:",attr,omitempty"` + Named int `xml:"int,attr,omitempty"` + Float float64 `xml:",attr,omitempty"` + Uint8 uint8 `xml:",attr,omitempty"` + Bool bool `xml:",attr,omitempty"` + Str string `xml:",attr,omitempty"` + Bytes []byte `xml:",attr,omitempty"` + PStr *string `xml:",attr,omitempty"` +} + +type OmitFieldTest struct { + Int int `xml:",omitempty"` + Named int `xml:"int,omitempty"` + Float float64 `xml:",omitempty"` + Uint8 uint8 `xml:",omitempty"` + Bool bool `xml:",omitempty"` + Str string `xml:",omitempty"` + Bytes []byte `xml:",omitempty"` + PStr *string `xml:",omitempty"` + Ptr *PresenceTest `xml:",omitempty"` +} + +type AnyTest struct { + XMLName struct{} `xml:"a"` + Nested string `xml:"nested>value"` + AnyField AnyHolder `xml:",any"` +} + +type AnyOmitTest struct { + XMLName struct{} `xml:"a"` + Nested string `xml:"nested>value"` + AnyField *AnyHolder `xml:",any,omitempty"` +} + +type AnySliceTest struct { + XMLName struct{} `xml:"a"` + Nested string `xml:"nested>value"` + AnyField []AnyHolder `xml:",any"` +} + +type AnyHolder struct { + XMLName Name + XML string `xml:",innerxml"` +} + +type RecurseA struct { + A string + B *RecurseB +} + +type RecurseB struct { + A *RecurseA + B string +} + +type PresenceTest struct { + Exists *struct{} +} + +type IgnoreTest struct { + PublicSecret string `xml:"-"` +} + +type MyBytes []byte + +type Data struct { + Bytes []byte + Attr []byte `xml:",attr"` + Custom MyBytes +} + +type Plain struct { + V any +} + +type MyInt int + +type EmbedInt struct { + MyInt +} + +type Strings struct { + X []string `xml:"A>B,omitempty"` +} + +type PointerFieldsTest struct { + XMLName Name `xml:"dummy"` + Name *string `xml:"name,attr"` + Age *uint `xml:"age,attr"` + Empty *string `xml:"empty,attr"` + Contents *string `xml:",chardata"` +} + +type ChardataEmptyTest struct { + XMLName Name `xml:"test"` + Contents *string `xml:",chardata"` +} + +type PointerAnonFields struct { + *MyInt + *NamedType +} + +type MyMarshalerTest struct { +} + +var _ Marshaler = (*MyMarshalerTest)(nil) + +func (m *MyMarshalerTest) MarshalXML(e *Encoder, start StartElement) error { + e.EncodeToken(start) + e.EncodeToken(CharData([]byte("hello world"))) + e.EncodeToken(EndElement{start.Name}) + return nil +} + +type MyMarshalerAttrTest struct { +} + +var _ MarshalerAttr = (*MyMarshalerAttrTest)(nil) + +func (m *MyMarshalerAttrTest) MarshalXMLAttr(name Name) (Attr, error) { + return Attr{name, "hello world"}, nil +} + +func (m *MyMarshalerAttrTest) UnmarshalXMLAttr(attr Attr) error { + return nil +} + +type MarshalerStruct struct { + Foo MyMarshalerAttrTest `xml:",attr"` +} + +type InnerStruct struct { + XMLName Name `xml:"testns outer"` +} + +type OuterStruct struct { + InnerStruct + IntAttr int `xml:"int,attr"` +} + +type OuterNamedStruct struct { + InnerStruct + XMLName Name `xml:"outerns test"` + IntAttr int `xml:"int,attr"` +} + +type OuterNamedOrderedStruct struct { + XMLName Name `xml:"outerns test"` + InnerStruct + IntAttr int `xml:"int,attr"` +} + +type OuterOuterStruct struct { + OuterStruct +} + +type NestedAndChardata struct { + AB []string `xml:"A>B"` + Chardata string `xml:",chardata"` +} + +type NestedAndComment struct { + AB []string `xml:"A>B"` + Comment string `xml:",comment"` +} + +type CDataTest struct { + Chardata string `xml:",cdata"` +} + +type NestedAndCData struct { + AB []string `xml:"A>B"` + CDATA string `xml:",cdata"` +} + +func ifaceptr(x any) any { + return &x +} + +func stringptr(x string) *string { + return &x +} + +type T1 struct{} +type T2 struct{} + +type IndirComment struct { + T1 T1 + Comment *string `xml:",comment"` + T2 T2 +} + +type DirectComment struct { + T1 T1 + Comment string `xml:",comment"` + T2 T2 +} + +type IfaceComment struct { + T1 T1 + Comment any `xml:",comment"` + T2 T2 +} + +type IndirChardata struct { + T1 T1 + Chardata *string `xml:",chardata"` + T2 T2 +} + +type DirectChardata struct { + T1 T1 + Chardata string `xml:",chardata"` + T2 T2 +} + +type IfaceChardata struct { + T1 T1 + Chardata any `xml:",chardata"` + T2 T2 +} + +type IndirCDATA struct { + T1 T1 + CDATA *string `xml:",cdata"` + T2 T2 +} + +type DirectCDATA struct { + T1 T1 + CDATA string `xml:",cdata"` + T2 T2 +} + +type IfaceCDATA struct { + T1 T1 + CDATA any `xml:",cdata"` + T2 T2 +} + +type IndirInnerXML struct { + T1 T1 + InnerXML *string `xml:",innerxml"` + T2 T2 +} + +type DirectInnerXML struct { + T1 T1 + InnerXML string `xml:",innerxml"` + T2 T2 +} + +type IfaceInnerXML struct { + T1 T1 + InnerXML any `xml:",innerxml"` + T2 T2 +} + +type IndirElement struct { + T1 T1 + Element *string + T2 T2 +} + +type DirectElement struct { + T1 T1 + Element string + T2 T2 +} + +type IfaceElement struct { + T1 T1 + Element any + T2 T2 +} + +type IndirOmitEmpty struct { + T1 T1 + OmitEmpty *string `xml:",omitempty"` + T2 T2 +} + +type DirectOmitEmpty struct { + T1 T1 + OmitEmpty string `xml:",omitempty"` + T2 T2 +} + +type IfaceOmitEmpty struct { + T1 T1 + OmitEmpty any `xml:",omitempty"` + T2 T2 +} + +type IndirAny struct { + T1 T1 + Any *string `xml:",any"` + T2 T2 +} + +type DirectAny struct { + T1 T1 + Any string `xml:",any"` + T2 T2 +} + +type IfaceAny struct { + T1 T1 + Any any `xml:",any"` + T2 T2 +} + +type Generic[T any] struct { + X T +} + +var ( + nameAttr = "Sarah" + ageAttr = uint(12) + contentsAttr = "lorem ipsum" + empty = "" +) + +// Unless explicitly stated as such (or *Plain), all of the +// tests below are two-way tests. When introducing new tests, +// please try to make them two-way as well to ensure that +// marshaling and unmarshaling are as symmetrical as feasible. +var marshalTests = []struct { + Value any + ExpectXML string + MarshalOnly bool + MarshalError string + UnmarshalOnly bool + UnmarshalError string +}{ + // Test nil marshals to nothing + {Value: nil, ExpectXML: ``, MarshalOnly: true}, + {Value: nilStruct, ExpectXML: ``, MarshalOnly: true}, + + // Test value types + {Value: &Plain{true}, ExpectXML: `true`}, + {Value: &Plain{false}, ExpectXML: `false`}, + {Value: &Plain{int(42)}, ExpectXML: `42`}, + {Value: &Plain{int8(42)}, ExpectXML: `42`}, + {Value: &Plain{int16(42)}, ExpectXML: `42`}, + {Value: &Plain{int32(42)}, ExpectXML: `42`}, + {Value: &Plain{uint(42)}, ExpectXML: `42`}, + {Value: &Plain{uint8(42)}, ExpectXML: `42`}, + {Value: &Plain{uint16(42)}, ExpectXML: `42`}, + {Value: &Plain{uint32(42)}, ExpectXML: `42`}, + {Value: &Plain{float32(1.25)}, ExpectXML: `1.25`}, + {Value: &Plain{float64(1.25)}, ExpectXML: `1.25`}, + {Value: &Plain{uintptr(0xFFDD)}, ExpectXML: `65501`}, + {Value: &Plain{"gopher"}, ExpectXML: `gopher`}, + {Value: &Plain{[]byte("gopher")}, ExpectXML: `gopher`}, + {Value: &Plain{""}, ExpectXML: `</>`}, + {Value: &Plain{[]byte("")}, ExpectXML: `</>`}, + {Value: &Plain{[3]byte{'<', '/', '>'}}, ExpectXML: `</>`}, + {Value: &Plain{NamedType("potato")}, ExpectXML: `potato`}, + {Value: &Plain{[]int{1, 2, 3}}, ExpectXML: `123`}, + {Value: &Plain{[3]int{1, 2, 3}}, ExpectXML: `123`}, + {Value: ifaceptr(true), MarshalOnly: true, ExpectXML: `true`}, + + // Test time. + { + Value: &Plain{time.Unix(1e9, 123456789).UTC()}, + ExpectXML: `2001-09-09T01:46:40.123456789Z`, + }, + + // A pointer to struct{} may be used to test for an element's presence. + { + Value: &PresenceTest{new(struct{})}, + ExpectXML: ``, + }, + { + Value: &PresenceTest{}, + ExpectXML: ``, + }, + + // A []byte field is only nil if the element was not found. + { + Value: &Data{}, + ExpectXML: ``, + UnmarshalOnly: true, + }, + { + Value: &Data{Bytes: []byte{}, Custom: MyBytes{}, Attr: []byte{}}, + ExpectXML: ``, + UnmarshalOnly: true, + }, + + // Check that []byte works, including named []byte types. + { + Value: &Data{Bytes: []byte("ab"), Custom: MyBytes("cd"), Attr: []byte{'v'}}, + ExpectXML: `abcd`, + }, + + // Test innerxml + { + Value: &SecretAgent{ + Handle: "007", + Identity: "James Bond", + Obfuscate: "", + }, + ExpectXML: `James Bond`, + MarshalOnly: true, + }, + { + Value: &SecretAgent{ + Handle: "007", + Identity: "James Bond", + Obfuscate: "James Bond", + }, + ExpectXML: `James Bond`, + UnmarshalOnly: true, + }, + + // Test structs + {Value: &Port{Type: "ssl", Number: "443"}, ExpectXML: `443`}, + {Value: &Port{Number: "443"}, ExpectXML: `443`}, + {Value: &Port{Type: ""}, ExpectXML: ``}, + {Value: &Port{Number: "443", Comment: "https"}, ExpectXML: `443`}, + {Value: &Port{Number: "443", Comment: "add space-"}, ExpectXML: `443`, MarshalOnly: true}, + {Value: &Domain{Name: []byte("google.com&friends")}, ExpectXML: `google.com&friends`}, + {Value: &Domain{Name: []byte("google.com"), Comment: []byte(" &friends ")}, ExpectXML: `google.com`}, + {Value: &Book{Title: "Pride & Prejudice"}, ExpectXML: `Pride & Prejudice`}, + {Value: &Event{Year: -3114}, ExpectXML: `-3114`}, + {Value: &Movie{Length: 13440}, ExpectXML: `13440`}, + {Value: &Pi{Approximation: 3.14159265}, ExpectXML: `3.1415927`}, + {Value: &Universe{Visible: 9.3e13}, ExpectXML: `9.3e+13`}, + {Value: &Particle{HasMass: true}, ExpectXML: `true`}, + {Value: &Departure{When: ParseTime("2013-01-09T00:15:00-09:00")}, ExpectXML: `2013-01-09T00:15:00-09:00`}, + {Value: atomValue, ExpectXML: atomXML}, + {Value: &Generic[int]{1}, ExpectXML: `1`}, + { + Value: &Ship{ + Name: "Heart of Gold", + Pilot: "Computer", + Age: 1, + Drive: ImprobabilityDrive, + Passenger: []*Passenger{ + { + Name: []string{"Zaphod", "Beeblebrox"}, + Weight: 7.25, + }, + { + Name: []string{"Trisha", "McMillen"}, + Weight: 5.5, + }, + { + Name: []string{"Ford", "Prefect"}, + Weight: 7, + }, + { + Name: []string{"Arthur", "Dent"}, + Weight: 6.75, + }, + }, + }, + ExpectXML: `` + + `` + strconv.Itoa(int(ImprobabilityDrive)) + `` + + `1` + + `` + + `Zaphod` + + `Beeblebrox` + + `7.25` + + `` + + `` + + `Trisha` + + `McMillen` + + `5.5` + + `` + + `` + + `Ford` + + `Prefect` + + `7` + + `` + + `` + + `Arthur` + + `Dent` + + `6.75` + + `` + + ``, + }, + + // Test a>b + { + Value: &NestedItems{Items: nil, Item1: nil}, + ExpectXML: `` + + `` + + `` + + ``, + }, + { + Value: &NestedItems{Items: []string{}, Item1: []string{}}, + ExpectXML: `` + + `` + + `` + + ``, + MarshalOnly: true, + }, + { + Value: &NestedItems{Items: nil, Item1: []string{"A"}}, + ExpectXML: `` + + `` + + `A` + + `` + + ``, + }, + { + Value: &NestedItems{Items: []string{"A", "B"}, Item1: nil}, + ExpectXML: `` + + `` + + `A` + + `B` + + `` + + ``, + }, + { + Value: &NestedItems{Items: []string{"A", "B"}, Item1: []string{"C"}}, + ExpectXML: `` + + `` + + `A` + + `B` + + `C` + + `` + + ``, + }, + { + Value: &NestedOrder{Field1: "C", Field2: "B", Field3: "A"}, + ExpectXML: `` + + `` + + `C` + + `B` + + `A` + + `` + + ``, + }, + { + Value: &NilTest{A: "A", B: nil, C: "C"}, + ExpectXML: `` + + `` + + `A` + + `C` + + `` + + ``, + MarshalOnly: true, // Uses interface{} + }, + { + Value: &MixedNested{A: "A", B: "B", C: "C", D: "D"}, + ExpectXML: `` + + `A` + + `B` + + `` + + `C` + + `D` + + `` + + ``, + }, + { + Value: &Service{Port: &Port{Number: "80"}}, + ExpectXML: `80`, + }, + { + Value: &Service{}, + ExpectXML: ``, + }, + { + Value: &Service{Port: &Port{Number: "80"}, Extra1: "A", Extra2: "B"}, + ExpectXML: `` + + `80` + + `A` + + `B` + + ``, + MarshalOnly: true, + }, + { + Value: &Service{Port: &Port{Number: "80"}, Extra2: "example"}, + ExpectXML: `` + + `80` + + `example` + + ``, + MarshalOnly: true, + }, + { + Value: &struct { + XMLName struct{} `xml:"space top"` + A string `xml:"x>a"` + B string `xml:"x>b"` + C string `xml:"space x>c"` + C1 string `xml:"space1 x>c"` + D1 string `xml:"space1 x>d"` + }{ + A: "a", + B: "b", + C: "c", + C1: "c1", + D1: "d1", + }, + ExpectXML: `` + + `abc` + + `c1` + + `d1` + + `` + + ``, + }, + { + Value: &struct { + XMLName Name + A string `xml:"x>a"` + B string `xml:"x>b"` + C string `xml:"space x>c"` + C1 string `xml:"space1 x>c"` + D1 string `xml:"space1 x>d"` + }{ + XMLName: Name{ + Space: "space0", + Local: "top", + }, + A: "a", + B: "b", + C: "c", + C1: "c1", + D1: "d1", + }, + ExpectXML: `` + + `ab` + + `c` + + `c1` + + `d1` + + `` + + ``, + }, + { + Value: &struct { + XMLName struct{} `xml:"top"` + B string `xml:"space x>b"` + B1 string `xml:"space1 x>b"` + }{ + B: "b", + B1: "b1", + }, + ExpectXML: `` + + `b` + + `b1` + + ``, + }, + + // Test struct embedding + { + Value: &EmbedA{ + EmbedC: EmbedC{ + FieldA1: "", // Shadowed by A.A + FieldA2: "", // Shadowed by A.A + FieldB: "A.C.B", + FieldC: "A.C.C", + }, + EmbedB: EmbedB{ + FieldB: "A.B.B", + EmbedC: &EmbedC{ + FieldA1: "A.B.C.A1", + FieldA2: "A.B.C.A2", + FieldB: "", // Shadowed by A.B.B + FieldC: "A.B.C.C", + }, + }, + FieldA: "A.A", + embedD: embedD{ + FieldE: "A.D.E", + }, + }, + ExpectXML: `` + + `A.C.B` + + `A.C.C` + + `` + + `A.B.B` + + `` + + `A.B.C.A1` + + `A.B.C.A2` + + `` + + `A.B.C.C` + + `` + + `A.A` + + `A.D.E` + + ``, + }, + + // Anonymous struct pointer field which is nil + { + Value: &EmbedB{}, + ExpectXML: ``, + }, + + // Other kinds of nil anonymous fields + { + Value: &PointerAnonFields{}, + ExpectXML: ``, + }, + + // Test that name casing matters + { + Value: &NameCasing{Xy: "mixed", XY: "upper", XyA: "mixedA", XYA: "upperA"}, + ExpectXML: `mixedupper`, + }, + + // Test the order in which the XML element name is chosen + { + Value: &NamePrecedence{ + FromTag: XMLNameWithoutTag{Value: "A"}, + FromNameVal: XMLNameWithoutTag{XMLName: Name{Local: "InXMLName"}, Value: "B"}, + FromNameTag: XMLNameWithTag{Value: "C"}, + InFieldName: "D", + }, + ExpectXML: `` + + `A` + + `B` + + `C` + + `D` + + ``, + MarshalOnly: true, + }, + { + Value: &NamePrecedence{ + XMLName: Name{Local: "Parent"}, + FromTag: XMLNameWithoutTag{XMLName: Name{Local: "InTag"}, Value: "A"}, + FromNameVal: XMLNameWithoutTag{XMLName: Name{Local: "FromNameVal"}, Value: "B"}, + FromNameTag: XMLNameWithTag{XMLName: Name{Local: "InXMLNameTag"}, Value: "C"}, + InFieldName: "D", + }, + ExpectXML: `` + + `A` + + `B` + + `C` + + `D` + + ``, + UnmarshalOnly: true, + }, + + // xml.Name works in a plain field as well. + { + Value: &NameInField{Name{Space: "ns", Local: "foo"}}, + ExpectXML: ``, + }, + { + Value: &NameInField{Name{Space: "ns", Local: "foo"}}, + ExpectXML: ``, + UnmarshalOnly: true, + }, + + // Marshaling zero xml.Name uses the tag or field name. + { + Value: &NameInField{}, + ExpectXML: ``, + MarshalOnly: true, + }, + + // Test attributes + { + Value: &AttrTest{ + Int: 8, + Named: 9, + Float: 23.5, + Uint8: 255, + Bool: true, + Str: "str", + Bytes: []byte("byt"), + }, + ExpectXML: ``, + }, + { + Value: &AttrTest{Bytes: []byte{}}, + ExpectXML: ``, + }, + { + Value: &AttrsTest{ + Attrs: []Attr{ + {Name: Name{Local: "Answer"}, Value: "42"}, + {Name: Name{Local: "Int"}, Value: "8"}, + {Name: Name{Local: "int"}, Value: "9"}, + {Name: Name{Local: "Float"}, Value: "23.5"}, + {Name: Name{Local: "Uint8"}, Value: "255"}, + {Name: Name{Local: "Bool"}, Value: "true"}, + {Name: Name{Local: "Str"}, Value: "str"}, + {Name: Name{Local: "Bytes"}, Value: "byt"}, + }, + }, + ExpectXML: ``, + MarshalOnly: true, + }, + { + Value: &AttrsTest{ + Attrs: []Attr{ + {Name: Name{Local: "Answer"}, Value: "42"}, + }, + Int: 8, + Named: 9, + Float: 23.5, + Uint8: 255, + Bool: true, + Str: "str", + Bytes: []byte("byt"), + }, + ExpectXML: ``, + }, + { + Value: &AttrsTest{ + Attrs: []Attr{ + {Name: Name{Local: "Int"}, Value: "0"}, + {Name: Name{Local: "int"}, Value: "0"}, + {Name: Name{Local: "Float"}, Value: "0"}, + {Name: Name{Local: "Uint8"}, Value: "0"}, + {Name: Name{Local: "Bool"}, Value: "false"}, + {Name: Name{Local: "Str"}}, + {Name: Name{Local: "Bytes"}}, + }, + Bytes: []byte{}, + }, + ExpectXML: ``, + MarshalOnly: true, + }, + { + Value: &OmitAttrTest{ + Int: 8, + Named: 9, + Float: 23.5, + Uint8: 255, + Bool: true, + Str: "str", + Bytes: []byte("byt"), + PStr: &empty, + }, + ExpectXML: ``, + }, + { + Value: &OmitAttrTest{}, + ExpectXML: ``, + }, + + // pointer fields + { + Value: &PointerFieldsTest{Name: &nameAttr, Age: &ageAttr, Contents: &contentsAttr}, + ExpectXML: `lorem ipsum`, + MarshalOnly: true, + }, + + // empty chardata pointer field + { + Value: &ChardataEmptyTest{}, + ExpectXML: ``, + MarshalOnly: true, + }, + + // omitempty on fields + { + Value: &OmitFieldTest{ + Int: 8, + Named: 9, + Float: 23.5, + Uint8: 255, + Bool: true, + Str: "str", + Bytes: []byte("byt"), + PStr: &empty, + Ptr: &PresenceTest{}, + }, + ExpectXML: `` + + `8` + + `9` + + `23.5` + + `255` + + `true` + + `str` + + `byt` + + `` + + `` + + ``, + }, + { + Value: &OmitFieldTest{}, + ExpectXML: ``, + }, + + // Test ",any" + { + ExpectXML: `knownunknown`, + Value: &AnyTest{ + Nested: "known", + AnyField: AnyHolder{ + XMLName: Name{Local: "other"}, + XML: "unknown", + }, + }, + }, + { + Value: &AnyTest{Nested: "known", + AnyField: AnyHolder{ + XML: "", + XMLName: Name{Local: "AnyField"}, + }, + }, + ExpectXML: `known`, + }, + { + ExpectXML: `b`, + Value: &AnyOmitTest{ + Nested: "b", + }, + }, + { + ExpectXML: `bei`, + Value: &AnySliceTest{ + Nested: "b", + AnyField: []AnyHolder{ + { + XMLName: Name{Local: "c"}, + XML: "e", + }, + { + XMLName: Name{Space: "f", Local: "g"}, + XML: "i", + }, + }, + }, + }, + { + ExpectXML: `b`, + Value: &AnySliceTest{ + Nested: "b", + }, + }, + + // Test recursive types. + { + Value: &RecurseA{ + A: "a1", + B: &RecurseB{ + A: &RecurseA{"a2", nil}, + B: "b1", + }, + }, + ExpectXML: `a1a2b1`, + }, + + // Test ignoring fields via "-" tag + { + ExpectXML: ``, + Value: &IgnoreTest{}, + }, + { + ExpectXML: ``, + Value: &IgnoreTest{PublicSecret: "can't tell"}, + MarshalOnly: true, + }, + { + ExpectXML: `ignore me`, + Value: &IgnoreTest{}, + UnmarshalOnly: true, + }, + + // Test escaping. + { + ExpectXML: `dquote: "; squote: '; ampersand: &; less: <; greater: >;`, + Value: &AnyTest{ + Nested: `dquote: "; squote: '; ampersand: &; less: <; greater: >;`, + AnyField: AnyHolder{XMLName: Name{Local: "empty"}}, + }, + }, + { + ExpectXML: `newline: ; cr: ; tab: ;`, + Value: &AnyTest{ + Nested: "newline: \n; cr: \r; tab: \t;", + AnyField: AnyHolder{XMLName: Name{Local: "AnyField"}}, + }, + }, + { + ExpectXML: "1\r2\r\n3\n\r4\n5", + Value: &AnyTest{ + Nested: "1\n2\n3\n\n4\n5", + }, + UnmarshalOnly: true, + }, + { + ExpectXML: `42`, + Value: &EmbedInt{ + MyInt: 42, + }, + }, + // Test outputting CDATA-wrapped text. + { + ExpectXML: ``, + Value: &CDataTest{}, + }, + { + ExpectXML: ``, + Value: &CDataTest{ + Chardata: "http://example.com/tests/1?foo=1&bar=baz", + }, + }, + { + ExpectXML: `!]]>`, + Value: &CDataTest{ + Chardata: "Literal !", + }, + }, + { + ExpectXML: ` Literal!]]>`, + Value: &CDataTest{ + Chardata: " Literal!", + }, + }, + { + ExpectXML: ` Literal! Literal!]]>`, + Value: &CDataTest{ + Chardata: " Literal! Literal!", + }, + }, + { + ExpectXML: `]]]]>]]>`, + Value: &CDataTest{ + Chardata: "]]>", + }, + }, + + // Test omitempty with parent chain; see golang.org/issue/4168. + { + ExpectXML: ``, + Value: &Strings{}, + }, + // Custom marshalers. + { + ExpectXML: `hello world`, + Value: &MyMarshalerTest{}, + }, + { + ExpectXML: ``, + Value: &MarshalerStruct{}, + }, + { + ExpectXML: ``, + Value: &OuterStruct{IntAttr: 10}, + }, + { + ExpectXML: ``, + Value: &OuterNamedStruct{XMLName: Name{Space: "outerns", Local: "test"}, IntAttr: 10}, + }, + { + ExpectXML: ``, + Value: &OuterNamedOrderedStruct{XMLName: Name{Space: "outerns", Local: "test"}, IntAttr: 10}, + }, + { + ExpectXML: ``, + Value: &OuterOuterStruct{OuterStruct{IntAttr: 10}}, + }, + { + ExpectXML: `test`, + Value: &NestedAndChardata{AB: make([]string, 2), Chardata: "test"}, + }, + { + ExpectXML: ``, + Value: &NestedAndComment{AB: make([]string, 2), Comment: "test"}, + }, + { + ExpectXML: ``, + Value: &NestedAndCData{AB: make([]string, 2), CDATA: "test"}, + }, + // Test pointer indirection in various kinds of fields. + // https://golang.org/issue/19063 + { + ExpectXML: ``, + Value: &IndirComment{Comment: stringptr("hi")}, + MarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &IndirComment{Comment: stringptr("")}, + MarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &IndirComment{Comment: nil}, + MarshalError: "xml: bad type for comment field of xml.IndirComment", + }, + { + ExpectXML: ``, + Value: &IndirComment{Comment: nil}, + UnmarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &IfaceComment{Comment: "hi"}, + MarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &IfaceComment{Comment: nil}, + UnmarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &IfaceComment{Comment: nil}, + MarshalError: "xml: bad type for comment field of xml.IfaceComment", + }, + { + ExpectXML: ``, + Value: &IfaceComment{Comment: nil}, + UnmarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &DirectComment{Comment: string("hi")}, + }, + { + ExpectXML: ``, + Value: &DirectComment{Comment: string("")}, + }, + { + ExpectXML: `hi`, + Value: &IndirChardata{Chardata: stringptr("hi")}, + }, + { + ExpectXML: ``, + Value: &IndirChardata{Chardata: stringptr("hi")}, + UnmarshalOnly: true, // marshals without CDATA + }, + { + ExpectXML: ``, + Value: &IndirChardata{Chardata: stringptr("")}, + }, + { + ExpectXML: ``, + Value: &IndirChardata{Chardata: nil}, + MarshalOnly: true, // unmarshal leaves Chardata=stringptr("") + }, + { + ExpectXML: `hi`, + Value: &IfaceChardata{Chardata: string("hi")}, + UnmarshalError: "cannot unmarshal into interface {}", + }, + { + ExpectXML: ``, + Value: &IfaceChardata{Chardata: string("hi")}, + UnmarshalOnly: true, // marshals without CDATA + UnmarshalError: "cannot unmarshal into interface {}", + }, + { + ExpectXML: ``, + Value: &IfaceChardata{Chardata: string("")}, + UnmarshalError: "cannot unmarshal into interface {}", + }, + { + ExpectXML: ``, + Value: &IfaceChardata{Chardata: nil}, + UnmarshalError: "cannot unmarshal into interface {}", + }, + { + ExpectXML: `hi`, + Value: &DirectChardata{Chardata: string("hi")}, + }, + { + ExpectXML: ``, + Value: &DirectChardata{Chardata: string("hi")}, + UnmarshalOnly: true, // marshals without CDATA + }, + { + ExpectXML: ``, + Value: &DirectChardata{Chardata: string("")}, + }, + { + ExpectXML: ``, + Value: &IndirCDATA{CDATA: stringptr("hi")}, + }, + { + ExpectXML: `hi`, + Value: &IndirCDATA{CDATA: stringptr("hi")}, + UnmarshalOnly: true, // marshals with CDATA + }, + { + ExpectXML: ``, + Value: &IndirCDATA{CDATA: stringptr("")}, + }, + { + ExpectXML: ``, + Value: &IndirCDATA{CDATA: nil}, + MarshalOnly: true, // unmarshal leaves CDATA=stringptr("") + }, + { + ExpectXML: ``, + Value: &IfaceCDATA{CDATA: string("hi")}, + UnmarshalError: "cannot unmarshal into interface {}", + }, + { + ExpectXML: `hi`, + Value: &IfaceCDATA{CDATA: string("hi")}, + UnmarshalOnly: true, // marshals with CDATA + UnmarshalError: "cannot unmarshal into interface {}", + }, + { + ExpectXML: ``, + Value: &IfaceCDATA{CDATA: string("")}, + UnmarshalError: "cannot unmarshal into interface {}", + }, + { + ExpectXML: ``, + Value: &IfaceCDATA{CDATA: nil}, + UnmarshalError: "cannot unmarshal into interface {}", + }, + { + ExpectXML: ``, + Value: &DirectCDATA{CDATA: string("hi")}, + }, + { + ExpectXML: `hi`, + Value: &DirectCDATA{CDATA: string("hi")}, + UnmarshalOnly: true, // marshals with CDATA + }, + { + ExpectXML: ``, + Value: &DirectCDATA{CDATA: string("")}, + }, + { + ExpectXML: ``, + Value: &IndirInnerXML{InnerXML: stringptr("")}, + MarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &IndirInnerXML{InnerXML: stringptr("")}, + MarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &IndirInnerXML{InnerXML: nil}, + }, + { + ExpectXML: ``, + Value: &IndirInnerXML{InnerXML: nil}, + UnmarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &IfaceInnerXML{InnerXML: ""}, + MarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &IfaceInnerXML{InnerXML: nil}, + UnmarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &IfaceInnerXML{InnerXML: nil}, + }, + { + ExpectXML: ``, + Value: &IfaceInnerXML{InnerXML: nil}, + UnmarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &DirectInnerXML{InnerXML: string("")}, + MarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &DirectInnerXML{InnerXML: string("")}, + UnmarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &DirectInnerXML{InnerXML: string("")}, + MarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &DirectInnerXML{InnerXML: string("")}, + UnmarshalOnly: true, + }, + { + ExpectXML: `hi`, + Value: &IndirElement{Element: stringptr("hi")}, + }, + { + ExpectXML: ``, + Value: &IndirElement{Element: stringptr("")}, + }, + { + ExpectXML: ``, + Value: &IndirElement{Element: nil}, + }, + { + ExpectXML: `hi`, + Value: &IfaceElement{Element: "hi"}, + MarshalOnly: true, + }, + { + ExpectXML: `hi`, + Value: &IfaceElement{Element: nil}, + UnmarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &IfaceElement{Element: nil}, + }, + { + ExpectXML: ``, + Value: &IfaceElement{Element: nil}, + UnmarshalOnly: true, + }, + { + ExpectXML: `hi`, + Value: &DirectElement{Element: string("hi")}, + }, + { + ExpectXML: ``, + Value: &DirectElement{Element: string("")}, + }, + { + ExpectXML: `hi`, + Value: &IndirOmitEmpty{OmitEmpty: stringptr("hi")}, + }, + { + // Note: Changed in Go 1.8 to include element (because x.OmitEmpty != nil). + ExpectXML: ``, + Value: &IndirOmitEmpty{OmitEmpty: stringptr("")}, + MarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &IndirOmitEmpty{OmitEmpty: stringptr("")}, + UnmarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &IndirOmitEmpty{OmitEmpty: nil}, + }, + { + ExpectXML: `hi`, + Value: &IfaceOmitEmpty{OmitEmpty: "hi"}, + MarshalOnly: true, + }, + { + ExpectXML: `hi`, + Value: &IfaceOmitEmpty{OmitEmpty: nil}, + UnmarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &IfaceOmitEmpty{OmitEmpty: nil}, + }, + { + ExpectXML: ``, + Value: &IfaceOmitEmpty{OmitEmpty: nil}, + UnmarshalOnly: true, + }, + { + ExpectXML: `hi`, + Value: &DirectOmitEmpty{OmitEmpty: string("hi")}, + }, + { + ExpectXML: ``, + Value: &DirectOmitEmpty{OmitEmpty: string("")}, + }, + { + ExpectXML: `hi`, + Value: &IndirAny{Any: stringptr("hi")}, + }, + { + ExpectXML: ``, + Value: &IndirAny{Any: stringptr("")}, + }, + { + ExpectXML: ``, + Value: &IndirAny{Any: nil}, + }, + { + ExpectXML: `hi`, + Value: &IfaceAny{Any: "hi"}, + MarshalOnly: true, + }, + { + ExpectXML: `hi`, + Value: &IfaceAny{Any: nil}, + UnmarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &IfaceAny{Any: nil}, + }, + { + ExpectXML: ``, + Value: &IfaceAny{Any: nil}, + UnmarshalOnly: true, + }, + { + ExpectXML: `hi`, + Value: &DirectAny{Any: string("hi")}, + }, + { + ExpectXML: ``, + Value: &DirectAny{Any: string("")}, + }, + { + ExpectXML: `hi`, + Value: &IndirAny{Any: stringptr("hi")}, + UnmarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &IndirAny{Any: stringptr("")}, + UnmarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &IndirAny{Any: nil}, + UnmarshalOnly: true, + }, + { + ExpectXML: `hi`, + Value: &IfaceAny{Any: nil}, + UnmarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &IfaceAny{Any: nil}, + UnmarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &IfaceAny{Any: nil}, + UnmarshalOnly: true, + }, + { + ExpectXML: `hi`, + Value: &DirectAny{Any: string("hi")}, + UnmarshalOnly: true, + }, + { + ExpectXML: ``, + Value: &DirectAny{Any: string("")}, + UnmarshalOnly: true, + }, +} + +func TestMarshal(t *testing.T) { + for idx, test := range marshalTests { + if test.UnmarshalOnly { + continue + } + + t.Run(fmt.Sprintf("%d", idx), func(t *testing.T) { + data, err := Marshal(test.Value) + if err != nil { + if test.MarshalError == "" { + t.Errorf("marshal(%#v): %s", test.Value, err) + return + } + if !strings.Contains(err.Error(), test.MarshalError) { + t.Errorf("marshal(%#v): %s, want %q", test.Value, err, test.MarshalError) + } + return + } + if test.MarshalError != "" { + t.Errorf("Marshal succeeded, want error %q", test.MarshalError) + return + } + if got, want := string(data), test.ExpectXML; got != want { + if strings.Contains(want, "\n") { + t.Errorf("marshal(%#v):\nHAVE:\n%s\nWANT:\n%s", test.Value, got, want) + } else { + t.Errorf("marshal(%#v):\nhave %#q\nwant %#q", test.Value, got, want) + } + } + }) + } +} + +type AttrParent struct { + X string `xml:"X>Y,attr"` +} + +type BadAttr struct { + Name map[string]string `xml:"name,attr"` +} + +var marshalErrorTests = []struct { + Value any + Err string + Kind reflect.Kind +}{ + { + Value: make(chan bool), + Err: "xml: unsupported type: chan bool", + Kind: reflect.Chan, + }, + { + Value: map[string]string{ + "question": "What do you get when you multiply six by nine?", + "answer": "42", + }, + Err: "xml: unsupported type: map[string]string", + Kind: reflect.Map, + }, + { + Value: map[*Ship]bool{nil: false}, + Err: "xml: unsupported type: map[*xml.Ship]bool", + Kind: reflect.Map, + }, + { + Value: &Domain{Comment: []byte("f--bar")}, + Err: `xml: comments must not contain "--"`, + }, + // Reject parent chain with attr, never worked; see golang.org/issue/5033. + { + Value: &AttrParent{}, + Err: `xml: X>Y chain not valid with attr flag`, + }, + { + Value: BadAttr{map[string]string{"X": "Y"}}, + Err: `xml: unsupported type: map[string]string`, + }, +} + +var marshalIndentTests = []struct { + Value any + Prefix string + Indent string + ExpectXML string +}{ + { + Value: &SecretAgent{ + Handle: "007", + Identity: "James Bond", + Obfuscate: "", + }, + Prefix: "", + Indent: "\t", + ExpectXML: "\n\tJames Bond\n", + }, +} + +func TestMarshalErrors(t *testing.T) { + for idx, test := range marshalErrorTests { + data, err := Marshal(test.Value) + if err == nil { + t.Errorf("#%d: marshal(%#v) = [success] %q, want error %v", idx, test.Value, data, test.Err) + continue + } + if err.Error() != test.Err { + t.Errorf("#%d: marshal(%#v) = [error] %v, want %v", idx, test.Value, err, test.Err) + } + if test.Kind != reflect.Invalid { + if kind := err.(*UnsupportedTypeError).Type.Kind(); kind != test.Kind { + t.Errorf("#%d: marshal(%#v) = [error kind] %s, want %s", idx, test.Value, kind, test.Kind) + } + } + } +} + +// Do invertibility testing on the various structures that we test +func TestUnmarshal(t *testing.T) { + for i, test := range marshalTests { + if test.MarshalOnly { + continue + } + if _, ok := test.Value.(*Plain); ok { + continue + } + if test.ExpectXML == ``+ + `b`+ + `b1`+ + `` { + // TODO(rogpeppe): re-enable this test in + // https://go-review.googlesource.com/#/c/5910/ + continue + } + + vt := reflect.TypeOf(test.Value) + dest := reflect.New(vt.Elem()).Interface() + err := Unmarshal([]byte(test.ExpectXML), dest) + + t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { + switch fix := dest.(type) { + case *Feed: + fix.Author.InnerXML = "" + for i := range fix.Entry { + fix.Entry[i].Author.InnerXML = "" + } + } + + if err != nil { + if test.UnmarshalError == "" { + t.Errorf("unmarshal(%#v): %s", test.ExpectXML, err) + return + } + if !strings.Contains(err.Error(), test.UnmarshalError) { + t.Errorf("unmarshal(%#v): %s, want %q", test.ExpectXML, err, test.UnmarshalError) + } + return + } + if got, want := dest, test.Value; !reflect.DeepEqual(got, want) { + t.Errorf("unmarshal(%q):\nhave %#v\nwant %#v", test.ExpectXML, got, want) + } + }) + } +} + +func TestMarshalIndent(t *testing.T) { + for i, test := range marshalIndentTests { + data, err := MarshalIndent(test.Value, test.Prefix, test.Indent) + if err != nil { + t.Errorf("#%d: Error: %s", i, err) + continue + } + if got, want := string(data), test.ExpectXML; got != want { + t.Errorf("#%d: MarshalIndent:\nGot:%s\nWant:\n%s", i, got, want) + } + } +} + +type limitedBytesWriter struct { + w io.Writer + remain int // until writes fail +} + +func (lw *limitedBytesWriter) Write(p []byte) (n int, err error) { + if lw.remain <= 0 { + println("error") + return 0, errors.New("write limit hit") + } + if len(p) > lw.remain { + p = p[:lw.remain] + n, _ = lw.w.Write(p) + lw.remain = 0 + return n, errors.New("write limit hit") + } + n, err = lw.w.Write(p) + lw.remain -= n + return n, err +} + +func TestMarshalWriteErrors(t *testing.T) { + var buf bytes.Buffer + const writeCap = 1024 + w := &limitedBytesWriter{&buf, writeCap} + enc := NewEncoder(w) + var err error + var i int + const n = 4000 + for i = 1; i <= n; i++ { + err = enc.Encode(&Passenger{ + Name: []string{"Alice", "Bob"}, + Weight: 5, + }) + if err != nil { + break + } + } + if err == nil { + t.Error("expected an error") + } + if i == n { + t.Errorf("expected to fail before the end") + } + if buf.Len() != writeCap { + t.Errorf("buf.Len() = %d; want %d", buf.Len(), writeCap) + } +} + +func TestMarshalWriteIOErrors(t *testing.T) { + enc := NewEncoder(errWriter{}) + + expectErr := "unwritable" + err := enc.Encode(&Passenger{}) + if err == nil || err.Error() != expectErr { + t.Errorf("EscapeTest = [error] %v, want %v", err, expectErr) + } +} + +func TestMarshalFlush(t *testing.T) { + var buf strings.Builder + enc := NewEncoder(&buf) + if err := enc.EncodeToken(CharData("hello world")); err != nil { + t.Fatalf("enc.EncodeToken: %v", err) + } + if buf.Len() > 0 { + t.Fatalf("enc.EncodeToken caused actual write: %q", buf.String()) + } + if err := enc.Flush(); err != nil { + t.Fatalf("enc.Flush: %v", err) + } + if buf.String() != "hello world" { + t.Fatalf("after enc.Flush, buf.String() = %q, want %q", buf.String(), "hello world") + } +} + +func BenchmarkMarshal(b *testing.B) { + b.ReportAllocs() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + Marshal(atomValue) + } + }) +} + +func BenchmarkUnmarshal(b *testing.B) { + b.ReportAllocs() + xml := []byte(atomXML) + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + Unmarshal(xml, &Feed{}) + } + }) +} + +// golang.org/issue/6556 +func TestStructPointerMarshal(t *testing.T) { + type A struct { + XMLName string `xml:"a"` + B []any + } + type C struct { + XMLName Name + Value string `xml:"value"` + } + + a := new(A) + a.B = append(a.B, &C{ + XMLName: Name{Local: "c"}, + Value: "x", + }) + + b, err := Marshal(a) + if err != nil { + t.Fatal(err) + } + if x := string(b); x != "x" { + t.Fatal(x) + } + var v A + err = Unmarshal(b, &v) + if err != nil { + t.Fatal(err) + } +} + +var encodeTokenTests = []struct { + desc string + toks []Token + want string + err string +}{{ + desc: "start element with name space", + toks: []Token{ + StartElement{Name{"space", "local"}, nil}, + }, + want: ``, +}, { + desc: "start element with no name", + toks: []Token{ + StartElement{Name{"space", ""}, nil}, + }, + err: "xml: start tag with no name", +}, { + desc: "end element with no name", + toks: []Token{ + EndElement{Name{"space", ""}}, + }, + err: "xml: end tag with no name", +}, { + desc: "char data", + toks: []Token{ + CharData("foo"), + }, + want: `foo`, +}, { + desc: "char data with escaped chars", + toks: []Token{ + CharData(" \t\n"), + }, + want: " \n", +}, { + desc: "comment", + toks: []Token{ + Comment("foo"), + }, + want: ``, +}, { + desc: "comment with invalid content", + toks: []Token{ + Comment("foo-->"), + }, + err: "xml: EncodeToken of Comment containing --> marker", +}, { + desc: "proc instruction", + toks: []Token{ + ProcInst{"Target", []byte("Instruction")}, + }, + want: ``, +}, { + desc: "proc instruction with empty target", + toks: []Token{ + ProcInst{"", []byte("Instruction")}, + }, + err: "xml: EncodeToken of ProcInst with invalid Target", +}, { + desc: "proc instruction with bad content", + toks: []Token{ + ProcInst{"", []byte("Instruction?>")}, + }, + err: "xml: EncodeToken of ProcInst with invalid Target", +}, { + desc: "directive", + toks: []Token{ + Directive("foo"), + }, + want: ``, +}, { + desc: "more complex directive", + toks: []Token{ + Directive("DOCTYPE doc [ '> ]"), + }, + want: `'> ]>`, +}, { + desc: "directive instruction with bad name", + toks: []Token{ + Directive("foo>"), + }, + err: "xml: EncodeToken of Directive containing wrong < or > markers", +}, { + desc: "end tag without start tag", + toks: []Token{ + EndElement{Name{"foo", "bar"}}, + }, + err: "xml: end tag without start tag", +}, { + desc: "mismatching end tag local name", + toks: []Token{ + StartElement{Name{"", "foo"}, nil}, + EndElement{Name{"", "bar"}}, + }, + err: "xml: end tag does not match start tag ", + want: ``, +}, { + desc: "mismatching end tag namespace", + toks: []Token{ + StartElement{Name{"space", "foo"}, nil}, + EndElement{Name{"another", "foo"}}, + }, + err: "xml: end tag in namespace another does not match start tag in namespace space", + want: ``, +}, { + desc: "start element with explicit namespace", + toks: []Token{ + StartElement{Name{"space", "local"}, []Attr{ + {Name{"xmlns", "x"}, "space"}, + {Name{"space", "foo"}, "value"}, + }}, + }, + want: ``, +}, { + desc: "start element with explicit namespace and colliding prefix", + toks: []Token{ + StartElement{Name{"space", "local"}, []Attr{ + {Name{"xmlns", "x"}, "space"}, + {Name{"space", "foo"}, "value"}, + {Name{"x", "bar"}, "other"}, + }}, + }, + want: ``, +}, { + desc: "start element using previously defined namespace", + toks: []Token{ + StartElement{Name{"", "local"}, []Attr{ + {Name{"xmlns", "x"}, "space"}, + }}, + StartElement{Name{"space", "foo"}, []Attr{ + {Name{"space", "x"}, "y"}, + }}, + }, + want: ``, +}, { + desc: "nested name space with same prefix", + toks: []Token{ + StartElement{Name{"", "foo"}, []Attr{ + {Name{"xmlns", "x"}, "space1"}, + }}, + StartElement{Name{"", "foo"}, []Attr{ + {Name{"xmlns", "x"}, "space2"}, + }}, + StartElement{Name{"", "foo"}, []Attr{ + {Name{"space1", "a"}, "space1 value"}, + {Name{"space2", "b"}, "space2 value"}, + }}, + EndElement{Name{"", "foo"}}, + EndElement{Name{"", "foo"}}, + StartElement{Name{"", "foo"}, []Attr{ + {Name{"space1", "a"}, "space1 value"}, + {Name{"space2", "b"}, "space2 value"}, + }}, + }, + want: ``, +}, { + desc: "start element defining several prefixes for the same name space", + toks: []Token{ + StartElement{Name{"space", "foo"}, []Attr{ + {Name{"xmlns", "a"}, "space"}, + {Name{"xmlns", "b"}, "space"}, + {Name{"space", "x"}, "value"}, + }}, + }, + want: ``, +}, { + desc: "nested element redefines name space", + toks: []Token{ + StartElement{Name{"", "foo"}, []Attr{ + {Name{"xmlns", "x"}, "space"}, + }}, + StartElement{Name{"space", "foo"}, []Attr{ + {Name{"xmlns", "y"}, "space"}, + {Name{"space", "a"}, "value"}, + }}, + }, + want: ``, +}, { + desc: "nested element creates alias for default name space", + toks: []Token{ + StartElement{Name{"space", "foo"}, []Attr{ + {Name{"", "xmlns"}, "space"}, + }}, + StartElement{Name{"space", "foo"}, []Attr{ + {Name{"xmlns", "y"}, "space"}, + {Name{"space", "a"}, "value"}, + }}, + }, + want: ``, +}, { + desc: "nested element defines default name space with existing prefix", + toks: []Token{ + StartElement{Name{"", "foo"}, []Attr{ + {Name{"xmlns", "x"}, "space"}, + }}, + StartElement{Name{"space", "foo"}, []Attr{ + {Name{"", "xmlns"}, "space"}, + {Name{"space", "a"}, "value"}, + }}, + }, + want: ``, +}, { + desc: "nested element uses empty attribute name space when default ns defined", + toks: []Token{ + StartElement{Name{"space", "foo"}, []Attr{ + {Name{"", "xmlns"}, "space"}, + }}, + StartElement{Name{"space", "foo"}, []Attr{ + {Name{"", "attr"}, "value"}, + }}, + }, + want: ``, +}, { + desc: "redefine xmlns", + toks: []Token{ + StartElement{Name{"", "foo"}, []Attr{ + {Name{"foo", "xmlns"}, "space"}, + }}, + }, + want: ``, +}, { + desc: "xmlns with explicit name space #1", + toks: []Token{ + StartElement{Name{"space", "foo"}, []Attr{ + {Name{"xml", "xmlns"}, "space"}, + }}, + }, + want: ``, +}, { + desc: "xmlns with explicit name space #2", + toks: []Token{ + StartElement{Name{"space", "foo"}, []Attr{ + {Name{xmlURL, "xmlns"}, "space"}, + }}, + }, + want: ``, +}, { + desc: "empty name space declaration is ignored", + toks: []Token{ + StartElement{Name{"", "foo"}, []Attr{ + {Name{"xmlns", "foo"}, ""}, + }}, + }, + want: ``, +}, { + desc: "attribute with no name is ignored", + toks: []Token{ + StartElement{Name{"", "foo"}, []Attr{ + {Name{"", ""}, "value"}, + }}, + }, + want: ``, +}, { + desc: "namespace URL with non-valid name", + toks: []Token{ + StartElement{Name{"/34", "foo"}, []Attr{ + {Name{"/34", "x"}, "value"}, + }}, + }, + want: ``, +}, { + desc: "nested element resets default namespace to empty", + toks: []Token{ + StartElement{Name{"space", "foo"}, []Attr{ + {Name{"", "xmlns"}, "space"}, + }}, + StartElement{Name{"", "foo"}, []Attr{ + {Name{"", "xmlns"}, ""}, + {Name{"", "x"}, "value"}, + {Name{"space", "x"}, "value"}, + }}, + }, + want: ``, +}, { + desc: "nested element requires empty default name space", + toks: []Token{ + StartElement{Name{"space", "foo"}, []Attr{ + {Name{"", "xmlns"}, "space"}, + }}, + StartElement{Name{"", "foo"}, nil}, + }, + want: ``, +}, { + desc: "attribute uses name space from xmlns", + toks: []Token{ + StartElement{Name{"some/space", "foo"}, []Attr{ + {Name{"", "attr"}, "value"}, + {Name{"some/space", "other"}, "other value"}, + }}, + }, + want: ``, +}, { + desc: "default name space should not be used by attributes", + toks: []Token{ + StartElement{Name{"space", "foo"}, []Attr{ + {Name{"", "xmlns"}, "space"}, + {Name{"xmlns", "bar"}, "space"}, + {Name{"space", "baz"}, "foo"}, + }}, + StartElement{Name{"space", "baz"}, nil}, + EndElement{Name{"space", "baz"}}, + EndElement{Name{"space", "foo"}}, + }, + want: ``, +}, { + desc: "default name space not used by attributes, not explicitly defined", + toks: []Token{ + StartElement{Name{"space", "foo"}, []Attr{ + {Name{"", "xmlns"}, "space"}, + {Name{"space", "baz"}, "foo"}, + }}, + StartElement{Name{"space", "baz"}, nil}, + EndElement{Name{"space", "baz"}}, + EndElement{Name{"space", "foo"}}, + }, + want: ``, +}, { + desc: "impossible xmlns declaration", + toks: []Token{ + StartElement{Name{"", "foo"}, []Attr{ + {Name{"", "xmlns"}, "space"}, + }}, + StartElement{Name{"space", "bar"}, []Attr{ + {Name{"space", "attr"}, "value"}, + }}, + }, + want: ``, +}, { + desc: "reserved namespace prefix -- all lower case", + toks: []Token{ + StartElement{Name{"", "foo"}, []Attr{ + {Name{"http://www.w3.org/2001/xmlSchema-instance", "nil"}, "true"}, + }}, + }, + want: ``, +}, { + desc: "reserved namespace prefix -- all upper case", + toks: []Token{ + StartElement{Name{"", "foo"}, []Attr{ + {Name{"http://www.w3.org/2001/XMLSchema-instance", "nil"}, "true"}, + }}, + }, + want: ``, +}, { + desc: "reserved namespace prefix -- all mixed case", + toks: []Token{ + StartElement{Name{"", "foo"}, []Attr{ + {Name{"http://www.w3.org/2001/XmLSchema-instance", "nil"}, "true"}, + }}, + }, + want: ``, +}} + +func TestEncodeToken(t *testing.T) { +loop: + for i, tt := range encodeTokenTests { + var buf strings.Builder + enc := NewEncoder(&buf) + var err error + for j, tok := range tt.toks { + err = enc.EncodeToken(tok) + if err != nil && j < len(tt.toks)-1 { + t.Errorf("#%d %s token #%d: %v", i, tt.desc, j, err) + continue loop + } + } + errorf := func(f string, a ...any) { + t.Errorf("#%d %s token #%d:%s", i, tt.desc, len(tt.toks)-1, fmt.Sprintf(f, a...)) + } + switch { + case tt.err != "" && err == nil: + errorf(" expected error; got none") + continue + case tt.err == "" && err != nil: + errorf(" got error: %v", err) + continue + case tt.err != "" && err != nil && tt.err != err.Error(): + errorf(" error mismatch; got %v, want %v", err, tt.err) + continue + } + if err := enc.Flush(); err != nil { + errorf(" %v", err) + continue + } + if got := buf.String(); got != tt.want { + errorf("\ngot %v\nwant %v", got, tt.want) + continue + } + } +} + +func TestProcInstEncodeToken(t *testing.T) { + var buf bytes.Buffer + enc := NewEncoder(&buf) + + if err := enc.EncodeToken(ProcInst{"xml", []byte("Instruction")}); err != nil { + t.Fatalf("enc.EncodeToken: expected to be able to encode xml target ProcInst as first token, %s", err) + } + + if err := enc.EncodeToken(ProcInst{"Target", []byte("Instruction")}); err != nil { + t.Fatalf("enc.EncodeToken: expected to be able to add non-xml target ProcInst") + } + + if err := enc.EncodeToken(ProcInst{"xml", []byte("Instruction")}); err == nil { + t.Fatalf("enc.EncodeToken: expected to not be allowed to encode xml target ProcInst when not first token") + } +} + +func TestDecodeEncode(t *testing.T) { + var in, out bytes.Buffer + in.WriteString(` + + + +`) + dec := NewDecoder(&in) + enc := NewEncoder(&out) + for tok, err := dec.Token(); err == nil; tok, err = dec.Token() { + err = enc.EncodeToken(tok) + if err != nil { + t.Fatalf("enc.EncodeToken: Unable to encode token (%#v), %v", tok, err) + } + } +} + +// Issue 9796. Used to fail with GORACE="halt_on_error=1" -race. +func TestRace9796(t *testing.T) { + type A struct{} + type B struct { + C []A `xml:"X>Y"` + } + var wg sync.WaitGroup + for i := 0; i < 2; i++ { + wg.Add(1) + go func() { + Marshal(B{[]A{{}}}) + wg.Done() + }() + } + wg.Wait() +} + +func TestIsValidDirective(t *testing.T) { + testOK := []string{ + "<>", + "< < > >", + "' '>' >", + " ]>", + " '<' ' doc ANY> ]>", + ">>> a < comment --> [ ] >", + } + testKO := []string{ + "<", + ">", + "", + "< > > < < >", + " -->", + "", + "'", + "", + } + for _, s := range testOK { + if !isValidDirective(Directive(s)) { + t.Errorf("Directive %q is expected to be valid", s) + } + } + for _, s := range testKO { + if isValidDirective(Directive(s)) { + t.Errorf("Directive %q is expected to be invalid", s) + } + } +} + +// Issue 11719. EncodeToken used to silently eat tokens with an invalid type. +func TestSimpleUseOfEncodeToken(t *testing.T) { + var buf strings.Builder + enc := NewEncoder(&buf) + if err := enc.EncodeToken(&StartElement{Name: Name{"", "object1"}}); err == nil { + t.Errorf("enc.EncodeToken: pointer type should be rejected") + } + if err := enc.EncodeToken(&EndElement{Name: Name{"", "object1"}}); err == nil { + t.Errorf("enc.EncodeToken: pointer type should be rejected") + } + if err := enc.EncodeToken(StartElement{Name: Name{"", "object2"}}); err != nil { + t.Errorf("enc.EncodeToken: StartElement %s", err) + } + if err := enc.EncodeToken(EndElement{Name: Name{"", "object2"}}); err != nil { + t.Errorf("enc.EncodeToken: EndElement %s", err) + } + if err := enc.EncodeToken(Universe{}); err == nil { + t.Errorf("enc.EncodeToken: invalid type not caught") + } + if err := enc.Flush(); err != nil { + t.Errorf("enc.Flush: %s", err) + } + if buf.Len() == 0 { + t.Errorf("enc.EncodeToken: empty buffer") + } + want := "" + if buf.String() != want { + t.Errorf("enc.EncodeToken: expected %q; got %q", want, buf.String()) + } +} + +// Issue 16158. Decoder.unmarshalAttr ignores the return value of copyValue. +func TestIssue16158(t *testing.T) { + const data = `` + err := Unmarshal([]byte(data), &struct { + B byte `xml:"b,attr,omitempty"` + }{}) + if err == nil { + t.Errorf("Unmarshal: expected error, got nil") + } +} + +// Issue 20953. Crash on invalid XMLName attribute. + +type InvalidXMLName struct { + XMLName Name `xml:"error"` + Type struct { + XMLName Name `xml:"type,attr"` + } +} + +func TestInvalidXMLName(t *testing.T) { + var buf bytes.Buffer + enc := NewEncoder(&buf) + if err := enc.Encode(InvalidXMLName{}); err == nil { + t.Error("unexpected success") + } else if want := "invalid tag"; !strings.Contains(err.Error(), want) { + t.Errorf("error %q does not contain %q", err, want) + } +} + +// Issue 50164. Crash on zero value XML attribute. +type LayerOne struct { + XMLName Name `xml:"l1"` + + Value *float64 `xml:"value,omitempty"` + *LayerTwo `xml:",omitempty"` +} + +type LayerTwo struct { + ValueTwo *int `xml:"value_two,attr,omitempty"` +} + +func TestMarshalZeroValue(t *testing.T) { + proofXml := `1.2345` + var l1 LayerOne + err := Unmarshal([]byte(proofXml), &l1) + if err != nil { + t.Fatalf("unmarshal XML error: %v", err) + } + want := float64(1.2345) + got := *l1.Value + if got != want { + t.Fatalf("unexpected unmarshal result, want %f but got %f", want, got) + } + + // Marshal again (or Encode again) + // In issue 50164, here `Marshal(l1)` will panic because of the zero value of xml attribute ValueTwo `value_two`. + anotherXML, err := Marshal(l1) + if err != nil { + t.Fatalf("marshal XML error: %v", err) + } + if string(anotherXML) != proofXml { + t.Fatalf("unexpected unmarshal result, want %q but got %q", proofXml, anotherXML) + } +} + +var closeTests = []struct { + desc string + toks []Token + want string + err string +}{{ + desc: "unclosed start element", + toks: []Token{ + StartElement{Name{"", "foo"}, nil}, + }, + want: ``, + err: "unclosed tag ", +}, { + desc: "closed element", + toks: []Token{ + StartElement{Name{"", "foo"}, nil}, + EndElement{Name{"", "foo"}}, + }, + want: ``, +}, { + desc: "directive", + toks: []Token{ + Directive("foo"), + }, + want: ``, +}} + +func TestClose(t *testing.T) { + for _, tt := range closeTests { + t.Run(tt.desc, func(t *testing.T) { + var out strings.Builder + enc := NewEncoder(&out) + for j, tok := range tt.toks { + if err := enc.EncodeToken(tok); err != nil { + t.Fatalf("token #%d: %v", j, err) + } + } + err := enc.Close() + switch { + case tt.err != "" && err == nil: + t.Error(" expected error; got none") + case tt.err == "" && err != nil: + t.Errorf(" got error: %v", err) + case tt.err != "" && err != nil && tt.err != err.Error(): + t.Errorf(" error mismatch; got %v, want %v", err, tt.err) + } + if got := out.String(); got != tt.want { + t.Errorf("\ngot %v\nwant %v", got, tt.want) + } + t.Log(enc.p.closed) + if err := enc.EncodeToken(Directive("foo")); err == nil { + t.Errorf("unexpected success when encoding after Close") + } + }) + } +} diff --git a/go/src/encoding/xml/read.go b/go/src/encoding/xml/read.go new file mode 100644 index 0000000000000000000000000000000000000000..d3cb74b2c4311ae11dd57ef99c1c181023d812af --- /dev/null +++ b/go/src/encoding/xml/read.go @@ -0,0 +1,792 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package xml + +import ( + "bytes" + "encoding" + "errors" + "fmt" + "reflect" + "runtime" + "strconv" + "strings" +) + +// BUG(rsc): Mapping between XML elements and data structures is inherently flawed: +// an XML element is an order-dependent collection of anonymous +// values, while a data structure is an order-independent collection +// of named values. +// See [encoding/json] for a textual representation more suitable +// to data structures. + +// Unmarshal parses the XML-encoded data and stores the result in +// the value pointed to by v, which must be an arbitrary struct, +// slice, or string. Well-formed data that does not fit into v is +// discarded. +// +// Because Unmarshal uses the reflect package, it can only assign +// to exported (upper case) fields. Unmarshal uses a case-sensitive +// comparison to match XML element names to tag values and struct +// field names. +// +// Unmarshal maps an XML element to a struct using the following rules. +// In the rules, the tag of a field refers to the value associated with the +// key 'xml' in the struct field's tag (see the example above). +// +// - If the struct has a field of type []byte or string with tag +// ",innerxml", Unmarshal accumulates the raw XML nested inside the +// element in that field. The rest of the rules still apply. +// +// - If the struct has a field named XMLName of type Name, +// Unmarshal records the element name in that field. +// +// - If the XMLName field has an associated tag of the form +// "name" or "namespace-URL name", the XML element must have +// the given name (and, optionally, name space) or else Unmarshal +// returns an error. +// +// - If the XML element has an attribute whose name matches a +// struct field name with an associated tag containing ",attr" or +// the explicit name in a struct field tag of the form "name,attr", +// Unmarshal records the attribute value in that field. +// +// - If the XML element has an attribute not handled by the previous +// rule and the struct has a field with an associated tag containing +// ",any,attr", Unmarshal records the attribute value in the first +// such field. +// +// - If the XML element contains character data, that data is +// accumulated in the first struct field that has tag ",chardata". +// The struct field may have type []byte or string. +// If there is no such field, the character data is discarded. +// +// - If the XML element contains comments, they are accumulated in +// the first struct field that has tag ",comment". The struct +// field may have type []byte or string. If there is no such +// field, the comments are discarded. +// +// - If the XML element contains a sub-element whose name matches +// the prefix of a tag formatted as "a" or "a>b>c", unmarshal +// will descend into the XML structure looking for elements with the +// given names, and will map the innermost elements to that struct +// field. A tag starting with ">" is equivalent to one starting +// with the field name followed by ">". +// +// - If the XML element contains a sub-element whose name matches +// a struct field's XMLName tag and the struct field has no +// explicit name tag as per the previous rule, unmarshal maps +// the sub-element to that struct field. +// +// - If the XML element contains a sub-element whose name matches a +// field without any mode flags (",attr", ",chardata", etc), Unmarshal +// maps the sub-element to that struct field. +// +// - If the XML element contains a sub-element that hasn't matched any +// of the above rules and the struct has a field with tag ",any", +// unmarshal maps the sub-element to that struct field. +// +// - An anonymous struct field is handled as if the fields of its +// value were part of the outer struct. +// +// - A struct field with tag "-" is never unmarshaled into. +// +// If Unmarshal encounters a field type that implements the Unmarshaler +// interface, Unmarshal calls its UnmarshalXML method to produce the value from +// the XML element. Otherwise, if the value implements +// [encoding.TextUnmarshaler], Unmarshal calls that value's UnmarshalText method. +// +// Unmarshal maps an XML element to a string or []byte by saving the +// concatenation of that element's character data in the string or +// []byte. The saved []byte is never nil. +// +// Unmarshal maps an attribute value to a string or []byte by saving +// the value in the string or slice. +// +// Unmarshal maps an attribute value to an [Attr] by saving the attribute, +// including its name, in the Attr. +// +// Unmarshal maps an XML element or attribute value to a slice by +// extending the length of the slice and mapping the element or attribute +// to the newly created value. +// +// Unmarshal maps an XML element or attribute value to a bool by +// setting it to the boolean value represented by the string. Whitespace +// is trimmed and ignored. +// +// Unmarshal maps an XML element or attribute value to an integer or +// floating-point field by setting the field to the result of +// interpreting the string value in decimal. There is no check for +// overflow. Whitespace is trimmed and ignored. +// +// Unmarshal maps an XML element to a Name by recording the element +// name. +// +// Unmarshal maps an XML element to a pointer by setting the pointer +// to a freshly allocated value and then mapping the element to that value. +// +// A missing element or empty attribute value will be unmarshaled as a zero value. +// If the field is a slice, a zero value will be appended to the field. Otherwise, the +// field will be set to its zero value. +func Unmarshal(data []byte, v any) error { + return NewDecoder(bytes.NewReader(data)).Decode(v) +} + +// Decode works like [Unmarshal], except it reads the decoder +// stream to find the start element. +func (d *Decoder) Decode(v any) error { + return d.DecodeElement(v, nil) +} + +// DecodeElement works like [Unmarshal] except that it takes +// a pointer to the start XML element to decode into v. +// It is useful when a client reads some raw XML tokens itself +// but also wants to defer to [Unmarshal] for some elements. +func (d *Decoder) DecodeElement(v any, start *StartElement) error { + val := reflect.ValueOf(v) + if val.Kind() != reflect.Pointer { + return errors.New("non-pointer passed to Unmarshal") + } + + if val.IsNil() { + return errors.New("nil pointer passed to Unmarshal") + } + return d.unmarshal(val.Elem(), start, 0) +} + +// An UnmarshalError represents an error in the unmarshaling process. +type UnmarshalError string + +func (e UnmarshalError) Error() string { return string(e) } + +// Unmarshaler is the interface implemented by objects that can unmarshal +// an XML element description of themselves. +// +// UnmarshalXML decodes a single XML element +// beginning with the given start element. +// If it returns an error, the outer call to Unmarshal stops and +// returns that error. +// UnmarshalXML must consume exactly one XML element. +// One common implementation strategy is to unmarshal into +// a separate value with a layout matching the expected XML +// using d.DecodeElement, and then to copy the data from +// that value into the receiver. +// Another common strategy is to use d.Token to process the +// XML object one token at a time. +// UnmarshalXML may not use d.RawToken. +type Unmarshaler interface { + UnmarshalXML(d *Decoder, start StartElement) error +} + +// UnmarshalerAttr is the interface implemented by objects that can unmarshal +// an XML attribute description of themselves. +// +// UnmarshalXMLAttr decodes a single XML attribute. +// If it returns an error, the outer call to [Unmarshal] stops and +// returns that error. +// UnmarshalXMLAttr is used only for struct fields with the +// "attr" option in the field tag. +type UnmarshalerAttr interface { + UnmarshalXMLAttr(attr Attr) error +} + +// receiverType returns the receiver type to use in an expression like "%s.MethodName". +func receiverType(val any) string { + t := reflect.TypeOf(val) + if t.Name() != "" { + return t.String() + } + return "(" + t.String() + ")" +} + +// unmarshalInterface unmarshals a single XML element into val. +// start is the opening tag of the element. +func (d *Decoder) unmarshalInterface(val Unmarshaler, start *StartElement) error { + // Record that decoder must stop at end tag corresponding to start. + d.pushEOF() + + d.unmarshalDepth++ + err := val.UnmarshalXML(d, *start) + d.unmarshalDepth-- + if err != nil { + d.popEOF() + return err + } + + if !d.popEOF() { + return fmt.Errorf("xml: %s.UnmarshalXML did not consume entire <%s> element", receiverType(val), start.Name.Local) + } + + return nil +} + +// unmarshalTextInterface unmarshals a single XML element into val. +// The chardata contained in the element (but not its children) +// is passed to the text unmarshaler. +func (d *Decoder) unmarshalTextInterface(val encoding.TextUnmarshaler) error { + var buf []byte + depth := 1 + for depth > 0 { + t, err := d.Token() + if err != nil { + return err + } + switch t := t.(type) { + case CharData: + if depth == 1 { + buf = append(buf, t...) + } + case StartElement: + depth++ + case EndElement: + depth-- + } + } + return val.UnmarshalText(buf) +} + +// unmarshalAttr unmarshals a single XML attribute into val. +func (d *Decoder) unmarshalAttr(val reflect.Value, attr Attr) error { + if val.Kind() == reflect.Pointer { + if val.IsNil() { + val.Set(reflect.New(val.Type().Elem())) + } + val = val.Elem() + } + if val.CanInterface() { + // This is an unmarshaler with a non-pointer receiver, + // so it's likely to be incorrect, but we do what we're told. + if unmarshaler, ok := reflect.TypeAssert[UnmarshalerAttr](val); ok { + return unmarshaler.UnmarshalXMLAttr(attr) + } + } + if val.CanAddr() { + pv := val.Addr() + if pv.CanInterface() { + if unmarshaler, ok := reflect.TypeAssert[UnmarshalerAttr](pv); ok { + return unmarshaler.UnmarshalXMLAttr(attr) + } + } + } + + // Not an UnmarshalerAttr; try encoding.TextUnmarshaler. + if val.CanInterface() { + // This is an unmarshaler with a non-pointer receiver, + // so it's likely to be incorrect, but we do what we're told. + if textUnmarshaler, ok := reflect.TypeAssert[encoding.TextUnmarshaler](val); ok { + return textUnmarshaler.UnmarshalText([]byte(attr.Value)) + } + } + if val.CanAddr() { + pv := val.Addr() + if pv.CanInterface() { + if textUnmarshaler, ok := reflect.TypeAssert[encoding.TextUnmarshaler](pv); ok { + return textUnmarshaler.UnmarshalText([]byte(attr.Value)) + } + } + } + + if val.Kind() == reflect.Slice && val.Type().Elem().Kind() != reflect.Uint8 { + // Slice of element values. + // Grow slice. + n := val.Len() + val.Grow(1) + val.SetLen(n + 1) + + // Recur to read element into slice. + if err := d.unmarshalAttr(val.Index(n), attr); err != nil { + val.SetLen(n) + return err + } + return nil + } + + if val.Type() == attrType { + val.Set(reflect.ValueOf(attr)) + return nil + } + + return copyValue(val, []byte(attr.Value)) +} + +var attrType = reflect.TypeFor[Attr]() + +const ( + maxUnmarshalDepth = 10000 + maxUnmarshalDepthWasm = 5000 // go.dev/issue/56498 +) + +var errUnmarshalDepth = errors.New("exceeded max depth") + +// Unmarshal a single XML element into val. +func (d *Decoder) unmarshal(val reflect.Value, start *StartElement, depth int) error { + if depth >= maxUnmarshalDepth || runtime.GOARCH == "wasm" && depth >= maxUnmarshalDepthWasm { + return errUnmarshalDepth + } + // Find start element if we need it. + if start == nil { + for { + tok, err := d.Token() + if err != nil { + return err + } + if t, ok := tok.(StartElement); ok { + start = &t + break + } + } + } + + // Load value from interface, but only if the result will be + // usefully addressable. + if val.Kind() == reflect.Interface && !val.IsNil() { + e := val.Elem() + if e.Kind() == reflect.Pointer && !e.IsNil() { + val = e + } + } + + if val.Kind() == reflect.Pointer { + if val.IsNil() { + val.Set(reflect.New(val.Type().Elem())) + } + val = val.Elem() + } + + if val.CanInterface() { + // This is an unmarshaler with a non-pointer receiver, + // so it's likely to be incorrect, but we do what we're told. + if unmarshaler, ok := reflect.TypeAssert[Unmarshaler](val); ok { + return d.unmarshalInterface(unmarshaler, start) + } + } + + if val.CanAddr() { + pv := val.Addr() + if pv.CanInterface() { + if unmarshaler, ok := reflect.TypeAssert[Unmarshaler](pv); ok { + return d.unmarshalInterface(unmarshaler, start) + } + } + } + + if val.CanInterface() { + if textUnmarshaler, ok := reflect.TypeAssert[encoding.TextUnmarshaler](val); ok { + return d.unmarshalTextInterface(textUnmarshaler) + } + } + + if val.CanAddr() { + pv := val.Addr() + if pv.CanInterface() { + if textUnmarshaler, ok := reflect.TypeAssert[encoding.TextUnmarshaler](pv); ok { + return d.unmarshalTextInterface(textUnmarshaler) + } + } + } + + var ( + data []byte + saveData reflect.Value + comment []byte + saveComment reflect.Value + saveXML reflect.Value + saveXMLIndex int + saveXMLData []byte + saveAny reflect.Value + sv reflect.Value + tinfo *typeInfo + err error + ) + + switch v := val; v.Kind() { + default: + return errors.New("unknown type " + v.Type().String()) + + case reflect.Interface: + // TODO: For now, simply ignore the field. In the near + // future we may choose to unmarshal the start + // element on it, if not nil. + return d.Skip() + + case reflect.Slice: + typ := v.Type() + if typ.Elem().Kind() == reflect.Uint8 { + // []byte + saveData = v + break + } + + // Slice of element values. + // Grow slice. + n := v.Len() + v.Grow(1) + v.SetLen(n + 1) + + // Recur to read element into slice. + if err := d.unmarshal(v.Index(n), start, depth+1); err != nil { + v.SetLen(n) + return err + } + return nil + + case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.String: + saveData = v + + case reflect.Struct: + typ := v.Type() + if typ == nameType { + v.Set(reflect.ValueOf(start.Name)) + break + } + + sv = v + tinfo, err = getTypeInfo(typ) + if err != nil { + return err + } + + // Validate and assign element name. + if tinfo.xmlname != nil { + finfo := tinfo.xmlname + if finfo.name != "" && finfo.name != start.Name.Local { + return UnmarshalError("expected element type <" + finfo.name + "> but have <" + start.Name.Local + ">") + } + if finfo.xmlns != "" && finfo.xmlns != start.Name.Space { + e := "expected element <" + finfo.name + "> in name space " + finfo.xmlns + " but have " + if start.Name.Space == "" { + e += "no name space" + } else { + e += start.Name.Space + } + return UnmarshalError(e) + } + fv := finfo.value(sv, initNilPointers) + if _, ok := reflect.TypeAssert[Name](fv); ok { + fv.Set(reflect.ValueOf(start.Name)) + } + } + + // Assign attributes. + for _, a := range start.Attr { + handled := false + any := -1 + for i := range tinfo.fields { + finfo := &tinfo.fields[i] + switch finfo.flags & fMode { + case fAttr: + strv := finfo.value(sv, initNilPointers) + if a.Name.Local == finfo.name && (finfo.xmlns == "" || finfo.xmlns == a.Name.Space) { + if err := d.unmarshalAttr(strv, a); err != nil { + return err + } + handled = true + } + + case fAny | fAttr: + if any == -1 { + any = i + } + } + } + if !handled && any >= 0 { + finfo := &tinfo.fields[any] + strv := finfo.value(sv, initNilPointers) + if err := d.unmarshalAttr(strv, a); err != nil { + return err + } + } + } + + // Determine whether we need to save character data or comments. + for i := range tinfo.fields { + finfo := &tinfo.fields[i] + switch finfo.flags & fMode { + case fCDATA, fCharData: + if !saveData.IsValid() { + saveData = finfo.value(sv, initNilPointers) + } + + case fComment: + if !saveComment.IsValid() { + saveComment = finfo.value(sv, initNilPointers) + } + + case fAny, fAny | fElement: + if !saveAny.IsValid() { + saveAny = finfo.value(sv, initNilPointers) + } + + case fInnerXML: + if !saveXML.IsValid() { + saveXML = finfo.value(sv, initNilPointers) + if d.saved == nil { + saveXMLIndex = 0 + d.saved = new(bytes.Buffer) + } else { + saveXMLIndex = d.savedOffset() + } + } + } + } + } + + // Find end element. + // Process sub-elements along the way. +Loop: + for { + var savedOffset int + if saveXML.IsValid() { + savedOffset = d.savedOffset() + } + tok, err := d.Token() + if err != nil { + return err + } + switch t := tok.(type) { + case StartElement: + consumed := false + if sv.IsValid() { + // unmarshalPath can call unmarshal, so we need to pass the depth through so that + // we can continue to enforce the maximum recursion limit. + consumed, err = d.unmarshalPath(tinfo, sv, nil, &t, depth) + if err != nil { + return err + } + if !consumed && saveAny.IsValid() { + consumed = true + if err := d.unmarshal(saveAny, &t, depth+1); err != nil { + return err + } + } + } + if !consumed { + if err := d.Skip(); err != nil { + return err + } + } + + case EndElement: + if saveXML.IsValid() { + saveXMLData = d.saved.Bytes()[saveXMLIndex:savedOffset] + if saveXMLIndex == 0 { + d.saved = nil + } + } + break Loop + + case CharData: + if saveData.IsValid() { + data = append(data, t...) + } + + case Comment: + if saveComment.IsValid() { + comment = append(comment, t...) + } + } + } + + if saveData.IsValid() && saveData.CanInterface() { + if textUnmarshaler, ok := reflect.TypeAssert[encoding.TextUnmarshaler](saveData); ok { + if err := textUnmarshaler.UnmarshalText(data); err != nil { + return err + } + saveData = reflect.Value{} + } + } + + if saveData.IsValid() && saveData.CanAddr() { + pv := saveData.Addr() + if pv.CanInterface() { + if textUnmarshaler, ok := reflect.TypeAssert[encoding.TextUnmarshaler](pv); ok { + if err := textUnmarshaler.UnmarshalText(data); err != nil { + return err + } + saveData = reflect.Value{} + } + } + } + + if err := copyValue(saveData, data); err != nil { + return err + } + + switch t := saveComment; t.Kind() { + case reflect.String: + t.SetString(string(comment)) + case reflect.Slice: + t.Set(reflect.ValueOf(comment)) + } + + switch t := saveXML; t.Kind() { + case reflect.String: + t.SetString(string(saveXMLData)) + case reflect.Slice: + if t.Type().Elem().Kind() == reflect.Uint8 { + t.Set(reflect.ValueOf(saveXMLData)) + } + } + + return nil +} + +func copyValue(dst reflect.Value, src []byte) (err error) { + dst0 := dst + + if dst.Kind() == reflect.Pointer { + if dst.IsNil() { + dst.Set(reflect.New(dst.Type().Elem())) + } + dst = dst.Elem() + } + + // Save accumulated data. + switch dst.Kind() { + case reflect.Invalid: + // Probably a comment. + default: + return errors.New("cannot unmarshal into " + dst0.Type().String()) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + if len(src) == 0 { + dst.SetInt(0) + return nil + } + itmp, err := strconv.ParseInt(strings.TrimSpace(string(src)), 10, dst.Type().Bits()) + if err != nil { + return err + } + dst.SetInt(itmp) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + if len(src) == 0 { + dst.SetUint(0) + return nil + } + utmp, err := strconv.ParseUint(strings.TrimSpace(string(src)), 10, dst.Type().Bits()) + if err != nil { + return err + } + dst.SetUint(utmp) + case reflect.Float32, reflect.Float64: + if len(src) == 0 { + dst.SetFloat(0) + return nil + } + ftmp, err := strconv.ParseFloat(strings.TrimSpace(string(src)), dst.Type().Bits()) + if err != nil { + return err + } + dst.SetFloat(ftmp) + case reflect.Bool: + if len(src) == 0 { + dst.SetBool(false) + return nil + } + value, err := strconv.ParseBool(strings.TrimSpace(string(src))) + if err != nil { + return err + } + dst.SetBool(value) + case reflect.String: + dst.SetString(string(src)) + case reflect.Slice: + if len(src) == 0 { + // non-nil to flag presence + src = []byte{} + } + dst.SetBytes(src) + } + return nil +} + +// unmarshalPath walks down an XML structure looking for wanted +// paths, and calls unmarshal on them. +// The consumed result tells whether XML elements have been consumed +// from the Decoder until start's matching end element, or if it's +// still untouched because start is uninteresting for sv's fields. +func (d *Decoder) unmarshalPath(tinfo *typeInfo, sv reflect.Value, parents []string, start *StartElement, depth int) (consumed bool, err error) { + recurse := false +Loop: + for i := range tinfo.fields { + finfo := &tinfo.fields[i] + if finfo.flags&fElement == 0 || len(finfo.parents) < len(parents) || finfo.xmlns != "" && finfo.xmlns != start.Name.Space { + continue + } + for j := range parents { + if parents[j] != finfo.parents[j] { + continue Loop + } + } + if len(finfo.parents) == len(parents) && finfo.name == start.Name.Local { + // It's a perfect match, unmarshal the field. + return true, d.unmarshal(finfo.value(sv, initNilPointers), start, depth+1) + } + if len(finfo.parents) > len(parents) && finfo.parents[len(parents)] == start.Name.Local { + // It's a prefix for the field. Break and recurse + // since it's not ok for one field path to be itself + // the prefix for another field path. + recurse = true + + // We can reuse the same slice as long as we + // don't try to append to it. + parents = finfo.parents[:len(parents)+1] + break + } + } + if !recurse { + // We have no business with this element. + return false, nil + } + // The element is not a perfect match for any field, but one + // or more fields have the path to this element as a parent + // prefix. Recurse and attempt to match these. + for { + var tok Token + tok, err = d.Token() + if err != nil { + return true, err + } + switch t := tok.(type) { + case StartElement: + // the recursion depth of unmarshalPath is limited to the path length specified + // by the struct field tag, so we don't increment the depth here. + consumed2, err := d.unmarshalPath(tinfo, sv, parents, &t, depth) + if err != nil { + return true, err + } + if !consumed2 { + if err := d.Skip(); err != nil { + return true, err + } + } + case EndElement: + return true, nil + } + } +} + +// Skip reads tokens until it has consumed the end element +// matching the most recent start element already consumed, +// skipping nested structures. +// It returns nil if it finds an end element matching the start +// element; otherwise it returns an error describing the problem. +func (d *Decoder) Skip() error { + var depth int64 + for { + tok, err := d.Token() + if err != nil { + return err + } + switch tok.(type) { + case StartElement: + depth++ + case EndElement: + if depth == 0 { + return nil + } + depth-- + } + } +} diff --git a/go/src/encoding/xml/read_test.go b/go/src/encoding/xml/read_test.go new file mode 100644 index 0000000000000000000000000000000000000000..f0f7b31ccc73ff256d206468ad2412d015e9dadd --- /dev/null +++ b/go/src/encoding/xml/read_test.go @@ -0,0 +1,1128 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package xml + +import ( + "bytes" + "errors" + "io" + "reflect" + "runtime" + "strings" + "testing" + "time" +) + +// Stripped down Atom feed data structures. + +func TestUnmarshalFeed(t *testing.T) { + var f Feed + if err := Unmarshal([]byte(atomFeedString), &f); err != nil { + t.Fatalf("Unmarshal: %s", err) + } + if !reflect.DeepEqual(f, atomFeed) { + t.Fatalf("have %#v\nwant %#v", f, atomFeed) + } +} + +// hget http://codereview.appspot.com/rss/mine/rsc +const atomFeedString = ` + +Code Review - My issueshttp://codereview.appspot.com/rietveld<>rietveld: an attempt at pubsubhubbub +2009-10-04T01:35:58+00:00email-address-removedurn:md5:134d9179c41f806be79b3a5f7877d19a + An attempt at adding pubsubhubbub support to Rietveld. +http://code.google.com/p/pubsubhubbub +http://code.google.com/p/rietveld/issues/detail?id=155 + +The server side of the protocol is trivial: + 1. add a &lt;link rel=&quot;hub&quot; href=&quot;hub-server&quot;&gt; tag to all + feeds that will be pubsubhubbubbed. + 2. every time one of those feeds changes, tell the hub + with a simple POST request. + +I have tested this by adding debug prints to a local hub +server and checking that the server got the right publish +requests. + +I can&#39;t quite get the server to work, but I think the bug +is not in my code. I think that the server expects to be +able to grab the feed and see the feed&#39;s actual URL in +the link rel=&quot;self&quot;, but the default value for that drops +the :port from the URL, and I cannot for the life of me +figure out how to get the Atom generator deep inside +django not to do that, or even where it is doing that, +or even what code is running to generate the Atom feed. +(I thought I knew but I added some assert False statements +and it kept running!) + +Ignoring that particular problem, I would appreciate +feedback on the right way to get the two values at +the top of feeds.py marked NOTE(rsc). + + +rietveld: correct tab handling +2009-10-03T23:02:17+00:00email-address-removedurn:md5:0a2a4f19bb815101f0ba2904aed7c35a + This fixes the buggy tab rendering that can be seen at +http://codereview.appspot.com/116075/diff/1/2 + +The fundamental problem was that the tab code was +not being told what column the text began in, so it +didn&#39;t know where to put the tab stops. Another problem +was that some of the code assumed that string byte +offsets were the same as column offsets, which is only +true if there are no tabs. + +In the process of fixing this, I cleaned up the arguments +to Fold and ExpandTabs and renamed them Break and +_ExpandTabs so that I could be sure that I found all the +call sites. I also wanted to verify that ExpandTabs was +not being used from outside intra_region_diff.py. + + + ` + +type Feed struct { + XMLName Name `xml:"http://www.w3.org/2005/Atom feed"` + Title string `xml:"title"` + ID string `xml:"id"` + Link []Link `xml:"link"` + Updated time.Time `xml:"updated,attr"` + Author Person `xml:"author"` + Entry []Entry `xml:"entry"` +} + +type Entry struct { + Title string `xml:"title"` + ID string `xml:"id"` + Link []Link `xml:"link"` + Updated time.Time `xml:"updated"` + Author Person `xml:"author"` + Summary Text `xml:"summary"` +} + +type Link struct { + Rel string `xml:"rel,attr,omitempty"` + Href string `xml:"href,attr"` +} + +type Person struct { + Name string `xml:"name"` + URI string `xml:"uri"` + Email string `xml:"email"` + InnerXML string `xml:",innerxml"` +} + +type Text struct { + Type string `xml:"type,attr,omitempty"` + Body string `xml:",chardata"` +} + +var atomFeed = Feed{ + XMLName: Name{"http://www.w3.org/2005/Atom", "feed"}, + Title: "Code Review - My issues", + Link: []Link{ + {Rel: "alternate", Href: "http://codereview.appspot.com/"}, + {Rel: "self", Href: "http://codereview.appspot.com/rss/mine/rsc"}, + }, + ID: "http://codereview.appspot.com/", + Updated: ParseTime("2009-10-04T01:35:58+00:00"), + Author: Person{ + Name: "rietveld<>", + InnerXML: "rietveld<>", + }, + Entry: []Entry{ + { + Title: "rietveld: an attempt at pubsubhubbub\n", + Link: []Link{ + {Rel: "alternate", Href: "http://codereview.appspot.com/126085"}, + }, + Updated: ParseTime("2009-10-04T01:35:58+00:00"), + Author: Person{ + Name: "email-address-removed", + InnerXML: "email-address-removed", + }, + ID: "urn:md5:134d9179c41f806be79b3a5f7877d19a", + Summary: Text{ + Type: "html", + Body: ` + An attempt at adding pubsubhubbub support to Rietveld. +http://code.google.com/p/pubsubhubbub +http://code.google.com/p/rietveld/issues/detail?id=155 + +The server side of the protocol is trivial: + 1. add a <link rel="hub" href="hub-server"> tag to all + feeds that will be pubsubhubbubbed. + 2. every time one of those feeds changes, tell the hub + with a simple POST request. + +I have tested this by adding debug prints to a local hub +server and checking that the server got the right publish +requests. + +I can't quite get the server to work, but I think the bug +is not in my code. I think that the server expects to be +able to grab the feed and see the feed's actual URL in +the link rel="self", but the default value for that drops +the :port from the URL, and I cannot for the life of me +figure out how to get the Atom generator deep inside +django not to do that, or even where it is doing that, +or even what code is running to generate the Atom feed. +(I thought I knew but I added some assert False statements +and it kept running!) + +Ignoring that particular problem, I would appreciate +feedback on the right way to get the two values at +the top of feeds.py marked NOTE(rsc). + + +`, + }, + }, + { + Title: "rietveld: correct tab handling\n", + Link: []Link{ + {Rel: "alternate", Href: "http://codereview.appspot.com/124106"}, + }, + Updated: ParseTime("2009-10-03T23:02:17+00:00"), + Author: Person{ + Name: "email-address-removed", + InnerXML: "email-address-removed", + }, + ID: "urn:md5:0a2a4f19bb815101f0ba2904aed7c35a", + Summary: Text{ + Type: "html", + Body: ` + This fixes the buggy tab rendering that can be seen at +http://codereview.appspot.com/116075/diff/1/2 + +The fundamental problem was that the tab code was +not being told what column the text began in, so it +didn't know where to put the tab stops. Another problem +was that some of the code assumed that string byte +offsets were the same as column offsets, which is only +true if there are no tabs. + +In the process of fixing this, I cleaned up the arguments +to Fold and ExpandTabs and renamed them Break and +_ExpandTabs so that I could be sure that I found all the +call sites. I also wanted to verify that ExpandTabs was +not being used from outside intra_region_diff.py. + + +`, + }, + }, + }, +} + +const pathTestString = ` + + 1 + + + A + + + B + + + C + D + + <_> + E + + + 2 + +` + +type PathTestItem struct { + Value string +} + +type PathTestA struct { + Items []PathTestItem `xml:">Item1"` + Before, After string +} + +type PathTestB struct { + Other []PathTestItem `xml:"Items>Item1"` + Before, After string +} + +type PathTestC struct { + Values1 []string `xml:"Items>Item1>Value"` + Values2 []string `xml:"Items>Item2>Value"` + Before, After string +} + +type PathTestSet struct { + Item1 []PathTestItem +} + +type PathTestD struct { + Other PathTestSet `xml:"Items"` + Before, After string +} + +type PathTestE struct { + Underline string `xml:"Items>_>Value"` + Before, After string +} + +var pathTests = []any{ + &PathTestA{Items: []PathTestItem{{"A"}, {"D"}}, Before: "1", After: "2"}, + &PathTestB{Other: []PathTestItem{{"A"}, {"D"}}, Before: "1", After: "2"}, + &PathTestC{Values1: []string{"A", "C", "D"}, Values2: []string{"B"}, Before: "1", After: "2"}, + &PathTestD{Other: PathTestSet{Item1: []PathTestItem{{"A"}, {"D"}}}, Before: "1", After: "2"}, + &PathTestE{Underline: "E", Before: "1", After: "2"}, +} + +func TestUnmarshalPaths(t *testing.T) { + for _, pt := range pathTests { + v := reflect.New(reflect.TypeOf(pt).Elem()).Interface() + if err := Unmarshal([]byte(pathTestString), v); err != nil { + t.Fatalf("Unmarshal: %s", err) + } + if !reflect.DeepEqual(v, pt) { + t.Fatalf("have %#v\nwant %#v", v, pt) + } + } +} + +type BadPathTestA struct { + First string `xml:"items>item1"` + Other string `xml:"items>item2"` + Second string `xml:"items"` +} + +type BadPathTestB struct { + Other string `xml:"items>item2>value"` + First string `xml:"items>item1"` + Second string `xml:"items>item1>value"` +} + +type BadPathTestC struct { + First string + Second string `xml:"First"` +} + +type BadPathTestD struct { + BadPathEmbeddedA + BadPathEmbeddedB +} + +type BadPathEmbeddedA struct { + First string +} + +type BadPathEmbeddedB struct { + Second string `xml:"First"` +} + +var badPathTests = []struct { + v, e any +}{ + {&BadPathTestA{}, &TagPathError{reflect.TypeFor[BadPathTestA](), "First", "items>item1", "Second", "items"}}, + {&BadPathTestB{}, &TagPathError{reflect.TypeFor[BadPathTestB](), "First", "items>item1", "Second", "items>item1>value"}}, + {&BadPathTestC{}, &TagPathError{reflect.TypeFor[BadPathTestC](), "First", "", "Second", "First"}}, + {&BadPathTestD{}, &TagPathError{reflect.TypeFor[BadPathTestD](), "First", "", "Second", "First"}}, +} + +func TestUnmarshalBadPaths(t *testing.T) { + for _, tt := range badPathTests { + err := Unmarshal([]byte(pathTestString), tt.v) + if !reflect.DeepEqual(err, tt.e) { + t.Fatalf("Unmarshal with %#v didn't fail properly:\nhave %#v,\nwant %#v", tt.v, err, tt.e) + } + } +} + +const OK = "OK" +const withoutNameTypeData = ` + +` + +type TestThree struct { + XMLName Name `xml:"Test3"` + Attr string `xml:",attr"` +} + +func TestUnmarshalWithoutNameType(t *testing.T) { + var x TestThree + if err := Unmarshal([]byte(withoutNameTypeData), &x); err != nil { + t.Fatalf("Unmarshal: %s", err) + } + if x.Attr != OK { + t.Fatalf("have %v\nwant %v", x.Attr, OK) + } +} + +func TestUnmarshalAttr(t *testing.T) { + type ParamVal struct { + Int int `xml:"int,attr"` + } + + type ParamPtr struct { + Int *int `xml:"int,attr"` + } + + type ParamStringPtr struct { + Int *string `xml:"int,attr"` + } + + x := []byte(``) + + p1 := &ParamPtr{} + if err := Unmarshal(x, p1); err != nil { + t.Fatalf("Unmarshal: %s", err) + } + if p1.Int == nil { + t.Fatalf("Unmarshal failed in to *int field") + } else if *p1.Int != 1 { + t.Fatalf("Unmarshal with %s failed:\nhave %#v,\n want %#v", x, p1.Int, 1) + } + + p2 := &ParamVal{} + if err := Unmarshal(x, p2); err != nil { + t.Fatalf("Unmarshal: %s", err) + } + if p2.Int != 1 { + t.Fatalf("Unmarshal with %s failed:\nhave %#v,\n want %#v", x, p2.Int, 1) + } + + p3 := &ParamStringPtr{} + if err := Unmarshal(x, p3); err != nil { + t.Fatalf("Unmarshal: %s", err) + } + if p3.Int == nil { + t.Fatalf("Unmarshal failed in to *string field") + } else if *p3.Int != "1" { + t.Fatalf("Unmarshal with %s failed:\nhave %#v,\n want %#v", x, p3.Int, 1) + } +} + +type Tables struct { + HTable string `xml:"http://www.w3.org/TR/html4/ table"` + FTable string `xml:"http://www.w3schools.com/furniture table"` +} + +var tables = []struct { + xml string + tab Tables + ns string +}{ + { + xml: `` + + `hello
` + + `world
` + + `
`, + tab: Tables{"hello", "world"}, + }, + { + xml: `` + + `world
` + + `hello
` + + `
`, + tab: Tables{"hello", "world"}, + }, + { + xml: `` + + `world` + + `hello` + + ``, + tab: Tables{"hello", "world"}, + }, + { + xml: `` + + `bogus
` + + `
`, + tab: Tables{}, + }, + { + xml: `` + + `only
` + + `
`, + tab: Tables{HTable: "only"}, + ns: "http://www.w3.org/TR/html4/", + }, + { + xml: `` + + `only
` + + `
`, + tab: Tables{FTable: "only"}, + ns: "http://www.w3schools.com/furniture", + }, + { + xml: `` + + `only
` + + `
`, + tab: Tables{}, + ns: "something else entirely", + }, +} + +func TestUnmarshalNS(t *testing.T) { + for i, tt := range tables { + var dst Tables + var err error + if tt.ns != "" { + d := NewDecoder(strings.NewReader(tt.xml)) + d.DefaultSpace = tt.ns + err = d.Decode(&dst) + } else { + err = Unmarshal([]byte(tt.xml), &dst) + } + if err != nil { + t.Errorf("#%d: Unmarshal: %v", i, err) + continue + } + want := tt.tab + if dst != want { + t.Errorf("#%d: dst=%+v, want %+v", i, dst, want) + } + } +} + +func TestMarshalNS(t *testing.T) { + dst := Tables{"hello", "world"} + data, err := Marshal(&dst) + if err != nil { + t.Fatalf("Marshal: %v", err) + } + want := `hello
world
` + str := string(data) + if str != want { + t.Errorf("have: %q\nwant: %q\n", str, want) + } +} + +type TableAttrs struct { + TAttr TAttr +} + +type TAttr struct { + HTable string `xml:"http://www.w3.org/TR/html4/ table,attr"` + FTable string `xml:"http://www.w3schools.com/furniture table,attr"` + Lang string `xml:"http://www.w3.org/XML/1998/namespace lang,attr,omitempty"` + Other1 string `xml:"http://golang.org/xml/ other,attr,omitempty"` + Other2 string `xml:"http://golang.org/xmlfoo/ other,attr,omitempty"` + Other3 string `xml:"http://golang.org/json/ other,attr,omitempty"` + Other4 string `xml:"http://golang.org/2/json/ other,attr,omitempty"` +} + +var tableAttrs = []struct { + xml string + tab TableAttrs + ns string +}{ + { + xml: ``, + tab: TableAttrs{TAttr{HTable: "hello", FTable: "world"}}, + }, + { + xml: ``, + tab: TableAttrs{TAttr{HTable: "hello", FTable: "world"}}, + }, + { + xml: ``, + tab: TableAttrs{TAttr{HTable: "hello", FTable: "world"}}, + }, + { + // Default space does not apply to attribute names. + xml: ``, + tab: TableAttrs{TAttr{HTable: "hello", FTable: ""}}, + }, + { + // Default space does not apply to attribute names. + xml: ``, + tab: TableAttrs{TAttr{HTable: "", FTable: "world"}}, + }, + { + xml: ``, + tab: TableAttrs{}, + }, + { + // Default space does not apply to attribute names. + xml: ``, + tab: TableAttrs{TAttr{HTable: "hello", FTable: ""}}, + ns: "http://www.w3schools.com/furniture", + }, + { + // Default space does not apply to attribute names. + xml: ``, + tab: TableAttrs{TAttr{HTable: "", FTable: "world"}}, + ns: "http://www.w3.org/TR/html4/", + }, + { + xml: ``, + tab: TableAttrs{}, + ns: "something else entirely", + }, +} + +func TestUnmarshalNSAttr(t *testing.T) { + for i, tt := range tableAttrs { + var dst TableAttrs + var err error + if tt.ns != "" { + d := NewDecoder(strings.NewReader(tt.xml)) + d.DefaultSpace = tt.ns + err = d.Decode(&dst) + } else { + err = Unmarshal([]byte(tt.xml), &dst) + } + if err != nil { + t.Errorf("#%d: Unmarshal: %v", i, err) + continue + } + want := tt.tab + if dst != want { + t.Errorf("#%d: dst=%+v, want %+v", i, dst, want) + } + } +} + +func TestMarshalNSAttr(t *testing.T) { + src := TableAttrs{TAttr{"hello", "world", "en_US", "other1", "other2", "other3", "other4"}} + data, err := Marshal(&src) + if err != nil { + t.Fatalf("Marshal: %v", err) + } + want := `` + str := string(data) + if str != want { + t.Errorf("Marshal:\nhave: %#q\nwant: %#q\n", str, want) + } + + var dst TableAttrs + if err := Unmarshal(data, &dst); err != nil { + t.Errorf("Unmarshal: %v", err) + } + + if dst != src { + t.Errorf("Unmarshal = %q, want %q", dst, src) + } +} + +type MyCharData struct { + body string +} + +func (m *MyCharData) UnmarshalXML(d *Decoder, start StartElement) error { + for { + t, err := d.Token() + if err == io.EOF { // found end of element + break + } + if err != nil { + return err + } + if char, ok := t.(CharData); ok { + m.body += string(char) + } + } + return nil +} + +var _ Unmarshaler = (*MyCharData)(nil) + +func (m *MyCharData) UnmarshalXMLAttr(attr Attr) error { + panic("must not call") +} + +type MyAttr struct { + attr string +} + +func (m *MyAttr) UnmarshalXMLAttr(attr Attr) error { + m.attr = attr.Value + return nil +} + +var _ UnmarshalerAttr = (*MyAttr)(nil) + +type MyStruct struct { + Data *MyCharData + Attr *MyAttr `xml:",attr"` + + Data2 MyCharData + Attr2 MyAttr `xml:",attr"` +} + +func TestUnmarshaler(t *testing.T) { + xml := ` + + hello world + howdy world + + ` + + var m MyStruct + if err := Unmarshal([]byte(xml), &m); err != nil { + t.Fatal(err) + } + + if m.Data == nil || m.Attr == nil || m.Data.body != "hello world" || m.Attr.attr != "attr1" || m.Data2.body != "howdy world" || m.Attr2.attr != "attr2" { + t.Errorf("m=%#+v\n", m) + } +} + +type Pea struct { + Cotelydon string +} + +type Pod struct { + Pea any `xml:"Pea"` +} + +// https://golang.org/issue/6836 +func TestUnmarshalIntoInterface(t *testing.T) { + pod := new(Pod) + pod.Pea = new(Pea) + xml := `Green stuff` + err := Unmarshal([]byte(xml), pod) + if err != nil { + t.Fatalf("failed to unmarshal %q: %v", xml, err) + } + pea, ok := pod.Pea.(*Pea) + if !ok { + t.Fatalf("unmarshaled into wrong type: have %T want *Pea", pod.Pea) + } + have, want := pea.Cotelydon, "Green stuff" + if have != want { + t.Errorf("failed to unmarshal into interface, have %q want %q", have, want) + } +} + +type X struct { + D string `xml:",comment"` +} + +// Issue 11112. Unmarshal must reject invalid comments. +func TestMalformedComment(t *testing.T) { + testData := []string{ + "", + "", + "", + "", + } + for i, test := range testData { + data := []byte(test) + v := new(X) + if err := Unmarshal(data, v); err == nil { + t.Errorf("%d: unmarshal should reject invalid comments", i) + } + } +} + +type IXField struct { + Five int `xml:"five"` + NotInnerXML []string `xml:",innerxml"` +} + +// Issue 15600. ",innerxml" on a field that can't hold it. +func TestInvalidInnerXMLType(t *testing.T) { + v := new(IXField) + if err := Unmarshal([]byte(`5`), v); err != nil { + t.Errorf("Unmarshal failed: got %v", err) + } + if v.Five != 5 { + t.Errorf("Five = %v, want 5", v.Five) + } + if v.NotInnerXML != nil { + t.Errorf("NotInnerXML = %v, want nil", v.NotInnerXML) + } +} + +type Child struct { + G struct { + I int + } +} + +type ChildToEmbed struct { + X bool +} + +type Parent struct { + I int + IPtr *int + Is []int + IPtrs []*int + F float32 + FPtr *float32 + Fs []float32 + FPtrs []*float32 + B bool + BPtr *bool + Bs []bool + BPtrs []*bool + Bytes []byte + BytesPtr *[]byte + S string + SPtr *string + Ss []string + SPtrs []*string + MyI MyInt + Child Child + Children []Child + ChildPtr *Child + ChildToEmbed +} + +const ( + emptyXML = ` + + + + + + + + + + + + + + + + + + + + + + + + + +` +) + +// golang.org/issues/13417 +func TestUnmarshalEmptyValues(t *testing.T) { + // Test first with a zero-valued dst. + v := new(Parent) + if err := Unmarshal([]byte(emptyXML), v); err != nil { + t.Fatalf("zero: Unmarshal failed: got %v", err) + } + + zBytes, zInt, zStr, zFloat, zBool := []byte{}, 0, "", float32(0), false + want := &Parent{ + IPtr: &zInt, + Is: []int{zInt}, + IPtrs: []*int{&zInt}, + FPtr: &zFloat, + Fs: []float32{zFloat}, + FPtrs: []*float32{&zFloat}, + BPtr: &zBool, + Bs: []bool{zBool}, + BPtrs: []*bool{&zBool}, + Bytes: []byte{}, + BytesPtr: &zBytes, + SPtr: &zStr, + Ss: []string{zStr}, + SPtrs: []*string{&zStr}, + Children: []Child{{}}, + ChildPtr: new(Child), + ChildToEmbed: ChildToEmbed{}, + } + if !reflect.DeepEqual(v, want) { + t.Fatalf("zero: Unmarshal:\nhave: %#+v\nwant: %#+v", v, want) + } + + // Test with a pre-populated dst. + // Multiple addressable copies, as pointer-to fields will replace value during unmarshal. + vBytes0, vInt0, vStr0, vFloat0, vBool0 := []byte("x"), 1, "x", float32(1), true + vBytes1, vInt1, vStr1, vFloat1, vBool1 := []byte("x"), 1, "x", float32(1), true + vInt2, vStr2, vFloat2, vBool2 := 1, "x", float32(1), true + v = &Parent{ + I: vInt0, + IPtr: &vInt1, + Is: []int{vInt0}, + IPtrs: []*int{&vInt2}, + F: vFloat0, + FPtr: &vFloat1, + Fs: []float32{vFloat0}, + FPtrs: []*float32{&vFloat2}, + B: vBool0, + BPtr: &vBool1, + Bs: []bool{vBool0}, + BPtrs: []*bool{&vBool2}, + Bytes: vBytes0, + BytesPtr: &vBytes1, + S: vStr0, + SPtr: &vStr1, + Ss: []string{vStr0}, + SPtrs: []*string{&vStr2}, + MyI: MyInt(vInt0), + Child: Child{G: struct{ I int }{I: vInt0}}, + Children: []Child{{G: struct{ I int }{I: vInt0}}}, + ChildPtr: &Child{G: struct{ I int }{I: vInt0}}, + ChildToEmbed: ChildToEmbed{X: vBool0}, + } + if err := Unmarshal([]byte(emptyXML), v); err != nil { + t.Fatalf("populated: Unmarshal failed: got %v", err) + } + + want = &Parent{ + IPtr: &zInt, + Is: []int{vInt0, zInt}, + IPtrs: []*int{&vInt0, &zInt}, + FPtr: &zFloat, + Fs: []float32{vFloat0, zFloat}, + FPtrs: []*float32{&vFloat0, &zFloat}, + BPtr: &zBool, + Bs: []bool{vBool0, zBool}, + BPtrs: []*bool{&vBool0, &zBool}, + Bytes: []byte{}, + BytesPtr: &zBytes, + SPtr: &zStr, + Ss: []string{vStr0, zStr}, + SPtrs: []*string{&vStr0, &zStr}, + Child: Child{G: struct{ I int }{I: vInt0}}, // I should == zInt0? (zero value) + Children: []Child{{G: struct{ I int }{I: vInt0}}, {}}, + ChildPtr: &Child{G: struct{ I int }{I: vInt0}}, // I should == zInt0? (zero value) + } + if !reflect.DeepEqual(v, want) { + t.Fatalf("populated: Unmarshal:\nhave: %#+v\nwant: %#+v", v, want) + } +} + +type WhitespaceValuesParent struct { + BFalse bool + BTrue bool + I int + INeg int + I8 int8 + I8Neg int8 + I16 int16 + I16Neg int16 + I32 int32 + I32Neg int32 + I64 int64 + I64Neg int64 + UI uint + UI8 uint8 + UI16 uint16 + UI32 uint32 + UI64 uint64 + F32 float32 + F32Neg float32 + F64 float64 + F64Neg float64 +} + +const whitespaceValuesXML = ` + + false + true + 266703 + -266703 + 112 + -112 + 6703 + -6703 + 266703 + -266703 + 266703 + -266703 + 266703 + 112 + 6703 + 266703 + 266703 + 266.703 + -266.703 + 266.703 + -266.703 + +` + +// golang.org/issues/22146 +func TestUnmarshalWhitespaceValues(t *testing.T) { + v := WhitespaceValuesParent{} + if err := Unmarshal([]byte(whitespaceValuesXML), &v); err != nil { + t.Fatalf("whitespace values: Unmarshal failed: got %v", err) + } + + want := WhitespaceValuesParent{ + BFalse: false, + BTrue: true, + I: 266703, + INeg: -266703, + I8: 112, + I8Neg: -112, + I16: 6703, + I16Neg: -6703, + I32: 266703, + I32Neg: -266703, + I64: 266703, + I64Neg: -266703, + UI: 266703, + UI8: 112, + UI16: 6703, + UI32: 266703, + UI64: 266703, + F32: 266.703, + F32Neg: -266.703, + F64: 266.703, + F64Neg: -266.703, + } + if v != want { + t.Fatalf("whitespace values: Unmarshal:\nhave: %#+v\nwant: %#+v", v, want) + } +} + +type WhitespaceAttrsParent struct { + BFalse bool `xml:",attr"` + BTrue bool `xml:",attr"` + I int `xml:",attr"` + INeg int `xml:",attr"` + I8 int8 `xml:",attr"` + I8Neg int8 `xml:",attr"` + I16 int16 `xml:",attr"` + I16Neg int16 `xml:",attr"` + I32 int32 `xml:",attr"` + I32Neg int32 `xml:",attr"` + I64 int64 `xml:",attr"` + I64Neg int64 `xml:",attr"` + UI uint `xml:",attr"` + UI8 uint8 `xml:",attr"` + UI16 uint16 `xml:",attr"` + UI32 uint32 `xml:",attr"` + UI64 uint64 `xml:",attr"` + F32 float32 `xml:",attr"` + F32Neg float32 `xml:",attr"` + F64 float64 `xml:",attr"` + F64Neg float64 `xml:",attr"` +} + +const whitespaceAttrsXML = ` + + +` + +// golang.org/issues/22146 +func TestUnmarshalWhitespaceAttrs(t *testing.T) { + v := WhitespaceAttrsParent{} + if err := Unmarshal([]byte(whitespaceAttrsXML), &v); err != nil { + t.Fatalf("whitespace attrs: Unmarshal failed: got %v", err) + } + + want := WhitespaceAttrsParent{ + BFalse: false, + BTrue: true, + I: 266703, + INeg: -266703, + I8: 112, + I8Neg: -112, + I16: 6703, + I16Neg: -6703, + I32: 266703, + I32Neg: -266703, + I64: 266703, + I64Neg: -266703, + UI: 266703, + UI8: 112, + UI16: 6703, + UI32: 266703, + UI64: 266703, + F32: 266.703, + F32Neg: -266.703, + F64: 266.703, + F64Neg: -266.703, + } + if v != want { + t.Fatalf("whitespace attrs: Unmarshal:\nhave: %#+v\nwant: %#+v", v, want) + } +} + +// golang.org/issues/53350 +func TestUnmarshalIntoNil(t *testing.T) { + type T struct { + A int `xml:"A"` + } + + var nilPointer *T + err := Unmarshal([]byte("1"), nilPointer) + + if err == nil { + t.Fatalf("no error in unmarshaling") + } + +} + +func TestCVE202228131(t *testing.T) { + type nested struct { + Parent *nested `xml:",any"` + } + var n nested + err := Unmarshal(bytes.Repeat([]byte(""), maxUnmarshalDepth+1), &n) + if err == nil { + t.Fatal("Unmarshal did not fail") + } else if !errors.Is(err, errUnmarshalDepth) { + t.Fatalf("Unmarshal unexpected error: got %q, want %q", err, errUnmarshalDepth) + } +} + +func TestCVE202230633(t *testing.T) { + if testing.Short() || runtime.GOARCH == "wasm" { + t.Skip("test requires significant memory") + } + defer func() { + p := recover() + if p != nil { + t.Fatal("Unmarshal panicked") + } + }() + var example struct { + Things []string + } + Unmarshal(bytes.Repeat([]byte(""), 17_000_000), &example) +} diff --git a/go/src/encoding/xml/typeinfo.go b/go/src/encoding/xml/typeinfo.go new file mode 100644 index 0000000000000000000000000000000000000000..b18ed284a690ca08247e504f2d0b819100906a59 --- /dev/null +++ b/go/src/encoding/xml/typeinfo.go @@ -0,0 +1,367 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package xml + +import ( + "fmt" + "reflect" + "strings" + "sync" +) + +// typeInfo holds details for the xml representation of a type. +type typeInfo struct { + xmlname *fieldInfo + fields []fieldInfo +} + +// fieldInfo holds details for the xml representation of a single field. +type fieldInfo struct { + idx []int + name string + xmlns string + flags fieldFlags + parents []string +} + +type fieldFlags int + +const ( + fElement fieldFlags = 1 << iota + fAttr + fCDATA + fCharData + fInnerXML + fComment + fAny + + fOmitEmpty + + fMode = fElement | fAttr | fCDATA | fCharData | fInnerXML | fComment | fAny + + xmlName = "XMLName" +) + +var tinfoMap sync.Map // map[reflect.Type]*typeInfo + +var nameType = reflect.TypeFor[Name]() + +// getTypeInfo returns the typeInfo structure with details necessary +// for marshaling and unmarshaling typ. +func getTypeInfo(typ reflect.Type) (*typeInfo, error) { + if ti, ok := tinfoMap.Load(typ); ok { + return ti.(*typeInfo), nil + } + + tinfo := &typeInfo{} + if typ.Kind() == reflect.Struct && typ != nameType { + n := typ.NumField() + for i := 0; i < n; i++ { + f := typ.Field(i) + if (!f.IsExported() && !f.Anonymous) || f.Tag.Get("xml") == "-" { + continue // Private field + } + + // For embedded structs, embed its fields. + if f.Anonymous { + t := f.Type + if t.Kind() == reflect.Pointer { + t = t.Elem() + } + if t.Kind() == reflect.Struct { + inner, err := getTypeInfo(t) + if err != nil { + return nil, err + } + if tinfo.xmlname == nil { + tinfo.xmlname = inner.xmlname + } + for _, finfo := range inner.fields { + finfo.idx = append([]int{i}, finfo.idx...) + if err := addFieldInfo(typ, tinfo, &finfo); err != nil { + return nil, err + } + } + continue + } + } + + finfo, err := structFieldInfo(typ, &f) + if err != nil { + return nil, err + } + + if f.Name == xmlName { + tinfo.xmlname = finfo + continue + } + + // Add the field if it doesn't conflict with other fields. + if err := addFieldInfo(typ, tinfo, finfo); err != nil { + return nil, err + } + } + } + + ti, _ := tinfoMap.LoadOrStore(typ, tinfo) + return ti.(*typeInfo), nil +} + +// structFieldInfo builds and returns a fieldInfo for f. +func structFieldInfo(typ reflect.Type, f *reflect.StructField) (*fieldInfo, error) { + finfo := &fieldInfo{idx: f.Index} + + // Split the tag from the xml namespace if necessary. + tag := f.Tag.Get("xml") + if ns, t, ok := strings.Cut(tag, " "); ok { + finfo.xmlns, tag = ns, t + } + + // Parse flags. + tokens := strings.Split(tag, ",") + if len(tokens) == 1 { + finfo.flags = fElement + } else { + tag = tokens[0] + for _, flag := range tokens[1:] { + switch flag { + case "attr": + finfo.flags |= fAttr + case "cdata": + finfo.flags |= fCDATA + case "chardata": + finfo.flags |= fCharData + case "innerxml": + finfo.flags |= fInnerXML + case "comment": + finfo.flags |= fComment + case "any": + finfo.flags |= fAny + case "omitempty": + finfo.flags |= fOmitEmpty + } + } + + // Validate the flags used. + valid := true + switch mode := finfo.flags & fMode; mode { + case 0: + finfo.flags |= fElement + case fAttr, fCDATA, fCharData, fInnerXML, fComment, fAny, fAny | fAttr: + if f.Name == xmlName || tag != "" && mode != fAttr { + valid = false + } + default: + // This will also catch multiple modes in a single field. + valid = false + } + if finfo.flags&fMode == fAny { + finfo.flags |= fElement + } + if finfo.flags&fOmitEmpty != 0 && finfo.flags&(fElement|fAttr) == 0 { + valid = false + } + if !valid { + return nil, fmt.Errorf("xml: invalid tag in field %s of type %s: %q", + f.Name, typ, f.Tag.Get("xml")) + } + } + + // Use of xmlns without a name is not allowed. + if finfo.xmlns != "" && tag == "" { + return nil, fmt.Errorf("xml: namespace without name in field %s of type %s: %q", + f.Name, typ, f.Tag.Get("xml")) + } + + if f.Name == xmlName { + // The XMLName field records the XML element name. Don't + // process it as usual because its name should default to + // empty rather than to the field name. + finfo.name = tag + return finfo, nil + } + + if tag == "" { + // If the name part of the tag is completely empty, get + // default from XMLName of underlying struct if feasible, + // or field name otherwise. + if xmlname := lookupXMLName(f.Type); xmlname != nil { + finfo.xmlns, finfo.name = xmlname.xmlns, xmlname.name + } else { + finfo.name = f.Name + } + return finfo, nil + } + + // Prepare field name and parents. + parents := strings.Split(tag, ">") + if parents[0] == "" { + parents[0] = f.Name + } + if parents[len(parents)-1] == "" { + return nil, fmt.Errorf("xml: trailing '>' in field %s of type %s", f.Name, typ) + } + finfo.name = parents[len(parents)-1] + if len(parents) > 1 { + if (finfo.flags & fElement) == 0 { + return nil, fmt.Errorf("xml: %s chain not valid with %s flag", tag, strings.Join(tokens[1:], ",")) + } + finfo.parents = parents[:len(parents)-1] + } + + // If the field type has an XMLName field, the names must match + // so that the behavior of both marshaling and unmarshaling + // is straightforward and unambiguous. + if finfo.flags&fElement != 0 { + ftyp := f.Type + xmlname := lookupXMLName(ftyp) + if xmlname != nil && xmlname.name != finfo.name { + return nil, fmt.Errorf("xml: name %q in tag of %s.%s conflicts with name %q in %s.XMLName", + finfo.name, typ, f.Name, xmlname.name, ftyp) + } + } + return finfo, nil +} + +// lookupXMLName returns the fieldInfo for typ's XMLName field +// in case it exists and has a valid xml field tag, otherwise +// it returns nil. +func lookupXMLName(typ reflect.Type) (xmlname *fieldInfo) { + for typ.Kind() == reflect.Pointer { + typ = typ.Elem() + } + if typ.Kind() != reflect.Struct { + return nil + } + for i, n := 0, typ.NumField(); i < n; i++ { + f := typ.Field(i) + if f.Name != xmlName { + continue + } + finfo, err := structFieldInfo(typ, &f) + if err == nil && finfo.name != "" { + return finfo + } + // Also consider errors as a non-existent field tag + // and let getTypeInfo itself report the error. + break + } + return nil +} + +// addFieldInfo adds finfo to tinfo.fields if there are no +// conflicts, or if conflicts arise from previous fields that were +// obtained from deeper embedded structures than finfo. In the latter +// case, the conflicting entries are dropped. +// A conflict occurs when the path (parent + name) to a field is +// itself a prefix of another path, or when two paths match exactly. +// It is okay for field paths to share a common, shorter prefix. +func addFieldInfo(typ reflect.Type, tinfo *typeInfo, newf *fieldInfo) error { + var conflicts []int +Loop: + // First, figure all conflicts. Most working code will have none. + for i := range tinfo.fields { + oldf := &tinfo.fields[i] + if oldf.flags&fMode != newf.flags&fMode { + continue + } + if oldf.xmlns != "" && newf.xmlns != "" && oldf.xmlns != newf.xmlns { + continue + } + minl := min(len(newf.parents), len(oldf.parents)) + for p := 0; p < minl; p++ { + if oldf.parents[p] != newf.parents[p] { + continue Loop + } + } + if len(oldf.parents) > len(newf.parents) { + if oldf.parents[len(newf.parents)] == newf.name { + conflicts = append(conflicts, i) + } + } else if len(oldf.parents) < len(newf.parents) { + if newf.parents[len(oldf.parents)] == oldf.name { + conflicts = append(conflicts, i) + } + } else { + if newf.name == oldf.name && newf.xmlns == oldf.xmlns { + conflicts = append(conflicts, i) + } + } + } + // Without conflicts, add the new field and return. + if conflicts == nil { + tinfo.fields = append(tinfo.fields, *newf) + return nil + } + + // If any conflict is shallower, ignore the new field. + // This matches the Go field resolution on embedding. + for _, i := range conflicts { + if len(tinfo.fields[i].idx) < len(newf.idx) { + return nil + } + } + + // Otherwise, if any of them is at the same depth level, it's an error. + for _, i := range conflicts { + oldf := &tinfo.fields[i] + if len(oldf.idx) == len(newf.idx) { + f1 := typ.FieldByIndex(oldf.idx) + f2 := typ.FieldByIndex(newf.idx) + return &TagPathError{typ, f1.Name, f1.Tag.Get("xml"), f2.Name, f2.Tag.Get("xml")} + } + } + + // Otherwise, the new field is shallower, and thus takes precedence, + // so drop the conflicting fields from tinfo and append the new one. + for c := len(conflicts) - 1; c >= 0; c-- { + i := conflicts[c] + copy(tinfo.fields[i:], tinfo.fields[i+1:]) + tinfo.fields = tinfo.fields[:len(tinfo.fields)-1] + } + tinfo.fields = append(tinfo.fields, *newf) + return nil +} + +// A TagPathError represents an error in the unmarshaling process +// caused by the use of field tags with conflicting paths. +type TagPathError struct { + Struct reflect.Type + Field1, Tag1 string + Field2, Tag2 string +} + +func (e *TagPathError) Error() string { + return fmt.Sprintf("%s field %q with tag %q conflicts with field %q with tag %q", e.Struct, e.Field1, e.Tag1, e.Field2, e.Tag2) +} + +const ( + initNilPointers = true + dontInitNilPointers = false +) + +// value returns v's field value corresponding to finfo. +// It's equivalent to v.FieldByIndex(finfo.idx), but when passed +// initNilPointers, it initializes and dereferences pointers as necessary. +// When passed dontInitNilPointers and a nil pointer is reached, the function +// returns a zero reflect.Value. +func (finfo *fieldInfo) value(v reflect.Value, shouldInitNilPointers bool) reflect.Value { + for i, x := range finfo.idx { + if i > 0 { + t := v.Type() + if t.Kind() == reflect.Pointer && t.Elem().Kind() == reflect.Struct { + if v.IsNil() { + if !shouldInitNilPointers { + return reflect.Value{} + } + v.Set(reflect.New(v.Type().Elem())) + } + v = v.Elem() + } + } + v = v.Field(x) + } + return v +} diff --git a/go/src/encoding/xml/xml.go b/go/src/encoding/xml/xml.go new file mode 100644 index 0000000000000000000000000000000000000000..951676d4032fe4244b4c85c187030aefa3808662 --- /dev/null +++ b/go/src/encoding/xml/xml.go @@ -0,0 +1,2076 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package xml implements a simple XML 1.0 parser that +// understands XML name spaces. +package xml + +// References: +// Annotated XML spec: https://www.xml.com/axml/testaxml.htm +// XML name spaces: https://www.w3.org/TR/REC-xml-names/ + +import ( + "bufio" + "bytes" + "errors" + "fmt" + "io" + "strconv" + "strings" + "unicode" + "unicode/utf8" +) + +// A SyntaxError represents a syntax error in the XML input stream. +type SyntaxError struct { + Msg string + Line int +} + +func (e *SyntaxError) Error() string { + return "XML syntax error on line " + strconv.Itoa(e.Line) + ": " + e.Msg +} + +// A Name represents an XML name (Local) annotated +// with a name space identifier (Space). +// In tokens returned by [Decoder.Token], the Space identifier +// is given as a canonical URL, not the short prefix used +// in the document being parsed. +type Name struct { + Space, Local string +} + +// An Attr represents an attribute in an XML element (Name=Value). +type Attr struct { + Name Name + Value string +} + +// A Token is an interface holding one of the token types: +// [StartElement], [EndElement], [CharData], [Comment], [ProcInst], or [Directive]. +type Token any + +// A StartElement represents an XML start element. +type StartElement struct { + Name Name + Attr []Attr +} + +// Copy creates a new copy of StartElement. +func (e StartElement) Copy() StartElement { + attrs := make([]Attr, len(e.Attr)) + copy(attrs, e.Attr) + e.Attr = attrs + return e +} + +// End returns the corresponding XML end element. +func (e StartElement) End() EndElement { + return EndElement{e.Name} +} + +// An EndElement represents an XML end element. +type EndElement struct { + Name Name +} + +// A CharData represents XML character data (raw text), +// in which XML escape sequences have been replaced by +// the characters they represent. +type CharData []byte + +// Copy creates a new copy of CharData. +func (c CharData) Copy() CharData { return CharData(bytes.Clone(c)) } + +// A Comment represents an XML comment of the form . +// The bytes do not include the comment markers. +type Comment []byte + +// Copy creates a new copy of Comment. +func (c Comment) Copy() Comment { return Comment(bytes.Clone(c)) } + +// A ProcInst represents an XML processing instruction of the form +type ProcInst struct { + Target string + Inst []byte +} + +// Copy creates a new copy of ProcInst. +func (p ProcInst) Copy() ProcInst { + p.Inst = bytes.Clone(p.Inst) + return p +} + +// A Directive represents an XML directive of the form . +// The bytes do not include the markers. +type Directive []byte + +// Copy creates a new copy of Directive. +func (d Directive) Copy() Directive { return Directive(bytes.Clone(d)) } + +// CopyToken returns a copy of a Token. +func CopyToken(t Token) Token { + switch v := t.(type) { + case CharData: + return v.Copy() + case Comment: + return v.Copy() + case Directive: + return v.Copy() + case ProcInst: + return v.Copy() + case StartElement: + return v.Copy() + } + return t +} + +// A TokenReader is anything that can decode a stream of XML tokens, including a +// [Decoder]. +// +// When Token encounters an error or end-of-file condition after successfully +// reading a token, it returns the token. It may return the (non-nil) error from +// the same call or return the error (and a nil token) from a subsequent call. +// An instance of this general case is that a TokenReader returning a non-nil +// token at the end of the token stream may return either io.EOF or a nil error. +// The next Read should return nil, [io.EOF]. +// +// Implementations of Token are discouraged from returning a nil token with a +// nil error. Callers should treat a return of nil, nil as indicating that +// nothing happened; in particular it does not indicate EOF. +type TokenReader interface { + Token() (Token, error) +} + +// A Decoder represents an XML parser reading a particular input stream. +// The parser assumes that its input is encoded in UTF-8. +type Decoder struct { + // Strict defaults to true, enforcing the requirements + // of the XML specification. + // If set to false, the parser allows input containing common + // mistakes: + // * If an element is missing an end tag, the parser invents + // end tags as necessary to keep the return values from Token + // properly balanced. + // * In attribute values and character data, unknown or malformed + // character entities (sequences beginning with &) are left alone. + // + // Setting: + // + // d.Strict = false + // d.AutoClose = xml.HTMLAutoClose + // d.Entity = xml.HTMLEntity + // + // creates a parser that can handle typical HTML. + // + // Strict mode does not enforce the requirements of the XML name spaces TR. + // In particular it does not reject name space tags using undefined prefixes. + // Such tags are recorded with the unknown prefix as the name space URL. + Strict bool + + // When Strict == false, AutoClose indicates a set of elements to + // consider closed immediately after they are opened, regardless + // of whether an end element is present. + AutoClose []string + + // Entity can be used to map non-standard entity names to string replacements. + // The parser behaves as if these standard mappings are present in the map, + // regardless of the actual map content: + // + // "lt": "<", + // "gt": ">", + // "amp": "&", + // "apos": "'", + // "quot": `"`, + Entity map[string]string + + // CharsetReader, if non-nil, defines a function to generate + // charset-conversion readers, converting from the provided + // non-UTF-8 charset into UTF-8. If CharsetReader is nil or + // returns an error, parsing stops with an error. One of the + // CharsetReader's result values must be non-nil. + CharsetReader func(charset string, input io.Reader) (io.Reader, error) + + // DefaultSpace sets the default name space used for unadorned tags, + // as if the entire XML stream were wrapped in an element containing + // the attribute xmlns="DefaultSpace". + DefaultSpace string + + r io.ByteReader + t TokenReader + buf bytes.Buffer + saved *bytes.Buffer + stk *stack + free *stack + needClose bool + toClose Name + nextToken Token + nextByte int + ns map[string]string + err error + line int + linestart int64 + offset int64 + unmarshalDepth int +} + +// NewDecoder creates a new XML parser reading from r. +// If r does not implement [io.ByteReader], NewDecoder will +// do its own buffering. +func NewDecoder(r io.Reader) *Decoder { + d := &Decoder{ + ns: make(map[string]string), + nextByte: -1, + line: 1, + Strict: true, + } + d.switchToReader(r) + return d +} + +// NewTokenDecoder creates a new XML parser using an underlying token stream. +func NewTokenDecoder(t TokenReader) *Decoder { + // Is it already a Decoder? + if d, ok := t.(*Decoder); ok { + return d + } + d := &Decoder{ + ns: make(map[string]string), + t: t, + nextByte: -1, + line: 1, + Strict: true, + } + return d +} + +// Token returns the next XML token in the input stream. +// At the end of the input stream, Token returns nil, [io.EOF]. +// +// Slices of bytes in the returned token data refer to the +// parser's internal buffer and remain valid only until the next +// call to Token. To acquire a copy of the bytes, call [CopyToken] +// or the token's Copy method. +// +// Token expands self-closing elements such as
+// into separate start and end elements returned by successive calls. +// +// Token guarantees that the [StartElement] and [EndElement] +// tokens it returns are properly nested and matched: +// if Token encounters an unexpected end element +// or EOF before all expected end elements, +// it will return an error. +// +// If [Decoder.CharsetReader] is called and returns an error, +// the error is wrapped and returned. +// +// Token implements XML name spaces as described by +// https://www.w3.org/TR/REC-xml-names/. Each of the +// [Name] structures contained in the Token has the Space +// set to the URL identifying its name space when known. +// If Token encounters an unrecognized name space prefix, +// it uses the prefix as the Space rather than report an error. +func (d *Decoder) Token() (Token, error) { + var t Token + var err error + if d.stk != nil && d.stk.kind == stkEOF { + return nil, io.EOF + } + if d.nextToken != nil { + t = d.nextToken + d.nextToken = nil + } else { + if t, err = d.rawToken(); t == nil && err != nil { + if err == io.EOF && d.stk != nil && d.stk.kind != stkEOF { + err = d.syntaxError("unexpected EOF") + } + return nil, err + } + // We still have a token to process, so clear any + // errors (e.g. EOF) and proceed. + err = nil + } + if !d.Strict { + if t1, ok := d.autoClose(t); ok { + d.nextToken = t + t = t1 + } + } + switch t1 := t.(type) { + case StartElement: + // In XML name spaces, the translations listed in the + // attributes apply to the element name and + // to the other attribute names, so process + // the translations first. + for _, a := range t1.Attr { + if a.Name.Space == xmlnsPrefix { + v, ok := d.ns[a.Name.Local] + d.pushNs(a.Name.Local, v, ok) + d.ns[a.Name.Local] = a.Value + } + if a.Name.Space == "" && a.Name.Local == xmlnsPrefix { + // Default space for untagged names + v, ok := d.ns[""] + d.pushNs("", v, ok) + d.ns[""] = a.Value + } + } + + d.pushElement(t1.Name) + d.translate(&t1.Name, true) + for i := range t1.Attr { + d.translate(&t1.Attr[i].Name, false) + } + t = t1 + + case EndElement: + if !d.popElement(&t1) { + return nil, d.err + } + t = t1 + } + return t, err +} + +const ( + xmlURL = "http://www.w3.org/XML/1998/namespace" + xmlnsPrefix = "xmlns" + xmlPrefix = "xml" +) + +// Apply name space translation to name n. +// The default name space (for Space=="") +// applies only to element names, not to attribute names. +func (d *Decoder) translate(n *Name, isElementName bool) { + switch { + case n.Space == xmlnsPrefix: + return + case n.Space == "" && !isElementName: + return + case n.Space == xmlPrefix: + n.Space = xmlURL + case n.Space == "" && n.Local == xmlnsPrefix: + return + } + if v, ok := d.ns[n.Space]; ok { + n.Space = v + } else if n.Space == "" { + n.Space = d.DefaultSpace + } +} + +func (d *Decoder) switchToReader(r io.Reader) { + // Get efficient byte at a time reader. + // Assume that if reader has its own + // ReadByte, it's efficient enough. + // Otherwise, use bufio. + if rb, ok := r.(io.ByteReader); ok { + d.r = rb + } else { + d.r = bufio.NewReader(r) + } +} + +// Parsing state - stack holds old name space translations +// and the current set of open elements. The translations to pop when +// ending a given tag are *below* it on the stack, which is +// more work but forced on us by XML. +type stack struct { + next *stack + kind int + name Name + ok bool +} + +const ( + stkStart = iota + stkNs + stkEOF +) + +func (d *Decoder) push(kind int) *stack { + s := d.free + if s != nil { + d.free = s.next + } else { + s = new(stack) + } + s.next = d.stk + s.kind = kind + d.stk = s + return s +} + +func (d *Decoder) pop() *stack { + s := d.stk + if s != nil { + d.stk = s.next + s.next = d.free + d.free = s + } + return s +} + +// Record that after the current element is finished +// (that element is already pushed on the stack) +// Token should return EOF until popEOF is called. +func (d *Decoder) pushEOF() { + // Walk down stack to find Start. + // It might not be the top, because there might be stkNs + // entries above it. + start := d.stk + for start.kind != stkStart { + start = start.next + } + // The stkNs entries below a start are associated with that + // element too; skip over them. + for start.next != nil && start.next.kind == stkNs { + start = start.next + } + s := d.free + if s != nil { + d.free = s.next + } else { + s = new(stack) + } + s.kind = stkEOF + s.next = start.next + start.next = s +} + +// Undo a pushEOF. +// The element must have been finished, so the EOF should be at the top of the stack. +func (d *Decoder) popEOF() bool { + if d.stk == nil || d.stk.kind != stkEOF { + return false + } + d.pop() + return true +} + +// Record that we are starting an element with the given name. +func (d *Decoder) pushElement(name Name) { + s := d.push(stkStart) + s.name = name +} + +// Record that we are changing the value of ns[local]. +// The old value is url, ok. +func (d *Decoder) pushNs(local string, url string, ok bool) { + s := d.push(stkNs) + s.name.Local = local + s.name.Space = url + s.ok = ok +} + +// Creates a SyntaxError with the current line number. +func (d *Decoder) syntaxError(msg string) error { + return &SyntaxError{Msg: msg, Line: d.line} +} + +// Record that we are ending an element with the given name. +// The name must match the record at the top of the stack, +// which must be a pushElement record. +// After popping the element, apply any undo records from +// the stack to restore the name translations that existed +// before we saw this element. +func (d *Decoder) popElement(t *EndElement) bool { + s := d.pop() + name := t.Name + switch { + case s == nil || s.kind != stkStart: + d.err = d.syntaxError("unexpected end element ") + return false + case s.name.Local != name.Local: + if !d.Strict { + d.needClose = true + d.toClose = t.Name + t.Name = s.name + return true + } + d.err = d.syntaxError("element <" + s.name.Local + "> closed by ") + return false + case s.name.Space != name.Space: + ns := name.Space + if name.Space == "" { + ns = `""` + } + d.err = d.syntaxError("element <" + s.name.Local + "> in space " + s.name.Space + + " closed by in space " + ns) + return false + } + + d.translate(&t.Name, true) + + // Pop stack until a Start or EOF is on the top, undoing the + // translations that were associated with the element we just closed. + for d.stk != nil && d.stk.kind != stkStart && d.stk.kind != stkEOF { + s := d.pop() + if s.ok { + d.ns[s.name.Local] = s.name.Space + } else { + delete(d.ns, s.name.Local) + } + } + + return true +} + +// If the top element on the stack is autoclosing and +// t is not the end tag, invent the end tag. +func (d *Decoder) autoClose(t Token) (Token, bool) { + if d.stk == nil || d.stk.kind != stkStart { + return nil, false + } + for _, s := range d.AutoClose { + if strings.EqualFold(s, d.stk.name.Local) { + // This one should be auto closed if t doesn't close it. + et, ok := t.(EndElement) + if !ok || !strings.EqualFold(et.Name.Local, d.stk.name.Local) { + return EndElement{d.stk.name}, true + } + break + } + } + return nil, false +} + +var errRawToken = errors.New("xml: cannot use RawToken from UnmarshalXML method") + +// RawToken is like [Decoder.Token] but does not verify that +// start and end elements match and does not translate +// name space prefixes to their corresponding URLs. +func (d *Decoder) RawToken() (Token, error) { + if d.unmarshalDepth > 0 { + return nil, errRawToken + } + return d.rawToken() +} + +func (d *Decoder) rawToken() (Token, error) { + if d.t != nil { + return d.t.Token() + } + if d.err != nil { + return nil, d.err + } + if d.needClose { + // The last element we read was self-closing and + // we returned just the StartElement half. + // Return the EndElement half now. + d.needClose = false + return EndElement{d.toClose}, nil + } + + b, ok := d.getc() + if !ok { + return nil, d.err + } + + if b != '<' { + // Text section. + d.ungetc(b) + data := d.text(-1, false) + if data == nil { + return nil, d.err + } + return CharData(data), nil + } + + if b, ok = d.mustgetc(); !ok { + return nil, d.err + } + switch b { + case '/': + // ' { + d.err = d.syntaxError("invalid characters between ") + return nil, d.err + } + return EndElement{name}, nil + + case '?': + // ' { + break + } + b0 = b + } + data := d.buf.Bytes() + data = data[0 : len(data)-2] // chop ?> + + if target == "xml" { + content := string(data) + ver := procInst("version", content) + if ver != "" && ver != "1.0" { + d.err = fmt.Errorf("xml: unsupported version %q; only version 1.0 is supported", ver) + return nil, d.err + } + enc := procInst("encoding", content) + if enc != "" && enc != "utf-8" && enc != "UTF-8" && !strings.EqualFold(enc, "utf-8") { + if d.CharsetReader == nil { + d.err = fmt.Errorf("xml: encoding %q declared but Decoder.CharsetReader is nil", enc) + return nil, d.err + } + newr, err := d.CharsetReader(enc, d.r.(io.Reader)) + if err != nil { + d.err = fmt.Errorf("xml: opening charset %q: %w", enc, err) + return nil, d.err + } + if newr == nil { + panic("CharsetReader returned a nil Reader for charset " + enc) + } + d.switchToReader(newr) + } + } + return ProcInst{target, data}, nil + + case '!': + // ' { + d.err = d.syntaxError( + `invalid sequence "--" not allowed in comments`) + return nil, d.err + } + break + } + b0, b1 = b1, b + } + data := d.buf.Bytes() + data = data[0 : len(data)-3] // chop --> + return Comment(data), nil + + case '[': // . + data := d.text(-1, true) + if data == nil { + return nil, d.err + } + return CharData(data), nil + } + + // Probably a directive: , , etc. + // We don't care, but accumulate for caller. Quoted angle + // brackets do not count for nesting. + d.buf.Reset() + d.buf.WriteByte(b) + inquote := uint8(0) + depth := 0 + for { + if b, ok = d.mustgetc(); !ok { + return nil, d.err + } + if inquote == 0 && b == '>' && depth == 0 { + break + } + HandleB: + d.buf.WriteByte(b) + switch { + case b == inquote: + inquote = 0 + + case inquote != 0: + // in quotes, no special action + + case b == '\'' || b == '"': + inquote = b + + case b == '>' && inquote == 0: + depth-- + + case b == '<' && inquote == 0: + // Look for ` + +var testEntity = map[string]string{"何": "What", "is-it": "is it?"} + +var rawTokens = []Token{ + CharData("\n"), + ProcInst{"xml", []byte(`version="1.0" encoding="UTF-8"`)}, + CharData("\n"), + Directive(`DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"`), + CharData("\n"), + StartElement{Name{"", "body"}, []Attr{{Name{"xmlns", "foo"}, "ns1"}, {Name{"", "xmlns"}, "ns2"}, {Name{"xmlns", "tag"}, "ns3"}}}, + CharData("\n "), + StartElement{Name{"", "hello"}, []Attr{{Name{"", "lang"}, "en"}}}, + CharData("World <>'\" 白鵬翔"), + EndElement{Name{"", "hello"}}, + CharData("\n "), + StartElement{Name{"", "query"}, []Attr{}}, + CharData("What is it?"), + EndElement{Name{"", "query"}}, + CharData("\n "), + StartElement{Name{"", "goodbye"}, []Attr{}}, + EndElement{Name{"", "goodbye"}}, + CharData("\n "), + StartElement{Name{"", "outer"}, []Attr{{Name{"foo", "attr"}, "value"}, {Name{"xmlns", "tag"}, "ns4"}}}, + CharData("\n "), + StartElement{Name{"", "inner"}, []Attr{}}, + EndElement{Name{"", "inner"}}, + CharData("\n "), + EndElement{Name{"", "outer"}}, + CharData("\n "), + StartElement{Name{"tag", "name"}, []Attr{}}, + CharData("\n "), + CharData("Some text here."), + CharData("\n "), + EndElement{Name{"tag", "name"}}, + CharData("\n"), + EndElement{Name{"", "body"}}, + Comment(" missing final newline "), +} + +var cookedTokens = []Token{ + CharData("\n"), + ProcInst{"xml", []byte(`version="1.0" encoding="UTF-8"`)}, + CharData("\n"), + Directive(`DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"`), + CharData("\n"), + StartElement{Name{"ns2", "body"}, []Attr{{Name{"xmlns", "foo"}, "ns1"}, {Name{"", "xmlns"}, "ns2"}, {Name{"xmlns", "tag"}, "ns3"}}}, + CharData("\n "), + StartElement{Name{"ns2", "hello"}, []Attr{{Name{"", "lang"}, "en"}}}, + CharData("World <>'\" 白鵬翔"), + EndElement{Name{"ns2", "hello"}}, + CharData("\n "), + StartElement{Name{"ns2", "query"}, []Attr{}}, + CharData("What is it?"), + EndElement{Name{"ns2", "query"}}, + CharData("\n "), + StartElement{Name{"ns2", "goodbye"}, []Attr{}}, + EndElement{Name{"ns2", "goodbye"}}, + CharData("\n "), + StartElement{Name{"ns2", "outer"}, []Attr{{Name{"ns1", "attr"}, "value"}, {Name{"xmlns", "tag"}, "ns4"}}}, + CharData("\n "), + StartElement{Name{"ns2", "inner"}, []Attr{}}, + EndElement{Name{"ns2", "inner"}}, + CharData("\n "), + EndElement{Name{"ns2", "outer"}}, + CharData("\n "), + StartElement{Name{"ns3", "name"}, []Attr{}}, + CharData("\n "), + CharData("Some text here."), + CharData("\n "), + EndElement{Name{"ns3", "name"}}, + CharData("\n"), + EndElement{Name{"ns2", "body"}}, + Comment(" missing final newline "), +} + +const testInputAltEncoding = ` + +VALUE` + +var rawTokensAltEncoding = []Token{ + CharData("\n"), + ProcInst{"xml", []byte(`version="1.0" encoding="x-testing-uppercase"`)}, + CharData("\n"), + StartElement{Name{"", "tag"}, []Attr{}}, + CharData("value"), + EndElement{Name{"", "tag"}}, +} + +var xmlInput = []string{ + // unexpected EOF cases + "<", + "", + "", + "", + // "", // let the Token() caller handle + "", + "", + "", + "", + " c;", + "", + "", + "", + // "", // let the Token() caller handle + "", + "", + "cdata]]>", +} + +func TestRawToken(t *testing.T) { + d := NewDecoder(strings.NewReader(testInput)) + d.Entity = testEntity + testRawToken(t, d, testInput, rawTokens) +} + +const nonStrictInput = ` +non&entity +&unknown;entity +{ +&#zzz; +&なまえ3; +<-gt; +&; +&0a; +` + +var nonStrictTokens = []Token{ + CharData("\n"), + StartElement{Name{"", "tag"}, []Attr{}}, + CharData("non&entity"), + EndElement{Name{"", "tag"}}, + CharData("\n"), + StartElement{Name{"", "tag"}, []Attr{}}, + CharData("&unknown;entity"), + EndElement{Name{"", "tag"}}, + CharData("\n"), + StartElement{Name{"", "tag"}, []Attr{}}, + CharData("{"), + EndElement{Name{"", "tag"}}, + CharData("\n"), + StartElement{Name{"", "tag"}, []Attr{}}, + CharData("&#zzz;"), + EndElement{Name{"", "tag"}}, + CharData("\n"), + StartElement{Name{"", "tag"}, []Attr{}}, + CharData("&なまえ3;"), + EndElement{Name{"", "tag"}}, + CharData("\n"), + StartElement{Name{"", "tag"}, []Attr{}}, + CharData("<-gt;"), + EndElement{Name{"", "tag"}}, + CharData("\n"), + StartElement{Name{"", "tag"}, []Attr{}}, + CharData("&;"), + EndElement{Name{"", "tag"}}, + CharData("\n"), + StartElement{Name{"", "tag"}, []Attr{}}, + CharData("&0a;"), + EndElement{Name{"", "tag"}}, + CharData("\n"), +} + +func TestNonStrictRawToken(t *testing.T) { + d := NewDecoder(strings.NewReader(nonStrictInput)) + d.Strict = false + testRawToken(t, d, nonStrictInput, nonStrictTokens) +} + +type downCaser struct { + t *testing.T + r io.ByteReader +} + +func (d *downCaser) ReadByte() (c byte, err error) { + c, err = d.r.ReadByte() + if c >= 'A' && c <= 'Z' { + c += 'a' - 'A' + } + return +} + +func (d *downCaser) Read(p []byte) (int, error) { + d.t.Fatalf("unexpected Read call on downCaser reader") + panic("unreachable") +} + +func TestRawTokenAltEncoding(t *testing.T) { + d := NewDecoder(strings.NewReader(testInputAltEncoding)) + d.CharsetReader = func(charset string, input io.Reader) (io.Reader, error) { + if charset != "x-testing-uppercase" { + t.Fatalf("unexpected charset %q", charset) + } + return &downCaser{t, input.(io.ByteReader)}, nil + } + testRawToken(t, d, testInputAltEncoding, rawTokensAltEncoding) +} + +func TestRawTokenAltEncodingNoConverter(t *testing.T) { + d := NewDecoder(strings.NewReader(testInputAltEncoding)) + token, err := d.RawToken() + if token == nil { + t.Fatalf("expected a token on first RawToken call") + } + if err != nil { + t.Fatal(err) + } + token, err = d.RawToken() + if token != nil { + t.Errorf("expected a nil token; got %#v", token) + } + if err == nil { + t.Fatalf("expected an error on second RawToken call") + } + const encoding = "x-testing-uppercase" + if !strings.Contains(err.Error(), encoding) { + t.Errorf("expected error to contain %q; got error: %v", + encoding, err) + } +} + +func testRawToken(t *testing.T, d *Decoder, raw string, rawTokens []Token) { + lastEnd := int64(0) + for i, want := range rawTokens { + start := d.InputOffset() + have, err := d.RawToken() + end := d.InputOffset() + if err != nil { + t.Fatalf("token %d: unexpected error: %s", i, err) + } + if !reflect.DeepEqual(have, want) { + var shave, swant string + if _, ok := have.(CharData); ok { + shave = fmt.Sprintf("CharData(%q)", have) + } else { + shave = fmt.Sprintf("%#v", have) + } + if _, ok := want.(CharData); ok { + swant = fmt.Sprintf("CharData(%q)", want) + } else { + swant = fmt.Sprintf("%#v", want) + } + t.Errorf("token %d = %s, want %s", i, shave, swant) + } + + // Check that InputOffset returned actual token. + switch { + case start < lastEnd: + t.Errorf("token %d: position [%d,%d) for %T is before previous token", i, start, end, have) + case start >= end: + // Special case: EndElement can be synthesized. + if start == end && end == lastEnd { + break + } + t.Errorf("token %d: position [%d,%d) for %T is empty", i, start, end, have) + case end > int64(len(raw)): + t.Errorf("token %d: position [%d,%d) for %T extends beyond input", i, start, end, have) + default: + text := raw[start:end] + if strings.ContainsAny(text, "<>") && (!strings.HasPrefix(text, "<") || !strings.HasSuffix(text, ">")) { + t.Errorf("token %d: misaligned raw token %#q for %T", i, text, have) + } + } + lastEnd = end + } +} + +// Ensure that directives (specifically !DOCTYPE) include the complete +// text of any nested directives, noting that < and > do not change +// nesting depth if they are in single or double quotes. + +var nestedDirectivesInput = ` +]> +">]> +]> +'>]> +]> +'>]> +]> +` + +var nestedDirectivesTokens = []Token{ + CharData("\n"), + Directive(`DOCTYPE []`), + CharData("\n"), + Directive(`DOCTYPE [">]`), + CharData("\n"), + Directive(`DOCTYPE []`), + CharData("\n"), + Directive(`DOCTYPE ['>]`), + CharData("\n"), + Directive(`DOCTYPE []`), + CharData("\n"), + Directive(`DOCTYPE ['>]`), + CharData("\n"), + Directive(`DOCTYPE []`), + CharData("\n"), +} + +func TestNestedDirectives(t *testing.T) { + d := NewDecoder(strings.NewReader(nestedDirectivesInput)) + + for i, want := range nestedDirectivesTokens { + have, err := d.Token() + if err != nil { + t.Fatalf("token %d: unexpected error: %s", i, err) + } + if !reflect.DeepEqual(have, want) { + t.Errorf("token %d = %#v want %#v", i, have, want) + } + } +} + +func TestToken(t *testing.T) { + d := NewDecoder(strings.NewReader(testInput)) + d.Entity = testEntity + + for i, want := range cookedTokens { + have, err := d.Token() + if err != nil { + t.Fatalf("token %d: unexpected error: %s", i, err) + } + if !reflect.DeepEqual(have, want) { + t.Errorf("token %d = %#v want %#v", i, have, want) + } + } +} + +func TestSyntax(t *testing.T) { + for i := range xmlInput { + d := NewDecoder(strings.NewReader(xmlInput[i])) + var err error + for _, err = d.Token(); err == nil; _, err = d.Token() { + } + if _, ok := err.(*SyntaxError); !ok { + t.Fatalf(`xmlInput "%s": expected SyntaxError not received`, xmlInput[i]) + } + } +} + +func TestInputLinePos(t *testing.T) { + testInput := ` + + +` + linePos := [][]int{ + {1, 7}, + {2, 1}, + {3, 4}, + {3, 6}, + {6, 7}, + {7, 1}, + {8, 4}, + {10, 4}, + {10, 10}, + {11, 1}, + {11, 8}, + } + dec := NewDecoder(strings.NewReader(testInput)) + for _, want := range linePos { + if _, err := dec.Token(); err != nil { + t.Errorf("Unexpected error: %v", err) + continue + } + + gotLine, gotCol := dec.InputPos() + if gotLine != want[0] || gotCol != want[1] { + t.Errorf("dec.InputPos() = %d,%d, want %d,%d", gotLine, gotCol, want[0], want[1]) + } + } +} + +type allScalars struct { + True1 bool + True2 bool + False1 bool + False2 bool + Int int + Int8 int8 + Int16 int16 + Int32 int32 + Int64 int64 + Uint int + Uint8 uint8 + Uint16 uint16 + Uint32 uint32 + Uint64 uint64 + Uintptr uintptr + Float32 float32 + Float64 float64 + String string + PtrString *string +} + +var all = allScalars{ + True1: true, + True2: true, + False1: false, + False2: false, + Int: 1, + Int8: -2, + Int16: 3, + Int32: -4, + Int64: 5, + Uint: 6, + Uint8: 7, + Uint16: 8, + Uint32: 9, + Uint64: 10, + Uintptr: 11, + Float32: 13.0, + Float64: 14.0, + String: "15", + PtrString: &sixteen, +} + +var sixteen = "16" + +const testScalarsInput = ` + true + 1 + false + 0 + 1 + -2 + 3 + -4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12.0 + 13.0 + 14.0 + 15 + 16 +` + +func TestAllScalars(t *testing.T) { + var a allScalars + err := Unmarshal([]byte(testScalarsInput), &a) + + if err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(a, all) { + t.Errorf("have %+v want %+v", a, all) + } +} + +type item struct { + FieldA string +} + +func TestIssue68387(t *testing.T) { + data := `` + dec := NewDecoder(strings.NewReader(data)) + var tok1, tok2, tok3 Token + var err error + if tok1, err = dec.RawToken(); err != nil { + t.Fatalf("RawToken() failed: %v", err) + } + if tok2, err = dec.RawToken(); err != nil { + t.Fatalf("RawToken() failed: %v", err) + } + if tok3, err = dec.RawToken(); err != io.EOF || tok3 != nil { + t.Fatalf("Missed EOF") + } + s := StartElement{Name{"", "item"}, []Attr{Attr{Name{"", "b"}, "]]>"}}} + if !reflect.DeepEqual(tok1.(StartElement), s) { + t.Error("Wrong start element") + } + e := EndElement{Name{"", "item"}} + if tok2.(EndElement) != e { + t.Error("Wrong end element") + } +} + +func TestIssue569(t *testing.T) { + data := `abcd` + var i item + err := Unmarshal([]byte(data), &i) + + if err != nil || i.FieldA != "abcd" { + t.Fatal("Expecting abcd") + } +} + +func TestUnquotedAttrs(t *testing.T) { + data := "" + d := NewDecoder(strings.NewReader(data)) + d.Strict = false + token, err := d.Token() + if _, ok := err.(*SyntaxError); ok { + t.Errorf("Unexpected error: %v", err) + } + if token.(StartElement).Name.Local != "tag" { + t.Errorf("Unexpected tag name: %v", token.(StartElement).Name.Local) + } + attr := token.(StartElement).Attr[0] + if attr.Value != "azAZ09:-_" { + t.Errorf("Unexpected attribute value: %v", attr.Value) + } + if attr.Name.Local != "attr" { + t.Errorf("Unexpected attribute name: %v", attr.Name.Local) + } +} + +func TestValuelessAttrs(t *testing.T) { + tests := [][3]string{ + {"

", "p", "nowrap"}, + {"

", "p", "nowrap"}, + {"", "input", "checked"}, + {"", "input", "checked"}, + } + for _, test := range tests { + d := NewDecoder(strings.NewReader(test[0])) + d.Strict = false + token, err := d.Token() + if _, ok := err.(*SyntaxError); ok { + t.Errorf("Unexpected error: %v", err) + } + if token.(StartElement).Name.Local != test[1] { + t.Errorf("Unexpected tag name: %v", token.(StartElement).Name.Local) + } + attr := token.(StartElement).Attr[0] + if attr.Value != test[2] { + t.Errorf("Unexpected attribute value: %v", attr.Value) + } + if attr.Name.Local != test[2] { + t.Errorf("Unexpected attribute name: %v", attr.Name.Local) + } + } +} + +func TestCopyTokenCharData(t *testing.T) { + data := []byte("same data") + var tok1 Token = CharData(data) + tok2 := CopyToken(tok1) + if !reflect.DeepEqual(tok1, tok2) { + t.Error("CopyToken(CharData) != CharData") + } + data[1] = 'o' + if reflect.DeepEqual(tok1, tok2) { + t.Error("CopyToken(CharData) uses same buffer.") + } +} + +func TestCopyTokenStartElement(t *testing.T) { + elt := StartElement{Name{"", "hello"}, []Attr{{Name{"", "lang"}, "en"}}} + var tok1 Token = elt + tok2 := CopyToken(tok1) + if tok1.(StartElement).Attr[0].Value != "en" { + t.Error("CopyToken overwrote Attr[0]") + } + if !reflect.DeepEqual(tok1, tok2) { + t.Error("CopyToken(StartElement) != StartElement") + } + tok1.(StartElement).Attr[0] = Attr{Name{"", "lang"}, "de"} + if reflect.DeepEqual(tok1, tok2) { + t.Error("CopyToken(CharData) uses same buffer.") + } +} + +func TestCopyTokenComment(t *testing.T) { + data := []byte("") + var tok1 Token = Comment(data) + tok2 := CopyToken(tok1) + if !reflect.DeepEqual(tok1, tok2) { + t.Error("CopyToken(Comment) != Comment") + } + data[1] = 'o' + if reflect.DeepEqual(tok1, tok2) { + t.Error("CopyToken(Comment) uses same buffer.") + } +} + +func TestSyntaxErrorLineNum(t *testing.T) { + testInput := "

Foo

\n\n

Bar\n" + d := NewDecoder(strings.NewReader(testInput)) + var err error + for _, err = d.Token(); err == nil; _, err = d.Token() { + } + synerr, ok := err.(*SyntaxError) + if !ok { + t.Error("Expected SyntaxError.") + } + if synerr.Line != 3 { + t.Error("SyntaxError didn't have correct line number.") + } +} + +func TestTrailingRawToken(t *testing.T) { + input := ` ` + d := NewDecoder(strings.NewReader(input)) + var err error + for _, err = d.RawToken(); err == nil; _, err = d.RawToken() { + } + if err != io.EOF { + t.Fatalf("d.RawToken() = _, %v, want _, io.EOF", err) + } +} + +func TestTrailingToken(t *testing.T) { + input := ` ` + d := NewDecoder(strings.NewReader(input)) + var err error + for _, err = d.Token(); err == nil; _, err = d.Token() { + } + if err != io.EOF { + t.Fatalf("d.Token() = _, %v, want _, io.EOF", err) + } +} + +func TestEntityInsideCDATA(t *testing.T) { + input := `` + d := NewDecoder(strings.NewReader(input)) + var err error + for _, err = d.Token(); err == nil; _, err = d.Token() { + } + if err != io.EOF { + t.Fatalf("d.Token() = _, %v, want _, io.EOF", err) + } +} + +var characterTests = []struct { + in string + err string +}{ + {"\x12", "illegal character code U+0012"}, + {"\x0b", "illegal character code U+000B"}, + {"\xef\xbf\xbe", "illegal character code U+FFFE"}, + {"\r\n\x07", "illegal character code U+0007"}, + {"what's up", "expected attribute name in element"}, + {"&abc\x01;", "invalid character entity &abc (no semicolon)"}, + {"&\x01;", "invalid character entity & (no semicolon)"}, + {"&\xef\xbf\xbe;", "invalid character entity &\uFFFE;"}, + {"&hello;", "invalid character entity &hello;"}, +} + +func TestDisallowedCharacters(t *testing.T) { + + for i, tt := range characterTests { + d := NewDecoder(strings.NewReader(tt.in)) + var err error + + for err == nil { + _, err = d.Token() + } + synerr, ok := err.(*SyntaxError) + if !ok { + t.Fatalf("input %d d.Token() = _, %v, want _, *SyntaxError", i, err) + } + if synerr.Msg != tt.err { + t.Fatalf("input %d synerr.Msg wrong: want %q, got %q", i, tt.err, synerr.Msg) + } + } +} + +func TestIsInCharacterRange(t *testing.T) { + invalid := []rune{ + utf8.MaxRune + 1, + 0xD800, // surrogate min + 0xDFFF, // surrogate max + -1, + } + for _, r := range invalid { + if isInCharacterRange(r) { + t.Errorf("rune %U considered valid", r) + } + } +} + +var procInstTests = []struct { + input string + expect [2]string +}{ + {`version="1.0" encoding="utf-8"`, [2]string{"1.0", "utf-8"}}, + {`version="1.0" encoding='utf-8'`, [2]string{"1.0", "utf-8"}}, + {`version="1.0" encoding='utf-8' `, [2]string{"1.0", "utf-8"}}, + {`version="1.0" encoding=utf-8`, [2]string{"1.0", ""}}, + {`encoding="FOO" `, [2]string{"", "FOO"}}, + {`version=2.0 version="1.0" encoding=utf-7 encoding='utf-8'`, [2]string{"1.0", "utf-8"}}, + {`version= encoding=`, [2]string{"", ""}}, + {`encoding="version=1.0"`, [2]string{"", "version=1.0"}}, + {``, [2]string{"", ""}}, + // TODO: what's the right approach to handle these nested cases? + {`encoding="version='1.0'"`, [2]string{"1.0", "version='1.0'"}}, + {`version="encoding='utf-8'"`, [2]string{"encoding='utf-8'", "utf-8"}}, +} + +func TestProcInstEncoding(t *testing.T) { + for _, test := range procInstTests { + if got := procInst("version", test.input); got != test.expect[0] { + t.Errorf("procInst(version, %q) = %q; want %q", test.input, got, test.expect[0]) + } + if got := procInst("encoding", test.input); got != test.expect[1] { + t.Errorf("procInst(encoding, %q) = %q; want %q", test.input, got, test.expect[1]) + } + } +} + +// Ensure that directives with comments include the complete +// text of any nested directives. + +var directivesWithCommentsInput = ` +]> +]> + --> --> []> +` + +var directivesWithCommentsTokens = []Token{ + CharData("\n"), + Directive(`DOCTYPE [ ]`), + CharData("\n"), + Directive(`DOCTYPE [ ]`), + CharData("\n"), + Directive(`DOCTYPE [ ]`), + CharData("\n"), +} + +func TestDirectivesWithComments(t *testing.T) { + d := NewDecoder(strings.NewReader(directivesWithCommentsInput)) + + for i, want := range directivesWithCommentsTokens { + have, err := d.Token() + if err != nil { + t.Fatalf("token %d: unexpected error: %s", i, err) + } + if !reflect.DeepEqual(have, want) { + t.Errorf("token %d = %#v want %#v", i, have, want) + } + } +} + +// Writer whose Write method always returns an error. +type errWriter struct{} + +func (errWriter) Write(p []byte) (n int, err error) { return 0, fmt.Errorf("unwritable") } + +func TestEscapeTextIOErrors(t *testing.T) { + expectErr := "unwritable" + err := EscapeText(errWriter{}, []byte{'A'}) + + if err == nil || err.Error() != expectErr { + t.Errorf("have %v, want %v", err, expectErr) + } +} + +func TestEscapeTextInvalidChar(t *testing.T) { + input := []byte("A \x00 terminated string.") + expected := "A \uFFFD terminated string." + + buff := new(strings.Builder) + if err := EscapeText(buff, input); err != nil { + t.Fatalf("have %v, want nil", err) + } + text := buff.String() + + if text != expected { + t.Errorf("have %v, want %v", text, expected) + } +} + +func TestIssue5880(t *testing.T) { + type T []byte + data, err := Marshal(T{192, 168, 0, 1}) + if err != nil { + t.Errorf("Marshal error: %v", err) + } + if !utf8.Valid(data) { + t.Errorf("Marshal generated invalid UTF-8: %x", data) + } +} + +func TestIssue8535(t *testing.T) { + + type ExampleConflict struct { + XMLName Name `xml:"example"` + Link string `xml:"link"` + AtomLink string `xml:"http://www.w3.org/2005/Atom link"` // Same name in a different name space + } + testCase := ` + Example + http://example.com/default + http://example.com/home + http://example.com/ns + ` + + var dest ExampleConflict + d := NewDecoder(strings.NewReader(testCase)) + if err := d.Decode(&dest); err != nil { + t.Fatal(err) + } +} + +func TestEncodeXMLNS(t *testing.T) { + testCases := []struct { + f func() ([]byte, error) + want string + ok bool + }{ + {encodeXMLNS1, `hello world`, true}, + {encodeXMLNS2, `hello world`, true}, + {encodeXMLNS3, `hello world`, true}, + {encodeXMLNS4, `hello world`, false}, + } + + for i, tc := range testCases { + if b, err := tc.f(); err == nil { + if got, want := string(b), tc.want; got != want { + t.Errorf("%d: got %s, want %s \n", i, got, want) + } + } else { + t.Errorf("%d: marshal failed with %s", i, err) + } + } +} + +func encodeXMLNS1() ([]byte, error) { + + type T struct { + XMLName Name `xml:"Test"` + Ns string `xml:"xmlns,attr"` + Body string + } + + s := &T{Ns: "http://example.com/ns", Body: "hello world"} + return Marshal(s) +} + +func encodeXMLNS2() ([]byte, error) { + + type Test struct { + Body string `xml:"http://example.com/ns body"` + } + + s := &Test{Body: "hello world"} + return Marshal(s) +} + +func encodeXMLNS3() ([]byte, error) { + + type Test struct { + XMLName Name `xml:"http://example.com/ns Test"` + Body string + } + + //s := &Test{XMLName: Name{"http://example.com/ns",""}, Body: "hello world"} is unusable as the "-" is missing + // as documentation states + s := &Test{Body: "hello world"} + return Marshal(s) +} + +func encodeXMLNS4() ([]byte, error) { + + type Test struct { + Ns string `xml:"xmlns,attr"` + Body string + } + + s := &Test{Ns: "http://example.com/ns", Body: "hello world"} + return Marshal(s) +} + +func TestIssue11405(t *testing.T) { + testCases := []string{ + "", + "", + "", + } + for _, tc := range testCases { + d := NewDecoder(strings.NewReader(tc)) + var err error + for { + _, err = d.Token() + if err != nil { + break + } + } + if _, ok := err.(*SyntaxError); !ok { + t.Errorf("%s: Token: Got error %v, want SyntaxError", tc, err) + } + } +} + +func TestIssue12417(t *testing.T) { + testCases := []struct { + s string + ok bool + }{ + {``, true}, + {``, true}, + {``, true}, + {``, false}, + } + for _, tc := range testCases { + d := NewDecoder(strings.NewReader(tc.s)) + var err error + for { + _, err = d.Token() + if err != nil { + if err == io.EOF { + err = nil + } + break + } + } + if err != nil && tc.ok { + t.Errorf("%q: Encoding charset: expected no error, got %s", tc.s, err) + continue + } + if err == nil && !tc.ok { + t.Errorf("%q: Encoding charset: expected error, got nil", tc.s) + } + } +} + +func TestIssue7113(t *testing.T) { + type C struct { + XMLName Name `xml:""` // Sets empty namespace + } + + type D struct { + XMLName Name `xml:"d"` + } + + type A struct { + XMLName Name `xml:""` + C C `xml:""` + D D + } + + var a A + structSpace := "b" + xmlTest := `` + t.Log(xmlTest) + err := Unmarshal([]byte(xmlTest), &a) + if err != nil { + t.Fatal(err) + } + + if a.XMLName.Space != structSpace { + t.Errorf("overidding with empty namespace: unmarshaling, got %s, want %s\n", a.XMLName.Space, structSpace) + } + if len(a.C.XMLName.Space) != 0 { + t.Fatalf("overidding with empty namespace: unmarshaling, got %s, want empty\n", a.C.XMLName.Space) + } + + var b []byte + b, err = Marshal(&a) + if err != nil { + t.Fatal(err) + } + if len(a.C.XMLName.Space) != 0 { + t.Errorf("overidding with empty namespace: marshaling, got %s in C tag which should be empty\n", a.C.XMLName.Space) + } + if string(b) != xmlTest { + t.Fatalf("overidding with empty namespace: marshaling, got %s, want %s\n", b, xmlTest) + } + var c A + err = Unmarshal(b, &c) + if err != nil { + t.Fatalf("second Unmarshal failed: %s", err) + } + if c.XMLName.Space != "b" { + t.Errorf("overidding with empty namespace: after marshaling & unmarshaling, XML name space: got %s, want %s\n", a.XMLName.Space, structSpace) + } + if len(c.C.XMLName.Space) != 0 { + t.Errorf("overidding with empty namespace: after marshaling & unmarshaling, got %s, want empty\n", a.C.XMLName.Space) + } +} + +func TestIssue20396(t *testing.T) { + + var attrError = UnmarshalError("XML syntax error on line 1: expected attribute name in element") + + testCases := []struct { + s string + wantErr error + }{ + {``, // Issue 20396 + UnmarshalError("XML syntax error on line 1: expected element name after <")}, + {``, attrError}, + {``, attrError}, + {``, nil}, + {`1`, + UnmarshalError("XML syntax error on line 1: expected element name after <")}, + {`1`, attrError}, + {`1`, attrError}, + {`1`, nil}, + } + + var dest string + for _, tc := range testCases { + if got, want := Unmarshal([]byte(tc.s), &dest), tc.wantErr; got != want { + if got == nil { + t.Errorf("%s: Unexpected success, want %v", tc.s, want) + } else if want == nil { + t.Errorf("%s: Unexpected error, got %v", tc.s, got) + } else if got.Error() != want.Error() { + t.Errorf("%s: got %v, want %v", tc.s, got, want) + } + } + } +} + +func TestIssue20685(t *testing.T) { + testCases := []struct { + s string + ok bool + }{ + {`one`, false}, + {`one`, true}, + {`one`, false}, + {`one`, false}, + {`one`, false}, + {`one`, false}, + {`one`, false}, + } + for _, tc := range testCases { + d := NewDecoder(strings.NewReader(tc.s)) + var err error + for { + _, err = d.Token() + if err != nil { + if err == io.EOF { + err = nil + } + break + } + } + if err != nil && tc.ok { + t.Errorf("%q: Closing tag with namespace : expected no error, got %s", tc.s, err) + continue + } + if err == nil && !tc.ok { + t.Errorf("%q: Closing tag with namespace : expected error, got nil", tc.s) + } + } +} + +func tokenMap(mapping func(t Token) Token) func(TokenReader) TokenReader { + return func(src TokenReader) TokenReader { + return mapper{ + t: src, + f: mapping, + } + } +} + +type mapper struct { + t TokenReader + f func(Token) Token +} + +func (m mapper) Token() (Token, error) { + tok, err := m.t.Token() + if err != nil { + return nil, err + } + return m.f(tok), nil +} + +func TestNewTokenDecoderIdempotent(t *testing.T) { + d := NewDecoder(strings.NewReader(`
`)) + d2 := NewTokenDecoder(d) + if d != d2 { + t.Error("NewTokenDecoder did not detect underlying Decoder") + } +} + +func TestWrapDecoder(t *testing.T) { + d := NewDecoder(strings.NewReader(`[Re-enter Clown with a letter, and FABIAN]`)) + m := tokenMap(func(t Token) Token { + switch tok := t.(type) { + case StartElement: + if tok.Name.Local == "quote" { + tok.Name.Local = "blocking" + return tok + } + case EndElement: + if tok.Name.Local == "quote" { + tok.Name.Local = "blocking" + return tok + } + } + return t + }) + + d = NewTokenDecoder(m(d)) + + o := struct { + XMLName Name `xml:"blocking"` + Chardata string `xml:",chardata"` + }{} + + if err := d.Decode(&o); err != nil { + t.Fatal("Got unexpected error while decoding:", err) + } + + if o.Chardata != "[Re-enter Clown with a letter, and FABIAN]" { + t.Fatalf("Got unexpected chardata: `%s`\n", o.Chardata) + } +} + +type tokReader struct{} + +func (tokReader) Token() (Token, error) { + return StartElement{}, nil +} + +type Failure struct{} + +func (Failure) UnmarshalXML(*Decoder, StartElement) error { + return nil +} + +func TestTokenUnmarshaler(t *testing.T) { + defer func() { + if r := recover(); r != nil { + t.Error("Unexpected panic using custom token unmarshaler") + } + }() + + d := NewTokenDecoder(tokReader{}) + d.Decode(&Failure{}) +} + +func testRoundTrip(t *testing.T, input string) { + d := NewDecoder(strings.NewReader(input)) + var tokens []Token + var buf bytes.Buffer + e := NewEncoder(&buf) + for { + tok, err := d.Token() + if err == io.EOF { + break + } + if err != nil { + t.Fatalf("invalid input: %v", err) + } + if err := e.EncodeToken(tok); err != nil { + t.Fatalf("failed to re-encode input: %v", err) + } + tokens = append(tokens, CopyToken(tok)) + } + if err := e.Flush(); err != nil { + t.Fatal(err) + } + + d = NewDecoder(&buf) + for { + tok, err := d.Token() + if err == io.EOF { + break + } + if err != nil { + t.Fatalf("failed to decode output: %v", err) + } + if len(tokens) == 0 { + t.Fatalf("unexpected token: %#v", tok) + } + a, b := tokens[0], tok + if !reflect.DeepEqual(a, b) { + t.Fatalf("token mismatch: %#v vs %#v", a, b) + } + tokens = tokens[1:] + } + if len(tokens) > 0 { + t.Fatalf("lost tokens: %#v", tokens) + } +} + +func TestRoundTrip(t *testing.T) { + tests := map[string]string{ + "trailing colon": ``, + "comments in directives": `--x --> > --x ]>`, + } + for name, input := range tests { + t.Run(name, func(t *testing.T) { testRoundTrip(t, input) }) + } +} + +func TestParseErrors(t *testing.T) { + withDefaultHeader := func(s string) string { + return `` + s + } + tests := []struct { + src string + err string + }{ + {withDefaultHeader(``), `unexpected end element `}, + {withDefaultHeader(``), `element in space x closed by in space y`}, + {withDefaultHeader(``), `expected target name after `), `invalid sequence `), `invalid sequence `), `invalid baz`), + `element in space zzz closed by in space ""`}, + {withDefaultHeader("\xf1"), `invalid UTF-8`}, + + // Header-related errors. + {``, `unsupported version "1.1"; only version 1.0 is supported`}, + + // Cases below are for "no errors". + {withDefaultHeader(``), ``}, + {withDefaultHeader(``), ``}, + } + + for _, test := range tests { + d := NewDecoder(strings.NewReader(test.src)) + var err error + for { + _, err = d.Token() + if err != nil { + break + } + } + if test.err == "" { + if err != io.EOF { + t.Errorf("parse %s: have %q error, expected none", test.src, err) + } + continue + } + // Inv: err != nil + if err == io.EOF { + t.Errorf("parse %s: unexpected EOF", test.src) + continue + } + if !strings.Contains(err.Error(), test.err) { + t.Errorf("parse %s: can't find %q error substring\nerror: %q", test.src, test.err, err) + continue + } + } +} + +const testInputHTMLAutoClose = ` +
+

+

+

+
+

+

+
abc

` + +func BenchmarkHTMLAutoClose(b *testing.B) { + b.RunParallel(func(p *testing.PB) { + for p.Next() { + d := NewDecoder(strings.NewReader(testInputHTMLAutoClose)) + d.Strict = false + d.AutoClose = HTMLAutoClose + d.Entity = HTMLEntity + for { + _, err := d.Token() + if err != nil { + if err == io.EOF { + break + } + b.Fatalf("unexpected error: %v", err) + } + } + } + }) +} + +func TestHTMLAutoClose(t *testing.T) { + wantTokens := []Token{ + ProcInst{"xml", []byte(`version="1.0" encoding="UTF-8"`)}, + CharData("\n"), + StartElement{Name{"", "br"}, []Attr{}}, + EndElement{Name{"", "br"}}, + CharData("\n"), + StartElement{Name{"", "br"}, []Attr{}}, + EndElement{Name{"", "br"}}, + StartElement{Name{"", "br"}, []Attr{}}, + EndElement{Name{"", "br"}}, + CharData("\n"), + StartElement{Name{"", "br"}, []Attr{}}, + EndElement{Name{"", "br"}}, + StartElement{Name{"", "br"}, []Attr{}}, + EndElement{Name{"", "br"}}, + CharData("\n"), + StartElement{Name{"", "br"}, []Attr{}}, + EndElement{Name{"", "br"}}, + CharData("\n"), + StartElement{Name{"", "BR"}, []Attr{}}, + EndElement{Name{"", "BR"}}, + CharData("\n"), + StartElement{Name{"", "BR"}, []Attr{}}, + EndElement{Name{"", "BR"}}, + StartElement{Name{"", "BR"}, []Attr{}}, + EndElement{Name{"", "BR"}}, + CharData("\n"), + StartElement{Name{"", "Br"}, []Attr{}}, + EndElement{Name{"", "Br"}}, + CharData("\n"), + StartElement{Name{"", "BR"}, []Attr{}}, + EndElement{Name{"", "BR"}}, + StartElement{Name{"", "span"}, []Attr{{Name: Name{"", "id"}, Value: "test"}}}, + CharData("abc"), + EndElement{Name{"", "span"}}, + StartElement{Name{"", "br"}, []Attr{}}, + EndElement{Name{"", "br"}}, + StartElement{Name{"", "br"}, []Attr{}}, + EndElement{Name{"", "br"}}, + } + + d := NewDecoder(strings.NewReader(testInputHTMLAutoClose)) + d.Strict = false + d.AutoClose = HTMLAutoClose + d.Entity = HTMLEntity + var haveTokens []Token + for { + tok, err := d.Token() + if err != nil { + if err == io.EOF { + break + } + t.Fatalf("unexpected error: %v", err) + } + haveTokens = append(haveTokens, CopyToken(tok)) + } + if len(haveTokens) != len(wantTokens) { + t.Errorf("tokens count mismatch: have %d, want %d", len(haveTokens), len(wantTokens)) + } + for i, want := range wantTokens { + if i >= len(haveTokens) { + t.Errorf("token[%d] expected %#v, have no token", i, want) + } else { + have := haveTokens[i] + if !reflect.DeepEqual(have, want) { + t.Errorf("token[%d] mismatch:\nhave: %#v\nwant: %#v", i, have, want) + } + } + } +}