Support EVP_PKEY_sign() and EVP_PKEY_verify() for EdDSA
[openssl.git] / apps / version.c
index 298d837f5afbded22600a1b1663601d4b039d7ec..2aca1636152bb263ba36b978a49ecec8fcf1fa14 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -11,6 +11,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "apps.h"
+#include "progs.h"
 #include <openssl/evp.h>
 #include <openssl/crypto.h>
 #include <openssl/bn.h>
@@ -49,6 +50,16 @@ const OPTIONS version_options[] = {
     {NULL}
 };
 
+#if defined(OPENSSL_RAND_SEED_DEVRANDOM) || defined(OPENSSL_RAND_SEED_EGD)
+static void printlist(const char *prefix, const char **dev)
+{
+    printf("%s (", prefix);
+    for ( ; *dev != NULL; dev++)
+        printf(" \"%s\"", *dev);
+    printf(" )");
+}
+#endif
+
 int version_main(int argc, char **argv)
 {
     int ret = 1, dirty = 0, seed = 0;
@@ -62,6 +73,7 @@ int version_main(int argc, char **argv)
         switch (o) {
         case OPT_EOF:
         case OPT_ERR:
+opthelp:
             BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
             goto end;
         case OPT_HELP:
@@ -93,10 +105,15 @@ int version_main(int argc, char **argv)
             dirty = version = 1;
             break;
         case OPT_A:
-            seed = cflags = version = date = platform = dir = engdir = 1;
+            seed = options = cflags = version = date = platform = dir = engdir
+                = 1;
             break;
         }
     }
+    if (opt_num_rest() != 0) {
+        BIO_printf(bio_err, "Extra parameters given.\n");
+        goto opthelp;
+    }
     if (!dirty)
         version = 1;
 
@@ -143,7 +160,7 @@ int version_main(int argc, char **argv)
         printf(" rtdsc");
 #endif
 #ifdef OPENSSL_RAND_SEED_RDCPU
-        printf(" rdrand-hardware");
+        printf(" rdrand ( rdseed rdrand )");
 #endif
 #ifdef OPENSSL_RAND_SEED_LIBRANDOM
         printf(" C-library-random");
@@ -152,10 +169,16 @@ int version_main(int argc, char **argv)
         printf(" getrandom-syscall");
 #endif
 #ifdef OPENSSL_RAND_SEED_DEVRANDOM
-        printf(" random-device");
+        {
+            static const char *dev[] = { DEVRANDOM, NULL };
+            printlist(" random-device", dev);
+        }
 #endif
 #ifdef OPENSSL_RAND_SEED_EGD
-        printf(" EGD");
+        {
+            static const char *dev[] = { DEVRANDOM_EGD, NULL };
+            printlist(" EGD", dev);
+        }
 #endif
 #ifdef OPENSSL_RAND_SEED_NONE
         printf(" none");
@@ -167,5 +190,5 @@ int version_main(int argc, char **argv)
     }
     ret = 0;
  end:
-    return (ret);
+    return ret;
 }