提交 e7917e38 编写于 作者: F FdaSilvaYY 提交者: Matt Caswell

Simplify and add help about OPT_PVK* options

Reviewed-by: NRich Salz <rsalz@openssl.org>
Reviewed-by: NMatt Caswell <matt@openssl.org>
上级 cfd451d4
...@@ -27,9 +27,10 @@ NON_EMPTY_TRANSLATION_UNIT ...@@ -27,9 +27,10 @@ NON_EMPTY_TRANSLATION_UNIT
typedef enum OPTION_choice { typedef enum OPTION_choice {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT, OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT, OPT_ENGINE,
OPT_ENGINE, OPT_PVK_STRONG, OPT_PVK_WEAK, /* Do not change the order here; see case statements below */
OPT_PVK_NONE, OPT_NOOUT, OPT_TEXT, OPT_MODULUS, OPT_PUBIN, OPT_PVK_NONE, OPT_PVK_WEAK, OPT_PVK_STRONG,
OPT_NOOUT, OPT_TEXT, OPT_MODULUS, OPT_PUBIN,
OPT_PUBOUT, OPT_CIPHER, OPT_PASSIN, OPT_PASSOUT OPT_PUBOUT, OPT_CIPHER, OPT_PASSIN, OPT_PASSOUT
} OPTION_CHOICE; } OPTION_CHOICE;
...@@ -48,9 +49,9 @@ OPTIONS dsa_options[] = { ...@@ -48,9 +49,9 @@ OPTIONS dsa_options[] = {
{"passout", OPT_PASSOUT, 's', "Output file pass phrase source"}, {"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
{"", OPT_CIPHER, '-', "Any supported cipher"}, {"", OPT_CIPHER, '-', "Any supported cipher"},
# ifndef OPENSSL_NO_RC4 # ifndef OPENSSL_NO_RC4
{"pvk-strong", OPT_PVK_STRONG, '-'}, {"pvk-strong", OPT_PVK_STRONG, '-', "Enable 'Strong' PVK encoding level (default)"},
{"pvk-weak", OPT_PVK_WEAK, '-'}, {"pvk-weak", OPT_PVK_WEAK, '-', "Enable 'Weak' PVK encoding level"},
{"pvk-none", OPT_PVK_NONE, '-'}, {"pvk-none", OPT_PVK_NONE, '-', "Don't enforce PVK encoding"},
# endif # endif
# ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_ENGINE
{"engine", OPT_ENGINE, 's', "Use engine e, possibly a hardware device"}, {"engine", OPT_ENGINE, 's', "Use engine e, possibly a hardware device"},
...@@ -111,22 +112,13 @@ int dsa_main(int argc, char **argv) ...@@ -111,22 +112,13 @@ int dsa_main(int argc, char **argv)
case OPT_PASSOUT: case OPT_PASSOUT:
passoutarg = opt_arg(); passoutarg = opt_arg();
break; break;
case OPT_PVK_STRONG: /* pvk_encr:= 2 */
case OPT_PVK_WEAK: /* pvk_encr:= 1 */
case OPT_PVK_NONE: /* pvk_encr:= 0 */
#ifndef OPENSSL_NO_RC4 #ifndef OPENSSL_NO_RC4
case OPT_PVK_STRONG: pvk_encr = (o - OPT_PVK_NONE);
pvk_encr = 2;
break;
case OPT_PVK_WEAK:
pvk_encr = 1;
break;
case OPT_PVK_NONE:
pvk_encr = 0;
break;
#else
case OPT_PVK_STRONG:
case OPT_PVK_WEAK:
case OPT_PVK_NONE:
break;
#endif #endif
break;
case OPT_NOOUT: case OPT_NOOUT:
noout = 1; noout = 1;
break; break;
......
...@@ -29,8 +29,10 @@ typedef enum OPTION_choice { ...@@ -29,8 +29,10 @@ typedef enum OPTION_choice {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
OPT_INFORM, OPT_OUTFORM, OPT_ENGINE, OPT_IN, OPT_OUT, OPT_INFORM, OPT_OUTFORM, OPT_ENGINE, OPT_IN, OPT_OUT,
OPT_PUBIN, OPT_PUBOUT, OPT_PASSOUT, OPT_PASSIN, OPT_PUBIN, OPT_PUBOUT, OPT_PASSOUT, OPT_PASSIN,
OPT_RSAPUBKEY_IN, OPT_RSAPUBKEY_OUT, OPT_PVK_STRONG, OPT_PVK_WEAK, OPT_RSAPUBKEY_IN, OPT_RSAPUBKEY_OUT,
OPT_PVK_NONE, OPT_NOOUT, OPT_TEXT, OPT_MODULUS, OPT_CHECK, OPT_CIPHER /* Do not change the order here; see case statements below */
OPT_PVK_NONE, OPT_PVK_WEAK, OPT_PVK_STRONG,
OPT_NOOUT, OPT_TEXT, OPT_MODULUS, OPT_CHECK, OPT_CIPHER
} OPTION_CHOICE; } OPTION_CHOICE;
OPTIONS rsa_options[] = { OPTIONS rsa_options[] = {
...@@ -51,9 +53,9 @@ OPTIONS rsa_options[] = { ...@@ -51,9 +53,9 @@ OPTIONS rsa_options[] = {
{"check", OPT_CHECK, '-', "Verify key consistency"}, {"check", OPT_CHECK, '-', "Verify key consistency"},
{"", OPT_CIPHER, '-', "Any supported cipher"}, {"", OPT_CIPHER, '-', "Any supported cipher"},
# if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_RC4) # if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_RC4)
{"pvk-strong", OPT_PVK_STRONG, '-'}, {"pvk-strong", OPT_PVK_STRONG, '-', "Enable 'Strong' PVK encoding level (default)"},
{"pvk-weak", OPT_PVK_WEAK, '-'}, {"pvk-weak", OPT_PVK_WEAK, '-', "Enable 'Weak' PVK encoding level"},
{"pvk-none", OPT_PVK_NONE, '-'}, {"pvk-none", OPT_PVK_NONE, '-', "Don't enforce PVK encoding"},
# endif # endif
# ifndef OPENSSL_NO_ENGINE # ifndef OPENSSL_NO_ENGINE
{"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"}, {"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"},
...@@ -124,22 +126,13 @@ int rsa_main(int argc, char **argv) ...@@ -124,22 +126,13 @@ int rsa_main(int argc, char **argv)
case OPT_RSAPUBKEY_OUT: case OPT_RSAPUBKEY_OUT:
pubout = 2; pubout = 2;
break; break;
case OPT_PVK_STRONG: /* pvk_encr:= 2 */
case OPT_PVK_WEAK: /* pvk_encr:= 1 */
case OPT_PVK_NONE: /* pvk_encr:= 0 */
# if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_RC4) # if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_RC4)
case OPT_PVK_STRONG: pvk_encr = (o - OPT_PVK_NONE);
pvk_encr = 2;
break;
case OPT_PVK_WEAK:
pvk_encr = 1;
break;
case OPT_PVK_NONE:
pvk_encr = 0;
break;
# else
case OPT_PVK_STRONG:
case OPT_PVK_WEAK:
case OPT_PVK_NONE:
break;
# endif # endif
break;
case OPT_NOOUT: case OPT_NOOUT:
noout = 1; noout = 1;
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册