Skip to content

Commit c43c34f

Browse files
committed
ellswift: fix probabilistic test failure when swapping sides
When configured with `--disable-module-ecdh --enable-module-recovery`, then `./tests 64 81af32fd7ab8c9cbc2e62a689f642106` fails with ``` src/modules/ellswift/tests_impl.h:396: test condition failed: secp256k1_memcmp_var(share32_bad, share32a, 32) != 0 ``` This tests verifies that changing the `party` bit of the `secp256k1_ellswift_xdh` function results in a different share. However, that's not the case when the secret keys of both parties are the same and this is actually what happens in the observed test failure. The keys can be equal in this test case because they are created by the `random_scalar_order_test` function whose output is not uniformly random (it's biased towards 0). This commit restores the assummption that the secret keys differ.
1 parent 907a672 commit c43c34f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/modules/ellswift/tests_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ void run_ellswift_tests(void) {
321321
/* Generate random secret keys and random randomizers. */
322322
secp256k1_testrand256_test(auxrnd32a);
323323
secp256k1_testrand256_test(auxrnd32b);
324-
random_scalar_order_test(&seca);
324+
random_scalar_order(&seca);
325325
random_scalar_order_test(&secb);
326326
secp256k1_scalar_get_b32(sec32a, &seca);
327327
secp256k1_scalar_get_b32(sec32b, &secb);

0 commit comments

Comments
 (0)