Fix warnings.
[openssl.git] / crypto / ec / ectest.c
index ac0f055faf0432e2506c66b2318930bfc0da3452..6da5d4b2473a462183a2e497f56850e1cd00fa0e 100644 (file)
@@ -55,6 +55,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 
 
@@ -148,6 +149,7 @@ int main(int argc, char *argv[])
        BIGNUM *x, *y, *z;
        unsigned char buf[100];
        size_t i, len;
+       int k;
        
        /* enable memory leak checking unless explicitly disabled */
        if (!((getenv("OPENSSL_DEBUG_MEMORY") != NULL) && (0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off"))))
@@ -230,8 +232,11 @@ int main(int argc, char *argv[])
                }
 
        fprintf(stdout, "A cyclic subgroup:\n");
+       k = 100;
        do
                {
+               if (k-- == 0) ABORT;
+
                if (EC_POINT_is_at_infinity(group, P))
                        fprintf(stdout, "     point at infinity\n");
                else
@@ -330,7 +335,7 @@ int main(int argc, char *argv[])
        if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
        fprintf(stdout, ".");
        fflush(stdout);
-       if (!EC_GROUP_precompute(group, ctx)) ABORT;
+       if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
        if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
        if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
        fprintf(stdout, " ok\n");
@@ -370,7 +375,7 @@ int main(int argc, char *argv[])
        if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
        fprintf(stdout, ".");
        fflush(stdout);
-       if (!EC_GROUP_precompute(group, ctx)) ABORT;
+       if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
        if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
        if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
        fprintf(stdout, " ok\n");
@@ -411,7 +416,7 @@ int main(int argc, char *argv[])
        if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
        fprintf(stdout, ".");
        fflush(stdout);
-       if (!EC_GROUP_precompute(group, ctx)) ABORT;
+       if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
        if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
        if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
        fprintf(stdout, " ok\n");
@@ -457,7 +462,7 @@ int main(int argc, char *argv[])
        if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
        fprintf(stdout, ".");
        fflush(stdout);
-       if (!EC_GROUP_precompute(group, ctx)) ABORT;
+       if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
        if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
        if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
        fprintf(stdout, " ok\n");
@@ -509,7 +514,7 @@ int main(int argc, char *argv[])
        if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
        fprintf(stdout, ".");
        fflush(stdout);
-       if (!EC_GROUP_precompute(group, ctx)) ABORT;
+       if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
        if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
        if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
        fprintf(stdout, " ok\n");