tls-crypto: Generalizing DH group to TLS group mapping

This simplifies writing the key share extension as the TLS group does
not have to be cached.
This commit is contained in:
Pascal Knecht
2021-02-12 14:35:23 +01:00
committed by Tobias Brunner
parent ab70f68cf9
commit 066ac8809c
4 changed files with 42 additions and 38 deletions
+17
View File
@@ -2319,3 +2319,20 @@ int tls_crypto_get_supported_suites(bool null, tls_version_t version,
}
return count;
}
/**
* See header.
*/
tls_named_group_t tls_ec_group_to_curve(diffie_hellman_group_t group)
{
int i;
for (i = 0; i < countof(curves); i++)
{
if (curves[i].group == group)
{
return curves[i].curve;
}
}
return 0;
}