Cleanup OPENSSL_NO_xxx, part 1
[oweals/openssl.git] / crypto / ec / ectest.c
index 82c8c8bfb119c6cbc73413ee25969404af2cc8ac..16cf43f0edcd94f655564ce9a8c36503d05cb306 100644 (file)
@@ -164,8 +164,6 @@ static void timings(EC_GROUP *group, int type, BN_CTX *ctx)
         *                                       -- ISO/IEC 9899 */
 #      define UNIT "s"
 #else
-       /* "`CLOCKS_PER_SEC' undeclared (first use this function)"
-        *                            -- cc on NeXTstep/OpenStep */
 #      define UNIT "units"
 #      define CLOCKS_PER_SEC 1
 #endif
@@ -251,14 +249,15 @@ static void group_order_tests(EC_GROUP *group)
                if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
 
                /* Exercise EC_POINTs_mul, including corner cases. */
+               if (EC_POINT_is_at_infinity(group, P)) ABORT;
                scalars[0] = n1; points[0] = Q; /* => infinity */
                scalars[1] = n2; points[1] = P; /* => -P */
                scalars[2] = n1; points[2] = Q; /* => infinity */
                scalars[3] = n2; points[3] = Q; /* => infinity */
                scalars[4] = n1; points[4] = P; /* => P */
                scalars[5] = n2; points[5] = Q; /* => infinity */
-               if (!EC_POINTs_mul(group, Q, NULL, 5, points, scalars, ctx)) ABORT;
-               if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
+               if (!EC_POINTs_mul(group, P, NULL, 6, points, scalars, ctx)) ABORT;
+               if (!EC_POINT_is_at_infinity(group, P)) ABORT;
                }
        fprintf(stdout, "ok\n");
 
@@ -666,7 +665,7 @@ static void prime_field_tests(void)
        {
                const EC_POINT *points[4];
                const BIGNUM *scalars[4];
-               BIGNUM scalar3;
+               BIGNUM *scalar3;
        
                if (EC_POINT_is_at_infinity(group, Q)) ABORT;
                points[0] = Q;
@@ -712,16 +711,17 @@ static void prime_field_tests(void)
                scalars[1] = y;
                scalars[2] = z; /* z = -(x+y) */
 
-               BN_init(&scalar3);
-               BN_zero(&scalar3);
-               scalars[3] = &scalar3;
+               scalar3 = BN_new();
+               if(!scalar3) ABORT;
+               BN_zero(scalar3);
+               scalars[3] = scalar3;
 
                if (!EC_POINTs_mul(group, P, NULL, 4, points, scalars, ctx)) ABORT;
                if (!EC_POINT_is_at_infinity(group, P)) ABORT;
 
                fprintf(stdout, " ok\n\n");
 
-               BN_free(&scalar3);
+               BN_free(scalar3);
        }
 
 
@@ -1365,7 +1365,7 @@ static const struct nistp_test_params nistp_tests_params[] =
                },
        };
 
-void nistp_single_test(const struct nistp_test_params *test)
+static void nistp_single_test(const struct nistp_test_params *test)
        {
        BN_CTX *ctx;
        BIGNUM *p, *a, *b, *x, *y, *n, *m, *order;
@@ -1468,7 +1468,7 @@ void nistp_single_test(const struct nistp_test_params *test)
        BN_CTX_free(ctx);
        }
 
-void nistp_tests()
+static void nistp_tests()
        {
        unsigned i;