1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-16 02:27:32 -05:00

Add some tests of Miller-Rabin to cryptsuite.

I'm about to rewrite the Miller-Rabin testing code, so let's start by
introducing a test suite that the old version passes, and then I can
make sure the new one does too.
This commit is contained in:
Simon Tatham
2021-08-27 17:43:40 +01:00
parent 59409d0947
commit 23431f8ff4
6 changed files with 112 additions and 8 deletions

View File

@ -94,6 +94,14 @@ typedef struct MillerRabin MillerRabin;
MillerRabin *miller_rabin_new(mp_int *p);
void miller_rabin_free(MillerRabin *mr);
/* Perform a single Miller-Rabin test, using a specified witness value.
* Used in the test suite. */
struct mr_result {
bool passed;
bool potential_primitive_root;
};
struct mr_result miller_rabin_test(MillerRabin *mr, mp_int *w);
/* Perform a single Miller-Rabin test, using a random witness value. */
bool miller_rabin_test_random(MillerRabin *mr);