diff --git a/test/cryptsuite.py b/test/cryptsuite.py index 7638d346..55269189 100755 --- a/test/cryptsuite.py +++ b/test/cryptsuite.py @@ -370,6 +370,18 @@ class mpint(MyTestBase): self.assertEqual(int(mp_div(n, d)), q) self.assertEqual(int(mp_mod(n, d)), r) + # Make sure divmod_into can handle not getting one + # of its output pointers (or even both). + mp_clear(mq) + mp_divmod_into(n, d, mq, None) + self.assertEqual(int(mq), q) + mp_clear(mr) + mp_divmod_into(n, d, None, mr) + self.assertEqual(int(mr), r) + mp_divmod_into(n, d, None, None) + # No tests we can do after that last one - we just + # insist that it isn't allowed to have crashed! + def testBitwise(self): p = 0x3243f6a8885a308d313198a2e03707344a4093822299f31d0082efa98ec4e e = 0x2b7e151628aed2a6abf7158809cf4f3c762e7160f38b4da56a784d9045190 diff --git a/testcrypt.h b/testcrypt.h index 41bee353..13f7011b 100644 --- a/testcrypt.h +++ b/testcrypt.h @@ -48,7 +48,7 @@ FUNC4(void, mp_cond_add_into, val_mpint, val_mpint, val_mpint, uint) FUNC4(void, mp_cond_sub_into, val_mpint, val_mpint, val_mpint, uint) FUNC3(void, mp_cond_swap, val_mpint, val_mpint, uint) FUNC2(void, mp_cond_clear, val_mpint, uint) -FUNC4(void, mp_divmod_into, val_mpint, val_mpint, val_mpint, val_mpint) +FUNC4(void, mp_divmod_into, val_mpint, val_mpint, opt_val_mpint, opt_val_mpint) FUNC2(val_mpint, mp_div, val_mpint, val_mpint) FUNC2(val_mpint, mp_mod, val_mpint, val_mpint) FUNC2(void, mp_reduce_mod_2to, val_mpint, uint)