]> git.ipfire.org Git - thirdparty/openssl.git/blobdiff - apps/ec.c
Force public key to be included unless explicitly excluded with -no_public
[thirdparty/openssl.git] / apps / ec.c
index 3d5371ccdcdffdd33d2671671317e9cad64afe44..5103838da036949022cb52d69b42616442df7427 100644 (file)
--- a/apps/ec.c
+++ b/apps/ec.c
@@ -211,10 +211,16 @@ int ec_main(int argc, char **argv)
         goto end;
     }
 
-    if (no_public
-        && !EVP_PKEY_set_int_param(eckey, OSSL_PKEY_PARAM_EC_INCLUDE_PUBLIC, 0)) {
-        BIO_printf(bio_err, "unable to disable public key encoding\n");
-        goto end;
+    if (no_public) {
+        if (!EVP_PKEY_set_int_param(eckey, OSSL_PKEY_PARAM_EC_INCLUDE_PUBLIC, 0)) {
+            BIO_printf(bio_err, "unable to disable public key encoding\n");
+            goto end;
+        }
+    } else {
+        if (!EVP_PKEY_set_int_param(eckey, OSSL_PKEY_PARAM_EC_INCLUDE_PUBLIC, 1)) {
+            BIO_printf(bio_err, "unable to enable public key encoding\n");
+            goto end;
+        }
     }
 
     if (text) {