Add missing tests
Accidentally omitted from commit455b65dfab
Reviewed-by: Kurt Roeckx <kurt@openssl.org> (cherry picked from commitfdc35a9d3e
)
This commit is contained in:
parent
1bb01b1b5f
commit
116fd3732a
1 changed files with 7 additions and 5 deletions
|
@ -201,14 +201,14 @@ static int test_eq_int(int a, int b)
|
||||||
unsigned int equal = constant_time_eq_int(a, b);
|
unsigned int equal = constant_time_eq_int(a, b);
|
||||||
if (a == b && equal != CONSTTIME_TRUE)
|
if (a == b && equal != CONSTTIME_TRUE)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Test failed for constant_time_select(%d, %d): "
|
fprintf(stderr, "Test failed for constant_time_eq_int(%d, %d): "
|
||||||
"expected %du(TRUE), got %du\n",
|
"expected %du(TRUE), got %du\n",
|
||||||
a, b, CONSTTIME_TRUE, equal);
|
a, b, CONSTTIME_TRUE, equal);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (a != b && equal != CONSTTIME_FALSE)
|
else if (a != b && equal != CONSTTIME_FALSE)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Test failed for constant_time_select(%d, %d): "
|
fprintf(stderr, "Test failed for constant_time_eq_int(%d, %d): "
|
||||||
"expected %du(FALSE), got %du\n",
|
"expected %du(FALSE), got %du\n",
|
||||||
a, b, CONSTTIME_FALSE, equal);
|
a, b, CONSTTIME_FALSE, equal);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -221,14 +221,14 @@ static int test_eq_int_8(int a, int b)
|
||||||
unsigned char equal = constant_time_eq_int_8(a, b);
|
unsigned char equal = constant_time_eq_int_8(a, b);
|
||||||
if (a == b && equal != CONSTTIME_TRUE_8)
|
if (a == b && equal != CONSTTIME_TRUE_8)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Test failed for constant_time_select(%d, %d): "
|
fprintf(stderr, "Test failed for constant_time_eq_int_8(%d, %d): "
|
||||||
"expected %u(TRUE), got %u\n",
|
"expected %u(TRUE), got %u\n",
|
||||||
a, b, CONSTTIME_TRUE_8, equal);
|
a, b, CONSTTIME_TRUE_8, equal);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (a != b && equal != CONSTTIME_FALSE_8)
|
else if (a != b && equal != CONSTTIME_FALSE_8)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Test failed for constant_time_select(%d, %d): "
|
fprintf(stderr, "Test failed for constant_time_eq_int_8(%d, %d): "
|
||||||
"expected %u(FALSE), got %u\n",
|
"expected %u(FALSE), got %u\n",
|
||||||
a, b, CONSTTIME_FALSE_8, equal);
|
a, b, CONSTTIME_FALSE_8, equal);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -300,7 +300,9 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
d = signed_test_values[j];
|
d = signed_test_values[j];
|
||||||
num_failed += test_select_int(c, d);
|
num_failed += test_select_int(c, d);
|
||||||
num_all += 1;
|
num_failed += test_eq_int(c, d);
|
||||||
|
num_failed += test_eq_int_8(c, d);
|
||||||
|
num_all += 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue