10803 Commits

Author SHA1 Message Date
Adam Langley
66feb2c552 Add TLS_KDF to documented break tests.
8846533744 added a “power-on” test for the TLS KDF, but omitted to add
it to the documented list of these tests.

Change-Id: I13dbad4b9359e7dae0938d02ac53e5e011f50824
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44505
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2020-12-10 16:24:54 +00:00
Adam Langley
0898b077a3 acvp: add support for KAS
Change-Id: Ida3ec65e81398881a71828dc1d51cf80be41bdbb
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44444
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2020-12-08 23:28:48 +00:00
David Benjamin
a6b6b804a0 Align armv8.pl references to OPENSSL_armcap_P.
This imports d741debb320bf54e8575d35603a44d4eb40fa1f9 from upstream.
We've been managing the shared libraries already because our
arm-xlate.pl automatically adds .hidden to .extern lines, but nice to
reduce the diff. (This does result in some duplicate .hidden lines in
the generated output, but we still want the arm-xlate.pl patch to
automatically hide .globl.)

Removing .comm lines does change the generated output, but having each
asm file define its own copy of OPENSSL_armcap_P as a common symbol
always seemed odd. I recall some weird issue where the armv4.pl files
subtly rely on it for iOS's strange .indirect_symbol machinery. (Not
actually because iOS wants a common symbol but because arm-xlate.pl
repurposes .comm to trigger .indirect_symbol.) Fortunately, aarch64 is
much better about PC-relative addressing, so it should be a no-op.

