mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-03-20 11:11:08 +01:00
library: ssl: make the list of "TLS ID" <-> "group name" public when possible
This is only done when MBEDTLS_DEBUG_C is declared in order not to inflate the library size. Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
@@ -3695,6 +3695,14 @@ typedef struct {
|
||||
{ MBEDTLS_SSL_IANA_TLS_GROUP_NONE, NULL } \
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_DEBUG_C)
|
||||
/*
|
||||
* List of known "TLS ID" <-> "group name".
|
||||
* #MBEDTLS_SSL_IANA_TLS_GROUPS_INFO is used to initialized the list.
|
||||
*/
|
||||
extern mbedtls_ssl_iana_tls_group_info_t mbedtls_ssl_iana_tls_group_info[];
|
||||
#endif /* MBEDTLS_DEBUG_C */
|
||||
|
||||
/**
|
||||
* \brief Return the list of supported groups (curves and finite fields).
|
||||
*
|
||||
|
||||
@@ -5850,14 +5850,14 @@ uint16_t mbedtls_ssl_get_tls_id_from_ecp_group_id(mbedtls_ecp_group_id grp_id)
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_DEBUG_C)
|
||||
static
|
||||
mbedtls_ssl_iana_tls_group_info_t tls_id_curve_name_table[] = MBEDTLS_SSL_IANA_TLS_GROUPS_INFO;
|
||||
mbedtls_ssl_iana_tls_group_info_t mbedtls_ssl_iana_tls_group_info[] =
|
||||
MBEDTLS_SSL_IANA_TLS_GROUPS_INFO;
|
||||
|
||||
const char *mbedtls_ssl_get_curve_name_from_tls_id(uint16_t tls_id)
|
||||
{
|
||||
for (int i = 0; tls_id_curve_name_table[i].tls_id != 0; i++) {
|
||||
if (tls_id_curve_name_table[i].tls_id == tls_id) {
|
||||
return tls_id_curve_name_table[i].group_name;
|
||||
for (int i = 0; mbedtls_ssl_iana_tls_group_info[i].tls_id != 0; i++) {
|
||||
if (mbedtls_ssl_iana_tls_group_info[i].tls_id == tls_id) {
|
||||
return mbedtls_ssl_iana_tls_group_info[i].group_name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user