10858 Commits

Author SHA1 Message Date
Brian Smith
7886603cee Use some variant of "ring core" instead of "GFp" as a prefix for everything.
"GFp_" isn't in the code at all anymore.
2021-05-02 22:09:07 -07:00
Brian Smith
384f7d056b Replace manual FFI symbol prefixing with automatic symbol prefixing.
Revert the names used in the BoringSSL C/asm code to the names used in
BoringSSL. This substantially reduces the diff between *ring* and
BoringSSL for these files.

Use a variant of BoringSSL's symbol prefixing machinery to semi-
automatically prefix FFI symbols with the `GFp_` prefix. The names aren't
all exactly the same as before, because previously we *replaced* a
symbol's original prefix with the `GFp_` prefix; now we're prepending
`GFp_`. In the future we'll use a different prefix entirely.

This paves the way for using different prefixes for each version so that
multiple versions of *ring* can be linked into an executable at once.
2021-05-02 22:09:07 -07:00
Brian Smith
4048eaa957 Build: Don't make symbol prefixing conditional on a variable being set. 2021-05-02 22:09:07 -07:00
Brian Smith
a9f99b6f06 Build: Bring in BoringSSL symbol prefixing PerlAsm changes.
The symbol prefixing infrastructure wasn't merged when it was originally
added to BoringSSL. Import it now so *ring* can start using it.
2021-05-02 22:09:07 -07:00
Brian Smith
7f98cbb7a7 Remove decryption functions from aesv8-armx. 2021-05-02 22:09:07 -07:00
Brian Smith
0e800b80ce build.rs: Replace manual dirty file checking with cargo:rerun-if-changed.
Simplify build.rs to make it easier to maintain. It seemed like the logic
being removed here wasn't always correct.
2021-04-30 13:37:46 -07:00
Brian Smith
e03cb68e53 CI/CD: Always use LLVM 12. 2021-04-29 16:37:41 -07:00
Brian Smith
4f30438640 CI/CD: Fix error handling in mk/clippy.sh.
`cargo clippy` failed with an error but this didn't cause mk/cargo.sh
to fail because it didn't contain `set -e`. Thus the `clippy` job has
been passing when it shouldn't.

Add the "bash strict mode" to the script.

I verified the other shell scripts use the "bash strict mode" already.
2021-04-29 16:07:38 -07:00
Brian Smith
2b4d07c177 AEAD tests: Fix warning for non-wasm32 targets. 2021-04-29 16:07:38 -07:00
Brian Smith
508f5a3293 CI/CD: Use a GitHub-hosted copy of nasm instead of downloading it from nasm.us.
Downloading from nasm.us frequently fails. Avoid depending on it.

Change the expected location of nasm in build.rs.
2021-04-29 15:10:32 -07:00
Brian Smith
0c69150e35 CI/CD: Use my own fork of (third-party) GitHub Actions.
This is a step towards implementing the GitHub security hardening advice.

```
$ sed -ri 's|(uses: +)([^/]+)/([^@])|\1briansmith/\2-\3|g' .github/workflows/ci.yml
$ grep "uses:" .github/workflows/ci.yml | sort | uniq
      - uses: briansmith/actions-cache@v2
      - uses: briansmith/actions-checkout@v2
      - uses: briansmith/actions-rs-toolchain@v1
      - uses: briansmith/codecov-codecov-action@v1
```
2021-04-26 17:52:53 -07:00
Brian Smith
f3d8b52f53 Minimize GITHUB_TOKEN permissions and avoid persisting it.
Follow the advice near the end of
https://github.blog/changelog/2021-04-20-github-actions-control-permissions-for-github_token/
2021-04-22 16:16:57 -07:00
Brian Smith
9accd874cb WebAssembly: Reduce boilerplate for running tests in WebAssembly.
Skip `digest_tests.rs` since it doesn't get built by wasm-bindgen
correctly when we do this.
2021-04-20 18:22:20 -07:00
Brian Smith
f37b8a2f3e Only use assembly code on known-compatible OS+Arch combinations.
Assume by default that an operating system does not have an ABI compatible
with the PerlAsm sources. Add all the operating systems that we've
explicitly added support for to the allowlist. Avoid trying to build or
use the PerlAsm code for those targets.

