* -- 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
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");
{
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;
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);
}
},
};
-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;
BN_CTX_free(ctx);
}
-void nistp_tests()
+static void nistp_tests()
{
unsigned i;