Skip to content

Commit

Permalink
Fix ecc_ecdsa_verify corner case with all-zero hash.
Browse files Browse the repository at this point in the history
  • Loading branch information
niels-moller committed Jan 20, 2021
1 parent 0c31ec6 commit b3d0bcf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2021-01-20 Niels Möller <nisse@lysator.liu.se>

* ecc-ecdsa-verify.c (ecc_ecdsa_verify): Fix corner case with
all-zero hash. Reported by Guido Vranken.

2021-01-10 Niels Möller <nisse@lysator.liu.se>

* fat-ppc.c: Don't use __GLIBC_PREREQ in the same preprocessor
Expand Down
6 changes: 3 additions & 3 deletions ecc-ecdsa-verify.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ ecc_ecdsa_verify (const struct ecc_curve *ecc,
private key by guessing.
*/
/* Total storage: 6*ecc->p.size + ecc->add_hhh_itch */
ecc->add_hhh (ecc, P1, P1, P2, P1 + 3*ecc->p.size);
ecc->add_hhh (ecc, P2, P2, P1, P1 + 3*ecc->p.size);
}
/* x coordinate only, modulo q */
ecc->h_to_a (ecc, 2, P2, P1, P1 + 3*ecc->p.size);
ecc->h_to_a (ecc, 2, P1, P2, P1 + 3*ecc->p.size);

return (mpn_cmp (rp, P2, ecc->p.size) == 0);
return (mpn_cmp (rp, P1, ecc->p.size) == 0);
#undef P2
#undef P1
#undef sinv
Expand Down

0 comments on commit b3d0bcf

Please sign in to comment.