11023 Commits

Author SHA1 Message Date
David Benjamin
15e0f6784b Fold ripemd/internal.h into ripemd.c.
It's only used from that file and, given the names defined by it,
probably isn't usable by other files anyway.

Change-Id: Ice205408962ade00c1dcb51406da3ef2fd7f0393
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46426
Reviewed-by: Adam Langley <agl@google.com>
2021-04-02 16:33:50 +00:00
David Benjamin
ca4598781a Move load/store helpers to crypto/internal.h.
We have loads of variations of these. Align them in one set. This avoids
the HOST_* macros defined by md32_common.h, so it'll be a little easier
to make it a more conventional header.

Change-Id: Id47fe7b51a8f961bd87839f8146d8a5aa8027aa6
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46425
Reviewed-by: Adam Langley <agl@google.com>
2021-04-02 16:33:15 +00:00
David Benjamin
8d4c8fc41b Make words in crypto/fipsmodule/modes actually words.
It's a little confusing to have load_word_le but actually use size_t
instead of crypto_word_t.

NOTE: on some platforms, notably NaCl, crypto_word_t is larger than
size_t. (Do we still need to support this?) We don't have a good testing
story here, so I tested it by hacking up a 32-bit x86 build to think it
was OPENSSL_64_BIT.

Change-Id: Ia0ce469e86803f22655fe2d9659a6a5db766429f
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46424
Reviewed-by: Adam Langley <agl@google.com>
2021-04-02 16:28:42 +00:00
David Benjamin
6b9c012b7b Handle EINTR more in handshaker.cc.
Some of our calls handled it and others didn't.

Change-Id: I09f15d3db679954599bcf987d86357b6e12e9b9b
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46532
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2021-04-02 15:33:46 +00:00
David Benjamin
084064becc Add a few missing SSL_R_BIO_NOT_SET cases.
The ssl_buffer.cc code handles this, but since outgoing handshake I/O
goes through a different path, it was missing these checks.

Change-Id: I4fed62b435b577645c405d0d995511a58d47a702
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46531
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2021-04-02 15:19:06 +00:00
David Benjamin
9bcf307c4c Fix some unreachable code in the QUIC handshaker driver.
The check for ssl_hs_read_change_cipher_spec didn't do anything. Replace
it with an assert and add some comments since the hs->wait handling is a
little tricky.

Change-Id: I8e62ce3cceca9bed4611cb9d3faf0bfec3d3bdd4
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46530
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2021-04-02 04:13:36 +00:00
David Benjamin
0a6c3fc9c3 Rearrange SSLKeyShare::Serialize.
It's strange to have Serialize/Deserialize methods not inverses of each
other. Split the operation up and move the common parts out of the
subclass.

Change-Id: Iadfa57de19faca411c64b64d2568a78d2eb982e8
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46529
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2021-04-01 22:10:25 +00:00
David Benjamin
08b1729f07 Fix ssl/internal.h sectioning.
The delegated credentials bits got stuck in the middle of the handshake
bits.

Change-Id: I522d8a5a5f000de3e329934851ee74fc4ec613a7
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46528
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2021-04-01 21:13:55 +00:00
David Benjamin
b62a48f31d Remove some now unnecessary test exclusions from split handshakes.
TLS 1.3 works, so no need to exclude version negotiation. We also now
only test QUICTransportParams with QUIC, so there is no need to exclude
it manually. Checking the protocol works as well.

Change-Id: Ie9d33095231a1f9eb74145db5147a287e4fdc930
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46527
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2021-04-01 20:33:25 +00:00
David Benjamin
60a78dcc98 Remove tls13-split-handshakes flag.
This is no longer needed.

Change-Id: Ie6dba524ecccd265f7f80a910b40c0fe1800356b
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46526
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2021-04-01 19:43:05 +00:00
David Benjamin
953650cc7b Define HANDSHAKER_SUPPORTED in once place.
Change-Id: Ie5e41c55e36958af5aabd9e365eb2986a488069e
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46525
Reviewed-by: Adam Langley <agl@google.com>
2021-04-01 15:56:12 +00:00
David Benjamin
b9b036340d Tidy up handshaker tester.
Do a better job with scopers for fds and posix_spawn_file_actions_t.
There's also no need to make a copy of handshaker_path with strdup.
The non-const parameter are because posix_spawn inherits execve's
C problem: unlike C++, C cannot cast from char *const * to
const char *const *, so POSIX APIs are not const-correct.

Finally, we freely use std::vector and friends in tests, so we don't
actually need to depend on bssl::Array.

Change-Id: I739dcb6b1a2d415d47ff9b2399eebec987aab0bc
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46524
Reviewed-by: Adam Langley <agl@google.com>
2021-04-01 15:55:41 +00:00
Adam Langley
1a93f4f820 modulewrapper: add option to print build information.
When doing Android FIPS validations one ends up with quite a lot of
different build configurations for ACVP and it's useful to be able to
check that a binary is what you think it is.

