mirror of
https://github.com/espressif/openthread.git
synced 2026-07-30 23:57:47 +00:00
[mbedtls] TLS functions do not require rng functions from Mbed TLS 4.0 (#12459)
Starting from Mbed TLS 4.0, TLS functions will use psa_generate_random() inernally, so there is no need to specify it as parameter or through mbedtls_ssl_conf_rng(). Signed-off-by: Valerio Setti <[email protected]>
This commit is contained in:
committed by
Jonathan Hui
parent
06e2cdbf5c
commit
b59baea4f4
+3
-1
@@ -148,7 +148,9 @@ template <> otError TcpExample::Process<Cmd("init")>(Arg aArgs[])
|
||||
|
||||
mbedtls_ssl_init(&mSslContext);
|
||||
mbedtls_ssl_config_init(&mSslConfig);
|
||||
#if (MBEDTLS_VERSION_NUMBER <= 0x03060500)
|
||||
mbedtls_ssl_conf_rng(&mSslConfig, Crypto::MbedTls::CryptoSecurePrng, nullptr);
|
||||
#endif
|
||||
mbedtls_ssl_conf_authmode(&mSslConfig, MBEDTLS_SSL_VERIFY_NONE);
|
||||
mbedtls_ssl_conf_ciphersuites(&mSslConfig, sCipherSuites);
|
||||
|
||||
@@ -160,7 +162,7 @@ template <> otError TcpExample::Process<Cmd("init")>(Arg aArgs[])
|
||||
mbedtls_ssl_conf_max_version(&mSslConfig, MBEDTLS_SSL_MAJOR_VERSION_3, MBEDTLS_SSL_MINOR_VERSION_3);
|
||||
#endif
|
||||
|
||||
#if (MBEDTLS_VERSION_NUMBER >= 0x03000000)
|
||||
#if (MBEDTLS_VERSION_NUMBER >= 0x03000000) && (MBEDTLS_VERSION_NUMBER <= 0x03060500)
|
||||
#include "crypto/mbedtls.hpp"
|
||||
int rv = mbedtls_pk_parse_key(&mPKey, reinterpret_cast<const unsigned char *>(sSrvKey), sSrvKeyLength,
|
||||
nullptr, 0, Crypto::MbedTls::CryptoSecurePrng, nullptr);
|
||||
|
||||
@@ -199,7 +199,9 @@ Error SecureSession::Setup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (MBEDTLS_VERSION_NUMBER <= 0x03060500)
|
||||
mbedtls_ssl_conf_rng(&mConf, Crypto::MbedTls::CryptoSecurePrng, nullptr);
|
||||
#endif
|
||||
#if (MBEDTLS_VERSION_NUMBER >= 0x03020000)
|
||||
mbedtls_ssl_conf_min_tls_version(&mConf, MBEDTLS_SSL_VERSION_TLS1_2);
|
||||
mbedtls_ssl_conf_max_tls_version(&mConf, MBEDTLS_SSL_VERSION_TLS1_2);
|
||||
@@ -278,7 +280,11 @@ Error SecureSession::Setup(void)
|
||||
|
||||
if (mIsServer)
|
||||
{
|
||||
#if (MBEDTLS_VERSION_NUMBER <= 0x03060500)
|
||||
rval = mbedtls_ssl_cookie_setup(&mCookieCtx, Crypto::MbedTls::CryptoSecurePrng, nullptr);
|
||||
#else
|
||||
rval = mbedtls_ssl_cookie_setup(&mCookieCtx);
|
||||
#endif
|
||||
VerifyOrExit(rval == 0);
|
||||
|
||||
mbedtls_ssl_conf_dtls_cookies(&mConf, mbedtls_ssl_cookie_write, mbedtls_ssl_cookie_check, &mCookieCtx);
|
||||
|
||||
Reference in New Issue
Block a user