Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge BoringSSL through a8b1633d1c6be133b9f684cc5cdd778bfd8d564e. #1553

Merged
merged 53 commits into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
553e81e
Update comment in light of prior change.
Apr 25, 2022
15302de
Remove code added to avoid SHA1 weakness.
Apr 25, 2022
48f7947
Fix build for older CMake versions.
mysterymath Apr 25, 2022
0e0ca82
Remove the ASN1_TLC cache. It appears to not help performance.
Apr 27, 2022
8b988b8
Tidy up how ASN1_STRING_print_ex figures out the type.
davidben Apr 13, 2022
9a836f7
Update delocate tests
May 2, 2022
a75bee5
Support running tests on non-NEON devices.
May 2, 2022
a56d941
Add function to return the name of the FIPS module.
May 4, 2022
8241345
Drop ACVP support for 3DES.
May 4, 2022
1a541d4
Add PSS to the AVCP regcap.
May 4, 2022
097ffe1
acvp: test SHA-512/256 with HMAC, RSA (PSS), and ECDSA.
May 4, 2022
25e5b06
Do pending `go fmt` updates.
May 4, 2022
735a868
acvp: test CTR-DRBG with reseed in modulewrapper.
May 4, 2022
df6311b
Add tests for X509_NAME_print_ex.
davidben Apr 15, 2022
3f180b8
Implement SSL_CTX_set_num_tickets.
davidben May 9, 2022
227ff6e
Remove unions in EC_SCALAR and EC_FELEM.
davidben May 5, 2022
07e1b28
Add missing blank line between functions.
May 13, 2022
ce2a353
Declare EVP_AEAD_CTX in base.h, like other typedefs.
May 13, 2022
5a79788
Remove X509_to_X509_REQ.
davidben May 13, 2022
7fd831c
Enforce X.509 version invariants more consistently.
davidben Apr 6, 2022
0426313
limit the feature macro stuff to __linux__
May 17, 2022
f7e2879
Switch to the CIPD version of CMake on Windows.
davidben May 20, 2022
1694627
Don't leave stray errors in the error queue in X509_print_ex.
davidben May 20, 2022
ac639b7
Update build tools.
davidben May 20, 2022
a928171
Use CMake's C/C++ version features.
davidben May 20, 2022
f5d6d24
Move cmac into the FIPS module boundary.
May 5, 2022
118a892
Add a service indicator for FIPS 140-3.
May 13, 2022
71573dc
Clean up ECDSA EVP_PKEY_CTRL_MD validation.
davidben May 23, 2022
1530333
Remove X509_CRL_METHOD.
davidben May 23, 2022
2d4f1b8
Use the correct function types in X509V3_EXT_METHODs.
davidben May 23, 2022
cf506f1
Make EVP_CIPHER opaque.
davidben May 25, 2022
a51821a
Remove a layer of indirection from most EVP_CIPHERs
davidben May 25, 2022
701d8b2
Fix docs for EVP_Cipher given an AEAD.
davidben May 25, 2022
33d7e32
Do not allow md4 or md5 based signatures in X.509 certificates.
Mar 21, 2022
97c6032
Convince clang-format to handle ASN1_ITEM definitions better
davidben May 26, 2022
ac57319
Rewrite ASN1_STRING_print_ex escaping.
davidben May 11, 2022
1f7525e
Remove leading blank lines in convert_comments.go
davidben May 27, 2022
67d4f28
Manually fix a few tables in advance of clang-format.
davidben May 27, 2022
49350b2
Move digestsign.c into the module.
May 23, 2022
a255d7c
Add some missing includes.
davidben May 25, 2022
505bbf9
Add a fuzzer to check CBS is a DER parser.
davidben May 25, 2022
828b2d2
Increase ACVP sizes.
May 30, 2022
451ea3c
Add SSL_[CTX_]_set_compliance_policy.
May 18, 2022
a8b1633
Use // instead of # for comments inside armv8 asm.
davidben Jun 2, 2022
bacb255
No-op merge of BoringSSL 553e81e: Update comment in light of prior ch…
briansmith Nov 8, 2022
855345a
Ignore BoringSSL 15302de..9a836f7.
briansmith Nov 8, 2022
4b11331
Ignore BoringSSL a75bee5..097ffe1.
briansmith Nov 8, 2022
2c042da
No-op merge of BoringSSL 25e5b06: Do pending `go fmt` updates.
briansmith Nov 8, 2022
d18d912
Ignore BoringSSL 735a868..3f180b8.
briansmith Nov 8, 2022
3392aef
Merge BoringSSL 227ff6e: Remove unions in EC_SCALAR and EC_FELEM.
briansmith Nov 8, 2022
d846af0
Ignore BoringSSL 07e1b28..451ea3c.
briansmith Nov 8, 2022
78a9001
Take BoringSSL a8b1633: Use // instead of # for comments inside armv8…
briansmith Nov 8, 2022
dac8111
EC: Fix merge conflict in p256.c.
briansmith Nov 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions crypto/cipher_extra/asm/chacha20_poly1305_armv8.pl
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,9 @@ sub chacha_qr_x5 {
.cfi_offset w30, -72
.cfi_offset w29, -80
mov x29, sp
# We probably could do .cfi_def_cfa w29, 80 at this point, but since
# we don't actually use the frame pointer like that, it's probably not
# worth bothering.
// We probably could do .cfi_def_cfa w29, 80 at this point, but since
// we don't actually use the frame pointer like that, it's probably not
// worth bothering.
stp d8, d9, [sp, #16]
stp d10, d11, [sp, #32]
stp d12, d13, [sp, #48]
Expand Down Expand Up @@ -881,7 +881,7 @@ sub chacha_qr_x5 {
&poly_add_vec($LEN_STORE);
&poly_mul();
$code.=<<___;
# Final reduction step
// Final reduction step
sub $t1, xzr, $one
orr $t2, xzr, #3
subs $t0, $acc0, #-5
Expand Down Expand Up @@ -986,9 +986,9 @@ sub chacha_qr_x5 {
.cfi_offset w30, -72
.cfi_offset w29, -80
mov x29, sp
# We probably could do .cfi_def_cfa w29, 80 at this point, but since
# we don't actually use the frame pointer like that, it's probably not
# worth bothering.
// We probably could do .cfi_def_cfa w29, 80 at this point, but since
// we don't actually use the frame pointer like that, it's probably not
// worth bothering.
stp d8, d9, [sp, #16]
stp d10, d11, [sp, #32]
stp d12, d13, [sp, #48]
Expand Down Expand Up @@ -1502,7 +1502,7 @@ sub chacha_qr_x5 {
&poly_add_vec($LEN_STORE);
&poly_mul();
$code.=<<___;
# Final reduction step
// Final reduction step
sub $t1, xzr, $one
orr $t2, xzr, #3
subs $t0, $acc0, #-5
Expand Down
48 changes: 24 additions & 24 deletions crypto/fipsmodule/ec/p256.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,17 @@ static void fiat_p256_select_point(const fiat_p256_limb_t idx, size_t size,
}

// fiat_p256_get_bit returns the |i|th bit in |in|
static crypto_word fiat_p256_get_bit(const uint8_t *in, int i) {
static crypto_word fiat_p256_get_bit(const Limb in[P256_LIMBS], int i) {
if (i < 0 || i >= 256) {
return 0;
}
return (in[i >> 3] >> (i & 7)) & 1;
#if defined(OPENSSL_64_BIT)
OPENSSL_STATIC_ASSERT(sizeof(Limb) == 8, "BN_ULONG was not 64-bit");
return (in[i >> 6] >> (i & 63)) & 1;
#else
OPENSSL_STATIC_ASSERT(sizeof(Limb) == 4, "BN_ULONG was not 32-bit");
return (in[i >> 5] >> (i & 31)) & 1;
#endif
}

void p256_point_mul(P256_POINT *r, const Limb scalar[P256_LIMBS],
Expand All @@ -343,12 +349,8 @@ void p256_point_mul(P256_POINT *r, const Limb scalar[P256_LIMBS],
debug_assert_nonsecret(p_x != NULL);
debug_assert_nonsecret(p_y != NULL);

P256_SCALAR_BYTES scalar_bytes;
p256_scalar_bytes_from_limbs(scalar_bytes, scalar);

fiat_p256_felem p_pre_comp[17][3];
OPENSSL_memset(&p_pre_comp, 0, sizeof(p_pre_comp));

// Precompute multiples.
limbs_copy(&p_pre_comp[1][0][0], p_x, P256_LIMBS);
limbs_copy(&p_pre_comp[1][1][0], p_y, P256_LIMBS);
Expand Down Expand Up @@ -380,12 +382,12 @@ void p256_point_mul(P256_POINT *r, const Limb scalar[P256_LIMBS],

// do other additions every 5 doublings
if (i % 5 == 0) {
crypto_word bits = fiat_p256_get_bit(scalar_bytes, i + 4) << 5;
bits |= fiat_p256_get_bit(scalar_bytes, i + 3) << 4;
bits |= fiat_p256_get_bit(scalar_bytes, i + 2) << 3;
bits |= fiat_p256_get_bit(scalar_bytes, i + 1) << 2;
bits |= fiat_p256_get_bit(scalar_bytes, i) << 1;
bits |= fiat_p256_get_bit(scalar_bytes, i - 1);
crypto_word bits = fiat_p256_get_bit(scalar, i + 4) << 5;
bits |= fiat_p256_get_bit(scalar, i + 3) << 4;
bits |= fiat_p256_get_bit(scalar, i + 2) << 3;
bits |= fiat_p256_get_bit(scalar, i + 1) << 2;
bits |= fiat_p256_get_bit(scalar, i) << 1;
bits |= fiat_p256_get_bit(scalar, i - 1);
crypto_word sign, digit;
recode_scalar_bits(&sign, &digit, bits);

Expand Down Expand Up @@ -414,9 +416,6 @@ void p256_point_mul(P256_POINT *r, const Limb scalar[P256_LIMBS],
}

void p256_point_mul_base(P256_POINT *r, const Limb scalar[P256_LIMBS]) {
P256_SCALAR_BYTES scalar_bytes;
p256_scalar_bytes_from_limbs(scalar_bytes, scalar);

// Set nq to the point at infinity.
fiat_p256_felem nq[3] = {{0}, {0}, {0}}, tmp[3];

Expand All @@ -427,10 +426,10 @@ void p256_point_mul_base(P256_POINT *r, const Limb scalar[P256_LIMBS]) {
}

// First, look 32 bits upwards.
crypto_word bits = fiat_p256_get_bit(scalar_bytes, i + 224) << 3;
bits |= fiat_p256_get_bit(scalar_bytes, i + 160) << 2;
bits |= fiat_p256_get_bit(scalar_bytes, i + 96) << 1;
bits |= fiat_p256_get_bit(scalar_bytes, i + 32);
crypto_word bits = fiat_p256_get_bit(scalar, i + 224) << 3;
bits |= fiat_p256_get_bit(scalar, i + 160) << 2;
bits |= fiat_p256_get_bit(scalar, i + 96) << 1;
bits |= fiat_p256_get_bit(scalar, i + 32);
// Select the point to add, in constant time.
fiat_p256_select_point_affine((fiat_p256_limb_t)bits, 15,
fiat_p256_g_pre_comp[1], tmp);
Expand All @@ -446,12 +445,13 @@ void p256_point_mul_base(P256_POINT *r, const Limb scalar[P256_LIMBS]) {
}

// Second, look at the current position.
bits = fiat_p256_get_bit(scalar_bytes, i + 192) << 3;
bits |= fiat_p256_get_bit(scalar_bytes, i + 128) << 2;
bits |= fiat_p256_get_bit(scalar_bytes, i + 64) << 1;
bits |= fiat_p256_get_bit(scalar_bytes, i);
bits = fiat_p256_get_bit(scalar, i + 192) << 3;
bits |= fiat_p256_get_bit(scalar, i + 128) << 2;
bits |= fiat_p256_get_bit(scalar, i + 64) << 1;
bits |= fiat_p256_get_bit(scalar, i);
// Select the point to add, in constant time.
fiat_p256_select_point_affine((fiat_p256_limb_t)bits, 15, fiat_p256_g_pre_comp[0], tmp);
fiat_p256_select_point_affine((fiat_p256_limb_t)bits, 15,
fiat_p256_g_pre_comp[0], tmp);
fiat_p256_point_add(nq[0], nq[1], nq[2], nq[0], nq[1], nq[2], 1 /* mixed */,
tmp[0], tmp[1], tmp[2]);
}
Expand Down