Skip to content

Commit 180c66b

Browse files
committed
Fix curve448
`wc_curve448_check_public` can get into an infinite loop in the big-endian code path.
1 parent 4fe05d7 commit 180c66b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

wolfcrypt/src/curve448.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,12 +409,12 @@ int wc_curve448_check_public(const byte* pub, word32 pubSz, int endian)
409409
return ECC_BAD_ARG_E;
410410
}
411411
if ((i == 27) && (pub[i] == 0xfe)) {
412-
for (++i; i < CURVE448_PUB_KEY_SIZE - 1; i--) {
412+
for (++i; i < CURVE448_PUB_KEY_SIZE - 1; i++) {
413413
if (pub[i] != 0xff) {
414414
break;
415415
}
416416
}
417-
if ((i == CURVE448_PUB_KEY_SIZE) && (pub[i] >= 0xfe)) {
417+
if ((i == CURVE448_PUB_KEY_SIZE - 1) && (pub[i] >= 0xfe)) {
418418
return ECC_BAD_ARG_E;
419419
}
420420
}

0 commit comments

Comments
 (0)