Previous commit was incomplete. Add missing prototypes and a test case.

This commit is contained in:
Dag-Erling Smørgrav 2014-08-14 18:42:52 +00:00 committed by des
parent 885c586ce9
commit 3be915b8d7
2 changed files with 10 additions and 2 deletions

View file

@ -53,5 +53,7 @@ int mpi_lshift(cryb_mpi *, unsigned int);
int mpi_rshift(cryb_mpi *, unsigned int);
int mpi_add_abs(cryb_mpi *, cryb_mpi *, cryb_mpi *);
int mpi_sub_abs(cryb_mpi *, cryb_mpi *, cryb_mpi *);
int mpi_cmp_abs(cryb_mpi *, cryb_mpi *);
int mpi_cmp(cryb_mpi *, cryb_mpi *);
#endif

View file

@ -586,6 +586,12 @@ static struct t_cmp_case {
size_t blen;
int cmpabs, cmp;
} t_cmp_cases[] = {
{
"0 == 0",
{ 0x00, }, 1,
{ 0x00, }, 1,
0, 0,
},
};
static int
@ -597,8 +603,8 @@ t_mpi_cmp(char **desc CRYB_UNUSED, void *arg)
mpi_load(&a, tc->a, tc->alen);
mpi_load(&b, tc->b, tc->blen);
ret &= t_compare_int(tc->cmpabs, mpi_cmp_abs(&a, &b));
ret &= t_compare_int(tc->cmp, mpi_cmp(&a, &b));
ret &= t_compare_i(tc->cmpabs, mpi_cmp_abs(&a, &b));
ret &= t_compare_i(tc->cmp, mpi_cmp(&a, &b));
mpi_destroy(&a);
mpi_destroy(&b);
return (ret);