diff options
author | Rich Salz <rsalz@akamai.com> | 2015-05-15 13:50:38 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-06-02 12:40:24 -0400 |
commit | 9c3bcfa027cb32421ed20ab77553860b922b82fc (patch) | |
tree | 5bc2b7a055c4abbc75431212948d0693d922f3ab /apps/ciphers.c | |
parent | 366e2a60b2fcc727b061f1459343245476ad6c3b (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/ciphers.c')
-rw-r--r-- | apps/ciphers.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/apps/ciphers.c b/apps/ciphers.c index b1b3bddd76..a2ccf2842d 100644 --- a/apps/ciphers.c +++ b/apps/ciphers.c @@ -64,12 +64,8 @@ typedef enum OPTION_choice { OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, -#ifndef OPENSSL_NO_SSL_TRACE OPT_STDNAME, -#endif -#ifndef OPENSSL_NO_SSL3 OPT_SSL3, -#endif OPT_TLS1, OPT_V, OPT_UPPER_V, OPT_S } OPTION_CHOICE; @@ -79,13 +75,13 @@ OPTIONS ciphers_options[] = { {"v", OPT_V, '-', "Verbose listing of the SSL/TLS ciphers"}, {"V", OPT_UPPER_V, '-', "Even more verbose"}, {"s", OPT_S, '-', "Only supported ciphers"}, + {"tls1", OPT_TLS1, '-', "TLS1 mode"}, #ifndef OPENSSL_NO_SSL_TRACE {"stdname", OPT_STDNAME, '-', "Show standard cipher names"}, #endif #ifndef OPENSSL_NO_SSL3 {"ssl3", OPT_SSL3, '-', "SSL3 mode"}, #endif - {"tls1", OPT_TLS1, '-', "TLS1 mode"}, {NULL} }; @@ -125,16 +121,16 @@ int ciphers_main(int argc, char **argv) case OPT_S: use_supported = 1; break; -#ifndef OPENSSL_NO_SSL_TRACE case OPT_STDNAME: +#ifndef OPENSSL_NO_SSL_TRACE stdname = verbose = 1; - break; #endif -#ifndef OPENSSL_NO_SSL3 + break; case OPT_SSL3: +#ifndef OPENSSL_NO_SSL3 meth = SSLv3_client_method(); - break; #endif + break; case OPT_TLS1: meth = TLSv1_client_method(); break; |