10803 Commits

Author SHA1 Message Date
Dan McArdle
7dfb4721d0 Update HPKE to draft-irtf-cfrg-hpke-07.
Bug: 275
Change-Id: Ifef2b94f701ab75755893c2806335b626b655446
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44904
Commit-Queue: Dan McArdle <dmcardle@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2021-01-07 20:11:34 +00:00
Brian Smith
f8dab2c909 Tests: Take Clippy's advice for clippy::unusual_byte_grouping. 2021-01-07 10:58:58 -08:00
Brian Smith
2a849b32af test: Rewrite from_hex_digit() to avoid clippy::manual_range_contains. 2021-01-07 10:58:58 -08:00
Adam Langley
ab6a8f49ff acvp: drop subprocess_test.go
It has been subsumed by the tests added in the previous change.

Change-Id: Ie53e8bd1116d2a70b9b88b2b59163e0f9a3140e8
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44747
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2021-01-07 17:13:14 +00:00
Adam Langley
76164b1bc9 Add some OpenSSL-compatibility aliases
Change-Id: I808f37c2980e36843b5b5d29174b4f27a030738a
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44924
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2021-01-07 16:44:54 +00:00
Adam Langley
c42baf84df delocate: eliminate expression from vpaes assembly.
This change eliminates an Aarch64 assembly pattern that only appears
in this case. It's easier to change this code than to pile more things
on top of the delocate parser.

Change-Id: I6bbbe9df744ec2ad4178d74456d8f4fecc3a2dae
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44845
Reviewed-by: David Benjamin <davidben@google.com>
2021-01-06 19:51:58 +00:00
Adam Langley
e4843750e5 delocate: support alternative comment indicators
aarch64 assembly files use "//" as the comment indicator because '#'
indicates a constant value.

Change-Id: I53b18cbb3498522b0924716238abf55e6627d216
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44844
Commit-Queue: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2021-01-06 19:26:33 +00:00
David Benjamin
4df05c5235 Update third_party/googletest.
Fuchsia is looking to remove the ZX_WAIT_ASYNC_ONCE constant, and our
copy of GoogleTest still has it. As usually with GoogleTest updates, our
old local patch is no longer necessary, but now we need a new one.

Change-Id: I8d226f01cf0951fd278605688684bf1ce3e17898
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44884
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2021-01-06 17:41:42 +00:00
Adam Langley
4f75b76ef2 acvp: add tests
This change causes the run_tests target, in FIPS builds, to run ACVP
for each supported algorithm. For most of them the output can be compared
against a known result. For some of them the output is too variable and
they are only run to ensure that they don't have local errors.

The ACVP test vectors have been trimmed significantly because they're
often huge. Firstly an included tool drops all but one test from each
group. Some vector sets have been manually trimmed to remove tests that
cause variable output.

Change-Id: Iff73851e3d47813041cc7ea6d881282750274940
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44746
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2021-01-06 17:28:02 +00:00
David Benjamin
9422ac61f7 Fix chacha20_poly1305_x86_64.pl comments.
See
https://boringssl-review.googlesource.com/c/boringssl/+/44347/7/crypto/cipher_extra/asm/chacha20_poly1305_x86_64.pl#863

Change-Id: I8df6a5323c53b39dd99109b31acdd727443f3363
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44864
Reviewed-by: Adam Langley <agl@google.com>
2021-01-06 00:23:03 +00:00
Adam Langley
bac5544e98 Fix awkward wording in comment.
One of the comments in e56dfcf9f4 was worded awkwardly. Thanks to Zi Lin
for fixing this.

Change-Id: I7ee647716e0ee30145bdce5be35128058130e1ec
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44764
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2021-01-05 22:49:29 +00:00
Dan McArdle
92c48be84a Update ECH GREASE to draft-ietf-tls-esni-09
Bug: 275
Change-Id: I9ae9128c25f18f346641d54d5c14527bc5c74d3f
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44784
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2021-01-05 20:51:39 +00:00
Adam Langley
78f15a6aa9 Gerrit ignores <sup>; use Unicode superscript instead.
Change-Id: Ieb49837c3091b058a05d4558fe73248449c718c5
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44825
Reviewed-by: Adam Langley <agl@google.com>
2020-12-23 18:59:44 +00:00
Adam Langley
e02dd70f53 acvp: better document the subprocess protocol.
Change-Id: I5b0b0892cfb968e5899464a6b35f647ba2dc2702
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44824
Reviewed-by: Adam Langley <agl@google.com>
2020-12-23 18:43:06 +00:00
Peter Collingbourne
082cd7860e Add .text.unlikely.* pattern to fips_shared.lds.
Newer versions of LLVM may use profile information to put code in
sections named .text.unlikely.*. Make sure those sections end up in
our .text section.

Change-Id: Ia0224fd8e683f5e77c60dd3ad34d59b33f9b41ab
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44804
Commit-Queue: Peter Collingbourne <pcc@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2020-12-22 23:47:50 +00:00
Brian Smith
52428a5745 Remove trailing whitespace in chacha20_poly1305_x86_64.pl. 2020-12-22 13:21:31 -08:00
Brian Smith
d74df3fced Merge BoringSSL f2adafe: Fix ChaCha20-Poly1305 x86-64 asm on Windows. 2020-12-22 13:03:46 -08:00
Brian Smith
0c6621c179
Merge pull request #1156 from briansmith/b/merge-boringssl
Merge BoringSSL through cd204d8e1542c0ef85117492f4642c1a47080540
2020-12-22 12:56:34 -08:00
Brian Smith
a6f0f26a5a Ignore BoringSSL ce7f088..cd204d8. 2020-12-17 21:07:13 -08:00
Brian Smith
3b89a838a5 Merge BoringSSL 49587b2: Remove unused Netware codepaths in x86 perlasm. 2020-12-17 21:06:10 -08:00
Brian Smith
afc7cab7e6 Merge BoringSSL a929e32: Finish switching to NASM. 2020-12-17 21:05:46 -08:00
Brian Smith
929aeda618 Ignore BoringSSL 0898b07..a3a9894. 2020-12-17 21:03:34 -08:00
Brian Smith
900c880261 No-op merge of BoringSSL a6b6b80: Align armv8.pl references to OPENSSL_armcap_P. 2020-12-17 21:00:37 -08:00
Brian Smith
4ff3912b81 Ignore BoringSSL 455b78d..92de0b5. 2020-12-17 20:57:52 -08:00
Brian Smith
27200d4596 Ed25519 malleability tests: Add control test case. 2020-12-17 20:55:22 -08:00
Brian Smith
01a2e429ae Merge BoringSSL 3094902: Get closer to Ed25519 boundary conditions. 2020-12-17 20:55:22 -08:00
Brian Smith
a25271beb0 Ed25519 malleability test: Add control case. 2020-12-17 20:55:22 -08:00
Brian Smith
6e3c8a331e Ed25519 Tests: Import Ed25519 malleability test case from BoringSSL. 2020-12-17 20:55:22 -08:00
Brian Smith
47dfb4814f Ed25519 Tests: Refactor tests to prepare for more complete testing of invalid signatures. 2020-12-17 20:55:22 -08:00
Brian Smith
8728b670a4
Merge pull request #1154 from briansmith/b/merge-boringssl
Merge BoringSSL through 41a14304d7e0cfcb8afa82ee8735f0bd6763e415
2020-12-17 19:50:55 -08:00
Brian Smith
c974d38f83 Ignore BoringSSL 5763899..41a1430. 2020-12-17 18:20:51 -08:00
Brian Smith
9e69354040 Merge BoringSSL 'c3f4612': Only accept little-endian ARM and MIPS variants in base.h. 2020-12-17 18:19:52 -08:00
Adam Langley
4ab14ea275 acvp: fix silly errors.
A couple of processing errors crept in over time. Caught by the tests
in the next change.

Change-Id: I0caa478d3321cb8a1da1e61ddde16ba8db91eb35
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44745
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2020-12-18 00:48:55 +00:00
Adam Langley
86854828e0 acvp: load config later.
The config file is only needed if interacting with an ACVP server.
Invocations that just want to process input from a file don't need it.
By moving this chunk of code down, the config isn't loaded until
after handling JSON inputs and just can be ignore if not needed.

Change-Id: Ibce334f63ddf8df34cf2917b923db20b3aaa735f
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44744
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2020-12-18 00:47:15 +00:00
Adam Langley
e56dfcf9f4 Allow some non-minimal lengths in BER.
BER permits lengths to be non-minimal. Previously this was not supported
at all. This change brings greater support, allowing non-minimal lengths
so long as they fit in a uint32_t.

