summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2022-12-07Fix timebomb by disabling time check in this testBob Beck
Cherry-picked from https://boringssl-review.googlesource.com/c/boringssl/+/55585 Bug: 261669237 Test: atest boringssl_crypto_test boringssl_ssl_test Change-Id: I6e61b8ff2c401b9d8d1a89f28bbcff294179f1a0
2022-12-07Add X509_V_FLAG_NO_CHECK_TIME.Pete Bentley
Cherry-picked from https://boringssl-review.googlesource.com/c/boringssl/+/53965 and needed for a following test fix. The new flag value will only be used in tests on branches that this change is cherry-picked to. This patch is slightly editted from the original as it didn't apply cleanly, but is functionally identical. Original commit message: This was added in OpenSSL 1.1.0. cryptography.io binds it. They don't actually use it, but this is a useful feature to have anyway. Projects like Envoy currently implement such a mode with X509_STORE_set_verify_cb, which is a very problematic API to support. Add this so we can move them to something more sustainable. Bug: 261669237 Test: atest boringsl_crypto_test boringssl_ssl_test Change-Id: Ifa2951df37ad2742486c68f012d4c9aefee374d1
2022-09-16Allow prng_seeder utilityPaul Crowley
Give //system/security/prng_seeder access to ctrdrbg.h Bug: 243933553 Test: Started under init and verified correct operation using strace Change-Id: If18124d50d97d93541e5c040b506484a48ee40ac
2022-08-08Add FIPS break test targets and use them in break-tests.sh.Pete Bentley
Adds a version of libcrypto for use with break-tests.sh which has BORINGSSL_FIPS_BREAK_TESTS defined and updates the script to use them. Removes manual steps from testing at the cost of keeping the FIPS test targets in sync. Test: break-tests.sh Change-Id: Ide85b148260f611552368cce15821b99ee2a07e3
2022-08-08Interim version of FIPS break-tests.sh script.Pete Bentley
This is a working but interim version of the upstream code under review at https://boringssl-review.googlesource.com/c/boringssl/+/53885 This version will work with Android devices but needs some manual steps to create artifacts needed for testing. Next version will improve on that. Test: Run break-tests.sh Change-Id: I9bda1134f4505e63819c9afeb2062e1c94f2eae4
2022-08-08external/boringssl: Sync to branch fips-20220613.Pete Bentley
This includes the following changes: * Include hopefully all ARM instructions with condition codes. * Cherry-pick crypto/internal.h changes from 1e469e45a4 * Fetch entropy from a system daemon in FIPS mode on Android. * Merge entropy read in FIPS mode. * Rename |from_cpu| to |want_additional_input|. * Expose the CTR_DRBG API. * Fix possible ODR violations for ecp_nistz256_from_mont * Don't try to specify SHA-256 for Aarch64 FIPS. Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases boringssl_crypto_test boringssl_ssl_test Change-Id: I7c35fe35ed84cddf49f1c253b6fb5cb984e868fe
2022-06-23Set FIPS version for next evaluation.Pete Bentley
Cherry-picked from upstream. Bug: 233873228 Test: m Change-Id: Ie9302ec1616437d04efe568e39893eef84e5f08a Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/53105 Reviewed-by: David Benjamin <davidben@google.com>
2022-06-16external/boringssl: Sync upstream branch fips-20220613Pete Bentley
Final FIPS changes for 2022. The upstream branch being merged contains cherry-picks of changes needed for FIPS certification plus a couple of critical bug fixes. No API or ABI changes. No functional changes. Those changes are also in the main upstream branch, so won't be overwritten by the next routine rollup with do using our UPDATING script. Includes the following changes: * Add an extra reduction step to the end of RSAZ. * Always end BN_mod_exp_mont_consttime with normal Montgomery reduction. * More includes for builds that don't use bcm.c * Add some more includes. * Increase ACVP sizes. * Move digestsign.c into the module. Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases Change-Id: I1d41a5d6f51af818253b55b8b99e0e73ea6e24ba
2022-06-03ANDROID: Build fix for hmac.cAlistair Delva
Upstream 118a892d2da8c78b46ed549454b3b62ded8c84b7 broke the build of hmac.c when BORINGSSL_FIPS is not set because it calls functions such as FIPS_service_indicator_lock_state() which are provided as static inlines by service_indicator/internal.h. Fix it. Bug: 234880165 Change-Id: I8a730cd067906b81ded3d78b609334c22d49ce4b
2022-05-27external/boringssl: Sync to 1530333b25589ee4d4d52b10e78ee55dd82f6dcd.Pete Bentley
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/c9a7dd687987666df5910f2b35fdc8c3d1e5ed05..1530333b25589ee4d4d52b10e78ee55dd82f6dcd * Remove X509_CRL_METHOD. Update-Note: APIs relating to X509_CRL_METHOD are removed. * Clean up ECDSA EVP_PKEY_CTRL_MD validation. * Add a service indicator for FIPS 140-3. * Move cmac into the FIPS module boundary. * Use CMake's C/C++ version features. * Update build tools. * Don't leave stray errors in the error queue in X509_print_ex. * Switch to the CIPD version of CMake on Windows. * limit the feature macro stuff to __linux__ * Enforce X.509 version invariants more consistently. Update-Note: Invalid CRL and CSR versions will no longer be accepted. X509_set_version, etc., no longer allow invalid versions. * Remove X509_to_X509_REQ. Update-Note: Removed seemingly unused public API. * Declare EVP_AEAD_CTX in base.h, like other typedefs. * Add missing blank line between functions. * Remove unions in EC_SCALAR and EC_FELEM. * Implement SSL_CTX_set_num_tickets. * Add tests for X509_NAME_print_ex. * acvp: test CTR-DRBG with reseed in modulewrapper. * Do pending `go fmt` updates. * acvp: test SHA-512/256 with HMAC, RSA (PSS), and ECDSA. * Add PSS to the AVCP regcap. * Drop ACVP support for 3DES. * Add function to return the name of the FIPS module. * Support running tests on non-NEON devices. * Update delocate tests * Tidy up how ASN1_STRING_print_ex figures out the type. * Remove the ASN1_TLC cache. It appears to not help performance. * Fix build for older CMake versions. * Remove code added to avoid SHA1 weakness. * Update comment in light of prior change. * ChaCha20-Poly1305 for Armv8 (AArch64) * Replace the last strcasecmp with OPENSSL_strcasecmp. * [build] Fix build with HEAD clang. * Make calls to the verify callback consistant by calling ctx->verify_cb directly. This removes some temporary variables that would only be used to hold ctx->verify_cb. * Try to require C11 (in non-MSVC compilers). Update-Note: If the build fails with an error about C11, remove -std=c99 or -std=gnu99 from your build. Refcounting will get faster. * Try to require C++14. Update-Note: C++14 is now required to build BoringSSL. If the build breaks, make sure your compiler is C++14-capable and is not passing -std=c++11. If this is causing problems for your project, let us know. * Reject [UNIVERSAL 0] in DER/BER element parsers. Update-Note: There are two kinds of impacts I might expect from this change. The first is BER parsers might be relying on the CBS DER/BER element parser to pick up EOCs, as our ber.c does. This should be caught by the most basic unit test and can be fixed by detecting EOCs externally. * Add CMake install rules. * P-256 assembly optimisations for Aarch64. * hrss: always normalize. * Use SHA-256 for the FIPS integrity check everywhere. * Remove unused variable * Use X509 certificate alias as friendlyName in PKCS12 Bug: 231880827 Bug: 233873228 Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases Change-Id: I748d8d55ffab4ea4441648307a797e7b709b6def
2022-05-26Use genrule to pull in bindgen-erated sourceDavid Drysdale
Rather than having a local modification of the upstream Rust source, instead use a genrule to replace the `${INCLUDES}` placeholder with a re-export of everything from the bindgen-created code. This change means that the upstream BoringSSL source no longer has a local modification, making it easier to import new versions. Also add a rust_test for the bindgen layout tests along the way. Bug: 177080016 Test: build targets, atest libbssl_sys_raw_test Change-Id: Iabf1b6ac4ae7d3a391cc038b29f157347fb36f2f
2022-04-28Build Rust bindingsMatthew Maurer
Converts the CMake build for Rust into an Android.bp one. Resulting Rust bindings are only available to the `openssl` crate, as they are raw bindings and should have a safe wrapper before anyone else uses them. Bug: 177080016 Test: mm Change-Id: I81e85b663c6ac7539395b54dad7e224e2b3f5433
2022-04-08external/boringssl: Sync to c9a7dd687987666df5910f2b35fdc8c3d1e5ed05.Pete Bentley
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/81502beeddc5f116d44d0898c6c4a33057198db8..c9a7dd687987666df5910f2b35fdc8c3d1e5ed05 * Retire the Windows BIO_printf workaround. * Work around another C language bug with empty spans. * ASAN replaces malloc and free with its own implementation. * Update fiat-crypto. * Remove VS 2015 support. Update-Note: BoringSSL may no longer build with VS 2015. Consumers should upgrade to the latest Visual Studio release. VS 2017 or later is required. * Remove X509_TRUST_set_default. * Replace internal use sha1 hash with sha256. * Document that |EC_KEY_generate_fips| works for both cases. * Allow the integrity test to be run on demand. * Add a function to return a FIPS version. * Add a function to tell if an algorithm is FIPS approved. * Add vs2019 to vs_toolchain.py. * Unexport X509_CERT_AUX and remove X509_CERT_AUX.other * Document and tidy up X509_alias_get0, etc. * Don't loop forever in BN_mod_sqrt on invalid inputs. * Make a whitespace commit to trigger a build. * Rust bindings: Use CARGO_MANIFEST_DIR in build.rs * Remove ASN1_ADB_INTEGER. * Replace an ASN1_INTEGER_get call with ASN1_INTEGER_get_uint64 * Correctly handle LONG_MIN in ASN1_INTEGER_get. * Implement ASN1_INTEGER_set_uint64 with ASN1_STRING_set. * Rewrite and tighten ASN1_INTEGER encoding and decoding. Update-Note: Invalid INTEGERs will no longer parse, but they already would not have parsed in OpenSSL. Additionally, zero is now internally represented as "" rather than "\0". * Deduplicate the rest of ASN1_INTEGER and ASN1_ENUMERATED. Update-Note: ASN1_INTEGER_to_BN and ASN1_ENUMERATED_to_BN will now fail when called on an ASN1_STRING/ASN1_INTEGER/ASN1_ENUMERATED (they're all the same type) with the wrong runtime type value. Previously, callers that mixed them up would get the right answer on positive values and silently misinterpret the input on negative values. This change matches OpenSSL's 1.1.0's behavior. * Fix theoretical overflow in ASN1_INTEGER_cmp. * Include rsa/internal.h for |...no_self_test| functions. * Limit the pthread_rwlock workaround to glibc. Update-Note: If there are non-glibc libcs with similarly problematic headers, this may break the build. Let us know if it does. * Rewrite ASN1_INTEGER tests. * Use X509V3_add_value_int in i2v_AUTHORITY_KEYID. * Fix x509v3_bytes_to_hex when passed the empty string. * Reimplement ASN1_get_object with CBS. Update-Note: Invalid certificates (and the few external structures using asn1t.h) with incorrectly-encoded tags will now be rejected. * Add an explicit indefinite-length output to CBS_get_any_ber_asn1_element. Update-Note: This is a breaking change to CBS_get_any_ber_asn1_element. There is only one external caller of this function, and it should be possible to fix them atomically with this change, so I haven't bothered introducing another name, etc. (See cl/429632075 for the fix.) * Use ctype(3) in a more standards-conformant way. Bug: 160351635 Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases Change-Id: Iffd9451788b67d3da80cefbcf8d3d0ffb7d682fd Merged-In: Iffd9451788b67d3da80cefbcf8d3d0ffb7d682fd
2022-02-28external/boringssl: Sync to 81502beeddc5f116d44d0898c6c4a33057198db8.Pete Bentley
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/345c86b1cfcc478a71a9a71f0206893fd16ae912..81502beeddc5f116d44d0898c6c4a33057198db8 * Linkify RFCs in more places in the docs. * Make FFDH self tests lazy. * Make ECC self tests lazy. * HPKE is now RFC 9180. * Include the policy document for the most recent FIPS validation. * Check static CPU capabilities on x86. Update-Note: This CL may break build environments that incorrectly mark some instruction as statically available. This is unlikely to happen with vector instructions like AVX, where the compiler could freely emit them anyway. However, instructions like AES-NI might be set incorrectly. * Align rsaz_avx2_preferred with x86_64-mont5.pl. * Enable SHA-NI optimizations for SHA-256. * Update Intel SDE. * Include the EKU extension in bssl server's self-signed certs. * Don't call a non-test file *test.h. * Make RSA self-test lazy. * Add link to new Android FIPS certificate. * delocate: handle a new output form in Clang 13. * Drop, now unused, KAT value. * Drop CAVP code. * Break FIPS tests differently. * Don't forget hmac.h in self_check.h. * Perform SHA-$x and HMAC KAT before integrity check. * Add a couple of spaces to `check_test`. * Split FIPS KATs into fast and slow groups. * Move DES out of the FIPS module. * acvp: don't send the Authorization header when renewing tokens * Support Bazel's test-sharding protocol. * Simply CMake assembly source selection. * Rename generated assembly from 'mac' or 'ios' to 'apple' Update-Note: References to 'mac' or 'ios' source lists in downstream builds should be renamed to 'apple'. * Build aarch64 assembly for macOS in the bazel build. * Fix OPENSSL_NO_ASM definition in bazel. * Use @platforms in Bazel rules. * Record ClientHelloInner values in msg_callback. * Fold ssl_decode_client_hello_inner into ssl_client_hello_decrypt. * Explicitly reject self-referential ech_outer_extensions. * Simpler square-root computation for Ed25519 * Condition split handshake tests on Linux in CMake. * Implement PEM_read_bio_DHparams with the macro. * Limit _XOPEN_SOURCE to Linux. Update-Note: It's possible this will break yet another obscure UNIX. Hopefully we can eventually find a combination that works? * Fix Unicode strings for C++20 Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases Change-Id: I177c2a06d3d85ea4912e4f657caa370363966c33
2022-01-25external/boringssl: Sync to 345c86b1cfcc478a71a9a71f0206893fd16ae912.Benjamin Brittain
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/a9670a8b476470e6f874fef3554e8059683e1413..345c86b1cfcc478a71a9a71f0206893fd16ae912 * Switch CRYPTO_BUFFER_POOL to SipHash-2-4. * LSC: Apply clang-tidy's modernize-use-bool-literals to boringssl * Fix mac_arm64 builder. * Put Rust binding generation behind an explicit flag and only build bindings for the targeted Arch * Add ARMV8_SHA512 detection for Fuchsia. Update-Note: This CL is written assuming we can just rely on the SDK changes. Per go/fuchsia-sdk-age, this seems fairly safe. If this file fails to build due to missing symbols, update your project's Fuchsia SDK. If this blocks something, let us know. * Generates "low-level" bindings for Rust using bindgen * Add note about Gerrit account creation * Make EVP_AEAD_CTX_free accept NULL. * Zero out the values from the integrity check. * Ignore duplicates in |X509_STORE_add_*| * Don't #include "internal.h" twice. * Version bump: 2 -> 3. * Simplify __ARM_ARCH__ definition. Update-Note: ARM assembly now requires the compiler define __ARM_ARCH. This is not expected to break Clang or GCC from the last 8 or 9 years. * Don't use __ARMEL__/__ARMEB__ in aarch64 assembly * Switch __ARM_FEATURE_CRYPTO to __ARM_FEATURE_{AES,SHA2}. * Move CPU detection symbols to crypto/internal.h. * Move public APIs from cpu.h to crypto.h. Update-Note: As part of this, I conditioned cpu-arm-linux.c on OPENSSL_LINUX, so that the header files can have accurate conditions. This means unrecognized ARM platforms that do not set OPENSSL_STATIC_ARMCAP will fail to build, where previously we defaulted to the Linux mechanisms. This matches cpu-aarch64-linux.c, which is already gated on OPENSSL_LINUX. (And the file is quite Linux-specific. Even if a non-Linux ELF target used getauxval for ARM capabilities, it's unlikely that our hardcoded constants and /proc behavior applies anyway.) * Rename CPU feature files with underscores. * Enable SHA-512 ARM acceleration when available. Update-Note: Consumers with a different build setup may need to limit -D_XOPEN_SOURCE=700 to Linux or non-Apple platforms. Otherwise, <sys/types.h> won't define some typedef needed by <sys/sysctl.h>. If you see a build error about u_char, etc., being undefined in some system header, that is probably the cause. * Sync sha512-armv8.pl up to 753316232243ccbf86b96c1c51ffcb41651d9ad5. * Import sha512-armv8.pl transforms from upstream NEON code. * Import a few test vectors from OpenSSL. * Use uint16_t in TestConfig and enable -Wformat-signedness. * Reorder flags to match TestConfig struct. * Rewrite bssl_shim command-line parser. * Fix X509_CRL_print error-handling. * Silence -Wformat-signedness when printing X.509 versions. * Don't print small, negative serial numbers in decimal. * Fix the easy -Wformat-signedness errors. * Add BIO_tell and BIO_seek wrappers. * Remove non-standard wildcard input DNS names. Update-Note: ".example.com" as an input DNS name will no longer match "www.example.com" in a certificate. (Note this does not impact wildcard certificates. Rather, it removes a non-standard "reverse wildcard" that OpenSSL implemented.) * Rewrite X.509 name-matching tests. * Remove non-standard X.509 DNS wildcard matching. Update-Note: BoringSSL will no longer accept wildcard patterns like *www.example.com or www*.example.com. (It already did not accept ww*w.example.com.) X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS will also be ignored and can no longer be used to allow foo.bar.example.com to match *.example.com. * Make X509_REVOKED opaque. Update-Note: Use X509_REVOKED accessors rather than reaching into the struct. * Document |SSL_set1_host| return values. * Add |SSL_set1_host| and |SSL_set_hostflags|. * Add ERR_set_error_data for compatibility. * Add BN_GENCB_new, BN_GENCB_free, and RSA_test_flags. * Remove X509_REVOKED.sequence. * Binary tag bump: 1 -> 2 * Export PKCS12_DEFAULT_ITER. * Add SSL_has_pending. * Update HPKE test vectors. * Add various OpenSSL compatibility functions. * Add PKCS7_bundle_raw_certificates function which takes CRYPTO_BUFFERs Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases Change-Id: I6348ef26c5afb28e09132acd267be700de379cc8
2021-11-05external/boringssl: Sync to a9670a8b476470e6f874fef3554e8059683e1413.Pete Bentley
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/66e61c577d39e757bf491468f651461fa79fd5e1..a9670a8b476470e6f874fef3554e8059683e1413 * No-op change to test the bots. * Remove outdated comment in ECDSA implementation. * Add missing assert.h include. * Check tag class and constructed bit in d2i_ASN1_OBJECT. Update-Note: d2i_ASN1_OBJECT will now notice more incorrect tags. It was already checking for tag number 6, so it is unlikely anyone was relying on this as a non-tag-checking parser. * Don't parse constructed BIT STRINGs in crypto/bytestring Update-Note: PKCS#7 and PKCS#12 parsers will now reject BER constructed BIT STRINGs. We were previously misparsing them, as was OpenSSL. Given how long the incorrect parse has been out there, without anyone noticing (other parsers handle it correctly), it is unlikely these exist. * Enforce DER rules for BIT STRING values. * Remove support for indefinite lengths in crypto/asn1. Update-Note: Invalid certificates (and the few external structures using asn1t.h) with BER indefinite lengths will now be rejected. * Remove support for constructed strings in crypto/asn1. Update-Note: Invalid certificates (and the few external structures using asn1t.h) with BER constructed strings will now be rejected. * Check for trailing data in extensions. Update-Note: Some previously accepted invalid certicates may be rejected, either in certificate verification or in X509_get_ext_d2i. * Update tools. * Fold x509v3/pcy_int.h into x509v3/internal.h. * Switch kModuleDigestSize to a macro. * Switch DEPS actions on bots to Python 3. * Match OPENSSL_EXPORT in ssl/internal.h friend declarations. * Add a function to express the desired record version protocol. * Add CRYPTO_BUFFER_new_from_static_data_unsafe. * Finish documenting asn1.h. * Trim some undocumented symbols from asn1.h. * Add magic tag to BoringSSL binaries. * Document and const-correct multi-string types. * Fully unexport X509_VAL. Update-Note: The last remnants of the now (barely usable) X509_VAL are no longer exported. It is unlikely anyone was relying on this. * Document ASN1_OBJECT, i2c, and c2i functions. * Unexport ASN1_OBJECT_new. Update-Note: ASN1_OBJECT_new is no longer exported. While this function does remain in OpenSSL, it is extremely unlikely anyone has found a use for this function. * Return 0x80 in all ASN1_get_object error paths. Update-Note: ASN1_get_object's calling convention is slightly simplified. * Document low-level encoding functions in asn1.h. * Use C preprocessor comments in assembly headers. * Document and const-correct ASN1_TYPE functions. * Fix error-handling for i2a_ASN1_OBJECT. * Document i2a_ASN1_* functions. * Fold i2a_ASN1_ENUMERATED into i2a_ASN1_INTEGER. * Fix BIT STRING comparison in ASN1_STRING_cmp. Update-Note: ASN1_STRING_cmp no longer incorrectly treats BIT STRINGs with different padding bits as equal. * Rewrite ASN1_item_pack and ASN1_item_unpack. Update-Note: ASN1_item_unpack now checks for trailing data. * Document some more ASN1_ITEM-associated functions. * Reword ASN1_BOOLEAN exception. * Move M_ASN1_* to the deprecated section. * Fix up some doc.go nits in asn1.h. * Document new/free/d2i/i2d for singly-typed ASN1_STRINGs. * Document ASN1_NULL. * Const-correct the low-level ASN1 i2d functions. Update-Note: The type signature of some i2d functions, such as i2d_ASN1_OCTET_STRING, is now const-correct. * Start documenting ASN1_ITEM. * Tidy up SSLTest.SetVersion. * Deduplicate d2i and i2d documentation. * Check tag class and constructed bit in d2i_ASN1_BOOLEAN. * Use typedefs in i2d and d2i_ASN1_BOOLEAN. * Forward-declare SSL_CLIENT_HELLO. * Fix BN_CTX usage in BN_mod_sqrt malloc error paths. * Make ASN1_NULL an opaque pointer. Update-Note: Code that was assuming ASN1_NULL was an int typedef will fail to compile. Given this was never dereferencable, it is hard to imagine anything relying on this. * Remove remnants of ASN.1 print function generators. * Fold x509_vfy.h into x509.h. * Make ASN1_STRING_TABLE_add thread-safe and document. Update-Note: ASN1_STRING_TABLE_add no longer allows overwrite existing entries. In most cases, this would crash or trigger a race condition anyway. * Test ASN1_STRING_set_by_NID with custom NIDs. * Test ASN1_STRING_set_by_NID with built-in NIDs. * Test that built-in ASN1_STRING_TABLEs are sorted. * Extract common rotl/rotr functions. * Remove X509_STORE_set0_additional_untrusted. * Enable X509_V_FLAG_TRUSTED_FIRST by default. Update-Note: X509_verify_cert will now build slightly different chains by default. Hopefully, this fixes more issues than it causes, but there is a risk of trusted_first breaking other scenarios. Those scenarios will also break OpenSSL 1.1.x defaults, so hopefully this is fine. * Switch x509_test.cc to modify the existing X509_VERIFY_PARAM. * Add note to HMAC test vectors from NIST * Add log tag for Trusty. * Fix CRYPTO_malloc, etc., definitions. * Keep EVP_CIPHER/EVP_MD lookup and do_all functions in sync * aarch64: Add missing LR validation in 'vpaes_cbc_encrypt' Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases Change-Id: I0fc8c0f6505d4ee04193404cf02ec776bced8d40
2021-10-05Enable X509_V_FLAG_TRUSTED_FIRST by default.David Benjamin
Cherry-picked from https://boringssl-review.googlesource.com/c/boringssl/+/49745 and https://boringssl-review.googlesource.com/c/boringssl/+/49746 Cherry-picked outside normal BoringSSL release process to allow easier cherry-picking to Mainline (see bug for details). The first cherry-pick is a test-only fix to pick up correct defaults, the rest of this commit message refers to the second. The OpenSSL X.509 verifier lacks a proper path builder. When there are two paths available for a certificate, we pick one without looking at expiry, etc. In scenarios like one below, X509_V_FLAG_TRUSTED_FIRST will prefer Leaf -> Intermediate -> Root1. Otherwise, we will prefer Leaf -> Intermediate -> Root1Cross -> Root2: Root2 | Root1 Root1Cross \ / Intermediate | Leaf If Root2 is expired, as with Let's Encrypt, X509_V_FLAG_TRUSTED_FIRST will find the path we want. Same if Root1Cross is expired. (Meanwhile, if Root1 is expired, TRUSTED_FIRST will break and leaving it off works. TRUSTED_FIRST does not actually select chains with validity in mind. It just changes the semi-arbitrary decision.) OpenSSL 1.1.x now defaults to X509_V_FLAG_TRUSTED_FIRST by default, so match them. Hopefully the shorter chain is more likely to be correct. Update-Note: X509_verify_cert will now build slightly different chains by default. Hopefully, this fixes more issues than it causes, but there is a risk of trusted_first breaking other scenarios. Those scenarios will also break OpenSSL 1.1.x defaults, so hopefully this is fine. BoringSSL-Bug: 439 Bug: 201667701 Test: atest boringssl_crypto_test Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49746 Reviewed-by: Adam Langley <agl@google.com> Reviewed-by: Ryan Sleevi <rsleevi@chromium.org> (cherry picked from BoringSSL commit 8f5eb80b810ff63d14ad3535cb16f7cb8271a4f5) Change-Id: Ib75feb0081ced6520f9547ff381ee7b4dee75010
2021-10-01external/boringssl: Sync to 66e61c577d39e757bf491468f651461fa79fd5e1.Pete Bentley
This change re-lands https://r.android.com/1834454 by reverting https://r.android.com/1842042 with no changes. Revert was due to a vendor copy of wpa_supplicant needing the same changes as https://r.android.com/1835013, this is now done and I verified that it builds correctly against this version of BoringSSL. This CL includes the following upstream changes: https://boringssl.googlesource.com/boringssl/+log/c1571feb5faf5cce844354c63d0f3e842464bea3..66e61c577d39e757bf491468f651461fa79fd5e1 * Allow PKCS7_sign to work for signing kernel modules. * Speed up constant-time base64 decoding. * Unwind remnants of ASN1_TFLG_NDEF. * acvptool: add CS3 support. * Ignore SIGPIPE in the bssl tool. * Add FIPS counters for AES-GCM in EVP_AEAD. * Refresh fuzzer corpus for ECH draft-13. * Fix the TLS fuzzers for ECH draft-13. * Clarify that TLS sessions are not application sessions. * Fix BN_prime_checks_for_validation to align with false-positive rate. * Add maskHash to RSA_PSS_PARAMS for compat * Remove ASN1_OP_I2D_* callbacks. * Don't read it->funcs without checking it->itype. * Reject missing required fields in i2d functions. Update-Note: Structures with missing mandatory fields can no longer be encoded. Note that, apart from the cases already handled by preceding CLs, tasn_new.c will fill in non-NULL empty objects everywhere. The main downstream impact I've seen of this particular change is in combination with other bugs. Consider a caller that does: * Reject -1 types in ASN1_TYPE and MSTRINGs when encoding. Update-Note: A default-constructed object with a required ANY or string-like CHOICE field cannot be encoded until the field is specified. Note this affects i2d_X509: notBefore and notAfter are string-like CHOICEs in OpenSSL. * Correctly handle invalid ASN1_OBJECTs when encoding. Update-Note: A default-constructed object with a required ASN1_OBJECT field can no longer be encoded without initializing the ASN1_OBJECT. Note this affects X509: the signature algorithm is an ASN1_OBJECT. Tests that try to serialize an X509_new() must fill in all required fields. (Production code is unlikely to be affected because the output was unparsable anyway, while tests sometimes wouldn't notice.) * Check for invalid CHOICE selectors in i2d functions. Update-Note: An invalid CHOICE object (e.g. GENERAL_NAME) will now fail when encoded, rather than be silently omitted. In particular, CHOICE objects are default-initialized by tasn_new.c in an empty -1 state. Structures containing a required CHOICE field can no longer be encoded without filling in the CHOICE. * Fix x509_name_ex_i2d error-handling. * Correctly propagate errors in i2d functions. Update-Note: Some error cases which were silently misinterpreted as missing OPTIONAL elements will now cause encoding to fail. * acvptool: add hmacDRBG support * Check for __TRUSTY__ instead of TRUSTY. * Update comment for ECH draft-13. * Silence a GCC false positive warning. * Switch to the new, simpler WHATWG URL formulation. * Revert "Guard use of sdallocx with BORINGSSL_SDALLOCX" * Fix calculation of draft-13 ECH confirmation signal. * Update to draft-ietf-tls-esni-13. * Reword SSL_get0_ech_name_override documentation. * Remove SSL_set_verify_result. * Make most of crypto/x509 opaque. Update-Note: Patch cl/390055173 into the roll that includes this. This unexports most of the X.509 structs, aligning with OpenSSL. Use the accessor APIs instead. * Remove V_ASN1_APP_CHOOSE. Update-Note: V_ASN1_APP_CHOOSE is removed. I only found one use, which has been fixed. * Rewrite ASN1_PRINTABLE_type and add tests. * Include SHA512-256 in EVP_get_digestbyname and EVP_MD_do_all. * NUL is not printable. Update-Note: ASN1_mbstring_ncopy will no longer allow PrintableString for strings containing NUL. * Make RSA_check_key more than 2x as fast. * Benchmark RSA private key parsing. * Work around yet another MSVC 2015 SFINAE bug. * Avoid re-hashing the transcript multiple times. * Make ssl_parse_extensions a little easier to use. * Deduplicate our three ServerHello parsers. * Merge in OpenSSL's X.509 corpus. * Run X509_print in the certificate fuzzer. * Fix some error-handling in i2v functions. * Fix typo. * OPENSSL_strndup should not return NULL given {NULL, 0}. * Rewrite name constraints matching with CBS. * Add some tests for name constraints. * Fix i2v_GENERAL_NAME to not assume NUL terminated strings * Do not rely on ASN1_STRING being NUL-terminated. * Add a CBB_add_zeros helper. * Linkify RFCs in documentation. * Refer to RFCs consistently. * runner: Test session IDs over 32 bytes. * Process the TLS 1.3 cipher suite in one place. * Guard use of sdallocx with BORINGSSL_SDALLOCX * Bump minimum GCC version and note impending VS2015 deprecation. * Add Span::first() and Span::last(). * Simplify built-in BIOs slightly. * Fix some error returns from SSL_read and SSL_write. * Fix negative ENUMERATED values in multi-strings. * Add a test for ASN1_mbstring_copy and clean up. * Remove ASN1_TFLG_SET_ORDER. * Fix ASN1_STRING_print_ex with negative integers. * Check i2d_ASN1_TYPE's return value in ASN1_STRING_print_ex. * Document ASN.1 printing functions. * Move some ASN1 printing functions to crypto/asn1. * Move a_strex.c back to asn1, split X509_NAME bits out. * Unwind io_ch abstraction in print functions. * Implement ASN1_STRING_print_ex_fp, etc., with file BIOs. * Remove OPENSSL_NO_FP_API ifdefs. * Move X509_ALGOR to x509.h. * Unexport BIT_STRING_BITNAME. * Unexport ub_* constants. Update-Note: Removed some unnamespaced constants. * Always use an ASN1_STRING_TABLE global mask of UTF8String. Update-Note: The global mask for ASN1_STRING_set_by_NID is now always UTF-8. Callers that want another type should reconsider and, if UTF-8 is still unsuitable, just pass the actual desired type into ASN1_mbstring_copy, X509_NAME_ENTRY_set_data, etc * Document ASN1_mbstring_copy. * Update ghashv8-armx.pl from upstream. * Align with upstream on 'close STDOUT' lines. * Avoid double-expanding variables in CMake. * Reject years outside 0000-9999 in ASN1_GENERALIZEDTIME_adj. * Add some tests for time_t to ASN1_TIME conversions. * Remove ASN1_STRING_FLAG_MSTRING. Update-Note: ASN1_STRING_FLAG_MSTRING is no longer defined and X509_time_adj_ex now behaves more predictably. Callers that actually wanted to lock to a specific type should call ASN1_UTCTIME_adj or ASN1_GENERALIZEDTIME_adj instead. * Document another batch of functions. * Clarify BIO_new_mum_buf's lifetime rules. * generate_ech.cc: include needed headers * Don't overread in poly_Rq_mul * acvp: recognise another style of JSON. * Revert "Revert "Revert "Disable check that X.509 extensions implies v3.""" Change-Id: I5fe21e26f701feb315aceb86684b5bc1ee327669 Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases
2021-09-30Revert "external/boringssl: Sync to 66e61c577d39e757bf491468f651..."Michael Eastwood
Revert submission 1835013-bssl_update_sep2021 Reason for revert: DroidMonitor: Potential culprit for Bug 201683809 - verifying through Forrest before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted. Reverted Changes: I27d7b79e3:Fix wpa_supplicant build with newer BoringSSL I4f2228ef8:external/boringssl: Sync to 66e61c577d39e757bf4914... Change-Id: If2184c4aa55b7dc89e037362e4d5cbbea1107ae2
2021-09-27external/boringssl: Sync to 66e61c577d39e757bf491468f651461fa79fd5e1.Pete Bentley
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/c1571feb5faf5cce844354c63d0f3e842464bea3..66e61c577d39e757bf491468f651461fa79fd5e1 * Allow PKCS7_sign to work for signing kernel modules. * Speed up constant-time base64 decoding. * Unwind remnants of ASN1_TFLG_NDEF. * acvptool: add CS3 support. * Ignore SIGPIPE in the bssl tool. * Add FIPS counters for AES-GCM in EVP_AEAD. * Refresh fuzzer corpus for ECH draft-13. * Fix the TLS fuzzers for ECH draft-13. * Clarify that TLS sessions are not application sessions. * Fix BN_prime_checks_for_validation to align with false-positive rate. * Add maskHash to RSA_PSS_PARAMS for compat * Remove ASN1_OP_I2D_* callbacks. * Don't read it->funcs without checking it->itype. * Reject missing required fields in i2d functions. Update-Note: Structures with missing mandatory fields can no longer be encoded. Note that, apart from the cases already handled by preceding CLs, tasn_new.c will fill in non-NULL empty objects everywhere. The main downstream impact I've seen of this particular change is in combination with other bugs. Consider a caller that does: * Reject -1 types in ASN1_TYPE and MSTRINGs when encoding. Update-Note: A default-constructed object with a required ANY or string-like CHOICE field cannot be encoded until the field is specified. Note this affects i2d_X509: notBefore and notAfter are string-like CHOICEs in OpenSSL. * Correctly handle invalid ASN1_OBJECTs when encoding. Update-Note: A default-constructed object with a required ASN1_OBJECT field can no longer be encoded without initializing the ASN1_OBJECT. Note this affects X509: the signature algorithm is an ASN1_OBJECT. Tests that try to serialize an X509_new() must fill in all required fields. (Production code is unlikely to be affected because the output was unparsable anyway, while tests sometimes wouldn't notice.) * Check for invalid CHOICE selectors in i2d functions. Update-Note: An invalid CHOICE object (e.g. GENERAL_NAME) will now fail when encoded, rather than be silently omitted. In particular, CHOICE objects are default-initialized by tasn_new.c in an empty -1 state. Structures containing a required CHOICE field can no longer be encoded without filling in the CHOICE. * Fix x509_name_ex_i2d error-handling. * Correctly propagate errors in i2d functions. Update-Note: Some error cases which were silently misinterpreted as missing OPTIONAL elements will now cause encoding to fail. * acvptool: add hmacDRBG support * Check for __TRUSTY__ instead of TRUSTY. * Update comment for ECH draft-13. * Silence a GCC false positive warning. * Switch to the new, simpler WHATWG URL formulation. * Revert "Guard use of sdallocx with BORINGSSL_SDALLOCX" * Fix calculation of draft-13 ECH confirmation signal. * Update to draft-ietf-tls-esni-13. * Reword SSL_get0_ech_name_override documentation. * Remove SSL_set_verify_result. * Make most of crypto/x509 opaque. Update-Note: Patch cl/390055173 into the roll that includes this. This unexports most of the X.509 structs, aligning with OpenSSL. Use the accessor APIs instead. * Remove V_ASN1_APP_CHOOSE. Update-Note: V_ASN1_APP_CHOOSE is removed. I only found one use, which has been fixed. * Rewrite ASN1_PRINTABLE_type and add tests. * Include SHA512-256 in EVP_get_digestbyname and EVP_MD_do_all. * NUL is not printable. Update-Note: ASN1_mbstring_ncopy will no longer allow PrintableString for strings containing NUL. * Make RSA_check_key more than 2x as fast. * Benchmark RSA private key parsing. * Work around yet another MSVC 2015 SFINAE bug. * Avoid re-hashing the transcript multiple times. * Make ssl_parse_extensions a little easier to use. * Deduplicate our three ServerHello parsers. * Merge in OpenSSL's X.509 corpus. * Run X509_print in the certificate fuzzer. * Fix some error-handling in i2v functions. * Fix typo. * OPENSSL_strndup should not return NULL given {NULL, 0}. * Rewrite name constraints matching with CBS. * Add some tests for name constraints. * Fix i2v_GENERAL_NAME to not assume NUL terminated strings * Do not rely on ASN1_STRING being NUL-terminated. * Add a CBB_add_zeros helper. * Linkify RFCs in documentation. * Refer to RFCs consistently. * runner: Test session IDs over 32 bytes. * Process the TLS 1.3 cipher suite in one place. * Guard use of sdallocx with BORINGSSL_SDALLOCX * Bump minimum GCC version and note impending VS2015 deprecation. * Add Span::first() and Span::last(). * Simplify built-in BIOs slightly. * Fix some error returns from SSL_read and SSL_write. * Fix negative ENUMERATED values in multi-strings. * Add a test for ASN1_mbstring_copy and clean up. * Remove ASN1_TFLG_SET_ORDER. * Fix ASN1_STRING_print_ex with negative integers. * Check i2d_ASN1_TYPE's return value in ASN1_STRING_print_ex. * Document ASN.1 printing functions. * Move some ASN1 printing functions to crypto/asn1. * Move a_strex.c back to asn1, split X509_NAME bits out. * Unwind io_ch abstraction in print functions. * Implement ASN1_STRING_print_ex_fp, etc., with file BIOs. * Remove OPENSSL_NO_FP_API ifdefs. * Move X509_ALGOR to x509.h. * Unexport BIT_STRING_BITNAME. * Unexport ub_* constants. Update-Note: Removed some unnamespaced constants. * Always use an ASN1_STRING_TABLE global mask of UTF8String. Update-Note: The global mask for ASN1_STRING_set_by_NID is now always UTF-8. Callers that want another type should reconsider and, if UTF-8 is still unsuitable, just pass the actual desired type into ASN1_mbstring_copy, X509_NAME_ENTRY_set_data, etc * Document ASN1_mbstring_copy. * Update ghashv8-armx.pl from upstream. * Align with upstream on 'close STDOUT' lines. * Avoid double-expanding variables in CMake. * Reject years outside 0000-9999 in ASN1_GENERALIZEDTIME_adj. * Add some tests for time_t to ASN1_TIME conversions. * Remove ASN1_STRING_FLAG_MSTRING. Update-Note: ASN1_STRING_FLAG_MSTRING is no longer defined and X509_time_adj_ex now behaves more predictably. Callers that actually wanted to lock to a specific type should call ASN1_UTCTIME_adj or ASN1_GENERALIZEDTIME_adj instead. * Document another batch of functions. * Clarify BIO_new_mum_buf's lifetime rules. * generate_ech.cc: include needed headers * Don't overread in poly_Rq_mul * acvp: recognise another style of JSON. * Revert "Revert "Revert "Disable check that X.509 extensions implies v3.""" Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases Change-Id: I4f2228ef815ded0599322186ab7bad49ab1bb5af
2021-07-27external/boringssl: Sync to c1571feb5faf5cce844354c63d0f3e842464bea3.android-s-beta-5android-s-beta-5Pete Bentley
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/7a817f48bafee508b2d23ad278f892ee1cb32b91..c1571feb5faf5cce844354c63d0f3e842464bea3 * acvp: add HKDF support. Bug: 194209538 Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases Change-Id: I4bf41abbe28b97ecf21732f5088d3ec3f4518abd
2021-07-23external/boringssl: Sync to 7a817f48bafee508b2d23ad278f892ee1cb32b91.Pete Bentley
Re-lands https://r.android.com/1774909 This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/ae2bb641735447496bed334c495e4868b981fe32..7a817f48bafee508b2d23ad278f892ee1cb32b91 * Add 'generate-ech' command to bssl tool * Don't enable atomics in NO_THREADS configurations. * Check strtoul return for overflow error in GetUnsigned() * Add convenience functions to malloc EVP_HPKE_CTX and EVP_HPKE_KEY. * Document that SSL_PRIVATE_KEY_METHOD should configure signing prefs. * Always have CRYPTO_sysrand_for_seed. * hrss: use less stack space. * Make X509_EXTENSION opaque. Update-Note: Use X509_EXTENSION_get_* instead. * Make X509_CRL opaque. Update-Note: Use accessors instead. * Switch another malloc to bssl::Array. * Add a pointer alignment helper function. * Remove unused field in X509_NAME_ENTRY. Update-Note: Removed unused field in struct. * Fix sign bit in BN_div if numerator and quotient alias. * Handle the server case in SSL_get0_ech_name_override. * Remove -2 return value from X509*_get_*_by_NID. Update-Note: The return value convention of some functions was simplified. This is not expected to affect any callers. * Remove X509at_get0_data_by_OBJ. Update-Note: X509at_get0_data_by_OBJ is removed. We found no callers of this function. * Document a batch of extension-related functions in x509.h. * conf: fix getting keys from the default section. * conf: don't crash when parsing. * Add some OpenSSL compatibility aliases. * Make ASN1_OBJECT opaque. Update-Note: ASN1_OBJECT is now opaque. Callers should use accessors. * Rename asn1_locl.h to internal.h. * Update hpke_test.go. * Decorate x509v3_a2i_ipadd declaration as its definition. * SHA-256 is used on AArch64, even if NO_ASM. * swtb is another AArch64 magic tweak. * Implement ClientHelloOuter handshakes. * runner: Add a convenience function for base64 flags. * Reduce bouncing on the cache lock in ssl_update_cache. Update-Note: This reshuffles some locks around the session cache. (Hopefully for the better.) * Only clear not_resumable after the handshake. * runner: Test that clients actually use renewed tickets. * runner: Clean up test logic. * runner: Fix process exit timeout. * Remove old ASN.1 SET macros. * Document some ASN1_INTEGER and ASN1_ENUMERATED functions. * Document ASN1_STRING_to_UTF8. * Const-correct ASN1_item_verify a bit more. * Compute ASN.1 BIT STRING sizes more consistently. * Remove lh_FOO_doall. * Prefix internal LHASH functions. * Unexport almost all of LHASH. Update-Note: BoringSSL no longer provides a general-purpose hash table to callers. Use the language's standard library, or another implementation. * Rename t1_lib.cc to extensions.cc. * Prefix and unexport a2i_ipadd. * Fix a -Wdeprecated-copy warning. * Validate ECH public names. * Fold X509_VERIFY_PARAM_ID into X509_VERIFY_PARAM. * Make X509_VERIFY_PARAM opaque. Update-Note: Use setters instead of configuring X509_VERIFY_PARAM directly. * Move crypto/x509/vpm_int.h into internal.h. * Reformat x509_vfy.h and convert comments. * Reland "Add util/fetch_ech_config_list.go" * Revert "Add util/fetch_ech_config_list.go" * Add util/fetch_ech_config_list.go * More reliably report handshake errors through SSL_write. * Add an option to permute ClientHello extension order. * runner: Check the test name against the protocol being tested. * Remove outdated comment in primality testing. * Add most of an ECH client implementation. * Add a basic API to make ECHConfigs. * Make ECH server APIs take EVP_HPKE_KEY. * Rename SSL_ECH_SERVER_CONFIG_LIST to SSL_ECH_KEYS. * runner: Self-check tests more accurately and earlier. * Don't pad the second ClientHello. * Fix ext_pre_shared_key_clienthello_length calculation. * Tidy up the PSK binder logic. * Move the TLS vs DTLS header length adjustment into ssl_add_clienthello_tlsext. * Shift some complexity out of ssl_add_clienthello_tlsext. * Add a note about extension callback names. * Add move support to EVP_MD_CTX. * Replace hs->needs_psk_binder with an output parameter. * Make add_clienthello callbacks const. * Fix documentation typo. * Compute the ECH GREASE payload outside of the callbacks. * Pick up the GREASE ECH config ID from grease_seed. * Initialize grease_seed on construction. * Remove the extension init hook. * Move key_share computation out of ClientHello callbacks. * Release some temporaries outside of ClientHello callbacks. * Move the early_data_{offered,reason} logic out of extension callbacks. * Implement a handshake hint for certificate compression. * runner: Implement ECH server for testing. * runner: Parse the status_request extension more strictly. * runner: Make echIsInner a boolean. * runner: Revise ECHConfig type in preparation for client implementation * Fix ECH-Server-RepeatedConfigID test. * Add SSL_ech_accepted API and ech_is_required alerts. * Reject the ECH extension in TLS 1.2 ServerHello. * Move ECH-related APIs to encrypted_client_hello.cc. * Const-correct message creation hooks. * Remove the Channel ID callback. Update-Note: SSL_CTX_set_channel_id_cb is removed. SSL_set_tls_channel_id_enabled no longer enables Channel ID as a client, only as a server. * Manage Channel ID handshake state better. Update-Note: SSL_get_tls_channel_id will no longer return all zeros during the handshake or on the client. I did not find any callers relying on this. * DTLS-SRTP is only defined for DTLS. * Remove impossible ssl->s3 null check. * fix #415: Perl scripts fail when building from a path with spaces * Cite an RFC over 9000 (draft-ietf-quic-tls is now RFC 9001). Update-Note: QUIC APIs now default to the standard code point rather than the draft one. QUICHE has already been calling SSL_set_quic_use_legacy_codepoint, so this should not affect them. Once callers implementing the draft versions cycle out, we can then drop SSL_set_quic_use_legacy_codepoint altogether. I've also bumped BORINGSSL_API_VERSION in case we end up needing an ifdef. * Add compatibility impl for EVP_PKEY_get0 * Make md32_common.h single-included and use an unsized helper for SHA-256. * Pull HASH_TRANSFORM out of md32_common.h. * Ensure name not null in EVP_get_cipherbyname * Fix array-parameter warnings * Don't copy client's session ID into server's session. * Test ECH server with unique and repeated config IDs. * Refresh SSL corpora after adding ECH fuzzer mode. * Implement fuzzer mode for ECH server. * Don't try to write empty early data in the tool. * GREASE is now RFC 8701. * runner: Reject all zero client and server randoms. * Const-correct SSL_get_srtp_profiles. Update-Note: The change to the return type isn't quite compatible, but I only found one caller of this function, which has since been fixed. (If we need to return a non-const value for compatibility, we can do that and document that the caller should not mutate the output.) * Update the ECH GREASE size selection. * fuzz/minimise_corpora.sh: Add shebang and chmod +x * Add a missing case to SSL_error_description. * Remove draft tokbind implementation. Update-Note: Token binding APIs are removed. * Make X509_REQ and X509_REQ_INFO opaque. Update-Note: Callers that reach into X509_REQ and X509_REQ_INFO must use accessors instead. * Check hs->early_session, not ssl->session, for the early data limit. * Fix some includes. * Be clearer which signing inputs are digests. * Validate RSA public keys more consistently. Update-Note: See above. * Add APIs to manually fill in signatures for CRLs. * Check for resumption identifiers in SSL_SESSION_is_resumable. * Don't use SHA256(ticket) as the signaling session ID for tickets. * Simplify renego + resumption handling. * Move session ID assignment out of ssl_get_new_session. * Fix the ech_accept comment. * Export the HPKE implementation. * Refer to EVP_HPKE_CTX by a consistent name. * Shift the KEM dependency in HPKE up a step. * Update ACVP URLs. * Add SSL_can_release_private_key. * Make X509_SIG and X509_CERT_AUX opaque. Update-Note: Direct access of these structs should be replaced by accessors. * acvp: move hash iterations into modulewrapper. * Switch HPKE to a three-parameter output buffer. * Introduce EVP_HPKE_{AEAD,KDF} types. * Don't mark up the first word in a collective comment. * Revise the deterministic for_test variant of HPKE's SetupBaseS. * Fix a memory leak with d2i_ASN1_OBJECT object reuse. * Remove HPKE PSK mode. * Remove HKDF-SHA384 and HKDF-SHA512 from HPKE. * Correctly order PKCS#7 certificates and CRLs. Update-Note: It is no longer the case that constructing a PKCS#7 file and parsing them back out will keep the certificates and CRLs in the same order. * Implement ECH draft 10 and update HPKE to draft 08. * Document expected use of BTI and PAC macros. * Remove non-deterministic bits from ECDSA ACVP test. * Reference the newer ChaCha20-Poly1305 RFC. * Use passive entropy collection everywhere. * Rename X509V*_VERSION constants. Update-Note: This renames some BoringSSL-specific constants that we recently added. It doesn't look like anyone's used them yet. * Const-correct ASN1_OBJECT_create. * Clarify OBJ_get0_data and OBJ_get_length. * avcp: SHA-1 for ECDSA _verification_ is still supported by NIST. * A couple of Aarch64 FIPS delocate fixes. * Use a placeholder for unknown errors in ERR_*_error_string. * Include assembly optimizations in Bazel builds on Linux-aarch64. * Remove some BoringSSL-only X509_CINF functions. Update-Note: X509_get_cert_info, X509_CINF_set_modified, and X509_CINF_get_signature are removed. I believe all callers have been updated. Callers should use i2d_re_X509_tbs, i2d_X509_tbs, and X509_get0_tbs_sigalg instead. * Document and test X509_ATTRIBUTE creation functions. * Revert handshaker fd numbers and make StartProcess more flexible. * Remove support for malformed X509_ATTRIBUTEs. Update-Note: Given OpenSSL hasn't accepted these for five years, it's unlikely anything depends on it. If something breaks, we can revert this and revisit. No one calls X509_ATTRIBUTE_set1_data on a non-empty X509_ATTRIBUTE, so the behavior change there should be safe. * Make X509_ATTRIBUTE opaque. Update-Note: Direct accesses of X509_ATTRIBUTE should be replaced with one of the accessors. I couldn't find any direct accesses, so hopefully this is fine. * acvptool: Fix typo hard-coding the HTTP method. * Document a few more x509.h functions. * Make X509_PUBKEY opaque. Update-Note: Direct accesses of X509_PUBKEY should be replaced with one of the accessors. I believe all callers have been fixed at this point. * Always encode booleans as DER. Update-Note: Callers setting ASN1_BOOLEANs to a positive value other than 0xff will now encode 0xff. This probably fixes a bug, but if anyone was attaching significance to incorrectly-encoded booleans, that will break. * Fix issuerUID and subjectUID parsing in the key usage checker. * Add experimental handshake hints API. * Make our Python scripts Python-3-compatible. * Export ssl_client_hello_init for fuzzers. * acvp: support GMAC as an algorithm. * Record a fuzzing corpus for the ClientHelloInner decoder. * Use a consistent plural for 'corpus'. * Add util/bot/libFuzzer to .gitignore. * acvp: support KAS-ECC-SSC staticUnified mode. * Check for invalid ALPN inputs in SSL_(CTX_)set_alpn_protos. Update-Note: SSL_CTX_set_alpn_protos and SSL_set_alpn_protos will now reject invalud inputs. Previously, they would accept them, but silently send an invalid ALPN extension which the server would almost certainly error on. * Don't duplicate ServerHello construction code. * Rearrange key share and early data logic. * Only skip early data with HRR when offered. * Add ECH server config API to ssl_ctx_api fuzzer * Fix ppc64le build. * Simplify the Lucky13 mitigation. * Add ECH server (draft-ietf-tls-esni-09). * runner: Remove unused field * runner: Construct finishedHash earlier. * Simplify tls_cbc.c slightly. * Remove remnants of CBC SHA2 cipher suites. * runner: Test different V2ClientHello challenge lengths. * runner: Ensure helloBytes is always the same as hello.marshal(). * runner: Fix ECH confirmation calculation with PSKs in tests. * runner: Fix HPKE parameter order. * runner: UpdateForHelloRetryRequest cannot fail. * runner: Don't use the buffer in TLS 1.3. * runner: Don't maintain two copies of the same transcript hash. * runner: Remove remnants of SSL 3.0. * runner: Fix writeClientHash and writeRecord ordering. * runner: Remove CheckTLS13DowngradeRandom. * runner: Remove remnants of the separate HelloRetryRequest message. * runner: Store a cipherSuite in ClientSessionState. * runner: Move writeHash to the finishedHash struct. * Fix the spelling of HPKE AEAD constants. * Don't reset server callback expectations on new handshake. * Fix MockQuicTransport::Flush error handling. * Fold ripemd/internal.h into ripemd.c. * Move load/store helpers to crypto/internal.h. * Make words in crypto/fipsmodule/modes actually words. * Handle EINTR more in handshaker.cc. * Add a few missing SSL_R_BIO_NOT_SET cases. * Fix some unreachable code in the QUIC handshaker driver. * Rearrange SSLKeyShare::Serialize. * Fix ssl/internal.h sectioning. * Remove some now unnecessary test exclusions from split handshakes. * Remove tls13-split-handshakes flag. * Define HANDSHAKER_SUPPORTED in once place. * Tidy up handshaker tester. * modulewrapper: add option to print build information. * FIPS counters for AES-CTR. * Enforce that pre_shared_key must come with psk_key_exchange_modes. * Zero out FIPS counters. * Remove is_resume field on TestState. * Remove OPENSSL_DANGEROUS_RELEASE_PTHREAD_KEY build flag. * Add some warnings on how to use OPENSSL_memory_* functions. * Use an unsized helper for truncated SHA-512 variants. Update-Note: There is a small chance the asserts will trip something, but hopefully not since I've left SHA512_Final alone. * Fix mismatch between header and implementation of bn_sqr_comba8. * Remove GCC 4.8.99 check. * Bump minimum CMake version. * Automatically enable C11 atomics when available. 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. * Make generate_build_files.py python3 compatible. * Remove X509_REQ_set_extension_nids and document related functions. Update-Note: This removes a pair of unused functions. * Document a few more functions in x509.h. * Do not access value.ptr with V_ASN1_BOOLEAN. * Add X509_PUBKEY_get0_public_key. * Test empty EVP_CIPHER inputs and fix exact memcpy overlap. * Revert "Implement rsa_pkcs1_sha256_legacy." * Fix unnecessarily direction-specific tests in cipher_tests.txt * Refactor HPKE API to include explicit length parameters. * Generalize make_errors.go to allow EVP covering multiple directories. * Add a Windows no-op impl of BORINGSSL_self_test * Only pass -handshaker-path in split handshakes tests. * Add RNG support for FreeBSD. * Move fips.c into a subdirectory. * Implement rsa_pkcs1_sha256_legacy. * Better document nullable X.509 getters. * runner: Remove redundant -enable-all-curves shim flag. * Initialize nonce in PerAEADTest.ABI. * Document ASN1_TYPE and related functions. * fips: add counters. * Align with OpenSSL on constness of static ASN1_OBJECTs. Update-Note: The change to OBJ_nid2obj should be compatible. The changes to X509_PUBKEY_set0_param and X509_ALGOR_set0 may require fixing some pointer types. * Add -rr-record flag to runner.go. * Register NAME_CONSTRAINTS with bssl::UniquePtr. * Register POLICY_MAPPING with bssl::UniquePtr. * Stub out some more of PKCS7. * Remove TODO to reverse the output of PKCS12_parse. * Make the X509_VAL structure opaque. Update-Note: I believe this is now safe to do. If there are compile failures, switch to X509_get0_notBefore, X509_getm_notBefore, and X509_set1_notBefore, or revert this if I'm wrong and too many callers still need updating. * Support creating unencrypted PKCS#12 files. * Move PKCS#12 samples to embed_test_data. * Remove some remnants of TLS 1.3 downgrade carveouts. Update-Note: https://boringssl-review.googlesource.com/c/boringssl/+/44124 made these functions a no-op, but we kept them around because there were still some call sites floating around. That code has since been updated, so we can remove this. * Remove X509_REQ_to_X509. Update-Note: This removes a function that appears to be unused. It also hardcodes the use of MD5, so please do not use it. * Fix OPENSSL_EC_* constants and add EC_GROUP_get_asn1_flag * RAND_set_rand_method returns int. * Check the inner and outer CRL signature algorithms match. Update-Note: Invalid CRLs with inconsistent inner and outer signature algorithms will now be rejected. * Remove block_mask from EVP_CIPHER_CTX. Update-Note: It doesn't look like anyone is reading into this field. If they are, we can ideally fix it, or revert this if absolutely necessary. * Document a couple more functions in x509.h. * Define X509V*_VERSION constants. * Handle the default X.509 version explicitly. * Compile for RISC-V. * Add ECDSA nonce-testing functions. * Rearrange ECDSA implementation. * Split the FIPS mode PRNG lock in two. * Remove legacy vs_toolchain.py environment variable. * runner: Rename 'masterSecret' on session objects to plain 'secret'. * Test ECDSA signing is non-deterministic. * acvp: split ACVP modulewrapper for reuse by Trusty * No-op CL to trigger some builds. * Use CIPD Go packages. * Update CMake on the bots and switch to CIPD where available. * Future-proof vs_toolchain.py for VS2019. * Revert "Revert "Disable check that X.509 extensions implies v3."" * Update Clang and Go on the bots. * Check for OBJ_nid2obj failures in X509_ATTRIBUTE_create. * Don't overflow the output length in EVP_CipherUpdate calls. Update-Note: Passing extremely large input lengths into EVP_CipherUpdate will now fail. Use EVP_AEAD instead, which is size_t-based and has more explicit output bounds. * Remove X509_issuer_and_serial_hash. Update-Note: No one uses this function. It had a NULL dereference in some error cases. See CVE-2021-23841. * Fix Bazel build breakage. * Specify VS toolchain by command-line argument. * Update Android Bazel build support in BUILD.toplevel. * Honor SSL_TLSEXT_ERR_ALERT_FATAL in the ALPN callback. Update-Note: Callers that return SSL_TLSEXT_ERR_ALERT_FATAL from the ALPN callback will change behavior. The old behavior may be restored by returning SSL_TLSEXT_ERR_NOACK, though see the documentation for new recommendations on return values. * acvp: detect header element in JSON. * Align the ARM capability functions. * Skip runtime NEON checks if __ARM_NEON is defined. Update-Note: Builds with __ARM_NEON (-mfpu=neon) will now drop about 30KiB of dead code, but no longer work (if they even did before) on a particular buggy CPU. Builds without __ARM_NEON are not affected. * acvp: don't include CMAC-AES in regcap dump. * acvp: fix CMAC verify * Include bn/internal.h for non-bcm.c builds. * Add various function calls to test_fips. * Add missing include to self_check.c. * Revert "Disable check that X.509 extensions implies v3." * Fix TLS13SessionID-TLS13 test. Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases Change-Id: Idb0a37fccba5d1c3f6a40fe91a81c5189170ed23
2021-07-23Revert "external/boringssl: Sync to 7a817f48bafee508b2d23ad278f892ee1cb32b91."Sergey Volnov
This reverts commit d03f4c0ac5663fb300b1f40f1059c4194dd0652a. Reason for revert: Investigating b/194282044 Change-Id: I168d73caae2cbc83921133cd47aef37d3bce8c37
2021-07-22external/boringssl: Sync to 7a817f48bafee508b2d23ad278f892ee1cb32b91.Pete Bentley
Re-lands https://r.android.com/1772605 plus three newer upstream changes. This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/ae2bb641735447496bed334c495e4868b981fe32..7a817f48bafee508b2d23ad278f892ee1cb32b91 * Add 'generate-ech' command to bssl tool * Don't enable atomics in NO_THREADS configurations. * Check strtoul return for overflow error in GetUnsigned() * Add convenience functions to malloc EVP_HPKE_CTX and EVP_HPKE_KEY. * Document that SSL_PRIVATE_KEY_METHOD should configure signing prefs. * Always have CRYPTO_sysrand_for_seed. * hrss: use less stack space. * Make X509_EXTENSION opaque. Update-Note: Use X509_EXTENSION_get_* instead. * Make X509_CRL opaque. Update-Note: Use accessors instead. * Switch another malloc to bssl::Array. * Add a pointer alignment helper function. * Remove unused field in X509_NAME_ENTRY. Update-Note: Removed unused field in struct. * Fix sign bit in BN_div if numerator and quotient alias. * Handle the server case in SSL_get0_ech_name_override. * Remove -2 return value from X509*_get_*_by_NID. Update-Note: The return value convention of some functions was simplified. This is not expected to affect any callers. * Remove X509at_get0_data_by_OBJ. Update-Note: X509at_get0_data_by_OBJ is removed. We found no callers of this function. * Document a batch of extension-related functions in x509.h. * conf: fix getting keys from the default section. * conf: don't crash when parsing. * Add some OpenSSL compatibility aliases. * Make ASN1_OBJECT opaque. Update-Note: ASN1_OBJECT is now opaque. Callers should use accessors. * Rename asn1_locl.h to internal.h. * Update hpke_test.go. * Decorate x509v3_a2i_ipadd declaration as its definition. * SHA-256 is used on AArch64, even if NO_ASM. * swtb is another AArch64 magic tweak. * Implement ClientHelloOuter handshakes. * runner: Add a convenience function for base64 flags. * Reduce bouncing on the cache lock in ssl_update_cache. Update-Note: This reshuffles some locks around the session cache. (Hopefully for the better.) * Only clear not_resumable after the handshake. * runner: Test that clients actually use renewed tickets. * runner: Clean up test logic. * runner: Fix process exit timeout. * Remove old ASN.1 SET macros. * Document some ASN1_INTEGER and ASN1_ENUMERATED functions. * Document ASN1_STRING_to_UTF8. * Const-correct ASN1_item_verify a bit more. * Compute ASN.1 BIT STRING sizes more consistently. * Remove lh_FOO_doall. * Prefix internal LHASH functions. * Unexport almost all of LHASH. Update-Note: BoringSSL no longer provides a general-purpose hash table to callers. Use the language's standard library, or another implementation. * Rename t1_lib.cc to extensions.cc. * Prefix and unexport a2i_ipadd. * Fix a -Wdeprecated-copy warning. * Validate ECH public names. * Fold X509_VERIFY_PARAM_ID into X509_VERIFY_PARAM. * Make X509_VERIFY_PARAM opaque. Update-Note: Use setters instead of configuring X509_VERIFY_PARAM directly. * Move crypto/x509/vpm_int.h into internal.h. * Reformat x509_vfy.h and convert comments. * Reland "Add util/fetch_ech_config_list.go" * Revert "Add util/fetch_ech_config_list.go" * Add util/fetch_ech_config_list.go * More reliably report handshake errors through SSL_write. * Add an option to permute ClientHello extension order. * runner: Check the test name against the protocol being tested. * Remove outdated comment in primality testing. * Add most of an ECH client implementation. * Add a basic API to make ECHConfigs. * Make ECH server APIs take EVP_HPKE_KEY. * Rename SSL_ECH_SERVER_CONFIG_LIST to SSL_ECH_KEYS. * runner: Self-check tests more accurately and earlier. * Don't pad the second ClientHello. * Fix ext_pre_shared_key_clienthello_length calculation. * Tidy up the PSK binder logic. * Move the TLS vs DTLS header length adjustment into ssl_add_clienthello_tlsext. * Shift some complexity out of ssl_add_clienthello_tlsext. * Add a note about extension callback names. * Add move support to EVP_MD_CTX. * Replace hs->needs_psk_binder with an output parameter. * Make add_clienthello callbacks const. * Fix documentation typo. * Compute the ECH GREASE payload outside of the callbacks. * Pick up the GREASE ECH config ID from grease_seed. * Initialize grease_seed on construction. * Remove the extension init hook. * Move key_share computation out of ClientHello callbacks. * Release some temporaries outside of ClientHello callbacks. * Move the early_data_{offered,reason} logic out of extension callbacks. * Implement a handshake hint for certificate compression. * runner: Implement ECH server for testing. * runner: Parse the status_request extension more strictly. * runner: Make echIsInner a boolean. * runner: Revise ECHConfig type in preparation for client implementation * Fix ECH-Server-RepeatedConfigID test. * Add SSL_ech_accepted API and ech_is_required alerts. * Reject the ECH extension in TLS 1.2 ServerHello. * Move ECH-related APIs to encrypted_client_hello.cc. * Const-correct message creation hooks. * Remove the Channel ID callback. Update-Note: SSL_CTX_set_channel_id_cb is removed. SSL_set_tls_channel_id_enabled no longer enables Channel ID as a client, only as a server. * Manage Channel ID handshake state better. Update-Note: SSL_get_tls_channel_id will no longer return all zeros during the handshake or on the client. I did not find any callers relying on this. * DTLS-SRTP is only defined for DTLS. * Remove impossible ssl->s3 null check. * fix #415: Perl scripts fail when building from a path with spaces * Cite an RFC over 9000 (draft-ietf-quic-tls is now RFC 9001). Update-Note: QUIC APIs now default to the standard code point rather than the draft one. QUICHE has already been calling SSL_set_quic_use_legacy_codepoint, so this should not affect them. Once callers implementing the draft versions cycle out, we can then drop SSL_set_quic_use_legacy_codepoint altogether. I've also bumped BORINGSSL_API_VERSION in case we end up needing an ifdef. * Add compatibility impl for EVP_PKEY_get0 * Make md32_common.h single-included and use an unsized helper for SHA-256. * Pull HASH_TRANSFORM out of md32_common.h. * Ensure name not null in EVP_get_cipherbyname * Fix array-parameter warnings * Don't copy client's session ID into server's session. * Test ECH server with unique and repeated config IDs. * Refresh SSL corpora after adding ECH fuzzer mode. * Implement fuzzer mode for ECH server. * Don't try to write empty early data in the tool. * GREASE is now RFC 8701. * runner: Reject all zero client and server randoms. * Const-correct SSL_get_srtp_profiles. Update-Note: The change to the return type isn't quite compatible, but I only found one caller of this function, which has since been fixed. (If we need to return a non-const value for compatibility, we can do that and document that the caller should not mutate the output.) * Update the ECH GREASE size selection. * fuzz/minimise_corpora.sh: Add shebang and chmod +x * Add a missing case to SSL_error_description. * Remove draft tokbind implementation. Update-Note: Token binding APIs are removed. Change-Id: Iecea7c3dcf9d3e2644a3b7afaf61511310b45d5f Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/47584 Reviewed-by: Adam Langley <agl@google.com> * Make X509_REQ and X509_REQ_INFO opaque. Update-Note: Callers that reach into X509_REQ and X509_REQ_INFO must use accessors instead. * Check hs->early_session, not ssl->session, for the early data limit. * Fix some includes. * Be clearer which signing inputs are digests. * Validate RSA public keys more consistently. Update-Note: See above. * Add APIs to manually fill in signatures for CRLs. * Check for resumption identifiers in SSL_SESSION_is_resumable. * Don't use SHA256(ticket) as the signaling session ID for tickets. * Simplify renego + resumption handling. * Move session ID assignment out of ssl_get_new_session. * Fix the ech_accept comment. * Export the HPKE implementation. * Refer to EVP_HPKE_CTX by a consistent name. * Shift the KEM dependency in HPKE up a step. * Update ACVP URLs. * Add SSL_can_release_private_key. * Make X509_SIG and X509_CERT_AUX opaque. Update-Note: Direct access of these structs should be replaced by accessors. * acvp: move hash iterations into modulewrapper. * Switch HPKE to a three-parameter output buffer. * Introduce EVP_HPKE_{AEAD,KDF} types. * Don't mark up the first word in a collective comment. * Revise the deterministic for_test variant of HPKE's SetupBaseS. * Fix a memory leak with d2i_ASN1_OBJECT object reuse. * Remove HPKE PSK mode. * Remove HKDF-SHA384 and HKDF-SHA512 from HPKE. * Correctly order PKCS#7 certificates and CRLs. Update-Note: It is no longer the case that constructing a PKCS#7 file and parsing them back out will keep the certificates and CRLs in the same order. * Implement ECH draft 10 and update HPKE to draft 08. * Document expected use of BTI and PAC macros. * Remove non-deterministic bits from ECDSA ACVP test. * Reference the newer ChaCha20-Poly1305 RFC. * Use passive entropy collection everywhere. * Rename X509V*_VERSION constants. Update-Note: This renames some BoringSSL-specific constants that we recently added. It doesn't look like anyone's used them yet. * Const-correct ASN1_OBJECT_create. * Clarify OBJ_get0_data and OBJ_get_length. * avcp: SHA-1 for ECDSA _verification_ is still supported by NIST. * A couple of Aarch64 FIPS delocate fixes. * Use a placeholder for unknown errors in ERR_*_error_string. * Include assembly optimizations in Bazel builds on Linux-aarch64. * Remove some BoringSSL-only X509_CINF functions. Update-Note: X509_get_cert_info, X509_CINF_set_modified, and X509_CINF_get_signature are removed. I believe all callers have been updated. Callers should use i2d_re_X509_tbs, i2d_X509_tbs, and X509_get0_tbs_sigalg instead. * Document and test X509_ATTRIBUTE creation functions. * Revert handshaker fd numbers and make StartProcess more flexible. * Remove support for malformed X509_ATTRIBUTEs. Update-Note: Given OpenSSL hasn't accepted these for five years, it's unlikely anything depends on it. If something breaks, we can revert this and revisit. No one calls X509_ATTRIBUTE_set1_data on a non-empty X509_ATTRIBUTE, so the behavior change there should be safe. * Make X509_ATTRIBUTE opaque. Update-Note: Direct accesses of X509_ATTRIBUTE should be replaced with one of the accessors. I couldn't find any direct accesses, so hopefully this is fine. * acvptool: Fix typo hard-coding the HTTP method. * Document a few more x509.h functions. * Make X509_PUBKEY opaque. Update-Note: Direct accesses of X509_PUBKEY should be replaced with one of the accessors. I believe all callers have been fixed at this point. * Always encode booleans as DER. Update-Note: Callers setting ASN1_BOOLEANs to a positive value other than 0xff will now encode 0xff. This probably fixes a bug, but if anyone was attaching significance to incorrectly-encoded booleans, that will break. * Fix issuerUID and subjectUID parsing in the key usage checker. * Add experimental handshake hints API. * Make our Python scripts Python-3-compatible. * Export ssl_client_hello_init for fuzzers. * acvp: support GMAC as an algorithm. * Record a fuzzing corpus for the ClientHelloInner decoder. * Use a consistent plural for 'corpus'. * Add util/bot/libFuzzer to .gitignore. * acvp: support KAS-ECC-SSC staticUnified mode. * Check for invalid ALPN inputs in SSL_(CTX_)set_alpn_protos. Update-Note: SSL_CTX_set_alpn_protos and SSL_set_alpn_protos will now reject invalud inputs. Previously, they would accept them, but silently send an invalid ALPN extension which the server would almost certainly error on. * Don't duplicate ServerHello construction code. * Rearrange key share and early data logic. * Only skip early data with HRR when offered. * Add ECH server config API to ssl_ctx_api fuzzer * Fix ppc64le build. * Simplify the Lucky13 mitigation. * Add ECH server (draft-ietf-tls-esni-09). * runner: Remove unused field * runner: Construct finishedHash earlier. * Simplify tls_cbc.c slightly. * Remove remnants of CBC SHA2 cipher suites. * runner: Test different V2ClientHello challenge lengths. * runner: Ensure helloBytes is always the same as hello.marshal(). * runner: Fix ECH confirmation calculation with PSKs in tests. * runner: Fix HPKE parameter order. * runner: UpdateForHelloRetryRequest cannot fail. * runner: Don't use the buffer in TLS 1.3. * runner: Don't maintain two copies of the same transcript hash. * runner: Remove remnants of SSL 3.0. * runner: Fix writeClientHash and writeRecord ordering. * runner: Remove CheckTLS13DowngradeRandom. * runner: Remove remnants of the separate HelloRetryRequest message. * runner: Store a cipherSuite in ClientSessionState. * runner: Move writeHash to the finishedHash struct. * Fix the spelling of HPKE AEAD constants. * Don't reset server callback expectations on new handshake. * Fix MockQuicTransport::Flush error handling. * Fold ripemd/internal.h into ripemd.c. * Move load/store helpers to crypto/internal.h. * Make words in crypto/fipsmodule/modes actually words. * Handle EINTR more in handshaker.cc. * Add a few missing SSL_R_BIO_NOT_SET cases. * Fix some unreachable code in the QUIC handshaker driver. * Rearrange SSLKeyShare::Serialize. * Fix ssl/internal.h sectioning. * Remove some now unnecessary test exclusions from split handshakes. * Remove tls13-split-handshakes flag. * Define HANDSHAKER_SUPPORTED in once place. * Tidy up handshaker tester. * modulewrapper: add option to print build information. * FIPS counters for AES-CTR. * Enforce that pre_shared_key must come with psk_key_exchange_modes. * Zero out FIPS counters. * Remove is_resume field on TestState. * Remove OPENSSL_DANGEROUS_RELEASE_PTHREAD_KEY build flag. * Add some warnings on how to use OPENSSL_memory_* functions. * Use an unsized helper for truncated SHA-512 variants. Update-Note: There is a small chance the asserts will trip something, but hopefully not since I've left SHA512_Final alone. * Fix mismatch between header and implementation of bn_sqr_comba8. * Remove GCC 4.8.99 check. * Bump minimum CMake version. * Automatically enable C11 atomics when available. 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. * Make generate_build_files.py python3 compatible. * Remove X509_REQ_set_extension_nids and document related functions. Update-Note: This removes a pair of unused functions. * Document a few more functions in x509.h. * Do not access value.ptr with V_ASN1_BOOLEAN. * Add X509_PUBKEY_get0_public_key. * Test empty EVP_CIPHER inputs and fix exact memcpy overlap. * Revert "Implement rsa_pkcs1_sha256_legacy." * Fix unnecessarily direction-specific tests in cipher_tests.txt * Refactor HPKE API to include explicit length parameters. * Generalize make_errors.go to allow EVP covering multiple directories. * Add a Windows no-op impl of BORINGSSL_self_test * Only pass -handshaker-path in split handshakes tests. * Add RNG support for FreeBSD. * Move fips.c into a subdirectory. * Implement rsa_pkcs1_sha256_legacy. * Better document nullable X.509 getters. * runner: Remove redundant -enable-all-curves shim flag. * Initialize nonce in PerAEADTest.ABI. * Document ASN1_TYPE and related functions. * fips: add counters. * Align with OpenSSL on constness of static ASN1_OBJECTs. Update-Note: The change to OBJ_nid2obj should be compatible. The changes to X509_PUBKEY_set0_param and X509_ALGOR_set0 may require fixing some pointer types. * Add -rr-record flag to runner.go. * Register NAME_CONSTRAINTS with bssl::UniquePtr. * Register POLICY_MAPPING with bssl::UniquePtr. * Stub out some more of PKCS7. * Remove TODO to reverse the output of PKCS12_parse. * Make the X509_VAL structure opaque. Update-Note: I believe this is now safe to do. If there are compile failures, switch to X509_get0_notBefore, X509_getm_notBefore, and X509_set1_notBefore, or revert this if I'm wrong and too many callers still need updating. * Support creating unencrypted PKCS#12 files. * Move PKCS#12 samples to embed_test_data. * Remove some remnants of TLS 1.3 downgrade carveouts. Update-Note: https://boringssl-review.googlesource.com/c/boringssl/+/44124 made these functions a no-op, but we kept them around because there were still some call sites floating around. That code has since been updated, so we can remove this. * Remove X509_REQ_to_X509. Update-Note: This removes a function that appears to be unused. It also hardcodes the use of MD5, so please do not use it. * Fix OPENSSL_EC_* constants and add EC_GROUP_get_asn1_flag * RAND_set_rand_method returns int. * Check the inner and outer CRL signature algorithms match. Update-Note: Invalid CRLs with inconsistent inner and outer signature algorithms will now be rejected. * Remove block_mask from EVP_CIPHER_CTX. Update-Note: It doesn't look like anyone is reading into this field. If they are, we can ideally fix it, or revert this if absolutely necessary. * Document a couple more functions in x509.h. * Define X509V*_VERSION constants. * Handle the default X.509 version explicitly. * Compile for RISC-V. * Add ECDSA nonce-testing functions. * Rearrange ECDSA implementation. * Split the FIPS mode PRNG lock in two. * Remove legacy vs_toolchain.py environment variable. * runner: Rename 'masterSecret' on session objects to plain 'secret'. * Test ECDSA signing is non-deterministic. * acvp: split ACVP modulewrapper for reuse by Trusty * No-op CL to trigger some builds. * Use CIPD Go packages. * Update CMake on the bots and switch to CIPD where available. * Future-proof vs_toolchain.py for VS2019. * Revert "Revert "Disable check that X.509 extensions implies v3."" * Update Clang and Go on the bots. * Check for OBJ_nid2obj failures in X509_ATTRIBUTE_create. * Don't overflow the output length in EVP_CipherUpdate calls. Update-Note: Passing extremely large input lengths into EVP_CipherUpdate will now fail. Use EVP_AEAD instead, which is size_t-based and has more explicit output bounds. * Remove X509_issuer_and_serial_hash. Update-Note: No one uses this function. It had a NULL dereference in some error cases. See CVE-2021-23841. * Fix Bazel build breakage. * Specify VS toolchain by command-line argument. * Update Android Bazel build support in BUILD.toplevel. * Honor SSL_TLSEXT_ERR_ALERT_FATAL in the ALPN callback. Update-Note: Callers that return SSL_TLSEXT_ERR_ALERT_FATAL from the ALPN callback will change behavior. The old behavior may be restored by returning SSL_TLSEXT_ERR_NOACK, though see the documentation for new recommendations on return values. * acvp: detect header element in JSON. * Align the ARM capability functions. * Skip runtime NEON checks if __ARM_NEON is defined. Update-Note: Builds with __ARM_NEON (-mfpu=neon) will now drop about 30KiB of dead code, but no longer work (if they even did before) on a particular buggy CPU. Builds without __ARM_NEON are not affected. * acvp: don't include CMAC-AES in regcap dump. * acvp: fix CMAC verify * Include bn/internal.h for non-bcm.c builds. * Add various function calls to test_fips. * Add missing include to self_check.c. * Revert "Disable check that X.509 extensions implies v3." * Fix TLS13SessionID-TLS13 test. Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases Change-Id: I894552c1cfb97c327808e9cdadcc7e6a7b1874e2
2021-07-21Revert "external/boringssl: Sync to 897a2ca3f184b34278641138c726ef902ab1fab2."Pete Bentley
This reverts commit a769e3be7b5b02e3a0ee4043b6642ab0361a1420. Reason for revert: Breaks x86 builds: b/194262305 Change-Id: I9074b7d01972b3f1162eb3ece0a591077d0b3451
2021-07-20external/boringssl: Sync to 897a2ca3f184b34278641138c726ef902ab1fab2.Pete Bentley
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/ae2bb641735447496bed334c495e4868b981fe32..897a2ca3f184b34278641138c726ef902ab1fab2 * Add convenience functions to malloc EVP_HPKE_CTX and EVP_HPKE_KEY. * Document that SSL_PRIVATE_KEY_METHOD should configure signing prefs. * Always have CRYPTO_sysrand_for_seed. * hrss: use less stack space. * Make X509_EXTENSION opaque. Update-Note: Use X509_EXTENSION_get_* instead. * Make X509_CRL opaque. Update-Note: Use accessors instead. * Switch another malloc to bssl::Array. * Add a pointer alignment helper function. * Remove unused field in X509_NAME_ENTRY. Update-Note: Removed unused field in struct. * Fix sign bit in BN_div if numerator and quotient alias. * Handle the server case in SSL_get0_ech_name_override. * Remove -2 return value from X509*_get_*_by_NID. Update-Note: The return value convention of some functions was simplified. This is not expected to affect any callers. * Remove X509at_get0_data_by_OBJ. Update-Note: X509at_get0_data_by_OBJ is removed. We found no callers of this function. * Document a batch of extension-related functions in x509.h. * conf: fix getting keys from the default section. * conf: don't crash when parsing. * Add some OpenSSL compatibility aliases. * Make ASN1_OBJECT opaque. Update-Note: ASN1_OBJECT is now opaque. Callers should use accessors. * Rename asn1_locl.h to internal.h. * Update hpke_test.go. * Decorate x509v3_a2i_ipadd declaration as its definition. * SHA-256 is used on AArch64, even if NO_ASM. * swtb is another AArch64 magic tweak. * Implement ClientHelloOuter handshakes. * runner: Add a convenience function for base64 flags. * Reduce bouncing on the cache lock in ssl_update_cache. Update-Note: This reshuffles some locks around the session cache. (Hopefully for the better.) * Only clear not_resumable after the handshake. * runner: Test that clients actually use renewed tickets. * runner: Clean up test logic. * runner: Fix process exit timeout. * Remove old ASN.1 SET macros. * Document some ASN1_INTEGER and ASN1_ENUMERATED functions. * Document ASN1_STRING_to_UTF8. * Const-correct ASN1_item_verify a bit more. * Compute ASN.1 BIT STRING sizes more consistently. * Remove lh_FOO_doall. * Prefix internal LHASH functions. * Unexport almost all of LHASH. Update-Note: BoringSSL no longer provides a general-purpose hash table to callers. Use the language's standard library, or another implementation. * Rename t1_lib.cc to extensions.cc. * Prefix and unexport a2i_ipadd. * Fix a -Wdeprecated-copy warning. * Validate ECH public names. * Fold X509_VERIFY_PARAM_ID into X509_VERIFY_PARAM. * Make X509_VERIFY_PARAM opaque. Update-Note: Use setters instead of configuring X509_VERIFY_PARAM directly. * Move crypto/x509/vpm_int.h into internal.h. * Reformat x509_vfy.h and convert comments. * Reland "Add util/fetch_ech_config_list.go" * Revert "Add util/fetch_ech_config_list.go" * Add util/fetch_ech_config_list.go * More reliably report handshake errors through SSL_write. * Add an option to permute ClientHello extension order. * runner: Check the test name against the protocol being tested. * Remove outdated comment in primality testing. * Add most of an ECH client implementation. * Add a basic API to make ECHConfigs. * Make ECH server APIs take EVP_HPKE_KEY. * Rename SSL_ECH_SERVER_CONFIG_LIST to SSL_ECH_KEYS. * runner: Self-check tests more accurately and earlier. * Don't pad the second ClientHello. * Fix ext_pre_shared_key_clienthello_length calculation. * Tidy up the PSK binder logic. * Move the TLS vs DTLS header length adjustment into ssl_add_clienthello_tlsext. * Shift some complexity out of ssl_add_clienthello_tlsext. * Add a note about extension callback names. * Add move support to EVP_MD_CTX. * Replace hs->needs_psk_binder with an output parameter. * Make add_clienthello callbacks const. * Fix documentation typo. * Compute the ECH GREASE payload outside of the callbacks. * Pick up the GREASE ECH config ID from grease_seed. * Initialize grease_seed on construction. * Remove the extension init hook. * Move key_share computation out of ClientHello callbacks. * Release some temporaries outside of ClientHello callbacks. * Move the early_data_{offered,reason} logic out of extension callbacks. * Implement a handshake hint for certificate compression. * runner: Implement ECH server for testing. * runner: Parse the status_request extension more strictly. * runner: Make echIsInner a boolean. * runner: Revise ECHConfig type in preparation for client implementation * Fix ECH-Server-RepeatedConfigID test. * Add SSL_ech_accepted API and ech_is_required alerts. * Reject the ECH extension in TLS 1.2 ServerHello. * Move ECH-related APIs to encrypted_client_hello.cc. * Const-correct message creation hooks. * Remove the Channel ID callback. Update-Note: SSL_CTX_set_channel_id_cb is removed. SSL_set_tls_channel_id_enabled no longer enables Channel ID as a client, only as a server. * Manage Channel ID handshake state better. Update-Note: SSL_get_tls_channel_id will no longer return all zeros during the handshake or on the client. I did not find any callers relying on this. * DTLS-SRTP is only defined for DTLS. * Remove impossible ssl->s3 null check. * fix #415: Perl scripts fail when building from a path with spaces * Cite an RFC over 9000 (draft-ietf-quic-tls is now RFC 9001). Update-Note: QUIC APIs now default to the standard code point rather than the draft one. QUICHE has already been calling SSL_set_quic_use_legacy_codepoint, so this should not affect them. Once callers implementing the draft versions cycle out, we can then drop SSL_set_quic_use_legacy_codepoint altogether. I've also bumped BORINGSSL_API_VERSION in case we end up needing an ifdef. * Add compatibility impl for EVP_PKEY_get0 * Make md32_common.h single-included and use an unsized helper for SHA-256. * Pull HASH_TRANSFORM out of md32_common.h. * Ensure name not null in EVP_get_cipherbyname * Fix array-parameter warnings * Don't copy client's session ID into server's session. * Test ECH server with unique and repeated config IDs. * Refresh SSL corpora after adding ECH fuzzer mode. * Implement fuzzer mode for ECH server. * Don't try to write empty early data in the tool. * GREASE is now RFC 8701. * runner: Reject all zero client and server randoms. * Const-correct SSL_get_srtp_profiles. Update-Note: The change to the return type isn't quite compatible, but I only found one caller of this function, which has since been fixed. (If we need to return a non-const value for compatibility, we can do that and document that the caller should not mutate the output.) * Update the ECH GREASE size selection. * fuzz/minimise_corpora.sh: Add shebang and chmod +x * Add a missing case to SSL_error_description. * Remove draft tokbind implementation. Update-Note: Token binding APIs are removed. * Make X509_REQ and X509_REQ_INFO opaque. Update-Note: Callers that reach into X509_REQ and X509_REQ_INFO must use accessors instead. * Check hs->early_session, not ssl->session, for the early data limit. * Fix some includes. * Be clearer which signing inputs are digests. * Validate RSA public keys more consistently. Update-Note: See above. * Add APIs to manually fill in signatures for CRLs. * Check for resumption identifiers in SSL_SESSION_is_resumable. * Don't use SHA256(ticket) as the signaling session ID for tickets. * Simplify renego + resumption handling. * Move session ID assignment out of ssl_get_new_session. * Fix the ech_accept comment. * Export the HPKE implementation. * Refer to EVP_HPKE_CTX by a consistent name. * Shift the KEM dependency in HPKE up a step. * Update ACVP URLs. * Add SSL_can_release_private_key. * Make X509_SIG and X509_CERT_AUX opaque. Update-Note: Direct access of these structs should be replaced by accessors. * acvp: move hash iterations into modulewrapper. * Switch HPKE to a three-parameter output buffer. * Introduce EVP_HPKE_{AEAD,KDF} types. * Don't mark up the first word in a collective comment. * Revise the deterministic for_test variant of HPKE's SetupBaseS. * Fix a memory leak with d2i_ASN1_OBJECT object reuse. * Remove HPKE PSK mode. * Remove HKDF-SHA384 and HKDF-SHA512 from HPKE. * Correctly order PKCS#7 certificates and CRLs. Update-Note: It is no longer the case that constructing a PKCS#7 file and parsing them back out will keep the certificates and CRLs in the same order. * Implement ECH draft 10 and update HPKE to draft 08. * Document expected use of BTI and PAC macros. * Remove non-deterministic bits from ECDSA ACVP test. * Reference the newer ChaCha20-Poly1305 RFC. * Use passive entropy collection everywhere. * Rename X509V*_VERSION constants. Update-Note: This renames some BoringSSL-specific constants that we recently added. It doesn't look like anyone's used them yet. * Const-correct ASN1_OBJECT_create. * Clarify OBJ_get0_data and OBJ_get_length. * avcp: SHA-1 for ECDSA _verification_ is still supported by NIST. * A couple of Aarch64 FIPS delocate fixes. * Use a placeholder for unknown errors in ERR_*_error_string. * Include assembly optimizations in Bazel builds on Linux-aarch64. * Remove some BoringSSL-only X509_CINF functions. Update-Note: X509_get_cert_info, X509_CINF_set_modified, and X509_CINF_get_signature are removed. I believe all callers have been updated. Callers should use i2d_re_X509_tbs, i2d_X509_tbs, and X509_get0_tbs_sigalg instead. * Document and test X509_ATTRIBUTE creation functions. * Revert handshaker fd numbers and make StartProcess more flexible. * Remove support for malformed X509_ATTRIBUTEs. Update-Note: Given OpenSSL hasn't accepted these for five years, it's unlikely anything depends on it. If something breaks, we can revert this and revisit. No one calls X509_ATTRIBUTE_set1_data on a non-empty X509_ATTRIBUTE, so the behavior change there should be safe. * Make X509_ATTRIBUTE opaque. Update-Note: Direct accesses of X509_ATTRIBUTE should be replaced with one of the accessors. I couldn't find any direct accesses, so hopefully this is fine. * acvptool: Fix typo hard-coding the HTTP method. * Document a few more x509.h functions. * Make X509_PUBKEY opaque. Update-Note: Direct accesses of X509_PUBKEY should be replaced with one of the accessors. I believe all callers have been fixed at this point. * Always encode booleans as DER. Update-Note: Callers setting ASN1_BOOLEANs to a positive value other than 0xff will now encode 0xff. This probably fixes a bug, but if anyone was attaching significance to incorrectly-encoded booleans, that will break. * Fix issuerUID and subjectUID parsing in the key usage checker. * Add experimental handshake hints API. * Make our Python scripts Python-3-compatible. * Export ssl_client_hello_init for fuzzers. * acvp: support GMAC as an algorithm. * Record a fuzzing corpus for the ClientHelloInner decoder. * Use a consistent plural for 'corpus'. * Add util/bot/libFuzzer to .gitignore. * acvp: support KAS-ECC-SSC staticUnified mode. * Check for invalid ALPN inputs in SSL_(CTX_)set_alpn_protos. Update-Note: SSL_CTX_set_alpn_protos and SSL_set_alpn_protos will now reject invalud inputs. Previously, they would accept them, but silently send an invalid ALPN extension which the server would almost certainly error on. * Don't duplicate ServerHello construction code. * Rearrange key share and early data logic. * Only skip early data with HRR when offered. * Add ECH server config API to ssl_ctx_api fuzzer * Fix ppc64le build. * Simplify the Lucky13 mitigation. * Add ECH server (draft-ietf-tls-esni-09). * runner: Remove unused field * runner: Construct finishedHash earlier. * Simplify tls_cbc.c slightly. * Remove remnants of CBC SHA2 cipher suites. * runner: Test different V2ClientHello challenge lengths. * runner: Ensure helloBytes is always the same as hello.marshal(). * runner: Fix ECH confirmation calculation with PSKs in tests. * runner: Fix HPKE parameter order. * runner: UpdateForHelloRetryRequest cannot fail. * runner: Don't use the buffer in TLS 1.3. * runner: Don't maintain two copies of the same transcript hash. * runner: Remove remnants of SSL 3.0. * runner: Fix writeClientHash and writeRecord ordering. * runner: Remove CheckTLS13DowngradeRandom. * runner: Remove remnants of the separate HelloRetryRequest message. * runner: Store a cipherSuite in ClientSessionState. * runner: Move writeHash to the finishedHash struct. * Fix the spelling of HPKE AEAD constants. * Don't reset server callback expectations on new handshake. * Fix MockQuicTransport::Flush error handling. * Fold ripemd/internal.h into ripemd.c. * Move load/store helpers to crypto/internal.h. * Make words in crypto/fipsmodule/modes actually words. * Handle EINTR more in handshaker.cc. * Add a few missing SSL_R_BIO_NOT_SET cases. * Fix some unreachable code in the QUIC handshaker driver. * Rearrange SSLKeyShare::Serialize. * Fix ssl/internal.h sectioning. * Remove some now unnecessary test exclusions from split handshakes. * Remove tls13-split-handshakes flag. * Define HANDSHAKER_SUPPORTED in once place. * Tidy up handshaker tester. * modulewrapper: add option to print build information. * FIPS counters for AES-CTR. * Enforce that pre_shared_key must come with psk_key_exchange_modes. * Zero out FIPS counters. * Remove is_resume field on TestState. * Remove OPENSSL_DANGEROUS_RELEASE_PTHREAD_KEY build flag. * Add some warnings on how to use OPENSSL_memory_* functions. * Use an unsized helper for truncated SHA-512 variants. Update-Note: There is a small chance the asserts will trip something, but hopefully not since I've left SHA512_Final alone. * Fix mismatch between header and implementation of bn_sqr_comba8. * Remove GCC 4.8.99 check. * Bump minimum CMake version. * Automatically enable C11 atomics when available. 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. * Make generate_build_files.py python3 compatible. * Remove X509_REQ_set_extension_nids and document related functions. Update-Note: This removes a pair of unused functions. * Document a few more functions in x509.h. * Do not access value.ptr with V_ASN1_BOOLEAN. * Add X509_PUBKEY_get0_public_key. * Test empty EVP_CIPHER inputs and fix exact memcpy overlap. * Revert "Implement rsa_pkcs1_sha256_legacy." * Fix unnecessarily direction-specific tests in cipher_tests.txt * Refactor HPKE API to include explicit length parameters. * Generalize make_errors.go to allow EVP covering multiple directories. * Add a Windows no-op impl of BORINGSSL_self_test * Only pass -handshaker-path in split handshakes tests. * Add RNG support for FreeBSD. * Move fips.c into a subdirectory. * Implement rsa_pkcs1_sha256_legacy. * Better document nullable X.509 getters. * runner: Remove redundant -enable-all-curves shim flag. * Initialize nonce in PerAEADTest.ABI. * Document ASN1_TYPE and related functions. * fips: add counters. * Align with OpenSSL on constness of static ASN1_OBJECTs. Update-Note: The change to OBJ_nid2obj should be compatible. The changes to X509_PUBKEY_set0_param and X509_ALGOR_set0 may require fixing some pointer types. * Add -rr-record flag to runner.go. * Register NAME_CONSTRAINTS with bssl::UniquePtr. * Register POLICY_MAPPING with bssl::UniquePtr. * Stub out some more of PKCS7. * Remove TODO to reverse the output of PKCS12_parse. * Make the X509_VAL structure opaque. Update-Note: I believe this is now safe to do. If there are compile failures, switch to X509_get0_notBefore, X509_getm_notBefore, and X509_set1_notBefore, or revert this if I'm wrong and too many callers still need updating. * Support creating unencrypted PKCS#12 files. * Move PKCS#12 samples to embed_test_data. * Remove some remnants of TLS 1.3 downgrade carveouts. Update-Note: https://boringssl-review.googlesource.com/c/boringssl/+/44124 made these functions a no-op, but we kept them around because there were still some call sites floating around. That code has since been updated, so we can remove this. * Remove X509_REQ_to_X509. Update-Note: This removes a function that appears to be unused. It also hardcodes the use of MD5, so please do not use it. * Fix OPENSSL_EC_* constants and add EC_GROUP_get_asn1_flag * RAND_set_rand_method returns int. * Check the inner and outer CRL signature algorithms match. Update-Note: Invalid CRLs with inconsistent inner and outer signature algorithms will now be rejected. * Remove block_mask from EVP_CIPHER_CTX. Update-Note: It doesn't look like anyone is reading into this field. If they are, we can ideally fix it, or revert this if absolutely necessary. * Document a couple more functions in x509.h. * Define X509V*_VERSION constants. * Handle the default X.509 version explicitly. * Compile for RISC-V. * Add ECDSA nonce-testing functions. * Rearrange ECDSA implementation. * Split the FIPS mode PRNG lock in two. * Remove legacy vs_toolchain.py environment variable. * runner: Rename 'masterSecret' on session objects to plain 'secret'. * Test ECDSA signing is non-deterministic. * acvp: split ACVP modulewrapper for reuse by Trusty * No-op CL to trigger some builds. * Use CIPD Go packages. * Update CMake on the bots and switch to CIPD where available. * Future-proof vs_toolchain.py for VS2019. * Revert "Revert "Disable check that X.509 extensions implies v3."" * Update Clang and Go on the bots. * Check for OBJ_nid2obj failures in X509_ATTRIBUTE_create. * Don't overflow the output length in EVP_CipherUpdate calls. Update-Note: Passing extremely large input lengths into EVP_CipherUpdate will now fail. Use EVP_AEAD instead, which is size_t-based and has more explicit output bounds. * Remove X509_issuer_and_serial_hash. Update-Note: No one uses this function. It had a NULL dereference in some error cases. See CVE-2021-23841. * Fix Bazel build breakage. * Specify VS toolchain by command-line argument. * Update Android Bazel build support in BUILD.toplevel. * Honor SSL_TLSEXT_ERR_ALERT_FATAL in the ALPN callback. Update-Note: Callers that return SSL_TLSEXT_ERR_ALERT_FATAL from the ALPN callback will change behavior. The old behavior may be restored by returning SSL_TLSEXT_ERR_NOACK, though see the documentation for new recommendations on return values. * acvp: detect header element in JSON. * Align the ARM capability functions. * Skip runtime NEON checks if __ARM_NEON is defined. Update-Note: Builds with __ARM_NEON (-mfpu=neon) will now drop about 30KiB of dead code, but no longer work (if they even did before) on a particular buggy CPU. Builds without __ARM_NEON are not affected. * acvp: don't include CMAC-AES in regcap dump. * acvp: fix CMAC verify * Include bn/internal.h for non-bcm.c builds. * Add various function calls to test_fips. * Add missing include to self_check.c. * Revert "Disable check that X.509 extensions implies v3." * Fix TLS13SessionID-TLS13 test. Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases Change-Id: I86bd269475ed5598d81787e7ecfec010c4a128fa
2021-02-26external/boringssl: Cherry-pick bc0a4f1f0f7a2d56f944058da74b9c776ba38002Stephen Crane
This includes the following change: https://boringssl.googlesource.com/boringssl/+/bc0a4f1f0f7a2d56f944058da74b9c776ba38002 * acvp: split ACVP modulewrapper for reuse by Trusty Trusty requires its own trusted app to implement the ACVP modulewrapper functionality for validation. Separate the frontend from the generic functions that implement each algorithm. Also includes the necessary Android build system changes for the new file structure. Bug: 173805789 Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases Change-Id: I9711c39c94dcae0929b5198970747e7e9c12c536
2021-01-28external/boringssl: Sync to ae2bb641735447496bed334c495e4868b981fe32.Pete Bentley
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/c1e156ae16fa8b61af9b5d2b74e59d3f86e141be..ae2bb641735447496bed334c495e4868b981fe32 * Use ID instead of Id in Go. * acvp: move CMAC verification into the module wrapper. * Benchmark BORINGSSL_self_test in FIPS mode. * Support MOVLPS and MOVHPS in delocate. * Add FFDH FIPS self-test. * acvp: update to newer FFDH test. * Add basic BLAKE2b-256 support. * acvp: check that the payloadLen of cipher tests is correct. * acvp: update test expectations in light of 8dcdcb39a7 * Support cross-compiling AArch64 FIPS to Android. * acvp: drop 3DES fields from output when unused. * acvp: don't advertise SHA-1 RSA signature generation. * Fix comments that refer to old draft of HPKE. * Define TLSEXT_TYPE_quic_transport_parameters to the old code point for now. Update-Note: This this fixes a compatibility issue with https://boringssl-review.googlesource.com/c/boringssl/+/44704. * Make BN_clear_free a wrapper around BN_free. * delocate: support Aarch64 Bug: 160351436 Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases Change-Id: Ib0479fe6c6c788d9cac4e5d99d3da7d7d7915eb6
2021-01-20external/boringssl: Sync to c1e156ae16fa8b61af9b5d2b74e59d3f86e141be.Pete Bentley
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/3989c99706bf30054798ff82f1cb010e50e385f5..c1e156ae16fa8b61af9b5d2b74e59d3f86e141be * Add DH_compute_key_padded. Update-Note: No compatibility impact, but callers that use DH_compute_key and then fix up the removed leading zeros can switch to this function. Then they should migrate to something else. * Fix client 0-RTT handling with ALPS. * acvp: add XTS support. * doc: fix SSL_set0_rbio * Add support for the new QUIC TLS extension codepoint * delocate: preprocess perlasm output on Aarch64 * Replace MockQUICTransport tags with record types. * Run extension tests at all protocols. * Make QUIC tests work with early data. * Make QUIC work with -async tests. * Fix ALPS state machine in QUIC servers. * runner: Allow tokbind without RI/EMS in TLS 1.3. * Test that ALPS can be deferred to the ALPN callback. * Send ECH acceptance signal from backend server. * delocate: handle Aarch64 assembly in parser. * Add ASM optimizations for Windows on Arm * Use gai_strerrorA on Windows. * Optimize suffix building in FileTest::ReadNext(). * A handful more compatibility functions. * Update HPKE to draft-irtf-cfrg-hpke-07. * acvp: drop subprocess_test.go * Add some OpenSSL-compatibility aliases * delocate: eliminate expression from vpaes assembly. * delocate: support alternative comment indicators * Update third_party/googletest. * acvp: add tests * Fix chacha20_poly1305_x86_64.pl comments. * Fix awkward wording in comment. * Update ECH GREASE to draft-ietf-tls-esni-09 * Gerrit ignores <sup>; use Unicode superscript instead. * acvp: better document the subprocess protocol. * Add .text.unlikely.* pattern to fips_shared.lds. * acvp: fix silly errors. * acvp: load config later. * Allow some non-minimal lengths in BER. * Export tool_sources to GN. * Use more efficient std::string::find overload. * Revert "Add support for the new QUIC TLS extension codepoint" * Move DH parameter generation out of the FIPS module. * Add support for the new QUIC TLS extension codepoint * Use stdlib.h instead of cstdlib in span.h. * Check for trailing data in X509Test.GeneralName. * Fix ChaCha20-Poly1305 x86-64 asm on Windows * Include bn.h from bn/internal.h * acvp: add support for finite-field Diffie–Hellman. * Move DH code into the FIPS module. * Remove unused Netware codepaths in x86 perlasm. * Finish switching to NASM. 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. * Switch to passive entropy collection for Android FIPS. * Skip ASN.1 template tests in Windows shared library builds. * Add TLS_KDF to documented break tests. * acvp: add support for KAS * Align armv8.pl references to OPENSSL_armcap_P. Update-Note: If aarch64 builds get some weird error about relocations, it's this CL's fault. * Reject bad ASN.1 templates with implicitly-tagged CHOICEs. * Implement GREASE for ECH (draft-ietf-tls-esni-08). * acvp: add TLS KDF support * acvp: tweak config * acvp: fix subprocess_test.go * Const-correct GENERAL_NAME_cmp. * Fix EDIPartyName parsing and GENERAL_NAME_cmp. * PWCT failures should clear the generated key. * Get closer to Ed25519 boundary conditions. * draft-ietf-tls-certificate-compression is now RFC 8879. * Update FIPS.md to include latest FIPS certificate. * Only accept little-endian ARM and MIPS variants in base.h. Update-Note: CPU processor defines are a mess. If a little-endian ARM or MIPS build breaks, some of the assumptions above may be wrong. In that case, the output $CC -dM -E - < /dev/null on the offending toolchain will be useful to fix it. If a big-endian ARM or MIPS build breaks, this is working as intended. Any resulting binaries weren't producing the right outputs. * aesv8-armx.pl: avoid 32-bit lane assignment in CTR mode * Improve sk_dup. * Poly1305: Use |size_t|; assert |poly1305_state| is large enough. * util/fipstools/acvp/acvptool: buffer signal channel to avoid losing signal * Add digest.h to self_check.c * Document ASN1_STRING. * acvp: add SHA-512/256 support. * Add FIPS self test for the TLS KDF. * Rename the master_key field in SSL_SESSION to secret. * Always check the TLS 1.3 downgrade signal. Update-Note: SSL_CTX_set_ignore_tls13_downgrade, SSL_set_ignore_tls13_downgrade, and SSL_is_tls13_downgrade now do nothing. Calls sites should be removed. (There are some copies of older Chromium lying around, so I haven't removed the functions yet.) The enforcement was already on by default, so this CL does not affect callers that don't use those functions. * Fix NETSCAPE_SPKI_get_pubkey documentation. * Const-correct and document more X509 functions. * Add APIs for checking ASN.1 INTEGERs. Update-Note: This CL does not change behavior, but I'm leaving a note to myself to make net/der/parse_values.cc call the new functions. * Remove some unnecessary pointer casts. * Document the basic ASN1_STRING functions. * Document some defaults for the EVP RSA interface. * Rearrange ASN1_STRING_copy slightly. * Remove the legacy MSTRING M_ASN1 macros. Update-Note: Some M_ASN1 macros were removed. Code search says there were no uses, and OpenSSL upstream removed all of them. * Switch M_ASN1_TIME macros within the library. * Unwind M_ASN1_* macros for primitive types. Update-Note: Some external code uses the M_ASN1_* macros. This should remain compatible, but some type errors may have gotten through unnoticed. This CL restores type-checking. * Reformat and convert comments in asn1.h. * aarch64: Fix name of gnu property note section * Re-reformat x509.h. * Document X509V3_add1_i2d and friends. * Remove ASN1_STRING_FLAG_NDEF. * Unexport internal crypto/asn1 functions. Update-Note: Code search says these are unused. If someone's using them, we can reexport them. * Unwind some old ASN.1 ifdefs. * Unwind ASN1_PRIMITIVE_FUNCS. * Remove some unused types from asn1t.h. * Unwind ASN1_TFLG_NDEF. Update-Note: Types that use one of the NDEF macros in asn1t.h will fail to compile. This CL should not affect certificate parsing. * Unwind ASN1_ITYPE_COMPAT. Update-Note: Types using IMPLEMENT_COMPAT_ASN1 from openssl/asn1t.h will fail to compile. This CL should not affect certificate parsing. * Unwind ASN1_AFLG_BROKEN. Update-Note: Types using ASN1_BROKEN_SEQUENCE from openssl/asn1t.h will fail to compile. This CL should not affect certificate parsing. * Const-correct various X509 string parameters. * Document the next few functions in x509.h * Remove sk_new_null call. * acvp: move inner MCT loops into subprocess. * Fix x509_rsa_ctx_to_pss when saltlen is md_size. * Document the X509V3_get_d2i family of functions. * runner: explicitly signal error from handshaker. * runner: add -skip * Add functions for manipulating X.509 TBS structures. * Remove ASN1_STRING_length_set prototype. * Update Go on the bots. * Rework vs_toolchain.py and vs_env.py. * Add ECDSA verify KAT to FIPS self-tests. * Add AES-GCM AEADs with internal nonce generation. * Define a constant for the standard GCM nonce length. * Add test for X25519-containing certificate. * Add SSL_early_data_reason_string. * Add raw redeem API. * aarch64: Remove some flavour conditionals * Have fewer opaque booleans in aead_test.cc * acvp: RSA signature verification tests. * acvp: RSA signature generation tests. * acvp: support RSA key generation tests. * Support 4096-bit keys in FIPS mode. * Reland "Check AlgorithmIdentifier parameters for RSA and ECDSA signatures."" Update-Note: Some invalid certificates will now be rejected at verification time. Parsing of certificates is unchanged. * acvp: add 3DES-CBC support * acvp: add 3DES-ECB support * Clear some reported gcc -Wshadow warnings. * Const-correct X509V3_extensions_print. * clang-format and convert comments in x509v3.h. * aarch64: Improve conditional compilation * Silence some linter checks. * acvp: update subprocess_test.go * Update clang. * Implement draft-vvv-tls-alps-01. * Simplify 0-RTT tests. Bug: 160351436 Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases Change-Id: I1fb4105341a73be9d5f978301f7318e16027f37d
2020-10-13external/boringssl: Sync to 3989c99706bf30054798ff82f1cb010e50e385f5.Pete Bentley
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/3743aafdacff2f7b083615a043a37101f740fa53..3989c99706bf30054798ff82f1cb010e50e385f5 * Fix crash when flushing an SSL BIO. * Document low-level PEM read/write functions. * clang-format pem.h and convert comments. * Add PSK variants of HPKE setup functions to BoGo. * acvp: abstract out MCT iteration functions. * Add Go implementation of HPKE draft 05 to runner. * runner: Implement a more complete ClientHello consistency check. * Update TrustTokenV2 to use VOPRFs and assemble RR. * acvp: add AES-CCM support. * acvp: highlight that the TOTP secret goes in the config file. * acvp: handle more private key formats. * runner: Refactor BoGo clientHelloMsg extension marshalling. * Include rodata subsections in FIPS-shared build. * Switch x509_test.cc to use C++ raw string literals. * Fix some malloc error handling. * acvp: add AES-KWP support. * acvp: add AES-KW support. * acvp: support saving vectors. * Fix handling of quic_early_data_context. * Add a warning to des.h. * Move Trusty workaround to the OPENSSL_LINUX define. * acvp: add AES-GCM support. * Disable fork detection on Trusty. * acvp: add AES-CTR support. * Tell clang-format that STACK_OF and LHASH_OF are types. * modulewrapper: fix unknown functions. * Print SSL_get_error in bssl_shim. * modulewrapper: fix sending empty spans. * Allow specifying different initial and resumption expectations. * Add a few more OPENSSL_NO_* constants. * Test SSL_get0_alpn_selected on both client and server. * runner: Rewrite sessionState parsing with byteReader. * Switch ssl_parse_extensions to bool and Span. * Disable check that X.509 extensions implies v3. * Silence some clang warnings on macOS and iOS CQ bots. * Mirror dsa.h's deprecation notice in dh.h. * Const-correct X509_get0_extensions. Update-Note: Callers may need to update their calls of X509_get0_extensions, but I believe everything affected has been fixed. Bug: 160351436 Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases Change-Id: Ieaf5a7c605cdfe2a511406c8b377e9178ad69a55
2020-10-12Revert "external/boringssl: Sync to 3989c99706bf30054798ff82f1cb010e50e385f5."Pete Bentley
This reverts commit 92a0f790a5c96b3f6e0516a20aca2222459be9cd. Reason for revert: Breaks tests in postsubmit: b/170610462 Change-Id: I728ca3ccefda48c2f379747a9b8a68d45ca7854b
2020-10-10external/boringssl: Sync to 3989c99706bf30054798ff82f1cb010e50e385f5.Pete Bentley
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/3743aafdacff2f7b083615a043a37101f740fa53..3989c99706bf30054798ff82f1cb010e50e385f5 * Fix crash when flushing an SSL BIO. * Document low-level PEM read/write functions. * clang-format pem.h and convert comments. * Add PSK variants of HPKE setup functions to BoGo. * acvp: abstract out MCT iteration functions. * Add Go implementation of HPKE draft 05 to runner. * runner: Implement a more complete ClientHello consistency check. * Update TrustTokenV2 to use VOPRFs and assemble RR. * acvp: add AES-CCM support. * acvp: highlight that the TOTP secret goes in the config file. * acvp: handle more private key formats. * runner: Refactor BoGo clientHelloMsg extension marshalling. * Include rodata subsections in FIPS-shared build. * Switch x509_test.cc to use C++ raw string literals. * Fix some malloc error handling. * acvp: add AES-KWP support. * acvp: add AES-KW support. * acvp: support saving vectors. * Fix handling of quic_early_data_context. * Add a warning to des.h. * Move Trusty workaround to the OPENSSL_LINUX define. * acvp: add AES-GCM support. * Disable fork detection on Trusty. * acvp: add AES-CTR support. * Tell clang-format that STACK_OF and LHASH_OF are types. * modulewrapper: fix unknown functions. * Print SSL_get_error in bssl_shim. * modulewrapper: fix sending empty spans. * Allow specifying different initial and resumption expectations. * Add a few more OPENSSL_NO_* constants. * Test SSL_get0_alpn_selected on both client and server. * runner: Rewrite sessionState parsing with byteReader. * Switch ssl_parse_extensions to bool and Span. * Disable check that X.509 extensions implies v3. * Silence some clang warnings on macOS and iOS CQ bots. * Mirror dsa.h's deprecation notice in dh.h. * Const-correct X509_get0_extensions. Update-Note: Callers may need to update their calls of X509_get0_extensions, but I believe everything affected has been fixed. Bug: 160351436 Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases Change-Id: I591546ce4deac518352bb625537073aca1465d35
2020-09-30external/boringssl: Sync to 3743aafdacff2f7b083615a043a37101f740fa53.Pete Bentley
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/2fb729d4f36beaf263ad85e24a790b571652679c..3743aafdacff2f7b083615a043a37101f740fa53 * Add SSL_CIPHER_get_protocol_id. * Add TrustTokenV2. * Add X509_get_pathlen and X509_REVOKED_get0_extensions. * Add some accommodations for FreeRDP * Require non-NULL store in X509_STORE_CTX_init. Update-Note: X509_STORE_CTX_init will now fail when the store is NULL, rather than report success, only to crash later in X509_verify_cert. Breakage should thus be limited to code which was passing in a NULL store but never used the resulting X509_STORE_CTX. * Const-correct X509V3_CONF_METHOD. Update-Note: External definitions of X509V3_CONF_METHOD will need fix the types of their functions. There should not be any of these (probably hide this struct), but if there are, this aligns with upstream OpenSSL. * Avoid unions in X509_NAME logic. * Bump OPENSSL_VERSION_NUMBER to 1.1.1. Update-Note: Some OPENSSL_VERSION_NUMBER/OPENSSL_IS_BORINGSSL checks may need to be updated. Hopefully even more can go away. * Document more of x509.h. * Fix potential leak in bssl::Array::Shrink. * Remove ASN1_STRING_length_set. Update-Note: Use ASN1_STRING_set instead, though this function appears to be unused. * Revert "Check AlgorithmIdentifier parameters for RSA and ECDSA signatures." * Implement PSK variants of HPKE setup functions. * acvp: support working with files. * Document a few more functions in x509.h. * Add subject key ID and authority key ID accessors. * Remove sxnet and pkey_usage_period extensions. Update-Note: Parsers for these two extensions are removed. Parsing the types directly or passing NID_sxnet and NID_pkey_usage_period into X509V3_get_d2i, or *_get_ext_d2i will no longer work. * Const-correct various X509 functions. * Make X509_set_not{Before,After} functions rather than macros. * Add X509_get0_uids from OpenSSL 1.1.0. * Bound RSA and DSA key sizes better. Update-Note: Some invalid or overly large RSA and DSA keys may previously have been accepted that are now rejected at parse time. For public keys, this only moves the error from verification to parsing. In some private key cases, we would previously allow signing with those keys, but the resulting signatures would not be accepted by BoringSSL anyway. This CL makes us behave more consistently. * Add set1 versions of X509 timestamp setters. * Consistently sort generated build files. * delocate: use 64-bit GOT offsets in the large memory model. * Update HPKE implementation and test vectors to draft-irtf-cfrg-hpke-05. * Handle NULL arguments in some i2d_* functions. * aarch64: support BTI and pointer authentication in assembly * Support delegated credentials verison 06 * delocation: large memory model support. * Enforce presence of ALPN when QUIC is in use. Update-Note: If an SSL_QUIC_METHOD is set, connections will now fail if ALPN is not negotiated. This new behavior can be detected by checking if the value of BORINGSSL_API_VERSION is greater than 10. * Fix the naming of alert error codes. Update-Note: The renamed alerts will log slightly different strings, but the constants used by external code are still there. * Use golang.org/x/crypto in runner. Update-Note: The tests now have a golang.org/x/crypto dependency. This should be fetched transparently with Go modules. Monorepos with different import path conventions may need to rewrite these imports. * Disable ClientHello padding for QUIC. * Add X509_SIG_get0 and X509_SIG_getm. * Implement HPKE. * Disallow TLS 1.3 compatibility mode in QUIC. * Switch clang-format IncludeBlocks to Preserve. * Fix unterminated clang-format off. * Add line number to doc.go error messages. * Kick the bots. * Add a JSON output to generate_build_files.py. * Add details of 20190808 FIPS certification. * Link to ws2_32 more consistently. * Allow explicitly-encoded X.509v1 versions for now. * Opaquify PKCS8_PRIV_KEY_INFO. Update-Note: Direct accesses of PKCS8_PRIV_KEY_INFO now need to use the accessors. Code search suggests no one uses the fields. Even the accessors are virtually unused (the one thing which uses it doesn't need it). * Implement i2d_PUBKEY and friends without crypto/asn1. * Remove TRUST_TOKEN_experiment_v0. Update-Note: This gets rid of TRUST_TOKEN_experiment_v0. Existing callers should be updated to call TRUST_TOKEN_experiment_v1. * Clarify in-place rules for low-level AES mode functions. * acvp: add CMAC-AES support. * acvp: add SP800-108 KDF support. * Remove x509->name. Update-Note: instead of x509->name, use X509_NAME_oneline and X509_get_subject_name. * Maybe build for AArch64 Windows. * sha1-x86_64: fix CFI. * Use |crypto_word_t| and |size_t| more consistently in ECC scalar recoding. * Enable shaext path for sha1. * Avoid relying on SSL_get_session's behavior during the handshake. Update-Note: SSL_generate_key_block will now fail mid-handshake. It is ambiguous which key block to use and, in some cases, we may not even be able to compute the right key block. * Add a -wait-for-debugger flag to runner. * Add missing OPENSSL_EXPORT to X509_get_X509_PUBKEY. * Const-correct various functions in crypto/asn1. * Remove uneeded switch statement. * Convert X.509 accessor macros to proper functions. Update-Note: This should be compatible, but it is possible that someone, e.g., passed in a bssl::UniquePtr<X509> to an accessor and relied on operator->. Callers may also run afoul of const correctness. I mirrored OpenSSL 1.1.1's consts, so it should at least be compatible with third-party code. * Remove X509_CINF_get_issuer and X509_CINF_get_extensions. Update-Note: Two unused macros were removed. If there were uses, the X509-level accessors can be used instead. * Remove X509_get_signature_type. Update-Note: If there are any calls to X509_get_signature_type, remove them. It more-or-less always returned NID_undef. * clang-format x509.h and run comment converter. * Check AlgorithmIdentifier parameters for RSA and ECDSA signatures. * Remove some unimplemented prototypes. * Check the X.509 version when parsing. Update-Note: The X.509 parser is now a bit stricter. This may break some malformed certificates which were previously incorrectly accepted. * Fix x509v3_cache_extensions error-handling. Update-Note: The X.509 verifier now correctly rejects syntax errors in important certificate extensions. This may break some malformed certificates which were incorrectly accepted before. * Work around Windows command-line limits in embed_test_data.go. * Move crypto/x509 test data into its own directory. * Test resumability of same, different, and default ticket keys. * Fixes warning when redefining PATH_MAX when building with MINGW. * Abstract fd operations better in tool. * Use CMAKE_SIZEOF_VOID_P instead of CMAKE_CL_64 * Enforce the keyUsage extension in TLS 1.2 client certs. Update-Note: Client certificates which do not support the digitalSignature key usage will be rejected. They should either include that bit or omit the keyUsage extension. * Reword some comments. * Add “Z Computation” KAT. * acvptool: handle negative sizeConstraint. * Let memory hooks override the size prefix. * acvptool: go fmt * Assert md_size > 0. * Remove -enable-ed25519 compat hack. * Add a |SSL_process_tls13_new_session_ticket|. * Use ctr32 optimizations for AES_ctr128_encrypt. * Test AES mode wrappers. * Bump minimum CMake version. * Modify how QUIC 0-RTT go/no-go decision is made. * Remove RAND_set_urandom_fd. Update-Note: RAND_set_urandom_fd no longer exists. This was only called by Chromium, which now uses CRYPTO_pre_sandbox_init. * Document that getrandom support must be consistent. * Fix docs link for SSL_CTX_load_verify_locations * Fix TRUST_TOKEN experiment_v1 SRR map. * Add CRYPTO_pre_sandbox_init. * Still query getauxval if reading /proc/cpuinfo fails. * Add missing header to ec/wnaf.c * Fix OPENSSL_TSAN typo. * Fix p256-x86_64-table.h indentation. * Enable avx2 implementation of sha1. * Trim Z coordinates from the OPENSSL_SMALL P-256 tables. * Use public multi-scalar mults in Trust Tokens where applicable. * Use batched DLEQ proofs for Trust Token. * Restrict when 0-RTT will be accepted in QUIC. * Disable TLS 1.3 compatibility mode for QUIC. * Use a 5-bit comb for some Trust Tokens multiplications. * Use a (mostly) constant-time multi-scalar mult for Trust Tokens. * Batch inversions in Trust Tokens. * Rearrange the DLEQ logic slightly. * Use token hash to encode private metadata for Trust Token Experiment V1. * Introduce an EC_AFFINE abstraction. * Make the fuzzer PRNG thread-safe. * Disable fork-detect tests under TSAN. * Introduce TRUST_TOKENS_experiment_v1. * Route PMBToken calls through TRUST_TOKEN_METHOD. * Introduce a TRUST_TOKEN_METHOD hook to select TRUST_TOKEN variations. Update-Note: Pass TRUST_TOKEN_experiment_v0() into any existing code that now needs a TRUST_TOKEN_METHOD. * fork_detect: be robust to qemu. * Move serialization of points inside pmbtoken.c. * Introduce PMBTOKENS key abstractions. * Fix the types used in token counts. Update-Note: Fix callers of TRUST_TOKEN_ISSUER_issue to use size_t instead of uint8_t. The max_batchsize changes should go through without changes to the caller. * Remove unused code from ghash-x86_64.pl. * Switch the P-384 hash-to-curve to draft-07. * Add hash-to-curve code for P384. * Write down the expressions for all the NIST primes. * Move fork_detect files into rand/ * Harden against fork via MADV_WIPEONFORK. * Fix typo in comment. * Use faster addition chains for P-256 field inversion. * Tidy up third_party/fiat. * Prefix g_pre_comp in p256.c as well. * Add missing curve check to ec_hash_to_scalar_p521_xmd_sha512. * Add a tool to compare the output of bssl speed. * Benchmark ECDH slightly more accurately. * Align remaining Intel copyright notice. * Don't retain T in PMBTOKEN_PRETOKEN. * Check for trailing data in TRUST_TOKEN_CLIENT_finish_issuance. * Properly namespace everything in third_party/fiat/p256.c. * Update fiat-crypto. * Add missing ERR_LIB_TRUST_TOKEN constants. * Add bssl speed support for hashtocurve and trusttoken. * Implement DLEQ checks for Trust Token. * Fix error-handling in EVP_BytesToKey. * Fix Trust Token CBOR. * Match parameter names between header and source. * Trust Token Implementation. * Include mem.h for |CRYPTO_memcmp| * acvptool: add subprocess tests. * Add SHA-512-256. * Make ec_GFp_simple_cmp constant-time. Update-Note: This does mean that we pay a 6M+2S Jacobian comparison where comparing two publicly affine points should cost no field operations at all. Code which compares two EC public keys for equality will be slightly slower. I wouldn't expect this to matter (if you actually use the public keys, you'll pay much much more) If it does, we can restore this optimization by keeping better track of affine vs. Jacobian forms. See https://crbug.com/boringssl/326. * Tidy up CRYPTO_sysrand variants. * Do a better job testing EC_POINT_cmp. * Follow-up comments to hash_to_scalar. * Add a hash_to_scalar variation of P-521's hash_to_field. * Add SSL_SESSION_copy_without_early_data. * Double-check secret EC point multiplications. * Make ec_felem_equal constant-time. * Fix hash-to-curve comment. * Make ec_GFp_simple_is_on_curve constant-time. * Implement draft-irtf-cfrg-hash-to-curve-06. * Update list of tested SDE configurations. * Only draw from RDRAND for additional_data if it's fast. * Generalize bn_from_montgomery_small. * Remove BIGNUM from uncompressed coordinate parsing. * Add EC_RAW_POINT serialization function. * Base EC_FELEM conversions on bytes rather than BIGNUMs. * runner: Replace supportsVersions calls with allVersions. * Enable QUIC for some perMessageTest runner tests * Move BN_nnmod calls out of low-level group_set_curve. * Clean up various EC inversion functions. * Start to organize ec/internal.h a little. * Fix CFI for AVX2 ChaCha20-Poly1305. * Remove unused function prototype. * Enable more runner tests for QUIC * Require QUIC method with Transport Parameters and vice versa * acvptool: support non-interactive mode. * Add is_quic bit to SSL_SESSION * Update SDE. * Update tools. * Add simpler getters for DH and DSA. * Don't define default implementations for weak symbols. * Don't automatically run all tests for ABI testing. * Fix test build with recent Clang. * Remove LCM dependency from RSA_check_key. * Simplify bn_sub_part_words. * No-op commit to test Windows SDE bots. * ABI-test each AEAD. * Add memory tracking and sanitization hooks * Add X509_STORE_CTX_get0_chain. * Add DH_set_length. * Static assert that CRYPTO_MUTEX is sufficiently aligned. * [bazel] Format toplevel BUILD file with buildifier * Add |SSL_CTX_get0_chain|. * Configure QUIC secrets inside set_{read,write}_state. Update-Note: See b/151142920#comment9 Change-Id: I4bbb76e15b5d95615ea643bccf796db87fae4989 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/40244 Commit-Queue: David Benjamin <davidben@google.com> Reviewed-by: Steven Valdez <svaldez@google.com> * Allow setting QUIC transport parameters after parsing the client's * Fix comment for |BORINGSSL_self_test|. * Trust Token Key Generation. * Revise QUIC encryption secret APIs. Update-Note: This is an incompatible change to SSL_QUIC_METHOD. BORINGSSL_API_VERSION can be used to distinguish the two revisions. * Fix ec_point_mul_scalar_public's documentation. Test: atest CtsLibcoreTestCases CtsLibcoreTestCases Change-Id: I754169828a3e1cb461bf0d4a64d4d7b46951d730
2020-08-27Revert "external/boringssl: Sync to a0b49d63fdc33e54eac93674c86891d15d181d87."Pete Bentley
This reverts commit c960c43412e0632abb712fc465e70b6dfa2e9657. Reason for revert: <Breaks ART buildbot> Bug: 166619732 Change-Id: I5c843090e06a33aca391cde9c2da2bcb16995f05
2020-08-24external/boringssl: Sync to a0b49d63fdc33e54eac93674c86891d15d181d87.Daulet Zhanguzin
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/2fb729d4f36beaf263ad85e24a790b571652679c..a0b49d63fdc33e54eac93674c86891d15d181d87 Test: atest CtsLibcoreTestCases Change-Id: Ida4794d56d237422351b9ddcc7d0bc9295e816e1
2020-03-02external/boringssl: Sync to 2fb729d4f36beaf263ad85e24a790b571652679c.Tobias Thierer
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/7f02881e96e51f1873afcf384d02f782b48967ca..2fb729d4f36beaf263ad85e24a790b571652679c Test: atest CtsLibcoreTestCases Change-Id: I46a15a7bae971f16f957b04bcbb771a6936d5c1b
2019-10-19external/boringssl: Sync to 7f02881e96e51f1873afcf384d02f782b48967ca.Tobias Thierer
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/da8caf5b1029b93d482702759058ac993a39bcc5..7f02881e96e51f1873afcf384d02f782b48967ca Test: atest CtsLibcoreTestCases Change-Id: I0d11a8a68591703d691dfb8403dc45054988f60d
2019-10-19external/boringssl: Sync to da8caf5b1029b93d482702759058ac993a39bcc5.Tobias Thierer
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/a7a75f208caea8a303615724d4cc5f4e8dfb9695..da8caf5b1029b93d482702759058ac993a39bcc5 Also contains a local change to Android.bp to disable hwasan as that in combination with the linker script changes cause Clang to crash. Test: atest CtsLibcoreTestCases Change-Id: I630124e7786fcad4f3389e8fe1b6d294d0f13912
2019-10-15external/boringssl: Sync to a7a75f208caea8a303615724d4cc5f4e8dfb9695.Tobias Thierer
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/4ca15d5dcbe6e8051a4654df7c971ea8307abfe0..a7a75f208caea8a303615724d4cc5f4e8dfb9695 Test: atest CtsLibcoreTestCases Change-Id: Ie997cc5a7f8f03b271d58b5d89d43f67e4df68b0
2019-10-09external/boringssl: Sync to 4ca15d5dcbe6e8051a4654df7c971ea8307abfe0.ndk-sysroot-r21Tobias Thierer
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/56b6c714c9cae5963681ed9dd9f6cabf294e3f80..4ca15d5dcbe6e8051a4654df7c971ea8307abfe0 Test: Treehugger only - this is a trivial change from a single commit that shouldn't affect Android at all, it only affects boringssl's own builds. Change-Id: I2427fdca35ae3cb61298c1d0102b9bf191d0d068
2019-10-09external/boringssl: Sync to 56b6c714c9cae5963681ed9dd9f6cabf294e3f80.Tobias Thierer
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/6e7255c17e1a7348a2377fbc804441dd284806e2..56b6c714c9cae5963681ed9dd9f6cabf294e3f80 Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases Change-Id: I9977c8fa204dd39e5b6c71abdb85d055e842bf4e
2019-10-02external/boringssl: Sync to 6e7255c17e1a7348a2377fbc804441dd284806e2.Pete Bentley
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/3a3552247ecb0bfb260a36d9da7a3bce7fdc3f8a..6e7255c17e1a7348a2377fbc804441dd284806e2 Key changes for Android are 1458b49 Switch to using SHA-256 for FIPS integrity check on Android. 9638f8f Use a smaller hex digest in FIPS flag files when SHA-256 used. 6e7255c Use a pointer to module_hash in boringssl_fips_self_test() args. Bug: 141710485 Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases Change-Id: Ie3900ac71bf6c8ea3e413ee4c3438b4822560df4
2019-09-26external/boringssl: Sync to 3a3552247ecb0bfb260a36d9da7a3bce7fdc3f8a.Pete Bentley
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/e60b080dda138e1dd02d99fb34641ac22e46c85d..3a3552247ecb0bfb260a36d9da7a3bce7fdc3f8a Also changes Android.bp to compile with execute-only memory again as this should no longer be necessary with the mprotect changes in https://boringssl.googlesource.com/boringssl/+/09a9ec036030ac84896f5143548d05f3951d1817 Bug: 134580074 Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases Change-Id: I0ec54998afd2e0b40ec930716397e20aa3c21bf2
2019-09-12external/boringssl: Sync to e60b080dda138e1dd02d99fb34641ac22e46c85d.Tobias Thierer
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/a8ffaf1bf2ec64cbbb17863ede06ba506b3db8b8..e60b080dda138e1dd02d99fb34641ac22e46c85d Bug: 137267623 Bug: 140918050 Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases Change-Id: I00eeca876b9070a7163ec284433fc2ec5ea5ef01
2019-09-12external/boringssl: Sync to a8ffaf1bf2ec64cbbb17863ede06ba506b3db8b8.Tobias Thierer
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/44544d9d2d624cbfff9b1e77cb77f8dfc70d073c..a8ffaf1bf2ec64cbbb17863ede06ba506b3db8b8 Bug: 137267623 Test: atest CtsLibcoreTestCases Change-Id: I055f50e4f223810088400492bd51be29cbce445c
2019-08-19external/boringssl: Sync to 44544d9d2d624cbfff9b1e77cb77f8dfc70d073c.Pete Bentley
This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/bc2a2013e03754a89a701739a7b58c422391efa2..44544d9d2d624cbfff9b1e77cb77f8dfc70d073c 44544d9 Introduce libcrypto_bcm_sources for Android. 8c98bac Remove stale TODO. eca48e5 Add an android-cmake option to generate_build_files.py fd863b6 Add a QUIC test for HelloRetryRequest. The key change for Android splitting sorces into BCM (Boring Crypto Module) and non-BCM to allow different compilation rules. Test: atest CtsLibcoreTestCases CtsLibcoreOkHttpTestCases Change-Id: I2556da61088a4956805cf9a6be92b824715b7eb5
2019-08-13external/boringssl: Sync to bc2a2013e03754a89a701739a7b58c422391efa2.Pete Bentley
Third time's the charm. This includes the following changes: https://boringssl.googlesource.com/boringssl/+log/c9827e073f64e353c4891ecc2c73721882543ee0..bc2a2013e03754a89a701739a7b58c422391efa2 Test: atest CtsLibcoreTestCases Test: atest CtsLibcoreOkHttpTestCases Change-Id: I7943c83d12237ec6e4dc54fb3d5a9cecb909e6e7
2019-08-09Revert "Revert "Revert "external/boringssl: Sync to ↵Srinivas Paladugu
81080a729af568f7b5fde92b9170cc17065027c9.""" This reverts commit a5c947b7c91bac52eeb5086507b67e52a59ef980. Reason for revert: Breaks blueline target on qt-dev-plus-aosp and pi-dev-plus-aosp Change-Id: Ib3f71674ce7f7114e5925043ead7e8e51e9bc31e
2019-08-09Revert "Revert "external/boringssl: Sync to ↵Pete Bentley
81080a729af568f7b5fde92b9170cc17065027c9."" This reverts commit 228bd6249d17f351ea66508b3ec3112ed1cbdf30. Reason for revert: All fixes submitted for modules affected by the ENGINE_free API change. Change-Id: I30fafafa13ec0a6390f4a9211fbf3122a8b4865f
2019-08-08Revert "external/boringssl: Sync to 81080a729af568f7b5fde92b9170cc17065027c9."Pete Bentley
This reverts commit f8d8b73da16aa9f2fdda401a46b4f86a83016712. Reason for revert: Breaks buildsdk_tools_cross_win Change-Id: I3bac24f78d165dfa7f89b878cc2277281fd8f1ab