Change-Id: Ie5c81f164e6e6903c85ea832a93868f84921e74a
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46484
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2021-03-31 19:19:21 +00:00
Adam Langley
0da75f35d5 FIPS counters for AES-CTR.
Change-Id: I0ea4c600741c3604d7b3b6df614b40d8c57116e4
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46504
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2021-03-30 23:57:56 +00:00
David Benjamin
3af62269df Enforce that pre_shared_key must come with psk_key_exchange_modes.
Omitting the extension means we'll never issue tickets, but if the
client were to offer a ticket anyway, RFC8446 4.2.9 says we MUST reject
the ClientHello. It's not clear on what alert to use, but
missing_extension is probably appropriate.

Thanks to Ben Kaduk for pointing this out.

Change-Id: Ie5c720eac9dd2e1a27ba8a13c59b707c109eaa4e
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46464
Commit-Queue: David Benjamin <davidben@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2021-03-30 18:15:23 +00:00
Adam Langley
4aef687fcf Zero out FIPS counters.
MSAN doesn't like the counters starting at whatever value malloc
found to be free.

Change-Id: I0968e61e0025db35b82291fde5d1e193aef77c1e
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46444
Commit-Queue: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2021-03-29 21:03:11 +00:00
David Benjamin
da890de1b5 Remove is_resume field on TestState.
This wasn't being used and wasn't even set correctly in split handshake
tests.

Change-Id: I03000db8dd3c227ea44e7bacaf3d1341259fae44
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46384
Reviewed-by: Adam Langley <agl@google.com>
2021-03-29 16:28:54 +00:00
David Benjamin
04c44d92c9 Remove OPENSSL_DANGEROUS_RELEASE_PTHREAD_KEY build flag.
It's now a year past the February 2020 deadline for removing it. Judging
from b/72831885, it looks like the root cause was addressed.

Change-Id: I8c8b358ef4f4146b41aab2a7163c000fa7306025
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46407
Reviewed-by: Adam Langley <agl@google.com>
2021-03-29 16:28:12 +00:00
David Benjamin
20f7bbaacc Add some warnings on how to use OPENSSL_memory_* functions.
Being called on every malloc or free has some non-trivial implications.

Change-Id: I9f18f307a8b43e30dea2e2f3a47d7da0b188e980
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46406
Reviewed-by: Adam Langley <agl@google.com>
2021-03-29 16:27:58 +00:00
David Benjamin
a24ab549e6 Use an unsized helper for truncated SHA-512 variants.
Although it is strictly fine to call SHA512_Final in SHA384_Final
(array sizes in C parameters are purely decorational, according to the
language), GCC 11 reportedly checks now and gets upset about the size
mismatch. Use an unsized helper function so all our code matches the
specified bounds.

Unfortunately, the bounds in all the functions are a bit misleading
because SHA512_Final really outputs based on sha->md_len (which Init
function you called) rather than which Final function. I've fixed this
places within a library where we mismatched and added asserts to the
smaller functions. SHA512_Final is assert-less because I've seen lots of
code use SHA384_Init / SHA512_Update / SHA512_Final.

This doesn't fix the SHA256 variant since that is generated by a pile of
macros in a multiply-included file. This is probably a good opportunity
to make that code less macro-heavy.

Update-Note: There is a small chance the asserts will trip something,
but hopefully not since I've left SHA512_Final alone.

Bug: 402
Change-Id: I4c9d579a63ee0a0dea103c19ef219c13bb9aa62c
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46405
Reviewed-by: Adam Langley <agl@google.com>
2021-03-29 16:27:23 +00:00
David Benjamin
139adff9b2 Fix mismatch between header and implementation of bn_sqr_comba8.
Bug: 402
Change-Id: I6de879f44f6e3eca26f2f49c500769d944fa9bc0
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46404
Reviewed-by: Adam Langley <agl@google.com>
2021-03-29 16:25:12 +00:00
Brian Smith
c263876eb5
Merge pull request #1241 from briansmith/b/merge-boringssl
Merge BoringSSL through d9ee55a.
2021-03-26 09:16:59 -07:00
Brian Smith
0d63e12975 Ignore BoringSSL 0653147..d9ee55a. 2021-03-24 17:46:39 -07:00
Brian Smith
075b129f8b Skip BoringSSL 8640b41: Test ECDSA signing is non-deterministic.
*ring* PR #1239 proposes similar tests.
2021-03-24 17:43:58 -07:00
Brian Smith
3b1864a071
Merge pull request #1240 from briansmith/b/merge-boringssl
Merge BoringSSL through bc0a4f1.
2021-03-24 17:24:31 -07:00
Brian Smith
5db2df2d9a ChaCha internals: Clarify usage of internal value of Key.
The compiler complained that `words` is never read in situations where
it is passed to the assembly code as a `Key`, relying on `Key` being
`#[repr(transparent)]`.

