X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fec%2Fectest.c;h=eab46cc0806eb945e93d4aa9397905f0ed6d6c1d;hp=bebfb24e42457c79ffd639d68db2c93203d71e21;hb=65ee74fbc75b06e58bbcb7cc35fc68191cd289c2;hpb=b8e2f83ae69e6451fb374c02ca20e3f60657c0f7;ds=sidebyside diff --git a/crypto/ec/ectest.c b/crypto/ec/ectest.c index bebfb24e42..eab46cc080 100644 --- a/crypto/ec/ectest.c +++ b/crypto/ec/ectest.c @@ -75,8 +75,8 @@ int main(int argc, char * argv[]) { puts("Elliptic curves are disabled."); retur exit(1); \ } while (0) - -void timings(EC_GROUP *group, int simult, BN_CTX *ctx) +#if 0 +static void timings(EC_GROUP *group, int multi, BN_CTX *ctx) { clock_t clck; int i, j; @@ -101,13 +101,13 @@ void timings(EC_GROUP *group, int simult, BN_CTX *ctx) for (i = 0; i < 10; i++) { if (!BN_pseudo_rand(s, BN_num_bits(s), 0, 0)) ABORT; - if (simult) + if (multi) { if (!BN_pseudo_rand(s0, BN_num_bits(s), 0, 0)) ABORT; } for (j = 0; j < 10; j++) { - if (!EC_POINT_mul(group, P, s, simult ? P : NULL, simult ? s0 : NULL, ctx)) ABORT; + if (!EC_POINT_mul(group, P, s, multi ? P : NULL, multi ? s0 : NULL, ctx)) ABORT; } fprintf(stdout, "."); fflush(stdout); @@ -130,7 +130,7 @@ void timings(EC_GROUP *group, int simult, BN_CTX *ctx) #endif fprintf(stdout, "%i %s in %.2f " UNIT "\n", i*j, - simult ? "s*P+t*Q operations" : "point multiplications", + multi ? "s*P+t*Q operations" : "point multiplications", (double)clck/CLOCKS_PER_SEC); fprintf(stdout, "average: %.4f " UNIT "\n", (double)clck/(CLOCKS_PER_SEC*i*j)); @@ -138,7 +138,7 @@ void timings(EC_GROUP *group, int simult, BN_CTX *ctx) BN_free(s); BN_free(s0); } - +#endif int main(int argc, char *argv[]) { @@ -156,7 +156,12 @@ int main(int argc, char *argv[]) if (!((getenv("OPENSSL_DEBUG_MEMORY") != NULL) && (0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off")))) { CRYPTO_malloc_debug_init(); - CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL); + CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL); + } + else + { + /* OPENSSL_DEBUG_MEMORY=off */ + CRYPTO_set_mem_debug_functions(0, 0, 0, 0, 0); } CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); ERR_load_crypto_strings(); @@ -551,7 +556,7 @@ int main(int argc, char *argv[]) scalars[0] = y; /* (group order + 1)/2, so y*Q + y*Q = Q */ scalars[1] = y; - fprintf(stdout, "simultaneous multiplication ..."); + fprintf(stdout, "combined multiplication ..."); fflush(stdout); /* z is still the group order */ @@ -564,10 +569,10 @@ int main(int argc, char *argv[]) fflush(stdout); if (!BN_pseudo_rand(y, BN_num_bits(y), 0, 0)) ABORT; - if (!BN_copy(z, y)) ABORT; + if (!BN_add(z, z, y)) ABORT; z->neg = 1; scalars[0] = y; - scalars[1] = z; /* z = -y */ + scalars[1] = z; /* z = -(order + y) */ if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT; if (!EC_POINT_is_at_infinity(group, P)) ABORT; @@ -619,6 +624,7 @@ int main(int argc, char *argv[]) if (P_521) EC_GROUP_free(P_521); ENGINE_cleanup(); + CRYPTO_cleanup_all_ex_data(); ERR_free_strings(); ERR_remove_state(0); CRYPTO_mem_leaks_fp(stderr);