programs: use proper macro for ECDSA capabilities in ssl_sever2

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
Valerio Setti 2023-02-22 12:38:54 +01:00
parent 1ad9ef2132
commit 5ba1d5eb2c
2 changed files with 6 additions and 4 deletions

View File

@ -69,6 +69,8 @@ int main(void)
#include "test/psa_crypto_helpers.h" #include "test/psa_crypto_helpers.h"
#endif #endif
#include "mbedtls/pk.h"
/* Size of memory to be allocated for the heap, when using the library's memory /* Size of memory to be allocated for the heap, when using the library's memory
* management and MBEDTLS_MEMORY_BUFFER_ALLOC_C is enabled. */ * management and MBEDTLS_MEMORY_BUFFER_ALLOC_C is enabled. */
#define MEMORY_HEAP_SIZE 120000 #define MEMORY_HEAP_SIZE 120000
@ -2652,7 +2654,7 @@ usage:
} }
key_cert_init = 2; key_cert_init = 2;
#endif /* MBEDTLS_RSA_C */ #endif /* MBEDTLS_RSA_C */
#if defined(MBEDTLS_ECDSA_C) #if defined(MBEDTLS_PK_CAN_ECDSA_SOME)
if ((ret = mbedtls_x509_crt_parse(&srvcert2, if ((ret = mbedtls_x509_crt_parse(&srvcert2,
(const unsigned char *) mbedtls_test_srv_crt_ec, (const unsigned char *) mbedtls_test_srv_crt_ec,
mbedtls_test_srv_crt_ec_len)) != 0) { mbedtls_test_srv_crt_ec_len)) != 0) {
@ -2669,7 +2671,7 @@ usage:
goto exit; goto exit;
} }
key_cert_init2 = 2; key_cert_init2 = 2;
#endif /* MBEDTLS_ECDSA_C */ #endif /* MBEDTLS_PK_CAN_ECDSA_SOME */
} }
#if defined(MBEDTLS_USE_PSA_CRYPTO) #if defined(MBEDTLS_USE_PSA_CRYPTO)

View File

@ -272,7 +272,7 @@ int send_cb(void *ctx, unsigned char const *buf, size_t len)
} }
#if defined(MBEDTLS_X509_CRT_PARSE_C) #if defined(MBEDTLS_X509_CRT_PARSE_C)
#if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_RSA_C) #if defined(MBEDTLS_PK_CAN_ECDSA_SOME) && defined(MBEDTLS_RSA_C)
#if defined(MBEDTLS_SSL_PROTO_TLS1_3) #if defined(MBEDTLS_SSL_PROTO_TLS1_3)
/* /*
* When GnuTLS/Openssl server is configured in TLS 1.2 mode with a certificate * When GnuTLS/Openssl server is configured in TLS 1.2 mode with a certificate
@ -289,7 +289,7 @@ int send_cb(void *ctx, unsigned char const *buf, size_t len)
#define MBEDTLS_SSL_SIG_ALG(hash) ((hash << 8) | MBEDTLS_SSL_SIG_ECDSA), \ #define MBEDTLS_SSL_SIG_ALG(hash) ((hash << 8) | MBEDTLS_SSL_SIG_ECDSA), \
((hash << 8) | MBEDTLS_SSL_SIG_RSA), ((hash << 8) | MBEDTLS_SSL_SIG_RSA),
#endif #endif
#elif defined(MBEDTLS_ECDSA_C) #elif defined(MBEDTLS_PK_CAN_ECDSA_SOME)
#define MBEDTLS_SSL_SIG_ALG(hash) ((hash << 8) | MBEDTLS_SSL_SIG_ECDSA), #define MBEDTLS_SSL_SIG_ALG(hash) ((hash << 8) | MBEDTLS_SSL_SIG_ECDSA),
#elif defined(MBEDTLS_RSA_C) #elif defined(MBEDTLS_RSA_C)
#if defined(MBEDTLS_SSL_PROTO_TLS1_3) #if defined(MBEDTLS_SSL_PROTO_TLS1_3)