diff options
author | Simon Tatham <anakin@pobox.com> | 2021-08-27 19:43:40 +0300 |
---|---|---|
committer | Simon Tatham <anakin@pobox.com> | 2021-08-27 19:43:40 +0300 |
commit | 23431f8ff454aef29f25627bae2bc08c6dd69af2 (patch) | |
tree | 8090789f6d0eaf22dc7df2dbb6273003b94f067e /sshkeygen.h | |
parent | 59409d0947ec6d0dc11b4bda8296f68ff088f0f3 (diff) |
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.
Diffstat (limited to 'sshkeygen.h')
-rw-r--r-- | sshkeygen.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sshkeygen.h b/sshkeygen.h index dc0024b9..fae6fa83 100644 --- a/sshkeygen.h +++ b/sshkeygen.h @@ -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); |