### Local tests for Ed25519 verify { ## Check that noncanonical scalars are rejected. The base test is repeated ## from the main suite; let s be the scalar part of the signature, and ℓ be ## the curve order. The negative test has s' = s + ℓ < 2^254, so the value ## fits. 74d29127f199d86a8676aec33b4ce3f225ccb191f52c191ccd1e8cca65213a6b bd8e05033f3a8bcdcbf4beceb70901c82e31 fbe929d743a03c17910575492f3092ee2a2bf14a60a3fcacec74a58c7334510fc262db582791322d6c8c41f1700adb80027ecabc14270b703444ae3ee7623e0a 0; 74d29127f199d86a8676aec33b4ce3f225ccb191f52c191ccd1e8cca65213a6b bd8e05033f3a8bcdcbf4beceb70901c82e31 fbe929d743a03c17910575492f3092ee2a2bf14a60a3fcacec74a58c7334510faf36d1b541f44485422939944f04ba95027ecabc14270b703444ae3ee7623e1a -1; ## OK, so this is a massive cheat, but otherwise testing that out-of-range ## coordinates are rejected is really hard. Pick A = (0, 1), which is the ## identity in E. Then n A = A for all n; in particular, H(R, A, M) A = A ## for any choice of R and M. Furthermore, R = R + H(R, A, M) A for any R. ## Let's pick R = A = (0, 1), because that seems to be working out for us. ## Then s P = R + H(R, A, M) A exactly when s = 0 (mod ℓ). ## ## This is obviously a really daft choice of public key for security, ## because the following is a completely general-purpose signature for all ## messages. ## ## Why bother, you ask? Well, because (0, 1) is one of the few points ## which has a reduntant representation. So we can use this to check that ## we're correctly rejecting signatures which aren't in normal form. 0100000000000000000000000000000000000000000000000000000000000000 416c6c2d707572706f7365207369676e6174757265210a 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0; eeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f 416c6c2d707572706f7365207369676e6174757265210a 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -1; 0100000000000000000000000000000000000000000000000000000000000000 416c6c2d707572706f7365207369676e6174757265210a eeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000 -1; }