commit efdeec4fda9f506d59d5649e1726f8e91b96702c parent aeaf52aa2ab59a9f487acc79bdd9bb35b85b5d76 Author: Jared Tobin <jared@jtobin.io> Date: Fri, 14 Mar 2025 13:44:21 +0400 test: handle some invalid cases Diffstat:
M | test/WycheproofEcdh.hs | | | 16 | +++++++--------- |
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/test/WycheproofEcdh.hs b/test/WycheproofEcdh.hs @@ -33,15 +33,13 @@ execute_group EcdhTestGroup {..} = execute :: EcdhTest -> TestTree execute EcdhTest {..} = H.testCase report $ do - let pub = case der_to_pub t_public of - Left _ -> error "der_to_pub failed" - Right p -> p - sec = parse_bigint t_private - sar = parse_bigint t_shared - - Affine x_out _ = affine (mul_unsafe pub sec) -- faster - - H.assertEqual mempty sar x_out + case der_to_pub t_public of + Left _ -> H.assertBool "invalid" (t_result == "invalid") + Right pub -> do + let sec = parse_bigint t_private + sar = parse_bigint t_shared + Affine x_out _ = affine (mul_unsafe pub sec) -- faster + H.assertEqual mempty sar x_out where report = "wycheproof ecdh " <> show t_tcId