X-Git-Url: https://git.openssl.org/gitweb/?a=blobdiff_plain;f=test%2Fconstant_time_test.c;h=faadcb79b5095163dbe9263f8abb385c9001bc40;hb=ddc606c914e72e770dbe8293a65585b7c3017bba;hp=d313d0c7a9be75e4077b65dd98da245ac193f78f;hpb=dee502be89e78e2979e3bd1d7724cf79daa6ef61;p=openssl.git diff --git a/test/constant_time_test.c b/test/constant_time_test.c index d313d0c7a9..faadcb79b5 100644 --- a/test/constant_time_test.c +++ b/test/constant_time_test.c @@ -1,4 +1,3 @@ -/* crypto/constant_time_test.c */ /*- * Utilities for constant-time cryptography. * @@ -44,7 +43,8 @@ * [including the GNU Public Licence.] */ -#include "../crypto/constant_time_locl.h" +#include "internal/constant_time_locl.h" +#include "e_os.h" #include #include @@ -231,12 +231,12 @@ int main(int argc, char *argv[]) int num_failed = 0, num_all = 0; fprintf(stdout, "Testing constant time operations...\n"); - for (i = 0; i < sizeof(test_values) / sizeof(int); ++i) { + for (i = 0; i < OSSL_NELEM(test_values); ++i) { a = test_values[i]; num_failed += test_is_zero(a); num_failed += test_is_zero_8(a); num_all += 2; - for (j = 0; j < sizeof(test_values) / sizeof(int); ++j) { + for (j = 0; j < OSSL_NELEM(test_values); ++j) { b = test_values[j]; num_failed += test_binary_op(&constant_time_lt, "constant_time_lt", a, b, a < b); @@ -274,9 +274,9 @@ int main(int argc, char *argv[]) } } - for (i = 0; i < sizeof(signed_test_values) / sizeof(int); ++i) { + for (i = 0; i < OSSL_NELEM(signed_test_values); ++i) { c = signed_test_values[i]; - for (j = 0; j < sizeof(signed_test_values) / sizeof(int); ++j) { + for (j = 0; j < OSSL_NELEM(signed_test_values); ++j) { d = signed_test_values[j]; num_failed += test_select_int(c, d); num_failed += test_eq_int(c, d); @@ -295,7 +295,7 @@ int main(int argc, char *argv[]) } if (!num_failed) { - fprintf(stdout, "ok (ran %d tests)\n", num_all); + fprintf(stdout, "success (ran %d tests)\n", num_all); return EXIT_SUCCESS; } else { fprintf(stdout, "%d of %d tests failed!\n", num_failed, num_all);