grpc 1.41.0 → 1.41.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +4 -3
- data/etc/roots.pem +335 -326
- data/src/ruby/ext/grpc/extconf.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/boringssl-with-bazel/err_data.c +278 -272
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bool.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_d2i_fp.c +0 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_gentm.c +5 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_mbstr.c +15 -22
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +13 -7
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_print.c +19 -29
- data/third_party/boringssl-with-bazel/src/crypto/{x509 → asn1}/a_strex.c +268 -271
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strnid.c +6 -43
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +0 -39
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_par.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/{x509 → asn1}/charmap.h +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/internal.h +25 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_dec.c +8 -8
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +289 -198
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_fre.c +8 -8
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_new.c +9 -13
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_utl.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/base64/base64.c +11 -8
- data/third_party/boringssl-with-bazel/src/crypto/bio/bio_mem.c +1 -7
- data/third_party/boringssl-with-bazel/src/crypto/bio/connect.c +1 -5
- data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +0 -4
- data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +1 -7
- data/third_party/boringssl-with-bazel/src/crypto/bio/pair.c +1 -6
- data/third_party/boringssl-with-bazel/src/crypto/bio/socket.c +3 -17
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbb.c +9 -0
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbs.c +8 -0
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/cipher_extra.c +45 -65
- data/third_party/boringssl-with-bazel/src/crypto/digest_extra/digest_extra.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +21 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/gcd_extra.c +3 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +5 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/e_aes.c +10 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md4/md4.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm_nohw.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +24 -9
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +4 -2
- data/third_party/boringssl-with-bazel/src/crypto/mem.c +12 -9
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_all.c +0 -9
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_info.c +0 -2
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_lib.c +0 -8
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_pk8.c +0 -2
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_pkey.c +0 -4
- data/third_party/boringssl-with-bazel/src/crypto/pkcs7/internal.h +16 -7
- data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7.c +9 -4
- data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7_x509.c +151 -12
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/by_file.c +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +181 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/name_print.c +246 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/rsa_pss.c +11 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/t_crl.c +0 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509.c +0 -179
- data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509a.c +4 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_lu.c +0 -5
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_obj.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +11 -50
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vpm.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +2 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_all.c +0 -16
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +22 -18
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +11 -8
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +16 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_cache.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_data.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_int.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_map.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_tree.c +4 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_akey.c +24 -5
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_alt.c +17 -8
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_bitst.c +3 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_cpols.c +6 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_crld.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_enum.c +5 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_ncons.c +112 -55
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_pci.c +2 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_prn.c +0 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +71 -26
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +304 -192
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1t.h +2 -9
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +5 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +3 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/bn.h +3 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +9 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +8 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/hkdf.h +4 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/mem.h +9 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/pem.h +0 -20
- data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +12 -5
- data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +5 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/span.h +37 -15
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +26 -12
- data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +31 -32
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +50 -76
- data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +0 -131
- data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +48 -8
- data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +266 -357
- data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +90 -152
- data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +15 -13
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +75 -79
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +96 -97
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +63 -43
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/ssl_transcript.cc +6 -12
- data/third_party/boringssl-with-bazel/src/ssl/ssl_x509.cc +14 -16
- data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +14 -27
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +203 -203
- data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +30 -41
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +47 -33
- metadata +39 -38
@@ -146,6 +146,7 @@
|
|
146
146
|
|
147
147
|
#include <stdlib.h>
|
148
148
|
|
149
|
+
#include <initializer_list>
|
149
150
|
#include <limits>
|
150
151
|
#include <new>
|
151
152
|
#include <type_traits>
|
@@ -693,7 +694,8 @@ class SSLTranscript {
|
|
693
694
|
// InitHash initializes the handshake hash based on the PRF and contents of
|
694
695
|
// the handshake transcript. Subsequent calls to |Update| will update the
|
695
696
|
// rolling hash. It returns one on success and zero on failure. It is an error
|
696
|
-
// to call this function after the handshake buffer is released.
|
697
|
+
// to call this function after the handshake buffer is released. This may be
|
698
|
+
// called multiple times to change the hash function.
|
697
699
|
bool InitHash(uint16_t version, const SSL_CIPHER *cipher);
|
698
700
|
|
699
701
|
// UpdateForHelloRetryRequest resets the rolling hash with the
|
@@ -1449,7 +1451,7 @@ struct ECHConfig {
|
|
1449
1451
|
Span<const uint8_t> public_name;
|
1450
1452
|
Span<const uint8_t> cipher_suites;
|
1451
1453
|
uint16_t kem_id = 0;
|
1452
|
-
|
1454
|
+
uint8_t maximum_name_length = 0;
|
1453
1455
|
uint8_t config_id = 0;
|
1454
1456
|
};
|
1455
1457
|
|
@@ -1486,6 +1488,10 @@ enum ssl_client_hello_type_t {
|
|
1486
1488
|
ssl_client_hello_outer,
|
1487
1489
|
};
|
1488
1490
|
|
1491
|
+
// ECH_CLIENT_* are types for the ClientHello encrypted_client_hello extension.
|
1492
|
+
#define ECH_CLIENT_OUTER 0
|
1493
|
+
#define ECH_CLIENT_INNER 1
|
1494
|
+
|
1489
1495
|
// ssl_decode_client_hello_inner recovers the full ClientHelloInner from the
|
1490
1496
|
// EncodedClientHelloInner |encoded_client_hello_inner| by replacing its
|
1491
1497
|
// outer_extensions extension with the referenced extensions from the
|
@@ -1497,18 +1503,13 @@ OPENSSL_EXPORT bool ssl_decode_client_hello_inner(
|
|
1497
1503
|
Span<const uint8_t> encoded_client_hello_inner,
|
1498
1504
|
const SSL_CLIENT_HELLO *client_hello_outer);
|
1499
1505
|
|
1500
|
-
// ssl_client_hello_decrypt attempts to decrypt the
|
1501
|
-
//
|
1502
|
-
//
|
1503
|
-
//
|
1504
|
-
|
1505
|
-
// otherwise.
|
1506
|
-
bool ssl_client_hello_decrypt(EVP_HPKE_CTX *hpke_ctx,
|
1507
|
-
Array<uint8_t> *out_encoded_client_hello_inner,
|
1506
|
+
// ssl_client_hello_decrypt attempts to decrypt the |payload| and writes the
|
1507
|
+
// result to |*out|. |payload| must point into |client_hello_outer|. It returns
|
1508
|
+
// true on success and false on error. On error, it sets |*out_is_decrypt_error|
|
1509
|
+
// to whether the failure was due to a bad ciphertext.
|
1510
|
+
bool ssl_client_hello_decrypt(EVP_HPKE_CTX *hpke_ctx, Array<uint8_t> *out,
|
1508
1511
|
bool *out_is_decrypt_error,
|
1509
1512
|
const SSL_CLIENT_HELLO *client_hello_outer,
|
1510
|
-
uint16_t kdf_id, uint16_t aead_id,
|
1511
|
-
uint8_t config_id, Span<const uint8_t> enc,
|
1512
1513
|
Span<const uint8_t> payload);
|
1513
1514
|
|
1514
1515
|
#define ECH_CONFIRMATION_SIGNAL_LEN 8
|
@@ -1518,13 +1519,14 @@ bool ssl_client_hello_decrypt(EVP_HPKE_CTX *hpke_ctx,
|
|
1518
1519
|
size_t ssl_ech_confirmation_signal_hello_offset(const SSL *ssl);
|
1519
1520
|
|
1520
1521
|
// ssl_ech_accept_confirmation computes the server's ECH acceptance signal,
|
1521
|
-
// writing it to |out|. The
|
1522
|
-
// with |
|
1523
|
-
// |
|
1524
|
-
// on success, and false on failure.
|
1522
|
+
// writing it to |out|. The transcript portion is the concatenation of
|
1523
|
+
// |transcript| with |msg|. The |ECH_CONFIRMATION_SIGNAL_LEN| bytes from
|
1524
|
+
// |offset| in |msg| are replaced with zeros before hashing. This function
|
1525
|
+
// returns true on success, and false on failure.
|
1525
1526
|
bool ssl_ech_accept_confirmation(const SSL_HANDSHAKE *hs, Span<uint8_t> out,
|
1526
|
-
const
|
1527
|
-
|
1527
|
+
Span<const uint8_t> client_random,
|
1528
|
+
const SSLTranscript &transcript, bool is_hrr,
|
1529
|
+
Span<const uint8_t> msg, size_t offset);
|
1528
1530
|
|
1529
1531
|
// ssl_is_valid_ech_public_name returns true if |public_name| is a valid ECH
|
1530
1532
|
// public name and false otherwise. It is exported for testing.
|
@@ -1830,8 +1832,9 @@ struct SSL_HANDSHAKE {
|
|
1830
1832
|
// cookie is the value of the cookie received from the server, if any.
|
1831
1833
|
Array<uint8_t> cookie;
|
1832
1834
|
|
1833
|
-
//
|
1834
|
-
|
1835
|
+
// ech_client_outer contains the outer ECH extension to send in the
|
1836
|
+
// ClientHello, excluding the header and type byte.
|
1837
|
+
Array<uint8_t> ech_client_outer;
|
1835
1838
|
|
1836
1839
|
// ech_retry_configs, on the client, contains the retry configs from the
|
1837
1840
|
// server as a serialized ECHConfigList.
|
@@ -1939,13 +1942,9 @@ struct SSL_HANDSHAKE {
|
|
1939
1942
|
// influence the handshake on match.
|
1940
1943
|
UniquePtr<SSL_HANDSHAKE_HINTS> hints;
|
1941
1944
|
|
1942
|
-
//
|
1943
|
-
//
|
1944
|
-
bool
|
1945
|
-
|
1946
|
-
// ech_is_inner_present, on the server, indicates whether the ClientHello
|
1947
|
-
// contained an ech_is_inner extension.
|
1948
|
-
bool ech_is_inner_present : 1;
|
1945
|
+
// ech_is_inner, on the server, indicates whether the ClientHello contained an
|
1946
|
+
// inner ECH extension.
|
1947
|
+
bool ech_is_inner : 1;
|
1949
1948
|
|
1950
1949
|
// ech_authenticated_reject, on the client, indicates whether an ECH rejection
|
1951
1950
|
// handshake has been authenticated.
|
@@ -2163,6 +2162,22 @@ bool ssl_write_client_hello_without_extensions(const SSL_HANDSHAKE *hs,
|
|
2163
2162
|
// flight. It returns true on success and false on error.
|
2164
2163
|
bool ssl_add_client_hello(SSL_HANDSHAKE *hs);
|
2165
2164
|
|
2165
|
+
struct ParsedServerHello {
|
2166
|
+
CBS raw;
|
2167
|
+
uint16_t legacy_version = 0;
|
2168
|
+
CBS random;
|
2169
|
+
CBS session_id;
|
2170
|
+
uint16_t cipher_suite = 0;
|
2171
|
+
uint8_t compression_method = 0;
|
2172
|
+
CBS extensions;
|
2173
|
+
};
|
2174
|
+
|
2175
|
+
// ssl_parse_server_hello parses |msg| as a ServerHello. On success, it writes
|
2176
|
+
// the result to |*out| and returns true. Otherwise, it returns false and sets
|
2177
|
+
// |*out_alert| to an alert to send to the peer.
|
2178
|
+
bool ssl_parse_server_hello(ParsedServerHello *out, uint8_t *out_alert,
|
2179
|
+
const SSLMessage &msg);
|
2180
|
+
|
2166
2181
|
enum ssl_cert_verify_context_t {
|
2167
2182
|
ssl_cert_verify_server,
|
2168
2183
|
ssl_cert_verify_client,
|
@@ -2204,19 +2219,25 @@ bool ssl_get_local_application_settings(const SSL_HANDSHAKE *hs,
|
|
2204
2219
|
bool ssl_negotiate_alps(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
2205
2220
|
const SSL_CLIENT_HELLO *client_hello);
|
2206
2221
|
|
2207
|
-
struct
|
2222
|
+
struct SSLExtension {
|
2223
|
+
SSLExtension(uint16_t type_arg, bool allowed_arg = true)
|
2224
|
+
: type(type_arg), allowed(allowed_arg), present(false) {
|
2225
|
+
CBS_init(&data, nullptr, 0);
|
2226
|
+
}
|
2227
|
+
|
2208
2228
|
uint16_t type;
|
2209
|
-
bool
|
2210
|
-
|
2229
|
+
bool allowed;
|
2230
|
+
bool present;
|
2231
|
+
CBS data;
|
2211
2232
|
};
|
2212
2233
|
|
2213
2234
|
// ssl_parse_extensions parses a TLS extensions block out of |cbs| and advances
|
2214
|
-
// it. It writes the parsed extensions to pointers
|
2215
|
-
//
|
2216
|
-
//
|
2217
|
-
//
|
2235
|
+
// it. It writes the parsed extensions to pointers in |extensions|. On success,
|
2236
|
+
// it fills in the |present| and |data| fields and returns true. Otherwise, it
|
2237
|
+
// sets |*out_alert| to an alert to send and returns false. Unknown extensions
|
2238
|
+
// are rejected unless |ignore_unknown| is true.
|
2218
2239
|
bool ssl_parse_extensions(const CBS *cbs, uint8_t *out_alert,
|
2219
|
-
|
2240
|
+
std::initializer_list<SSLExtension *> extensions,
|
2220
2241
|
bool ignore_unknown);
|
2221
2242
|
|
2222
2243
|
// ssl_verify_peer_cert verifies the peer certificate for |hs|.
|
@@ -2255,6 +2276,9 @@ bool ssl_log_secret(const SSL *ssl, const char *label,
|
|
2255
2276
|
OPENSSL_EXPORT bool ssl_client_hello_init(const SSL *ssl, SSL_CLIENT_HELLO *out,
|
2256
2277
|
Span<const uint8_t> body);
|
2257
2278
|
|
2279
|
+
bool ssl_parse_client_hello_with_trailing_data(const SSL *ssl, CBS *cbs,
|
2280
|
+
SSL_CLIENT_HELLO *out);
|
2281
|
+
|
2258
2282
|
bool ssl_client_hello_get_extension(const SSL_CLIENT_HELLO *client_hello,
|
2259
2283
|
CBS *out, uint16_t extension_type);
|
2260
2284
|
|
@@ -2315,7 +2339,7 @@ bool tls12_check_peer_sigalg(const SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
|
2315
2339
|
|
2316
2340
|
#define TLSEXT_CHANNEL_ID_SIZE 128
|
2317
2341
|
|
2318
|
-
// From
|
2342
|
+
// From RFC 4492, used in encoding the curve type in ECParameters
|
2319
2343
|
#define NAMED_CURVE_TYPE 3
|
2320
2344
|
|
2321
2345
|
struct CERT {
|
@@ -3292,19 +3316,15 @@ bool tls1_set_curves_list(Array<uint16_t> *out_group_ids, const char *curves);
|
|
3292
3316
|
// ClientHello extension was the pre_shared_key extension and needs a PSK binder
|
3293
3317
|
// filled in. The caller should then update |out| and, if applicable,
|
3294
3318
|
// |out_encoded| with the binder after completing the whole message.
|
3295
|
-
//
|
3296
|
-
// If |omit_ech_len| is non-zero, the ECH extension is omitted, but padding is
|
3297
|
-
// computed as if there were an extension of length |omit_ech_len|. This is used
|
3298
|
-
// to compute ClientHelloOuterAAD.
|
3299
3319
|
bool ssl_add_clienthello_tlsext(SSL_HANDSHAKE *hs, CBB *out, CBB *out_encoded,
|
3300
3320
|
bool *out_needs_psk_binder,
|
3301
|
-
ssl_client_hello_type_t type,
|
3302
|
-
size_t
|
3321
|
+
ssl_client_hello_type_t type,
|
3322
|
+
size_t header_len);
|
3303
3323
|
|
3304
3324
|
bool ssl_add_serverhello_tlsext(SSL_HANDSHAKE *hs, CBB *out);
|
3305
3325
|
bool ssl_parse_clienthello_tlsext(SSL_HANDSHAKE *hs,
|
3306
3326
|
const SSL_CLIENT_HELLO *client_hello);
|
3307
|
-
bool ssl_parse_serverhello_tlsext(SSL_HANDSHAKE *hs, CBS *
|
3327
|
+
bool ssl_parse_serverhello_tlsext(SSL_HANDSHAKE *hs, const CBS *extensions);
|
3308
3328
|
|
3309
3329
|
#define tlsext_tick_md EVP_sha256
|
3310
3330
|
|
@@ -234,7 +234,7 @@ static constexpr SSL_CIPHER kCiphers[] = {
|
|
234
234
|
SSL_HANDSHAKE_MAC_DEFAULT,
|
235
235
|
},
|
236
236
|
|
237
|
-
// GCM ciphersuites from
|
237
|
+
// GCM ciphersuites from RFC 5288
|
238
238
|
|
239
239
|
// Cipher 9C
|
240
240
|
{
|
@@ -346,7 +346,7 @@ static constexpr SSL_CIPHER kCiphers[] = {
|
|
346
346
|
SSL_HANDSHAKE_MAC_DEFAULT,
|
347
347
|
},
|
348
348
|
|
349
|
-
// GCM based TLS v1.2 ciphersuites from
|
349
|
+
// GCM based TLS v1.2 ciphersuites from RFC 5289
|
350
350
|
|
351
351
|
// Cipher C02B
|
352
352
|
{
|
@@ -1023,7 +1023,7 @@ int SSL_read(SSL *ssl, void *buf, int num) {
|
|
1023
1023
|
int SSL_peek(SSL *ssl, void *buf, int num) {
|
1024
1024
|
if (ssl->quic_method != nullptr) {
|
1025
1025
|
OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
1026
|
-
return
|
1026
|
+
return -1;
|
1027
1027
|
}
|
1028
1028
|
|
1029
1029
|
int ret = ssl_read_impl(ssl);
|
@@ -1044,7 +1044,7 @@ int SSL_write(SSL *ssl, const void *buf, int num) {
|
|
1044
1044
|
|
1045
1045
|
if (ssl->quic_method != nullptr) {
|
1046
1046
|
OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
1047
|
-
return
|
1047
|
+
return -1;
|
1048
1048
|
}
|
1049
1049
|
|
1050
1050
|
if (ssl->do_handshake == NULL) {
|
@@ -158,20 +158,14 @@ bool SSLTranscript::Init() {
|
|
158
158
|
return true;
|
159
159
|
}
|
160
160
|
|
161
|
-
// InitDigestWithData calls |EVP_DigestInit_ex| on |ctx| with |md| and then
|
162
|
-
// writes the data in |buf| to it.
|
163
|
-
static bool InitDigestWithData(EVP_MD_CTX *ctx, const EVP_MD *md,
|
164
|
-
const BUF_MEM *buf) {
|
165
|
-
if (!EVP_DigestInit_ex(ctx, md, NULL)) {
|
166
|
-
return false;
|
167
|
-
}
|
168
|
-
EVP_DigestUpdate(ctx, buf->data, buf->length);
|
169
|
-
return true;
|
170
|
-
}
|
171
|
-
|
172
161
|
bool SSLTranscript::InitHash(uint16_t version, const SSL_CIPHER *cipher) {
|
173
162
|
const EVP_MD *md = ssl_get_handshake_digest(version, cipher);
|
174
|
-
|
163
|
+
if (Digest() == md) {
|
164
|
+
// No need to re-hash the buffer.
|
165
|
+
return true;
|
166
|
+
}
|
167
|
+
return EVP_DigestInit_ex(hash_.get(), md, nullptr) &&
|
168
|
+
EVP_DigestUpdate(hash_.get(), buffer_->data, buffer_->length);
|
175
169
|
}
|
176
170
|
|
177
171
|
void SSLTranscript::FreeBuffer() {
|
@@ -379,8 +379,9 @@ static bool ssl_crypto_x509_session_verify_cert_chain(SSL_SESSION *session,
|
|
379
379
|
const char *name;
|
380
380
|
size_t name_len;
|
381
381
|
SSL_get0_ech_name_override(ssl, &name, &name_len);
|
382
|
-
|
383
|
-
if (!
|
382
|
+
UniquePtr<X509_STORE_CTX> ctx(X509_STORE_CTX_new());
|
383
|
+
if (!ctx ||
|
384
|
+
!X509_STORE_CTX_init(ctx.get(), verify_store, leaf, cert_chain) ||
|
384
385
|
!X509_STORE_CTX_set_ex_data(ctx.get(),
|
385
386
|
SSL_get_ex_data_X509_STORE_CTX_idx(), ssl) ||
|
386
387
|
// We need to inherit the verify parameters. These can be determined by
|
@@ -411,11 +412,11 @@ static bool ssl_crypto_x509_session_verify_cert_chain(SSL_SESSION *session,
|
|
411
412
|
verify_ret = X509_verify_cert(ctx.get());
|
412
413
|
}
|
413
414
|
|
414
|
-
session->verify_result = ctx
|
415
|
+
session->verify_result = X509_STORE_CTX_get_error(ctx.get());
|
415
416
|
|
416
417
|
// If |SSL_VERIFY_NONE|, the error is non-fatal, but we keep the result.
|
417
418
|
if (verify_ret <= 0 && hs->config->verify_mode != SSL_VERIFY_NONE) {
|
418
|
-
*out_alert = SSL_alert_from_verify_result(
|
419
|
+
*out_alert = SSL_alert_from_verify_result(session->verify_result);
|
419
420
|
return false;
|
420
421
|
}
|
421
422
|
|
@@ -464,9 +465,9 @@ static bool ssl_crypto_x509_ssl_auto_chain_if_needed(SSL_HANDSHAKE *hs) {
|
|
464
465
|
return false;
|
465
466
|
}
|
466
467
|
|
467
|
-
|
468
|
-
if (!X509_STORE_CTX_init(ctx.get(), hs->ssl->ctx->cert_store,
|
469
|
-
|
468
|
+
UniquePtr<X509_STORE_CTX> ctx(X509_STORE_CTX_new());
|
469
|
+
if (!ctx || !X509_STORE_CTX_init(ctx.get(), hs->ssl->ctx->cert_store,
|
470
|
+
leaf.get(), nullptr)) {
|
470
471
|
OPENSSL_PUT_ERROR(SSL, ERR_R_X509_LIB);
|
471
472
|
return false;
|
472
473
|
}
|
@@ -476,9 +477,13 @@ static bool ssl_crypto_x509_ssl_auto_chain_if_needed(SSL_HANDSHAKE *hs) {
|
|
476
477
|
ERR_clear_error();
|
477
478
|
|
478
479
|
// Remove the leaf from the generated chain.
|
479
|
-
|
480
|
+
UniquePtr<STACK_OF(X509)> chain(X509_STORE_CTX_get1_chain(ctx.get()));
|
481
|
+
if (!chain) {
|
482
|
+
return false;
|
483
|
+
}
|
484
|
+
X509_free(sk_X509_shift(chain.get()));
|
480
485
|
|
481
|
-
if (!ssl_cert_set_chain(hs->config->cert.get(),
|
486
|
+
if (!ssl_cert_set_chain(hs->config->cert.get(), chain.get())) {
|
482
487
|
return false;
|
483
488
|
}
|
484
489
|
|
@@ -706,13 +711,6 @@ int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *ca_file,
|
|
706
711
|
return X509_STORE_load_locations(ctx->cert_store, ca_file, ca_dir);
|
707
712
|
}
|
708
713
|
|
709
|
-
void SSL_set_verify_result(SSL *ssl, long result) {
|
710
|
-
check_ssl_x509_method(ssl);
|
711
|
-
if (result != X509_V_OK) {
|
712
|
-
abort();
|
713
|
-
}
|
714
|
-
}
|
715
|
-
|
716
714
|
long SSL_get_verify_result(const SSL *ssl) {
|
717
715
|
check_ssl_x509_method(ssl);
|
718
716
|
SSL_SESSION *session = SSL_get_session(ssl);
|
@@ -235,15 +235,14 @@ bool tls13_process_certificate(SSL_HANDSHAKE *hs, const SSLMessage &msg,
|
|
235
235
|
}
|
236
236
|
|
237
237
|
// Parse out the extensions.
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
238
|
+
SSLExtension status_request(
|
239
|
+
TLSEXT_TYPE_status_request,
|
240
|
+
!ssl->server && hs->config->ocsp_stapling_enabled);
|
241
|
+
SSLExtension sct(
|
242
|
+
TLSEXT_TYPE_certificate_timestamp,
|
243
|
+
!ssl->server && hs->config->signed_cert_timestamps_enabled);
|
245
244
|
uint8_t alert = SSL_AD_DECODE_ERROR;
|
246
|
-
if (!ssl_parse_extensions(&extensions, &alert,
|
245
|
+
if (!ssl_parse_extensions(&extensions, &alert, {&status_request, &sct},
|
247
246
|
/*ignore_unknown=*/false)) {
|
248
247
|
ssl_send_alert(ssl, SSL3_AL_FATAL, alert);
|
249
248
|
return false;
|
@@ -251,20 +250,14 @@ bool tls13_process_certificate(SSL_HANDSHAKE *hs, const SSLMessage &msg,
|
|
251
250
|
|
252
251
|
// All Certificate extensions are parsed, but only the leaf extensions are
|
253
252
|
// stored.
|
254
|
-
if (
|
255
|
-
if (ssl->server || !hs->config->ocsp_stapling_enabled) {
|
256
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_UNEXPECTED_EXTENSION);
|
257
|
-
ssl_send_alert(ssl, SSL3_AL_FATAL, SSL_AD_UNSUPPORTED_EXTENSION);
|
258
|
-
return false;
|
259
|
-
}
|
260
|
-
|
253
|
+
if (status_request.present) {
|
261
254
|
uint8_t status_type;
|
262
255
|
CBS ocsp_response;
|
263
|
-
if (!CBS_get_u8(&status_request, &status_type) ||
|
256
|
+
if (!CBS_get_u8(&status_request.data, &status_type) ||
|
264
257
|
status_type != TLSEXT_STATUSTYPE_ocsp ||
|
265
|
-
!CBS_get_u24_length_prefixed(&status_request, &ocsp_response) ||
|
258
|
+
!CBS_get_u24_length_prefixed(&status_request.data, &ocsp_response) ||
|
266
259
|
CBS_len(&ocsp_response) == 0 ||
|
267
|
-
CBS_len(&status_request) != 0) {
|
260
|
+
CBS_len(&status_request.data) != 0) {
|
268
261
|
ssl_send_alert(ssl, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);
|
269
262
|
return false;
|
270
263
|
}
|
@@ -279,14 +272,8 @@ bool tls13_process_certificate(SSL_HANDSHAKE *hs, const SSLMessage &msg,
|
|
279
272
|
}
|
280
273
|
}
|
281
274
|
|
282
|
-
if (
|
283
|
-
if (
|
284
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_UNEXPECTED_EXTENSION);
|
285
|
-
ssl_send_alert(ssl, SSL3_AL_FATAL, SSL_AD_UNSUPPORTED_EXTENSION);
|
286
|
-
return false;
|
287
|
-
}
|
288
|
-
|
289
|
-
if (!ssl_is_sct_list_valid(&sct)) {
|
275
|
+
if (sct.present) {
|
276
|
+
if (!ssl_is_sct_list_valid(&sct.data)) {
|
290
277
|
OPENSSL_PUT_ERROR(SSL, SSL_R_ERROR_PARSING_EXTENSION);
|
291
278
|
ssl_send_alert(ssl, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);
|
292
279
|
return false;
|
@@ -294,7 +281,7 @@ bool tls13_process_certificate(SSL_HANDSHAKE *hs, const SSLMessage &msg,
|
|
294
281
|
|
295
282
|
if (sk_CRYPTO_BUFFER_num(certs.get()) == 1) {
|
296
283
|
hs->new_session->signed_cert_timestamp_list.reset(
|
297
|
-
CRYPTO_BUFFER_new_from_CBS(&sct, ssl->ctx->pool));
|
284
|
+
CRYPTO_BUFFER_new_from_CBS(&sct.data, ssl->ctx->pool));
|
298
285
|
if (hs->new_session->signed_cert_timestamp_list == nullptr) {
|
299
286
|
ssl_send_alert(ssl, SSL3_AL_FATAL, SSL_AD_INTERNAL_ERROR);
|
300
287
|
return false;
|