Latest update.
This commit is contained in:
@@ -21,6 +21,32 @@
|
||||
options of the apps.
|
||||
[Kurt Roeckx]
|
||||
|
||||
*) The command line utilities dhparam, dsa, gendsa and dsaparam have been
|
||||
deprecated. Instead use the pkeyparam, pkey, genpkey and pkeyparam
|
||||
programs respectively.
|
||||
[Paul Dale]
|
||||
|
||||
*) All of the low level DSA functions have been deprecated including:
|
||||
|
||||
DSA_do_sign, DSA_do_verify, DSA_OpenSSL, DSA_set_default_method,
|
||||
DSA_get_default_method, DSA_set_method, DSA_get_method, DSA_new_method,
|
||||
DSA_sign_setup, DSA_sign, DSA_verify, DSA_get_ex_new_index,
|
||||
DSA_set_ex_data, DSA_get_ex_data, DSA_generate_parameters_ex,
|
||||
DSA_generate_key, DSA_meth_new, DSA_get0_engine, DSA_meth_free,
|
||||
DSA_meth_dup, DSA_meth_get0_name, DSA_meth_set1_name, DSA_meth_get_flags,
|
||||
DSA_meth_set_flags, DSA_meth_get0_app_data, DSA_meth_set0_app_data,
|
||||
DSA_meth_get_sign, DSA_meth_set_sign, DSA_meth_get_sign_setup,
|
||||
DSA_meth_set_sign_setup, DSA_meth_get_verify, DSA_meth_set_verify,
|
||||
DSA_meth_get_mod_exp, DSA_meth_set_mod_exp, DSA_meth_get_bn_mod_exp,
|
||||
DSA_meth_set_bn_mod_exp, DSA_meth_get_init, DSA_meth_set_init,
|
||||
DSA_meth_get_finish, DSA_meth_set_finish, DSA_meth_get_paramgen,
|
||||
DSA_meth_set_paramgen, DSA_meth_get_keygen and DSA_meth_set_keygen.
|
||||
|
||||
Use of these low level functions has been informally discouraged for a long
|
||||
time. Instead applications should use L<EVP_DigestSignInit_ex(3)>,
|
||||
L<EVP_DigestSignUpdate(3)> and L<EVP_DigestSignFinal(3)>.
|
||||
[Paul Dale]
|
||||
|
||||
*) Reworked the treatment of EC EVP_PKEYs with the SM2 curve to
|
||||
automatically become EVP_PKEY_SM2 rather than EVP_PKEY_EC.
|
||||
This means that applications don't have to look at the curve NID and
|
||||
|
||||
@@ -1483,6 +1483,16 @@ my %targets = (
|
||||
lib_cppflags => "-DL_ENDIAN",
|
||||
sys_id => "UEFI",
|
||||
},
|
||||
"UEFI-x86" => {
|
||||
inherit_from => [ "UEFI" ],
|
||||
asm_arch => 'x86',
|
||||
perlasm_scheme => "win32n",
|
||||
},
|
||||
"UEFI-x86_64" => {
|
||||
inherit_from => [ "UEFI" ],
|
||||
asm_arch => 'x86_64',
|
||||
perlasm_scheme => "nasm",
|
||||
},
|
||||
|
||||
#### UWIN
|
||||
"UWIN" => {
|
||||
|
||||
@@ -412,6 +412,7 @@ my @disablables = (
|
||||
"rmd160",
|
||||
"scrypt",
|
||||
"sctp",
|
||||
"secure-memory",
|
||||
"seed",
|
||||
"shared",
|
||||
"siphash",
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
|
||||
Major changes between OpenSSL 1.1.1 and OpenSSL 3.0.0 [under development]
|
||||
|
||||
o The algorithm specific public key command line applications have
|
||||
been deprecated. These include dhparam, gendsa and others. The pkey
|
||||
alternatives should be used intead: pkey, pkeyparam and genpkey.
|
||||
o X509 certificates signed using SHA1 are no longer allowed at security
|
||||
level 1 or higher. The default security level for TLS is 1, so
|
||||
certificates signed using SHA1 are by default no longer trusted to
|
||||
|
||||
+6
-2
@@ -12,8 +12,8 @@ ENDIF
|
||||
# Source for the 'openssl' program
|
||||
$OPENSSLSRC=\
|
||||
openssl.c progs.c \
|
||||
asn1pars.c ca.c ciphers.c cms.c crl.c crl2p7.c dgst.c dhparam.c \
|
||||
dsa.c dsaparam.c ec.c ecparam.c enc.c engine.c errstr.c gendsa.c \
|
||||
asn1pars.c ca.c ciphers.c cms.c crl.c crl2p7.c dgst.c \
|
||||
ec.c ecparam.c enc.c engine.c errstr.c \
|
||||
genpkey.c genrsa.c kdf.c mac.c nseq.c ocsp.c passwd.c pkcs12.c pkcs7.c \
|
||||
pkcs8.c pkey.c pkeyparam.c pkeyutl.c prime.c rand.c req.c rsa.c \
|
||||
rsautl.c s_client.c s_server.c s_time.c sess_id.c smime.c speed.c \
|
||||
@@ -31,6 +31,10 @@ IF[{- !$disabled{apps} -}]
|
||||
SOURCE[openssl]=openssl.rc
|
||||
ENDIF
|
||||
|
||||
IF[{- !$disabled{'deprecated-3.0'} -}]
|
||||
SOURCE[openssl]=dhparam.c dsa.c dsaparam.c gendsa.c
|
||||
ENDIF
|
||||
|
||||
SCRIPTS{misc}=CA.pl
|
||||
SOURCE[CA.pl]=CA.pl.in
|
||||
# linkname tells build files that a symbolic link or copy of this script
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/* We need to use some deprecated APIs */
|
||||
#define OPENSSL_SUPPRESS_DEPRECATED
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
#ifdef OPENSSL_NO_DH
|
||||
NON_EMPTY_TRANSLATION_UNIT
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/* We need to use the deprecated DSA_print */
|
||||
#define OPENSSL_SUPPRESS_DEPRECATED
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
#ifdef OPENSSL_NO_DSA
|
||||
NON_EMPTY_TRANSLATION_UNIT
|
||||
@@ -173,6 +176,7 @@ int dsa_main(int argc, char **argv)
|
||||
EVP_PKEY_free(pkey);
|
||||
}
|
||||
}
|
||||
|
||||
if (dsa == NULL) {
|
||||
BIO_printf(bio_err, "unable to load Key\n");
|
||||
ERR_print_errors(bio_err);
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/* We need to use some deprecated APIs */
|
||||
#define OPENSSL_SUPPRESS_DEPRECATED
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
#ifdef OPENSSL_NO_DSA
|
||||
NON_EMPTY_TRANSLATION_UNIT
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/* We need to use some deprecated APIs */
|
||||
#define OPENSSL_SUPPRESS_DEPRECATED
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
#ifdef OPENSSL_NO_DSA
|
||||
NON_EMPTY_TRANSLATION_UNIT
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
# include <openssl/lhash.h>
|
||||
# include "opt.h"
|
||||
|
||||
#define DEPRECATED_NO_ALTERNATIVE "unknown"
|
||||
|
||||
typedef enum FUNC_TYPE {
|
||||
FT_none, FT_general, FT_md, FT_cipher, FT_pkey,
|
||||
FT_md_alg, FT_cipher_alg
|
||||
@@ -23,6 +25,7 @@ typedef struct function_st {
|
||||
const char *name;
|
||||
int (*func)(int argc, char *argv[]);
|
||||
const OPTIONS *help;
|
||||
const char *deprecated_alternative;
|
||||
} FUNCTION;
|
||||
|
||||
DEFINE_LHASH_OF(FUNCTION);
|
||||
|
||||
@@ -190,6 +190,7 @@ static STRINT_PAIR cert_type_list[] = {
|
||||
{"RSA fixed ECDH", TLS_CT_RSA_FIXED_ECDH},
|
||||
{"ECDSA fixed ECDH", TLS_CT_ECDSA_FIXED_ECDH},
|
||||
{"GOST01 Sign", TLS_CT_GOST01_SIGN},
|
||||
{"GOST12 Sign", TLS_CT_GOST12_SIGN},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
@@ -47,6 +47,15 @@ BIO *bio_in = NULL;
|
||||
BIO *bio_out = NULL;
|
||||
BIO *bio_err = NULL;
|
||||
|
||||
static void warn_deprecated(const char *pname,
|
||||
const char *deprecated_alternative)
|
||||
{
|
||||
BIO_printf(bio_err, "The command %s is deprecated.", pname);
|
||||
if (strcmp(deprecated_alternative, DEPRECATED_NO_ALTERNATIVE) != 0)
|
||||
BIO_printf(bio_err, " Use '%s' instead.", deprecated_alternative);
|
||||
BIO_printf(bio_err, "\n");
|
||||
}
|
||||
|
||||
static int apps_startup(void)
|
||||
{
|
||||
#ifdef SIGPIPE
|
||||
@@ -277,6 +286,8 @@ int main(int argc, char *argv[])
|
||||
fp = lh_FUNCTION_retrieve(prog, &f);
|
||||
if (fp != NULL) {
|
||||
argv[0] = pname;
|
||||
if (fp->deprecated_alternative != NULL)
|
||||
warn_deprecated(pname, fp->deprecated_alternative);
|
||||
ret = fp->func(argc, argv);
|
||||
goto end;
|
||||
}
|
||||
@@ -470,6 +481,8 @@ static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
if (fp != NULL) {
|
||||
if (fp->deprecated_alternative != NULL)
|
||||
warn_deprecated(fp->name, fp->deprecated_alternative);
|
||||
return fp->func(argc, argv);
|
||||
}
|
||||
if ((strncmp(argv[0], "no-", 3)) == 0) {
|
||||
|
||||
+3
-2
@@ -556,8 +556,9 @@ static EVP_PKEY_CTX *init_ctx(const char *kdfalg, int *pkeysize,
|
||||
|| (group = EC_KEY_get0_group(eckey)) == NULL
|
||||
|| (nid = EC_GROUP_get_curve_name(group)) == 0)
|
||||
goto end;
|
||||
if (nid == NID_sm2)
|
||||
EVP_PKEY_set_alias_type(pkey, EVP_PKEY_SM2);
|
||||
if (nid == NID_sm2
|
||||
&& !EVP_PKEY_set_alias_type(pkey, EVP_PKEY_SM2))
|
||||
goto end;
|
||||
}
|
||||
#endif
|
||||
*pkeysize = EVP_PKEY_size(pkey);
|
||||
|
||||
+170
-170
@@ -13,388 +13,388 @@
|
||||
#include "progs.h"
|
||||
|
||||
FUNCTION functions[] = {
|
||||
{FT_general, "asn1parse", asn1parse_main, asn1parse_options},
|
||||
{FT_general, "ca", ca_main, ca_options},
|
||||
{FT_general, "asn1parse", asn1parse_main, asn1parse_options, NULL},
|
||||
{FT_general, "ca", ca_main, ca_options, NULL},
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
{FT_general, "ciphers", ciphers_main, ciphers_options},
|
||||
{FT_general, "ciphers", ciphers_main, ciphers_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CMS
|
||||
{FT_general, "cms", cms_main, cms_options},
|
||||
{FT_general, "cms", cms_main, cms_options, NULL},
|
||||
#endif
|
||||
{FT_general, "crl", crl_main, crl_options},
|
||||
{FT_general, "crl2pkcs7", crl2pkcs7_main, crl2pkcs7_options},
|
||||
{FT_general, "dgst", dgst_main, dgst_options},
|
||||
#ifndef OPENSSL_NO_DH
|
||||
{FT_general, "dhparam", dhparam_main, dhparam_options},
|
||||
{FT_general, "crl", crl_main, crl_options, NULL},
|
||||
{FT_general, "crl2pkcs7", crl2pkcs7_main, crl2pkcs7_options, NULL},
|
||||
{FT_general, "dgst", dgst_main, dgst_options, NULL},
|
||||
#if !defined(OPENSSL_NO_DH) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
{FT_general, "dhparam", dhparam_main, dhparam_options, "pkeyparam"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
{FT_general, "dsa", dsa_main, dsa_options},
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
{FT_general, "dsa", dsa_main, dsa_options, "pkey"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
{FT_general, "dsaparam", dsaparam_main, dsaparam_options},
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
{FT_general, "dsaparam", dsaparam_main, dsaparam_options, "pkeyparam"},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EC
|
||||
{FT_general, "ec", ec_main, ec_options},
|
||||
{FT_general, "ec", ec_main, ec_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EC
|
||||
{FT_general, "ecparam", ecparam_main, ecparam_options},
|
||||
{FT_general, "ecparam", ecparam_main, ecparam_options, NULL},
|
||||
#endif
|
||||
{FT_general, "enc", enc_main, enc_options},
|
||||
{FT_general, "enc", enc_main, enc_options, NULL},
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
{FT_general, "engine", engine_main, engine_options},
|
||||
{FT_general, "engine", engine_main, engine_options, NULL},
|
||||
#endif
|
||||
{FT_general, "errstr", errstr_main, errstr_options},
|
||||
{FT_general, "fipsinstall", fipsinstall_main, fipsinstall_options},
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
{FT_general, "gendsa", gendsa_main, gendsa_options},
|
||||
{FT_general, "errstr", errstr_main, errstr_options, NULL},
|
||||
{FT_general, "fipsinstall", fipsinstall_main, fipsinstall_options, NULL},
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
{FT_general, "gendsa", gendsa_main, gendsa_options, "genpkey"},
|
||||
#endif
|
||||
{FT_general, "genpkey", genpkey_main, genpkey_options},
|
||||
{FT_general, "genpkey", genpkey_main, genpkey_options, NULL},
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
{FT_general, "genrsa", genrsa_main, genrsa_options},
|
||||
{FT_general, "genrsa", genrsa_main, genrsa_options, NULL},
|
||||
#endif
|
||||
{FT_general, "help", help_main, help_options},
|
||||
{FT_general, "info", info_main, info_options},
|
||||
{FT_general, "kdf", kdf_main, kdf_options},
|
||||
{FT_general, "list", list_main, list_options},
|
||||
{FT_general, "mac", mac_main, mac_options},
|
||||
{FT_general, "nseq", nseq_main, nseq_options},
|
||||
{FT_general, "help", help_main, help_options, NULL},
|
||||
{FT_general, "info", info_main, info_options, NULL},
|
||||
{FT_general, "kdf", kdf_main, kdf_options, NULL},
|
||||
{FT_general, "list", list_main, list_options, NULL},
|
||||
{FT_general, "mac", mac_main, mac_options, NULL},
|
||||
{FT_general, "nseq", nseq_main, nseq_options, NULL},
|
||||
#ifndef OPENSSL_NO_OCSP
|
||||
{FT_general, "ocsp", ocsp_main, ocsp_options},
|
||||
{FT_general, "ocsp", ocsp_main, ocsp_options, NULL},
|
||||
#endif
|
||||
{FT_general, "passwd", passwd_main, passwd_options},
|
||||
{FT_general, "passwd", passwd_main, passwd_options, NULL},
|
||||
#ifndef OPENSSL_NO_DES
|
||||
{FT_general, "pkcs12", pkcs12_main, pkcs12_options},
|
||||
{FT_general, "pkcs12", pkcs12_main, pkcs12_options, NULL},
|
||||
#endif
|
||||
{FT_general, "pkcs7", pkcs7_main, pkcs7_options},
|
||||
{FT_general, "pkcs8", pkcs8_main, pkcs8_options},
|
||||
{FT_general, "pkey", pkey_main, pkey_options},
|
||||
{FT_general, "pkeyparam", pkeyparam_main, pkeyparam_options},
|
||||
{FT_general, "pkeyutl", pkeyutl_main, pkeyutl_options},
|
||||
{FT_general, "prime", prime_main, prime_options},
|
||||
{FT_general, "provider", provider_main, provider_options},
|
||||
{FT_general, "rand", rand_main, rand_options},
|
||||
{FT_general, "rehash", rehash_main, rehash_options},
|
||||
{FT_general, "req", req_main, req_options},
|
||||
{FT_general, "rsa", rsa_main, rsa_options},
|
||||
{FT_general, "pkcs7", pkcs7_main, pkcs7_options, NULL},
|
||||
{FT_general, "pkcs8", pkcs8_main, pkcs8_options, NULL},
|
||||
{FT_general, "pkey", pkey_main, pkey_options, NULL},
|
||||
{FT_general, "pkeyparam", pkeyparam_main, pkeyparam_options, NULL},
|
||||
{FT_general, "pkeyutl", pkeyutl_main, pkeyutl_options, NULL},
|
||||
{FT_general, "prime", prime_main, prime_options, NULL},
|
||||
{FT_general, "provider", provider_main, provider_options, NULL},
|
||||
{FT_general, "rand", rand_main, rand_options, NULL},
|
||||
{FT_general, "rehash", rehash_main, rehash_options, NULL},
|
||||
{FT_general, "req", req_main, req_options, NULL},
|
||||
{FT_general, "rsa", rsa_main, rsa_options, NULL},
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
{FT_general, "rsautl", rsautl_main, rsautl_options},
|
||||
{FT_general, "rsautl", rsautl_main, rsautl_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
{FT_general, "s_client", s_client_main, s_client_options},
|
||||
{FT_general, "s_client", s_client_main, s_client_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
{FT_general, "s_server", s_server_main, s_server_options},
|
||||
{FT_general, "s_server", s_server_main, s_server_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
{FT_general, "s_time", s_time_main, s_time_options},
|
||||
{FT_general, "s_time", s_time_main, s_time_options, NULL},
|
||||
#endif
|
||||
{FT_general, "sess_id", sess_id_main, sess_id_options},
|
||||
{FT_general, "smime", smime_main, smime_options},
|
||||
{FT_general, "speed", speed_main, speed_options},
|
||||
{FT_general, "spkac", spkac_main, spkac_options},
|
||||
{FT_general, "sess_id", sess_id_main, sess_id_options, NULL},
|
||||
{FT_general, "smime", smime_main, smime_options, NULL},
|
||||
{FT_general, "speed", speed_main, speed_options, NULL},
|
||||
{FT_general, "spkac", spkac_main, spkac_options, NULL},
|
||||
#ifndef OPENSSL_NO_SRP
|
||||
{FT_general, "srp", srp_main, srp_options},
|
||||
{FT_general, "srp", srp_main, srp_options, NULL},
|
||||
#endif
|
||||
{FT_general, "storeutl", storeutl_main, storeutl_options},
|
||||
{FT_general, "storeutl", storeutl_main, storeutl_options, NULL},
|
||||
#ifndef OPENSSL_NO_TS
|
||||
{FT_general, "ts", ts_main, ts_options},
|
||||
{FT_general, "ts", ts_main, ts_options, NULL},
|
||||
#endif
|
||||
{FT_general, "verify", verify_main, verify_options},
|
||||
{FT_general, "version", version_main, version_options},
|
||||
{FT_general, "x509", x509_main, x509_options},
|
||||
{FT_general, "verify", verify_main, verify_options, NULL},
|
||||
{FT_general, "version", version_main, version_options, NULL},
|
||||
{FT_general, "x509", x509_main, x509_options, NULL},
|
||||
#ifndef OPENSSL_NO_MD2
|
||||
{FT_md, "md2", dgst_main},
|
||||
{FT_md, "md2", dgst_main, NULL, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_MD4
|
||||
{FT_md, "md4", dgst_main},
|
||||
{FT_md, "md4", dgst_main, NULL, NULL},
|
||||
#endif
|
||||
{FT_md, "md5", dgst_main},
|
||||
{FT_md, "md5", dgst_main, NULL, NULL},
|
||||
#ifndef OPENSSL_NO_GOST
|
||||
{FT_md, "gost", dgst_main},
|
||||
{FT_md, "gost", dgst_main, NULL, NULL},
|
||||
#endif
|
||||
{FT_md, "sha1", dgst_main},
|
||||
{FT_md, "sha224", dgst_main},
|
||||
{FT_md, "sha256", dgst_main},
|
||||
{FT_md, "sha384", dgst_main},
|
||||
{FT_md, "sha512", dgst_main},
|
||||
{FT_md, "sha512-224", dgst_main},
|
||||
{FT_md, "sha512-256", dgst_main},
|
||||
{FT_md, "sha3-224", dgst_main},
|
||||
{FT_md, "sha3-256", dgst_main},
|
||||
{FT_md, "sha3-384", dgst_main},
|
||||
{FT_md, "sha3-512", dgst_main},
|
||||
{FT_md, "shake128", dgst_main},
|
||||
{FT_md, "shake256", dgst_main},
|
||||
{FT_md, "sha1", dgst_main, NULL, NULL},
|
||||
{FT_md, "sha224", dgst_main, NULL, NULL},
|
||||
{FT_md, "sha256", dgst_main, NULL, NULL},
|
||||
{FT_md, "sha384", dgst_main, NULL, NULL},
|
||||
{FT_md, "sha512", dgst_main, NULL, NULL},
|
||||
{FT_md, "sha512-224", dgst_main, NULL, NULL},
|
||||
{FT_md, "sha512-256", dgst_main, NULL, NULL},
|
||||
{FT_md, "sha3-224", dgst_main, NULL, NULL},
|
||||
{FT_md, "sha3-256", dgst_main, NULL, NULL},
|
||||
{FT_md, "sha3-384", dgst_main, NULL, NULL},
|
||||
{FT_md, "sha3-512", dgst_main, NULL, NULL},
|
||||
{FT_md, "shake128", dgst_main, NULL, NULL},
|
||||
{FT_md, "shake256", dgst_main, NULL, NULL},
|
||||
#ifndef OPENSSL_NO_MDC2
|
||||
{FT_md, "mdc2", dgst_main},
|
||||
{FT_md, "mdc2", dgst_main, NULL, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RMD160
|
||||
{FT_md, "rmd160", dgst_main},
|
||||
{FT_md, "rmd160", dgst_main, NULL, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_BLAKE2
|
||||
{FT_md, "blake2b512", dgst_main},
|
||||
{FT_md, "blake2b512", dgst_main, NULL, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_BLAKE2
|
||||
{FT_md, "blake2s256", dgst_main},
|
||||
{FT_md, "blake2s256", dgst_main, NULL, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SM3
|
||||
{FT_md, "sm3", dgst_main},
|
||||
{FT_md, "sm3", dgst_main, NULL, NULL},
|
||||
#endif
|
||||
{FT_cipher, "aes-128-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "aes-128-ecb", enc_main, enc_options},
|
||||
{FT_cipher, "aes-192-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "aes-192-ecb", enc_main, enc_options},
|
||||
{FT_cipher, "aes-256-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "aes-256-ecb", enc_main, enc_options},
|
||||
{FT_cipher, "aes-128-cbc", enc_main, enc_options, NULL},
|
||||
{FT_cipher, "aes-128-ecb", enc_main, enc_options, NULL},
|
||||
{FT_cipher, "aes-192-cbc", enc_main, enc_options, NULL},
|
||||
{FT_cipher, "aes-192-ecb", enc_main, enc_options, NULL},
|
||||
{FT_cipher, "aes-256-cbc", enc_main, enc_options, NULL},
|
||||
{FT_cipher, "aes-256-ecb", enc_main, enc_options, NULL},
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
{FT_cipher, "aria-128-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "aria-128-cbc", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
{FT_cipher, "aria-128-cfb", enc_main, enc_options},
|
||||
{FT_cipher, "aria-128-cfb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
{FT_cipher, "aria-128-ctr", enc_main, enc_options},
|
||||
{FT_cipher, "aria-128-ctr", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
{FT_cipher, "aria-128-ecb", enc_main, enc_options},
|
||||
{FT_cipher, "aria-128-ecb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
{FT_cipher, "aria-128-ofb", enc_main, enc_options},
|
||||
{FT_cipher, "aria-128-ofb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
{FT_cipher, "aria-128-cfb1", enc_main, enc_options},
|
||||
{FT_cipher, "aria-128-cfb1", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
{FT_cipher, "aria-128-cfb8", enc_main, enc_options},
|
||||
{FT_cipher, "aria-128-cfb8", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
{FT_cipher, "aria-192-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "aria-192-cbc", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
{FT_cipher, "aria-192-cfb", enc_main, enc_options},
|
||||
{FT_cipher, "aria-192-cfb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
{FT_cipher, "aria-192-ctr", enc_main, enc_options},
|
||||
{FT_cipher, "aria-192-ctr", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
{FT_cipher, "aria-192-ecb", enc_main, enc_options},
|
||||
{FT_cipher, "aria-192-ecb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
{FT_cipher, "aria-192-ofb", enc_main, enc_options},
|
||||
{FT_cipher, "aria-192-ofb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
{FT_cipher, "aria-192-cfb1", enc_main, enc_options},
|
||||
{FT_cipher, "aria-192-cfb1", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
{FT_cipher, "aria-192-cfb8", enc_main, enc_options},
|
||||
{FT_cipher, "aria-192-cfb8", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
{FT_cipher, "aria-256-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "aria-256-cbc", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
{FT_cipher, "aria-256-cfb", enc_main, enc_options},
|
||||
{FT_cipher, "aria-256-cfb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
{FT_cipher, "aria-256-ctr", enc_main, enc_options},
|
||||
{FT_cipher, "aria-256-ctr", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
{FT_cipher, "aria-256-ecb", enc_main, enc_options},
|
||||
{FT_cipher, "aria-256-ecb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
{FT_cipher, "aria-256-ofb", enc_main, enc_options},
|
||||
{FT_cipher, "aria-256-ofb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
{FT_cipher, "aria-256-cfb1", enc_main, enc_options},
|
||||
{FT_cipher, "aria-256-cfb1", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
{FT_cipher, "aria-256-cfb8", enc_main, enc_options},
|
||||
{FT_cipher, "aria-256-cfb8", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
{FT_cipher, "camellia-128-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "camellia-128-cbc", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
{FT_cipher, "camellia-128-ecb", enc_main, enc_options},
|
||||
{FT_cipher, "camellia-128-ecb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
{FT_cipher, "camellia-192-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "camellia-192-cbc", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
{FT_cipher, "camellia-192-ecb", enc_main, enc_options},
|
||||
{FT_cipher, "camellia-192-ecb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
{FT_cipher, "camellia-256-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "camellia-256-cbc", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
{FT_cipher, "camellia-256-ecb", enc_main, enc_options},
|
||||
{FT_cipher, "camellia-256-ecb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
{FT_cipher, "base64", enc_main, enc_options},
|
||||
{FT_cipher, "base64", enc_main, enc_options, NULL},
|
||||
#ifdef ZLIB
|
||||
{FT_cipher, "zlib", enc_main, enc_options},
|
||||
{FT_cipher, "zlib", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
{FT_cipher, "des", enc_main, enc_options},
|
||||
{FT_cipher, "des", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
{FT_cipher, "des3", enc_main, enc_options},
|
||||
{FT_cipher, "des3", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
{FT_cipher, "desx", enc_main, enc_options},
|
||||
{FT_cipher, "desx", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_IDEA
|
||||
{FT_cipher, "idea", enc_main, enc_options},
|
||||
{FT_cipher, "idea", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SEED
|
||||
{FT_cipher, "seed", enc_main, enc_options},
|
||||
{FT_cipher, "seed", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC4
|
||||
{FT_cipher, "rc4", enc_main, enc_options},
|
||||
{FT_cipher, "rc4", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC4
|
||||
{FT_cipher, "rc4-40", enc_main, enc_options},
|
||||
{FT_cipher, "rc4-40", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC2
|
||||
{FT_cipher, "rc2", enc_main, enc_options},
|
||||
{FT_cipher, "rc2", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_BF
|
||||
{FT_cipher, "bf", enc_main, enc_options},
|
||||
{FT_cipher, "bf", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAST
|
||||
{FT_cipher, "cast", enc_main, enc_options},
|
||||
{FT_cipher, "cast", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC5
|
||||
{FT_cipher, "rc5", enc_main, enc_options},
|
||||
{FT_cipher, "rc5", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
{FT_cipher, "des-ecb", enc_main, enc_options},
|
||||
{FT_cipher, "des-ecb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
{FT_cipher, "des-ede", enc_main, enc_options},
|
||||
{FT_cipher, "des-ede", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
{FT_cipher, "des-ede3", enc_main, enc_options},
|
||||
{FT_cipher, "des-ede3", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
{FT_cipher, "des-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "des-cbc", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
{FT_cipher, "des-ede-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "des-ede-cbc", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
{FT_cipher, "des-ede3-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "des-ede3-cbc", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
{FT_cipher, "des-cfb", enc_main, enc_options},
|
||||
{FT_cipher, "des-cfb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
{FT_cipher, "des-ede-cfb", enc_main, enc_options},
|
||||
{FT_cipher, "des-ede-cfb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
{FT_cipher, "des-ede3-cfb", enc_main, enc_options},
|
||||
{FT_cipher, "des-ede3-cfb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
{FT_cipher, "des-ofb", enc_main, enc_options},
|
||||
{FT_cipher, "des-ofb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
{FT_cipher, "des-ede-ofb", enc_main, enc_options},
|
||||
{FT_cipher, "des-ede-ofb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DES
|
||||
{FT_cipher, "des-ede3-ofb", enc_main, enc_options},
|
||||
{FT_cipher, "des-ede3-ofb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_IDEA
|
||||
{FT_cipher, "idea-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "idea-cbc", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_IDEA
|
||||
{FT_cipher, "idea-ecb", enc_main, enc_options},
|
||||
{FT_cipher, "idea-ecb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_IDEA
|
||||
{FT_cipher, "idea-cfb", enc_main, enc_options},
|
||||
{FT_cipher, "idea-cfb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_IDEA
|
||||
{FT_cipher, "idea-ofb", enc_main, enc_options},
|
||||
{FT_cipher, "idea-ofb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SEED
|
||||
{FT_cipher, "seed-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "seed-cbc", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SEED
|
||||
{FT_cipher, "seed-ecb", enc_main, enc_options},
|
||||
{FT_cipher, "seed-ecb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SEED
|
||||
{FT_cipher, "seed-cfb", enc_main, enc_options},
|
||||
{FT_cipher, "seed-cfb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SEED
|
||||
{FT_cipher, "seed-ofb", enc_main, enc_options},
|
||||
{FT_cipher, "seed-ofb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC2
|
||||
{FT_cipher, "rc2-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "rc2-cbc", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC2
|
||||
{FT_cipher, "rc2-ecb", enc_main, enc_options},
|
||||
{FT_cipher, "rc2-ecb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC2
|
||||
{FT_cipher, "rc2-cfb", enc_main, enc_options},
|
||||
{FT_cipher, "rc2-cfb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC2
|
||||
{FT_cipher, "rc2-ofb", enc_main, enc_options},
|
||||
{FT_cipher, "rc2-ofb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC2
|
||||
{FT_cipher, "rc2-64-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "rc2-64-cbc", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC2
|
||||
{FT_cipher, "rc2-40-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "rc2-40-cbc", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_BF
|
||||
{FT_cipher, "bf-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "bf-cbc", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_BF
|
||||
{FT_cipher, "bf-ecb", enc_main, enc_options},
|
||||
{FT_cipher, "bf-ecb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_BF
|
||||
{FT_cipher, "bf-cfb", enc_main, enc_options},
|
||||
{FT_cipher, "bf-cfb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_BF
|
||||
{FT_cipher, "bf-ofb", enc_main, enc_options},
|
||||
{FT_cipher, "bf-ofb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAST
|
||||
{FT_cipher, "cast5-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "cast5-cbc", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAST
|
||||
{FT_cipher, "cast5-ecb", enc_main, enc_options},
|
||||
{FT_cipher, "cast5-ecb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAST
|
||||
{FT_cipher, "cast5-cfb", enc_main, enc_options},
|
||||
{FT_cipher, "cast5-cfb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAST
|
||||
{FT_cipher, "cast5-ofb", enc_main, enc_options},
|
||||
{FT_cipher, "cast5-ofb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAST
|
||||
{FT_cipher, "cast-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "cast-cbc", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC5
|
||||
{FT_cipher, "rc5-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "rc5-cbc", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC5
|
||||
{FT_cipher, "rc5-ecb", enc_main, enc_options},
|
||||
{FT_cipher, "rc5-ecb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC5
|
||||
{FT_cipher, "rc5-cfb", enc_main, enc_options},
|
||||
{FT_cipher, "rc5-cfb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC5
|
||||
{FT_cipher, "rc5-ofb", enc_main, enc_options},
|
||||
{FT_cipher, "rc5-ofb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SM4
|
||||
{FT_cipher, "sm4-cbc", enc_main, enc_options},
|
||||
{FT_cipher, "sm4-cbc", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SM4
|
||||
{FT_cipher, "sm4-ecb", enc_main, enc_options},
|
||||
{FT_cipher, "sm4-ecb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SM4
|
||||
{FT_cipher, "sm4-cfb", enc_main, enc_options},
|
||||
{FT_cipher, "sm4-cfb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SM4
|
||||
{FT_cipher, "sm4-ofb", enc_main, enc_options},
|
||||
{FT_cipher, "sm4-ofb", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SM4
|
||||
{FT_cipher, "sm4-ctr", enc_main, enc_options},
|
||||
{FT_cipher, "sm4-ctr", enc_main, enc_options, NULL},
|
||||
#endif
|
||||
{0, NULL, NULL}
|
||||
{0, NULL, NULL, NULL, NULL}
|
||||
};
|
||||
+20
-7
@@ -94,20 +94,33 @@ EOF
|
||||
ciphers => "sock",
|
||||
genrsa => "rsa",
|
||||
rsautl => "rsa",
|
||||
gendsa => "dsa",
|
||||
dsaparam => "dsa",
|
||||
gendh => "dh",
|
||||
dhparam => "dh",
|
||||
ecparam => "ec",
|
||||
pkcs12 => "des",
|
||||
);
|
||||
my %cmd_deprecated = (
|
||||
dhparam => [ "3_0", "pkeyparam", "dh" ],
|
||||
dsaparam => [ "3_0", "pkeyparam", "dsa" ],
|
||||
dsa => [ "3_0", "pkey", "dsa" ],
|
||||
gendsa => [ "3_0", "genpkey", "dsa" ],
|
||||
);
|
||||
|
||||
print "FUNCTION functions[] = {\n";
|
||||
foreach my $cmd ( @ARGV ) {
|
||||
my $str =
|
||||
" {FT_general, \"$cmd\", ${cmd}_main, ${cmd}_options},\n";
|
||||
" {FT_general, \"$cmd\", ${cmd}_main, ${cmd}_options, NULL},\n";
|
||||
if ($cmd =~ /^s_/) {
|
||||
print "#ifndef OPENSSL_NO_SOCK\n${str}#endif\n";
|
||||
} elsif (my $deprecated = $cmd_deprecated{$cmd}) {
|
||||
my @dep = @{$deprecated};
|
||||
print "#if ";
|
||||
if ($dep[2]) {
|
||||
print "!defined(OPENSSL_NO_" . uc($dep[2]) . ") && ";
|
||||
}
|
||||
print "!defined(OPENSSL_NO_DEPRECATED_" . $dep[0] . ")";
|
||||
my $dalt = "\"" . $dep[1] . "\"";
|
||||
$str =~ s/NULL/$dalt/;
|
||||
print "\n${str}#endif\n";
|
||||
} elsif (grep { $cmd eq $_ } @disablables) {
|
||||
print "#ifndef OPENSSL_NO_" . uc($cmd) . "\n${str}#endif\n";
|
||||
} elsif (my $disabler = $cmd_disabler{$cmd}) {
|
||||
@@ -131,7 +144,7 @@ EOF
|
||||
"mdc2", "rmd160", "blake2b512", "blake2s256",
|
||||
"sm3"
|
||||
) {
|
||||
my $str = " {FT_md, \"$cmd\", dgst_main},\n";
|
||||
my $str = " {FT_md, \"$cmd\", dgst_main, NULL, NULL},\n";
|
||||
if (grep { $cmd eq $_ } @disablables) {
|
||||
print "#ifndef OPENSSL_NO_" . uc($cmd) . "\n${str}#endif\n";
|
||||
} elsif (my $disabler = $md_disabler{$cmd}) {
|
||||
@@ -177,7 +190,7 @@ EOF
|
||||
"cast-cbc", "rc5-cbc", "rc5-ecb", "rc5-cfb", "rc5-ofb",
|
||||
"sm4-cbc", "sm4-ecb", "sm4-cfb", "sm4-ofb", "sm4-ctr"
|
||||
) {
|
||||
my $str = " {FT_cipher, \"$cmd\", enc_main, enc_options},\n";
|
||||
my $str = " {FT_cipher, \"$cmd\", enc_main, enc_options, NULL},\n";
|
||||
(my $algo = $cmd) =~ s/-.*//g;
|
||||
if ($cmd eq "zlib") {
|
||||
print "#ifdef ZLIB\n${str}#endif\n";
|
||||
@@ -190,5 +203,5 @@ EOF
|
||||
}
|
||||
}
|
||||
|
||||
print " {0, NULL, NULL}\n};\n";
|
||||
print " {0, NULL, NULL, NULL, NULL}\n};\n";
|
||||
}
|
||||
+13
-13
@@ -99,7 +99,7 @@
|
||||
# include "./testrsa.h"
|
||||
#endif
|
||||
#include <openssl/x509.h>
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
# include <openssl/dsa.h>
|
||||
# include "./testdsa.h"
|
||||
#endif
|
||||
@@ -406,7 +406,7 @@ static const OPT_PAIR doit_choices[] = {
|
||||
|
||||
static double results[ALGOR_NUM][SIZE_NUM];
|
||||
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
enum { R_DSA_512, R_DSA_1024, R_DSA_2048, DSA_NUM };
|
||||
static const OPT_PAIR dsa_choices[DSA_NUM] = {
|
||||
{"dsa512", R_DSA_512},
|
||||
@@ -545,7 +545,7 @@ typedef struct loopargs_st {
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
RSA *rsa_key[RSA_NUM];
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
DSA *dsa_key[DSA_NUM];
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EC
|
||||
@@ -1066,7 +1066,7 @@ static int RSA_verify_loop(void *args)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
static long dsa_c[DSA_NUM][2];
|
||||
static int DSA_sign_loop(void *args)
|
||||
{
|
||||
@@ -1520,7 +1520,7 @@ int speed_main(int argc, char **argv)
|
||||
uint8_t rsa_doit[RSA_NUM] = { 0 };
|
||||
int primes = RSA_DEFAULT_PRIME_NUM;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
static const unsigned int dsa_bits[DSA_NUM] = { 512, 1024, 2048 };
|
||||
uint8_t dsa_doit[DSA_NUM] = { 0 };
|
||||
#endif
|
||||
@@ -1760,7 +1760,7 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
if (strncmp(algo, "dsa", 3) == 0) {
|
||||
if (algo[3] == '\0') {
|
||||
memset(dsa_doit, 1, sizeof(dsa_doit));
|
||||
@@ -1912,7 +1912,7 @@ int speed_main(int argc, char **argv)
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
memset(rsa_doit, 1, sizeof(rsa_doit));
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
memset(dsa_doit, 1, sizeof(dsa_doit));
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EC
|
||||
@@ -1952,7 +1952,7 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
for (i = 0; i < loopargs_len; i++) {
|
||||
loopargs[i].dsa_key[0] = get_dsa(512);
|
||||
loopargs[i].dsa_key[1] = get_dsa(1024);
|
||||
@@ -2120,7 +2120,7 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifndef OPENSSL_NO_DSA
|
||||
# if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
dsa_c[R_DSA_512][0] = count / 1000;
|
||||
dsa_c[R_DSA_512][1] = count / 1000 / 2;
|
||||
for (i = 1; i < DSA_NUM; i++) {
|
||||
@@ -2955,7 +2955,7 @@ int speed_main(int argc, char **argv)
|
||||
if (RAND_bytes(loopargs[i].buf, 36) <= 0)
|
||||
goto end;
|
||||
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
for (testnum = 0; testnum < DSA_NUM; testnum++) {
|
||||
int st = 0;
|
||||
if (!dsa_doit[testnum])
|
||||
@@ -3582,7 +3582,7 @@ int speed_main(int argc, char **argv)
|
||||
rsa_results[k][0], rsa_results[k][1]);
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
testnum = 1;
|
||||
for (k = 0; k < DSA_NUM; k++) {
|
||||
if (!dsa_doit[k])
|
||||
@@ -3695,7 +3695,7 @@ int speed_main(int argc, char **argv)
|
||||
for (k = 0; k < RSA_NUM; k++)
|
||||
RSA_free(loopargs[i].rsa_key[k]);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
for (k = 0; k < DSA_NUM; k++)
|
||||
DSA_free(loopargs[i].dsa_key[k]);
|
||||
#endif
|
||||
@@ -3901,7 +3901,7 @@ static int do_multi(int multi, int size_num)
|
||||
d = atof(sstrsep(&p, sep));
|
||||
rsa_results[k][1] += d;
|
||||
}
|
||||
# ifndef OPENSSL_NO_DSA
|
||||
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
|
||||
else if (strncmp(buf, "+F3:", 4) == 0) {
|
||||
int k;
|
||||
double d;
|
||||
|
||||
+1
-1
@@ -128,7 +128,7 @@ const OPTIONS x509_options[] = {
|
||||
{"setalias", OPT_SETALIAS, 's', "Set certificate alias"},
|
||||
{"days", OPT_DAYS, 'n',
|
||||
"How long till expiry of a signed certificate - def 30 days"},
|
||||
{"signkey", OPT_SIGNKEY, '<', "Self sign cert with arg"},
|
||||
{"signkey", OPT_SIGNKEY, 's', "Self sign cert with arg"},
|
||||
{"set_serial", OPT_SET_SERIAL, 's', "Serial number to use"},
|
||||
{"extensions", OPT_EXTENSIONS, 's', "Section from config file to use"},
|
||||
{"certopt", OPT_CERTOPT, 's', "Various certificate text options"},
|
||||
|
||||
@@ -2995,4 +2995,4 @@ sub deckey()
|
||||
|
||||
&asm_finish();
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -1245,4 +1245,4 @@ while(<SELF>) {
|
||||
close SELF;
|
||||
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT"; # enforce flush
|
||||
close STDOUT or die "error closing STDOUT: $!"; # enforce flush
|
||||
@@ -1378,4 +1378,4 @@ AES_Td4:
|
||||
___
|
||||
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -2203,4 +2203,4 @@ foreach (split("\n",$code)) {
|
||||
print $_,"\n";
|
||||
}
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -1038,4 +1038,4 @@ foreach (split("\n",$code)) {
|
||||
|
||||
print $_,"\n";
|
||||
}
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -1460,4 +1460,4 @@ ___
|
||||
|
||||
$code =~ s/\`([^\`]*)\`/eval $1/gem;
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -2281,4 +2281,4 @@ ___
|
||||
|
||||
$code =~ s/\`([^\`]*)\`/eval $1/gem;
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT"; # force flush
|
||||
close STDOUT or die "error closing STDOUT: $!"; # force flush
|
||||
@@ -1188,4 +1188,4 @@ ___
|
||||
$code =~ s/fmovs.*$//gm;
|
||||
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT"; # ensure flush
|
||||
close STDOUT or die "error closing STDOUT: $!"; # ensure flush
|
||||
@@ -606,6 +606,7 @@ $code.=<<___;
|
||||
asm_AES_encrypt:
|
||||
AES_encrypt:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
mov %rsp,%rax
|
||||
.cfi_def_cfa_register %rax
|
||||
push %rbx
|
||||
@@ -1226,6 +1227,7 @@ $code.=<<___;
|
||||
asm_AES_decrypt:
|
||||
AES_decrypt:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
mov %rsp,%rax
|
||||
.cfi_def_cfa_register %rax
|
||||
push %rbx
|
||||
@@ -1343,6 +1345,7 @@ $code.=<<___;
|
||||
.align 16
|
||||
AES_set_encrypt_key:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
push %rbx
|
||||
.cfi_push %rbx
|
||||
push %rbp
|
||||
@@ -1623,6 +1626,7 @@ $code.=<<___;
|
||||
.align 16
|
||||
AES_set_decrypt_key:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
push %rbx
|
||||
.cfi_push %rbx
|
||||
push %rbp
|
||||
@@ -1737,6 +1741,7 @@ $code.=<<___;
|
||||
asm_AES_cbc_encrypt:
|
||||
AES_cbc_encrypt:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
cmp \$0,%rdx # check length
|
||||
je .Lcbc_epilogue
|
||||
pushfq
|
||||
@@ -2919,4 +2924,4 @@ $code =~ s/\`([^\`]*)\`/eval($1)/gem;
|
||||
|
||||
print $code;
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -1266,4 +1266,4 @@ foreach (split("\n",$code)) {
|
||||
print $_,"\n";
|
||||
}
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -1473,4 +1473,4 @@ $code =~ s/\`([^\`]*)\`/eval($1)/gem;
|
||||
$code =~ s/\b(aes.*%xmm[0-9]+).*$/aesni($1)/gem;
|
||||
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -2145,4 +2145,4 @@ foreach (split("\n",$code)) {
|
||||
|
||||
print $_,"\n";
|
||||
}
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -1801,4 +1801,4 @@ sub rex {
|
||||
$code =~ s/\`([^\`]*)\`/eval $1/gem;
|
||||
$code =~ s/\b(sha256[^\s]*)\s+(.*)/sha256op38($1,$2)/gem;
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -3410,4 +3410,4 @@ my ($l_,$block,$i1,$i3,$i5) = ($rounds_,$key_,$rounds,$len,$out);
|
||||
|
||||
&asm_finish();
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -277,6 +277,7 @@ $code.=<<___;
|
||||
.align 16
|
||||
${PREFIX}_encrypt:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
movups ($inp),$inout0 # load input
|
||||
mov 240($key),$rounds # key->rounds
|
||||
___
|
||||
@@ -295,6 +296,7 @@ $code.=<<___;
|
||||
.align 16
|
||||
${PREFIX}_decrypt:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
movups ($inp),$inout0 # load input
|
||||
mov 240($key),$rounds # key->rounds
|
||||
___
|
||||
@@ -615,6 +617,7 @@ $code.=<<___;
|
||||
.align 16
|
||||
aesni_ecb_encrypt:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
lea -0x58(%rsp),%rsp
|
||||
@@ -987,6 +990,7 @@ $code.=<<___;
|
||||
.align 16
|
||||
aesni_ccm64_encrypt_blocks:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
lea -0x58(%rsp),%rsp
|
||||
@@ -1079,6 +1083,7 @@ $code.=<<___;
|
||||
.align 16
|
||||
aesni_ccm64_decrypt_blocks:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
lea -0x58(%rsp),%rsp
|
||||
@@ -1205,6 +1210,7 @@ $code.=<<___;
|
||||
.align 16
|
||||
aesni_ctr32_encrypt_blocks:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
cmp \$1,$len
|
||||
jne .Lctr32_bulk
|
||||
|
||||
@@ -1777,6 +1783,7 @@ $code.=<<___;
|
||||
.align 16
|
||||
aesni_xts_encrypt:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
lea (%rsp),%r11 # frame pointer
|
||||
.cfi_def_cfa_register %r11
|
||||
push %rbp
|
||||
@@ -2260,6 +2267,7 @@ $code.=<<___;
|
||||
.align 16
|
||||
aesni_xts_decrypt:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
lea (%rsp),%r11 # frame pointer
|
||||
.cfi_def_cfa_register %r11
|
||||
push %rbp
|
||||
@@ -2785,6 +2793,7 @@ $code.=<<___;
|
||||
.align 32
|
||||
aesni_ocb_encrypt:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
lea (%rsp),%rax
|
||||
push %rbx
|
||||
.cfi_push %rbx
|
||||
@@ -3251,6 +3260,7 @@ __ocb_encrypt1:
|
||||
.align 32
|
||||
aesni_ocb_decrypt:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
lea (%rsp),%rax
|
||||
push %rbx
|
||||
.cfi_push %rbx
|
||||
@@ -3739,6 +3749,7 @@ $code.=<<___;
|
||||
.align 16
|
||||
${PREFIX}_cbc_encrypt:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
test $len,$len # check length
|
||||
jz .Lcbc_ret
|
||||
|
||||
@@ -5156,4 +5167,4 @@ $code =~ s/\bmovbe\s+%eax,\s*([0-9]+)\(%rsp\)/movbe($1)/gem;
|
||||
|
||||
print $code;
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -3808,4 +3808,4 @@ foreach(split("\n",$code)) {
|
||||
print $_,"\n";
|
||||
}
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -925,4 +925,4 @@ ___
|
||||
|
||||
&emit_assembler();
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -211,7 +211,12 @@ $code.=<<___;
|
||||
.Loop192:
|
||||
vtbl.8 $key,{$in1},$mask
|
||||
vext.8 $tmp,$zero,$in0,#12
|
||||
#ifdef __ARMEB__
|
||||
vst1.32 {$in1},[$out],#16
|
||||
sub $out,$out,#8
|
||||
#else
|
||||
vst1.32 {$in1},[$out],#8
|
||||
#endif
|
||||
aese $key,$zero
|
||||
subs $bits,$bits,#1
|
||||
|
||||
@@ -1772,8 +1777,11 @@ $code.=<<___;
|
||||
ldr $rounds,[$key,#240]
|
||||
|
||||
ldr $ctr, [$ivp, #12]
|
||||
#ifdef __ARMEB__
|
||||
vld1.8 {$dat0},[$ivp]
|
||||
#else
|
||||
vld1.32 {$dat0},[$ivp]
|
||||
|
||||
#endif
|
||||
vld1.32 {q8-q9},[$key] // load key schedule...
|
||||
sub $rounds,$rounds,#4
|
||||
mov $step,#16
|
||||
@@ -2237,4 +2245,4 @@ if ($flavour =~ /64/) { ######## 64-bit code
|
||||
}
|
||||
}
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -2491,4 +2491,4 @@ close SELF;
|
||||
|
||||
print $code;
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -1616,6 +1616,7 @@ $code.=<<___;
|
||||
.align 16
|
||||
bsaes_cbc_encrypt:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
mov 48(%rsp),$arg6 # pull direction flag
|
||||
@@ -1921,6 +1922,7 @@ $code.=<<___;
|
||||
.align 16
|
||||
bsaes_ctr32_encrypt_blocks:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
mov %rsp, %rax
|
||||
.Lctr_enc_prologue:
|
||||
push %rbp
|
||||
@@ -3238,4 +3240,4 @@ $code =~ s/\`([^\`]*)\`/eval($1)/gem;
|
||||
|
||||
print $code;
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -1278,4 +1278,4 @@ ___
|
||||
} }
|
||||
print $code;
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -1595,4 +1595,4 @@ foreach (split("\n",$code)) {
|
||||
print $_,"\n";
|
||||
}
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -911,4 +911,4 @@ $k_dsbo=0x2c0; # decryption sbox final output
|
||||
|
||||
&asm_finish();
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -698,6 +698,7 @@ _vpaes_schedule_mangle:
|
||||
.align 16
|
||||
${PREFIX}_set_encrypt_key:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
lea -0xb8(%rsp),%rsp
|
||||
@@ -748,6 +749,7 @@ $code.=<<___;
|
||||
.align 16
|
||||
${PREFIX}_set_decrypt_key:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
lea -0xb8(%rsp),%rsp
|
||||
@@ -803,6 +805,7 @@ $code.=<<___;
|
||||
.align 16
|
||||
${PREFIX}_encrypt:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
lea -0xb8(%rsp),%rsp
|
||||
@@ -848,6 +851,7 @@ $code.=<<___;
|
||||
.align 16
|
||||
${PREFIX}_decrypt:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
___
|
||||
$code.=<<___ if ($win64);
|
||||
lea -0xb8(%rsp),%rsp
|
||||
@@ -899,6 +903,7 @@ $code.=<<___;
|
||||
.align 16
|
||||
${PREFIX}_cbc_encrypt:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
xchg $key,$len
|
||||
___
|
||||
($len,$key)=($key,$len);
|
||||
@@ -1240,4 +1245,4 @@ $code =~ s/\`([^\`]*)\`/eval($1)/gem;
|
||||
|
||||
print $code;
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -253,4 +253,4 @@ OPENSSL_instrument_bus2:
|
||||
___
|
||||
}
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -147,4 +147,4 @@ CRYPTO_memcmp:
|
||||
___
|
||||
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -297,4 +297,4 @@ atomic_add_spinlock:
|
||||
___
|
||||
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -199,6 +199,14 @@ static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs)
|
||||
BIO_puts(out, "gostr3411-94");
|
||||
goto err;
|
||||
|
||||
case NID_id_GostR3411_2012_256:
|
||||
BIO_puts(out, "gostr3411-2012-256");
|
||||
goto err;
|
||||
|
||||
case NID_id_GostR3411_2012_512:
|
||||
BIO_puts(out, "gostr3411-2012-512");
|
||||
goto err;
|
||||
|
||||
default:
|
||||
if (have_unknown)
|
||||
write_comma = 0;
|
||||
|
||||
@@ -7,6 +7,12 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* DSA low level APIs are deprecated for public use, but still ok for
|
||||
* internal use.
|
||||
*/
|
||||
#include "internal/deprecated.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/bn.h>
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <stdio.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/serializer.h>
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "crypto/asn1.h"
|
||||
#include "crypto/evp.h"
|
||||
@@ -28,6 +30,36 @@ int i2d_PrivateKey(const EVP_PKEY *a, unsigned char **pp)
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
if (a->pkeys[0].keymgmt != NULL) {
|
||||
const char *serprop = OSSL_SERIALIZER_PrivateKey_TO_DER_PQ;
|
||||
OSSL_SERIALIZER_CTX *ctx =
|
||||
OSSL_SERIALIZER_CTX_new_by_EVP_PKEY(a, serprop);
|
||||
BIO *out = BIO_new(BIO_s_mem());
|
||||
BUF_MEM *buf = NULL;
|
||||
int ret = -1;
|
||||
|
||||
if (ctx != NULL
|
||||
&& out != NULL
|
||||
&& OSSL_SERIALIZER_CTX_get_serializer(ctx) != NULL
|
||||
&& OSSL_SERIALIZER_to_bio(ctx, out)
|
||||
&& BIO_get_mem_ptr(out, &buf) > 0) {
|
||||
ret = buf->length;
|
||||
|
||||
if (pp != NULL) {
|
||||
if (*pp == NULL) {
|
||||
*pp = (unsigned char *)buf->data;
|
||||
buf->length = 0;
|
||||
buf->data = NULL;
|
||||
} else {
|
||||
memcpy(*pp, buf->data, ret);
|
||||
*pp += ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
BIO_free(out);
|
||||
OSSL_SERIALIZER_CTX_free(ctx);
|
||||
return ret;
|
||||
}
|
||||
ASN1err(ASN1_F_I2D_PRIVATEKEY, ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
|
||||
return -1;
|
||||
}
|
||||
@@ -7,6 +7,12 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* DSA low level APIs are deprecated for public use, but still ok for
|
||||
* internal use.
|
||||
*/
|
||||
#include "internal/deprecated.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/bn.h>
|
||||
|
||||
@@ -31,7 +31,7 @@ $tmp4="edx";
|
||||
&cbc("BF_cbc_encrypt","BF_encrypt","BF_decrypt",1,4,5,3,-1,-1);
|
||||
&asm_finish();
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
|
||||
sub BF_encrypt
|
||||
{
|
||||
|
||||
@@ -324,4 +324,4 @@ bn_mul_mont:
|
||||
___
|
||||
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -338,4 +338,4 @@ foreach (split("\n",$code)) {
|
||||
|
||||
print $_,"\n";
|
||||
}
|
||||
close STDOUT or die "error closing STDOUT"; # enforce flush
|
||||
close STDOUT or die "error closing STDOUT: $!"; # enforce flush
|
||||
@@ -763,4 +763,4 @@ foreach (split("\n",$code)) {
|
||||
print $_,"\n";
|
||||
}
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -1514,4 +1514,4 @@ ___
|
||||
|
||||
print $code;
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -30,7 +30,7 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
|
||||
|
||||
&asm_finish();
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
|
||||
sub bn_mul_add_words
|
||||
{
|
||||
|
||||
@@ -156,4 +156,4 @@ $code.=<<___;
|
||||
___
|
||||
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -21,7 +21,7 @@ $output = pop and open STDOUT,">$output";
|
||||
|
||||
&asm_finish();
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
|
||||
sub mul_add_c
|
||||
{
|
||||
|
||||
@@ -858,4 +858,4 @@ ___
|
||||
|
||||
open STDOUT,">$output" if $output;
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -433,4 +433,4 @@ ___
|
||||
$code =~ s/\`([^\`]*)\`/eval $1/gem;
|
||||
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -2262,4 +2262,4 @@ $code.=<<___;
|
||||
.end bn_sqr_comba4
|
||||
___
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -1005,4 +1005,4 @@ foreach (split("\n",$code)) {
|
||||
|
||||
print $_,"\n";
|
||||
}
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -1991,4 +1991,4 @@ ___
|
||||
|
||||
$code =~ s/\`([^\`]*)\`/eval $1/gem;
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -2013,4 +2013,4 @@ Lppcasm_maw_adios:
|
||||
EOF
|
||||
$data =~ s/\`([^\`]*)\`/eval $1/gem;
|
||||
print $data;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -1653,4 +1653,4 @@ ___
|
||||
|
||||
$code =~ s/\`([^\`]*)\`/eval $1/gem;
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -1981,4 +1981,4 @@ rsaz_1024_gather5_avx2:
|
||||
___
|
||||
}}}
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -2430,4 +2430,4 @@ ___
|
||||
|
||||
$code =~ s/\`([^\`]*)\`/eval $1/gem;
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -227,4 +227,4 @@ ___
|
||||
|
||||
$code =~ s/\`([^\`]*)\`/eval($1)/gem;
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -283,4 +283,4 @@ foreach (split("\n",$code)) {
|
||||
s/_dswap\s+(%r[0-9]+)/sprintf("rllg\t%s,%s,32",$1,$1) if($SIZE_T==4)/e;
|
||||
print $_,"\n";
|
||||
}
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -1224,4 +1224,4 @@ ___
|
||||
|
||||
&emit_assembler();
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -196,4 +196,4 @@ ___
|
||||
|
||||
$code =~ s/\`([^\`]*)\`/eval($1)/gem;
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -616,4 +616,4 @@ $code.=<<___;
|
||||
___
|
||||
$code =~ s/\`([^\`]*)\`/eval($1)/gem;
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -886,4 +886,4 @@ $code =~ s/fzeros\s+%f([0-9]+)/
|
||||
|
||||
print $code;
|
||||
# flush
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -247,4 +247,4 @@ $sp=&DWP(28,"esp");
|
||||
|
||||
&asm_finish();
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -380,4 +380,4 @@ foreach (split("\n",$code)) {
|
||||
print $_,"\n";
|
||||
}
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -321,4 +321,4 @@ if ($sse2) {
|
||||
|
||||
&asm_finish();
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -627,4 +627,4 @@ $sbit=$num;
|
||||
|
||||
&asm_finish();
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -423,4 +423,4 @@ ___
|
||||
|
||||
$code =~ s/\`([^\`]*)\`/eval($1)/gem;
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -1591,4 +1591,4 @@ ___
|
||||
}
|
||||
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -3962,4 +3962,4 @@ ___
|
||||
$code =~ s/\`([^\`]*)\`/eval($1)/gem;
|
||||
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -22,6 +22,7 @@
|
||||
# endif
|
||||
|
||||
# include "crypto/bn.h"
|
||||
# include "internal/cryptlib.h"
|
||||
|
||||
/*
|
||||
* These preprocessor symbols control various aspects of the bignum headers
|
||||
|
||||
@@ -284,4 +284,4 @@ bus_loop2_done?:
|
||||
___
|
||||
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -1146,4 +1146,4 @@ my ($s0,$s1,$s2,$s3) = @T;
|
||||
|
||||
&asm_finish();
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -687,6 +687,7 @@ $code.=<<___;
|
||||
.align 16
|
||||
Camellia_cbc_encrypt:
|
||||
.cfi_startproc
|
||||
endbranch
|
||||
cmp \$0,%rdx
|
||||
je .Lcbc_abort
|
||||
push %rbx
|
||||
@@ -1152,4 +1153,4 @@ ___
|
||||
|
||||
$code =~ s/\`([^\`]*)\`/eval $1/gem;
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -935,4 +935,4 @@ ___
|
||||
|
||||
&emit_assembler();
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -45,7 +45,7 @@ $S4="CAST_S_table3";
|
||||
|
||||
&asm_finish();
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
|
||||
sub CAST_encrypt {
|
||||
local($name,$enc)=@_;
|
||||
|
||||
@@ -1166,4 +1166,4 @@ foreach (split("\n",$code)) {
|
||||
|
||||
print $_,"\n";
|
||||
}
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -1289,4 +1289,4 @@ foreach (split("\n",$code)) {
|
||||
|
||||
print $_,"\n";
|
||||
}
|
||||
close STDOUT or die "error closing STDOUT"; # flush
|
||||
close STDOUT or die "error closing STDOUT: $!"; # flush
|
||||
@@ -922,4 +922,4 @@ $code.=<<___;
|
||||
___
|
||||
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -288,4 +288,4 @@ stringz "ChaCha20 for IA64, CRYPTOGAMS by \@dot-asm"
|
||||
___
|
||||
|
||||
print $code;
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -1349,4 +1349,4 @@ foreach (split("\n",$code)) {
|
||||
print $_,"\n";
|
||||
}
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -1151,4 +1151,4 @@ sub XOPROUND {
|
||||
|
||||
&asm_finish();
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -4004,4 +4004,4 @@ foreach (split("\n",$code)) {
|
||||
print $_,"\n";
|
||||
}
|
||||
|
||||
close STDOUT or die "error closing STDOUT";
|
||||
close STDOUT or die "error closing STDOUT: $!";
|
||||
@@ -1,3 +1,3 @@
|
||||
LIBS=../../libcrypto
|
||||
SOURCE[../../libcrypto]= cmp_asn.c cmp_ctx.c cmp_err.c cmp_util.c \
|
||||
cmp_status.c cmp_hdr.c cmp_protect.c cmp_msg.c
|
||||
cmp_status.c cmp_hdr.c cmp_protect.c cmp_msg.c cmp_vfy.c
|
||||
@@ -73,7 +73,8 @@ ASN1_SEQUENCE(OSSL_CMP_ERRORMSGCONTENT) = {
|
||||
IMPLEMENT_ASN1_FUNCTIONS(OSSL_CMP_ERRORMSGCONTENT)
|
||||
|
||||
ASN1_ADB_TEMPLATE(infotypeandvalue_default) = ASN1_OPT(OSSL_CMP_ITAV,
|
||||
infoValue.other, ASN1_ANY);
|
||||
infoValue.other,
|
||||
ASN1_ANY);
|
||||
/* ITAV means InfoTypeAndValue */
|
||||
ASN1_ADB(OSSL_CMP_ITAV) = {
|
||||
/* OSSL_CMP_CMPCERTIFICATE is effectively X509 so it is used directly */
|
||||
|
||||
+56
-5
@@ -80,7 +80,7 @@ int OSSL_CMP_CTX_set1_untrusted_certs(OSSL_CMP_CTX *ctx, STACK_OF(X509) *certs)
|
||||
sk_X509_pop_free(ctx->untrusted_certs, X509_free);
|
||||
ctx->untrusted_certs = untrusted_certs;
|
||||
return 1;
|
||||
err:
|
||||
err:
|
||||
sk_X509_pop_free(untrusted_certs, X509_free);
|
||||
return 0;
|
||||
}
|
||||
@@ -301,7 +301,7 @@ static size_t ossl_cmp_log_trace_cb(const char *buf, size_t cnt,
|
||||
int category, int cmd, void *vdata)
|
||||
{
|
||||
OSSL_CMP_CTX *ctx = vdata;
|
||||
const char *prefix_msg;
|
||||
const char *msg;
|
||||
OSSL_CMP_severity level = -1;
|
||||
char *func = NULL;
|
||||
char *file = NULL;
|
||||
@@ -312,14 +312,14 @@ static size_t ossl_cmp_log_trace_cb(const char *buf, size_t cnt,
|
||||
if (ctx->log_cb == NULL)
|
||||
return 1; /* silently drop message */
|
||||
|
||||
prefix_msg = ossl_cmp_log_parse_metadata(buf, &level, &func, &file, &line);
|
||||
msg = ossl_cmp_log_parse_metadata(buf, &level, &func, &file, &line);
|
||||
|
||||
if (level > ctx->log_verbosity) /* excludes the case level is unknown */
|
||||
goto end; /* suppress output since severity is not sufficient */
|
||||
|
||||
if (!ctx->log_cb(func != NULL ? func : "(no func)",
|
||||
file != NULL ? file : "(no file)",
|
||||
line, level, prefix_msg))
|
||||
line, level, msg))
|
||||
cnt = 0;
|
||||
|
||||
end:
|
||||
@@ -329,6 +329,57 @@ static size_t ossl_cmp_log_trace_cb(const char *buf, size_t cnt,
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Print CMP log messages (i.e., diagnostic info) via the log cb of the ctx */
|
||||
int ossl_cmp_print_log(OSSL_CMP_severity level, const OSSL_CMP_CTX *ctx,
|
||||
const char *func, const char *file, int line,
|
||||
const char *level_str, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
char hugebuf[1024 * 2];
|
||||
int res = 0;
|
||||
|
||||
if (ctx == NULL || ctx->log_cb == NULL)
|
||||
return 1; /* silently drop message */
|
||||
|
||||
if (level > ctx->log_verbosity) /* excludes the case level is unknown */
|
||||
return 1; /* suppress output since severity is not sufficient */
|
||||
|
||||
if (format == NULL)
|
||||
return 0;
|
||||
|
||||
va_start(args, format);
|
||||
|
||||
if (func == NULL)
|
||||
func = "(unset function name)";
|
||||
if (file == NULL)
|
||||
file = "(unset file name)";
|
||||
if (level_str == NULL)
|
||||
level_str = "(unset level string)";
|
||||
|
||||
#ifndef OPENSSL_NO_TRACE
|
||||
if (OSSL_TRACE_ENABLED(CMP)) {
|
||||
OSSL_TRACE_BEGIN(CMP) {
|
||||
int printed =
|
||||
BIO_snprintf(hugebuf, sizeof(hugebuf),
|
||||
"%s:%s:%d:" OSSL_CMP_LOG_PREFIX "%s: ",
|
||||
func, file, line, level_str);
|
||||
if (printed > 0 && (size_t)printed < sizeof(hugebuf)) {
|
||||
if (BIO_vsnprintf(hugebuf + printed,
|
||||
sizeof(hugebuf) - printed, format, args) > 0)
|
||||
res = BIO_puts(trc_out, hugebuf) > 0;
|
||||
}
|
||||
} OSSL_TRACE_END(CMP);
|
||||
}
|
||||
#else /* compensate for disabled trace API */
|
||||
{
|
||||
if (BIO_vsnprintf(hugebuf, sizeof(hugebuf), format, args) > 0)
|
||||
res = ctx->log_cb(func, file, line, level, hugebuf);
|
||||
}
|
||||
#endif
|
||||
va_end(args);
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set a callback function for error reporting and logging messages.
|
||||
* Returns 1 on success, 0 on error
|
||||
@@ -768,7 +819,7 @@ int OSSL_CMP_CTX_set1_transactionID(OSSL_CMP_CTX *ctx,
|
||||
* returns 1 on success, 0 on error
|
||||
*/
|
||||
int ossl_cmp_ctx_set1_recipNonce(OSSL_CMP_CTX *ctx,
|
||||
const ASN1_OCTET_STRING *nonce)
|
||||
const ASN1_OCTET_STRING *nonce)
|
||||
{
|
||||
if (!ossl_assert(ctx != NULL))
|
||||
return 0;
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#ifndef OPENSSL_NO_ERR
|
||||
|
||||
static const ERR_STRING_DATA CMP_str_reasons[] = {
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_ALGORITHM_NOT_SUPPORTED),
|
||||
"algorithm not supported"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_BAD_REQUEST_ID), "bad request id"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_CERTID_NOT_FOUND), "certid not found"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_CERTIFICATE_NOT_FOUND),
|
||||
@@ -50,6 +52,10 @@ static const ERR_STRING_DATA CMP_str_reasons[] = {
|
||||
"error protecting message"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_ERROR_SETTING_CERTHASH),
|
||||
"error setting certhash"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_ERROR_VALIDATING_PROTECTION),
|
||||
"error validating protection"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_FAILED_EXTRACTING_PUBKEY),
|
||||
"failed extracting pubkey"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_FAILURE_OBTAINING_RANDOM),
|
||||
"failure obtaining random"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_FAIL_INFO_OUT_OF_RANGE),
|
||||
@@ -57,19 +63,38 @@ static const ERR_STRING_DATA CMP_str_reasons[] = {
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_INVALID_ARGS), "invalid args"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_MISSING_KEY_INPUT_FOR_CREATING_PROTECTION),
|
||||
"missing key input for creating protection"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_MISSING_KEY_USAGE_DIGITALSIGNATURE),
|
||||
"missing key usage digitalsignature"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_MISSING_PRIVATE_KEY),
|
||||
"missing private key"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_MISSING_PROTECTION), "missing protection"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_MISSING_SENDER_IDENTIFICATION),
|
||||
"missing sender identification"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_MISSING_TRUST_STORE),
|
||||
"missing trust store"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_MULTIPLE_SAN_SOURCES),
|
||||
"multiple san sources"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_NO_STDIO), "no stdio"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_NO_SUITABLE_SENDER_CERT),
|
||||
"no suitable sender cert"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_NULL_ARGUMENT), "null argument"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_PKIBODY_ERROR), "pkibody error"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_PKISTATUSINFO_NOT_FOUND),
|
||||
"pkistatusinfo not found"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_POTENTIALLY_INVALID_CERTIFICATE),
|
||||
"potentially invalid certificate"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_RECIPNONCE_UNMATCHED),
|
||||
"recipnonce unmatched"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_REQUEST_NOT_ACCEPTED),
|
||||
"request not accepted"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_SENDER_GENERALNAME_TYPE_NOT_SUPPORTED),
|
||||
"sender generalname type not supported"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_SRVCERT_DOES_NOT_VALIDATE_MSG),
|
||||
"srvcert does not validate msg"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_TRANSACTIONID_UNMATCHED),
|
||||
"transactionid unmatched"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_UNEXPECTED_PKIBODY), "unexpected pkibody"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_UNEXPECTED_PVNO), "unexpected pvno"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_UNKNOWN_ALGORITHM_ID),
|
||||
"unknown algorithm id"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_UNKNOWN_CERT_TYPE), "unknown cert type"},
|
||||
@@ -77,8 +102,11 @@ static const ERR_STRING_DATA CMP_str_reasons[] = {
|
||||
"unsupported algorithm"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_UNSUPPORTED_KEY_TYPE),
|
||||
"unsupported key type"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_UNSUPPORTED_PROTECTION_ALG_DHBASEDMAC),
|
||||
"unsupported protection alg dhbasedmac"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_WRONG_ALGORITHM_OID),
|
||||
"wrong algorithm oid"},
|
||||
{ERR_PACK(ERR_LIB_CMP, 0, CMP_R_WRONG_PBM_VALUE), "wrong pbm value"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
|
||||
+129
-52
@@ -48,16 +48,23 @@ struct ossl_cmp_ctx_st {
|
||||
void *http_cb_arg; /* allows to store optional argument to cb */
|
||||
|
||||
/* server authentication */
|
||||
int unprotectedErrors; /* accept neg. response with no/invalid protection */
|
||||
/* to cope with broken server */
|
||||
/*
|
||||
* unprotectedErrors may be set as workaround for broken server responses:
|
||||
* accept missing or invalid protection of regular error messages, negative
|
||||
* certificate responses (ip/cp/kup), revocation responses (rp), and PKIConf
|
||||
*/
|
||||
int unprotectedErrors;
|
||||
X509 *srvCert; /* certificate used to identify the server */
|
||||
X509 *validatedSrvCert; /* caches any already validated server cert */
|
||||
X509_NAME *expected_sender; /* expected sender in pkiheader of response */
|
||||
X509_STORE *trusted; /* trust store maybe w CRLs and cert verify callback */
|
||||
STACK_OF(X509) *untrusted_certs; /* untrusted (intermediate) certs */
|
||||
int ignore_keyusage; /* ignore key usage entry when validating certs */
|
||||
int permitTAInExtraCertsForIR; /* allow use of root certs in extracerts */
|
||||
/* when validating message protection; used for 3GPP-style E.7 */
|
||||
/*
|
||||
* permitTAInExtraCertsForIR allows use of root certs in extracerts
|
||||
* when validating message protection; this is used for 3GPP-style E.7
|
||||
*/
|
||||
int permitTAInExtraCertsForIR;
|
||||
|
||||
/* client authentication */
|
||||
int unprotectedSend; /* send unprotected PKI messages */
|
||||
@@ -536,68 +543,108 @@ typedef struct ossl_cmp_pkibody_st {
|
||||
OSSL_CMP_CERTREPMESSAGE *ip; /* 1 */
|
||||
OSSL_CRMF_MSGS *cr; /* 2 */
|
||||
OSSL_CMP_CERTREPMESSAGE *cp; /* 3 */
|
||||
/* p10cr [4] CertificationRequest, --imported from [PKCS10] */
|
||||
/*
|
||||
/*-
|
||||
* p10cr [4] CertificationRequest, --imported from [PKCS10]
|
||||
*
|
||||
* PKCS10_CERTIFICATIONREQUEST is effectively X509_REQ
|
||||
* so it is used directly
|
||||
*/
|
||||
X509_REQ *p10cr; /* 4 */
|
||||
/* popdecc [5] POPODecKeyChallContent, --pop Challenge */
|
||||
/* POPODecKeyChallContent ::= SEQUENCE OF Challenge */
|
||||
/*-
|
||||
* popdecc [5] POPODecKeyChallContent, --pop Challenge
|
||||
*
|
||||
* POPODecKeyChallContent ::= SEQUENCE OF Challenge
|
||||
*/
|
||||
OSSL_CMP_POPODECKEYCHALLCONTENT *popdecc; /* 5 */
|
||||
/* popdecr [6] POPODecKeyRespContent, --pop Response */
|
||||
/* POPODecKeyRespContent ::= SEQUENCE OF INTEGER */
|
||||
/*-
|
||||
* popdecr [6] POPODecKeyRespContent, --pop Response
|
||||
*
|
||||
* POPODecKeyRespContent ::= SEQUENCE OF INTEGER
|
||||
*/
|
||||
OSSL_CMP_POPODECKEYRESPCONTENT *popdecr; /* 6 */
|
||||
OSSL_CRMF_MSGS *kur; /* 7 */
|
||||
OSSL_CMP_CERTREPMESSAGE *kup; /* 8 */
|
||||
OSSL_CRMF_MSGS *krr; /* 9 */
|
||||
|
||||
/* krp [10] KeyRecRepContent, --Key Recovery Response */
|
||||
/*-
|
||||
* krp [10] KeyRecRepContent, --Key Recovery Response
|
||||
*/
|
||||
OSSL_CMP_KEYRECREPCONTENT *krp; /* 10 */
|
||||
/* rr [11] RevReqContent, --Revocation Request */
|
||||
/*-
|
||||
* rr [11] RevReqContent, --Revocation Request
|
||||
*/
|
||||
OSSL_CMP_REVREQCONTENT *rr; /* 11 */
|
||||
/* rp [12] RevRepContent, --Revocation Response */
|
||||
/*-
|
||||
* rp [12] RevRepContent, --Revocation Response
|
||||
*/
|
||||
OSSL_CMP_REVREPCONTENT *rp; /* 12 */
|
||||
/* ccr [13] CertReqMessages, --Cross-Cert. Request */
|
||||
/*-
|
||||
* ccr [13] CertReqMessages, --Cross-Cert. Request
|
||||
*/
|
||||
OSSL_CRMF_MSGS *ccr; /* 13 */
|
||||
/* ccp [14] CertRepMessage, --Cross-Cert. Response */
|
||||
/*-
|
||||
* ccp [14] CertRepMessage, --Cross-Cert. Response
|
||||
*/
|
||||
OSSL_CMP_CERTREPMESSAGE *ccp; /* 14 */
|
||||
/* ckuann [15] CAKeyUpdAnnContent, --CA Key Update Ann. */
|
||||
/*-
|
||||
* ckuann [15] CAKeyUpdAnnContent, --CA Key Update Ann.
|
||||
*/
|
||||
OSSL_CMP_CAKEYUPDANNCONTENT *ckuann; /* 15 */
|
||||
/* cann [16] CertAnnContent, --Certificate Ann. */
|
||||
/* OSSL_CMP_CMPCERTIFICATE is effectively X509 so it is used directly */
|
||||
X509 *cann; /* 16 */
|
||||
/* rann [17] RevAnnContent, --Revocation Ann. */
|
||||
/*-
|
||||
* cann [16] CertAnnContent, --Certificate Ann.
|
||||
* OSSL_CMP_CMPCERTIFICATE is effectively X509 so it is used directly
|
||||
*/
|
||||
X509 *cann; /* 16 */
|
||||
/*-
|
||||
* rann [17] RevAnnContent, --Revocation Ann.
|
||||
*/
|
||||
OSSL_CMP_REVANNCONTENT *rann; /* 17 */
|
||||
/* crlann [18] CRLAnnContent, --CRL Announcement */
|
||||
/* CRLAnnContent ::= SEQUENCE OF CertificateList */
|
||||
OSSL_CMP_CRLANNCONTENT *crlann;
|
||||
/* PKIConfirmContent ::= NULL */
|
||||
/* pkiconf [19] PKIConfirmContent, --Confirmation */
|
||||
/* OSSL_CMP_PKICONFIRMCONTENT would be only a typedef of ASN1_NULL */
|
||||
/* OSSL_CMP_CONFIRMCONTENT *pkiconf; */
|
||||
/*
|
||||
/*-
|
||||
* crlann [18] CRLAnnContent, --CRL Announcement
|
||||
* CRLAnnContent ::= SEQUENCE OF CertificateList
|
||||
*/
|
||||
OSSL_CMP_CRLANNCONTENT *crlann; /* 18 */
|
||||
/*-
|
||||
* PKIConfirmContent ::= NULL
|
||||
* pkiconf [19] PKIConfirmContent, --Confirmation
|
||||
* OSSL_CMP_PKICONFIRMCONTENT would be only a typedef of ASN1_NULL
|
||||
* OSSL_CMP_CONFIRMCONTENT *pkiconf;
|
||||
*
|
||||
* NOTE: this should ASN1_NULL according to the RFC
|
||||
* but there might be a struct in it when sent from faulty servers...
|
||||
*/
|
||||
ASN1_TYPE *pkiconf; /* 19 */
|
||||
/* nested [20] NestedMessageContent, --Nested Message */
|
||||
/* NestedMessageContent ::= PKIMessages */
|
||||
/*-
|
||||
* nested [20] NestedMessageContent, --Nested Message
|
||||
* NestedMessageContent ::= PKIMessages
|
||||
*/
|
||||
OSSL_CMP_MSGS *nested; /* 20 */
|
||||
/* genm [21] GenMsgContent, --General Message */
|
||||
/* GenMsgContent ::= SEQUENCE OF InfoTypeAndValue */
|
||||
/*-
|
||||
* genm [21] GenMsgContent, --General Message
|
||||
* GenMsgContent ::= SEQUENCE OF InfoTypeAndValue
|
||||
*/
|
||||
OSSL_CMP_GENMSGCONTENT *genm; /* 21 */
|
||||
/* genp [22] GenRepContent, --General Response */
|
||||
/* GenRepContent ::= SEQUENCE OF InfoTypeAndValue */
|
||||
/*-
|
||||
* genp [22] GenRepContent, --General Response
|
||||
* GenRepContent ::= SEQUENCE OF InfoTypeAndValue
|
||||
*/
|
||||
OSSL_CMP_GENREPCONTENT *genp; /* 22 */
|
||||
/* error [23] ErrorMsgContent, --Error Message */
|
||||
/*-
|
||||
* error [23] ErrorMsgContent, --Error Message
|
||||
*/
|
||||
OSSL_CMP_ERRORMSGCONTENT *error; /* 23 */
|
||||
/* certConf [24] CertConfirmContent, --Certificate confirm */
|
||||
/*-
|
||||
* certConf [24] CertConfirmContent, --Certificate confirm
|
||||
*/
|
||||
OSSL_CMP_CERTCONFIRMCONTENT *certConf; /* 24 */
|
||||
/* pollReq [25] PollReqContent, --Polling request */
|
||||
OSSL_CMP_POLLREQCONTENT *pollReq;
|
||||
/* pollRep [26] PollRepContent --Polling response */
|
||||
OSSL_CMP_POLLREPCONTENT *pollRep;
|
||||
/*-
|
||||
* pollReq [25] PollReqContent, --Polling request
|
||||
*/
|
||||
OSSL_CMP_POLLREQCONTENT *pollReq; /* 25 */
|
||||
/*-
|
||||
* pollRep [26] PollRepContent --Polling response
|
||||
*/
|
||||
OSSL_CMP_POLLREPCONTENT *pollRep; /* 26 */
|
||||
} value;
|
||||
} OSSL_CMP_PKIBODY;
|
||||
DECLARE_ASN1_FUNCTIONS(OSSL_CMP_PKIBODY)
|
||||
@@ -699,18 +746,15 @@ int ossl_cmp_asn1_get_int(const ASN1_INTEGER *a);
|
||||
const char *ossl_cmp_log_parse_metadata(const char *buf,
|
||||
OSSL_CMP_severity *level, char **func,
|
||||
char **file, int *line);
|
||||
/* workaround for 4096 bytes limitation of ERR_print_errors_cb() */
|
||||
void ossl_cmp_add_error_txt(const char *separator, const char *txt);
|
||||
# define ossl_cmp_add_error_data(txt) ossl_cmp_add_error_txt(" : ", txt)
|
||||
# define ossl_cmp_add_error_line(txt) ossl_cmp_add_error_txt("\n", txt)
|
||||
# define ossl_cmp_add_error_data(txt) ERR_add_error_txt(" : ", txt)
|
||||
# define ossl_cmp_add_error_line(txt) ERR_add_error_txt("\n", txt)
|
||||
/* functions manipulating lists of certificates etc could be generally useful */
|
||||
int ossl_cmp_sk_X509_add1_cert (STACK_OF(X509) *sk, X509 *cert,
|
||||
int no_dup, int prepend);
|
||||
int ossl_cmp_sk_X509_add1_cert(STACK_OF(X509) *sk, X509 *cert,
|
||||
int no_dup, int prepend);
|
||||
int ossl_cmp_sk_X509_add1_certs(STACK_OF(X509) *sk, STACK_OF(X509) *certs,
|
||||
int no_self_signed, int no_dups, int prepend);
|
||||
int no_self_issued, int no_dups, int prepend);
|
||||
int ossl_cmp_X509_STORE_add1_certs(X509_STORE *store, STACK_OF(X509) *certs,
|
||||
int only_self_signed);
|
||||
STACK_OF(X509) *ossl_cmp_X509_STORE_get1_certs(X509_STORE *store);
|
||||
int only_self_issued);
|
||||
int ossl_cmp_asn1_octet_string_set1(ASN1_OCTET_STRING **tgt,
|
||||
const ASN1_OCTET_STRING *src);
|
||||
int ossl_cmp_asn1_octet_string_set1_bytes(ASN1_OCTET_STRING **tgt,
|
||||
@@ -718,6 +762,31 @@ int ossl_cmp_asn1_octet_string_set1_bytes(ASN1_OCTET_STRING **tgt,
|
||||
STACK_OF(X509) *ossl_cmp_build_cert_chain(STACK_OF(X509) *certs, X509 *cert);
|
||||
|
||||
/* from cmp_ctx.c */
|
||||
int ossl_cmp_print_log(OSSL_CMP_severity level, const OSSL_CMP_CTX *ctx,
|
||||
const char *func, const char *file, int line,
|
||||
const char *level_str, const char *format, ...);
|
||||
# define ossl_cmp_log(level, ctx, msg) \
|
||||
ossl_cmp_print_log(OSSL_CMP_LOG_##level, ctx, OPENSSL_FUNC, OPENSSL_FILE, \
|
||||
OPENSSL_LINE, #level, "%s", msg)
|
||||
# define ossl_cmp_log1(level, ctx, fmt, arg1) \
|
||||
ossl_cmp_print_log(OSSL_CMP_LOG_##level, ctx, OPENSSL_FUNC, OPENSSL_FILE, \
|
||||
OPENSSL_LINE, #level, fmt, arg1)
|
||||
# define ossl_cmp_log2(level, ctx, fmt, arg1, arg2) \
|
||||
ossl_cmp_print_log(OSSL_CMP_LOG_##level, ctx, OPENSSL_FUNC, OPENSSL_FILE, \
|
||||
OPENSSL_LINE, #level, fmt, arg1, arg2)
|
||||
# define ossl_cmp_log3(level, ctx, fmt, arg1, arg2, arg3) \
|
||||
ossl_cmp_print_log(OSSL_CMP_LOG_##level, ctx, OPENSSL_FUNC, OPENSSL_FILE, \
|
||||
OPENSSL_LINE, #level, fmt, arg1, arg2, arg3)
|
||||
# define ossl_cmp_log4(level, ctx, fmt, arg1, arg2, arg3, arg4) \
|
||||
ossl_cmp_print_log(OSSL_CMP_LOG_##level, ctx, OPENSSL_FUNC, OPENSSL_FILE, \
|
||||
OPENSSL_LINE, #level, fmt, arg1, arg2, arg3, arg4)
|
||||
# define OSSL_CMP_LOG_ERROR OSSL_CMP_LOG_ERR
|
||||
# define OSSL_CMP_LOG_WARN OSSL_CMP_LOG_WARNING
|
||||
# define ossl_cmp_alert(ctx, msg) ossl_cmp_log(ALERT, ctx, msg)
|
||||
# define ossl_cmp_err(ctx, msg) ossl_cmp_log(ERROR, ctx, msg)
|
||||
# define ossl_cmp_warn(ctx, msg) ossl_cmp_log(WARN, ctx, msg)
|
||||
# define ossl_cmp_info(ctx, msg) ossl_cmp_log(INFO, ctx, msg)
|
||||
# define ossl_cmp_debug(ctx, msg) ossl_cmp_log(DEBUG, ctx, msg)
|
||||
int ossl_cmp_ctx_set0_validatedSrvCert(OSSL_CMP_CTX *ctx, X509 *cert);
|
||||
int ossl_cmp_ctx_set_status(OSSL_CMP_CTX *ctx, int status);
|
||||
int ossl_cmp_ctx_set0_statusString(OSSL_CMP_CTX *ctx,
|
||||
@@ -825,7 +894,7 @@ OSSL_CMP_MSG *ossl_cmp_pollRep_new(OSSL_CMP_CTX *ctx, int crid,
|
||||
OSSL_CMP_PKISI *
|
||||
ossl_cmp_revrepcontent_get_pkistatusinfo(OSSL_CMP_REVREPCONTENT *rrep, int rsid);
|
||||
OSSL_CRMF_CERTID *ossl_cmp_revrepcontent_get_CertId(OSSL_CMP_REVREPCONTENT *rrep,
|
||||
int rsid);
|
||||
int rsid);
|
||||
OSSL_CMP_POLLREP *
|
||||
ossl_cmp_pollrepcontent_get0_pollrep(const OSSL_CMP_POLLREPCONTENT *prc,
|
||||
int rid);
|
||||
@@ -836,9 +905,9 @@ X509 *ossl_cmp_certresponse_get1_certificate(EVP_PKEY *privkey,
|
||||
const OSSL_CMP_CERTRESPONSE *crep);
|
||||
OSSL_CMP_MSG *ossl_cmp_msg_load(const char *file);
|
||||
/* BIO definitions */
|
||||
# define OSSL_d2i_CMP_MSG_bio(bp, p) \
|
||||
# define OSSL_d2i_CMP_MSG_bio(bp, p) \
|
||||
ASN1_d2i_bio_of(OSSL_CMP_MSG, OSSL_CMP_MSG_new, d2i_OSSL_CMP_MSG, bp, p)
|
||||
# define OSSL_i2d_CMP_MSG_bio(bp, o) \
|
||||
# define OSSL_i2d_CMP_MSG_bio(bp, o) \
|
||||
ASN1_i2d_bio_of(OSSL_CMP_MSG, i2d_OSSL_CMP_MSG, bp, o)
|
||||
|
||||
/* from cmp_protect.c */
|
||||
@@ -848,4 +917,12 @@ ASN1_BIT_STRING *ossl_cmp_calc_protection(const OSSL_CMP_MSG *msg,
|
||||
int ossl_cmp_msg_add_extraCerts(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg);
|
||||
int ossl_cmp_msg_protect(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg);
|
||||
|
||||
/* from cmp_vfy.c */
|
||||
typedef int (*ossl_cmp_allow_unprotected_cb_t)(const OSSL_CMP_CTX *ctx,
|
||||
const OSSL_CMP_MSG *msg,
|
||||
int invalid_protection, int arg);
|
||||
int ossl_cmp_msg_check_received(OSSL_CMP_CTX *ctx, const OSSL_CMP_MSG *msg,
|
||||
ossl_cmp_allow_unprotected_cb_t cb, int cb_arg);
|
||||
int ossl_cmp_verify_popo(const OSSL_CMP_MSG *msg, int accept_RAVerified);
|
||||
|
||||
#endif /* !defined OSSL_CRYPTO_CMP_LOCAL_H */
|
||||
@@ -232,7 +232,7 @@ static OSSL_CRMF_MSG *crm_new(OSSL_CMP_CTX *ctx, int bodytype,
|
||||
*/
|
||||
|| !OSSL_CRMF_CERTTEMPLATE_fill(OSSL_CRMF_MSG_get0_tmpl(crm), rkey,
|
||||
subject, ctx->issuer,
|
||||
NULL/* serial */))
|
||||
NULL /* serial */))
|
||||
goto err;
|
||||
if (ctx->days != 0) {
|
||||
time_t notBefore, notAfter;
|
||||
@@ -442,8 +442,8 @@ OSSL_CMP_MSG *ossl_cmp_rr_new(OSSL_CMP_CTX *ctx)
|
||||
|
||||
/* Fill the template from the contents of the certificate to be revoked */
|
||||
if (!OSSL_CRMF_CERTTEMPLATE_fill(rd->certDetails,
|
||||
NULL/* pubkey would be redundant */,
|
||||
NULL/* subject would be redundant */,
|
||||
NULL /* pubkey would be redundant */,
|
||||
NULL /* subject would be redundant */,
|
||||
X509_get_issuer_name(ctx->oldCert),
|
||||
X509_get_serialNumber(ctx->oldCert)))
|
||||
goto err;
|
||||
@@ -569,7 +569,7 @@ int ossl_cmp_msg_gen_push1_ITAVs(OSSL_CMP_MSG *msg,
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < sk_OSSL_CMP_ITAV_num(itavs); i++) {
|
||||
if ((itav = OSSL_CMP_ITAV_dup(sk_OSSL_CMP_ITAV_value(itavs,i))) == NULL)
|
||||
if ((itav = OSSL_CMP_ITAV_dup(sk_OSSL_CMP_ITAV_value(itavs, i))) == NULL)
|
||||
return 0;
|
||||
if (!ossl_cmp_msg_gen_push0_ITAV(msg, itav)) {
|
||||
OSSL_CMP_ITAV_free(itav);
|
||||
@@ -643,8 +643,8 @@ OSSL_CMP_MSG *ossl_cmp_error_new(OSSL_CMP_CTX *ctx, OSSL_CMP_PKISI *si,
|
||||
}
|
||||
if (errorDetails != NULL)
|
||||
if ((msg->body->value.error->errorDetails =
|
||||
sk_ASN1_UTF8STRING_deep_copy(errorDetails, ASN1_STRING_dup,
|
||||
ASN1_STRING_free)) == NULL)
|
||||
sk_ASN1_UTF8STRING_deep_copy(errorDetails, ASN1_STRING_dup,
|
||||
ASN1_STRING_free)) == NULL)
|
||||
goto err;
|
||||
|
||||
if (!unprotected && !ossl_cmp_msg_protect(ctx, msg))
|
||||
|
||||
@@ -156,7 +156,7 @@ int ossl_cmp_msg_add_extraCerts(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg)
|
||||
STACK_OF(X509) *chain =
|
||||
ossl_cmp_build_cert_chain(ctx->untrusted_certs, ctx->clCert);
|
||||
int res = ossl_cmp_sk_X509_add1_certs(msg->extraCerts, chain,
|
||||
1 /* no self-signed */,
|
||||
1 /* no self-issued */,
|
||||
1 /* no duplicates */, 0);
|
||||
sk_X509_pop_free(chain, X509_free);
|
||||
if (res == 0)
|
||||
|
||||
@@ -61,7 +61,7 @@ const char *ossl_cmp_PKIStatus_to_string(int status)
|
||||
char buf[40];
|
||||
BIO_snprintf(buf, sizeof(buf), "PKIStatus: invalid=%d", status);
|
||||
CMPerr(0, CMP_R_ERROR_PARSING_PKISTATUS);
|
||||
ossl_cmp_add_error_data(buf);
|
||||
ERR_add_error_data(1, buf);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -195,7 +195,7 @@ char *OSSL_CMP_CTX_snprint_PKIStatus(OSSL_CMP_CTX *ctx, char *buf,
|
||||
int printed_chars;
|
||||
int failinfo_found = 0;
|
||||
int n_status_strings;
|
||||
char* write_ptr = buf;
|
||||
char *write_ptr = buf;
|
||||
|
||||
#define ADVANCE_BUFFER \
|
||||
if (printed_chars < 0 || (size_t)printed_chars >= bufsize) \
|
||||
|
||||
+57
-142
@@ -69,7 +69,8 @@ static OSSL_CMP_severity parse_level(const char *level)
|
||||
}
|
||||
|
||||
const char *ossl_cmp_log_parse_metadata(const char *buf,
|
||||
OSSL_CMP_severity *level, char **func, char **file, int *line)
|
||||
OSSL_CMP_severity *level,
|
||||
char **func, char **file, int *line)
|
||||
{
|
||||
const char *p_func = buf;
|
||||
const char *p_file = buf == NULL ? NULL : strchr(buf, ':');
|
||||
@@ -106,129 +107,75 @@ const char *ossl_cmp_log_parse_metadata(const char *buf,
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
#define UNKNOWN_FUNC "(unknown function)" /* the default for OPENSSL_FUNC */
|
||||
/*
|
||||
* auxiliary function for incrementally reporting texts via the error queue
|
||||
* substitute fallback if component/function name is NULL or empty or contains
|
||||
* just pseudo-information "(unknown function)" due to -pedantic and macros.h
|
||||
*/
|
||||
static void put_error(int lib, const char *func, int reason,
|
||||
const char *file, int line)
|
||||
static const char *improve_location_name(const char *func, const char *fallback)
|
||||
{
|
||||
ERR_new();
|
||||
ERR_set_debug(file, line, func);
|
||||
ERR_set_error(lib, reason, NULL /* no data here, so fmt is NULL */);
|
||||
if (!ossl_assert(fallback != NULL))
|
||||
return NULL;
|
||||
return func == NULL || *func == '\0' || strcmp(func, UNKNOWN_FUNC) == 0
|
||||
? fallback : func;
|
||||
}
|
||||
|
||||
#define ERR_print_errors_cb_LIMIT 4096 /* size of char buf[] variable there */
|
||||
#define TYPICAL_MAX_OUTPUT_BEFORE_DATA 100
|
||||
#define MAX_DATA_LEN (ERR_print_errors_cb_LIMIT-TYPICAL_MAX_OUTPUT_BEFORE_DATA)
|
||||
void ossl_cmp_add_error_txt(const char *separator, const char *txt)
|
||||
int OSSL_CMP_print_to_bio(BIO *bio, const char *component, const char *file,
|
||||
int line, OSSL_CMP_severity level, const char *msg)
|
||||
{
|
||||
const char *file = NULL;
|
||||
int line;
|
||||
const char *func = NULL;
|
||||
const char *data = NULL;
|
||||
int flags;
|
||||
unsigned long err = ERR_peek_last_error();
|
||||
const char *level_string =
|
||||
level == OSSL_CMP_LOG_EMERG ? "EMERG" :
|
||||
level == OSSL_CMP_LOG_ALERT ? "ALERT" :
|
||||
level == OSSL_CMP_LOG_CRIT ? "CRIT" :
|
||||
level == OSSL_CMP_LOG_ERR ? "error" :
|
||||
level == OSSL_CMP_LOG_WARNING ? "warning" :
|
||||
level == OSSL_CMP_LOG_NOTICE ? "NOTE" :
|
||||
level == OSSL_CMP_LOG_INFO ? "info" :
|
||||
level == OSSL_CMP_LOG_DEBUG ? "DEBUG" : "(unknown level)";
|
||||
|
||||
if (separator == NULL)
|
||||
separator = "";
|
||||
if (err == 0)
|
||||
put_error(ERR_LIB_CMP, NULL, 0, "", 0);
|
||||
|
||||
do {
|
||||
size_t available_len, data_len;
|
||||
const char *curr = txt, *next = txt;
|
||||
char *tmp;
|
||||
|
||||
ERR_peek_last_error_all(&file, &line, &func, &data, &flags);
|
||||
if ((flags & ERR_TXT_STRING) == 0) {
|
||||
data = "";
|
||||
separator = "";
|
||||
}
|
||||
data_len = strlen(data);
|
||||
|
||||
/* workaround for limit of ERR_print_errors_cb() */
|
||||
if (data_len >= MAX_DATA_LEN
|
||||
|| strlen(separator) >= (size_t)(MAX_DATA_LEN - data_len))
|
||||
available_len = 0;
|
||||
else
|
||||
available_len = MAX_DATA_LEN - data_len - strlen(separator) - 1;
|
||||
/* MAX_DATA_LEN > available_len >= 0 */
|
||||
|
||||
if (separator[0] == '\0') {
|
||||
const size_t len_next = strlen(next);
|
||||
|
||||
if (len_next <= available_len) {
|
||||
next += len_next;
|
||||
curr = NULL; /* no need to split */
|
||||
}
|
||||
else {
|
||||
next += available_len;
|
||||
curr = next; /* will split at this point */
|
||||
}
|
||||
} else {
|
||||
while (*next != '\0' && (size_t)(next - txt) <= available_len) {
|
||||
curr = next;
|
||||
next = strstr(curr, separator);
|
||||
if (next != NULL)
|
||||
next += strlen(separator);
|
||||
else
|
||||
next = curr + strlen(curr);
|
||||
}
|
||||
if ((size_t)(next - txt) <= available_len)
|
||||
curr = NULL; /* the above loop implies *next == '\0' */
|
||||
}
|
||||
if (curr != NULL) {
|
||||
/* split error msg at curr since error data would get too long */
|
||||
if (curr != txt) {
|
||||
tmp = OPENSSL_strndup(txt, curr - txt);
|
||||
if (tmp == NULL)
|
||||
return;
|
||||
ERR_add_error_data(2, separator, tmp);
|
||||
OPENSSL_free(tmp);
|
||||
}
|
||||
put_error(ERR_LIB_CMP, func, err, file, line);
|
||||
txt = curr;
|
||||
} else {
|
||||
ERR_add_error_data(2, separator, txt);
|
||||
txt = next; /* finished */
|
||||
}
|
||||
} while (*txt != '\0');
|
||||
#ifndef NDEBUG
|
||||
if (BIO_printf(bio, "%s:%s:%d:", improve_location_name(component, "CMP"),
|
||||
file, line) < 0)
|
||||
return 0;
|
||||
#endif
|
||||
return BIO_printf(bio, OSSL_CMP_LOG_PREFIX"%s: %s\n",
|
||||
level_string, msg) >= 0;
|
||||
}
|
||||
|
||||
#define ERR_PRINT_BUF_SIZE 4096
|
||||
/* this is similar to ERR_print_errors_cb, but uses the CMP-specific cb type */
|
||||
void OSSL_CMP_print_errors_cb(OSSL_cmp_log_cb_t log_fn)
|
||||
{
|
||||
unsigned long err;
|
||||
char msg[ERR_print_errors_cb_LIMIT];
|
||||
char msg[ERR_PRINT_BUF_SIZE];
|
||||
const char *file = NULL, *func = NULL, *data = NULL;
|
||||
int line, flags;
|
||||
|
||||
if (log_fn == NULL) {
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
ERR_print_errors_fp(stderr);
|
||||
#else
|
||||
/* CMPerr(0, CMP_R_NO_STDIO) makes no sense during error printing */
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
while ((err = ERR_get_error_all(&file, &line, &func, &data, &flags)) != 0) {
|
||||
char component[128];
|
||||
const char *func_ = func != NULL && *func != '\0' ? func : "<unknown>";
|
||||
const char *component =
|
||||
improve_location_name(func, ERR_lib_error_string(err));
|
||||
|
||||
if (!(flags & ERR_TXT_STRING))
|
||||
data = NULL;
|
||||
#ifdef OSSL_CMP_PRINT_LIBINFO
|
||||
BIO_snprintf(component, sizeof(component), "OpenSSL:%s:%s",
|
||||
ERR_lib_error_string(err), func_);
|
||||
#else
|
||||
BIO_snprintf(component, sizeof(component), "%s",func_);
|
||||
#endif
|
||||
BIO_snprintf(msg, sizeof(msg), "%s%s%s", ERR_reason_error_string(err),
|
||||
data == NULL ? "" : " : ", data == NULL ? "" : data);
|
||||
if (log_fn(component, file, line, OSSL_CMP_LOG_ERR, msg) <= 0)
|
||||
break; /* abort outputting the error report */
|
||||
data == NULL || *data == '\0' ? "" : " : ",
|
||||
data == NULL ? "" : data);
|
||||
if (log_fn == NULL) {
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
BIO *bio = BIO_new_fp(stderr, BIO_NOCLOSE);
|
||||
|
||||
if (bio != NULL) {
|
||||
OSSL_CMP_print_to_bio(bio, component, file, line,
|
||||
OSSL_CMP_LOG_ERR, msg);
|
||||
BIO_free(bio);
|
||||
}
|
||||
#else
|
||||
/* CMPerr(0, CMP_R_NO_STDIO) makes no sense during error printing */
|
||||
#endif
|
||||
} else {
|
||||
if (log_fn(component, file, line, OSSL_CMP_LOG_ERR, msg) <= 0)
|
||||
break; /* abort outputting the error report */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,7 +213,7 @@ int ossl_cmp_sk_X509_add1_cert(STACK_OF(X509) *sk, X509 *cert,
|
||||
}
|
||||
|
||||
int ossl_cmp_sk_X509_add1_certs(STACK_OF(X509) *sk, STACK_OF(X509) *certs,
|
||||
int no_self_signed, int no_dups, int prepend)
|
||||
int no_self_issued, int no_dups, int prepend)
|
||||
/* compiler would allow 'const' for the list of certs, yet they are up-ref'ed */
|
||||
{
|
||||
int i;
|
||||
@@ -278,7 +225,7 @@ int ossl_cmp_sk_X509_add1_certs(STACK_OF(X509) *sk, STACK_OF(X509) *certs,
|
||||
for (i = 0; i < sk_X509_num(certs); i++) { /* certs may be NULL */
|
||||
X509 *cert = sk_X509_value(certs, i);
|
||||
|
||||
if (!no_self_signed || X509_check_issued(cert, cert) != X509_V_OK) {
|
||||
if (!no_self_issued || X509_check_issued(cert, cert) != X509_V_OK) {
|
||||
if (!ossl_cmp_sk_X509_add1_cert(sk, cert, no_dups, prepend))
|
||||
return 0;
|
||||
}
|
||||
@@ -287,7 +234,7 @@ int ossl_cmp_sk_X509_add1_certs(STACK_OF(X509) *sk, STACK_OF(X509) *certs,
|
||||
}
|
||||
|
||||
int ossl_cmp_X509_STORE_add1_certs(X509_STORE *store, STACK_OF(X509) *certs,
|
||||
int only_self_signed)
|
||||
int only_self_issued)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -300,45 +247,13 @@ int ossl_cmp_X509_STORE_add1_certs(X509_STORE *store, STACK_OF(X509) *certs,
|
||||
for (i = 0; i < sk_X509_num(certs); i++) {
|
||||
X509 *cert = sk_X509_value(certs, i);
|
||||
|
||||
if (!only_self_signed || X509_check_issued(cert, cert) == X509_V_OK)
|
||||
if (!only_self_issued || X509_check_issued(cert, cert) == X509_V_OK)
|
||||
if (!X509_STORE_add_cert(store, cert)) /* ups cert ref counter */
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
STACK_OF(X509) *ossl_cmp_X509_STORE_get1_certs(X509_STORE *store)
|
||||
{
|
||||
int i;
|
||||
STACK_OF(X509) *sk;
|
||||
STACK_OF(X509_OBJECT) *objs;
|
||||
|
||||
if (store == NULL) {
|
||||
CMPerr(0, CMP_R_NULL_ARGUMENT);
|
||||
return 0;
|
||||
}
|
||||
if ((sk = sk_X509_new_null()) == NULL)
|
||||
return NULL;
|
||||
objs = X509_STORE_get0_objects(store);
|
||||
for (i = 0; i < sk_X509_OBJECT_num(objs); i++) {
|
||||
X509 *cert = X509_OBJECT_get0_X509(sk_X509_OBJECT_value(objs, i));
|
||||
|
||||
if (cert != NULL) {
|
||||
if (!sk_X509_push(sk, cert))
|
||||
goto err;
|
||||
if (!X509_up_ref(cert)) {
|
||||
(void)sk_X509_pop(sk);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
}
|
||||
return sk;
|
||||
|
||||
err:
|
||||
sk_X509_pop_free(sk, X509_free);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*-
|
||||
* Builds up the certificate chain of certs as high up as possible using
|
||||
* the given list of certs containing all possible intermediate certificates and
|
||||
@@ -390,10 +305,10 @@ STACK_OF(X509) *ossl_cmp_build_cert_chain(STACK_OF(X509) *certs, X509 *cert)
|
||||
|
||||
chain = X509_STORE_CTX_get0_chain(csc);
|
||||
|
||||
/* result list to store the up_ref'ed not self-signed certificates */
|
||||
/* result list to store the up_ref'ed not self-issued certificates */
|
||||
if ((result = sk_X509_new_null()) == NULL)
|
||||
goto err;
|
||||
if (!ossl_cmp_sk_X509_add1_certs(result, chain, 1 /* no self-signed */,
|
||||
if (!ossl_cmp_sk_X509_add1_certs(result, chain, 1 /* no self-issued */,
|
||||
1 /* no duplicates */, 0)) {
|
||||
sk_X509_free(result);
|
||||
result = NULL;
|
||||
@@ -438,7 +353,7 @@ int ossl_cmp_asn1_octet_string_set1_bytes(ASN1_OCTET_STRING **tgt,
|
||||
return 0;
|
||||
}
|
||||
if (bytes != NULL) {
|
||||
if ((new = ASN1_OCTET_STRING_new()) == NULL
|
||||
if ((new = ASN1_OCTET_STRING_new()) == NULL
|
||||
|| !(ASN1_OCTET_STRING_set(new, bytes, len))) {
|
||||
ASN1_OCTET_STRING_free(new);
|
||||
return 0;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user