[dtls] fix ECDSA configuration for newer mbed TLS versions (#6261)

When using newer versions of mbed TLS, two issues appear when using
`OPENTHREAD_ECDSA`:
- An empty list of configuration hashes is treated as a configuration
error: DTLS fails.
- Identifiers with double underscore are not used anymore: signature
hashes configuration is not included.

This commit addresses both issues.
This commit is contained in:
Eduardo Montoya
2021-03-10 10:10:31 -08:00
committed by GitHub
parent 268cce160a
commit 09245f0766
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -56,8 +56,8 @@ namespace ot {
namespace MeshCoP {
const mbedtls_ecp_group_id Dtls::sCurves[] = {MBEDTLS_ECP_DP_SECP256R1, MBEDTLS_ECP_DP_NONE};
#ifdef MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED
const int Dtls::sHashes[] = {MBEDTLS_MD_NONE};
#if defined(MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED) || defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
const int Dtls::sHashes[] = {MBEDTLS_MD_SHA256, MBEDTLS_MD_NONE};
#endif
Dtls::Dtls(Instance &aInstance, bool aLayerTwoSecurity)
@@ -284,7 +284,7 @@ otError Dtls::Setup(bool aClient)
if (mCipherSuites[0] == MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8)
{
mbedtls_ssl_conf_curves(&mConf, sCurves);
#ifdef MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED
#if defined(MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED) || defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
mbedtls_ssl_conf_sig_hashes(&mConf, sHashes);
#endif
}
+1 -1
View File
@@ -414,7 +414,7 @@ private:
uint8_t mPskLength;
static const mbedtls_ecp_group_id sCurves[];
#ifdef MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED
#if defined(MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED) || defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
static const int sHashes[];
#endif