diff options
author | Rich Salz <rsalz@openssl.org> | 2015-02-02 11:11:34 -0500 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-02-02 11:11:34 -0500 |
commit | 9ccc00ef6ea65567622e40c49aca43f2c6d79cdb (patch) | |
tree | c6d8ee38c57de246455d61548d110cdde6834327 /crypto/ec | |
parent | 7aa0b022460e1a7bfdf5c70e8cd084d916bac012 (diff) |
Dead code cleanup: #if 0 dropped from tests
Reviewed-by: Andy Polyakov <appro@openssl.org>
Diffstat (limited to 'crypto/ec')
-rw-r--r-- | crypto/ec/ectest.c | 157 |
1 files changed, 0 insertions, 157 deletions
diff --git a/crypto/ec/ectest.c b/crypto/ec/ectest.c index a6be1a9556..fc04f3b3e1 100644 --- a/crypto/ec/ectest.c +++ b/crypto/ec/ectest.c @@ -114,93 +114,6 @@ int main(int argc, char *argv[]) # define TIMING_RAND_PT 1 # define TIMING_SIMUL 2 -# if 0 -static void timings(EC_GROUP *group, int type, BN_CTX *ctx) -{ - clock_t clck; - int i, j; - BIGNUM *s; - BIGNUM *r[10], *r0[10]; - EC_POINT *P; - - s = BN_new(); - if (s == NULL) - ABORT; - - fprintf(stdout, "Timings for %d-bit field, ", EC_GROUP_get_degree(group)); - if (!EC_GROUP_get_order(group, s, ctx)) - ABORT; - fprintf(stdout, "%d-bit scalars ", (int)BN_num_bits(s)); - fflush(stdout); - - P = EC_POINT_new(group); - if (P == NULL) - ABORT; - EC_POINT_copy(P, EC_GROUP_get0_generator(group)); - - for (i = 0; i < 10; i++) { - if ((r[i] = BN_new()) == NULL) - ABORT; - if (!BN_pseudo_rand(r[i], BN_num_bits(s), 0, 0)) - ABORT; - if (type != TIMING_BASE_PT) { - if ((r0[i] = BN_new()) == NULL) - ABORT; - if (!BN_pseudo_rand(r0[i], BN_num_bits(s), 0, 0)) - ABORT; - } - } - - clck = clock(); - for (i = 0; i < 10; i++) { - for (j = 0; j < 10; j++) { - if (!EC_POINT_mul - (group, P, (type != TIMING_RAND_PT) ? r[i] : NULL, - (type != TIMING_BASE_PT) ? P : NULL, - (type != TIMING_BASE_PT) ? r0[i] : NULL, ctx)) - ABORT; - } - } - clck = clock() - clck; - - fprintf(stdout, "\n"); - -# ifdef CLOCKS_PER_SEC - /* - * "To determine the time in seconds, the value returned by the clock - * function should be divided by the value of the macro CLOCKS_PER_SEC." - * -- ISO/IEC 9899 - */ -# define UNIT "s" -# else -# define UNIT "units" -# define CLOCKS_PER_SEC 1 -# endif - - if (type == TIMING_BASE_PT) { - fprintf(stdout, "%i %s in %.2f " UNIT "\n", i * j, - "base point multiplications", (double)clck / CLOCKS_PER_SEC); - } else if (type == TIMING_RAND_PT) { - fprintf(stdout, "%i %s in %.2f " UNIT "\n", i * j, - "random point multiplications", - (double)clck / CLOCKS_PER_SEC); - } else if (type == TIMING_SIMUL) { - fprintf(stdout, "%i %s in %.2f " UNIT "\n", i * j, - "s*P+t*Q operations", (double)clck / CLOCKS_PER_SEC); - } - fprintf(stdout, "average: %.4f " UNIT "\n", - (double)clck / (CLOCKS_PER_SEC * i * j)); - - EC_POINT_free(P); - BN_free(s); - for (i = 0; i < 10; i++) { - BN_free(r[i]); - if (type != TIMING_BASE_PT) - BN_free(r0[i]); - } -} -# endif - /* test multiplication with group order, long and negative scalars */ static void group_order_tests(EC_GROUP *group) { @@ -443,18 +356,6 @@ static void prime_field_tests(void) if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT; -# if 0 /* optional */ - { - EC_POINT *points[3]; - - points[0] = R; - points[1] = Q; - points[2] = P; - if (!EC_POINTs_make_affine(group, 2, points, ctx)) - ABORT; - } -# endif - } while (!EC_POINT_is_at_infinity(group, P)); @@ -952,27 +853,6 @@ static void prime_field_tests(void) BN_free(scalar3); } -# if 0 - timings(P_160, TIMING_BASE_PT, ctx); - timings(P_160, TIMING_RAND_PT, ctx); - timings(P_160, TIMING_SIMUL, ctx); - timings(P_192, TIMING_BASE_PT, ctx); - timings(P_192, TIMING_RAND_PT, ctx); - timings(P_192, TIMING_SIMUL, ctx); - timings(P_224, TIMING_BASE_PT, ctx); - timings(P_224, TIMING_RAND_PT, ctx); - timings(P_224, TIMING_SIMUL, ctx); - timings(P_256, TIMING_BASE_PT, ctx); - timings(P_256, TIMING_RAND_PT, ctx); - timings(P_256, TIMING_SIMUL, ctx); - timings(P_384, TIMING_BASE_PT, ctx); - timings(P_384, TIMING_RAND_PT, ctx); - timings(P_384, TIMING_SIMUL, ctx); - timings(P_521, TIMING_BASE_PT, ctx); - timings(P_521, TIMING_RAND_PT, ctx); - timings(P_521, TIMING_SIMUL, ctx); -# endif - if (ctx) BN_CTX_free(ctx); BN_free(p); @@ -1456,39 +1336,6 @@ static void char2_field_tests(void) fprintf(stdout, " ok\n\n"); } -# if 0 - timings(C2_K163, TIMING_BASE_PT, ctx); - timings(C2_K163, TIMING_RAND_PT, ctx); - timings(C2_K163, TIMING_SIMUL, ctx); - timings(C2_B163, TIMING_BASE_PT, ctx); - timings(C2_B163, TIMING_RAND_PT, ctx); - timings(C2_B163, TIMING_SIMUL, ctx); - timings(C2_K233, TIMING_BASE_PT, ctx); - timings(C2_K233, TIMING_RAND_PT, ctx); - timings(C2_K233, TIMING_SIMUL, ctx); - timings(C2_B233, TIMING_BASE_PT, ctx); - timings(C2_B233, TIMING_RAND_PT, ctx); - timings(C2_B233, TIMING_SIMUL, ctx); - timings(C2_K283, TIMING_BASE_PT, ctx); - timings(C2_K283, TIMING_RAND_PT, ctx); - timings(C2_K283, TIMING_SIMUL, ctx); - timings(C2_B283, TIMING_BASE_PT, ctx); - timings(C2_B283, TIMING_RAND_PT, ctx); - timings(C2_B283, TIMING_SIMUL, ctx); - timings(C2_K409, TIMING_BASE_PT, ctx); - timings(C2_K409, TIMING_RAND_PT, ctx); - timings(C2_K409, TIMING_SIMUL, ctx); - timings(C2_B409, TIMING_BASE_PT, ctx); - timings(C2_B409, TIMING_RAND_PT, ctx); - timings(C2_B409, TIMING_SIMUL, ctx); - timings(C2_K571, TIMING_BASE_PT, ctx); - timings(C2_K571, TIMING_RAND_PT, ctx); - timings(C2_K571, TIMING_SIMUL, ctx); - timings(C2_B571, TIMING_BASE_PT, ctx); - timings(C2_B571, TIMING_RAND_PT, ctx); - timings(C2_B571, TIMING_SIMUL, ctx); -# endif - if (ctx) BN_CTX_free(ctx); BN_free(p); @@ -1783,10 +1630,6 @@ static void nistp_single_test(const struct nistp_test_params *test) fprintf(stdout, "ok\n"); group_order_tests(NISTP); -# if 0 - timings(NISTP, TIMING_BASE_PT, ctx); - timings(NISTP, TIMING_RAND_PT, ctx); -# endif EC_GROUP_free(NISTP); EC_POINT_free(G); EC_POINT_free(P); |