We've been moving away from using `repr(transparent)` for these kinds of types. Do
that here to solve this problem and also to continue that general trend. Use
`words_less_safe()` instead of directly accessing `words` to reduce the amount of
conditional logic.
2021-03-24 16:51:01 -07:00
Brian Smith
cd492d2129 Ignore BoringSSL f6bd54e..bc0a4f1. 2021-03-24 16:19:45 -07:00
Brian Smith
b48609fe8d Ignore BoringSSL e7c0c97: Don't overflow the output length in EVP_CipherUpdate calls. 2021-03-24 16:16:01 -07:00
Brian Smith
201cf72422 Skip BoringSSL ce9b002 Align the ARM capability functions.
*ring* issue #1237 tracks similar work.
2021-03-24 16:08:46 -07:00
Brian Smith
3254c83e13 Temporarily skip BoringSSL f9bd455: Skip runtime NEON checks if __ARM_NEON is defined.
*ring* issue #1237 tracks similar improvements.
2021-03-24 16:07:53 -07:00
Brian Smith
7d9c70b6b4
Merge pull request #1235 from briansmith/b/merge-boringssl
Merge BoringSSL through fc23300.
2021-03-24 15:36:26 -07:00
Brian Smith
9b9603ecf7 Ignore BoringSSL 5d54832..fc23300. 2021-03-24 14:58:47 -07:00
Brian Smith
3fd2cb2c27 Merge perlasm part of BoringSSL afd5dba: Add ASM optimizations for Windows on Arm.
The CPU feature detection will be done in a similar way in the future, but in Rust.
2021-03-24 14:51:35 -07:00
Brian Smith
739a644ff6 Ignore BoringSSL 76164b1..571c3e7. 2021-03-24 14:49:22 -07:00
Brian Smith
5389ed898a Take BoringSSL c42baf8: delocate: eliminate expression from vpaes assembly. 2021-03-24 14:47:50 -07:00
Brian Smith
08726b1281 Ignore BoringSSL 4f75b76..e484375. 2021-03-24 14:47:27 -07:00
Brian Smith
416576c04b No-op merge BoringSSL 9422ac6: Fix chacha20_poly1305_x86_64.pl comments.
These changes were already made in *ring* previously.
2021-03-24 14:46:53 -07:00
Brian Smith
b1093d599d Ignore BoringSSL 60926d3..bac5544. 2021-03-24 14:44:40 -07:00
Brian Smith
db019020eb ECC internals: Rename elem_equals to elem_equals_vartime. 2021-03-24 14:40:58 -07:00
Brian Smith
708a504c69 ECC internals: Avoid reimplementing slice equality. 2021-03-24 14:40:58 -07:00
David Benjamin
49f0329110 Remove GCC 4.8.99 check.
GCC 4.9.0 was released April 2014, which was well over five years ago.

Change-Id: Ib26d459ed82a7af671b8524a334a6f99eacb003e
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46346
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2021-03-23 17:57:18 +00:00
David Benjamin
d0b66c7d5c Bump minimum CMake version.
CMake 3.5.0 was released March 8, 2016. Per our five year rule, we
can require that now:
https://cmake.org/pipermail/cmake/2016-March/062947.html

Change-Id: I916fdb66e0356e3a8ffbe1e5fa89f51d99a78546
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46345
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2021-03-23 17:55:58 +00:00
David Benjamin
edfe4133d2 Automatically enable C11 atomics when available.
It's now 2021. Hopefully we can at least assume anyone building with
-std=c11 also has a corresponding set of headers. Plus, even if you
don't, Clang seems to provide a header. (So C11 atomics work in
clang-cl.) Also apparently atomics are optional, so this checks
__STDC_NO_ATOMICS__.

This does *not* set C11 as the minimum version. If you build with
-std=c99, we'll silently use the non-atomics implementation. That's a
little magical, so I've kept OPENSSL_C11_ATOMIC as a way to assert that
you really want C11 atomics. Mostly it turns into a -std=c11 && !MSVC
self-assert.

Update-Note: If something fails to compile, we'll revert this and adjust
the check, or add an opt-out, or give up. Also, if building with
-std=c99, consider -std=c11.

Change-Id: I1a8074c367a765c5a0f087db8c250e050df2dde8
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46344
Reviewed-by: Adam Langley <agl@google.com>
2021-03-23 17:32:33 +00:00
Yoshisato Yanagisawa
565081680a Make generate_build_files.py python3 compatible.
To make the script run with python3, let me replace python2 specific
dict functions to python3 compatible ones.

Change-Id: I85b446234f9a86a02f60eed311e1c747a3ff399b
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46364
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2021-03-23 15:34:28 +00:00
Brian Smith
2be8976f70 AEAD internals: Have each AEAD key type remember the CPU features.
Move the `cpu_features` field from `KeyInner` to the (inner) inner key
types. This makes the AES-GCM code clearer.
2021-03-23 01:02:44 -07:00
Brian Smith
4a0c4830af AEAD internals: Remove redundant cpu_features parameter from gcm::Context::is_avx2(). 2021-03-23 01:02:44 -07:00
Brian Smith
521081fd31 CI: Don't enable unuseful features during coverage measurement. 2021-03-22 23:45:44 -07:00
Brian Smith
95cbe07c58 Internals: DRY array_map polyfill. 2021-03-22 21:59:51 -07:00
Brian Smith
2a6b7484dc Internals: Polyfill array_map. 2021-03-22 21:59:51 -07:00
Brian Smith
45604135a6 Digest internals: use array patterns. 2021-03-22 20:40:48 -07:00