Move PKCS#12 samples to embed_test_data.

pkcs12_test.cc was getting a bit long. Along the way, embed_test_data.go
needed a fix to work around a syntax quirk of C++.

Change-Id: Ic4a19f77d177ebd607918feb253a08f1f9037981
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46044
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
grpc-202302
David Benjamin 4 years ago committed by CQ bot account: commit-bot@chromium.org
parent a1d1a67589
commit 84c0c900fc
  1. 1523
      crypto/pkcs8/pkcs12_test.cc
  2. BIN
      crypto/pkcs8/test/empty_password.p12
  3. BIN
      crypto/pkcs8/test/no_encryption.p12
  4. BIN
      crypto/pkcs8/test/nss.p12
  5. BIN
      crypto/pkcs8/test/null_password.p12
  6. BIN
      crypto/pkcs8/test/openssl.p12
  7. BIN
      crypto/pkcs8/test/pbes2_sha1.p12
  8. BIN
      crypto/pkcs8/test/pbes2_sha256.p12
  9. BIN
      crypto/pkcs8/test/unicode_password.p12
  10. BIN
      crypto/pkcs8/test/windows.p12
  11. 9
      sources.cmake
  12. 13
      util/embed_test_data.go

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -59,6 +59,15 @@ set(
crypto/fipsmodule/rand/ctrdrbg_vectors.txt crypto/fipsmodule/rand/ctrdrbg_vectors.txt
crypto/hmac_extra/hmac_tests.txt crypto/hmac_extra/hmac_tests.txt
crypto/hpke/hpke_test_vectors.txt crypto/hpke/hpke_test_vectors.txt
crypto/pkcs8/test/empty_password.p12
crypto/pkcs8/test/no_encryption.p12
crypto/pkcs8/test/nss.p12
crypto/pkcs8/test/null_password.p12
crypto/pkcs8/test/openssl.p12
crypto/pkcs8/test/pbes2_sha1.p12
crypto/pkcs8/test/pbes2_sha256.p12
crypto/pkcs8/test/unicode_password.p12
crypto/pkcs8/test/windows.p12
crypto/poly1305/poly1305_tests.txt crypto/poly1305/poly1305_tests.txt
crypto/siphash/siphash_tests.txt crypto/siphash/siphash_tests.txt
crypto/x509/test/basic_constraints_ca.pem crypto/x509/test/basic_constraints_ca.pem

@ -28,9 +28,11 @@ import (
var fileList = flag.String("file-list", "", "if not empty, the path to a file containing a newline-separated list of files, to work around Windows command-line limits") var fileList = flag.String("file-list", "", "if not empty, the path to a file containing a newline-separated list of files, to work around Windows command-line limits")
func quote(in []byte) string { func quote(in []byte) string {
var lastWasHex bool
var buf bytes.Buffer var buf bytes.Buffer
buf.WriteByte('"') buf.WriteByte('"')
for _, b := range in { for _, b := range in {
var wasHex bool
switch b { switch b {
case '\a': case '\a':
buf.WriteString(`\a`) buf.WriteString(`\a`)
@ -51,13 +53,20 @@ func quote(in []byte) string {
case '\\': case '\\':
buf.WriteString(`\\`) buf.WriteString(`\\`)
default: default:
// printable ascii code [32, 126] // Emit printable ASCII characters, [32, 126], as-is to minimize
if 32 <= b && b <= 126 { // file size. However, if the previous character used a hex escape
// sequence, do not emit 0-9 and a-f as-is. C++ interprets "\x123"
// as a single (overflowing) escape sequence, rather than '\x12'
// followed by '3'.
isHexDigit := ('0' <= b && b <= '9') || ('a' <= b && b <= 'f') || ('A' <= b && b <= 'F')
if 32 <= b && b <= 126 && !(lastWasHex && isHexDigit) {
buf.WriteByte(b) buf.WriteByte(b)
} else { } else {
fmt.Fprintf(&buf, "\\x%02x", b) fmt.Fprintf(&buf, "\\x%02x", b)
wasHex = true
} }
} }
lastWasHex = wasHex
} }
buf.WriteByte('"') buf.WriteByte('"')
return buf.String() return buf.String()

Loading…
Cancel
Save