diff options
Diffstat (limited to 'apps/ec.c')
| -rw-r--r-- | apps/ec.c | 78 |
1 files changed, 46 insertions, 32 deletions
diff --git a/apps/ec.c b/apps/ec.c index 677876ccc90e..dee1ef48e7e0 100644 --- a/apps/ec.c +++ b/apps/ec.c @@ -23,42 +23,56 @@ typedef enum OPTION_choice { OPT_COMMON, - OPT_INFORM, OPT_OUTFORM, OPT_ENGINE, OPT_IN, OPT_OUT, - OPT_NOOUT, OPT_TEXT, OPT_PARAM_OUT, OPT_PUBIN, OPT_PUBOUT, - OPT_PASSIN, OPT_PASSOUT, OPT_PARAM_ENC, OPT_CONV_FORM, OPT_CIPHER, - OPT_NO_PUBLIC, OPT_CHECK, OPT_PROV_ENUM + OPT_INFORM, + OPT_OUTFORM, + OPT_ENGINE, + OPT_IN, + OPT_OUT, + OPT_NOOUT, + OPT_TEXT, + OPT_PARAM_OUT, + OPT_PUBIN, + OPT_PUBOUT, + OPT_PASSIN, + OPT_PASSOUT, + OPT_PARAM_ENC, + OPT_CONV_FORM, + OPT_CIPHER, + OPT_NO_PUBLIC, + OPT_CHECK, + OPT_PROV_ENUM } OPTION_CHOICE; const OPTIONS ec_options[] = { OPT_SECTION("General"), - {"help", OPT_HELP, '-', "Display this summary"}, + { "help", OPT_HELP, '-', "Display this summary" }, #ifndef OPENSSL_NO_ENGINE - {"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"}, + { "engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device" }, #endif OPT_SECTION("Input"), - {"in", OPT_IN, 's', "Input file"}, - {"inform", OPT_INFORM, 'f', "Input format (DER/PEM/P12/ENGINE)"}, - {"pubin", OPT_PUBIN, '-', "Expect a public key in input file"}, - {"passin", OPT_PASSIN, 's', "Input file pass phrase source"}, - {"check", OPT_CHECK, '-', "check key consistency"}, - {"", OPT_CIPHER, '-', "Any supported cipher"}, - {"param_enc", OPT_PARAM_ENC, 's', - "Specifies the way the ec parameters are encoded"}, - {"conv_form", OPT_CONV_FORM, 's', "Specifies the point conversion form "}, + { "in", OPT_IN, 's', "Input file" }, + { "inform", OPT_INFORM, 'f', "Input format (DER/PEM/P12/ENGINE)" }, + { "pubin", OPT_PUBIN, '-', "Expect a public key in input file" }, + { "passin", OPT_PASSIN, 's', "Input file pass phrase source" }, + { "check", OPT_CHECK, '-', "check key consistency" }, + { "", OPT_CIPHER, '-', "Any supported cipher" }, + { "param_enc", OPT_PARAM_ENC, 's', + "Specifies the way the ec parameters are encoded" }, + { "conv_form", OPT_CONV_FORM, 's', "Specifies the point conversion form " }, OPT_SECTION("Output"), - {"out", OPT_OUT, '>', "Output file"}, - {"outform", OPT_OUTFORM, 'F', "Output format - DER or PEM"}, - {"noout", OPT_NOOUT, '-', "Don't print key out"}, - {"text", OPT_TEXT, '-', "Print the key"}, - {"param_out", OPT_PARAM_OUT, '-', "Print the elliptic curve parameters"}, - {"pubout", OPT_PUBOUT, '-', "Output public key, not private"}, - {"no_public", OPT_NO_PUBLIC, '-', "exclude public key from private key"}, - {"passout", OPT_PASSOUT, 's', "Output file pass phrase source"}, + { "out", OPT_OUT, '>', "Output file" }, + { "outform", OPT_OUTFORM, 'F', "Output format - DER or PEM" }, + { "noout", OPT_NOOUT, '-', "Don't print key out" }, + { "text", OPT_TEXT, '-', "Print the key" }, + { "param_out", OPT_PARAM_OUT, '-', "Print the elliptic curve parameters" }, + { "pubout", OPT_PUBOUT, '-', "Output public key, not private" }, + { "no_public", OPT_NO_PUBLIC, '-', "exclude public key from private key" }, + { "passout", OPT_PASSOUT, 's', "Output file pass phrase source" }, OPT_PROV_OPTIONS, - {NULL} + { NULL } }; int ec_main(int argc, char **argv) @@ -86,7 +100,7 @@ int ec_main(int argc, char **argv) switch (o) { case OPT_EOF: case OPT_ERR: - opthelp: + opthelp: BIO_printf(bio_err, "%s: Use -help for summary.\n", prog); goto end; case OPT_HELP: @@ -188,15 +202,15 @@ int ec_main(int argc, char **argv) if (point_format && !EVP_PKEY_set_utf8_string_param( - eckey, OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT, - point_format)) { + eckey, OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT, + point_format)) { BIO_printf(bio_err, "unable to set point conversion format\n"); goto end; } if (asn1_encoding != NULL && !EVP_PKEY_set_utf8_string_param( - eckey, OSSL_PKEY_PARAM_EC_ENCODING, asn1_encoding)) { + eckey, OSSL_PKEY_PARAM_EC_ENCODING, asn1_encoding)) { BIO_printf(bio_err, "unable to set asn1 encoding format\n"); goto end; } @@ -253,8 +267,8 @@ int ec_main(int argc, char **argv) } ectx = OSSL_ENCODER_CTX_new_for_pkey(eckey, selection, - output_type, output_structure, - NULL); + output_type, output_structure, + NULL); if (enc != NULL) { OSSL_ENCODER_CTX_set_cipher(ectx, EVP_CIPHER_get0_name(enc), NULL); /* Default passphrase prompter */ @@ -262,8 +276,8 @@ int ec_main(int argc, char **argv) if (passout != NULL) /* When passout given, override the passphrase prompter */ OSSL_ENCODER_CTX_set_passphrase(ectx, - (const unsigned char *)passout, - strlen(passout)); + (const unsigned char *)passout, + strlen(passout)); } if (!OSSL_ENCODER_to_bio(ectx, out)) { BIO_printf(bio_err, "unable to write EC key\n"); |
