mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-07 06:42:56 +03:00
Rm dead !USE_PSA code: ssl_tls13_xxx (part 1)
unifdef -m -DMBEDTLS_USE_PSA_CRYPTO library/ssl_tls13*.c Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
@@ -435,9 +435,7 @@ static int ssl_tls13_offered_psks_check_binder_match(
|
||||
psk, psk_len, psk_type,
|
||||
transcript,
|
||||
server_computed_binder);
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
mbedtls_free((void *) psk);
|
||||
#endif
|
||||
if (ret != 0) {
|
||||
MBEDTLS_SSL_DEBUG_MSG(1, ("PSK binder calculation failed."));
|
||||
return MBEDTLS_ERR_SSL_HANDSHAKE_FAILURE;
|
||||
@@ -739,11 +737,7 @@ static int ssl_tls13_write_server_pre_shared_key_ext(mbedtls_ssl_context *ssl,
|
||||
*olen = 0;
|
||||
|
||||
int not_using_psk = 0;
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
not_using_psk = (mbedtls_svc_key_id_is_null(ssl->handshake->psk_opaque));
|
||||
#else
|
||||
not_using_psk = (ssl->handshake->psk == NULL);
|
||||
#endif
|
||||
if (not_using_psk) {
|
||||
/* We shouldn't have called this extension writer unless we've
|
||||
* chosen to use a PSK. */
|
||||
@@ -1078,7 +1072,6 @@ static int ssl_tls13_key_exchange_is_ephemeral_available(mbedtls_ssl_context *ss
|
||||
#if defined(MBEDTLS_X509_CRT_PARSE_C) && \
|
||||
defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED)
|
||||
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
static psa_algorithm_t ssl_tls13_iana_sig_alg_to_psa_alg(uint16_t sig_alg)
|
||||
{
|
||||
switch (sig_alg) {
|
||||
@@ -1104,7 +1097,6 @@ static psa_algorithm_t ssl_tls13_iana_sig_alg_to_psa_alg(uint16_t sig_alg)
|
||||
return PSA_ALG_NONE;
|
||||
}
|
||||
}
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
/*
|
||||
* Pick best ( private key, certificate chain ) pair based on the signature
|
||||
@@ -1139,9 +1131,7 @@ static int ssl_tls13_pick_key_cert(mbedtls_ssl_context *ssl)
|
||||
|
||||
for (key_cert = key_cert_list; key_cert != NULL;
|
||||
key_cert = key_cert->next) {
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
psa_algorithm_t psa_alg = PSA_ALG_NONE;
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
MBEDTLS_SSL_DEBUG_CRT(3, "certificate (chain) candidate",
|
||||
key_cert->cert);
|
||||
@@ -1165,17 +1155,13 @@ static int ssl_tls13_pick_key_cert(mbedtls_ssl_context *ssl)
|
||||
"check signature algorithm %s [%04x]",
|
||||
mbedtls_ssl_sig_alg_to_str(*sig_alg),
|
||||
*sig_alg));
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
psa_alg = ssl_tls13_iana_sig_alg_to_psa_alg(*sig_alg);
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
if (mbedtls_ssl_tls13_check_sig_alg_cert_key_match(
|
||||
*sig_alg, &key_cert->cert->pk)
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
&& psa_alg != PSA_ALG_NONE &&
|
||||
mbedtls_pk_can_do_ext(&key_cert->cert->pk, psa_alg,
|
||||
PSA_KEY_USAGE_SIGN_HASH) == 1
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
) {
|
||||
ssl->handshake->key_cert = key_cert;
|
||||
MBEDTLS_SSL_DEBUG_MSG(3,
|
||||
|
Reference in New Issue
Block a user