TinyCrypt SSL: Declare EC-related TLS RFC constants in SSL namespace
mbedtls/ecp.h defines constants
MBEDTLS_ECP_PF_UNCOMPRESSED
MBEDTLS_ECP_PF_COMPRESSED
MBEDTLS_ECP_TLS_NAMED_CURVE
which regard the encoding of elliptic curves and curve point formats in TLS.
As such, they should be defined in the SSL namespace. Asides, this will help
replacing the legacy ECC crypto by alternative ECC implementations.
diff --git a/library/ssl_cli.c b/library/ssl_cli.c
index 97ae00e..330d017 100644
--- a/library/ssl_cli.c
+++ b/library/ssl_cli.c
@@ -331,7 +331,7 @@
*p++ = 2;
*p++ = 1;
- *p++ = MBEDTLS_ECP_PF_UNCOMPRESSED;
+ *p++ = MBEDTLS_SSL_EC_PF_UNCOMPRESSED;
*olen = 6;
}
@@ -1405,8 +1405,8 @@
p = buf + 1;
while( list_size > 0 )
{
- if( p[0] == MBEDTLS_ECP_PF_UNCOMPRESSED ||
- p[0] == MBEDTLS_ECP_PF_COMPRESSED )
+ if( p[0] == MBEDTLS_SSL_EC_PF_UNCOMPRESSED ||
+ p[0] == MBEDTLS_SSL_EC_PF_COMPRESSED )
{
#if defined(MBEDTLS_ECDH_C)
ssl->handshake->ecdh_ctx.point_format = p[0];
@@ -2817,7 +2817,7 @@
== MBEDTLS_KEY_EXCHANGE_ECDHE_RSA )
{
static const unsigned char ecdh_group[] = {
- MBEDTLS_ECP_TLS_NAMED_CURVE,
+ MBEDTLS_SSL_EC_TLS_NAMED_CURVE,
0 /* high bits of secp256r1 TLS ID */,
23 /* low bits of secp256r1 TLS ID */,
};