Guard GF2m-specifics with OPENSSL_NO_EC2M
authortb <tb@openbsd.org>
Sat, 25 Mar 2023 09:23:44 +0000 (09:23 +0000)
committertb <tb@openbsd.org>
Sat, 25 Mar 2023 09:23:44 +0000 (09:23 +0000)
regress/lib/libcrypto/ec/ec_point_conversion.c

index 04177a0..a32bdbd 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ec_point_conversion.c,v 1.7 2022/12/01 13:49:12 tb Exp $ */
+/*     $OpenBSD: ec_point_conversion.c,v 1.8 2023/03/25 09:23:44 tb Exp $ */
 /*
  * Copyright (c) 2021 Theo Buehler <tb@openbsd.org>
  * Copyright (c) 2021 Joel Sing <jsing@openbsd.org>
@@ -109,6 +109,7 @@ roundtrip(EC_GROUP *group, EC_POINT *point, int form, BIGNUM *x, BIGNUM *y)
        return failed;
 }
 
+#ifndef OPENSSL_NO_EC2M
 static int
 test_hybrid_corner_case(void)
 {
@@ -143,6 +144,7 @@ test_hybrid_corner_case(void)
 
        return failed;
 }
+#endif
 
 /* XXX This only tests multiples of the generator for now... */
 static int
@@ -242,6 +244,7 @@ static const struct point_conversion {
        uint8_t octets_len;
        int valid;
 } point_conversions[] = {
+#ifndef OPENSSL_NO_EC2M
        {
                .description = "point at infinity on sect571k1",
                .nid = NID_sect571k1,
@@ -549,7 +552,7 @@ static const struct point_conversion {
                .octets_len = 145,
                .valid = 0,
        },
-
+#endif
        {
                .description = "point at infinity on secp256r1",
                .nid = NID_X9_62_prime256v1,
@@ -880,7 +883,9 @@ main(int argc, char **argv)
        int failed = 0;
 
        failed |= test_random_points();
+#ifndef OPENSSL_NO_EC2M
        failed |= test_hybrid_corner_case();
+#endif
        failed |= test_point_conversions();
 
        return failed;