summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2020-02-25 14:29:30 +1000
committerPauli <paul.dale@oracle.com>2020-03-07 11:46:48 +1000
commit6bd4e3f231d74578b97821d981d42583fec5c2f3 (patch)
treed255cb0db84ccb5bf71fed8e62f4bb310933b5a5
parent5e98904c231f5a40c6ce291df85799cca7c8d125 (diff)
cmdline app: add provider commandline options.
Add a -provider option to allow providers to be loaded. This option can be specified multiple times. Add a -provider_path option to allow the path to providers to be specified. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11167)
-rw-r--r--apps/ca.c7
-rw-r--r--apps/ciphers.c7
-rw-r--r--apps/cms.c6
-rw-r--r--apps/crl.c8
-rw-r--r--apps/crl2p7.c9
-rw-r--r--apps/dgst.c7
-rw-r--r--apps/dhparam.c7
-rw-r--r--apps/dsa.c8
-rw-r--r--apps/dsaparam.c7
-rw-r--r--apps/ec.c8
-rw-r--r--apps/ecparam.c7
-rw-r--r--apps/enc.c7
-rw-r--r--apps/gendsa.c7
-rw-r--r--apps/genpkey.c10
-rw-r--r--apps/genrsa.c7
-rw-r--r--apps/include/opt.h19
-rw-r--r--apps/kdf.c9
-rw-r--r--apps/lib/app_provider.c51
-rw-r--r--apps/lib/build.info2
-rw-r--r--apps/list.c9
-rw-r--r--apps/mac.c9
-rw-r--r--apps/nseq.c9
-rw-r--r--apps/ocsp.c7
-rw-r--r--apps/passwd.c7
-rw-r--r--apps/pkcs12.c7
-rw-r--r--apps/pkcs7.c9
-rw-r--r--apps/pkcs8.c7
-rw-r--r--apps/pkey.c8
-rw-r--r--apps/pkeyparam.c9
-rw-r--r--apps/pkeyutl.c7
-rw-r--r--apps/prime.c9
-rw-r--r--apps/rand.c7
-rw-r--r--apps/rehash.c9
-rw-r--r--apps/req.c7
-rw-r--r--apps/rsa.c9
-rw-r--r--apps/rsautl.c7
-rw-r--r--apps/s_client.c7
-rw-r--r--apps/s_server.c8
-rw-r--r--apps/s_time.c8
-rw-r--r--apps/smime.c7
-rw-r--r--apps/speed.c7
-rw-r--r--apps/spkac.c9
-rw-r--r--apps/srp.c7
-rw-r--r--apps/storeutl.c8
-rw-r--r--apps/ts.c7
-rw-r--r--apps/verify.c9
-rw-r--r--apps/x509.c7
-rw-r--r--crypto/provider_core.c42
-rw-r--r--doc/man1/openssl-ca.pod.in3
-rw-r--r--doc/man1/openssl-ciphers.pod.in3
-rw-r--r--doc/man1/openssl-cms.pod.in3
-rw-r--r--doc/man1/openssl-crl.pod.in3
-rw-r--r--doc/man1/openssl-crl2pkcs7.pod.in3
-rw-r--r--doc/man1/openssl-dgst.pod.in3
-rw-r--r--doc/man1/openssl-dhparam.pod.in3
-rw-r--r--doc/man1/openssl-dsa.pod.in3
-rw-r--r--doc/man1/openssl-dsaparam.pod.in3
-rw-r--r--doc/man1/openssl-ec.pod.in3
-rw-r--r--doc/man1/openssl-ecparam.pod.in3
-rw-r--r--doc/man1/openssl-enc.pod.in3
-rw-r--r--doc/man1/openssl-gendsa.pod.in3
-rw-r--r--doc/man1/openssl-genpkey.pod.in3
-rw-r--r--doc/man1/openssl-genrsa.pod.in3
-rw-r--r--doc/man1/openssl-kdf.pod.in3
-rw-r--r--doc/man1/openssl-list.pod.in3
-rw-r--r--doc/man1/openssl-mac.pod.in3
-rw-r--r--doc/man1/openssl-nseq.pod.in3
-rw-r--r--doc/man1/openssl-ocsp.pod.in3
-rw-r--r--doc/man1/openssl-passwd.pod.in3
-rw-r--r--doc/man1/openssl-pkcs12.pod.in3
-rw-r--r--doc/man1/openssl-pkcs7.pod.in3
-rw-r--r--doc/man1/openssl-pkcs8.pod.in3
-rw-r--r--doc/man1/openssl-pkey.pod.in3
-rw-r--r--doc/man1/openssl-pkeyparam.pod.in3
-rw-r--r--doc/man1/openssl-pkeyutl.pod.in3
-rw-r--r--doc/man1/openssl-prime.pod.in3
-rw-r--r--doc/man1/openssl-rand.pod.in3
-rw-r--r--doc/man1/openssl-rehash.pod.in4
-rw-r--r--doc/man1/openssl-req.pod.in3
-rw-r--r--doc/man1/openssl-rsa.pod.in3
-rw-r--r--doc/man1/openssl-rsautl.pod.in3
-rw-r--r--doc/man1/openssl-s_client.pod.in3
-rw-r--r--doc/man1/openssl-s_server.pod.in3
-rw-r--r--doc/man1/openssl-s_time.pod.in3
-rw-r--r--doc/man1/openssl-smime.pod.in3
-rw-r--r--doc/man1/openssl-speed.pod.in3
-rw-r--r--doc/man1/openssl-spkac.pod.in3
-rw-r--r--doc/man1/openssl-srp.pod.in3
-rw-r--r--doc/man1/openssl-storeutl.pod.in3
-rw-r--r--doc/man1/openssl-ts.pod.in5
-rw-r--r--doc/man1/openssl-verify.pod.in3
-rw-r--r--doc/man1/openssl-x509.pod.in3
-rw-r--r--doc/man1/openssl.pod20
-rw-r--r--doc/man3/OSSL_PROVIDER.pod9
-rw-r--r--doc/perlvars.pm11
-rw-r--r--include/openssl/provider.h3
-rw-r--r--util/libcrypto.num1
97 files changed, 587 insertions, 47 deletions
diff --git a/apps/ca.c b/apps/ca.c
index f201efe3af..84e1905d38 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -148,7 +148,7 @@ typedef enum OPTION_choice {
OPT_INFILES, OPT_SS_CERT, OPT_SPKAC, OPT_REVOKE, OPT_VALID,
OPT_EXTENSIONS, OPT_EXTFILE, OPT_STATUS, OPT_UPDATEDB, OPT_CRLEXTS,
OPT_RAND_SERIAL,
- OPT_R_ENUM, OPT_SM2ID, OPT_SM2HEXID,
+ OPT_R_ENUM, OPT_SM2ID, OPT_SM2HEXID, OPT_PROV_ENUM,
/* Do not change the order here; see related case statements below */
OPT_CRL_REASON, OPT_CRL_HOLD, OPT_CRL_COMPROMISE, OPT_CRL_CA_COMPROMISE
} OPTION_CHOICE;
@@ -237,6 +237,7 @@ const OPTIONS ca_options[] = {
{"revoke", OPT_REVOKE, '<', "Revoke a cert (given in file)"},
OPT_R_OPTIONS,
+ OPT_PROV_OPTIONS,
OPT_PARAMETERS(),
{"certreq", 0, 0, "Certificate requests to be signed (optional)"},
@@ -361,6 +362,10 @@ opthelp:
if (!opt_rand(o))
goto end;
break;
+ case OPT_PROV_CASES:
+ if (!opt_provider(o))
+ goto end;
+ break;
case OPT_KEY:
key = opt_arg();
break;
diff --git a/apps/ciphers.c b/apps/ciphers.c
index 280a5ab477..9bbc12aeec 100644
--- a/apps/ciphers.c
+++ b/apps/ciphers.c
@@ -27,7 +27,7 @@ typedef enum OPTION_choice {
OPT_PSK,
OPT_SRP,
OPT_CIPHERSUITES,
- OPT_V, OPT_UPPER_V, OPT_S
+ OPT_V, OPT_UPPER_V, OPT_S, OPT_PROV_ENUM
} OPTION_CHOICE;
const OPTIONS ciphers_options[] = {
@@ -67,6 +67,7 @@ const OPTIONS ciphers_options[] = {
#endif
{"ciphersuites", OPT_CIPHERSUITES, 's',
"Configure the TLSv1.3 ciphersuites to use"},
+ OPT_PROV_OPTIONS,
OPT_PARAMETERS(),
{"cipher", 0, 0, "Cipher string to decode (optional)"},
@@ -169,6 +170,10 @@ int ciphers_main(int argc, char **argv)
case OPT_CIPHERSUITES:
ciphersuites = opt_arg();
break;
+ case OPT_PROV_CASES:
+ if (!opt_provider(o))
+ goto end;
+ break;
}
}
argv = opt_rest();
diff --git a/apps/cms.c b/apps/cms.c
index 9c92e79658..c8c303ea37 100644
--- a/apps/cms.c
+++ b/apps/cms.c
@@ -83,6 +83,7 @@ typedef enum OPTION_choice {
OPT_RR_TO, OPT_AES128_WRAP, OPT_AES192_WRAP, OPT_AES256_WRAP,
OPT_3DES_WRAP, OPT_WRAP, OPT_ENGINE,
OPT_R_ENUM,
+ OPT_PROV_ENUM,
OPT_V_ENUM,
OPT_CIPHER,
OPT_ORIGINATOR
@@ -220,6 +221,7 @@ const OPTIONS cms_options[] = {
OPT_R_OPTIONS,
OPT_V_OPTIONS,
+ OPT_PROV_OPTIONS,
OPT_PARAMETERS(),
{"cert", 0, 0, "Recipient certs (optional; used only when encrypting)"},
@@ -621,6 +623,10 @@ int cms_main(int argc, char **argv)
if (!opt_rand(o))
goto end;
break;
+ case OPT_PROV_CASES:
+ if (!opt_provider(o))
+ goto end;
+ break;
case OPT_3DES_WRAP:
# ifndef OPENSSL_NO_DES
wrap_cipher = EVP_des_ede3_wrap();
diff --git a/apps/crl.c b/apps/crl.c
index 14410f3512..5e0a517a1b 100644
--- a/apps/crl.c
+++ b/apps/crl.c
@@ -24,7 +24,7 @@ typedef enum OPTION_choice {
OPT_ISSUER, OPT_LASTUPDATE, OPT_NEXTUPDATE, OPT_FINGERPRINT,
OPT_CRLNUMBER, OPT_BADSIG, OPT_GENDELTA, OPT_CAPATH, OPT_CAFILE, OPT_CASTORE,
OPT_NOCAPATH, OPT_NOCAFILE, OPT_NOCASTORE, OPT_VERIFY, OPT_TEXT, OPT_HASH,
- OPT_HASH_OLD, OPT_NOOUT, OPT_NAMEOPT, OPT_MD
+ OPT_HASH_OLD, OPT_NOOUT, OPT_NAMEOPT, OPT_MD, OPT_PROV_ENUM
} OPTION_CHOICE;
const OPTIONS crl_options[] = {
@@ -69,6 +69,7 @@ const OPTIONS crl_options[] = {
"Do not load certificates from the default certificates directory"},
{"no-CAstore", OPT_NOCASTORE, '-',
"Do not load certificates from the default certificates store"},
+ OPT_PROV_OPTIONS,
{NULL}
};
@@ -193,6 +194,11 @@ int crl_main(int argc, char **argv)
case OPT_MD:
if (!opt_md(opt_unknown(), &digest))
goto opthelp;
+ break;
+ case OPT_PROV_CASES:
+ if (!opt_provider(o))
+ goto end;
+ break;
}
}
argc = opt_num_rest();
diff --git a/apps/crl2p7.c b/apps/crl2p7.c
index ffbee4cbff..53bc88f750 100644
--- a/apps/crl2p7.c
+++ b/apps/crl2p7.c
@@ -23,7 +23,8 @@ static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile);
typedef enum OPTION_choice {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
- OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT, OPT_NOCRL, OPT_CERTFILE
+ OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT, OPT_NOCRL, OPT_CERTFILE,
+ OPT_PROV_ENUM
} OPTION_CHOICE;
const OPTIONS crl2pkcs7_options[] = {
@@ -40,6 +41,8 @@ const OPTIONS crl2pkcs7_options[] = {
OPT_SECTION("Output"),
{"out", OPT_OUT, '>', "Output file"},
{"outform", OPT_OUTFORM, 'F', "Output format - DER or PEM"},
+
+ OPT_PROV_OPTIONS,
{NULL}
};
@@ -93,6 +96,10 @@ int crl2pkcs7_main(int argc, char **argv)
if (!sk_OPENSSL_STRING_push(certflst, opt_arg()))
goto end;
break;
+ case OPT_PROV_CASES:
+ if (!opt_provider(o))
+ goto end;
+ break;
}
}
argc = opt_num_rest();
diff --git a/apps/dgst.c b/apps/dgst.c
index 7a81cb28dc..dcb4c094c7 100644
--- a/apps/dgst.c
+++ b/apps/dgst.c
@@ -42,7 +42,7 @@ typedef enum OPTION_choice {
OPT_HEX, OPT_BINARY, OPT_DEBUG, OPT_FIPS_FINGERPRINT,
OPT_HMAC, OPT_MAC, OPT_SIGOPT, OPT_MACOPT,
OPT_DIGEST,
- OPT_R_ENUM
+ OPT_R_ENUM, OPT_PROV_ENUM
} OPTION_CHOICE;
const OPTIONS dgst_options[] = {
@@ -82,6 +82,7 @@ const OPTIONS dgst_options[] = {
"Compute HMAC with the key used in OpenSSL-FIPS fingerprint"},
OPT_R_OPTIONS,
+ OPT_PROV_OPTIONS,
OPT_PARAMETERS(),
{"file", 0, 0, "Files to digest (optional; default is stdin)"},
@@ -208,6 +209,10 @@ int dgst_main(int argc, char **argv)
goto opthelp;
md = m;
break;
+ case OPT_PROV_CASES:
+ if (!opt_provider(o))
+ goto end;
+ break;
}
}
argc = opt_num_rest();
diff --git a/apps/dhparam.c b/apps/dhparam.c
index acff366158..3f694c5a35 100644
--- a/apps/dhparam.c
+++ b/apps/dhparam.c
@@ -41,7 +41,7 @@ typedef enum OPTION_choice {
OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT,
OPT_ENGINE, OPT_CHECK, OPT_TEXT, OPT_NOOUT,
OPT_DSAPARAM, OPT_C, OPT_2, OPT_3, OPT_5,
- OPT_R_ENUM
+ OPT_R_ENUM, OPT_PROV_ENUM
} OPTION_CHOICE;
const OPTIONS dhparam_options[] = {
@@ -73,6 +73,7 @@ const OPTIONS dhparam_options[] = {
{"5", OPT_5, '-', "Generate parameters using 5 as the generator value"},
OPT_R_OPTIONS,
+ OPT_PROV_OPTIONS,
OPT_PARAMETERS(),
{"numbits", 0, 0, "Number of bits if generating parameters (optional)"},
@@ -151,6 +152,10 @@ int dhparam_main(int argc, char **argv)
if (!opt_rand(o))
goto end;
break;
+ case OPT_PROV_CASES:
+ if (!opt_provider(o))
+ goto end;
+ break;
}
}
argc = opt_num_rest();
diff --git a/apps/dsa.c b/apps/dsa.c
index 9704a34c39..082aa96476 100644
--- a/apps/dsa.c
+++ b/apps/dsa.c
@@ -35,7 +35,8 @@ typedef enum OPTION_choice {
/* 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_PUBIN,
- OPT_PUBOUT, OPT_CIPHER, OPT_PASSIN, OPT_PASSOUT
+ OPT_PUBOUT, OPT_CIPHER, OPT_PASSIN, OPT_PASSOUT,
+ OPT_PROV_ENUM
} OPTION_CHOICE;
const OPTIONS dsa_options[] = {
@@ -66,6 +67,7 @@ const OPTIONS dsa_options[] = {
{"pubout", OPT_PUBOUT, '-', "Output public key, not private"},
{"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
+ OPT_PROV_OPTIONS,
{NULL}
};
@@ -147,6 +149,10 @@ int dsa_main(int argc, char **argv)
if (!opt_cipher(opt_unknown(), &enc))
goto end;
break;
+ case OPT_PROV_CASES:
+ if (!opt_provider(o))
+ goto end;
+ break;
}
}
argc = opt_num_rest();
diff --git a/apps/dsaparam.c b/apps/dsaparam.c
index eebffa0ee5..04e09e7950 100644
--- a/apps/dsaparam.c
+++ b/apps/dsaparam.c
@@ -36,7 +36,7 @@ typedef enum OPTION_choice {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT, OPT_TEXT, OPT_C,
OPT_NOOUT, OPT_GENKEY, OPT_ENGINE, OPT_VERBOSE,
- OPT_R_ENUM
+ OPT_R_ENUM, OPT_PROV_ENUM
} OPTION_CHOICE;
const OPTIONS dsaparam_options[] = {
@@ -62,6 +62,7 @@ const OPTIONS dsaparam_options[] = {
{"genkey", OPT_GENKEY, '-', "Generate a DSA key"},
OPT_R_OPTIONS,
+ OPT_PROV_OPTIONS,
OPT_PARAMETERS(),
{"numbits", 0, 0, "Number of bits if generating parameters (optional)"},
@@ -122,6 +123,10 @@ int dsaparam_main(int argc, char **argv)
if (!opt_rand(o))
goto end;
break;
+ case OPT_PROV_CASES:
+ if (!opt_provider(o))
+ goto end;
+ break;
case OPT_NOOUT:
noout = 1;
break;
diff --git a/apps/ec.c b/apps/ec.c
index 3d901bbad3..6a3879922c 100644
--- a/apps/ec.c
+++ b/