New function mbedtls_ecp_keypair_get_group_id
Add a simple function to get the group id from a key object.
This information is available via mbedtls_ecp_export, but that function
consumes a lot of memory, which is a waste if all you need is to identify
the curve.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/library/ecp.c b/library/ecp.c
index ee86cbc..351e9e8 100644
--- a/library/ecp.c
+++ b/library/ecp.c
@@ -3357,6 +3357,12 @@
}
#endif /* MBEDTLS_ECP_C */
+mbedtls_ecp_group_id mbedtls_ecp_keypair_get_group_id(
+ const mbedtls_ecp_keypair *key)
+{
+ return key->grp.id;
+}
+
/*
* Export generic key-pair parameters.
*/