Skip to content

Commit 0ed1df6

Browse files
Merge pull request #184 from hanno-arm/ecp_restartable_offset
Fix fragile method for passing from ECDSA to ECP restart contexts
2 parents 317f940 + 80bb77e commit 0ed1df6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/ecdsa.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,11 @@ static void ecdsa_restart_det_free( mbedtls_ecdsa_restart_det_ctx *ctx )
172172
}
173173
#endif /* MBEDTLS_ECDSA_DETERMINISTIC */
174174

175-
#define ECDSA_RS_ECP &rs_ctx->ecp
175+
#define ECDSA_RS_ECP ( rs_ctx == NULL ? NULL : &rs_ctx->ecp )
176176

177177
/* Utility macro for checking and updating ops budget */
178178
#define ECDSA_BUDGET( ops ) \
179-
MBEDTLS_MPI_CHK( mbedtls_ecp_check_budget( grp, &rs_ctx->ecp, ops ) );
179+
MBEDTLS_MPI_CHK( mbedtls_ecp_check_budget( grp, ECDSA_RS_ECP, ops ) );
180180

181181
/* Call this when entering a function that needs its own sub-context */
182182
#define ECDSA_RS_ENTER( SUB ) do { \

0 commit comments

Comments
 (0)