Change-Id: I002ed2375c78fdb326e725eb1c23eca71ef9ba4a
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44684
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2020-12-18 00:46:25 +00:00
David Benjamin
bb0cb95e68 Export tool_sources to GN.
This is so we can build the tool in Chromium and run benchmarks using
Chromium's build config.

Change-Id: I16b4d99a923cd61f338ba488cb0abdfce3c0a3d2
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44724
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2020-12-17 22:28:55 +00:00
Adam Langley
62634262d8 Use more efficient std::string::find overload.
This reflects an internal LSC cleanup.

Change-Id: Ic6d363ab14e0b021a579cdcf0a7a68a9021e2e18
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44664
Commit-Queue: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2020-12-16 20:29:23 +00:00
Adam Langley
ca058c0647 Revert "Add support for the new QUIC TLS extension codepoint"
This reverts commit 7ba96a675eec621bc897b25b126a95e98f1014bb.

BUG=oss-fuzz:28720

Change-Id: Ibfea49cc3101079573eedbb33c443c85a14e4b4c
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44644
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
2020-12-16 18:26:34 +00:00
Adam Langley
df75139bec Move DH parameter generation out of the FIPS module.
This moved, en masse, into the FIPS module in e7f08827d2. But we want to
minimise the amount that's in the FIPS module and it doesn't appear that
we need this at the current time.

Change-Id: Ib2c243aad461b716314eeeb6a460955818a7aa22
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44605
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2020-12-15 19:56:22 +00:00
David Schinazi
7ba96a675e Add support for the new QUIC TLS extension codepoint
IETF QUIC draft 33 is replacing the TLS extension
codepoint for QUIC transport parameters from 0xffa5
to 57. To support multiple versions of Chrome, we
need to support both codepoints in BoringSSL. This
CL adds support for the new codepoint in a way that
can be enabled on individual connections.

Change-Id: I3bf06ea0710702c0dc45bb3ff2e3d772e9f87f9b
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44585
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2020-12-15 19:53:02 +00:00
David Benjamin
061a7f5596 Use stdlib.h instead of cstdlib in span.h.
The headers aren't quite interchangeable. stdlib.h defines ::abort()
while cstdlib defines std::abort(). The Google style guide doesn't give
much guidance but says to match the existing style, so I've switched it
to stdlib.h.

See https://github.com/apple/swift-nio-ssl/issues/259

Change-Id: I19feb5213e123a88b381d6d8f8fe9d8e87c81e67
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44625
Commit-Queue: David Benjamin <davidben@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2020-12-15 19:24:32 +00:00
David Benjamin
60926d3533 Check for trailing data in X509Test.GeneralName.
I accidentally lost these lines juggling patches around.

Change-Id: I35551eeb0f1bb26dee74344048198a318c55209b
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44624
Commit-Queue: David Benjamin <davidben@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2020-12-15 18:51:32 +00:00
Vlad Krasnov
f2adafe737 Fix ChaCha20-Poly1305 x86-64 asm on Windows
Current:

Did 2916000 ChaCha20-Poly1305 (16 bytes) seal operations in 1015000us (2872906.4 ops/sec): 46.0 MB/s
Did 1604750 ChaCha20-Poly1305 (256 bytes) seal operations in 1016000us (1579478.3 ops/sec): 404.3 MB/s
Did 516750 ChaCha20-Poly1305 (1350 bytes) seal operations in 1015000us (509113.3 ops/sec): 687.3 MB/s
Did 99750 ChaCha20-Poly1305 (8192 bytes) seal operations in 1016000us (98179.1 ops/sec): 804.3 MB/s
Did 50500 ChaCha20-Poly1305 (16384 bytes) seal operations in 1016000us (49704.7 ops/sec): 814.4 MB/s

With fix:

Did 6366750 ChaCha20-Poly1305 (16 bytes) seal operations in 1016000us (6266486.2 ops/sec): 100.3 MB/s
Did 3938000 ChaCha20-Poly1305 (256 bytes) seal operations in 1016000us (3875984.3 ops/sec): 992.3 MB/s
Did 1207750 ChaCha20-Poly1305 (1350 bytes) seal operations in 1015000us (1189901.5 ops/sec): 1606.4 MB/s
Did 258500 ChaCha20-Poly1305 (8192 bytes) seal operations in 1016000us (254429.1 ops/sec): 2084.3 MB/s
Did 131500 ChaCha20-Poly1305 (16384 bytes) seal operations in 1016000us (129429.1 ops/sec): 2120.6 MB/s

