BIGNUM *n1, *n2, *order;
EC_POINT *P = EC_POINT_new(group);
EC_POINT *Q = EC_POINT_new(group);
+ EC_POINT *R = EC_POINT_new(group);
+ EC_POINT *S = EC_POINT_new(group);
BN_CTX *ctx = BN_CTX_new();
int i;
/* Exercise EC_POINTs_mul, including corner cases. */
if (EC_POINT_is_at_infinity(group, P))
ABORT;
+
+ scalars[0] = scalars[1] = BN_value_one();
+ points[0] = points[1] = P;
+
+ if (!EC_POINTs_mul(group, R, NULL, 2, points, scalars, ctx))
+ ABORT;
+ if (!EC_POINT_dbl(group, S, points[0], ctx))
+ ABORT;
+ if (0 != EC_POINT_cmp(group, R, S, ctx))
+ ABORT;
+
scalars[0] = n1;
points[0] = Q; /* => infinity */
scalars[1] = n2;
EC_POINT_free(P);
EC_POINT_free(Q);
+ EC_POINT_free(R);
+ EC_POINT_free(S);
BN_free(n1);
BN_free(n2);
BN_free(order);
for (n = 0; n < crv_len; n++) {
EC_GROUP *group = NULL;
int nid = curves[n].nid;
+ /*
+ * Skip for X25519 because low level operations such as EC_POINT_mul()
+ * are not supported for this curve
+ */
+ if (nid == NID_X25519)
+ continue;
fprintf(stdout, "%s:\n", OBJ_nid2sn(nid));
fflush(stdout);
if ((group = EC_GROUP_new_by_curve_name(nid)) == NULL) {
if (p != NULL && strcmp(p, "on") == 0)
CRYPTO_set_mem_debug(1);
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
- ERR_load_crypto_strings();
RAND_seed(rnd_seed, sizeof rnd_seed); /* or BN_generate_prime may fail */
/* test the internal curves */
internal_curve_test();
-# ifndef OPENSSL_NO_ENGINE
- ENGINE_cleanup();
-# endif
- CRYPTO_cleanup_all_ex_data();
- ERR_free_strings();
- ERR_remove_thread_state(NULL);
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
- CRYPTO_mem_leaks_fp(stderr);
+ if (CRYPTO_mem_leaks_fp(stderr) <= 0)
+ return 1;
#endif
return 0;