Topic: ECC hash verification failure with P-521 curve
My project involves implementing functions from wolfCrypt on an NXP LPC1837 MCU.
I'm able to build and run the wolf_example project in the IDE/LPCXPRESSO directory. Running the test with default settings is a success, but if I attempt to add in support for the P-521 curve (#define HAVE_ECC521 in user_settings.h) the test fails, with error code -1023.
Separate from the wolf_example project, I've also tested wolfCrypt within my own project by including just the necessary .c and .h files for the functions I need. I've done a bit of digging to figure out exactly where the error occurs:
Hash verification fails at line 2469 of ecc.c
2467 /* does v == r */
2468 if (err == MP_OKAY) {
2469 if (mp_cmp(&v, r) == MP_EQ)
2470 *stat = 1;
2471 }
This happens within line 6261 of test.c, causing the return at 6266
6261 ret = wc_ecc_verify_hash(sig, x, (byte*)vector->msg, (word32)vector->msgLen, &verify, userA);
6262 if (ret != 0)
6263 return -1021;
6264
6265 if (verify != 1)
6266 return -1023;
which is called within line 6598 of test.c
6597 ecc521.curveName = "nistp521";
6598 ret = ecc_test_raw_vector(&ecc521, &userA, sig, sizeof(sig));
6599 if (ret < 0) {
6600 return ret;
6601 }
To utilize the P-521 curve, are the additional steps needed besides defining HAVE_ECC521?
If not, what else might be causing this issue?