Fix ec_GFp_simple_cmp.
[openssl.git] / crypto / ec / ectest.c
index 5425dce01e31c2ad983e88ce6c40b4fdf4eb0bc4..53f88c651738648853dbdbe376d783b6b004287f 100644 (file)
@@ -94,12 +94,14 @@ int main(int argc, char *argv[])
        b = BN_new();
        if (!p || !a || !b) ABORT;
 
-       if (!BN_hex2bn(&p, "D")) ABORT;
-       if (!BN_hex2bn(&a, "7")) ABORT;
-       if (!BN_hex2bn(&b, "C")) ABORT;
+       if (!BN_hex2bn(&p, "17")) ABORT;
+       if (!BN_hex2bn(&a, "1")) ABORT;
+       if (!BN_hex2bn(&b, "1")) ABORT;
        
-       group = EC_GROUP_new_curve_GFp(p, a, b, NULL);
+       group = EC_GROUP_new(EC_GFp_mont_method());
        if (!group) ABORT;
+       if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
+       if (!EC_GROUP_get_curve_GFp(group, p, a, b, ctx)) ABORT;
 
        fprintf(stdout, "Curve defined by Weierstrass equation\n     y^2 = x^3 + a*x + b  (mod 0x");
        BN_print_fp(stdout, p);
@@ -128,12 +130,15 @@ int main(int argc, char *argv[])
        z = BN_new();
        if (!x || !y || !z) ABORT;
 
-       if (!BN_hex2bn(&x, "C")) ABORT;
+       if (!BN_hex2bn(&x, "D")) ABORT;
        if (!EC_POINT_set_compressed_coordinates_GFp(group, Q, x, 1, ctx)) ABORT;
        if (!EC_POINT_is_on_curve(group, Q, ctx))
                {
-               fprintf(stderr, "Point is not on curve, x = 0x");
+               if (!EC_POINT_get_affine_coordinates_GFp(group, Q, x, y, ctx)) ABORT;
+               fprintf(stderr, "Point is not on curve: x = 0x");
                BN_print_fp(stderr, x);
+               fprintf(stderr, ", y = 0x");
+               BN_print_fp(stderr, y);
                fprintf(stderr, "\n");
                ABORT;
                }