Bazel: update BoringSSL to a57dcfb / 47b7059 (master-with-bazel).

This update includes the following changes:

a57dcfb6 Add new cipherlist-setting APIs that reject nonsense.
c4796c92 ECDSA: const EC_KEY* arguments where possible.
699e55bb Unexport time_support.h.
fc02b59b Move tmp.extended_master_secret to SSL_HANDSHAKE.
45738dd4 Move new_cipher and new_session to SSL_HANDSHAKE.
12709db3 Stop reporting SSL_R_SHUTDOWN_WHILE_IN_INIT.
c92f29dc Remove freelist_max_len.
ced18959 Fix mis-import of upstream cc598f321fbac9c04da5766243ed55d55948637d.
c4d5925c Fix various malloc failure checks.
ec1d9637 Fix crashes in EVP_CIPHER if cipher_data was not allocated.
fb2ac390 Convert ec_test to GTest.
c5be327e Tidy up EVP_PKEY_CTX_dup and fix malloc error crash.
3e8b782c Remove "raw" versions of PKCS8_encrypt and PKCS8_decrypt.
628f518c bn/asm/x86_64*: add DWARF CFI directives.
b91b9a89 Convert rsa_test to GTest.
98f5dc30 perlasm/x86_64-xlate.pl: recognize even offset(%reg) in cfa_expression.
f3cc7a33 perlasm/x86_64-xlate.pl: fix pair of typo-bugs in the new cfi_directive.
4c405319 perlasm/x86_64-xlate.pl: typo fix in comment.
cb1b333c x86_64 assembly pack: Win64 SEH face-lift.
dc90e392 Clear the last GTest warning suppression.
5960a909 Move sid_ctx from SSL/SSL_CTX to CERT.
0f28691d Fix a few typos.
26e1ff3d Remove some unnecessary return values.
27a9e6ae Adding ALPN to session.
f6d64efd tool: show if server sent SCT staple
b19b6626 Convert chacha_test to GTest.
1d5a5706 Don't hardcode GTest sources.
83a32123 Move SCT lists and OCSP responses to CERT.
004bff3a chacha/asm/chacha-x86_64.pl: add AVX512 path optimized for shorter inputs.
cf9a98cc x86 assembly pack: update performance results.
51079b4e x86_64 assembly pack: add AVX512 ChaCha20 path.
b99dc55f chacha/asm/chacha-x86.pl: improve [backward] portability.
5ca18d8a chacha-x86.pl: simplify feature setting.
766a6fd1 Revert "OpenSSL: make final reduction in Montgomery multiplication constant-time."
0bf9d6d5 bn/asm/x86[_64]-mont*.pl: implement slightly alternative page-walking.
ff7fb71a x86_64 assembly pack: add Goldmont performance results.
952f7bff Spelling fixes in Perl files.
86c06924 Skylake performance results.
c948d465 Remove trailing whitespace from Perl files.
073a06d3 On Windows, page walking is known as __chkstk.
b8344501 Explain *cough*-dows
edcd8fda bn/asm/x86[_64]-mont*.pl: complement alloca with page-walking.
689eb3d0 x86_64-xlate.pl: import fix(?) from upstream.
9ad43cbf x86_64-xlate.pl: drop some whitespace.
9be3238e perlasm/x86_64-xlate.pl: recognize DWARF CFI directives.
16b1b1d4 Simplify state and info_callback management.
35ed5233 Remove an unnecessary state transition.
77458a43 Avoid transitioning into SSL_ST_OK and back out.
9e766d75 Unexport the handshake's internal state.
07ab5d44 Stop skipping stray HelloRequests.
040bc494 Enable TLS 1.3 by default in bssl tool.
7d7554b6 Add a helper for comparing byte strings.
949628a2 perlasm/x86_64-xlate.pl: remove obsolete .picmeup synthetic directive.
25126633 perlasm/x86_64-xlate.pl: minor readability updates.
31499790 perlasm/x86_64-xlate.pl: clarify SEH coding guidelines.
4229d26b perlasm/x86_64-xlate.pl: add support for AVX512 OPMASK-ing.
137e2f86 bn/asm/rsaz-avx2.pl: refine Win64 SE handler.
46db7af2 Remove |X509| things from SSL_SESSION.
7ebe61a5 Fix server-side KeyUpdates.
bc6ef7a8 Convert err_test to GTest.
908ac19e Moving transcript and PRF functions to SSL_TRANSCRIPT.
d4c349b5 Test various lengths of ticket session IDs.
b987355a Add BN_is_pow2, BN_mod_pow2, and BN_nnmod_pow2.
5e377783 Rename ssl_rsa.c to ssl_privkey.c.
52940c49 Move a number of certificate-related functions from ssl_rsa.c to ssl_cert.c
3509dacc Add |X509_METHOD| and, using it, move many functions to ssl_x509.c.
04540a7f Set the default value of a last |alert|.
c68e5b99 Establish that the default value of an out-arg for alerts is SSL_AD_DECODE_ERROR.
64453919 chacha20_poly1305_x86_64.pl: Suppress Yasm non-local label warnings.
dc8c1d96 Remove some dead state constants.
59bae5aa Split TLS 1.2 ClientHello processing into separate functions.
7dccc71e Set output alert when failing to parse public key.
cdb6fe90 Test the exporter at all versions + ciphers + side.
3bd57e3a Remove remnants of non-standard ECDHE_PSK GCM ciphers.
6b0edfb9 Add a common TestEventListener for the error queue.
f0d8e220 Convert some of ssl_test to GTest more thoroughly.
634b0e3c Combine stdout and stderr in all_test.go
8df6766d Support setting per-connection SCT list
33fe4a0d Remove support for setting per-connection default session timeout
5bd8a09f Fix a crash with malformed user notice policy numbers
023d419e Test that we tolerate server name acknowledgements.
ab20cec1 Read 0-RTT data in Bogo.
f2511f19 Send 0-RTT data in bogo.
e0ca4879 Fix EVP_get_digestbyobj for NID-less ASN1_OBJECTs.
3f2611a9 Hide SSL struct.
2f82a0e5 Don't stash tlsext_hostname in ssl_get_new_session.
b7d53ba2 Add “const” to |SSL_SESSION| fuzzer.
58966a45 Remove legacy ChaCha20-Poly1305 cipher name aliases.
2056f63b Recommend ex_data for SSL_CTX_set_cert_verify_callback.
b2ff2623 Add a basic SSL_get_certificate test.
e025f305 Guard the _GNU_SOURCE #define.
bdcfd136 Move the SSL BIO into ssl/ from decrepit/.
daa05392 Remove an unnecessary TLS 1.3 ClientHello state.
42bfeb36 Remove an unnecessary TLS 1.2 ClientHello state.
e5dfb52c Add -root-certs options to bssl client.
e212f27a Support running tests under Intel SDE.
3c0e0377 Don't reach into SSL in BIO_f_ssl.
5fa2cdf1 Test SSE4.1 before using ChaCha20-Poly1305 asm.
772a5bed Reorder the X25519 ladderstep stack frame on x86-64.
8671c47b Fold ssl3_write_bytes into ssl3_write_app_data.
6342111c Remove BIO puts hooks.
5c9d411e Fix some compact unwind errors.
17b30833 Use a separate timeout scheme for TLS 1.3.
0b1bb12c Push the SSL_CTX session_timeout zero logic up.
0efa7592 dispatch_alert is not an incidental write.
e79fe70b Bit-pack SSL_AEAD_CTX's various toggles.
b5c58db9 TLS 1.3 sessions should not be added to the server session cache.
c26692cf Push the use of X509 upwards, out of |ssl_set_cert|.
e1e78130 Keep a reference to |X509|s appended to a chain.
7cd0a978 Bogo: Send and receive 0.5-RTT data.
3f38d80b Add CFI information to the x86-64 X25519 asm.
8c2480f7 Push to error queue in |EVP_PKEY_CTX_ctrl| for wrong keytype.
f71036e4 Remove ssl_hash_message_t from ssl_get_message.
1a444dac Detach V2ClientHello hashing hack from ssl_hash_message_t.
360a4c26 chacha20_poly1305_x86_64.pl: Use NASM-compatible syntax for |ldea|.
357a9f23 chacha20_poly1305_x86_64.pl: Use |imulq| instead of |imul|.
3416d28a chacha20_poly1305_x86_64.pl: Escape command line args like other PerlAsm scripts.
276b7e81 Move optional message type checks out of ssl_get_message.
6f07d726 Don't up_ref a NULL |CRYPTO_BUFFER|.
42e3e191 Restore mapping BIO_flush errors to -1.
830f7009 Rename some single-letter argument names.
3b3b62f3 X509_parse_from_buffer: reject massive certificates.
3a2b47ab Don't use |X509| objects in |CERT|, by default.
2fe6e227 Remove mask_a and mask_k from CERT.
41a26e81 Remove buffer BIOs.
71e4aff6 Use |extern| when referencing assembly functions from C.
9b160666 Ignore 0-RTT-capable tickets unless enabled.
258508fc Adding V2ClientHello counter.
d103616d bn/asm/x86_64-mont5.pl: fix carry bug in bn_sqr8x_internal.
47383aad Skip over early data in bogo.
16315f7c Remove the rest of write_message.
0f24bedb Rename tls13_prepare_* to tls13_add_*.
81b7bc39 Trim unnecessary TLS 1.3 states.
25ac251a Remove write_message from TLS 1.3 handshakes.
daf207a5 Don't use the buffer BIO in TLS.
1a999cf5 Don't use the buffer BIO in DTLS.
330282a6 Remove SHA_LBLOCK and SHA_LONG.
6d50f475 Remove support for RSA premaster logging.
a772b16f Allow dtls_seal_record to work in-place.
3b584332 Fix ssl_test with BORINGSSL_ANDROID_SYSTEM.
c0263ab4 Don't leave ARCH unset for mips.
5db7c9b8 Get OPENSSL_COMPILE_ASSERT working in function bodies.
d1515a3b Move a number of X.509 functions from ssl_lib.c to ssl_x509.c
03b96d70 Remove unused |ssl_parse_x509|.
8d5f9da2 Abstract away BIO_flush calls in the handshake.
44c1a657 Run go fmt on bogo code.
1da9c67a Use a Perlasm variable rather than an #if to exclude the ChaCha20-Poly1305 asm on Windows.
feca9e56 Emit ssl_[c|cc]_sources for Bazel.
8d565580 Optimized Seal/Open routines for ChaCha20-Poly1305 for x86-64
358baeb9 Add missing src/ prefix to GTest sources.
5b410b6b Remove unnecessary CBS_get_asn1_element.
1aa4a5bd Delete unused Poly1305 assembly.
96628433 Do a cursory conversion of a few tests to GTest.
d1263b05 Stop emitting tests for gyp.
9fb326d4 Fix MSVC C4826 issues in googletest.
c10c2986 Fix ColorPrintf issues in googletest.
9b502852 Check in a pristine copy of googletest.
958346a5 Run select_certificate_cb multiple times
5c7a4b8c Add test for truncated AEAD tags.
07820b5c Add a getter for SSL_set_session_id_context.
2e839244 Remove old ChaCha20-Poly1305 AEAD.
53220104 Revert "Remove old ChaCha20-Poly1305 AEAD."
6752efde Never send SNI warning alerts.
a8c8b387 Don't call the SNI callback as a client.
def9b468 Remove old ChaCha20-Poly1305 AEAD.
1252f875 Convert one libssl function to C++11.
0726fb76 Add SSL_CIPHER_is_AEAD.
a26d4c3f Enable stitched x86-64 AES-NI AES-GCM implementation.
abb32cc0 Restore H (the key) in the GHASH context.
67ccf591 Fix crypto/rand/urandom header guards for Fuchsia.
c2538649 Remove some node.js hacks.
c80e4163 Add support for Fuchsia in crypto/rand.
b4cc925c Remove specialized assembly language |ecp_nistz256_from_mont|.
a2bdbb60 Remove unused cp_nistz256_mul_by_2.
cb42354a Clarify x86 GCM asm implementation dispatching.
18a37a42 Remove unused "pure" MMX x86 GCM implementation.
ac153bde Remove unused non-MMX/SSE GCM assembly code.
6a0888dd Save one call to |ecp_nistz256_from_mont| in |ecp_nistz256_get_affine|.
745745df Add SSL_CIPHER_is_static_RSA.
5fc99c66 There are no more MD5 ciphers.
dcecdfd6 Fix a couple of missing spaces in comments.
1d6eeb3b Spellcheck our public headers.
e3fbb360 Test SSL_set_max_send_fragment.
8b8d22c9 Parse PKCS#12 files more accurately.
2df010e4 Remove 'pivot element' from wNAF code.
0a211dfe Remove BN_FLG_CONSTTIME.
d2610040 Report TLS 1.3 as supporting secure renegotiation.
7f539fa0 Handle overflow in ascii_to_ucs2.
9d0e7fb6 Rework PKCS{5,8,12} code.
314d8142 Reimplement pkcs12_pbe_keyivgen with CBS.
d1afc418 Reimplement PKCS5_pbe_set with CBB.
2a25aae0 Ensure that CBB is |CBB_zero|ed before possibly calling |CBB_cleanup|.
4fae069c Reimplement PKCS5_v2_PBE_keyivgen.
e464e81f Reimplement PKCS5_pbe2_set with CBB.
ac83bea8 Trim dead code from PKCS#5 PBE2 bits.
9ba19b8e Test we can round-trip PKCS8_{encrypt,decrypt}.
a5eee1c7 Decouple EVP_get_digestbyobj from the giant OID table.
8f3f6be0 Const-correct the PKCS8 salt parameter.
35349e9f Unexport PKCS5 functions.
20dbc1ff Import some PKCS8_decrypt test vectors from Chromium.
e2c083df ASN1_UTCTIME_print: fix, comment, test.
7c7ab217 Guard a winsock2.h include under the usual pragmas.
9c33ae85 Fix TLS 1.3 NewSessionTicket processing.
6add9f17 Fix setsockopt call.
45573cc0 Add Little-endian BIGNUM conversions
08b65f4e Enabling 0-RTT on new Session Tickets.
c0c70192 Simplify ec_GFp_nistp224_points_mul logic.
d2242407 Don't accept signature OIDs in EVP_get_digestby{nid,obj}.
9cbd5599 Simplify ec_GFp_nistp256_points_mul logic.
bf5bda37 Adding socket reuse to bssl server.
0b8dc309 Don't use BN_mod_inverse for inverses mod p in RSA keygen.
053fee9f Enforce the SSL 3.0 no_certificate alert in tests.
48063c2a Add tests around SSL_write's retry behavior.
a660e7ab Don't clear cert_request in ssl3_send_client_certificate.
2be4aa71 Add a helper function for resetting SSL_get_error state.
3fa1e21b Test invalid inputs for AES_unwrap_key.
a1eaba1d Add a test for renegotiation on busy write buffer.
f53e3909 Import RSA decryption tests from upstream.
322f431b Fix API-CONVENTIONS.md typos.
2214f4e4 Remove call to SSL_CTX_set_tls_channel_id_enabled in bssl_shim.
14e18ca2 Fix AES-GCM-SIV on large inputs.
55696cec Remove lh_new's default hash and comparator.
c42a771d Test LHASH contents with lh_doall_arg.
a17eb560 Convert hkdf_test to C++.
d17d1dae Convert dsa_test to C++.
ca064228 Rewrite lhash_test in C++.
c96a8881 Convert constant_time_test and refcount_test to C++.
650aa1c8 Clean up certificate auto-chaining.
d31148b1 update required cmake version to 2.8.10
2ee1edfb Add BN_get_u64 so that Android doesn't have to reach into the BIGNUM structs
d035ab3b Add a GCOV option to CMakeLists.txt.
f650c71a Use SSL_CTX_up_ref to up-ref an SSL_CTX.
a81967b4 Add tests for the point format extension.
23594412 Refresh fuzzer corpus.
4c592d8f Enable short header negotiation in fuzzers.
9c70b89d Update fuzzer mode suppressions.
3e349513 Fix fuzzer mode build.
1444c3ac Add tests for auto-chaining.
c7df7967 Don't chain to next_bio for buffer BIO BIO_[w]pending.
6cc90388 Reimplement objects.pl in Go.
6f600d6b Add experimental TLS 1.3 short record header extension.
ec6b5306 Fix comment on OPENSSL_memcmp, etc.
17cf2cb1 Work around language and compiler bug in memcpy, etc.
56cadc3d Assert on the alert sent on FALLBACK_SCSV.
720ff53d Trim and simplify obj_xref.c.
48e2be24 Include the type in empty vector literals.
28feb92a Add |X509_STORE_set0_additional_untrusted|.
b442dee3 Rename FallbackSCSV-MatchVersion.
458334a1 Test name-based version APIs are reported as expected.
e6620af1 Remove rsaz-x86_64.pl from CMake inputs.
9f05de4e Remove the non-no_branch branch of BN_div.
4cb8494d Splitting handshake traffic derivation from key change.
1bcd10c5 Add CMake support for ASAN and MSAN.
65fb4258 Remove version-specific cipher lists.
2d584820 Call __msan_unpoison on the output of getrandom.
39ae1447 Revert "Revert "crypto/rand: Fix a crash bug in RAND_enable_fork_unsafe_buffering." and "Enable getrandom for entropy gathering.""
16bfff71 Calculate Montgomery RR without division.
febf7719 Verify consistency of RSA keys after generation & parsing.
a36255cd Fix RSA-PSS documentation.
4f57074b Check input length to pkey_rsa_verify and add initial tests.
97db926c Revert "crypto/rand: Fix a crash bug in RAND_enable_fork_unsafe_buffering." and "Enable getrandom for entropy gathering."
b479c5df Revert "Include some C versions of the x86-64 P-256 code."
ba84265c Include some C versions of the x86-64 P-256 code.
87c0bb29 Adding new options for bssl tool.
76bb1411 Remove the BORINGSSL_ANDROID_SYSTEM P-521 special-case.
593b6a44 Remove RSAZ-512.
d9d36b27 Add RSAZ-512 versions of RSAZ-1024 test vectors.
61a7ef4f Reduce the input base |a| in BN_mod_exp_mont_consttime for RSAZ.
36ca2141 crypto/rand: Fix a crash bug in RAND_enable_fork_unsafe_buffering.
4cc1ccd3 Add minimal tests for 1024-bit RSAZ BN_mod_exp_mont_consttime.
629db8cd Add |SSL_get_peer_full_cert_chain|.
a4b91981 Make TLS 1.3 check ECDSA KeyUsage and add test.
0567220b Don't use X.509 functions to check ECDSA keyUsage.
0c294254 Don't use |X509_get_pubkey| in TLS 1.3 code either.
703aa160 Import a test vector from upstream.
fa99197b perlasm/x86_64-xlate.pl: refine sign extension in ea package.
fcd714d5 Add CBS functions for working with BIT STRINGs.
aa012041 Move per-cipher-suite tests into a separate function.
db5bd721 Move key_share extension check with ECDHE code.
f1050fd7 Preserve the peer signature algorithm across resumes.
8a55ce49 Test SSL_get_curve_id behavior on resume.
4882a6c5 Replace key_exchange_info with group_id.
54881224 Remove SSL_get_dhe_group_size.
d515722d Don't depend on the X509 code for getting public keys.
d519bf6b Add |SSL_CTX_set0_buffer_pool|.
68e7124d Hold certificates in an SSL_SESSION as CRYPTO_BUFFERSs as well.
364f7a6d Push the difference in chain semantics to the edge.
cb0c29ff Move state and next_state to SSL_HANDSHAKE.
2644a13d Set up the SSL_HANDSHAKE object earlier.
5edfc8cc Emulate the client_cert_cb with cert_cb.
58889467 Remove SSL_CTX_get_client_cert_cb.
888d5ccd Remove unused SSL_want_* macros.
287fc4ff Don't use SSL_want_* macros internally.
5b1f07e9 Remove unused BIO_RR_* values.
2ad3c989 Merge in upstream's certificate corpus.
9434b6bb Fix BN_kronecker on unreachable BN_rshift error.
edb4c796 Add yet another way to spell 32.
3977f303 Rename hs->state to hs->tls13_state.
1149ee1d tool: show if server sent OCSP staple
f440e827 Remove New Hope key agreement.
c0fc7a13 Revert "Add |SSL_CTX_set0_buffer_pool|." and "Hold certificates in an SSL_SESSION as CRYPTO_BUFFERSs as well."
651aaefb Remove CECPQ1 (experimental post-quantum key agreement).
5a6e6169 Add |SSL_CTX_set0_buffer_pool|.
e8509090 Hold certificates in an SSL_SESSION as CRYPTO_BUFFERSs as well.
f5b30cc2 Add a simplified SSL BIO for curl.
559f0644 Support setting per-connection OCSP staple
7c572864 Remove SSL_set_reject_peer_renegotiations.
b79cc846 Fix SSL_clear's interaction with session resumption.
30c4c30d Revise some integer sizes.
813fc01f Remove unreachable check.
f04c2e98 Move client_version into SSL_HANDSHAKE.
a2bda9fb Make more functions static.
0be6fc4c Move a few more functions into *_method.c.
c8006be2 Fix X509_parse_from_buffer when failing to parse.
9d125dcd Remove SSL_OP_DISABLE_NPN.
82bbe550 Add tests for BIO pairs.
aac1e2dd Remove the remaining bssl::Main wrappers.
4ba6e196 Better pack ssl_handshake_st and ssl3_state_st.
93c332b0 Tighten BIO_new_bio_pair.
ed1d288a Unwind all the zero-copy BIO pair machinery.
33b1d4f5 Check that tests with a version in the name do something with versions.
eebd3c88 Add SSL_(CTX_)set_tls_channel_id_enabled.
8db920ad Remove SSL_ctrl compatibility macros for Channel ID.
2578b291 Make ssl3_choose_cipher and dependencies static.
731058ec Typedef ssl_early_callback_ctx to SSL_CLIENT_HELLO.
91e9b0de Remove tls_record_type_t.
df447ba3 Add generic AES-GCM-SIV support.
cd6cfb07 Test SendReceiveIntermediate* with expected version.
dfec182a Remove Fake TLS 1.3 code from prf.go.
f3c8f8d1 Pass explicit parameters elsewhere.
8baf9635 Pass explicit hs parameters to ssl_ext_*.
6773972f Pass explicit hs parameters into t1_enc.c.
2bd19178 Pass explicit hs parameters into custom_extensions.c.
6e4fc336 Pass explicit hs parameters to tls13_*.c.
8c880a2b Pass explicit hs parameters to kExtensions callbacks.
7b668a87 Enable getrandom for entropy gathering.
c3c88829 Match state machine functions with new calling convention.
ce8c9d2b Maintain SSL_HANDSHAKE lifetime outside of handshake_func.
7d759784 Fix x509v3_cache_extensions locking.

Change-Id: I02e71ee0e92b2ad8bf8fa7dc301ce8b4eeaf8147
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Reviewed-on: https://nginx-review.googlesource.com/2780
Reviewed-by: Lizan Zhou <zlizan@google.com>
diff --git a/build.bzl b/build.bzl
index a0add04..9442e32 100644
--- a/build.bzl
+++ b/build.bzl
@@ -606,7 +606,7 @@
 def nginx_repositories_boringssl(bind):
     native.git_repository(
         name = "boringssl",
-        commit = "a94639db9cf5b951297c4d418fef3be5ba486d9b",  # 2016-12-05
+        commit = "47b70592b67e26e80c23da5b67be50d9e0c27e67",  # 2017-02-22
         remote = "https://boringssl.googlesource.com/boringssl",
     )