Latest update.
This commit is contained in:
@@ -1595,7 +1595,8 @@ int tls_psk_do_binder(SSL *s, const EVP_MD *md, const unsigned char *msgstart,
|
||||
binderout = tmpbinder;
|
||||
|
||||
bindersize = hashsize;
|
||||
if (EVP_DigestSignInit(mctx, NULL, md, NULL, mackey) <= 0
|
||||
if (EVP_DigestSignInit_ex(mctx, NULL, EVP_MD_name(md), s->ctx->propq,
|
||||
mackey, s->ctx->libctx) <= 0
|
||||
|| EVP_DigestSignUpdate(mctx, hash, hashsize) <= 0
|
||||
|| EVP_DigestSignFinal(mctx, binderout, &bindersize) <= 0
|
||||
|| bindersize != hashsize) {
|
||||
|
||||
@@ -644,6 +644,21 @@ static int add_key_share(SSL *s, WPACKET *pkt, unsigned int curve_id)
|
||||
/* SSLfatal() already called */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO(3.0) Remove this when EVP_PKEY_get1_tls_encodedpoint()
|
||||
* knows how to get a key from an encoded point with the help of
|
||||
* a OSSL_SERIALIZER deserializer. We know that EVP_PKEY_get0()
|
||||
* downgrades an EVP_PKEY to contain a legacy key.
|
||||
*
|
||||
* THIS IS TEMPORARY
|
||||
*/
|
||||
EVP_PKEY_get0(key_share_key);
|
||||
if (EVP_PKEY_id(key_share_key) == EVP_PKEY_NONE) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_ADD_KEY_SHARE,
|
||||
ERR_R_EC_LIB);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
/* Encode the public key. */
|
||||
@@ -1906,6 +1921,23 @@ int tls_parse_stoc_key_share(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
|
||||
ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO(3.0) Remove this when EVP_PKEY_get1_tls_encodedpoint()
|
||||
* knows how to get a key from an encoded point with the help of
|
||||
* a OSSL_SERIALIZER deserializer. We know that EVP_PKEY_get0()
|
||||
* downgrades an EVP_PKEY to contain a legacy key.
|
||||
*
|
||||
* THIS IS TEMPORARY
|
||||
*/
|
||||
EVP_PKEY_get0(skey);
|
||||
if (EVP_PKEY_id(skey) == EVP_PKEY_NONE) {
|
||||
EVP_PKEY_free(skey);
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PARSE_STOC_KEY_SHARE,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!EVP_PKEY_set1_tls_encodedpoint(skey, PACKET_data(&encoded_pt),
|
||||
PACKET_remaining(&encoded_pt))) {
|
||||
SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_F_TLS_PARSE_STOC_KEY_SHARE,
|
||||
|
||||
@@ -711,6 +711,21 @@ int tls_parse_ctos_key_share(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO(3.0) Remove this when EVP_PKEY_get1_tls_encodedpoint()
|
||||
* knows how to get a key from an encoded point with the help of
|
||||
* a OSSL_SERIALIZER deserializer. We know that EVP_PKEY_get0()
|
||||
* downgrades an EVP_PKEY to contain a legacy key.
|
||||
*
|
||||
* THIS IS TEMPORARY
|
||||
*/
|
||||
EVP_PKEY_get0(s->s3.peer_tmp);
|
||||
if (EVP_PKEY_id(s->s3.peer_tmp) == EVP_PKEY_NONE) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PARSE_CTOS_KEY_SHARE,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s->s3.group_id = group_id;
|
||||
|
||||
if (!EVP_PKEY_set1_tls_encodedpoint(s->s3.peer_tmp,
|
||||
@@ -780,7 +795,8 @@ int tls_parse_ctos_cookie(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
|
||||
}
|
||||
|
||||
hmaclen = SHA256_DIGEST_LENGTH;
|
||||
if (EVP_DigestSignInit(hctx, NULL, EVP_sha256(), NULL, pkey) <= 0
|
||||
if (EVP_DigestSignInit_ex(hctx, NULL, "SHA2-256", s->ctx->propq, pkey,
|
||||
s->ctx->libctx) <= 0
|
||||
|| EVP_DigestSign(hctx, hmac, &hmaclen, data,
|
||||
rawlen - SHA256_DIGEST_LENGTH) <= 0
|
||||
|| hmaclen != SHA256_DIGEST_LENGTH) {
|
||||
@@ -1734,6 +1750,21 @@ EXT_RETURN tls_construct_stoc_key_share(SSL *s, WPACKET *pkt,
|
||||
return EXT_RETURN_FAIL;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO(3.0) Remove this when EVP_PKEY_get1_tls_encodedpoint()
|
||||
* knows how to get a key from an encoded point with the help of
|
||||
* a OSSL_SERIALIZER deserializer. We know that EVP_PKEY_get0()
|
||||
* downgrades an EVP_PKEY to contain a legacy key.
|
||||
*
|
||||
* THIS IS TEMPORARY
|
||||
*/
|
||||
EVP_PKEY_get0(skey);
|
||||
if (EVP_PKEY_id(skey) == EVP_PKEY_NONE) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_STOC_KEY_SHARE,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
return EXT_RETURN_FAIL;
|
||||
}
|
||||
|
||||
/* Generate encoding of server key */
|
||||
encoded_pt_len = EVP_PKEY_get1_tls_encodedpoint(skey, &encodedPoint);
|
||||
if (encoded_pt_len == 0) {
|
||||
@@ -1863,7 +1894,8 @@ EXT_RETURN tls_construct_stoc_cookie(SSL *s, WPACKET *pkt, unsigned int context,
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (EVP_DigestSignInit(hctx, NULL, EVP_sha256(), NULL, pkey) <= 0
|
||||
if (EVP_DigestSignInit_ex(hctx, NULL, "SHA2-256", s->ctx->propq, pkey,
|
||||
s->ctx->libctx) <= 0
|
||||
|| EVP_DigestSign(hctx, hmac, &hmaclen, cookie,
|
||||
totcookielen) <= 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_STOC_COOKIE,
|
||||
|
||||
@@ -2152,9 +2152,10 @@ static int tls_process_ske_dhe(SSL *s, PACKET *pkt, EVP_PKEY **pkey)
|
||||
ERR_R_EVP_LIB);
|
||||
goto err;
|
||||
}
|
||||
dh = NULL;
|
||||
|
||||
if (!ssl_security(s, SSL_SECOP_TMP_DH, EVP_PKEY_security_bits(peer_tmp),
|
||||
0, dh)) {
|
||||
0, EVP_PKEY_get0_DH(peer_tmp))) {
|
||||
SSLfatal(s, SSL_AD_HANDSHAKE_FAILURE, SSL_F_TLS_PROCESS_SKE_DHE,
|
||||
SSL_R_DH_KEY_TOO_SMALL);
|
||||
goto err;
|
||||
@@ -2226,6 +2227,21 @@ static int tls_process_ske_ecdhe(SSL *s, PACKET *pkt, EVP_PKEY **pkey)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO(3.0) Remove this when EVP_PKEY_get1_tls_encodedpoint()
|
||||
* knows how to get a key from an encoded point with the help of
|
||||
* a OSSL_SERIALIZER deserializer. We know that EVP_PKEY_get0()
|
||||
* downgrades an EVP_PKEY to contain a legacy key.
|
||||
*
|
||||
* THIS IS TEMPORARY
|
||||
*/
|
||||
EVP_PKEY_get0(s->s3.peer_tmp);
|
||||
if (EVP_PKEY_id(s->s3.peer_tmp) == EVP_PKEY_NONE) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_SKE_ECDHE,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!EVP_PKEY_set1_tls_encodedpoint(s->s3.peer_tmp,
|
||||
PACKET_data(&encoded_pt),
|
||||
PACKET_remaining(&encoded_pt))) {
|
||||
@@ -2361,7 +2377,9 @@ MSG_PROCESS_RETURN tls_process_key_exchange(SSL *s, PACKET *pkt)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (EVP_DigestVerifyInit(md_ctx, &pctx, md, NULL, pkey) <= 0) {
|
||||
if (EVP_DigestVerifyInit_ex(md_ctx, &pctx,
|
||||
md == NULL ? NULL : EVP_MD_name(md),
|
||||
s->ctx->propq, pkey, s->ctx->libctx) <= 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_KEY_EXCHANGE,
|
||||
ERR_R_EVP_LIB);
|
||||
goto err;
|
||||
@@ -2560,6 +2578,7 @@ MSG_PROCESS_RETURN tls_process_new_session_ticket(SSL *s, PACKET *pkt)
|
||||
unsigned int sess_len;
|
||||
RAW_EXTENSION *exts = NULL;
|
||||
PACKET nonce;
|
||||
EVP_MD *sha256 = NULL;
|
||||
|
||||
PACKET_null_init(&nonce);
|
||||
|
||||
@@ -2675,20 +2694,28 @@ MSG_PROCESS_RETURN tls_process_new_session_ticket(SSL *s, PACKET *pkt)
|
||||
* other way is to set zero length session ID when the ticket is
|
||||
* presented and rely on the handshake to determine session resumption.
|
||||
* We choose the former approach because this fits in with assumptions
|
||||
* elsewhere in OpenSSL. The session ID is set to the SHA256 (or SHA1 is
|
||||
* SHA256 is disabled) hash of the ticket.
|
||||
* elsewhere in OpenSSL. The session ID is set to the SHA256 hash of the
|
||||
* ticket.
|
||||
*/
|
||||
sha256 = EVP_MD_fetch(s->ctx->libctx, "SHA2-256", s->ctx->propq);
|
||||
if (sha256 == NULL) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_NEW_SESSION_TICKET,
|
||||
SSL_R_ALGORITHM_FETCH_FAILED);
|
||||
goto err;
|
||||
}
|
||||
/*
|
||||
* TODO(size_t): we use sess_len here because EVP_Digest expects an int
|
||||
* but s->session->session_id_length is a size_t
|
||||
*/
|
||||
if (!EVP_Digest(s->session->ext.tick, ticklen,
|
||||
s->session->session_id, &sess_len,
|
||||
EVP_sha256(), NULL)) {
|
||||
sha256, NULL)) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_NEW_SESSION_TICKET,
|
||||
ERR_R_EVP_LIB);
|
||||
goto err;
|
||||
}
|
||||
EVP_MD_free(sha256);
|
||||
sha256 = NULL;
|
||||
s->session->session_id_length = sess_len;
|
||||
s->session->not_resumable = 0;
|
||||
|
||||
@@ -2727,6 +2754,7 @@ MSG_PROCESS_RETURN tls_process_new_session_ticket(SSL *s, PACKET *pkt)
|
||||
|
||||
return MSG_PROCESS_CONTINUE_READING;
|
||||
err:
|
||||
EVP_MD_free(sha256);
|
||||
OPENSSL_free(exts);
|
||||
return MSG_PROCESS_ERROR;
|
||||
}
|
||||
@@ -2990,7 +3018,8 @@ static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt)
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
goto err;
|
||||
}
|
||||
pctx = EVP_PKEY_CTX_new(pkey, NULL);
|
||||
|
||||
pctx = EVP_PKEY_CTX_new_from_pkey(s->ctx->libctx, pkey, s->ctx->propq);
|
||||
if (pctx == NULL || EVP_PKEY_encrypt_init(pctx) <= 0
|
||||
|| EVP_PKEY_encrypt(pctx, NULL, &enclen, pms, pmslen) <= 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
|
||||
@@ -3115,6 +3144,21 @@ static int tls_construct_cke_ecdhe(SSL *s, WPACKET *pkt)
|
||||
goto err;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO(3.0) Remove this when EVP_PKEY_get1_tls_encodedpoint()
|
||||
* knows how to get a key from an encoded point with the help of
|
||||
* a OSSL_SERIALIZER deserializer. We know that EVP_PKEY_get0()
|
||||
* downgrades an EVP_PKEY to contain a legacy key.
|
||||
*
|
||||
* THIS IS TEMPORARY
|
||||
*/
|
||||
EVP_PKEY_get0(ckey);
|
||||
if (EVP_PKEY_id(skey) == EVP_PKEY_NONE) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_ECDHE,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (ssl_derive(s, ckey, skey, 0) == 0) {
|
||||
/* SSLfatal() already called */
|
||||
goto err;
|
||||
|
||||
+14
-9
@@ -14,6 +14,7 @@
|
||||
#include "../ssl_local.h"
|
||||
#include "statem_local.h"
|
||||
#include "internal/cryptlib.h"
|
||||
#include "internal/evp.h"
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/evp.h>
|
||||
@@ -272,7 +273,9 @@ int tls_construct_cert_verify(SSL *s, WPACKET *pkt)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (EVP_DigestSignInit(mctx, &pctx, md, NULL, pkey) <= 0) {
|
||||
if (EVP_DigestSignInit_ex(mctx, &pctx,
|
||||
md == NULL ? NULL : EVP_MD_name(md),
|
||||
s->ctx->propq, pkey, s->ctx->libctx) <= 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CERT_VERIFY,
|
||||
ERR_R_EVP_LIB);
|
||||
goto err;
|
||||
@@ -465,7 +468,9 @@ MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt)
|
||||
OSSL_TRACE1(TLS, "Using client verify alg %s\n",
|
||||
md == NULL ? "n/a" : EVP_MD_name(md));
|
||||
|
||||
if (EVP_DigestVerifyInit(mctx, &pctx, md, NULL, pkey) <= 0) {
|
||||
if (EVP_DigestVerifyInit_ex(mctx, &pctx,
|
||||
md == NULL ? NULL : EVP_MD_name(md),
|
||||
s->ctx->propq, pkey, s->ctx->libctx) <= 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY,
|
||||
ERR_R_EVP_LIB);
|
||||
goto err;
|
||||
@@ -860,9 +865,11 @@ MSG_PROCESS_RETURN tls_process_finished(SSL *s, PACKET *pkt)
|
||||
return MSG_PROCESS_ERROR;
|
||||
}
|
||||
} else {
|
||||
/* TLS 1.3 gets the secret size from the handshake md */
|
||||
size_t dummy;
|
||||
if (!s->method->ssl3_enc->generate_master_secret(s,
|
||||
s->master_secret, s->handshake_secret, 0,
|
||||
&s->session->master_key_length)) {
|
||||
&dummy)) {
|
||||
/* SSLfatal() already called */
|
||||
return MSG_PROCESS_ERROR;
|
||||
}
|
||||
@@ -951,7 +958,8 @@ static int ssl_add_cert_chain(SSL *s, WPACKET *pkt, CERT_PKEY *cpk)
|
||||
chain_store = s->ctx->cert_store;
|
||||
|
||||
if (chain_store != NULL) {
|
||||
X509_STORE_CTX *xs_ctx = X509_STORE_CTX_new();
|
||||
X509_STORE_CTX *xs_ctx = X509_STORE_CTX_new_with_libctx(s->ctx->libctx,
|
||||
s->ctx->propq);
|
||||
|
||||
if (xs_ctx == NULL) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL_ADD_CERT_CHAIN,
|
||||
@@ -1525,7 +1533,6 @@ static int is_tls13_capable(const SSL *s)
|
||||
int i;
|
||||
#ifndef OPENSSL_NO_EC
|
||||
int curve;
|
||||
EC_KEY *eckey;
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_PSK
|
||||
@@ -1557,10 +1564,8 @@ static int is_tls13_capable(const SSL *s)
|
||||
* more restrictive so check that our sig algs are consistent with this
|
||||
* EC cert. See section 4.2.3 of RFC8446.
|
||||
*/
|
||||
eckey = EVP_PKEY_get0_EC_KEY(s->cert->pkeys[SSL_PKEY_ECC].privatekey);
|
||||
if (eckey == NULL)
|
||||
continue;
|
||||
curve = EC_GROUP_get_curve_name(EC_KEY_get0_group(eckey));
|
||||
curve = evp_pkey_get_EC_KEY_curve_nid(s->cert->pkeys[SSL_PKEY_ECC]
|
||||
.privatekey);
|
||||
if (tls_check_sigalg_curve(s, curve))
|
||||
return 1;
|
||||
#else
|
||||
|
||||
@@ -744,7 +744,15 @@ WORK_STATE ossl_statem_server_pre_work(SSL *s, WORK_STATE wst)
|
||||
case TLS_ST_SW_CHANGE:
|
||||
if (SSL_IS_TLS13(s))
|
||||
break;
|
||||
s->session->cipher = s->s3.tmp.new_cipher;
|
||||
/* Writes to s->session are only safe for initial handshakes */
|
||||
if (s->session->cipher == NULL) {
|
||||
s->session->cipher = s->s3.tmp.new_cipher;
|
||||
} else if (s->session->cipher != s->s3.tmp.new_cipher) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_OSSL_STATEM_SERVER_PRE_WORK,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
return WORK_ERROR;
|
||||
}
|
||||
if (!s->method->ssl3_enc->setup_key_block(s)) {
|
||||
/* SSLfatal() already called */
|
||||
return WORK_ERROR;
|
||||
@@ -948,9 +956,11 @@ WORK_STATE ossl_statem_server_post_work(SSL *s, WORK_STATE wst)
|
||||
}
|
||||
#endif
|
||||
if (SSL_IS_TLS13(s)) {
|
||||
/* TLS 1.3 gets the secret size from the handshake md */
|
||||
size_t dummy;
|
||||
if (!s->method->ssl3_enc->generate_master_secret(s,
|
||||
s->master_secret, s->handshake_secret, 0,
|
||||
&s->session->master_key_length)
|
||||
&dummy)
|
||||
|| !s->method->ssl3_enc->change_cipher_state(s,
|
||||
SSL3_CC_APPLICATION | SSL3_CHANGE_CIPHER_SERVER_WRITE))
|
||||
/* SSLfatal() already called */
|
||||
@@ -2615,6 +2625,18 @@ int tls_construct_server_key_exchange(SSL *s, WPACKET *pkt)
|
||||
goto err;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO(3.0) Remove this when EVP_PKEY_get1_tls_encodedpoint()
|
||||
* knows how to get a key from an encoded point with the help of
|
||||
* a OSSL_SERIALIZER deserializer. We know that EVP_PKEY_get0()
|
||||
* downgrades an EVP_PKEY to contain a legacy key.
|
||||
*
|
||||
* THIS IS TEMPORARY
|
||||
*/
|
||||
EVP_PKEY_get0(s->s3.tmp.pkey);
|
||||
if (EVP_PKEY_id(s->s3.tmp.pkey) == EVP_PKEY_NONE)
|
||||
goto err;
|
||||
|
||||
/* Encode the public key. */
|
||||
encodedlen = EVP_PKEY_get1_tls_encodedpoint(s->s3.tmp.pkey,
|
||||
&encodedPoint);
|
||||
@@ -2786,7 +2808,9 @@ int tls_construct_server_key_exchange(SSL *s, WPACKET *pkt)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (EVP_DigestSignInit(md_ctx, &pctx, md, NULL, pkey) <= 0) {
|
||||
if (EVP_DigestSignInit_ex(md_ctx, &pctx,
|
||||
md == NULL ? NULL : EVP_MD_name(md),
|
||||
s->ctx->propq, pkey, s->ctx->libctx) <= 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
@@ -3196,6 +3220,22 @@ static int tls_process_cke_ecdhe(SSL *s, PACKET *pkt)
|
||||
ERR_R_EVP_LIB);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO(3.0) Remove this when EVP_PKEY_get1_tls_encodedpoint()
|
||||
* knows how to get a key from an encoded point with the help of
|
||||
* a OSSL_SERIALIZER deserializer. We know that EVP_PKEY_get0()
|
||||
* downgrades an EVP_PKEY to contain a legacy key.
|
||||
*
|
||||
* THIS IS TEMPORARY
|
||||
*/
|
||||
EVP_PKEY_get0(ckey);
|
||||
if (EVP_PKEY_id(ckey) == EVP_PKEY_NONE) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CKE_ECDHE,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (EVP_PKEY_set1_tls_encodedpoint(ckey, data, i) == 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CKE_ECDHE,
|
||||
ERR_R_EC_LIB);
|
||||
@@ -3897,7 +3937,14 @@ static int construct_stateless_ticket(SSL *s, WPACKET *pkt, uint32_t age_add,
|
||||
}
|
||||
iv_len = EVP_CIPHER_CTX_iv_length(ctx);
|
||||
} else {
|
||||
const EVP_CIPHER *cipher = EVP_aes_256_cbc();
|
||||
EVP_CIPHER *cipher = EVP_CIPHER_fetch(s->ctx->libctx, "AES-256-CBC",
|
||||
s->ctx->propq);
|
||||
|
||||
if (cipher == NULL) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_CONSTRUCT_STATELESS_TICKET,
|
||||
SSL_R_ALGORITHM_FETCH_FAILED);
|
||||
goto err;
|
||||
}
|
||||
|
||||
iv_len = EVP_CIPHER_iv_length(cipher);
|
||||
if (RAND_bytes_ex(s->ctx->libctx, iv, iv_len) <= 0
|
||||
@@ -3906,10 +3953,12 @@ static int construct_stateless_ticket(SSL *s, WPACKET *pkt, uint32_t age_add,
|
||||
|| !ssl_hmac_init(hctx, tctx->ext.secure->tick_hmac_key,
|
||||
sizeof(tctx->ext.secure->tick_hmac_key),
|
||||
"SHA256")) {
|
||||
EVP_CIPHER_free(cipher);
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_CONSTRUCT_STATELESS_TICKET,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
goto err;
|
||||
}
|
||||
EVP_CIPHER_free(cipher);
|
||||
memcpy(key_name, tctx->ext.tick_key_name,
|
||||
sizeof(tctx->ext.tick_key_name));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user