9203 Commits

Author SHA1 Message Date
Brian Smith
38a2237a74 Revert "Allow Aad to own its contents."
This reverts commit c1c9c2221ef26c7cb808ffe79dad4217bd7f431b.

I am looking at improving the API in a different way, so I'm undoing
this change to reduce churn in the interim.
2019-01-25 09:57:26 -10:00
Brian Smith
abbb616b57 Implement Debug for OpeningKey and SealingKey. 2019-01-23 16:40:16 -10:00
Brian Smith
c15607558e Simplify use of derive_debug_via_field! when there is no type alias. 2019-01-23 16:39:19 -10:00
Brian Smith
c1c9c2221e Allow Aad to own its contents.
This allows `Aad` to be returned by value from functions, which is useful in
many cases.
2019-01-23 08:18:28 -10:00
Ian Chamberlain
7b8bfa745a Remove misplaced code block boundary
The "Submodules and file naming" section ended with three backticks (` ``` `), which caused the next section to be unformatted instead of using proper Markdown formatting.
2019-01-23 08:15:46 -10:00
Brian Smith
5f670008e3 Push use of Aad type down to the aead::gcm. 2019-01-22 17:19:39 -10:00
Brian Smith
7bad631ec0 Define GCM128_KEY the same way in both Rust and C. 2019-01-22 17:12:14 -10:00
Brian Smith
576cfc4813 Remove string.h dependency from gcm.c. 2019-01-22 17:12:14 -10:00
Brian Smith
4b1a699488 Remove redundant lifetime parameters from AEAD internal functions.
Follow-up on 0e80eeb2aa05615b3bab00af32c387c53115e6ac by simplifying
things furtuer.
2019-01-22 16:43:31 -10:00
Brian Smith
eec4d82f95 0.14.3. 2019-01-22 16:35:11 -10:00
Brian Smith
0e80eeb2aa Loosen lifetime requirements for aead::open_in_place().
Tying the lifetime of the `aad` parameter to the lifetime of the
input/output buffer was an accident. Separate them.
2019-01-22 10:07:42 -10:00
Brian Smith
1445fa4367 Improve and test various key type Clone/Debug implementations. 2019-01-19 19:56:02 -10:00
Brian Smith
8bdf5806bb Replace unimplemented!() with unreachable!() in AES-GCM.
The line is unreachable.
2019-01-19 17:24:30 -10:00
Pietro Monteiro
0f246702f1 Re-enable and update Kcov.
Run on Rust stable.
Install C++ compiler and other Kcov dependencies.
Don't install sources and packages that are not needed.
Update Kcov to the latest version.

I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2019-01-19 17:15:50 -10:00
Pietro Monteiro
59b550c074 Travis CI changed its defaults to sudo enabled Ubuntu Trusty.
Removed unnecessary `sudo` entries.
Make `distro` explicit in case we want to mix Linux build environments.
Adjust compiler packages to the correct defaults.

I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2019-01-19 17:15:42 -10:00
Brian Smith
af1bd64d0f Stop disabling -Wcast-align. 2019-01-19 10:12:40 -10:00
Brian Smith
4c345bca47 Enable -Wconversion and -Wsign-conversion. 2019-01-19 10:12:40 -10:00
Brian Smith
5369ae46bd Remove currently-unused elem_exp_vartime test code. 2019-01-19 09:20:39 -10:00
Brian Smith
7ee3976792 Add (coverage) test for rsa::bigint::PublicExponent Debug formatting. 2019-01-19 09:14:50 -10:00
Brian Smith
278d64c569 Add (coverage) test for rsa::bigint::Modulus. 2019-01-19 09:09:17 -10:00
Brian Smith
81d5662da6 Start running kcov in CI again.
Restrict code coverage to X86_64 for now.

We need to investigate the build faliures for 32-bit x86 before we can
enable it for that architecture.
2019-01-18 15:38:29 -10:00
Brian Smith
4a1a843d96 Remove dead code in build script for "default clang" on Linux.
This code was a no-op, which can be seen by running
mk/update-travis-yml.py and observing that it didn't change anything.
2019-01-18 15:35:05 -10:00
Brian Smith
52c0e56dda 0.14.2. 2019-01-18 12:50:06 -10:00
Brian Smith
36039cf0b6 Fix x86-64 integrated AES-GCM feature detection.
The integrated code path requires CLMUL too.
2019-01-18 12:50:06 -10:00
Brian Smith
b9a6d04826 Remove unnecessary implicit signed/unsigned conversion in aes.c. 2019-01-18 12:50:06 -10:00
Brian Smith
ee9dc7ad52 Prevent implicit type conversion in crypto/fipsmodule/bn/generic.c.
`num >= 4` is not the same as `num & ~3`. This is pretty much a no-op
change because we expect that we'll never encounter a situation where
`num` is too large to be represented as a 32-bit integer.
2019-01-18 12:43:31 -10:00
Brian Smith
0cd9bf6f64 Use C instead of assembly fallback code in GCM on X86_64.
This will ensure that this code is tested in CI and is being compiled
by MSVC; previously this C code wasn't being tested at all because all
platforms we use for testing were taking other code paths.
2019-01-18 12:40:41 -10:00
Brian Smith
225f6b0c3a Fix GCM on Aarch64 platforms without PMULL, e.g. Raspberry Pi 3.
The GHASH part of the tag was effectively being truncated to 16 bits
each round because of a type confusion error. Prior to commit
c4e76592fb2983cd17d20882bf391377b9c44395, the `Xi` parameter of
`GFp_gcm_ghash_4bit` was `uint64_t Xi[2]` and it worked correctly.
In c4e76592fb2983cd17d20882bf391377b9c44395 the type was changed to
`uint8_t Xi[16]`. Most of the code was adapted to the new type,
except these two lines. In particular, note that in that commit that
`GFp_gcm_gmult_4bit` did have the same change made to it.

This only affects AAarch64 platforms without PMULL. X86, X86_64,
and 32-bit ARM have only assembly language code for GCM that is used
instead, so they are unaffected. AAarch64 platforms with PMULL, e.g.
most phones, are not affected because they will use the PMULL-based
code. Consequently, this code wasn't being tested in CI or in most
other configurations.

The C compilers didn't catch this because Clang and GCC do not enable
`-Wconversion` even when `-Wextra` is provided, and because this code
is never compiled with MSVC. A future commit will change both of these
aspects. I verified that MSVC 2017 catches this bug immediately as soon
as allow it to be compiled for X86_64.
2019-01-18 12:36:06 -10:00
Brian Smith
94d4c810c6 Remove now-unused GHASH_CHUNK in gcm.c. 2019-01-16 17:19:23 -10:00
Brian Smith
87031013b7 0.14.1. 2019-01-15 08:07:57 -10:00
Brian Smith
902e3c7b6a cargo +nightly fmt. 2019-01-14 18:07:57 -10:00
Brian Smith
7d60a6690a Fix formatting of ring::rsa::verification module doc comment. 2019-01-14 18:07:39 -10:00
Benjamin Saunders
d6d2a2c238 Expose algorithm, sample length for QUIC header protection
I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2019-01-14 11:40:39 -10:00
Brian Smith
292bb7ea76 0.14.0. 2019-01-09 09:06:30 -10:00
Brian Smith
0cdfac9c02 Update Cargo.toml for QUIC API. 2019-01-09 09:06:18 -10:00
Brian Smith
10214c70c0 Ignote BoringSSL 9cde848..6c597be. 2019-01-07 12:58:32 -10:00
Brian Smith
c75c59749c Merge CFI directives from BoringSSL 1aaa7aa: Add ABI tests for bn_mul_mont. 2019-01-07 12:56:07 -10:00
Brian Smith
bb0e58ea30 No-op merge of BoringSSL 005f616. 2019-01-07 12:54:38 -10:00
Brian Smith
400c1a39e3 Ignore BoringSSL 3c79ba8..9dfaf25. 2019-01-07 12:53:53 -10:00
Brian Smith
91685b70e5 Merge crypto/test/asm/trampoline-x86_64.pl in BoringSSL 17d553d: Add a CFI tester to CHECK_ABI. 2019-01-07 12:53:23 -10:00
Brian Smith
177527d5fe Ignore BoringSSL e67b625..79c7ec0. 2019-01-07 12:52:05 -10:00
David Benjamin
6c597be1c6 Update tools.
Unfortunately, this requires partially reverting
https://boringssl-review.googlesource.com/31324. This is a mess.

While clang proper includes a fuzzer driver, Chromium doesn't use it.
Chromium builds exclusively with fuzzer-no-link and links to its own
copy of the fuzzer runtime[1]. As of [2], Chromium's clang (which we use
on bots) no longer includes the driver, so we must mimic them.

However, Chromium's setup is somewhat questionable because
fuzzer-no-link pulls in libclang_rt.fuzzer_no_main which still includes
most of libclang_rt.fuzzer, just not the one main function[3]. It
appears Chromium is actually linking two copies of
libclang_rt.fuzzer_no_main. Hopefully this mostly works out as Chromium's
clang and libFuzzer should be relatively aligned, but it's not a good
assumption for our build, which can take other Clangs too.

Thus, if you pass -DFUZZ=1 as-is, we will assume you are using a
"normal" Clang with all its relevant runtimes intact. If, however, you
are using Chromium clang, you must drop the matching libFuzzer where the
bots expected it and build with -DLIBFUZZER_FROM_DEPS=1.

This involves no changes to the bots because we never actually unwound
all the LIBFUZZER_FROM_DEPS bits before.

[1] https://cs.chromium.org/chromium/src/testing/libfuzzer/BUILD.gn?rcl=d21c49585f262e851e2984f96f52905782706325&l=14
[2] c79bf2ea4c
[3] 8ebc3668b0/lib/fuzzer/CMakeLists.txt (L93-L107)
    8ebc3668b0/lib/fuzzer/FuzzerMain.cpp

Change-Id: I946b3c821c3d7e6def7e07f1381f58241611ba3d
Reviewed-on: https://boringssl-review.googlesource.com/c/34184
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2019-01-07 22:39:55 +00:00
Raul Tambre
35771ff8af Fix protos_len size in SSL_set_alpn_protos and SSL_CTX_set_alpn_protos
MakeConstSpan() takes size_t as the second argument, so protos_len ought to also be size_t.

Bug: chromium:879657
Change-Id: I93089ea20ce4b9c2b9d4d954dce807feb5341482
Reviewed-on: https://boringssl-review.googlesource.com/c/34164
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2019-01-07 18:14:42 +00:00
Alessandro Ghedini
016a5d54f8 Add ChaCha20 support to QUIC header protection
This requires the addition of a constructor for aead::nonce::Iv from
an aead::block::Block.

I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2019-01-05 09:07:20 -10:00
Alessandro Ghedini
351ed16251 Implement QUIC header protection API
This adds a new API to the AEAD module for generating QUIC Header Protection
masks, as described in draft-ietf-quic-tls-17.

Only AES support is currently implemented, but ChaCha20 can be added later.

I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2019-01-04 17:42:59 -10:00
Brian Smith
9d874613ba Disable x86_64 Intel SHA Extensions code paths for now.
We don't have a good way to build them and, after the most recent
BoringSSL merge, they are breaking the build.
2019-01-04 16:06:22 -10:00
Brian Smith
0a5ad8cf18 Merge BoringSSL 0eaf783: Annotate leaf functions with .cfi_{startproc,endproc} 2019-01-04 16:00:54 -10:00
Brian Smith
563a858132 Take BoringSSL c2e8d01: Fix beeu_mod_inverse_vartime CFI annotations and preamble. 2019-01-04 15:45:41 -10:00
Brian Smith
7bdd3c1ab4 Take BoringSSL a306b1b: Fix CFI annotations in p256-x86_64-asm.pl. 2019-01-04 15:45:24 -10:00
Brian Smith
eda7bcc478 Ignore BoringSSL 6ef1b64. 2019-01-04 15:44:43 -10:00