1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Test passing null pointers to mp_divmod_into.

I've got opt_val_mpint already in the test system, so it makes
sense to use it.
This commit is contained in:
Simon Tatham 2020-02-18 18:55:56 +00:00
parent 791f1cc068
commit 82df83719a
2 changed files with 13 additions and 1 deletions

View File

@ -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

View File

@ -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)