Change-Id: Iec6417b9855b9d3d1d5154c93a370f80f219c65f
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44347
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2020-12-15 01:09:10 +00:00
Adam Langley
cd204d8e15 Include bn.h from bn/internal.h
If using precompiled headers then this is needed otherwise bn/internal.h
doesn't have a definition for BN_ULONG etc.

Change-Id: I41b331465abae7108f255722a156d2ffb3016ba3
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44604
Commit-Queue: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2020-12-14 21:35:06 +00:00
Adam Langley
28cab640d1 acvp: add support for finite-field Diffie–Hellman.
This involves adding a new function |DH_compute_key_hashed| that
combines the FFDH with the output hashing inside the FIPS module. This
new function uses the padded FFDH output, as newly specified in SP
800-56Ar3.

Change-Id: Iafcb7e276f16d39bf7d25d3b2f163b5cd6f67883
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44504
Reviewed-by: David Benjamin <davidben@google.com>
2020-12-14 21:31:09 +00:00
Adam Langley
ce7f08827d Move DH code into the FIPS module.
This change also drops ex_data from DH objects. The global would need
special handling in the FIPS module, which isn't hard, but just dropping
it saves some of the code-size costs of this change and I cannot find
any signs of use of this functionality.

Change-Id: I984bd70698c2ec329f340d294b3b9ec169cd0c4e
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44524
Reviewed-by: David Benjamin <davidben@google.com>
2020-12-14 21:30:19 +00:00
David Benjamin
49587b2c10 Remove unused Netware codepaths in x86 perlasm.
Imported from upstream's 617b49db14fa4c1211bfc5d0e88294d0f159c9a9.

Change-Id: I64349b7cbbda8fbacf1e20ca609081ed42f10550
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44565
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2020-12-11 17:34:27 +00:00
David Benjamin
a929e32746 Finish switching to NASM.
As of
https://chromium-review.googlesource.com/c/chromium/tools/build/+/2586225,
we no longer test on Yasm. Yasm hasn't seen a release for over six years
now and is missing support for newer x86 instructions.

This removes the remnants of support for Yasm on the CI. It also removes
the Yasm support we patched into x86nasm.pl, which removes a now
unnecessary divergence from upstream.

Update-Note: If a x86 Windows asm build breaks, switch from Yasm to
NASM. We're also no longer testing NASM on x86_64 Windows, but there
wasn't any patch to revert.

Change-Id: I016bad8757fcc13240db9f56dd622be518e649d7
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44564
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2020-12-11 17:17:47 +00:00
Adam Langley
a3a98944f4 Switch to passive entropy collection for Android FIPS.
Rather than the FIPS module actively collecting entropy from the CPU or
OS, this change configures Android FIPS to passively receive entropy.

See FIPS IG 7.14 section two.

Change-Id: Ibfc5c5042e560718474b89970199d35b67c21296
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44305
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2020-12-10 23:08:55 +00:00
David Benjamin
4ae71a4c7a Skip ASN.1 template tests in Windows shared library builds.
This should fix the Chromium roll.

Windows shared library builds are fussy about dllexport vs. dllimport in
a way that's incompatible with external uses of the asn1t.h macros. The
issue is the DECLARE_* macros will add dllexport vs. dllimport on the
assumption the symbols are defined in libcrypto, but external
definitions need a different selector.

Rather than add more complex macros for this, just exclude those tests.
Ideally we wouldn't supoport asn1t.h outside the library at all, if we
can manage it, so no sense in trying to make it work.

This excludes both the new and the old tests. Although this has been
working thus far, it only works because we've been setting the
BORINGSSL_IMPLEMENTATION symbol for test targets wrong in Chromium. I'm
confused how that's been working at all (maybe dllexport vs. dllimport
is more lax when it comes to functions rather than variables?), but when
I do it correctly, the ASN1_LINKED_LIST template breaks too.

Change-Id: I391edba1748f66c383ed55a9d23053674bbb876e
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44484
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2020-12-10 20:53:04 +00:00