The .comm lines have also previously caused weird issues
(https://boringssl-review.googlesource.com/c/boringssl/+/32324), so
it's generally nice to get rid of them.

Update-Note: If aarch64 builds get some weird error about relocations,
it's this CL's fault.

Change-Id: I763ffa6cda750d99694ded8a5b68d7b27b09cfc9
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44464
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2020-12-08 23:14:15 +00:00
David Benjamin
92de0b53a7 Reject bad ASN.1 templates with implicitly-tagged CHOICEs.
This imports 1ecc76f6746cefd502c7e9000bdfa4e5d7911386 and
41d62636fd996c031c0c7cef746476278583dc9e from upstream. These would have
rejected the mistake in OpenSSL's EDIPartyName sturcture.

Change-Id: I4eb218f9372bea0f7ff302321b9dc1992ef0c13a
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44424
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2020-12-08 22:10:05 +00:00
Dan McArdle
1920c6f2ca Implement GREASE for ECH (draft-ietf-tls-esni-08).
Bug: 275
Change-Id: I4927c0886e3acf5b39104e3d89ed51d67520a343
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/40204
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2020-12-08 20:28:05 +00:00
Adam Langley
f0400014b3 acvp: add TLS KDF support
Change-Id: I4f4a89f97e2513d8b5b740620989b187a7b44a58
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44386
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2020-12-08 19:14:47 +00:00
Adam Langley
9ac743e0b4 acvp: tweak config
This change tweaks our ACVP config to better match what BoringCrypto
has previously tested with CAVP.

Change-Id: I7d7ce5153a3eb7355ae1516f06ff591ee2c9d902
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44385
Reviewed-by: David Benjamin <davidben@google.com>
2020-12-08 18:47:46 +00:00
Adam Langley
329c0cbb2f acvp: fix subprocess_test.go
Change-Id: Ia3d98b00365ed92cbf7d02cdb55a1a16e431c4f4
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44384
Reviewed-by: David Benjamin <davidben@google.com>
2020-12-08 18:47:24 +00:00
David Benjamin
225961dc49 Const-correct GENERAL_NAME_cmp.
Also make it a little shorter.

Change-Id: I6ee9d7666e9cf622509c54966a88f899a1974f9f
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44405
Reviewed-by: Adam Langley <agl@google.com>
2020-12-08 18:13:14 +00:00
David Benjamin
aa4ecb4926 Fix EDIPartyName parsing and GENERAL_NAME_cmp.
See also CVE-2020-1971, f960d81215ebf3f65e03d4d5d857fb9b666d6920, and
aa0ad2011d3e7ad8a611da274ef7d9c7706e289b from upstream OpenSSL.

Unlike upstream's version, this CL opts for a simpler edipartyname_cmp.
GENERAL_NAME_cmp is already unsuitable for ordering, just equality,
which means there's no need to preserve return values from
ASN1_STRING_cmp. Additionally, the ASN.1 structure implies most fields
cannot be NULL.

(The change from other to x400Address is a no-op. They're the same type.
Just x400Address is a little clearer. Historical quirks of the
GENERAL_NAME structure.)

Change-Id: I4b0ffe8e931c8ef916794a486e6a0d6d684c0cc1
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44404
Reviewed-by: Adam Langley <agl@google.com>
2020-12-08 18:12:17 +00:00
Brian Smith
20c9479474 CI/CD: Run release-mode tests using MSRV.
Also reorder the channels according in some priority order.
2020-12-07 21:33:27 -08:00
Brian Smith
45a43db987 CI/CD: Only use the latest stable version of Clippy.
It's too tedious to keep the code compatible with older clippy and newer
clippy, especially if/when we enable pedantic lints.
2020-12-07 21:33:27 -08:00
Adam Langley
455b78d5f9 PWCT failures should clear the generated key.
It's insufficient to signal an error when the PWCT fails. We
additionally need to ensure that the invalid key material is not
returned.

Change-Id: Ic5ff719a688985a61c52540ce6d1ed279a493d27
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44306
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2020-12-07 23:42:23 +00:00
Brian Smith
ad4f6c9153 CI/CD: Also lint with the stable channel's clippy. 2020-12-03 17:40:33 -08:00
Brian Smith
b9d7d089d9 Remove #![forbid(warnings)]; reply on Clippy in CI/CD instead.
The newest Rust Nightly is getting stricter about `forbid(warnings)`
which breaks the build.

Use "deny" instead of "forbid". And only deny when running Clippy in
CI/CD, so that when hacking on *ring* we don't have to deal with
warnings right away; we now only have to deal with them when we're ready
to submit a change to be merged.
2020-12-03 17:40:33 -08:00
Brian Smith
1cfafdcab7 ECDSA tests: Tell clippy to allow an intetionally redundant clone. 2020-12-03 17:40:33 -08:00
Brian Smith
d57c8d56a2 Signature tests: Remove redundant clones found by Clippy. 2020-12-03 17:40:33 -08:00
Brian Smith
d58e2dadde Agreement tests: Make clippy happy about an assertion. 2020-12-03 17:40:33 -08:00
Brian Smith
a2fec64d10 AEAD tests: Use Vec::resize() to make Clippy happy. 2020-12-03 17:40:33 -08:00
Brian Smith
3d14e19f08 Minimize the scope in which we allow "useless" conversions. 2020-12-03 17:40:33 -08:00
Brian Smith
e1f08cb970 AES: Tell clippy to allow a pattern we can't avoid w/o increasing MSRV. 2020-12-03 17:40:33 -08:00
David Benjamin
3094902fcd Get closer to Ed25519 boundary conditions.
If I perturb kOrder in the malleability check, our and Wycheproof's
tests don't easily notice. This adds some tests with s above and below
the order. EdDSA hashes the public key with the message, which
frustrates constructing actual boundary cases. Instead, these inputs
were found by generating many signatures.

This isn't ideal, but it is sensitive to the most significant 32 bits.

Change-Id: I7fc03758ab97650d0e94478f355ea7085ae0559a
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44346
Commit-Queue: David Benjamin <davidben@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2020-12-02 21:23:44 +00:00
David Benjamin
41a14304d7 draft-ietf-tls-certificate-compression is now RFC 8879.
Change-Id: I55ef8c4987c1205de9eb16243ffd4efc6aa1c5bd
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44344
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
2020-12-02 17:54:54 +00:00
Adam Langley
5763899886 Update FIPS.md to include latest FIPS certificate.
Change-Id: Iba527924a79733b28b12b65d8e1f613d7819eb34
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44345
Commit-Queue: Adam Langley <alangley@gmail.com>
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2020-12-02 17:43:34 +00:00
Brian Smith
f247250ee0
Merge pull request #1144 from briansmith/b/0.16.19
0.16.19
2020-12-01 19:36:27 -08:00
Brian Smith
8a49b70789 0.16.19 2020-12-01 16:40:40 -08:00
Brian Smith
9eda586b54
Merge pull request #1142 from briansmith/b/merge-boringssl
Merge BoringSSL changes through eb57cc1e875d3137aa3cf723f3c525e253ddea9b
2020-12-01 16:10:44 -08:00
David Benjamin
c3f4612d83 Only accept little-endian ARM and MIPS variants in base.h.
<openssl/base.h> checks for a supported platform, but we don't check
endianness of ARM and MIPS, which are bi-endian. See
https://crbug.com/1153312#c7.

Switch this around. Documentation on which define is "official" is hard
to come by, so I mostly mimicked Chromium. Chromium detects
little-endian ARM and MIPS with __ARMEL__ and __MIPSEL__ respectively,
without looking at __arm__ or __mips__. It uses __aarch64__
instead of __AARCH64EL__, but I think that's an oversight. I can get
Clang to output for aarch64_be and that defines __aarch64__ with
__AARCH64EB__.

<openssl/arm_arch.h> (which we should simplify and align with base.h
once this CL sticks) also normalizes to __ARMEL__ over __BYTE_ORDER__
and friends. Although, interestingly, arm_arch.h defines its own
__ARMEL__ on GNUC aarch64, even though Clang does *not* define __ARMEL__
on aarch64. (I'm guessing this aligned for the benefit of the "armx"
bi-arch asm files.) This value is based on __BYTE_ORDER__, not
__ARMEL__, but it assumes GNUC arm always defines __ARMEL__, so I think
it's reasonable to assume GNUC aarch64 always defines __AARCH64EL__.

Given all this, probably the simplest thing that's most likely to work
is to use __ARMEL__, __MIPSEL__, and __AARCH64EL__. Note this does not
change the _M_* checks. _M_* are Windows's definitions, which I think we
can reasonably assume come with an endianness opinion. (Windows' ARM and
ARM64 ABIs mandate little-endian.) This aligns with Chromium.

Update-Note: CPU processor defines are a mess. If a little-endian ARM or
MIPS build breaks, some of the assumptions above may be wrong. In that
case, the output $CC -dM -E - < /dev/null on the offending toolchain
will be useful to fix it. If a big-endian ARM or MIPS build breaks, this
is working as intended. Any resulting binaries weren't producing the
right outputs.

Change-Id: I2a9e662d09df119a71226e91716d84e7ac3792aa
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44324
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2020-12-01 23:49:03 +00:00
Brian Smith
1725cc295e CI/CD: Run sudo apt-get update before using apt-get.
See https://github.com/actions/virtual-environments/issues/2155. This fixes
CI/CD jobs failing due to `apt-get` failing to download packages.
2020-12-01 15:26:07 -08:00
Brian Smith
94c07648a8 Merge branch 'b/apt-get-update'.
These CI/CD changes are necessary for CI/CD to pass.
2020-12-01 15:23:19 -08:00
Brian Smith
f8f86267e4 Merge BoringSSL eb57cc1: aesv8-armx.pl: avoid 32-bit lane assignment in CTR mode. 2020-12-01 14:55:42 -08:00
Brian Smith
92e1630654 Ignore BoringSSL f8047e2. 2020-12-01 14:55:16 -08:00
Brian Smith
9ad79a15c7 CI/CD: Run sudo apt-get update before using apt-get.
See https://github.com/actions/virtual-environments/issues/2155. This fixes
CI/CD jobs failing due to `apt-get` failing to download packages.
2020-12-01 14:53:41 -08:00
David Benjamin
eb57cc1e87 aesv8-armx.pl: avoid 32-bit lane assignment in CTR mode
ARM Cortex-A57 and Cortex-A72 cores running in 32-bit mode are affected
by silicon errata #1742098 [0] and #1655431 [1], respectively, where the
second instruction of a AES instruction pair may execute twice if an
interrupt is taken right after the first instruction consumes an input
register of which a single 32-bit lane has been updated the last time it
was modified.

Shuffle the counter assignments around a bit so that the most recent
updates when the AES instruction pair executes are 128-bit wide.

[0] ARM-EPM-049219 v23 Cortex-A57 MPCore Software Developers Errata Notice
[1] ARM-EPM-012079 v11.0 Cortex-A72 MPCore Software Developers Errata Notice

(This is imported from upstream's
409c59e8f44ae56f2587cdd8a7ce611d0e3d91d9.)

The change is applied to both 32-bit and 64-bit for simplicity, but there
was no measurable performance difference, so leaving them aligned is
easiest.

Change-Id: Ic8e5f656f59ae8c2ecb2762a066c2c9064bb34c5
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44284
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2020-12-01 22:41:33 +00:00
Aaron zhang
f8047e2d47 Improve sk_dup.
No need to use |sk_new|, which allocates a buffer that will immediately
be realloced.

Change-Id: If0a787beac19933d93c5f9a3a8b560edd027c16c
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44205
Reviewed-by: Adam Langley <agl@google.com>
2020-12-01 22:36:56 +00:00
Brian Smith
830dd15c31 Ignore BoringSSL 7a26f97..bb6f9c4. 2020-12-01 12:39:39 -08:00
Brian Smith
1bec25297c Poly1305: Use |size_t|; assert |poly1305_state| is large enough.
Clarify that there are no truncation issues on targets where the range
of |unsigned| is smaller than the range of |size_t|.

Ensure that |poly1305_state| is (still) large enough. This is a good
idea independently of this change, but is especially important because
switching the fields to |size_t| might have enlarged the structures.

Change-Id: I16e408229c28fcba6c3592603ddb9431cf1f142d
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44244
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2020-12-01 20:38:13 +00:00
Brian Smith
746e24b5d0 Merge BoringSSL 25f9d7a: aarch64: Fix name of gnu property note section. 2020-12-01 12:37:04 -08:00
Brian Smith
d9c49f72e1 Ignore BoringSSL 0782715..7be158d. 2020-12-01 12:36:05 -08:00
Brian Smith
feb692a355 Merge BoringSSL b67732a: aarch64: Remove some flavour conditionals 2020-12-01 12:30:01 -08:00
Brian Smith
ebf8b4ea57 Ignore BoringSSL 1e8e563..c583dbe. 2020-12-01 12:26:12 -08:00
Emmanuel T Odeke
bb6f9c44b3 util/fipstools/acvp/acvptool: buffer signal channel to avoid losing signal
The docs at os/signal.Notify warn about this signal delivery loss bug at
https://golang.org/pkg/os/signal/#Notify, which says:

    Package signal will not block sending to c: the caller must ensure
    that c has sufficient buffer space to keep up with the expected signal
    rate. For a channel used for notification of just one signal value,
    a buffer of size 1 is sufficient.

Discovered by one of Orijtech, Inc's internal static
analyzers that will eventually be donated to the Go project, and will
then be included when one runs:
    go test

Change-Id: I5713f7087a195ac706240d32b53d2e4855d93a1c
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44264
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2020-12-01 17:57:02 +00:00
Brian Smith
64184d649f CI/CD: Add cargo audit. 2020-11-30 20:24:31 -08:00
Brian Smith
2114ed7f9d CI/CD: Try again to cache cargo-deny.
AFAICT, the previous attempt at caching didn't work because, AFAICT,
~/.cargo/{.crates.toml, .crates2.json} were not cached.
2020-11-30 19:28:28 -08:00
Brian Smith
df8fbf4145 CI/CD: Cache the cargo-deny binary to speed up the deny job.
`cargo install cargo-deny` takes 7 minutes, while running it takes 2 seconds.
2020-11-30 18:25:56 -08:00
Brian Smith
019a8747dd CI/CD: Use the same version of wasm-bindgen-cli as wasm-bindgen. 2020-11-30 17:40:12 -08:00
Brian Smith
749502e1fe Sync cc dependency version in pregenerate_asm/Cargo.toml with ./Cargo.toml's. 2020-11-30 15:57:01 -08:00
Adam Langley
9dae0ac4f0 Add digest.h to self_check.c
This covers the use of EVP_sha256() added in 8846533744.

Change-Id: I8cd4c8e271de6a0b9a926e7186c7b24ffe849d67
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44224
Commit-Queue: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2020-11-30 20:06:59 +00:00
Michael Neumann
432909280d Fix compilation on DragonFly
This superseeds issue #966.

Tested-on: DragonFly 5.8.1
2020-11-30 11:06:34 -08:00
Brian Smith
b85171a353 CI/CD: Allow multiple versions of dependencies in deny jobs. 2020-11-30 11:05:49 -08:00