Disable SHA256 if not supported.
[openssl.git] / apps / rsautl.c
index 596199010a39ba7e7b196803904ae497a89363e9..b01f004eb3f6c8c91e43fe53d19e61a68d4a6b7b 100644 (file)
@@ -1,5 +1,5 @@
 /* rsautl.c */
-/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
+/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
  * project 2000.
  */
 /* ====================================================================
@@ -56,6 +56,7 @@
  *
  */
 
+#include <openssl/opensslconf.h>
 #ifndef OPENSSL_NO_RSA
 
 #include "apps.h"
@@ -118,24 +119,36 @@ int MAIN(int argc, char **argv)
        while(argc >= 1)
        {
                if (!strcmp(*argv,"-in")) {
-                       if (--argc < 1) badarg = 1;
-                        infile= *(++argv);
+                       if (--argc < 1)
+                               badarg = 1;
+                       else
+                               infile= *(++argv);
                } else if (!strcmp(*argv,"-out")) {
-                       if (--argc < 1) badarg = 1;
-                       outfile= *(++argv);
+                       if (--argc < 1)
+                               badarg = 1;
+                       else
+                               outfile= *(++argv);
                } else if(!strcmp(*argv, "-inkey")) {
-                       if (--argc < 1) badarg = 1;
-                       keyfile = *(++argv);
+                       if (--argc < 1)
+                               badarg = 1;
+                       else
+                               keyfile = *(++argv);
                } else if (!strcmp(*argv,"-passin")) {
-                       if (--argc < 1) badarg = 1;
-                       passargin= *(++argv);
+                       if (--argc < 1)
+                               badarg = 1;
+                       else
+                               passargin= *(++argv);
                } else if (strcmp(*argv,"-keyform") == 0) {
-                       if (--argc < 1) badarg = 1;
-                       keyform=str2fmt(*(++argv));
+                       if (--argc < 1)
+                               badarg = 1;
+                       else
+                               keyform=str2fmt(*(++argv));
 #ifndef OPENSSL_NO_ENGINE
                } else if(!strcmp(*argv, "-engine")) {
-                       if (--argc < 1) badarg = 1;
-                       engine = *(++argv);
+                       if (--argc < 1)
+                               badarg = 1;
+                       else
+                               engine = *(++argv);
 #endif
                } else if(!strcmp(*argv, "-pubin")) {
                        key_type = KEY_PUBKEY;
@@ -148,6 +161,7 @@ int MAIN(int argc, char **argv)
                else if(!strcmp(*argv, "-oaep")) pad = RSA_PKCS1_OAEP_PADDING;
                else if(!strcmp(*argv, "-ssl")) pad = RSA_SSLV23_PADDING;
                else if(!strcmp(*argv, "-pkcs")) pad = RSA_PKCS1_PADDING;
+               else if(!strcmp(*argv, "-x931")) pad = RSA_X931_PADDING;
                else if(!strcmp(*argv, "-sign")) {
                        rsa_mode = RSA_SIGN;
                        need_priv = 1;
@@ -328,4 +342,10 @@ static void usage()
 
 }
 
+#else /* !OPENSSL_NO_RSA */
+
+# if PEDANTIC
+static void *dummy=&dummy;
+# endif
+
 #endif