From aeb42ce3a789b906efa612302a04ddfa7b18667b Mon Sep 17 00:00:00 2001 From: Laukik Hase Date: Fri, 30 Sep 2022 15:26:48 +0530 Subject: [PATCH] https_server: Fix example when `MBEDTLS_DYNAMIC_BUFFER` is enabled - While checking if ciphersuite uses RSA key exchange methods, the APIs `mbedtls_ssl_get_ciphersuite_id_from_ssl` and `mbedtls_ssl_ciphersuite_from_id` were used to get the ciphersuite info. - However, this is incorrect as we need the ciphersuite info from the handshake instance and not the ssl_session instance. --- .gitlab/ci/rules.yml | 1 + components/mbedtls/port/dynamic/esp_ssl_srv.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab/ci/rules.yml b/.gitlab/ci/rules.yml index ed519a6f37..990235dfc3 100644 --- a/.gitlab/ci/rules.yml +++ b/.gitlab/ci/rules.yml @@ -219,6 +219,7 @@ - "components/esp_wifi/**/*" - "components/esp_netif/**/*" - "components/lwip/**/*" + - "components/mbedtls/port/dynamic/*" # for cases with wifi_high_traffic marker - "examples/system/ota/**/*" diff --git a/components/mbedtls/port/dynamic/esp_ssl_srv.c b/components/mbedtls/port/dynamic/esp_ssl_srv.c index e49af1e489..5a657b56c7 100644 --- a/components/mbedtls/port/dynamic/esp_ssl_srv.c +++ b/components/mbedtls/port/dynamic/esp_ssl_srv.c @@ -18,8 +18,8 @@ static const char *TAG = "SSL Server"; */ static bool ssl_ciphersuite_uses_rsa_key_ex(mbedtls_ssl_context *ssl) { - int suite_id = mbedtls_ssl_get_ciphersuite_id_from_ssl(ssl); - const mbedtls_ssl_ciphersuite_t *ciphersuite_info = mbedtls_ssl_ciphersuite_from_id(suite_id); + const mbedtls_ssl_ciphersuite_t *ciphersuite_info = + ssl->MBEDTLS_PRIVATE(handshake)->ciphersuite_info; if (ciphersuite_info->MBEDTLS_PRIVATE(key_exchange) == MBEDTLS_KEY_EXCHANGE_RSA || ciphersuite_info->MBEDTLS_PRIVATE(key_exchange) == MBEDTLS_KEY_EXCHANGE_RSA_PSK) {