X-Git-Url: https://git.openssl.org/?a=blobdiff_plain;f=apps%2Frsautl.c;h=c428bf18b4fae78379bfd5c04ffea60820908f4a;hb=15b7175f558bf9eb057ec3266685486f727dd70f;hp=333edb936389851613cae395e0883ac7e579e728;hpb=021410ea3fc3876538830839d16b67e610d12785;p=openssl.git diff --git a/apps/rsautl.c b/apps/rsautl.c index 333edb9363..c428bf18b4 100644 --- a/apps/rsautl.c +++ b/apps/rsautl.c @@ -1,5 +1,5 @@ /* - * Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -26,9 +26,9 @@ #define KEY_CERT 3 typedef enum OPTION_choice { - OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, + OPT_COMMON, OPT_ENGINE, OPT_IN, OPT_OUT, OPT_ASN1PARSE, OPT_HEXDUMP, - OPT_RSA_RAW, OPT_OAEP, OPT_SSL, OPT_PKCS, OPT_X931, + OPT_RSA_RAW, OPT_OAEP, OPT_PKCS, OPT_X931, OPT_SIGN, OPT_VERIFY, OPT_REV, OPT_ENCRYPT, OPT_DECRYPT, OPT_PUBIN, OPT_CERTIN, OPT_INKEY, OPT_PASSIN, OPT_KEYFORM, OPT_R_ENUM, OPT_PROV_ENUM @@ -56,7 +56,6 @@ const OPTIONS rsautl_options[] = { OPT_SECTION("Output"), {"out", OPT_OUT, '>', "Output file"}, - {"ssl", OPT_SSL, '-', "Use SSL v2 padding"}, {"raw", OPT_RSA_RAW, '-', "Use no padding"}, {"pkcs", OPT_PKCS, '-', "Use PKCS#1 v1.5 padding (default)"}, {"x931", OPT_X931, '-', "Use ANSI X9.31 padding"}, @@ -82,7 +81,7 @@ int rsautl_main(int argc, char **argv) char rsa_mode = RSA_VERIFY, key_type = KEY_PRIVKEY; unsigned char *rsa_in = NULL, *rsa_out = NULL, pad = RSA_PKCS1_PADDING; size_t rsa_inlen, rsa_outlen = 0; - int keyformat = FORMAT_PEM, keysize, ret = 1, rv; + int keyformat = FORMAT_UNDEF, keysize, ret = 1, rv; int hexdump = 0, asn1parse = 0, need_priv = 0, rev = 0; OPTION_CHOICE o; @@ -123,9 +122,6 @@ int rsautl_main(int argc, char **argv) case OPT_OAEP: pad = RSA_PKCS1_OAEP_PADDING; break; - case OPT_SSL: - pad = RSA_SSLV23_PADDING; - break; case OPT_PKCS: pad = RSA_PKCS1_PADDING; break; @@ -173,10 +169,12 @@ int rsautl_main(int argc, char **argv) } /* No extra arguments. */ - argc = opt_num_rest(); - if (argc != 0) + if (!opt_check_rest_arg(NULL)) goto opthelp; + if (!app_RAND_load()) + goto end; + if (need_priv && (key_type != KEY_PRIVKEY)) { BIO_printf(bio_err, "A private key is needed for this operation\n"); goto end; @@ -197,7 +195,7 @@ int rsautl_main(int argc, char **argv) break; case KEY_CERT: - x = load_cert(keyfile, "Certificate"); + x = load_cert(keyfile, FORMAT_UNDEF, "Certificate"); if (x) { pkey = X509_get_pubkey(x); X509_free(x); @@ -215,7 +213,7 @@ int rsautl_main(int argc, char **argv) if (out == NULL) goto end; - keysize = EVP_PKEY_size(pkey); + keysize = EVP_PKEY_get_size(pkey); rsa_in = app_malloc(keysize * 2, "hold rsa key"); rsa_out = app_malloc(keysize, "output rsa key");