10651 Commits

Author SHA1 Message Date
Brian Smith
f2488d6118 Agreement: Stop requiring the KDF to return a Result.
Many (most?) KDFs are infallible, so optimize for that case. If the KDF
is fallible then the result will be `Ok(Err(_))` which is messy.

This eliminates the `error_value` parameter.
2021-02-04 19:06:25 -08:00
Brian Smith
d93b954901 Remove definitions of deprecated Error::description()/cause(). 2021-02-04 17:07:41 -08:00
Brian Smith
51f743c44e Remove deprecated APIs. 2021-02-01 16:29:35 -08:00
Brian Smith
27a045642a Dependencies: Require latest libc. 2021-02-01 16:19:08 -08:00
Brian Smith
62d90f7d50 Dependencies: Require latest cc-rs. 2021-02-01 16:19:08 -08:00
Brian Smith
9cc0d45f4d 0.16.20. 2021-02-01 13:14:08 -08:00
Brian Smith
cdd1955d9c
Merge pull request #1179 from briansmith/b/merge-boringssl-integrated-chacha-x86_64
Use integrated ChaCha20-Poly1305 assembly from BoringSSL
2021-01-27 14:45:23 -08:00
Brian Smith
a822206929 Remove currently-unused test vectors for AES-GCM-SIV.
We'll add them back when we add the actual AES-GCM-SIV code.
2021-01-27 12:23:45 -08:00
Brian Smith
af3fa46f29 ChaCha20-Poly1305: Clarify alignment of the output tag in the integrated x86-64 code. 2021-01-26 15:37:56 -08:00
Brian Smith
a0017634b2 Merge branch 'main' into b/merge-boringssl-integrated-chacha-x86_64 2021-01-26 14:29:23 -08:00
Brian Smith
45e2ed5cf7 ChaCha20-Poly1305: Remove has_sse41.
It isn't significantly simpler to use than the direct use of `cpu`.
2021-01-26 14:28:12 -08:00
Brian Smith
5e38e04857 ChaCha20-Poly1305: Revert unneeded changes to BoringSSL assembly code.
`chacha20_poly1305_constants` is unused but if we want to remove it, we should
remove it upstream too (first).
2021-01-26 10:16:14 -08:00
Brian Smith
47437a3d57 ChaCha20-Poly1305: Combine unsafe blocks in integrated version. 2021-01-26 10:15:26 -08:00
Brian Smith
1ebb1e93b6 ChaCha20-Poly1305: Elide lifetimes in integrated version. 2021-01-26 10:15:26 -08:00
Brian Smith
45b034905d ChaCha20-Poly1305: Define integrated assembly types more like BoringSSL.
Define the input data structures for the integrated assembly almost exactly
like BoringSSL does, except for the caveat mentioned in the comments.

Similarly, define the output type as a structure containing a byte array, like
BoringSSL, again with the caveats mentioned in the comments.

Abstract the union types into a single parameterized type.
2021-01-26 10:15:26 -08:00
Brian Smith
8d5b0f2059 ChaCha20-Poly1305: Rearrange the unwrapping of the key.
Unwrap the ChaCha20 key earlier so we can use stronger types in the code that calls into
the integrated assembly. Either way we do the unwrapping in two places, but this way we
do it earlier.
2021-01-26 10:15:26 -08:00
Brian Smith
cce0b6afdb Endian: Allow ArrayEncoding to be implemented for larger arrays.
The original version avoided `unsafe` but doesn't work for older
versions of Rust that we're still trying to support. Switch to the
`unsafe` implementation that works everywhere.
2021-01-26 10:15:26 -08:00
Brian Smith
da1a5ec473 Limit visibility of function that exposes a ChaCha20 key's value.
In the future we may exposes the `chacha` module publicly and then it
would be wrong for the `Key` type to implement `as_ref()` as that would
then expose the key material outside the module.
2021-01-26 10:15:26 -08:00
Vlad Krasnov
34424d829d Enable the integrated assembly x86-64 ChaCha20-Poly1305 implementation from BoringSSL 2021-01-26 10:12:14 -08:00
Brian Smith
f3a2c36c57 Endian: Allow ArrayEncoding to be implemented for larger arrays.
The original version avoided `unsafe` but doesn't work for older
versions of Rust that we're still trying to support. Switch to the
`unsafe` implementation that works everywhere.
2021-01-26 10:05:58 -08:00
Brian Smith
628acbeff5 Document all features in docs.rs. 2021-01-07 15:00:13 -08: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
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
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
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