summaryrefslogtreecommitdiffstats
path: root/apps/rsa.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2015-05-15 13:50:38 -0400
committerRich Salz <rsalz@openssl.org>2015-06-02 12:40:24 -0400
commit9c3bcfa027cb32421ed20ab77553860b922b82fc (patch)
tree5bc2b7a055c4abbc75431212948d0693d922f3ab /apps/rsa.c
parent366e2a60b2fcc727b061f1459343245476ad6c3b (diff)
Standardize handling of #ifdef'd options.
Here are the "rules" for handling flags that depend on #ifdef: - Do not ifdef the enum. Only ifdef the OPTIONS table. All ifdef'd entries appear at the end; by convention "engine" is last. This ensures that at run-time, the flag will never be recognized/allowed. The next two bullets entries are for silencing compiler warnings: - In the while/switch parsing statement, use #ifdef for the body to disable it; leave the "case OPT_xxx:" and "break" statements outside the ifdef/ifndef. See ciphers.c for example. - If there are multiple options controlled by a single guard, OPT_FOO, OPT_BAR, etc., put a an #ifdef around the set, and then do "#else" and a series of case labels and a break. See OPENSSL_NO_AES in cms.c for example. Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'apps/rsa.c')
-rw-r--r--apps/rsa.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/apps/rsa.c b/apps/rsa.c
index 87cb70254e..51581aed28 100644
--- a/apps/rsa.c
+++ b/apps/rsa.c
@@ -138,14 +138,16 @@ OPTIONS rsa_options[] = {
{"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
{"RSAPublicKey_in", OPT_RSAPUBKEY_IN, '-', "Input is an RSAPublicKey"},
{"RSAPublicKey_out", OPT_RSAPUBKEY_OUT, '-', "Output is an RSAPublicKey"},
- {"pvk-strong", OPT_PVK_STRONG, '-'},
- {"pvk-weak", OPT_PVK_WEAK, '-'},
- {"pvk-none", OPT_PVK_NONE, '-'},
{"noout", OPT_NOOUT, '-', "Don't print key out"},
{"text", OPT_TEXT, '-', "Print the key in text"},
{"modulus", OPT_MODULUS, '-', "Print the RSA key modulus"},
{"check", OPT_CHECK, '-', "Verify key consistency"},
{"", OPT_CIPHER, '-', "Any supported cipher"},
+# ifdef OPENSSL_NO_RC4
+ {"pvk-strong", OPT_PVK_STRONG, '-'},
+ {"pvk-weak", OPT_PVK_WEAK, '-'},
+ {"pvk-none", OPT_PVK_NONE, '-'},
+# endif
# ifndef OPENSSL_NO_ENGINE
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
# endif
@@ -170,11 +172,6 @@ int rsa_main(int argc, char **argv)
switch (o) {
case OPT_EOF:
case OPT_ERR:
-#ifdef OPENSSL_NO_RC4
- case OPT_PVK_STRONG:
- case OPT_PVK_WEAK:
- case OPT_PVK_NONE:
-#endif
opthelp:
BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
goto end;
@@ -227,6 +224,11 @@ int rsa_main(int argc, char **argv)
case OPT_PVK_NONE:
pvk_encr = 0;
break;
+#else
+ case OPT_PVK_STRONG:
+ case OPT_PVK_WEAK:
+ case OPT_PVK_NONE:
+ break;
#endif
case OPT_NOOUT:
noout = 1;