Latest update
This commit is contained in:
@@ -1530,10 +1530,12 @@ int tls_psk_do_binder(SSL *s, const EVP_MD *md, const unsigned char *msgstart,
|
||||
*/
|
||||
if (s->hello_retry_request == SSL_HRR_PENDING) {
|
||||
size_t hdatalen;
|
||||
long hdatalen_l;
|
||||
void *hdata;
|
||||
|
||||
hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata);
|
||||
if (hdatalen <= 0) {
|
||||
hdatalen = hdatalen_l =
|
||||
BIO_get_mem_data(s->s3->handshake_buffer, &hdata);
|
||||
if (hdatalen_l <= 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PSK_DO_BINDER,
|
||||
SSL_R_BAD_HANDSHAKE_LENGTH);
|
||||
goto err;
|
||||
|
||||
@@ -1095,6 +1095,7 @@ WORK_STATE ossl_statem_client_post_process_message(SSL *s, WORK_STATE wst)
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
return WORK_ERROR;
|
||||
|
||||
case TLS_ST_CR_CERT_VRFY:
|
||||
case TLS_ST_CR_CERT_REQ:
|
||||
return tls_prepare_client_certificate(s, wst);
|
||||
}
|
||||
@@ -2563,6 +2564,17 @@ MSG_PROCESS_RETURN tls_process_certificate_request(SSL *s, PACKET *pkt)
|
||||
/* we should setup a certificate to return.... */
|
||||
s->s3->tmp.cert_req = 1;
|
||||
|
||||
/*
|
||||
* In TLSv1.3 we don't prepare the client certificate yet. We wait until
|
||||
* after the CertificateVerify message has been received. This is because
|
||||
* in TLSv1.3 the CertificateRequest arrives before the Certificate message
|
||||
* but in TLSv1.2 it is the other way around. We want to make sure that
|
||||
* SSL_get_peer_certificate() returns something sensible in
|
||||
* client_cert_cb.
|
||||
*/
|
||||
if (SSL_IS_TLS13(s) && s->post_handshake_auth != SSL_PHA_REQUESTED)
|
||||
return MSG_PROCESS_CONTINUE_READING;
|
||||
|
||||
return MSG_PROCESS_CONTINUE_PROCESSING;
|
||||
}
|
||||
|
||||
|
||||
+15
-3
@@ -203,9 +203,10 @@ static int get_cert_verify_tbs_data(SSL *s, unsigned char *tls13tbs,
|
||||
*hdatalen = TLS13_TBS_PREAMBLE_SIZE + hashlen;
|
||||
} else {
|
||||
size_t retlen;
|
||||
long retlen_l;
|
||||
|
||||
retlen = BIO_get_mem_data(s->s3->handshake_buffer, hdata);
|
||||
if (retlen <= 0) {
|
||||
retlen = retlen_l = BIO_get_mem_data(s->s3->handshake_buffer, hdata);
|
||||
if (retlen_l <= 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_GET_CERT_VERIFY_TBS_DATA,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
return 0;
|
||||
@@ -494,7 +495,18 @@ MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt)
|
||||
}
|
||||
}
|
||||
|
||||
ret = MSG_PROCESS_CONTINUE_READING;
|
||||
/*
|
||||
* In TLSv1.3 on the client side we make sure we prepare the client
|
||||
* certificate after the CertVerify instead of when we get the
|
||||
* CertificateRequest. This is because in TLSv1.3 the CertificateRequest
|
||||
* comes *before* the Certificate message. In TLSv1.2 it comes after. We
|
||||
* want to make sure that SSL_get_peer_certificate() will return the actual
|
||||
* server certificate from the client_cert_cb callback.
|
||||
*/
|
||||
if (!s->server && SSL_IS_TLS13(s) && s->s3->tmp.cert_req == 1)
|
||||
ret = MSG_PROCESS_CONTINUE_PROCESSING;
|
||||
else
|
||||
ret = MSG_PROCESS_CONTINUE_READING;
|
||||
err:
|
||||
BIO_free(s->s3->handshake_buffer);
|
||||
s->s3->handshake_buffer = NULL;
|
||||
|
||||
@@ -1519,8 +1519,10 @@ MSG_PROCESS_RETURN tls_process_client_hello(SSL *s, PACKET *pkt)
|
||||
* So check cookie length...
|
||||
*/
|
||||
if (SSL_get_options(s) & SSL_OP_COOKIE_EXCHANGE) {
|
||||
if (clienthello->dtls_cookie_len == 0)
|
||||
if (clienthello->dtls_cookie_len == 0) {
|
||||
OPENSSL_free(clienthello);
|
||||
return MSG_PROCESS_FINISHED_READING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3225,6 +3227,12 @@ static int tls_process_cke_ecdhe(SSL *s, PACKET *pkt)
|
||||
SSL_R_LENGTH_MISMATCH);
|
||||
goto err;
|
||||
}
|
||||
if (skey == NULL) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CKE_ECDHE,
|
||||
SSL_R_MISSING_TMP_ECDH_KEY);
|
||||
goto err;
|
||||
}
|
||||
|
||||
ckey = EVP_PKEY_new();
|
||||
if (ckey == NULL || EVP_PKEY_copy_parameters(ckey, skey) <= 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CKE_ECDHE,
|
||||
|
||||
Reference in New Issue
Block a user