Skip to content

Commit c27f5a9

Browse files
authored
Version check mbedtls instead of introducing a new define (#516)
1 parent 2d47af8 commit c27f5a9

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

ixwebsocket/IXSocketMbedTLS.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,13 @@ namespace ix
4747
mbedtls_x509_crt_init(&_cacert);
4848
mbedtls_x509_crt_init(&_cert);
4949
mbedtls_pk_init(&_pkey);
50-
// Initialize the PSA Crypto API if requested.
50+
// Initialize the PSA Crypto API if required by the version of Mbed TLS (3.6.0).
5151
// This allows the X.509/TLS libraries to use PSA for crypto operations.
5252
// See: https://github.com/Mbed-TLS/mbedtls/blob/development/docs/use-psa-crypto.md
53-
#if defined(IXWEBSOCKET_MBEDTLS_USE_PSA_CRYPTO)
54-
psa_crypto_init();
55-
#endif
53+
if (MBEDTLS_VERSION_MAJOR >= 3 && MBEDTLS_VERSION_MINOR >= 6 && MBEDTLS_VERSION_PATCH >= 0)
54+
{
55+
psa_crypto_init();
56+
}
5657
}
5758

5859
bool SocketMbedTLS::loadSystemCertificates(std::string& errorMsg)

0 commit comments

Comments
 (0)