ssl_server2: support ticket_aead only when CIPHER_C is defined

Cipher parsing requires mbedtls_cipher_info_from_string() which
depends on CIPHER_C.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
Valerio Setti 2023-10-27 12:02:45 +02:00
parent 31ad3a14cc
commit bdf04e840a

View File

@ -283,6 +283,7 @@ int main(void)
#else
#define USAGE_PSK ""
#endif /* MBEDTLS_SSL_HANDSHAKE_WITH_PSK_ENABLED */
#if defined(MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK)
#define USAGE_CA_CALLBACK \
" ca_callback=%%d default: 0 (disabled)\n" \
@ -290,13 +291,21 @@ int main(void)
#else
#define USAGE_CA_CALLBACK ""
#endif /* MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK */
#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_TICKET_C)
#if defined(MBEDTLS_CIPHER_C)
#define USAGE_TICKETS \
" tickets=%%d default: 1 (enabled)\n" \
" ticket_rotate=%%d default: 0 (disabled)\n" \
" ticket_timeout=%%d default: 86400 (one day)\n" \
" ticket_aead=%%s default: \"AES-256-GCM\"\n"
#else
#else /* MBEDTLS_CIPHER_C */
#define USAGE_TICKETS \
" tickets=%%d default: 1 (enabled)\n" \
" ticket_rotate=%%d default: 0 (disabled)\n" \
" ticket_timeout=%%d default: 86400 (one day)\n"
#endif /* MBEDTLS_CIPHER_C */
#else /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_TICKET_C */
#define USAGE_TICKETS ""
#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_TICKET_C */
@ -2146,14 +2155,18 @@ usage:
if (opt.ticket_timeout < 0) {
goto usage;
}
} else if (strcmp(p, "ticket_aead") == 0) {
} else
#if defined(MBEDTLS_CIPHER_C)
if (strcmp(p, "ticket_aead") == 0) {
const mbedtls_cipher_info_t *ci = mbedtls_cipher_info_from_string(q);
if (ci == NULL) {
goto usage;
}
opt.ticket_aead = mbedtls_cipher_info_get_type(ci);
} else if (strcmp(p, "cache_max") == 0) {
} else
#endif
if (strcmp(p, "cache_max") == 0) {
opt.cache_max = atoi(q);
if (opt.cache_max < 0) {
goto usage;