Avoid unnecessary xxx_copy() calls
The call would anyway check for pointer equality and return early, but it
doesn't hurt to save a function call, and also this follows more uniformly the
pattern that those two lines go together:
#if defined(MBEDTLS_ECP_RESTARTBLE)
if( rs_ctx != NULL && ...
diff --git a/library/ecp.c b/library/ecp.c
index 6675c47..a8c367a 100644
--- a/library/ecp.c
+++ b/library/ecp.c
@@ -1804,7 +1804,8 @@
MBEDTLS_MPI_CHK( ecp_normalize_jac( grp, RR ) );
#if defined(MBEDTLS_ECP_RESTARTABLE)
- MBEDTLS_MPI_CHK( mbedtls_ecp_copy( R, RR ) );
+ if( rs_ctx != NULL && rs_ctx->rsm != NULL )
+ MBEDTLS_MPI_CHK( mbedtls_ecp_copy( R, RR ) );
#endif
cleanup: