New function mbedtls_ecjpake_set_point_format
Use this instead of accessing the field directly.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/library/ecjpake.c b/library/ecjpake.c
index 464ff51..de43ddb 100644
--- a/library/ecjpake.c
+++ b/library/ecjpake.c
@@ -128,6 +128,20 @@
return( ret );
}
+int mbedtls_ecjpake_set_point_format( mbedtls_ecjpake_context *ctx,
+ int point_format )
+{
+ switch( point_format )
+ {
+ case MBEDTLS_ECP_PF_UNCOMPRESSED:
+ case MBEDTLS_ECP_PF_COMPRESSED:
+ ctx->point_format = point_format;
+ return( 0 );
+ default:
+ return( MBEDTLS_ERR_ECP_BAD_INPUT_DATA );
+ }
+}
+
/*
* Check if context is ready for use
*/
diff --git a/library/ssl_cli.c b/library/ssl_cli.c
index 1bacd64..9a44138 100644
--- a/library/ssl_cli.c
+++ b/library/ssl_cli.c
@@ -1663,7 +1663,8 @@
ssl->handshake->ecdh_ctx.point_format = p[0];
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
- ssl->handshake->ecjpake_ctx.point_format = p[0];
+ mbedtls_ecjpake_set_point_format( &ssl->handshake->ecjpake_ctx,
+ p[0] );
#endif
MBEDTLS_SSL_DEBUG_MSG( 4, ( "point format selected: %d", p[0] ) );
return( 0 );
diff --git a/library/ssl_srv.c b/library/ssl_srv.c
index cf4b7c5..d9ad607 100644
--- a/library/ssl_srv.c
+++ b/library/ssl_srv.c
@@ -407,7 +407,8 @@
ssl->handshake->ecdh_ctx.point_format = p[0];
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
- ssl->handshake->ecjpake_ctx.point_format = p[0];
+ mbedtls_ecjpake_set_point_format( &ssl->handshake->ecjpake_ctx,
+ p[0] );
#endif
MBEDTLS_SSL_DEBUG_MSG( 4, ( "point format selected: %d", p[0] ) );
return( 0 );