On top of this, we can build fallback logic for using Rust (or C)
implementations for those targets that aren't compatible with the
assembly.
2021-04-20 15:45:28 -07:00
Brian Smith
491255539b
Merge pull request #1249 from briansmith/b/clippy
"Fix" clippy job
2021-04-20 14:16:16 -07:00
Brian Smith
d62da4ecbe Move disabling of clippy lints to mk/clippy.sh. 2021-04-20 13:31:22 -07:00
Brian Smith
0141c08d96 CI/CD: Suppress new clippy lints. 2021-04-20 13:31:06 -07: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
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
Brian Smith
9385c6d014 Use Self more. 2021-03-22 16:11:07 -07:00
Dan McArdle
d9ee55a89f Refactor HPKE API to include explicit length parameters.
Bug: 275
Change-Id: I724e9315b860e230e8fed92de34d89a875ef043c
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46184
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2021-03-19 17:24:14 +00:00
David Benjamin
c9d3265a92 Generalize make_errors.go to allow EVP covering multiple directories.
In doing so, this switches make_errors.go to take library names as
parameters rather than detecting it from the CWD. (I considered
detecting it, but then we'd need to map evp -> crypto/whatever and
crypto/whatever -> evp in both directions.)

Since crypto/hpke currently sits in the EVP namespace, I've gone ahead
and added that, so it should be easier to define new errors in
crypto/hpke. I've not added crypto/cipher, etc., yet. Moving those will
be a breaking change (consumers that put ERR_LIB_CIPHER and ERR_LIB_EVP
in a switch/case need patches).

Bug: 398
Change-Id: Ibae2afd46e076891fa517c377b540b2e492516f0
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46264
Reviewed-by: Adam Langley <agl@google.com>
2021-03-19 16:39:08 +00:00
Bradley Hess
b09f283a03 Add a Windows no-op impl of BORINGSSL_self_test
Change-Id: Id5b5b639023d30a8ebd763d02e1787fbf9d79288
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46245
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
2021-03-18 17:18:44 +00:00
David Benjamin
b2147413e0 Only pass -handshaker-path in split handshakes tests.
This is a little inconvenient for external users of the test suite. It's
also not very helpful to pass -handshaker-path in build configurations
without a handshaker because there won't be a file there anyway.

Change-Id: I6a8fdcfbbf86288876c4c6fda2a46d32663efb69
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46244
Reviewed-by: Adam Langley <agl@google.com>
2021-03-18 16:49:02 +00:00
Bradley Hess
c953ee4af7 Add RNG support for FreeBSD.
Get entropy from /dev/urandom on FreeBSD < 12, or getrandom() on FreeBSD
12, per
https://www.freebsd.org/cgi/man.cgi?query=getrandom&sektion=2&format=html

Tested manually with `ninja run_tests` on both FreeBSD 11 and 12.

Change-Id: I72ef54d1a83104d1fbe172fd86f6cd32dacc9819
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46188
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
2021-03-17 17:38:02 +00:00
David Benjamin
fb855a28fe Move fips.c into a subdirectory.
The build scripts distinguish between normal files and bcm.c fragments
based on whether code is in a subdirectory inside crypto/fipsmodule.

Bug: 401
Change-Id: Ieba88178e4f8e19f020e56e2567d5736a34bb43f
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46224
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2021-03-17 16:40:27 +00:00
David Benjamin
a3437c09c7 Implement rsa_pkcs1_sha256_legacy.
See draft-davidben-tls13-pkcs1-00. The code point is disabled by default
and must be configured in SSL_set_verify_algorithm_prefs and
SSL_set_signing_algorithm_prefs. It is also only defined for TLS 1.3
client certificates and otherwise ignored.

This required reworking the tests a bit since this is the first
signature algorithm that's disabled by default, and the first algorithm
that behaves differently between client and server.

Change-Id: Iac4aa96a4963cbc33688c252e958a572c5c3b511
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46187
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2021-03-16 18:07:24 +00:00